xorg-server-1.20.8/0000755000175000017500000000000013640201535011065 500000000000000xorg-server-1.20.8/Makefile.am0000644000175000017500000000744313640201473013052 00000000000000AUTOMAKE_OPTIONS=nostdinc # Required for automake < 1.14 ACLOCAL_AMFLAGS = -I m4 if COMPOSITE COMPOSITE_DIR=composite endif if GLX GLX_DIR=glx endif if DBE DBE_DIR=dbe endif if RECORD RECORD_DIR=record endif if DRI3 DRI3_DIR=dri3 endif if PRESENT PRESENT_DIR=present endif if PSEUDORAMIX PSEUDORAMIX_DIR=pseudoramiX endif if GLAMOR GLAMOR_DIR=glamor endif SUBDIRS = \ doc \ man \ include \ dix \ fb \ mi \ Xext \ miext \ os \ randr \ render \ Xi \ xkb \ $(PSEUDORAMIX_DIR) \ $(DBE_DIR) \ $(RECORD_DIR) \ xfixes \ damageext \ $(COMPOSITE_DIR) \ $(GLX_DIR) \ $(PRESENT_DIR) \ $(DRI3_DIR) \ exa \ $(GLAMOR_DIR) \ config \ hw \ test if XORG aclocaldir = $(datadir)/aclocal aclocal_DATA = xorg-server.m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = xorg-server.pc endif EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh README.md DISTCHECK_CONFIGURE_FLAGS=\ --with-xkb-path=$(XKB_BASE_DIRECTORY) \ --with-xkb-bin-directory=$(XKB_BIN_DIRECTORY) \ --with-xkb-output='$${datadir}/X11/xkb/compiled' .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL DIST_SUBDIRS = \ doc \ man \ include \ dix \ fb \ mi \ Xext \ miext \ os \ pseudoramiX \ randr \ render \ Xi \ xkb \ dbe \ record \ xfixes \ damageext \ composite \ glx \ exa \ glamor \ config \ dri3 \ present \ hw \ test # gross hack relink: all $(AM_V_at)$(MAKE) -C hw relink install-headers: Makefile +find . -name Makefile | while read m; do \ if grep -q install-sdkHEADERS $$m; then \ (cd `dirname "$$m"` && make install-sdkHEADERS) \ fi \ done distcheck-hook: cd $(srcdir) && \ meson setup _distcheck_build && \ meson configure _distcheck_build && \ ninja -C _distcheck_build && \ rm -rf _distcheck_build && \ cd - EXTRA_DIST += \ meson_options.txt \ include/xorg-config.h.meson.in \ include/xwin-config.h.meson.in \ hw/xfree86/loader/symbol-test.c \ hw/xfree86/common/xf86Build.sh \ composite/meson.build \ config/meson.build \ damageext/meson.build \ dbe/meson.build \ dix/meson.build \ dri3/meson.build \ exa/meson.build \ fb/meson.build \ glamor/meson.build \ glx/meson.build \ hw/dmx/config/meson.build \ hw/dmx/examples/meson.build \ hw/dmx/glxProxy/meson.build \ hw/dmx/input/meson.build \ hw/dmx/meson.build \ hw/kdrive/ephyr/meson.build \ hw/kdrive/meson.build \ hw/kdrive/src/meson.build \ hw/meson.build \ hw/vfb/meson.build \ hw/xfree86/common/meson.build \ hw/xfree86/ddc/meson.build \ hw/xfree86/dixmods/meson.build \ hw/xfree86/dri2/meson.build \ hw/xfree86/dri/meson.build \ hw/xfree86/drivers/modesetting/meson.build \ hw/xfree86/exa/meson.build \ hw/xfree86/fbdevhw/meson.build \ hw/xfree86/glamor_egl/meson.build \ hw/xfree86/i2c/meson.build \ hw/xfree86/int10/meson.build \ hw/xfree86/loader/meson.build \ hw/xfree86/meson.build \ hw/xfree86/modes/meson.build \ hw/xfree86/os-support/meson.build \ hw/xfree86/parser/meson.build \ hw/xfree86/ramdac/meson.build \ hw/xfree86/shadowfb/meson.build \ hw/xfree86/vbe/meson.build \ hw/xfree86/vgahw/meson.build \ hw/xfree86/x86emu/meson.build \ hw/xfree86/xkb/meson.build \ hw/xnest/meson.build \ hw/xquartz/meson.build \ hw/xwayland/meson.build \ hw/xwin/dri/meson.build \ hw/xwin/glx/meson.build \ hw/xwin/meson.build \ hw/xwin/winclipboard/meson.build \ include/meson.build \ meson.build \ miext/damage/meson.build \ miext/shadow/meson.build \ miext/sync/meson.build \ mi/meson.build \ os/meson.build \ present/meson.build \ pseudoramiX/meson.build \ randr/meson.build \ record/meson.build \ render/meson.build \ test/bigreq/meson.build \ test/bigreq/request-length.c \ test/meson.build \ test/sync/meson.build \ test/sync/sync.c \ Xext/meson.build \ xfixes/meson.build \ Xi/meson.build \ xkb/meson.build xorg-server-1.20.8/configure.ac0000644000175000017500000027053713640201473013312 00000000000000dnl 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 dnl Daniel Stone dnl an unwitting cast of miscellaneous others dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) AC_INIT([xorg-server], 1.20.8, [https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server) RELEASE_DATE="2020-03-29" RELEASE_NAME="Chicken Parmigiana" AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AC_USE_SYSTEM_EXTENSIONS # Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.14 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.14) XORG_DEFAULT_OPTIONS XORG_WITH_DOXYGEN(1.6.1) XORG_CHECK_SGML_DOCTOOLS(1.8) XORG_ENABLE_DOCS XORG_ENABLE_DEVEL_DOCS XORG_WITH_XMLTO(0.0.20) XORG_WITH_FOP XORG_WITH_XSLTPROC XORG_ENABLE_UNIT_TESTS XORG_LD_WRAP([optional]) m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install font-util 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 xwayland-config.h covers Xwayland. AC_CONFIG_HEADERS(include/xwayland-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 LT_PREREQ([2.2]) LT_INIT([disable-static win32-dll]) 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 Explicitly add -fno-strict-aliasing since this option should disappear dnl from util-macros CWARNFLAGS if test "x$GCC" = xyes ; then XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing" fi dnl Check for dtrace program (needed to build Xserver dtrace probes) dnl Also checks for , 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/mkdev.h sys/sysmacros.h sys/utsname.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_TYPEOF AC_C_BIGENDIAN(AC_DEFINE(X_BYTE_ORDER, X_BIG_ENDIAN, [byte order]), AC_DEFINE(X_BYTE_ORDER, X_LITTLE_ENDIAN, [byte order])) 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 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_CHECK_FUNCS([backtrace geteuid getuid issetugid getresuid \ getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \ mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \ walkcontext setitimer poll epoll_create1 mkostemp memfd_create isastream]) AC_CONFIG_LIBOBJ_DIR([os]) AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\ timingsafe_memcmp]) AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"]) AC_CHECK_LIB([bsd], [arc4random_buf]) AC_CHECK_FUNCS([arc4random_buf]) AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include ]]) dnl Check for SO_PEERCRED #define AC_CACHE_CHECK([for SO_PEERCRED in sys/socket.h], [xorg_cv_sys_have_so_peercred], [AC_EGREP_CPP(yes_have_so_peercred,[ #include #include #ifdef SO_PEERCRED yes_have_so_peercred #endif ], [xorg_cv_sys_have_so_peercred=yes], [xorg_cv_sys_have_so_peercred=no])]) dnl define NO_LOCAL_CLIENT_CRED if no getpeereid, getpeerucred or SO_PEERCRED if test "x$ac_cv_func_getpeereid" = xno && test "x$ac_cv_func_getpeerucred" = xno && test "x$xorg_cv_sys_have_so_peercred" = xno ; then AC_DEFINE([NO_LOCAL_CLIENT_CRED], 1, [Define to 1 if no local socket credentials interface exists]) fi dnl Find the math libary, then check for cbrt function in it. AC_CHECK_LIB(m, sqrt) AC_CHECK_FUNCS([cbrt]) 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 fbdev header AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes) AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes]) 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 ]) AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes]) AC_CACHE_CHECK([for SYSV IPC], ac_cv_sysv_ipc, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include ]],[[ { int id; id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR); 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 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 --------------------------------------------------------------------------- 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 DEFAULT_INT10="stub" ;; 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 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*) DRI=yes ;; darwin*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;; cygwin*|mingw*) CFLAGS="$CFLAGS -DFD_SETSIZE=512" ;; 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" 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_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" ] [ ]) AC_ARG_ENABLE(listen-tcp, AS_HELP_STRING([--enable-listen-tcp], [Listen on TCP by default (default:disabled)]), [LISTEN_TCP=$enableval], [LISTEN_TCP=no]) AC_ARG_ENABLE(listen-unix, AS_HELP_STRING([--disable-listen-unix], [Listen on Unix by default (default:enabled)]), [LISTEN_UNIX=$enableval], [LISTEN_UNIX=yes]) AC_ARG_ENABLE(listen-local, AS_HELP_STRING([--disable-listen-local], [Listen on local by default (default:enabled)]), [LISTEN_LOCAL=$enableval], [LISTEN_LOCAL=yes]) case $host_os in linux*) FALLBACK_INPUT_DRIVER="libinput" ;; *) FALLBACK_INPUT_DRIVER="" ;; esac AC_ARG_WITH(fallback-input-driver, AC_HELP_STRING([--with-fallback-input-driver=$FALLBACK_INPUT_DRIVER], [Input driver fallback if the requested driver for a device is unavailable]), [ FALLBACK_INPUT_DRIVER=$withval ], []) if test "x$FALLBACK_INPUT_DRIVER" = "xno"; then FALLBACK_INPUT_DRIVER="" fi AC_MSG_CHECKING([for fallback input driver]) AC_MSG_RESULT([$FALLBACK_INPUT_DRIVER]) AC_DEFINE_UNQUOTED(FALLBACK_INPUT_DRIVER, ["$FALLBACK_INPUT_DRIVER"], [ Fallback input driver ]) 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 --with-default-font-path if set, otherwise uses standard dnl subdirectories of FONTROOTDIR. Some distros set the default font path to dnl "catalogue:/etc/X11/fontpath.d,built-ins" DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/" case $host_os in darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; esac 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: auto)]), [ XKBPATH="$withval" ], [ XKBPATH="auto" ]) 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(bundle-id-prefix, AS_HELP_STRING([--with-bundle-id-prefix=RDNS_PREFIX], [Prefix to use for bundle identifiers (default: org.x)]), [ BUNDLE_ID_PREFIX="${withval}" ]) AC_SUBST([BUNDLE_ID_PREFIX]) AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers]) m4_define(DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | cut -f1-3 -d. | tr -d '\n'])) AC_ARG_WITH(bundle-version, AS_HELP_STRING([--with-bundle-version=VERSION], [Version to use for X11.app's CFBundleVersion (default: ]DEFAULT_BUNDLE_VERSION[)]), [ BUNDLE_VERSION="${withval}" ], [ BUNDLE_VERSION="DEFAULT_BUNDLE_VERSION" ]) AC_SUBST([BUNDLE_VERSION]) AC_ARG_WITH(bundle-version-string, AS_HELP_STRING([--with-bundle-version-string=VERSION], [Version to use for X11.app's CFBundleShortVersionString (default: ]AC_PACKAGE_VERSION[)]), [ BUNDLE_VERSION_STRING="${withval}" ], [ BUNDLE_VERSION_STRING="${PACKAGE_VERSION}" ]) AC_SUBST([BUNDLE_VERSION_STRING]) 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_WITH(sparkle-feed-url, AS_HELP_STRING([--with-sparkle-feed-url=URL], [URL for the Sparkle feed (default: https://www.xquartz.org/releases/sparkle/release.xml)]), [ XQUARTZ_SPARKLE_FEED_URL="${withval}" ], [ XQUARTZ_SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle/release.xml" ]) AC_SUBST([XQUARTZ_SPARKLE_FEED_URL]) AC_ARG_ENABLE(visibility, AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]), [SYMBOL_VISIBILITY=$enableval], [SYMBOL_VISIBILITY=auto]) dnl GLX build options AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Path to Khronos OpenGL registry database files (default: auto)]), [KHRONOS_SPEC_DIR="${withval}"], [KHRONOS_SPEC_DIR=auto]) dnl Extensions. 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-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto]) 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(dri3, AS_HELP_STRING([--enable-dri3], [Build DRI3 extension (default: auto)]), [DRI3=$enableval], [DRI3=auto]) AC_ARG_ENABLE(present, AS_HELP_STRING([--disable-present], [Build Present extension (default: enabled)]), [PRESENT=$enableval], [PRESENT=yes]) 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(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-udev-kms, AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto]) 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(config-wscons, AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=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(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(windowsdri, AS_HELP_STRING([--enable-windowsdri], [Build XWin with WindowsDRI extension (default: auto)]), [WINDOWSDRI=$enableval], [WINDOWSDRI=auto]) AC_ARG_ENABLE(libdrm, AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes]) AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes]) AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes]) AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto]) AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no]) 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: no)]), [DMX=$enableval], [DMX=no]) 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(xwayland, AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto]) AC_ARG_ENABLE(xwayland-eglstream, AS_HELP_STRING([--enable-xwayland-eglstream], [Build Xwayland eglstream support (default: no)]), [XWAYLAND_EGLSTREAM=$enableval], [XWAYLAND_EGLSTREAM=no]) 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]) AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: auto)]), [GLAMOR=$enableval], [GLAMOR=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]) dnl kdrive options AC_ARG_ENABLE(libunwind, AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"]) AC_ARG_ENABLE(xshmfence, AS_HELP_STRING([--disable-xshmfence], [Disable xshmfence (default: auto)]), [XSHMFENCE="$enableval"], [XSHMFENCE="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" ;; mingw*) 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]) 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* | mingw*) CONFIG_HAL=no CONFIG_UDEV=no CONFIG_UDEV_KMS=no DGA=no DRM=no DRI2=no DRI3=no INT10MODULE=no PCI=no VGAHW=no VBE=no XF86UTILS=no XF86VIDMODE=no XSELINUX=no SYMBOL_VISIBILITY=no ;; darwin*) PCI=no INT10MODULE=no VGAHW=no VBE=no DRM=no DRI2=no DRI3=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([AC_LANG_SOURCE([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 AC_CHECK_FUNC(dispatch_async, AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]), []) if test "x$XQUARTZ" = xyes ; then XQUARTZ=yes XVFB=no XNEST=no XWAYLAND=no COMPOSITE=no DGA=no DPMSExtension=no XF86VIDMODE=no fi ;; gnu*) DRM=no DRI2=no DRI3=no ;; *) XQUARTZ=no ;; esac dnl --------------------------------------------------------------------------- dnl Extension section dnl --------------------------------------------------------------------------- XEXT_INC='-I$(top_srcdir)/Xext' XEXT_LIB='$(top_builddir)/Xext/libXext.la' dnl Optional modules VIDEOPROTO="videoproto" COMPOSITEPROTO="compositeproto >= 0.4" RECORDPROTO="recordproto >= 1.13.99.1" SCRNSAVERPROTO="scrnsaverproto >= 1.1" RESOURCEPROTO="resourceproto >= 1.2.0" DRIPROTO="xf86driproto >= 2.1.0" DRI2PROTO="dri2proto >= 2.8" DRI3PROTO="dri3proto >= 1.2" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" DGAPROTO="xf86dgaproto >= 2.0.99.1" GLPROTO="glproto >= 1.4.17" DMXPROTO="dmxproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" WINDOWSWMPROTO="windowswmproto" APPLEWMPROTO="applewmproto >= 1.4" LIBXSHMFENCE="xshmfence >= 1.1" dnl Required modules XPROTO="xproto >= 7.0.31" RANDRPROTO="randrproto >= 1.6.0" RENDERPROTO="renderproto >= 0.11" XEXTPROTO="xextproto >= 7.2.99.901" INPUTPROTO="inputproto >= 2.3" KBPROTO="kbproto >= 1.0.3" FONTSPROTO="fontsproto >= 2.1.3" FIXESPROTO="fixesproto >= 5.0" DAMAGEPROTO="damageproto >= 1.1" XCMISCPROTO="xcmiscproto >= 1.2.0" BIGREQSPROTO="bigreqsproto >= 1.1.0" XTRANS="xtrans >= 1.3.5" PRESENTPROTO="presentproto >= 1.1" 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.4.89" LIBEGL="egl" LIBGBM="gbm >= 10.2.0" LIBGL="gl >= 1.2" LIBXEXT="xext >= 1.0.99.4" LIBXFONT="xfont2 >= 2.0.0" LIBXI="xi >= 1.2.99.1" LIBXTST="xtst >= 1.0.99.2" LIBPCIACCESS="pciaccess >= 0.12.901" LIBUDEV="libudev >= 143" LIBSELINUX="libselinux >= 2.0.86" LIBDBUS="dbus-1 >= 1.0" LIBPIXMAN="pixman-1 >= 0.27.2" 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" dnl Core modules for most extensions, et al. SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $KBPROTO $FONTSPROTO $LIBPIXMAN" # Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc AC_SUBST(SDK_REQUIRED_MODULES) AC_CHECK_DECL([PTHREAD_MUTEX_RECURSIVE], [HAVE_RECURSIVE_MUTEX=yes], [HAVE_RECURSIVE_MUTEX=no], [[#include ]]) THREAD_DEFAULT=no if test "x$HAVE_RECURSIVE_MUTEX" = "xyes" ; then THREAD_DEFAULT=yes fi AC_ARG_ENABLE(input-thread, AS_HELP_STRING([--enable-input-thread], [Enable input threads]), [INPUTTHREAD=$enableval], [INPUTTHREAD=$THREAD_DEFAULT]) if test "x$INPUTTHREAD" = "xyes" ; then AX_PTHREAD(,AC_MSG_ERROR([threaded input requested but no pthread support has been found])) SYS_LIBS="$SYS_LIBS $PTHREAD_LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" AC_DEFINE(INPUTTHREAD, 1, [Use a separate input thread]) save_LIBS="$LIBS" LIBS="$LIBS $SYS_LIBS" dnl MacOS X 10.6 & higher AC_MSG_CHECKING(for pthread_setname_np(const char*)) AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [pthread_setname_np("example")])], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1, [Have function pthread_setname_np(const char*)])], [AC_MSG_RESULT(no)]) dnl GNU libc 2.12 & higher, Solaris 11.3 & higher AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*)) AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [pthread_setname_np(pthread_self(), "example")])], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1, [Have function pthread_setname_np(pthread_t, const char*)])], [AC_MSG_RESULT(no)]) LIBS="$save_LIBS" fi REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES" dnl systemd socket activation dnl activate the code in libxtrans that grabs systemd's socket fds dnl libsystemd-daemon was moved into libsystemd in version 209 LIBSYSTEMD="libsystemd >= 209" AC_ARG_WITH([systemd-daemon], AS_HELP_STRING([--with-systemd-daemon], [support systemd socket activation (default: auto)]), [WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto]) if test "x$WITH_SYSTEMD_DAEMON" = "xyes" -o "x$WITH_SYSTEMD_DAEMON" = "xauto" ; then PKG_CHECK_MODULES([SYSTEMD_DAEMON], [$LIBSYSTEMD], [HAVE_SYSTEMD_DAEMON=yes; LIBSYSTEMD_DAEMON="$LIBSYSTEMD"], [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], [HAVE_SYSTEMD_DAEMON=yes; LIBSYSTEMD_DAEMON=libsystemd-daemon], [HAVE_SYSTEMD_DAEMON=no])]) if test "x$HAVE_SYSTEMD_DAEMON" = xyes; then AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available]) REQUIRED_LIBS="$REQUIRED_LIBS $LIBSYSTEMD_DAEMON" elif test "x$WITH_SYSTEMD_DAEMON" = xyes; then AC_MSG_ERROR([systemd support requested but no library has been found]) fi fi AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"]) if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then AC_MSG_ERROR([Hotplugging through both libudev and 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" AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.]) fi AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes]) if test "x$CONFIG_UDEV" = xyes; then CONFIG_HAL=no if test "x$CONFIG_UDEV_KMS" = xauto; then CONFIG_UDEV_KMS="$HAVE_LIBUDEV" fi 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]) if test "x$CONFIG_UDEV_KMS" = xyes; then AC_DEFINE(CONFIG_UDEV_KMS, 1, [Use libudev for kms enumeration]) fi SAVE_LIBS=$LIBS SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $UDEV_CFLAGS" LIBS=$UDEV_LIBS AC_CHECK_FUNCS([udev_monitor_filter_add_match_tag]) AC_CHECK_FUNCS([udev_enumerate_add_match_tag]) LIBS=$SAVE_LIBS CFLAGS=$SAVE_CFLAGS fi AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes]) 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]) 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]) NEED_DBUS="yes" fi AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes]) if test "x$SYSTEMD_LOGIND" = xauto; then if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then SYSTEMD_LOGIND=yes else SYSTEMD_LOGIND=no fi fi if test "x$SYSTEMD_LOGIND" = xyes; then if ! test "x$HAVE_DBUS" = xyes; then AC_MSG_ERROR([systemd-logind requested, but D-Bus is not installed.]) fi if ! test "x$CONFIG_UDEV" = xyes ; then AC_MSG_ERROR([systemd-logind is only supported in combination with udev configuration.]) fi AC_DEFINE(SYSTEMD_LOGIND, 1, [Enable systemd-logind integration]) NEED_DBUS="yes" fi AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes]) if test "x$SUID_WRAPPER" = xyes; then dnl This is a define so that if some platforms want to put the wrapper dnl somewhere else this can be easily changed AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install the Xorg binary and Xorg.wrap]) SETUID="no" fi AM_CONDITIONAL(SUID_WRAPPER, [test "x$SUID_WRAPPER" = xyes]) if test "x$NEED_DBUS" = xyes; then AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core]) fi AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes]) if test "x$CONFIG_WSCONS" = xauto; then case $host_os in *openbsd*) CONFIG_WSCONS=yes; ;; *) CONFIG_WSCONS=no; ;; esac fi AM_CONDITIONAL(CONFIG_WSCONS, [test "x$CONFIG_WSCONS" = xyes]) if test "x$CONFIG_WSCONS" = xyes; then AC_DEFINE(CONFIG_WSCONS, 1, [Use wscons for input auto configuration]) fi AC_MSG_CHECKING([for glibc...]) AC_PREPROC_IFELSE([AC_LANG_SOURCE([ #include #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([AC_LANG_SOURCE([ #include 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"]) if test "$MONOTONIC_CLOCK" = "cross compiling"; then AC_CHECK_DECL([CLOCK_MONOTONIC],[MONOTONIC_CLOCK="guessing yes"],[MONOTONIC_CLOCK=no],[#include ]) fi LIBS="$LIBS_SAVE" CPPFLAGS="$CPPFLAGS_SAVE" else MONOTONIC_CLOCK=no fi AC_MSG_RESULT([$MONOTONIC_CLOCK]) if test "$MONOTONIC_CLOCK" = "guessing yes"; then MONOTONIC_CLOCK=yes fi 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(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 if test "x$MITSHM" = xauto; then MITSHM="$ac_cv_sysv_ipc" 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" SDK_REQUIRED_MODULES="$SDK_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" SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO" fi if test "x$LISTEN_TCP" = xyes; then AC_DEFINE(LISTEN_TCP, 1, [Listen on TCP socket]) fi if test "x$LISTEN_UNIX" = xyes; then AC_DEFINE(LISTEN_UNIX, 1, [Listen on Unix socket]) fi if test "x$LISTEN_LOCAL" = xyes; then AC_DEFINE(LISTEN_LOCAL, 1, [Listen on local socket]) fi # The XRes extension may support client ID tracking only if it has # been specifically enabled. Client ID tracking is implicitly not # supported if XRes extension is disabled. AC_MSG_CHECKING([whether to track client ids]) if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then AC_DEFINE(CLIENTIDS, 1, [Support client ID tracking]) else CLIENTIDS=no fi if test "x$CLIENTIDS" = xyes; then case $host_os in openbsd*) SYS_LIBS="$SYS_LIBS -lkvm" ;; esac fi AC_MSG_RESULT([$CLIENTIDS]) AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes]) AM_CONDITIONAL(DRI, test "x$DRI" = xyes) if test "x$DRI" = xyes; then AC_DEFINE(XF86DRI, 1, [Build DRI extension]) REQUIRED_MODULES="$REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI" SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI" 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 LIBGL="gl >= 1.2" SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO" ;; esac AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) AC_ARG_ENABLE(xtrans-send-fds, AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto]) case "x$XTRANS_SEND_FDS" in xauto) case "$host_os" in linux*|solaris*|freebsd*|dragonfly*|openbsd*) XTRANS_SEND_FDS=yes ;; *) XTRANS_SEND_FDS=no ;; esac esac case "x$XTRANS_SEND_FDS" in xyes) AC_DEFINE(XTRANS_SEND_FDS, 1, [Enable xtrans fd passing support]) ;; esac case "$DRI3,$XTRANS_SEND_FDS" in yes,yes | auto,yes) ;; yes,no) AC_MSG_ERROR([DRI3 requested, but xtrans fd passing support not found.]) DRI3=no ;; no,*) ;; *) AC_MSG_NOTICE([DRI3 disabled because xtrans fd passing support not found.]) DRI3=no ;; esac PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO, [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no]) case "$DRI3,$HAVE_DRI3PROTO" in yes,yes | auto,yes) REQUIRED_MODULES="$REQUIRED_MODULES dri3proto" ;; yes,no) AC_MSG_ERROR([DRI3 requested, but dri3proto not found.]) DRI3=no ;; no,*) ;; *) AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.]) DRI3=no ;; esac AC_CHECK_FUNCS([sigaction]) BUSFAULT=no case x"$ac_cv_func_sigaction" in xyes) AC_DEFINE(HAVE_SIGACTION, 1, [Have sigaction function]) BUSFAULT=yes ;; esac case x"$BUSFAULT" in xyes) AC_DEFINE(BUSFAULT, 1, [Include busfault OS API]) ;; esac AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes) PKG_CHECK_MODULES([XSHMFENCE], $LIBXSHMFENCE, [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no]) if test "x$XSHMFENCE" = "xauto"; then XSHMFENCE="$HAVE_XSHMFENCE" fi if test "x$XSHMFENCE" = "xyes"; then if test "x$HAVE_XSHMFENCE" != "xyes"; then AC_MSG_ERROR([xshmfence requested but not installed.]) fi AC_DEFINE(HAVE_XSHMFENCE, 1, [Have xshmfence support]) REQUIRED_LIBS="$REQUIRED_LIBS $LIBXSHMFENCE" fi AM_CONDITIONAL(XSHMFENCE, [test "x$XSHMFENCE" = xyes]) case "$DRI3,$XSHMFENCE" in yes,yes | auto,yes) ;; yes,no) AC_MSG_ERROR([DRI3 requested, but xshmfence not found.]) DRI3=no ;; no,*) ;; *) AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.]) DRI3=no ;; esac case x"$DRI3" in xyes|xauto) DRI3=yes AC_DEFINE(DRI3, 1, [Build DRI3 extension]) DRI3_LIB='$(top_builddir)/dri3/libdri3.la' SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO" AC_MSG_NOTICE([DRI3 enabled]); ;; esac AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes) if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes || test "x$XORG" = 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$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 $(top_builddir)/glx/libglxvnd.la' GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS" else GLX=no fi AM_CONDITIONAL(GLX, test "x$GLX" = xyes) AC_SUBST([GLX_DEFINES]) AC_SUBST([GLX_SYS_LIBS]) AM_CONDITIONAL(PRESENT, [test "x$PRESENT" = xyes]) if test "x$PRESENT" = xyes; then AC_DEFINE(PRESENT, 1, [Support Present extension]) REQUIRED_MODULES="$REQUIRED_MODULES $PRESENTPROTO" SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $PRESENTPROTO" PRESENT_INC='-I$(top_srcdir)/present' PRESENT_LIB='$(top_builddir)/present/libpresent.la' fi 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' DBE_INC='-I$(top_srcdir)/dbe' 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" SDK_REQUIRED_MODULES="$SDK_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 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(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]) if test "x$XKBPATH" = "xauto"; then XKBPATH=$(pkg-config --variable datadir xkbcomp || echo ${datadir})/X11/xkb fi 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 (default: auto)]), [XKB_BIN_DIRECTORY="$withval"], [XKB_BIN_DIRECTORY="auto"]) if test "x$XKB_BIN_DIRECTORY" = "xauto"; then XKB_BIN_DIRECTORY=$(pkg-config --variable bindir xkbcomp || echo ${bindir}) fi 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. XKB_DFLT_RULES="evdev" ;; *) 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]) AC_SUBST([XKB_DFLT_RULES]) AC_SUBST([XKB_DFLT_MODEL]) AC_SUBST([XKB_DFLT_LAYOUT]) AC_SUBST([XKB_DFLT_VARIANT]) AC_SUBST([XKB_DFLT_OPTIONS]) XKB_LIB='$(top_builddir)/xkb/libxkb.la' XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la' REQUIRED_MODULES="$REQUIRED_MODULES xkbfile" PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"]) 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; 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 if test "x$XF86VIDMODE" = xauto; then PKG_CHECK_EXISTS($VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no]) fi if test "x$XF86VIDMODE" = xyes; then AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension]) fi AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes]) AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font 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_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]) if test "x$DEBUGGING" = xyes; then AC_DEFINE(DEBUG, 1, [Enable debugging code]) fi AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = 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) $(LIBUNWIND_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|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI], [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 dnl stdcall functions cannot be tested with AC_CHECK_LIB AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include ]) if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then with_sha1=CryptoAPI fi if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then AC_MSG_ERROR([CryptoAPI requested but not found]) fi if test "x$with_sha1" = xCryptoAPI; then AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1], [Use CryptoAPI 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([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes]) if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then with_sha1=libnettle fi if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then AC_MSG_ERROR([libnettle requested but not found]) fi if test "x$with_sha1" = xlibnettle; then AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1], [Use libnettle SHA1 functions]) SHA1_LIBS=-lnettle 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]) PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no]) if test "x$LIBUNWIND" = "xauto"; then LIBUNWIND="$HAVE_LIBUNWIND" fi if test "x$LIBUNWIND" = "xyes"; then if test "x$HAVE_LIBUNWIND" != "xyes"; then AC_MSG_ERROR([libunwind requested but not installed.]) fi AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support]) fi AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$LIBUNWIND" = xyes]) # 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" LD_NO_UNDEFINED_FLAG= XORG_DRIVER_LIBS= case "$host_os" in cygwin*) LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-all,--out-implib,lib\$@.a" LD_NO_UNDEFINED_FLAG="-no-undefined -Wl,\$(top_builddir)/hw/xfree86/libXorg.exe.a" XORG_DRIVER_LIBS="-lXorg.exe -L\${moduledir} -lshadow -lfb -no-undefined" CYGWIN=yes ;; solaris*) # We use AC_LINK_IFELSE to generate a temporary program conftest$EXEEXT # that we can link against for testing if the system linker is new # enough to support -z parent= for verifying loadable modules # are only calling functions defined in either the loading program or # the libraries they're linked with. AC_LINK_IFELSE( [AC_LANG_SOURCE([int main(int argc, char **argv) { return 0; }])], [mv conftest$EXEEXT conftest.parent XORG_CHECK_LINKER_FLAGS([-Wl,-z,parent=conftest.parent -G], [LD_NO_UNDEFINED_FLAG="-Wl,-z,defs -Wl,-z,parent=\$(top_builddir)/hw/xfree86/Xorg" # Not set yet, since this gets exported in xorg-server.pc to all the drivers, # and they're not all fixed to build correctly with it yet. # XORG_DRIVER_LIBS="-Wl,-z,defs -Wl,-z,parent=${bindir}/Xorg" ],[], [AC_LANG_SOURCE([extern int main(int argc, char **argv); int call_main(void) { return main(0, (void *)0); }])]) rm -f conftest.parent ]) ;; esac AC_SUBST([LD_EXPORT_SYMBOLS_FLAG]) AC_SUBST([LD_NO_UNDEFINED_FLAG]) AC_SUBST([XORG_DRIVER_LIBS]) AM_CONDITIONAL([CYGWIN], [test x"$CYGWIN" = xyes]) AM_CONDITIONAL([NO_UNDEFINED], [test x"$LD_NO_UNDEFINED_FLAG" != x]) 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 $DBE_INC $PRESENT_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 $DRI3_LIB $PRESENT_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 $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $RENDER_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_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" ;; mingw*) XORG="no" ;; darwin*) XORG="no" ;; esac fi AC_MSG_RESULT([$XORG]) 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 $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_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 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" proto_inc=`$PKG_CONFIG --cflags xproto` CFLAGS="$CFLAGS $VISIBILITY_CFLAGS $proto_inc" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ [#include 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 =================================================================== dnl =================================================================== dnl ================= beginning of PCI configuration ================== dnl =================================================================== xorg_bus_bsdpci=no xorg_bus_sparc=no AC_MSG_CHECKING([whether to build Xorg PCI functions]) if test "x$PCI" = xyes; then PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS) SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS" XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS" XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS" AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation]) AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path]) case $host_os in gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*) xorg_bus_bsdpci="yes" ;; esac case $host_cpu in sparc*) xorg_bus_sparc="yes" ;; esac else if test "x$CONFIG_UDEV_KMS" = xyes; then AC_MSG_ERROR([Platform device enumeration requires libpciaccess]) fi if test "x$INT10MODULE" = xyes && test "x$INT10" != xstub; then AC_MSG_ERROR([Cannot build int10 without libpciaccess]) fi fi AC_MSG_RESULT([$PCI]) if test "x$CONFIG_UDEV_KMS" = xyes; then AC_DEFINE(XSERVER_PLATFORM_BUS, 1, [X server supports platform device enumeration]) fi AC_MSG_RESULT([$XSERVER_PLATFORM_BUS]) dnl =================================================================== dnl ==================== end of PCI configuration ===================== dnl =================================================================== case $host_os in linux*) XORG_OS_SUBDIR="linux" linux_acpi="no" case $host_cpu in i*86|amd64*|x86_64*|ia64*) linux_acpi=$enable_linux_acpi ;; *) ;; esac dnl APM header AC_CHECK_HEADERS([linux/apm_bios.h], [linux_apm=$enable_linux_apm]) if test "x$linux_apm" = xyes -o "x$linux_acpi" = xyes; then AC_DEFINE(XF86PM, 1, [Support APM/ACPI power management in the server]) fi ;; freebsd* | kfreebsd*-gnu | dragonfly*) XORG_OS_SUBDIR="bsd" ;; netbsd*) XORG_OS_SUBDIR="bsd" ;; 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_SUBDIR="bsd" ;; solaris*) XORG_OS_SUBDIR="solaris" XORG_CFLAGS="$XORG_CFLAGS -DXF86PM" 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([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"]) case $host_cpu in sparc*) SOLARIS_INOUT_ARCH="sparcv8plus" ;; i*86|x86_64*) 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]) ;; gnu*) XORG_OS_SUBDIR="hurd" ;; cygwin*) XORG_OS_SUBDIR="stub" ;; *) XORG_OS_SUBDIR="stub" AC_MSG_NOTICE([m4_text_wrap(m4_join([ ], [Your OS is unknown.], [If you are interested in porting Xorg to your platform,], [please email xorg@lists.freedesktop.org.]))]) ;; esac 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" = xyes; then XORG_MODULES="$XORG_MODULES $VIDMODEPROTO" 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 if test "x$DRM" = xyes; then XORG_DRIVER_MODESETTING=yes fi AC_SUBST([XORG_LIBS]) AC_SUBST([XORG_SYS_LIBS]) AC_SUBST([XORG_INCS]) AC_SUBST([XORG_OS_SUBDIR]) 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="Xorg." XDG_DATA_HOME=".local/share" XDG_DATA_HOME_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_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_LOGDIR, logdir, [Default log location]) AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix]) AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME]) AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME]) AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support]) 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_PCI], [test "x$PCI" = 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([LNXACPI], [test "x$linux_acpi" = xyes]) AM_CONDITIONAL([LNXAPM], [test "x$linux_apm" = xyes]) AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes]) AM_CONDITIONAL([DGA], [test "x$DGA" = xyes]) AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes]) AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xyes]) dnl glamor if test "x$GLAMOR" = xauto; then if echo "$XORG" "$XEPHYR" "$XWAYLAND" | grep -q yes ; then GLAMOR=yes fi fi AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes]) if test "x$GLAMOR" = xyes; then AC_DEFINE(GLAMOR, 1, [Build glamor]) PKG_CHECK_MODULES([GLAMOR], [epoxy]) PKG_CHECK_EXISTS(epoxy >= 1.4.4, [AC_DEFINE(GLAMOR_HAS_EGL_QUERY_DMABUF, 1, [Have GLAMOR_HAS_EGL_QUERY_DMABUF])], []) PKG_CHECK_EXISTS(epoxy >= 1.5.4, [AC_DEFINE(GLAMOR_HAS_EGL_QUERY_DRIVER, 1, [Have GLAMOR_HAS_EGL_QUERY_DRIVER])], []) PKG_CHECK_MODULES(GBM, "$LIBGBM", [GBM=yes], [GBM=no]) if test "x$GBM" = xyes; then AC_DEFINE(GLAMOR_HAS_GBM, 1, [Build glamor with GBM-based EGL support]) AC_CHECK_DECL(GBM_BO_USE_LINEAR, [AC_DEFINE(GLAMOR_HAS_GBM_LINEAR, 1, [Have GBM_BO_USE_LINEAR])], [], [#include #include ]) dnl 17.1.0 is required for gbm_bo_create_with_modifiers PKG_CHECK_EXISTS(gbm >= 17.1.0, [AC_DEFINE(GBM_BO_WITH_MODIFIERS, 1, [Have gbm_bo_create_with_modifiers])], []) else if test "x$XORG" = xyes; then AC_MSG_ERROR([Glamor for Xorg requires $LIBGBM]) fi fi fi AM_CONDITIONAL([GLAMOR_EGL], [test "x$GBM" = 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(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 xfixes x11-xcb xcb-aux xcb-image xcb-ewmh xcb-icccm]) 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 if test "x$WINDOWSDRI" = xauto; then PKG_CHECK_EXISTS([windowsdriproto], [WINDOWSDRI=yes], [WINDOWSDRI=no]) fi if test "x$WINDOWSDRI" = xyes ; then PKG_CHECK_MODULES(WINDOWSDRI, [windowsdriproto]) 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="-lpthread -lws2_32" ;; 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 $PRESENT_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 ]) dnl XWin requires OpenGL spec files in order to generate wrapper code for native GL functions if [test "x$XWIN" = xyes && test "x$GLX" = xyes] ; then AC_CHECK_PROG(PYTHON3, python3, python3) if test -z "$PYTHON3"; then AC_MSG_ERROR([python3 not found]) fi AC_MSG_CHECKING(for python module lxml) $PYTHON3 -c "import lxml;" if test $? -ne 0 ; then AC_MSG_ERROR([not found]) fi AC_MSG_RESULT(yes) if test "x$KHRONOS_SPEC_DIR" = "xauto" ; then PKG_CHECK_MODULES([KHRONOS_OPENGL_REGISTRY], [khronos-opengl-registry]) KHRONOS_SPEC_DIR=`pkg-config khronos-opengl-registry --variable=specdir` fi AC_SUBST(KHRONOS_SPEC_DIR) fi fi AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes]) AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$GLX" = xyes]) AM_CONDITIONAL(XWIN_WINDOWS_DRI, [test "x$XWIN" = xyes && test "x$WINDOWSDRI" = 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]) XQUARTZ_LIBS="$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 $PRESENT_LIB" AC_SUBST([XQUARTZ_LIBS]) AC_CHECK_LIB([Xplugin],[xp_init],[:]) CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -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 AM_CONDITIONAL(PSEUDORAMIX, [test "x$XQUARTZ" = xyes -o "x$XWIN" = xyes ]) # 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 >= 1.6 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" ;; mingw*) 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 $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $RANDR_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 AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes", DMX_BUILD_USB="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_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 XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-render xcb-renderutil xcb-aux xcb-image xcb-icccm xcb-shm >= 1.9.3 xcb-keysyms xcb-randr xcb-xkb" if test "x$XV" = xyes; then XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv" fi if test "x$DRI" = xyes && test "x$GLX" = xyes; then XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBDRM xcb-glx xcb-xf86dri > 1.6" fi if test "x$GLAMOR" = xyes; then XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS x11-xcb" fi if test "x$XEPHYR" = xauto; then PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"], [XEPHYR="no"]) elif test "x$XEPHYR" = xyes ; then PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS) 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" KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_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' KDRIVE_MAIN_LIB="$MAIN_LIB" KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_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" 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_MAIN_LIB]) AC_SUBST([KDRIVE_LOCAL_LIBS]) AC_SUBST([KDRIVE_LIBS]) AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes]) dnl Xwayland DDX XWAYLANDMODULES="wayland-client >= 1.3.0 wayland-protocols >= 1.10 $LIBDRM epoxy" if test "x$XF86VIDMODE" = xyes; then XWAYLANDMODULES="$XWAYLANDMODULES $VIDMODEPROTO" fi PKG_CHECK_MODULES(XWAYLANDMODULES, [$XWAYLANDMODULES], [have_xwayland=yes], [have_xwayland=no]) AC_MSG_CHECKING([whether to build Xwayland DDX]) if test "x$XWAYLAND" = xauto; then XWAYLAND="$have_xwayland" fi AC_MSG_RESULT([$XWAYLAND]) AM_CONDITIONAL(XWAYLAND, [test "x$XWAYLAND" = xyes]) if test "x$XWAYLAND" = xyes; then if test "x$have_xwayland" = xno; then AC_MSG_ERROR([Xwayland build explicitly requested, but required modules not found.]) fi if test "x$GLAMOR" = xyes && test "x$GBM" = xyes; then AC_DEFINE(XWL_HAS_GLAMOR, 1, [Build xwayland with glamor support]) fi PKG_CHECK_MODULES(WAYLAND_EGLSTREAM, [wayland-eglstream-protocols >= 1.0.2], [have_wl_eglstream=yes], [have_wl_eglstream=no]) if test "x$XWAYLAND_EGLSTREAM" = xauto; then if test "x$have_wl_eglstream" = xyes && test "x$GLAMOR" = xyes; then XWAYLAND_EGLSTREAM=yes fi fi if test "x$XWAYLAND_EGLSTREAM" = xyes; then if test "x$GLAMOR" != xyes; then AC_MSG_ERROR([Xwayland eglstream support explicitly requested, but required modules not found.]) fi if test "x$have_wl_eglstream" = xno; then AC_MSG_ERROR([Xwayland eglstream support requires wayland-eglstream-protocols >= 1.0.2]) fi AC_SUBST(WAYLAND_EGLSTREAM_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-eglstream-protocols`) AC_DEFINE(XWL_HAS_EGLSTREAM, 1, [Build xwayland with eglstream support]) fi XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB" XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XWAYLAND_LIBS]) AC_SUBST([XWAYLAND_SYS_LIBS]) if test "x$MONOTONIC_CLOCK" != xyes; then AC_MSG_ERROR([Xwayland requires CLOCK_MONOTONIC support.]) fi AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner]) if test "x$WAYLAND_SCANNER" = x; then PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner]) AC_SUBST(WAYLAND_SCANNER, `$PKG_CONFIG --variable=wayland_scanner wayland-scanner`) fi PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner >= 1.14.91], AC_SUBST(SCANNER_ARG, 'private-code'), AC_SUBST(SCANNER_ARG, 'code')) AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-protocols`) fi AM_CONDITIONAL(XWAYLAND_EGLSTREAM, [test "x$XWAYLAND_EGLSTREAM" = "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_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #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_DEFINE_DIR(SYSCONFDIR, sysconfdir, [sysconfdir]) AC_SUBST([RELEASE_DATE]) DATE_FMT="%Y%m%d" TIME_FMT="1%H%M%S" BUILD_DATE="`date "+$DATE_FMT"`" BUILD_TIME="`date "+$TIME_FMT"`" if test "x$SOURCE_DATE_EPOCH" != "x"; then BUILD_DATE="`date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT"`" BUILD_TIME="`date -u -d "@$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u "+$TIME_FMT"`" fi AC_SUBST([BUILD_DATE]) 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_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep]) if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then AC_MSG_WARN([ *********************************************** Neither HAL nor udev backend will be enabled. Input device hotplugging will not be available! ***********************************************]) fi AC_CONFIG_FILES([ Makefile glx/Makefile include/Makefile composite/Makefile damageext/Makefile dbe/Makefile dix/Makefile doc/Makefile doc/dtrace/Makefile man/Makefile fb/Makefile glamor/Makefile record/Makefile config/Makefile mi/Makefile miext/Makefile miext/sync/Makefile miext/damage/Makefile miext/shadow/Makefile miext/rootless/Makefile os/Makefile pseudoramiX/Makefile randr/Makefile render/Makefile xkb/Makefile Xext/Makefile Xi/Makefile xfixes/Makefile exa/Makefile dri3/Makefile present/Makefile hw/Makefile hw/xfree86/Makefile hw/xfree86/Xorg.sh hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile hw/xfree86/dixmods/Makefile hw/xfree86/doc/Makefile hw/xfree86/dri/Makefile hw/xfree86/dri2/Makefile hw/xfree86/dri2/pci_ids/Makefile hw/xfree86/drivers/Makefile hw/xfree86/drivers/modesetting/Makefile hw/xfree86/exa/Makefile hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile hw/xfree86/fbdevhw/man/Makefile hw/xfree86/glamor_egl/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile hw/xfree86/man/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/os-support/stub/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/xkb/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/doxygen/doxygen.conf hw/dmx/doxygen/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/dri/Makefile hw/xwin/glx/Makefile hw/xwin/man/Makefile hw/xwin/winclipboard/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/src/Makefile hw/xwayland/Makefile test/Makefile xserver.ent xorg-server.pc ]) AC_OUTPUT xorg-server-1.20.8/config.sub0000755000175000017500000007613113640201510012771 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2019 Free Software Foundation, Inc. timestamp='2019-06-30' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp os=hpux ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vsta) basic_machine=i386-pc os=vsta ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; mipsEE* | ee) cpu=mips64r5900el vendor=scei case $os in linux*) ;; *) os=elf ;; esac ;; iop) cpu=mipsel vendor=scei os=irx ;; dvp) cpu=dvp vendor=scei os=elf ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in openstep*) ;; nextstep*) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* | irx* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xorg-server-1.20.8/config/0000755000175000017500000000000013640201533012330 500000000000000xorg-server-1.20.8/config/config-backends.h0000644000175000017500000000336213640201473015445 00000000000000/* * Copyright © 2006-2007 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "input.h" #include "list.h" void remove_devices(const char *backend, const char *config_info); BOOL device_is_duplicate(const char *config_info); #ifdef CONFIG_UDEV int config_udev_pre_init(void); int config_udev_init(void); void config_udev_fini(void); void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback); #elif defined(CONFIG_HAL) int config_hal_init(void); void config_hal_fini(void); #elif defined(CONFIG_WSCONS) int config_wscons_init(void); void config_wscons_fini(void); #endif xorg-server-1.20.8/config/Makefile.am0000644000175000017500000000135713640201473014315 00000000000000AM_CFLAGS = $(DIX_CFLAGS) noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = config.c config-backends.h libconfig_la_LIBADD = if NEED_DBUS AM_CFLAGS += $(DBUS_CFLAGS) libconfig_la_SOURCES += dbus-core.c libconfig_la_LIBADD += $(DBUS_LIBS) endif if CONFIG_UDEV AM_CFLAGS += $(UDEV_CFLAGS) libconfig_la_SOURCES += udev.c libconfig_la_LIBADD += $(UDEV_LIBS) if XORG xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) xorgconfd_DATA = 10-quirks.conf endif else if CONFIG_HAL AM_CFLAGS += $(HAL_CFLAGS) libconfig_la_SOURCES += hal.c libconfig_la_LIBADD += $(HAL_LIBS) else if CONFIG_WSCONS libconfig_la_SOURCES += wscons.c endif # CONFIG_WSCONS endif # !CONFIG_HAL endif # !CONFIG_UDEV EXTRA_DIST = x11-input.fdi fdi2iclass.py 10-quirks.conf xorg-server-1.20.8/config/dbus-core.c0000644000175000017500000001517013640201473014306 00000000000000/* * Copyright © 2006-2007 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "dix.h" #include "os.h" #include "dbus-core.h" /* How often to attempt reconnecting when we get booted off the bus. */ #define RECONNECT_DELAY (10 * 1000) /* in ms */ struct dbus_core_info { int fd; DBusConnection *connection; OsTimerPtr timer; struct dbus_core_hook *hooks; }; static struct dbus_core_info bus_info = { .fd = -1 }; static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg); static void socket_handler(int fd, int ready, void *data) { struct dbus_core_info *info = data; if (info->connection) { do { dbus_connection_read_write_dispatch(info->connection, 0); } while (info->connection && dbus_connection_get_is_connected(info->connection) && dbus_connection_get_dispatch_status(info->connection) == DBUS_DISPATCH_DATA_REMAINS); } } /** * Disconnect (if we haven't already been forcefully disconnected), clean up * after ourselves, and call all registered disconnect hooks. */ static void teardown(void) { struct dbus_core_hook *hook; if (bus_info.timer) { TimerFree(bus_info.timer); bus_info.timer = NULL; } /* We should really have pre-disconnect hooks and run them here, for * completeness. But then it gets awkward, given that you can't * guarantee that they'll be called ... */ if (bus_info.connection) dbus_connection_unref(bus_info.connection); if (bus_info.fd != -1) RemoveNotifyFd(bus_info.fd); bus_info.fd = -1; bus_info.connection = NULL; for (hook = bus_info.hooks; hook; hook = hook->next) { if (hook->disconnect) hook->disconnect(hook->data); } } /** * This is a filter, which only handles the disconnected signal, which * doesn't go to the normal message handling function. This takes * precedence over the message handling function, so have have to be * careful to ignore anything we don't want to deal with here. */ static DBusHandlerResult message_filter(DBusConnection * connection, DBusMessage * message, void *data) { /* If we get disconnected, then take everything down, and attempt to * reconnect immediately (assuming it's just a restart). The * connection isn't valid at this point, so throw it out immediately. */ if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) { DebugF("[dbus-core] disconnected from bus\n"); bus_info.connection = NULL; teardown(); if (bus_info.timer) TimerFree(bus_info.timer); bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL); return DBUS_HANDLER_RESULT_HANDLED; } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } /** * Attempt to connect to the system bus, and set a filter to deal with * disconnection (see message_filter above). * * @return 1 on success, 0 on failure. */ static int connect_to_bus(void) { DBusError error; struct dbus_core_hook *hook; dbus_error_init(&error); bus_info.connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); if (!bus_info.connection || dbus_error_is_set(&error)) { LogMessage(X_ERROR, "dbus-core: error connecting to system bus: %s (%s)\n", error.name, error.message); goto err_begin; } /* Thankyou. Really, thankyou. */ dbus_connection_set_exit_on_disconnect(bus_info.connection, FALSE); if (!dbus_connection_get_unix_fd(bus_info.connection, &bus_info.fd)) { ErrorF("[dbus-core] couldn't get fd for system bus\n"); goto err_unref; } if (!dbus_connection_add_filter(bus_info.connection, message_filter, &bus_info, NULL)) { ErrorF("[dbus-core] couldn't add filter: %s (%s)\n", error.name, error.message); goto err_fd; } dbus_error_free(&error); SetNotifyFd(bus_info.fd, socket_handler, X_NOTIFY_READ, &bus_info); for (hook = bus_info.hooks; hook; hook = hook->next) { if (hook->connect) hook->connect(bus_info.connection, hook->data); } return 1; err_fd: bus_info.fd = -1; err_unref: dbus_connection_unref(bus_info.connection); bus_info.connection = NULL; err_begin: dbus_error_free(&error); return 0; } static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg) { if (connect_to_bus()) { TimerFree(bus_info.timer); bus_info.timer = NULL; return 0; } else { return RECONNECT_DELAY; } } int dbus_core_add_hook(struct dbus_core_hook *hook) { struct dbus_core_hook **prev; for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next); hook->next = NULL; *prev = hook; /* If we're already connected, call the connect hook. */ if (bus_info.connection) hook->connect(bus_info.connection, hook->data); return 1; } void dbus_core_remove_hook(struct dbus_core_hook *hook) { struct dbus_core_hook **prev; for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) { if (*prev == hook) { *prev = hook->next; break; } } } int dbus_core_init(void) { memset(&bus_info, 0, sizeof(bus_info)); bus_info.fd = -1; bus_info.hooks = NULL; if (!connect_to_bus()) bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL); return 1; } void dbus_core_fini(void) { teardown(); } xorg-server-1.20.8/config/10-quirks.conf0000644000175000017500000000250613640201473014661 00000000000000# Collection of quirks and blacklist/whitelists for specific devices. # Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable # http://bugs.freedesktop.org/show_bug.cgi?id=22442 Section "InputClass" Identifier "ThinkPad HDAPS accelerometer blacklist" MatchProduct "ThinkPad HDAPS accelerometer data" Option "Ignore" "on" EndSection # https://bugzilla.redhat.com/show_bug.cgi?id=523914 # Mouse does not move in PV Xen guest # Explicitly tell evdev to not ignore the absolute axes. Section "InputClass" Identifier "Xen Virtual Pointer axis blacklist" MatchProduct "Xen Virtual Pointer" Option "IgnoreAbsoluteAxes" "off" Option "IgnoreRelativeAxes" "off" EndSection # https://bugs.freedesktop.org/show_bug.cgi?id=55867 # Bug 55867 - Doesn't know how to tag XI_TRACKBALL Section "InputClass" Identifier "Tag trackballs as XI_TRACKBALL" MatchProduct "trackball" MatchDriver "evdev" Option "TypeName" "TRACKBALL" EndSection # https://bugs.freedesktop.org/show_bug.cgi?id=62831 # Bug 62831 - Mionix Naos 5000 mouse detected incorrectly Section "InputClass" Identifier "Tag Mionix Naos 5000 mouse XI_MOUSE" MatchProduct "La-VIEW Technology Naos 5000 Mouse" MatchDriver "evdev" Option "TypeName" "MOUSE" EndSection xorg-server-1.20.8/config/fdi2iclass.py0000755000175000017500000001550513640201473014661 00000000000000#!/usr/bin/python # # Convert xorg keys from hal FDIs files to xorg.conf InputClass sections. # Modified from Martin Pitt's original fdi2mpi.py script: # http://cgit.freedesktop.org/media-player-info/tree/tools/fdi2mpi.py # # (C) 2010 Dan Nicholson # (C) 2009 Canonical Ltd. # Author: Dan Nicholson # Author: Martin Pitt # # 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 # fur- nished 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, # FIT- NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- # NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import sys, xml.dom.minidom # dict converting tags to Match* entries match_table = { 'info.product': 'MatchProduct', 'input.product': 'MatchProduct', 'info.vendor': 'MatchVendor', 'input.vendor': 'MatchVendor', 'info.device': 'MatchDevicePath', 'linux.device_file': 'MatchDevicePath', '/org/freedesktop/Hal/devices/computer:system.kernel.name': 'MatchOS', '@info.parent:pnp.id': 'MatchPnPID', } # dict converting info.capabilities list to Match* entries cap_match_table = { 'input.keys': 'MatchIsKeyboard', 'input.keyboard': 'MatchIsKeyboard', 'input.keypad': 'MatchIsKeyboard', 'input.mouse': 'MatchIsPointer', 'input.joystick': 'MatchIsJoystick', 'input.tablet': 'MatchIsTablet', 'input.touchpad': 'MatchIsTouchpad', 'input.touchscreen': 'MatchIsTouchscreen', } def device_glob(path): '''Convert a contains device path to a glob entry''' if path[0] != '/': path = '*' + path return path + '*' def parse_match(node): '''Parse a tag to a tuple with InputClass values''' match = None value = None booltype = False # see what type of key we have if node.attributes.has_key('key'): key = node.attributes['key'].nodeValue if key in match_table: match = match_table[key] elif key == 'info.capabilities': booltype = True # bail out now if it's unrecognized if not match and not booltype: return (match, value) if node.attributes.has_key('string'): value = node.attributes['string'].nodeValue elif node.attributes.has_key('contains'): value = node.attributes['contains'].nodeValue if match == 'MatchDevicePath': value = device_glob(value) elif booltype and value in cap_match_table: match = cap_match_table[value] value = 'yes' elif node.attributes.has_key('string_outof'): value = node.attributes['string_outof'].nodeValue.replace(';','|') elif node.attributes.has_key('contains_outof'): all_values = node.attributes['contains_outof'].nodeValue.split(';') for v in all_values: if match == 'MatchDevicePath': v = device_glob(v) elif match == 'MatchPnPID' and len(v) < 7: v += '*' if value: value += '|' + v else: value = v return (match, value) def parse_options(node): '''Parse the x11_* options and return InputClass entries''' driver = '' ignore = False options = [] for n in node.childNodes: if n.nodeType != xml.dom.minidom.Node.ELEMENT_NODE: continue tag = n.tagName key = n.attributes['key'].nodeValue value = '' if n.hasChildNodes(): content_node = n.childNodes[0] assert content_node.nodeType == xml.dom.Node.TEXT_NODE value = content_node.nodeValue if tag == 'match': continue assert tag in ('addset', 'merge', 'append', 'remove') if tag == 'remove' and key == 'input.x11_driver': ignore = True elif key == 'input.x11_driver': driver = value elif key.startswith('input.x11_options.'): option = key.split('.', 2)[2] options.append((option, value)) return (driver, ignore, options) def is_match_node(node): '''Check if a node is a element''' return node.nodeType == xml.dom.minidom.Node.ELEMENT_NODE and \ node.tagName == 'match' def parse_all_matches(node): '''Parse a x11 match tag and any parents that don't supply their own options''' matches = [] while True: (key, value) = parse_match(node) if key and value: matches.append((key, value)) # walk up to a parent match node node = node.parentNode if node == None or not is_match_node(node): break # leave if there other options at this level children = set([n.tagName for n in node.childNodes if n.nodeType == xml.dom.minidom.Node.ELEMENT_NODE]) if children & set(['addset', 'merge', 'append']): break return matches # stupid counter to give "unique" rule names num_sections = 1 def print_section(matches, driver, ignore, options): '''Print a valid InputClass section to stdout''' global num_sections print 'Section "InputClass"' print '\tIdentifier "Converted Class %d"' % num_sections num_sections += 1 for m, v in matches: print '\t%s "%s"' % (m, v) if driver: print '\tDriver "%s"' % driver if ignore: print '\tOption "Ignore" "yes"' for o, v in options: print '\tOption "%s" "%s"' % (o, v) print 'EndSection' def parse_fdi(fdi): '''Parse x11 matches from fdi''' # find all leaf nodes num = 0 for match_node in fdi.getElementsByTagName('match'): children = set([n.tagName for n in match_node.childNodes if n.nodeType == xml.dom.minidom.Node.ELEMENT_NODE]) # see if there are any options at this level (driver, ignore, options) = parse_options(match_node) if not driver and not ignore and not options: continue matches = parse_all_matches(match_node) if num > 0: print print_section(matches, driver, ignore, options) num += 1 for f in sys.argv[1:]: parse_fdi(xml.dom.minidom.parse(f)) xorg-server-1.20.8/config/x11-input.fdi0000644000175000017500000000712013640201473014505 00000000000000 mouse evdev usbms VUID base kbd pc105 evdev evdev usbkbm VUID us xorg-server-1.20.8/config/wscons.c0000644000175000017500000001762713640201473013750 00000000000000/* * Copyright (c) 2011 Matthieu Herrb * * 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 #endif #include #include #include #include #include #include #include "input.h" #include "inputstr.h" #include "os.h" #include "config-backends.h" #define WSCONS_KBD_DEVICE "/dev/wskbd" #define WSCONS_MOUSE_PREFIX "/dev/wsmouse" #define KB_OVRENC \ { KB_UK, "gb" }, \ { KB_SV, "se" }, \ { KB_SG, "ch" }, \ { KB_SF, "ch" }, \ { KB_LA, "latam" }, \ { KB_CF, "ca" } struct nameint { int val; char *name; } kbdenc[] = { KB_OVRENC, KB_ENCTAB, {0} }; struct nameint kbdvar[] = { {KB_NODEAD | KB_SG, "de_nodeadkeys"}, {KB_NODEAD | KB_SF, "fr_nodeadkeys"}, {KB_SF, "fr"}, {KB_DVORAK | KB_CF, "fr-dvorak"}, {KB_DVORAK | KB_FR, "bepo"}, {KB_DVORAK, "dvorak"}, {KB_CF, "fr-legacy"}, {KB_NODEAD, "nodeadkeys"}, {0} }; struct nameint kbdopt[] = { {KB_SWAPCTRLCAPS, "ctrl:swapcaps"}, {0} }; struct nameint kbdmodel[] = { {WSKBD_TYPE_ZAURUS, "zaurus"}, {0} }; static void wscons_add_keyboard(void) { InputAttributes attrs = { }; DeviceIntPtr dev = NULL; InputOption *input_options = NULL; char *config_info = NULL; int fd, i, rc; unsigned int type; kbd_t wsenc = 0; /* Find keyboard configuration */ fd = open(WSCONS_KBD_DEVICE, O_RDWR | O_NONBLOCK | O_EXCL); if (fd == -1) { LogMessage(X_ERROR, "wskbd: open %s: %s\n", WSCONS_KBD_DEVICE, strerror(errno)); return; } if (ioctl(fd, WSKBDIO_GETENCODING, &wsenc) == -1) { LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GETENCODING) " "failed: %s\n", strerror(errno)); close(fd); return; } if (ioctl(fd, WSKBDIO_GTYPE, &type) == -1) { LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GTYPE) " "failed: %s\n", strerror(errno)); close(fd); return; } close(fd); input_options = input_option_new(input_options, "_source", "server/wscons"); if (input_options == NULL) return; LogMessage(X_INFO, "config/wscons: checking input device %s\n", WSCONS_KBD_DEVICE); input_options = input_option_new(input_options, "name", WSCONS_KBD_DEVICE); input_options = input_option_new(input_options, "driver", "kbd"); config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE); if (!config_info) goto unwind; if (KB_ENCODING(wsenc) == KB_USER) { /* Ignore wscons "user" layout */ LogMessageVerb(X_INFO, 3, "wskbd: ignoring \"user\" layout\n"); goto kbd_config_done; } for (i = 0; kbdenc[i].val; i++) if (KB_ENCODING(wsenc) == kbdenc[i].val) { LogMessageVerb(X_INFO, 3, "wskbd: using layout %s\n", kbdenc[i].name); input_options = input_option_new(input_options, "xkb_layout", kbdenc[i].name); break; } for (i = 0; kbdvar[i].val; i++) if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) { LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n", kbdvar[i].name); input_options = input_option_new(input_options, "xkb_variant", kbdvar[i].name); break; } for (i = 0; kbdopt[i].val; i++) if (KB_VARIANT(wsenc) == kbdopt[i].val) { LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n", kbdopt[i].name); input_options = input_option_new(input_options, "xkb_options", kbdopt[i].name); break; } for (i = 0; kbdmodel[i].val; i++) if (type == kbdmodel[i].val) { LogMessageVerb(X_INFO, 3, "wskbd: using model %s\n", kbdmodel[i].name); input_options = input_option_new(input_options, "xkb_model", kbdmodel[i].name); break; } kbd_config_done: attrs.flags |= ATTR_KEY | ATTR_KEYBOARD; rc = NewInputDeviceRequest(input_options, &attrs, &dev); if (rc != Success) goto unwind; for (; dev; dev = dev->next) { free(dev->config_info); dev->config_info = strdup(config_info); } unwind: input_option_free_list(&input_options); } static void wscons_add_pointer(const char *path, const char *driver, int flags) { InputAttributes attrs = { }; DeviceIntPtr dev = NULL; InputOption *input_options = NULL; char *config_info = NULL; int rc; config_info = Xprintf("wscons:%s", path); if (!config_info) return; input_options = input_option_new(input_options, "_source", "server/wscons"); if (input_options == NULL) return; input_options = input_option_new(input_options, "name", strdup(path)); input_options = input_option_new(input_options, "driver", strdup(driver)); input_options = input_option_new(input_options, "device", strdup(path)); LogMessage(X_INFO, "config/wscons: checking input device %s\n", path); attrs.flags |= flags; rc = NewInputDeviceRequest(input_options, &attrs, &dev); if (rc != Success) goto unwind; for (; dev; dev = dev->next) { free(dev->config_info); dev->config_info = strdup(config_info); } unwind: input_option_free_list(&input_options); } static void wscons_add_pointers(void) { char devname[256]; int fd, i, wsmouse_type; /* Check pointing devices */ for (i = 0; i < 4; i++) { snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i); LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname); fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL); if (fd == -1) { LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno)); continue; } if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) { LogMessageVerb(X_WARNING, 10, "%s: WSMOUSEIO_GTYPE failed\n", devname); close(fd); continue; } close(fd); switch (wsmouse_type) { case WSMOUSE_TYPE_SYNAPTICS: wscons_add_pointer(devname, "synaptics", ATTR_TOUCHPAD); break; case WSMOUSE_TYPE_TPANEL: wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN); break; default: break; } } /* Add a default entry catching all other mux elements as "mouse" */ wscons_add_pointer(WSCONS_MOUSE_PREFIX, "mouse", ATTR_POINTER); } int config_wscons_init(void) { wscons_add_keyboard(); wscons_add_pointers(); return 1; } void config_wscons_fini(void) { /* Not much to do ? */ } xorg-server-1.20.8/config/Makefile.in0000644000175000017500000007436713640201511014332 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @NEED_DBUS_TRUE@am__append_1 = $(DBUS_CFLAGS) @NEED_DBUS_TRUE@am__append_2 = dbus-core.c @NEED_DBUS_TRUE@am__append_3 = $(DBUS_LIBS) @CONFIG_UDEV_TRUE@am__append_4 = $(UDEV_CFLAGS) @CONFIG_UDEV_TRUE@am__append_5 = udev.c @CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_LIBS) @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = $(HAL_CFLAGS) @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = hal.c @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_LIBS) @CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_10 = wscons.c subdir = config ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = @NEED_DBUS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) @CONFIG_UDEV_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_4 = \ @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_1) libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) am__libconfig_la_SOURCES_DIST = config.c config-backends.h dbus-core.c \ udev.c hal.c wscons.c @NEED_DBUS_TRUE@am__objects_1 = dbus-core.lo @CONFIG_UDEV_TRUE@am__objects_2 = udev.lo @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = hal.lo @CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_4 = wscons.lo am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/config.Plo ./$(DEPDIR)/dbus-core.Plo \ ./$(DEPDIR)/hal.Plo ./$(DEPDIR)/udev.Plo \ ./$(DEPDIR)/wscons.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libconfig_la_SOURCES) DIST_SOURCES = $(am__libconfig_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(xorgconfddir)" DATA = $(xorgconfd_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_4) \ $(am__append_7) noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \ $(am__append_5) $(am__append_8) $(am__append_10) libconfig_la_LIBADD = $(am__append_3) $(am__append_6) $(am__append_9) @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfd_DATA = 10-quirks.conf EXTRA_DIST = x11-input.fdi fdi2iclass.py 10-quirks.conf all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign config/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign config/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libconfig.la: $(libconfig_la_OBJECTS) $(libconfig_la_DEPENDENCIES) $(EXTRA_libconfig_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libconfig_la_OBJECTS) $(libconfig_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wscons.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-xorgconfdDATA: $(xorgconfd_DATA) @$(NORMAL_INSTALL) @list='$(xorgconfd_DATA)'; test -n "$(xorgconfddir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(xorgconfddir)'"; \ $(MKDIR_P) "$(DESTDIR)$(xorgconfddir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(xorgconfddir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(xorgconfddir)" || exit $$?; \ done uninstall-xorgconfdDATA: @$(NORMAL_UNINSTALL) @list='$(xorgconfd_DATA)'; test -n "$(xorgconfddir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(xorgconfddir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: for dir in "$(DESTDIR)$(xorgconfddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/config.Plo -rm -f ./$(DEPDIR)/dbus-core.Plo -rm -f ./$(DEPDIR)/hal.Plo -rm -f ./$(DEPDIR)/udev.Plo -rm -f ./$(DEPDIR)/wscons.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-xorgconfdDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/config.Plo -rm -f ./$(DEPDIR)/dbus-core.Plo -rm -f ./$(DEPDIR)/hal.Plo -rm -f ./$(DEPDIR)/udev.Plo -rm -f ./$(DEPDIR)/wscons.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-xorgconfdDATA .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ install-xorgconfdDATA installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-xorgconfdDATA .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/config/hal.c0000644000175000017500000005406313640201473013173 00000000000000/* * Copyright © 2007 Daniel Stone * Copyright © 2007 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. * * Author: Daniel Stone */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "dbus-core.h" #include "input.h" #include "inputstr.h" #include "hotplug.h" #include "config-backends.h" #include "os.h" #define LIBHAL_PROP_KEY "input.x11_options." #define LIBHAL_XKB_PROP_KEY "input.xkb." struct config_hal_info { DBusConnection *system_bus; LibHalContext *hal_ctx; }; /* Used for special handling of xkb options. */ struct xkb_options { char *layout; char *model; char *rules; char *variant; char *options; }; static void device_removed(LibHalContext * ctx, const char *udi) { char *value; if (asprintf(&value, "hal:%s", udi) == -1) return; remove_devices("hal", value); free(value); } static char * get_prop_string(LibHalContext * hal_ctx, const char *udi, const char *name) { char *prop, *ret; prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL); LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)"); if (prop) { ret = strdup(prop); libhal_free_string(prop); } else { return NULL; } return ret; } static char * get_prop_string_array(LibHalContext * hal_ctx, const char *udi, const char *prop) { char **props, *ret, *str; int i, len = 0; props = libhal_device_get_property_strlist(hal_ctx, udi, prop, NULL); if (props) { for (i = 0; props[i]; i++) len += strlen(props[i]); ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */ if (!ret) { libhal_free_string_array(props); return NULL; } str = ret; for (i = 0; props[i]; i++) { strcpy(str, props[i]); str += strlen(props[i]); *str++ = ','; } *(str - 1) = '\0'; libhal_free_string_array(props); } else { return NULL; } return ret; } static void device_added(LibHalContext * hal_ctx, const char *udi) { char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL; char *hal_tags, *parent; InputOption *input_options = NULL; InputAttributes attrs = { 0 }; DeviceIntPtr dev = NULL; DBusError error; struct xkb_options xkb_opts = { 0 }; int rc; LibHalPropertySet *set = NULL; LibHalPropertySetIterator set_iter; char *psi_key = NULL, *tmp_val; dbus_error_init(&error); driver = get_prop_string(hal_ctx, udi, "input.x11_driver"); if (!driver) { /* verbose, don't tell the user unless they _want_ to see it */ LogMessageVerb(X_INFO, 7, "config/hal: no driver specified for device %s\n", udi); goto unwind; } path = get_prop_string(hal_ctx, udi, "input.device"); if (!path) { LogMessage(X_WARNING, "config/hal: no driver or path specified for %s\n", udi); goto unwind; } attrs.device = strdup(path); name = get_prop_string(hal_ctx, udi, "info.product"); if (!name) name = strdup("(unnamed)"); else attrs.product = strdup(name); attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor"); hal_tags = get_prop_string(hal_ctx, udi, "input.tags"); attrs.tags = xstrtokenize(hal_tags, ","); free(hal_tags); if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL)) attrs.flags |= ATTR_KEY | ATTR_KEYBOARD; if (libhal_device_query_capability(hal_ctx, udi, "input.mouse", NULL)) attrs.flags |= ATTR_POINTER; if (libhal_device_query_capability(hal_ctx, udi, "input.joystick", NULL)) attrs.flags |= ATTR_JOYSTICK; if (libhal_device_query_capability(hal_ctx, udi, "input.tablet", NULL)) attrs.flags |= ATTR_TABLET; if (libhal_device_query_capability(hal_ctx, udi, "input.tablet_pad", NULL)) attrs.flags |= ATTR_TABLET_PAD; if (libhal_device_query_capability(hal_ctx, udi, "input.touchpad", NULL)) attrs.flags |= ATTR_TOUCHPAD; if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL)) attrs.flags |= ATTR_TOUCHSCREEN; parent = get_prop_string(hal_ctx, udi, "info.parent"); if (parent) { int usb_vendor, usb_product; char *old_parent; /* construct USB ID in lowercase - "0000:ffff" */ usb_vendor = libhal_device_get_property_int(hal_ctx, parent, "usb.vendor_id", NULL); LogMessageVerb(X_INFO, 10, "config/hal: getting usb.vendor_id on %s " "returned %04x\n", parent, usb_vendor); usb_product = libhal_device_get_property_int(hal_ctx, parent, "usb.product_id", NULL); LogMessageVerb(X_INFO, 10, "config/hal: getting usb.product_id on %s " "returned %04x\n", parent, usb_product); if (usb_vendor && usb_product) if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_product) == -1) attrs.usb_id = NULL; attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); old_parent = parent; while (!attrs.pnp_id && (parent = get_prop_string(hal_ctx, parent, "info.parent"))) { attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); free(old_parent); old_parent = parent; } free(old_parent); } input_options = input_option_new(NULL, "_source", "server/hal"); if (!input_options) { LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n"); goto unwind; } /* most drivers use device.. not path. evdev uses both however, but the * path version isn't documented apparently. support both for now. */ input_options = input_option_new(input_options, "path", path); input_options = input_option_new(input_options, "device", path); input_options = input_option_new(input_options, "driver", driver); input_options = input_option_new(input_options, "name", name); if (asprintf(&config_info, "hal:%s", udi) == -1) { config_info = NULL; LogMessage(X_ERROR, "config/hal: couldn't allocate name\n"); goto unwind; } /* Check for duplicate devices */ if (device_is_duplicate(config_info)) { LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name); goto unwind; } /* ok, grab options from hal.. iterate through all properties * and lets see if any of them are options that we can add */ set = libhal_device_get_all_properties(hal_ctx, udi, &error); if (!set) { LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n", udi, error.name, error.message); goto unwind; } libhal_psi_init(&set_iter, set); while (libhal_psi_has_more(&set_iter)) { /* we are looking for supported keys.. extract and add to options */ psi_key = libhal_psi_get_key(&set_iter); if (psi_key) { /* normal options first (input.x11_options.) */ if (!strncasecmp (psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY) - 1)) { char *tmp; /* only support strings for all values */ tmp_val = get_prop_string(hal_ctx, udi, psi_key); if (tmp_val) { /* xkb needs special handling. HAL specs include * input.xkb.xyz options, but the x11-input.fdi specifies * input.x11_options.Xkbxyz options. By default, we use * the former, unless the specific X11 ones are specified. * Since we can't predict the order in which the keys * arrive, we need to store them. */ if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4) { if (!strcasecmp(&tmp[3], "layout")) { free(xkb_opts.layout); xkb_opts.layout = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "model")) { free(xkb_opts.model); xkb_opts.model = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "rules")) { free(xkb_opts.rules); xkb_opts.rules = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "variant")) { free(xkb_opts.variant); xkb_opts.variant = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "options")) { free(xkb_opts.options); xkb_opts.options = strdup(tmp_val); } } else { /* all others */ input_options = input_option_new(input_options, psi_key + sizeof(LIBHAL_PROP_KEY) - 1, tmp_val); free(tmp_val); } } else { /* server 1.4 had xkb_options as strlist. */ if ((tmp = strcasestr(psi_key, "xkb")) && (strlen(tmp) >= 4) && (!strcasecmp(&tmp[3], "options")) && (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key))) { free(xkb_opts.options); xkb_opts.options = strdup(tmp_val); } } } else if (!strncasecmp (psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY) - 1)) { char *tmp; /* only support strings for all values */ tmp_val = get_prop_string(hal_ctx, udi, psi_key); if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY)) { tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1]; if (!strcasecmp(tmp, "layout")) { if (!xkb_opts.layout) xkb_opts.layout = strdup(tmp_val); } else if (!strcasecmp(tmp, "rules")) { if (!xkb_opts.rules) xkb_opts.rules = strdup(tmp_val); } else if (!strcasecmp(tmp, "variant")) { if (!xkb_opts.variant) xkb_opts.variant = strdup(tmp_val); } else if (!strcasecmp(tmp, "model")) { if (!xkb_opts.model) xkb_opts.model = strdup(tmp_val); } else if (!strcasecmp(tmp, "options")) { if (!xkb_opts.options) xkb_opts.options = strdup(tmp_val); } free(tmp_val); } else { /* server 1.4 had xkb options as strlist */ tmp_val = get_prop_string_array(hal_ctx, udi, psi_key); if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY)) { tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1]; if (!strcasecmp(tmp, ".options") && (!xkb_opts.options)) xkb_opts.options = strdup(tmp_val); } free(tmp_val); } } } /* psi_key doesn't need to be freed */ libhal_psi_next(&set_iter); } /* Now add xkb options */ if (xkb_opts.layout) input_options = input_option_new(input_options, "xkb_layout", xkb_opts.layout); if (xkb_opts.rules) input_options = input_option_new(input_options, "xkb_rules", xkb_opts.rules); if (xkb_opts.variant) input_options = input_option_new(input_options, "xkb_variant", xkb_opts.variant); if (xkb_opts.model) input_options = input_option_new(input_options, "xkb_model", xkb_opts.model); if (xkb_opts.options) input_options = input_option_new(input_options, "xkb_options", xkb_opts.options); input_options = input_option_new(input_options, "config_info", config_info); /* this isn't an error, but how else do you output something that the user can see? */ LogMessage(X_INFO, "config/hal: Adding input device %s\n", name); if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) { LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc); dev = NULL; goto unwind; } unwind: if (set) libhal_free_property_set(set); free(path); free(driver); free(name); free(config_info); input_option_free_list(&input_options); free(attrs.product); free(attrs.vendor); free(attrs.device); free(attrs.pnp_id); free(attrs.usb_id); if (attrs.tags) { char **tag = attrs.tags; while (*tag) { free(*tag); tag++; } free(attrs.tags); } free(xkb_opts.layout); free(xkb_opts.rules); free(xkb_opts.model); free(xkb_opts.variant); free(xkb_opts.options); dbus_error_free(&error); return; } static void disconnect_hook(void *data) { DBusError error; struct config_hal_info *info = data; if (info->hal_ctx) { if (dbus_connection_get_is_connected(info->system_bus)) { dbus_error_init(&error); if (!libhal_ctx_shutdown(info->hal_ctx, &error)) LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n", error.name, error.message); dbus_error_free(&error); } libhal_ctx_free(info->hal_ctx); } info->hal_ctx = NULL; info->system_bus = NULL; } static BOOL connect_and_register(DBusConnection * connection, struct config_hal_info *info) { DBusError error; char **devices; int num_devices, i; if (info->hal_ctx) return TRUE; /* already registered, pretend we did something */ info->system_bus = connection; dbus_error_init(&error); info->hal_ctx = libhal_ctx_new(); if (!info->hal_ctx) { LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n"); goto out_err; } if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) { LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n"); goto out_err; } if (!libhal_ctx_init(info->hal_ctx, &error)) { LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n", error.name ? error.name : "unknown error", error.message ? error.message : "null"); goto out_err; } if (!libhal_device_property_watch_all(info->hal_ctx, &error)) { LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n", error.name ? error.name : "unknown error", error.message ? error.message : "null"); goto out_ctx; } libhal_ctx_set_device_added(info->hal_ctx, device_added); libhal_ctx_set_device_removed(info->hal_ctx, device_removed); devices = libhal_find_device_by_capability(info->hal_ctx, "input", &num_devices, &error); /* FIXME: Get default devices if error is set. */ if (dbus_error_is_set(&error)) { LogMessage(X_ERROR, "config/hal: couldn't find input device: %s (%s)\n", error.name ? error.name : "unknown error", error.message ? error.message : "null"); goto out_ctx; } for (i = 0; i < num_devices; i++) device_added(info->hal_ctx, devices[i]); libhal_free_string_array(devices); dbus_error_free(&error); return TRUE; out_ctx: dbus_error_free(&error); if (!libhal_ctx_shutdown(info->hal_ctx, &error)) { LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n", error.name ? error.name : "unknown error", error.message ? error.message : "null"); dbus_error_free(&error); } out_err: dbus_error_free(&error); if (info->hal_ctx) { libhal_ctx_free(info->hal_ctx); } info->hal_ctx = NULL; info->system_bus = NULL; return FALSE; } /** * Handle NewOwnerChanged signals to deal with HAL startup at X server runtime. * * NewOwnerChanged is send once when HAL shuts down, and once again when it * comes back up. Message has three arguments, first is the name * (org.freedesktop.Hal), the second one is the old owner, third one is new * owner. */ static DBusHandlerResult ownerchanged_handler(DBusConnection * connection, DBusMessage * message, void *data) { int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; if (dbus_message_is_signal(message, "org.freedesktop.DBus", "NameOwnerChanged")) { DBusError error; char *name, *old_owner, *new_owner; dbus_error_init(&error); dbus_message_get_args(message, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old_owner, DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID); if (dbus_error_is_set(&error)) { ErrorF ("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n", error.name, error.message); } else if (name && strcmp(name, "org.freedesktop.Hal") == 0) { if (!old_owner || !strlen(old_owner)) { DebugF("[config/hal] HAL startup detected.\n"); if (connect_and_register (connection, (struct config_hal_info *) data)) dbus_connection_unregister_object_path(connection, "/org/freedesktop/DBus"); else ErrorF("[config/hal] Failed to connect to HAL bus.\n"); } ret = DBUS_HANDLER_RESULT_HANDLED; } dbus_error_free(&error); } return ret; } /** * Register a handler for the NameOwnerChanged signal. */ static BOOL listen_for_startup(DBusConnection * connection, void *data) { DBusObjectPathVTable vtable = {.message_function = ownerchanged_handler, }; DBusError error; const char MATCH_RULE[] = "sender='org.freedesktop.DBus'," "interface='org.freedesktop.DBus'," "type='signal'," "path='/org/freedesktop/DBus'," "member='NameOwnerChanged'"; int rc = FALSE; dbus_error_init(&error); dbus_bus_add_match(connection, MATCH_RULE, &error); if (!dbus_error_is_set(&error)) { if (dbus_connection_register_object_path(connection, "/org/freedesktop/DBus", &vtable, data)) rc = TRUE; else ErrorF("[config/hal] cannot register object path.\n"); } else { ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name, error.message); ErrorF("[config/hal] cannot detect a HAL startup.\n"); } dbus_error_free(&error); return rc; } static void connect_hook(DBusConnection * connection, void *data) { struct config_hal_info *info = data; if (listen_for_startup(connection, data) && connect_and_register(connection, info)) dbus_connection_unregister_object_path(connection, "/org/freedesktop/DBus"); return; } static struct config_hal_info hal_info; static struct dbus_core_hook hook = { .connect = connect_hook, .disconnect = disconnect_hook, .data = &hal_info, }; int config_hal_init(void) { memset(&hal_info, 0, sizeof(hal_info)); hal_info.system_bus = NULL; hal_info.hal_ctx = NULL; if (!dbus_core_add_hook(&hook)) { LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n"); return 0; } /* verbose message */ LogMessageVerb(X_INFO, 7, "config/hal: initialized\n"); return 1; } void config_hal_fini(void) { dbus_core_remove_hook(&hook); } xorg-server-1.20.8/config/config.c0000644000175000017500000001010113640201473013655 00000000000000/* * Copyright © 2006-2007 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "os.h" #include "inputstr.h" #include "hotplug.h" #include "config-backends.h" #include "systemd-logind.h" void config_pre_init(void) { #ifdef CONFIG_UDEV if (!config_udev_pre_init()) ErrorF("[config] failed to pre-init udev\n"); #endif } void config_init(void) { #ifdef CONFIG_UDEV if (!config_udev_init()) ErrorF("[config] failed to initialise udev\n"); #elif defined(CONFIG_HAL) if (!config_hal_init()) ErrorF("[config] failed to initialise HAL\n"); #elif defined(CONFIG_WSCONS) if (!config_wscons_init()) ErrorF("[config] failed to initialise wscons\n"); #endif } void config_fini(void) { #if defined(CONFIG_UDEV) config_udev_fini(); #elif defined(CONFIG_HAL) config_hal_fini(); #elif defined(CONFIG_WSCONS) config_wscons_fini(); #endif } void config_odev_probe(config_odev_probe_proc_ptr probe_callback) { #if defined(CONFIG_UDEV_KMS) config_udev_odev_probe(probe_callback); #endif } static void remove_device(const char *backend, DeviceIntPtr dev) { /* this only gets called for devices that have already been added */ LogMessage(X_INFO, "config/%s: removing device %s\n", backend, dev->name); /* Call PIE here so we don't try to dereference a device that's * already been removed. */ input_lock(); ProcessInputEvents(); DeleteInputDeviceRequest(dev); input_unlock(); } void remove_devices(const char *backend, const char *config_info) { DeviceIntPtr dev, next; for (dev = inputInfo.devices; dev; dev = next) { next = dev->next; if (dev->config_info && strcmp(dev->config_info, config_info) == 0) remove_device(backend, dev); } for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; if (dev->config_info && strcmp(dev->config_info, config_info) == 0) remove_device(backend, dev); } RemoveInputDeviceTraces(config_info); } BOOL device_is_duplicate(const char *config_info) { DeviceIntPtr dev; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->config_info && (strcmp(dev->config_info, config_info) == 0)) return TRUE; } for (dev = inputInfo.off_devices; dev; dev = dev->next) { if (dev->config_info && (strcmp(dev->config_info, config_info) == 0)) return TRUE; } return FALSE; } struct OdevAttributes * config_odev_allocate_attributes(void) { struct OdevAttributes *attribs = xnfcalloc(1, sizeof (struct OdevAttributes)); attribs->fd = -1; return attribs; } void config_odev_free_attributes(struct OdevAttributes *attribs) { if (attribs->fd != -1) systemd_logind_release_fd(attribs->major, attribs->minor, attribs->fd); free(attribs->path); free(attribs->syspath); free(attribs->busid); free(attribs->driver); free(attribs); } xorg-server-1.20.8/config/udev.c0000644000175000017500000004107013640201473013364 00000000000000/* * Copyright © 2009 Julien Cristau * * 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. * * Author: Julien Cristau */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "input.h" #include "inputstr.h" #include "hotplug.h" #include "config-backends.h" #include "os.h" #include "globals.h" #include "systemd-logind.h" #define UDEV_XKB_PROP_KEY "xkb" #define LOG_PROPERTY(path, prop, val) \ LogMessageVerb(X_INFO, 10, \ "config/udev: getting property %s on %s " \ "returned \"%s\"\n", \ (prop), (path), (val) ? (val) : "(null)") #define LOG_SYSATTR(path, attr, val) \ LogMessageVerb(X_INFO, 10, \ "config/udev: getting attribute %s on %s " \ "returned \"%s\"\n", \ (attr), (path), (val) ? (val) : "(null)") static struct udev_monitor *udev_monitor; #ifdef CONFIG_UDEV_KMS static void config_udev_odev_setup_attribs(const char *path, const char *syspath, int major, int minor, config_odev_probe_proc_ptr probe_callback); #endif static char itoa_buf[16]; static const char *itoa(int i) { snprintf(itoa_buf, sizeof(itoa_buf), "%d", i); return itoa_buf; } static Bool check_seat(struct udev_device *udev_device) { const char *dev_seat; dev_seat = udev_device_get_property_value(udev_device, "ID_SEAT"); if (!dev_seat) dev_seat = "seat0"; if (SeatId && strcmp(dev_seat, SeatId)) return FALSE; if (!SeatId && strcmp(dev_seat, "seat0")) return FALSE; return TRUE; } static void device_added(struct udev_device *udev_device) { const char *path, *name = NULL; char *config_info = NULL; const char *syspath; const char *tags_prop; const char *key, *value, *tmp; InputOption *input_options; InputAttributes attrs = { }; DeviceIntPtr dev = NULL; struct udev_list_entry *set, *entry; struct udev_device *parent; int rc; dev_t devnum; path = udev_device_get_devnode(udev_device); syspath = udev_device_get_syspath(udev_device); if (!path || !syspath) return; if (!check_seat(udev_device)) return; devnum = udev_device_get_devnum(udev_device); #ifdef CONFIG_UDEV_KMS if (!strcmp(udev_device_get_subsystem(udev_device), "drm")) { const char *sysname = udev_device_get_sysname(udev_device); if (strncmp(sysname, "card", 4) != 0) return; /* Check for devices already added through xf86platformProbe() */ if (xf86_find_platform_device_by_devnum(major(devnum), minor(devnum))) return; LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path); config_udev_odev_setup_attribs(path, syspath, major(devnum), minor(devnum), NewGPUDeviceRequest); return; } #endif value = udev_device_get_property_value(udev_device, "ID_INPUT"); if (!value || !strcmp(value, "0")) { LogMessageVerb(X_INFO, 10, "config/udev: ignoring device %s without " "property ID_INPUT set\n", path); return; } input_options = input_option_new(NULL, "_source", "server/udev"); if (!input_options) return; parent = udev_device_get_parent(udev_device); if (parent) { const char *ppath = udev_device_get_devnode(parent); const char *product = udev_device_get_property_value(parent, "PRODUCT"); const char *pnp_id = udev_device_get_sysattr_value(parent, "id"); unsigned int usb_vendor, usb_model; name = udev_device_get_sysattr_value(parent, "name"); LOG_SYSATTR(ppath, "name", name); if (!name) { name = udev_device_get_property_value(parent, "NAME"); LOG_PROPERTY(ppath, "NAME", name); } /* construct USB ID in lowercase hex - "0000:ffff" */ if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) { char *usb_id; if (asprintf(&usb_id, "%04x:%04x", usb_vendor, usb_model) == -1) usb_id = NULL; else LOG_PROPERTY(ppath, "PRODUCT", product); attrs.usb_id = usb_id; } while (!pnp_id && (parent = udev_device_get_parent(parent))) { pnp_id = udev_device_get_sysattr_value(parent, "id"); if (!pnp_id) continue; attrs.pnp_id = strdup(pnp_id); ppath = udev_device_get_devnode(parent); LOG_SYSATTR(ppath, "id", pnp_id); } } if (!name) name = "(unnamed)"; else attrs.product = strdup(name); input_options = input_option_new(input_options, "name", name); input_options = input_option_new(input_options, "path", path); input_options = input_option_new(input_options, "device", path); input_options = input_option_new(input_options, "major", itoa(major(devnum))); input_options = input_option_new(input_options, "minor", itoa(minor(devnum))); if (path) attrs.device = strdup(path); tags_prop = udev_device_get_property_value(udev_device, "ID_INPUT.tags"); LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop); attrs.tags = xstrtokenize(tags_prop, ","); if (asprintf(&config_info, "udev:%s", syspath) == -1) { config_info = NULL; goto unwind; } if (device_is_duplicate(config_info)) { LogMessage(X_WARNING, "config/udev: device %s already added. " "Ignoring.\n", name); goto unwind; } set = udev_device_get_properties_list_entry(udev_device); udev_list_entry_foreach(entry, set) { key = udev_list_entry_get_name(entry); if (!key) continue; value = udev_list_entry_get_value(entry); if (!strncasecmp(key, UDEV_XKB_PROP_KEY, sizeof(UDEV_XKB_PROP_KEY) - 1)) { LOG_PROPERTY(path, key, value); tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1; if (!strcasecmp(tmp, "rules")) input_options = input_option_new(input_options, "xkb_rules", value); else if (!strcasecmp(tmp, "layout")) input_options = input_option_new(input_options, "xkb_layout", value); else if (!strcasecmp(tmp, "variant")) input_options = input_option_new(input_options, "xkb_variant", value); else if (!strcasecmp(tmp, "model")) input_options = input_option_new(input_options, "xkb_model", value); else if (!strcasecmp(tmp, "options")) input_options = input_option_new(input_options, "xkb_options", value); } else if (!strcmp(key, "ID_VENDOR")) { LOG_PROPERTY(path, key, value); attrs.vendor = strdup(value); } else if (!strncmp(key, "ID_INPUT_", 9)) { const struct pfmap { const char *property; unsigned int flag; } map[] = { { "ID_INPUT_KEY", ATTR_KEY }, { "ID_INPUT_KEYBOARD", ATTR_KEYBOARD }, { "ID_INPUT_MOUSE", ATTR_POINTER }, { "ID_INPUT_JOYSTICK", ATTR_JOYSTICK }, { "ID_INPUT_TABLET", ATTR_TABLET }, { "ID_INPUT_TABLET_PAD", ATTR_TABLET_PAD }, { "ID_INPUT_TOUCHPAD", ATTR_TOUCHPAD }, { "ID_INPUT_TOUCHSCREEN", ATTR_TOUCHSCREEN }, { NULL, 0 }, }; /* Anything but the literal string "0" is considered a * boolean true. The empty string isn't a thing with udev * properties anyway */ if (value && strcmp(value, "0")) { const struct pfmap *m = map; while (m->property != NULL) { if (!strcmp(m->property, key)) { LOG_PROPERTY(path, key, value); attrs.flags |= m->flag; } m++; } } } } input_options = input_option_new(input_options, "config_info", config_info); /* Default setting needed for non-seat0 seats */ if (ServerIsNotSeat0()) input_options = input_option_new(input_options, "GrabDevice", "on"); LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n", name, path); rc = NewInputDeviceRequest(input_options, &attrs, &dev); if (rc != Success) goto unwind; unwind: free(config_info); input_option_free_list(&input_options); free(attrs.usb_id); free(attrs.pnp_id); free(attrs.product); free(attrs.device); free(attrs.vendor); if (attrs.tags) { char **tag = attrs.tags; while (*tag) { free(*tag); tag++; } free(attrs.tags); } return; } static void device_removed(struct udev_device *device) { char *value; const char *syspath = udev_device_get_syspath(device); #ifdef CONFIG_UDEV_KMS if (!strcmp(udev_device_get_subsystem(device), "drm")) { const char *sysname = udev_device_get_sysname(device); const char *path = udev_device_get_devnode(device); dev_t devnum = udev_device_get_devnum(device); if ((strncmp(sysname,"card", 4) != 0) || (path == NULL)) return; LogMessage(X_INFO, "config/udev: removing GPU device %s %s\n", syspath, path); config_udev_odev_setup_attribs(path, syspath, major(devnum), minor(devnum), DeleteGPUDeviceRequest); /* Retry vtenter after a drm node removal */ systemd_logind_vtenter(); return; } #endif if (asprintf(&value, "udev:%s", syspath) == -1) return; remove_devices("udev", value); free(value); } static void socket_handler(int fd, int ready, void *data) { struct udev_device *udev_device; const char *action; input_lock(); udev_device = udev_monitor_receive_device(udev_monitor); if (!udev_device) { input_unlock(); return; } action = udev_device_get_action(udev_device); if (action) { if (!strcmp(action, "add")) { device_removed(udev_device); device_added(udev_device); } else if (!strcmp(action, "change")) { /* ignore change for the drm devices */ if (strcmp(udev_device_get_subsystem(udev_device), "drm")) { device_removed(udev_device); device_added(udev_device); } } else if (!strcmp(action, "remove")) device_removed(udev_device); } udev_device_unref(udev_device); input_unlock(); } int config_udev_pre_init(void) { struct udev *udev; udev = udev_new(); if (!udev) return 0; udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); if (!udev_monitor) return 0; udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL); /* For Wacom serial devices */ udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); #ifdef CONFIG_UDEV_KMS /* For output GPU devices */ udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "drm", NULL); #endif #ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG if (ServerIsNotSeat0()) udev_monitor_filter_add_match_tag(udev_monitor, SeatId); #endif if (udev_monitor_enable_receiving(udev_monitor)) { ErrorF("config/udev: failed to bind the udev monitor\n"); return 0; } return 1; } int config_udev_init(void) { struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *devices, *device; udev = udev_monitor_get_udev(udev_monitor); enumerate = udev_enumerate_new(udev); if (!enumerate) return 0; udev_enumerate_add_match_subsystem(enumerate, "input"); udev_enumerate_add_match_subsystem(enumerate, "tty"); #ifdef CONFIG_UDEV_KMS udev_enumerate_add_match_subsystem(enumerate, "drm"); #endif #ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG if (ServerIsNotSeat0()) udev_enumerate_add_match_tag(enumerate, SeatId); #endif udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); udev_list_entry_foreach(device, devices) { const char *syspath = udev_list_entry_get_name(device); struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath); /* Device might be gone by the time we try to open it */ if (!udev_device) continue; device_added(udev_device); udev_device_unref(udev_device); } udev_enumerate_unref(enumerate); SetNotifyFd(udev_monitor_get_fd(udev_monitor), socket_handler, X_NOTIFY_READ, NULL); return 1; } void config_udev_fini(void) { struct udev *udev; if (!udev_monitor) return; udev = udev_monitor_get_udev(udev_monitor); RemoveNotifyFd(udev_monitor_get_fd(udev_monitor)); udev_monitor_unref(udev_monitor); udev_monitor = NULL; udev_unref(udev); } #ifdef CONFIG_UDEV_KMS static void config_udev_odev_setup_attribs(const char *path, const char *syspath, int major, int minor, config_odev_probe_proc_ptr probe_callback) { struct OdevAttributes *attribs = config_odev_allocate_attributes(); attribs->path = XNFstrdup(path); attribs->syspath = XNFstrdup(syspath); attribs->major = major; attribs->minor = minor; /* ownership of attribs is passed to probe layer */ probe_callback(attribs); } void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback) { struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *devices, *device; udev = udev_monitor_get_udev(udev_monitor); enumerate = udev_enumerate_new(udev); if (!enumerate) return; udev_enumerate_add_match_subsystem(enumerate, "drm"); udev_enumerate_add_match_sysname(enumerate, "card[0-9]*"); #ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG if (ServerIsNotSeat0()) udev_enumerate_add_match_tag(enumerate, SeatId); #endif udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); udev_list_entry_foreach(device, devices) { const char *syspath = udev_list_entry_get_name(device); struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath); const char *path = udev_device_get_devnode(udev_device); const char *sysname = udev_device_get_sysname(udev_device); dev_t devnum = udev_device_get_devnum(udev_device); if (!path || !syspath) goto no_probe; else if (strcmp(udev_device_get_subsystem(udev_device), "drm") != 0) goto no_probe; else if (strncmp(sysname, "card", 4) != 0) goto no_probe; else if (!check_seat(udev_device)) goto no_probe; config_udev_odev_setup_attribs(path, syspath, major(devnum), minor(devnum), probe_callback); no_probe: udev_device_unref(udev_device); } udev_enumerate_unref(enumerate); return; } #endif xorg-server-1.20.8/config/meson.build0000644000175000017500000000120213640201473014410 00000000000000srcs_config = [ 'config.c', ] config_dep = [common_dep] if build_dbus srcs_config += 'dbus-core.c' config_dep += dbus_dep endif if build_hal srcs_config += 'hal.c' config_dep += hal_dep endif if build_udev srcs_config += 'udev.c' config_dep += udev_dep endif if host_machine.system() == 'openbsd' srcs_config += 'wscons.c' endif if build_xorg install_data('10-quirks.conf', install_dir: join_paths(get_option('datadir'), 'X11/xorg.conf.d')) endif libxserver_config = static_library('libxserver_config', srcs_config, include_directories: inc, dependencies: config_dep, ) xorg-server-1.20.8/missing0000755000175000017500000001533613640201510012405 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: xorg-server-1.20.8/README.md0000644000175000017500000000227213640201473012270 00000000000000X Server -------- The X server accepts requests from client applications to create windows, which are (normally rectangular) "virtual screens" that the client program can draw into. Windows are then composed on the actual screen by the X server (or by a separate composite manager) as directed by the window manager, which usually communicates with the user via graphical controls such as buttons and draggable titlebars and borders. For a comprehensive overview of X Server and X Window System, consult the following article: https://en.wikipedia.org/wiki/X_server All questions regarding this software should be directed at the Xorg mailing list: https://lists.freedesktop.org/mailman/listinfo/xorg The master development code repository can be found at: https://gitlab.freedesktop.org/xorg/xserver For patch submission instructions, see: https://www.x.org/wiki/Development/Documentation/SubmittingPatches As with other projects hosted on freedesktop.org, X.Org follows its Code of Conduct, based on the Contributor Covenant. Please conduct yourself in a respectful and civilized manner when using the above mailing lists, bug trackers, etc: https://www.freedesktop.org/wiki/CodeOfConduct xorg-server-1.20.8/mi/0000755000175000017500000000000013640201533011470 500000000000000xorg-server-1.20.8/mi/mipolyseg.c0000644000175000017500000000600313640201473013566 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmap.h" #include "mi.h" /***************************************************************** * miPolySegment * * For each segment, draws a line between (x1, y1) and (x2, y2). The * lines are drawn in the order listed. * * Walks the segments, compressing them into format for PolyLines. * *****************************************************************/ void miPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSegs) { int i; for (i = 0; i < nseg; i++) { (*pGC->ops->Polylines) (pDraw, pGC, CoordModeOrigin, 2, (DDXPointPtr) pSegs); pSegs++; } } xorg-server-1.20.8/mi/mizerline.c0000644000175000017500000002574313640201473013570 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "miline.h" /* Draw lineSolid, fillStyle-independent zero width lines. * * Must keep X and Y coordinates in "ints" at least until after they're * translated and clipped to accomodate CoordModePrevious lines with very * large coordinates. * * Draws the same pixels regardless of sign(dx) or sign(dy). * * Ken Whaley * */ /* largest positive value that can fit into a component of a point. * Assumes that the point structure is {type x, y;} where type is * a signed type. */ #define MAX_COORDINATE ((1 << (((sizeof(DDXPointRec) >> 1) << 3) - 1)) - 1) #define MI_OUTPUT_POINT(xx, yy)\ {\ if ( !new_span && yy == current_y)\ {\ if (xx < spans->x)\ spans->x = xx;\ ++*widths;\ }\ else\ {\ ++Nspans;\ ++spans;\ ++widths;\ spans->x = xx;\ spans->y = yy;\ *widths = 1;\ current_y = yy;\ new_span = FALSE;\ }\ } void miZeroLine(DrawablePtr pDraw, GCPtr pGC, int mode, /* Origin or Previous */ int npt, /* number of points */ DDXPointPtr pptInit) { int Nspans, current_y = 0; DDXPointPtr ppt; DDXPointPtr pspanInit, spans; int *pwidthInit, *widths, list_len; int xleft, ytop, xright, ybottom; int new_x1, new_y1, new_x2, new_y2; int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart; int oc1, oc2; int result; int pt1_clipped, pt2_clipped = 0; Bool new_span; int signdx, signdy; int clipdx, clipdy; int width, height; int adx, ady; int octant; unsigned int bias = miGetZeroLineBias(pDraw->pScreen); int e, e1, e2, e3; /* Bresenham error terms */ int length; /* length of lines == # of pixels on major axis */ xleft = pDraw->x; ytop = pDraw->y; xright = pDraw->x + pDraw->width - 1; ybottom = pDraw->y + pDraw->height - 1; if (!pGC->miTranslate) { /* do everything in drawable-relative coordinates */ xleft = 0; ytop = 0; xright -= pDraw->x; ybottom -= pDraw->y; } /* it doesn't matter whether we're in drawable or screen coordinates, * FillSpans simply cannot take starting coordinates outside of the * range of a DDXPointRec component. */ if (xright > MAX_COORDINATE) xright = MAX_COORDINATE; if (ybottom > MAX_COORDINATE) ybottom = MAX_COORDINATE; /* since we're clipping to the drawable's boundaries & coordinate * space boundaries, we're guaranteed that the larger of width/height * is the longest span we'll need to output */ width = xright - xleft + 1; height = ybottom - ytop + 1; list_len = (height >= width) ? height : width; pspanInit = xallocarray(list_len, sizeof(DDXPointRec)); pwidthInit = xallocarray(list_len, sizeof(int)); if (!pspanInit || !pwidthInit) { free(pspanInit); free(pwidthInit); return; } Nspans = 0; new_span = TRUE; spans = pspanInit - 1; widths = pwidthInit - 1; ppt = pptInit; xstart = ppt->x; ystart = ppt->y; if (pGC->miTranslate) { xstart += pDraw->x; ystart += pDraw->y; } /* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify * iteration logic */ x2 = xstart; y2 = ystart; oc2 = 0; MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); while (--npt > 0) { x1 = x2; y1 = y2; oc1 = oc2; ++ppt; x2 = ppt->x; y2 = ppt->y; if (pGC->miTranslate && (mode != CoordModePrevious)) { x2 += pDraw->x; y2 += pDraw->y; } else if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } oc2 = 0; MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (ady + 1 > (list_len - Nspans)) { (*pGC->ops->FillSpans) (pDraw, pGC, Nspans, pspanInit, pwidthInit, FALSE); Nspans = 0; spans = pspanInit - 1; widths = pwidthInit - 1; } new_span = TRUE; if (adx > ady) { e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; length = adx; /* don't draw endpoint in main loop */ FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if ((oc1 | oc2) != 0) { result = miZeroClipLine(xleft, ytop, xright, ybottom, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) continue; length = abs(new_x2 - new_x1); /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter */ if (pt2_clipped) length++; if (pt1_clipped) { /* must calculate new error terms */ clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); e += (clipdy * e2) + ((clipdx - clipdy) * e1); } } /* draw the segment */ x = new_x1; y = new_y1; e3 = e2 - e1; e = e - e1; while (length--) { MI_OUTPUT_POINT(x, y); e += e1; if (e >= 0) { y += signdy; e += e3; } x += signdx; } } else { /* Y major line */ e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; length = ady; /* don't draw endpoint in main loop */ SetYMajorOctant(octant); FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if ((oc1 | oc2) != 0) { result = miZeroClipLine(xleft, ytop, xright, ybottom, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) continue; length = abs(new_y2 - new_y1); /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter */ if (pt2_clipped) length++; if (pt1_clipped) { /* must calculate new error terms */ clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); e += (clipdx * e2) + ((clipdy - clipdx) * e1); } } /* draw the segment */ x = new_x1; y = new_y1; e3 = e2 - e1; e = e - e1; while (length--) { MI_OUTPUT_POINT(x, y); e += e1; if (e >= 0) { x += signdx; e += e3; } y += signdy; } } } /* only do the capnotlast check on the last segment * and only if the endpoint wasn't clipped. And then, if the last * point is the same as the first point, do not draw it, unless the * line is degenerate */ if ((!pt2_clipped) && (pGC->capStyle != CapNotLast) && (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1))) { MI_OUTPUT_POINT(x, y); } if (Nspans > 0) (*pGC->ops->FillSpans) (pDraw, pGC, Nspans, pspanInit, pwidthInit, FALSE); free(pwidthInit); free(pspanInit); } void miZeroDashLine(DrawablePtr dst, GCPtr pgc, int mode, int nptInit, /* number of points in polyline */ DDXPointRec * pptInit /* points in the polyline */ ) { /* XXX kludge until real zero-width dash code is written */ pgc->lineWidth = 1; miWideDash(dst, pgc, mode, nptInit, pptInit); pgc->lineWidth = 0; } xorg-server-1.20.8/mi/misprite.h0000644000175000017500000000414113640201473013420 00000000000000/* * misprite.h * * software-sprite/sprite drawing interface spec * * mi versions of these routines exist. */ /* Copyright 1989, 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. */ extern Bool miSpriteInitialize(ScreenPtr /*pScreen */ , miPointerScreenFuncPtr /*screenFuncs */ ); extern Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); extern Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); extern Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y, unsigned long source, unsigned long mask); extern Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h); extern Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h); extern Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); extern void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); xorg-server-1.20.8/mi/Makefile.am0000644000175000017500000000154013640201473013447 00000000000000noinst_LTLIBRARIES = libmi.la if XORG sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \ migc.h mipointrst.h mizerarc.h micoord.h \ mistruct.h mioverlay.h endif AM_CFLAGS = $(DIX_CFLAGS) libmi_la_SOURCES = \ mi.h \ miarc.c \ mibitblt.c \ micmap.c \ micmap.h \ micoord.h \ micopy.c \ midash.c \ midispcur.c \ mieq.c \ miexpose.c \ mifillarc.c \ mifillarc.h \ mifillrct.c \ mifpoly.h \ migc.c \ migc.h \ miglblt.c \ miline.h \ mioverlay.c \ mioverlay.h \ mipointer.c \ mipointer.h \ mipointrst.h \ mipoly.c \ mipoly.h \ mipolypnt.c \ mipolyrect.c \ mipolyseg.c \ mipolytext.c \ mipushpxl.c \ miscanfill.h \ miscrinit.c \ misprite.c \ misprite.h \ mistruct.h \ mivaltree.c \ mivalidate.h \ miwideline.c \ miwideline.h \ miwindow.c \ mizerarc.c \ mizerarc.h \ mizerclip.c \ mizerline.c xorg-server-1.20.8/mi/mioverlay.c0000644000175000017500000016310313640201473013572 00000000000000 #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "scrnintstr.h" #include #include "validate.h" #include "windowstr.h" #include "mi.h" #include "gcstruct.h" #include "regionstr.h" #include "privates.h" #include "mivalidate.h" #include "mioverlay.h" #include "migc.h" #include "globals.h" typedef struct { RegionRec exposed; RegionRec borderExposed; RegionPtr borderVisible; DDXPointRec oldAbsCorner; } miOverlayValDataRec, *miOverlayValDataPtr; typedef struct _TreeRec { WindowPtr pWin; struct _TreeRec *parent; struct _TreeRec *firstChild; struct _TreeRec *lastChild; struct _TreeRec *prevSib; struct _TreeRec *nextSib; RegionRec borderClip; RegionRec clipList; unsigned visibility; miOverlayValDataPtr valdata; } miOverlayTreeRec, *miOverlayTreePtr; typedef struct { miOverlayTreePtr tree; } miOverlayWindowRec, *miOverlayWindowPtr; typedef struct { CloseScreenProcPtr CloseScreen; CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; UnrealizeWindowProcPtr UnrealizeWindow; RealizeWindowProcPtr RealizeWindow; miOverlayTransFunc MakeTransparent; miOverlayInOverlayFunc InOverlay; Bool underlayMarked; Bool copyUnderlay; } miOverlayScreenRec, *miOverlayScreenPtr; static DevPrivateKeyRec miOverlayWindowKeyRec; #define miOverlayWindowKey (&miOverlayWindowKeyRec) static DevPrivateKeyRec miOverlayScreenKeyRec; #define miOverlayScreenKey (&miOverlayScreenKeyRec) static void RebuildTree(WindowPtr); static Bool HasUnderlayChildren(WindowPtr); static void MarkUnderlayWindow(WindowPtr); static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr); static Bool miOverlayCloseScreen(ScreenPtr); static Bool miOverlayCreateWindow(WindowPtr); static Bool miOverlayDestroyWindow(WindowPtr); static Bool miOverlayUnrealizeWindow(WindowPtr); static Bool miOverlayRealizeWindow(WindowPtr); static void miOverlayMarkWindow(WindowPtr); static void miOverlayReparentWindow(WindowPtr, WindowPtr); static void miOverlayRestackWindow(WindowPtr, WindowPtr); static Bool miOverlayMarkOverlappedWindows(WindowPtr, WindowPtr, WindowPtr *); static void miOverlayMarkUnrealizedWindow(WindowPtr, WindowPtr, Bool); static int miOverlayValidateTree(WindowPtr, WindowPtr, VTKind); static void miOverlayHandleExposures(WindowPtr); static void miOverlayMoveWindow(WindowPtr, int, int, WindowPtr, VTKind); static void miOverlayWindowExposures(WindowPtr, RegionPtr); static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int, unsigned int, WindowPtr); static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool); static void miOverlaySetShape(WindowPtr, int); static void miOverlayChangeBorderWidth(WindowPtr, unsigned int); #define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, miOverlayScreenKey)) #define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) ((miOverlayWindowPtr) \ dixLookupPrivate(&(pWin)->devPrivates, miOverlayWindowKey)) #define MIOVERLAY_GET_WINDOW_TREE(pWin) \ (MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree) #define IN_UNDERLAY(w) MIOVERLAY_GET_WINDOW_TREE(w) #define IN_OVERLAY(w) !MIOVERLAY_GET_WINDOW_TREE(w) #define MARK_OVERLAY(w) miMarkWindow(w) #define MARK_UNDERLAY(w) MarkUnderlayWindow(w) #define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ HasBorder(w) && \ (w)->backgroundState == ParentRelative) Bool miInitOverlay(ScreenPtr pScreen, miOverlayInOverlayFunc inOverlayFunc, miOverlayTransFunc transFunc) { miOverlayScreenPtr pScreenPriv; if (!inOverlayFunc || !transFunc) return FALSE; if (!dixRegisterPrivateKey (&miOverlayWindowKeyRec, PRIVATE_WINDOW, sizeof(miOverlayWindowRec))) return FALSE; if (!dixRegisterPrivateKey(&miOverlayScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!(pScreenPriv = malloc(sizeof(miOverlayScreenRec)))) return FALSE; dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv); pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->MakeTransparent = transFunc; pScreenPriv->underlayMarked = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->CreateWindow = pScreen->CreateWindow; pScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; pScreenPriv->RealizeWindow = pScreen->RealizeWindow; pScreen->CloseScreen = miOverlayCloseScreen; pScreen->CreateWindow = miOverlayCreateWindow; pScreen->DestroyWindow = miOverlayDestroyWindow; pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; pScreen->RealizeWindow = miOverlayRealizeWindow; pScreen->ReparentWindow = miOverlayReparentWindow; pScreen->RestackWindow = miOverlayRestackWindow; pScreen->MarkOverlappedWindows = miOverlayMarkOverlappedWindows; pScreen->MarkUnrealizedWindow = miOverlayMarkUnrealizedWindow; pScreen->ValidateTree = miOverlayValidateTree; pScreen->HandleExposures = miOverlayHandleExposures; pScreen->MoveWindow = miOverlayMoveWindow; pScreen->WindowExposures = miOverlayWindowExposures; pScreen->ResizeWindow = miOverlayResizeWindow; pScreen->MarkWindow = miOverlayMarkWindow; pScreen->ClearToBackground = miOverlayClearToBackground; pScreen->SetShape = miOverlaySetShape; pScreen->ChangeBorderWidth = miOverlayChangeBorderWidth; return TRUE; } static Bool miOverlayCloseScreen(ScreenPtr pScreen) { miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateWindow = pScreenPriv->CreateWindow; pScreen->DestroyWindow = pScreenPriv->DestroyWindow; pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; pScreen->RealizeWindow = pScreenPriv->RealizeWindow; free(pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static Bool miOverlayCreateWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayWindowPtr pWinPriv = MIOVERLAY_GET_WINDOW_PRIVATE(pWin); miOverlayTreePtr pTree = NULL; Bool result = TRUE; pWinPriv->tree = NULL; if (!pWin->parent || !((*pScreenPriv->InOverlay) (pWin))) { if (!(pTree = (miOverlayTreePtr) calloc(1, sizeof(miOverlayTreeRec)))) return FALSE; } if (pScreenPriv->CreateWindow) { pScreen->CreateWindow = pScreenPriv->CreateWindow; result = (*pScreen->CreateWindow) (pWin); pScreen->CreateWindow = miOverlayCreateWindow; } if (pTree) { if (result) { pTree->pWin = pWin; pTree->visibility = VisibilityNotViewable; pWinPriv->tree = pTree; if (pWin->parent) { RegionNull(&(pTree->borderClip)); RegionNull(&(pTree->clipList)); RebuildTree(pWin); } else { BoxRec fullBox; fullBox.x1 = 0; fullBox.y1 = 0; fullBox.x2 = pScreen->width; fullBox.y2 = pScreen->height; RegionInit(&(pTree->borderClip), &fullBox, 1); RegionInit(&(pTree->clipList), &fullBox, 1); } } else free(pTree); } return TRUE; } static Bool miOverlayDestroyWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); Bool result = TRUE; if (pTree) { if (pTree->prevSib) pTree->prevSib->nextSib = pTree->nextSib; else if (pTree->parent) pTree->parent->firstChild = pTree->nextSib; if (pTree->nextSib) pTree->nextSib->prevSib = pTree->prevSib; else if (pTree->parent) pTree->parent->lastChild = pTree->prevSib; RegionUninit(&(pTree->borderClip)); RegionUninit(&(pTree->clipList)); free(pTree); } if (pScreenPriv->DestroyWindow) { pScreen->DestroyWindow = pScreenPriv->DestroyWindow; result = (*pScreen->DestroyWindow) (pWin); pScreen->DestroyWindow = miOverlayDestroyWindow; } return result; } static Bool miOverlayUnrealizeWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); Bool result = TRUE; if (pTree) pTree->visibility = VisibilityNotViewable; if (pScreenPriv->UnrealizeWindow) { pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; result = (*pScreen->UnrealizeWindow) (pWin); pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; } return result; } static Bool miOverlayRealizeWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); Bool result = TRUE; if (pScreenPriv->RealizeWindow) { pScreen->RealizeWindow = pScreenPriv->RealizeWindow; result = (*pScreen->RealizeWindow) (pWin); pScreen->RealizeWindow = miOverlayRealizeWindow; } /* we only need to catch the root window realization */ if (result && !pWin->parent && !((*pScreenPriv->InOverlay) (pWin))) { BoxRec box; box.x1 = box.y1 = 0; box.x2 = pWin->drawable.width; box.y2 = pWin->drawable.height; (*pScreenPriv->MakeTransparent) (pScreen, 1, &box); } return result; } static void miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) { if (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) { /* This could probably be more optimal */ RebuildTree(pWin->drawable.pScreen->root->firstChild); } } static void miOverlayRestackWindow(WindowPtr pWin, WindowPtr oldNextSib) { if (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) { /* This could probably be more optimal */ RebuildTree(pWin); } } static Bool miOverlayMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *pLayerWin) { WindowPtr pChild, pLast; Bool overMarked, underMarked, doUnderlay, markAll; miOverlayTreePtr pTree = NULL, tLast, tChild; BoxPtr box; overMarked = underMarked = markAll = FALSE; if (pLayerWin) *pLayerWin = pWin; /* hah! */ doUnderlay = (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)); box = RegionExtents(&pWin->borderSize); if ((pChild = pFirst)) { pLast = pChild->parent->lastChild; while (1) { if (pChild == pWin) markAll = TRUE; if (doUnderlay && IN_UNDERLAY(pChild)) pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); if (pChild->viewable) { if (RegionBroken(&pChild->winSize)) SetWinSize(pChild); if (RegionBroken(&pChild->borderSize)) SetBorderSize(pChild); if (markAll || RegionContainsRect(&pChild->borderSize, box)) { MARK_OVERLAY(pChild); overMarked = TRUE; if (doUnderlay && IN_UNDERLAY(pChild)) { MARK_UNDERLAY(pChild); underMarked = TRUE; } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } } while (!pChild->nextSib && (pChild != pLast)) { pChild = pChild->parent; if (doUnderlay && IN_UNDERLAY(pChild)) pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); } if (pChild == pWin) markAll = FALSE; if (pChild == pLast) break; pChild = pChild->nextSib; } if (overMarked) MARK_OVERLAY(pWin->parent); } if (doUnderlay && !pTree) { if (!(pTree = MIOVERLAY_GET_WINDOW_TREE(pWin))) { pChild = pWin->lastChild; while (1) { if ((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) break; if (pChild->lastChild) { pChild = pChild->lastChild; continue; } while (!pChild->prevSib) pChild = pChild->parent; pChild = pChild->prevSib; } } } if (pTree && pTree->nextSib) { tChild = pTree->parent->lastChild; tLast = pTree->nextSib; while (1) { if (tChild->pWin->viewable) { if (RegionBroken(&tChild->pWin->winSize)) SetWinSize(tChild->pWin); if (RegionBroken(&tChild->pWin->borderSize)) SetBorderSize(tChild->pWin); if (RegionContainsRect(&(tChild->pWin->borderSize), box)) { MARK_UNDERLAY(tChild->pWin); underMarked = TRUE; } } if (tChild->lastChild) { tChild = tChild->lastChild; continue; } while (!tChild->prevSib && (tChild != tLast)) tChild = tChild->parent; if (tChild == tLast) break; tChild = tChild->prevSib; } } if (underMarked) { ScreenPtr pScreen = pWin->drawable.pScreen; MARK_UNDERLAY(pTree->parent->pWin); MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->underlayMarked = TRUE; } return underMarked || overMarked; } static void miOverlayComputeClips(WindowPtr pParent, RegionPtr universe, VTKind kind, RegionPtr exposed) { ScreenPtr pScreen = pParent->drawable.pScreen; int oldVis, newVis, dx, dy; BoxRec borderSize; RegionPtr borderVisible; RegionRec childUniverse, childUnion; miOverlayTreePtr tParent = MIOVERLAY_GET_WINDOW_TREE(pParent); miOverlayTreePtr tChild; Bool overlap; borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); if (dx > 32767) dx = 32767; borderSize.x2 = dx; dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); if (dy > 32767) dy = 32767; borderSize.y2 = dy; oldVis = tParent->visibility; switch (RegionContainsRect(universe, &borderSize)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnPART: newVis = VisibilityPartiallyObscured; { RegionPtr pBounding; if ((pBounding = wBoundingShape(pParent))) { switch (miShapedWindowIn(universe, pBounding, &borderSize, pParent->drawable.x, pParent->drawable.y)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnOUT: newVis = VisibilityFullyObscured; break; } } } break; default: newVis = VisibilityFullyObscured; break; } tParent->visibility = newVis; dx = pParent->drawable.x - tParent->valdata->oldAbsCorner.x; dy = pParent->drawable.y - tParent->valdata->oldAbsCorner.y; switch (kind) { case VTMap: case VTStack: case VTUnmap: break; case VTMove: if ((oldVis == newVis) && ((oldVis == VisibilityFullyObscured) || (oldVis == VisibilityUnobscured))) { tChild = tParent; while (1) { if (tChild->pWin->viewable) { if (tChild->visibility != VisibilityFullyObscured) { RegionTranslate(&tChild->borderClip, dx, dy); RegionTranslate(&tChild->clipList, dx, dy); tChild->pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (*pScreen->ClipNotify) (tChild->pWin, dx, dy); } if (tChild->valdata) { RegionNull(&tChild->valdata->borderExposed); if (HasParentRelativeBorder(tChild->pWin)) { RegionSubtract(&tChild->valdata->borderExposed, &tChild->borderClip, &tChild->pWin->winSize); } RegionNull(&tChild->valdata->exposed); } if (tChild->firstChild) { tChild = tChild->firstChild; continue; } } while (!tChild->nextSib && (tChild != tParent)) tChild = tChild->parent; if (tChild == tParent) break; tChild = tChild->nextSib; } return; } /* fall through */ default: if (dx || dy) { RegionTranslate(&tParent->borderClip, dx, dy); RegionTranslate(&tParent->clipList, dx, dy); } break; case VTBroken: RegionEmpty(&tParent->borderClip); RegionEmpty(&tParent->clipList); break; } borderVisible = tParent->valdata->borderVisible; RegionNull(&tParent->valdata->borderExposed); RegionNull(&tParent->valdata->exposed); if (HasBorder(pParent)) { if (borderVisible) { RegionSubtract(exposed, universe, borderVisible); RegionDestroy(borderVisible); } else RegionSubtract(exposed, universe, &tParent->borderClip); if (HasParentRelativeBorder(pParent) && (dx || dy)) RegionSubtract(&tParent->valdata->borderExposed, universe, &pParent->winSize); else RegionSubtract(&tParent->valdata->borderExposed, exposed, &pParent->winSize); RegionCopy(&tParent->borderClip, universe); RegionIntersect(universe, universe, &pParent->winSize); } else RegionCopy(&tParent->borderClip, universe); if ((tChild = tParent->firstChild) && pParent->mapped) { RegionNull(&childUniverse); RegionNull(&childUnion); for (; tChild; tChild = tChild->nextSib) { if (tChild->pWin->viewable) RegionAppend(&childUnion, &tChild->pWin->borderSize); } RegionValidate(&childUnion, &overlap); for (tChild = tParent->firstChild; tChild; tChild = tChild->nextSib) { if (tChild->pWin->viewable) { if (tChild->valdata) { RegionIntersect(&childUniverse, universe, &tChild->pWin->borderSize); miOverlayComputeClips(tChild->pWin, &childUniverse, kind, exposed); } if (overlap) RegionSubtract(universe, universe, &tChild->pWin->borderSize); } } if (!overlap) RegionSubtract(universe, universe, &childUnion); RegionUninit(&childUnion); RegionUninit(&childUniverse); } if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { RegionCopy(&tParent->valdata->exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { RegionSubtract(&tParent->valdata->exposed, universe, &tParent->clipList); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = tParent->clipList; tParent->clipList = *universe; *universe = tmp; } pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pParent, dx, dy); } static void miOverlayMarkWindow(WindowPtr pWin) { miOverlayTreePtr pTree = NULL; WindowPtr pChild, pGrandChild; miMarkWindow(pWin); /* look for UnmapValdata among immediate children */ if (!(pChild = pWin->firstChild)) return; for (; pChild; pChild = pChild->nextSib) { if (pChild->valdata == UnmapValData) { if (IN_UNDERLAY(pChild)) { pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); pTree->valdata = (miOverlayValDataPtr) UnmapValData; continue; } else { if (!(pGrandChild = pChild->firstChild)) continue; while (1) { if (IN_UNDERLAY(pGrandChild)) { pTree = MIOVERLAY_GET_WINDOW_TREE(pGrandChild); pTree->valdata = (miOverlayValDataPtr) UnmapValData; } else if (pGrandChild->firstChild) { pGrandChild = pGrandChild->firstChild; continue; } while (!pGrandChild->nextSib && (pGrandChild != pChild)) pGrandChild = pGrandChild->parent; if (pChild == pGrandChild) break; pGrandChild = pGrandChild->nextSib; } } } } if (pTree) { MARK_UNDERLAY(pTree->parent->pWin); MIOVERLAY_GET_SCREEN_PRIVATE(pWin->drawable.pScreen)->underlayMarked = TRUE; } } static void miOverlayMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure) { if ((pChild != pWin) || fromConfigure) { miOverlayTreePtr pTree; RegionEmpty(&pChild->clipList); if (pChild->drawable.pScreen->ClipNotify) (*pChild->drawable.pScreen->ClipNotify) (pChild, 0, 0); RegionEmpty(&pChild->borderClip); if ((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) { if (pTree->valdata != (miOverlayValDataPtr) UnmapValData) { RegionEmpty(&pTree->clipList); RegionEmpty(&pTree->borderClip); } } } } static int miOverlayValidateTree(WindowPtr pParent, WindowPtr pChild, /* first child effected */ VTKind kind) { ScreenPtr pScreen = pParent->drawable.pScreen; miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); RegionRec totalClip, childClip, exposed; miOverlayTreePtr tParent, tChild, tWin; Bool overlap; WindowPtr newParent; if (!pPriv->underlayMarked) goto SKIP_UNDERLAY; if (!pChild) pChild = pParent->firstChild; RegionNull(&totalClip); RegionNull(&childClip); RegionNull(&exposed); newParent = pParent; while (IN_OVERLAY(newParent)) newParent = newParent->parent; tParent = MIOVERLAY_GET_WINDOW_TREE(newParent); if (IN_UNDERLAY(pChild)) tChild = MIOVERLAY_GET_WINDOW_TREE(pChild); else tChild = tParent->firstChild; if (RegionBroken(&tParent->clipList) && !RegionBroken(&tParent->borderClip)) { kind = VTBroken; RegionCopy(&totalClip, &tParent->borderClip); RegionIntersect(&totalClip, &totalClip, &tParent->pWin->winSize); for (tWin = tParent->firstChild; tWin != tChild; tWin = tWin->nextSib) { if (tWin->pWin->viewable) RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize); } RegionEmpty(&tParent->clipList); } else { for (tWin = tChild; tWin; tWin = tWin->nextSib) { if (tWin->valdata) RegionAppend(&totalClip, &tWin->borderClip); } RegionValidate(&totalClip, &overlap); } if (kind != VTStack) RegionUnion(&totalClip, &totalClip, &tParent->clipList); for (tWin = tChild; tWin; tWin = tWin->nextSib) { if (tWin->valdata) { if (tWin->pWin->viewable) { RegionIntersect(&childClip, &totalClip, &tWin->pWin->borderSize); miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed); RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize); } else { /* Means we are unmapping */ RegionEmpty(&tWin->clipList); RegionEmpty(&tWin->borderClip); tWin->valdata = NULL; } } } RegionUninit(&childClip); if (!((*pPriv->InOverlay) (newParent))) { RegionNull(&tParent->valdata->exposed); RegionNull(&tParent->valdata->borderExposed); } switch (kind) { case VTStack: break; default: if (!((*pPriv->InOverlay) (newParent))) RegionSubtract(&tParent->valdata->exposed, &totalClip, &tParent->clipList); /* fall through */ case VTMap: RegionCopy(&tParent->clipList, &totalClip); if (!((*pPriv->InOverlay) (newParent))) newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } RegionUninit(&totalClip); RegionUninit(&exposed); SKIP_UNDERLAY: miValidateTree(pParent, pChild, kind); return 1; } static void miOverlayHandleExposures(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); WindowPtr pChild; ValidatePtr val; WindowExposuresProcPtr WindowExposures; WindowExposures = pWin->drawable.pScreen->WindowExposures; if (pPriv->underlayMarked) { miOverlayTreePtr pTree; miOverlayValDataPtr mival; pChild = pWin; while (IN_OVERLAY(pChild)) pChild = pChild->parent; pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); while (1) { if ((mival = pTree->valdata)) { if (!((*pPriv->InOverlay) (pTree->pWin))) { if (RegionNotEmpty(&mival->borderExposed)) { pScreen->PaintWindow(pTree->pWin, &mival->borderExposed, PW_BORDER); } RegionUninit(&mival->borderExposed); (*WindowExposures) (pTree->pWin, &mival->exposed); RegionUninit(&mival->exposed); } free(mival); pTree->valdata = NULL; if (pTree->firstChild) { pTree = pTree->firstChild; continue; } } while (!pTree->nextSib && (pTree->pWin != pChild)) pTree = pTree->parent; if (pTree->pWin == pChild) break; pTree = pTree->nextSib; } pPriv->underlayMarked = FALSE; } pChild = pWin; while (1) { if ((val = pChild->valdata)) { if (!((*pPriv->InOverlay) (pChild))) { RegionUnion(&val->after.exposed, &val->after.exposed, &val->after.borderExposed); if (RegionNotEmpty(&val->after.exposed)) { (*(MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent)) (pScreen, RegionNumRects(&val->after.exposed), RegionRects(&val->after.exposed)); } } else { if (RegionNotEmpty(&val->after.borderExposed)) { pScreen->PaintWindow(pChild, &val->after.borderExposed, PW_BORDER); } (*WindowExposures) (pChild, &val->after.exposed); } RegionUninit(&val->after.borderExposed); RegionUninit(&val->after.exposed); free(val); pChild->valdata = NULL; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } static void miOverlayMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); WindowPtr pParent, windowToValidate; Bool WasViewable = (Bool) (pWin->viewable); short bw; RegionRec overReg, underReg; DDXPointRec oldpt; if (!(pParent = pWin->parent)) return; bw = wBorderWidth(pWin); oldpt.x = pWin->drawable.x; oldpt.y = pWin->drawable.y; if (WasViewable) { RegionNull(&overReg); RegionNull(&underReg); if (pTree) { RegionCopy(&overReg, &pWin->borderClip); RegionCopy(&underReg, &pTree->borderClip); } else { RegionCopy(&overReg, &pWin->borderClip); CollectUnderlayChildrenRegions(pWin, &underReg); } (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); } pWin->origin.x = x + (int) bw; pWin->origin.y = y + (int) bw; x = pWin->drawable.x = pParent->drawable.x + x + (int) bw; y = pWin->drawable.y = pParent->drawable.y + y + (int) bw; SetWinSize(pWin); SetBorderSize(pWin); (*pScreen->PositionWindow) (pWin, x, y); windowToValidate = MoveWindowInStack(pWin, pNextSib); ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0); if (WasViewable) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, NULL); (*pScreen->ValidateTree) (pWin->parent, NullWindow, kind); if (RegionNotEmpty(&underReg)) { pPriv->copyUnderlay = TRUE; (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, &underReg); } RegionUninit(&underReg); if (RegionNotEmpty(&overReg)) { pPriv->copyUnderlay = FALSE; (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, &overReg); } RegionUninit(&overReg); (*pScreen->HandleExposures) (pWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pWin->parent, NullWindow, kind); } if (pWin->realized) WindowsRestructured(); } #ifndef RECTLIMIT #define RECTLIMIT 25 #endif static void miOverlayWindowExposures(WindowPtr pWin, RegionPtr prgn) { RegionPtr exposures = prgn; ScreenPtr pScreen = pWin->drawable.pScreen; if (prgn && !RegionNil(prgn)) { RegionRec expRec; int clientInterested = (pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask; if (clientInterested && (RegionNumRects(prgn) > RECTLIMIT)) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); BoxRec box; box = *RegionExtents(prgn); exposures = &expRec; RegionInit(exposures, &box, 1); RegionReset(prgn, &box); /* This is the only reason why we are replacing mi's version of this file */ if (!((*pPriv->InOverlay) (pWin))) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionIntersect(prgn, prgn, &pTree->clipList); } else RegionIntersect(prgn, prgn, &pWin->clipList); } pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND); if (clientInterested) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) RegionUninit(exposures); RegionEmpty(prgn); } } typedef struct { RegionPtr over; RegionPtr under; } miOverlayTwoRegions; static int miOverlayRecomputeExposures(WindowPtr pWin, void *value) { miOverlayTwoRegions *pValid = (miOverlayTwoRegions *) value; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if (pWin->valdata) { /* * compute exposed regions of this window */ RegionSubtract(&pWin->valdata->after.exposed, &pWin->clipList, pValid->over); /* * compute exposed regions of the border */ RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->borderClip, &pWin->winSize); RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->valdata->after.borderExposed, pValid->over); } if (pTree && pTree->valdata) { RegionSubtract(&pTree->valdata->exposed, &pTree->clipList, pValid->under); RegionSubtract(&pTree->valdata->borderExposed, &pTree->borderClip, &pWin->winSize); RegionSubtract(&pTree->valdata->borderExposed, &pTree->valdata->borderExposed, pValid->under); } else if (!pWin->valdata) return WT_NOMATCH; return WT_WALKCHILDREN; } static void miOverlayResizeWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib) { ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pParent; miOverlayTreePtr tChild, pTree; Bool WasViewable = (Bool) (pWin->viewable); unsigned short width = pWin->drawable.width; unsigned short height = pWin->drawable.height; short oldx = pWin->drawable.x; short oldy = pWin->drawable.y; int bw = wBorderWidth(pWin); short dw, dh; DDXPointRec oldpt; RegionPtr oldRegion = NULL, oldRegion2 = NULL; WindowPtr pFirstChange; WindowPtr pChild; RegionPtr gravitate[StaticGravity + 1]; RegionPtr gravitate2[StaticGravity + 1]; unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ RegionPtr pRegion = NULL; RegionPtr destClip, destClip2; RegionPtr oldWinClip = NULL, oldWinClip2 = NULL; RegionPtr borderVisible = NullRegion; RegionPtr borderVisible2 = NullRegion; Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ Bool doUnderlay; /* if this is a root window, can't be resized */ if (!(pParent = pWin->parent)) return; pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); doUnderlay = ((pTree) || HasUnderlayChildren(pWin)); newx = pParent->drawable.x + x + bw; newy = pParent->drawable.y + y + bw; if (WasViewable) { /* * save the visible region of the window */ oldRegion = RegionCreate(NullBox, 1); RegionCopy(oldRegion, &pWin->winSize); if (doUnderlay) { oldRegion2 = RegionCreate(NullBox, 1); RegionCopy(oldRegion2, &pWin->winSize); } /* * categorize child windows into regions to be moved */ for (g = 0; g <= StaticGravity; g++) gravitate[g] = gravitate2[g] = NULL; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { g = pChild->winGravity; if (g != UnmapGravity) { if (!gravitate[g]) gravitate[g] = RegionCreate(NullBox, 1); RegionUnion(gravitate[g], gravitate[g], &pChild->borderClip); if (doUnderlay) { if (!gravitate2[g]) gravitate2[g] = RegionCreate(NullBox, 0); if ((tChild = MIOVERLAY_GET_WINDOW_TREE(pChild))) { RegionUnion(gravitate2[g], gravitate2[g], &tChild->borderClip); } else CollectUnderlayChildrenRegions(pChild, gravitate2[g]); } } else { UnmapWindow(pChild, TRUE); } } (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); oldWinClip = oldWinClip2 = NULL; if (pWin->bitGravity != ForgetGravity) { oldWinClip = RegionCreate(NullBox, 1); RegionCopy(oldWinClip, &pWin->clipList); if (pTree) { oldWinClip2 = RegionCreate(NullBox, 1); RegionCopy(oldWinClip2, &pTree->clipList); } } /* * if the window is changing size, borderExposed * can't be computed correctly without some help. */ if (pWin->drawable.height > h || pWin->drawable.width > w) shrunk = TRUE; if (newx != oldx || newy != oldy) moved = TRUE; if ((pWin->drawable.height != h || pWin->drawable.width != w) && HasBorder(pWin)) { borderVisible = RegionCreate(NullBox, 1); if (pTree) borderVisible2 = RegionCreate(NullBox, 1); /* for tiled borders, we punt and draw the whole thing */ if (pWin->borderIsPixel || !moved) { if (shrunk || moved) RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); else RegionCopy(borderVisible, &pWin->borderClip); if (pTree) { if (shrunk || moved) RegionSubtract(borderVisible, &pTree->borderClip, &pWin->winSize); else RegionCopy(borderVisible, &pTree->borderClip); } } } } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.height = h; pWin->drawable.width = w; x = pWin->drawable.x = newx; y = pWin->drawable.y = newy; SetWinSize(pWin); SetBorderSize(pWin); dw = (int) w - (int) width; dh = (int) h - (int) height; ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh); /* let the hardware adjust background and border pixmaps, if any */ (*pScreen->PositionWindow) (pWin, x, y); pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { pRegion = RegionCreate(NullBox, 1); (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange, NULL); pWin->valdata->before.resized = TRUE; pWin->valdata->before.borderVisible = borderVisible; if (pTree) pTree->valdata->borderVisible = borderVisible2; (*pScreen->ValidateTree) (pWin->parent, pFirstChange, VTOther); /* * the entire window is trashed unless bitGravity * recovers portions of it */ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList); if (pTree) RegionCopy(&pTree->valdata->exposed, &pTree->clipList); } GravityTranslate(x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); if (WasViewable) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTwoRegions TwoRegions; /* avoid the border */ if (HasBorder(pWin)) { int offx, offy, dx, dy; /* kruft to avoid double translates for each gravity */ offx = 0; offy = 0; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g] && !gravitate2[g]) continue; /* align winSize to gravitate[g]. * winSize is in new coordinates, * gravitate[g] is still in old coordinates */ GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny); dx = (oldx - nx) - offx; dy = (oldy - ny) - offy; if (dx || dy) { RegionTranslate(&pWin->winSize, dx, dy); offx += dx; offy += dy; } if (gravitate[g]) RegionIntersect(gravitate[g], gravitate[g], &pWin->winSize); if (gravitate2[g]) RegionIntersect(gravitate2[g], gravitate2[g], &pWin->winSize); } /* get winSize back where it belongs */ if (offx || offy) RegionTranslate(&pWin->winSize, -offx, -offy); } /* * add screen bits to the appropriate bucket */ if (oldWinClip2) { RegionCopy(pRegion, oldWinClip2); RegionTranslate(pRegion, nx - oldx, ny - oldy); RegionIntersect(oldWinClip2, pRegion, &pTree->clipList); for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate2[g]) RegionSubtract(oldWinClip2, oldWinClip2, gravitate2[g]); } RegionTranslate(oldWinClip2, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate2[g]) gravitate2[g] = oldWinClip2; else { RegionUnion(gravitate2[g], gravitate2[g], oldWinClip2); RegionDestroy(oldWinClip2); } } if (oldWinClip) { /* * clip to new clipList */ RegionCopy(pRegion, oldWinClip); RegionTranslate(pRegion, nx - oldx, ny - oldy); RegionIntersect(oldWinClip, pRegion, &pWin->clipList); /* * don't step on any gravity bits which will be copied after this * region. Note -- this assumes that the regions will be copied * in gravity order. */ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate[g]) RegionSubtract(oldWinClip, oldWinClip, gravitate[g]); } RegionTranslate(oldWinClip, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate[g]) gravitate[g] = oldWinClip; else { RegionUnion(gravitate[g], gravitate[g], oldWinClip); RegionDestroy(oldWinClip); } } /* * move the bits on the screen */ destClip = destClip2 = NULL; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g] && !gravitate2[g]) continue; GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny); oldpt.x = oldx + (x - nx); oldpt.y = oldy + (y - ny); /* Note that gravitate[g] is *translated* by CopyWindow */ /* only copy the remaining useful bits */ if (gravitate[g]) RegionIntersect(gravitate[g], gravitate[g], oldRegion); if (gravitate2[g]) RegionIntersect(gravitate2[g], gravitate2[g], oldRegion2); /* clip to not overwrite already copied areas */ if (destClip && gravitate[g]) { RegionTranslate(destClip, oldpt.x - x, oldpt.y - y); RegionSubtract(gravitate[g], gravitate[g], destClip); RegionTranslate(destClip, x - oldpt.x, y - oldpt.y); } if (destClip2 && gravitate2[g]) { RegionTranslate(destClip2, oldpt.x - x, oldpt.y - y); RegionSubtract(gravitate2[g], gravitate2[g], destClip2); RegionTranslate(destClip2, x - oldpt.x, y - oldpt.y); } /* and move those bits */ if (oldpt.x != x || oldpt.y != y) { if (gravitate2[g]) { pPriv->copyUnderlay = TRUE; (*pScreen->CopyWindow) (pWin, oldpt, gravitate2[g]); } if (gravitate[g]) { pPriv->copyUnderlay = FALSE; (*pScreen->CopyWindow) (pWin, oldpt, gravitate[g]); } } /* remove any overwritten bits from the remaining useful bits */ if (gravitate[g]) RegionSubtract(oldRegion, oldRegion, gravitate[g]); if (gravitate2[g]) RegionSubtract(oldRegion2, oldRegion2, gravitate2[g]); /* * recompute exposed regions of child windows */ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->winGravity != g) continue; TwoRegions.over = gravitate[g]; TwoRegions.under = gravitate2[g]; TraverseTree(pChild, miOverlayRecomputeExposures, (void *) (&TwoRegions)); } /* * remove the successfully copied regions of the * window from its exposed region */ if (g == pWin->bitGravity) { if (gravitate[g]) RegionSubtract(&pWin->valdata->after.exposed, &pWin->valdata->after.exposed, gravitate[g]); if (gravitate2[g] && pTree) RegionSubtract(&pTree->valdata->exposed, &pTree->valdata->exposed, gravitate2[g]); } if (gravitate[g]) { if (!destClip) destClip = gravitate[g]; else { RegionUnion(destClip, destClip, gravitate[g]); RegionDestroy(gravitate[g]); } } if (gravitate2[g]) { if (!destClip2) destClip2 = gravitate2[g]; else { RegionUnion(destClip2, destClip2, gravitate2[g]); RegionDestroy(gravitate2[g]); } } } RegionDestroy(pRegion); RegionDestroy(oldRegion); if (doUnderlay) RegionDestroy(oldRegion2); if (destClip) RegionDestroy(destClip); if (destClip2) RegionDestroy(destClip2); (*pScreen->HandleExposures) (pWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pWin->parent, pFirstChange, VTOther); } if (pWin->realized) WindowsRestructured(); } static void miOverlaySetShape(WindowPtr pWin, int kind) { Bool WasViewable = (Bool) (pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; if (kind != ShapeInput) { if (WasViewable) { (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); 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; if (IN_UNDERLAY(pWin)) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionPtr borderVisible2; borderVisible2 = RegionCreate(NULL, 1); RegionSubtract(borderVisible2, &pTree->borderClip, &pWin->winSize); pTree->valdata->borderVisible = borderVisible2; } } } SetWinSize(pWin); SetBorderSize(pWin); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); if (WasViewable) { (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); (*pScreen->ValidateTree) (pWin->parent, NullWindow, VTOther); (*pScreen->HandleExposures) (pWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pWin->parent, NullWindow, VTOther); } } if (pWin->realized) WindowsRestructured(); CheckCursorConfinement(pWin); } static void miOverlayChangeBorderWidth(WindowPtr pWin, unsigned int width) { int oldwidth; ScreenPtr pScreen; Bool WasViewable = (Bool) (pWin->viewable); Bool HadBorder; oldwidth = wBorderWidth(pWin); if (oldwidth == width) return; HadBorder = HasBorder(pWin); pScreen = pWin->drawable.pScreen; if (WasViewable && (width < oldwidth)) (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); pWin->borderWidth = width; SetBorderSize(pWin); if (WasViewable) { if (width > oldwidth) { (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); if (HadBorder) { RegionPtr borderVisible; borderVisible = RegionCreate(NULL, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; if (IN_UNDERLAY(pWin)) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionPtr borderVisible2; borderVisible2 = RegionCreate(NULL, 1); RegionSubtract(borderVisible2, &pTree->borderClip, &pWin->winSize); pTree->valdata->borderVisible = borderVisible2; } } } (*pScreen->ValidateTree) (pWin->parent, pWin, VTOther); (*pScreen->HandleExposures) (pWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pWin->parent, pWin, VTOther); } if (pWin->realized) WindowsRestructured(); } /* We need this as an addition since the xf86 common code doesn't know about the second tree which is static to this file. */ void miOverlaySetRootClip(ScreenPtr pScreen, Bool enable) { WindowPtr pRoot = pScreen->root; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot); MARK_UNDERLAY(pRoot); if (enable) { BoxRec box; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; RegionReset(&pTree->borderClip, &box); } else RegionEmpty(&pTree->borderClip); RegionBreak(&pTree->clipList); } static void miOverlayClearToBackground(WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); BoxRec box; RegionRec reg; ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); RegionPtr clipList; BoxPtr extents; int x1, y1, x2, y2; x1 = pWin->drawable.x + x; y1 = pWin->drawable.y + y; if (w) x2 = x1 + (int) w; else x2 = x1 + (int) pWin->drawable.width - (int) x; if (h) y2 = y1 + h; else y2 = y1 + (int) pWin->drawable.height - (int) y; clipList = ((*pScreenPriv->InOverlay) (pWin)) ? &pWin->clipList : &pTree->clipList; extents = RegionExtents(clipList); if (x1 < extents->x1) x1 = extents->x1; if (x2 > extents->x2) x2 = extents->x2; if (y1 < extents->y1) y1 = extents->y1; if (y2 > extents->y2) y2 = extents->y2; if (x2 <= x1 || y2 <= y1) x2 = x1 = y2 = y1 = 0; box.x1 = x1; box.x2 = x2; box.y1 = y1; box.y2 = y2; RegionInit(®, &box, 1); RegionIntersect(®, ®, clipList); if (generateExposures) (*pScreen->WindowExposures) (pWin, ®); else if (pWin->backgroundState != None) pScreen->PaintWindow(pWin, ®, PW_BACKGROUND); RegionUninit(®); } /****************************************************************/ /* not used */ Bool miOverlayGetPrivateClips(WindowPtr pWin, RegionPtr *borderClip, RegionPtr *clipList) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if (pTree) { *borderClip = &(pTree->borderClip); *clipList = &(pTree->clipList); return TRUE; } *borderClip = *clipList = NULL; return FALSE; } void miOverlaySetTransFunction(ScreenPtr pScreen, miOverlayTransFunc transFunc) { MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent = transFunc; } Bool miOverlayCopyUnderlay(ScreenPtr pScreen) { return MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->copyUnderlay; } void miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if (!pTree) { miComputeCompositeClip(pGC, &pWin->drawable); return; } if (pGC->subWindowMode == IncludeInferiors) { pregWin = RegionCreate(NullBox, 1); freeTmpClip = TRUE; if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) || !HasSaverWindow(pGC->pScreen)) { RegionIntersect(pregWin, &pTree->borderClip, &pWin->winSize); } } else { pregWin = &pTree->clipList; freeTmpClip = FALSE; } freeCompClip = pGC->freeCompClip; if (!pGC->clientClip) { if (freeCompClip) RegionDestroy(pGC->pCompositeClip); pGC->pCompositeClip = pregWin; pGC->freeCompClip = freeTmpClip; } else { RegionTranslate(pGC->clientClip, pWin->drawable.x + pGC->clipOrg.x, pWin->drawable.y + pGC->clipOrg.y); if (freeCompClip) { RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) RegionDestroy(pregWin); } else if (freeTmpClip) { RegionIntersect(pregWin, pregWin, pGC->clientClip); pGC->pCompositeClip = pregWin; } else { pGC->pCompositeClip = RegionCreate(NullBox, 0); RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); } pGC->freeCompClip = TRUE; RegionTranslate(pGC->clientClip, -(pWin->drawable.x + pGC->clipOrg.x), -(pWin->drawable.y + pGC->clipOrg.y)); } } Bool miOverlayCollectUnderlayRegions(WindowPtr pWin, RegionPtr *region) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if (pTree) { *region = &pTree->borderClip; return FALSE; } *region = RegionCreate(NullBox, 0); CollectUnderlayChildrenRegions(pWin, *region); return TRUE; } static miOverlayTreePtr DoLeaf(WindowPtr pWin, miOverlayTreePtr parent, miOverlayTreePtr prevSib) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); pTree->parent = parent; pTree->firstChild = NULL; pTree->lastChild = NULL; pTree->prevSib = prevSib; pTree->nextSib = NULL; if (prevSib) prevSib->nextSib = pTree; if (!parent->firstChild) parent->firstChild = parent->lastChild = pTree; else if (parent->lastChild == prevSib) parent->lastChild = pTree; return pTree; } static void RebuildTree(WindowPtr pWin) { miOverlayTreePtr parent, prevSib, tChild; WindowPtr pChild; prevSib = tChild = NULL; pWin = pWin->parent; while (IN_OVERLAY(pWin)) pWin = pWin->parent; parent = MIOVERLAY_GET_WINDOW_TREE(pWin); pChild = pWin->firstChild; parent->firstChild = parent->lastChild = NULL; while (1) { if (IN_UNDERLAY(pChild)) prevSib = tChild = DoLeaf(pChild, parent, prevSib); if (pChild->firstChild) { if (IN_UNDERLAY(pChild)) { parent = tChild; prevSib = NULL; } pChild = pChild->firstChild; continue; } while (!pChild->nextSib) { pChild = pChild->parent; if (pChild == pWin) return; if (IN_UNDERLAY(pChild)) { prevSib = tChild = MIOVERLAY_GET_WINDOW_TREE(pChild); parent = tChild->parent; } } pChild = pChild->nextSib; } } static Bool HasUnderlayChildren(WindowPtr pWin) { WindowPtr pChild; if (!(pChild = pWin->firstChild)) return FALSE; while (1) { if (IN_UNDERLAY(pChild)) return TRUE; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pWin != pChild)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } return FALSE; } static Bool CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg) { WindowPtr pChild; miOverlayTreePtr pTree; Bool hasUnderlay; if (!(pChild = pWin->firstChild)) return FALSE; hasUnderlay = FALSE; while (1) { if ((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) { RegionAppend(pReg, &pTree->borderClip); hasUnderlay = TRUE; } else if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pWin != pChild)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } if (hasUnderlay) { Bool overlap; RegionValidate(pReg, &overlap); } return hasUnderlay; } static void MarkUnderlayWindow(WindowPtr pWin) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if (pTree->valdata) return; pTree->valdata = (miOverlayValDataPtr) xnfalloc(sizeof(miOverlayValDataRec)); pTree->valdata->oldAbsCorner.x = pWin->drawable.x; pTree->valdata->oldAbsCorner.y = pWin->drawable.y; pTree->valdata->borderVisible = NullRegion; } xorg-server-1.20.8/mi/micmap.h0000644000175000017500000000476113640201473013042 00000000000000 #include "colormapst.h" #ifndef _MICMAP_H_ #define _MICMAP_H_ #define GetInstalledmiColormap(s) \ ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey)) #define SetInstalledmiColormap(s,c) \ (dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c)) extern _X_EXPORT DevPrivateKeyRec micmapScrPrivateKeyRec; #define micmapScrPrivateKey (&micmapScrPrivateKeyRec) typedef Bool (*miInitVisualsProcPtr) (VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *, unsigned long, int, int); extern _X_EXPORT int miListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps); extern _X_EXPORT void miInstallColormap(ColormapPtr pmap); extern _X_EXPORT void miUninstallColormap(ColormapPtr pmap); extern _X_EXPORT void miResolveColor(unsigned short *, unsigned short *, unsigned short *, VisualPtr); extern _X_EXPORT Bool miInitializeColormap(ColormapPtr); extern _X_EXPORT int miExpandDirectColors(ColormapPtr, int, xColorItem *, xColorItem *); extern _X_EXPORT Bool miCreateDefColormap(ScreenPtr); extern _X_EXPORT void miClearVisualTypes(void); extern _X_EXPORT Bool miSetVisualTypes(int, int, int, int); extern _X_EXPORT Bool miSetPixmapDepths(void); extern _X_EXPORT Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, int preferredCVC, Pixel redMask, Pixel greenMask, Pixel blueMask); extern _X_EXPORT int miGetDefaultVisualMask(int); extern _X_EXPORT Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *, unsigned long, int, int); #define MAX_PSEUDO_DEPTH 10 #define MIN_TRUE_DEPTH 6 #define StaticGrayMask (1 << StaticGray) #define GrayScaleMask (1 << GrayScale) #define StaticColorMask (1 << StaticColor) #define PseudoColorMask (1 << PseudoColor) #define TrueColorMask (1 << TrueColor) #define DirectColorMask (1 << DirectColor) #define ALL_VISUALS (StaticGrayMask|\ GrayScaleMask|\ StaticColorMask|\ PseudoColorMask|\ TrueColorMask|\ DirectColorMask) #define LARGE_VISUALS (TrueColorMask|\ DirectColorMask) #define SMALL_VISUALS (StaticGrayMask|\ GrayScaleMask|\ StaticColorMask|\ PseudoColorMask) #endif /* _MICMAP_H_ */ xorg-server-1.20.8/mi/mieq.c0000644000175000017500000004240113640201473012513 00000000000000/* * Copyright 1990, 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: Keith Packard, MIT X Consortium */ /* * mieq.c * * Machine independent event queue * */ #if HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "windowstr.h" #include "pixmapstr.h" #include "inputstr.h" #include "inpututils.h" #include "mi.h" #include "mipointer.h" #include "scrnintstr.h" #include #include #include #include "extinit.h" #include "exglobals.h" #include "eventstr.h" #ifdef DPMSExtension #include "dpmsproc.h" #include #endif /* Maximum size should be initial size multiplied by a power of 2 */ #define QUEUE_INITIAL_SIZE 512 #define QUEUE_RESERVED_SIZE 64 #define QUEUE_MAXIMUM_SIZE 4096 #define QUEUE_DROP_BACKTRACE_FREQUENCY 100 #define QUEUE_DROP_BACKTRACE_MAX 10 #define EnqueueScreen(dev) dev->spriteInfo->sprite->pEnqueueScreen #define DequeueScreen(dev) dev->spriteInfo->sprite->pDequeueScreen typedef struct _Event { InternalEvent *events; ScreenPtr pScreen; DeviceIntPtr pDev; /* device this event _originated_ from */ } EventRec, *EventPtr; typedef struct _EventQueue { HWEventQueueType head, tail; /* long for SetInputCheck */ CARD32 lastEventTime; /* to avoid time running backwards */ int lastMotion; /* device ID if last event motion? */ EventRec *events; /* our queue as an array */ size_t nevents; /* the number of buckets in our queue */ size_t dropped; /* counter for number of consecutive dropped events */ mieqHandler handlers[128]; /* custom event handler */ } EventQueueRec, *EventQueuePtr; static EventQueueRec miEventQueue; static size_t mieqNumEnqueued(EventQueuePtr eventQueue) { size_t n_enqueued = 0; if (eventQueue->nevents) { /* % is not well-defined with negative numbers... sigh */ n_enqueued = eventQueue->tail - eventQueue->head + eventQueue->nevents; if (n_enqueued >= eventQueue->nevents) n_enqueued -= eventQueue->nevents; } return n_enqueued; } /* Pre-condition: Called with input_lock held */ static Bool mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents) { size_t i, n_enqueued, first_hunk; EventRec *new_events; if (!eventQueue) { ErrorF("[mi] mieqGrowQueue called with a NULL eventQueue\n"); return FALSE; } if (new_nevents <= eventQueue->nevents) return FALSE; new_events = calloc(new_nevents, sizeof(EventRec)); if (new_events == NULL) { ErrorF("[mi] mieqGrowQueue memory allocation error.\n"); return FALSE; } n_enqueued = mieqNumEnqueued(eventQueue); /* First copy the existing events */ first_hunk = eventQueue->nevents - eventQueue->head; memcpy(new_events, &eventQueue->events[eventQueue->head], first_hunk * sizeof(EventRec)); memcpy(&new_events[first_hunk], eventQueue->events, eventQueue->head * sizeof(EventRec)); /* Initialize the new portion */ for (i = eventQueue->nevents; i < new_nevents; i++) { InternalEvent *evlist = InitEventList(1); if (!evlist) { size_t j; for (j = 0; j < i; j++) FreeEventList(new_events[j].events, 1); free(new_events); return FALSE; } new_events[i].events = evlist; } /* And update our record */ eventQueue->tail = n_enqueued; eventQueue->head = 0; eventQueue->nevents = new_nevents; free(eventQueue->events); eventQueue->events = new_events; return TRUE; } Bool mieqInit(void) { memset(&miEventQueue, 0, sizeof(miEventQueue)); miEventQueue.lastEventTime = GetTimeInMillis(); input_lock(); if (!mieqGrowQueue(&miEventQueue, QUEUE_INITIAL_SIZE)) FatalError("Could not allocate event queue.\n"); input_unlock(); SetInputCheck(&miEventQueue.head, &miEventQueue.tail); return TRUE; } void mieqFini(void) { int i; for (i = 0; i < miEventQueue.nevents; i++) { if (miEventQueue.events[i].events != NULL) { FreeEventList(miEventQueue.events[i].events, 1); miEventQueue.events[i].events = NULL; } } free(miEventQueue.events); } /* * Must be reentrant with ProcessInputEvents. Assumption: mieqEnqueue * will never be interrupted. Must be called with input_lock held */ void mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) { unsigned int oldtail = miEventQueue.tail; InternalEvent *evt; int isMotion = 0; int evlen; Time time; size_t n_enqueued; verify_internal_event(e); n_enqueued = mieqNumEnqueued(&miEventQueue); /* avoid merging events from different devices */ if (e->any.type == ET_Motion) isMotion = pDev->id; if (isMotion && isMotion == miEventQueue.lastMotion && oldtail != miEventQueue.head) { oldtail = (oldtail - 1) % miEventQueue.nevents; } else if (n_enqueued + 1 == miEventQueue.nevents) { if (!mieqGrowQueue(&miEventQueue, miEventQueue.nevents << 1)) { /* Toss events which come in late. Usually this means your server's * stuck in an infinite loop in the main thread. */ miEventQueue.dropped++; if (miEventQueue.dropped == 1) { ErrorFSigSafe("[mi] EQ overflowing. Additional events will be " "discarded until existing events are processed.\n"); xorg_backtrace(); ErrorFSigSafe("[mi] These backtraces from mieqEnqueue may point to " "a culprit higher up the stack.\n"); ErrorFSigSafe("[mi] mieq is *NOT* the cause. It is a victim.\n"); } else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 && miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <= QUEUE_DROP_BACKTRACE_MAX) { ErrorFSigSafe("[mi] EQ overflow continuing. %zu events have been " "dropped.\n", miEventQueue.dropped); if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY == QUEUE_DROP_BACKTRACE_MAX) { ErrorFSigSafe("[mi] No further overflow reports will be " "reported until the clog is cleared.\n"); } xorg_backtrace(); } return; } oldtail = miEventQueue.tail; } evlen = e->any.length; evt = miEventQueue.events[oldtail].events; memcpy(evt, e, evlen); time = e->any.time; /* Make sure that event times don't go backwards - this * is "unnecessary", but very useful. */ if (time < miEventQueue.lastEventTime && miEventQueue.lastEventTime - time < 10000) e->any.time = miEventQueue.lastEventTime; miEventQueue.lastEventTime = evt->any.time; miEventQueue.events[oldtail].pScreen = pDev ? EnqueueScreen(pDev) : NULL; miEventQueue.events[oldtail].pDev = pDev; miEventQueue.lastMotion = isMotion; miEventQueue.tail = (oldtail + 1) % miEventQueue.nevents; } /** * Changes the screen reference events are being enqueued from. * Input events are enqueued with a screen reference and dequeued and * processed with a (potentially different) screen reference. * This function is called whenever a new event has changed screen but is * still logically on the previous screen as seen by the client. * This usually happens whenever the visible cursor moves across screen * boundaries during event generation, before the same event is processed * and sent down the wire. * * @param pDev The device that triggered a screen change. * @param pScreen The new screen events are being enqueued for. * @param set_dequeue_screen If TRUE, pScreen is set as both enqueue screen * and dequeue screen. */ void mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool set_dequeue_screen) { EnqueueScreen(pDev) = pScreen; if (set_dequeue_screen) DequeueScreen(pDev) = pScreen; } void mieqSetHandler(int event, mieqHandler handler) { if (handler && miEventQueue.handlers[event]) ErrorF("[mi] mieq: warning: overriding existing handler %p with %p for " "event %d\n", miEventQueue.handlers[event], handler, event); miEventQueue.handlers[event] = handler; } /** * Change the device id of the given event to the given device's id. */ static void ChangeDeviceID(DeviceIntPtr dev, InternalEvent *event) { switch (event->any.type) { case ET_Motion: case ET_KeyPress: case ET_KeyRelease: case ET_ButtonPress: case ET_ButtonRelease: case ET_ProximityIn: case ET_ProximityOut: case ET_Hierarchy: case ET_DeviceChanged: case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: event->device_event.deviceid = dev->id; break; case ET_TouchOwnership: event->touch_ownership_event.deviceid = dev->id; break; #ifdef XFreeXDGA case ET_DGAEvent: break; #endif case ET_RawKeyPress: case ET_RawKeyRelease: case ET_RawButtonPress: case ET_RawButtonRelease: case ET_RawMotion: case ET_RawTouchBegin: case ET_RawTouchEnd: case ET_RawTouchUpdate: event->raw_event.deviceid = dev->id; break; case ET_BarrierHit: case ET_BarrierLeave: event->barrier_event.deviceid = dev->id; break; default: ErrorF("[mi] Unknown event type (%d), cannot change id.\n", event->any.type); } } static void FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, InternalEvent *original, InternalEvent *master) { verify_internal_event(original); verify_internal_event(master); /* Ensure chained button mappings, i.e. that the detail field is the * value of the mapped button on the SD, not the physical button */ if (original->any.type == ET_ButtonPress || original->any.type == ET_ButtonRelease) { int btn = original->device_event.detail.button; if (!sdev->button) return; /* Should never happen */ master->device_event.detail.button = sdev->button->map[btn]; } } /** * Copy the given event into master. * @param sdev The slave device the original event comes from * @param original The event as it came from the EQ * @param copy The event after being copied * @return The master device or NULL if the device is a floating slave. */ DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr sdev, InternalEvent *original, InternalEvent *copy) { DeviceIntPtr mdev; int len = original->any.length; int type = original->any.type; int mtype; /* which master type? */ verify_internal_event(original); /* ET_XQuartz has sdev == NULL */ if (!sdev || IsMaster(sdev) || IsFloating(sdev)) return NULL; #ifdef XFreeXDGA if (type == ET_DGAEvent) type = original->dga_event.subtype; #endif switch (type) { case ET_KeyPress: case ET_KeyRelease: mtype = MASTER_KEYBOARD; break; case ET_ButtonPress: case ET_ButtonRelease: case ET_Motion: case ET_ProximityIn: case ET_ProximityOut: mtype = MASTER_POINTER; break; default: mtype = MASTER_ATTACHED; break; } mdev = GetMaster(sdev, mtype); memcpy(copy, original, len); ChangeDeviceID(mdev, copy); FixUpEventForMaster(mdev, sdev, original, copy); return mdev; } static void mieqMoveToNewScreen(DeviceIntPtr dev, ScreenPtr screen, DeviceEvent *event) { if (dev && screen && screen != DequeueScreen(dev)) { int x = 0, y = 0; DequeueScreen(dev) = screen; x = event->root_x; y = event->root_y; NewCurrentScreen(dev, DequeueScreen(dev), x, y); } } /** * Post the given @event through the device hierarchy, as appropriate. * Use this function if an event must be posted for a given device during the * usual event processing cycle. */ void mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen) { mieqHandler handler; DeviceIntPtr master; InternalEvent mevent; /* master event */ verify_internal_event(event); /* refuse events from disabled devices */ if (dev && !dev->enabled) return; /* Custom event handler */ handler = miEventQueue.handlers[event->any.type]; switch (event->any.type) { /* Catch events that include valuator information and check if they * are changing the screen */ case ET_Motion: case ET_KeyPress: case ET_KeyRelease: case ET_ButtonPress: case ET_ButtonRelease: if (!handler) mieqMoveToNewScreen(dev, screen, &event->device_event); break; case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: if (!handler && (event->device_event.flags & TOUCH_POINTER_EMULATED)) mieqMoveToNewScreen(dev, screen, &event->device_event); break; default: break; } master = CopyGetMasterEvent(dev, event, &mevent); if (master) master->lastSlave = dev; /* If someone's registered a custom event handler, let them * steal it. */ if (handler) { int screenNum = dev && DequeueScreen(dev) ? DequeueScreen(dev)->myNum : (screen ? screen-> myNum : 0); handler(screenNum, event, dev); /* Check for the SD's master in case the device got detached * during event processing */ if (master && !IsFloating(dev)) handler(screenNum, &mevent, master); } else { /* process slave first, then master */ dev->public.processInputProc(event, dev); /* Check for the SD's master in case the device got detached * during event processing */ if (master && !IsFloating(dev)) master->public.processInputProc(&mevent, master); } } /* Call this from ProcessInputEvents(). */ void mieqProcessInputEvents(void) { EventRec *e = NULL; ScreenPtr screen; InternalEvent event; DeviceIntPtr dev = NULL, master = NULL; static Bool inProcessInputEvents = FALSE; input_lock(); /* * report an error if mieqProcessInputEvents() is called recursively; * this can happen, e.g., if something in the mieqProcessDeviceEvent() * call chain calls UpdateCurrentTime() instead of UpdateCurrentTimeIf() */ BUG_WARN_MSG(inProcessInputEvents, "[mi] mieqProcessInputEvents() called recursively.\n"); inProcessInputEvents = TRUE; if (miEventQueue.dropped) { ErrorF("[mi] EQ processing has resumed after %lu dropped events.\n", (unsigned long) miEventQueue.dropped); ErrorF ("[mi] This may be caused by a misbehaving driver monopolizing the server's resources.\n"); miEventQueue.dropped = 0; } while (miEventQueue.head != miEventQueue.tail) { e = &miEventQueue.events[miEventQueue.head]; event = *e->events; dev = e->pDev; screen = e->pScreen; miEventQueue.head = (miEventQueue.head + 1) % miEventQueue.nevents; input_unlock(); master = (dev) ? GetMaster(dev, MASTER_ATTACHED) : NULL; if (screenIsSaved == SCREEN_SAVER_ON) dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); #ifdef DPMSExtension else if (DPMSPowerLevel != DPMSModeOn) SetScreenSaverTimer(); if (DPMSPowerLevel != DPMSModeOn) DPMSSet(serverClient, DPMSModeOn); #endif mieqProcessDeviceEvent(dev, &event, screen); /* Update the sprite now. Next event may be from different device. */ if (master && (event.any.type == ET_Motion || ((event.any.type == ET_TouchBegin || event.any.type == ET_TouchUpdate) && event.device_event.flags & TOUCH_POINTER_EMULATED))) miPointerUpdateSprite(dev); input_lock(); } inProcessInputEvents = FALSE; input_unlock(); } xorg-server-1.20.8/mi/mivalidate.h0000644000175000017500000000337713640201473013715 00000000000000/* Copyright 1993, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef MIVALIDATE_H #define MIVALIDATE_H #include "regionstr.h" typedef union _Validate { struct BeforeValidate { DDXPointRec oldAbsCorner; /* old window position */ RegionPtr borderVisible; /* visible region of border, */ /* non-null when size changes */ Bool resized; /* unclipped winSize has changed */ } before; struct AfterValidate { RegionRec exposed; /* exposed regions, absolute pos */ RegionRec borderExposed; } after; } ValidateRec; #endif /* MIVALIDATE_H */ xorg-server-1.20.8/mi/mipushpxl.c0000644000175000017500000002252013640201473013611 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "mi.h" #include "servermd.h" #define NPT 128 /* These were stolen from mfb. They don't really belong here. */ #define LONG2CHARSSAMEORDER(x) ((MiBits)(x)) #define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MiBits)0x000000FF ) << 0x18 ) \ | ( ( ( x ) & (MiBits)0x0000FF00 ) << 0x08 ) \ | ( ( ( x ) & (MiBits)0x00FF0000 ) >> 0x08 ) \ | ( ( ( x ) & (MiBits)0xFF000000 ) >> 0x18 ) ) #define PGSZB 4 #define PPW (PGSZB<<3) /* assuming 8 bits per byte */ #define PGSZ PPW #define PLST (PPW-1) #define PIM PLST #define PWSH 5 /* miPushPixels -- squeegees the fill style of pGC through pBitMap * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit * is set in the bitmap, the fill style is put onto the drawable using * the GC's logical function. The drawable is not changed where the bitmap * has a zero bit or outside the area covered by the stencil. WARNING: this code works if the 1-bit deep pixmap format returned by GetSpans is the same as the format defined by the mfb code (i.e. 32-bit padding per scanline, scanline unit = 32 bits; later, this might mean bitsizeof(int) padding and sacnline unit == bitsizeof(int).) */ /* * in order to have both (MSB_FIRST and LSB_FIRST) versions of this * in the server, we need to rename one of them */ void miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) { int h, dxDivPPW, ibEnd; MiBits *pwLineStart; MiBits *pw, *pwEnd; MiBits msk; int ib, w; int ipt; /* index into above arrays */ Bool fInBox; DDXPointRec pt[NPT], ptThisLine; int width[NPT]; #if 1 MiBits startmask; if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER) if (screenInfo.bitmapBitOrder == LSBFirst) startmask = (MiBits) (-1) ^ LONG2CHARSSAMEORDER((MiBits) (-1) << 1); else startmask = (MiBits) (-1) ^ LONG2CHARSSAMEORDER((MiBits) (-1) >> 1); else if (screenInfo.bitmapBitOrder == LSBFirst) startmask = (MiBits) (-1) ^ LONG2CHARSDIFFORDER((MiBits) (-1) << 1); else startmask = (MiBits) (-1) ^ LONG2CHARSDIFFORDER((MiBits) (-1) >> 1); #endif pwLineStart = malloc(BitmapBytePad(dx)); if (!pwLineStart) return; ipt = 0; dxDivPPW = dx / PPW; for (h = 0, ptThisLine.x = 0, ptThisLine.y = 0; h < dy; h++, ptThisLine.y++) { (*pBitMap->drawable.pScreen->GetSpans) ((DrawablePtr) pBitMap, dx, &ptThisLine, &dx, 1, (char *) pwLineStart); pw = pwLineStart; /* Process all words which are fully in the pixmap */ fInBox = FALSE; pwEnd = pwLineStart + dxDivPPW; while (pw < pwEnd) { w = *pw; #if 1 msk = startmask; #else msk = (MiBits) (-1) ^ SCRRIGHT((MiBits) (-1), 1); #endif for (ib = 0; ib < PPW; ib++) { if (w & msk) { if (!fInBox) { pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; /* start new box */ fInBox = TRUE; } } else { if (fInBox) { width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans) (pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } /* end box */ fInBox = FALSE; } } #if 1 /* This is not quite right, but it'll do for now */ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER) if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1); else msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1); else if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1); else msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); #else msk = SCRRIGHT(msk, 1); #endif } pw++; } ibEnd = dx & PIM; if (ibEnd) { /* Process final partial word on line */ w = *pw; #if 1 msk = startmask; #else msk = (MiBits) (-1) ^ SCRRIGHT((MiBits) (-1), 1); #endif for (ib = 0; ib < ibEnd; ib++) { if (w & msk) { if (!fInBox) { /* start new box */ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; fInBox = TRUE; } } else { if (fInBox) { /* end box */ width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans) (pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } fInBox = FALSE; } } #if 1 /* This is not quite right, but it'll do for now */ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER) if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1); else msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1); else if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1); else msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); #else msk = SCRRIGHT(msk, 1); #endif } } /* If scanline ended with last bit set, end the box */ if (fInBox) { width[ipt] = dx + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans) (pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } } } free(pwLineStart); /* Flush any remaining spans */ if (ipt) { (*pGC->ops->FillSpans) (pDrawable, pGC, ipt, pt, width, TRUE); } } xorg-server-1.20.8/mi/mibitblt.c0000644000175000017500000006530313640201473013374 00000000000000/*********************************************************** 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. ******************************************************************/ /* Author: Todd Newman (aided and abetted by Mr. Drewry) */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "scrnintstr.h" #include "mi.h" #include "regionstr.h" #include #include "servermd.h" /* MICOPYAREA -- public entry for the CopyArea request * For each rectangle in the source region * get the pixels with GetSpans * set them in the destination with SetSpans * We let SetSpans worry about clipping to the destination. */ _X_COLD RegionPtr miCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut) { DDXPointPtr ppt, pptFirst; unsigned int *pwidthFirst, *pwidth, *pbits; BoxRec srcBox, *prect; /* may be a new region, or just a copy */ RegionPtr prgnSrcClip; /* non-0 if we've created a src clip */ RegionPtr prgnExposed; int realSrcClip = 0; int srcx, srcy, dstx, dsty, i, j, y, width, height, xMin, xMax, yMin, yMax; unsigned int *ordering; int numRects; BoxPtr boxes; srcx = xIn + pSrcDrawable->x; srcy = yIn + pSrcDrawable->y; /* If the destination isn't realized, this is easy */ if (pDstDrawable->type == DRAWABLE_WINDOW && !((WindowPtr) pDstDrawable)->realized) return NULL; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { BoxRec box; box.x1 = pSrcDrawable->x; box.y1 = pSrcDrawable->y; box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; prgnSrcClip = RegionCreate(&box, 1); realSrcClip = 1; } else { if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable); realSrcClip = 1; } else prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList; } /* If the src drawable is a window, we need to translate the srcBox so * that we can compare it with the window's clip region later on. */ srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx + widthSrc; srcBox.y2 = srcy + heightSrc; dstx = xOut; dsty = yOut; if (pGC->miTranslate) { dstx += pDstDrawable->x; dsty += pDstDrawable->y; } pptFirst = ppt = xallocarray(heightSrc, sizeof(DDXPointRec)); pwidthFirst = pwidth = xallocarray(heightSrc, sizeof(unsigned int)); numRects = RegionNumRects(prgnSrcClip); boxes = RegionRects(prgnSrcClip); ordering = xallocarray(numRects, sizeof(unsigned int)); if (!pptFirst || !pwidthFirst || !ordering) { free(ordering); free(pwidthFirst); free(pptFirst); if (realSrcClip) RegionDestroy(prgnSrcClip); return NULL; } /* If not the same drawable then order of move doesn't matter. Following assumes that boxes are sorted from top to bottom and left to right. */ if ((pSrcDrawable != pDstDrawable) && ((pGC->subWindowMode != IncludeInferiors) || (pSrcDrawable->type == DRAWABLE_PIXMAP) || (pDstDrawable->type == DRAWABLE_PIXMAP))) for (i = 0; i < numRects; i++) ordering[i] = i; else { /* within same drawable, must sequence moves carefully! */ if (dsty <= srcBox.y1) { /* Scroll up or stationary vertical. Vertical order OK */ if (dstx <= srcBox.x1) /* Scroll left or stationary horizontal. Horizontal order OK as well */ for (i = 0; i < numRects; i++) ordering[i] = i; else { /* scroll right. must reverse horizontal banding of rects. */ for (i = 0, j = 1, xMax = 0; i < numRects; j = i + 1, xMax = i) { /* find extent of current horizontal band */ y = boxes[i].y1; /* band has this y coordinate */ while ((j < numRects) && (boxes[j].y1 == y)) j++; /* reverse the horizontal band in the output ordering */ for (j--; j >= xMax; j--, i++) ordering[i] = j; } } } else { /* Scroll down. Must reverse vertical banding. */ if (dstx < srcBox.x1) { /* Scroll left. Horizontal order OK. */ for (i = numRects - 1, j = i - 1, yMin = i, yMax = 0; i >= 0; j = i - 1, yMin = i) { /* find extent of current horizontal band */ y = boxes[i].y1; /* band has this y coordinate */ while ((j >= 0) && (boxes[j].y1 == y)) j--; /* reverse the horizontal band in the output ordering */ for (j++; j <= yMin; j++, i--, yMax++) ordering[yMax] = j; } } else /* Scroll right or horizontal stationary. Reverse horizontal order as well (if stationary, horizontal order can be swapped without penalty and this is faster to compute). */ for (i = 0, j = numRects - 1; i < numRects; i++, j--) ordering[i] = j; } } for (i = 0; i < numRects; i++) { prect = &boxes[ordering[i]]; xMin = max(prect->x1, srcBox.x1); xMax = min(prect->x2, srcBox.x2); yMin = max(prect->y1, srcBox.y1); yMax = min(prect->y2, srcBox.y2); /* is there anything visible here? */ if (xMax <= xMin || yMax <= yMin) continue; ppt = pptFirst; pwidth = pwidthFirst; y = yMin; height = yMax - yMin; width = xMax - xMin; for (j = 0; j < height; j++) { /* We must untranslate before calling GetSpans */ ppt->x = xMin; ppt++->y = y++; *pwidth++ = width; } pbits = xallocarray(height, PixmapBytePad(width, pSrcDrawable->depth)); if (pbits) { (*pSrcDrawable->pScreen->GetSpans) (pSrcDrawable, width, pptFirst, (int *) pwidthFirst, height, (char *) pbits); ppt = pptFirst; pwidth = pwidthFirst; xMin -= (srcx - dstx); y = yMin - (srcy - dsty); for (j = 0; j < height; j++) { ppt->x = xMin; ppt++->y = y++; *pwidth++ = width; } (*pGC->ops->SetSpans) (pDstDrawable, pGC, (char *) pbits, pptFirst, (int *) pwidthFirst, height, TRUE); free(pbits); } } prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut); if (realSrcClip) RegionDestroy(prgnSrcClip); free(ordering); free(pwidthFirst); free(pptFirst); return prgnExposed; } /* MIGETPLANE -- gets a bitmap representing one plane of pDraw * A helper used for CopyPlane and XY format GetImage * No clever strategy here, we grab a scanline at a time, pull out the * bits and then stuff them in a 1 bit deep map. */ /* * This should be replaced with something more general. mi shouldn't have to * care about such things as scanline padding et alia. */ _X_COLD static MiBits * miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */ int sx, int sy, int w, int h, MiBits * result) { int i, j, k, width, bitsPerPixel, widthInBytes; DDXPointRec pt = { 0, 0 }; MiBits pixel; MiBits bit; unsigned char *pCharsOut = NULL; #if BITMAP_SCANLINE_UNIT == 8 #define OUT_TYPE unsigned char #endif #if BITMAP_SCANLINE_UNIT == 16 #define OUT_TYPE CARD16 #endif #if BITMAP_SCANLINE_UNIT == 32 #define OUT_TYPE CARD32 #endif #if BITMAP_SCANLINE_UNIT == 64 #define OUT_TYPE CARD64 #endif OUT_TYPE *pOut; int delta = 0; sx += pDraw->x; sy += pDraw->y; widthInBytes = BitmapBytePad(w); if (!result) result = calloc(h, widthInBytes); if (!result) return NULL; bitsPerPixel = pDraw->bitsPerPixel; pOut = (OUT_TYPE *) result; if (bitsPerPixel == 1) { pCharsOut = (unsigned char *) result; width = w; } else { delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) - (w / BITMAP_SCANLINE_UNIT); width = 1; #if IMAGE_BYTE_ORDER == MSBFirst planeNum += (32 - bitsPerPixel); #endif } pt.y = sy; for (i = h; --i >= 0; pt.y++) { pt.x = sx; if (bitsPerPixel == 1) { (*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1, (char *) pCharsOut); pCharsOut += widthInBytes; } else { k = 0; for (j = w; --j >= 0; pt.x++) { /* Fetch the next pixel */ (*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1, (char *) &pixel); /* * Now get the bit and insert into a bitmap in XY format. */ bit = (pixel >> planeNum) & 1; #if 0 /* XXX assuming bit order == byte order */ #if BITMAP_BIT_ORDER == LSBFirst bit <<= k; #else bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k); #endif #else /* XXX assuming byte order == LSBFirst */ if (screenInfo.bitmapBitOrder == LSBFirst) bit <<= k; else bit <<= ((screenInfo.bitmapScanlineUnit - 1) - (k % screenInfo.bitmapScanlineUnit)) + ((k / screenInfo.bitmapScanlineUnit) * screenInfo.bitmapScanlineUnit); #endif *pOut |= (OUT_TYPE) bit; k++; if (k == BITMAP_SCANLINE_UNIT) { pOut++; k = 0; } } pOut += delta; } } return result; } /* MIOPQSTIPDRAWABLE -- use pbits as an opaque stipple for pDraw. * Drawing through the clip mask we SetSpans() the bits into a * bitmap and stipple those bits onto the destination drawable by doing a * PolyFillRect over the whole drawable, * then we invert the bitmap by copying it onto itself with an alu of * GXinvert, invert the foreground/background colors of the gc, and draw * the background bits. * Note how the clipped out bits of the bitmap are always the background * color so that the stipple never causes FillRect to draw them. */ _X_COLD static void miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, MiBits * pbits, int srcx, int w, int h, int dstx, int dsty) { int oldfill, i; unsigned long oldfg; int *pwidth, *pwidthFirst; ChangeGCVal gcv[6]; PixmapPtr pStipple, pPixmap; DDXPointRec oldOrg; GCPtr pGCT; DDXPointPtr ppt, pptFirst; xRectangle rect; RegionPtr prgnSrcClip; pPixmap = (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, w + srcx, h, 1, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; /* Put the image into a 1 bit deep pixmap */ pGCT = GetScratchGC(1, pDraw->pScreen); if (!pGCT) { (*pDraw->pScreen->DestroyPixmap) (pPixmap); return; } /* First set the whole pixmap to 0 */ gcv[0].val = 0; ChangeGC(NullClient, pGCT, GCBackground, gcv); ValidateGC((DrawablePtr) pPixmap, pGCT); miClearDrawable((DrawablePtr) pPixmap, pGCT); ppt = pptFirst = xallocarray(h, sizeof(DDXPointRec)); pwidth = pwidthFirst = xallocarray(h, sizeof(int)); if (!pptFirst || !pwidthFirst) { free(pwidthFirst); free(pptFirst); FreeScratchGC(pGCT); return; } /* we need a temporary region because ChangeClip must be assumed to destroy what it's sent. note that this means we don't have to free prgnSrcClip ourselves. */ prgnSrcClip = RegionCreate(NULL, 0); RegionCopy(prgnSrcClip, prgnSrc); RegionTranslate(prgnSrcClip, srcx, 0); (*pGCT->funcs->ChangeClip) (pGCT, CT_REGION, prgnSrcClip, 0); ValidateGC((DrawablePtr) pPixmap, pGCT); /* Since we know pDraw is always a pixmap, we never need to think * about translation here */ for (i = 0; i < h; i++) { ppt->x = 0; ppt++->y = i; *pwidth++ = w + srcx; } (*pGCT->ops->SetSpans) ((DrawablePtr) pPixmap, pGCT, (char *) pbits, pptFirst, pwidthFirst, h, TRUE); free(pwidthFirst); free(pptFirst); /* Save current values from the client GC */ oldfill = pGC->fillStyle; pStipple = pGC->stipple; if (pStipple) pStipple->refcnt++; oldOrg = pGC->patOrg; /* Set a new stipple in the drawable */ gcv[0].val = FillStippled; gcv[1].ptr = pPixmap; gcv[2].val = dstx - srcx; gcv[3].val = dsty; ChangeGC(NullClient, pGC, GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, gcv); ValidateGC(pDraw, pGC); /* Fill the drawable with the stipple. This will draw the * foreground color whereever 1 bits are set, leaving everything * with 0 bits untouched. Note that the part outside the clip * region is all 0s. */ rect.x = dstx; rect.y = dsty; rect.width = w; rect.height = h; (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); /* Invert the tiling pixmap. This sets 0s for 1s and 1s for 0s, only * within the clipping region, the part outside is still all 0s */ gcv[0].val = GXinvert; ChangeGC(NullClient, pGCT, GCFunction, gcv); ValidateGC((DrawablePtr) pPixmap, pGCT); (*pGCT->ops->CopyArea) ((DrawablePtr) pPixmap, (DrawablePtr) pPixmap, pGCT, 0, 0, w + srcx, h, 0, 0); /* Swap foreground and background colors on the GC for the drawable. * Now when we fill the drawable, we will fill in the "Background" * values */ oldfg = pGC->fgPixel; gcv[0].val = pGC->bgPixel; gcv[1].val = oldfg; gcv[2].ptr = pPixmap; ChangeGC(NullClient, pGC, GCForeground | GCBackground | GCStipple, gcv); ValidateGC(pDraw, pGC); /* PolyFillRect might have bashed the rectangle */ rect.x = dstx; rect.y = dsty; rect.width = w; rect.height = h; (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); /* Now put things back */ if (pStipple) pStipple->refcnt--; gcv[0].val = oldfg; gcv[1].val = pGC->fgPixel; gcv[2].val = oldfill; gcv[3].ptr = pStipple; gcv[4].val = oldOrg.x; gcv[5].val = oldOrg.y; ChangeGC(NullClient, pGC, GCForeground | GCBackground | GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, gcv); ValidateGC(pDraw, pGC); /* put what we hope is a smaller clip region back in the scratch gc */ (*pGCT->funcs->ChangeClip) (pGCT, CT_NONE, NULL, 0); FreeScratchGC(pGCT); (*pDraw->pScreen->DestroyPixmap) (pPixmap); } /* MICOPYPLANE -- public entry for the CopyPlane request. * strategy: * First build up a bitmap out of the bits requested * build a source clip * Use the bitmap we've built up as a Stipple for the destination */ _X_COLD RegionPtr miCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) { MiBits *ptile; BoxRec box; RegionPtr prgnSrc, prgnExposed; /* incorporate the source clip */ box.x1 = srcx + pSrcDrawable->x; box.y1 = srcy + pSrcDrawable->y; box.x2 = box.x1 + width; box.y2 = box.y1 + height; /* clip to visible drawable */ if (box.x1 < pSrcDrawable->x) box.x1 = pSrcDrawable->x; if (box.y1 < pSrcDrawable->y) box.y1 = pSrcDrawable->y; if (box.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; if (box.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; prgnSrc = RegionCreate(&box, 1); if (pSrcDrawable->type != DRAWABLE_PIXMAP) { /* clip to visible drawable */ if (pGC->subWindowMode == IncludeInferiors) { RegionPtr clipList = NotClippedByChildren((WindowPtr) pSrcDrawable); RegionIntersect(prgnSrc, prgnSrc, clipList); RegionDestroy(clipList); } else RegionIntersect(prgnSrc, prgnSrc, &((WindowPtr) pSrcDrawable)->clipList); } box = *RegionExtents(prgnSrc); RegionTranslate(prgnSrc, -box.x1, -box.y1); if ((box.x2 > box.x1) && (box.y2 > box.y1)) { /* minimize the size of the data extracted */ /* note that we convert the plane mask bitPlane into a plane number */ box.x1 -= pSrcDrawable->x; box.x2 -= pSrcDrawable->x; box.y1 -= pSrcDrawable->y; box.y2 -= pSrcDrawable->y; ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1, (MiBits *) NULL); if (ptile) { miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0, box.x2 - box.x1, box.y2 - box.y1, dstx + box.x1 - srcx, dsty + box.y1 - srcy); free(ptile); } } prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); RegionDestroy(prgnSrc); return prgnExposed; } /* MIGETIMAGE -- public entry for the GetImage Request * We're getting the image into a memory buffer. While we have to use GetSpans * to read a line from the device (since we don't know what that looks like), * we can just write into the destination buffer * * two different strategies are used, depending on whether we're getting the * image in Z format or XY format * Z format: * Line at a time, GetSpans a line into the destination buffer, then if the * planemask is not all ones, we do a SetSpans into a temporary buffer (to get * bits turned off) and then another GetSpans to get stuff back (because * pixmaps are opaque, and we are passed in the memory to write into). This is * pretty ugly and slow but works. Life is hard. * XY format: * get the single plane specified in planemask */ _X_COLD void miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h, unsigned int format, unsigned long planeMask, char *pDst) { unsigned char depth; int i, linelength, width, srcx, srcy; DDXPointRec pt = { 0, 0 }; PixmapPtr pPixmap = NULL; GCPtr pGC = NULL; depth = pDraw->depth; if (format == ZPixmap) { if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) { ChangeGCVal gcv; xPoint xpt; pGC = GetScratchGC(depth, pDraw->pScreen); if (!pGC) return; pPixmap = (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, w, 1, depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { FreeScratchGC(pGC); return; } /* * Clear the pixmap before doing anything else */ ValidateGC((DrawablePtr) pPixmap, pGC); xpt.x = xpt.y = 0; width = w; (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &xpt, &width, TRUE); /* alu is already GXCopy */ gcv.val = (XID) planeMask; ChangeGC(NullClient, pGC, GCPlaneMask, &gcv); ValidateGC((DrawablePtr) pPixmap, pGC); } linelength = PixmapBytePad(w, depth); srcx = sx + pDraw->x; srcy = sy + pDraw->y; for (i = 0; i < h; i++) { pt.x = srcx; pt.y = srcy + i; width = w; (*pDraw->pScreen->GetSpans) (pDraw, w, &pt, &width, 1, pDst); if (pPixmap) { pt.x = 0; pt.y = 0; width = w; (*pGC->ops->SetSpans) ((DrawablePtr) pPixmap, pGC, pDst, &pt, &width, 1, TRUE); (*pDraw->pScreen->GetSpans) ((DrawablePtr) pPixmap, w, &pt, &width, 1, pDst); } pDst += linelength; } if (pPixmap) { (*pGC->pScreen->DestroyPixmap) (pPixmap); FreeScratchGC(pGC); } } else { (void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h, (MiBits *) pDst); } } /* MIPUTIMAGE -- public entry for the PutImage request * Here we benefit from knowing the format of the bits pointed to by pImage, * even if we don't know how pDraw represents them. * Three different strategies are used depending on the format * XYBitmap Format: * we just use the Opaque Stipple helper function to cover the destination * Note that this covers all the planes of the drawable with the * foreground color (masked with the GC planemask) where there are 1 bits * and the background color (masked with the GC planemask) where there are * 0 bits * XYPixmap format: * what we're called with is a series of XYBitmaps, but we only want * each XYPixmap to update 1 plane, instead of updating all of them. * we set the foreground color to be all 1s and the background to all 0s * then for each plane, we set the plane mask to only effect that one * plane and recursive call ourself with the format set to XYBitmap * (This clever idea courtesy of RGD.) * ZPixmap format: * This part is simple, just call SetSpans */ _X_COLD void miPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { DDXPointPtr pptFirst, ppt; int *pwidthFirst, *pwidth; RegionPtr prgnSrc; BoxRec box; unsigned long oldFg, oldBg; ChangeGCVal gcv[3]; unsigned long oldPlanemask; unsigned long i; long bytesPer; if (!w || !h) return; switch (format) { case XYBitmap: box.x1 = 0; box.y1 = 0; box.x2 = w; box.y2 = h; prgnSrc = RegionCreate(&box, 1); miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage, leftPad, w, h, x, y); RegionDestroy(prgnSrc); break; case XYPixmap: depth = pGC->depth; oldPlanemask = pGC->planemask; oldFg = pGC->fgPixel; oldBg = pGC->bgPixel; gcv[0].val = (XID) ~0; gcv[1].val = (XID) 0; ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv); bytesPer = (long) h *BitmapBytePad(w + leftPad); for (i = (unsigned long) 1 << (depth - 1); i != 0; i >>= 1, pImage += bytesPer) { if (i & oldPlanemask) { gcv[0].val = (XID) i; ChangeGC(NullClient, pGC, GCPlaneMask, gcv); ValidateGC(pDraw, pGC); (*pGC->ops->PutImage) (pDraw, pGC, 1, x, y, w, h, leftPad, XYBitmap, (char *) pImage); } } gcv[0].val = (XID) oldPlanemask; gcv[1].val = (XID) oldFg; gcv[2].val = (XID) oldBg; ChangeGC(NullClient, pGC, GCPlaneMask | GCForeground | GCBackground, gcv); ValidateGC(pDraw, pGC); break; case ZPixmap: ppt = pptFirst = xallocarray(h, sizeof(DDXPointRec)); pwidth = pwidthFirst = xallocarray(h, sizeof(int)); if (!pptFirst || !pwidthFirst) { free(pwidthFirst); free(pptFirst); return; } if (pGC->miTranslate) { x += pDraw->x; y += pDraw->y; } for (i = 0; i < h; i++) { ppt->x = x; ppt->y = y + i; ppt++; *pwidth++ = w; } (*pGC->ops->SetSpans) (pDraw, pGC, (char *) pImage, pptFirst, pwidthFirst, h, TRUE); free(pwidthFirst); free(pptFirst); break; } } xorg-server-1.20.8/mi/miarc.c0000644000175000017500000031720713640201473012664 00000000000000/*********************************************************** 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. ******************************************************************/ /* Author: Keith Packard and Bob Scheifler */ /* Warning: this code is toxic, do not dally very long here. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" #include #define EPSILON 0.000001 #define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON) #define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON) #define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y)) #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */ /* Point with sub-pixel positioning. */ typedef struct _SppPoint { double x, y; } SppPointRec, *SppPointPtr; typedef struct _SppArc { double x, y, width, height; double angle1, angle2; } SppArcRec, *SppArcPtr; static double miDsin(double a); static double miDcos(double a); static double miDasin(double v); static double miDatan2(double dy, double dx); #ifndef HAVE_CBRT static double cbrt(double x) { if (x > 0.0) return pow(x, 1.0 / 3.0); else return -pow(-x, 1.0 / 3.0); } #endif /* * some interesting sematic interpretation of the protocol: * * Self intersecting arcs (i.e. those spanning 360 degrees) * never join with other arcs, and are drawn without caps * (unless on/off dashed, in which case each dash segment * is capped, except when the last segment meets the * first segment, when no caps are drawn) * * double dash arcs are drawn in two parts, first the * odd dashes (drawn in background) then the even dashes * (drawn in foreground). This means that overlapping * sections of foreground/background are drawn twice, * first in background then in foreground. The double-draw * occurs even when the function uses the destination values * (e.g. xor mode). This is the same way the wide-line * code works and should be "fixed". * */ struct bound { double min, max; }; struct ibound { int min, max; }; #define boundedLe(value, bounds)\ ((bounds).min <= (value) && (value) <= (bounds).max) struct line { double m, b; int valid; }; #define intersectLine(y,line) (line.m * (y) + line.b) /* * these are all y value bounds */ struct arc_bound { struct bound ellipse; struct bound inner; struct bound outer; struct bound right; struct bound left; struct ibound inneri; struct ibound outeri; }; struct accelerators { double tail_y; double h2; double w2; double h4; double w4; double h2mw2; double h2l; double w2l; double fromIntX; double fromIntY; struct line left, right; int yorgu; int yorgl; int xorg; }; struct arc_def { double w, h, l; double a0, a1; }; #define todeg(xAngle) (((double) (xAngle)) / 64.0) #define RIGHT_END 0 #define LEFT_END 1 typedef struct _miArcJoin { int arcIndex0, arcIndex1; int phase0, phase1; int end0, end1; } miArcJoinRec, *miArcJoinPtr; typedef struct _miArcCap { int arcIndex; int end; } miArcCapRec, *miArcCapPtr; typedef struct _miArcFace { SppPointRec clock; SppPointRec center; SppPointRec counterClock; } miArcFaceRec, *miArcFacePtr; typedef struct _miArcData { xArc arc; int render; /* non-zero means render after drawing */ int join; /* related join */ int cap; /* related cap */ int selfJoin; /* final dash meets first dash */ miArcFaceRec bounds[2]; double x0, y0, x1, y1; } miArcDataRec, *miArcDataPtr; /* * This is an entire sequence of arcs, computed and categorized according * to operation. miDashArcs generates either one or two of these. */ typedef struct _miPolyArc { int narcs; miArcDataPtr arcs; int ncaps; miArcCapPtr caps; int njoins; miArcJoinPtr joins; } miPolyArcRec, *miPolyArcPtr; typedef struct { short lx, lw, rx, rw; } miArcSpan; typedef struct { miArcSpan *spans; int count1, count2, k; char top, bot, hole; } miArcSpanData; static void fillSpans(DrawablePtr pDrawable, GCPtr pGC); static void newFinalSpan(int y, int xmin, int xmax); static miArcSpanData *drawArc(xArc * tarc, int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left, miArcSpanData *spdata); static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc * tarc, int lw, miArcFacePtr left, miArcFacePtr right); static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, miArcFacePtr pRight, int xOrgLeft, int yOrgLeft, double xFtransLeft, double yFtransLeft, int xOrgRight, int yOrgRight, double xFtransRight, double yFtransRight); static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace, int end, int xOrg, int yOrg, double xFtrans, double yFtrans); static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter, SppPointRec pEnd, SppPointRec pCorner, SppPointRec pOtherCorner, int fLineEnd, int xOrg, int yOrg, double xFtrans, double yFtrans); static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC); static miPolyArcPtr miComputeArcs(xArc * parcs, int narcs, GCPtr pGC); static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr * ppPts); #define CUBED_ROOT_2 1.2599210498948732038115849718451499938964 #define CUBED_ROOT_4 1.5874010519681993173435330390930175781250 /* * draw one segment of the arc using the arc spans generation routines */ static miArcSpanData * miArcSegment(DrawablePtr pDraw, GCPtr pGC, xArc tarc, miArcFacePtr right, miArcFacePtr left, miArcSpanData *spdata) { int l = pGC->lineWidth; int a0, a1, startAngle, endAngle; miArcFacePtr temp; if (!l) l = 1; if (tarc.width == 0 || tarc.height == 0) { drawZeroArc(pDraw, pGC, &tarc, l, left, right); return spdata; } if (pGC->miTranslate) { tarc.x += pDraw->x; tarc.y += pDraw->y; } a0 = tarc.angle1; a1 = tarc.angle2; if (a1 > FULLCIRCLE) a1 = FULLCIRCLE; else if (a1 < -FULLCIRCLE) a1 = -FULLCIRCLE; if (a1 < 0) { startAngle = a0 + a1; endAngle = a0; temp = right; right = left; left = temp; } else { startAngle = a0; endAngle = a0 + a1; } /* * bounds check the two angles */ if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; if (endAngle < 0) endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE; if (endAngle > FULLCIRCLE) endAngle = (endAngle - 1) % FULLCIRCLE + 1; if ((startAngle == endAngle) && a1) { startAngle = 0; endAngle = FULLCIRCLE; } return drawArc(&tarc, l, startAngle, endAngle, right, left, spdata); } /* Three equations combine to describe the boundaries of the arc x^2/w^2 + y^2/h^2 = 1 ellipse itself (X-x)^2 + (Y-y)^2 = r^2 circle at (x, y) on the ellipse (Y-y) = (X-x)*w^2*y/(h^2*x) normal at (x, y) on the ellipse These lead to a quartic relating Y and y y^4 - (2Y)y^3 + (Y^2 + (h^4 - w^2*r^2)/(w^2 - h^2))y^2 - (2Y*h^4/(w^2 - h^2))y + (Y^2*h^4)/(w^2 - h^2) = 0 The reducible cubic obtained from this quartic is z^3 - (3N)z^2 - 2V = 0 where N = (Y^2 + (h^4 - w^2*r^2/(w^2 - h^2)))/6 V = w^2*r^2*Y^2*h^4/(4 *(w^2 - h^2)^2) Let t = z - N p = -N^2 q = -N^3 - V Then we get t^3 + 3pt + 2q = 0 The discriminant of this cubic is D = q^2 + p^3 When D > 0, a real root is obtained as z = N + cbrt(-q+sqrt(D)) + cbrt(-q-sqrt(D)) When D < 0, a real root is obtained as z = N - 2m*cos(acos(-q/m^3)/3) where m = sqrt(|p|) * sign(q) Given a real root Z of the cubic, the roots of the quartic are the roots of the two quadratics y^2 + ((b+A)/2)y + (Z + (bZ - d)/A) = 0 where A = +/- sqrt(8Z + b^2 - 4c) b, c, d are the cubic, quadratic, and linear coefficients of the quartic Some experimentation is then required to determine which solutions correspond to the inner and outer boundaries. */ static void drawQuadrant(struct arc_def *def, struct accelerators *acc, int a0, int a1, int mask, miArcFacePtr right, miArcFacePtr left, miArcSpanData * spdata); static void miComputeCircleSpans(int lw, xArc * parc, miArcSpanData * spdata) { miArcSpan *span; int doinner; int x, y, e; int xk, yk, xm, ym, dx, dy; int slw, inslw; int inx = 0, iny, ine = 0; int inxk = 0, inyk = 0, inxm = 0, inym = 0; doinner = -lw; slw = parc->width - doinner; y = parc->height >> 1; dy = parc->height & 1; dx = 1 - dy; MIWIDEARCSETUP(x, y, dy, slw, e, xk, xm, yk, ym); inslw = parc->width + doinner; if (inslw > 0) { spdata->hole = spdata->top; MIWIDEARCSETUP(inx, iny, dy, inslw, ine, inxk, inxm, inyk, inym); } else { spdata->hole = FALSE; doinner = -y; } spdata->count1 = -doinner - spdata->top; spdata->count2 = y + doinner; span = spdata->spans; while (y) { MIFILLARCSTEP(slw); span->lx = dy - x; if (++doinner <= 0) { span->lw = slw; span->rx = 0; span->rw = span->lx + slw; } else { MIFILLINARCSTEP(inslw); span->lw = x - inx; span->rx = dy - inx + inslw; span->rw = inx - x + slw - inslw; } span++; } if (spdata->bot) { if (spdata->count2) spdata->count2--; else { if (lw > (int) parc->height) span[-1].rx = span[-1].rw = -((lw - (int) parc->height) >> 1); else span[-1].rw = 0; spdata->count1--; } } } static void miComputeEllipseSpans(int lw, xArc * parc, miArcSpanData * spdata) { miArcSpan *span; double w, h, r, xorg; double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs; double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm; int flip, solution; w = (double) parc->width / 2.0; h = (double) parc->height / 2.0; r = lw / 2.0; rs = r * r; Hs = h * h; WH = w * w - Hs; Nk = w * r; Vk = (Nk * Hs) / (WH + WH); Hf = Hs * Hs; Nk = (Hf - Nk * Nk) / WH; Fk = Hf / WH; hepp = h + EPSILON; hepm = h - EPSILON; K = h + ((lw - 1) >> 1); span = spdata->spans; if (parc->width & 1) xorg = .5; else xorg = 0.0; if (spdata->top) { span->lx = 0; span->lw = 1; span++; } spdata->count1 = 0; spdata->count2 = 0; spdata->hole = (spdata->top && (int) parc->height * lw <= (int) (parc->width * parc->width) && lw < (int) parc->height); for (; K > 0.0; K -= 1.0) { N = (K * K + Nk) / 6.0; Nc = N * N * N; Vr = Vk * K; t = Nc + Vr * Vr; d = Nc + t; if (d < 0.0) { d = Nc; b = N; if ((b < 0.0) == (t < 0.0)) { b = -b; d = -d; } Z = N - 2.0 * b * cos(acos(-t / d) / 3.0); if ((Z < 0.0) == (Vr < 0.0)) flip = 2; else flip = 1; } else { d = Vr * sqrt(d); Z = N + cbrt(t + d) + cbrt(t - d); flip = 0; } A = sqrt((Z + Z) - Nk); T = (Fk - Z) * K / A; inx = 0.0; solution = FALSE; b = -A + K; d = b * b - 4 * (Z + T); if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if ((y >= 0.0) && (y < hepp)) { solution = TRUE; if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; if (flip == 2) inx = x - t; else outx = x + t; } } b = A + K; d = b * b - 4 * (Z - T); /* Because of the large magnitudes involved, we lose enough precision * that sometimes we end up with a negative value near the axis, when * it should be positive. This is a workaround. */ if (d < 0 && !solution) d = 0.0; if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if (y < hepp) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) inx = x - sqrt(rs - (t * t)); else inx = x; } y = (b - d) / 2; if (y >= 0.0) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; if (flip == 1) inx = x - t; else outx = x + t; } } span->lx = ICEIL(xorg - outx); if (inx <= 0.0) { spdata->count1++; span->lw = ICEIL(xorg + outx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = -ICEIL(xorg - inx); } else { spdata->count2++; span->lw = ICEIL(xorg - inx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = ICEIL(xorg + outx) - span->rx; } span++; } if (spdata->bot) { outx = w + r; if (r >= h && r <= w) inx = 0.0; else if (Nk < 0.0 && -Nk < Hs) { inx = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk); if (inx > w - r) inx = w - r; } else inx = w - r; span->lx = ICEIL(xorg - outx); if (inx <= 0.0) { span->lw = ICEIL(xorg + outx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = -ICEIL(xorg - inx); } else { span->lw = ICEIL(xorg - inx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = ICEIL(xorg + outx) - span->rx; } } if (spdata->hole) { span = &spdata->spans[spdata->count1]; span->lw = -span->lx; span->rx = 1; span->rw = span->lw; spdata->count1--; spdata->count2++; } } static double tailX(double K, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc) { double w, h, r; double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs; double A, T, b, d, x, y, t, hepp, hepm; int flip, solution; double xs[2]; double *xp; w = def->w; h = def->h; r = def->l; rs = r * r; Hs = acc->h2; WH = -acc->h2mw2; Nk = def->w * r; Vk = (Nk * Hs) / (WH + WH); Hf = acc->h4; Nk = (Hf - Nk * Nk) / WH; if (K == 0.0) { if (Nk < 0.0 && -Nk < Hs) { xs[0] = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk); xs[1] = w - r; if (acc->left.valid && boundedLe(K, bounds->left) && !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0) return xs[1]; if (acc->right.valid && boundedLe(K, bounds->right) && !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0) return xs[1]; return xs[0]; } return w - r; } Fk = Hf / WH; hepp = h + EPSILON; hepm = h - EPSILON; N = (K * K + Nk) / 6.0; Nc = N * N * N; Vr = Vk * K; xp = xs; xs[0] = 0.0; t = Nc + Vr * Vr; d = Nc + t; if (d < 0.0) { d = Nc; b = N; if ((b < 0.0) == (t < 0.0)) { b = -b; d = -d; } Z = N - 2.0 * b * cos(acos(-t / d) / 3.0); if ((Z < 0.0) == (Vr < 0.0)) flip = 2; else flip = 1; } else { d = Vr * sqrt(d); Z = N + cbrt(t + d) + cbrt(t - d); flip = 0; } A = sqrt((Z + Z) - Nk); T = (Fk - Z) * K / A; solution = FALSE; b = -A + K; d = b * b - 4 * (Z + T); if (d >= 0 && flip == 2) { d = sqrt(d); y = (b + d) / 2; if ((y >= 0.0) && (y < hepp)) { solution = TRUE; if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; *xp++ = x - t; } } b = A + K; d = b * b - 4 * (Z - T); /* Because of the large magnitudes involved, we lose enough precision * that sometimes we end up with a negative value near the axis, when * it should be positive. This is a workaround. */ if (d < 0 && !solution) d = 0.0; if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if (y < hepp) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) *xp++ = x - sqrt(rs - (t * t)); else *xp++ = x; } y = (b - d) / 2; if (y >= 0.0 && flip == 1) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; *xp++ = x - t; } } if (xp > &xs[1]) { if (acc->left.valid && boundedLe(K, bounds->left) && !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0) return xs[1]; if (acc->right.valid && boundedLe(K, bounds->right) && !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0) return xs[1]; } return xs[0]; } static miArcSpanData * miComputeWideEllipse(int lw, xArc * parc) { miArcSpanData *spdata = NULL; int k; if (!lw) lw = 1; k = (parc->height >> 1) + ((lw - 1) >> 1); spdata = malloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2)); if (!spdata) return NULL; spdata->spans = (miArcSpan *) (spdata + 1); spdata->k = k; spdata->top = !(lw & 1) && !(parc->width & 1); spdata->bot = !(parc->height & 1); if (parc->width == parc->height) miComputeCircleSpans(lw, parc, spdata); else miComputeEllipseSpans(lw, parc, spdata); return spdata; } static void miFillWideEllipse(DrawablePtr pDraw, GCPtr pGC, xArc * parc) { DDXPointPtr points; DDXPointPtr pts; int *widths; int *wids; miArcSpanData *spdata; miArcSpan *span; int xorg, yorgu, yorgl; int n; yorgu = parc->height + pGC->lineWidth; n = (sizeof(int) * 2) * yorgu; widths = malloc(n + (sizeof(DDXPointRec) * 2) * yorgu); if (!widths) return; points = (DDXPointPtr) ((char *) widths + n); spdata = miComputeWideEllipse((int) pGC->lineWidth, parc); if (!spdata) { free(widths); return; } pts = points; wids = widths; span = spdata->spans; xorg = parc->x + (parc->width >> 1); yorgu = parc->y + (parc->height >> 1); yorgl = yorgu + (parc->height & 1); if (pGC->miTranslate) { xorg += pDraw->x; yorgu += pDraw->y; yorgl += pDraw->y; } yorgu -= spdata->k; yorgl += spdata->k; if (spdata->top) { pts->x = xorg; pts->y = yorgu - 1; pts++; *wids++ = 1; span++; } for (n = spdata->count1; --n >= 0;) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = pts[0].x; pts[1].y = yorgl; wids[1] = wids[0]; yorgu++; yorgl--; pts += 2; wids += 2; span++; } if (spdata->hole) { pts[0].x = xorg; pts[0].y = yorgl; wids[0] = 1; pts++; wids++; } for (n = spdata->count2; --n >= 0;) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = xorg + span->rx; pts[1].y = pts[0].y; wids[1] = span->rw; pts[2].x = pts[0].x; pts[2].y = yorgl; wids[2] = wids[0]; pts[3].x = pts[1].x; pts[3].y = pts[2].y; wids[3] = wids[1]; yorgu++; yorgl--; pts += 4; wids += 4; span++; } if (spdata->bot) { if (span->rw <= 0) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts++; wids++; } else { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = xorg + span->rx; pts[1].y = pts[0].y; wids[1] = span->rw; pts += 2; wids += 2; } } free(spdata); (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE); free(widths); } /* * miPolyArc strategy: * * If arc is zero width and solid, we don't have to worry about the rasterop * or join styles. For wide solid circles, we use a fast integer algorithm. * For wide solid ellipses, we use special case floating point code. * Otherwise, we set up pDrawTo and pGCTo according to the rasterop, then * draw using pGCTo and pDrawTo. If the raster-op was "tricky," that is, * if it involves the destination, then we use PushPixels to move the bits * from the scratch drawable to pDraw. (See the wide line code for a * fuller explanation of this.) */ void miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) { int i; xArc *parc; int xMin, xMax, yMin, yMax; int pixmapWidth = 0, pixmapHeight = 0; int xOrg = 0, yOrg = 0; int width = pGC->lineWidth; Bool fTricky; DrawablePtr pDrawTo; CARD32 fg, bg; GCPtr pGCTo; miPolyArcPtr polyArcs; int cap[2], join[2]; int iphase; int halfWidth; if (width == 0 && pGC->lineStyle == LineSolid) { for (i = narcs, parc = parcs; --i >= 0; parc++) { miArcSpanData *spdata; spdata = miArcSegment(pDraw, pGC, *parc, NULL, NULL, NULL); free(spdata); } fillSpans(pDraw, pGC); return; } if ((pGC->lineStyle == LineSolid) && narcs) { while (parcs->width && parcs->height && (parcs->angle2 >= FULLCIRCLE || parcs->angle2 <= -FULLCIRCLE)) { miFillWideEllipse(pDraw, pGC, parcs); if (!--narcs) return; parcs++; } } /* Set up pDrawTo and pGCTo based on the rasterop */ switch (pGC->alu) { case GXclear: /* 0 */ case GXcopy: /* src */ case GXcopyInverted: /* NOT src */ case GXset: /* 1 */ fTricky = FALSE; pDrawTo = pDraw; pGCTo = pGC; break; default: fTricky = TRUE; /* find bounding box around arcs */ xMin = yMin = MAXSHORT; xMax = yMax = MINSHORT; for (i = narcs, parc = parcs; --i >= 0; parc++) { xMin = min(xMin, parc->x); yMin = min(yMin, parc->y); xMax = max(xMax, (parc->x + (int) parc->width)); yMax = max(yMax, (parc->y + (int) parc->height)); } /* expand box to deal with line widths */ halfWidth = (width + 1) / 2; xMin -= halfWidth; yMin -= halfWidth; xMax += halfWidth; yMax += halfWidth; /* compute pixmap size; limit it to size of drawable */ xOrg = max(xMin, 0); yOrg = max(yMin, 0); pixmapWidth = min(xMax, pDraw->width) - xOrg; pixmapHeight = min(yMax, pDraw->height) - yOrg; /* if nothing left, return */ if ((pixmapWidth <= 0) || (pixmapHeight <= 0)) return; for (i = narcs, parc = parcs; --i >= 0; parc++) { parc->x -= xOrg; parc->y -= yOrg; } if (pGC->miTranslate) { xOrg += pDraw->x; yOrg += pDraw->y; } /* set up scratch GC */ pGCTo = GetScratchGC(1, pDraw->pScreen); if (!pGCTo) return; { ChangeGCVal gcvals[6]; gcvals[0].val = GXcopy; gcvals[1].val = 1; gcvals[2].val = 0; gcvals[3].val = pGC->lineWidth; gcvals[4].val = pGC->capStyle; gcvals[5].val = pGC->joinStyle; ChangeGC(NullClient, pGCTo, GCFunction | GCForeground | GCBackground | GCLineWidth | GCCapStyle | GCJoinStyle, gcvals); } /* allocate a bitmap of the appropriate size, and validate it */ pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, pixmapWidth, pixmapHeight, 1, CREATE_PIXMAP_USAGE_SCRATCH); if (!pDrawTo) { FreeScratchGC(pGCTo); return; } ValidateGC(pDrawTo, pGCTo); miClearDrawable(pDrawTo, pGCTo); } fg = pGC->fgPixel; bg = pGC->bgPixel; /* the protocol sez these don't cause color changes */ if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillOpaqueStippled)) bg = fg; polyArcs = miComputeArcs(parcs, narcs, pGC); if (!polyArcs) goto out; cap[0] = cap[1] = 0; join[0] = join[1] = 0; for (iphase = (pGC->lineStyle == LineDoubleDash); iphase >= 0; iphase--) { miArcSpanData *spdata = NULL; xArc lastArc; ChangeGCVal gcval; if (iphase == 1) { gcval.val = bg; ChangeGC(NullClient, pGC, GCForeground, &gcval); ValidateGC(pDraw, pGC); } else if (pGC->lineStyle == LineDoubleDash) { gcval.val = fg; ChangeGC(NullClient, pGC, GCForeground, &gcval); ValidateGC(pDraw, pGC); } for (i = 0; i < polyArcs[iphase].narcs; i++) { miArcDataPtr arcData; arcData = &polyArcs[iphase].arcs[i]; if (spdata) { if (lastArc.width != arcData->arc.width || lastArc.height != arcData->arc.height) { free(spdata); spdata = NULL; } } memcpy(&lastArc, &arcData->arc, sizeof(xArc)); spdata = miArcSegment(pDrawTo, pGCTo, arcData->arc, &arcData->bounds[RIGHT_END], &arcData->bounds[LEFT_END], spdata); if (polyArcs[iphase].arcs[i].render) { fillSpans(pDrawTo, pGCTo); /* don't cap self-joining arcs */ if (polyArcs[iphase].arcs[i].selfJoin && cap[iphase] < polyArcs[iphase].arcs[i].cap) cap[iphase]++; while (cap[iphase] < polyArcs[iphase].arcs[i].cap) { int arcIndex, end; miArcDataPtr arcData0; arcIndex = polyArcs[iphase].caps[cap[iphase]].arcIndex; end = polyArcs[iphase].caps[cap[iphase]].end; arcData0 = &polyArcs[iphase].arcs[arcIndex]; miArcCap(pDrawTo, pGCTo, &arcData0->bounds[end], end, arcData0->arc.x, arcData0->arc.y, (double) arcData0->arc.width / 2.0, (double) arcData0->arc.height / 2.0); ++cap[iphase]; } while (join[iphase] < polyArcs[iphase].arcs[i].join) { int arcIndex0, arcIndex1, end0, end1; int phase0, phase1; miArcDataPtr arcData0, arcData1; miArcJoinPtr joinp; joinp = &polyArcs[iphase].joins[join[iphase]]; arcIndex0 = joinp->arcIndex0; end0 = joinp->end0; arcIndex1 = joinp->arcIndex1; end1 = joinp->end1; phase0 = joinp->phase0; phase1 = joinp->phase1; arcData0 = &polyArcs[phase0].arcs[arcIndex0]; arcData1 = &polyArcs[phase1].arcs[arcIndex1]; miArcJoin(pDrawTo, pGCTo, &arcData0->bounds[end0], &arcData1->bounds[end1], arcData0->arc.x, arcData0->arc.y, (double) arcData0->arc.width / 2.0, (double) arcData0->arc.height / 2.0, arcData1->arc.x, arcData1->arc.y, (double) arcData1->arc.width / 2.0, (double) arcData1->arc.height / 2.0); ++join[iphase]; } if (fTricky) { if (pGC->serialNumber != pDraw->serialNumber) ValidateGC(pDraw, pGC); (*pGC->ops->PushPixels) (pGC, (PixmapPtr) pDrawTo, pDraw, pixmapWidth, pixmapHeight, xOrg, yOrg); miClearDrawable((DrawablePtr) pDrawTo, pGCTo); } } } free(spdata); spdata = NULL; } miFreeArcs(polyArcs, pGC); out: if (fTricky) { (*pGCTo->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo); FreeScratchGC(pGCTo); } } /* Find the index of the point with the smallest y.also return the * smallest and largest y */ static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans, int *by, int *ty) { SppPointPtr ptMin; double ymin, ymax; SppPointPtr ptsStart = pts; ptMin = pts; ymin = ymax = (pts++)->y; while (--n > 0) { if (pts->y < ymin) { ptMin = pts; ymin = pts->y; } if (pts->y > ymax) ymax = pts->y; pts++; } *by = ICEIL(ymin + yFtrans); *ty = ICEIL(ymax + yFtrans - 1); return ptMin - ptsStart; } /* * miFillSppPoly written by Todd Newman; April. 1987. * * Fill a convex polygon. If the given polygon * is not convex, then the result is undefined. * The algorithm is to order the edges from smallest * y to largest by partitioning the array into a left * edge list and a right edge list. The algorithm used * to traverse each edge is digital differencing analyzer * line algorithm with y as the major axis. There's some funny linear * interpolation involved because of the subpixel postioning. */ static void miFillSppPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points */ SppPointPtr ptsIn, /* the points */ int xTrans, int yTrans, /* Translate each point by this */ double xFtrans, double yFtrans /* translate before conversion by this amount. This provides a mechanism to match rounding errors with any shape that must meet the polygon exactly. */ ) { double xl = 0.0, xr = 0.0, /* x vals of left and right edges */ ml = 0.0, /* left edge slope */ mr = 0.0, /* right edge slope */ dy, /* delta y */ i; /* loop counter */ int y, /* current scanline */ j, imin, /* index of vertex with smallest y */ ymin, /* y-extents of polygon */ ymax, *width, *FirstWidth, /* output buffer */ *Marked; /* set if this vertex has been used */ int left, right, /* indices to first endpoints */ nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ if (pgc->miTranslate) { xTrans += dst->x; yTrans += dst->y; } imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax); y = ymax - ymin + 1; if ((count < 3) || (y <= 0)) return; ptsOut = FirstPoint = xallocarray(y, sizeof(DDXPointRec)); width = FirstWidth = xallocarray(y, sizeof(int)); Marked = xallocarray(count, sizeof(int)); if (!ptsOut || !width || !Marked) { free(Marked); free(width); free(ptsOut); return; } for (j = 0; j < count; j++) Marked[j] = 0; nextleft = nextright = imin; Marked[imin] = -1; y = ICEIL(ptsIn[nextleft].y + yFtrans); /* * loop through all edges of the polygon */ do { /* add a left edge if we need to */ if ((y > (ptsIn[nextleft].y + yFtrans) || ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) && Marked[nextleft] != 1) { Marked[nextleft]++; left = nextleft++; /* find the next edge, considering the end conditions */ if (nextleft >= count) nextleft = 0; /* now compute the starting point and slope */ dy = ptsIn[nextleft].y - ptsIn[left].y; if (dy != 0.0) { ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy; dy = y - (ptsIn[left].y + yFtrans); xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0); } } /* add a right edge if we need to */ if ((y > ptsIn[nextright].y + yFtrans) || (ISEQUAL(y, ptsIn[nextright].y + yFtrans) && Marked[nextright] != 1)) { Marked[nextright]++; right = nextright--; /* find the next edge, considering the end conditions */ if (nextright < 0) nextright = count - 1; /* now compute the starting point and slope */ dy = ptsIn[nextright].y - ptsIn[right].y; if (dy != 0.0) { mr = (ptsIn[nextright].x - ptsIn[right].x) / dy; dy = y - (ptsIn[right].y + yFtrans); xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0); } } /* * generate scans to fill while we still have * a right edge as well as a left edge. */ i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y; if (i < EPSILON) { if (Marked[nextleft] && Marked[nextright]) { /* Arrgh, we're trapped! (no more points) * Out, we've got to get out of here before this decadence saps * our will completely! */ break; } continue; } else { j = (int) i; if (!j) j++; } while (j > 0) { int cxl, cxr; ptsOut->y = (y) + yTrans; cxl = ICEIL(xl); cxr = ICEIL(xr); /* reverse the edges if necessary */ if (xl < xr) { *(width++) = cxr - cxl; (ptsOut++)->x = cxl + xTrans; } else { *(width++) = cxl - cxr; (ptsOut++)->x = cxr + xTrans; } y++; /* increment down the edges */ xl += ml; xr += mr; j--; } } while (y <= ymax); /* Finally, fill the spans we've collected */ (*pgc->ops->FillSpans) (dst, pgc, ptsOut - FirstPoint, FirstPoint, FirstWidth, 1); free(Marked); free(FirstWidth); free(FirstPoint); } static double angleBetween(SppPointRec center, SppPointRec point1, SppPointRec point2) { double a1, a2, a; /* * reflect from X coordinates back to ellipse * coordinates -- y increasing upwards */ a1 = miDatan2(-(point1.y - center.y), point1.x - center.x); a2 = miDatan2(-(point2.y - center.y), point2.x - center.x); a = a2 - a1; if (a <= -180.0) a += 360.0; else if (a > 180.0) a -= 360.0; return a; } static void translateBounds(miArcFacePtr b, int x, int y, double fx, double fy) { fx += x; fy += y; b->clock.x -= fx; b->clock.y -= fy; b->center.x -= fx; b->center.y -= fy; b->counterClock.x -= fx; b->counterClock.y -= fy; } static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, miArcFacePtr pRight, int xOrgLeft, int yOrgLeft, double xFtransLeft, double yFtransLeft, int xOrgRight, int yOrgRight, double xFtransRight, double yFtransRight) { SppPointRec center, corner, otherCorner; SppPointRec poly[5], e; SppPointPtr pArcPts; int cpt; SppArcRec arc; miArcFaceRec Right, Left; int polyLen = 0; int xOrg, yOrg; double xFtrans, yFtrans; double a; double ae, ac2, ec2, bc2, de; double width; xOrg = (xOrgRight + xOrgLeft) / 2; yOrg = (yOrgRight + yOrgLeft) / 2; xFtrans = (xFtransLeft + xFtransRight) / 2; yFtrans = (yFtransLeft + yFtransRight) / 2; Right = *pRight; translateBounds(&Right, xOrg - xOrgRight, yOrg - yOrgRight, xFtrans - xFtransRight, yFtrans - yFtransRight); Left = *pLeft; translateBounds(&Left, xOrg - xOrgLeft, yOrg - yOrgLeft, xFtrans - xFtransLeft, yFtrans - yFtransLeft); pRight = &Right; pLeft = &Left; if (pRight->clock.x == pLeft->counterClock.x && pRight->clock.y == pLeft->counterClock.y) return; center = pRight->center; if (0 <= (a = angleBetween(center, pRight->clock, pLeft->counterClock)) && a <= 180.0) { corner = pRight->clock; otherCorner = pLeft->counterClock; } else { a = angleBetween(center, pLeft->clock, pRight->counterClock); corner = pLeft->clock; otherCorner = pRight->counterClock; } switch (pGC->joinStyle) { case JoinRound: width = (pGC->lineWidth ? (double) pGC->lineWidth : (double) 1); arc.x = center.x - width / 2; arc.y = center.y - width / 2; arc.width = width; arc.height = width; arc.angle1 = -miDatan2(corner.y - center.y, corner.x - center.x); arc.angle2 = a; pArcPts = malloc(3 * sizeof(SppPointRec)); if (!pArcPts) return; pArcPts[0].x = otherCorner.x; pArcPts[0].y = otherCorner.y; pArcPts[1].x = center.x; pArcPts[1].y = center.y; pArcPts[2].x = corner.x; pArcPts[2].y = corner.y; if ((cpt = miGetArcPts(&arc, 3, &pArcPts))) { /* by drawing with miFillSppPoly and setting the endpoints of the arc * to be the corners, we assure that the cap will meet up with the * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans); } free(pArcPts); return; case JoinMiter: /* * don't miter arcs with less than 11 degrees between them */ if (a < 169.0) { poly[0] = corner; poly[1] = center; poly[2] = otherCorner; bc2 = (corner.x - otherCorner.x) * (corner.x - otherCorner.x) + (corner.y - otherCorner.y) * (corner.y - otherCorner.y); ec2 = bc2 / 4; ac2 = (corner.x - center.x) * (corner.x - center.x) + (corner.y - center.y) * (corner.y - center.y); ae = sqrt(ac2 - ec2); de = ec2 / ae; e.x = (corner.x + otherCorner.x) / 2; e.y = (corner.y + otherCorner.y) / 2; poly[3].x = e.x + de * (e.x - center.x) / ae; poly[3].y = e.y + de * (e.y - center.y) / ae; poly[4] = corner; polyLen = 5; break; } case JoinBevel: poly[0] = corner; poly[1] = center; poly[2] = otherCorner; poly[3] = corner; polyLen = 4; break; } miFillSppPoly(pDraw, pGC, polyLen, poly, xOrg, yOrg, xFtrans, yFtrans); } /*ARGSUSED*/ static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace, int end, int xOrg, int yOrg, double xFtrans, double yFtrans) { SppPointRec corner, otherCorner, center, endPoint, poly[5]; corner = pFace->clock; otherCorner = pFace->counterClock; center = pFace->center; switch (pGC->capStyle) { case CapProjecting: poly[0].x = otherCorner.x; poly[0].y = otherCorner.y; poly[1].x = corner.x; poly[1].y = corner.y; poly[2].x = corner.x - (center.y - corner.y); poly[2].y = corner.y + (center.x - corner.x); poly[3].x = otherCorner.x - (otherCorner.y - center.y); poly[3].y = otherCorner.y + (otherCorner.x - center.x); poly[4].x = otherCorner.x; poly[4].y = otherCorner.y; miFillSppPoly(pDraw, pGC, 5, poly, xOrg, yOrg, xFtrans, yFtrans); break; case CapRound: /* * miRoundCap just needs these to be unequal. */ endPoint = center; endPoint.x = endPoint.x + 100; miRoundCap(pDraw, pGC, center, endPoint, corner, otherCorner, 0, -xOrg, -yOrg, xFtrans, yFtrans); break; } } /* MIROUNDCAP -- a private helper function * Put Rounded cap on end. pCenter is the center of this end of the line * pEnd is the center of the other end of the line. pCorner is one of the * two corners at this end of the line. * NOTE: pOtherCorner must be counter-clockwise from pCorner. */ /*ARGSUSED*/ static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter, SppPointRec pEnd, SppPointRec pCorner, SppPointRec pOtherCorner, int fLineEnd, int xOrg, int yOrg, double xFtrans, double yFtrans) { int cpt; double width; SppArcRec arc; SppPointPtr pArcPts; width = (pGC->lineWidth ? (double) pGC->lineWidth : (double) 1); arc.x = pCenter.x - width / 2; arc.y = pCenter.y - width / 2; arc.width = width; arc.height = width; arc.angle1 = -miDatan2(pCorner.y - pCenter.y, pCorner.x - pCenter.x); if (PTISEQUAL(pCenter, pEnd)) arc.angle2 = -180.0; else { arc.angle2 = -miDatan2(pOtherCorner.y - pCenter.y, pOtherCorner.x - pCenter.x) - arc.angle1; if (arc.angle2 < 0) arc.angle2 += 360.0; } pArcPts = (SppPointPtr) NULL; if ((cpt = miGetArcPts(&arc, 0, &pArcPts))) { /* by drawing with miFillSppPoly and setting the endpoints of the arc * to be the corners, we assure that the cap will meet up with the * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans); } free(pArcPts); } /* * To avoid inaccuracy at the cardinal points, use trig functions * which are exact for those angles */ #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923 #endif #define Dsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0))) #define Dcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0))) #define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-(a)) % (b)) static double miDcos(double a) { int i; if (floor(a / 90) == a / 90) { i = (int) (a / 90.0); switch (mod(i, 4)) { case 0: return 1; case 1: return 0; case 2: return -1; case 3: return 0; } } return cos(a * M_PI / 180.0); } static double miDsin(double a) { int i; if (floor(a / 90) == a / 90) { i = (int) (a / 90.0); switch (mod(i, 4)) { case 0: return 0; case 1: return 1; case 2: return 0; case 3: return -1; } } return sin(a * M_PI / 180.0); } static double miDasin(double v) { if (v == 0) return 0.0; if (v == 1.0) return 90.0; if (v == -1.0) return -90.0; return asin(v) * (180.0 / M_PI); } static double miDatan2(double dy, double dx) { if (dy == 0) { if (dx >= 0) return 0.0; return 180.0; } else if (dx == 0) { if (dy > 0) return 90.0; return -90.0; } else if (fabs(dy) == fabs(dx)) { if (dy > 0) { if (dx > 0) return 45.0; return 135.0; } else { if (dx > 0) return 315.0; return 225.0; } } else { return atan2(dy, dx) * (180.0 / M_PI); } } /* MIGETARCPTS -- Converts an arc into a set of line segments -- a helper * routine for filled arc and line (round cap) code. * Returns the number of points in the arc. Note that it takes a pointer * to a pointer to where it should put the points and an index (cpt). * This procedure allocates the space necessary to fit the arc points. * Sometimes it's convenient for those points to be at the end of an existing * array. (For example, if we want to leave a spare point to make sectors * instead of segments.) So we pass in the malloc()ed chunk that contains the * array and an index saying where we should start stashing the points. * If there isn't an array already, we just pass in a null pointer and * count on realloc() to handle the null pointer correctly. */ static int miGetArcPts(SppArcPtr parc, /* points to an arc */ int cpt, /* number of points already in arc list */ SppPointPtr * ppPts) { /* pointer to pointer to arc-list -- modified */ double st, /* Start Theta, start angle */ et, /* End Theta, offset from start theta */ dt, /* Delta Theta, angle to sweep ellipse */ cdt, /* Cos Delta Theta, actually 2 cos(dt) */ x0, y0, /* the recurrence formula needs two points to start */ x1, y1, x2, y2, /* this will be the new point generated */ xc, yc; /* the center point */ int count, i; SppPointPtr poly; /* The spec says that positive angles indicate counterclockwise motion. * Given our coordinate system (with 0,0 in the upper left corner), * the screen appears flipped in Y. The easiest fix is to negate the * angles given */ st = -parc->angle1; et = -parc->angle2; /* Try to get a delta theta that is within 1/2 pixel. Then adjust it * so that it divides evenly into the total. * I'm just using cdt 'cause I'm lazy. */ cdt = parc->width; if (parc->height > cdt) cdt = parc->height; cdt /= 2.0; if (cdt <= 0) return 0; if (cdt < 1.0) cdt = 1.0; dt = miDasin(1.0 / cdt); /* minimum step necessary */ count = et / dt; count = abs(count) + 1; dt = et / count; count++; cdt = 2 * miDcos(dt); if (!(poly = reallocarray(*ppPts, cpt + count, sizeof(SppPointRec)))) return 0; *ppPts = poly; xc = parc->width / 2.0; /* store half width and half height */ yc = parc->height / 2.0; x0 = xc * miDcos(st); y0 = yc * miDsin(st); x1 = xc * miDcos(st + dt); y1 = yc * miDsin(st + dt); xc += parc->x; /* by adding initial point, these become */ yc += parc->y; /* the center point */ poly[cpt].x = (xc + x0); poly[cpt].y = (yc + y0); poly[cpt + 1].x = (xc + x1); poly[cpt + 1].y = (yc + y1); for (i = 2; i < count; i++) { x2 = cdt * x1 - x0; y2 = cdt * y1 - y0; poly[cpt + i].x = (xc + x2); poly[cpt + i].y = (yc + y2); x0 = x1; y0 = y1; x1 = x2; y1 = y2; } /* adjust the last point */ if (fabs(parc->angle2) >= 360.0) poly[cpt + i - 1] = poly[0]; else { poly[cpt + i - 1].x = (miDcos(st + et) * parc->width / 2.0 + xc); poly[cpt + i - 1].y = (miDsin(st + et) * parc->height / 2.0 + yc); } return count; } struct arcData { double x0, y0, x1, y1; int selfJoin; }; #define ADD_REALLOC_STEP 20 static void addCap(miArcCapPtr * capsp, int *ncapsp, int *sizep, int end, int arcIndex) { int newsize; miArcCapPtr cap; if (*ncapsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; cap = reallocarray(*capsp, newsize, sizeof(**capsp)); if (!cap) return; *sizep = newsize; *capsp = cap; } cap = &(*capsp)[*ncapsp]; cap->end = end; cap->arcIndex = arcIndex; ++*ncapsp; } static void addJoin(miArcJoinPtr * joinsp, int *njoinsp, int *sizep, int end0, int index0, int phase0, int end1, int index1, int phase1) { int newsize; miArcJoinPtr join; if (*njoinsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; join = reallocarray(*joinsp, newsize, sizeof(**joinsp)); if (!join) return; *sizep = newsize; *joinsp = join; } join = &(*joinsp)[*njoinsp]; join->end0 = end0; join->arcIndex0 = index0; join->phase0 = phase0; join->end1 = end1; join->arcIndex1 = index1; join->phase1 = phase1; ++*njoinsp; } static miArcDataPtr addArc(miArcDataPtr * arcsp, int *narcsp, int *sizep, xArc * xarc) { int newsize; miArcDataPtr arc; if (*narcsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; arc = reallocarray(*arcsp, newsize, sizeof(**arcsp)); if (!arc) return NULL; *sizep = newsize; *arcsp = arc; } arc = &(*arcsp)[*narcsp]; arc->arc = *xarc; ++*narcsp; return arc; } static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC) { int iphase; for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0); iphase >= 0; iphase--) { if (arcs[iphase].narcs > 0) free(arcs[iphase].arcs); if (arcs[iphase].njoins > 0) free(arcs[iphase].joins); if (arcs[iphase].ncaps > 0) free(arcs[iphase].caps); } free(arcs); } /* * map angles to radial distance. This only deals with the first quadrant */ /* * a polygonal approximation to the arc for computing arc lengths */ #define DASH_MAP_SIZE 91 #define dashIndexToAngle(di) ((((double) (di)) * 90.0) / ((double) DASH_MAP_SIZE - 1)) #define xAngleToDashIndex(xa) ((((long) (xa)) * (DASH_MAP_SIZE - 1)) / (90 * 64)) #define dashIndexToXAngle(di) ((((long) (di)) * (90 * 64)) / (DASH_MAP_SIZE - 1)) #define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1))) typedef struct { double map[DASH_MAP_SIZE]; } dashMap; static int computeAngleFromPath(int startAngle, int endAngle, dashMap * map, int *lenp, int backwards); static void computeDashMap(xArc * arcp, dashMap * map) { int di; double a, x, y, prevx = 0.0, prevy = 0.0, dist; for (di = 0; di < DASH_MAP_SIZE; di++) { a = dashIndexToAngle(di); x = ((double) arcp->width / 2.0) * miDcos(a); y = ((double) arcp->height / 2.0) * miDsin(a); if (di == 0) { map->map[di] = 0.0; } else { dist = hypot(x - prevx, y - prevy); map->map[di] = map->map[di - 1] + dist; } prevx = x; prevy = y; } } typedef enum { HORIZONTAL, VERTICAL, OTHER } arcTypes; /* this routine is a bit gory */ static miPolyArcPtr miComputeArcs(xArc * parcs, int narcs, GCPtr pGC) { int isDashed, isDoubleDash; int dashOffset; miPolyArcPtr arcs; int start, i, j, k = 0, nexti, nextk = 0; int joinSize[2]; int capSize[2]; int arcSize[2]; int angle2; double a0, a1; struct arcData *data; miArcDataPtr arc; xArc xarc; int iphase, prevphase = 0, joinphase; int arcsJoin; int selfJoin; int iDash = 0, dashRemaining = 0; int iDashStart = 0, dashRemainingStart = 0, iphaseStart; int startAngle, spanAngle, endAngle, backwards = 0; int prevDashAngle, dashAngle; dashMap map; isDashed = !(pGC->lineStyle == LineSolid); isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashOffset = pGC->dashOffset; data = xallocarray(narcs, sizeof(struct arcData)); if (!data) return NULL; arcs = xallocarray(isDoubleDash ? 2 : 1, sizeof(*arcs)); if (!arcs) { free(data); return NULL; } for (i = 0; i < narcs; i++) { a0 = todeg(parcs[i].angle1); angle2 = parcs[i].angle2; if (angle2 > FULLCIRCLE) angle2 = FULLCIRCLE; else if (angle2 < -FULLCIRCLE) angle2 = -FULLCIRCLE; data[i].selfJoin = angle2 == FULLCIRCLE || angle2 == -FULLCIRCLE; a1 = todeg(parcs[i].angle1 + angle2); data[i].x0 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos(a0)); data[i].y0 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin(a0)); data[i].x1 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos(a1)); data[i].y1 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin(a1)); } for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) { arcs[iphase].njoins = 0; arcs[iphase].joins = 0; joinSize[iphase] = 0; arcs[iphase].ncaps = 0; arcs[iphase].caps = 0; capSize[iphase] = 0; arcs[iphase].narcs = 0; arcs[iphase].arcs = 0; arcSize[iphase] = 0; } iphase = 0; if (isDashed) { iDash = 0; dashRemaining = pGC->dash[0]; while (dashOffset > 0) { if (dashOffset >= dashRemaining) { dashOffset -= dashRemaining; iphase = iphase ? 0 : 1; iDash++; if (iDash == pGC->numInDashList) iDash = 0; dashRemaining = pGC->dash[iDash]; } else { dashRemaining -= dashOffset; dashOffset = 0; } } iDashStart = iDash; dashRemainingStart = dashRemaining; } iphaseStart = iphase; for (i = narcs - 1; i >= 0; i--) { j = i + 1; if (j == narcs) j = 0; if (data[i].selfJoin || i == j || (UNEQUAL(data[i].x1, data[j].x0) || UNEQUAL(data[i].y1, data[j].y0))) { if (iphase == 0 || isDoubleDash) addCap(&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, 0); break; } } start = i + 1; if (start == narcs) start = 0; i = start; for (;;) { j = i + 1; if (j == narcs) j = 0; nexti = i + 1; if (nexti == narcs) nexti = 0; if (isDashed) { /* ** deal with dashed arcs. Use special rules for certain 0 area arcs. ** Presumably, the other 0 area arcs still aren't done right. */ arcTypes arcType = OTHER; CARD16 thisLength; if (parcs[i].height == 0 && (parcs[i].angle1 % FULLCIRCLE) == 0x2d00 && parcs[i].angle2 == 0x2d00) arcType = HORIZONTAL; else if (parcs[i].width == 0 && (parcs[i].angle1 % FULLCIRCLE) == 0x1680 && parcs[i].angle2 == 0x2d00) arcType = VERTICAL; if (arcType == OTHER) { /* * precompute an approximation map */ computeDashMap(&parcs[i], &map); /* * compute each individual dash segment using the path * length function */ startAngle = parcs[i].angle1; spanAngle = parcs[i].angle2; if (spanAngle > FULLCIRCLE) spanAngle = FULLCIRCLE; else if (spanAngle < -FULLCIRCLE) spanAngle = -FULLCIRCLE; if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; endAngle = startAngle + spanAngle; backwards = spanAngle < 0; } else { xarc = parcs[i]; if (arcType == VERTICAL) { xarc.angle1 = 0x1680; startAngle = parcs[i].y; endAngle = startAngle + parcs[i].height; } else { xarc.angle1 = 0x2d00; startAngle = parcs[i].x; endAngle = startAngle + parcs[i].width; } } dashAngle = startAngle; selfJoin = data[i].selfJoin && (iphase == 0 || isDoubleDash); /* * add dashed arcs to each bucket */ arc = 0; while (dashAngle != endAngle) { prevDashAngle = dashAngle; if (arcType == OTHER) { dashAngle = computeAngleFromPath(prevDashAngle, endAngle, &map, &dashRemaining, backwards); /* avoid troubles with huge arcs and small dashes */ if (dashAngle == prevDashAngle) { if (backwards) dashAngle--; else dashAngle++; } } else { thisLength = (dashAngle + dashRemaining <= endAngle) ? dashRemaining : endAngle - dashAngle; if (arcType == VERTICAL) { xarc.y = dashAngle; xarc.height = thisLength; } else { xarc.x = dashAngle; xarc.width = thisLength; } dashAngle += thisLength; dashRemaining -= thisLength; } if (iphase == 0 || isDoubleDash) { if (arcType == OTHER) { xarc = parcs[i]; spanAngle = prevDashAngle; if (spanAngle < 0) spanAngle = FULLCIRCLE - (-spanAngle) % FULLCIRCLE; if (spanAngle >= FULLCIRCLE) spanAngle = spanAngle % FULLCIRCLE; xarc.angle1 = spanAngle; spanAngle = dashAngle - prevDashAngle; if (backwards) { if (dashAngle > prevDashAngle) spanAngle = -FULLCIRCLE + spanAngle; } else { if (dashAngle < prevDashAngle) spanAngle = FULLCIRCLE + spanAngle; } if (spanAngle > FULLCIRCLE) spanAngle = FULLCIRCLE; if (spanAngle < -FULLCIRCLE) spanAngle = -FULLCIRCLE; xarc.angle2 = spanAngle; } arc = addArc(&arcs[iphase].arcs, &arcs[iphase].narcs, &arcSize[iphase], &xarc); if (!arc) goto arcfail; /* * cap each end of an on/off dash */ if (!isDoubleDash) { if (prevDashAngle != startAngle) { addCap(&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, arc - arcs[iphase].arcs); } if (dashAngle != endAngle) { addCap(&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], LEFT_END, arc - arcs[iphase].arcs); } } arc->cap = arcs[iphase].ncaps; arc->join = arcs[iphase].njoins; arc->render = 0; arc->selfJoin = 0; if (dashAngle == endAngle) arc->selfJoin = selfJoin; } prevphase = iphase; if (dashRemaining <= 0) { ++iDash; if (iDash == pGC->numInDashList) iDash = 0; iphase = iphase ? 0 : 1; dashRemaining = pGC->dash[iDash]; } } /* * make sure a place exists for the position data when * drawing a zero-length arc */ if (startAngle == endAngle) { prevphase = iphase; if (!isDoubleDash && iphase == 1) prevphase = 0; arc = addArc(&arcs[prevphase].arcs, &arcs[prevphase].narcs, &arcSize[prevphase], &parcs[i]); if (!arc) goto arcfail; arc->join = arcs[prevphase].njoins; arc->cap = arcs[prevphase].ncaps; arc->selfJoin = data[i].selfJoin; } } else { arc = addArc(&arcs[iphase].arcs, &arcs[iphase].narcs, &arcSize[iphase], &parcs[i]); if (!arc) goto arcfail; arc->join = arcs[iphase].njoins; arc->cap = arcs[iphase].ncaps; arc->selfJoin = data[i].selfJoin; prevphase = iphase; } if (prevphase == 0 || isDoubleDash) k = arcs[prevphase].narcs - 1; if (iphase == 0 || isDoubleDash) nextk = arcs[iphase].narcs; if (nexti == start) { nextk = 0; if (isDashed) { iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } } arcsJoin = narcs > 1 && i != j && ISEQUAL(data[i].x1, data[j].x0) && ISEQUAL(data[i].y1, data[j].y0) && !data[i].selfJoin && !data[j].selfJoin; if (arc) { if (arcsJoin) arc->render = 0; else arc->render = 1; } if (arcsJoin && (prevphase == 0 || isDoubleDash) && (iphase == 0 || isDoubleDash)) { joinphase = iphase; if (isDoubleDash) { if (nexti == start) joinphase = iphaseStart; /* * if the join is right at the dash, * draw the join in foreground * This is because the foreground * arcs are computed second, the results * of which are needed to draw the join */ if (joinphase != prevphase) joinphase = 0; } if (joinphase == 0 || isDoubleDash) { addJoin(&arcs[joinphase].joins, &arcs[joinphase].njoins, &joinSize[joinphase], LEFT_END, k, prevphase, RIGHT_END, nextk, iphase); arc->join = arcs[prevphase].njoins; } } else { /* * cap the left end of this arc * unless it joins itself */ if ((prevphase == 0 || isDoubleDash) && !arc->selfJoin) { addCap(&arcs[prevphase].caps, &arcs[prevphase].ncaps, &capSize[prevphase], LEFT_END, k); arc->cap = arcs[prevphase].ncaps; } if (isDashed && !arcsJoin) { iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } nextk = arcs[iphase].narcs; if (nexti == start) { nextk = 0; iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } /* * cap the right end of the next arc. If the * next arc is actually the first arc, only * cap it if it joins with this arc. This * case will occur when the final dash segment * of an on/off dash is off. Of course, this * cap will be drawn at a strange time, but that * hardly matters... */ if ((iphase == 0 || isDoubleDash) && (nexti != start || (arcsJoin && isDashed))) addCap(&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, nextk); } i = nexti; if (i == start) break; } /* * make sure the last section is rendered */ for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) if (arcs[iphase].narcs > 0) { arcs[iphase].arcs[arcs[iphase].narcs - 1].render = 1; arcs[iphase].arcs[arcs[iphase].narcs - 1].join = arcs[iphase].njoins; arcs[iphase].arcs[arcs[iphase].narcs - 1].cap = arcs[iphase].ncaps; } free(data); return arcs; arcfail: miFreeArcs(arcs, pGC); free(data); return NULL; } static double angleToLength(int angle, dashMap * map) { double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen; int di; int excess; Bool oddSide = FALSE; totallen = 0; if (angle >= 0) { while (angle >= 90 * 64) { angle -= 90 * 64; totallen += sidelen; oddSide = !oddSide; } } else { while (angle < 0) { angle += 90 * 64; totallen -= sidelen; oddSide = !oddSide; } } if (oddSide) angle = 90 * 64 - angle; di = xAngleToDashIndex(angle); excess = angle - dashIndexToXAngle(di); len = map->map[di]; /* * linearly interpolate between this point and the next */ if (excess > 0) { excesslen = (map->map[di + 1] - map->map[di]) * ((double) excess) / dashXAngleStep; len += excesslen; } if (oddSide) totallen += (sidelen - len); else totallen += len; return totallen; } /* * len is along the arc, but may be more than one rotation */ static int lengthToAngle(double len, dashMap * map) { double sidelen = map->map[DASH_MAP_SIZE - 1]; int angle, angleexcess; Bool oddSide = FALSE; int a0, a1, a; angle = 0; /* * step around the ellipse, subtracting sidelens and * adding 90 degrees. oddSide will tell if the * map should be interpolated in reverse */ if (len >= 0) { if (sidelen == 0) return 2 * FULLCIRCLE; /* infinity */ while (len >= sidelen) { angle += 90 * 64; len -= sidelen; oddSide = !oddSide; } } else { if (sidelen == 0) return -2 * FULLCIRCLE; /* infinity */ while (len < 0) { angle -= 90 * 64; len += sidelen; oddSide = !oddSide; } } if (oddSide) len = sidelen - len; a0 = 0; a1 = DASH_MAP_SIZE - 1; /* * binary search for the closest pre-computed length */ while (a1 - a0 > 1) { a = (a0 + a1) / 2; if (len > map->map[a]) a0 = a; else a1 = a; } angleexcess = dashIndexToXAngle(a0); /* * linearly interpolate to the next point */ angleexcess += (len - map->map[a0]) / (map->map[a0 + 1] - map->map[a0]) * dashXAngleStep; if (oddSide) angle += (90 * 64) - angleexcess; else angle += angleexcess; return angle; } /* * compute the angle of an ellipse which cooresponds to * the given path length. Note that the correct solution * to this problem is an eliptic integral, we'll punt and * approximate (it's only for dashes anyway). This * approximation uses a polygon. * * The remaining portion of len is stored in *lenp - * this will be negative if the arc extends beyond * len and positive if len extends beyond the arc. */ static int computeAngleFromPath(int startAngle, int endAngle, /* normalized absolute angles in *64 degrees */ dashMap * map, int *lenp, int backwards) { int a0, a1, a; double len0; int len; a0 = startAngle; a1 = endAngle; len = *lenp; if (backwards) { /* * flip the problem around to always be * forwards */ a0 = FULLCIRCLE - a0; a1 = FULLCIRCLE - a1; } if (a1 < a0) a1 += FULLCIRCLE; len0 = angleToLength(a0, map); a = lengthToAngle(len0 + len, map); if (a > a1) { a = a1; len -= angleToLength(a1, map) - len0; } else len = 0; if (backwards) a = FULLCIRCLE - a; *lenp = len; return a; } /* * scan convert wide arcs. */ /* * draw zero width/height arcs */ static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc * tarc, int lw, miArcFacePtr left, miArcFacePtr right) { double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y; double xmax, ymax, xmin, ymin; int a0, a1; double a, startAngle, endAngle; double l, lx, ly; l = lw / 2.0; a0 = tarc->angle1; a1 = tarc->angle2; if (a1 > FULLCIRCLE) a1 = FULLCIRCLE; else if (a1 < -FULLCIRCLE) a1 = -FULLCIRCLE; w = (double) tarc->width / 2.0; h = (double) tarc->height / 2.0; /* * play in X coordinates right away */ startAngle = -((double) a0 / 64.0); endAngle = -((double) (a0 + a1) / 64.0); xmax = -w; xmin = w; ymax = -h; ymin = h; a = startAngle; for (;;) { x = w * miDcos(a); y = h * miDsin(a); if (a == startAngle) { x0 = x; y0 = y; } if (a == endAngle) { x1 = x; y1 = y; } if (x > xmax) xmax = x; if (x < xmin) xmin = x; if (y > ymax) ymax = y; if (y < ymin) ymin = y; if (a == endAngle) break; if (a1 < 0) { /* clockwise */ if (floor(a / 90.0) == floor(endAngle / 90.0)) a = endAngle; else a = 90 * (floor(a / 90.0) + 1); } else { if (ceil(a / 90.0) == ceil(endAngle / 90.0)) a = endAngle; else a = 90 * (ceil(a / 90.0) - 1); } } lx = ly = l; if ((x1 - x0) + (y1 - y0) < 0) lx = ly = -l; if (h) { ly = 0.0; lx = -lx; } else lx = 0.0; if (right) { right->center.x = x0; right->center.y = y0; right->clock.x = x0 - lx; right->clock.y = y0 - ly; right->counterClock.x = x0 + lx; right->counterClock.y = y0 + ly; } if (left) { left->center.x = x1; left->center.y = y1; left->clock.x = x1 + lx; left->clock.y = y1 + ly; left->counterClock.x = x1 - lx; left->counterClock.y = y1 - ly; } x0 = xmin; x1 = xmax; y0 = ymin; y1 = ymax; if (ymin != y1) { xmin = -l; xmax = l; } else { ymin = -l; ymax = l; } if (xmax != xmin && ymax != ymin) { int minx, maxx, miny, maxy; xRectangle rect; minx = ICEIL(xmin + w) + tarc->x; maxx = ICEIL(xmax + w) + tarc->x; miny = ICEIL(ymin + h) + tarc->y; maxy = ICEIL(ymax + h) + tarc->y; rect.x = minx; rect.y = miny; rect.width = maxx - minx; rect.height = maxy - miny; (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); } } /* * this computes the ellipse y value associated with the * bottom of the tail. */ static void tailEllipseY(struct arc_def *def, struct accelerators *acc) { double t; acc->tail_y = 0.0; if (def->w == def->h) return; t = def->l * def->w; if (def->w > def->h) { if (t < acc->h2) return; } else { if (t > acc->h2) return; } t = 2.0 * def->h * t; t = (CUBED_ROOT_4 * acc->h2 - cbrt(t * t)) / acc->h2mw2; if (t > 0.0) acc->tail_y = def->h / CUBED_ROOT_2 * sqrt(t); } /* * inverse functions -- compute edge coordinates * from the ellipse */ static double outerXfromXY(double x, double y, struct arc_def *def, struct accelerators *acc) { return x + (x * acc->h2l) / sqrt(x * x * acc->h4 + y * y * acc->w4); } static double outerYfromXY(double x, double y, struct arc_def *def, struct accelerators *acc) { return y + (y * acc->w2l) / sqrt(x * x * acc->h4 + y * y * acc->w4); } static double innerXfromXY(double x, double y, struct arc_def *def, struct accelerators *acc) { return x - (x * acc->h2l) / sqrt(x * x * acc->h4 + y * y * acc->w4); } static double innerYfromXY(double x, double y, struct arc_def *def, struct accelerators *acc) { return y - (y * acc->w2l) / sqrt(x * x * acc->h4 + y * y * acc->w4); } static double innerYfromY(double y, struct arc_def *def, struct accelerators *acc) { double x; x = (def->w / def->h) * sqrt(acc->h2 - y * y); return y - (y * acc->w2l) / sqrt(x * x * acc->h4 + y * y * acc->w4); } static void computeLine(double x1, double y1, double x2, double y2, struct line *line) { if (y1 == y2) line->valid = 0; else { line->m = (x1 - x2) / (y1 - y2); line->b = x1 - y1 * line->m; line->valid = 1; } } /* * compute various accelerators for an ellipse. These * are simply values that are used repeatedly in * the computations */ static void computeAcc(xArc * tarc, int lw, struct arc_def *def, struct accelerators *acc) { def->w = ((double) tarc->width) / 2.0; def->h = ((double) tarc->height) / 2.0; def->l = ((double) lw) / 2.0; acc->h2 = def->h * def->h; acc->w2 = def->w * def->w; acc->h4 = acc->h2 * acc->h2; acc->w4 = acc->w2 * acc->w2; acc->h2l = acc->h2 * def->l; acc->w2l = acc->w2 * def->l; acc->h2mw2 = acc->h2 - acc->w2; acc->fromIntX = (tarc->width & 1) ? 0.5 : 0.0; acc->fromIntY = (tarc->height & 1) ? 0.5 : 0.0; acc->xorg = tarc->x + (tarc->width >> 1); acc->yorgu = tarc->y + (tarc->height >> 1); acc->yorgl = acc->yorgu + (tarc->height & 1); tailEllipseY(def, acc); } /* * compute y value bounds of various portions of the arc, * the outer edge, the ellipse and the inner edge. */ static void computeBound(struct arc_def *def, struct arc_bound *bound, struct accelerators *acc, miArcFacePtr right, miArcFacePtr left) { double t; double innerTaily; double tail_y; struct bound innerx, outerx; struct bound ellipsex; bound->ellipse.min = Dsin(def->a0) * def->h; bound->ellipse.max = Dsin(def->a1) * def->h; if (def->a0 == 45 && def->w == def->h) ellipsex.min = bound->ellipse.min; else ellipsex.min = Dcos(def->a0) * def->w; if (def->a1 == 45 && def->w == def->h) ellipsex.max = bound->ellipse.max; else ellipsex.max = Dcos(def->a1) * def->w; bound->outer.min = outerYfromXY(ellipsex.min, bound->ellipse.min, def, acc); bound->outer.max = outerYfromXY(ellipsex.max, bound->ellipse.max, def, acc); bound->inner.min = innerYfromXY(ellipsex.min, bound->ellipse.min, def, acc); bound->inner.max = innerYfromXY(ellipsex.max, bound->ellipse.max, def, acc); outerx.min = outerXfromXY(ellipsex.min, bound->ellipse.min, def, acc); outerx.max = outerXfromXY(ellipsex.max, bound->ellipse.max, def, acc); innerx.min = innerXfromXY(ellipsex.min, bound->ellipse.min, def, acc); innerx.max = innerXfromXY(ellipsex.max, bound->ellipse.max, def, acc); /* * save the line end points for the * cap code to use. Careful here, these are * in cartesean coordinates (y increasing upwards) * while the cap code uses inverted coordinates * (y increasing downwards) */ if (right) { right->counterClock.y = bound->outer.min; right->counterClock.x = outerx.min; right->center.y = bound->ellipse.min; right->center.x = ellipsex.min; right->clock.y = bound->inner.min; right->clock.x = innerx.min; } if (left) { left->clock.y = bound->outer.max; left->clock.x = outerx.max; left->center.y = bound->ellipse.max; left->center.x = ellipsex.max; left->counterClock.y = bound->inner.max; left->counterClock.x = innerx.max; } bound->left.min = bound->inner.max; bound->left.max = bound->outer.max; bound->right.min = bound->inner.min; bound->right.max = bound->outer.min; computeLine(innerx.min, bound->inner.min, outerx.min, bound->outer.min, &acc->right); computeLine(innerx.max, bound->inner.max, outerx.max, bound->outer.max, &acc->left); if (bound->inner.min > bound->inner.max) { t = bound->inner.min; bound->inner.min = bound->inner.max; bound->inner.max = t; } tail_y = acc->tail_y; if (tail_y > bound->ellipse.max) tail_y = bound->ellipse.max; else if (tail_y < bound->ellipse.min) tail_y = bound->ellipse.min; innerTaily = innerYfromY(tail_y, def, acc); if (bound->inner.min > innerTaily) bound->inner.min = innerTaily; if (bound->inner.max < innerTaily) bound->inner.max = innerTaily; bound->inneri.min = ICEIL(bound->inner.min - acc->fromIntY); bound->inneri.max = floor(bound->inner.max - acc->fromIntY); bound->outeri.min = ICEIL(bound->outer.min - acc->fromIntY); bound->outeri.max = floor(bound->outer.max - acc->fromIntY); } /* * this section computes the x value of the span at y * intersected with the specified face of the ellipse. * * this is the min/max X value over the set of normal * lines to the entire ellipse, the equation of the * normal lines is: * * ellipse_x h^2 h^2 * x = ------------ y + ellipse_x (1 - --- ) * ellipse_y w^2 w^2 * * compute the derivative with-respect-to ellipse_y and solve * for zero: * * (w^2 - h^2) ellipse_y^3 + h^4 y * 0 = - ---------------------------------- * h w ellipse_y^2 sqrt (h^2 - ellipse_y^2) * * ( h^4 y ) * ellipse_y = ( ---------- ) ^ (1/3) * ( (h^2 - w^2) ) * * The other two solutions to the equation are imaginary. * * This gives the position on the ellipse which generates * the normal with the largest/smallest x intersection point. * * Now compute the second derivative to check whether * the intersection is a minimum or maximum: * * h (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2)) * - ------------------------------------------- * w y0^3 (sqrt (h^2 - y^2)) ^ 3 * * as we only care about the sign, * * - (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2)) * * or (to use accelerators), * * y0^3 (h^2 - w^2) - h^2 y (3y0^2 - 2h^2) * */ /* * computes the position on the ellipse whose normal line * intersects the given scan line maximally */ static double hookEllipseY(double scan_y, struct arc_bound *bound, struct accelerators *acc, int left) { double ret; if (acc->h2mw2 == 0) { if ((scan_y > 0 && !left) || (scan_y < 0 && left)) return bound->ellipse.min; return bound->ellipse.max; } ret = (acc->h4 * scan_y) / (acc->h2mw2); if (ret >= 0) return cbrt(ret); else return -cbrt(-ret); } /* * computes the X value of the intersection of the * given scan line with the right side of the lower hook */ static double hookX(double scan_y, struct arc_def *def, struct arc_bound *bound, struct accelerators *acc, int left) { double ellipse_y, x; double maxMin; if (def->w != def->h) { ellipse_y = hookEllipseY(scan_y, bound, acc, left); if (boundedLe(ellipse_y, bound->ellipse)) { /* * compute the value of the second * derivative */ maxMin = ellipse_y * ellipse_y * ellipse_y * acc->h2mw2 - acc->h2 * scan_y * (3 * ellipse_y * ellipse_y - 2 * acc->h2); if ((left && maxMin > 0) || (!left && maxMin < 0)) { if (ellipse_y == 0) return def->w + left ? -def->l : def->l; x = (acc->h2 * scan_y - ellipse_y * acc->h2mw2) * sqrt(acc->h2 - ellipse_y * ellipse_y) / (def->h * def->w * ellipse_y); return x; } } } if (left) { if (acc->left.valid && boundedLe(scan_y, bound->left)) { x = intersectLine(scan_y, acc->left); } else { if (acc->right.valid) x = intersectLine(scan_y, acc->right); else x = def->w - def->l; } } else { if (acc->right.valid && boundedLe(scan_y, bound->right)) { x = intersectLine(scan_y, acc->right); } else { if (acc->left.valid) x = intersectLine(scan_y, acc->left); else x = def->w - def->l; } } return x; } /* * generate the set of spans with * the given y coordinate */ static void arcSpan(int y, int lx, int lw, int rx, int rw, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc, int mask) { int linx, loutx, rinx, routx; double x, altx; if (boundedLe(y, bounds->inneri)) { linx = -(lx + lw); rinx = rx; } else { /* * intersection with left face */ x = hookX(y + acc->fromIntY, def, bounds, acc, 1); if (acc->right.valid && boundedLe(y + acc->fromIntY, bounds->right)) { altx = intersectLine(y + acc->fromIntY, acc->right); if (altx < x) x = altx; } linx = -ICEIL(acc->fromIntX - x); rinx = ICEIL(acc->fromIntX + x); } if (boundedLe(y, bounds->outeri)) { loutx = -lx; routx = rx + rw; } else { /* * intersection with right face */ x = hookX(y + acc->fromIntY, def, bounds, acc, 0); if (acc->left.valid && boundedLe(y + acc->fromIntY, bounds->left)) { altx = x; x = intersectLine(y + acc->fromIntY, acc->left); if (x < altx) x = altx; } loutx = -ICEIL(acc->fromIntX - x); routx = ICEIL(acc->fromIntX + x); } if (routx > rinx) { if (mask & 1) newFinalSpan(acc->yorgu - y, acc->xorg + rinx, acc->xorg + routx); if (mask & 8) newFinalSpan(acc->yorgl + y, acc->xorg + rinx, acc->xorg + routx); } if (loutx > linx) { if (mask & 2) newFinalSpan(acc->yorgu - y, acc->xorg - loutx, acc->xorg - linx); if (mask & 4) newFinalSpan(acc->yorgl + y, acc->xorg - loutx, acc->xorg - linx); } } static void arcSpan0(int lx, int lw, int rx, int rw, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc, int mask) { double x; if (boundedLe(0, bounds->inneri) && acc->left.valid && boundedLe(0, bounds->left) && acc->left.b > 0) { x = def->w - def->l; if (acc->left.b < x) x = acc->left.b; lw = ICEIL(acc->fromIntX - x) - lx; rw += rx; rx = ICEIL(acc->fromIntX + x); rw -= rx; } arcSpan(0, lx, lw, rx, rw, def, bounds, acc, mask); } static void tailSpan(int y, int lw, int rw, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc, int mask) { double yy, xalt, x, lx, rx; int n; if (boundedLe(y, bounds->outeri)) arcSpan(y, 0, lw, -rw, rw, def, bounds, acc, mask); else if (def->w != def->h) { yy = y + acc->fromIntY; x = tailX(yy, def, bounds, acc); if (yy == 0.0 && x == -rw - acc->fromIntX) return; if (acc->right.valid && boundedLe(yy, bounds->right)) { rx = x; lx = -x; xalt = intersectLine(yy, acc->right); if (xalt >= -rw - acc->fromIntX && xalt <= rx) rx = xalt; n = ICEIL(acc->fromIntX + lx); if (lw > n) { if (mask & 2) newFinalSpan(acc->yorgu - y, acc->xorg + n, acc->xorg + lw); if (mask & 4) newFinalSpan(acc->yorgl + y, acc->xorg + n, acc->xorg + lw); } n = ICEIL(acc->fromIntX + rx); if (n > -rw) { if (mask & 1) newFinalSpan(acc->yorgu - y, acc->xorg - rw, acc->xorg + n); if (mask & 8) newFinalSpan(acc->yorgl + y, acc->xorg - rw, acc->xorg + n); } } arcSpan(y, ICEIL(acc->fromIntX - x), 0, ICEIL(acc->fromIntX + x), 0, def, bounds, acc, mask); } } /* * create whole arcs out of pieces. This code is * very bad. */ static struct finalSpan **finalSpans = NULL; static int finalMiny = 0, finalMaxy = -1; static int finalSize = 0; static int nspans = 0; /* total spans, not just y coords */ struct finalSpan { struct finalSpan *next; int min, max; /* x values */ }; static struct finalSpan *freeFinalSpans, *tmpFinalSpan; #define allocFinalSpan() (freeFinalSpans ?\ ((tmpFinalSpan = freeFinalSpans), \ (freeFinalSpans = freeFinalSpans->next), \ (tmpFinalSpan->next = 0), \ tmpFinalSpan) : \ realAllocSpan ()) #define SPAN_CHUNK_SIZE 128 struct finalSpanChunk { struct finalSpan data[SPAN_CHUNK_SIZE]; struct finalSpanChunk *next; }; static struct finalSpanChunk *chunks; static struct finalSpan * realAllocSpan(void) { struct finalSpanChunk *newChunk; struct finalSpan *span; int i; newChunk = malloc(sizeof(struct finalSpanChunk)); if (!newChunk) return (struct finalSpan *) NULL; newChunk->next = chunks; chunks = newChunk; freeFinalSpans = span = newChunk->data + 1; for (i = 1; i < SPAN_CHUNK_SIZE - 1; i++) { span->next = span + 1; span++; } span->next = 0; span = newChunk->data; span->next = 0; return span; } static void disposeFinalSpans(void) { struct finalSpanChunk *chunk, *next; for (chunk = chunks; chunk; chunk = next) { next = chunk->next; free(chunk); } chunks = 0; freeFinalSpans = 0; free(finalSpans); finalSpans = 0; } static void fillSpans(DrawablePtr pDrawable, GCPtr pGC) { struct finalSpan *span; DDXPointPtr xSpan; int *xWidth; int i; struct finalSpan **f; int spany; DDXPointPtr xSpans; int *xWidths; if (nspans == 0) return; xSpan = xSpans = xallocarray(nspans, sizeof(DDXPointRec)); xWidth = xWidths = xallocarray(nspans, sizeof(int)); if (xSpans && xWidths) { i = 0; f = finalSpans; for (spany = finalMiny; spany <= finalMaxy; spany++, f++) { for (span = *f; span; span = span->next) { if (span->max <= span->min) continue; xSpan->x = span->min; xSpan->y = spany; ++xSpan; *xWidth++ = span->max - span->min; ++i; } } (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE); } disposeFinalSpans(); free(xSpans); free(xWidths); finalMiny = 0; finalMaxy = -1; finalSize = 0; nspans = 0; } #define SPAN_REALLOC 100 #define findSpan(y) ((finalMiny <= (y) && (y) <= finalMaxy) ? \ &finalSpans[(y) - finalMiny] : \ realFindSpan (y)) static struct finalSpan ** realFindSpan(int y) { struct finalSpan **newSpans; int newSize, newMiny, newMaxy; int change; int i; if (y < finalMiny || y > finalMaxy) { if (!finalSize) { finalMiny = y; finalMaxy = y - 1; } if (y < finalMiny) change = finalMiny - y; else change = y - finalMaxy; if (change >= SPAN_REALLOC) change += SPAN_REALLOC; else change = SPAN_REALLOC; newSize = finalSize + change; newSpans = xallocarray(newSize, sizeof(struct finalSpan *)); if (!newSpans) return NULL; newMiny = finalMiny; newMaxy = finalMaxy; if (y < finalMiny) newMiny = finalMiny - change; else newMaxy = finalMaxy + change; if (finalSpans) { memmove(((char *) newSpans) + (finalMiny - newMiny) * sizeof(struct finalSpan *), (char *) finalSpans, finalSize * sizeof(struct finalSpan *)); free(finalSpans); } if ((i = finalMiny - newMiny) > 0) memset((char *) newSpans, 0, i * sizeof(struct finalSpan *)); if ((i = newMaxy - finalMaxy) > 0) memset((char *) (newSpans + newSize - i), 0, i * sizeof(struct finalSpan *)); finalSpans = newSpans; finalMaxy = newMaxy; finalMiny = newMiny; finalSize = newSize; } return &finalSpans[y - finalMiny]; } static void newFinalSpan(int y, int xmin, int xmax) { struct finalSpan *x; struct finalSpan **f; struct finalSpan *oldx; struct finalSpan *prev; f = findSpan(y); if (!f) return; oldx = 0; for (;;) { prev = 0; for (x = *f; x; x = x->next) { if (x == oldx) { prev = x; continue; } if (x->min <= xmax && xmin <= x->max) { if (oldx) { oldx->min = min(x->min, xmin); oldx->max = max(x->max, xmax); if (prev) prev->next = x->next; else *f = x->next; --nspans; } else { x->min = min(x->min, xmin); x->max = max(x->max, xmax); oldx = x; } xmin = oldx->min; xmax = oldx->max; break; } prev = x; } if (!x) break; } if (!oldx) { x = allocFinalSpan(); if (x) { x->min = xmin; x->max = xmax; x->next = *f; *f = x; ++nspans; } } } static void mirrorSppPoint(int quadrant, SppPointPtr sppPoint) { switch (quadrant) { case 0: break; case 1: sppPoint->x = -sppPoint->x; break; case 2: sppPoint->x = -sppPoint->x; sppPoint->y = -sppPoint->y; break; case 3: sppPoint->y = -sppPoint->y; break; } /* * and translate to X coordinate system */ sppPoint->y = -sppPoint->y; } /* * split an arc into pieces which are scan-converted * in the first-quadrant and mirrored into position. * This is necessary as the scan-conversion code can * only deal with arcs completely contained in the * first quadrant. */ static miArcSpanData * drawArc(xArc * tarc, int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left, miArcSpanData *spdata) { /* save end line points */ struct arc_def def; struct accelerators acc; int startq, endq, curq; int rightq, leftq = 0, righta = 0, lefta = 0; miArcFacePtr passRight, passLeft; int q0 = 0, q1 = 0, mask; struct band { int a0, a1; int mask; } band[5], sweep[20]; int bandno, sweepno; int i, j; int flipRight = 0, flipLeft = 0; int copyEnd = 0; if (!spdata) spdata = miComputeWideEllipse(l, tarc); if (!spdata) return NULL; if (a1 < a0) a1 += 360 * 64; startq = a0 / (90 * 64); if (a0 == a1) endq = startq; else endq = (a1 - 1) / (90 * 64); bandno = 0; curq = startq; rightq = -1; for (;;) { switch (curq) { case 0: if (a0 > 90 * 64) q0 = 0; else q0 = a0; if (a1 < 360 * 64) q1 = min(a1, 90 * 64); else q1 = 90 * 64; if (curq == startq && a0 == q0 && rightq < 0) { righta = q0; rightq = curq; } if (curq == endq && a1 == q1) { lefta = q1; leftq = curq; } break; case 1: if (a1 < 90 * 64) q0 = 0; else q0 = 180 * 64 - min(a1, 180 * 64); if (a0 > 180 * 64) q1 = 90 * 64; else q1 = 180 * 64 - max(a0, 90 * 64); if (curq == startq && 180 * 64 - a0 == q1) { righta = q1; rightq = curq; } if (curq == endq && 180 * 64 - a1 == q0) { lefta = q0; leftq = curq; } break; case 2: if (a0 > 270 * 64) q0 = 0; else q0 = max(a0, 180 * 64) - 180 * 64; if (a1 < 180 * 64) q1 = 90 * 64; else q1 = min(a1, 270 * 64) - 180 * 64; if (curq == startq && a0 - 180 * 64 == q0) { righta = q0; rightq = curq; } if (curq == endq && a1 - 180 * 64 == q1) { lefta = q1; leftq = curq; } break; case 3: if (a1 < 270 * 64) q0 = 0; else q0 = 360 * 64 - min(a1, 360 * 64); q1 = 360 * 64 - max(a0, 270 * 64); if (curq == startq && 360 * 64 - a0 == q1) { righta = q1; rightq = curq; } if (curq == endq && 360 * 64 - a1 == q0) { lefta = q0; leftq = curq; } break; } band[bandno].a0 = q0; band[bandno].a1 = q1; band[bandno].mask = 1 << curq; bandno++; if (curq == endq) break; curq++; if (curq == 4) { a0 = 0; a1 -= 360 * 64; curq = 0; endq -= 4; } } sweepno = 0; for (;;) { q0 = 90 * 64; mask = 0; /* * find left-most point */ for (i = 0; i < bandno; i++) if (band[i].a0 <= q0) { q0 = band[i].a0; q1 = band[i].a1; mask = band[i].mask; } if (!mask) break; /* * locate next point of change */ for (i = 0; i < bandno; i++) if (!(mask & band[i].mask)) { if (band[i].a0 == q0) { if (band[i].a1 < q1) q1 = band[i].a1; mask |= band[i].mask; } else if (band[i].a0 < q1) q1 = band[i].a0; } /* * create a new sweep */ sweep[sweepno].a0 = q0; sweep[sweepno].a1 = q1; sweep[sweepno].mask = mask; sweepno++; /* * subtract the sweep from the affected bands */ for (i = 0; i < bandno; i++) if (band[i].a0 == q0) { band[i].a0 = q1; /* * check if this band is empty */ if (band[i].a0 == band[i].a1) band[i].a1 = band[i].a0 = 90 * 64 + 1; } } computeAcc(tarc, l, &def, &acc); for (j = 0; j < sweepno; j++) { mask = sweep[j].mask; passRight = passLeft = 0; if (mask & (1 << rightq)) { if (sweep[j].a0 == righta) passRight = right; else if (sweep[j].a1 == righta) { passLeft = right; flipRight = 1; } } if (mask & (1 << leftq)) { if (sweep[j].a1 == lefta) { if (passLeft) copyEnd = 1; passLeft = left; } else if (sweep[j].a0 == lefta) { if (passRight) copyEnd = 1; passRight = left; flipLeft = 1; } } drawQuadrant(&def, &acc, sweep[j].a0, sweep[j].a1, mask, passRight, passLeft, spdata); } /* * when copyEnd is set, both ends of the arc were computed * at the same time; drawQuadrant only takes one end though, * so the left end will be the only one holding the data. Copy * it from there. */ if (copyEnd) *right = *left; /* * mirror the coordinates generated for the * faces of the arc */ if (right) { mirrorSppPoint(rightq, &right->clock); mirrorSppPoint(rightq, &right->center); mirrorSppPoint(rightq, &right->counterClock); if (flipRight) { SppPointRec temp; temp = right->clock; right->clock = right->counterClock; right->counterClock = temp; } } if (left) { mirrorSppPoint(leftq, &left->counterClock); mirrorSppPoint(leftq, &left->center); mirrorSppPoint(leftq, &left->clock); if (flipLeft) { SppPointRec temp; temp = left->clock; left->clock = left->counterClock; left->counterClock = temp; } } return spdata; } static void drawQuadrant(struct arc_def *def, struct accelerators *acc, int a0, int a1, int mask, miArcFacePtr right, miArcFacePtr left, miArcSpanData * spdata) { struct arc_bound bound; double yy, x, xalt; int y, miny, maxy; int n; miArcSpan *span; def->a0 = ((double) a0) / 64.0; def->a1 = ((double) a1) / 64.0; computeBound(def, &bound, acc, right, left); yy = bound.inner.min; if (bound.outer.min < yy) yy = bound.outer.min; miny = ICEIL(yy - acc->fromIntY); yy = bound.inner.max; if (bound.outer.max > yy) yy = bound.outer.max; maxy = floor(yy - acc->fromIntY); y = spdata->k; span = spdata->spans; if (spdata->top) { if (a1 == 90 * 64 && (mask & 1)) newFinalSpan(acc->yorgu - y - 1, acc->xorg, acc->xorg + 1); span++; } for (n = spdata->count1; --n >= 0;) { if (y < miny) return; if (y <= maxy) { arcSpan(y, span->lx, -span->lx, 0, span->lx + span->lw, def, &bound, acc, mask); if (span->rw + span->rx) tailSpan(y, -span->rw, -span->rx, def, &bound, acc, mask); } y--; span++; } if (y < miny) return; if (spdata->hole) { if (y <= maxy) arcSpan(y, 0, 0, 0, 1, def, &bound, acc, mask & 0xc); } for (n = spdata->count2; --n >= 0;) { if (y < miny) return; if (y <= maxy) arcSpan(y, span->lx, span->lw, span->rx, span->rw, def, &bound, acc, mask); y--; span++; } if (spdata->bot && miny <= y && y <= maxy) { n = mask; if (y == miny) n &= 0xc; if (span->rw <= 0) { arcSpan0(span->lx, -span->lx, 0, span->lx + span->lw, def, &bound, acc, n); if (span->rw + span->rx) tailSpan(y, -span->rw, -span->rx, def, &bound, acc, n); } else arcSpan0(span->lx, span->lw, span->rx, span->rw, def, &bound, acc, n); y--; } while (y >= miny) { yy = y + acc->fromIntY; if (def->w == def->h) { xalt = def->w - def->l; x = -sqrt(xalt * xalt - yy * yy); } else { x = tailX(yy, def, &bound, acc); if (acc->left.valid && boundedLe(yy, bound.left)) { xalt = intersectLine(yy, acc->left); if (xalt < x) x = xalt; } if (acc->right.valid && boundedLe(yy, bound.right)) { xalt = intersectLine(yy, acc->right); if (xalt < x) x = xalt; } } arcSpan(y, ICEIL(acc->fromIntX - x), 0, ICEIL(acc->fromIntX + x), 0, def, &bound, acc, mask); y--; } } void miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) { if (pGC->lineWidth == 0) miZeroPolyArc(pDraw, pGC, narcs, parcs); else miWideArc(pDraw, pGC, narcs, parcs); } xorg-server-1.20.8/mi/mi.h0000644000175000017500000004561013640201473012177 00000000000000/*********************************************************** 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 MI_H #define MI_H #include #include "region.h" #include "validate.h" #include "window.h" #include "gc.h" #include #include "input.h" #include "cursor.h" #include "privates.h" #include "colormap.h" #include "events.h" #define MiBits CARD32 typedef struct _miDash *miDashPtr; #define EVEN_DASH 0 #define ODD_DASH ~0 /* miarc.c */ extern _X_EXPORT void miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs); extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*narcs */ , xArc * /*parcs */ ); /* mibitblt.c */ extern _X_EXPORT RegionPtr miCopyArea(DrawablePtr /*pSrcDrawable */ , DrawablePtr /*pDstDrawable */ , GCPtr /*pGC */ , int /*xIn */ , int /*yIn */ , int /*widthSrc */ , int /*heightSrc */ , int /*xOut */ , int /*yOut */ ); extern _X_EXPORT RegionPtr miCopyPlane(DrawablePtr /*pSrcDrawable */ , DrawablePtr /*pDstDrawable */ , GCPtr /*pGC */ , int /*srcx */ , int /*srcy */ , int /*width */ , int /*height */ , int /*dstx */ , int /*dsty */ , unsigned long /*bitPlane */ ); extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ , int /*sx */ , int /*sy */ , int /*w */ , int /*h */ , unsigned int /*format */ , unsigned long /*planeMask */ , char * /*pdstLine */ ); extern _X_EXPORT void miPutImage(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*depth */ , int /*x */ , int /*y */ , int /*w */ , int /*h */ , int /*leftPad */ , int /*format */ , char * /*pImage */ ); /* micopy.c */ #define miGetCompositeClip(pGC) ((pGC)->pCompositeClip) typedef void (*miCopyProc) (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pDstBox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); extern _X_EXPORT void miCopyRegion(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, RegionPtr pDstRegion, int dx, int dy, miCopyProc copyProc, Pixel bitPlane, void *closure); extern _X_EXPORT RegionPtr miDoCopy(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, miCopyProc copyProc, Pixel bitplane, void *closure); /* micursor.c */ extern _X_EXPORT void miRecolorCursor(DeviceIntPtr /* pDev */ , ScreenPtr /*pScr */ , CursorPtr /*pCurs */ , Bool /*displayed */ ); /* midash.c */ extern _X_EXPORT void miStepDash(int /*dist */ , int * /*pDashIndex */ , unsigned char * /*pDash */ , int /*numInDashList */ , int * /*pDashOffset */ ); /* mieq.c */ #ifndef INPUT_H typedef struct _DeviceRec *DevicePtr; #endif extern _X_EXPORT Bool mieqInit(void ); extern _X_EXPORT void mieqFini(void); extern _X_EXPORT void mieqEnqueue(DeviceIntPtr /*pDev */ , InternalEvent * /*e */ ); extern _X_EXPORT void mieqSwitchScreen(DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , Bool /*set_dequeue_screen */ ); extern _X_EXPORT void mieqProcessDeviceEvent(DeviceIntPtr /* dev */ , InternalEvent * /* event */ , ScreenPtr /* screen */ ); extern _X_EXPORT void mieqProcessInputEvents(void ); extern DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr /* sdev */ , InternalEvent * /* original */ , InternalEvent * /* copy */ ); /** * Custom input event handler. If you need to process input events in some * other way than the default path, register an input event handler for the * given internal event type. */ typedef void (*mieqHandler) (int screen, InternalEvent *event, DeviceIntPtr dev); void _X_EXPORT mieqSetHandler(int event, mieqHandler handler); /* miexpose.c */ extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ , DrawablePtr /*pDstDrawable */ , GCPtr /*pGC */ , int /*srcx */ , int /*srcy */ , int /*width */ , int /*height */ , int /*dstx */ , int /*dsty */ ); extern _X_EXPORT void miSendExposures(WindowPtr /*pWin */ , RegionPtr /*pRgn */ , int /*dx */ , int /*dy */ ); extern _X_EXPORT void miWindowExposures(WindowPtr /*pWin */ , RegionPtr /*prgn */); extern _X_EXPORT void miPaintWindow(WindowPtr /*pWin */ , RegionPtr /*prgn */ , int /*what */ ); extern _X_EXPORT void miClearDrawable(DrawablePtr /*pDraw */ , GCPtr /*pGC */ ); /* mifillrct.c */ extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*nrectFill */ , xRectangle * /*prectInit */ ); /* miglblt.c */ extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase ); extern _X_EXPORT void miImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase ); /* mipoly.c */ extern _X_EXPORT void miFillPolygon(DrawablePtr /*dst */ , GCPtr /*pgc */ , int /*shape */ , int /*mode */ , int /*count */ , DDXPointPtr /*pPts */ ); /* mipolypnt.c */ extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*mode */ , int /*npt */ , xPoint * /*pptInit */ ); /* mipolyrect.c */ extern _X_EXPORT void miPolyRectangle(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*nrects */ , xRectangle * /*pRects */ ); /* mipolyseg.c */ extern _X_EXPORT void miPolySegment(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*nseg */ , xSegment * /*pSegs */ ); /* mipolytext.c */ extern _X_EXPORT int miPolyText8(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , char * /*chars */ ); extern _X_EXPORT int miPolyText16(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , unsigned short * /*chars */ ); extern _X_EXPORT void miImageText8(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , char * /*chars */ ); extern _X_EXPORT void miImageText16(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , unsigned short * /*chars */ ); /* mipushpxl.c */ extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ , PixmapPtr /*pBitMap */ , DrawablePtr /*pDrawable */ , int /*dx */ , int /*dy */ , int /*xOrg */ , int /*yOrg */ ); /* miscrinit.c */ extern _X_EXPORT void miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int subWindowMode); extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData ); extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */ ); extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits ); extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int rootDepth, int numDepths, DepthPtr depths, VisualID rootVisual, int numVisuals, VisualPtr visuals ); /* mivaltree.c */ extern _X_EXPORT int miShapedWindowIn(RegionPtr /*universe */ , RegionPtr /*bounding */ , BoxPtr /*rect */ , int /*x */ , int /*y */ ); extern _X_EXPORT int miValidateTree(WindowPtr /*pParent */ , WindowPtr /*pChild */ , VTKind /*kind */ ); extern _X_EXPORT void miWideLine(DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*mode */ , int /*npt */ , DDXPointPtr /*pPts */ ); extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*mode */ , int /*npt */ , DDXPointPtr /*pPts */ ); extern _X_EXPORT void miPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pPts); /* miwindow.c */ extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ , int /*x */ , int /*y */ , int /*w */ , int /*h */ , Bool /*generateExposures */ ); extern _X_EXPORT void miMarkWindow(WindowPtr /*pWin */ ); extern _X_EXPORT Bool miMarkOverlappedWindows(WindowPtr /*pWin */ , WindowPtr /*pFirst */ , WindowPtr * /*ppLayerWin */ ); extern _X_EXPORT void miHandleValidateExposures(WindowPtr /*pWin */ ); extern _X_EXPORT void miMoveWindow(WindowPtr /*pWin */ , int /*x */ , int /*y */ , WindowPtr /*pNextSib */ , VTKind /*kind */ ); extern _X_EXPORT void miResizeWindow(WindowPtr /*pWin */ , int /*x */ , int /*y */ , unsigned int /*w */ , unsigned int /*h */ , WindowPtr /*pSib */ ); extern _X_EXPORT WindowPtr miGetLayerWindow(WindowPtr /*pWin */ ); extern _X_EXPORT void miSetShape(WindowPtr /*pWin */ , int /*kind */ ); extern _X_EXPORT void miChangeBorderWidth(WindowPtr /*pWin */ , unsigned int /*width */ ); extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ , WindowPtr /*pWin */ , Bool /*fromConfigure */ ); extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y); extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y); /* mizerarc.c */ extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*narcs */ , xArc * /*parcs */ ); /* mizerline.c */ extern _X_EXPORT void miZeroLine(DrawablePtr /*dst */ , GCPtr /*pgc */ , int /*mode */ , int /*nptInit */ , DDXPointRec * /*pptInit */ ); extern _X_EXPORT void miZeroDashLine(DrawablePtr /*dst */ , GCPtr /*pgc */ , int /*mode */ , int /*nptInit */ , DDXPointRec * /*pptInit */ ); extern _X_EXPORT void miPolyFillArc(DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*narcs */ , xArc * /*parcs */ ); #endif /* MI_H */ xorg-server-1.20.8/mi/midispcur.c0000644000175000017500000003673013640201473013567 00000000000000/* * midispcur.c * * machine independent cursor display routines */ /* Copyright 1989, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "input.h" #include "cursorstr.h" #include "windowstr.h" #include "regionstr.h" #include "dixstruct.h" #include "scrnintstr.h" #include "servermd.h" #include "mipointer.h" #include "misprite.h" #include "gcstruct.h" #include "picturestr.h" #include "inputstr.h" /* per-screen private data */ static DevPrivateKeyRec miDCScreenKeyRec; #define miDCScreenKey (&miDCScreenKeyRec) static DevScreenPrivateKeyRec miDCDeviceKeyRec; #define miDCDeviceKey (&miDCDeviceKeyRec) static Bool miDCCloseScreen(ScreenPtr pScreen); /* per device private data */ typedef struct { GCPtr pSourceGC, pMaskGC; GCPtr pSaveGC, pRestoreGC; PixmapPtr pSave; PicturePtr pRootPicture; } miDCBufferRec, *miDCBufferPtr; #define miGetDCDevice(dev, screen) \ ((DevHasCursor(dev)) ? \ (miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \ (miDCBufferPtr)dixLookupScreenPrivate(&GetMaster(dev, MASTER_POINTER)->devPrivates, miDCDeviceKey, screen)) /* * The core pointer buffer will point to the index of the virtual pointer * in the pCursorBuffers array. */ typedef struct { CloseScreenProcPtr CloseScreen; PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ PicturePtr pPicture; CursorPtr pCursor; } miDCScreenRec, *miDCScreenPtr; #define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey))) Bool miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) { miDCScreenPtr pScreenPriv; if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) || !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0)) return FALSE; pScreenPriv = calloc(1, sizeof(miDCScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miDCCloseScreen; dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); if (!miSpriteInitialize(pScreen, screenFuncs)) { free((void *) pScreenPriv); return FALSE; } return TRUE; } static void miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBits, PixmapPtr maskBits, PicturePtr pPicture) { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); if (pScreenPriv->sourceBits) (*pScreen->DestroyPixmap)(pScreenPriv->sourceBits); pScreenPriv->sourceBits = sourceBits; if (pScreenPriv->maskBits) (*pScreen->DestroyPixmap)(pScreenPriv->maskBits); pScreenPriv->maskBits = maskBits; if (pScreenPriv->pPicture) FreePicture(pScreenPriv->pPicture, 0); pScreenPriv->pPicture = pPicture; pScreenPriv->pCursor = pCursor; } static Bool miDCCloseScreen(ScreenPtr pScreen) { miDCScreenPtr pScreenPriv; pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); free((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } #define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win)) static PicturePtr miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin) { PictFormatPtr pFormat; XID subwindow_mode = IncludeInferiors; PicturePtr pPicture; int error; pFormat = PictureWindowFormat(pWin); if (!pFormat) return 0; pPicture = CreatePicture(0, pDraw, pFormat, CPSubwindowMode, &subwindow_mode, serverClient, &error); *ppPicture = pPicture; return pPicture; } static Bool miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); GCPtr pGC; ChangeGCVal gcvals; PixmapPtr sourceBits, maskBits; if (pScreenPriv->pCursor == pCursor) return TRUE; if (pCursor->bits->argb) { PixmapPtr pPixmap; PictFormatPtr pFormat; int error; PicturePtr pPicture; pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); if (!pFormat) return FALSE; pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 32, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return FALSE; pGC = GetScratchGC(32, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); return FALSE; } ValidateGC(&pPixmap->drawable, pGC); (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, ZPixmap, (char *) pCursor->bits->argb); FreeScratchGC(pGC); pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0, serverClient, &error); (*pScreen->DestroyPixmap) (pPixmap); if (!pPicture) return FALSE; miDCSwitchScreenCursor(pScreen, pCursor, NULL, NULL, pPicture); return TRUE; } sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!sourceBits) return FALSE; maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!maskBits) { (*pScreen->DestroyPixmap) (sourceBits); return FALSE; } /* create the two sets of bits, clipping as appropriate */ pGC = GetScratchGC(1, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (sourceBits); (*pScreen->DestroyPixmap) (maskBits); return FALSE; } ValidateGC((DrawablePtr) sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr) sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->source); gcvals.val = GXand; ChangeGC(NullClient, pGC, GCFunction, &gcvals); ValidateGC((DrawablePtr) sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr) sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->mask); /* mask bits -- pCursor->mask & ~pCursor->source */ gcvals.val = GXcopy; ChangeGC(NullClient, pGC, GCFunction, &gcvals); ValidateGC((DrawablePtr) maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr) maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->mask); gcvals.val = GXandInverted; ChangeGC(NullClient, pGC, GCFunction, &gcvals); ValidateGC((DrawablePtr) maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr) maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->source); FreeScratchGC(pGC); miDCSwitchScreenCursor(pScreen, pCursor, sourceBits, maskBits, NULL); return TRUE; } Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); if (pCursor == pScreenPriv->pCursor) miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); return TRUE; } static void miDCPutBits(DrawablePtr pDrawable, GCPtr sourceGC, GCPtr maskGC, int x_org, int y_org, unsigned w, unsigned h, unsigned long source, unsigned long mask) { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pDrawable->pScreen->devPrivates, miDCScreenKey); ChangeGCVal gcval; int x, y; if (sourceGC->fgPixel != source) { gcval.val = source; ChangeGC(NullClient, sourceGC, GCForeground, &gcval); } if (sourceGC->serialNumber != pDrawable->serialNumber) ValidateGC(pDrawable, sourceGC); if (sourceGC->miTranslate) { x = pDrawable->x + x_org; y = pDrawable->y + y_org; } else { x = x_org; y = y_org; } (*sourceGC->ops->PushPixels) (sourceGC, pScreenPriv->sourceBits, pDrawable, w, h, x, y); if (maskGC->fgPixel != mask) { gcval.val = mask; ChangeGC(NullClient, maskGC, GCForeground, &gcval); } if (maskGC->serialNumber != pDrawable->serialNumber) ValidateGC(pDrawable, maskGC); if (maskGC->miTranslate) { x = pDrawable->x + x_org; y = pDrawable->y + y_org; } else { x = x_org; y = y_org; } (*maskGC->ops->PushPixels) (maskGC, pScreenPriv->maskBits, pDrawable, w, h, x, y); } static GCPtr miDCMakeGC(WindowPtr pWin) { GCPtr pGC; int status; XID gcvals[2]; gcvals[0] = IncludeInferiors; gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr) pWin, GCSubwindowMode | GCGraphicsExposures, gcvals, &status, (XID) 0, serverClient); return pGC; } Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y, unsigned long source, unsigned long mask) { miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); miDCBufferPtr pBuffer; WindowPtr pWin; if (!miDCRealize(pScreen, pCursor)) return FALSE; pWin = pScreen->root; pBuffer = miGetDCDevice(pDev, pScreen); if (pScreenPriv->pPicture) { if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin)) return FALSE; CompositePicture(PictOpOver, pScreenPriv->pPicture, NULL, pBuffer->pRootPicture, 0, 0, 0, 0, x, y, pCursor->bits->width, pCursor->bits->height); } else { miDCPutBits((DrawablePtr) pWin, pBuffer->pSourceGC, pBuffer->pMaskGC, x, y, pCursor->bits->width, pCursor->bits->height, source, mask); } return TRUE; } Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h) { miDCBufferPtr pBuffer; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pBuffer = miGetDCDevice(pDev, pScreen); pSave = pBuffer->pSave; pWin = pScreen->root; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (pSave) (*pScreen->DestroyPixmap) (pSave); pBuffer->pSave = pSave = (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0); if (!pSave) return FALSE; } pGC = pBuffer->pSaveGC; if (pSave->drawable.serialNumber != pGC->serialNumber) ValidateGC((DrawablePtr) pSave, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y, w, h, 0, 0); return TRUE; } Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h) { miDCBufferPtr pBuffer; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pBuffer = miGetDCDevice(pDev, pScreen); pSave = pBuffer->pSave; pWin = pScreen->root; if (!pSave) return FALSE; pGC = pBuffer->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC((DrawablePtr) pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, 0, w, h, x, y); return TRUE; } Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { miDCBufferPtr pBuffer; WindowPtr pWin; int i; if (!DevHasCursor(pDev)) return TRUE; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; pBuffer = calloc(1, sizeof(miDCBufferRec)); if (!pBuffer) goto failure; dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, pBuffer); pWin = pScreen->root; pBuffer->pSourceGC = miDCMakeGC(pWin); if (!pBuffer->pSourceGC) goto failure; pBuffer->pMaskGC = miDCMakeGC(pWin); if (!pBuffer->pMaskGC) goto failure; pBuffer->pSaveGC = miDCMakeGC(pWin); if (!pBuffer->pSaveGC) goto failure; pBuffer->pRestoreGC = miDCMakeGC(pWin); if (!pBuffer->pRestoreGC) goto failure; pBuffer->pRootPicture = NULL; /* (re)allocated lazily depending on the cursor size */ pBuffer->pSave = NULL; } return TRUE; failure: miDCDeviceCleanup(pDev, pScreen); return FALSE; } void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { miDCBufferPtr pBuffer; int i; if (DevHasCursor(pDev)) { for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; pBuffer = miGetDCDevice(pDev, pScreen); if (pBuffer) { if (pBuffer->pSourceGC) FreeGC(pBuffer->pSourceGC, (GContext) 0); if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0); if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0); if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0); /* If a pRootPicture was allocated for a root window, it * is freed when that root window is destroyed, so don't * free it again here. */ if (pBuffer->pSave) (*pScreen->DestroyPixmap) (pBuffer->pSave); free(pBuffer); dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, NULL); } } } } xorg-server-1.20.8/mi/mifillarc.h0000644000175000017500000001053513640201473013532 00000000000000/************************************************************ Copyright 1989, 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. ********************************************************/ #ifndef __MIFILLARC_H__ #define __MIFILLARC_H__ #define FULLCIRCLE (360 * 64) typedef struct _miFillArc { int xorg, yorg; int y; int dx, dy; int e; int ym, yk, xm, xk; } miFillArcRec; /* could use 64-bit integers */ typedef struct _miFillArcD { int xorg, yorg; int y; int dx, dy; double e; double ym, yk, xm, xk; } miFillArcDRec; #define miFillArcEmpty(arc) (!(arc)->angle2 || \ !(arc)->width || !(arc)->height || \ (((arc)->width == 1) && ((arc)->height & 1))) #define miCanFillArc(arc) (((arc)->width == (arc)->height) || \ (((arc)->width <= 800) && ((arc)->height <= 800))) #define MIFILLARCSETUP() \ x = 0; \ y = info.y; \ e = info.e; \ xk = info.xk; \ xm = info.xm; \ yk = info.yk; \ ym = info.ym; \ dx = info.dx; \ dy = info.dy; \ xorg = info.xorg; \ yorg = info.yorg #define MIFILLARCSTEP(slw) \ e += yk; \ while (e >= 0) \ { \ x++; \ xk -= xm; \ e += xk; \ } \ y--; \ yk -= ym; \ slw = (x << 1) + dx; \ if ((e == xk) && (slw > 1)) \ slw-- #define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw) #define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw) #define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk))) typedef struct _miSliceEdge { int x; int stepx; int deltax; int e; int dy; int dx; } miSliceEdgeRec, *miSliceEdgePtr; typedef struct _miArcSlice { miSliceEdgeRec edge1, edge2; int min_top_y, max_top_y; int min_bot_y, max_bot_y; Bool edge1_top, edge2_top; Bool flip_top, flip_bot; } miArcSliceRec; #define MIARCSLICESTEP(edge) \ edge.x -= edge.stepx; \ edge.e -= edge.dx; \ if (edge.e <= 0) \ { \ edge.x -= edge.deltax; \ edge.e += edge.dy; \ } #define miFillSliceUpper(slice) \ ((y >= slice.min_top_y) && (y <= slice.max_top_y)) #define miFillSliceLower(slice) \ ((y >= slice.min_bot_y) && (y <= slice.max_bot_y)) #define MIARCSLICEUPPER(xl,xr,slice,slw) \ xl = xorg - x; \ xr = xl + slw - 1; \ if (slice.edge1_top && (slice.edge1.x < xr)) \ xr = slice.edge1.x; \ if (slice.edge2_top && (slice.edge2.x > xl)) \ xl = slice.edge2.x; #define MIARCSLICELOWER(xl,xr,slice,slw) \ xl = xorg - x; \ xr = xl + slw - 1; \ if (!slice.edge1_top && (slice.edge1.x > xl)) \ xl = slice.edge1.x; \ if (!slice.edge2_top && (slice.edge2.x < xr)) \ xr = slice.edge2.x; #define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \ x = 0; \ y = slw >> 1; \ yk = y << 3; \ xm = 8; \ ym = 8; \ if (dy) \ { \ xk = 0; \ if (slw & 1) \ e = -1; \ else \ e = -(y << 2) - 2; \ } \ else \ { \ y++; \ yk += 4; \ xk = -4; \ if (slw & 1) \ e = -(y << 2) - 3; \ else \ e = - (y << 3); \ } #define MIFILLINARCSTEP(slw) \ ine += inyk; \ while (ine >= 0) \ { \ inx++; \ inxk -= inxm; \ ine += inxk; \ } \ iny--; \ inyk -= inym; \ slw = (inx << 1) + dx; \ if ((ine == inxk) && (slw > 1)) \ slw-- #define miFillInArcLower(slw) (((iny + dy) != 0) && \ ((slw > 1) || (ine != inxk))) #endif /* __MIFILLARC_H__ */ xorg-server-1.20.8/mi/miscanfill.h0000644000175000017500000001150013640201473013702 00000000000000/* 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SCANFILLINCLUDED #define SCANFILLINCLUDED /* * scanfill.h * * Written by Brian Kelleher; Jan 1985 * * This file contains a few macros to help track * the edge of a filled object. The object is assumed * to be filled in scanline order, and thus the * algorithm used is an extension of Bresenham's line * drawing algorithm which assumes that y is always the * major axis. * Since these pieces of code are the same for any filled shape, * it is more convenient to gather the library in one * place, but since these pieces of code are also in * the inner loops of output primitives, procedure call * overhead is out of the question. * See the author for a derivation if needed. */ /* * In scan converting polygons, we want to choose those pixels * which are inside the polygon. Thus, we add .5 to the starting * x coordinate for both left and right edges. Now we choose the * first pixel which is inside the pgon for the left edge and the * first pixel which is outside the pgon for the right edge. * Draw the left pixel, but not the right. * * How to add .5 to the starting x coordinate: * If the edge is moving to the right, then subtract dy from the * error term from the general form of the algorithm. * If the edge is moving to the left, then add dy to the error term. * * The reason for the difference between edges moving to the left * and edges moving to the right is simple: If an edge is moving * to the right, then we want the algorithm to flip immediately. * If it is moving to the left, then we don't want it to flip until * we traverse an entire pixel. */ #define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ int dx; /* local storage */ \ \ /* \ * if the edge is horizontal, then it is ignored \ * and assumed not to be processed. Otherwise, do this stuff. \ */ \ if ((dy) != 0) { \ xStart = (x1); \ dx = (x2) - xStart; \ if (dx < 0) { \ m = dx / (dy); \ m1 = m - 1; \ incr1 = -2 * dx + 2 * (dy) * m1; \ incr2 = -2 * dx + 2 * (dy) * m; \ d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ } else { \ m = dx / (dy); \ m1 = m + 1; \ incr1 = 2 * dx - 2 * (dy) * m1; \ incr2 = 2 * dx - 2 * (dy) * m; \ d = -2 * m * (dy) + 2 * dx; \ } \ } \ } #define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ if (m1 > 0) { \ if (d > 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } else {\ if (d >= 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } \ } /* * This structure contains all of the information needed * to run the bresenham algorithm. * The variables may be hardcoded into the declarations * instead of using this structure to make use of * register declarations. */ typedef struct { int minor; /* minor axis */ int d; /* decision variable */ int m, m1; /* slope and slope+1 */ int incr1, incr2; /* error increments */ } BRESINFO; #define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ BRESINITPGON(dmaj, min1, min2, bres.minor, bres.d, \ bres.m, bres.m1, bres.incr1, bres.incr2) #define BRESINCRPGONSTRUCT(bres) \ BRESINCRPGON(bres.d, bres.minor, bres.m, bres.m1, bres.incr1, bres.incr2) #endif xorg-server-1.20.8/mi/mipointer.c0000644000175000017500000005712413640201473013576 00000000000000/* Copyright 1989, 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. */ /** * @file * This file contains functions to move the pointer on the screen and/or * restrict its movement. These functions are divided into two sets: * Screen-specific functions that are used as function pointers from other * parts of the server (and end up heavily wrapped by e.g. animcur and * xfixes): * miPointerConstrainCursor * miPointerCursorLimits * miPointerDisplayCursor * miPointerRealizeCursor * miPointerUnrealizeCursor * miPointerSetCursorPosition * miRecolorCursor * miPointerDeviceInitialize * miPointerDeviceCleanup * If wrapped, these are the last element in the wrapping chain. They may * call into sprite-specific code through further function pointers though. * * The second type of functions are those that are directly called by the * DIX, DDX and some drivers. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "windowstr.h" #include "pixmapstr.h" #include "mi.h" #include "scrnintstr.h" #include "mipointrst.h" #include "cursorstr.h" #include "dixstruct.h" #include "inputstr.h" #include "inpututils.h" #include "eventstr.h" typedef struct { ScreenPtr pScreen; /* current screen */ ScreenPtr pSpriteScreen; /* screen containing current sprite */ CursorPtr pCursor; /* current cursor */ CursorPtr pSpriteCursor; /* cursor on screen */ BoxRec limits; /* current constraints */ Bool confined; /* pointer can't change screens */ int x, y; /* hot spot location */ int devx, devy; /* sprite position */ Bool generateEvent; /* generate an event during warping? */ } miPointerRec, *miPointerPtr; DevPrivateKeyRec miPointerScreenKeyRec; #define GetScreenPrivate(s) ((miPointerScreenPtr) \ dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey)) #define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s) DevPrivateKeyRec miPointerPrivKeyRec; #define MIPOINTER(dev) \ (IsFloating(dev) ? \ (miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \ (miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey)) static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static void miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox); static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox); static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent); static Bool miPointerCloseScreen(ScreenPtr pScreen); static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static InternalEvent *mipointermove_events; /* for WarpPointer MotionNotifies */ Bool miPointerInitialize(ScreenPtr pScreen, miPointerSpriteFuncPtr spriteFuncs, miPointerScreenFuncPtr screenFuncs, Bool waitForUpdate) { miPointerScreenPtr pScreenPriv; if (!dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0)) return FALSE; pScreenPriv = malloc(sizeof(miPointerScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->spriteFuncs = spriteFuncs; pScreenPriv->screenFuncs = screenFuncs; pScreenPriv->waitForUpdate = waitForUpdate; pScreenPriv->showTransparent = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miPointerCloseScreen; dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv); /* * set up screen cursor method table */ pScreen->ConstrainCursor = miPointerConstrainCursor; pScreen->CursorLimits = miPointerCursorLimits; pScreen->DisplayCursor = miPointerDisplayCursor; pScreen->RealizeCursor = miPointerRealizeCursor; pScreen->UnrealizeCursor = miPointerUnrealizeCursor; pScreen->SetCursorPosition = miPointerSetCursorPosition; pScreen->RecolorCursor = miRecolorCursor; pScreen->DeviceCursorInitialize = miPointerDeviceInitialize; pScreen->DeviceCursorCleanup = miPointerDeviceCleanup; mipointermove_events = NULL; return TRUE; } /** * Destroy screen-specific information. * * @param index Screen index of the screen in screenInfo.screens[] * @param pScreen The actual screen pointer */ static Bool miPointerCloseScreen(ScreenPtr pScreen) { SetupScreen(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; free((void *) pScreenPriv); FreeEventList(mipointermove_events, GetMaximumEventsNum()); mipointermove_events = NULL; return (*pScreen->CloseScreen) (pScreen); } /* * DIX/DDX interface routines */ static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor); } static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCursor); } static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { miPointerPtr pPointer; /* return for keyboards */ if (!IsPointerDevice(pDev)) return FALSE; pPointer = MIPOINTER(pDev); pPointer->pCursor = pCursor; pPointer->pScreen = pScreen; miPointerUpdateSprite(pDev); return TRUE; } /** * Set up the constraints for the given device. This function does not * actually constrain the cursor but merely copies the given box to the * internal constraint storage. * * @param pDev The device to constrain to the box * @param pBox The rectangle to constrain the cursor to * @param pScreen Used for copying screen confinement */ static void miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox) { miPointerPtr pPointer; pPointer = MIPOINTER(pDev); pPointer->limits = *pBox; pPointer->confined = PointerConfinedToScreen(pDev); } /** * Should calculate the box for the given cursor, based on screen and the * confinement given. But we assume that whatever box is passed in is valid * anyway. * * @param pDev The device to calculate the cursor limits for * @param pScreen The screen the confinement happens on * @param pCursor The screen the confinement happens on * @param pHotBox The confinement box for the cursor * @param[out] pTopLeftBox The new confinement box, always *pHotBox. */ static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox) { *pTopLeftBox = *pHotBox; } /** * Set the device's cursor position to the x/y position on the given screen. * Generates and event if required. * * This function is called from: * - sprite init code to place onto initial position * - the various WarpPointer implementations (core, XI, Xinerama, dmx,…) * - during the cursor update path in CheckMotion * - in the Xinerama part of NewCurrentScreen * - when a RandR/RandR1.2 mode was applied (it may have moved the pointer, so * it's set back to the original pos) * * @param pDev The device to move * @param pScreen The screen the device is on * @param x The x coordinate in per-screen coordinates * @param y The y coordinate in per-screen coordinates * @param generateEvent True if the pointer movement should generate an * event. * * @return TRUE in all cases */ static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) { SetupScreen(pScreen); miPointerPtr pPointer = MIPOINTER(pDev); pPointer->generateEvent = generateEvent; if (pScreen->ConstrainCursorHarder) pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y); /* device dependent - must pend signal and call miPointerWarpCursor */ (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y); if (!generateEvent) miPointerUpdateSprite(pDev); return TRUE; } void miRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs, Bool displayed) { /* * This is guaranteed to correct any color-dependent state which may have * been bound up in private state created by RealizeCursor */ pScr->UnrealizeCursor(pDev, pScr, pCurs); pScr->RealizeCursor(pDev, pScr, pCurs); if (displayed) pScr->DisplayCursor(pDev, pScr, pCurs); } /** * Set up sprite information for the device. * This function will be called once for each device after it is initialized * in the DIX. * * @param pDev The newly created device * @param pScreen The initial sprite scree. */ static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { miPointerPtr pPointer; SetupScreen(pScreen); pPointer = malloc(sizeof(miPointerRec)); if (!pPointer) return FALSE; pPointer->pScreen = NULL; pPointer->pSpriteScreen = NULL; pPointer->pCursor = NULL; pPointer->pSpriteCursor = NULL; pPointer->limits.x1 = 0; pPointer->limits.x2 = 32767; pPointer->limits.y1 = 0; pPointer->limits.y2 = 32767; pPointer->confined = FALSE; pPointer->x = 0; pPointer->y = 0; pPointer->generateEvent = FALSE; if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize) (pDev, pScreen))) { free(pPointer); return FALSE; } dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, pPointer); return TRUE; } /** * Clean up after device. * This function will be called once before the device is freed in the DIX * * @param pDev The device to be removed from the server * @param pScreen Current screen of the device */ static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { SetupScreen(pScreen); if (!IsMaster(pDev) && !IsFloating(pDev)) return; (*pScreenPriv->spriteFuncs->DeviceCursorCleanup) (pDev, pScreen); free(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey)); dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL); } /** * Warp the pointer to the given position on the given screen. May generate * an event, depending on whether we're coming from miPointerSetPosition. * * Once signals are ignored, the WarpCursor function can call this * * @param pDev The device to warp * @param pScreen Screen to warp on * @param x The x coordinate in per-screen coordinates * @param y The y coordinate in per-screen coordinates */ void miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { miPointerPtr pPointer; BOOL changedScreen = FALSE; pPointer = MIPOINTER(pDev); if (pPointer->pScreen != pScreen) { mieqSwitchScreen(pDev, pScreen, TRUE); changedScreen = TRUE; } if (pPointer->generateEvent) miPointerMove(pDev, pScreen, x, y); else miPointerMoveNoEvent(pDev, pScreen, x, y); /* Don't call USFS if we use Xinerama, otherwise the root window is * updated to the second screen, and we never receive any events. * (FDO bug #18668) */ if (changedScreen #ifdef PANORAMIX && noPanoramiXExtension #endif ) UpdateSpriteForScreen(pDev, pScreen); } /** * Syncronize the sprite with the cursor. * * @param pDev The device to sync */ void miPointerUpdateSprite(DeviceIntPtr pDev) { ScreenPtr pScreen; miPointerScreenPtr pScreenPriv; CursorPtr pCursor; int x, y, devx, devy; miPointerPtr pPointer; if (!pDev || !pDev->coreEvents) return; pPointer = MIPOINTER(pDev); if (!pPointer) return; pScreen = pPointer->pScreen; if (!pScreen) return; x = pPointer->x; y = pPointer->y; devx = pPointer->devx; devy = pPointer->devy; pScreenPriv = GetScreenPrivate(pScreen); /* * if the cursor has switched screens, disable the sprite * on the old screen */ if (pScreen != pPointer->pSpriteScreen) { if (pPointer->pSpriteScreen) { miPointerScreenPtr pOldPriv; pOldPriv = GetScreenPrivate(pPointer->pSpriteScreen); if (pPointer->pCursor) { (*pOldPriv->spriteFuncs->SetCursor) (pDev, pPointer->pSpriteScreen, NullCursor, 0, 0); } (*pOldPriv->screenFuncs->CrossScreen) (pPointer->pSpriteScreen, FALSE); } (*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE); (*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pPointer->pCursor, x, y); pPointer->devx = x; pPointer->devy = y; pPointer->pSpriteCursor = pPointer->pCursor; pPointer->pSpriteScreen = pScreen; } /* * if the cursor has changed, display the new one */ else if (pPointer->pCursor != pPointer->pSpriteCursor) { pCursor = pPointer->pCursor; if (!pCursor || (pCursor->bits->emptyMask && !pScreenPriv->showTransparent)) pCursor = NullCursor; (*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCursor, x, y); pPointer->devx = x; pPointer->devy = y; pPointer->pSpriteCursor = pPointer->pCursor; } else if (x != devx || y != devy) { pPointer->devx = x; pPointer->devy = y; if (pPointer->pCursor && !pPointer->pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); } } /** * Invalidate the current sprite and force it to be reloaded on next cursor setting * operation * * @param pDev The device to invalidate the sprite fore */ void miPointerInvalidateSprite(DeviceIntPtr pDev) { miPointerPtr pPointer; pPointer = MIPOINTER(pDev); pPointer->pSpriteCursor = (CursorPtr) 1; } /** * Set the device to the coordinates on the given screen. * * @param pDev The device to move * @param screen_no Index of the screen to move to * @param x The x coordinate in per-screen coordinates * @param y The y coordinate in per-screen coordinates */ void miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y) { ScreenPtr pScreen; miPointerPtr pPointer; pPointer = MIPOINTER(pDev); pScreen = screenInfo.screens[screen_no]; mieqSwitchScreen(pDev, pScreen, FALSE); NewCurrentScreen(pDev, pScreen, x, y); pPointer->limits.x2 = pScreen->width; pPointer->limits.y2 = pScreen->height; } /** * @return The current screen of the given device or NULL. */ ScreenPtr miPointerGetScreen(DeviceIntPtr pDev) { miPointerPtr pPointer = MIPOINTER(pDev); return (pPointer) ? pPointer->pScreen : NULL; } /* Controls whether the cursor image should be updated immediately when moved (FALSE) or if something else will be responsible for updating it later (TRUE). Returns current setting. Caller is responsible for calling OsBlockSignal first. */ Bool miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait) { SetupScreen(pScreen); Bool prevWait = pScreenPriv->waitForUpdate; pScreenPriv->waitForUpdate = wait; return prevWait; } /* Move the pointer on the current screen, and update the sprite. */ static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { miPointerPtr pPointer; SetupScreen(pScreen); pPointer = MIPOINTER(pDev); /* Hack: We mustn't call into ->MoveCursor for anything but the * VCP, as this may cause a non-HW rendered cursor to be rendered while * not holding the input lock. This would race with building the command * buffer for other rendering. */ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer &&!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) { pPointer->devx = x; pPointer->devy = y; if (pPointer->pCursor && !pPointer->pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); } pPointer->x = x; pPointer->y = y; pPointer->pScreen = pScreen; } /** * Set the devices' cursor position to the given x/y position. * * This function is called during the pointer update path in * GetPointerEvents and friends (and the same in the xwin DDX). * * The coordinates provided are always absolute. The parameter mode whether * it was relative or absolute movement that landed us at those coordinates. * * If the cursor was constrained by a barrier, ET_Barrier* events may be * generated and appended to the InternalEvent list provided. * * @param pDev The device to move * @param mode Movement mode (Absolute or Relative) * @param[in,out] screenx The x coordinate in desktop coordinates * @param[in,out] screeny The y coordinate in desktop coordinates * @param[in,out] nevents The number of events in events (before/after) * @param[in,out] events The list of events before/after being constrained */ ScreenPtr miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *screeny, int *nevents, InternalEvent* events) { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; ScreenPtr newScreen; int x, y; Bool switch_screen = FALSE; Bool should_constrain_barriers = FALSE; int i; miPointerPtr pPointer; pPointer = MIPOINTER(pDev); pScreen = pPointer->pScreen; x = trunc(*screenx); y = trunc(*screeny); switch_screen = !point_on_screen(pScreen, x, y); /* Switch to per-screen coordinates for CursorOffScreen and * Pointer->limits */ x -= pScreen->x; y -= pScreen->y; should_constrain_barriers = (mode == Relative); if (should_constrain_barriers) { /* coordinates after clamped to a barrier */ int constrained_x, constrained_y; int current_x, current_y; /* current position in per-screen coord */ current_x = MIPOINTER(pDev)->x - pScreen->x; current_y = MIPOINTER(pDev)->y - pScreen->y; input_constrain_cursor(pDev, pScreen, current_x, current_y, x, y, &constrained_x, &constrained_y, nevents, events); x = constrained_x; y = constrained_y; } if (switch_screen) { pScreenPriv = GetScreenPrivate(pScreen); if (!pPointer->confined) { newScreen = pScreen; (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y); if (newScreen != pScreen) { pScreen = newScreen; mieqSwitchScreen(pDev, pScreen, FALSE); /* Smash the confine to the new screen */ pPointer->limits.x2 = pScreen->width; pPointer->limits.y2 = pScreen->height; } } } /* Constrain the sprite to the current limits. */ if (x < pPointer->limits.x1) x = pPointer->limits.x1; if (x >= pPointer->limits.x2) x = pPointer->limits.x2 - 1; if (y < pPointer->limits.y1) y = pPointer->limits.y1; if (y >= pPointer->limits.y2) y = pPointer->limits.y2 - 1; if (pScreen->ConstrainCursorHarder) pScreen->ConstrainCursorHarder(pDev, pScreen, mode, &x, &y); if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen) miPointerMoveNoEvent(pDev, pScreen, x, y); /* check if we generated any barrier events and if so, update root x/y * to the fully constrained coords */ if (should_constrain_barriers) { for (i = 0; i < *nevents; i++) { if (events[i].any.type == ET_BarrierHit || events[i].any.type == ET_BarrierLeave) { events[i].barrier_event.root_x = x; events[i].barrier_event.root_y = y; } } } /* Convert to desktop coordinates again */ x += pScreen->x; y += pScreen->y; /* In the event we actually change screen or we get confined, we just * drop the float component on the floor * FIXME: only drop remainder for ConstrainCursorHarder, not for screen * crossings */ if (x != trunc(*screenx)) *screenx = x; if (y != trunc(*screeny)) *screeny = y; return pScreen; } /** * Get the current position of the device in desktop coordinates. * * @param x Return value for the current x coordinate in desktop coordiates. * @param y Return value for the current y coordinate in desktop coordiates. */ void miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y) { *x = MIPOINTER(pDev)->x; *y = MIPOINTER(pDev)->y; } /** * Move the device's pointer to the x/y coordinates on the given screen. * This function generates and enqueues pointer events. * * @param pDev The device to move * @param pScreen The screen the device is on * @param x The x coordinate in per-screen coordinates * @param y The y coordinate in per-screen coordinates */ void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { int i, nevents; int valuators[2]; ValuatorMask mask; miPointerMoveNoEvent(pDev, pScreen, x, y); /* generate motion notify */ valuators[0] = x; valuators[1] = y; if (!mipointermove_events) { mipointermove_events = InitEventList(GetMaximumEventsNum()); if (!mipointermove_events) { FatalError("Could not allocate event store.\n"); return; } } valuator_mask_set_range(&mask, 0, 2, valuators); nevents = GetPointerEvents(mipointermove_events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE | POINTER_NORAW, &mask); input_lock(); for (i = 0; i < nevents; i++) mieqEnqueue(pDev, &mipointermove_events[i]); input_unlock(); } xorg-server-1.20.8/mi/micoord.h0000644000175000017500000000404213640201473013220 00000000000000/* * Copyright (C) 2000 The XFree86 Project, 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 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 * XFREE86 PROJECT 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 XFree86 Project 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 * XFree86 Project. * */ #ifndef _MICOORD_H_ #define _MICOORD_H_ 1 #include "servermd.h" /* Macros which handle a coordinate in a single register */ #define GetHighWord(x) (((int) (x)) >> 16) #if IMAGE_BYTE_ORDER == MSBFirst #define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i)))) #define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff)) #define intToX(i) (GetHighWord(i)) #define intToY(i) ((int) ((short) i)) #else #define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i))) #define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff)) #define intToX(i) ((int) ((short) (i))) #define intToY(i) (GetHighWord(i)) #endif #endif /* _MICOORD_H_ */ xorg-server-1.20.8/mi/miglblt.c0000644000175000017500000002037513640201473013220 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include #include #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmap.h" #include "servermd.h" #include "mi.h" /* machine-independent glyph blt. assumes that glyph bits in snf are written in bytes, have same bit order as the server's bitmap format, and are byte padded. this corresponds to the snf distributed with the sample server. get a scratch GC. in the scratch GC set alu = GXcopy, fg = 1, bg = 0 allocate a bitmap big enough to hold the largest glyph in the font validate the scratch gc with the bitmap for each glyph carefully put the bits of the glyph in a buffer, padded to the server pixmap scanline padding rules fake a call to PutImage from the buffer into the bitmap use the bitmap in a call to PushPixels */ void miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ void *pglyphBase /* start of array of glyphs */ ) { int width, height; PixmapPtr pPixmap; int nbyLine; /* bytes per line of padded pixmap */ FontPtr pfont; GCPtr pGCtmp; int i; int j; unsigned char *pbits; /* buffer for PutImage */ unsigned char *pb; /* temp pointer into buffer */ CharInfoPtr pci; /* currect char info */ unsigned char *pglyph; /* pointer bits in glyph */ int gWidth, gHeight; /* width and height of glyph */ int nbyGlyphWidth; /* bytes per scanline of glyph */ int nbyPadGlyph; /* server padded line of glyph */ ChangeGCVal gcvals[3]; if (pGC->miTranslate) { x += pDrawable->x; y += pDrawable->y; } pfont = pGC->font; width = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, leftSideBearing); height = FONTMAXBOUNDS(pfont, ascent) + FONTMAXBOUNDS(pfont, descent); pPixmap = (*pDrawable->pScreen->CreatePixmap) (pDrawable->pScreen, width, height, 1, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; pGCtmp = GetScratchGC(1, pDrawable->pScreen); if (!pGCtmp) { (*pDrawable->pScreen->DestroyPixmap) (pPixmap); return; } gcvals[0].val = GXcopy; gcvals[1].val = 1; gcvals[2].val = 0; ChangeGC(NullClient, pGCtmp, GCFunction | GCForeground | GCBackground, gcvals); nbyLine = BitmapBytePad(width); pbits = xallocarray(height, nbyLine); if (!pbits) { (*pDrawable->pScreen->DestroyPixmap) (pPixmap); FreeScratchGC(pGCtmp); return; } while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci); nbyPadGlyph = BitmapBytePad(gWidth); if (nbyGlyphWidth == nbyPadGlyph #if GLYPHPADBYTES != 4 && (((int) pglyph) & 3) == 0 #endif ) { pb = pglyph; } else { for (i = 0, pb = pbits; i < gHeight; i++, pb = pbits + (i * nbyPadGlyph)) for (j = 0; j < nbyGlyphWidth; j++) *pb++ = *pglyph++; pb = pbits; } if ((pGCtmp->serialNumber) != (pPixmap->drawable.serialNumber)) ValidateGC((DrawablePtr) pPixmap, pGCtmp); (*pGCtmp->ops->PutImage) ((DrawablePtr) pPixmap, pGCtmp, pPixmap->drawable.depth, 0, 0, gWidth, gHeight, 0, XYBitmap, (char *) pb); (*pGC->ops->PushPixels) (pGC, pPixmap, pDrawable, gWidth, gHeight, x + pci->metrics.leftSideBearing, y - pci->metrics.ascent); } x += pci->metrics.characterWidth; } (*pDrawable->pScreen->DestroyPixmap) (pPixmap); free(pbits); FreeScratchGC(pGCtmp); } void miImageGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ void *pglyphBase /* start of array of glyphs */ ) { ExtentInfoRec info; /* used by xfont2_query_glyph_extents() */ ChangeGCVal gcvals[3]; int oldAlu, oldFS; unsigned long oldFG; xRectangle backrect; xfont2_query_glyph_extents(pGC->font, ppci, (unsigned long) nglyph, &info); if (info.overallWidth >= 0) { backrect.x = x; backrect.width = info.overallWidth; } else { backrect.x = x + info.overallWidth; backrect.width = -info.overallWidth; } backrect.y = y - FONTASCENT(pGC->font); backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); oldAlu = pGC->alu; oldFG = pGC->fgPixel; oldFS = pGC->fillStyle; /* fill in the background */ gcvals[0].val = GXcopy; gcvals[1].val = pGC->bgPixel; gcvals[2].val = FillSolid; ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFillStyle, gcvals); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect); /* put down the glyphs */ gcvals[0].val = oldFG; ChangeGC(NullClient, pGC, GCForeground, gcvals); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); /* put all the toys away when done playing */ gcvals[0].val = oldAlu; gcvals[1].val = oldFG; gcvals[2].val = oldFS; ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFillStyle, gcvals); ValidateGC(pDrawable, pGC); } xorg-server-1.20.8/mi/mioverlay.h0000644000175000017500000000156413640201473013601 00000000000000 #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef __MIOVERLAY_H #define __MIOVERLAY_H typedef void (*miOverlayTransFunc) (ScreenPtr, int, BoxPtr); typedef Bool (*miOverlayInOverlayFunc) (WindowPtr); extern _X_EXPORT Bool miInitOverlay(ScreenPtr pScreen, miOverlayInOverlayFunc inOverlay, miOverlayTransFunc trans); extern _X_EXPORT Bool miOverlayGetPrivateClips(WindowPtr pWin, RegionPtr *borderClip, RegionPtr *clipList); extern _X_EXPORT Bool miOverlayCollectUnderlayRegions(WindowPtr, RegionPtr *); extern _X_EXPORT void miOverlayComputeCompositeClip(GCPtr, WindowPtr); extern _X_EXPORT Bool miOverlayCopyUnderlay(ScreenPtr); extern _X_EXPORT void miOverlaySetTransFunction(ScreenPtr, miOverlayTransFunc); extern _X_EXPORT void miOverlaySetRootClip(ScreenPtr, Bool); #endif /* __MIOVERLAY_H */ xorg-server-1.20.8/mi/miscrinit.c0000644000175000017500000002430113640201473013560 00000000000000/* Copyright 1990, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "servermd.h" #include "misc.h" #include "mi.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "dix.h" #include "miline.h" #ifdef MITSHM #include #include "shmint.h" #endif /* We use this structure to propogate some information from miScreenInit to * miCreateScreenResources. miScreenInit allocates the structure, fills it * in, and puts it into pScreen->devPrivate. miCreateScreenResources * extracts the info and frees the structure. We could've accomplished the * same thing by adding fields to the screen structure, but they would have * ended up being redundant, and would have exposed this mi implementation * detail to the whole server. */ typedef struct { void *pbits; /* pointer to framebuffer */ int width; /* delta to add to a framebuffer addr to move one row down */ } miScreenInitParmsRec, *miScreenInitParmsPtr; /* this plugs into pScreen->ModifyPixmapHeader */ Bool miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData) { if (!pPixmap) return FALSE; /* * If all arguments are specified, reinitialize everything (including * validated state). */ if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) && (devKind > 0) && pPixData) { pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = bitsPerPixel; pPixmap->drawable.id = 0; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = devKind; pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = pPixData; } else { /* * Only modify specified fields, keeping all others intact. */ if (width > 0) pPixmap->drawable.width = width; if (height > 0) pPixmap->drawable.height = height; if (depth > 0) pPixmap->drawable.depth = depth; if (bitsPerPixel > 0) pPixmap->drawable.bitsPerPixel = bitsPerPixel; else if ((bitsPerPixel < 0) && (depth > 0)) pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth); /* * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for * other purposes. */ if (devKind > 0) pPixmap->devKind = devKind; else if ((devKind < 0) && ((width > 0) || (depth > 0))) pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width, pPixmap->drawable.depth); if (pPixData) pPixmap->devPrivate.ptr = pPixData; } pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; return TRUE; } static Bool miCloseScreen(ScreenPtr pScreen) { return ((*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate)); } void miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int subWindowMode) { } /* With the introduction of pixmap privates, the "screen pixmap" can no * longer be created in miScreenInit, since all the modules that could * possibly ask for pixmap private space have not been initialized at * that time. pScreen->CreateScreenResources is called after all * possible private-requesting modules have been inited; we create the * screen pixmap here. */ Bool miCreateScreenResources(ScreenPtr pScreen) { miScreenInitParmsPtr pScrInitParms; void *value; pScrInitParms = (miScreenInitParmsPtr) pScreen->devPrivate; /* if width is non-zero, pScreen->devPrivate will be a pixmap * else it will just take the value pbits */ if (pScrInitParms->width) { PixmapPtr pPixmap; /* create a pixmap with no data, then redirect it to point to * the screen */ pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width, pScreen->height, pScreen->rootDepth, BitsPerPixel(pScreen->rootDepth), PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), pScrInitParms->pbits)) return FALSE; value = (void *) pPixmap; } else { value = pScrInitParms->pbits; } free(pScreen->devPrivate); /* freeing miScreenInitParmsRec */ pScreen->devPrivate = value; /* pPixmap or pbits */ return TRUE; } Bool miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits) { miScreenInitParmsPtr pScrInitParms; /* Stash pbits and width in a short-lived miScreenInitParmsRec attached * to the screen, until CreateScreenResources can put them in the * screen pixmap. */ pScrInitParms = malloc(sizeof(miScreenInitParmsRec)); if (!pScrInitParms) return FALSE; pScrInitParms->pbits = pbits; pScrInitParms->width = width; pScreen->devPrivate = (void *) pScrInitParms; return TRUE; } static PixmapPtr miGetScreenPixmap(ScreenPtr pScreen) { return (PixmapPtr) (pScreen->devPrivate); } static void miSetScreenPixmap(PixmapPtr pPix) { if (pPix) pPix->drawable.pScreen->devPrivate = (void *) pPix; } Bool miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */ int xsize, int ysize, /* in pixels */ int dpix, int dpiy, /* dots per inch */ int width, /* pixel width of frame buffer */ int rootDepth, /* depth of root window */ int numDepths, /* number of depths supported */ DepthRec * depths, /* supported depths */ VisualID rootVisual, /* root visual */ int numVisuals, /* number of visuals supported */ VisualRec * visuals /* supported visuals */ ) { pScreen->width = xsize; pScreen->height = ysize; pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); pScreen->numDepths = numDepths; pScreen->rootDepth = rootDepth; pScreen->allowedDepths = depths; pScreen->rootVisual = rootVisual; /* defColormap */ pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 1; pScreen->backingStoreSupport = NotUseful; pScreen->saveUnderSupport = NotUseful; /* whitePixel, blackPixel */ pScreen->ModifyPixmapHeader = miModifyPixmapHeader; pScreen->CreateScreenResources = miCreateScreenResources; pScreen->GetScreenPixmap = miGetScreenPixmap; pScreen->SetScreenPixmap = miSetScreenPixmap; pScreen->numVisuals = numVisuals; pScreen->visuals = visuals; if (width) { #ifdef MITSHM ShmRegisterFbFuncs(pScreen); #endif pScreen->CloseScreen = miCloseScreen; } /* else CloseScreen */ /* QueryBestSize, SaveScreen, GetImage, GetSpans */ pScreen->SourceValidate = miSourceValidate; /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* RealizeWindow, UnrealizeWindow */ pScreen->ValidateTree = miValidateTree; pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; pScreen->WindowExposures = miWindowExposures; /* CopyWindow */ pScreen->ClearToBackground = miClearToBackground; pScreen->ClipNotify = (ClipNotifyProcPtr) 0; pScreen->RestackWindow = (RestackWindowProcPtr) 0; pScreen->PaintWindow = miPaintWindow; /* CreatePixmap, DestroyPixmap */ /* RealizeFont, UnrealizeFont */ /* CreateGC */ /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */ /* ListInstalledColormaps, StoreColors, ResolveColor */ /* BitmapToRegion */ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; pScreen->MarkWindow = miMarkWindow; pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; pScreen->MoveWindow = miMoveWindow; pScreen->ResizeWindow = miResizeWindow; pScreen->GetLayerWindow = miGetLayerWindow; pScreen->HandleExposures = miHandleValidateExposures; pScreen->ReparentWindow = (ReparentWindowProcPtr) 0; pScreen->ChangeBorderWidth = miChangeBorderWidth; pScreen->SetShape = miSetShape; pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; pScreen->XYToWindow = miXYToWindow; miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); return miScreenDevPrivateInit(pScreen, width, pbits); } DevPrivateKeyRec miZeroLineScreenKeyRec; void miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias) { if (!dixRegisterPrivateKey(&miZeroLineScreenKeyRec, PRIVATE_SCREEN, 0)) return; dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, (unsigned long *) (unsigned long) bias); } xorg-server-1.20.8/mi/mivaltree.c0000644000175000017500000006316513640201473013562 00000000000000/* * mivaltree.c -- * Functions for recalculating window clip lists. Main function * is miValidateTree. * Copyright 1987, 1988, 1989, 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, 1988, 1989 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. * ******************************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. 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. 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 DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * Aug '86: Susan Angebranndt -- original code * July '87: Adam de Boor -- substantially modified and commented * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible. * In particular, much improved code for window mapping and * circulating. * Bob Scheifler -- avoid miComputeClips for unmapped windows, * valdata changes */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "scrnintstr.h" #include "validate.h" #include "windowstr.h" #include "mi.h" #include "regionstr.h" #include "mivalidate.h" #include "globals.h" #ifdef COMPOSITE #include "compint.h" #endif /* * Compute the visibility of a shaped window */ int miShapedWindowIn(RegionPtr universe, RegionPtr bounding, BoxPtr rect, int x, int y) { BoxRec box; BoxPtr boundBox; int nbox; Bool someIn, someOut; int t, x1, y1, x2, y2; nbox = RegionNumRects(bounding); boundBox = RegionRects(bounding); someIn = someOut = FALSE; x1 = rect->x1; y1 = rect->y1; x2 = rect->x2; y2 = rect->y2; while (nbox--) { if ((t = boundBox->x1 + x) < x1) t = x1; box.x1 = t; if ((t = boundBox->y1 + y) < y1) t = y1; box.y1 = t; if ((t = boundBox->x2 + x) > x2) t = x2; box.x2 = t; if ((t = boundBox->y2 + y) > y2) t = y2; box.y2 = t; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; switch (RegionContainsRect(universe, &box)) { case rgnIN: if (someOut) return rgnPART; someIn = TRUE; break; case rgnOUT: if (someIn) return rgnPART; someOut = TRUE; break; default: return rgnPART; } boundBox++; } if (someIn) return rgnIN; return rgnOUT; } /* * Manual redirected windows are treated as transparent; they do not obscure * siblings or parent windows */ #ifdef COMPOSITE #define TreatAsTransparent(w) ((w)->redirectDraw == RedirectDrawManual) #else #define TreatAsTransparent(w) FALSE #endif #define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ HasBorder(w) && \ (w)->backgroundState == ParentRelative) /* *----------------------------------------------------------------------- * miComputeClips -- * Recompute the clipList, borderClip, exposed and borderExposed * regions for pParent and its children. Only viewable windows are * taken into account. * * Results: * None. * * Side Effects: * clipList, borderClip, exposed and borderExposed are altered. * A VisibilityNotify event may be generated on the parent window. * *----------------------------------------------------------------------- */ static void miComputeClips(WindowPtr pParent, ScreenPtr pScreen, RegionPtr universe, VTKind kind, RegionPtr exposed) { /* for intermediate calculations */ int dx, dy; RegionRec childUniverse; WindowPtr pChild; int oldVis, newVis; BoxRec borderSize; RegionRec childUnion; Bool overlap; RegionPtr borderVisible; /* * Figure out the new visibility of this window. * The extent of the universe should be the same as the extent of * the borderSize region. If the window is unobscured, this rectangle * will be completely inside the universe (the universe will cover it * completely). If the window is completely obscured, none of the * universe will cover the rectangle. */ borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); if (dx > 32767) dx = 32767; borderSize.x2 = dx; dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); if (dy > 32767) dy = 32767; borderSize.y2 = dy; #ifdef COMPOSITE /* * In redirected drawing case, reset universe to borderSize */ if (pParent->redirectDraw != RedirectDrawNone) { if (TreatAsTransparent(pParent)) RegionEmpty(universe); compSetRedirectBorderClip (pParent, universe); RegionCopy(universe, &pParent->borderSize); } #endif oldVis = pParent->visibility; switch (RegionContainsRect(universe, &borderSize)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnPART: newVis = VisibilityPartiallyObscured; { RegionPtr pBounding; if ((pBounding = wBoundingShape(pParent))) { switch (miShapedWindowIn(universe, pBounding, &borderSize, pParent->drawable.x, pParent->drawable.y)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnOUT: newVis = VisibilityFullyObscured; break; } } } break; default: newVis = VisibilityFullyObscured; break; } pParent->visibility = newVis; if (oldVis != newVis && ((pParent-> eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask)) SendVisibilityNotify(pParent); dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x; dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y; /* * avoid computations when dealing with simple operations */ switch (kind) { case VTMap: case VTStack: case VTUnmap: break; case VTMove: if ((oldVis == newVis) && ((oldVis == VisibilityFullyObscured) || (oldVis == VisibilityUnobscured))) { pChild = pParent; while (1) { if (pChild->viewable) { if (pChild->visibility != VisibilityFullyObscured) { RegionTranslate(&pChild->borderClip, dx, dy); RegionTranslate(&pChild->clipList, dx, dy); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pChild, dx, dy); } if (pChild->valdata) { RegionNull(&pChild->valdata->after.borderExposed); if (HasParentRelativeBorder(pChild)) { RegionSubtract(&pChild->valdata->after. borderExposed, &pChild->borderClip, &pChild->winSize); } RegionNull(&pChild->valdata->after.exposed); } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } return; } /* fall through */ default: /* * To calculate exposures correctly, we have to translate the old * borderClip and clipList regions to the window's new location so there * is a correspondence between pieces of the new and old clipping regions. */ if (dx || dy) { /* * We translate the old clipList because that will be exposed or copied * if gravity is right. */ RegionTranslate(&pParent->borderClip, dx, dy); RegionTranslate(&pParent->clipList, dx, dy); } break; case VTBroken: RegionEmpty(&pParent->borderClip); RegionEmpty(&pParent->clipList); break; } borderVisible = pParent->valdata->before.borderVisible; RegionNull(&pParent->valdata->after.borderExposed); RegionNull(&pParent->valdata->after.exposed); /* * Since the borderClip must not be clipped by the children, we do * the border exposure first... * * 'universe' is the window's borderClip. To figure the exposures, remove * the area that used to be exposed from the new. * This leaves a region of pieces that weren't exposed before. */ if (HasBorder(pParent)) { if (borderVisible) { /* * when the border changes shape, the old visible portions * of the border will be saved by DIX in borderVisible -- * use that region and destroy it */ RegionSubtract(exposed, universe, borderVisible); RegionDestroy(borderVisible); } else { RegionSubtract(exposed, universe, &pParent->borderClip); } if (HasParentRelativeBorder(pParent) && (dx || dy)) RegionSubtract(&pParent->valdata->after.borderExposed, universe, &pParent->winSize); else RegionSubtract(&pParent->valdata->after.borderExposed, exposed, &pParent->winSize); RegionCopy(&pParent->borderClip, universe); /* * To get the right clipList for the parent, and to make doubly sure * that no child overlaps the parent's border, we remove the parent's * border from the universe before proceeding. */ RegionIntersect(universe, universe, &pParent->winSize); } else RegionCopy(&pParent->borderClip, universe); if ((pChild = pParent->firstChild) && pParent->mapped) { RegionNull(&childUniverse); RegionNull(&childUnion); if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable && !TreatAsTransparent(pChild)) RegionAppend(&childUnion, &pChild->borderSize); } } else { for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) { if (pChild->viewable && !TreatAsTransparent(pChild)) RegionAppend(&childUnion, &pChild->borderSize); } } RegionValidate(&childUnion, &overlap); for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * If the child is viewable, we want to remove its extents * from the current universe, but we only re-clip it if * it's been marked. */ if (pChild->valdata) { /* * Figure out the new universe from the child's * perspective and recurse. */ RegionIntersect(&childUniverse, universe, &pChild->borderSize); miComputeClips(pChild, pScreen, &childUniverse, kind, exposed); } /* * Once the child has been processed, we remove its extents * from the current universe, thus denying its space to any * other sibling. */ if (overlap && !TreatAsTransparent(pChild)) RegionSubtract(universe, universe, &pChild->borderSize); } } if (!overlap) RegionSubtract(universe, universe, &childUnion); RegionUninit(&childUnion); RegionUninit(&childUniverse); } /* if any children */ /* * 'universe' now contains the new clipList for the parent window. * * To figure the exposure of the window we subtract the old clip from the * new, just as for the border. */ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { RegionCopy(&pParent->valdata->after.exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { RegionSubtract(&pParent->valdata->after.exposed, universe, &pParent->clipList); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = pParent->clipList; pParent->clipList = *universe; *universe = tmp; } #ifdef NOTDEF RegionCopy(&pParent->clipList, universe); #endif pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pParent, dx, dy); } static void miTreeObscured(WindowPtr pParent) { WindowPtr pChild; int oldVis; pChild = pParent; while (1) { if (pChild->viewable) { oldVis = pChild->visibility; if (oldVis != (pChild->visibility = VisibilityFullyObscured) && ((pChild-> eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask)) SendVisibilityNotify(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } } static RegionPtr getBorderClip(WindowPtr pWin) { #ifdef COMPOSITE if (pWin->redirectDraw != RedirectDrawNone) return compGetRedirectBorderClip(pWin); else #endif return &pWin->borderClip; } /* *----------------------------------------------------------------------- * miValidateTree -- * Recomputes the clip list for pParent and all its inferiors. * * Results: * Always returns 1. * * Side Effects: * The clipList, borderClip, exposed, and borderExposed regions for * each marked window are altered. * * Notes: * This routine assumes that all affected windows have been marked * (valdata created) and their winSize and borderSize regions * adjusted to correspond to their new positions. The borderClip and * clipList regions should not have been touched. * * The top-most level is treated differently from all lower levels * because pParent is unchanged. For the top level, we merge the * regions taken up by the marked children back into the clipList * for pParent, thus forming a region from which the marked children * can claim their areas. For lower levels, where the old clipList * and borderClip are invalid, we can't do this and have to do the * extra operations done in miComputeClips, but this is much faster * e.g. when only one child has moved... * *----------------------------------------------------------------------- */ /*ARGSUSED*/ int miValidateTree(WindowPtr pParent, /* Parent to validate */ WindowPtr pChild, /* First child of pParent that was * affected */ VTKind kind /* What kind of configuration caused call */ ) { RegionRec totalClip; /* Total clipping region available to * the marked children. pParent's clipList * merged with the borderClips of all * the marked children. */ RegionRec childClip; /* The new borderClip for the current * child */ RegionRec childUnion; /* the space covered by borderSize for * all marked children */ RegionRec exposed; /* For intermediate calculations */ ScreenPtr pScreen; WindowPtr pWin; Bool overlap; int viewvals; Bool forward; pScreen = pParent->drawable.pScreen; if (pChild == NullWindow) pChild = pParent->firstChild; RegionNull(&childClip); RegionNull(&exposed); /* * compute the area of the parent window occupied * by the marked children + the parent itself. This * is the area which can be divied up among the marked * children in their new configuration. */ RegionNull(&totalClip); viewvals = 0; if (RegionBroken(&pParent->clipList) && !RegionBroken(&pParent->borderClip)) { kind = VTBroken; /* * When rebuilding clip lists after out of memory, * assume everything is busted. */ forward = TRUE; RegionCopy(&totalClip, &pParent->borderClip); RegionIntersect(&totalClip, &totalClip, &pParent->winSize); for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib) { if (pWin->viewable && !TreatAsTransparent(pWin)) RegionSubtract(&totalClip, &totalClip, &pWin->borderSize); } for (pWin = pChild; pWin; pWin = pWin->nextSib) if (pWin->valdata && pWin->viewable) viewvals++; RegionEmpty(&pParent->clipList); } else { if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { forward = TRUE; for (pWin = pChild; pWin; pWin = pWin->nextSib) { if (pWin->valdata) { RegionAppend(&totalClip, getBorderClip(pWin)); if (pWin->viewable) viewvals++; } } } else { forward = FALSE; pWin = pParent->lastChild; while (1) { if (pWin->valdata) { RegionAppend(&totalClip, getBorderClip(pWin)); if (pWin->viewable) viewvals++; } if (pWin == pChild) break; pWin = pWin->prevSib; } } RegionValidate(&totalClip, &overlap); } /* * Now go through the children of the root and figure their new * borderClips from the totalClip, passing that off to miComputeClips * to handle recursively. Once that's done, we remove the child * from the totalClip to clip any siblings below it. */ overlap = TRUE; if (kind != VTStack) { RegionUnion(&totalClip, &totalClip, &pParent->clipList); if (viewvals > 1) { /* * precompute childUnion to discover whether any of them * overlap. This seems redundant, but performance studies * have demonstrated that the cost of this loop is * lower than the cost of multiple Subtracts in the * loop below. */ RegionNull(&childUnion); if (forward) { for (pWin = pChild; pWin; pWin = pWin->nextSib) if (pWin->valdata && pWin->viewable && !TreatAsTransparent(pWin)) RegionAppend(&childUnion, &pWin->borderSize); } else { pWin = pParent->lastChild; while (1) { if (pWin->valdata && pWin->viewable && !TreatAsTransparent(pWin)) RegionAppend(&childUnion, &pWin->borderSize); if (pWin == pChild) break; pWin = pWin->prevSib; } } RegionValidate(&childUnion, &overlap); if (overlap) RegionUninit(&childUnion); } } for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) { if (pWin->viewable) { if (pWin->valdata) { RegionIntersect(&childClip, &totalClip, &pWin->borderSize); miComputeClips(pWin, pScreen, &childClip, kind, &exposed); if (overlap && !TreatAsTransparent(pWin)) { RegionSubtract(&totalClip, &totalClip, &pWin->borderSize); } } else if (pWin->visibility == VisibilityNotViewable) { miTreeObscured(pWin); } } else { if (pWin->valdata) { RegionEmpty(&pWin->clipList); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pWin, 0, 0); RegionEmpty(&pWin->borderClip); pWin->valdata = NULL; } } } RegionUninit(&childClip); if (!overlap) { RegionSubtract(&totalClip, &totalClip, &childUnion); RegionUninit(&childUnion); } RegionNull(&pParent->valdata->after.exposed); RegionNull(&pParent->valdata->after.borderExposed); /* * each case below is responsible for updating the * clipList and serial number for the parent window */ switch (kind) { case VTStack: break; default: /* * totalClip contains the new clipList for the parent. Figure out * exposures and obscures as per miComputeClips and reset the parent's * clipList. */ RegionSubtract(&pParent->valdata->after.exposed, &totalClip, &pParent->clipList); /* fall through */ case VTMap: RegionCopy(&pParent->clipList, &totalClip); pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } RegionUninit(&totalClip); RegionUninit(&exposed); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pParent, 0, 0); return 1; } xorg-server-1.20.8/mi/mizerclip.c0000644000175000017500000005257313640201473013571 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "miline.h" /* The bresenham error equation used in the mi/mfb/cfb line routines is: e = error dx = difference in raw X coordinates dy = difference in raw Y coordinates M = # of steps in X direction N = # of steps in Y direction B = 0 to prefer diagonal steps in a given octant, 1 to prefer axial steps in a given octant For X major lines: e = 2Mdy - 2Ndx - dx - B -2dx <= e < 0 For Y major lines: e = 2Ndx - 2Mdy - dy - B -2dy <= e < 0 At the start of the line, we have taken 0 X steps and 0 Y steps, so M = 0 and N = 0: X major e = 2Mdy - 2Ndx - dx - B = -dx - B Y major e = 2Ndx - 2Mdy - dy - B = -dy - B At the end of the line, we have taken dx X steps and dy Y steps, so M = dx and N = dy: X major e = 2Mdy - 2Ndx - dx - B = 2dxdy - 2dydx - dx - B = -dx - B Y major e = 2Ndx - 2Mdy - dy - B = 2dydx - 2dxdy - dy - B = -dy - B Thus, the error term is the same at the start and end of the line. Let us consider clipping an X coordinate. There are 4 cases which represent the two independent cases of clipping the start vs. the end of the line and an X major vs. a Y major line. In any of these cases, we know the number of X steps (M) and we wish to find the number of Y steps (N). Thus, we will solve our error term equation. If we are clipping the start of the line, we will find the smallest N that satisfies our error term inequality. If we are clipping the end of the line, we will find the largest number of Y steps that satisfies the inequality. In that case, since we are representing the Y steps as (dy - N), we will actually want to solve for the smallest N in that equation. Case 1: X major, starting X coordinate moved by M steps -2dx <= 2Mdy - 2Ndx - dx - B < 0 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx N <= (2Mdy + dx - B) / 2dx Since we are trying to find the smallest N that satisfies these equations, we should use the > inequality to find the smallest: N = floor((2Mdy - dx - B) / 2dx) + 1 = floor((2Mdy - dx - B + 2dx) / 2dx) = floor((2Mdy + dx - B) / 2dx) Case 1b: X major, ending X coordinate moved to M steps Same derivations as Case 1, but we want the largest N that satisfies the equations, so we use the <= inequality: N = floor((2Mdy + dx - B) / 2dx) Case 2: X major, ending X coordinate moved by M steps -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 -2dx <= 2Ndx - 2Mdy - dx - B < 0 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx N >= (2Mdy - dx + B) / 2dx Since we are trying to find the highest number of Y steps that satisfies these equations, we need to find the smallest N, so we should use the >= inequality to find the smallest: N = ceiling((2Mdy - dx + B) / 2dx) = floor((2Mdy - dx + B + 2dx - 1) / 2dx) = floor((2Mdy + dx + B - 1) / 2dx) Case 2b: X major, starting X coordinate moved to M steps from end Same derivations as Case 2, but we want the smallest number of Y steps, so we want the highest N, so we use the < inequality: N = ceiling((2Mdy + dx + B) / 2dx) - 1 = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1 = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx) = floor((2Mdy + dx + B - 1) / 2dx) Case 3: Y major, starting X coordinate moved by M steps -2dy <= 2Ndx - 2Mdy - dy - B < 0 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx N >= (2Mdy - dy + B) / 2dx Since we are trying to find the smallest N that satisfies these equations, we should use the >= inequality to find the smallest: N = ceiling((2Mdy - dy + B) / 2dx) = floor((2Mdy - dy + B + 2dx - 1) / 2dx) = floor((2Mdy - dy + B - 1) / 2dx) + 1 Case 3b: Y major, ending X coordinate moved to M steps Same derivations as Case 3, but we want the largest N that satisfies the equations, so we use the < inequality: N = ceiling((2Mdy + dy + B) / 2dx) - 1 = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1 = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx) = floor((2Mdy + dy + B - 1) / 2dx) Case 4: Y major, ending X coordinate moved by M steps -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 -2dy <= 2Mdy - 2Ndx - dy - B < 0 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx N <= (2Mdy + dy - B) / 2dx Since we are trying to find the highest number of Y steps that satisfies these equations, we need to find the smallest N, so we should use the > inequality to find the smallest: N = floor((2Mdy - dy - B) / 2dx) + 1 Case 4b: Y major, starting X coordinate moved to M steps from end Same analysis as Case 4, but we want the smallest number of Y steps which means the largest N, so we use the <= inequality: N = floor((2Mdy + dy - B) / 2dx) Now let's try the Y coordinates, we have the same 4 cases. Case 5: X major, starting Y coordinate moved by N steps -2dx <= 2Mdy - 2Ndx - dx - B < 0 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy M >= (2Ndx - dx + B) / 2dy Since we are trying to find the smallest M, we use the >= inequality: M = ceiling((2Ndx - dx + B) / 2dy) = floor((2Ndx - dx + B + 2dy - 1) / 2dy) = floor((2Ndx - dx + B - 1) / 2dy) + 1 Case 5b: X major, ending Y coordinate moved to N steps Same derivations as Case 5, but we want the largest M that satisfies the equations, so we use the < inequality: M = ceiling((2Ndx + dx + B) / 2dy) - 1 = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1 = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy) = floor((2Ndx + dx + B - 1) / 2dy) Case 6: X major, ending Y coordinate moved by N steps -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 -2dx <= 2Ndx - 2Mdy - dx - B < 0 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy M <= (2Ndx + dx - B) / 2dy Largest # of X steps means smallest M, so use the > inequality: M = floor((2Ndx - dx - B) / 2dy) + 1 Case 6b: X major, starting Y coordinate moved to N steps from end Same derivations as Case 6, but we want the smallest # of X steps which means the largest M, so use the <= inequality: M = floor((2Ndx + dx - B) / 2dy) Case 7: Y major, starting Y coordinate moved by N steps -2dy <= 2Ndx - 2Mdy - dy - B < 0 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy M <= (2Ndx + dy - B) / 2dy To find the smallest M, use the > inequality: M = floor((2Ndx - dy - B) / 2dy) + 1 = floor((2Ndx - dy - B + 2dy) / 2dy) = floor((2Ndx + dy - B) / 2dy) Case 7b: Y major, ending Y coordinate moved to N steps Same derivations as Case 7, but we want the largest M that satisfies the equations, so use the <= inequality: M = floor((2Ndx + dy - B) / 2dy) Case 8: Y major, ending Y coordinate moved by N steps -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 -2dy <= 2Mdy - 2Ndx - dy - B < 0 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy M >= (2Ndx - dy + B) / 2dy To find the highest X steps, find the smallest M, use the >= inequality: M = ceiling((2Ndx - dy + B) / 2dy) = floor((2Ndx - dy + B + 2dy - 1) / 2dy) = floor((2Ndx + dy + B - 1) / 2dy) Case 8b: Y major, starting Y coordinate moved to N steps from the end Same derivations as Case 8, but we want to find the smallest # of X steps which means the largest M, so we use the < inequality: M = ceiling((2Ndx + dy + B) / 2dy) - 1 = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1 = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy) = floor((2Ndx + dy + B - 1) / 2dy) So, our equations are: 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx) 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx) 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx) 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx) 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx) 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx) 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy) 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy) 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy) 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy) 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy) 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy) We have the following constraints on all of the above terms: 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine 0 <= dx/dy <= 2^16 - 1 0 <= B <= 1 The floor in all of the above equations can be accomplished with a simple C divide operation provided that both numerator and denominator are positive. Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0 and moving a Y coordinate implies dy != 0, we know that the denominators are all > 0. For all lines, (-B) and (B-1) are both either 0 or -1, depending on the bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1 or > 0 to prove that the numerators are positive (or zero). For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the constraints, the first four equations all have numerators >= 0. For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy or (2Mdy + dy) > 0. So all of their numerators are >= 0. For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx) >= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0. For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators are > 0. To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1) <= 2^16 * (2^16 - 1) + (2^16 - 1) <= 2^32 - 2^16 + 2^16 - 1 <= 2^32 - 1 Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of the numerator is therefore (2^32 - 1), which does not overflow an unsigned 32 bit variable. */ /* Bit codes for the terms of the 16 clipping equations defined below. */ #define T_2NDX (1 << 0) #define T_2MDY (0) /* implicit term */ #define T_DXNOTY (1 << 1) #define T_DYNOTX (0) /* implicit term */ #define T_SUBDXORY (1 << 2) #define T_ADDDX (T_DXNOTY) /* composite term */ #define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */ #define T_ADDDY (T_DYNOTX) /* composite term */ #define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */ #define T_BIASSUBONE (1 << 3) #define T_SUBBIAS (0) /* implicit term */ #define T_DIV2DX (1 << 4) #define T_DIV2DY (0) /* implicit term */ #define T_ADDONE (1 << 5) /* Bit masks defining the 16 equations used in miZeroClipLine. */ #define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) #define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) #define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) #define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) #define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE) #define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX) #define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE) #define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX) #define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE) #define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY) #define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE) #define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY) #define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) #define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) #define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) #define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) /* miZeroClipLine * * returns: 1 for partially clipped line * -1 for completely clipped line * */ int miZeroClipLine(int xmin, int ymin, int xmax, int ymax, int *new_x1, int *new_y1, int *new_x2, int *new_y2, unsigned int adx, unsigned int ady, int *pt1_clipped, int *pt2_clipped, int octant, unsigned int bias, int oc1, int oc2) { int swapped = 0; int clipDone = 0; CARD32 utmp = 0; int clip1, clip2; int x1, y1, x2, y2; int x1_orig, y1_orig, x2_orig, y2_orig; int xmajor; int negslope = 0, anchorval = 0; unsigned int eqn = 0; x1 = x1_orig = *new_x1; y1 = y1_orig = *new_y1; x2 = x2_orig = *new_x2; y2 = y2_orig = *new_y2; clip1 = 0; clip2 = 0; xmajor = IsXMajorOctant(octant); bias = ((bias >> octant) & 1); while (1) { if ((oc1 & oc2) != 0) { /* trivial reject */ clipDone = -1; clip1 = oc1; clip2 = oc2; break; } else if ((oc1 | oc2) == 0) { /* trivial accept */ clipDone = 1; if (swapped) { SWAPINT_PAIR(x1, y1, x2, y2); SWAPINT(clip1, clip2); } break; } else { /* have to clip */ /* only clip one point at a time */ if (oc1 == 0) { SWAPINT_PAIR(x1, y1, x2, y2); SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig); SWAPINT(oc1, oc2); SWAPINT(clip1, clip2); swapped = !swapped; } clip1 |= oc1; if (oc1 & OUT_LEFT) { negslope = IsYDecreasingOctant(octant); utmp = xmin - x1_orig; if (utmp <= 32767) { /* clip based on near endpt */ if (xmajor) eqn = (swapped) ? EQN2 : EQN1; else eqn = (swapped) ? EQN4 : EQN3; anchorval = y1_orig; } else { /* clip based on far endpt */ utmp = x2_orig - xmin; if (xmajor) eqn = (swapped) ? EQN1B : EQN2B; else eqn = (swapped) ? EQN3B : EQN4B; anchorval = y2_orig; negslope = !negslope; } x1 = xmin; } else if (oc1 & OUT_ABOVE) { negslope = IsXDecreasingOctant(octant); utmp = ymin - y1_orig; if (utmp <= 32767) { /* clip based on near endpt */ if (xmajor) eqn = (swapped) ? EQN6 : EQN5; else eqn = (swapped) ? EQN8 : EQN7; anchorval = x1_orig; } else { /* clip based on far endpt */ utmp = y2_orig - ymin; if (xmajor) eqn = (swapped) ? EQN5B : EQN6B; else eqn = (swapped) ? EQN7B : EQN8B; anchorval = x2_orig; negslope = !negslope; } y1 = ymin; } else if (oc1 & OUT_RIGHT) { negslope = IsYDecreasingOctant(octant); utmp = x1_orig - xmax; if (utmp <= 32767) { /* clip based on near endpt */ if (xmajor) eqn = (swapped) ? EQN2 : EQN1; else eqn = (swapped) ? EQN4 : EQN3; anchorval = y1_orig; } else { /* clip based on far endpt */ /* * Technically since the equations can handle * utmp == 32768, this overflow code isn't * needed since X11 protocol can't generate * a line which goes more than 32768 pixels * to the right of a clip rectangle. */ utmp = xmax - x2_orig; if (xmajor) eqn = (swapped) ? EQN1B : EQN2B; else eqn = (swapped) ? EQN3B : EQN4B; anchorval = y2_orig; negslope = !negslope; } x1 = xmax; } else if (oc1 & OUT_BELOW) { negslope = IsXDecreasingOctant(octant); utmp = y1_orig - ymax; if (utmp <= 32767) { /* clip based on near endpt */ if (xmajor) eqn = (swapped) ? EQN6 : EQN5; else eqn = (swapped) ? EQN8 : EQN7; anchorval = x1_orig; } else { /* clip based on far endpt */ /* * Technically since the equations can handle * utmp == 32768, this overflow code isn't * needed since X11 protocol can't generate * a line which goes more than 32768 pixels * below the bottom of a clip rectangle. */ utmp = ymax - y2_orig; if (xmajor) eqn = (swapped) ? EQN5B : EQN6B; else eqn = (swapped) ? EQN7B : EQN8B; anchorval = x2_orig; negslope = !negslope; } y1 = ymax; } if (swapped) negslope = !negslope; utmp <<= 1; /* utmp = 2N or 2M */ if (eqn & T_2NDX) utmp = (utmp * adx); else /* (eqn & T_2MDY) */ utmp = (utmp * ady); if (eqn & T_DXNOTY) if (eqn & T_SUBDXORY) utmp -= adx; else utmp += adx; else /* (eqn & T_DYNOTX) */ if (eqn & T_SUBDXORY) utmp -= ady; else utmp += ady; if (eqn & T_BIASSUBONE) utmp += bias - 1; else /* (eqn & T_SUBBIAS) */ utmp -= bias; if (eqn & T_DIV2DX) utmp /= (adx << 1); else /* (eqn & T_DIV2DY) */ utmp /= (ady << 1); if (eqn & T_ADDONE) utmp++; if (negslope) utmp = -utmp; if (eqn & T_2NDX) /* We are calculating X steps */ x1 = anchorval + utmp; else /* else, Y steps */ y1 = anchorval + utmp; oc1 = 0; MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax); } } *new_x1 = x1; *new_y1 = y1; *new_x2 = x2; *new_y2 = y2; *pt1_clipped = clip1; *pt2_clipped = clip2; return clipDone; } xorg-server-1.20.8/mi/mifpoly.h0000644000175000017500000000473413640201473013253 00000000000000/*********************************************************** 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 __MIFPOLY_H__ #define __MIFPOLY_H__ #include static _X_INLINE int ICEIL(double x) { int _cTmp = x; return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1; } #endif /* __MIFPOLY_H__ */ xorg-server-1.20.8/mi/midash.c0000644000175000017500000000644713640201473013037 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "regionstr.h" #include "mistruct.h" void miStepDash(int dist, /* distance to step */ int *pDashIndex, /* current dash */ unsigned char *pDash, /* dash list */ int numInDashList, /* total length of dash list */ int *pDashOffset /* offset into current dash */ ) { int dashIndex, dashOffset; int totallen; int i; dashIndex = *pDashIndex; dashOffset = *pDashOffset; if (dist < pDash[dashIndex] - dashOffset) { *pDashOffset = dashOffset + dist; return; } dist -= pDash[dashIndex] - dashOffset; if (++dashIndex == numInDashList) dashIndex = 0; totallen = 0; for (i = 0; i < numInDashList; i++) totallen += pDash[i]; if (totallen <= dist) dist = dist % totallen; while (dist >= pDash[dashIndex]) { dist -= pDash[dashIndex]; if (++dashIndex == numInDashList) dashIndex = 0; } *pDashIndex = dashIndex; *pDashOffset = dist; } xorg-server-1.20.8/mi/miinitext.c0000644000175000017500000002343713640201473013602 00000000000000/*********************************************************** 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. ******************************************************************/ /* * Copyright (c) 2000 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef HAVE_XORG_CONFIG_H #include #include "xf86Extensions.h" #endif #ifdef HAVE_DMX_CONFIG_H #include #undef XV #undef DBE #undef SCREENSAVER #undef RANDR #undef DAMAGE #undef COMPOSITE #undef MITSHM #endif #ifdef HAVE_XNEST_CONFIG_H #include #undef COMPOSITE #undef DPMSExtension #endif #include "misc.h" #include "extension.h" #include "extinit.h" #ifdef INXQUARTZ #include "nonsdk_extinit.h" #endif #include "micmap.h" #include "os.h" #include "globals.h" /* List of built-in (statically linked) extensions */ static const ExtensionModule staticExtensions[] = { {GEExtensionInit, "Generic Event Extension", &noGEExtension}, {ShapeExtensionInit, "SHAPE", NULL}, #ifdef MITSHM {ShmExtensionInit, "MIT-SHM", &noMITShmExtension}, #endif {XInputExtensionInit, "XInputExtension", NULL}, #ifdef XTEST {XTestExtensionInit, "XTEST", &noTestExtensions}, #endif {BigReqExtensionInit, "BIG-REQUESTS", NULL}, {SyncExtensionInit, "SYNC", NULL}, {XkbExtensionInit, "XKEYBOARD", NULL}, {XCMiscExtensionInit, "XC-MISC", NULL}, #ifdef XCSECURITY {SecurityExtensionInit, "SECURITY", &noSecurityExtension}, #endif #ifdef PANORAMIX {PanoramiXExtensionInit, "XINERAMA", &noPanoramiXExtension}, #endif #ifdef INXQUARTZ /* PseudoramiXExtensionInit must be done before RRExtensionInit, or * XQuartz will render windows offscreen. */ {PseudoramiXExtensionInit, "PseudoramiX", &noPseudoramiXExtension}, #endif /* must be before Render to layer DisplayCursor correctly */ {XFixesExtensionInit, "XFIXES", &noXFixesExtension}, #ifdef XF86BIGFONT {XFree86BigfontExtensionInit, "XFree86-Bigfont", &noXFree86BigfontExtension}, #endif {RenderExtensionInit, "RENDER", &noRenderExtension}, #ifdef RANDR {RRExtensionInit, "RANDR", &noRRExtension}, #endif #ifdef COMPOSITE {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension}, #endif #ifdef DAMAGE {DamageExtensionInit, "DAMAGE", &noDamageExtension}, #endif #ifdef SCREENSAVER {ScreenSaverExtensionInit, "MIT-SCREEN-SAVER", &noScreenSaverExtension}, #endif #ifdef DBE {DbeExtensionInit, "DOUBLE-BUFFER", &noDbeExtension}, #endif #ifdef XRECORD {RecordExtensionInit, "RECORD", &noTestExtensions}, #endif #ifdef DPMSExtension {DPMSExtensionInit, "DPMS", &noDPMSExtension}, #endif #ifdef PRESENT {present_extension_init, "Present", NULL}, #endif #ifdef DRI3 {dri3_extension_init, "DRI3", NULL}, #endif #ifdef RES {ResExtensionInit, "X-Resource", &noResExtension}, #endif #ifdef XV {XvExtensionInit, "XVideo", &noXvExtension}, {XvMCExtensionInit, "XVideo-MotionCompensation", &noXvExtension}, #endif #ifdef XSELINUX {SELinuxExtensionInit, "SELinux", &noSELinuxExtension}, #endif #ifdef GLXEXT {GlxExtensionInit, "GLX", &noGlxExtension}, #endif }; Bool EnableDisableExtension(const char *name, Bool enable) { const ExtensionModule *ext; int i; for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) { ext = &staticExtensions[i]; if (strcasecmp(name, ext->name) == 0) { if (ext->disablePtr != NULL) { *ext->disablePtr = !enable; return TRUE; } else { /* Extension is always on, impossible to disable */ return enable; /* okay if they wanted to enable, fail if they tried to disable */ } } } return FALSE; } void EnableDisableExtensionError(const char *name, Bool enable) { const ExtensionModule *ext; int i; Bool found = FALSE; for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) { ext = &staticExtensions[i]; if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) { ErrorF("[mi] Extension \"%s\" can not be disabled\n", name); found = TRUE; break; } } if (found == FALSE) ErrorF("[mi] Extension \"%s\" is not recognized\n", name); ErrorF("[mi] Only the following extensions can be run-time %s:\n", enable ? "enabled" : "disabled"); for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) { ext = &staticExtensions[i]; if (ext->disablePtr != NULL) { ErrorF("[mi] %s\n", ext->name); } } } static ExtensionModule *ExtensionModuleList = NULL; static int numExtensionModules = 0; static void AddStaticExtensions(void) { static Bool listInitialised = FALSE; if (listInitialised) return; listInitialised = TRUE; /* Add built-in extensions to the list. */ LoadExtensionList(staticExtensions, ARRAY_SIZE(staticExtensions), TRUE); } void InitExtensions(int argc, char *argv[]) { int i; ExtensionModule *ext; AddStaticExtensions(); for (i = 0; i < numExtensionModules; i++) { ext = &ExtensionModuleList[i]; if (ext->initFunc != NULL && (ext->disablePtr == NULL || !*ext->disablePtr)) { LogMessageVerb(X_INFO, 3, "Initializing extension %s\n", ext->name); (ext->initFunc) (); } } } static ExtensionModule * NewExtensionModuleList(int size) { ExtensionModule *save = ExtensionModuleList; int n; /* Sanity check */ if (!ExtensionModuleList) numExtensionModules = 0; n = numExtensionModules + size; ExtensionModuleList = reallocarray(ExtensionModuleList, n, sizeof(ExtensionModule)); if (ExtensionModuleList == NULL) { ExtensionModuleList = save; return NULL; } else { numExtensionModules += size; return ExtensionModuleList + (numExtensionModules - size); } } void LoadExtensionList(const ExtensionModule ext[], int size, Bool builtin) { ExtensionModule *newext; int i; /* Make sure built-in extensions get added to the list before those * in modules. */ AddStaticExtensions(); if (!(newext = NewExtensionModuleList(size))) return; for (i = 0; i < size; i++, newext++) { newext->name = ext[i].name; newext->initFunc = ext[i].initFunc; newext->disablePtr = ext[i].disablePtr; } } xorg-server-1.20.8/mi/miexpose.c0000644000175000017500000004370413640201473013420 00000000000000/*********************************************************** 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. ******************************************************************/ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. 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. 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 DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "input.h" #include "dixstruct.h" #include "mi.h" #include #include "globals.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif /* machine-independent graphics exposure code. any device that uses the region package can call this. */ #ifndef RECTLIMIT #define RECTLIMIT 25 /* pick a number, any number > 8 */ #endif /* miHandleExposures generate a region for exposures for areas that were copied from obscured or non-existent areas to non-obscured areas of the destination. Paint the background for the region, if the destination is a window. NOTE: this should generally be called, even if graphicsExposures is false, because this is where bits get recovered from backing store. */ RegionPtr miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { RegionPtr prgnSrcClip; /* drawable-relative source clip */ RegionRec rgnSrcRec; RegionPtr prgnDstClip; /* drawable-relative dest clip */ RegionRec rgnDstRec; BoxRec srcBox; /* unclipped source */ RegionRec rgnExposed; /* exposed region, calculated source- relative, made dst relative to intersect with visible parts of dest and send events to client, and then screen relative to paint the window background */ WindowPtr pSrcWin; BoxRec expBox = { 0, }; Bool extents; /* avoid work if we can */ if (!pGC->graphicsExposures && (pDstDrawable->type == DRAWABLE_PIXMAP) && ((pSrcDrawable->type == DRAWABLE_PIXMAP) || (((WindowPtr) pSrcDrawable)->backStorage == 0))) return NULL; srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx + width; srcBox.y2 = srcy + height; if (pSrcDrawable->type != DRAWABLE_PIXMAP) { BoxRec TsrcBox; TsrcBox.x1 = srcx + pSrcDrawable->x; TsrcBox.y1 = srcy + pSrcDrawable->y; TsrcBox.x2 = TsrcBox.x1 + width; TsrcBox.y2 = TsrcBox.y1 + height; pSrcWin = (WindowPtr) pSrcDrawable; if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren(pSrcWin); if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN) { RegionDestroy(prgnSrcClip); return NULL; } } else { if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN) return NULL; prgnSrcClip = &rgnSrcRec; RegionNull(prgnSrcClip); RegionCopy(prgnSrcClip, &pSrcWin->clipList); } RegionTranslate(prgnSrcClip, -pSrcDrawable->x, -pSrcDrawable->y); } else { BoxRec box; if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) && (srcBox.x2 <= pSrcDrawable->width) && (srcBox.y2 <= pSrcDrawable->height)) return NULL; box.x1 = 0; box.y1 = 0; box.x2 = pSrcDrawable->width; box.y2 = pSrcDrawable->height; prgnSrcClip = &rgnSrcRec; RegionInit(prgnSrcClip, &box, 1); pSrcWin = NULL; } if (pDstDrawable == pSrcDrawable) { prgnDstClip = prgnSrcClip; } else if (pDstDrawable->type != DRAWABLE_PIXMAP) { if (pGC->subWindowMode == IncludeInferiors) { prgnDstClip = NotClippedByChildren((WindowPtr) pDstDrawable); } else { prgnDstClip = &rgnDstRec; RegionNull(prgnDstClip); RegionCopy(prgnDstClip, &((WindowPtr) pDstDrawable)->clipList); } RegionTranslate(prgnDstClip, -pDstDrawable->x, -pDstDrawable->y); } else { BoxRec box; box.x1 = 0; box.y1 = 0; box.x2 = pDstDrawable->width; box.y2 = pDstDrawable->height; prgnDstClip = &rgnDstRec; RegionInit(prgnDstClip, &box, 1); } /* drawable-relative source region */ RegionInit(&rgnExposed, &srcBox, 1); /* now get the hidden parts of the source box */ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); /* move them over the destination */ RegionTranslate(&rgnExposed, dstx - srcx, dsty - srcy); /* intersect with visible areas of dest */ RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip); /* intersect with client clip region. */ if (pGC->clientClip) RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip); /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-) * for windows. */ extents = pGC->graphicsExposures && (RegionNumRects(&rgnExposed) > RECTLIMIT) && (pDstDrawable->type != DRAWABLE_PIXMAP); if (pSrcWin) { RegionPtr region; if (!(region = wClipShape(pSrcWin))) region = wBoundingShape(pSrcWin); /* * If you try to CopyArea the extents of a shaped window, compacting the * exposed region will undo all our work! */ if (extents && pSrcWin && region && (RegionContainsRect(region, &srcBox) != rgnIN)) extents = FALSE; } if (extents) { expBox = *RegionExtents(&rgnExposed); RegionReset(&rgnExposed, &expBox); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr) pDstDrawable)->backgroundState != None)) { WindowPtr pWin = (WindowPtr) pDstDrawable; /* make the exposed area screen-relative */ RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y); if (extents) { /* PaintWindow doesn't clip, so we have to */ RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList); } pDstDrawable->pScreen->PaintWindow((WindowPtr) pDstDrawable, &rgnExposed, PW_BACKGROUND); if (extents) { RegionReset(&rgnExposed, &expBox); } else RegionTranslate(&rgnExposed, -pDstDrawable->x, -pDstDrawable->y); } if (prgnDstClip == &rgnDstRec) { RegionUninit(prgnDstClip); } else if (prgnDstClip != prgnSrcClip) { RegionDestroy(prgnDstClip); } if (prgnSrcClip == &rgnSrcRec) { RegionUninit(prgnSrcClip); } else { RegionDestroy(prgnSrcClip); } if (pGC->graphicsExposures) { /* don't look */ RegionPtr exposed = RegionCreate(NullBox, 0); *exposed = rgnExposed; return exposed; } else { RegionUninit(&rgnExposed); return NULL; } } void miSendExposures(WindowPtr pWin, RegionPtr pRgn, int dx, int dy) { BoxPtr pBox; int numRects; xEvent *pEvent, *pe; int i; pBox = RegionRects(pRgn); numRects = RegionNumRects(pRgn); if (!(pEvent = calloc(1, numRects * sizeof(xEvent)))) return; for (i = numRects, pe = pEvent; --i >= 0; pe++, pBox++) { pe->u.u.type = Expose; pe->u.expose.window = pWin->drawable.id; pe->u.expose.x = pBox->x1 - dx; pe->u.expose.y = pBox->y1 - dy; pe->u.expose.width = pBox->x2 - pBox->x1; pe->u.expose.height = pBox->y2 - pBox->y1; pe->u.expose.count = i; } #ifdef PANORAMIX if (!noPanoramiXExtension) { int scrnum = pWin->drawable.pScreen->myNum; int x = 0, y = 0; XID realWin = 0; if (!pWin->parent) { x = screenInfo.screens[scrnum]->x; y = screenInfo.screens[scrnum]->y; pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, scrnum); if (!win) { free(pEvent); return; } realWin = win->info[0].id; dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess); } if (x || y || scrnum) for (i = 0; i < numRects; i++) { pEvent[i].u.expose.window = realWin; pEvent[i].u.expose.x += x; pEvent[i].u.expose.y += y; } } #endif DeliverEvents(pWin, pEvent, numRects, NullWindow); free(pEvent); } void miWindowExposures(WindowPtr pWin, RegionPtr prgn) { RegionPtr exposures = prgn; if (prgn && !RegionNil(prgn)) { RegionRec expRec; int clientInterested = (pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask; if (clientInterested && (RegionNumRects(prgn) > RECTLIMIT)) { /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-). */ BoxRec box = *RegionExtents(prgn); exposures = &expRec; RegionInit(exposures, &box, 1); RegionReset(prgn, &box); /* miPaintWindow doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); } pWin->drawable.pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND); if (clientInterested) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) RegionUninit(exposures); RegionEmpty(prgn); } } void miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; ChangeGCVal gcval[6]; BITS32 gcmask; GCPtr pGC; int i; BoxPtr pbox; xRectangle *prect; int numRects; /* * Distance from screen to destination drawable, use this * to adjust rendering coordinates which come in in screen space */ int draw_x_off, draw_y_off; /* * Tile offset for drawing; these need to align the tile * to the appropriate window origin */ int tile_x_off, tile_y_off; PixUnion fill; Bool solid = TRUE; DrawablePtr drawable = &pWin->drawable; if (what == PW_BACKGROUND) { while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; draw_x_off = drawable->x; draw_y_off = drawable->y; tile_x_off = pWin->drawable.x - draw_x_off; tile_y_off = pWin->drawable.y - draw_y_off; fill = pWin->background; #ifdef COMPOSITE if (pWin->inhibitBGPaint) return; #endif switch (pWin->backgroundState) { case None: return; case BackgroundPixmap: solid = FALSE; break; } } else { PixmapPtr pixmap; fill = pWin->border; solid = pWin->borderIsPixel; /* servers without pixmaps draw their own borders */ if (!pScreen->GetWindowPixmap) return; pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable); drawable = &pixmap->drawable; while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; tile_x_off = pWin->drawable.x; tile_y_off = pWin->drawable.y; #ifdef COMPOSITE draw_x_off = pixmap->screen_x; draw_y_off = pixmap->screen_y; tile_x_off -= draw_x_off; tile_y_off -= draw_y_off; #else draw_x_off = 0; draw_y_off = 0; #endif } gcval[0].val = GXcopy; gcmask = GCFunction; #ifdef ROOTLESS_SAFEALPHA /* Bit mask for alpha channel with a particular number of bits per * pixel. Note that we only care for 32bpp data. Mac OS X uses planar * alpha for 16bpp. */ #define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0) #endif if (solid) { #ifdef ROOTLESS_SAFEALPHA gcval[1].val = fill.pixel | RootlessAlphaMask(pWin->drawable.bitsPerPixel); #else gcval[1].val = fill.pixel; #endif gcval[2].val = FillSolid; gcmask |= GCForeground | GCFillStyle; } else { int c = 1; #ifdef ROOTLESS_SAFEALPHA gcval[c++].val = ((CARD32) -1) & ~RootlessAlphaMask(pWin->drawable.bitsPerPixel); gcmask |= GCPlaneMask; #endif gcval[c++].val = FillTiled; gcval[c++].ptr = (void *) fill.pixmap; gcval[c++].val = tile_x_off; gcval[c++].val = tile_y_off; gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; } prect = xallocarray(RegionNumRects(prgn), sizeof(xRectangle)); if (!prect) return; pGC = GetScratchGC(drawable->depth, drawable->pScreen); if (!pGC) { free(prect); return; } ChangeGC(NullClient, pGC, gcmask, gcval); ValidateGC(drawable, pGC); numRects = RegionNumRects(prgn); pbox = RegionRects(prgn); for (i = numRects; --i >= 0; pbox++, prect++) { prect->x = pbox->x1 - draw_x_off; prect->y = pbox->y1 - draw_y_off; prect->width = pbox->x2 - pbox->x1; prect->height = pbox->y2 - pbox->y1; } prect -= numRects; (*pGC->ops->PolyFillRect) (drawable, pGC, numRects, prect); free(prect); FreeScratchGC(pGC); } /* MICLEARDRAWABLE -- sets the entire drawable to the background color of * the GC. Useful when we have a scratch drawable and need to initialize * it. */ void miClearDrawable(DrawablePtr pDraw, GCPtr pGC) { ChangeGCVal fg, bg; xRectangle rect; fg.val = pGC->fgPixel; bg.val = pGC->bgPixel; rect.x = 0; rect.y = 0; rect.width = pDraw->width; rect.height = pDraw->height; ChangeGC(NullClient, pGC, GCForeground, &bg); ValidateGC(pDraw, pGC); (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); ChangeGC(NullClient, pGC, GCForeground, &fg); ValidateGC(pDraw, pGC); } xorg-server-1.20.8/mi/mifillarc.c0000644000175000017500000004640413640201473013531 00000000000000/************************************************************ Copyright 1989, 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: Bob Scheifler, MIT X Consortium ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "mifillarc.h" #define QUADRANT (90 * 64) #define HALFCIRCLE (180 * 64) #define QUADRANT3 (270 * 64) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define Dsin(d) sin((double)d*(M_PI/11520.0)) #define Dcos(d) cos((double)d*(M_PI/11520.0)) static void miFillArcSetup(xArc * arc, miFillArcRec * info) { info->y = arc->height >> 1; info->dy = arc->height & 1; info->yorg = arc->y + info->y; info->dx = arc->width & 1; info->xorg = arc->x + (arc->width >> 1) + info->dx; info->dx = 1 - info->dx; if (arc->width == arc->height) { /* (2x - 2xorg)^2 = d^2 - (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->ym = 8; info->xm = 8; info->yk = info->y << 3; if (!info->dx) { info->xk = 0; info->e = -1; } else { info->y++; info->yk += 4; info->xk = -4; info->e = -(info->y << 3); } } else { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->ym = (arc->width * arc->width) << 3; info->xm = (arc->height * arc->height) << 3; info->yk = info->y * info->ym; if (!info->dy) info->yk -= info->ym >> 1; if (!info->dx) { info->xk = 0; info->e = -(info->xm >> 3); } else { info->y++; info->yk += info->ym; info->xk = -(info->xm >> 1); info->e = info->xk - info->yk; } } } static void miFillArcDSetup(xArc * arc, miFillArcDRec * info) { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->y = arc->height >> 1; info->dy = arc->height & 1; info->yorg = arc->y + info->y; info->dx = arc->width & 1; info->xorg = arc->x + (arc->width >> 1) + info->dx; info->dx = 1 - info->dx; info->ym = ((double) arc->width) * (arc->width * 8); info->xm = ((double) arc->height) * (arc->height * 8); info->yk = info->y * info->ym; if (!info->dy) info->yk -= info->ym / 2.0; if (!info->dx) { info->xk = 0; info->e = -(info->xm / 8.0); } else { info->y++; info->yk += info->ym; info->xk = -info->xm / 2.0; info->e = info->xk - info->yk; } } static void miGetArcEdge(xArc * arc, miSliceEdgePtr edge, int k, Bool top, Bool left) { int xady, y; y = arc->height >> 1; if (!(arc->width & 1)) y++; if (!top) { y = -y; if (arc->height & 1) y--; } xady = k + y * edge->dx; if (xady <= 0) edge->x = -((-xady) / edge->dy + 1); else edge->x = (xady - 1) / edge->dy; edge->e = xady - edge->x * edge->dy; if ((top && (edge->dx < 0)) || (!top && (edge->dx > 0))) edge->e = edge->dy - edge->e + 1; if (left) edge->x++; edge->x += arc->x + (arc->width >> 1); if (edge->dx > 0) { edge->deltax = 1; edge->stepx = edge->dx / edge->dy; edge->dx = edge->dx % edge->dy; } else { edge->deltax = -1; edge->stepx = -((-edge->dx) / edge->dy); edge->dx = (-edge->dx) % edge->dy; } if (!top) { edge->deltax = -edge->deltax; edge->stepx = -edge->stepx; } } static void miEllipseAngleToSlope(int angle, int width, int height, int *dxp, int *dyp, double *d_dxp, double *d_dyp) { int dx, dy; double d_dx, d_dy, scale; Bool negative_dx, negative_dy; switch (angle) { case 0: *dxp = -1; *dyp = 0; if (d_dxp) { *d_dxp = width / 2.0; *d_dyp = 0; } break; case QUADRANT: *dxp = 0; *dyp = 1; if (d_dxp) { *d_dxp = 0; *d_dyp = -height / 2.0; } break; case HALFCIRCLE: *dxp = 1; *dyp = 0; if (d_dxp) { *d_dxp = -width / 2.0; *d_dyp = 0; } break; case QUADRANT3: *dxp = 0; *dyp = -1; if (d_dxp) { *d_dxp = 0; *d_dyp = height / 2.0; } break; default: d_dx = Dcos(angle) * width; d_dy = Dsin(angle) * height; if (d_dxp) { *d_dxp = d_dx / 2.0; *d_dyp = -d_dy / 2.0; } negative_dx = FALSE; if (d_dx < 0.0) { d_dx = -d_dx; negative_dx = TRUE; } negative_dy = FALSE; if (d_dy < 0.0) { d_dy = -d_dy; negative_dy = TRUE; } scale = d_dx; if (d_dy > d_dx) scale = d_dy; dx = floor((d_dx * 32768) / scale + 0.5); if (negative_dx) dx = -dx; *dxp = dx; dy = floor((d_dy * 32768) / scale + 0.5); if (negative_dy) dy = -dy; *dyp = dy; break; } } static void miGetPieEdge(xArc * arc, int angle, miSliceEdgePtr edge, Bool top, Bool left) { int k; int dx, dy; miEllipseAngleToSlope(angle, arc->width, arc->height, &dx, &dy, 0, 0); if (dy == 0) { edge->x = left ? -65536 : 65536; edge->stepx = 0; edge->e = 0; edge->dx = -1; return; } if (dx == 0) { edge->x = arc->x + (arc->width >> 1); if (left && (arc->width & 1)) edge->x++; else if (!left && !(arc->width & 1)) edge->x--; edge->stepx = 0; edge->e = 0; edge->dx = -1; return; } if (dy < 0) { dx = -dx; dy = -dy; } k = (arc->height & 1) ? dx : 0; if (arc->width & 1) k += dy; edge->dx = dx << 1; edge->dy = dy << 1; miGetArcEdge(arc, edge, k, top, left); } static void miFillArcSliceSetup(xArc * arc, miArcSliceRec * slice, GCPtr pGC) { int angle1, angle2; angle1 = arc->angle1; if (arc->angle2 < 0) { angle2 = angle1; angle1 += arc->angle2; } else angle2 = angle1 + arc->angle2; while (angle1 < 0) angle1 += FULLCIRCLE; while (angle1 >= FULLCIRCLE) angle1 -= FULLCIRCLE; while (angle2 < 0) angle2 += FULLCIRCLE; while (angle2 >= FULLCIRCLE) angle2 -= FULLCIRCLE; slice->min_top_y = 0; slice->max_top_y = arc->height >> 1; slice->min_bot_y = 1 - (arc->height & 1); slice->max_bot_y = slice->max_top_y - 1; slice->flip_top = FALSE; slice->flip_bot = FALSE; if (pGC->arcMode == ArcPieSlice) { slice->edge1_top = (angle1 < HALFCIRCLE); slice->edge2_top = (angle2 <= HALFCIRCLE); if ((angle2 == 0) || (angle1 == HALFCIRCLE)) { if (angle2 ? slice->edge2_top : slice->edge1_top) slice->min_top_y = slice->min_bot_y; else slice->min_top_y = arc->height; slice->min_bot_y = 0; } else if ((angle1 == 0) || (angle2 == HALFCIRCLE)) { slice->min_top_y = slice->min_bot_y; if (angle1 ? slice->edge1_top : slice->edge2_top) slice->min_bot_y = arc->height; else slice->min_bot_y = 0; } else if (slice->edge1_top == slice->edge2_top) { if (angle2 < angle1) { slice->flip_top = slice->edge1_top; slice->flip_bot = !slice->edge1_top; } else if (slice->edge1_top) { slice->min_top_y = 1; slice->min_bot_y = arc->height; } else { slice->min_bot_y = 0; slice->min_top_y = arc->height; } } miGetPieEdge(arc, angle1, &slice->edge1, slice->edge1_top, !slice->edge1_top); miGetPieEdge(arc, angle2, &slice->edge2, slice->edge2_top, slice->edge2_top); } else { double w2, h2, x1, y1, x2, y2, dx, dy, scale; int signdx, signdy, y, k; Bool isInt1 = TRUE, isInt2 = TRUE; w2 = (double) arc->width / 2.0; h2 = (double) arc->height / 2.0; if ((angle1 == 0) || (angle1 == HALFCIRCLE)) { x1 = angle1 ? -w2 : w2; y1 = 0.0; } else if ((angle1 == QUADRANT) || (angle1 == QUADRANT3)) { x1 = 0.0; y1 = (angle1 == QUADRANT) ? h2 : -h2; } else { isInt1 = FALSE; x1 = Dcos(angle1) * w2; y1 = Dsin(angle1) * h2; } if ((angle2 == 0) || (angle2 == HALFCIRCLE)) { x2 = angle2 ? -w2 : w2; y2 = 0.0; } else if ((angle2 == QUADRANT) || (angle2 == QUADRANT3)) { x2 = 0.0; y2 = (angle2 == QUADRANT) ? h2 : -h2; } else { isInt2 = FALSE; x2 = Dcos(angle2) * w2; y2 = Dsin(angle2) * h2; } dx = x2 - x1; dy = y2 - y1; if (arc->height & 1) { y1 -= 0.5; y2 -= 0.5; } if (arc->width & 1) { x1 += 0.5; x2 += 0.5; } if (dy < 0.0) { dy = -dy; signdy = -1; } else signdy = 1; if (dx < 0.0) { dx = -dx; signdx = -1; } else signdx = 1; if (isInt1 && isInt2) { slice->edge1.dx = dx * 2; slice->edge1.dy = dy * 2; } else { scale = (dx > dy) ? dx : dy; slice->edge1.dx = floor((dx * 32768) / scale + .5); slice->edge1.dy = floor((dy * 32768) / scale + .5); } if (!slice->edge1.dy) { if (signdx < 0) { y = floor(y1 + 1.0); if (y >= 0) { slice->min_top_y = y; slice->min_bot_y = arc->height; } else { slice->max_bot_y = -y - (arc->height & 1); } } else { y = floor(y1); if (y >= 0) slice->max_top_y = y; else { slice->min_top_y = arc->height; slice->min_bot_y = -y - (arc->height & 1); } } slice->edge1_top = TRUE; slice->edge1.x = 65536; slice->edge1.stepx = 0; slice->edge1.e = 0; slice->edge1.dx = -1; slice->edge2 = slice->edge1; slice->edge2_top = FALSE; } else if (!slice->edge1.dx) { if (signdy < 0) x1 -= 1.0; slice->edge1.x = ceil(x1); slice->edge1_top = signdy < 0; slice->edge1.x += arc->x + (arc->width >> 1); slice->edge1.stepx = 0; slice->edge1.e = 0; slice->edge1.dx = -1; slice->edge2_top = !slice->edge1_top; slice->edge2 = slice->edge1; } else { if (signdx < 0) slice->edge1.dx = -slice->edge1.dx; if (signdy < 0) slice->edge1.dx = -slice->edge1.dx; k = ceil(((x1 + x2) * slice->edge1.dy - (y1 + y2) * slice->edge1.dx) / 2.0); slice->edge2.dx = slice->edge1.dx; slice->edge2.dy = slice->edge1.dy; slice->edge1_top = signdy < 0; slice->edge2_top = !slice->edge1_top; miGetArcEdge(arc, &slice->edge1, k, slice->edge1_top, !slice->edge1_top); miGetArcEdge(arc, &slice->edge2, k, slice->edge2_top, slice->edge2_top); } } } #define ADDSPANS() \ pts->x = xorg - x; \ pts->y = yorg - y; \ *wids = slw; \ pts++; \ wids++; \ if (miFillArcLower(slw)) \ { \ pts->x = xorg - x; \ pts->y = yorg + y + dy; \ pts++; \ *wids++ = slw; \ } static int miFillEllipseI(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths) { int x, y, e; int yk, xk, ym, xm, dx, dy, xorg, yorg; int slw; miFillArcRec info; DDXPointPtr pts; int *wids; miFillArcSetup(arc, &info); MIFILLARCSETUP(); if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); ADDSPANS(); } return pts - points; } static int miFillEllipseD(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths) { int x, y; int xorg, yorg, dx, dy, slw; double e, yk, xk, ym, xm; miFillArcDRec info; DDXPointPtr pts; int *wids; miFillArcDSetup(arc, &info); MIFILLARCSETUP(); if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); ADDSPANS(); } return pts - points; } #define ADDSPAN(l,r) \ if (r >= l) \ { \ pts->x = l; \ pts->y = ya; \ pts++; \ *wids++ = r - l + 1; \ } #define ADDSLICESPANS(flip) \ if (!flip) \ { \ ADDSPAN(xl, xr); \ } \ else \ { \ xc = xorg - x; \ ADDSPAN(xc, xr); \ xc += slw - 1; \ ADDSPAN(xl, xc); \ } static int miFillArcSliceI(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths) { int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; int x, y, e; miFillArcRec info; miArcSliceRec slice; int ya, xl, xr, xc; DDXPointPtr pts; int *wids; miFillArcSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { ya = yorg - y; MIARCSLICEUPPER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_top); } if (miFillSliceLower(slice)) { ya = yorg + y + dy; MIARCSLICELOWER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_bot); } } return pts - points; } static int miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths) { int x, y; int dx, dy, xorg, yorg, slw; double e, yk, xk, ym, xm; miFillArcDRec info; miArcSliceRec slice; int ya, xl, xr, xc; DDXPointPtr pts; int *wids; miFillArcDSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { ya = yorg - y; MIARCSLICEUPPER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_top); } if (miFillSliceLower(slice)) { ya = yorg + y + dy; MIARCSLICELOWER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_bot); } } return pts - points; } /* MIPOLYFILLARC -- The public entry for the PolyFillArc request. * Since we don't have to worry about overlapping segments, we can just * fill each arc as it comes. */ /* Limit the number of spans in a single draw request to avoid integer * overflow in the computation of the span buffer size. */ #define MAX_SPANS_PER_LOOP (4 * 1024 * 1024) void miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs_all, xArc * parcs) { while (narcs_all > 0) { int narcs; int i; xArc *arc; int nspans = 0; DDXPointPtr pts, points; int *wids, *widths; int n; for (narcs = 0, arc = parcs; narcs < narcs_all; narcs++, arc++) { if (narcs && nspans + arc->height > MAX_SPANS_PER_LOOP) break; nspans += arc->height; /* A pie-slice arc may add another pile of spans */ if (pGC->arcMode == ArcPieSlice && (-FULLCIRCLE < arc->angle2 && arc->angle2 < FULLCIRCLE)) nspans += (arc->height + 1) >> 1; } pts = points = malloc (sizeof (DDXPointRec) * nspans + sizeof(int) * nspans); if (points) { wids = widths = (int *) (points + nspans); for (i = 0, arc = parcs; i < narcs; arc++, i++) { if (miFillArcEmpty(arc)) continue; if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) { if (miCanFillArc(arc)) n = miFillEllipseI(pDraw, pGC, arc, pts, wids); else n = miFillEllipseD(pDraw, pGC, arc, pts, wids); } else { if (miCanFillArc(arc)) n = miFillArcSliceI(pDraw, pGC, arc, pts, wids); else n = miFillArcSliceD(pDraw, pGC, arc, pts, wids); } pts += n; wids += n; } nspans = pts - points; if (nspans) (*pGC->ops->FillSpans) (pDraw, pGC, nspans, points, widths, FALSE); free (points); } parcs += narcs; narcs_all -= narcs; } } xorg-server-1.20.8/mi/mipolypnt.c0000644000175000017500000000734613640201473013624 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" #include "mi.h" void miPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */ int npt, xPoint * pptInit) { int xorg; int yorg; int nptTmp; ChangeGCVal fsOld, fsNew; int *pwidthInit, *pwidth; int i; xPoint *ppt; if (!(pwidthInit = xallocarray(npt, sizeof(int)))) return; /* make pointlist origin relative */ if (mode == CoordModePrevious) { ppt = pptInit; nptTmp = npt; nptTmp--; while (nptTmp--) { ppt++; ppt->x += (ppt - 1)->x; ppt->y += (ppt - 1)->y; } } if (pGC->miTranslate) { ppt = pptInit; nptTmp = npt; xorg = pDrawable->x; yorg = pDrawable->y; while (nptTmp--) { ppt->x += xorg; ppt++->y += yorg; } } fsOld.val = pGC->fillStyle; fsNew.val = FillSolid; if (pGC->fillStyle != FillSolid) { ChangeGC(NullClient, pGC, GCFillStyle, &fsNew); ValidateGC(pDrawable, pGC); } pwidth = pwidthInit; for (i = 0; i < npt; i++) *pwidth++ = 1; (*pGC->ops->FillSpans) (pDrawable, pGC, npt, pptInit, pwidthInit, FALSE); if (fsOld.val != FillSolid) { ChangeGC(NullClient, pGC, GCFillStyle, &fsOld); ValidateGC(pDrawable, pGC); } free(pwidthInit); } xorg-server-1.20.8/mi/mipolytext.c0000644000175000017500000001143313640201473013777 00000000000000/******************************************************************* 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. ************************************************************************/ /* * mipolytext.c - text routines * * Author: haynes * Digital Equipment Corporation * Western Software Laboratory * Date: Thu Feb 5 1987 */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "gcstruct.h" #include #include "dixfontstr.h" #include "mi.h" int miPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars) { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars, Linear8Bit, &n, charinfo); w = 0; for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x + w; } int miPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars) { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars, (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, &n, charinfo); w = 0; for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x + w; } void miImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars) { unsigned long n; FontPtr font = pGC->font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(font, (unsigned long) count, (unsigned char *) chars, Linear8Bit, &n, charinfo); if (n != 0) (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } void miImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars) { unsigned long n; FontPtr font = pGC->font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(font, (unsigned long) count, (unsigned char *) chars, (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, &n, charinfo); if (n != 0) (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } xorg-server-1.20.8/mi/misprite.c0000644000175000017500000007150213640201473013420 00000000000000/* * misprite.c * * machine independent software sprite routines */ /* Copyright 1989, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "pixmapstr.h" #include "input.h" #include "mi.h" #include "cursorstr.h" #include #include "scrnintstr.h" #include "colormapst.h" #include "windowstr.h" #include "gcstruct.h" #include "mipointer.h" #include "misprite.h" #include "dixfontstr.h" #include #include "inputstr.h" #include "damage.h" typedef struct { CursorPtr pCursor; int x; /* cursor hotspot */ int y; BoxRec saved; /* saved area from the screen */ Bool isUp; /* cursor in frame buffer */ Bool shouldBeUp; /* cursor should be displayed */ Bool checkPixels; /* check colormap collision */ ScreenPtr pScreen; } miCursorInfoRec, *miCursorInfoPtr; /* * per screen information */ typedef struct { /* screen procedures */ CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; /* window procedures */ CopyWindowProcPtr CopyWindow; /* colormap procedures */ InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; xColorItem colors[2]; ColormapPtr pInstalledMap; ColormapPtr pColormap; VisualPtr pVisual; DamagePtr pDamage; /* damage tracking structure */ Bool damageRegistered; int numberOfCursors; } miSpriteScreenRec, *miSpriteScreenPtr; #define SOURCE_COLOR 0 #define MASK_COLOR 1 /* * Overlap BoxPtr and Box elements */ #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \ (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \ ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2)) /* * Overlap BoxPtr, origins, and rectangle */ #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \ BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h)) /* * Overlap BoxPtr, origins and RectPtr */ #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \ ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \ (int)((pRect)->width), (int)((pRect)->height)) /* * Overlap BoxPtr and horizontal span */ #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) #define LINE_SORT(x1,y1,x2,y2) \ { int _t; \ if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \ BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2)) #define SPRITE_DEBUG_ENABLE 0 #if SPRITE_DEBUG_ENABLE #define SPRITE_DEBUG(x) ErrorF x #else #define SPRITE_DEBUG(x) #endif static DevPrivateKeyRec miSpriteScreenKeyRec; static DevPrivateKeyRec miSpriteDevPrivatesKeyRec; static miSpriteScreenPtr GetSpriteScreen(ScreenPtr pScreen) { return dixLookupPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec); } static miCursorInfoPtr GetSprite(DeviceIntPtr dev) { if (IsFloating(dev)) return dixLookupPrivate(&dev->devPrivates, &miSpriteDevPrivatesKeyRec); return dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, &miSpriteDevPrivatesKeyRec); } static void miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv) { if (pScreenPriv->damageRegistered) { DamageUnregister(pScreenPriv->pDamage); pScreenPriv->damageRegistered = 0; } } static void miSpriteEnableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv) { if (!pScreenPriv->damageRegistered) { pScreenPriv->damageRegistered = 1; DamageRegister(&(pScreen->GetScreenPixmap(pScreen)->drawable), pScreenPriv->pDamage); } } static void miSpriteIsUp(miCursorInfoPtr pDevCursor) { pDevCursor->isUp = TRUE; } static void miSpriteIsDown(miCursorInfoPtr pDevCursor) { pDevCursor->isUp = FALSE; } /* * screen wrappers */ static Bool miSpriteCloseScreen(ScreenPtr pScreen); static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width, int height, unsigned int subWindowMode); static void miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); static void miSpriteBlockHandler(ScreenPtr pScreen, void *timeout); static void miSpriteInstallColormap(ColormapPtr pMap); static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef); static void miSpriteComputeSaved(DeviceIntPtr pDev, ScreenPtr pScreen); static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); #define SCREEN_PROLOGUE(pPriv, pScreen, field) ((pScreen)->field = \ (pPriv)->field) #define SCREEN_EPILOGUE(pPriv, pScreen, field)\ ((pPriv)->field = (pScreen)->field, (pScreen)->field = miSprite##field) /* * pointer-sprite method table */ static Bool miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y); static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); miPointerSpriteFuncRec miSpritePointerFuncs = { miSpriteRealizeCursor, miSpriteUnrealizeCursor, miSpriteSetCursor, miSpriteMoveCursor, miSpriteDeviceCursorInitialize, miSpriteDeviceCursorCleanup, }; /* * other misc functions */ static void miSpriteRemoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen); static void miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen); static void miSpriteRestoreCursor(DeviceIntPtr pDev, ScreenPtr pScreen); static void miSpriteRegisterBlockHandler(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv) { if (!pScreenPriv->BlockHandler) { pScreenPriv->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = miSpriteBlockHandler; } } static void miSpriteReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure) { ScreenPtr pScreen = closure; miCursorInfoPtr pCursorInfo; DeviceIntPtr pDev; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && RegionContainsRect(pRegion, &pCursorInfo->saved) != rgnOUT) { SPRITE_DEBUG(("Damage remove\n")); miSpriteRemoveCursor(pDev, pScreen); } } } } /* * miSpriteInitialize -- called from device-dependent screen * initialization proc after all of the function pointers have * been stored in the screen structure. */ Bool miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) { miSpriteScreenPtr pScreenPriv; VisualPtr pVisual; if (!DamageSetup(pScreen)) return FALSE; if (!dixRegisterPrivateKey(&miSpriteScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey (&miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, sizeof(miCursorInfoRec))) return FALSE; pScreenPriv = malloc(sizeof(miSpriteScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->pDamage = DamageCreate(miSpriteReportDamage, NULL, DamageReportRawRegion, TRUE, pScreen, pScreen); if (!miPointerInitialize(pScreen, &miSpritePointerFuncs, screenFuncs, TRUE)) { free(pScreenPriv); return FALSE; } for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++); pScreenPriv->pVisual = pVisual; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->GetImage = pScreen->GetImage; pScreenPriv->GetSpans = pScreen->GetSpans; pScreenPriv->SourceValidate = pScreen->SourceValidate; pScreenPriv->CopyWindow = pScreen->CopyWindow; pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreenPriv->StoreColors = pScreen->StoreColors; pScreenPriv->BlockHandler = NULL; pScreenPriv->pInstalledMap = NULL; pScreenPriv->pColormap = NULL; pScreenPriv->colors[SOURCE_COLOR].red = 0; pScreenPriv->colors[SOURCE_COLOR].green = 0; pScreenPriv->colors[SOURCE_COLOR].blue = 0; pScreenPriv->colors[MASK_COLOR].red = 0; pScreenPriv->colors[MASK_COLOR].green = 0; pScreenPriv->colors[MASK_COLOR].blue = 0; pScreenPriv->damageRegistered = 0; pScreenPriv->numberOfCursors = 0; dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, pScreenPriv); pScreen->CloseScreen = miSpriteCloseScreen; pScreen->GetImage = miSpriteGetImage; pScreen->GetSpans = miSpriteGetSpans; pScreen->SourceValidate = miSpriteSourceValidate; pScreen->CopyWindow = miSpriteCopyWindow; pScreen->InstallColormap = miSpriteInstallColormap; pScreen->StoreColors = miSpriteStoreColors; return TRUE; } /* * Screen wrappers */ /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped function */ static Bool miSpriteCloseScreen(ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->SourceValidate = pScreenPriv->SourceValidate; pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->StoreColors = pScreenPriv->StoreColors; DamageDestroy(pScreenPriv->pDamage); free(pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine) { ScreenPtr pScreen = pDrawable->pScreen; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); SCREEN_PROLOGUE(pPriv, pScreen, GetImage); if (pDrawable->type == DRAWABLE_WINDOW) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y, sx, sy, w, h)) { SPRITE_DEBUG(("GetImage remove\n")); miSpriteRemoveCursor(pDev, pScreen); } } } } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); SCREEN_EPILOGUE(pPriv, pScreen, GetImage); } static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) { ScreenPtr pScreen = pDrawable->pScreen; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); SCREEN_PROLOGUE(pPriv, pScreen, GetSpans); if (pDrawable->type == DRAWABLE_WINDOW) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) { DDXPointPtr pts; int *widths; int nPts; int xorg, yorg; xorg = pDrawable->x; yorg = pDrawable->y; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pCursorInfo->saved, pts->y + yorg, pts->x + xorg, *widths)) { SPRITE_DEBUG(("GetSpans remove\n")); miSpriteRemoveCursor(pDev, pScreen); break; } } } } } } (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); SCREEN_EPILOGUE(pPriv, pScreen, GetSpans); } static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width, int height, unsigned int subWindowMode) { ScreenPtr pScreen = pDrawable->pScreen; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); SCREEN_PROLOGUE(pPriv, pScreen, SourceValidate); if (pDrawable->type == DRAWABLE_WINDOW) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y, x, y, width, height)) { SPRITE_DEBUG(("SourceValidate remove\n")); miSpriteRemoveCursor(pDev, pScreen); } } } } if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode); SCREEN_EPILOGUE(pPriv, pScreen, SourceValidate); } static void miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); SCREEN_PROLOGUE(pPriv, pScreen, CopyWindow); for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); /* * Damage will take care of destination check */ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && RegionContainsRect(prgnSrc, &pCursorInfo->saved) != rgnOUT) { SPRITE_DEBUG(("CopyWindow remove\n")); miSpriteRemoveCursor(pDev, pScreen); } } } (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); SCREEN_EPILOGUE(pPriv, pScreen, CopyWindow); } static void miSpriteBlockHandler(ScreenPtr pScreen, void *timeout) { miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; Bool WorkToDo = FALSE; SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler); for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); if (pCursorInfo && !pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && pCursorInfo->shouldBeUp) { SPRITE_DEBUG(("BlockHandler save")); miSpriteSaveUnderCursor(pDev, pScreen); } } } for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); if (pCursorInfo && !pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && pCursorInfo->shouldBeUp) { SPRITE_DEBUG(("BlockHandler restore\n")); miSpriteRestoreCursor(pDev, pScreen); if (!pCursorInfo->isUp) WorkToDo = TRUE; } } } (*pScreen->BlockHandler) (pScreen, timeout); if (WorkToDo) SCREEN_EPILOGUE(pPriv, pScreen, BlockHandler); else pPriv->BlockHandler = NULL; } static void miSpriteInstallColormap(ColormapPtr pMap) { ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); SCREEN_PROLOGUE(pPriv, pScreen, InstallColormap); (*pScreen->InstallColormap) (pMap); SCREEN_EPILOGUE(pPriv, pScreen, InstallColormap); /* InstallColormap can be called before devices are initialized. */ pPriv->pInstalledMap = pMap; if (pPriv->pColormap != pMap) { DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); pCursorInfo->checkPixels = TRUE; if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) miSpriteRemoveCursor(pDev, pScreen); } } } } static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef) { ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); int i; int updated; VisualPtr pVisual; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; SCREEN_PROLOGUE(pPriv, pScreen, StoreColors); (*pScreen->StoreColors) (pMap, ndef, pdef); SCREEN_EPILOGUE(pPriv, pScreen, StoreColors); if (pPriv->pColormap == pMap) { updated = 0; pVisual = pMap->pVisual; if (pVisual->class == DirectColor) { /* Direct color - match on any of the subfields */ #define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask))) #define UpdateDAC(dev, plane,dac,mask) {\ if (MaskMatch (dev->colors[plane].pixel,pdef[i].pixel,mask)) {\ dev->colors[plane].dac = pdef[i].dac; \ updated = 1; \ } \ } #define CheckDirect(dev, plane) \ UpdateDAC(dev, plane,red,redMask) \ UpdateDAC(dev, plane,green,greenMask) \ UpdateDAC(dev, plane,blue,blueMask) for (i = 0; i < ndef; i++) { CheckDirect(pPriv, SOURCE_COLOR) CheckDirect(pPriv, MASK_COLOR) } } else { /* PseudoColor/GrayScale - match on exact pixel */ for (i = 0; i < ndef; i++) { if (pdef[i].pixel == pPriv->colors[SOURCE_COLOR].pixel) { pPriv->colors[SOURCE_COLOR] = pdef[i]; if (++updated == 2) break; } if (pdef[i].pixel == pPriv->colors[MASK_COLOR].pixel) { pPriv->colors[MASK_COLOR] = pdef[i]; if (++updated == 2) break; } } } if (updated) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pCursorInfo = GetSprite(pDev); pCursorInfo->checkPixels = TRUE; if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) miSpriteRemoveCursor(pDev, pScreen); } } } } } static void miSpriteFindColors(miCursorInfoPtr pDevCursor, ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen); CursorPtr pCursor; xColorItem *sourceColor, *maskColor; pCursor = pDevCursor->pCursor; sourceColor = &pScreenPriv->colors[SOURCE_COLOR]; maskColor = &pScreenPriv->colors[MASK_COLOR]; if (pScreenPriv->pColormap != pScreenPriv->pInstalledMap || !(pCursor->foreRed == sourceColor->red && pCursor->foreGreen == sourceColor->green && pCursor->foreBlue == sourceColor->blue && pCursor->backRed == maskColor->red && pCursor->backGreen == maskColor->green && pCursor->backBlue == maskColor->blue)) { pScreenPriv->pColormap = pScreenPriv->pInstalledMap; sourceColor->red = pCursor->foreRed; sourceColor->green = pCursor->foreGreen; sourceColor->blue = pCursor->foreBlue; FakeAllocColor(pScreenPriv->pColormap, sourceColor); maskColor->red = pCursor->backRed; maskColor->green = pCursor->backGreen; maskColor->blue = pCursor->backBlue; FakeAllocColor(pScreenPriv->pColormap, maskColor); /* "free" the pixels right away, don't let this confuse you */ FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel); FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel); } pDevCursor->checkPixels = FALSE; } /* * miPointer interface routines */ #define SPRITE_PAD 8 static Bool miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { miCursorInfoPtr pCursorInfo; if (IsFloating(pDev)) return FALSE; pCursorInfo = GetSprite(pDev); if (pCursor == pCursorInfo->pCursor) pCursorInfo->checkPixels = TRUE; return miDCRealizeCursor(pScreen, pCursor); } static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return miDCUnrealizeCursor(pScreen, pCursor); } static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { miCursorInfoPtr pPointer; miSpriteScreenPtr pScreenPriv; if (IsFloating(pDev)) return; pPointer = GetSprite(pDev); pScreenPriv = GetSpriteScreen(pScreen); if (!pCursor) { if (pPointer->shouldBeUp) --pScreenPriv->numberOfCursors; pPointer->shouldBeUp = FALSE; if (pPointer->isUp) miSpriteRemoveCursor(pDev, pScreen); if (pScreenPriv->numberOfCursors == 0) miSpriteDisableDamage(pScreen, pScreenPriv); pPointer->pCursor = 0; return; } if (!pPointer->shouldBeUp) pScreenPriv->numberOfCursors++; pPointer->shouldBeUp = TRUE; if (!pPointer->isUp) miSpriteRegisterBlockHandler(pScreen, pScreenPriv); if (pPointer->x == x && pPointer->y == y && pPointer->pCursor == pCursor && !pPointer->checkPixels) { return; } pPointer->x = x; pPointer->y = y; if (pPointer->checkPixels || pPointer->pCursor != pCursor) { pPointer->pCursor = pCursor; miSpriteFindColors(pPointer, pScreen); } if (pPointer->isUp) { /* TODO: reimplement flicker-free MoveCursor */ SPRITE_DEBUG(("SetCursor remove %d\n", pDev->id)); miSpriteRemoveCursor(pDev, pScreen); } if (!pPointer->isUp && pPointer->pCursor) { SPRITE_DEBUG(("SetCursor restore %d\n", pDev->id)); miSpriteSaveUnderCursor(pDev, pScreen); miSpriteRestoreCursor(pDev, pScreen); } } static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { CursorPtr pCursor; if (IsFloating(pDev)) return; pCursor = GetSprite(pDev)->pCursor; miSpriteSetCursor(pDev, pScreen, pCursor, x, y); } static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { int ret = miDCDeviceInitialize(pDev, pScreen); if (ret) { miCursorInfoPtr pCursorInfo; pCursorInfo = dixLookupPrivate(&pDev->devPrivates, &miSpriteDevPrivatesKeyRec); pCursorInfo->pCursor = NULL; pCursorInfo->x = 0; pCursorInfo->y = 0; pCursorInfo->isUp = FALSE; pCursorInfo->shouldBeUp = FALSE; pCursorInfo->checkPixels = TRUE; pCursorInfo->pScreen = FALSE; } return ret; } static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { miCursorInfoPtr pCursorInfo = dixLookupPrivate(&pDev->devPrivates, &miSpriteDevPrivatesKeyRec); if (DevHasCursor(pDev)) miDCDeviceCleanup(pDev, pScreen); memset(pCursorInfo, 0, sizeof(miCursorInfoRec)); } /* * undraw/draw cursor */ static void miSpriteRemoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; if (IsFloating(pDev)) return; DamageDrawInternal(pScreen, TRUE); pScreenPriv = GetSpriteScreen(pScreen); pCursorInfo = GetSprite(pDev); miSpriteIsDown(pCursorInfo); miSpriteRegisterBlockHandler(pScreen, pScreenPriv); miSpriteDisableDamage(pScreen, pScreenPriv); if (!miDCRestoreUnderCursor(pDev, pScreen, pCursorInfo->saved.x1, pCursorInfo->saved.y1, pCursorInfo->saved.x2 - pCursorInfo->saved.x1, pCursorInfo->saved.y2 - pCursorInfo->saved.y1)) { miSpriteIsUp(pCursorInfo); } miSpriteEnableDamage(pScreen, pScreenPriv); DamageDrawInternal(pScreen, FALSE); } /* * Called from the block handler, saves area under cursor * before waiting for something to do. */ static void miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; if (IsFloating(pDev)) return; DamageDrawInternal(pScreen, TRUE); pScreenPriv = GetSpriteScreen(pScreen); pCursorInfo = GetSprite(pDev); miSpriteComputeSaved(pDev, pScreen); miSpriteDisableDamage(pScreen, pScreenPriv); miDCSaveUnderCursor(pDev, pScreen, pCursorInfo->saved.x1, pCursorInfo->saved.y1, pCursorInfo->saved.x2 - pCursorInfo->saved.x1, pCursorInfo->saved.y2 - pCursorInfo->saved.y1); SPRITE_DEBUG(("SaveUnderCursor %d\n", pDev->id)); miSpriteEnableDamage(pScreen, pScreenPriv); DamageDrawInternal(pScreen, FALSE); } /* * Called from the block handler, restores the cursor * before waiting for something to do. */ static void miSpriteRestoreCursor(DeviceIntPtr pDev, ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv; int x, y; CursorPtr pCursor; miCursorInfoPtr pCursorInfo; if (IsFloating(pDev)) return; DamageDrawInternal(pScreen, TRUE); pScreenPriv = GetSpriteScreen(pScreen); pCursorInfo = GetSprite(pDev); miSpriteComputeSaved(pDev, pScreen); pCursor = pCursorInfo->pCursor; x = pCursorInfo->x - (int) pCursor->bits->xhot; y = pCursorInfo->y - (int) pCursor->bits->yhot; miSpriteDisableDamage(pScreen, pScreenPriv); SPRITE_DEBUG(("RestoreCursor %d\n", pDev->id)); if (pCursorInfo->checkPixels) miSpriteFindColors(pCursorInfo, pScreen); if (miDCPutUpCursor(pDev, pScreen, pCursor, x, y, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel)) { miSpriteIsUp(pCursorInfo); pCursorInfo->pScreen = pScreen; } miSpriteEnableDamage(pScreen, pScreenPriv); DamageDrawInternal(pScreen, FALSE); } /* * compute the desired area of the screen to save */ static void miSpriteComputeSaved(DeviceIntPtr pDev, ScreenPtr pScreen) { int x, y, w, h; int wpad, hpad; CursorPtr pCursor; miCursorInfoPtr pCursorInfo; if (IsFloating(pDev)) return; pCursorInfo = GetSprite(pDev); pCursor = pCursorInfo->pCursor; x = pCursorInfo->x - (int) pCursor->bits->xhot; y = pCursorInfo->y - (int) pCursor->bits->yhot; w = pCursor->bits->width; h = pCursor->bits->height; wpad = SPRITE_PAD; hpad = SPRITE_PAD; pCursorInfo->saved.x1 = x - wpad; pCursorInfo->saved.y1 = y - hpad; pCursorInfo->saved.x2 = pCursorInfo->saved.x1 + w + wpad * 2; pCursorInfo->saved.y2 = pCursorInfo->saved.y1 + h + hpad * 2; } xorg-server-1.20.8/mi/mizerarc.c0000644000175000017500000005555513640201473013412 00000000000000/************************************************************ Copyright 1989, 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: Bob Scheifler, MIT X Consortium ********************************************************/ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" * by M. L. V. Pitteway * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "mizerarc.h" #define FULLCIRCLE (360 * 64) #define OCTANT (45 * 64) #define QUADRANT (90 * 64) #define HALFCIRCLE (180 * 64) #define QUADRANT3 (270 * 64) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define Dsin(d) ((d) == 0 ? 0.0 : ((d) == QUADRANT ? 1.0 : \ ((d) == HALFCIRCLE ? 0.0 : \ ((d) == QUADRANT3 ? -1.0 : sin((double)d*(M_PI/11520.0)))))) #define Dcos(d) ((d) == 0 ? 1.0 : ((d) == QUADRANT ? 0.0 : \ ((d) == HALFCIRCLE ? -1.0 : \ ((d) == QUADRANT3 ? 0.0 : cos((double)d*(M_PI/11520.0)))))) #define EPSILON45 64 typedef struct { int skipStart; int haveStart; DDXPointRec startPt; int haveLast; int skipLast; DDXPointRec endPt; int dashIndex; int dashOffset; int dashIndexInit; int dashOffsetInit; } DashInfo; static miZeroArcPtRec oob = { 65536, 65536, 0 }; /* * (x - l)^2 / (W/2)^2 + (y + H/2)^2 / (H/2)^2 = 1 * * where l is either 0 or .5 * * alpha = 4(W^2) * beta = 4(H^2) * gamma = 0 * u = 2(W^2)H * v = 4(H^2)l * k = -4(H^2)(l^2) * */ Bool miZeroArcSetup(xArc * arc, miZeroArcRec * info, Bool ok360) { int l; int angle1, angle2; int startseg, endseg; int startAngle, endAngle; int i, overlap; miZeroArcPtRec start, end; l = arc->width & 1; if (arc->width == arc->height) { info->alpha = 4; info->beta = 4; info->k1 = -8; info->k3 = -16; info->b = 12; info->a = (arc->width << 2) - 12; info->d = 17 - (arc->width << 1); if (l) { info->b -= 4; info->a += 4; info->d -= 7; } } else if (!arc->width || !arc->height) { info->alpha = 0; info->beta = 0; info->k1 = 0; info->k3 = 0; info->a = -(int) arc->height; info->b = 0; info->d = -1; } else { /* initial conditions */ info->alpha = (arc->width * arc->width) << 2; info->beta = (arc->height * arc->height) << 2; info->k1 = info->beta << 1; info->k3 = info->k1 + (info->alpha << 1); info->b = l ? 0 : -info->beta; info->a = info->alpha * arc->height; info->d = info->b - (info->a >> 1) - (info->alpha >> 2); if (l) info->d -= info->beta >> 2; info->a -= info->b; /* take first step, d < 0 always */ info->b -= info->k1; info->a += info->k1; info->d += info->b; /* octant change, b < 0 always */ info->k1 = -info->k1; info->k3 = -info->k3; info->b = -info->b; info->d = info->b - info->a - info->d; info->a = info->a - (info->b << 1); } info->dx = 1; info->dy = 0; info->w = (arc->width + 1) >> 1; info->h = arc->height >> 1; info->xorg = arc->x + (arc->width >> 1); info->yorg = arc->y; info->xorgo = info->xorg + l; info->yorgo = info->yorg + arc->height; if (!arc->width) { if (!arc->height) { info->x = 0; info->y = 0; info->initialMask = 0; info->startAngle = 0; info->endAngle = 0; info->start = oob; info->end = oob; return FALSE; } info->x = 0; info->y = 1; } else { info->x = 1; info->y = 0; } angle1 = arc->angle1; angle2 = arc->angle2; if ((angle1 == 0) && (angle2 >= FULLCIRCLE)) { startAngle = 0; endAngle = 0; } else { if (angle2 > FULLCIRCLE) angle2 = FULLCIRCLE; else if (angle2 < -FULLCIRCLE) angle2 = -FULLCIRCLE; if (angle2 < 0) { startAngle = angle1 + angle2; endAngle = angle1; } else { startAngle = angle1; endAngle = angle1 + angle2; } if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; if (endAngle < 0) endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE; if (endAngle >= FULLCIRCLE) endAngle = endAngle % FULLCIRCLE; } info->startAngle = startAngle; info->endAngle = endAngle; if (ok360 && (startAngle == endAngle) && arc->angle2 && arc->width && arc->height) { info->initialMask = 0xf; info->start = oob; info->end = oob; return TRUE; } startseg = startAngle / OCTANT; if (!arc->height || (((startseg + 1) & 2) && arc->width)) { start.x = Dcos(startAngle) * ((arc->width + 1) / 2.0); if (start.x < 0) start.x = -start.x; start.y = -1; } else { start.y = Dsin(startAngle) * (arc->height / 2.0); if (start.y < 0) start.y = -start.y; start.y = info->h - start.y; start.x = 65536; } endseg = endAngle / OCTANT; if (!arc->height || (((endseg + 1) & 2) && arc->width)) { end.x = Dcos(endAngle) * ((arc->width + 1) / 2.0); if (end.x < 0) end.x = -end.x; end.y = -1; } else { end.y = Dsin(endAngle) * (arc->height / 2.0); if (end.y < 0) end.y = -end.y; end.y = info->h - end.y; end.x = 65536; } info->firstx = start.x; info->firsty = start.y; info->initialMask = 0; overlap = arc->angle2 && (endAngle <= startAngle); for (i = 0; i < 4; i++) { if (overlap ? ((i * QUADRANT <= endAngle) || ((i + 1) * QUADRANT > startAngle)) : ((i * QUADRANT <= endAngle) && ((i + 1) * QUADRANT > startAngle))) info->initialMask |= (1 << i); } start.mask = info->initialMask; end.mask = info->initialMask; startseg >>= 1; endseg >>= 1; overlap = overlap && (endseg == startseg); if (start.x != end.x || start.y != end.y || !overlap) { if (startseg & 1) { if (!overlap) info->initialMask &= ~(1 << startseg); if (start.x > end.x || start.y > end.y) end.mask &= ~(1 << startseg); } else { start.mask &= ~(1 << startseg); if (((start.x < end.x || start.y < end.y) || (start.x == end.x && start.y == end.y && (endseg & 1))) && !overlap) end.mask &= ~(1 << startseg); } if (endseg & 1) { end.mask &= ~(1 << endseg); if (((start.x > end.x || start.y > end.y) || (start.x == end.x && start.y == end.y && !(startseg & 1))) && !overlap) start.mask &= ~(1 << endseg); } else { if (!overlap) info->initialMask &= ~(1 << endseg); if (start.x < end.x || start.y < end.y) start.mask &= ~(1 << endseg); } } /* take care of case when start and stop are both near 45 */ /* handle here rather than adding extra code to pixelization loops */ if (startAngle && ((start.y < 0 && end.y >= 0) || (start.y >= 0 && end.y < 0))) { i = (startAngle + OCTANT) % OCTANT; if (i < EPSILON45 || i > OCTANT - EPSILON45) { i = (endAngle + OCTANT) % OCTANT; if (i < EPSILON45 || i > OCTANT - EPSILON45) { if (start.y < 0) { i = Dsin(startAngle) * (arc->height / 2.0); if (i < 0) i = -i; if (info->h - i == end.y) start.mask = end.mask; } else { i = Dsin(endAngle) * (arc->height / 2.0); if (i < 0) i = -i; if (info->h - i == start.y) end.mask = start.mask; } } } } if (startseg & 1) { info->start = start; info->end = oob; } else { info->end = start; info->start = oob; } if (endseg & 1) { info->altend = end; if (info->altend.x < info->end.x || info->altend.y < info->end.y) { miZeroArcPtRec tmp; tmp = info->altend; info->altend = info->end; info->end = tmp; } info->altstart = oob; } else { info->altstart = end; if (info->altstart.x < info->start.x || info->altstart.y < info->start.y) { miZeroArcPtRec tmp; tmp = info->altstart; info->altstart = info->start; info->start = tmp; } info->altend = oob; } if (!info->start.x || !info->start.y) { info->initialMask = info->start.mask; info->start = info->altstart; } if (!arc->width && (arc->height == 1)) { /* kludge! */ info->initialMask |= info->end.mask; info->initialMask |= info->initialMask << 1; info->end.x = 0; info->end.mask = 0; } return FALSE; } #define Pixelate(xval,yval) \ { \ pts->x = xval; \ pts->y = yval; \ pts++; \ } #define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval); static DDXPointPtr miZeroArcPts(xArc * arc, DDXPointPtr pts) { miZeroArcRec info; int x, y, a, b, d, mask; int k1, k3, dx, dy; Bool do360; do360 = miZeroArcSetup(arc, &info, TRUE); MIARCSETUP(); mask = info.initialMask; if (!(arc->width & 1)) { DoPix(1, info.xorgo, info.yorg); DoPix(3, info.xorgo, info.yorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { int yorgh = info.yorg + info.h; int xorghp = info.xorg + info.h; int xorghn = info.xorg - info.h; while (1) { Pixelate(info.xorg + x, info.yorg + y); Pixelate(info.xorg - x, info.yorg + y); Pixelate(info.xorg - x, info.yorgo - y); Pixelate(info.xorg + x, info.yorgo - y); if (a < 0) break; Pixelate(xorghp - y, yorgh - x); Pixelate(xorghn + y, yorgh - x); Pixelate(xorghn + y, yorgh + x); Pixelate(xorghp - y, yorgh + x); MIARCCIRCLESTEP(; ); } if (x > 1 && pts[-1].x == pts[-5].x && pts[-1].y == pts[-5].y) pts -= 4; x = info.w; y = info.h; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(; ); Pixelate(info.xorg + x, info.yorg + y); Pixelate(info.xorgo - x, info.yorg + y); Pixelate(info.xorgo - x, info.yorgo - y); Pixelate(info.xorg + x, info.yorgo - y); MIARCSTEP(; ,; ); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(; ); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(0, info.xorg + x, info.yorg + y); DoPix(1, info.xorgo - x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); DoPix(3, info.xorg + x, info.yorgo - y); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(; ,; ); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(0, info.xorg + x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); if (arc->height & 1) { DoPix(1, info.xorgo - x, info.yorg + y); DoPix(3, info.xorg + x, info.yorgo - y); } return pts; } #undef DoPix #define DoPix(idx,xval,yval) \ if (mask & (1 << idx)) \ { \ arcPts[idx]->x = xval; \ arcPts[idx]->y = yval; \ arcPts[idx]++; \ } static void miZeroArcDashPts(GCPtr pGC, xArc * arc, DashInfo * dinfo, DDXPointPtr points, int maxPts, DDXPointPtr * evenPts, DDXPointPtr * oddPts) { miZeroArcRec info; int x, y, a, b, d, mask; int k1, k3, dx, dy; int dashRemaining; DDXPointPtr arcPts[4]; DDXPointPtr startPts[5], endPts[5]; int deltas[5]; DDXPointPtr startPt, pt, lastPt, pts; int i, j, delta, ptsdelta, seg, startseg; for (i = 0; i < 4; i++) arcPts[i] = points + (i * maxPts); (void) miZeroArcSetup(arc, &info, FALSE); MIARCSETUP(); mask = info.initialMask; startseg = info.startAngle / QUADRANT; startPt = arcPts[startseg]; if (!(arc->width & 1)) { DoPix(1, info.xorgo, info.yorg); DoPix(3, info.xorgo, info.yorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(; ); if ((x == info.firstx) || (y == info.firsty)) startPt = arcPts[startseg]; if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(0, info.xorg + x, info.yorg + y); DoPix(1, info.xorgo - x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); DoPix(3, info.xorg + x, info.yorgo - y); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(; ,; ); } if ((x == info.firstx) || (y == info.firsty)) startPt = arcPts[startseg]; if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(0, info.xorg + x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); if (arc->height & 1) { DoPix(1, info.xorgo - x, info.yorg + y); DoPix(3, info.xorg + x, info.yorgo - y); } for (i = 0; i < 4; i++) { seg = (startseg + i) & 3; pt = points + (seg * maxPts); if (seg & 1) { startPts[i] = pt; endPts[i] = arcPts[seg]; deltas[i] = 1; } else { startPts[i] = arcPts[seg] - 1; endPts[i] = pt - 1; deltas[i] = -1; } } startPts[4] = startPts[0]; endPts[4] = startPt; startPts[0] = startPt; if (startseg & 1) { if (startPts[4] != endPts[4]) endPts[4]--; deltas[4] = 1; } else { if (startPts[0] > startPts[4]) startPts[0]--; if (startPts[4] < endPts[4]) endPts[4]--; deltas[4] = -1; } if (arc->angle2 < 0) { DDXPointPtr tmps, tmpe; int tmpd; tmpd = deltas[0]; tmps = startPts[0] - tmpd; tmpe = endPts[0] - tmpd; startPts[0] = endPts[4] - deltas[4]; endPts[0] = startPts[4] - deltas[4]; deltas[0] = -deltas[4]; startPts[4] = tmpe; endPts[4] = tmps; deltas[4] = -tmpd; tmpd = deltas[1]; tmps = startPts[1] - tmpd; tmpe = endPts[1] - tmpd; startPts[1] = endPts[3] - deltas[3]; endPts[1] = startPts[3] - deltas[3]; deltas[1] = -deltas[3]; startPts[3] = tmpe; endPts[3] = tmps; deltas[3] = -tmpd; tmps = startPts[2] - deltas[2]; startPts[2] = endPts[2] - deltas[2]; endPts[2] = tmps; deltas[2] = -deltas[2]; } for (i = 0; i < 5 && startPts[i] == endPts[i]; i++); if (i == 5) return; pt = startPts[i]; for (j = 4; startPts[j] == endPts[j]; j--); lastPt = endPts[j] - deltas[j]; if (dinfo->haveLast && (pt->x == dinfo->endPt.x) && (pt->y == dinfo->endPt.y)) { startPts[i] += deltas[i]; } else { dinfo->dashIndex = dinfo->dashIndexInit; dinfo->dashOffset = dinfo->dashOffsetInit; } if (!dinfo->skipStart && (info.startAngle != info.endAngle)) { dinfo->startPt = *pt; dinfo->haveStart = TRUE; } else if (!dinfo->skipLast && dinfo->haveStart && (lastPt->x == dinfo->startPt.x) && (lastPt->y == dinfo->startPt.y) && (lastPt != startPts[i])) endPts[j] = lastPt; if (info.startAngle != info.endAngle) { dinfo->haveLast = TRUE; dinfo->endPt = *lastPt; } dashRemaining = pGC->dash[dinfo->dashIndex] - dinfo->dashOffset; for (i = 0; i < 5; i++) { pt = startPts[i]; lastPt = endPts[i]; delta = deltas[i]; while (pt != lastPt) { if (dinfo->dashIndex & 1) { pts = *oddPts; ptsdelta = -1; } else { pts = *evenPts; ptsdelta = 1; } while ((pt != lastPt) && --dashRemaining >= 0) { *pts = *pt; pts += ptsdelta; pt += delta; } if (dinfo->dashIndex & 1) *oddPts = pts; else *evenPts = pts; if (dashRemaining <= 0) { if (++(dinfo->dashIndex) == pGC->numInDashList) dinfo->dashIndex = 0; dashRemaining = pGC->dash[dinfo->dashIndex]; } } } dinfo->dashOffset = pGC->dash[dinfo->dashIndex] - dashRemaining; } void miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) { int maxPts = 0; int n, maxw = 0; xArc *arc; int i; DDXPointPtr points, pts, oddPts = NULL; DDXPointPtr pt; int numPts; Bool dospans; int *widths = NULL; XID fgPixel = pGC->fgPixel; DashInfo dinfo; for (arc = parcs, i = narcs; --i >= 0; arc++) { if (!miCanZeroArc(arc)) miWideArc(pDraw, pGC, 1, arc); else { if (arc->width > arc->height) n = arc->width + (arc->height >> 1); else n = arc->height + (arc->width >> 1); if (n > maxPts) maxPts = n; } } if (!maxPts) return; numPts = maxPts << 2; dospans = (pGC->fillStyle != FillSolid); if (dospans) { widths = xallocarray(numPts, sizeof(int)); if (!widths) return; maxw = 0; } if (pGC->lineStyle != LineSolid) { numPts <<= 1; dinfo.haveStart = FALSE; dinfo.skipStart = FALSE; dinfo.haveLast = FALSE; dinfo.dashIndexInit = 0; dinfo.dashOffsetInit = 0; miStepDash((int) pGC->dashOffset, &dinfo.dashIndexInit, (unsigned char *) pGC->dash, (int) pGC->numInDashList, &dinfo.dashOffsetInit); } points = xallocarray(numPts, sizeof(DDXPointRec)); if (!points) { if (dospans) { free(widths); } return; } for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miCanZeroArc(arc)) { if (pGC->lineStyle == LineSolid) pts = miZeroArcPts(arc, points); else { pts = points; oddPts = &points[(numPts >> 1) - 1]; dinfo.skipLast = i; miZeroArcDashPts(pGC, arc, &dinfo, oddPts + 1, maxPts, &pts, &oddPts); dinfo.skipStart = TRUE; } n = pts - points; if (!dospans) (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, n, points); else { if (n > maxw) { while (maxw < n) widths[maxw++] = 1; } if (pGC->miTranslate) { for (pt = points; pt != pts; pt++) { pt->x += pDraw->x; pt->y += pDraw->y; } } (*pGC->ops->FillSpans) (pDraw, pGC, n, points, widths, FALSE); } if (pGC->lineStyle != LineDoubleDash) continue; if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) { ChangeGCVal gcval; gcval.val = pGC->bgPixel; ChangeGC(NullClient, pGC, GCForeground, &gcval); ValidateGC(pDraw, pGC); } pts = &points[numPts >> 1]; oddPts++; n = pts - oddPts; if (!dospans) (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, n, oddPts); else { if (n > maxw) { while (maxw < n) widths[maxw++] = 1; } if (pGC->miTranslate) { for (pt = oddPts; pt != pts; pt++) { pt->x += pDraw->x; pt->y += pDraw->y; } } (*pGC->ops->FillSpans) (pDraw, pGC, n, oddPts, widths, FALSE); } if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) { ChangeGCVal gcval; gcval.val = fgPixel; ChangeGC(NullClient, pGC, GCForeground, &gcval); ValidateGC(pDraw, pGC); } } } free(points); if (dospans) { free(widths); } } xorg-server-1.20.8/mi/Makefile.in0000644000175000017500000010372213640201515013462 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = mi ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmi_la_LIBADD = am_libmi_la_OBJECTS = miarc.lo mibitblt.lo micmap.lo micopy.lo \ midash.lo midispcur.lo mieq.lo miexpose.lo mifillarc.lo \ mifillrct.lo migc.lo miglblt.lo mioverlay.lo mipointer.lo \ mipoly.lo mipolypnt.lo mipolyrect.lo mipolyseg.lo \ mipolytext.lo mipushpxl.lo miscrinit.lo misprite.lo \ mivaltree.lo miwideline.lo miwindow.lo mizerarc.lo \ mizerclip.lo mizerline.lo libmi_la_OBJECTS = $(am_libmi_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/miarc.Plo ./$(DEPDIR)/mibitblt.Plo \ ./$(DEPDIR)/micmap.Plo ./$(DEPDIR)/micopy.Plo \ ./$(DEPDIR)/midash.Plo ./$(DEPDIR)/midispcur.Plo \ ./$(DEPDIR)/mieq.Plo ./$(DEPDIR)/miexpose.Plo \ ./$(DEPDIR)/mifillarc.Plo ./$(DEPDIR)/mifillrct.Plo \ ./$(DEPDIR)/migc.Plo ./$(DEPDIR)/miglblt.Plo \ ./$(DEPDIR)/mioverlay.Plo ./$(DEPDIR)/mipointer.Plo \ ./$(DEPDIR)/mipoly.Plo ./$(DEPDIR)/mipolypnt.Plo \ ./$(DEPDIR)/mipolyrect.Plo ./$(DEPDIR)/mipolyseg.Plo \ ./$(DEPDIR)/mipolytext.Plo ./$(DEPDIR)/mipushpxl.Plo \ ./$(DEPDIR)/miscrinit.Plo ./$(DEPDIR)/misprite.Plo \ ./$(DEPDIR)/mivaltree.Plo ./$(DEPDIR)/miwideline.Plo \ ./$(DEPDIR)/miwindow.Plo ./$(DEPDIR)/mizerarc.Plo \ ./$(DEPDIR)/mizerclip.Plo ./$(DEPDIR)/mizerline.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmi_la_SOURCES) DIST_SOURCES = $(libmi_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__sdk_HEADERS_DIST = micmap.h miline.h mipointer.h mi.h migc.h \ mipointrst.h mizerarc.h micoord.h mistruct.h mioverlay.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libmi.la @XORG_TRUE@sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \ @XORG_TRUE@ migc.h mipointrst.h mizerarc.h micoord.h \ @XORG_TRUE@ mistruct.h mioverlay.h AM_CFLAGS = $(DIX_CFLAGS) libmi_la_SOURCES = \ mi.h \ miarc.c \ mibitblt.c \ micmap.c \ micmap.h \ micoord.h \ micopy.c \ midash.c \ midispcur.c \ mieq.c \ miexpose.c \ mifillarc.c \ mifillarc.h \ mifillrct.c \ mifpoly.h \ migc.c \ migc.h \ miglblt.c \ miline.h \ mioverlay.c \ mioverlay.h \ mipointer.c \ mipointer.h \ mipointrst.h \ mipoly.c \ mipoly.h \ mipolypnt.c \ mipolyrect.c \ mipolyseg.c \ mipolytext.c \ mipushpxl.c \ miscanfill.h \ miscrinit.c \ misprite.c \ misprite.h \ mistruct.h \ mivaltree.c \ mivalidate.h \ miwideline.c \ miwideline.h \ miwindow.c \ mizerarc.c \ mizerarc.h \ mizerclip.c \ mizerline.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mi/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign mi/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libmi.la: $(libmi_la_OBJECTS) $(libmi_la_DEPENDENCIES) $(EXTRA_libmi_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libmi_la_OBJECTS) $(libmi_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miarc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mibitblt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/micmap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/micopy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midash.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midispcur.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mieq.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miexpose.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mifillarc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mifillrct.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/migc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miglblt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mioverlay.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipointer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipoly.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipolypnt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipolyrect.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipolyseg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipolytext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipushpxl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miscrinit.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misprite.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mivaltree.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miwideline.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miwindow.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mizerarc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mizerclip.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mizerline.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/miarc.Plo -rm -f ./$(DEPDIR)/mibitblt.Plo -rm -f ./$(DEPDIR)/micmap.Plo -rm -f ./$(DEPDIR)/micopy.Plo -rm -f ./$(DEPDIR)/midash.Plo -rm -f ./$(DEPDIR)/midispcur.Plo -rm -f ./$(DEPDIR)/mieq.Plo -rm -f ./$(DEPDIR)/miexpose.Plo -rm -f ./$(DEPDIR)/mifillarc.Plo -rm -f ./$(DEPDIR)/mifillrct.Plo -rm -f ./$(DEPDIR)/migc.Plo -rm -f ./$(DEPDIR)/miglblt.Plo -rm -f ./$(DEPDIR)/mioverlay.Plo -rm -f ./$(DEPDIR)/mipointer.Plo -rm -f ./$(DEPDIR)/mipoly.Plo -rm -f ./$(DEPDIR)/mipolypnt.Plo -rm -f ./$(DEPDIR)/mipolyrect.Plo -rm -f ./$(DEPDIR)/mipolyseg.Plo -rm -f ./$(DEPDIR)/mipolytext.Plo -rm -f ./$(DEPDIR)/mipushpxl.Plo -rm -f ./$(DEPDIR)/miscrinit.Plo -rm -f ./$(DEPDIR)/misprite.Plo -rm -f ./$(DEPDIR)/mivaltree.Plo -rm -f ./$(DEPDIR)/miwideline.Plo -rm -f ./$(DEPDIR)/miwindow.Plo -rm -f ./$(DEPDIR)/mizerarc.Plo -rm -f ./$(DEPDIR)/mizerclip.Plo -rm -f ./$(DEPDIR)/mizerline.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/miarc.Plo -rm -f ./$(DEPDIR)/mibitblt.Plo -rm -f ./$(DEPDIR)/micmap.Plo -rm -f ./$(DEPDIR)/micopy.Plo -rm -f ./$(DEPDIR)/midash.Plo -rm -f ./$(DEPDIR)/midispcur.Plo -rm -f ./$(DEPDIR)/mieq.Plo -rm -f ./$(DEPDIR)/miexpose.Plo -rm -f ./$(DEPDIR)/mifillarc.Plo -rm -f ./$(DEPDIR)/mifillrct.Plo -rm -f ./$(DEPDIR)/migc.Plo -rm -f ./$(DEPDIR)/miglblt.Plo -rm -f ./$(DEPDIR)/mioverlay.Plo -rm -f ./$(DEPDIR)/mipointer.Plo -rm -f ./$(DEPDIR)/mipoly.Plo -rm -f ./$(DEPDIR)/mipolypnt.Plo -rm -f ./$(DEPDIR)/mipolyrect.Plo -rm -f ./$(DEPDIR)/mipolyseg.Plo -rm -f ./$(DEPDIR)/mipolytext.Plo -rm -f ./$(DEPDIR)/mipushpxl.Plo -rm -f ./$(DEPDIR)/miscrinit.Plo -rm -f ./$(DEPDIR)/misprite.Plo -rm -f ./$(DEPDIR)/mivaltree.Plo -rm -f ./$(DEPDIR)/miwideline.Plo -rm -f ./$(DEPDIR)/miwindow.Plo -rm -f ./$(DEPDIR)/mizerarc.Plo -rm -f ./$(DEPDIR)/mizerclip.Plo -rm -f ./$(DEPDIR)/mizerline.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/mi/migc.c0000644000175000017500000001543613640201473012507 00000000000000/* Copyright 1993, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "migc.h" /* ARGSUSED */ void miChangeGC(GCPtr pGC, unsigned long mask) { return; } void miDestroyGC(GCPtr pGC) { if (pGC->freeCompClip) RegionDestroy(pGC->pCompositeClip); } void miDestroyClip(GCPtr pGC) { if (pGC->clientClip) RegionDestroy(pGC->clientClip); pGC->clientClip = NULL; } void miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { (*pGC->funcs->DestroyClip) (pGC); if (type == CT_PIXMAP) { /* convert the pixmap to a region */ pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue); (*pGC->pScreen->DestroyPixmap) (pvalue); } else if (type == CT_REGION) { /* stuff the region in the GC */ pGC->clientClip = pvalue; } else if (type != CT_NONE) { pGC->clientClip = RegionFromRects(nrects, (xRectangle *) pvalue, type); free(pvalue); } pGC->stateChanges |= GCClipMask; } void miCopyClip(GCPtr pgcDst, GCPtr pgcSrc) { if (pgcSrc->clientClip) { RegionPtr prgnNew = RegionCreate(NULL, 1); RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip)); (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, prgnNew, 0); } else { (*pgcDst->funcs->ChangeClip) (pgcDst, CT_NONE, NULL, 0); } } /* ARGSUSED */ void miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst) { return; } void miComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable) { if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDrawable; RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if (pGC->subWindowMode == IncludeInferiors) { pregWin = NotClippedByChildren(pWin); freeTmpClip = TRUE; } else { pregWin = &pWin->clipList; freeTmpClip = FALSE; } freeCompClip = pGC->freeCompClip; /* * if there is no client clip, we can get by with just keeping the * pointer we got, and remembering whether or not should destroy (or * maybe re-use) it later. this way, we avoid unnecessary copying of * regions. (this wins especially if many clients clip by children * and have no client clip.) */ if (!pGC->clientClip) { if (freeCompClip) RegionDestroy(pGC->pCompositeClip); pGC->pCompositeClip = pregWin; pGC->freeCompClip = freeTmpClip; } else { /* * we need one 'real' region to put into the composite clip. if * pregWin the current composite clip are real, we can get rid of * one. if pregWin is real and the current composite clip isn't, * use pregWin for the composite clip. if the current composite * clip is real and pregWin isn't, use the current composite * clip. if neither is real, create a new region. */ RegionTranslate(pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); if (freeCompClip) { RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) RegionDestroy(pregWin); } else if (freeTmpClip) { RegionIntersect(pregWin, pregWin, pGC->clientClip); pGC->pCompositeClip = pregWin; } else { pGC->pCompositeClip = RegionCreate(NullBox, 0); RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); } pGC->freeCompClip = TRUE; RegionTranslate(pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); } } /* end of composite clip for a window */ else { BoxRec pixbounds; /* XXX should we translate by drawable.x/y here ? */ /* If you want pixmaps in offscreen memory, yes */ pixbounds.x1 = pDrawable->x; pixbounds.y1 = pDrawable->y; pixbounds.x2 = pDrawable->x + pDrawable->width; pixbounds.y2 = pDrawable->y + pDrawable->height; if (pGC->freeCompClip) { RegionReset(pGC->pCompositeClip, &pixbounds); } else { pGC->freeCompClip = TRUE; pGC->pCompositeClip = RegionCreate(&pixbounds, 1); } if (pGC->clientClip) { if (pDrawable->x || pDrawable->y) { RegionTranslate(pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); RegionIntersect(pGC->pCompositeClip, pGC->pCompositeClip, pGC->clientClip); RegionTranslate(pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); } else { RegionTranslate(pGC->pCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); RegionIntersect(pGC->pCompositeClip, pGC->pCompositeClip, pGC->clientClip); RegionTranslate(pGC->pCompositeClip, pGC->clipOrg.x, pGC->clipOrg.y); } } } /* end of composite clip for pixmap */ } /* end miComputeCompositeClip */ xorg-server-1.20.8/mi/micmap.c0000644000175000017500000004224713640201473013036 00000000000000/* * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 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 is based on cfbcmap.c. The functions here are useful independently * of cfb, which is the reason for including them here. How "mi" these * are may be debatable. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" #include "globals.h" #include "micmap.h" DevPrivateKeyRec micmapScrPrivateKeyRec; int miListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps) { if (GetInstalledmiColormap(pScreen)) { *pmaps = GetInstalledmiColormap(pScreen)->mid; return 1; } return 0; } void miInstallColormap(ColormapPtr pmap) { ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen); if (pmap != oldpmap) { /* Uninstall pInstalledMap. No hardware changes required, just * notify all interested parties. */ if (oldpmap != (ColormapPtr) None) WalkTree(pmap->pScreen, TellLostMap, (char *) &oldpmap->mid); /* Install pmap */ SetInstalledmiColormap(pmap->pScreen, pmap); WalkTree(pmap->pScreen, TellGainedMap, (char *) &pmap->mid); } } void miUninstallColormap(ColormapPtr pmap) { ColormapPtr curpmap = GetInstalledmiColormap(pmap->pScreen); if (pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { dixLookupResourceByType((void **) &curpmap, pmap->pScreen->defColormap, RT_COLORMAP, serverClient, DixUseAccess); (*pmap->pScreen->InstallColormap) (curpmap); } } } void miResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual) { int shift = 16 - pVisual->bitsPerRGBValue; unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1; if ((pVisual->class | DynamicClass) == GrayScale) { /* rescale to gray then rgb bits */ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; } else { /* rescale to rgb bits */ *pred = ((*pred >> shift) * 65535) / lim; *pgreen = ((*pgreen >> shift) * 65535) / lim; *pblue = ((*pblue >> shift) * 65535) / lim; } } Bool miInitializeColormap(ColormapPtr pmap) { unsigned i; VisualPtr pVisual; unsigned lim, maxent, shift; pVisual = pmap->pVisual; lim = (1 << pVisual->bitsPerRGBValue) - 1; shift = 16 - pVisual->bitsPerRGBValue; maxent = pVisual->ColormapEntries - 1; if (pVisual->class == TrueColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for (i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / limr) >> shift) * 65535) / lim; pmap->green[i].co.local.green = ((((i * 65535) / limg) >> shift) * 65535) / lim; pmap->blue[i].co.local.blue = ((((i * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for (i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((((i & pVisual->redMask) >> pVisual->offsetRed) * 65535) / limr) >> shift) * 65535) / lim; pmap->red[i].co.local.green = ((((((i & pVisual->greenMask) >> pVisual->offsetGreen) * 65535) / limg) >> shift) * 65535) / lim; pmap->red[i].co.local.blue = ((((((i & pVisual->blueMask) >> pVisual->offsetBlue) * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticGray) { for (i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift) * 65535) / lim; pmap->red[i].co.local.green = pmap->red[i].co.local.red; pmap->red[i].co.local.blue = pmap->red[i].co.local.red; } } return TRUE; } /* When simulating DirectColor on PseudoColor hardware, multiple entries of the colormap must be updated */ #define AddElement(mask) { \ pixel = red | green | blue; \ for (i = 0; i < nresult; i++) \ if (outdefs[i].pixel == pixel) \ break; \ if (i == nresult) \ { \ nresult++; \ outdefs[i].pixel = pixel; \ outdefs[i].flags = 0; \ } \ outdefs[i].flags |= (mask); \ outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \ outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \ outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \ } int miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem * indefs, xColorItem * outdefs) { int red, green, blue; int maxred, maxgreen, maxblue; int stepred, stepgreen, stepblue; VisualPtr pVisual; int pixel; int nresult; int i; pVisual = pmap->pVisual; stepred = 1 << pVisual->offsetRed; stepgreen = 1 << pVisual->offsetGreen; stepblue = 1 << pVisual->offsetBlue; maxred = pVisual->redMask; maxgreen = pVisual->greenMask; maxblue = pVisual->blueMask; nresult = 0; for (; ndef--; indefs++) { if (indefs->flags & DoRed) { red = indefs->pixel & pVisual->redMask; for (green = 0; green <= maxgreen; green += stepgreen) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement(DoRed) } } } if (indefs->flags & DoGreen) { green = indefs->pixel & pVisual->greenMask; for (red = 0; red <= maxred; red += stepred) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement(DoGreen) } } } if (indefs->flags & DoBlue) { blue = indefs->pixel & pVisual->blueMask; for (red = 0; red <= maxred; red += stepred) { for (green = 0; green <= maxgreen; green += stepgreen) { AddElement(DoBlue) } } } } return nresult; } Bool miCreateDefColormap(ScreenPtr pScreen) { unsigned short zero = 0, ones = 0xFFFF; Pixel wp, bp; VisualPtr pVisual; ColormapPtr cmap; int alloctype; if (!dixRegisterPrivateKey(&micmapScrPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++); if (pScreen->rootDepth == 1 || (pVisual->class & DynamicClass)) alloctype = AllocNone; else alloctype = AllocAll; if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, alloctype, 0) != Success) return FALSE; if (pScreen->rootDepth > 1) { wp = pScreen->whitePixel; bp = pScreen->blackPixel; if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != Success)) return FALSE; pScreen->whitePixel = wp; pScreen->blackPixel = bp; } (*pScreen->InstallColormap) (cmap); return TRUE; } /* * Default true color bitmasks, should be overridden by * driver */ #define _RZ(d) ((d + 2) / 3) #define _RS(d) 0 #define _RM(d) ((1 << _RZ(d)) - 1) #define _GZ(d) ((d - _RZ(d) + 1) / 2) #define _GS(d) _RZ(d) #define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d)) #define _BZ(d) (d - _RZ(d) - _GZ(d)) #define _BS(d) (_RZ(d) + _GZ(d)) #define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d)) #define _CE(d) (1 << _RZ(d)) typedef struct _miVisuals { struct _miVisuals *next; int depth; int bitsPerRGB; int visuals; int count; int preferredCVC; Pixel redMask, greenMask, blueMask; } miVisualsRec, *miVisualsPtr; static int miVisualPriority[] = { PseudoColor, GrayScale, StaticColor, TrueColor, DirectColor, StaticGray }; #define NUM_PRIORITY 6 static miVisualsPtr miVisuals; void miClearVisualTypes(void) { miVisualsPtr v; while ((v = miVisuals)) { miVisuals = v->next; free(v); } } Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, int preferredCVC, Pixel redMask, Pixel greenMask, Pixel blueMask) { miVisualsPtr new, *prev, v; int count; new = malloc(sizeof *new); if (!new) return FALSE; if (!redMask || !greenMask || !blueMask) { redMask = _RM(depth); greenMask = _GM(depth); blueMask = _BM(depth); } new->next = 0; new->depth = depth; new->visuals = visuals; new->bitsPerRGB = bitsPerRGB; new->preferredCVC = preferredCVC; new->redMask = redMask; new->greenMask = greenMask; new->blueMask = blueMask; count = (visuals >> 1) & 033333333333; count = visuals - count - ((count >> 1) & 033333333333); count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */ new->count = count; for (prev = &miVisuals; (v = *prev); prev = &v->next); *prev = new; return TRUE; } Bool miSetVisualTypes(int depth, int visuals, int bitsPerRGB, int preferredCVC) { return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, preferredCVC, 0, 0, 0); } int miGetDefaultVisualMask(int depth) { if (depth > MAX_PSEUDO_DEPTH) return LARGE_VISUALS; else if (depth >= MIN_TRUE_DEPTH) return ALL_VISUALS; else if (depth == 1) return StaticGrayMask; else return SMALL_VISUALS; } static Bool miVisualTypesSet(int depth) { miVisualsPtr visuals; for (visuals = miVisuals; visuals; visuals = visuals->next) if (visuals->depth == depth) return TRUE; return FALSE; } Bool miSetPixmapDepths(void) { int d, f; /* Add any unlisted depths from the pixmap formats */ for (f = 0; f < screenInfo.numPixmapFormats; f++) { d = screenInfo.formats[f].depth; if (!miVisualTypesSet(d)) { if (!miSetVisualTypes(d, 0, 0, -1)) return FALSE; } } return TRUE; } /* * Distance to least significant one bit */ static int maskShift(Pixel p) { int s; if (!p) return 0; s = 0; while (!(p & 1)) { s++; p >>= 1; } return s; } /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which corespond to * the set which can be used with this version of cfb. */ Bool miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB, int preferredVis) { int i, j = 0, k; VisualPtr visual; DepthPtr depth; VisualID *vid; int d, b; int f; int ndepth, nvisual; int nvtype; int vtype; miVisualsPtr visuals, nextVisuals; int *preferredCVCs, *prefp; int first_depth; /* none specified, we'll guess from pixmap formats */ if (!miVisuals) { for (f = 0; f < screenInfo.numPixmapFormats; f++) { d = screenInfo.formats[f].depth; b = screenInfo.formats[f].bitsPerPixel; if (sizes & (1 << (b - 1))) vtype = miGetDefaultVisualMask(d); else vtype = 0; if (!miSetVisualTypes(d, vtype, bitsPerRGB, -1)) return FALSE; } } nvisual = 0; ndepth = 0; for (visuals = miVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; ndepth++; nvisual += visuals->count; } depth = xallocarray(ndepth, sizeof(DepthRec)); visual = xallocarray(nvisual, sizeof(VisualRec)); preferredCVCs = xallocarray(ndepth, sizeof(int)); if (!depth || !visual || !preferredCVCs) { free(depth); free(visual); free(preferredCVCs); return FALSE; } *depthp = depth; *visualp = visual; *ndepthp = ndepth; *nvisualp = nvisual; prefp = preferredCVCs; for (visuals = miVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; d = visuals->depth; vtype = visuals->visuals; nvtype = visuals->count; *prefp = visuals->preferredCVC; prefp++; vid = NULL; if (nvtype) { vid = xallocarray(nvtype, sizeof(VisualID)); if (!vid) { free(depth); free(visual); free(preferredCVCs); return FALSE; } } depth->depth = d; depth->numVids = nvtype; depth->vids = vid; depth++; for (i = 0; i < NUM_PRIORITY; i++) { if (!(vtype & (1 << miVisualPriority[i]))) continue; visual->class = miVisualPriority[i]; visual->bitsPerRGBValue = visuals->bitsPerRGB; visual->ColormapEntries = 1 << d; visual->nplanes = d; visual->vid = *vid = FakeClientID(0); switch (visual->class) { case PseudoColor: case GrayScale: case StaticGray: visual->redMask = 0; visual->greenMask = 0; visual->blueMask = 0; visual->offsetRed = 0; visual->offsetGreen = 0; visual->offsetBlue = 0; break; case DirectColor: case TrueColor: visual->ColormapEntries = _CE(d); /* fall through */ case StaticColor: visual->redMask = visuals->redMask; visual->greenMask = visuals->greenMask; visual->blueMask = visuals->blueMask; visual->offsetRed = maskShift(visuals->redMask); visual->offsetGreen = maskShift(visuals->greenMask); visual->offsetBlue = maskShift(visuals->blueMask); } vid++; visual++; } free(visuals); } miVisuals = NULL; visual = *visualp; depth = *depthp; /* * if we did not supplyied by a preferred visual class * check if there is a preferred class in one of the depth * structures - if there is, we want to start looking for the * default visual/depth from that depth. */ first_depth = 0; if (preferredVis < 0 && defaultColorVisualClass < 0) { for (i = 0; i < ndepth; i++) { if (preferredCVCs[i] >= 0) { first_depth = i; break; } } } for (i = first_depth; i < ndepth; i++) { int prefColorVisualClass = -1; if (defaultColorVisualClass >= 0) prefColorVisualClass = defaultColorVisualClass; else if (preferredVis >= 0) prefColorVisualClass = preferredVis; else if (preferredCVCs[i] >= 0) prefColorVisualClass = preferredCVCs[i]; if (*rootDepthp && *rootDepthp != depth[i].depth) continue; for (j = 0; j < depth[i].numVids; j++) { for (k = 0; k < nvisual; k++) if (visual[k].vid == depth[i].vids[j]) break; if (k == nvisual) continue; if (prefColorVisualClass < 0 || visual[k].class == prefColorVisualClass) break; } if (j != depth[i].numVids) break; } if (i == ndepth) { i = 0; j = 0; } *rootDepthp = depth[i].depth; *defaultVisp = depth[i].vids[j]; free(preferredCVCs); return TRUE; } xorg-server-1.20.8/mi/mipolyrect.c0000644000175000017500000001366413640201473013760 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmap.h" #include "mi.h" void miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects) { int i; xRectangle *pR = pRects; DDXPointRec rect[5]; int bound_tmp; #define MINBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp < -32768) \ bound_tmp = -32768; \ dst = bound_tmp; #define MAXBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp > 32767) \ bound_tmp = 32767; \ dst = bound_tmp; #define MAXUBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp > 65535) \ bound_tmp = 65535; \ dst = bound_tmp; if (pGC->lineStyle == LineSolid && pGC->joinStyle == JoinMiter && pGC->lineWidth != 0) { xRectangle *tmp, *t; int ntmp; int offset1, offset2, offset3; int x, y, width, height; ntmp = (nrects << 2); offset2 = pGC->lineWidth; offset1 = offset2 >> 1; offset3 = offset2 - offset1; tmp = xallocarray(ntmp, sizeof(xRectangle)); if (!tmp) return; t = tmp; for (i = 0; i < nrects; i++) { x = pR->x; y = pR->y; width = pR->width; height = pR->height; pR++; if (width == 0 && height == 0) { rect[0].x = x; rect[0].y = y; rect[1].x = x; rect[1].y = y; (*pGC->ops->Polylines) (pDraw, pGC, CoordModeOrigin, 2, rect); } else if (height < offset2 || width < offset1) { if (height == 0) { t->x = x; t->width = width; } else { MINBOUND(t->x, x - offset1) MAXUBOUND(t->width, width + offset2) } if (width == 0) { t->y = y; t->height = height; } else { MINBOUND(t->y, y - offset1) MAXUBOUND(t->height, height + offset2) } t++; } else { MINBOUND(t->x, x - offset1) MINBOUND(t->y, y - offset1) MAXUBOUND(t->width, width + offset2) t->height = offset2; t++; MINBOUND(t->x, x - offset1) MAXBOUND(t->y, y + offset3); t->width = offset2; t->height = height - offset2; t++; MAXBOUND(t->x, x + width - offset1); MAXBOUND(t->y, y + offset3) t->width = offset2; t->height = height - offset2; t++; MINBOUND(t->x, x - offset1) MAXBOUND(t->y, y + height - offset1) MAXUBOUND(t->width, width + offset2) t->height = offset2; t++; } } (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp); free((void *) tmp); } else { for (i = 0; i < nrects; i++) { rect[0].x = pR->x; rect[0].y = pR->y; MAXBOUND(rect[1].x, pR->x + (int) pR->width) rect[1].y = rect[0].y; rect[2].x = rect[1].x; MAXBOUND(rect[2].y, pR->y + (int) pR->height); rect[3].x = rect[0].x; rect[3].y = rect[2].y; rect[4].x = rect[0].x; rect[4].y = rect[0].y; (*pGC->ops->Polylines) (pDraw, pGC, CoordModeOrigin, 5, rect); pR++; } } } xorg-server-1.20.8/mi/miwindow.c0000644000175000017500000006471313640201473013427 00000000000000 /*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "regionstr.h" #include "region.h" #include "mi.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "mivalidate.h" #include "inputstr.h" void miClearToBackground(WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures) { BoxRec box; RegionRec reg; BoxPtr extents; int x1, y1, x2, y2; /* compute everything using ints to avoid overflow */ x1 = pWin->drawable.x + x; y1 = pWin->drawable.y + y; if (w) x2 = x1 + (int) w; else x2 = x1 + (int) pWin->drawable.width - (int) x; if (h) y2 = y1 + h; else y2 = y1 + (int) pWin->drawable.height - (int) y; extents = &pWin->clipList.extents; /* clip the resulting rectangle to the window clipList extents. This * makes sure that the result will fit in a box, given that the * screen is < 32768 on a side. */ if (x1 < extents->x1) x1 = extents->x1; if (x2 > extents->x2) x2 = extents->x2; if (y1 < extents->y1) y1 = extents->y1; if (y2 > extents->y2) y2 = extents->y2; if (x2 <= x1 || y2 <= y1) { x2 = x1 = 0; y2 = y1 = 0; } box.x1 = x1; box.x2 = x2; box.y1 = y1; box.y2 = y2; RegionInit(®, &box, 1); RegionIntersect(®, ®, &pWin->clipList); if (generateExposures) (*pWin->drawable.pScreen->WindowExposures) (pWin, ®); else if (pWin->backgroundState != None) pWin->drawable.pScreen->PaintWindow(pWin, ®, PW_BACKGROUND); RegionUninit(®); } void miMarkWindow(WindowPtr pWin) { ValidatePtr val; if (pWin->valdata) return; val = (ValidatePtr) xnfalloc(sizeof(ValidateRec)); val->before.oldAbsCorner.x = pWin->drawable.x; val->before.oldAbsCorner.y = pWin->drawable.y; val->before.borderVisible = NullRegion; val->before.resized = FALSE; pWin->valdata = val; } Bool miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin) { BoxPtr box; WindowPtr pChild, pLast; Bool anyMarked = FALSE; MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow; /* single layered systems are easy */ if (ppLayerWin) *ppLayerWin = pWin; if (pWin == pFirst) { /* Blindly mark pWin and all of its inferiors. This is a slight * overkill if there are mapped windows that outside pWin's border, * but it's better than wasting time on RectIn checks. */ pChild = pWin; while (1) { if (pChild->viewable) { if (RegionBroken(&pChild->winSize)) SetWinSize(pChild); if (RegionBroken(&pChild->borderSize)) SetBorderSize(pChild); (*MarkWindow) (pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } anyMarked = TRUE; pFirst = pFirst->nextSib; } if ((pChild = pFirst)) { box = RegionExtents(&pWin->borderSize); pLast = pChild->parent->lastChild; while (1) { if (pChild->viewable) { if (RegionBroken(&pChild->winSize)) SetWinSize(pChild); if (RegionBroken(&pChild->borderSize)) SetBorderSize(pChild); if (RegionContainsRect(&pChild->borderSize, box)) { (*MarkWindow) (pChild); anyMarked = TRUE; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } } while (!pChild->nextSib && (pChild != pLast)) pChild = pChild->parent; if (pChild == pLast) break; pChild = pChild->nextSib; } } if (anyMarked) (*MarkWindow) (pWin->parent); return anyMarked; } /***** * miHandleValidateExposures(pWin) * starting at pWin, draw background in any windows that have exposure * regions, translate the regions, restore any backing store, * and then send any regions still exposed to the client *****/ void miHandleValidateExposures(WindowPtr pWin) { WindowPtr pChild; ValidatePtr val; WindowExposuresProcPtr WindowExposures; pChild = pWin; WindowExposures = pChild->drawable.pScreen->WindowExposures; while (1) { if ((val = pChild->valdata)) { if (RegionNotEmpty(&val->after.borderExposed)) pWin->drawable.pScreen->PaintWindow(pChild, &val->after.borderExposed, PW_BORDER); RegionUninit(&val->after.borderExposed); (*WindowExposures) (pChild, &val->after.exposed); RegionUninit(&val->after.exposed); free(val); pChild->valdata = NULL; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } void miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind) { WindowPtr pParent; Bool WasViewable = (Bool) (pWin->viewable); short bw; RegionPtr oldRegion = NULL; DDXPointRec oldpt; Bool anyMarked = FALSE; ScreenPtr pScreen; WindowPtr windowToValidate; WindowPtr pLayerWin; /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; pScreen = pWin->drawable.pScreen; bw = wBorderWidth(pWin); oldpt.x = pWin->drawable.x; oldpt.y = pWin->drawable.y; if (WasViewable) { oldRegion = RegionCreate(NullBox, 1); RegionCopy(oldRegion, &pWin->borderClip); anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin); } pWin->origin.x = x + (int) bw; pWin->origin.y = y + (int) bw; x = pWin->drawable.x = pParent->drawable.x + x + (int) bw; y = pWin->drawable.y = pParent->drawable.y + y + (int) bw; SetWinSize(pWin); SetBorderSize(pWin); (*pScreen->PositionWindow) (pWin, x, y); windowToValidate = MoveWindowInStack(pWin, pNextSib); ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0); if (WasViewable) { if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, NULL); if (anyMarked) { (*pScreen->ValidateTree) (pLayerWin->parent, NullWindow, kind); (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, oldRegion); RegionDestroy(oldRegion); /* XXX need to retile border if ParentRelative origin */ (*pScreen->HandleExposures) (pLayerWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pLayerWin->parent, NULL, kind); } } if (pWin->realized) WindowsRestructured(); } /* * pValid is a region of the screen which has been * successfully copied -- recomputed exposed regions for affected windows */ static int miRecomputeExposures(WindowPtr pWin, void *value) { /* must conform to VisitWindowProcPtr */ RegionPtr pValid = (RegionPtr) value; if (pWin->valdata) { #ifdef COMPOSITE /* * Redirected windows are not affected by parent window * gravity manipulations, so don't recompute their * exposed areas here. */ if (pWin->redirectDraw != RedirectDrawNone) return WT_DONTWALKCHILDREN; #endif /* * compute exposed regions of this window */ RegionSubtract(&pWin->valdata->after.exposed, &pWin->clipList, pValid); /* * compute exposed regions of the border */ RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->borderClip, &pWin->winSize); RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->valdata->after.borderExposed, pValid); return WT_WALKCHILDREN; } return WT_NOMATCH; } void miResizeWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib) { WindowPtr pParent; Bool WasViewable = (Bool) (pWin->viewable); unsigned short width = pWin->drawable.width, height = pWin->drawable.height; short oldx = pWin->drawable.x, oldy = pWin->drawable.y; int bw = wBorderWidth(pWin); short dw, dh; DDXPointRec oldpt; RegionPtr oldRegion = NULL; Bool anyMarked = FALSE; ScreenPtr pScreen; WindowPtr pFirstChange; WindowPtr pChild; RegionPtr gravitate[StaticGravity + 1]; unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ RegionPtr pRegion = NULL; RegionPtr destClip; /* portions of destination already written */ RegionPtr oldWinClip = NULL; /* old clip list for window */ RegionPtr borderVisible = NullRegion; /* visible area of the border */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ WindowPtr pLayerWin; /* if this is a root window, can't be resized */ if (!(pParent = pWin->parent)) return; pScreen = pWin->drawable.pScreen; newx = pParent->drawable.x + x + bw; newy = pParent->drawable.y + y + bw; if (WasViewable) { anyMarked = FALSE; /* * save the visible region of the window */ oldRegion = RegionCreate(NullBox, 1); RegionCopy(oldRegion, &pWin->winSize); /* * categorize child windows into regions to be moved */ for (g = 0; g <= StaticGravity; g++) gravitate[g] = (RegionPtr) NULL; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { g = pChild->winGravity; if (g != UnmapGravity) { if (!gravitate[g]) gravitate[g] = RegionCreate(NullBox, 1); RegionUnion(gravitate[g], gravitate[g], &pChild->borderClip); } else { UnmapWindow(pChild, TRUE); anyMarked = TRUE; } } anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin); oldWinClip = NULL; if (pWin->bitGravity != ForgetGravity) { oldWinClip = RegionCreate(NullBox, 1); RegionCopy(oldWinClip, &pWin->clipList); } /* * if the window is changing size, borderExposed * can't be computed correctly without some help. */ if (pWin->drawable.height > h || pWin->drawable.width > w) shrunk = TRUE; if (newx != oldx || newy != oldy) moved = TRUE; if ((pWin->drawable.height != h || pWin->drawable.width != w) && HasBorder(pWin)) { borderVisible = RegionCreate(NullBox, 1); /* for tiled borders, we punt and draw the whole thing */ if (pWin->borderIsPixel || !moved) { if (shrunk || moved) RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); else RegionCopy(borderVisible, &pWin->borderClip); } } } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.height = h; pWin->drawable.width = w; x = pWin->drawable.x = newx; y = pWin->drawable.y = newy; SetWinSize(pWin); SetBorderSize(pWin); dw = (int) w - (int) width; dh = (int) h - (int) height; ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh); /* let the hardware adjust background and border pixmaps, if any */ (*pScreen->PositionWindow) (pWin, x, y); pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { pRegion = RegionCreate(NullBox, 1); if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange, NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, NULL); if (pWin->valdata) { pWin->valdata->before.resized = TRUE; pWin->valdata->before.borderVisible = borderVisible; } if (anyMarked) (*pScreen->ValidateTree) (pLayerWin->parent, pFirstChange, VTOther); /* * the entire window is trashed unless bitGravity * recovers portions of it */ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList); } GravityTranslate(x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); if (WasViewable) { /* avoid the border */ if (HasBorder(pWin)) { int offx, offy, dx, dy; /* kruft to avoid double translates for each gravity */ offx = 0; offy = 0; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; /* align winSize to gravitate[g]. * winSize is in new coordinates, * gravitate[g] is still in old coordinates */ GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny); dx = (oldx - nx) - offx; dy = (oldy - ny) - offy; if (dx || dy) { RegionTranslate(&pWin->winSize, dx, dy); offx += dx; offy += dy; } RegionIntersect(gravitate[g], gravitate[g], &pWin->winSize); } /* get winSize back where it belongs */ if (offx || offy) RegionTranslate(&pWin->winSize, -offx, -offy); } /* * add screen bits to the appropriate bucket */ if (oldWinClip) { /* * clip to new clipList */ RegionCopy(pRegion, oldWinClip); RegionTranslate(pRegion, nx - oldx, ny - oldy); RegionIntersect(oldWinClip, pRegion, &pWin->clipList); /* * don't step on any gravity bits which will be copied after this * region. Note -- this assumes that the regions will be copied * in gravity order. */ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate[g]) RegionSubtract(oldWinClip, oldWinClip, gravitate[g]); } RegionTranslate(oldWinClip, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate[g]) gravitate[g] = oldWinClip; else { RegionUnion(gravitate[g], gravitate[g], oldWinClip); RegionDestroy(oldWinClip); } } /* * move the bits on the screen */ destClip = NULL; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny); oldpt.x = oldx + (x - nx); oldpt.y = oldy + (y - ny); /* Note that gravitate[g] is *translated* by CopyWindow */ /* only copy the remaining useful bits */ RegionIntersect(gravitate[g], gravitate[g], oldRegion); /* clip to not overwrite already copied areas */ if (destClip) { RegionTranslate(destClip, oldpt.x - x, oldpt.y - y); RegionSubtract(gravitate[g], gravitate[g], destClip); RegionTranslate(destClip, x - oldpt.x, y - oldpt.y); } /* and move those bits */ if (oldpt.x != x || oldpt.y != y #ifdef COMPOSITE || pWin->redirectDraw #endif ) { (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, gravitate[g]); } /* remove any overwritten bits from the remaining useful bits */ RegionSubtract(oldRegion, oldRegion, gravitate[g]); /* * recompute exposed regions of child windows */ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->winGravity != g) continue; RegionIntersect(pRegion, &pChild->borderClip, gravitate[g]); TraverseTree(pChild, miRecomputeExposures, (void *) pRegion); } /* * remove the successfully copied regions of the * window from its exposed region */ if (g == pWin->bitGravity) RegionSubtract(&pWin->valdata->after.exposed, &pWin->valdata->after.exposed, gravitate[g]); if (!destClip) destClip = gravitate[g]; else { RegionUnion(destClip, destClip, gravitate[g]); RegionDestroy(gravitate[g]); } } RegionDestroy(oldRegion); RegionDestroy(pRegion); if (destClip) RegionDestroy(destClip); if (anyMarked) { (*pScreen->HandleExposures) (pLayerWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pLayerWin->parent, pFirstChange, VTOther); } } if (pWin->realized) WindowsRestructured(); } WindowPtr miGetLayerWindow(WindowPtr pWin) { return pWin->firstChild; } /****** * * miSetShape * The border/window shape has changed. Recompute winSize/borderSize * and send appropriate exposure events */ void miSetShape(WindowPtr pWin, int kind) { Bool WasViewable = (Bool) (pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked = FALSE; WindowPtr pLayerWin; if (kind != ShapeInput) { if (WasViewable) { anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin); 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; } } SetWinSize(pWin); SetBorderSize(pWin); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); if (WasViewable) { anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL); if (anyMarked) { (*pScreen->ValidateTree) (pLayerWin->parent, NullWindow, VTOther); (*pScreen->HandleExposures) (pLayerWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pLayerWin->parent, NULL, VTOther); } } } if (pWin->realized) WindowsRestructured(); CheckCursorConfinement(pWin); } /* Keeps the same inside(!) origin */ void miChangeBorderWidth(WindowPtr pWin, unsigned int width) { int oldwidth; Bool anyMarked = FALSE; ScreenPtr pScreen; Bool WasViewable = (Bool) (pWin->viewable); Bool HadBorder; WindowPtr pLayerWin; oldwidth = wBorderWidth(pWin); if (oldwidth == width) return; HadBorder = HasBorder(pWin); pScreen = pWin->drawable.pScreen; if (WasViewable && width < oldwidth) anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin); pWin->borderWidth = width; SetBorderSize(pWin); if (WasViewable) { if (width > oldwidth) { anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin); /* * save the old border visible region to correctly compute * borderExposed. */ if (pWin->valdata && HadBorder) { RegionPtr borderVisible; borderVisible = RegionCreate(NULL, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } } if (anyMarked) { (*pScreen->ValidateTree) (pLayerWin->parent, pLayerWin, VTOther); (*pScreen->HandleExposures) (pLayerWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pLayerWin->parent, pLayerWin, VTOther); } } if (pWin->realized) WindowsRestructured(); } void miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure) { if ((pChild != pWin) || fromConfigure) { RegionEmpty(&pChild->clipList); if (pChild->drawable.pScreen->ClipNotify) (*pChild->drawable.pScreen->ClipNotify) (pChild, 0, 0); RegionEmpty(&pChild->borderClip); } } WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y) { WindowPtr pWin; BoxRec box; pWin = DeepestSpriteWin(pSprite)->firstChild; while (pWin) { if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth(pWin)) && (x < pWin->drawable.x + (int) pWin->drawable.width + wBorderWidth(pWin)) && (y >= pWin->drawable.y - wBorderWidth(pWin)) && (y < pWin->drawable.y + (int) pWin->drawable.height + wBorderWidth(pWin)) /* When a window is shaped, a further check * is made to see if the point is inside * borderSize */ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) && (!wInputShape(pWin) || RegionContainsPoint(wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) /* In rootless mode windows may be offscreen, even when * they're in X's stack. (E.g. if the native window system * implements some form of virtual desktop system). */ && !pWin->unhittable) { if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) { pSprite->spriteTraceSize += 10; pSprite->spriteTrace = reallocarray(pSprite->spriteTrace, pSprite->spriteTraceSize, sizeof(WindowPtr)); } pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; pWin = pWin->firstChild; } else pWin = pWin->nextSib; } return DeepestSpriteWin(pSprite); } /** * Traversed from the root window to the window at the position x/y. While * traversing, it sets up the traversal history in the spriteTrace array. * After completing, the spriteTrace history is set in the following way: * spriteTrace[0] ... root window * spriteTrace[1] ... top level window that encloses x/y * ... * spriteTrace[spriteTraceGood - 1] ... window at x/y * * @returns the window at the given coordinates. */ WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y) { pSprite->spriteTraceGood = 1; /* root window still there */ return miSpriteTrace(pSprite, x, y); } xorg-server-1.20.8/mi/mizerarc.h0000644000175000017500000000556513640201473013413 00000000000000/************************************************************ Copyright 1989, 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. ********************************************************/ typedef struct { int x; int y; int mask; } miZeroArcPtRec; typedef struct { int x, y, k1, k3, a, b, d, dx, dy; int alpha, beta; int xorg, yorg; int xorgo, yorgo; int w, h; int initialMask; miZeroArcPtRec start, altstart, end, altend; int firstx, firsty; int startAngle, endAngle; } miZeroArcRec; #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \ (((arc)->width <= 800) && ((arc)->height <= 800))) #define MIARCSETUP() \ x = info.x; \ y = info.y; \ k1 = info.k1; \ k3 = info.k3; \ a = info.a; \ b = info.b; \ d = info.d; \ dx = info.dx; \ dy = info.dy #define MIARCOCTANTSHIFT(clause) \ if (a < 0) \ { \ if (y == info.h) \ { \ d = -1; \ a = b = k1 = 0; \ } \ else \ { \ dx = (k1 << 1) - k3; \ k1 = dx - k1; \ k3 = -k3; \ b = b + a - (k1 >> 1); \ d = b + ((-a) >> 1) - d + (k3 >> 3); \ if (dx < 0) \ a = -((-dx) >> 1) - a; \ else \ a = (dx >> 1) - a; \ dx = 0; \ dy = 1; \ clause \ } \ } #define MIARCSTEP(move1,move2) \ b -= k1; \ if (d < 0) \ { \ x += dx; \ y += dy; \ a += k1; \ d += b; \ move1 \ } \ else \ { \ x++; \ y++; \ a += k3; \ d -= a; \ move2 \ } #define MIARCCIRCLESTEP(clause) \ b -= k1; \ x++; \ if (d < 0) \ { \ a += k1; \ d += b; \ } \ else \ { \ y++; \ a += k3; \ d -= a; \ clause \ } /* mizerarc.c */ extern _X_EXPORT Bool miZeroArcSetup(xArc * /*arc */ , miZeroArcRec * /*info */ , Bool /*ok360 */ ); xorg-server-1.20.8/mi/miwideline.h0000644000175000017500000000525213640201473013716 00000000000000/* Copyright 1988, 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: Keith Packard, MIT X Consortium */ #include "mifpoly.h" /* for ICEIL */ /* * Polygon edge description for integer wide-line routines */ typedef struct _PolyEdge { int height; /* number of scanlines to process */ int x; /* starting x coordinate */ int stepx; /* fixed integral dx */ int signdx; /* variable dx sign */ int e; /* initial error term */ int dy; int dx; } PolyEdgeRec, *PolyEdgePtr; #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */ /* * types for general polygon routines */ typedef struct _PolyVertex { double x, y; } PolyVertexRec, *PolyVertexPtr; typedef struct _PolySlope { int dx, dy; double k; /* x0 * dy - y0 * dx */ } PolySlopeRec, *PolySlopePtr; /* * Line face description for caps/joins */ typedef struct _LineFace { double xa, ya; int dx, dy; int x, y; double k; } LineFaceRec, *LineFacePtr; /* * macros for polygon fillers */ #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ oldPixel = pGC->fgPixel; \ if (pixel != oldPixel) { \ ChangeGCVal gcval; \ gcval.val = pixel; \ ChangeGC (NullClient, pGC, GCForeground, &gcval); \ ValidateGC (pDrawable, pGC); \ } \ } #define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ if (pixel != oldPixel) { \ ChangeGCVal gcval; \ gcval.val = oldPixel; \ ChangeGC (NullClient, pGC, GCForeground, &gcval); \ ValidateGC (pDrawable, pGC); \ } \ } xorg-server-1.20.8/mi/mipointer.h0000644000175000017500000001146313640201473013577 00000000000000/* Copyright 1989, 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. */ #ifndef MIPOINTER_H #define MIPOINTER_H #include "cursor.h" #include "input.h" #include "privates.h" typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScr */ , CursorPtr /* pCurs */ ); Bool (*UnrealizeCursor) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScr */ , CursorPtr /* pCurs */ ); void (*SetCursor) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScr */ , CursorPtr /* pCurs */ , int /* x */ , int /* y */ ); void (*MoveCursor) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScr */ , int /* x */ , int /* y */ ); Bool (*DeviceCursorInitialize) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScr */ ); void (*DeviceCursorCleanup) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScr */ ); } miPointerSpriteFuncRec, *miPointerSpriteFuncPtr; typedef struct _miPointerScreenFuncRec { Bool (*CursorOffScreen) (ScreenPtr * /* ppScr */ , int * /* px */ , int * /* py */ ); void (*CrossScreen) (ScreenPtr /* pScr */ , int /* entering */ ); void (*WarpCursor) (DeviceIntPtr /*pDev */ , ScreenPtr /* pScr */ , int /* x */ , int /* y */ ); } miPointerScreenFuncRec, *miPointerScreenFuncPtr; extern _X_EXPORT Bool miDCInitialize(ScreenPtr /*pScreen */ , miPointerScreenFuncPtr /*screenFuncs */ ); extern _X_EXPORT Bool miPointerInitialize(ScreenPtr /*pScreen */ , miPointerSpriteFuncPtr /*spriteFuncs */ , miPointerScreenFuncPtr /*screenFuncs */ , Bool /*waitForUpdate */ ); extern _X_EXPORT void miPointerWarpCursor(DeviceIntPtr /*pDev */ , ScreenPtr /*pScreen */ , int /*x */ , int /*y */ ); extern _X_EXPORT ScreenPtr miPointerGetScreen(DeviceIntPtr pDev); extern _X_EXPORT void miPointerSetScreen(DeviceIntPtr pDev, int screen_num, int x, int y); /* Returns the current cursor position. */ extern _X_EXPORT void miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y); /* Moves the cursor to the specified position. May clip the co-ordinates: * x and y are modified in-place. */ extern _X_EXPORT ScreenPtr miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y, int *nevents, InternalEvent *events); extern _X_EXPORT void miPointerUpdateSprite(DeviceIntPtr pDev); /* Invalidate current sprite, forcing reload on next * sprite setting (window crossing, grab action, etc) */ extern _X_EXPORT void miPointerInvalidateSprite(DeviceIntPtr pDev); /* Sets whether the sprite should be updated immediately on pointer moves */ extern _X_EXPORT Bool miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait); extern _X_EXPORT DevPrivateKeyRec miPointerPrivKeyRec; #define miPointerPrivKey (&miPointerPrivKeyRec) extern _X_EXPORT DevPrivateKeyRec miPointerScreenKeyRec; #define miPointerScreenKey (&miPointerScreenKeyRec) #endif /* MIPOINTER_H */ xorg-server-1.20.8/mi/mipoly.h0000644000175000017500000001452613640201473013105 00000000000000/* 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. */ /* * fill.h * * Created by Brian Kelleher; Oct 1985 * * Include file for filled polygon routines. * * These are the data structures needed to scan * convert regions. Two different scan conversion * methods are available -- the even-odd method, and * the winding number method. * The even-odd rule states that a point is inside * the polygon if a ray drawn from that point in any * direction will pass through an odd number of * path segments. * By the winding number rule, a point is decided * to be inside the polygon if a ray drawn from that * point in any direction passes through a different * number of clockwise and counter-clockwise path * segments. * * These data structures are adapted somewhat from * the algorithm in (Foley/Van Dam) for scan converting * polygons. * The basic algorithm is to start at the top (smallest y) * of the polygon, stepping down to the bottom of * the polygon by incrementing the y coordinate. We * keep a list of edges which the current scanline crosses, * sorted by x. This list is called the Active Edge Table (AET) * As we change the y-coordinate, we update each entry in * in the active edge table to reflect the edges new xcoord. * This list must be sorted at each scanline in case * two edges intersect. * We also keep a data structure known as the Edge Table (ET), * which keeps track of all the edges which the current * scanline has not yet reached. The ET is basically a * list of ScanLineList structures containing a list of * edges which are entered at a given scanline. There is one * ScanLineList per scanline at which an edge is entered. * When we enter a new edge, we move it from the ET to the AET. * * From the AET, we can implement the even-odd rule as in * (Foley/Van Dam). * The winding number rule is a little trickier. We also * keep the EdgeTableEntries in the AET linked by the * nextWETE (winding EdgeTableEntry) link. This allows * the edges to be linked just as before for updating * purposes, but only uses the edges linked by the nextWETE * link as edges representing spans of the polygon to * drawn (as with the even-odd rule). */ /* * for the winding number rule */ #define CLOCKWISE 1 #define COUNTERCLOCKWISE -1 typedef struct _EdgeTableEntry { int ymax; /* ycoord at which we exit this edge. */ BRESINFO bres; /* Bresenham info to run the edge */ struct _EdgeTableEntry *next; /* next in the list */ struct _EdgeTableEntry *back; /* for insertion sort */ struct _EdgeTableEntry *nextWETE; /* for winding num rule */ int ClockWise; /* flag for winding number rule */ } EdgeTableEntry; typedef struct _ScanLineList { int scanline; /* the scanline represented */ EdgeTableEntry *edgelist; /* header node */ struct _ScanLineList *next; /* next in the list */ } ScanLineList; typedef struct { int ymax; /* ymax for the polygon */ int ymin; /* ymin for the polygon */ ScanLineList scanlines; /* header node */ } EdgeTable; /* * Here is a struct to help with storage allocation * so we can allocate a big chunk at a time, and then take * pieces from this heap when we need to. */ #define SLLSPERBLOCK 25 typedef struct _ScanLineListBlock { ScanLineList SLLs[SLLSPERBLOCK]; struct _ScanLineListBlock *next; } ScanLineListBlock; /* * number of points to buffer before sending them off * to scanlines() : Must be an even number */ #define NUMPTSTOBUFFER 200 /* * * a few macros for the inner loops of the fill code where * performance considerations don't allow a procedure call. * * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The winding number rule is in effect, so we must notify * the caller when the edge has been removed so he * can reorder the Winding Active Edge Table. */ #define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ fixWAET = 1; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } /* * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The even-odd rule is in effect. */ #define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } xorg-server-1.20.8/mi/mipoly.c0000644000175000017500000005151113640201473013073 00000000000000/*********************************************************** 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. ******************************************************************/ /* * mipoly.c * * Written by Brian Kelleher; June 1986 */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "windowstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "miscanfill.h" #include "mipoly.h" #include "regionstr.h" /* * Insert the given edge into the edge table. First we must find the correct * bucket in the Edge table, then find the right slot in the bucket. Finally, * we can insert it. */ static Bool miInsertEdgeInET(EdgeTable * ET, EdgeTableEntry * ETE, int scanline, ScanLineListBlock ** SLLBlock, int *iSLLBlock) { EdgeTableEntry *start, *prev; ScanLineList *pSLL, *pPrevSLL; ScanLineListBlock *tmpSLLBlock; /* * find the right bucket to put the edge into */ pPrevSLL = &ET->scanlines; pSLL = pPrevSLL->next; while (pSLL && (pSLL->scanline < scanline)) { pPrevSLL = pSLL; pSLL = pSLL->next; } /* * reassign pSLL (pointer to ScanLineList) if necessary */ if ((!pSLL) || (pSLL->scanline > scanline)) { if (*iSLLBlock > SLLSPERBLOCK - 1) { tmpSLLBlock = malloc(sizeof(ScanLineListBlock)); if (!tmpSLLBlock) return FALSE; (*SLLBlock)->next = tmpSLLBlock; tmpSLLBlock->next = NULL; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; pSLL->edgelist = NULL; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; /* * now insert the edge in the right bucket */ prev = NULL; start = pSLL->edgelist; while (start && (start->bres.minor < ETE->bres.minor)) { prev = start; start = start->next; } ETE->next = start; if (prev) prev->next = ETE; else pSLL->edgelist = ETE; return TRUE; } static void miFreeStorage(ScanLineListBlock * pSLLBlock) { ScanLineListBlock *tmpSLLBlock; while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; free(pSLLBlock); pSLLBlock = tmpSLLBlock; } } /* * CreateEdgeTable * * This routine creates the edge table for scan converting polygons. * The Edge Table (ET) looks like: * * EdgeTable * -------- * | ymax | ScanLineLists * |scanline|-->------------>-------------->... * -------- |scanline| |scanline| * |edgelist| |edgelist| * --------- --------- * | | * | | * V V * list of ETEs list of ETEs * * where ETE is an EdgeTableEntry data structure, and there is one ScanLineList * per scanline at which an edge is initially entered. */ static Bool miCreateETandAET(int count, DDXPointPtr pts, EdgeTable * ET, EdgeTableEntry * AET, EdgeTableEntry * pETEs, ScanLineListBlock * pSLLBlock) { DDXPointPtr top, bottom; DDXPointPtr PrevPt, CurrPt; int iSLLBlock = 0; int dy; if (count < 2) return TRUE; /* * initialize the Active Edge Table */ AET->next = NULL; AET->back = NULL; AET->nextWETE = NULL; AET->bres.minor = MININT; /* * initialize the Edge Table. */ ET->scanlines.next = NULL; ET->ymax = MININT; ET->ymin = MAXINT; pSLLBlock->next = NULL; PrevPt = &pts[count - 1]; /* * for each vertex in the array of points. * In this loop we are dealing with two vertices at * a time -- these make up one edge of the polygon. */ while (count--) { CurrPt = pts++; /* * find out which point is above and which is below. */ if (PrevPt->y > CurrPt->y) { bottom = PrevPt, top = CurrPt; pETEs->ClockWise = 0; } else { bottom = CurrPt, top = PrevPt; pETEs->ClockWise = 1; } /* * don't add horizontal edges to the Edge table. */ if (bottom->y != top->y) { pETEs->ymax = bottom->y - 1; /* -1 so we don't get last scanline */ /* * initialize integer edge algorithm */ dy = bottom->y - top->y; BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres); if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock)) { miFreeStorage(pSLLBlock->next); return FALSE; } ET->ymax = max(ET->ymax, PrevPt->y); ET->ymin = min(ET->ymin, PrevPt->y); pETEs++; } PrevPt = CurrPt; } return TRUE; } /* * This routine moves EdgeTableEntries from the EdgeTable into the Active Edge * Table, leaving them sorted by smaller x coordinate. */ static void miloadAET(EdgeTableEntry * AET, EdgeTableEntry * ETEs) { EdgeTableEntry *pPrevAET; EdgeTableEntry *tmp; pPrevAET = AET; AET = AET->next; while (ETEs) { while (AET && (AET->bres.minor < ETEs->bres.minor)) { pPrevAET = AET; AET = AET->next; } tmp = ETEs->next; ETEs->next = AET; if (AET) AET->back = ETEs; ETEs->back = pPrevAET; pPrevAET->next = ETEs; pPrevAET = ETEs; ETEs = tmp; } } /* * computeWAET * * This routine links the AET by the nextWETE (winding EdgeTableEntry) link for * use by the winding number rule. The final Active Edge Table (AET) might * look something like: * * AET * ---------- --------- --------- * |ymax | |ymax | |ymax | * | ... | |... | |... | * |next |->|next |->|next |->... * |nextWETE| |nextWETE| |nextWETE| * --------- --------- ^-------- * | | | * V-------------------> V---> ... * */ static void micomputeWAET(EdgeTableEntry * AET) { EdgeTableEntry *pWETE; int inside = 1; int isInside = 0; AET->nextWETE = NULL; pWETE = AET; AET = AET->next; while (AET) { if (AET->ClockWise) isInside++; else isInside--; if ((!inside && !isInside) || (inside && isInside)) { pWETE->nextWETE = AET; pWETE = AET; inside = !inside; } AET = AET->next; } pWETE->nextWETE = NULL; } /* * Just a simple insertion sort using pointers and back pointers to sort the * Active Edge Table. */ static int miInsertionSort(EdgeTableEntry * AET) { EdgeTableEntry *pETEchase; EdgeTableEntry *pETEinsert; EdgeTableEntry *pETEchaseBackTMP; int changed = 0; AET = AET->next; while (AET) { pETEinsert = AET; pETEchase = AET; while (pETEchase->back->bres.minor > AET->bres.minor) pETEchase = pETEchase->back; AET = AET->next; if (pETEchase != pETEinsert) { pETEchaseBackTMP = pETEchase->back; pETEinsert->back->next = AET; if (AET) AET->back = pETEinsert->back; pETEinsert->next = pETEchase; pETEchase->back->next = pETEinsert; pETEchase->back = pETEinsert; pETEinsert->back = pETEchaseBackTMP; changed = 1; } } return changed; } /* Find the index of the point with the smallest y */ static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty) { DDXPointPtr ptMin; int ymin, ymax; DDXPointPtr ptsStart = pts; ptMin = pts; ymin = ymax = (pts++)->y; while (--n > 0) { if (pts->y < ymin) { ptMin = pts; ymin = pts->y; } if (pts->y > ymax) ymax = pts->y; pts++; } *by = ymin; *ty = ymax; return ptMin - ptsStart; } /* * Written by Brian Kelleher; Dec. 1985. * * Fill a convex polygon. If the given polygon is not convex, then the result * is undefined. The algorithm is to order the edges from smallest y to * largest by partitioning the array into a left edge list and a right edge * list. The algorithm used to traverse each edge is an extension of * Bresenham's line algorithm with y as the major axis. For a derivation of * the algorithm, see the author of this code. */ static Bool miFillConvexPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn) { int xl = 0, xr = 0; /* x vals of left and right edges */ int dl = 0, dr = 0; /* decision variables */ int ml = 0, m1l = 0; /* left edge slope and slope+1 */ int mr = 0, m1r = 0; /* right edge slope and slope+1 */ int incr1l = 0, incr2l = 0; /* left edge error increments */ int incr1r = 0, incr2r = 0; /* right edge error increments */ int dy; /* delta y */ int y; /* current scanline */ int left, right; /* indices to first endpoints */ int i; /* loop counter */ int nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ int *width, *FirstWidth; /* output buffer */ int imin; /* index of smallest vertex (in y) */ int ymin; /* y-extents of polygon */ int ymax; /* * find leftx, bottomy, rightx, topy, and the index * of bottomy. Also translate the points. */ imin = getPolyYBounds(ptsIn, count, &ymin, &ymax); dy = ymax - ymin + 1; if ((count < 3) || (dy < 0)) return TRUE; ptsOut = FirstPoint = xallocarray(dy, sizeof(DDXPointRec)); width = FirstWidth = xallocarray(dy, sizeof(int)); if (!FirstPoint || !FirstWidth) { free(FirstWidth); free(FirstPoint); return FALSE; } nextleft = nextright = imin; y = ptsIn[nextleft].y; /* * loop through all edges of the polygon */ do { /* * add a left edge if we need to */ if (ptsIn[nextleft].y == y) { left = nextleft; /* * find the next edge, considering the end * conditions of the array. */ nextleft++; if (nextleft >= count) nextleft = 0; /* * now compute all of the random information * needed to run the iterative algorithm. */ BRESINITPGON(ptsIn[nextleft].y - ptsIn[left].y, ptsIn[left].x, ptsIn[nextleft].x, xl, dl, ml, m1l, incr1l, incr2l); } /* * add a right edge if we need to */ if (ptsIn[nextright].y == y) { right = nextright; /* * find the next edge, considering the end * conditions of the array. */ nextright--; if (nextright < 0) nextright = count - 1; /* * now compute all of the random information * needed to run the iterative algorithm. */ BRESINITPGON(ptsIn[nextright].y - ptsIn[right].y, ptsIn[right].x, ptsIn[nextright].x, xr, dr, mr, m1r, incr1r, incr2r); } /* * generate scans to fill while we still have * a right edge as well as a left edge. */ i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y; /* in case we're called with non-convex polygon */ if (i < 0) { free(FirstWidth); free(FirstPoint); return TRUE; } while (i-- > 0) { ptsOut->y = y; /* * reverse the edges if necessary */ if (xl < xr) { *(width++) = xr - xl; (ptsOut++)->x = xl; } else { *(width++) = xl - xr; (ptsOut++)->x = xr; } y++; /* increment down the edges */ BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l); BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r); } } while (y != ymax); /* * Finally, fill the spans */ (*pgc->ops->FillSpans) (dst, pgc, ptsOut - FirstPoint, FirstPoint, FirstWidth, 1); free(FirstWidth); free(FirstPoint); return TRUE; } /* * Written by Brian Kelleher; Oct. 1985 * * Routine to fill a polygon. Two fill rules are supported: frWINDING and * frEVENODD. */ static Bool miFillGeneralPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn) { EdgeTableEntry *pAET; /* the Active Edge Table */ int y; /* the current scanline */ int nPts = 0; /* number of pts in buffer */ EdgeTableEntry *pWETE; /* Winding Edge Table */ ScanLineList *pSLL; /* Current ScanLineList */ DDXPointPtr ptsOut; /* ptr to output buffers */ int *width; DDXPointRec FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */ int FirstWidth[NUMPTSTOBUFFER]; EdgeTableEntry *pPrevAET; /* previous AET entry */ EdgeTable ET; /* Edge Table header node */ EdgeTableEntry AET; /* Active ET header node */ EdgeTableEntry *pETEs; /* Edge Table Entries buff */ ScanLineListBlock SLLBlock; /* header for ScanLineList */ int fixWAET = 0; if (count < 3) return TRUE; if (!(pETEs = malloc(sizeof(EdgeTableEntry) * count))) return FALSE; ptsOut = FirstPoint; width = FirstWidth; if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) { free(pETEs); return FALSE; } pSLL = ET.scanlines.next; if (pgc->fillRule == EvenOddRule) { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL && y == pSLL->scanline) { miloadAET(&AET, pSLL->edgelist); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; /* * for each active edge */ while (pAET) { ptsOut->x = pAET->bres.minor; ptsOut++->y = y; *width++ = pAET->next->bres.minor - pAET->bres.minor; nPts++; /* * send out the buffer when its full */ if (nPts == NUMPTSTOBUFFER) { (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint, FirstWidth, 1); ptsOut = FirstPoint; width = FirstWidth; nPts = 0; } EVALUATEEDGEEVENODD(pAET, pPrevAET, y); EVALUATEEDGEEVENODD(pAET, pPrevAET, y); } miInsertionSort(&AET); } } else { /* default to WindingNumber */ /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL && y == pSLL->scanline) { miloadAET(&AET, pSLL->edgelist); micomputeWAET(&AET); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; pWETE = pAET; /* * for each active edge */ while (pAET) { /* * if the next edge in the active edge table is * also the next edge in the winding active edge * table. */ if (pWETE == pAET) { ptsOut->x = pAET->bres.minor; ptsOut++->y = y; *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor; nPts++; /* * send out the buffer */ if (nPts == NUMPTSTOBUFFER) { (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint, FirstWidth, 1); ptsOut = FirstPoint; width = FirstWidth; nPts = 0; } pWETE = pWETE->nextWETE; while (pWETE != pAET) EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); pWETE = pWETE->nextWETE; } EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); } /* * reevaluate the Winding active edge table if we * just had to resort it or if we just exited an edge. */ if (miInsertionSort(&AET) || fixWAET) { micomputeWAET(&AET); fixWAET = 0; } } } /* * Get any spans that we missed by buffering */ (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint, FirstWidth, 1); free(pETEs); miFreeStorage(SLLBlock.next); return TRUE; } /* * Draw polygons. This routine translates the point by the origin if * pGC->miTranslate is non-zero, and calls to the appropriate routine to * actually scan convert the polygon. */ void miFillPolygon(DrawablePtr dst, GCPtr pgc, int shape, int mode, int count, DDXPointPtr pPts) { int i; int xorg, yorg; DDXPointPtr ppt; if (count == 0) return; ppt = pPts; if (pgc->miTranslate) { xorg = dst->x; yorg = dst->y; if (mode == CoordModeOrigin) { for (i = 0; i < count; i++) { ppt->x += xorg; ppt++->y += yorg; } } else { ppt->x += xorg; ppt++->y += yorg; for (i = 1; i < count; i++) { ppt->x += (ppt - 1)->x; ppt->y += (ppt - 1)->y; ppt++; } } } else { if (mode == CoordModePrevious) { ppt++; for (i = 1; i < count; i++) { ppt->x += (ppt - 1)->x; ppt->y += (ppt - 1)->y; ppt++; } } } if (shape == Convex) miFillConvexPoly(dst, pgc, count, pPts); else miFillGeneralPoly(dst, pgc, count, pPts); } xorg-server-1.20.8/mi/micopy.c0000644000175000017500000002335213640201473013064 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "mi.h" #include "scrnintstr.h" #include "gcstruct.h" #include "pixmap.h" #include "pixmapstr.h" #include "windowstr.h" void miCopyRegion(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, RegionPtr pDstRegion, int dx, int dy, miCopyProc copyProc, Pixel bitPlane, void *closure) { int careful; Bool reverse; Bool upsidedown; BoxPtr pbox; int nbox; BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp; pbox = RegionRects(pDstRegion); nbox = RegionNumRects(pDstRegion); /* XXX we have to err on the side of safety when both are windows, * because we don't know if IncludeInferiors is being used. */ careful = ((pSrcDrawable == pDstDrawable) || ((pSrcDrawable->type == DRAWABLE_WINDOW) && (pDstDrawable->type == DRAWABLE_WINDOW))); pboxNew1 = NULL; pboxNew2 = NULL; if (careful && dy < 0) { upsidedown = TRUE; if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ pboxNew1 = xallocarray(nbox, sizeof(BoxRec)); if (!pboxNew1) return; pboxBase = pboxNext = pbox + nbox - 1; while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; pboxTmp = pboxNext + 1; while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; } pboxBase = pboxNext; } pboxNew1 -= nbox; pbox = pboxNew1; } } else { /* walk source top to bottom */ upsidedown = FALSE; } if (careful && dx < 0) { /* walk source right to left */ if (dy <= 0) reverse = TRUE; else reverse = FALSE; if (nbox > 1) { /* reverse order of rects in each band */ pboxNew2 = xallocarray(nbox, sizeof(BoxRec)); if (!pboxNew2) { free(pboxNew1); return; } pboxBase = pboxNext = pbox; while (pboxBase < pbox + nbox) { while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; while (pboxTmp != pboxBase) { *pboxNew2++ = *--pboxTmp; } pboxBase = pboxNext; } pboxNew2 -= nbox; pbox = pboxNew2; } } else { /* walk source left to right */ reverse = FALSE; } (*copyProc) (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse, upsidedown, bitPlane, closure); free(pboxNew1); free(pboxNew2); } RegionPtr miDoCopy(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, miCopyProc copyProc, Pixel bitPlane, void *closure) { RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ Bool freeSrcClip = FALSE; RegionPtr prgnExposed = NULL; RegionRec rgnDst; int dx; int dy; int numRects; int box_x1; int box_y1; int box_x2; int box_y2; Bool fastSrc = FALSE; /* for fast clipping with pixmap source */ Bool fastDst = FALSE; /* for fast clipping with one rect dest */ Bool fastExpose = FALSE; /* for fast exposures with pixmap source */ /* Short cut for unmapped windows */ if (pDstDrawable->type == DRAWABLE_WINDOW && !((WindowPtr) pDstDrawable)->realized) { return NULL; } if (pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, widthSrc, heightSrc, pGC->subWindowMode); } /* Compute source clip region */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { if ((pSrcDrawable == pDstDrawable) && (!pGC->clientClip)) prgnSrcClip = miGetCompositeClip(pGC); else fastSrc = TRUE; } else { if (pGC->subWindowMode == IncludeInferiors) { /* * XFree86 DDX empties the border clip when the * VT is inactive, make sure the region isn't empty */ if (!((WindowPtr) pSrcDrawable)->parent && RegionNotEmpty(&((WindowPtr) pSrcDrawable)->borderClip)) { /* * special case bitblt from root window in * IncludeInferiors mode; just like from a pixmap */ fastSrc = TRUE; } else if ((pSrcDrawable == pDstDrawable) && (!pGC->clientClip)) { prgnSrcClip = miGetCompositeClip(pGC); } else { prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable); freeSrcClip = TRUE; } } else { prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList; } } xIn += pSrcDrawable->x; yIn += pSrcDrawable->y; xOut += pDstDrawable->x; yOut += pDstDrawable->y; box_x1 = xIn; box_y1 = yIn; box_x2 = xIn + widthSrc; box_y2 = yIn + heightSrc; dx = xIn - xOut; dy = yIn - yOut; /* Don't create a source region if we are doing a fast clip */ if (fastSrc) { RegionPtr cclip; fastExpose = TRUE; /* * clip the source; if regions extend beyond the source size, * make sure exposure events get sent */ if (box_x1 < pSrcDrawable->x) { box_x1 = pSrcDrawable->x; fastExpose = FALSE; } if (box_y1 < pSrcDrawable->y) { box_y1 = pSrcDrawable->y; fastExpose = FALSE; } if (box_x2 > pSrcDrawable->x + (int) pSrcDrawable->width) { box_x2 = pSrcDrawable->x + (int) pSrcDrawable->width; fastExpose = FALSE; } if (box_y2 > pSrcDrawable->y + (int) pSrcDrawable->height) { box_y2 = pSrcDrawable->y + (int) pSrcDrawable->height; fastExpose = FALSE; } /* Translate and clip the dst to the destination composite clip */ box_x1 -= dx; box_x2 -= dx; box_y1 -= dy; box_y2 -= dy; /* If the destination composite clip is one rectangle we can do the clip directly. Otherwise we have to create a full blown region and call intersect */ cclip = miGetCompositeClip(pGC); if (RegionNumRects(cclip) == 1) { BoxPtr pBox = RegionRects(cclip); if (box_x1 < pBox->x1) box_x1 = pBox->x1; if (box_x2 > pBox->x2) box_x2 = pBox->x2; if (box_y1 < pBox->y1) box_y1 = pBox->y1; if (box_y2 > pBox->y2) box_y2 = pBox->y2; fastDst = TRUE; } } /* Check to see if the region is empty */ if (box_x1 >= box_x2 || box_y1 >= box_y2) { RegionNull(&rgnDst); } else { BoxRec box; box.x1 = box_x1; box.y1 = box_y1; box.x2 = box_x2; box.y2 = box_y2; RegionInit(&rgnDst, &box, 1); } /* Clip against complex source if needed */ if (!fastSrc) { RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip); RegionTranslate(&rgnDst, -dx, -dy); } /* Clip against complex dest if needed */ if (!fastDst) { RegionIntersect(&rgnDst, &rgnDst, miGetCompositeClip(pGC)); } /* Do bit blitting */ numRects = RegionNumRects(&rgnDst); if (numRects && widthSrc && heightSrc) miCopyRegion(pSrcDrawable, pDstDrawable, pGC, &rgnDst, dx, dy, copyProc, bitPlane, closure); /* Pixmap sources generate a NoExposed (we return NULL to do this) */ if (!fastExpose && pGC->fExpose) prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn - pSrcDrawable->x, yIn - pSrcDrawable->y, widthSrc, heightSrc, xOut - pDstDrawable->x, yOut - pDstDrawable->y); RegionUninit(&rgnDst); if (freeSrcClip) RegionDestroy(prgnSrcClip); return prgnExposed; } xorg-server-1.20.8/mi/miline.h0000644000175000017500000001320313640201473013040 00000000000000 /* Copyright 1994, 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. */ #ifndef MILINE_H #include "screenint.h" #include "privates.h" /* * Public definitions used for configuring basic pixelization aspects * of the sample implementation line-drawing routines provided in * {mfb,mi,cfb*} at run-time. */ #define XDECREASING 4 #define YDECREASING 2 #define YMAJOR 1 #define OCTANT1 (1 << (YDECREASING)) #define OCTANT2 (1 << (YDECREASING|YMAJOR)) #define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR)) #define OCTANT4 (1 << (XDECREASING|YDECREASING)) #define OCTANT5 (1 << (XDECREASING)) #define OCTANT6 (1 << (XDECREASING|YMAJOR)) #define OCTANT7 (1 << (YMAJOR)) #define OCTANT8 (1 << (0)) #define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8) #define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5) /* * Devices can configure the rendering of routines in mi, mfb, and cfb* * by specifying a thin line bias to be applied to a particular screen * using the following function. The bias parameter is an OR'ing of * the appropriate OCTANT constants defined above to indicate which * octants to bias a line to prefer an axial step when the Bresenham * error term is exactly zero. The octants are mapped as follows: * * \ | / * \ 3 | 2 / * \ | / * 4 \ | / 1 * \|/ * ----------- * /|\ * 5 / | \ 8 * / | \ * / 6 | 7 \ * / | \ * * For more information, see "Ambiguities in Incremental Line Rastering," * Jack E. Bresenham, IEEE CG&A, May 1987. */ extern _X_EXPORT void miSetZeroLineBias(ScreenPtr /* pScreen */ , unsigned int /* bias */ ); /* * Private definitions needed for drawing thin (zero width) lines * Used by the mi, mfb, and all cfb* components. */ #define X_AXIS 0 #define Y_AXIS 1 #define OUT_LEFT 0x08 #define OUT_RIGHT 0x04 #define OUT_ABOVE 0x02 #define OUT_BELOW 0x01 #define OUTCODES(_result, _x, _y, _pbox) \ if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \ else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \ if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \ else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW; #define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \ {\ if (x < xmin) outcode |= OUT_LEFT;\ if (x > xmax) outcode |= OUT_RIGHT;\ if (y < ymin) outcode |= OUT_ABOVE;\ if (y > ymax) outcode |= OUT_BELOW;\ } #define SWAPINT(i, j) \ { int _t = i; i = j; j = _t; } #define SWAPPT(i, j) \ { DDXPointRec _t; _t = i; i = j; j = _t; } #define SWAPINT_PAIR(x1, y1, x2, y2)\ { int t = x1; x1 = x2; x2 = t;\ t = y1; y1 = y2; y2 = t;\ } #define miGetZeroLineBias(_pScreen) ((unsigned long) (unsigned long*)\ dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey)) #define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \ (_octant) = 0; \ (_sx) = (_SX); \ if (((_adx) = (_x2) - (_x1)) < 0) { \ (_adx) = -(_adx); \ (_sx = -(_sx)); \ (_octant) |= XDECREASING; \ } \ (_sy) = (_SY); \ if (((_ady) = (_y2) - (_y1)) < 0) { \ (_ady) = -(_ady); \ (_sy = -(_sy)); \ (_octant) |= YDECREASING; \ } #define SetYMajorOctant(_octant) ((_octant) |= YMAJOR) #define FIXUP_ERROR(_e, _octant, _bias) \ (_e) -= (((_bias) >> (_octant)) & 1) #define IsXMajorOctant(_octant) (!((_octant) & YMAJOR)) #define IsYMajorOctant(_octant) ((_octant) & YMAJOR) #define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING) #define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING) extern _X_EXPORT DevPrivateKeyRec miZeroLineScreenKeyRec; #define miZeroLineScreenKey (&miZeroLineScreenKeyRec) extern _X_EXPORT int miZeroClipLine(int /*xmin */ , int /*ymin */ , int /*xmax */ , int /*ymax */ , int * /*new_x1 */ , int * /*new_y1 */ , int * /*new_x2 */ , int * /*new_y2 */ , unsigned int /*adx */ , unsigned int /*ady */ , int * /*pt1_clipped */ , int * /*pt2_clipped */ , int /*octant */ , unsigned int /*bias */ , int /*oc1 */ , int /*oc2 */ ); #endif /* MILINE_H */ xorg-server-1.20.8/mi/migc.h0000644000175000017500000000401013640201473012476 00000000000000/* Copyright 1993, 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. */ #ifndef _MIGC_H #define _MIGC_H extern _X_EXPORT void miChangeGC(GCPtr pGC, unsigned long mask); extern _X_EXPORT void miDestroyGC(GCPtr pGC); extern _X_EXPORT void miDestroyClip(GCPtr pGC); extern _X_EXPORT void miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); extern _X_EXPORT void miCopyClip(GCPtr pgcDst, GCPtr pgcSrc); extern _X_EXPORT void miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst); extern _X_EXPORT void miComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable); #endif xorg-server-1.20.8/mi/miwideline.c0000644000175000017500000022174613640201473013721 00000000000000/* Copyright 1988, 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 1989 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. */ /* Author: Keith Packard, MIT X Consortium */ /* * Mostly integer wideline code. Uses a technique similar to * bresenham zero-width lines, except walks an X edge */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #ifdef _XOPEN_SOURCE #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ #include #undef _XOPEN_SOURCE #endif #include #include "windowstr.h" #include "gcstruct.h" #include "regionstr.h" #include "miwideline.h" #include "mi.h" #if 0 #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "pixmapstr.h" #include "gcstruct.h" #endif typedef struct { int count; /* number of spans */ DDXPointPtr points; /* pointer to list of start points */ int *widths; /* pointer to list of widths */ } Spans; typedef struct { int size; /* Total number of *Spans allocated */ int count; /* Number of *Spans actually in group */ Spans *group; /* List of Spans */ int ymin, ymax; /* Min, max y values encountered */ } SpanGroup; /* Rops which must use span groups */ #define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2) #define miSpansEasyRop(rop) (!miSpansCarefulRop(rop)) /* These routines maintain lists of Spans, in order to implement the ``touch-each-pixel-once'' rules of wide lines and arcs. Written by Joel McCormack, Summer 1989. */ static void miInitSpanGroup(SpanGroup * spanGroup) { spanGroup->size = 0; spanGroup->count = 0; spanGroup->group = NULL; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } /* InitSpanGroup */ #define YMIN(spans) (spans->points[0].y) #define YMAX(spans) (spans->points[spans->count-1].y) static void miSubtractSpans(SpanGroup * spanGroup, Spans * sub) { int i, subCount, spansCount; int ymin, ymax, xmin, xmax; Spans *spans; DDXPointPtr subPt, spansPt; int *subWid, *spansWid; int extra; ymin = YMIN(sub); ymax = YMAX(sub); spans = spanGroup->group; for (i = spanGroup->count; i; i--, spans++) { if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) { subCount = sub->count; subPt = sub->points; subWid = sub->widths; spansCount = spans->count; spansPt = spans->points; spansWid = spans->widths; extra = 0; for (;;) { while (spansCount && spansPt->y < subPt->y) { spansPt++; spansWid++; spansCount--; } if (!spansCount) break; while (subCount && subPt->y < spansPt->y) { subPt++; subWid++; subCount--; } if (!subCount) break; if (subPt->y == spansPt->y) { xmin = subPt->x; xmax = xmin + *subWid; if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) { ; } else if (xmin <= spansPt->x) { if (xmax >= spansPt->x + *spansWid) { memmove(spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1)); memmove(spansWid, spansWid + 1, sizeof *spansWid * (spansCount - 1)); spansPt--; spansWid--; spans->count--; extra++; } else { *spansWid = *spansWid - (xmax - spansPt->x); spansPt->x = xmax; } } else { if (xmax >= spansPt->x + *spansWid) { *spansWid = xmin - spansPt->x; } else { if (!extra) { DDXPointPtr newPt; int *newwid; #define EXTRA 8 newPt = reallocarray(spans->points, spans->count + EXTRA, sizeof(DDXPointRec)); if (!newPt) break; spansPt = newPt + (spansPt - spans->points); spans->points = newPt; newwid = reallocarray(spans->widths, spans->count + EXTRA, sizeof(int)); if (!newwid) break; spansWid = newwid + (spansWid - spans->widths); spans->widths = newwid; extra = EXTRA; } memmove(spansPt + 1, spansPt, sizeof *spansPt * (spansCount)); memmove(spansWid + 1, spansWid, sizeof *spansWid * (spansCount)); spans->count++; extra--; *spansWid = xmin - spansPt->x; spansWid++; spansPt++; *spansWid = *spansWid - (xmax - spansPt->x); spansPt->x = xmax; } } } spansPt++; spansWid++; spansCount--; } } } } static void miAppendSpans(SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans) { int ymin, ymax; int spansCount; spansCount = spans->count; if (spansCount > 0) { if (spanGroup->size == spanGroup->count) { spanGroup->size = (spanGroup->size + 8) * 2; spanGroup->group = reallocarray(spanGroup->group, sizeof(Spans), spanGroup->size); } spanGroup->group[spanGroup->count] = *spans; (spanGroup->count)++; ymin = spans->points[0].y; if (ymin < spanGroup->ymin) spanGroup->ymin = ymin; ymax = spans->points[spansCount - 1].y; if (ymax > spanGroup->ymax) spanGroup->ymax = ymax; if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) { miSubtractSpans(otherGroup, spans); } } else { free(spans->points); free(spans->widths); } } /* AppendSpans */ static void miFreeSpanGroup(SpanGroup * spanGroup) { free(spanGroup->group); } static void QuickSortSpansX(DDXPointRec points[], int widths[], int numSpans) { int x; int i, j, m; DDXPointPtr r; /* Always called with numSpans > 1 */ /* Sorts only by x, as all y should be the same */ #define ExchangeSpans(a, b) \ { \ DDXPointRec tpt; \ int tw; \ \ tpt = points[a]; points[a] = points[b]; points[b] = tpt; \ tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ } do { if (numSpans < 9) { /* Do insertion sort */ int xprev; xprev = points[0].x; i = 1; do { /* while i != numSpans */ x = points[i].x; if (xprev > x) { /* points[i] is out of order. Move into proper location. */ DDXPointRec tpt; int tw, k; for (j = 0; x >= points[j].x; j++) { } tpt = points[i]; tw = widths[i]; for (k = i; k != j; k--) { points[k] = points[k - 1]; widths[k] = widths[k - 1]; } points[j] = tpt; widths[j] = tw; x = points[i].x; } /* if out of order */ xprev = x; i++; } while (i != numSpans); return; } /* Choose partition element, stick in location 0 */ m = numSpans / 2; if (points[m].x > points[0].x) ExchangeSpans(m, 0); if (points[m].x > points[numSpans - 1].x) ExchangeSpans(m, numSpans - 1); if (points[m].x > points[0].x) ExchangeSpans(m, 0); x = points[0].x; /* Partition array */ i = 0; j = numSpans; do { r = &(points[i]); do { r++; i++; } while (i != numSpans && r->x < x); r = &(points[j]); do { r--; j--; } while (x < r->x); if (i < j) ExchangeSpans(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeSpans(0, j); /* Recurse */ if (numSpans - j - 1 > 1) QuickSortSpansX(&points[j + 1], &widths[j + 1], numSpans - j - 1); numSpans = j; } while (numSpans > 1); } /* QuickSortSpans */ static int UniquifySpansX(Spans * spans, DDXPointRec * newPoints, int *newWidths) { int newx1, newx2, oldpt, i, y; DDXPointRec *oldPoints; int *oldWidths; int *startNewWidths; /* Always called with numSpans > 1 */ /* Uniquify the spans, and stash them into newPoints and newWidths. Return the number of unique spans. */ startNewWidths = newWidths; oldPoints = spans->points; oldWidths = spans->widths; y = oldPoints->y; newx1 = oldPoints->x; newx2 = newx1 + *oldWidths; for (i = spans->count - 1; i != 0; i--) { oldPoints++; oldWidths++; oldpt = oldPoints->x; if (oldpt > newx2) { /* Write current span, start a new one */ newPoints->x = newx1; newPoints->y = y; *newWidths = newx2 - newx1; newPoints++; newWidths++; newx1 = oldpt; newx2 = oldpt + *oldWidths; } else { /* extend current span, if old extends beyond new */ oldpt = oldpt + *oldWidths; if (oldpt > newx2) newx2 = oldpt; } } /* for */ /* Write final span */ newPoints->x = newx1; *newWidths = newx2 - newx1; newPoints->y = y; return (newWidths - startNewWidths) + 1; } /* UniquifySpansX */ static void miDisposeSpanGroup(SpanGroup * spanGroup) { int i; Spans *spans; for (i = 0; i < spanGroup->count; i++) { spans = spanGroup->group + i; free(spans->points); free(spans->widths); } } static void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup) { int i; Spans *spans; Spans *yspans; int *ysizes; int ymin, ylength; /* Outgoing spans for one big call to FillSpans */ DDXPointPtr points; int *widths; int count; if (spanGroup->count == 0) return; if (spanGroup->count == 1) { /* Already should be sorted, unique */ spans = spanGroup->group; (*pGC->ops->FillSpans) (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); free(spans->points); free(spans->widths); } else { /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */ /* This seems to be the fastest thing to do. I've tried sorting on both x and y at the same time rather than creating into all those y buckets, but it was somewhat slower. */ ymin = spanGroup->ymin; ylength = spanGroup->ymax - ymin + 1; /* Allocate Spans for y buckets */ yspans = xallocarray(ylength, sizeof(Spans)); ysizes = xallocarray(ylength, sizeof(int)); if (!yspans || !ysizes) { free(yspans); free(ysizes); miDisposeSpanGroup(spanGroup); return; } for (i = 0; i != ylength; i++) { ysizes[i] = 0; yspans[i].count = 0; yspans[i].points = NULL; yspans[i].widths = NULL; } /* Go through every single span and put it into the correct bucket */ count = 0; for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { int index; int j; for (j = 0, points = spans->points, widths = spans->widths; j != spans->count; j++, points++, widths++) { index = points->y - ymin; if (index >= 0 && index < ylength) { Spans *newspans = &(yspans[index]); if (newspans->count == ysizes[index]) { DDXPointPtr newpoints; int *newwidths; ysizes[index] = (ysizes[index] + 8) * 2; newpoints = reallocarray(newspans->points, ysizes[index], sizeof(DDXPointRec)); newwidths = reallocarray(newspans->widths, ysizes[index], sizeof(int)); if (!newpoints || !newwidths) { for (i = 0; i < ylength; i++) { free(yspans[i].points); free(yspans[i].widths); } free(yspans); free(ysizes); free(newpoints); free(newwidths); miDisposeSpanGroup(spanGroup); return; } newspans->points = newpoints; newspans->widths = newwidths; } newspans->points[newspans->count] = *points; newspans->widths[newspans->count] = *widths; (newspans->count)++; } /* if y value of span in range */ } /* for j through spans */ count += spans->count; free(spans->points); spans->points = NULL; free(spans->widths); spans->widths = NULL; } /* for i thorough Spans */ /* Now sort by x and uniquify each bucket into the final array */ points = xallocarray(count, sizeof(DDXPointRec)); widths = xallocarray(count, sizeof(int)); if (!points || !widths) { for (i = 0; i < ylength; i++) { free(yspans[i].points); free(yspans[i].widths); } free(yspans); free(ysizes); free(points); free(widths); return; } count = 0; for (i = 0; i != ylength; i++) { int ycount = yspans[i].count; if (ycount > 0) { if (ycount > 1) { QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount); count += UniquifySpansX (&(yspans[i]), &(points[count]), &(widths[count])); } else { points[count] = yspans[i].points[0]; widths[count] = yspans[i].widths[0]; count++; } free(yspans[i].points); free(yspans[i].widths); } } (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE); free(points); free(widths); free(yspans); free(ysizes); /* use (DE)xalloc for these? */ } spanGroup->count = 0; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } static Bool InitSpans(Spans * spans, size_t nspans) { spans->points = xallocarray(nspans, sizeof(*spans->points)); if (!spans->points) return FALSE; spans->widths = xallocarray(nspans, sizeof(*spans->widths)); if (!spans->widths) { free(spans->points); return FALSE; } return TRUE; } /* * interface data to span-merging polygon filler */ typedef struct _SpanData { SpanGroup fgGroup, bgGroup; } SpanDataRec, *SpanDataPtr; static void AppendSpanGroup(GCPtr pGC, unsigned long pixel, Spans * spanPtr, SpanDataPtr spanData) { SpanGroup *group, *othergroup = NULL; if (pixel == pGC->fgPixel) { group = &spanData->fgGroup; if (pGC->lineStyle == LineDoubleDash) othergroup = &spanData->bgGroup; } else { group = &spanData->bgGroup; othergroup = &spanData->fgGroup; } miAppendSpans(group, othergroup, spanPtr); } static void miLineArc(DrawablePtr pDraw, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, LineFacePtr leftFace, LineFacePtr rightFace, double xorg, double yorg, Bool isInt); /* * spans-based polygon filler */ static void fillSpans(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, Spans * spans, SpanDataPtr spanData) { if (!spanData) { ChangeGCVal oldPixel, tmpPixel; oldPixel.val = pGC->fgPixel; if (pixel != oldPixel.val) { tmpPixel.val = (XID) pixel; ChangeGC(NullClient, pGC, GCForeground, &tmpPixel); ValidateGC(pDrawable, pGC); } (*pGC->ops->FillSpans) (pDrawable, pGC, spans->count, spans->points, spans->widths, TRUE); free(spans->widths); free(spans->points); if (pixel != oldPixel.val) { ChangeGC(NullClient, pGC, GCForeground, &oldPixel); ValidateGC(pDrawable, pGC); } } else AppendSpanGroup(pGC, pixel, spans, spanData); } static void miFillPolyHelper(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, int y, int overall_height, PolyEdgePtr left, PolyEdgePtr right, int left_count, int right_count) { int left_x = 0, left_e = 0; int left_stepx = 0; int left_signdx = 0; int left_dy = 0, left_dx = 0; int right_x = 0, right_e = 0; int right_stepx = 0; int right_signdx = 0; int right_dy = 0, right_dx = 0; int height = 0; int left_height = 0, right_height = 0; DDXPointPtr ppt; int *pwidth; int xorg; Spans spanRec; if (!InitSpans(&spanRec, overall_height)) return; ppt = spanRec.points; pwidth = spanRec.widths; xorg = 0; if (pGC->miTranslate) { y += pDrawable->y; xorg = pDrawable->x; } while ((left_count || left_height) && (right_count || right_height)) { if (!left_height && left_count) { left_height = left->height; left_x = left->x; left_stepx = left->stepx; left_signdx = left->signdx; left_e = left->e; left_dy = left->dy; left_dx = left->dx; --left_count; ++left; } if (!right_height && right_count) { right_height = right->height; right_x = right->x; right_stepx = right->stepx; right_signdx = right->signdx; right_e = right->e; right_dy = right->dy; right_dx = right->dx; --right_count; ++right; } height = left_height; if (height > right_height) height = right_height; left_height -= height; right_height -= height; while (--height >= 0) { if (right_x >= left_x) { ppt->y = y; ppt->x = left_x + xorg; ppt++; *pwidth++ = right_x - left_x + 1; } y++; left_x += left_stepx; left_e += left_dx; if (left_e > 0) { left_x += left_signdx; left_e -= left_dy; } right_x += right_stepx; right_e += right_dx; if (right_e > 0) { right_x += right_signdx; right_e -= right_dy; } } } spanRec.count = ppt - spanRec.points; fillSpans(pDrawable, pGC, pixel, &spanRec, spanData); } static void miFillRectPolyHelper(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, int x, int y, int w, int h) { DDXPointPtr ppt; int *pwidth; ChangeGCVal oldPixel, tmpPixel; Spans spanRec; xRectangle rect; if (!spanData) { rect.x = x; rect.y = y; rect.width = w; rect.height = h; oldPixel.val = pGC->fgPixel; if (pixel != oldPixel.val) { tmpPixel.val = (XID) pixel; ChangeGC(NullClient, pGC, GCForeground, &tmpPixel); ValidateGC(pDrawable, pGC); } (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect); if (pixel != oldPixel.val) { ChangeGC(NullClient, pGC, GCForeground, &oldPixel); ValidateGC(pDrawable, pGC); } } else { if (!InitSpans(&spanRec, h)) return; ppt = spanRec.points; pwidth = spanRec.widths; if (pGC->miTranslate) { y += pDrawable->y; x += pDrawable->x; } while (h--) { ppt->x = x; ppt->y = y; ppt++; *pwidth++ = w; y++; } spanRec.count = ppt - spanRec.points; AppendSpanGroup(pGC, pixel, &spanRec, spanData); } } static int miPolyBuildEdge(double x0, double y0, double k, /* x0 * dy - y0 * dx */ int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge) { int x, y, e; int xady; if (dy < 0) { dy = -dy; dx = -dx; k = -k; } #ifdef NOTDEF { double realk, kerror; realk = x0 * dy - y0 * dx; kerror = fabs(realk - k); if (kerror > .1) printf("realk: %g k: %g\n", realk, k); } #endif y = ICEIL(y0); xady = ICEIL(k) + y * dx; if (xady <= 0) x = -(-xady / dy) - 1; else x = (xady - 1) / dy; e = xady - x * dy; if (dx >= 0) { edge->signdx = 1; edge->stepx = dx / dy; edge->dx = dx % dy; } else { edge->signdx = -1; edge->stepx = -(-dx / dy); edge->dx = -dx % dy; e = dy - e + 1; } edge->dy = dy; edge->x = x + left + xi; edge->e = e - dy; /* bias to compare against 0 instead of dy */ return y + yi; } #define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr))) static int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes, int count, int xi, int yi, PolyEdgePtr left, PolyEdgePtr right, int *pnleft, int *pnright, int *h) { int top, bottom; double miny, maxy; int i; int j; int clockwise; int slopeoff; int s; int nright, nleft; int y, lasty = 0, bottomy, topy = 0; /* find the top of the polygon */ maxy = miny = vertices[0].y; bottom = top = 0; for (i = 1; i < count; i++) { if (vertices[i].y < miny) { top = i; miny = vertices[i].y; } if (vertices[i].y >= maxy) { bottom = i; maxy = vertices[i].y; } } clockwise = 1; slopeoff = 0; i = top; j = StepAround(top, -1, count); if ((int64_t) slopes[j].dy * slopes[i].dx > (int64_t) slopes[i].dy * slopes[j].dx) { clockwise = -1; slopeoff = -1; } bottomy = ICEIL(maxy) + yi; nright = 0; s = StepAround(top, slopeoff, count); i = top; while (i != bottom) { if (slopes[s].dy != 0) { y = miPolyBuildEdge(vertices[i].x, vertices[i].y, slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 0, &right[nright]); if (nright != 0) right[nright - 1].height = y - lasty; else topy = y; nright++; lasty = y; } i = StepAround(i, clockwise, count); s = StepAround(s, clockwise, count); } if (nright != 0) right[nright - 1].height = bottomy - lasty; if (slopeoff == 0) slopeoff = -1; else slopeoff = 0; nleft = 0; s = StepAround(top, slopeoff, count); i = top; while (i != bottom) { if (slopes[s].dy != 0) { y = miPolyBuildEdge(vertices[i].x, vertices[i].y, slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 1, &left[nleft]); if (nleft != 0) left[nleft - 1].height = y - lasty; nleft++; lasty = y; } i = StepAround(i, -clockwise, count); s = StepAround(s, -clockwise, count); } if (nleft != 0) left[nleft - 1].height = bottomy - lasty; *pnleft = nleft; *pnright = nright; *h = bottomy - topy; return topy; } static void miLineOnePoint(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, int x, int y) { DDXPointRec pt; int wid; unsigned long oldPixel; MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel); if (pGC->fillStyle == FillSolid) { pt.x = x; pt.y = y; (*pGC->ops->PolyPoint) (pDrawable, pGC, CoordModeOrigin, 1, &pt); } else { wid = 1; if (pGC->miTranslate) { x += pDrawable->x; y += pDrawable->y; } pt.x = x; pt.y = y; (*pGC->ops->FillSpans) (pDrawable, pGC, 1, &pt, &wid, TRUE); } MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel); } static void miLineJoin(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, LineFacePtr pLeft, LineFacePtr pRight) { double mx = 0, my = 0; double denom = 0.0; PolyVertexRec vertices[4]; PolySlopeRec slopes[4]; int edgecount; PolyEdgeRec left[4], right[4]; int nleft, nright; int y, height; int swapslopes; int joinStyle = pGC->joinStyle; int lw = pGC->lineWidth; if (lw == 1 && !spanData) { /* See if one of the lines will draw the joining pixel */ if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0)) return; if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0)) return; if (joinStyle != JoinRound) { denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; if (denom == 0) return; /* no join to draw */ } if (joinStyle != JoinMiter) { miLineOnePoint(pDrawable, pGC, pixel, spanData, pLeft->x, pLeft->y); return; } } else { if (joinStyle == JoinRound) { miLineArc(pDrawable, pGC, pixel, spanData, pLeft, pRight, (double) 0.0, (double) 0.0, TRUE); return; } denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; if (denom == 0.0) return; /* no join to draw */ } swapslopes = 0; if (denom > 0) { pLeft->xa = -pLeft->xa; pLeft->ya = -pLeft->ya; pLeft->dx = -pLeft->dx; pLeft->dy = -pLeft->dy; } else { swapslopes = 1; pRight->xa = -pRight->xa; pRight->ya = -pRight->ya; pRight->dx = -pRight->dx; pRight->dy = -pRight->dy; } vertices[0].x = pRight->xa; vertices[0].y = pRight->ya; slopes[0].dx = -pRight->dy; slopes[0].dy = pRight->dx; slopes[0].k = 0; vertices[1].x = 0; vertices[1].y = 0; slopes[1].dx = pLeft->dy; slopes[1].dy = -pLeft->dx; slopes[1].k = 0; vertices[2].x = pLeft->xa; vertices[2].y = pLeft->ya; if (joinStyle == JoinMiter) { my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) / denom; if (pLeft->dy != 0) { mx = pLeft->xa + (my - pLeft->ya) * (double) pLeft->dx / (double) pLeft->dy; } else { mx = pRight->xa + (my - pRight->ya) * (double) pRight->dx / (double) pRight->dy; } /* check miter limit */ if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) joinStyle = JoinBevel; } if (joinStyle == JoinMiter) { slopes[2].dx = pLeft->dx; slopes[2].dy = pLeft->dy; slopes[2].k = pLeft->k; if (swapslopes) { slopes[2].dx = -slopes[2].dx; slopes[2].dy = -slopes[2].dy; slopes[2].k = -slopes[2].k; } vertices[3].x = mx; vertices[3].y = my; slopes[3].dx = pRight->dx; slopes[3].dy = pRight->dy; slopes[3].k = pRight->k; if (swapslopes) { slopes[3].dx = -slopes[3].dx; slopes[3].dy = -slopes[3].dy; slopes[3].k = -slopes[3].k; } edgecount = 4; } else { double scale, dx, dy, adx, ady; adx = dx = pRight->xa - pLeft->xa; ady = dy = pRight->ya - pLeft->ya; if (adx < 0) adx = -adx; if (ady < 0) ady = -ady; scale = ady; if (adx > ady) scale = adx; slopes[2].dx = (dx * 65536) / scale; slopes[2].dy = (dy * 65536) / scale; slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; edgecount = 3; } y = miPolyBuildPoly(vertices, slopes, edgecount, pLeft->x, pLeft->y, left, right, &nleft, &nright, &height); miFillPolyHelper(pDrawable, pGC, pixel, spanData, y, height, left, right, nleft, nright); } static int miLineArcI(DrawablePtr pDraw, GCPtr pGC, int xorg, int yorg, DDXPointPtr points, int *widths) { DDXPointPtr tpts, bpts; int *twids, *bwids; int x, y, e, ex, slw; tpts = points; twids = widths; if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } slw = pGC->lineWidth; if (slw == 1) { tpts->x = xorg; tpts->y = yorg; *twids = 1; return 1; } bpts = tpts + slw; bwids = twids + slw; y = (slw >> 1) + 1; if (slw & 1) e = -((y << 2) + 3); else e = -(y << 3); ex = -4; x = 0; while (y) { e += (y << 3) - 4; while (e >= 0) { x++; e += (ex = -((x << 3) + 4)); } y--; slw = (x << 1) + 1; if ((e == ex) && (slw > 1)) slw--; tpts->x = xorg - x; tpts->y = yorg - y; tpts++; *twids++ = slw; if ((y != 0) && ((slw > 1) || (e != ex))) { bpts--; bpts->x = xorg - x; bpts->y = yorg + y; *--bwids = slw; } } return pGC->lineWidth; } #define CLIPSTEPEDGE(edgey,edge,edgeleft) \ if (ybase == edgey) \ { \ if (edgeleft) \ { \ if (edge->x > xcl) \ xcl = edge->x; \ } \ else \ { \ if (edge->x < xcr) \ xcr = edge->x; \ } \ edgey++; \ edge->x += edge->stepx; \ edge->e += edge->dx; \ if (edge->e > 0) \ { \ edge->x += edge->signdx; \ edge->e -= edge->dy; \ } \ } static int miLineArcD(DrawablePtr pDraw, GCPtr pGC, double xorg, double yorg, DDXPointPtr points, int *widths, PolyEdgePtr edge1, int edgey1, Bool edgeleft1, PolyEdgePtr edge2, int edgey2, Bool edgeleft2) { DDXPointPtr pts; int *wids; double radius, x0, y0, el, er, yk, xlk, xrk, k; int xbase, ybase, y, boty, xl, xr, xcl, xcr; int ymin, ymax; Bool edge1IsMin, edge2IsMin; int ymin1, ymin2; pts = points; wids = widths; xbase = floor(xorg); x0 = xorg - xbase; ybase = ICEIL(yorg); y0 = yorg - ybase; if (pGC->miTranslate) { xbase += pDraw->x; ybase += pDraw->y; edge1->x += pDraw->x; edge2->x += pDraw->x; edgey1 += pDraw->y; edgey2 += pDraw->y; } xlk = x0 + x0 + 1.0; xrk = x0 + x0 - 1.0; yk = y0 + y0 - 1.0; radius = ((double) pGC->lineWidth) / 2.0; y = floor(radius - y0 + 1.0); ybase -= y; ymin = ybase; ymax = 65536; edge1IsMin = FALSE; ymin1 = edgey1; if (edge1->dy >= 0) { if (!edge1->dy) { if (edgeleft1) edge1IsMin = TRUE; else ymax = edgey1; edgey1 = 65536; } else { if ((edge1->signdx < 0) == edgeleft1) edge1IsMin = TRUE; } } edge2IsMin = FALSE; ymin2 = edgey2; if (edge2->dy >= 0) { if (!edge2->dy) { if (edgeleft2) edge2IsMin = TRUE; else ymax = edgey2; edgey2 = 65536; } else { if ((edge2->signdx < 0) == edgeleft2) edge2IsMin = TRUE; } } if (edge1IsMin) { ymin = ymin1; if (edge2IsMin && ymin1 > ymin2) ymin = ymin2; } else if (edge2IsMin) ymin = ymin2; el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); er = el + xrk; xl = 1; xr = 0; if (x0 < 0.5) { xl = 0; el -= xlk; } boty = (y0 < -0.5) ? 1 : 0; if (ybase + y - boty > ymax) boty = ymax - ybase - y; while (y > boty) { k = (y << 1) + yk; er += k; while (er > 0.0) { xr++; er += xrk - (xr << 1); } el += k; while (el >= 0.0) { xl--; el += (xl << 1) - xlk; } y--; ybase++; if (ybase < ymin) continue; xcl = xl + xbase; xcr = xr + xbase; CLIPSTEPEDGE(edgey1, edge1, edgeleft1); CLIPSTEPEDGE(edgey2, edge2, edgeleft2); if (xcr >= xcl) { pts->x = xcl; pts->y = ybase; pts++; *wids++ = xcr - xcl + 1; } } er = xrk - (xr << 1) - er; el = (xl << 1) - xlk - el; boty = floor(-y0 - radius + 1.0); if (ybase + y - boty > ymax) boty = ymax - ybase - y; while (y > boty) { k = (y << 1) + yk; er -= k; while ((er >= 0.0) && (xr >= 0)) { xr--; er += xrk - (xr << 1); } el -= k; while ((el > 0.0) && (xl <= 0)) { xl++; el += (xl << 1) - xlk; } y--; ybase++; if (ybase < ymin) continue; xcl = xl + xbase; xcr = xr + xbase; CLIPSTEPEDGE(edgey1, edge1, edgeleft1); CLIPSTEPEDGE(edgey2, edge2, edgeleft2); if (xcr >= xcl) { pts->x = xcl; pts->y = ybase; pts++; *wids++ = xcr - xcl + 1; } } return pts - points; } static int miRoundJoinFace(LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge) { int y; int dx, dy; double xa, ya; Bool left; dx = -face->dy; dy = face->dx; xa = face->xa; ya = face->ya; left = 1; if (ya > 0) { ya = 0.0; xa = 0.0; } if (dy < 0 || (dy == 0 && dx > 0)) { dx = -dx; dy = -dy; left = !left; } if (dx == 0 && dy == 0) dy = 1; if (dy == 0) { y = ICEIL(face->ya) + face->y; edge->x = -32767; edge->stepx = 0; edge->signdx = 0; edge->e = -1; edge->dy = 0; edge->dx = 0; edge->height = 0; } else { y = miPolyBuildEdge(xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge); edge->height = 32767; } *leftEdge = !left; return y; } static void miRoundJoinClip(LineFacePtr pLeft, LineFacePtr pRight, PolyEdgePtr edge1, PolyEdgePtr edge2, int *y1, int *y2, Bool *left1, Bool *left2) { double denom; denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; if (denom >= 0) { pLeft->xa = -pLeft->xa; pLeft->ya = -pLeft->ya; } else { pRight->xa = -pRight->xa; pRight->ya = -pRight->ya; } *y1 = miRoundJoinFace(pLeft, edge1, left1); *y2 = miRoundJoinFace(pRight, edge2, left2); } static int miRoundCapClip(LineFacePtr face, Bool isInt, PolyEdgePtr edge, Bool *leftEdge) { int y; int dx, dy; double xa, ya, k; Bool left; dx = -face->dy; dy = face->dx; xa = face->xa; ya = face->ya; k = 0.0; if (!isInt) k = face->k; left = 1; if (dy < 0 || (dy == 0 && dx > 0)) { dx = -dx; dy = -dy; xa = -xa; ya = -ya; left = !left; } if (dx == 0 && dy == 0) dy = 1; if (dy == 0) { y = ICEIL(face->ya) + face->y; edge->x = -32767; edge->stepx = 0; edge->signdx = 0; edge->e = -1; edge->dy = 0; edge->dx = 0; edge->height = 0; } else { y = miPolyBuildEdge(xa, ya, k, dx, dy, face->x, face->y, !left, edge); edge->height = 32767; } *leftEdge = !left; return y; } static void miLineArc(DrawablePtr pDraw, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, LineFacePtr leftFace, LineFacePtr rightFace, double xorg, double yorg, Bool isInt) { int xorgi = 0, yorgi = 0; Spans spanRec; int n; PolyEdgeRec edge1 = { 0 }, edge2 = { 0 }; int edgey1, edgey2; Bool edgeleft1, edgeleft2; if (isInt) { xorgi = leftFace ? leftFace->x : rightFace->x; yorgi = leftFace ? leftFace->y : rightFace->y; } edgey1 = 65536; edgey2 = 65536; edge1.x = 0; /* not used, keep memory checkers happy */ edge1.dy = -1; edge2.x = 0; /* not used, keep memory checkers happy */ edge2.dy = -1; edgeleft1 = FALSE; edgeleft2 = FALSE; if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) && ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { if (isInt) { xorg = (double) xorgi; yorg = (double) yorgi; } if (leftFace && rightFace) { miRoundJoinClip(leftFace, rightFace, &edge1, &edge2, &edgey1, &edgey2, &edgeleft1, &edgeleft2); } else if (leftFace) { edgey1 = miRoundCapClip(leftFace, isInt, &edge1, &edgeleft1); } else if (rightFace) { edgey2 = miRoundCapClip(rightFace, isInt, &edge2, &edgeleft2); } isInt = FALSE; } if (!InitSpans(&spanRec, pGC->lineWidth)) return; if (isInt) n = miLineArcI(pDraw, pGC, xorgi, yorgi, spanRec.points, spanRec.widths); else n = miLineArcD(pDraw, pGC, xorg, yorg, spanRec.points, spanRec.widths, &edge1, edgey1, edgeleft1, &edge2, edgey2, edgeleft2); spanRec.count = n; fillSpans(pDraw, pGC, pixel, &spanRec, spanData); } static void miLineProjectingCap(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, LineFacePtr face, Bool isLeft, double xorg, double yorg, Bool isInt) { int xorgi = 0, yorgi = 0; int lw; PolyEdgeRec lefts[4], rights[4]; int lefty, righty, topy, bottomy; PolyEdgePtr left, right; PolyEdgePtr top, bottom; double xa, ya; double k; double xap, yap; int dx, dy; double projectXoff, projectYoff; double maxy; int finaly; if (isInt) { xorgi = face->x; yorgi = face->y; } lw = pGC->lineWidth; dx = face->dx; dy = face->dy; k = face->k; if (dy == 0) { lefts[0].height = lw; lefts[0].x = xorgi; if (isLeft) lefts[0].x -= (lw >> 1); lefts[0].stepx = 0; lefts[0].signdx = 1; lefts[0].e = -lw; lefts[0].dx = 0; lefts[0].dy = lw; rights[0].height = lw; rights[0].x = xorgi; if (!isLeft) rights[0].x += ((lw + 1) >> 1); rights[0].stepx = 0; rights[0].signdx = 1; rights[0].e = -lw; rights[0].dx = 0; rights[0].dy = lw; miFillPolyHelper(pDrawable, pGC, pixel, spanData, yorgi - (lw >> 1), lw, lefts, rights, 1, 1); } else if (dx == 0) { if (dy < 0) { dy = -dy; isLeft = !isLeft; } topy = yorgi; bottomy = yorgi + dy; if (isLeft) topy -= (lw >> 1); else bottomy += (lw >> 1); lefts[0].height = bottomy - topy; lefts[0].x = xorgi - (lw >> 1); lefts[0].stepx = 0; lefts[0].signdx = 1; lefts[0].e = -dy; lefts[0].dx = dx; lefts[0].dy = dy; rights[0].height = bottomy - topy; rights[0].x = lefts[0].x + (lw - 1); rights[0].stepx = 0; rights[0].signdx = 1; rights[0].e = -dy; rights[0].dx = dx; rights[0].dy = dy; miFillPolyHelper(pDrawable, pGC, pixel, spanData, topy, bottomy - topy, lefts, rights, 1, 1); } else { xa = face->xa; ya = face->ya; projectXoff = -ya; projectYoff = xa; if (dx < 0) { right = &rights[1]; left = &lefts[0]; top = &rights[0]; bottom = &lefts[1]; } else { right = &rights[0]; left = &lefts[1]; top = &lefts[0]; bottom = &rights[1]; } if (isLeft) { righty = miPolyBuildEdge(xa, ya, k, dx, dy, xorgi, yorgi, 0, right); xa = -xa; ya = -ya; k = -k; lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff, k, dx, dy, xorgi, yorgi, 1, left); if (dx > 0) { ya = -ya; xa = -xa; } xap = xa - projectXoff; yap = ya - projectYoff; topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy, -dy, dx, xorgi, yorgi, dx > 0, top); bottomy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom); maxy = -ya; } else { righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff, k, dx, dy, xorgi, yorgi, 0, right); xa = -xa; ya = -ya; k = -k; lefty = miPolyBuildEdge(xa, ya, k, dx, dy, xorgi, yorgi, 1, left); if (dx > 0) { ya = -ya; xa = -xa; } xap = xa - projectXoff; yap = ya - projectYoff; topy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top); bottomy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy, -dy, dx, xorgi, xorgi, dx < 0, bottom); maxy = -ya + projectYoff; } finaly = ICEIL(maxy) + yorgi; if (dx < 0) { left->height = bottomy - lefty; right->height = finaly - righty; top->height = righty - topy; } else { right->height = bottomy - righty; left->height = finaly - lefty; top->height = lefty - topy; } bottom->height = finaly - bottomy; miFillPolyHelper(pDrawable, pGC, pixel, spanData, topy, bottom->height + bottomy - topy, lefts, rights, 2, 2); } } static void miWideSegment(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, int x1, int y1, int x2, int y2, Bool projectLeft, Bool projectRight, LineFacePtr leftFace, LineFacePtr rightFace) { double l, L, r; double xa, ya; double projectXoff = 0.0, projectYoff = 0.0; double k; double maxy; int x, y; int dx, dy; int finaly; PolyEdgePtr left, right; PolyEdgePtr top, bottom; int lefty, righty, topy, bottomy; int signdx; PolyEdgeRec lefts[4], rights[4]; LineFacePtr tface; int lw = pGC->lineWidth; /* draw top-to-bottom always */ if (y2 < y1 || (y2 == y1 && x2 < x1)) { x = x1; x1 = x2; x2 = x; y = y1; y1 = y2; y2 = y; x = projectLeft; projectLeft = projectRight; projectRight = x; tface = leftFace; leftFace = rightFace; rightFace = tface; } dy = y2 - y1; signdx = 1; dx = x2 - x1; if (dx < 0) signdx = -1; leftFace->x = x1; leftFace->y = y1; leftFace->dx = dx; leftFace->dy = dy; rightFace->x = x2; rightFace->y = y2; rightFace->dx = -dx; rightFace->dy = -dy; if (dy == 0) { rightFace->xa = 0; rightFace->ya = (double) lw / 2.0; rightFace->k = -(double) (lw * dx) / 2.0; leftFace->xa = 0; leftFace->ya = -rightFace->ya; leftFace->k = rightFace->k; x = x1; if (projectLeft) x -= (lw >> 1); y = y1 - (lw >> 1); dx = x2 - x; if (projectRight) dx += ((lw + 1) >> 1); dy = lw; miFillRectPolyHelper(pDrawable, pGC, pixel, spanData, x, y, dx, dy); } else if (dx == 0) { leftFace->xa = (double) lw / 2.0; leftFace->ya = 0; leftFace->k = (double) (lw * dy) / 2.0; rightFace->xa = -leftFace->xa; rightFace->ya = 0; rightFace->k = leftFace->k; y = y1; if (projectLeft) y -= lw >> 1; x = x1 - (lw >> 1); dy = y2 - y; if (projectRight) dy += ((lw + 1) >> 1); dx = lw; miFillRectPolyHelper(pDrawable, pGC, pixel, spanData, x, y, dx, dy); } else { l = ((double) lw) / 2.0; L = hypot((double) dx, (double) dy); if (dx < 0) { right = &rights[1]; left = &lefts[0]; top = &rights[0]; bottom = &lefts[1]; } else { right = &rights[0]; left = &lefts[1]; top = &lefts[0]; bottom = &rights[1]; } r = l / L; /* coord of upper bound at integral y */ ya = -r * dx; xa = r * dy; if (projectLeft | projectRight) { projectXoff = -ya; projectYoff = xa; } /* xa * dy - ya * dx */ k = l * L; leftFace->xa = xa; leftFace->ya = ya; leftFace->k = k; rightFace->xa = -xa; rightFace->ya = -ya; rightFace->k = k; if (projectLeft) righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff, k, dx, dy, x1, y1, 0, right); else righty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 0, right); /* coord of lower bound at integral y */ ya = -ya; xa = -xa; /* xa * dy - ya * dx */ k = -k; if (projectLeft) lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff, k, dx, dy, x1, y1, 1, left); else lefty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 1, left); /* coord of top face at integral y */ if (signdx > 0) { ya = -ya; xa = -xa; } if (projectLeft) { double xap = xa - projectXoff; double yap = ya - projectYoff; topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy, -dy, dx, x1, y1, dx > 0, top); } else topy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top); /* coord of bottom face at integral y */ if (projectRight) { double xap = xa + projectXoff; double yap = ya + projectYoff; bottomy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy, -dy, dx, x2, y2, dx < 0, bottom); maxy = -ya + projectYoff; } else { bottomy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, x2, y2, dx < 0, bottom); maxy = -ya; } finaly = ICEIL(maxy) + y2; if (dx < 0) { left->height = bottomy - lefty; right->height = finaly - righty; top->height = righty - topy; } else { right->height = bottomy - righty; left->height = finaly - lefty; top->height = lefty - topy; } bottom->height = finaly - bottomy; miFillPolyHelper(pDrawable, pGC, pixel, spanData, topy, bottom->height + bottomy - topy, lefts, rights, 2, 2); } } static SpanDataPtr miSetupSpanData(GCPtr pGC, SpanDataPtr spanData, int npt) { if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu)) return (SpanDataPtr) NULL; if (pGC->lineStyle == LineDoubleDash) miInitSpanGroup(&spanData->bgGroup); miInitSpanGroup(&spanData->fgGroup); return spanData; } static void miCleanupSpanData(DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData) { if (pGC->lineStyle == LineDoubleDash) { ChangeGCVal oldPixel, pixel; pixel.val = pGC->bgPixel; oldPixel.val = pGC->fgPixel; if (pixel.val != oldPixel.val) { ChangeGC(NullClient, pGC, GCForeground, &pixel); ValidateGC(pDrawable, pGC); } miFillUniqueSpanGroup(pDrawable, pGC, &spanData->bgGroup); miFreeSpanGroup(&spanData->bgGroup); if (pixel.val != oldPixel.val) { ChangeGC(NullClient, pGC, GCForeground, &oldPixel); ValidateGC(pDrawable, pGC); } } miFillUniqueSpanGroup(pDrawable, pGC, &spanData->fgGroup); miFreeSpanGroup(&spanData->fgGroup); } void miWideLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pPts) { int x1, y1, x2, y2; SpanDataRec spanDataRec; SpanDataPtr spanData; long pixel; Bool projectLeft, projectRight; LineFaceRec leftFace, rightFace, prevRightFace; LineFaceRec firstFace; int first; Bool somethingDrawn = FALSE; Bool selfJoin; spanData = miSetupSpanData(pGC, &spanDataRec, npt); pixel = pGC->fgPixel; x2 = pPts->x; y2 = pPts->y; first = TRUE; selfJoin = FALSE; if (npt > 1) { if (mode == CoordModePrevious) { int nptTmp; DDXPointPtr pPtsTmp; x1 = x2; y1 = y2; nptTmp = npt; pPtsTmp = pPts + 1; while (--nptTmp) { x1 += pPtsTmp->x; y1 += pPtsTmp->y; ++pPtsTmp; } if (x2 == x1 && y2 == y1) selfJoin = TRUE; } else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) { selfJoin = TRUE; } } projectLeft = pGC->capStyle == CapProjecting && !selfJoin; projectRight = FALSE; while (--npt) { x1 = x2; y1 = y2; ++pPts; x2 = pPts->x; y2 = pPts->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } if (x1 != x2 || y1 != y2) { somethingDrawn = TRUE; if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin) projectRight = TRUE; miWideSegment(pDrawable, pGC, pixel, spanData, x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); if (first) { if (selfJoin) firstFace = leftFace; else if (pGC->capStyle == CapRound) { if (pGC->lineWidth == 1 && !spanData) miLineOnePoint(pDrawable, pGC, pixel, spanData, x1, y1); else miLineArc(pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); } } else { miLineJoin(pDrawable, pGC, pixel, spanData, &leftFace, &prevRightFace); } prevRightFace = rightFace; first = FALSE; projectLeft = FALSE; } if (npt == 1 && somethingDrawn) { if (selfJoin) miLineJoin(pDrawable, pGC, pixel, spanData, &firstFace, &rightFace); else if (pGC->capStyle == CapRound) { if (pGC->lineWidth == 1 && !spanData) miLineOnePoint(pDrawable, pGC, pixel, spanData, x2, y2); else miLineArc(pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); } } } /* handle crock where all points are coincedent */ if (!somethingDrawn) { projectLeft = pGC->capStyle == CapProjecting; miWideSegment(pDrawable, pGC, pixel, spanData, x2, y2, x2, y2, projectLeft, projectLeft, &leftFace, &rightFace); if (pGC->capStyle == CapRound) { miLineArc(pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); rightFace.dx = -1; /* sleezy hack to make it work */ miLineArc(pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); } } if (spanData) miCleanupSpanData(pDrawable, pGC, spanData); } #define V_TOP 0 #define V_RIGHT 1 #define V_BOTTOM 2 #define V_LEFT 3 static void miWideDashSegment(DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData, int *pDashOffset, int *pDashIndex, int x1, int y1, int x2, int y2, Bool projectLeft, Bool projectRight, LineFacePtr leftFace, LineFacePtr rightFace) { int dashIndex, dashRemain; unsigned char *pDash; double L, l; double k; PolyVertexRec vertices[4]; PolyVertexRec saveRight, saveBottom; PolySlopeRec slopes[4]; PolyEdgeRec left[4], right[4]; LineFaceRec lcapFace, rcapFace; int nleft, nright; int h; int y; int dy, dx; unsigned long pixel; double LRemain; double r; double rdx, rdy; double dashDx, dashDy; double saveK = 0.0; Bool first = TRUE; double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0; unsigned long fgPixel, bgPixel; dx = x2 - x1; dy = y2 - y1; dashIndex = *pDashIndex; pDash = pGC->dash; dashRemain = pDash[dashIndex] - *pDashOffset; fgPixel = pGC->fgPixel; bgPixel = pGC->bgPixel; if (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled) { bgPixel = fgPixel; } l = ((double) pGC->lineWidth) / 2.0; if (dx == 0) { L = dy; rdx = 0; rdy = l; if (dy < 0) { L = -dy; rdy = -l; } } else if (dy == 0) { L = dx; rdx = l; rdy = 0; if (dx < 0) { L = -dx; rdx = -l; } } else { L = hypot((double) dx, (double) dy); r = l / L; rdx = r * dx; rdy = r * dy; } k = l * L; LRemain = L; /* All position comments are relative to a line with dx and dy > 0, * but the code does not depend on this */ /* top */ slopes[V_TOP].dx = dx; slopes[V_TOP].dy = dy; slopes[V_TOP].k = k; /* right */ slopes[V_RIGHT].dx = -dy; slopes[V_RIGHT].dy = dx; slopes[V_RIGHT].k = 0; /* bottom */ slopes[V_BOTTOM].dx = -dx; slopes[V_BOTTOM].dy = -dy; slopes[V_BOTTOM].k = k; /* left */ slopes[V_LEFT].dx = dy; slopes[V_LEFT].dy = -dx; slopes[V_LEFT].k = 0; /* preload the start coordinates */ vertices[V_RIGHT].x = vertices[V_TOP].x = rdy; vertices[V_RIGHT].y = vertices[V_TOP].y = -rdx; vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy; vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx; if (projectLeft) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = rdx * dx + rdy * dy; } lcenterx = x1; lcentery = y1; if (pGC->capStyle == CapRound) { lcapFace.dx = dx; lcapFace.dy = dy; lcapFace.x = x1; lcapFace.y = y1; rcapFace.dx = -dx; rcapFace.dy = -dy; rcapFace.x = x1; rcapFace.y = y1; } while (LRemain > dashRemain) { dashDx = (dashRemain * dx) / L; dashDy = (dashRemain * dy) / L; rcenterx = lcenterx + dashDx; rcentery = lcentery + dashDy; vertices[V_RIGHT].x += dashDx; vertices[V_RIGHT].y += dashDy; vertices[V_BOTTOM].x += dashDx; vertices[V_BOTTOM].y += dashDy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy; if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { if (pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { saveRight = vertices[V_RIGHT]; saveBottom = vertices[V_BOTTOM]; saveK = slopes[V_RIGHT].k; if (!first) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = vertices[V_LEFT].x * slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; } vertices[V_RIGHT].x += rdx; vertices[V_RIGHT].y += rdy; vertices[V_BOTTOM].x += rdx; vertices[V_BOTTOM].y += rdy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; } y = miPolyBuildPoly(vertices, slopes, 4, x1, y1, left, right, &nleft, &nright, &h); pixel = (dashIndex & 1) ? bgPixel : fgPixel; miFillPolyHelper(pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright); if (pGC->lineStyle == LineOnOffDash) { switch (pGC->capStyle) { case CapProjecting: vertices[V_BOTTOM] = saveBottom; vertices[V_RIGHT] = saveRight; slopes[V_RIGHT].k = saveK; break; case CapRound: if (!first) { if (dx < 0) { lcapFace.xa = -vertices[V_LEFT].x; lcapFace.ya = -vertices[V_LEFT].y; lcapFace.k = slopes[V_LEFT].k; } else { lcapFace.xa = vertices[V_TOP].x; lcapFace.ya = vertices[V_TOP].y; lcapFace.k = -slopes[V_LEFT].k; } miLineArc(pDrawable, pGC, pixel, spanData, &lcapFace, (LineFacePtr) NULL, lcenterx, lcentery, FALSE); } if (dx < 0) { rcapFace.xa = vertices[V_BOTTOM].x; rcapFace.ya = vertices[V_BOTTOM].y; rcapFace.k = slopes[V_RIGHT].k; } else { rcapFace.xa = -vertices[V_RIGHT].x; rcapFace.ya = -vertices[V_RIGHT].y; rcapFace.k = -slopes[V_RIGHT].k; } miLineArc(pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rcapFace, rcenterx, rcentery, FALSE); break; } } } LRemain -= dashRemain; ++dashIndex; if (dashIndex == pGC->numInDashList) dashIndex = 0; dashRemain = pDash[dashIndex]; lcenterx = rcenterx; lcentery = rcentery; vertices[V_TOP] = vertices[V_RIGHT]; vertices[V_LEFT] = vertices[V_BOTTOM]; slopes[V_LEFT].k = -slopes[V_RIGHT].k; first = FALSE; } if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { vertices[V_TOP].x -= dx; vertices[V_TOP].y -= dy; vertices[V_LEFT].x -= dx; vertices[V_LEFT].y -= dy; vertices[V_RIGHT].x = rdy; vertices[V_RIGHT].y = -rdx; vertices[V_BOTTOM].x = -rdy; vertices[V_BOTTOM].y = rdx; if (projectRight) { vertices[V_RIGHT].x += rdx; vertices[V_RIGHT].y += rdy; vertices[V_BOTTOM].x += rdx; vertices[V_BOTTOM].y += rdy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; } else slopes[V_RIGHT].k = 0; if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = vertices[V_LEFT].x * slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; } else slopes[V_LEFT].k += dx * dx + dy * dy; y = miPolyBuildPoly(vertices, slopes, 4, x2, y2, left, right, &nleft, &nright, &h); pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel; miFillPolyHelper(pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright); if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapRound) { lcapFace.x = x2; lcapFace.y = y2; if (dx < 0) { lcapFace.xa = -vertices[V_LEFT].x; lcapFace.ya = -vertices[V_LEFT].y; lcapFace.k = slopes[V_LEFT].k; } else { lcapFace.xa = vertices[V_TOP].x; lcapFace.ya = vertices[V_TOP].y; lcapFace.k = -slopes[V_LEFT].k; } miLineArc(pDrawable, pGC, pixel, spanData, &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE); } } dashRemain = ((double) dashRemain) - LRemain; if (dashRemain == 0) { dashIndex++; if (dashIndex == pGC->numInDashList) dashIndex = 0; dashRemain = pDash[dashIndex]; } leftFace->x = x1; leftFace->y = y1; leftFace->dx = dx; leftFace->dy = dy; leftFace->xa = rdy; leftFace->ya = -rdx; leftFace->k = k; rightFace->x = x2; rightFace->y = y2; rightFace->dx = -dx; rightFace->dy = -dy; rightFace->xa = -rdy; rightFace->ya = rdx; rightFace->k = k; *pDashIndex = dashIndex; *pDashOffset = pDash[dashIndex] - dashRemain; } void miWideDash(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pPts) { int x1, y1, x2, y2; unsigned long pixel; Bool projectLeft, projectRight; LineFaceRec leftFace, rightFace, prevRightFace; LineFaceRec firstFace; int first; int dashIndex, dashOffset; int prevDashIndex; SpanDataRec spanDataRec; SpanDataPtr spanData; Bool somethingDrawn = FALSE; Bool selfJoin; Bool endIsFg = FALSE, startIsFg = FALSE; Bool firstIsFg = FALSE, prevIsFg = FALSE; #if 0 /* XXX backward compatibility */ if (pGC->lineWidth == 0) { miZeroDashLine(pDrawable, pGC, mode, npt, pPts); return; } #endif if (pGC->lineStyle == LineDoubleDash && (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled)) { miWideLine(pDrawable, pGC, mode, npt, pPts); return; } if (npt == 0) return; spanData = miSetupSpanData(pGC, &spanDataRec, npt); x2 = pPts->x; y2 = pPts->y; first = TRUE; selfJoin = FALSE; if (mode == CoordModePrevious) { int nptTmp; DDXPointPtr pPtsTmp; x1 = x2; y1 = y2; nptTmp = npt; pPtsTmp = pPts + 1; while (--nptTmp) { x1 += pPtsTmp->x; y1 += pPtsTmp->y; ++pPtsTmp; } if (x2 == x1 && y2 == y1) selfJoin = TRUE; } else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) { selfJoin = TRUE; } projectLeft = pGC->capStyle == CapProjecting && !selfJoin; projectRight = FALSE; dashIndex = 0; dashOffset = 0; miStepDash((int) pGC->dashOffset, &dashIndex, pGC->dash, (int) pGC->numInDashList, &dashOffset); while (--npt) { x1 = x2; y1 = y2; ++pPts; x2 = pPts->x; y2 = pPts->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } if (x1 != x2 || y1 != y2) { somethingDrawn = TRUE; if (npt == 1 && pGC->capStyle == CapProjecting && (!selfJoin || !firstIsFg)) projectRight = TRUE; prevDashIndex = dashIndex; miWideDashSegment(pDrawable, pGC, spanData, &dashOffset, &dashIndex, x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); startIsFg = !(prevDashIndex & 1); endIsFg = (dashIndex & 1) ^ (dashOffset != 0); if (pGC->lineStyle == LineDoubleDash || startIsFg) { pixel = startIsFg ? pGC->fgPixel : pGC->bgPixel; if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg)) { if (first && selfJoin) { firstFace = leftFace; firstIsFg = startIsFg; } else if (pGC->capStyle == CapRound) miLineArc(pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); } else { miLineJoin(pDrawable, pGC, pixel, spanData, &leftFace, &prevRightFace); } } prevRightFace = rightFace; prevIsFg = endIsFg; first = FALSE; projectLeft = FALSE; } if (npt == 1 && somethingDrawn) { if (pGC->lineStyle == LineDoubleDash || endIsFg) { pixel = endIsFg ? pGC->fgPixel : pGC->bgPixel; if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg)) { miLineJoin(pDrawable, pGC, pixel, spanData, &firstFace, &rightFace); } else { if (pGC->capStyle == CapRound) miLineArc(pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); } } else { /* glue a cap to the start of the line if * we're OnOffDash and ended on odd dash */ if (selfJoin && firstIsFg) { pixel = pGC->fgPixel; if (pGC->capStyle == CapProjecting) miLineProjectingCap(pDrawable, pGC, pixel, spanData, &firstFace, TRUE, (double) 0.0, (double) 0.0, TRUE); else if (pGC->capStyle == CapRound) miLineArc(pDrawable, pGC, pixel, spanData, &firstFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); } } } } /* handle crock where all points are coincident */ if (!somethingDrawn && (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))) { /* not the same as endIsFg computation above */ pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel; switch (pGC->capStyle) { case CapRound: miLineArc(pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, (LineFacePtr) NULL, (double) x2, (double) y2, FALSE); break; case CapProjecting: x1 = pGC->lineWidth; miFillRectPolyHelper(pDrawable, pGC, pixel, spanData, x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1); break; } } if (spanData) miCleanupSpanData(pDrawable, pGC, spanData); } void miPolylines(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points) { if (gc->lineWidth == 0) { if (gc->lineStyle == LineSolid) miZeroLine(drawable, gc, mode, n, points); else miZeroDashLine(drawable, gc, mode, n, points); } else { if (gc->lineStyle == LineSolid) miWideLine(drawable, gc, mode, n, points); else miWideDash(drawable, gc, mode, n, points); } } xorg-server-1.20.8/mi/meson.build0000644000175000017500000000156413640201473013563 00000000000000srcs_mi = [ 'miarc.c', 'mibitblt.c', 'micmap.c', 'micopy.c', 'midash.c', 'midispcur.c', 'mieq.c', 'miexpose.c', 'mifillarc.c', 'mifillrct.c', 'migc.c', 'miglblt.c', 'mioverlay.c', 'mipointer.c', 'mipoly.c', 'mipolypnt.c', 'mipolyrect.c', 'mipolyseg.c', 'mipolytext.c', 'mipushpxl.c', 'miscrinit.c', 'misprite.c', 'mivaltree.c', 'miwideline.c', 'miwindow.c', 'mizerarc.c', 'mizerclip.c', 'mizerline.c', ] hdrs_mi = [ 'micmap.h', 'micoord.h', 'migc.h', 'mi.h', 'miline.h', 'mioverlay.h', 'mipointer.h', 'mipointrst.h', 'mistruct.h', 'mizerarc.h', ] libxserver_mi = static_library('libxserver_mi', srcs_mi, include_directories: inc, dependencies: [ common_dep, m_dep, ], ) install_data(hdrs_mi, install_dir: xorgsdkdir) xorg-server-1.20.8/mi/mifillrct.c0000644000175000017500000001051013640201473013541 00000000000000/*********************************************************** 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. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "misc.h" /* mi rectangles written by newman, with debts to all and sundry */ /* MIPOLYFILLRECT -- public entry for PolyFillRect request * very straight forward: translate rectangles if necessary * then call FillSpans to fill each rectangle. We let FillSpans worry about * clipping to the destination */ _X_COLD void miPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, /* number of rectangles to fill */ xRectangle *prectInit /* Pointer to first rectangle to fill */ ) { int i; int height; int width; xRectangle *prect; int xorg; int yorg; int maxheight; DDXPointPtr pptFirst; DDXPointPtr ppt; int *pwFirst; int *pw; if (pGC->miTranslate) { xorg = pDrawable->x; yorg = pDrawable->y; prect = prectInit; maxheight = 0; for (i = 0; i < nrectFill; i++, prect++) { prect->x += xorg; prect->y += yorg; maxheight = max(maxheight, prect->height); } } else { prect = prectInit; maxheight = 0; for (i = 0; i < nrectFill; i++, prect++) maxheight = max(maxheight, prect->height); } pptFirst = xallocarray(maxheight, sizeof(DDXPointRec)); pwFirst = xallocarray(maxheight, sizeof(int)); if (!pptFirst || !pwFirst) { free(pwFirst); free(pptFirst); return; } prect = prectInit; while (nrectFill--) { ppt = pptFirst; pw = pwFirst; height = prect->height; width = prect->width; xorg = prect->x; yorg = prect->y; while (height--) { *pw++ = width; ppt->x = xorg; ppt->y = yorg; ppt++; yorg++; } (*pGC->ops->FillSpans) (pDrawable, pGC, prect->height, pptFirst, pwFirst, 1); prect++; } free(pwFirst); free(pptFirst); } xorg-server-1.20.8/mi/mipointrst.h0000644000175000017500000000322013640201473013771 00000000000000/* * mipointrst.h * */ /* Copyright 1989, 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. */ #ifndef MIPOINTRST_H #define MIPOINTRST_H #include "mipointer.h" #include "scrnintstr.h" typedef struct { miPointerSpriteFuncPtr spriteFuncs; /* sprite-specific methods */ miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */ CloseScreenProcPtr CloseScreen; Bool waitForUpdate; /* don't move cursor from input thread */ Bool showTransparent; /* show empty cursors */ } miPointerScreenRec, *miPointerScreenPtr; #endif /* MIPOINTRST_H */ xorg-server-1.20.8/mi/mistruct.h0000644000175000017500000000531013640201473013435 00000000000000/*********************************************************** 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 MISTRUCT_H #define MISTRUCT_H #include "mi.h" #include "regionstr.h" /* information about dashes */ typedef struct _miDash { DDXPointRec pt; int e1, e2; /* keep these, so we don't have to do it again */ int e; /* bresenham error term for this point on line */ int which; int newLine; /* 0 if part of same original line as previous dash */ } miDashRec; #endif /* MISTRUCT_H */ xorg-server-1.20.8/glamor/0000755000175000017500000000000013640201534012345 500000000000000xorg-server-1.20.8/glamor/glamor_trapezoid.c0000644000175000017500000001175513640201473016006 00000000000000/* * Copyright © 2009 Intel Corporation * * 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. * * Authors: * Junyan He * */ /** @file glamor_trapezoid.c * * Trapezoid acceleration implementation */ #include "glamor_priv.h" #include "mipict.h" #include "fbpict.h" /** * Creates an appropriate picture for temp mask use. */ static PicturePtr glamor_create_mask_picture(ScreenPtr screen, PicturePtr dst, PictFormatPtr pict_format, CARD16 width, CARD16 height) { PixmapPtr pixmap; PicturePtr picture; int error; if (!pict_format) { if (dst->polyEdge == PolyEdgeSharp) pict_format = PictureMatchFormat(screen, 1, PICT_a1); else pict_format = PictureMatchFormat(screen, 8, PICT_a8); if (!pict_format) return 0; } pixmap = glamor_create_pixmap(screen, 0, 0, pict_format->depth, GLAMOR_CREATE_PIXMAP_CPU); if (!pixmap) return 0; picture = CreatePicture(0, &pixmap->drawable, pict_format, 0, 0, serverClient, &error); glamor_destroy_pixmap(pixmap); return picture; } /** * glamor_trapezoids will generate trapezoid mask accumulating in * system memory. */ void glamor_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst, PictFormatPtr mask_format, INT16 x_src, INT16 y_src, int ntrap, xTrapezoid *traps) { ScreenPtr screen = dst->pDrawable->pScreen; BoxRec bounds; PicturePtr picture; INT16 x_dst, y_dst; INT16 x_rel, y_rel; int width, height, stride; PixmapPtr pixmap; pixman_image_t *image = NULL; /* If a mask format wasn't provided, we get to choose, but behavior should * be as if there was no temporary mask the traps were accumulated into. */ if (!mask_format) { if (dst->polyEdge == PolyEdgeSharp) mask_format = PictureMatchFormat(screen, 1, PICT_a1); else mask_format = PictureMatchFormat(screen, 8, PICT_a8); for (; ntrap; ntrap--, traps++) glamor_trapezoids(op, src, dst, mask_format, x_src, y_src, 1, traps); return; } miTrapezoidBounds(ntrap, traps, &bounds); if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) return; x_dst = traps[0].left.p1.x >> 16; y_dst = traps[0].left.p1.y >> 16; width = bounds.x2 - bounds.x1; height = bounds.y2 - bounds.y1; stride = PixmapBytePad(width, mask_format->depth); picture = glamor_create_mask_picture(screen, dst, mask_format, width, height); if (!picture) return; image = pixman_image_create_bits(picture->format, width, height, NULL, stride); if (!image) { FreePicture(picture, 0); return; } for (; ntrap; ntrap--, traps++) pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *) traps, -bounds.x1, -bounds.y1); pixmap = glamor_get_drawable_pixmap(picture->pDrawable); screen->ModifyPixmapHeader(pixmap, width, height, mask_format->depth, BitsPerPixel(mask_format->depth), PixmapBytePad(width, mask_format->depth), pixman_image_get_data(image)); x_rel = bounds.x1 + x_src - x_dst; y_rel = bounds.y1 + y_src - y_dst; CompositePicture(op, src, picture, dst, x_rel, y_rel, 0, 0, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (image) pixman_image_unref(image); FreePicture(picture, 0); } xorg-server-1.20.8/glamor/glamor_segs.c0000644000175000017500000001261413640201473014741 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_program.h" #include "glamor_transform.h" #include "glamor_prepare.h" static const glamor_facet glamor_facet_poly_segment = { .name = "poly_segment", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (" vec2 pos = vec2(0.0,0.0);\n" GLAMOR_POS(gl_Position, primitive.xy)), }; static Bool glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; glamor_program *prog; int off_x, off_y; xSegment *v; char *vbo_offset; int box_index; int add_last; Bool ret = FALSE; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; add_last = 0; if (gc->capStyle != CapNotLast) add_last = 1; glamor_make_current(glamor_priv); prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_segment_program, &glamor_facet_poly_segment); if (!prog) goto bail; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, (nseg << add_last) * sizeof (xSegment), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, sizeof(DDXPointRec), vbo_offset); if (add_last) { int i, j; for (i = 0, j=0; i < nseg; i++) { v[j++] = segs[i]; v[j].x1 = segs[i].x2; v[j].y1 = segs[i].y2; v[j].x2 = segs[i].x2+1; v[j].y2 = segs[i].y2; j++; } } else memcpy(v, segs, nseg * sizeof (xSegment)); glamor_put_vbo_space(screen); glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { int nbox = RegionNumRects(gc->pCompositeClip); BoxPtr box = RegionRects(gc->pCompositeClip); if (!glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y)) goto bail; while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; glDrawArrays(GL_LINES, 0, nseg << (1 + add_last)); } } ret = TRUE; glDisable(GL_SCISSOR_TEST); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); bail: return ret; } static Bool glamor_poly_segment_gl(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs) { if (gc->lineWidth != 0) return FALSE; switch (gc->lineStyle) { case LineSolid: return glamor_poly_segment_solid_gl(drawable, gc, nseg, segs); case LineOnOffDash: return glamor_poly_segment_dash_gl(drawable, gc, nseg, segs); case LineDoubleDash: if (gc->fillStyle == FillTiled) return glamor_poly_segment_solid_gl(drawable, gc, nseg, segs); else return glamor_poly_segment_dash_gl(drawable, gc, nseg, segs); default: return FALSE; } } static void glamor_poly_segment_bail(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs) { glamor_fallback("to %p (%c)\n", drawable, glamor_get_drawable_location(drawable)); if (gc->lineWidth == 0) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc)) { fbPolySegment(drawable, gc, nseg, segs); } glamor_finish_access_gc(gc); glamor_finish_access(drawable); } else miPolySegment(drawable, gc, nseg, segs); } void glamor_poly_segment(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs) { if (glamor_poly_segment_gl(drawable, gc, nseg, segs)) return; glamor_poly_segment_bail(drawable, gc, nseg, segs); } xorg-server-1.20.8/glamor/glamor_window.c0000644000175000017500000000463513640201473015313 00000000000000/* * Copyright © 2008 Intel Corporation * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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 "glamor_priv.h" /** @file glamor_window.c * * Screen Change Window Attribute implementation. */ static void glamor_fixup_window_pixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap) { PixmapPtr pPixmap = *ppPixmap; glamor_pixmap_private *pixmap_priv; if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) { pixmap_priv = glamor_get_pixmap_private(pPixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) { glamor_fallback("pixmap %p has no fbo\n", pPixmap); goto fail; } glamor_debug_output(GLAMOR_DEBUG_UNIMPL, "To be implemented.\n"); } return; fail: GLAMOR_PANIC (" We can't fall back to fbFixupWindowPixmap, as the fb24_32ReformatTile" " is broken for glamor. \n"); } Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask) { if (mask & CWBackPixmap) { if (pWin->backgroundState == BackgroundPixmap) glamor_fixup_window_pixmap(&pWin->drawable, &pWin->background.pixmap); } if (mask & CWBorderPixmap) { if (pWin->borderIsPixel == FALSE) glamor_fixup_window_pixmap(&pWin->drawable, &pWin->border.pixmap); } return TRUE; } xorg-server-1.20.8/glamor/glamor_egl.c0000644000175000017500000007701213640201473014552 00000000000000/* * Copyright © 2010 Intel Corporation. * * 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. * * Authors: * Zhigang Gong * */ #include "dix-config.h" #define GLAMOR_FOR_XORG #include #include #include #include #include #include #include #define EGL_DISPLAY_NO_X_MESA #include #include #include "glamor_egl.h" #include "glamor.h" #include "glamor_priv.h" #include "dri3.h" struct glamor_egl_screen_private { EGLDisplay display; EGLContext context; char *device_path; CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; int fd; struct gbm_device *gbm; int dmabuf_capable; CloseScreenProcPtr saved_close_screen; DestroyPixmapProcPtr saved_destroy_pixmap; xf86FreeScreenProc *saved_free_screen; }; int xf86GlamorEGLPrivateIndex = -1; static struct glamor_egl_screen_private * glamor_egl_get_screen_private(ScrnInfoPtr scrn) { return (struct glamor_egl_screen_private *) scrn->privates[xf86GlamorEGLPrivateIndex].ptr; } static void glamor_egl_make_current(struct glamor_context *glamor_ctx) { /* There's only a single global dispatch table in Mesa. EGL, GLX, * and AIGLX's direct dispatch table manipulation don't talk to * each other. We need to set the context to NULL first to avoid * EGL's no-op context change fast path when switching back to * EGL. */ eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_ctx->ctx)) { FatalError("Failed to make EGL context current\n"); } } static int glamor_get_flink_name(int fd, int handle, int *name) { struct drm_gem_flink flink; flink.handle = handle; if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) { /* * Assume non-GEM kernels have names identical to the handle */ if (errno == ENODEV) { *name = handle; return TRUE; } else { return FALSE; } } *name = flink.name; return TRUE; } static Bool glamor_create_texture_from_image(ScreenPtr screen, EGLImageKHR image, GLuint * texture) { struct glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glGenTextures(1, texture); glBindTexture(GL_TEXTURE_2D, *texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); glBindTexture(GL_TEXTURE_2D, 0); return TRUE; } struct gbm_device * glamor_egl_get_gbm_device(ScreenPtr screen) { struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); return glamor_egl->gbm; } Bool glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); PixmapPtr screen_pixmap; screen_pixmap = screen->GetScreenPixmap(screen); if (!glamor_egl_create_textured_pixmap(screen_pixmap, handle, stride)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create textured screen."); return FALSE; } return TRUE; } static void glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image, Bool used_modifiers) { struct glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); EGLImageKHR old; old = pixmap_priv->image; if (old) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); eglDestroyImageKHR(glamor_egl->display, old); } pixmap_priv->image = image; pixmap_priv->used_modifiers = used_modifiers; } Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); int ret, fd; /* GBM doesn't have an import path from handles, so we make a * dma-buf fd from it and then go through that. */ ret = drmPrimeHandleToFD(glamor_egl->fd, handle, O_CLOEXEC, &fd); if (ret) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make prime FD for handle: %d\n", errno); return FALSE; } if (!glamor_back_pixmap_from_fd(pixmap, fd, pixmap->drawable.width, pixmap->drawable.height, stride, pixmap->drawable.depth, pixmap->drawable.bitsPerPixel)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make import prime FD as pixmap: %d\n", errno); close(fd); return FALSE; } close(fd); return TRUE; } Bool glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, struct gbm_bo *bo, Bool used_modifiers) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; GLuint texture; Bool ret = FALSE; glamor_egl = glamor_egl_get_screen_private(scrn); glamor_make_current(glamor_priv); image = eglCreateImageKHR(glamor_egl->display, glamor_egl->context, EGL_NATIVE_PIXMAP_KHR, bo, NULL); if (image == EGL_NO_IMAGE_KHR) { glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); goto done; } glamor_create_texture_from_image(screen, image, &texture); glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); glamor_set_pixmap_texture(pixmap, texture); glamor_egl_set_pixmap_image(pixmap, image, used_modifiers); ret = TRUE; done: return ret; } static void glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name) { union gbm_bo_handle handle; handle = gbm_bo_get_handle(bo); if (!glamor_get_flink_name(gbm_fd, handle.u32, name)) *name = -1; } static Bool glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); struct glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); unsigned width = pixmap->drawable.width; unsigned height = pixmap->drawable.height; uint32_t format; struct gbm_bo *bo = NULL; Bool used_modifiers = FALSE; PixmapPtr exported; GCPtr scratch_gc; if (pixmap_priv->image && (modifiers_ok || !pixmap_priv->used_modifiers)) return TRUE; if (pixmap->drawable.bitsPerPixel != 32) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make %dbpp pixmap exportable\n", pixmap->drawable.bitsPerPixel); return FALSE; } if (pixmap->drawable.depth == 30) format = GBM_FORMAT_ARGB2101010; else format = GBM_FORMAT_ARGB8888; #ifdef GBM_BO_WITH_MODIFIERS if (modifiers_ok && glamor_egl->dmabuf_capable) { uint32_t num_modifiers; uint64_t *modifiers = NULL; glamor_get_modifiers(screen, format, &num_modifiers, &modifiers); bo = gbm_bo_create_with_modifiers(glamor_egl->gbm, width, height, format, modifiers, num_modifiers); if (bo) used_modifiers = TRUE; free(modifiers); } #endif if (!bo) { bo = gbm_bo_create(glamor_egl->gbm, width, height, format, #ifdef GLAMOR_HAS_GBM_LINEAR (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? GBM_BO_USE_LINEAR : 0) | #endif GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); } if (!bo) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make %dx%dx%dbpp GBM bo\n", width, height, pixmap->drawable.bitsPerPixel); return FALSE; } exported = screen->CreatePixmap(screen, 0, 0, pixmap->drawable.depth, 0); screen->ModifyPixmapHeader(exported, width, height, 0, 0, gbm_bo_get_stride(bo), NULL); if (!glamor_egl_create_textured_pixmap_from_gbm_bo(exported, bo, used_modifiers)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make %dx%dx%dbpp pixmap from GBM bo\n", width, height, pixmap->drawable.bitsPerPixel); screen->DestroyPixmap(exported); gbm_bo_destroy(bo); return FALSE; } gbm_bo_destroy(bo); scratch_gc = GetScratchGC(pixmap->drawable.depth, screen); ValidateGC(&pixmap->drawable, scratch_gc); scratch_gc->ops->CopyArea(&pixmap->drawable, &exported->drawable, scratch_gc, 0, 0, width, height, 0, 0); FreeScratchGC(scratch_gc); /* Now, swap the tex/gbm/EGLImage/etc. of the exported pixmap into * the original pixmap struct. */ glamor_egl_exchange_buffers(pixmap, exported); screen->DestroyPixmap(exported); return TRUE; } static struct gbm_bo * glamor_gbm_bo_from_pixmap_internal(ScreenPtr screen, PixmapPtr pixmap) { struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); struct glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); if (!pixmap_priv->image) return NULL; return gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_EGL_IMAGE, pixmap_priv->image, 0); } struct gbm_bo * glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap) { if (!glamor_make_pixmap_exportable(pixmap, TRUE)) return NULL; return glamor_gbm_bo_from_pixmap_internal(screen, pixmap); } int glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier) { #ifdef GLAMOR_HAS_GBM struct gbm_bo *bo; int num_fds; #ifdef GBM_BO_WITH_MODIFIERS int i; #endif if (!glamor_make_pixmap_exportable(pixmap, TRUE)) return 0; bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap); if (!bo) return 0; #ifdef GBM_BO_WITH_MODIFIERS num_fds = gbm_bo_get_plane_count(bo); for (i = 0; i < num_fds; i++) { fds[i] = gbm_bo_get_fd(bo); strides[i] = gbm_bo_get_stride_for_plane(bo, i); offsets[i] = gbm_bo_get_offset(bo, i); } *modifier = gbm_bo_get_modifier(bo); #else num_fds = 1; fds[0] = gbm_bo_get_fd(bo); strides[0] = gbm_bo_get_stride(bo); offsets[0] = 0; *modifier = DRM_FORMAT_MOD_INVALID; #endif gbm_bo_destroy(bo); return num_fds; #else return 0; #endif } _X_EXPORT int glamor_egl_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { #ifdef GLAMOR_HAS_GBM struct gbm_bo *bo; int fd; if (!glamor_make_pixmap_exportable(pixmap, FALSE)) return -1; bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap); if (!bo) return -1; fd = gbm_bo_get_fd(bo); *stride = gbm_bo_get_stride(bo); *size = *stride * gbm_bo_get_height(bo); gbm_bo_destroy(bo); return fd; #else return -1; #endif } int glamor_egl_fd_name_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { struct glamor_egl_screen_private *glamor_egl; struct gbm_bo *bo; int fd = -1; glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); if (!glamor_make_pixmap_exportable(pixmap, FALSE)) goto failure; bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap); if (!bo) goto failure; pixmap->devKind = gbm_bo_get_stride(bo); glamor_get_name_from_bo(glamor_egl->fd, bo, &fd); *stride = pixmap->devKind; *size = pixmap->devKind * gbm_bo_get_height(bo); gbm_bo_destroy(bo); failure: return fd; } _X_EXPORT Bool glamor_back_pixmap_from_fd(PixmapPtr pixmap, int fd, CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl; struct gbm_bo *bo; struct gbm_import_fd_data import_data = { 0 }; Bool ret; glamor_egl = glamor_egl_get_screen_private(scrn); if (bpp != 32 || !(depth == 24 || depth == 32 || depth == 30) || width == 0 || height == 0) return FALSE; import_data.fd = fd; import_data.width = width; import_data.height = height; import_data.stride = stride; if (depth == 30) import_data.format = GBM_FORMAT_ARGB2101010; else import_data.format = GBM_FORMAT_ARGB8888; bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_FD, &import_data, 0); if (!bo) return FALSE; screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL); ret = glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo, FALSE); gbm_bo_destroy(bo); return ret; } static uint32_t gbm_format_for_depth(CARD8 depth) { switch (depth) { case 16: return GBM_FORMAT_RGB565; case 24: return GBM_FORMAT_XRGB8888; case 30: return GBM_FORMAT_ARGB2101010; default: ErrorF("unexpected depth: %d\n", depth); case 32: return GBM_FORMAT_ARGB8888; } } _X_EXPORT PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds, CARD16 width, CARD16 height, const CARD32 *strides, const CARD32 *offsets, CARD8 depth, CARD8 bpp, uint64_t modifier) { PixmapPtr pixmap; struct glamor_egl_screen_private *glamor_egl; Bool ret = FALSE; int i; glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0); #ifdef GBM_BO_WITH_MODIFIERS if (glamor_egl->dmabuf_capable && modifier != DRM_FORMAT_MOD_INVALID) { struct gbm_import_fd_modifier_data import_data = { 0 }; struct gbm_bo *bo; import_data.width = width; import_data.height = height; import_data.num_fds = num_fds; import_data.modifier = modifier; for (i = 0; i < num_fds; i++) { import_data.fds[i] = fds[i]; import_data.strides[i] = strides[i]; import_data.offsets[i] = offsets[i]; } import_data.format = gbm_format_for_depth(depth); bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_FD_MODIFIER, &import_data, 0); if (bo) { screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, strides[0], NULL); ret = glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo, TRUE); gbm_bo_destroy(bo); } } else #endif { if (num_fds == 1) { ret = glamor_back_pixmap_from_fd(pixmap, fds[0], width, height, strides[0], depth, bpp); } } if (ret == FALSE) { screen->DestroyPixmap(pixmap); return NULL; } return pixmap; } _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen, int fd, CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp) { PixmapPtr pixmap; Bool ret; pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0); ret = glamor_back_pixmap_from_fd(pixmap, fd, width, height, stride, depth, bpp); if (ret == FALSE) { screen->DestroyPixmap(pixmap); return NULL; } return pixmap; } _X_EXPORT Bool glamor_get_formats(ScreenPtr screen, CARD32 *num_formats, CARD32 **formats) { #ifdef GLAMOR_HAS_EGL_QUERY_DMABUF struct glamor_egl_screen_private *glamor_egl; EGLint num; /* Explicitly zero the count as the caller may ignore the return value */ *num_formats = 0; glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); if (!glamor_egl->dmabuf_capable) return TRUE; if (!eglQueryDmaBufFormatsEXT(glamor_egl->display, 0, NULL, &num)) return FALSE; if (num == 0) return TRUE; *formats = calloc(num, sizeof(CARD32)); if (*formats == NULL) return FALSE; if (!eglQueryDmaBufFormatsEXT(glamor_egl->display, num, (EGLint *) *formats, &num)) { free(*formats); return FALSE; } *num_formats = num; return TRUE; #else *num_formats = 0; return TRUE; #endif } _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers) { #ifdef GLAMOR_HAS_EGL_QUERY_DMABUF struct glamor_egl_screen_private *glamor_egl; EGLint num; /* Explicitly zero the count as the caller may ignore the return value */ *num_modifiers = 0; glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); if (!glamor_egl->dmabuf_capable) return FALSE; if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, 0, NULL, NULL, &num)) return FALSE; if (num == 0) return TRUE; *modifiers = calloc(num, sizeof(uint64_t)); if (*modifiers == NULL) return FALSE; if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, num, (EGLuint64KHR *) *modifiers, NULL, &num)) { free(*modifiers); return FALSE; } *num_modifiers = num; return TRUE; #else *num_modifiers = 0; return TRUE; #endif } _X_EXPORT const char * glamor_egl_get_driver_name(ScreenPtr screen) { #ifdef GLAMOR_HAS_EGL_QUERY_DRIVER struct glamor_egl_screen_private *glamor_egl; glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); if (epoxy_has_egl_extension(glamor_egl->display, "EGL_MESA_query_driver")) return eglGetDisplayDriverName(glamor_egl->display); #endif return NULL; } static Bool glamor_egl_destroy_pixmap(PixmapPtr pixmap) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); Bool ret; if (pixmap->refcnt == 1) { struct glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); if (pixmap_priv->image) eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image); } screen->DestroyPixmap = glamor_egl->saved_destroy_pixmap; ret = screen->DestroyPixmap(pixmap); glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap; screen->DestroyPixmap = glamor_egl_destroy_pixmap; return ret; } _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back) { EGLImageKHR temp_img; Bool temp_mod; struct glamor_pixmap_private *front_priv = glamor_get_pixmap_private(front); struct glamor_pixmap_private *back_priv = glamor_get_pixmap_private(back); glamor_pixmap_exchange_fbos(front, back); temp_img = back_priv->image; temp_mod = back_priv->used_modifiers; back_priv->image = front_priv->image; back_priv->used_modifiers = front_priv->used_modifiers; front_priv->image = temp_img; front_priv->used_modifiers = temp_mod; glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM); glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM); } static Bool glamor_egl_close_screen(ScreenPtr screen) { ScrnInfoPtr scrn; struct glamor_egl_screen_private *glamor_egl; struct glamor_pixmap_private *pixmap_priv; PixmapPtr screen_pixmap; scrn = xf86ScreenToScrn(screen); glamor_egl = glamor_egl_get_screen_private(scrn); screen_pixmap = screen->GetScreenPixmap(screen); pixmap_priv = glamor_get_pixmap_private(screen_pixmap); eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image); pixmap_priv->image = NULL; screen->CloseScreen = glamor_egl->saved_close_screen; return screen->CloseScreen(screen); } #ifdef DRI3 static int glamor_dri3_open_client(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fdp) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); int fd; drm_magic_t magic; fd = open(glamor_egl->device_path, O_RDWR|O_CLOEXEC); if (fd < 0) return BadAlloc; /* Before FD passing in the X protocol with DRI3 (and increased * security of rendering with per-process address spaces on the * GPU), the kernel had to come up with a way to have the server * decide which clients got to access the GPU, which was done by * each client getting a unique (magic) number from the kernel, * passing it to the server, and the server then telling the * kernel which clients were authenticated for using the device. * * Now that we have FD passing, the server can just set up the * authentication on its own and hand the prepared FD off to the * client. */ if (drmGetMagic(fd, &magic) < 0) { if (errno == EACCES) { /* Assume that we're on a render node, and the fd is * already as authenticated as it should be. */ *fdp = fd; return Success; } else { close(fd); return BadMatch; } } if (drmAuthMagic(glamor_egl->fd, magic) < 0) { close(fd); return BadMatch; } *fdp = fd; return Success; } static const dri3_screen_info_rec glamor_dri3_info = { .version = 2, .open_client = glamor_dri3_open_client, .pixmap_from_fds = glamor_pixmap_from_fds, .fd_from_pixmap = glamor_egl_fd_from_pixmap, .fds_from_pixmap = glamor_egl_fds_from_pixmap, .get_formats = glamor_get_formats, .get_modifiers = glamor_get_modifiers, .get_drawable_modifiers = glamor_get_drawable_modifiers, }; #endif /* DRI3 */ void glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); #ifdef DRI3 glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); #endif glamor_egl->saved_close_screen = screen->CloseScreen; screen->CloseScreen = glamor_egl_close_screen; glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap; screen->DestroyPixmap = glamor_egl_destroy_pixmap; glamor_ctx->ctx = glamor_egl->context; glamor_ctx->display = glamor_egl->display; glamor_ctx->make_current = glamor_egl_make_current; #ifdef DRI3 /* Tell the core that we have the interfaces for import/export * of pixmaps. */ glamor_enable_dri3(screen); /* If the driver wants to do its own auth dance (e.g. Xwayland * on pre-3.15 kernels that don't have render nodes and thus * has the wayland compositor as a master), then it needs us * to stay out of the way and let it init DRI3 on its own. */ if (!(glamor_priv->flags & GLAMOR_NO_DRI3)) { /* To do DRI3 device FD generation, we need to open a new fd * to the same device we were handed in originally. */ glamor_egl->device_path = drmGetDeviceNameFromFd2(glamor_egl->fd); if (!dri3_screen_init(screen, &glamor_dri3_info)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to initialize DRI3.\n"); } } #endif } static void glamor_egl_cleanup(struct glamor_egl_screen_private *glamor_egl) { if (glamor_egl->display != EGL_NO_DISPLAY) { eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); /* * Force the next glamor_make_current call to update the context * (on hot unplug another GPU may still be using glamor) */ lastGLContext = NULL; eglTerminate(glamor_egl->display); } if (glamor_egl->gbm) gbm_device_destroy(glamor_egl->gbm); free(glamor_egl->device_path); free(glamor_egl); } static void glamor_egl_free_screen(ScrnInfoPtr scrn) { struct glamor_egl_screen_private *glamor_egl; glamor_egl = glamor_egl_get_screen_private(scrn); if (glamor_egl != NULL) { scrn->FreeScreen = glamor_egl->saved_free_screen; glamor_egl_cleanup(glamor_egl); scrn->FreeScreen(scrn); } } Bool glamor_egl_init(ScrnInfoPtr scrn, int fd) { struct glamor_egl_screen_private *glamor_egl; const GLubyte *renderer; glamor_egl = calloc(sizeof(*glamor_egl), 1); if (glamor_egl == NULL) return FALSE; if (xf86GlamorEGLPrivateIndex == -1) xf86GlamorEGLPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); scrn->privates[xf86GlamorEGLPrivateIndex].ptr = glamor_egl; glamor_egl->fd = fd; glamor_egl->gbm = gbm_create_device(glamor_egl->fd); if (glamor_egl->gbm == NULL) { ErrorF("couldn't get display device\n"); goto error; } glamor_egl->display = glamor_egl_get_display(EGL_PLATFORM_GBM_MESA, glamor_egl->gbm); if (!glamor_egl->display) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglGetDisplay() failed\n"); goto error; } if (!eglInitialize(glamor_egl->display, NULL, NULL)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n"); glamor_egl->display = EGL_NO_DISPLAY; goto error; } #define GLAMOR_CHECK_EGL_EXTENSION(EXT) \ if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) { \ ErrorF("EGL_" #EXT " required.\n"); \ goto error; \ } #define GLAMOR_CHECK_EGL_EXTENSIONS(EXT1, EXT2) \ if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT1) && \ !epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT2)) { \ ErrorF("EGL_" #EXT1 " or EGL_" #EXT2 " required.\n"); \ goto error; \ } GLAMOR_CHECK_EGL_EXTENSION(KHR_surfaceless_context); if (eglBindAPI(EGL_OPENGL_API)) { static const EGLint config_attribs_core[] = { EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, EGL_CONTEXT_MAJOR_VERSION_KHR, GLAMOR_GL_CORE_VER_MAJOR, EGL_CONTEXT_MINOR_VERSION_KHR, GLAMOR_GL_CORE_VER_MINOR, EGL_NONE }; static const EGLint config_attribs[] = { EGL_NONE }; glamor_egl->context = eglCreateContext(glamor_egl->display, NULL, EGL_NO_CONTEXT, config_attribs_core); if (glamor_egl->context == EGL_NO_CONTEXT) glamor_egl->context = eglCreateContext(glamor_egl->display, NULL, EGL_NO_CONTEXT, config_attribs); } if (glamor_egl->context == EGL_NO_CONTEXT) { static const EGLint config_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; if (!eglBindAPI(EGL_OPENGL_ES_API)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "glamor: Failed to bind either GL or GLES APIs.\n"); goto error; } glamor_egl->context = eglCreateContext(glamor_egl->display, NULL, EGL_NO_CONTEXT, config_attribs); } if (glamor_egl->context == EGL_NO_CONTEXT) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "glamor: Failed to create GL or GLES2 contexts\n"); goto error; } if (!eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_egl->context)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make EGL context current\n"); goto error; } renderer = glGetString(GL_RENDERER); if (!renderer) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "glGetString() returned NULL, your GL is broken\n"); goto error; } if (strstr((const char *)renderer, "llvmpipe")) { xf86DrvMsg(scrn->scrnIndex, X_INFO, "Refusing to try glamor on llvmpipe\n"); goto error; } /* * Force the next glamor_make_current call to set the right context * (in case of multiple GPUs using glamor) */ lastGLContext = NULL; if (!epoxy_has_gl_extension("GL_OES_EGL_image")) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "glamor acceleration requires GL_OES_EGL_image\n"); goto error; } xf86DrvMsg(scrn->scrnIndex, X_INFO, "glamor X acceleration enabled on %s\n", renderer); #ifdef GBM_BO_WITH_MODIFIERS if (epoxy_has_egl_extension(glamor_egl->display, "EGL_EXT_image_dma_buf_import") && epoxy_has_egl_extension(glamor_egl->display, "EGL_EXT_image_dma_buf_import_modifiers")) { if (xf86Info.debug != NULL) glamor_egl->dmabuf_capable = !!strstr(xf86Info.debug, "dmabuf_capable"); else glamor_egl->dmabuf_capable = FALSE; } #endif glamor_egl->saved_free_screen = scrn->FreeScreen; scrn->FreeScreen = glamor_egl_free_screen; return TRUE; error: glamor_egl_cleanup(glamor_egl); return FALSE; } /** Stub to retain compatibility with pre-server-1.16 ABI. */ Bool glamor_egl_init_textured_pixmap(ScreenPtr screen) { return TRUE; } xorg-server-1.20.8/glamor/Makefile.am0000644000175000017500000000220013640201473014315 00000000000000noinst_LTLIBRARIES = libglamor.la libglamor_egl_stubs.la libglamor_la_LIBADD = $(GLAMOR_LIBS) AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS) libglamor_la_SOURCES = \ glamor.c \ glamor_context.h \ glamor_copy.c \ glamor_core.c \ glamor_dash.c \ glamor_debug.h \ glamor_font.c \ glamor_font.h \ glamor_glx.c \ glamor_composite_glyphs.c \ glamor_image.c \ glamor_lines.c \ glamor_segs.c \ glamor_render.c \ glamor_gradient.c \ glamor_prepare.c \ glamor_prepare.h \ glamor_program.c \ glamor_program.h \ glamor_rects.c \ glamor_spans.c \ glamor_text.c \ glamor_transfer.c \ glamor_transfer.h \ glamor_transform.c \ glamor_transform.h \ glamor_trapezoid.c \ glamor_triangles.c\ glamor_addtraps.c\ glamor_glyphblt.c\ glamor_points.c\ glamor_priv.h\ glamor_pixmap.c\ glamor_largepixmap.c\ glamor_picture.c\ glamor_vbo.c \ glamor_window.c\ glamor_fbo.c\ glamor_compositerects.c\ glamor_utils.c\ glamor_utils.h\ glamor_sync.c \ glamor.h if XV libglamor_la_SOURCES += \ glamor_xv.c endif libglamor_egl_stubs_la_SOURCES = \ glamor_egl_stubs.c \ glamor_egl_ext.h \ glamor_egl.h sdk_HEADERS = glamor.h xorg-server-1.20.8/glamor/glamor_pixmap.c0000644000175000017500000001174213640201473015277 00000000000000/* * Copyright © 2001 Keith Packard * Copyright © 2008 Intel Corporation * * 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. * * Authors: * Eric Anholt * Zhigang Gong * */ #include #include "glamor_priv.h" /** * Sets the offsets to add to coordinates to make them address the same bits in * the backing drawable. These coordinates are nonzero only for redirected * windows. */ void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, int *x, int *y) { #ifdef COMPOSITE if (drawable->type == DRAWABLE_WINDOW) { *x = -pixmap->screen_x; *y = -pixmap->screen_y; return; } #endif *x = 0; *y = 0; } void glamor_pixmap_init(ScreenPtr screen) { } void glamor_pixmap_fini(ScreenPtr screen) { } void glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo, int x0, int y0, int width, int height) { glamor_make_current(glamor_priv); glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); glViewport(x0, y0, width, height); } void glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv) { int w, h; PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, pixmap_priv, w, h); glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_priv->fbo, 0, 0, w, h); } int glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv) { if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) return -1; glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv); return 0; } int glamor_set_destination_pixmap(PixmapPtr pixmap) { int err; glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); err = glamor_set_destination_pixmap_priv(glamor_priv, pixmap, pixmap_priv); return err; } Bool glamor_set_planemask(int depth, unsigned long planemask) { if (glamor_pm_is_solid(depth, planemask)) { return GL_TRUE; } glamor_fallback("unsupported planemask %lx\n", planemask); return GL_FALSE; } Bool glamor_set_alu(ScreenPtr screen, unsigned char alu) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { if (alu != GXcopy) return FALSE; else return TRUE; } if (alu == GXcopy) { glDisable(GL_COLOR_LOGIC_OP); return TRUE; } glEnable(GL_COLOR_LOGIC_OP); switch (alu) { case GXclear: glLogicOp(GL_CLEAR); break; case GXand: glLogicOp(GL_AND); break; case GXandReverse: glLogicOp(GL_AND_REVERSE); break; case GXandInverted: glLogicOp(GL_AND_INVERTED); break; case GXnoop: glLogicOp(GL_NOOP); break; case GXxor: glLogicOp(GL_XOR); break; case GXor: glLogicOp(GL_OR); break; case GXnor: glLogicOp(GL_NOR); break; case GXequiv: glLogicOp(GL_EQUIV); break; case GXinvert: glLogicOp(GL_INVERT); break; case GXorReverse: glLogicOp(GL_OR_REVERSE); break; case GXcopyInverted: glLogicOp(GL_COPY_INVERTED); break; case GXorInverted: glLogicOp(GL_OR_INVERTED); break; case GXnand: glLogicOp(GL_NAND); break; case GXset: glLogicOp(GL_SET); break; default: glamor_fallback("unsupported alu %x\n", alu); return FALSE; } return TRUE; } xorg-server-1.20.8/glamor/glamor_program.c0000644000175000017500000005445513640201473015460 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_transform.h" #include "glamor_program.h" static Bool use_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { return glamor_set_solid(pixmap, gc, TRUE, prog->fg_uniform); } const glamor_facet glamor_fill_solid = { .name = "solid", .fs_exec = " gl_FragColor = fg;\n", .locations = glamor_program_location_fg, .use = use_solid, }; static Bool use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform); } static const glamor_facet glamor_fill_tile = { .name = "tile", .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n", .fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n", .locations = glamor_program_location_fillsamp | glamor_program_location_fillpos, .use = use_tile, }; static Bool use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { return glamor_set_stippled(pixmap, gc, prog->fg_uniform, prog->fill_offset_uniform, prog->fill_size_inv_uniform); } static const glamor_facet glamor_fill_stipple = { .name = "stipple", .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n", .fs_exec = (" float a = texture2D(sampler, fill_pos).w;\n" " if (a == 0.0)\n" " discard;\n" " gl_FragColor = fg;\n"), .locations = glamor_program_location_fg | glamor_program_location_fillsamp | glamor_program_location_fillpos, .use = use_stipple, }; static Bool use_opaque_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { if (!use_stipple(pixmap, gc, prog, arg)) return FALSE; glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform); return TRUE; } static const glamor_facet glamor_fill_opaque_stipple = { .name = "opaque_stipple", .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n", .fs_exec = (" float a = texture2D(sampler, fill_pos).w;\n" " if (a == 0.0)\n" " gl_FragColor = bg;\n" " else\n" " gl_FragColor = fg;\n"), .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_fillsamp | glamor_program_location_fillpos, .use = use_opaque_stipple }; static const glamor_facet *glamor_facet_fill[4] = { &glamor_fill_solid, &glamor_fill_tile, &glamor_fill_stipple, &glamor_fill_opaque_stipple, }; typedef struct { glamor_program_location location; const char *vs_vars; const char *fs_vars; } glamor_location_var; static glamor_location_var location_vars[] = { { .location = glamor_program_location_fg, .fs_vars = "uniform vec4 fg;\n" }, { .location = glamor_program_location_bg, .fs_vars = "uniform vec4 bg;\n" }, { .location = glamor_program_location_fillsamp, .fs_vars = "uniform sampler2D sampler;\n" }, { .location = glamor_program_location_fillpos, .vs_vars = ("uniform vec2 fill_offset;\n" "uniform vec2 fill_size_inv;\n" "varying vec2 fill_pos;\n"), .fs_vars = ("varying vec2 fill_pos;\n") }, { .location = glamor_program_location_font, .fs_vars = "uniform usampler2D font;\n", }, { .location = glamor_program_location_bitplane, .fs_vars = ("uniform uvec4 bitplane;\n" "uniform vec4 bitmul;\n"), }, { .location = glamor_program_location_dash, .vs_vars = "uniform float dash_length;\n", .fs_vars = "uniform sampler2D dash;\n", }, { .location = glamor_program_location_atlas, .fs_vars = "uniform sampler2D atlas;\n", }, }; static char * add_var(char *cur, const char *add) { char *new; if (!add) return cur; new = realloc(cur, strlen(cur) + strlen(add) + 1); if (!new) { free(cur); return NULL; } strcat(new, add); return new; } static char * vs_location_vars(glamor_program_location locations) { int l; char *vars = strdup(""); for (l = 0; vars && l < ARRAY_SIZE(location_vars); l++) if (locations & location_vars[l].location) vars = add_var(vars, location_vars[l].vs_vars); return vars; } static char * fs_location_vars(glamor_program_location locations) { int l; char *vars = strdup(""); for (l = 0; vars && l < ARRAY_SIZE(location_vars); l++) if (locations & location_vars[l].location) vars = add_var(vars, location_vars[l].fs_vars); return vars; } static const char vs_template[] = "%s" /* version */ "%s" /* defines */ "%s" /* prim vs_vars */ "%s" /* fill vs_vars */ "%s" /* location vs_vars */ GLAMOR_DECLARE_MATRIX "void main() {\n" "%s" /* prim vs_exec, outputs 'pos' and gl_Position */ "%s" /* fill vs_exec */ "}\n"; static const char fs_template[] = "%s" /* version */ GLAMOR_DEFAULT_PRECISION "%s" /* defines */ "%s" /* prim fs_vars */ "%s" /* fill fs_vars */ "%s" /* location fs_vars */ "void main() {\n" "%s" /* prim fs_exec */ "%s" /* fill fs_exec */ "%s" /* combine */ "}\n"; static const char * str(const char *s) { if (!s) return ""; return s; } static const glamor_facet facet_null_fill = { .name = "" }; #define DBG 0 static GLint glamor_get_uniform(glamor_program *prog, glamor_program_location location, const char *name) { GLint uniform; if (location && (prog->locations & location) == 0) return -2; uniform = glGetUniformLocation(prog->prog, name); #if DBG ErrorF("%s uniform %d\n", name, uniform); #endif return uniform; } Bool glamor_build_program(ScreenPtr screen, glamor_program *prog, const glamor_facet *prim, const glamor_facet *fill, const char *combine, const char *defines) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_program_location locations = prim->locations; glamor_program_flag flags = prim->flags; int version = prim->version; char *version_string = NULL; char *fs_vars = NULL; char *vs_vars = NULL; char *vs_prog_string; char *fs_prog_string; GLint fs_prog, vs_prog; if (!fill) fill = &facet_null_fill; locations |= fill->locations; flags |= fill->flags; version = MAX(version, fill->version); if (version > glamor_priv->glsl_version) goto fail; vs_vars = vs_location_vars(locations); fs_vars = fs_location_vars(locations); if (!vs_vars) goto fail; if (!fs_vars) goto fail; if (version) { if (asprintf(&version_string, "#version %d\n", version) < 0) version_string = NULL; if (!version_string) goto fail; } if (asprintf(&vs_prog_string, vs_template, str(version_string), str(defines), str(prim->vs_vars), str(fill->vs_vars), vs_vars, str(prim->vs_exec), str(fill->vs_exec)) < 0) vs_prog_string = NULL; if (asprintf(&fs_prog_string, fs_template, str(version_string), str(defines), str(prim->fs_vars), str(fill->fs_vars), fs_vars, str(prim->fs_exec), str(fill->fs_exec), str(combine)) < 0) fs_prog_string = NULL; if (!vs_prog_string || !fs_prog_string) goto fail; prog->prog = glCreateProgram(); #if DBG ErrorF("\n\tProgram %d for %s %s\n\tVertex shader:\n\n\t================\n%s\n\n\tFragment Shader:\n\n%s\t================\n", prog->prog, prim->name, fill->name, vs_prog_string, fs_prog_string); #endif prog->flags = flags; prog->locations = locations; prog->prim_use = prim->use; prog->prim_use_render = prim->use_render; prog->fill_use = fill->use; prog->fill_use_render = fill->use_render; vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_prog_string); fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_prog_string); free(vs_prog_string); free(fs_prog_string); glAttachShader(prog->prog, vs_prog); glDeleteShader(vs_prog); glAttachShader(prog->prog, fs_prog); glDeleteShader(fs_prog); glBindAttribLocation(prog->prog, GLAMOR_VERTEX_POS, "primitive"); if (prim->source_name) { #if DBG ErrorF("Bind GLAMOR_VERTEX_SOURCE to %s\n", prim->source_name); #endif glBindAttribLocation(prog->prog, GLAMOR_VERTEX_SOURCE, prim->source_name); } if (prog->alpha == glamor_program_alpha_dual_blend) { glBindFragDataLocationIndexed(prog->prog, 0, 0, "color0"); glBindFragDataLocationIndexed(prog->prog, 0, 1, "color1"); } glamor_link_glsl_prog(screen, prog->prog, "%s_%s", prim->name, fill->name); prog->matrix_uniform = glamor_get_uniform(prog, glamor_program_location_none, "v_matrix"); prog->fg_uniform = glamor_get_uniform(prog, glamor_program_location_fg, "fg"); prog->bg_uniform = glamor_get_uniform(prog, glamor_program_location_bg, "bg"); prog->fill_offset_uniform = glamor_get_uniform(prog, glamor_program_location_fillpos, "fill_offset"); prog->fill_size_inv_uniform = glamor_get_uniform(prog, glamor_program_location_fillpos, "fill_size_inv"); prog->font_uniform = glamor_get_uniform(prog, glamor_program_location_font, "font"); prog->bitplane_uniform = glamor_get_uniform(prog, glamor_program_location_bitplane, "bitplane"); prog->bitmul_uniform = glamor_get_uniform(prog, glamor_program_location_bitplane, "bitmul"); prog->dash_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash"); prog->dash_length_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash_length"); prog->atlas_uniform = glamor_get_uniform(prog, glamor_program_location_atlas, "atlas"); free(version_string); free(fs_vars); free(vs_vars); return TRUE; fail: prog->failed = 1; if (prog->prog) { glDeleteProgram(prog->prog); prog->prog = 0; } free(version_string); free(fs_vars); free(vs_vars); return FALSE; } Bool glamor_use_program(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { glUseProgram(prog->prog); if (prog->prim_use && !prog->prim_use(pixmap, gc, prog, arg)) return FALSE; if (prog->fill_use && !prog->fill_use(pixmap, gc, prog, arg)) return FALSE; return TRUE; } glamor_program * glamor_use_program_fill(PixmapPtr pixmap, GCPtr gc, glamor_program_fill *program_fill, const glamor_facet *prim) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_program *prog = &program_fill->progs[gc->fillStyle]; int fill_style = gc->fillStyle; const glamor_facet *fill; if (prog->failed) return FALSE; if (!prog->prog) { fill = glamor_facet_fill[fill_style]; if (!fill) return NULL; if (!glamor_build_program(screen, prog, prim, fill, NULL, NULL)) return NULL; } if (!glamor_use_program(pixmap, gc, prog, NULL)) return NULL; return prog; } static struct blendinfo composite_op_info[] = { [PictOpClear] = {0, 0, GL_ZERO, GL_ZERO}, [PictOpSrc] = {0, 0, GL_ONE, GL_ZERO}, [PictOpDst] = {0, 0, GL_ZERO, GL_ONE}, [PictOpOver] = {0, 1, GL_ONE, GL_ONE_MINUS_SRC_ALPHA}, [PictOpOverReverse] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ONE}, [PictOpIn] = {1, 0, GL_DST_ALPHA, GL_ZERO}, [PictOpInReverse] = {0, 1, GL_ZERO, GL_SRC_ALPHA}, [PictOpOut] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ZERO}, [PictOpOutReverse] = {0, 1, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA}, [PictOpAtop] = {1, 1, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, [PictOpAtopReverse] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA}, [PictOpXor] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, [PictOpAdd] = {0, 0, GL_ONE, GL_ONE}, }; static void glamor_set_blend(CARD8 op, glamor_program_alpha alpha, PicturePtr dst) { glamor_screen_private *glamor_priv = glamor_get_screen_private(dst->pDrawable->pScreen); GLenum src_blend, dst_blend; struct blendinfo *op_info; switch (alpha) { case glamor_program_alpha_ca_first: op = PictOpOutReverse; break; case glamor_program_alpha_ca_second: op = PictOpAdd; break; default: break; } if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) glDisable(GL_COLOR_LOGIC_OP); if (op == PictOpSrc) return; op_info = &composite_op_info[op]; src_blend = op_info->source_blend; dst_blend = op_info->dest_blend; /* If there's no dst alpha channel, adjust the blend op so that we'll treat * it as always 1. */ if (PICT_FORMAT_A(dst->format) == 0 && op_info->dest_alpha) { if (src_blend == GL_DST_ALPHA) src_blend = GL_ONE; else if (src_blend == GL_ONE_MINUS_DST_ALPHA) src_blend = GL_ZERO; } /* Set up the source alpha value for blending in component alpha mode. */ if (alpha == glamor_program_alpha_dual_blend) { switch (dst_blend) { case GL_SRC_ALPHA: dst_blend = GL_SRC1_COLOR; break; case GL_ONE_MINUS_SRC_ALPHA: dst_blend = GL_ONE_MINUS_SRC1_COLOR; break; } } else if (alpha != glamor_program_alpha_normal) { switch (dst_blend) { case GL_SRC_ALPHA: dst_blend = GL_SRC_COLOR; break; case GL_ONE_MINUS_SRC_ALPHA: dst_blend = GL_ONE_MINUS_SRC_COLOR; break; } } glEnable(GL_BLEND); glBlendFunc(src_blend, dst_blend); } static Bool use_source_solid(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog) { PictSolidFill *solid = &src->pSourcePict->solidFill; float color[4]; glamor_get_rgba_from_color(&solid->fullcolor, color); glamor_set_blend(op, prog->alpha, dst); glUniform4fv(prog->fg_uniform, 1, color); return TRUE; } static const glamor_facet glamor_source_solid = { .name = "render_solid", .fs_exec = " vec4 source = fg;\n", .locations = glamor_program_location_fg, .use_render = use_source_solid, }; static Bool use_source_picture(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog) { glamor_set_blend(op, prog->alpha, dst); return glamor_set_texture((PixmapPtr) src->pDrawable, glamor_picture_red_is_alpha(dst), 0, 0, prog->fill_offset_uniform, prog->fill_size_inv_uniform); } static const glamor_facet glamor_source_picture = { .name = "render_picture", .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n", .fs_exec = " vec4 source = texture2D(sampler, fill_pos);\n", .locations = glamor_program_location_fillsamp | glamor_program_location_fillpos, .use_render = use_source_picture, }; static Bool use_source_1x1_picture(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog) { glamor_set_blend(op, prog->alpha, dst); return glamor_set_texture_pixmap((PixmapPtr) src->pDrawable, glamor_picture_red_is_alpha(dst)); } static const glamor_facet glamor_source_1x1_picture = { .name = "render_picture", .fs_exec = " vec4 source = texture2D(sampler, vec2(0.5));\n", .locations = glamor_program_location_fillsamp, .use_render = use_source_1x1_picture, }; static const glamor_facet *glamor_facet_source[glamor_program_source_count] = { [glamor_program_source_solid] = &glamor_source_solid, [glamor_program_source_picture] = &glamor_source_picture, [glamor_program_source_1x1_picture] = &glamor_source_1x1_picture, }; static const char *glamor_combine[] = { [glamor_program_alpha_normal] = " gl_FragColor = source * mask.a;\n", [glamor_program_alpha_ca_first] = " gl_FragColor = source.a * mask;\n", [glamor_program_alpha_ca_second] = " gl_FragColor = source * mask;\n", [glamor_program_alpha_dual_blend] = " color0 = source * mask;\n" " color1 = source.a * mask;\n" }; static Bool glamor_setup_one_program_render(ScreenPtr screen, glamor_program *prog, glamor_program_source source_type, glamor_program_alpha alpha, const glamor_facet *prim, const char *defines) { if (prog->failed) return FALSE; if (!prog->prog) { const glamor_facet *fill = glamor_facet_source[source_type]; if (!fill) return FALSE; prog->alpha = alpha; if (!glamor_build_program(screen, prog, prim, fill, glamor_combine[alpha], defines)) return FALSE; } return TRUE; } glamor_program * glamor_setup_program_render(CARD8 op, PicturePtr src, PicturePtr mask, PicturePtr dst, glamor_program_render *program_render, const glamor_facet *prim, const char *defines) { ScreenPtr screen = dst->pDrawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_program_alpha alpha; glamor_program_source source_type; glamor_program *prog; if (op > ARRAY_SIZE(composite_op_info)) return NULL; if (glamor_is_component_alpha(mask)) { if (glamor_priv->has_dual_blend) { alpha = glamor_program_alpha_dual_blend; } else { /* This only works for PictOpOver */ if (op != PictOpOver) return NULL; alpha = glamor_program_alpha_ca_first; } } else alpha = glamor_program_alpha_normal; if (src->pDrawable) { /* Can't do transforms, alphamaps or sourcing from non-pixmaps yet */ if (src->transform || src->alphaMap || src->pDrawable->type != DRAWABLE_PIXMAP) return NULL; if (src->pDrawable->width == 1 && src->pDrawable->height == 1 && src->repeat) source_type = glamor_program_source_1x1_picture; else source_type = glamor_program_source_picture; } else { SourcePictPtr sp = src->pSourcePict; if (!sp) return NULL; switch (sp->type) { case SourcePictTypeSolidFill: source_type = glamor_program_source_solid; break; default: return NULL; } } prog = &program_render->progs[source_type][alpha]; if (!glamor_setup_one_program_render(screen, prog, source_type, alpha, prim, defines)) return NULL; if (alpha == glamor_program_alpha_ca_first) { /* Make sure we can also build the second program before * deciding to use this path. */ if (!glamor_setup_one_program_render(screen, &program_render->progs[source_type][glamor_program_alpha_ca_second], source_type, glamor_program_alpha_ca_second, prim, defines)) return NULL; } return prog; } Bool glamor_use_program_render(glamor_program *prog, CARD8 op, PicturePtr src, PicturePtr dst) { glUseProgram(prog->prog); if (prog->prim_use_render && !prog->prim_use_render(op, src, dst, prog)) return FALSE; if (prog->fill_use_render && !prog->fill_use_render(op, src, dst, prog)) return FALSE; return TRUE; } xorg-server-1.20.8/glamor/glamor_eglmodule.c0000644000175000017500000000374113640201473015756 00000000000000/* * Copyright (C) 1998 The XFree86 Project, 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 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 * XFREE86 PROJECT 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 XFree86 Project 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 * XFree86 Project. * * Authors: * Zhigang Gong */ #include "dix-config.h" #include #define GLAMOR_FOR_XORG #include #include "glamor.h" static XF86ModuleVersionInfo VersRec = { GLAMOR_EGL_MODULE_NAME, MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 1, /* version */ ABI_CLASS_ANSIC, /* Only need the ansic layer */ ABI_ANSIC_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ }; _X_EXPORT XF86ModuleData glamoreglModuleData = { &VersRec, NULL, NULL }; xorg-server-1.20.8/glamor/glamor_egl_ext.h0000644000175000017500000000600613640201473015432 00000000000000/* * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL 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. */ /* Extensions used by Glamor, copied from Mesa's eglmesaext.h, */ #ifndef GLAMOR_EGL_EXT_H #define GLAMOR_EGL_EXT_H /* Define needed tokens from EGL_EXT_image_dma_buf_import extension * here to avoid having to add ifdefs everywhere.*/ #ifndef EGL_EXT_image_dma_buf_import #define EGL_LINUX_DMA_BUF_EXT 0x3270 #define EGL_LINUX_DRM_FOURCC_EXT 0x3271 #define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 #define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 #define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 #define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 #define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 #define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 #define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 #define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 #define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A #endif /* Define tokens from EGL_EXT_image_dma_buf_import_modifiers */ #ifndef EGL_EXT_image_dma_buf_import_modifiers #define EGL_EXT_image_dma_buf_import_modifiers 1 #define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 #define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 #define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 #define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 #define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 #define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 #define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 #define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 #define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 #define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 #define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); #endif #endif /* GLAMOR_EGL_EXT_H */ xorg-server-1.20.8/glamor/glamor_dash.c0000644000175000017500000002507513640201473014724 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_program.h" #include "glamor_transform.h" #include "glamor_transfer.h" #include "glamor_prepare.h" static const char dash_vs_vars[] = "attribute vec3 primitive;\n" "varying float dash_offset;\n"; static const char dash_vs_exec[] = " dash_offset = primitive.z / dash_length;\n" " vec2 pos = vec2(0,0);\n" GLAMOR_POS(gl_Position, primitive.xy); static const char dash_fs_vars[] = "varying float dash_offset;\n"; static const char on_off_fs_exec[] = " float pattern = texture2D(dash, vec2(dash_offset, 0.5)).w;\n" " if (pattern == 0.0)\n" " discard;\n"; /* XXX deal with stippled double dashed lines once we have stippling support */ static const char double_fs_exec[] = " float pattern = texture2D(dash, vec2(dash_offset, 0.5)).w;\n" " if (pattern == 0.0)\n" " gl_FragColor = bg;\n" " else\n" " gl_FragColor = fg;\n"; static const glamor_facet glamor_facet_on_off_dash_lines = { .version = 130, .name = "poly_lines_on_off_dash", .vs_vars = dash_vs_vars, .vs_exec = dash_vs_exec, .fs_vars = dash_fs_vars, .fs_exec = on_off_fs_exec, .locations = glamor_program_location_dash, }; static const glamor_facet glamor_facet_double_dash_lines = { .version = 130, .name = "poly_lines_double_dash", .vs_vars = dash_vs_vars, .vs_exec = dash_vs_exec, .fs_vars = dash_fs_vars, .fs_exec = double_fs_exec, .locations = (glamor_program_location_dash| glamor_program_location_fg| glamor_program_location_bg), }; static PixmapPtr glamor_get_dash_pixmap(GCPtr gc) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); ScreenPtr screen = gc->pScreen; PixmapPtr pixmap; int offset; int d; uint32_t pixel; GCPtr scratch_gc; if (gc_priv->dash) return gc_priv->dash; offset = 0; for (d = 0; d < gc->numInDashList; d++) offset += gc->dash[d]; pixmap = glamor_create_pixmap(screen, offset, 1, 8, 0); if (!pixmap) goto bail; scratch_gc = GetScratchGC(8, screen); if (!scratch_gc) goto bail_pixmap; pixel = 0xffffffff; offset = 0; for (d = 0; d < gc->numInDashList; d++) { xRectangle rect; ChangeGCVal changes; changes.val = pixel; (void) ChangeGC(NullClient, scratch_gc, GCForeground, &changes); ValidateGC(&pixmap->drawable, scratch_gc); rect.x = offset; rect.y = 0; rect.width = gc->dash[d]; rect.height = 1; scratch_gc->ops->PolyFillRect (&pixmap->drawable, scratch_gc, 1, &rect); offset += gc->dash[d]; pixel = ~pixel; } FreeScratchGC(scratch_gc); gc_priv->dash = pixmap; return pixmap; bail_pixmap: glamor_destroy_pixmap(pixmap); bail: return NULL; } static glamor_program * glamor_dash_setup(DrawablePtr drawable, GCPtr gc) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); PixmapPtr dash_pixmap; glamor_pixmap_private *dash_priv; glamor_program *prog; if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; if (gc->lineWidth != 0) goto bail; dash_pixmap = glamor_get_dash_pixmap(gc); dash_priv = glamor_get_pixmap_private(dash_pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dash_priv)) goto bail; glamor_make_current(glamor_priv); switch (gc->lineStyle) { case LineOnOffDash: prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->on_off_dash_line_progs, &glamor_facet_on_off_dash_lines); if (!prog) goto bail; break; case LineDoubleDash: if (gc->fillStyle != FillSolid) goto bail; prog = &glamor_priv->double_dash_line_prog; if (!prog->prog) { if (!glamor_build_program(screen, prog, &glamor_facet_double_dash_lines, NULL, NULL, NULL)) goto bail; } if (!glamor_use_program(pixmap, gc, prog, NULL)) goto bail; glamor_set_color(pixmap, gc->fgPixel, prog->fg_uniform); glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform); break; default: goto bail; } /* Set the dash pattern as texture 1 */ glamor_bind_texture(glamor_priv, GL_TEXTURE1, dash_priv->fbo, FALSE); glUniform1i(prog->dash_uniform, 1); glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width); return prog; bail: return NULL; } static void glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog, int n, GLenum mode) { PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); int box_index; int off_x, off_y; glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { int nbox = RegionNumRects(gc->pCompositeClip); BoxPtr box = RegionRects(gc->pCompositeClip); glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y); while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; glDrawArrays(mode, 0, n); } } glDisable(GL_SCISSOR_TEST); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); } static int glamor_line_length(short x1, short y1, short x2, short y2) { return max(abs(x2 - x1), abs(y2 - y1)); } Bool glamor_poly_lines_dash_gl(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points) { ScreenPtr screen = drawable->pScreen; glamor_program *prog; short *v; char *vbo_offset; int add_last; int dash_pos; int prev_x, prev_y; int i; if (n < 2) return TRUE; if (!(prog = glamor_dash_setup(drawable, gc))) return FALSE; add_last = 0; if (gc->capStyle != CapNotLast) add_last = 1; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, (n + add_last) * 3 * sizeof (short), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 3, GL_SHORT, GL_FALSE, 3 * sizeof (short), vbo_offset); dash_pos = gc->dashOffset; prev_x = prev_y = 0; for (i = 0; i < n; i++) { int this_x = points[i].x; int this_y = points[i].y; if (i) { if (mode == CoordModePrevious) { this_x += prev_x; this_y += prev_y; } dash_pos += glamor_line_length(prev_x, prev_y, this_x, this_y); } v[0] = prev_x = this_x; v[1] = prev_y = this_y; v[2] = dash_pos; v += 3; } if (add_last) { v[0] = prev_x + 1; v[1] = prev_y; v[2] = dash_pos + 1; } glamor_put_vbo_space(screen); glamor_dash_loop(drawable, gc, prog, n + add_last, GL_LINE_STRIP); return TRUE; } static short * glamor_add_segment(short *v, short x1, short y1, short x2, short y2, int dash_start, int dash_end) { v[0] = x1; v[1] = y1; v[2] = dash_start; v[3] = x2; v[4] = y2; v[5] = dash_end; return v + 6; } Bool glamor_poly_segment_dash_gl(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs) { ScreenPtr screen = drawable->pScreen; glamor_program *prog; short *v; char *vbo_offset; int dash_start = gc->dashOffset; int add_last; int i; if (!(prog = glamor_dash_setup(drawable, gc))) return FALSE; add_last = 0; if (gc->capStyle != CapNotLast) add_last = 1; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, (nseg< * * original author is Chris Wilson at sna. * */ #include "glamor_priv.h" #include "mipict.h" #include "damage.h" /** @file glamor_compositerects. * * compositeRects acceleration implementation */ static int16_t bound(int16_t a, uint16_t b) { int v = (int) a + (int) b; if (v > MAXSHORT) return MAXSHORT; return v; } static Bool _pixman_region_init_clipped_rectangles(pixman_region16_t * region, unsigned int num_rects, xRectangle *rects, int tx, int ty, BoxPtr extents) { pixman_box16_t stack_boxes[64], *boxes = stack_boxes; pixman_bool_t ret; unsigned int i, j; if (num_rects > ARRAY_SIZE(stack_boxes)) { boxes = xallocarray(num_rects, sizeof(pixman_box16_t)); if (boxes == NULL) return FALSE; } for (i = j = 0; i < num_rects; i++) { boxes[j].x1 = rects[i].x + tx; if (boxes[j].x1 < extents->x1) boxes[j].x1 = extents->x1; boxes[j].y1 = rects[i].y + ty; if (boxes[j].y1 < extents->y1) boxes[j].y1 = extents->y1; boxes[j].x2 = bound(rects[i].x + tx, rects[i].width); if (boxes[j].x2 > extents->x2) boxes[j].x2 = extents->x2; boxes[j].y2 = bound(rects[i].y + ty, rects[i].height); if (boxes[j].y2 > extents->y2) boxes[j].y2 = extents->y2; if (boxes[j].x2 > boxes[j].x1 && boxes[j].y2 > boxes[j].y1) j++; } ret = FALSE; if (j) ret = pixman_region_init_rects(region, boxes, j); if (boxes != stack_boxes) free(boxes); DEBUGF("%s: nrects=%d, region=(%d, %d), (%d, %d) x %d\n", __FUNCTION__, num_rects, region->extents.x1, region->extents.y1, region->extents.x2, region->extents.y2, j); return ret; } void glamor_composite_rectangles(CARD8 op, PicturePtr dst, xRenderColor * color, int num_rects, xRectangle *rects) { PixmapPtr pixmap; struct glamor_pixmap_private *priv; pixman_region16_t region; pixman_box16_t *boxes; int num_boxes; PicturePtr source = NULL; Bool need_free_region = FALSE; DEBUGF("%s(op=%d, %08x x %d [(%d, %d)x(%d, %d) ...])\n", __FUNCTION__, op, (color->alpha >> 8 << 24) | (color->red >> 8 << 16) | (color->green >> 8 << 8) | (color->blue >> 8 << 0), num_rects, rects[0].x, rects[0].y, rects[0].width, rects[0].height); if (!num_rects) return; if (RegionNil(dst->pCompositeClip)) { DEBUGF("%s: empty clip, skipping\n", __FUNCTION__); return; } if ((color->red | color->green | color->blue | color->alpha) <= 0x00ff) { switch (op) { case PictOpOver: case PictOpOutReverse: case PictOpAdd: return; case PictOpInReverse: case PictOpSrc: op = PictOpClear; break; case PictOpAtopReverse: op = PictOpOut; break; case PictOpXor: op = PictOpOverReverse; break; } } if (color->alpha <= 0x00ff) { switch (op) { case PictOpOver: case PictOpOutReverse: return; case PictOpInReverse: op = PictOpClear; break; case PictOpAtopReverse: op = PictOpOut; break; case PictOpXor: op = PictOpOverReverse; break; } } else if (color->alpha >= 0xff00) { switch (op) { case PictOpOver: op = PictOpSrc; break; case PictOpInReverse: return; case PictOpOutReverse: op = PictOpClear; break; case PictOpAtopReverse: op = PictOpOverReverse; break; case PictOpXor: op = PictOpOut; break; } } DEBUGF("%s: converted to op %d\n", __FUNCTION__, op); if (!_pixman_region_init_clipped_rectangles(®ion, num_rects, rects, dst->pDrawable->x, dst->pDrawable->y, &dst->pCompositeClip->extents)) { DEBUGF("%s: allocation failed for region\n", __FUNCTION__); return; } pixmap = glamor_get_drawable_pixmap(dst->pDrawable); priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) goto fallback; if (dst->alphaMap) { DEBUGF("%s: fallback, dst has an alpha-map\n", __FUNCTION__); goto fallback; } need_free_region = TRUE; DEBUGF("%s: drawable extents (%d, %d),(%d, %d) x %d\n", __FUNCTION__, RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, RegionNumRects(®ion)); if (dst->pCompositeClip->data && (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip) || RegionNil(®ion))) { DEBUGF("%s: zero-intersection between rectangles and clip\n", __FUNCTION__); pixman_region_fini(®ion); return; } DEBUGF("%s: clipped extents (%d, %d),(%d, %d) x %d\n", __FUNCTION__, RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, RegionNumRects(®ion)); boxes = pixman_region_rectangles(®ion, &num_boxes); if (op == PictOpSrc || op == PictOpClear) { CARD32 pixel; int dst_x, dst_y; glamor_get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y); pixman_region_translate(®ion, dst_x, dst_y); DEBUGF("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n", __FUNCTION__, dst_x, dst_y, RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, RegionExtents(®ion)->x2, RegionExtents(®ion)->y2); if (op == PictOpClear) pixel = 0; else miRenderColorToPixel(dst->pFormat, color, &pixel); glamor_solid_boxes(pixmap, boxes, num_boxes, pixel); goto done; } else { if (_X_LIKELY(glamor_pixmap_priv_is_small(priv))) { int error; source = CreateSolidPicture(0, color, &error); if (!source) goto done; if (glamor_composite_clipped_region(op, source, NULL, dst, NULL, NULL, pixmap, ®ion, 0, 0, 0, 0, 0, 0)) goto done; } } fallback: miCompositeRects(op, dst, color, num_rects, rects); done: /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must * manually append the damaged regions ourselves. */ DamageRegionAppend(&pixmap->drawable, ®ion); DamageRegionProcessPending(&pixmap->drawable); if (need_free_region) pixman_region_fini(®ion); if (source) FreePicture(source, 0); return; } xorg-server-1.20.8/glamor/glamor_program.h0000644000175000017500000001327013640201473015453 00000000000000/* * Copyright © 2014 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 _GLAMOR_PROGRAM_H_ #define _GLAMOR_PROGRAM_H_ typedef enum { glamor_program_location_none = 0, glamor_program_location_fg = 1, glamor_program_location_bg = 2, glamor_program_location_fillsamp = 4, glamor_program_location_fillpos = 8, glamor_program_location_font = 16, glamor_program_location_bitplane = 32, glamor_program_location_dash = 64, glamor_program_location_atlas = 128, } glamor_program_location; typedef enum { glamor_program_flag_none = 0, } glamor_program_flag; typedef enum { glamor_program_alpha_normal, glamor_program_alpha_ca_first, glamor_program_alpha_ca_second, glamor_program_alpha_dual_blend, glamor_program_alpha_count } glamor_program_alpha; typedef struct _glamor_program glamor_program; typedef Bool (*glamor_use) (PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg); typedef Bool (*glamor_use_render) (CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog); typedef struct { const char *name; const int version; char *vs_defines; char *fs_defines; const char *vs_vars; const char *vs_exec; const char *fs_vars; const char *fs_exec; const glamor_program_location locations; const glamor_program_flag flags; const char *source_name; glamor_use use; glamor_use_render use_render; } glamor_facet; struct _glamor_program { GLint prog; GLint failed; GLint matrix_uniform; GLint fg_uniform; GLint bg_uniform; GLint fill_size_inv_uniform; GLint fill_offset_uniform; GLint font_uniform; GLint bitplane_uniform; GLint bitmul_uniform; GLint dash_uniform; GLint dash_length_uniform; GLint atlas_uniform; glamor_program_location locations; glamor_program_flag flags; glamor_use prim_use; glamor_use fill_use; glamor_program_alpha alpha; glamor_use_render prim_use_render; glamor_use_render fill_use_render; }; typedef struct { glamor_program progs[4]; } glamor_program_fill; extern const glamor_facet glamor_fill_solid; Bool glamor_build_program(ScreenPtr screen, glamor_program *prog, const glamor_facet *prim, const glamor_facet *fill, const char *combine, const char *defines); Bool glamor_use_program(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg); glamor_program * glamor_use_program_fill(PixmapPtr pixmap, GCPtr gc, glamor_program_fill *program_fill, const glamor_facet *prim); typedef enum { glamor_program_source_solid, glamor_program_source_picture, glamor_program_source_1x1_picture, glamor_program_source_count, } glamor_program_source; typedef struct { glamor_program progs[glamor_program_source_count][glamor_program_alpha_count]; } glamor_program_render; static inline Bool glamor_is_component_alpha(PicturePtr mask) { if (mask && mask->componentAlpha && PICT_FORMAT_RGB(mask->format)) return TRUE; return FALSE; } glamor_program * glamor_setup_program_render(CARD8 op, PicturePtr src, PicturePtr mask, PicturePtr dst, glamor_program_render *program_render, const glamor_facet *prim, const char *defines); Bool glamor_use_program_render(glamor_program *prog, CARD8 op, PicturePtr src, PicturePtr dst); #endif /* _GLAMOR_PROGRAM_H_ */ xorg-server-1.20.8/glamor/glamor_triangles.c0000644000175000017500000000337313640201473015772 00000000000000/* * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. * * Authors: * Zhigang Gong * */ #include "glamor_priv.h" void glamor_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris) { if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) && glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) { fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris); } glamor_finish_access_picture(pSrc); glamor_finish_access_picture(pDst); } xorg-server-1.20.8/glamor/glamor_points.c0000644000175000017500000000776113640201473015323 00000000000000/* * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. * * Authors: * Zhigang Gong * */ #include "glamor_priv.h" #include "glamor_transform.h" static const glamor_facet glamor_facet_point = { .name = "poly_point", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = GLAMOR_POS(gl_Position, primitive), }; static Bool glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPointPtr ppt) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_program *prog = &glamor_priv->point_prog; glamor_pixmap_private *pixmap_priv; int off_x, off_y; GLshort *vbo_ppt; char *vbo_offset; int box_index; Bool ret = FALSE; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_make_current(glamor_priv); if (prog->failed) goto bail; if (!prog->prog) { if (!glamor_build_program(screen, prog, &glamor_facet_point, &glamor_fill_solid, NULL, NULL)) goto bail; } if (!glamor_use_program(pixmap, gc, prog, NULL)) goto bail; vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 0, vbo_offset); if (mode == CoordModePrevious) { int n = npt; INT16 x = 0, y = 0; while (n--) { vbo_ppt[0] = (x += ppt->x); vbo_ppt[1] = (y += ppt->y); vbo_ppt += 2; ppt++; } } else memcpy(vbo_ppt, ppt, npt * (2 * sizeof (INT16))); glamor_put_vbo_space(screen); glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { int nbox = RegionNumRects(gc->pCompositeClip); BoxPtr box = RegionRects(gc->pCompositeClip); if (!glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y)) goto bail; while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; glDrawArrays(GL_POINTS, 0, npt); } } ret = TRUE; bail: glDisable(GL_SCISSOR_TEST); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } void glamor_poly_point(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPointPtr ppt) { if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt)) return; miPolyPoint(drawable, gc, mode, npt, ppt); } xorg-server-1.20.8/glamor/glamor_lines.c0000644000175000017500000001234013640201473015106 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_program.h" #include "glamor_transform.h" #include "glamor_prepare.h" static const glamor_facet glamor_facet_poly_lines = { .name = "poly_lines", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (" vec2 pos = vec2(0.0,0.0);\n" GLAMOR_POS(gl_Position, primitive.xy)), }; static Bool glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; glamor_program *prog; int off_x, off_y; DDXPointPtr v; char *vbo_offset; int box_index; int add_last; Bool ret = FALSE; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; add_last = 0; if (gc->capStyle != CapNotLast) add_last = 1; if (n < 2) return TRUE; glamor_make_current(glamor_priv); prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_line_program, &glamor_facet_poly_lines); if (!prog) goto bail; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, (n + add_last) * sizeof (DDXPointRec), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, sizeof (DDXPointRec), vbo_offset); if (mode == CoordModePrevious) { int i; DDXPointRec here = { 0, 0 }; for (i = 0; i < n; i++) { here.x += points[i].x; here.y += points[i].y; v[i] = here; } } else { memcpy(v, points, n * sizeof (DDXPointRec)); } if (add_last) { v[n].x = v[n-1].x + 1; v[n].y = v[n-1].y; } glamor_put_vbo_space(screen); glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { int nbox = RegionNumRects(gc->pCompositeClip); BoxPtr box = RegionRects(gc->pCompositeClip); if (!glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y)) goto bail; while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; glDrawArrays(GL_LINE_STRIP, 0, n + add_last); } } ret = TRUE; bail: glDisable(GL_SCISSOR_TEST); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } static Bool glamor_poly_lines_gl(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points) { if (gc->lineWidth != 0) return FALSE; switch (gc->lineStyle) { case LineSolid: return glamor_poly_lines_solid_gl(drawable, gc, mode, n, points); case LineOnOffDash: return glamor_poly_lines_dash_gl(drawable, gc, mode, n, points); case LineDoubleDash: if (gc->fillStyle == FillTiled) return glamor_poly_lines_solid_gl(drawable, gc, mode, n, points); else return glamor_poly_lines_dash_gl(drawable, gc, mode, n, points); default: return FALSE; } } static void glamor_poly_lines_bail(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points) { glamor_fallback("to %p (%c)\n", drawable, glamor_get_drawable_location(drawable)); miPolylines(drawable, gc, mode, n, points); } void glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points) { if (glamor_poly_lines_gl(drawable, gc, mode, n, points)) return; glamor_poly_lines_bail(drawable, gc, mode, n, points); } xorg-server-1.20.8/glamor/glamor_utils.c0000644000175000017500000000505413640201473015140 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" void glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, unsigned long fg_pixel) { DrawablePtr drawable = &pixmap->drawable; GCPtr gc; xRectangle *rect; int n; rect = xallocarray(nbox, sizeof(xRectangle)); if (!rect) return; for (n = 0; n < nbox; n++) { rect[n].x = box[n].x1; rect[n].y = box[n].y1; rect[n].width = box[n].x2 - box[n].x1; rect[n].height = box[n].y2 - box[n].y1; } gc = GetScratchGC(drawable->depth, drawable->pScreen); if (gc) { ChangeGCVal vals[1]; vals[0].val = fg_pixel; ChangeGC(NullClient, gc, GCForeground, vals); ValidateGC(drawable, gc); gc->ops->PolyFillRect(drawable, gc, nbox, rect); FreeScratchGC(gc); } free(rect); } void glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, unsigned long fg_pixel) { DrawablePtr drawable = &pixmap->drawable; GCPtr gc; ChangeGCVal vals[1]; xRectangle rect; vals[0].val = fg_pixel; gc = GetScratchGC(drawable->depth, drawable->pScreen); if (!gc) return; ChangeGC(NullClient, gc, GCForeground, vals); ValidateGC(drawable, gc); rect.x = x; rect.y = y; rect.width = width; rect.height = height; gc->ops->PolyFillRect(drawable, gc, 1, &rect); FreeScratchGC(gc); } xorg-server-1.20.8/glamor/glamor_egl.h0000644000175000017500000000620413640201473014552 00000000000000/* * Copyright © 2016 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. * * Authors: * Adam Jackson */ #ifndef GLAMOR_EGL_H #define GLAMOR_EGL_H #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include #include #include /* * Create an EGLDisplay from a native display type. This is a little quirky * for a few reasons. * * 1: GetPlatformDisplayEXT and GetPlatformDisplay are the API you want to * use, but have different function signatures in the third argument; this * happens not to matter for us, at the moment, but it means epoxy won't alias * them together. * * 2: epoxy 1.3 and earlier don't understand EGL client extensions, which * means you can't call "eglGetPlatformDisplayEXT" directly, as the resolver * will crash. * * 3: You can't tell whether you have EGL 1.5 at this point, because * eglQueryString(EGL_VERSION) is a property of the display, which we don't * have yet. So you have to query for extensions no matter what. Fortunately * epoxy_has_egl_extension _does_ let you query for client extensions, so * we don't have to write our own extension string parsing. * * 4. There is no EGL_KHR_platform_base to complement the EXT one, thus one * needs to know EGL 1.5 is supported in order to use the eglGetPlatformDisplay * function pointer. * We can workaround this (circular dependency) by probing for the EGL 1.5 * platform extensions (EGL_KHR_platform_gbm and friends) yet it doesn't seem * like mesa will be able to adverise these (even though it can do EGL 1.5). */ static inline EGLDisplay glamor_egl_get_display(EGLint type, void *native) { /* In practise any EGL 1.5 implementation would support the EXT extension */ if (epoxy_has_egl_extension(NULL, "EGL_EXT_platform_base")) { PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplayEXT = (void *) eglGetProcAddress("eglGetPlatformDisplayEXT"); if (getPlatformDisplayEXT) return getPlatformDisplayEXT(type, native, NULL); } /* Welp, everything is awful. */ return eglGetDisplay(native); } #endif xorg-server-1.20.8/glamor/glamor_context.h0000644000175000017500000000352513640201473015472 00000000000000/* * Copyright © 2013 Intel Corporation * * 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. */ /** * @file glamor_context.h * * This is the struct of state required for context switching in * glamor. It has to use types that don't require including either * server headers or Xlib headers, since it will be included by both * the server and the GLX (xlib) code. */ struct glamor_context { /** Either an EGLDisplay or an Xlib Display */ void *display; /** Either a GLXContext or an EGLContext. */ void *ctx; /** The EGLSurface we should MakeCurrent to */ void *drawable; /** The GLXDrawable we should MakeCurrent to */ uint32_t drawable_xid; void (*make_current)(struct glamor_context *glamor_ctx); }; Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx); xorg-server-1.20.8/glamor/glamor_copy.c0000644000175000017500000006331213640201473014753 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_transfer.h" #include "glamor_prepare.h" #include "glamor_transform.h" struct copy_args { PixmapPtr src_pixmap; glamor_pixmap_fbo *src; uint32_t bitplane; int dx, dy; }; static Bool use_copyarea(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg) { struct copy_args *args = arg; glamor_pixmap_fbo *src = args->src; glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen), GL_TEXTURE0, src, TRUE); glUniform2f(prog->fill_offset_uniform, args->dx, args->dy); glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height); return TRUE; } static const glamor_facet glamor_facet_copyarea = { "copy_area", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (GLAMOR_POS(gl_Position, primitive.xy) " fill_pos = (fill_offset + primitive.xy) * fill_size_inv;\n"), .fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n", .locations = glamor_program_location_fillsamp | glamor_program_location_fillpos, .use = use_copyarea, }; /* * Configure the copy plane program for the current operation */ static Bool use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg) { struct copy_args *args = arg; glamor_pixmap_fbo *src = args->src; glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen), GL_TEXTURE0, src, TRUE); glUniform2f(prog->fill_offset_uniform, args->dx, args->dy); glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height); glamor_set_color(dst, gc->fgPixel, prog->fg_uniform); glamor_set_color(dst, gc->bgPixel, prog->bg_uniform); /* XXX handle 2 10 10 10 and 1555 formats; presumably the pixmap private knows this? */ switch (args->src_pixmap->drawable.depth) { case 30: glUniform4ui(prog->bitplane_uniform, (args->bitplane >> 20) & 0x3ff, (args->bitplane >> 10) & 0x3ff, (args->bitplane ) & 0x3ff, 0); glUniform4f(prog->bitmul_uniform, 0x3ff, 0x3ff, 0x3ff, 0); break; case 24: glUniform4ui(prog->bitplane_uniform, (args->bitplane >> 16) & 0xff, (args->bitplane >> 8) & 0xff, (args->bitplane ) & 0xff, 0); glUniform4f(prog->bitmul_uniform, 0xff, 0xff, 0xff, 0); break; case 32: glUniform4ui(prog->bitplane_uniform, (args->bitplane >> 16) & 0xff, (args->bitplane >> 8) & 0xff, (args->bitplane ) & 0xff, (args->bitplane >> 24) & 0xff); glUniform4f(prog->bitmul_uniform, 0xff, 0xff, 0xff, 0xff); break; case 16: glUniform4ui(prog->bitplane_uniform, (args->bitplane >> 11) & 0x1f, (args->bitplane >> 5) & 0x3f, (args->bitplane ) & 0x1f, 0); glUniform4f(prog->bitmul_uniform, 0x1f, 0x3f, 0x1f, 0); break; case 15: glUniform4ui(prog->bitplane_uniform, (args->bitplane >> 10) & 0x1f, (args->bitplane >> 5) & 0x1f, (args->bitplane ) & 0x1f, 0); glUniform4f(prog->bitmul_uniform, 0x1f, 0x1f, 0x1f, 0); break; case 8: glUniform4ui(prog->bitplane_uniform, 0, 0, 0, args->bitplane); glUniform4f(prog->bitmul_uniform, 0, 0, 0, 0xff); break; case 1: glUniform4ui(prog->bitplane_uniform, 0, 0, 0, args->bitplane); glUniform4f(prog->bitmul_uniform, 0, 0, 0, 0xff); break; } return TRUE; } static const glamor_facet glamor_facet_copyplane = { "copy_plane", .version = 130, .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (GLAMOR_POS(gl_Position, (primitive.xy)) " fill_pos = (fill_offset + primitive.xy) * fill_size_inv;\n"), .fs_exec = (" uvec4 bits = uvec4(round(texture2D(sampler, fill_pos) * bitmul));\n" " if ((bits & bitplane) != uvec4(0,0,0,0))\n" " gl_FragColor = fg;\n" " else\n" " gl_FragColor = bg;\n"), .locations = glamor_program_location_fillsamp|glamor_program_location_fillpos|glamor_program_location_fg|glamor_program_location_bg|glamor_program_location_bitplane, .use = use_copyplane, }; /* * When all else fails, pull the bits out of the GPU and do the * operation with fb */ static void glamor_copy_bail(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW) && glamor_prepare_access(src, GLAMOR_ACCESS_RO)) { if (bitplane) { if (src->bitsPerPixel > 1) fbCopyNto1(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); else fbCopy1toN(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } else { fbCopyNtoN(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } } glamor_finish_access(dst); glamor_finish_access(src); } /** * Implements CopyPlane and CopyArea from the CPU to the GPU by using * the source as a texture and painting that into the destination. * * This requires that source and dest are different textures, or that * (if the copy area doesn't overlap), GL_NV_texture_barrier is used * to ensure that the caches are flushed at the right times. */ static Bool glamor_copy_cpu_fbo(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { ScreenPtr screen = dst->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); int dst_xoff, dst_yoff; if (gc && gc->alu != GXcopy) goto bail; if (gc && !glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; glamor_make_current(glamor_priv); if (!glamor_prepare_access(src, GLAMOR_ACCESS_RO)) goto bail; glamor_get_drawable_deltas(dst, dst_pixmap, &dst_xoff, &dst_yoff); if (bitplane) { FbBits *tmp_bits; FbStride tmp_stride; int tmp_bpp; int tmp_xoff, tmp_yoff; PixmapPtr tmp_pix = fbCreatePixmap(screen, dst_pixmap->drawable.width, dst_pixmap->drawable.height, dst->depth, 0); if (!tmp_pix) { glamor_finish_access(src); goto bail; } tmp_pix->drawable.x = dst_xoff; tmp_pix->drawable.y = dst_yoff; fbGetDrawable(&tmp_pix->drawable, tmp_bits, tmp_stride, tmp_bpp, tmp_xoff, tmp_yoff); if (src->bitsPerPixel > 1) fbCopyNto1(src, &tmp_pix->drawable, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); else fbCopy1toN(src, &tmp_pix->drawable, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); glamor_upload_boxes(dst_pixmap, box, nbox, tmp_xoff, tmp_yoff, dst_xoff, dst_yoff, (uint8_t *) tmp_bits, tmp_stride * sizeof(FbBits)); fbDestroyPixmap(tmp_pix); } else { FbBits *src_bits; FbStride src_stride; int src_bpp; int src_xoff, src_yoff; fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff); glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy, dst_xoff, dst_yoff, (uint8_t *) src_bits, src_stride * sizeof (FbBits)); } glamor_finish_access(src); return TRUE; bail: return FALSE; } /** * Implements CopyArea from the GPU to the CPU using glReadPixels from the * source FBO. */ static Bool glamor_copy_fbo_cpu(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { ScreenPtr screen = dst->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); FbBits *dst_bits; FbStride dst_stride; int dst_bpp; int src_xoff, src_yoff; int dst_xoff, dst_yoff; if (gc && gc->alu != GXcopy) goto bail; if (gc && !glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; glamor_make_current(glamor_priv); if (!glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) goto bail; glamor_get_drawable_deltas(src, src_pixmap, &src_xoff, &src_yoff); fbGetDrawable(dst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff); glamor_download_boxes(src_pixmap, box, nbox, src_xoff + dx, src_yoff + dy, dst_xoff, dst_yoff, (uint8_t *) dst_bits, dst_stride * sizeof (FbBits)); glamor_finish_access(dst); return TRUE; bail: return FALSE; } /* Include the enums here for the moment, to keep from needing to bump epoxy. */ #ifndef GL_TILE_RASTER_ORDER_FIXED_MESA #define GL_TILE_RASTER_ORDER_FIXED_MESA 0x8BB8 #define GL_TILE_RASTER_ORDER_INCREASING_X_MESA 0x8BB9 #define GL_TILE_RASTER_ORDER_INCREASING_Y_MESA 0x8BBA #endif /* * Copy from GPU to GPU by using the source * as a texture and painting that into the destination */ static Bool glamor_copy_fbo_fbo_draw(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { ScreenPtr screen = dst->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); glamor_pixmap_private *src_priv = glamor_get_pixmap_private(src_pixmap); glamor_pixmap_private *dst_priv = glamor_get_pixmap_private(dst_pixmap); int src_box_index, dst_box_index; int dst_off_x, dst_off_y; int src_off_x, src_off_y; GLshort *v; char *vbo_offset; struct copy_args args; glamor_program *prog; const glamor_facet *copy_facet; int n; Bool ret = FALSE; BoxRec bounds = glamor_no_rendering_bounds(); glamor_make_current(glamor_priv); if (gc && !glamor_set_planemask(gc->depth, gc->planemask)) goto bail_ctx; if (!glamor_set_alu(screen, gc ? gc->alu : GXcopy)) goto bail_ctx; if (bitplane && !glamor_priv->can_copyplane) goto bail_ctx; if (bitplane) { prog = &glamor_priv->copy_plane_prog; copy_facet = &glamor_facet_copyplane; } else { prog = &glamor_priv->copy_area_prog; copy_facet = &glamor_facet_copyarea; } if (prog->failed) goto bail_ctx; if (!prog->prog) { if (!glamor_build_program(screen, prog, copy_facet, NULL, NULL, NULL)) goto bail_ctx; } args.src_pixmap = src_pixmap; args.bitplane = bitplane; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(dst->pScreen, nbox * 8 * sizeof (int16_t), &vbo_offset); if (src_pixmap == dst_pixmap && glamor_priv->has_mesa_tile_raster_order) { glEnable(GL_TILE_RASTER_ORDER_FIXED_MESA); if (dx >= 0) glEnable(GL_TILE_RASTER_ORDER_INCREASING_X_MESA); else glDisable(GL_TILE_RASTER_ORDER_INCREASING_X_MESA); if (dy >= 0) glEnable(GL_TILE_RASTER_ORDER_INCREASING_Y_MESA); else glDisable(GL_TILE_RASTER_ORDER_INCREASING_Y_MESA); } glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 2 * sizeof (GLshort), vbo_offset); if (nbox < 100) { bounds = glamor_start_rendering_bounds(); for (int i = 0; i < nbox; i++) glamor_bounds_union_box(&bounds, &box[i]); } for (n = 0; n < nbox; n++) { v[0] = box->x1; v[1] = box->y1; v[2] = box->x1; v[3] = box->y2; v[4] = box->x2; v[5] = box->y2; v[6] = box->x2; v[7] = box->y1; v += 8; box++; } glamor_put_vbo_space(screen); glamor_get_drawable_deltas(src, src_pixmap, &src_off_x, &src_off_y); glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(src_priv, src_box_index) { BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_index); args.dx = dx + src_off_x - src_box->x1; args.dy = dy + src_off_y - src_box->y1; args.src = glamor_pixmap_fbo_at(src_priv, src_box_index); if (!glamor_use_program(dst_pixmap, gc, prog, &args)) goto bail_ctx; glamor_pixmap_loop(dst_priv, dst_box_index) { BoxRec scissor = { .x1 = max(-args.dx, bounds.x1), .y1 = max(-args.dy, bounds.y1), .x2 = min(-args.dx + src_box->x2 - src_box->x1, bounds.x2), .y2 = min(-args.dy + src_box->y2 - src_box->y1, bounds.y2), }; if (scissor.x1 >= scissor.x2 || scissor.y1 >= scissor.y2) continue; if (!glamor_set_destination_drawable(dst, dst_box_index, FALSE, FALSE, prog->matrix_uniform, &dst_off_x, &dst_off_y)) goto bail_ctx; glScissor(scissor.x1 + dst_off_x, scissor.y1 + dst_off_y, scissor.x2 - scissor.x1, scissor.y2 - scissor.y1); glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox); } } ret = TRUE; bail_ctx: if (src_pixmap == dst_pixmap && glamor_priv->has_mesa_tile_raster_order) { glDisable(GL_TILE_RASTER_ORDER_FIXED_MESA); } glDisable(GL_SCISSOR_TEST); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } /** * Copies from the GPU to the GPU using a temporary pixmap in between, * to correctly handle overlapping copies. */ static Bool glamor_copy_fbo_fbo_temp(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { ScreenPtr screen = dst->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr tmp_pixmap; BoxRec bounds; int n; BoxPtr tmp_box; if (nbox == 0) return TRUE; /* Sanity check state to avoid getting halfway through and bailing * at the last second. Might be nice to have checks that didn't * involve setting state. */ glamor_make_current(glamor_priv); if (gc && !glamor_set_planemask(gc->depth, gc->planemask)) goto bail_ctx; if (!glamor_set_alu(screen, gc ? gc->alu : GXcopy)) goto bail_ctx; /* Find the size of the area to copy */ bounds = box[0]; for (n = 1; n < nbox; n++) { bounds.x1 = min(bounds.x1, box[n].x1); bounds.x2 = max(bounds.x2, box[n].x2); bounds.y1 = min(bounds.y1, box[n].y1); bounds.y2 = max(bounds.y2, box[n].y2); } /* Allocate a suitable temporary pixmap */ tmp_pixmap = glamor_create_pixmap(screen, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1, src->depth, 0); if (!tmp_pixmap) goto bail; tmp_box = calloc(nbox, sizeof (BoxRec)); if (!tmp_box) goto bail_pixmap; /* Convert destination boxes into tmp pixmap boxes */ for (n = 0; n < nbox; n++) { tmp_box[n].x1 = box[n].x1 - bounds.x1; tmp_box[n].x2 = box[n].x2 - bounds.x1; tmp_box[n].y1 = box[n].y1 - bounds.y1; tmp_box[n].y2 = box[n].y2 - bounds.y1; } if (!glamor_copy_fbo_fbo_draw(src, &tmp_pixmap->drawable, NULL, tmp_box, nbox, dx + bounds.x1, dy + bounds.y1, FALSE, FALSE, 0, NULL)) goto bail_box; if (!glamor_copy_fbo_fbo_draw(&tmp_pixmap->drawable, dst, gc, box, nbox, -bounds.x1, -bounds.y1, FALSE, FALSE, bitplane, closure)) goto bail_box; free(tmp_box); glamor_destroy_pixmap(tmp_pixmap); return TRUE; bail_box: free(tmp_box); bail_pixmap: glamor_destroy_pixmap(tmp_pixmap); bail: return FALSE; bail_ctx: return FALSE; } /** * Returns TRUE if the copy has to be implemented with * glamor_copy_fbo_fbo_temp() instead of glamor_copy_fbo_fbo(). * * If the src and dst are in the same pixmap, then glamor_copy_fbo_fbo()'s * sampling would give undefined results (since the same texture would be * bound as an FBO destination and as a texture source). However, if we * have GL_NV_texture_barrier, we can take advantage of the exception it * added: * * "- If a texel has been written, then in order to safely read the result * a texel fetch must be in a subsequent Draw separated by the command * * void TextureBarrierNV(void); * * TextureBarrierNV() will guarantee that writes have completed and caches * have been invalidated before subsequent Draws are executed." */ static Bool glamor_copy_needs_temp(DrawablePtr src, DrawablePtr dst, BoxPtr box, int nbox, int dx, int dy) { PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); ScreenPtr screen = dst->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); int n; int dst_off_x, dst_off_y; int src_off_x, src_off_y; BoxRec bounds; if (src_pixmap != dst_pixmap) return FALSE; if (nbox == 0) return FALSE; if (!glamor_priv->has_nv_texture_barrier) return TRUE; if (!glamor_priv->has_mesa_tile_raster_order) { glamor_get_drawable_deltas(src, src_pixmap, &src_off_x, &src_off_y); glamor_get_drawable_deltas(dst, dst_pixmap, &dst_off_x, &dst_off_y); bounds = box[0]; for (n = 1; n < nbox; n++) { bounds.x1 = min(bounds.x1, box[n].x1); bounds.y1 = min(bounds.y1, box[n].y1); bounds.x2 = max(bounds.x2, box[n].x2); bounds.y2 = max(bounds.y2, box[n].y2); } /* Check to see if the pixmap-relative boxes overlap in both X and Y, * in which case we can't rely on NV_texture_barrier and must * make a temporary copy * * dst.x1 < src.x2 && * src.x1 < dst.x2 && * * dst.y1 < src.y2 && * src.y1 < dst.y2 */ if (bounds.x1 + dst_off_x < bounds.x2 + dx + src_off_x && bounds.x1 + dx + src_off_x < bounds.x2 + dst_off_x && bounds.y1 + dst_off_y < bounds.y2 + dy + src_off_y && bounds.y1 + dy + src_off_y < bounds.y2 + dst_off_y) { return TRUE; } } glTextureBarrierNV(); return FALSE; } static Bool glamor_copy_gl(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); glamor_pixmap_private *src_priv = glamor_get_pixmap_private(src_pixmap); glamor_pixmap_private *dst_priv = glamor_get_pixmap_private(dst_pixmap); if (GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_priv)) { if (GLAMOR_PIXMAP_PRIV_HAS_FBO(src_priv)) { if (glamor_copy_needs_temp(src, dst, box, nbox, dx, dy)) return glamor_copy_fbo_fbo_temp(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); else return glamor_copy_fbo_fbo_draw(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } return glamor_copy_cpu_fbo(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } else if (GLAMOR_PIXMAP_PRIV_HAS_FBO(src_priv) && dst_priv->type != GLAMOR_DRM_ONLY && bitplane == 0) { return glamor_copy_fbo_cpu(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } return FALSE; } void glamor_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { if (nbox == 0) return; if (glamor_copy_gl(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure)) return; glamor_copy_bail(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } RegionPtr glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc, int srcx, int srcy, int width, int height, int dstx, int dsty) { return miDoCopy(src, dst, gc, srcx, srcy, width, height, dstx, dsty, glamor_copy, 0, NULL); } RegionPtr glamor_copy_plane(DrawablePtr src, DrawablePtr dst, GCPtr gc, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitplane) { if ((bitplane & FbFullMask(src->depth)) == 0) return miHandleExposures(src, dst, gc, srcx, srcy, width, height, dstx, dsty); return miDoCopy(src, dst, gc, srcx, srcy, width, height, dstx, dsty, glamor_copy, bitplane, NULL); } void glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region) { PixmapPtr pixmap = glamor_get_drawable_pixmap(&window->drawable); DrawablePtr drawable = &pixmap->drawable; RegionRec dst_region; int dx, dy; dx = old_origin.x - window->drawable.x; dy = old_origin.y - window->drawable.y; RegionTranslate(src_region, -dx, -dy); RegionNull(&dst_region); RegionIntersect(&dst_region, &window->borderClip, src_region); #ifdef COMPOSITE if (pixmap->screen_x || pixmap->screen_y) RegionTranslate(&dst_region, -pixmap->screen_x, -pixmap->screen_y); #endif miCopyRegion(drawable, drawable, 0, &dst_region, dx, dy, glamor_copy, 0, 0); RegionUninit(&dst_region); } xorg-server-1.20.8/glamor/glamor_priv.h0000644000175000017500000007005713640201473014772 00000000000000/* * Copyright © 2008 Intel Corporation * * 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. * * Authors: * Eric Anholt * */ #ifndef GLAMOR_PRIV_H #define GLAMOR_PRIV_H #include "dix-config.h" #include "glamor.h" #include "xvdix.h" #if XSYNC #include "misyncshm.h" #include "misyncstr.h" #endif #include #ifdef GLAMOR_HAS_GBM #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include #endif #define GLAMOR_DEFAULT_PRECISION \ "#ifdef GL_ES\n" \ "precision mediump float;\n" \ "#endif\n" #include "glyphstr.h" #include "glamor_debug.h" #include "glamor_context.h" #include "glamor_program.h" #include struct glamor_pixmap_private; typedef struct glamor_composite_shader { GLuint prog; GLint dest_to_dest_uniform_location; GLint dest_to_source_uniform_location; GLint dest_to_mask_uniform_location; GLint source_uniform_location; GLint mask_uniform_location; GLint source_wh; GLint mask_wh; GLint source_repeat_mode; GLint mask_repeat_mode; union { float source_solid_color[4]; struct { PixmapPtr source_pixmap; PicturePtr source; }; }; union { float mask_solid_color[4]; struct { PixmapPtr mask_pixmap; PicturePtr mask; }; }; } glamor_composite_shader; enum ca_state { CA_NONE, CA_TWO_PASS, CA_DUAL_BLEND, }; enum shader_source { SHADER_SOURCE_SOLID, SHADER_SOURCE_TEXTURE, SHADER_SOURCE_TEXTURE_ALPHA, SHADER_SOURCE_COUNT, }; enum shader_mask { SHADER_MASK_NONE, SHADER_MASK_SOLID, SHADER_MASK_TEXTURE, SHADER_MASK_TEXTURE_ALPHA, SHADER_MASK_COUNT, }; enum shader_dest_swizzle { SHADER_DEST_SWIZZLE_DEFAULT, SHADER_DEST_SWIZZLE_ALPHA_TO_RED, SHADER_DEST_SWIZZLE_COUNT, }; struct shader_key { enum shader_source source; enum shader_mask mask; glamor_program_alpha in; enum shader_dest_swizzle dest_swizzle; }; struct blendinfo { Bool dest_alpha; Bool source_alpha; GLenum source_blend; GLenum dest_blend; }; typedef struct { INT16 x_src; INT16 y_src; INT16 x_mask; INT16 y_mask; INT16 x_dst; INT16 y_dst; INT16 width; INT16 height; } glamor_composite_rect_t; enum glamor_vertex_type { GLAMOR_VERTEX_POS, GLAMOR_VERTEX_SOURCE, GLAMOR_VERTEX_MASK }; enum gradient_shader { SHADER_GRADIENT_LINEAR, SHADER_GRADIENT_RADIAL, SHADER_GRADIENT_CONICAL, SHADER_GRADIENT_COUNT, }; struct glamor_screen_private; struct glamor_pixmap_private; enum glamor_gl_flavor { GLAMOR_GL_DESKTOP, // OPENGL API GLAMOR_GL_ES2 // OPENGL ES2.0 API }; #define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024) struct glamor_saved_procs { CloseScreenProcPtr close_screen; CreateGCProcPtr create_gc; CreatePixmapProcPtr create_pixmap; DestroyPixmapProcPtr destroy_pixmap; GetSpansProcPtr get_spans; GetImageProcPtr get_image; CompositeProcPtr composite; CompositeRectsProcPtr composite_rects; TrapezoidsProcPtr trapezoids; GlyphsProcPtr glyphs; ChangeWindowAttributesProcPtr change_window_attributes; CopyWindowProcPtr copy_window; BitmapToRegionProcPtr bitmap_to_region; TrianglesProcPtr triangles; AddTrapsProcPtr addtraps; #if XSYNC SyncScreenFuncsRec sync_screen_funcs; #endif ScreenBlockHandlerProcPtr block_handler; }; typedef struct glamor_screen_private { enum glamor_gl_flavor gl_flavor; int glsl_version; Bool has_pack_invert; Bool has_fbo_blit; Bool has_map_buffer_range; Bool has_buffer_storage; Bool has_khr_debug; Bool has_mesa_tile_raster_order; Bool has_nv_texture_barrier; Bool has_pack_subimage; Bool has_unpack_subimage; Bool has_rw_pbo; Bool use_quads; Bool has_dual_blend; Bool has_texture_swizzle; Bool is_core_profile; Bool can_copyplane; int max_fbo_size; GLuint one_channel_format; /* glamor point shader */ glamor_program point_prog; /* glamor spans shaders */ glamor_program_fill fill_spans_program; /* glamor rect shaders */ glamor_program_fill poly_fill_rect_program; /* glamor glyphblt shaders */ glamor_program_fill poly_glyph_blt_progs; /* glamor text shaders */ glamor_program_fill poly_text_progs; glamor_program te_text_prog; glamor_program image_text_prog; /* glamor copy shaders */ glamor_program copy_area_prog; glamor_program copy_plane_prog; /* glamor line shader */ glamor_program_fill poly_line_program; /* glamor segment shaders */ glamor_program_fill poly_segment_program; /* glamor dash line shader */ glamor_program_fill on_off_dash_line_progs; glamor_program double_dash_line_prog; /* glamor composite_glyphs shaders */ glamor_program_render glyphs_program; struct glamor_glyph_atlas *glyph_atlas_a; struct glamor_glyph_atlas *glyph_atlas_argb; int glyph_atlas_dim; int glyph_max_dim; char *glyph_defines; /** Vertex buffer for all GPU rendering. */ GLuint vao; GLuint vbo; /** Next offset within the VBO that glamor_get_vbo_space() will use. */ int vbo_offset; int vbo_size; Bool vbo_mapped; /** * Pointer to glamor_get_vbo_space()'s current VBO mapping. * * Note that this is not necessarily equal to the pointer returned * by glamor_get_vbo_space(), so it can't be used in place of that. */ char *vb; int vb_stride; /** Cached index buffer for translating GL_QUADS to triangles. */ GLuint ib; /** Index buffer type: GL_UNSIGNED_SHORT or GL_UNSIGNED_INT */ GLenum ib_type; /** Number of quads the index buffer has indices for. */ unsigned ib_size; Bool has_source_coords, has_mask_coords; int render_nr_quads; glamor_composite_shader composite_shader[SHADER_SOURCE_COUNT] [SHADER_MASK_COUNT] [glamor_program_alpha_count] [SHADER_DEST_SWIZZLE_COUNT]; /* glamor gradient, 0 for small nstops, 1 for large nstops and 2 for dynamic generate. */ GLint gradient_prog[SHADER_GRADIENT_COUNT][3]; int linear_max_nstops; int radial_max_nstops; struct glamor_saved_procs saved_procs; GetDrawableModifiersFuncPtr get_drawable_modifiers; int flags; ScreenPtr screen; int dri3_enabled; Bool suppress_gl_out_of_memory_logging; Bool logged_any_fbo_allocation_failure; Bool logged_any_pbo_allocation_failure; /* xv */ glamor_program xv_prog; struct glamor_context ctx; } glamor_screen_private; typedef enum glamor_access { GLAMOR_ACCESS_RO, GLAMOR_ACCESS_RW, } glamor_access_t; enum glamor_fbo_state { /** There is no storage attached to the pixmap. */ GLAMOR_FBO_UNATTACHED, /** * The pixmap has FBO storage attached, but devPrivate.ptr doesn't * point at anything. */ GLAMOR_FBO_NORMAL, }; typedef struct glamor_pixmap_fbo { GLuint tex; /**< GL texture name */ GLuint fb; /**< GL FBO name */ int width; /**< width in pixels */ int height; /**< height in pixels */ GLenum format; /**< GL format used to create the texture. */ GLenum type; /**< GL type used to create the texture. */ } glamor_pixmap_fbo; typedef struct glamor_pixmap_clipped_regions { int block_idx; RegionPtr region; } glamor_pixmap_clipped_regions; typedef struct glamor_pixmap_private { glamor_pixmap_type_t type; enum glamor_fbo_state gl_fbo; /** * If devPrivate.ptr is non-NULL (meaning we're within * glamor_prepare_access), determies whether we should re-upload * that data on glamor_finish_access(). */ glamor_access_t map_access; glamor_pixmap_fbo *fbo; /** current fbo's coords in the whole pixmap. */ BoxRec box; GLuint pbo; RegionRec prepare_region; Bool prepared; #ifdef GLAMOR_HAS_GBM EGLImageKHR image; Bool used_modifiers; #endif /** block width of this large pixmap. */ int block_w; /** block height of this large pixmap. */ int block_h; /** block_wcnt: block count in one block row. */ int block_wcnt; /** block_hcnt: block count in one block column. */ int block_hcnt; /** * The list of boxes for the bounds of the FBOs making up the * pixmap. * * For a 2048x2048 pixmap with GL FBO size limits of 1024x1024: * * ****************** * * fbo0 * fbo1 * * * * * * ****************** * * fbo2 * fbo3 * * * * * * ****************** * * box[0] = {0,0,1024,1024} * box[1] = {1024,0,2048,2048} * ... */ BoxPtr box_array; /** * Array of fbo structs containing the actual GL texture/fbo * names. */ glamor_pixmap_fbo **fbo_array; } glamor_pixmap_private; extern DevPrivateKeyRec glamor_pixmap_private_key; static inline glamor_pixmap_private * glamor_get_pixmap_private(PixmapPtr pixmap) { if (pixmap == NULL) return NULL; return dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key); } /* * Returns TRUE if pixmap has no image object */ static inline Bool glamor_pixmap_drm_only(PixmapPtr pixmap) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); return priv->type == GLAMOR_DRM_ONLY; } /* * Returns TRUE if pixmap is plain memory (not a GL object at all) */ static inline Bool glamor_pixmap_is_memory(PixmapPtr pixmap) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); return priv->type == GLAMOR_MEMORY; } /* * Returns TRUE if pixmap requires multiple textures to hold it */ static inline Bool glamor_pixmap_priv_is_large(glamor_pixmap_private *priv) { return priv->block_wcnt > 1 || priv->block_hcnt > 1; } static inline Bool glamor_pixmap_priv_is_small(glamor_pixmap_private *priv) { return priv->block_wcnt <= 1 && priv->block_hcnt <= 1; } static inline Bool glamor_pixmap_is_large(PixmapPtr pixmap) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); return glamor_pixmap_priv_is_large(priv); } /* * Returns TRUE if pixmap has an FBO */ static inline Bool glamor_pixmap_has_fbo(PixmapPtr pixmap) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); return priv->gl_fbo == GLAMOR_FBO_NORMAL; } static inline void glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx) { if (glamor_pixmap_priv_is_large(priv)) { priv->fbo = priv->fbo_array[idx]; priv->box = priv->box_array[idx]; } } static inline glamor_pixmap_fbo * glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int box) { assert(box < priv->block_wcnt * priv->block_hcnt); return priv->fbo_array[box]; } static inline BoxPtr glamor_pixmap_box_at(glamor_pixmap_private *priv, int box) { assert(box < priv->block_wcnt * priv->block_hcnt); return &priv->box_array[box]; } static inline int glamor_pixmap_wcnt(glamor_pixmap_private *priv) { return priv->block_wcnt; } static inline int glamor_pixmap_hcnt(glamor_pixmap_private *priv) { return priv->block_hcnt; } #define glamor_pixmap_loop(priv, box_index) \ for (box_index = 0; box_index < glamor_pixmap_hcnt(priv) * \ glamor_pixmap_wcnt(priv); box_index++) \ /* GC private structure. Currently holds only any computed dash pixmap */ typedef struct { PixmapPtr dash; PixmapPtr stipple; DamagePtr stipple_damage; } glamor_gc_private; extern DevPrivateKeyRec glamor_gc_private_key; extern DevPrivateKeyRec glamor_screen_private_key; extern glamor_screen_private * glamor_get_screen_private(ScreenPtr screen); extern void glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv); static inline glamor_gc_private * glamor_get_gc_private(GCPtr gc) { return dixLookupPrivate(&gc->devPrivates, &glamor_gc_private_key); } /** * Returns TRUE if the given planemask covers all the significant bits in the * pixel values for pDrawable. */ static inline Bool glamor_pm_is_solid(int depth, unsigned long planemask) { return (planemask & FbFullMask(depth)) == FbFullMask(depth); } extern int glamor_debug_level; /* glamor.c */ PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable); glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private * pixmap_priv); void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo); glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private * glamor_priv, int w, int h, GLenum format, GLint tex, int flag); glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w, int h, GLenum format, int flag); void glamor_destroy_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo); void glamor_pixmap_destroy_fbo(PixmapPtr pixmap); Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap); void glamor_pixmap_clear_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo); /* Return whether 'picture' is alpha-only */ static inline Bool glamor_picture_is_alpha(PicturePtr picture) { return picture->format == PICT_a1 || picture->format == PICT_a8; } /* Return whether 'fbo' is storing alpha bits in the red channel */ static inline Bool glamor_fbo_red_is_alpha(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) { /* True when the format is GL_RED (that can only happen when our one channel format is GL_RED */ return fbo->format == GL_RED; } /* Return whether 'picture' is storing alpha bits in the red channel */ static inline Bool glamor_picture_red_is_alpha(PicturePtr picture) { /* True when the picture is alpha only and the screen is using GL_RED for alpha pictures */ return glamor_picture_is_alpha(picture) && glamor_get_screen_private(picture->pDrawable->pScreen)->one_channel_format == GL_RED; } void glamor_bind_texture(glamor_screen_private *glamor_priv, GLenum texture, glamor_pixmap_fbo *fbo, Bool destination_red); glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv, int w, int h, GLenum format, int flag, int block_w, int block_h, glamor_pixmap_private *); void glamor_gldrawarrays_quads_using_indices(glamor_screen_private *glamor_priv, unsigned count); /* glamor_core.c */ Bool glamor_get_drawable_location(const DrawablePtr drawable); void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, int *x, int *y); GLint glamor_compile_glsl_prog(GLenum type, const char *source); void glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4); void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, unsigned long fg_pixel, GLfloat *color); int glamor_set_destination_pixmap(PixmapPtr pixmap); int glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv); void glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *, int, int, int, int); /* nc means no check. caller must ensure this pixmap has valid fbo. * usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly. * */ void glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv); Bool glamor_set_alu(ScreenPtr screen, unsigned char alu); Bool glamor_set_planemask(int depth, unsigned long planemask); RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap); void glamor_track_stipple(GCPtr gc); /* glamor_render.c */ Bool glamor_composite_clipped_region(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, PixmapPtr source_pixmap, PixmapPtr mask_pixmap, PixmapPtr dest_pixmap, RegionPtr region, int x_source, int y_source, int x_mask, int y_mask, int x_dest, int y_dest); void glamor_composite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void glamor_composite_rects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); /* glamor_trapezoid.c */ void glamor_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst, PictFormatPtr mask_format, INT16 x_src, INT16 y_src, int ntrap, xTrapezoid *traps); /* glamor_gradient.c */ void glamor_init_gradient_shader(ScreenPtr screen); PicturePtr glamor_generate_linear_gradient_picture(ScreenPtr screen, PicturePtr src_picture, int x_source, int y_source, int width, int height, PictFormatShort format); PicturePtr glamor_generate_radial_gradient_picture(ScreenPtr screen, PicturePtr src_picture, int x_source, int y_source, int width, int height, PictFormatShort format); /* glamor_triangles.c */ void glamor_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris); /* glamor_pixmap.c */ void glamor_pixmap_init(ScreenPtr screen); void glamor_pixmap_fini(ScreenPtr screen); /* glamor_vbo.c */ void glamor_init_vbo(ScreenPtr screen); void glamor_fini_vbo(ScreenPtr screen); void * glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset); void glamor_put_vbo_space(ScreenPtr screen); /** * According to the flag, * if the flag is GLAMOR_CREATE_FBO_NO_FBO then just ensure * the fbo has a valid texture. Otherwise, it will ensure * the fbo has valid texture and attach to a valid fb. * If the fbo already has a valid glfbo then do nothing. */ Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag); glamor_pixmap_clipped_regions * glamor_compute_clipped_regions(PixmapPtr pixmap, RegionPtr region, int *clipped_nbox, int repeat_type, int reverse, int upsidedown); glamor_pixmap_clipped_regions * glamor_compute_clipped_regions_ext(PixmapPtr pixmap, RegionPtr region, int *n_region, int inner_block_w, int inner_block_h, int reverse, int upsidedown); Bool glamor_composite_largepixmap_region(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, PixmapPtr source_pixmap, PixmapPtr mask_pixmap, PixmapPtr dest_pixmap, RegionPtr region, Bool force_clip, INT16 x_source, INT16 y_source, INT16 x_mask, INT16 y_mask, INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height); /** * Upload a picture to gl texture. Similar to the * glamor_upload_pixmap_to_texture. Used in rendering. **/ Bool glamor_upload_picture_to_texture(PicturePtr picture); void glamor_add_traps(PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntrap, xTrap *traps); /* glamor_text.c */ int glamor_poly_text8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); int glamor_poly_text16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); void glamor_image_text8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); void glamor_image_text16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); /* glamor_spans.c */ void glamor_fill_spans(DrawablePtr drawable, GCPtr gc, int n, DDXPointPtr points, int *widths, int sorted); void glamor_get_spans(DrawablePtr drawable, int wmax, DDXPointPtr points, int *widths, int count, char *dst); void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, DDXPointPtr points, int *widths, int numPoints, int sorted); /* glamor_rects.c */ void glamor_poly_fill_rect(DrawablePtr drawable, GCPtr gc, int nrect, xRectangle *prect); /* glamor_image.c */ void glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits); void glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); /* glamor_dash.c */ Bool glamor_poly_lines_dash_gl(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points); Bool glamor_poly_segment_dash_gl(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs); /* glamor_lines.c */ void glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr points); /* glamor_segs.c */ void glamor_poly_segment(DrawablePtr drawable, GCPtr gc, int nseg, xSegment *segs); /* glamor_copy.c */ void glamor_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, BoxPtr box, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); RegionPtr glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc, int srcx, int srcy, int width, int height, int dstx, int dsty); RegionPtr glamor_copy_plane(DrawablePtr src, DrawablePtr dst, GCPtr gc, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitplane); /* glamor_glyphblt.c */ void glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase); void glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase); void glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int w, int h, int x, int y); void glamor_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); void glamor_composite_rectangles(CARD8 op, PicturePtr dst, xRenderColor *color, int num_rects, xRectangle *rects); /* glamor_composite_glyphs.c */ Bool glamor_composite_glyphs_init(ScreenPtr pScreen); void glamor_composite_glyphs_fini(ScreenPtr pScreen); void glamor_composite_glyphs(CARD8 op, PicturePtr src, PicturePtr dst, PictFormatPtr mask_format, INT16 x_src, INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs); /* glamor_sync.c */ Bool glamor_sync_init(ScreenPtr screen); void glamor_sync_close(ScreenPtr screen); /* glamor_util.c */ void glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, unsigned long fg_pixel); void glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, unsigned long fg_pixel); /* glamor_xv */ typedef struct { uint32_t transform_index; uint32_t gamma; /* gamma value x 1000 */ int brightness; int saturation; int hue; int contrast; DrawablePtr pDraw; PixmapPtr pPixmap; uint32_t src_pitch; uint8_t *src_addr; int src_w, src_h, dst_w, dst_h; int src_x, src_y, drw_x, drw_y; int w, h; RegionRec clip; PixmapPtr src_pix[3]; /* y, u, v for planar */ int src_pix_w, src_pix_h; } glamor_port_private; extern XvAttributeRec glamor_xv_attributes[]; extern int glamor_xv_num_attributes; extern XvImageRec glamor_xv_images[]; extern int glamor_xv_num_images; void glamor_xv_init_port(glamor_port_private *port_priv); void glamor_xv_stop_video(glamor_port_private *port_priv); int glamor_xv_set_port_attribute(glamor_port_private *port_priv, Atom attribute, INT32 value); int glamor_xv_get_port_attribute(glamor_port_private *port_priv, Atom attribute, INT32 *value); int glamor_xv_query_image_attributes(int id, unsigned short *w, unsigned short *h, int *pitches, int *offsets); int glamor_xv_put_image(glamor_port_private *port_priv, DrawablePtr pDrawable, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int id, unsigned char *buf, short width, short height, Bool sync, RegionPtr clipBoxes); void glamor_xv_core_init(ScreenPtr screen); void glamor_xv_render(glamor_port_private *port_priv); #include "glamor_utils.h" #if 0 #define MAX_FBO_SIZE 32 /* For test purpose only. */ #endif #include "glamor_font.h" #define GLAMOR_MIN_ALU_INSTRUCTIONS 128 /* Minimum required number of native ALU instructions */ #endif /* GLAMOR_PRIV_H */ xorg-server-1.20.8/glamor/glamor_prepare.h0000644000175000017500000000354413640201473015445 00000000000000/* * Copyright © 2014 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 _GLAMOR_PREPARE_H_ #define _GLAMOR_PREPARE_H_ Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access); Bool glamor_prepare_access_box(DrawablePtr drawable, glamor_access_t access, int x, int y, int w, int h); void glamor_finish_access(DrawablePtr drawable); Bool glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access); Bool glamor_prepare_access_picture_box(PicturePtr picture, glamor_access_t access, int x, int y, int w, int h); void glamor_finish_access_picture(PicturePtr picture); Bool glamor_prepare_access_gc(GCPtr gc); void glamor_finish_access_gc(GCPtr gc); #endif /* _GLAMOR_PREPARE_H_ */ xorg-server-1.20.8/glamor/glamor_glx.c0000644000175000017500000000444613640201473014576 00000000000000/* * Copyright © 2013 Intel Corporation * * 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. */ #include #include "glamor_context.h" /** * @file glamor_glx.c * * GLX context management for glamor. * * This has to be kept separate from the server sources because of * Xlib's conflicting definition of CARD32 and similar typedefs. */ static void glamor_glx_make_current(struct glamor_context *glamor_ctx) { /* There's only a single global dispatch table in Mesa. EGL, GLX, * and AIGLX's direct dispatch table manipulation don't talk to * each other. We need to set the context to NULL first to avoid * GLX's no-op context change fast path when switching back to * GLX. */ glXMakeCurrent(glamor_ctx->display, None, None); glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid, glamor_ctx->ctx); } Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx) { glamor_ctx->ctx = glXGetCurrentContext(); if (!glamor_ctx->ctx) return False; glamor_ctx->display = glXGetCurrentDisplay(); if (!glamor_ctx->display) return False; glamor_ctx->drawable_xid = glXGetCurrentDrawable(); glamor_ctx->make_current = glamor_glx_make_current; return True; } xorg-server-1.20.8/glamor/glamor_font.h0000644000175000017500000000330613640201473014751 00000000000000/* * Copyright © 2014 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 _GLAMOR_FONT_H_ #define _GLAMOR_FONT_H_ typedef struct { Bool realized; CharInfoPtr default_char; CARD8 default_row; CARD8 default_col; GLuint texture_id; GLuint row_width; CARD16 glyph_width_bytes; CARD16 glyph_width_pixels; CARD16 glyph_height; } glamor_font_t; glamor_font_t * glamor_font_get(ScreenPtr screen, FontPtr font); Bool glamor_font_init(ScreenPtr screen); void glamor_fini_glyph_shader(ScreenPtr screen); #endif /* _GLAMOR_FONT_H_ */ xorg-server-1.20.8/glamor/glamor_glyphblt.c0000644000175000017500000002050613640201473015624 00000000000000/* * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. * * Authors: * Zhigang Gong * */ #include "glamor_priv.h" #include #include "glamor_transform.h" static const glamor_facet glamor_facet_poly_glyph_blt = { .name = "poly_glyph_blt", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (" vec2 pos = vec2(0,0);\n" GLAMOR_POS(gl_Position, primitive)), }; static Bool glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc, int start_x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyph_base) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; glamor_program *prog; RegionPtr clip = gc->pCompositeClip; int box_index; Bool ret = FALSE; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_make_current(glamor_priv); prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs, &glamor_facet_poly_glyph_blt); if (!prog) goto bail; glEnableVertexAttribArray(GLAMOR_VERTEX_POS); start_x += drawable->x; y += drawable->y; glamor_pixmap_loop(pixmap_priv, box_index) { int x; int n; int num_points, max_points; INT16 *points = NULL; int off_x, off_y; char *vbo_offset; if (!glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE, prog->matrix_uniform, &off_x, &off_y)) goto bail; max_points = 500; num_points = 0; x = start_x; for (n = 0; n < nglyph; n++) { CharInfoPtr charinfo = ppci[n]; int w = GLYPHWIDTHPIXELS(charinfo); int h = GLYPHHEIGHTPIXELS(charinfo); uint8_t *glyphbits = FONTGLYPHBITS(NULL, charinfo); if (w && h) { int glyph_x = x + charinfo->metrics.leftSideBearing; int glyph_y = y - charinfo->metrics.ascent; int glyph_stride = GLYPHWIDTHBYTESPADDED(charinfo); int xx, yy; for (yy = 0; yy < h; yy++) { uint8_t *glyph = glyphbits; for (xx = 0; xx < w; glyph += ((xx&7) == 7), xx++) { int pt_x_i = glyph_x + xx; int pt_y_i = glyph_y + yy; if (!(*glyph & (1 << (xx & 7)))) continue; if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL)) continue; if (!num_points) { points = glamor_get_vbo_space(screen, max_points * (2 * sizeof (INT16)), &vbo_offset); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 0, vbo_offset); } *points++ = pt_x_i; *points++ = pt_y_i; num_points++; if (num_points == max_points) { glamor_put_vbo_space(screen); glDrawArrays(GL_POINTS, 0, num_points); num_points = 0; } } glyphbits += glyph_stride; } } x += charinfo->metrics.characterWidth; } if (num_points) { glamor_put_vbo_space(screen); glDrawArrays(GL_POINTS, 0, num_points); } } ret = TRUE; bail: glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } void glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc, int start_x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyph_base) { if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base)) return; miPolyGlyphBlt(drawable, gc, start_x, y, nglyph, ppci, pglyph_base); } static Bool glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap, DrawablePtr drawable, int w, int h, int x, int y) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; uint8_t *bitmap_data = bitmap->devPrivate.ptr; int bitmap_stride = bitmap->devKind; glamor_program *prog; RegionPtr clip = gc->pCompositeClip; int box_index; int yy, xx; int num_points; INT16 *points = NULL; char *vbo_offset; Bool ret = FALSE; if (w * h > MAXINT / (2 * sizeof(float))) goto bail; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_make_current(glamor_priv); prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs, &glamor_facet_poly_glyph_blt); if (!prog) goto bail; glEnableVertexAttribArray(GLAMOR_VERTEX_POS); points = glamor_get_vbo_space(screen, w * h * sizeof(INT16) * 2, &vbo_offset); num_points = 0; /* Note that because fb sets miTranslate in the GC, our incoming X * and Y are in screen coordinate space (same for spans, but not * other operations). */ for (yy = 0; yy < h; yy++) { uint8_t *bitmap_row = bitmap_data + yy * bitmap_stride; for (xx = 0; xx < w; xx++) { if (bitmap_row[xx / 8] & (1 << xx % 8) && RegionContainsPoint(clip, x + xx, y + yy, NULL)) { *points++ = x + xx; *points++ = y + yy; num_points++; } } } glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 0, vbo_offset); glamor_put_vbo_space(screen); glamor_pixmap_loop(pixmap_priv, box_index) { if (!glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE, prog->matrix_uniform, NULL, NULL)) goto bail; glDrawArrays(GL_POINTS, 0, num_points); } ret = TRUE; bail: glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } void glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int w, int h, int x, int y) { if (glamor_push_pixels_gl(pGC, pBitmap, pDrawable, w, h, x, y)) return; miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y); } xorg-server-1.20.8/glamor/glamor_picture.c0000644000175000017500000002724113640201473015455 00000000000000/* * Copyright © 2016 Broadcom * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. */ /** * @file glamor_picture.c * * Implements temporary uploads of GL_MEMORY Pixmaps to a texture that * is swizzled appropriately for a given Render picture format. * laid * * * This is important because GTK likes to use SHM Pixmaps for Render * blending operations, and we don't want a blend operation to fall * back to software (readback is more expensive than the upload we do * here, and you'd have to re-upload the fallback output anyway). */ #include #include "glamor_priv.h" #include "mipict.h" static void byte_swap_swizzle(GLenum *swizzle) { GLenum temp; temp = swizzle[0]; swizzle[0] = swizzle[3]; swizzle[3] = temp; temp = swizzle[1]; swizzle[1] = swizzle[2]; swizzle[2] = temp; } /** * Returns the GL format and type for uploading our bits to a given PictFormat. * * We may need to tell the caller to translate the bits to another * format, as in PICT_a1 (which GL doesn't support). We may also need * to tell the GL to swizzle the texture on sampling, because GLES3 * doesn't support the GL_UNSIGNED_INT_8_8_8_8{,_REV} types, so we * don't have enough channel reordering options at upload time without * it. */ static Bool glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, PictFormatShort format, PictFormatShort *temp_format, GLenum *tex_format, GLenum *tex_type, GLenum *swizzle) { glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen); Bool is_little_endian = IMAGE_BYTE_ORDER == LSBFirst; *temp_format = format; swizzle[0] = GL_RED; swizzle[1] = GL_GREEN; swizzle[2] = GL_BLUE; swizzle[3] = GL_ALPHA; switch (format) { case PICT_a1: *tex_format = glamor_priv->one_channel_format; *tex_type = GL_UNSIGNED_BYTE; *temp_format = PICT_a8; break; case PICT_b8g8r8x8: case PICT_b8g8r8a8: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_BGRA; *tex_type = GL_UNSIGNED_INT_8_8_8_8; } else { *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_BYTE; swizzle[0] = GL_GREEN; swizzle[1] = GL_BLUE; swizzle[2] = GL_ALPHA; swizzle[3] = GL_RED; if (!is_little_endian) byte_swap_swizzle(swizzle); } break; case PICT_x8r8g8b8: case PICT_a8r8g8b8: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_BGRA; *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; } else { *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_BYTE; swizzle[0] = GL_BLUE; swizzle[2] = GL_RED; if (!is_little_endian) byte_swap_swizzle(swizzle); break; } break; case PICT_x8b8g8r8: case PICT_a8b8g8r8: *tex_format = GL_RGBA; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; } else { *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_BYTE; if (!is_little_endian) byte_swap_swizzle(swizzle); } break; case PICT_x2r10g10b10: case PICT_a2r10g10b10: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_BGRA; *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; } else { return FALSE; } break; case PICT_x2b10g10r10: case PICT_a2b10g10r10: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; } else { return FALSE; } break; case PICT_r5g6b5: *tex_format = GL_RGB; *tex_type = GL_UNSIGNED_SHORT_5_6_5; break; case PICT_b5g6r5: *tex_format = GL_RGB; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV; } else { *tex_type = GL_UNSIGNED_SHORT_5_6_5; swizzle[0] = GL_BLUE; swizzle[2] = GL_RED; } break; case PICT_x1b5g5r5: case PICT_a1b5g5r5: *tex_format = GL_RGBA; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; } else { return FALSE; } break; case PICT_x1r5g5b5: case PICT_a1r5g5b5: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_BGRA; *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; } else { return FALSE; } break; case PICT_a8: *tex_format = glamor_priv->one_channel_format; *tex_type = GL_UNSIGNED_BYTE; break; case PICT_x4r4g4b4: case PICT_a4r4g4b4: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_BGRA; *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; } else { /* XXX */ *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; } break; case PICT_x4b4g4r4: case PICT_a4b4g4r4: if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; } else { /* XXX */ *tex_format = GL_RGBA; *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; } break; default: return FALSE; } if (!PICT_FORMAT_A(format)) swizzle[3] = GL_ONE; return TRUE; } /** * Takes a set of source bits with a given format and returns an * in-memory pixman image of those bits in a destination format. */ static pixman_image_t * glamor_get_converted_image(PictFormatShort dst_format, PictFormatShort src_format, void *src_bits, int src_stride, int w, int h) { pixman_image_t *dst_image; pixman_image_t *src_image; dst_image = pixman_image_create_bits(dst_format, w, h, NULL, 0); if (dst_image == NULL) { return NULL; } src_image = pixman_image_create_bits(src_format, w, h, src_bits, src_stride); if (src_image == NULL) { pixman_image_unref(dst_image); return NULL; } pixman_image_composite(PictOpSrc, src_image, NULL, dst_image, 0, 0, 0, 0, 0, 0, w, h); pixman_image_unref(src_image); return dst_image; } /** * Uploads a picture based on a GLAMOR_MEMORY pixmap to a texture in a * temporary FBO. */ Bool glamor_upload_picture_to_texture(PicturePtr picture) { PixmapPtr pixmap = glamor_get_drawable_pixmap(picture->pDrawable); ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); PictFormatShort converted_format; void *bits = pixmap->devPrivate.ptr; int stride = pixmap->devKind; GLenum format, type; GLenum swizzle[4]; GLenum iformat; Bool ret = TRUE; Bool needs_swizzle; pixman_image_t *converted_image = NULL; assert(glamor_pixmap_is_memory(pixmap)); assert(!pixmap_priv->fbo); glamor_make_current(glamor_priv); /* No handling of large pixmap pictures here (would need to make * an FBO array and split the uploads across it). */ if (!glamor_check_fbo_size(glamor_priv, pixmap->drawable.width, pixmap->drawable.height)) { return FALSE; } if (!glamor_get_tex_format_type_from_pictformat(screen, picture->format, &converted_format, &format, &type, swizzle)) { glamor_fallback("Unknown pixmap depth %d.\n", pixmap->drawable.depth); return FALSE; } needs_swizzle = (swizzle[0] != GL_RED || swizzle[1] != GL_GREEN || swizzle[2] != GL_BLUE || swizzle[3] != GL_ALPHA); if (!glamor_priv->has_texture_swizzle && needs_swizzle) { glamor_fallback("Couldn't upload temporary picture due to missing " "GL_ARB_texture_swizzle.\n"); return FALSE; } if (converted_format != picture->format) { converted_image = glamor_get_converted_image(converted_format, picture->format, bits, stride, pixmap->drawable.width, pixmap->drawable.height); if (!converted_image) return FALSE; bits = pixman_image_get_data(converted_image); stride = pixman_image_get_stride(converted_image); } if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) iformat = gl_iformat_for_pixmap(pixmap); else iformat = format; if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) { ret = FALSE; goto fail; } glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glamor_priv->suppress_gl_out_of_memory_logging = true; /* We can't use glamor_pixmap_loop() because GLAMOR_MEMORY pixmaps * don't have initialized boxes. */ glBindTexture(GL_TEXTURE_2D, pixmap_priv->fbo->tex); glTexImage2D(GL_TEXTURE_2D, 0, iformat, pixmap->drawable.width, pixmap->drawable.height, 0, format, type, bits); if (needs_swizzle) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, swizzle[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, swizzle[1]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, swizzle[2]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, swizzle[3]); } glamor_priv->suppress_gl_out_of_memory_logging = false; if (glGetError() == GL_OUT_OF_MEMORY) { ret = FALSE; } fail: if (converted_image) pixman_image_unref(converted_image); return ret; } xorg-server-1.20.8/glamor/glamor_gradient.c0000644000175000017500000015511013640201473015574 00000000000000/* * Copyright © 2009 Intel Corporation * * 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. * * Authors: * Junyan He * */ /** @file glamor_gradient.c * * Gradient acceleration implementation */ #include "glamor_priv.h" #define LINEAR_SMALL_STOPS (6 + 2) #define LINEAR_LARGE_STOPS (16 + 2) #define RADIAL_SMALL_STOPS (6 + 2) #define RADIAL_LARGE_STOPS (16 + 2) static char * _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count, int use_array) { char *gradient_fs = NULL; #define gradient_fs_getcolor\ GLAMOR_DEFAULT_PRECISION\ "uniform int n_stop;\n"\ "uniform float stops[%d];\n"\ "uniform vec4 stop_colors[%d];\n"\ "vec4 get_color(float stop_len)\n"\ "{\n"\ " int i = 0;\n"\ " vec4 stop_color_before;\n"\ " vec4 gradient_color;\n"\ " float stop_delta;\n"\ " float percentage; \n"\ " \n"\ " if(stop_len < stops[0])\n"\ " return vec4(0.0, 0.0, 0.0, 0.0); \n"\ " for(i = 1; i < n_stop; i++) {\n"\ " if(stop_len < stops[i])\n"\ " break; \n"\ " }\n"\ " if(i == n_stop)\n"\ " return vec4(0.0, 0.0, 0.0, 0.0); \n"\ " \n"\ " stop_color_before = stop_colors[i-1];\n"\ " stop_delta = stops[i] - stops[i-1];\n"\ " if(stop_delta > 2.0)\n"\ " percentage = 0.0;\n" /*For comply with pixman, walker->stepper overflow.*/\ " else if(stop_delta < 0.000001)\n"\ " percentage = 0.0;\n"\ " else \n"\ " percentage = (stop_len - stops[i-1])/stop_delta;\n"\ " \n"\ " gradient_color = stop_color_before;\n"\ " if(percentage != 0.0)\n"\ " gradient_color += (stop_colors[i] - gradient_color)*percentage;\n"\ " return vec4(gradient_color.rgb * gradient_color.a, gradient_color.a);\n"\ "}\n" /* Because the array access for shader is very slow, the performance is very low if use array. So use global uniform to replace for it if the number of n_stops is small. */ const char *gradient_fs_getcolor_no_array = GLAMOR_DEFAULT_PRECISION "uniform int n_stop;\n" "uniform float stop0;\n" "uniform float stop1;\n" "uniform float stop2;\n" "uniform float stop3;\n" "uniform float stop4;\n" "uniform float stop5;\n" "uniform float stop6;\n" "uniform float stop7;\n" "uniform vec4 stop_color0;\n" "uniform vec4 stop_color1;\n" "uniform vec4 stop_color2;\n" "uniform vec4 stop_color3;\n" "uniform vec4 stop_color4;\n" "uniform vec4 stop_color5;\n" "uniform vec4 stop_color6;\n" "uniform vec4 stop_color7;\n" "\n" "vec4 get_color(float stop_len)\n" "{\n" " vec4 stop_color_before;\n" " vec4 stop_color_after;\n" " vec4 gradient_color;\n" " float stop_before;\n" " float stop_delta;\n" " float percentage; \n" " \n" " if((stop_len < stop0) && (n_stop >= 1)) {\n" " stop_color_before = vec4(0.0, 0.0, 0.0, 0.0);\n" " stop_delta = 0.0;\n" " } else if((stop_len < stop1) && (n_stop >= 2)) {\n" " stop_color_before = stop_color0;\n" " stop_color_after = stop_color1;\n" " stop_before = stop0;\n" " stop_delta = stop1 - stop0;\n" " } else if((stop_len < stop2) && (n_stop >= 3)) {\n" " stop_color_before = stop_color1;\n" " stop_color_after = stop_color2;\n" " stop_before = stop1;\n" " stop_delta = stop2 - stop1;\n" " } else if((stop_len < stop3) && (n_stop >= 4)){\n" " stop_color_before = stop_color2;\n" " stop_color_after = stop_color3;\n" " stop_before = stop2;\n" " stop_delta = stop3 - stop2;\n" " } else if((stop_len < stop4) && (n_stop >= 5)){\n" " stop_color_before = stop_color3;\n" " stop_color_after = stop_color4;\n" " stop_before = stop3;\n" " stop_delta = stop4 - stop3;\n" " } else if((stop_len < stop5) && (n_stop >= 6)){\n" " stop_color_before = stop_color4;\n" " stop_color_after = stop_color5;\n" " stop_before = stop4;\n" " stop_delta = stop5 - stop4;\n" " } else if((stop_len < stop6) && (n_stop >= 7)){\n" " stop_color_before = stop_color5;\n" " stop_color_after = stop_color6;\n" " stop_before = stop5;\n" " stop_delta = stop6 - stop5;\n" " } else if((stop_len < stop7) && (n_stop >= 8)){\n" " stop_color_before = stop_color6;\n" " stop_color_after = stop_color7;\n" " stop_before = stop6;\n" " stop_delta = stop7 - stop6;\n" " } else {\n" " stop_color_before = vec4(0.0, 0.0, 0.0, 0.0);\n" " stop_delta = 0.0;\n" " }\n" " if(stop_delta > 2.0)\n" " percentage = 0.0;\n" //For comply with pixman, walker->stepper overflow. " else if(stop_delta < 0.000001)\n" " percentage = 0.0;\n" " else\n" " percentage = (stop_len - stop_before)/stop_delta;\n" " \n" " gradient_color = stop_color_before;\n" " if(percentage != 0.0)\n" " gradient_color += (stop_color_after - gradient_color)*percentage;\n" " return vec4(gradient_color.rgb * gradient_color.a, gradient_color.a);\n" "}\n"; if (use_array) { XNFasprintf(&gradient_fs, gradient_fs_getcolor, stops_count, stops_count); return gradient_fs; } else { return XNFstrdup(gradient_fs_getcolor_no_array); } } static void _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, int dyn_gen) { glamor_screen_private *glamor_priv; int index; GLint gradient_prog = 0; char *gradient_fs = NULL; GLint fs_prog, vs_prog; const char *gradient_vs = GLAMOR_DEFAULT_PRECISION "attribute vec4 v_position;\n" "attribute vec4 v_texcoord;\n" "varying vec2 source_texture;\n" "\n" "void main()\n" "{\n" " gl_Position = v_position;\n" " source_texture = v_texcoord.xy;\n" "}\n"; /* * Refer to pixman radial gradient. * * The problem is given the two circles of c1 and c2 with the radius of r1 and * r1, we need to caculate the t, which is used to do interpolate with stops, * using the fomula: * length((1-t)*c1 + t*c2 - p) = (1-t)*r1 + t*r2 * expand the fomula with xy coond, get the following: * sqrt(sqr((1-t)*c1.x + t*c2.x - p.x) + sqr((1-t)*c1.y + t*c2.y - p.y)) * = (1-t)r1 + t*r2 * <====> At*t- 2Bt + C = 0 * where A = sqr(c2.x - c1.x) + sqr(c2.y - c1.y) - sqr(r2 -r1) * B = (p.x - c1.x)*(c2.x - c1.x) + (p.y - c1.y)*(c2.y - c1.y) + r1*(r2 -r1) * C = sqr(p.x - c1.x) + sqr(p.y - c1.y) - r1*r1 * * solve the fomula and we get the result of * t = (B + sqrt(B*B - A*C)) / A or * t = (B - sqrt(B*B - A*C)) / A (quadratic equation have two solutions) * * The solution we are going to prefer is the bigger one, unless the * radius associated to it is negative (or it falls outside the valid t range) */ #define gradient_radial_fs_template\ GLAMOR_DEFAULT_PRECISION\ "uniform mat3 transform_mat;\n"\ "uniform int repeat_type;\n"\ "uniform float A_value;\n"\ "uniform vec2 c1;\n"\ "uniform float r1;\n"\ "uniform vec2 c2;\n"\ "uniform float r2;\n"\ "varying vec2 source_texture;\n"\ "\n"\ "vec4 get_color(float stop_len);\n"\ "\n"\ "int t_invalid;\n"\ "\n"\ "float get_stop_len()\n"\ "{\n"\ " float t = 0.0;\n"\ " float sqrt_value;\n"\ " t_invalid = 0;\n"\ " \n"\ " vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\ " vec3 source_texture_trans = transform_mat * tmp;\n"\ " source_texture_trans.xy = source_texture_trans.xy/source_texture_trans.z;\n"\ " float B_value = (source_texture_trans.x - c1.x) * (c2.x - c1.x)\n"\ " + (source_texture_trans.y - c1.y) * (c2.y - c1.y)\n"\ " + r1 * (r2 - r1);\n"\ " float C_value = (source_texture_trans.x - c1.x) * (source_texture_trans.x - c1.x)\n"\ " + (source_texture_trans.y - c1.y) * (source_texture_trans.y - c1.y)\n"\ " - r1*r1;\n"\ " if(abs(A_value) < 0.00001) {\n"\ " if(B_value == 0.0) {\n"\ " t_invalid = 1;\n"\ " return t;\n"\ " }\n"\ " t = 0.5 * C_value / B_value;"\ " } else {\n"\ " sqrt_value = B_value * B_value - A_value * C_value;\n"\ " if(sqrt_value < 0.0) {\n"\ " t_invalid = 1;\n"\ " return t;\n"\ " }\n"\ " sqrt_value = sqrt(sqrt_value);\n"\ " t = (B_value + sqrt_value) / A_value;\n"\ " }\n"\ " if(repeat_type == %d) {\n" /* RepeatNone case. */\ " if((t <= 0.0) || (t > 1.0))\n"\ /* try another if first one invalid*/\ " t = (B_value - sqrt_value) / A_value;\n"\ " \n"\ " if((t <= 0.0) || (t > 1.0)) {\n" /*still invalid, return.*/\ " t_invalid = 1;\n"\ " return t;\n"\ " }\n"\ " } else {\n"\ " if(t * (r2 - r1) <= -1.0 * r1)\n"\ /* try another if first one invalid*/\ " t = (B_value - sqrt_value) / A_value;\n"\ " \n"\ " if(t * (r2 -r1) <= -1.0 * r1) {\n" /*still invalid, return.*/\ " t_invalid = 1;\n"\ " return t;\n"\ " }\n"\ " }\n"\ " \n"\ " if(repeat_type == %d){\n" /* repeat normal*/\ " t = fract(t);\n"\ " }\n"\ " \n"\ " if(repeat_type == %d) {\n" /* repeat reflect*/\ " t = abs(fract(t * 0.5 + 0.5) * 2.0 - 1.0);\n"\ " }\n"\ " \n"\ " return t;\n"\ "}\n"\ "\n"\ "void main()\n"\ "{\n"\ " float stop_len = get_stop_len();\n"\ " if(t_invalid == 1) {\n"\ " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"\ " } else {\n"\ " gl_FragColor = get_color(stop_len);\n"\ " }\n"\ "}\n"\ "\n"\ "%s\n" /* fs_getcolor_source */ char *fs_getcolor_source; glamor_priv = glamor_get_screen_private(screen); if ((glamor_priv->radial_max_nstops >= stops_count) && (dyn_gen)) { /* Very Good, not to generate again. */ return; } glamor_make_current(glamor_priv); if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) { glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]); glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2] = 0; } gradient_prog = glCreateProgram(); vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs); fs_getcolor_source = _glamor_create_getcolor_fs_source(screen, stops_count, (stops_count > 0)); XNFasprintf(&gradient_fs, gradient_radial_fs_template, PIXMAN_REPEAT_NONE, PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT, fs_getcolor_source); fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs); free(gradient_fs); free(fs_getcolor_source); glAttachShader(gradient_prog, vs_prog); glAttachShader(gradient_prog, fs_prog); glDeleteShader(vs_prog); glDeleteShader(fs_prog); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); glamor_link_glsl_prog(screen, gradient_prog, "radial gradient"); if (dyn_gen) { index = 2; glamor_priv->radial_max_nstops = stops_count; } else if (stops_count) { index = 1; } else { index = 0; } glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog; } static void _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, int dyn_gen) { glamor_screen_private *glamor_priv; int index = 0; GLint gradient_prog = 0; char *gradient_fs = NULL; GLint fs_prog, vs_prog; const char *gradient_vs = GLAMOR_DEFAULT_PRECISION "attribute vec4 v_position;\n" "attribute vec4 v_texcoord;\n" "varying vec2 source_texture;\n" "\n" "void main()\n" "{\n" " gl_Position = v_position;\n" " source_texture = v_texcoord.xy;\n" "}\n"; /* * | * |\ * | \ * | \ * | \ * |\ \ * | \ \ * cos_val = |\ p1d \ / * sqrt(1/(slope*slope+1.0)) ------>\ \ \ / * | \ \ \ * | \ \ / \ * | \ *Pt1\ * *p1 | \ \ *P * \ | / \ \ / * \ | / \ \ / * \ | pd \ * \ | \ / \ * p2* | \ / \ / * slope = (p2.y - p1.y) / | / p2d / * (p2.x - p1.x) | / \ / * | / \ / * | / / * | / / * | / *Pt2 * | / * | / * | / * | / * | / * -------+--------------------------------- * O| * | * | * * step 1: compute the distance of p, pt1 and pt2 in the slope direction. * Caculate the distance on Y axis first and multiply cos_val to * get the value on slope direction(pd, p1d and p2d represent the * distance of p, pt1, and pt2 respectively). * * step 2: caculate the percentage of (pd - p1d)/(p2d - p1d). * If (pd - p1d) > (p2d - p1d) or < 0, then sub or add (p2d - p1d) * to make it in the range of [0, (p2d - p1d)]. * * step 3: compare the percentage to every stop and find the stpos just * before and after it. Use the interpolation fomula to compute RGBA. */ #define gradient_fs_template \ GLAMOR_DEFAULT_PRECISION\ "uniform mat3 transform_mat;\n"\ "uniform int repeat_type;\n"\ "uniform int hor_ver;\n"\ "uniform float pt_slope;\n"\ "uniform float cos_val;\n"\ "uniform float p1_distance;\n"\ "uniform float pt_distance;\n"\ "varying vec2 source_texture;\n"\ "\n"\ "vec4 get_color(float stop_len);\n"\ "\n"\ "float get_stop_len()\n"\ "{\n"\ " vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\ " float distance;\n"\ " float _p1_distance;\n"\ " float _pt_distance;\n"\ " float y_dist;\n"\ " vec3 source_texture_trans = transform_mat * tmp;\n"\ " \n"\ " if(hor_ver == 0) { \n" /*Normal case.*/\ " y_dist = source_texture_trans.y - source_texture_trans.x*pt_slope;\n"\ " distance = y_dist * cos_val;\n"\ " _p1_distance = p1_distance * source_texture_trans.z;\n"\ " _pt_distance = pt_distance * source_texture_trans.z;\n"\ " \n"\ " } else if (hor_ver == 1) {\n"/*horizontal case.*/\ " distance = source_texture_trans.x;\n"\ " _p1_distance = p1_distance * source_texture_trans.z;\n"\ " _pt_distance = pt_distance * source_texture_trans.z;\n"\ " } \n"\ " \n"\ " distance = (distance - _p1_distance) / _pt_distance;\n"\ " \n"\ " if(repeat_type == %d){\n" /* repeat normal*/\ " distance = fract(distance);\n"\ " }\n"\ " \n"\ " if(repeat_type == %d) {\n" /* repeat reflect*/\ " distance = abs(fract(distance * 0.5 + 0.5) * 2.0 - 1.0);\n"\ " }\n"\ " \n"\ " return distance;\n"\ "}\n"\ "\n"\ "void main()\n"\ "{\n"\ " float stop_len = get_stop_len();\n"\ " gl_FragColor = get_color(stop_len);\n"\ "}\n"\ "\n"\ "%s" /* fs_getcolor_source */ char *fs_getcolor_source; glamor_priv = glamor_get_screen_private(screen); if ((glamor_priv->linear_max_nstops >= stops_count) && (dyn_gen)) { /* Very Good, not to generate again. */ return; } glamor_make_current(glamor_priv); if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]) { glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]); glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2] = 0; } gradient_prog = glCreateProgram(); vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs); fs_getcolor_source = _glamor_create_getcolor_fs_source(screen, stops_count, stops_count > 0); XNFasprintf(&gradient_fs, gradient_fs_template, PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT, fs_getcolor_source); fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs); free(gradient_fs); free(fs_getcolor_source); glAttachShader(gradient_prog, vs_prog); glAttachShader(gradient_prog, fs_prog); glDeleteShader(vs_prog); glDeleteShader(fs_prog); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); glamor_link_glsl_prog(screen, gradient_prog, "linear gradient"); if (dyn_gen) { index = 2; glamor_priv->linear_max_nstops = stops_count; } else if (stops_count) { index = 1; } else { index = 0; } glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog; } void glamor_init_gradient_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; int i; glamor_priv = glamor_get_screen_private(screen); for (i = 0; i < 3; i++) { glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i] = 0; glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i] = 0; } glamor_priv->linear_max_nstops = 0; glamor_priv->radial_max_nstops = 0; _glamor_create_linear_gradient_program(screen, 0, 0); _glamor_create_linear_gradient_program(screen, LINEAR_LARGE_STOPS, 0); _glamor_create_radial_gradient_program(screen, 0, 0); _glamor_create_radial_gradient_program(screen, RADIAL_LARGE_STOPS, 0); } static void _glamor_gradient_convert_trans_matrix(PictTransform *from, float to[3][3], int width, int height, int normalize) { /* * Because in the shader program, we normalize all the pixel cood to [0, 1], * so with the transform matrix, the correct logic should be: * v_s = A*T*v * v_s: point vector in shader after normalized. * A: The transition matrix from width X height --> 1.0 X 1.0 * T: The transform matrix. * v: point vector in width X height space. * * result is OK if we use this fomula. But for every point in width X height space, * we can just use their normalized point vector in shader, namely we can just * use the result of A*v in shader. So we have no chance to insert T in A*v. * We can just convert v_s = A*T*v to v_s = A*T*inv(A)*A*v, where inv(A) is the * inverse matrix of A. Now, v_s = (A*T*inv(A)) * (A*v) * So, to get the correct v_s, we need to cacula1 the matrix: (A*T*inv(A)), and * we name this matrix T_s. * * Firstly, because A is for the scale conversion, we find * -- -- * |1/w 0 0 | * A = | 0 1/h 0 | * | 0 0 1.0| * -- -- * so T_s = A*T*inv(a) and result * * -- -- * | t11 h*t12/w t13/w| * T_s = | w*t21/h t22 t23/h| * | w*t31 h*t32 t33 | * -- -- */ to[0][0] = (float) pixman_fixed_to_double(from->matrix[0][0]); to[0][1] = (float) pixman_fixed_to_double(from->matrix[0][1]) * (normalize ? (((float) height) / ((float) width)) : 1.0); to[0][2] = (float) pixman_fixed_to_double(from->matrix[0][2]) / (normalize ? ((float) width) : 1.0); to[1][0] = (float) pixman_fixed_to_double(from->matrix[1][0]) * (normalize ? (((float) width) / ((float) height)) : 1.0); to[1][1] = (float) pixman_fixed_to_double(from->matrix[1][1]); to[1][2] = (float) pixman_fixed_to_double(from->matrix[1][2]) / (normalize ? ((float) height) : 1.0); to[2][0] = (float) pixman_fixed_to_double(from->matrix[2][0]) * (normalize ? ((float) width) : 1.0); to[2][1] = (float) pixman_fixed_to_double(from->matrix[2][1]) * (normalize ? ((float) height) : 1.0); to[2][2] = (float) pixman_fixed_to_double(from->matrix[2][2]); DEBUGF("the transform matrix is:\n%f\t%f\t%f\n%f\t%f\t%f\n%f\t%f\t%f\n", to[0][0], to[0][1], to[0][2], to[1][0], to[1][1], to[1][2], to[2][0], to[2][1], to[2][2]); } static int _glamor_gradient_set_pixmap_destination(ScreenPtr screen, glamor_screen_private *glamor_priv, PicturePtr dst_picture, GLfloat *xscale, GLfloat *yscale, int x_source, int y_source, int tex_normalize) { glamor_pixmap_private *pixmap_priv; PixmapPtr pixmap = NULL; GLfloat *v; char *vbo_offset; pixmap = glamor_get_drawable_pixmap(dst_picture->pDrawable); pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) { /* should always have here. */ return 0; } glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv); pixmap_priv_get_dest_scale(pixmap, pixmap_priv, xscale, yscale); DEBUGF("xscale = %f, yscale = %f," " x_source = %d, y_source = %d, width = %d, height = %d\n", *xscale, *yscale, x_source, y_source, dst_picture->pDrawable->width, dst_picture->pDrawable->height); v = glamor_get_vbo_space(screen, 16 * sizeof(GLfloat), &vbo_offset); glamor_set_normalize_vcoords_tri_strip(*xscale, *yscale, 0, 0, (INT16) (dst_picture->pDrawable-> width), (INT16) (dst_picture->pDrawable-> height), v); if (tex_normalize) { glamor_set_normalize_tcoords_tri_stripe(*xscale, *yscale, x_source, y_source, (INT16) (dst_picture-> pDrawable->width + x_source), (INT16) (dst_picture-> pDrawable->height + y_source), &v[8]); } else { glamor_set_tcoords_tri_strip(x_source, y_source, (INT16) (dst_picture->pDrawable->width) + x_source, (INT16) (dst_picture->pDrawable->height) + y_source, &v[8]); } DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f," "rightbottom: %f X %f, leftbottom : %f X %f\n", v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f," "rightbottom: %f X %f, leftbottom : %f X %f\n", v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]); glamor_make_current(glamor_priv); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, 0, vbo_offset); glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, 0, vbo_offset + 8 * sizeof(GLfloat)); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glamor_put_vbo_space(screen); return 1; } static int _glamor_gradient_set_stops(PicturePtr src_picture, PictGradient *pgradient, GLfloat *stop_colors, GLfloat *n_stops) { int i; int count = 1; for (i = 0; i < pgradient->nstops; i++) { stop_colors[count * 4] = pixman_fixed_to_double(pgradient->stops[i].color.red); stop_colors[count * 4 + 1] = pixman_fixed_to_double(pgradient->stops[i].color.green); stop_colors[count * 4 + 2] = pixman_fixed_to_double(pgradient->stops[i].color.blue); stop_colors[count * 4 + 3] = pixman_fixed_to_double(pgradient->stops[i].color.alpha); n_stops[count] = (GLfloat) pixman_fixed_to_double(pgradient->stops[i].x); count++; } /* for the end stop. */ count++; switch (src_picture->repeatType) { #define REPEAT_FILL_STOPS(m, n) \ stop_colors[(m)*4 + 0] = stop_colors[(n)*4 + 0]; \ stop_colors[(m)*4 + 1] = stop_colors[(n)*4 + 1]; \ stop_colors[(m)*4 + 2] = stop_colors[(n)*4 + 2]; \ stop_colors[(m)*4 + 3] = stop_colors[(n)*4 + 3]; default: case PIXMAN_REPEAT_NONE: stop_colors[0] = 0.0; //R stop_colors[1] = 0.0; //G stop_colors[2] = 0.0; //B stop_colors[3] = 0.0; //Alpha n_stops[0] = n_stops[1]; stop_colors[0 + (count - 1) * 4] = 0.0; //R stop_colors[1 + (count - 1) * 4] = 0.0; //G stop_colors[2 + (count - 1) * 4] = 0.0; //B stop_colors[3 + (count - 1) * 4] = 0.0; //Alpha n_stops[count - 1] = n_stops[count - 2]; break; case PIXMAN_REPEAT_NORMAL: REPEAT_FILL_STOPS(0, count - 2); n_stops[0] = n_stops[count - 2] - 1.0; REPEAT_FILL_STOPS(count - 1, 1); n_stops[count - 1] = n_stops[1] + 1.0; break; case PIXMAN_REPEAT_REFLECT: REPEAT_FILL_STOPS(0, 1); n_stops[0] = -n_stops[1]; REPEAT_FILL_STOPS(count - 1, count - 2); n_stops[count - 1] = 1.0 + 1.0 - n_stops[count - 2]; break; case PIXMAN_REPEAT_PAD: REPEAT_FILL_STOPS(0, 1); n_stops[0] = -(float) INT_MAX; REPEAT_FILL_STOPS(count - 1, count - 2); n_stops[count - 1] = (float) INT_MAX; break; #undef REPEAT_FILL_STOPS } for (i = 0; i < count; i++) { DEBUGF("n_stops[%d] = %f, color = r:%f g:%f b:%f a:%f\n", i, n_stops[i], stop_colors[i * 4], stop_colors[i * 4 + 1], stop_colors[i * 4 + 2], stop_colors[i * 4 + 3]); } return count; } PicturePtr glamor_generate_radial_gradient_picture(ScreenPtr screen, PicturePtr src_picture, int x_source, int y_source, int width, int height, PictFormatShort format) { glamor_screen_private *glamor_priv; PicturePtr dst_picture = NULL; PixmapPtr pixmap = NULL; GLint gradient_prog = 0; int error; int stops_count = 0; int count = 0; GLfloat *stop_colors = NULL; GLfloat *n_stops = NULL; GLfloat xscale, yscale; float transform_mat[3][3]; static const float identity_mat[3][3] = { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} }; GLfloat stop_colors_st[RADIAL_SMALL_STOPS * 4]; GLfloat n_stops_st[RADIAL_SMALL_STOPS]; GLfloat A_value; GLfloat cxy[4]; float c1x, c1y, c2x, c2y, r1, r2; GLint transform_mat_uniform_location = 0; GLint repeat_type_uniform_location = 0; GLint n_stop_uniform_location = 0; GLint stops_uniform_location = 0; GLint stop_colors_uniform_location = 0; GLint stop0_uniform_location = 0; GLint stop1_uniform_location = 0; GLint stop2_uniform_location = 0; GLint stop3_uniform_location = 0; GLint stop4_uniform_location = 0; GLint stop5_uniform_location = 0; GLint stop6_uniform_location = 0; GLint stop7_uniform_location = 0; GLint stop_color0_uniform_location = 0; GLint stop_color1_uniform_location = 0; GLint stop_color2_uniform_location = 0; GLint stop_color3_uniform_location = 0; GLint stop_color4_uniform_location = 0; GLint stop_color5_uniform_location = 0; GLint stop_color6_uniform_location = 0; GLint stop_color7_uniform_location = 0; GLint A_value_uniform_location = 0; GLint c1_uniform_location = 0; GLint r1_uniform_location = 0; GLint c2_uniform_location = 0; GLint r2_uniform_location = 0; glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); /* Create a pixmap with VBO. */ pixmap = glamor_create_pixmap(screen, width, height, PIXMAN_FORMAT_DEPTH(format), 0); if (!pixmap) goto GRADIENT_FAIL; dst_picture = CreatePicture(0, &pixmap->drawable, PictureMatchFormat(screen, PIXMAN_FORMAT_DEPTH(format), format), 0, 0, serverClient, &error); /* Release the reference, picture will hold the last one. */ glamor_destroy_pixmap(pixmap); if (!dst_picture) goto GRADIENT_FAIL; ValidatePicture(dst_picture); stops_count = src_picture->pSourcePict->radial.nstops + 2; /* Because the max value of nstops is unknown, so create a program when nstops > LINEAR_LARGE_STOPS. */ if (stops_count <= RADIAL_SMALL_STOPS) { gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][0]; } else if (stops_count <= RADIAL_LARGE_STOPS) { gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][1]; } else { _glamor_create_radial_gradient_program(screen, src_picture->pSourcePict->linear. nstops + 2, 1); gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]; } /* Bind all the uniform vars . */ transform_mat_uniform_location = glGetUniformLocation(gradient_prog, "transform_mat"); repeat_type_uniform_location = glGetUniformLocation(gradient_prog, "repeat_type"); n_stop_uniform_location = glGetUniformLocation(gradient_prog, "n_stop"); A_value_uniform_location = glGetUniformLocation(gradient_prog, "A_value"); c1_uniform_location = glGetUniformLocation(gradient_prog, "c1"); r1_uniform_location = glGetUniformLocation(gradient_prog, "r1"); c2_uniform_location = glGetUniformLocation(gradient_prog, "c2"); r2_uniform_location = glGetUniformLocation(gradient_prog, "r2"); if (src_picture->pSourcePict->radial.nstops + 2 <= RADIAL_SMALL_STOPS) { stop0_uniform_location = glGetUniformLocation(gradient_prog, "stop0"); stop1_uniform_location = glGetUniformLocation(gradient_prog, "stop1"); stop2_uniform_location = glGetUniformLocation(gradient_prog, "stop2"); stop3_uniform_location = glGetUniformLocation(gradient_prog, "stop3"); stop4_uniform_location = glGetUniformLocation(gradient_prog, "stop4"); stop5_uniform_location = glGetUniformLocation(gradient_prog, "stop5"); stop6_uniform_location = glGetUniformLocation(gradient_prog, "stop6"); stop7_uniform_location = glGetUniformLocation(gradient_prog, "stop7"); stop_color0_uniform_location = glGetUniformLocation(gradient_prog, "stop_color0"); stop_color1_uniform_location = glGetUniformLocation(gradient_prog, "stop_color1"); stop_color2_uniform_location = glGetUniformLocation(gradient_prog, "stop_color2"); stop_color3_uniform_location = glGetUniformLocation(gradient_prog, "stop_color3"); stop_color4_uniform_location = glGetUniformLocation(gradient_prog, "stop_color4"); stop_color5_uniform_location = glGetUniformLocation(gradient_prog, "stop_color5"); stop_color6_uniform_location = glGetUniformLocation(gradient_prog, "stop_color6"); stop_color7_uniform_location = glGetUniformLocation(gradient_prog, "stop_color7"); } else { stops_uniform_location = glGetUniformLocation(gradient_prog, "stops"); stop_colors_uniform_location = glGetUniformLocation(gradient_prog, "stop_colors"); } glUseProgram(gradient_prog); glUniform1i(repeat_type_uniform_location, src_picture->repeatType); if (src_picture->transform) { _glamor_gradient_convert_trans_matrix(src_picture->transform, transform_mat, width, height, 0); glUniformMatrix3fv(transform_mat_uniform_location, 1, 1, &transform_mat[0][0]); } else { glUniformMatrix3fv(transform_mat_uniform_location, 1, 1, &identity_mat[0][0]); } if (!_glamor_gradient_set_pixmap_destination (screen, glamor_priv, dst_picture, &xscale, &yscale, x_source, y_source, 0)) goto GRADIENT_FAIL; glamor_set_alu(screen, GXcopy); /* Set all the stops and colors to shader. */ if (stops_count > RADIAL_SMALL_STOPS) { stop_colors = xallocarray(stops_count, 4 * sizeof(float)); if (stop_colors == NULL) { ErrorF("Failed to allocate stop_colors memory.\n"); goto GRADIENT_FAIL; } n_stops = xallocarray(stops_count, sizeof(float)); if (n_stops == NULL) { ErrorF("Failed to allocate n_stops memory.\n"); goto GRADIENT_FAIL; } } else { stop_colors = stop_colors_st; n_stops = n_stops_st; } count = _glamor_gradient_set_stops(src_picture, &src_picture->pSourcePict->gradient, stop_colors, n_stops); if (src_picture->pSourcePict->linear.nstops + 2 <= RADIAL_SMALL_STOPS) { int j = 0; glUniform4f(stop_color0_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color1_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color2_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color3_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color4_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color5_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color6_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color7_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j = 0; glUniform1f(stop0_uniform_location, n_stops[j++]); glUniform1f(stop1_uniform_location, n_stops[j++]); glUniform1f(stop2_uniform_location, n_stops[j++]); glUniform1f(stop3_uniform_location, n_stops[j++]); glUniform1f(stop4_uniform_location, n_stops[j++]); glUniform1f(stop5_uniform_location, n_stops[j++]); glUniform1f(stop6_uniform_location, n_stops[j++]); glUniform1f(stop7_uniform_location, n_stops[j++]); glUniform1i(n_stop_uniform_location, count); } else { glUniform4fv(stop_colors_uniform_location, count, stop_colors); glUniform1fv(stops_uniform_location, count, n_stops); glUniform1i(n_stop_uniform_location, count); } c1x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.x); c1y = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.y); c2x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.x); c2y = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.y); r1 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1. radius); r2 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2. radius); glamor_set_circle_centre(width, height, c1x, c1y, cxy); glUniform2fv(c1_uniform_location, 1, cxy); glUniform1f(r1_uniform_location, r1); glamor_set_circle_centre(width, height, c2x, c2y, cxy); glUniform2fv(c2_uniform_location, 1, cxy); glUniform1f(r2_uniform_location, r2); A_value = (c2x - c1x) * (c2x - c1x) + (c2y - c1y) * (c2y - c1y) - (r2 - r1) * (r2 - r1); glUniform1f(A_value_uniform_location, A_value); DEBUGF("C1:(%f, %f) R1:%f\nC2:(%f, %f) R2:%f\nA = %f\n", c1x, c1y, r1, c2x, c2y, r2, A_value); /* Now rendering. */ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); /* Do the clear logic. */ if (stops_count > RADIAL_SMALL_STOPS) { free(n_stops); free(stop_colors); } glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); return dst_picture; GRADIENT_FAIL: if (dst_picture) { FreePicture(dst_picture, 0); } if (stops_count > RADIAL_SMALL_STOPS) { if (n_stops) free(n_stops); if (stop_colors) free(stop_colors); } glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); return NULL; } PicturePtr glamor_generate_linear_gradient_picture(ScreenPtr screen, PicturePtr src_picture, int x_source, int y_source, int width, int height, PictFormatShort format) { glamor_screen_private *glamor_priv; PicturePtr dst_picture = NULL; PixmapPtr pixmap = NULL; GLint gradient_prog = 0; int error; float pt_distance; float p1_distance; GLfloat cos_val; int stops_count = 0; GLfloat *stop_colors = NULL; GLfloat *n_stops = NULL; int count = 0; float slope; GLfloat xscale, yscale; GLfloat pt1[2], pt2[2]; float transform_mat[3][3]; static const float identity_mat[3][3] = { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} }; GLfloat stop_colors_st[LINEAR_SMALL_STOPS * 4]; GLfloat n_stops_st[LINEAR_SMALL_STOPS]; GLint transform_mat_uniform_location = 0; GLint n_stop_uniform_location = 0; GLint stops_uniform_location = 0; GLint stop0_uniform_location = 0; GLint stop1_uniform_location = 0; GLint stop2_uniform_location = 0; GLint stop3_uniform_location = 0; GLint stop4_uniform_location = 0; GLint stop5_uniform_location = 0; GLint stop6_uniform_location = 0; GLint stop7_uniform_location = 0; GLint stop_colors_uniform_location = 0; GLint stop_color0_uniform_location = 0; GLint stop_color1_uniform_location = 0; GLint stop_color2_uniform_location = 0; GLint stop_color3_uniform_location = 0; GLint stop_color4_uniform_location = 0; GLint stop_color5_uniform_location = 0; GLint stop_color6_uniform_location = 0; GLint stop_color7_uniform_location = 0; GLint pt_slope_uniform_location = 0; GLint repeat_type_uniform_location = 0; GLint hor_ver_uniform_location = 0; GLint cos_val_uniform_location = 0; GLint p1_distance_uniform_location = 0; GLint pt_distance_uniform_location = 0; glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); /* Create a pixmap with VBO. */ pixmap = glamor_create_pixmap(screen, width, height, PIXMAN_FORMAT_DEPTH(format), 0); if (!pixmap) goto GRADIENT_FAIL; dst_picture = CreatePicture(0, &pixmap->drawable, PictureMatchFormat(screen, PIXMAN_FORMAT_DEPTH(format), format), 0, 0, serverClient, &error); /* Release the reference, picture will hold the last one. */ glamor_destroy_pixmap(pixmap); if (!dst_picture) goto GRADIENT_FAIL; ValidatePicture(dst_picture); stops_count = src_picture->pSourcePict->linear.nstops + 2; /* Because the max value of nstops is unknown, so create a program when nstops > LINEAR_LARGE_STOPS. */ if (stops_count <= LINEAR_SMALL_STOPS) { gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][0]; } else if (stops_count <= LINEAR_LARGE_STOPS) { gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][1]; } else { _glamor_create_linear_gradient_program(screen, src_picture->pSourcePict->linear. nstops + 2, 1); gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]; } /* Bind all the uniform vars . */ n_stop_uniform_location = glGetUniformLocation(gradient_prog, "n_stop"); pt_slope_uniform_location = glGetUniformLocation(gradient_prog, "pt_slope"); repeat_type_uniform_location = glGetUniformLocation(gradient_prog, "repeat_type"); hor_ver_uniform_location = glGetUniformLocation(gradient_prog, "hor_ver"); transform_mat_uniform_location = glGetUniformLocation(gradient_prog, "transform_mat"); cos_val_uniform_location = glGetUniformLocation(gradient_prog, "cos_val"); p1_distance_uniform_location = glGetUniformLocation(gradient_prog, "p1_distance"); pt_distance_uniform_location = glGetUniformLocation(gradient_prog, "pt_distance"); if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) { stop0_uniform_location = glGetUniformLocation(gradient_prog, "stop0"); stop1_uniform_location = glGetUniformLocation(gradient_prog, "stop1"); stop2_uniform_location = glGetUniformLocation(gradient_prog, "stop2"); stop3_uniform_location = glGetUniformLocation(gradient_prog, "stop3"); stop4_uniform_location = glGetUniformLocation(gradient_prog, "stop4"); stop5_uniform_location = glGetUniformLocation(gradient_prog, "stop5"); stop6_uniform_location = glGetUniformLocation(gradient_prog, "stop6"); stop7_uniform_location = glGetUniformLocation(gradient_prog, "stop7"); stop_color0_uniform_location = glGetUniformLocation(gradient_prog, "stop_color0"); stop_color1_uniform_location = glGetUniformLocation(gradient_prog, "stop_color1"); stop_color2_uniform_location = glGetUniformLocation(gradient_prog, "stop_color2"); stop_color3_uniform_location = glGetUniformLocation(gradient_prog, "stop_color3"); stop_color4_uniform_location = glGetUniformLocation(gradient_prog, "stop_color4"); stop_color5_uniform_location = glGetUniformLocation(gradient_prog, "stop_color5"); stop_color6_uniform_location = glGetUniformLocation(gradient_prog, "stop_color6"); stop_color7_uniform_location = glGetUniformLocation(gradient_prog, "stop_color7"); } else { stops_uniform_location = glGetUniformLocation(gradient_prog, "stops"); stop_colors_uniform_location = glGetUniformLocation(gradient_prog, "stop_colors"); } glUseProgram(gradient_prog); glUniform1i(repeat_type_uniform_location, src_picture->repeatType); /* set the transform matrix. */ if (src_picture->transform) { _glamor_gradient_convert_trans_matrix(src_picture->transform, transform_mat, width, height, 1); glUniformMatrix3fv(transform_mat_uniform_location, 1, 1, &transform_mat[0][0]); } else { glUniformMatrix3fv(transform_mat_uniform_location, 1, 1, &identity_mat[0][0]); } if (!_glamor_gradient_set_pixmap_destination (screen, glamor_priv, dst_picture, &xscale, &yscale, x_source, y_source, 1)) goto GRADIENT_FAIL; glamor_set_alu(screen, GXcopy); /* Normalize the PTs. */ glamor_set_normalize_pt(xscale, yscale, pixman_fixed_to_double(src_picture->pSourcePict-> linear.p1.x), pixman_fixed_to_double(src_picture->pSourcePict-> linear.p1.y), pt1); DEBUGF("pt1:(%f, %f) ---> (%f %f)\n", pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.x), pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.y), pt1[0], pt1[1]); glamor_set_normalize_pt(xscale, yscale, pixman_fixed_to_double(src_picture->pSourcePict-> linear.p2.x), pixman_fixed_to_double(src_picture->pSourcePict-> linear.p2.y), pt2); DEBUGF("pt2:(%f, %f) ---> (%f %f)\n", pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.x), pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.y), pt2[0], pt2[1]); /* Set all the stops and colors to shader. */ if (stops_count > LINEAR_SMALL_STOPS) { stop_colors = xallocarray(stops_count, 4 * sizeof(float)); if (stop_colors == NULL) { ErrorF("Failed to allocate stop_colors memory.\n"); goto GRADIENT_FAIL; } n_stops = xallocarray(stops_count, sizeof(float)); if (n_stops == NULL) { ErrorF("Failed to allocate n_stops memory.\n"); goto GRADIENT_FAIL; } } else { stop_colors = stop_colors_st; n_stops = n_stops_st; } count = _glamor_gradient_set_stops(src_picture, &src_picture->pSourcePict->gradient, stop_colors, n_stops); if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) { int j = 0; glUniform4f(stop_color0_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color1_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color2_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color3_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color4_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color5_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color6_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; glUniform4f(stop_color7_uniform_location, stop_colors[4 * j + 0], stop_colors[4 * j + 1], stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j = 0; glUniform1f(stop0_uniform_location, n_stops[j++]); glUniform1f(stop1_uniform_location, n_stops[j++]); glUniform1f(stop2_uniform_location, n_stops[j++]); glUniform1f(stop3_uniform_location, n_stops[j++]); glUniform1f(stop4_uniform_location, n_stops[j++]); glUniform1f(stop5_uniform_location, n_stops[j++]); glUniform1f(stop6_uniform_location, n_stops[j++]); glUniform1f(stop7_uniform_location, n_stops[j++]); glUniform1i(n_stop_uniform_location, count); } else { glUniform4fv(stop_colors_uniform_location, count, stop_colors); glUniform1fv(stops_uniform_location, count, n_stops); glUniform1i(n_stop_uniform_location, count); } if (src_picture->pSourcePict->linear.p2.y == src_picture->pSourcePict->linear.p1.y) { // The horizontal case. glUniform1i(hor_ver_uniform_location, 1); DEBUGF("p1.y: %f, p2.y: %f, enter the horizontal case\n", pt1[1], pt2[1]); p1_distance = pt1[0]; pt_distance = (pt2[0] - p1_distance); glUniform1f(p1_distance_uniform_location, p1_distance); glUniform1f(pt_distance_uniform_location, pt_distance); } else { /* The slope need to compute here. In shader, the viewport set will change the original slope and the slope which is vertical to it will not be correct. */ slope = -(float) (src_picture->pSourcePict->linear.p2.x - src_picture->pSourcePict->linear.p1.x) / (float) (src_picture->pSourcePict->linear.p2.y - src_picture->pSourcePict->linear.p1.y); slope = slope * yscale / xscale; glUniform1f(pt_slope_uniform_location, slope); glUniform1i(hor_ver_uniform_location, 0); cos_val = sqrt(1.0 / (slope * slope + 1.0)); glUniform1f(cos_val_uniform_location, cos_val); p1_distance = (pt1[1] - pt1[0] * slope) * cos_val; pt_distance = (pt2[1] - pt2[0] * slope) * cos_val - p1_distance; glUniform1f(p1_distance_uniform_location, p1_distance); glUniform1f(pt_distance_uniform_location, pt_distance); } /* Now rendering. */ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); /* Do the clear logic. */ if (stops_count > LINEAR_SMALL_STOPS) { free(n_stops); free(stop_colors); } glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); return dst_picture; GRADIENT_FAIL: if (dst_picture) { FreePicture(dst_picture, 0); } if (stops_count > LINEAR_SMALL_STOPS) { if (n_stops) free(n_stops); if (stop_colors) free(stop_colors); } glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); return NULL; } xorg-server-1.20.8/glamor/glamor_vbo.c0000644000175000017500000001600413640201473014563 00000000000000/* * Copyright © 2014 Intel Corporation * * 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. */ /** * @file glamor_vbo.c * * Helpers for managing streamed vertex bufffers used in glamor. */ #include "glamor_priv.h" /** Default size of the VBO, in bytes. * * If a single request is larger than this size, we'll resize the VBO * and return an appropriate mapping, but we'll resize back down after * that to avoid hogging that memory forever. We don't anticipate * normal usage actually requiring larger VBO sizes. */ #define GLAMOR_VBO_SIZE (512 * 1024) /** * Returns a pointer to @size bytes of VBO storage, which should be * accessed by the GL using vbo_offset within the VBO. */ void * glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); void *data; glamor_make_current(glamor_priv); glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); if (glamor_priv->has_buffer_storage) { if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) { if (glamor_priv->vbo_size) glUnmapBuffer(GL_ARRAY_BUFFER); if (size > glamor_priv->vbo_size) { glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); /* We aren't allowed to resize glBufferStorage() * buffers, so we need to gen a new one. */ glDeleteBuffers(1, &glamor_priv->vbo); glGenBuffers(1, &glamor_priv->vbo); glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); assert(glGetError() == GL_NO_ERROR); glBufferStorage(GL_ARRAY_BUFFER, glamor_priv->vbo_size, NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); if (glGetError() != GL_NO_ERROR) { /* If the driver failed our coherent mapping, fall * back to the ARB_mbr path. */ glamor_priv->has_buffer_storage = false; glamor_priv->vbo_size = 0; return glamor_get_vbo_space(screen, size, vbo_offset); } } glamor_priv->vbo_offset = 0; glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, 0, glamor_priv->vbo_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); } *vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset; data = glamor_priv->vb + glamor_priv->vbo_offset; glamor_priv->vbo_offset += size; } else if (glamor_priv->has_map_buffer_range) { /* Avoid GL errors on GL 4.5 / ES 3.0 with mapping size == 0, * which callers may sometimes pass us (for example, if * clipping leads to zero rectangles left). Prior to that * version, Mesa would sometimes throw errors on unmapping a * zero-size mapping. */ if (size == 0) return NULL; if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) { glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); glamor_priv->vbo_offset = 0; glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); } data = glMapBufferRange(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, size, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_RANGE_BIT); *vbo_offset = (char *)(uintptr_t)glamor_priv->vbo_offset; glamor_priv->vbo_offset += size; glamor_priv->vbo_mapped = TRUE; } else { /* Return a pointer to the statically allocated non-VBO * memory. We'll upload it through glBufferData() later. */ if (glamor_priv->vbo_size < size) { glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); free(glamor_priv->vb); glamor_priv->vb = xnfalloc(glamor_priv->vbo_size); } *vbo_offset = NULL; /* We point to the start of glamor_priv->vb every time, and * the vbo_offset determines the size of the glBufferData(). */ glamor_priv->vbo_offset = size; data = glamor_priv->vb; } return data; } void glamor_put_vbo_space(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); if (glamor_priv->has_buffer_storage) { /* If we're in the ARB_buffer_storage path, we have a * persistent mapping, so we can leave it around until we * reach the end of the buffer. */ } else if (glamor_priv->has_map_buffer_range) { if (glamor_priv->vbo_mapped) { glUnmapBuffer(GL_ARRAY_BUFFER); glamor_priv->vbo_mapped = FALSE; } } else { glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, glamor_priv->vb, GL_DYNAMIC_DRAW); } glBindBuffer(GL_ARRAY_BUFFER, 0); } void glamor_init_vbo(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glGenBuffers(1, &glamor_priv->vbo); glGenVertexArrays(1, &glamor_priv->vao); glBindVertexArray(glamor_priv->vao); } void glamor_fini_vbo(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glDeleteVertexArrays(1, &glamor_priv->vao); glamor_priv->vao = 0; if (!glamor_priv->has_map_buffer_range) free(glamor_priv->vb); } xorg-server-1.20.8/glamor/glamor.c0000644000175000017500000007521413640201473013725 00000000000000/* * Copyright © 2008,2011 Intel Corporation * * 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. * * Authors: * Eric Anholt * Zhigang Gong * Chad Versace */ /** @file glamor.c * This file covers the initialization and teardown of glamor, and has various * functions not responsible for performing rendering. */ #include #include #include "glamor_priv.h" #include "mipict.h" DevPrivateKeyRec glamor_screen_private_key; DevPrivateKeyRec glamor_pixmap_private_key; DevPrivateKeyRec glamor_gc_private_key; glamor_screen_private * glamor_get_screen_private(ScreenPtr screen) { return (glamor_screen_private *) dixLookupPrivate(&screen->devPrivates, &glamor_screen_private_key); } void glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv) { dixSetPrivate(&screen->devPrivates, &glamor_screen_private_key, priv); } /** * glamor_get_drawable_pixmap() returns a backing pixmap for a given drawable. * * @param drawable the drawable being requested. * * This function returns the backing pixmap for a drawable, whether it is a * redirected window, unredirected window, or already a pixmap. Note that * coordinate translation is needed when drawing to the backing pixmap of a * redirected window, and the translation coordinates are provided by calling * exaGetOffscreenPixmap() on the drawable. */ PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable) { if (drawable->type == DRAWABLE_WINDOW) return drawable->pScreen->GetWindowPixmap((WindowPtr) drawable); else return (PixmapPtr) drawable; } static void glamor_init_pixmap_private_small(PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv) { pixmap_priv->box.x1 = 0; pixmap_priv->box.x2 = pixmap->drawable.width; pixmap_priv->box.y1 = 0; pixmap_priv->box.y2 = pixmap->drawable.height; pixmap_priv->block_w = pixmap->drawable.width; pixmap_priv->block_h = pixmap->drawable.height; pixmap_priv->block_hcnt = 1; pixmap_priv->block_wcnt = 1; pixmap_priv->box_array = &pixmap_priv->box; pixmap_priv->fbo_array = &pixmap_priv->fbo; } _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type) { glamor_pixmap_private *pixmap_priv; pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv->type = type; glamor_init_pixmap_private_small(pixmap, pixmap_priv); } _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_pixmap_private *pixmap_priv; glamor_screen_private *glamor_priv; glamor_pixmap_fbo *fbo; GLenum format; glamor_priv = glamor_get_screen_private(screen); pixmap_priv = glamor_get_pixmap_private(pixmap); if (pixmap_priv->fbo) { fbo = glamor_pixmap_detach_fbo(pixmap_priv); glamor_destroy_fbo(glamor_priv, fbo); } format = gl_iformat_for_pixmap(pixmap); fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width, pixmap->drawable.height, format, tex, 0); if (fbo == NULL) { ErrorF("XXX fail to create fbo.\n"); return; } glamor_pixmap_attach_fbo(pixmap, fbo); } _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv; glamor_pixmap_private *pixmap_priv; glamor_priv = glamor_get_screen_private(screen); pixmap_priv = glamor_get_pixmap_private(pixmap); assert(pixmap_priv->fbo != NULL); glamor_pixmap_clear_fbo(glamor_priv, pixmap_priv->fbo); } uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap) { glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); if (!pixmap_priv) return 0; if (!pixmap_priv->fbo) return 0; if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY) return 0; return pixmap_priv->fbo->tex; } void glamor_bind_texture(glamor_screen_private *glamor_priv, GLenum texture, glamor_pixmap_fbo *fbo, Bool destination_red) { glActiveTexture(texture); glBindTexture(GL_TEXTURE_2D, fbo->tex); /* If we're pulling data from a GL_RED texture, then whether we * want to make it an A,0,0,0 result or a 0,0,0,R result depends * on whether the destination is also a GL_RED texture. * * For GL_RED destinations, we need to leave the bits in the R * channel. For all other destinations, we need to clear out the R * channel so that it returns zero for R, G and B. * * Note that we're leaving the SWIZZLE_A value alone; for GL_RED * destinations, that means we'll actually be returning R,0,0,R, * but it doesn't matter as the bits in the alpha channel aren't * going anywhere. */ /* Is the operand a GL_RED fbo? */ if (glamor_fbo_red_is_alpha(glamor_priv, fbo)) { /* If destination is also GL_RED, then preserve the bits in * the R channel */ if (destination_red) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED); else glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ZERO); } } PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, unsigned int usage) { PixmapPtr pixmap; glamor_pixmap_private *pixmap_priv; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_fbo *fbo = NULL; int pitch; GLenum format; if (w > 32767 || h > 32767) return NullPixmap; if ((usage == GLAMOR_CREATE_PIXMAP_CPU || (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE && w <= glamor_priv->glyph_max_dim && h <= glamor_priv->glyph_max_dim) || (w == 0 && h == 0) || !glamor_check_pixmap_fbo_depth(depth))) return fbCreatePixmap(screen, w, h, depth, usage); else pixmap = fbCreatePixmap(screen, 0, 0, depth, usage); pixmap_priv = glamor_get_pixmap_private(pixmap); format = gl_iformat_for_pixmap(pixmap); pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3; screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL); pixmap_priv->type = GLAMOR_TEXTURE_ONLY; if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) { glamor_init_pixmap_private_small(pixmap, pixmap_priv); return pixmap; } else if (usage == GLAMOR_CREATE_NO_LARGE || glamor_check_fbo_size(glamor_priv, w, h)) { glamor_init_pixmap_private_small(pixmap, pixmap_priv); fbo = glamor_create_fbo(glamor_priv, w, h, format, usage); } else { int tile_size = glamor_priv->max_fbo_size; DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size); fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage, tile_size, tile_size, pixmap_priv); } if (fbo == NULL) { fbDestroyPixmap(pixmap); return fbCreatePixmap(screen, w, h, depth, usage); } glamor_pixmap_attach_fbo(pixmap, fbo); return pixmap; } Bool glamor_destroy_pixmap(PixmapPtr pixmap) { if (pixmap->refcnt == 1) { glamor_pixmap_destroy_fbo(pixmap); } return fbDestroyPixmap(pixmap); } void glamor_block_handler(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glFlush(); } static void _glamor_block_handler(ScreenPtr screen, void *timeout) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glFlush(); screen->BlockHandler = glamor_priv->saved_procs.block_handler; screen->BlockHandler(screen, timeout); glamor_priv->saved_procs.block_handler = screen->BlockHandler; screen->BlockHandler = _glamor_block_handler; } static void glamor_set_debug_level(int *debug_level) { char *debug_level_string; debug_level_string = getenv("GLAMOR_DEBUG"); if (debug_level_string && sscanf(debug_level_string, "%d", debug_level) == 1) return; *debug_level = 0; } int glamor_debug_level; void glamor_gldrawarrays_quads_using_indices(glamor_screen_private *glamor_priv, unsigned count) { unsigned i; /* For a single quad, don't bother with an index buffer. */ if (count == 1) goto fallback; if (glamor_priv->ib_size < count) { /* Basic GLES2 doesn't have any way to map buffer objects for * writing, but it's long past time for drivers to have * MapBufferRange. */ if (!glamor_priv->has_map_buffer_range) goto fallback; /* Lazy create the buffer name, and only bind it once since * none of the glamor code binds it to anything else. */ if (!glamor_priv->ib) { glGenBuffers(1, &glamor_priv->ib); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ib); } /* For now, only support GL_UNSIGNED_SHORTs. */ if (count > ((1 << 16) - 1) / 4) { goto fallback; } else { uint16_t *data; size_t size = count * 6 * sizeof(GLushort); glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW); data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); for (i = 0; i < count; i++) { data[i * 6 + 0] = i * 4 + 0; data[i * 6 + 1] = i * 4 + 1; data[i * 6 + 2] = i * 4 + 2; data[i * 6 + 3] = i * 4 + 0; data[i * 6 + 4] = i * 4 + 2; data[i * 6 + 5] = i * 4 + 3; } glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); glamor_priv->ib_size = count; glamor_priv->ib_type = GL_UNSIGNED_SHORT; } } glDrawElements(GL_TRIANGLES, count * 6, glamor_priv->ib_type, NULL); return; fallback: for (i = 0; i < count; i++) glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4); } static Bool glamor_check_instruction_count(int gl_version) { GLint max_native_alu_instructions; /* Avoid using glamor if the reported instructions limit is too low, * as this would cause glamor to fallback on sw due to large shaders * which ends up being unbearably slow. */ if (gl_version < 30) { if (!epoxy_has_gl_extension("GL_ARB_fragment_program")) { ErrorF("GL_ARB_fragment_program required\n"); return FALSE; } glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, &max_native_alu_instructions); if (max_native_alu_instructions < GLAMOR_MIN_ALU_INSTRUCTIONS) { LogMessage(X_WARNING, "glamor requires at least %d instructions (%d reported)\n", GLAMOR_MIN_ALU_INSTRUCTIONS, max_native_alu_instructions); return FALSE; } } return TRUE; } static void GLAPIENTRY glamor_debug_output_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) { ScreenPtr screen = (void *)userParam; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); if (glamor_priv->suppress_gl_out_of_memory_logging && source == GL_DEBUG_SOURCE_API && type == GL_DEBUG_TYPE_ERROR) { return; } LogMessageVerb(X_ERROR, 0, "glamor%d: GL error: %*s\n", screen->myNum, length, message); } /** * Configures GL_ARB_debug_output to give us immediate callbacks when * GL errors occur, so that we can log them. */ static void glamor_setup_debug_output(ScreenPtr screen) { if (!epoxy_has_gl_extension("GL_ARB_debug_output")) return; glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); /* Disable debugging messages other than GL API errors */ glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_FALSE); glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, NULL, GL_TRUE); glDebugMessageCallback(glamor_debug_output_callback, screen); /* If KHR_debug is present, all debug output is disabled by * default on non-debug contexts. */ if (epoxy_has_gl_extension("GL_KHR_debug")) glEnable(GL_DEBUG_OUTPUT); } /** Set up glamor for an already-configured GL context. */ Bool glamor_init(ScreenPtr screen, unsigned int flags) { glamor_screen_private *glamor_priv; int gl_version; int glsl_major, glsl_minor; int max_viewport_size[2]; const char *shading_version_string; int shading_version_offset; PictureScreenPtr ps = GetPictureScreenIfSet(screen); if (flags & ~GLAMOR_VALID_FLAGS) { ErrorF("glamor_init: Invalid flags %x\n", flags); return FALSE; } glamor_priv = calloc(1, sizeof(*glamor_priv)); if (glamor_priv == NULL) return FALSE; glamor_priv->flags = flags; if (!dixRegisterPrivateKey(&glamor_screen_private_key, PRIVATE_SCREEN, 0)) { LogMessage(X_WARNING, "glamor%d: Failed to allocate screen private\n", screen->myNum); goto free_glamor_private; } glamor_set_screen_private(screen, glamor_priv); if (!dixRegisterPrivateKey(&glamor_pixmap_private_key, PRIVATE_PIXMAP, sizeof(struct glamor_pixmap_private))) { LogMessage(X_WARNING, "glamor%d: Failed to allocate pixmap private\n", screen->myNum); goto free_glamor_private; } if (!dixRegisterPrivateKey(&glamor_gc_private_key, PRIVATE_GC, sizeof (glamor_gc_private))) { LogMessage(X_WARNING, "glamor%d: Failed to allocate gc private\n", screen->myNum); goto free_glamor_private; } glamor_priv->saved_procs.close_screen = screen->CloseScreen; screen->CloseScreen = glamor_close_screen; glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap; screen->DestroyPixmap = glamor_destroy_pixmap; /* If we are using egl screen, call egl screen init to * register correct close screen function. */ if (flags & GLAMOR_USE_EGL_SCREEN) { glamor_egl_screen_init(screen, &glamor_priv->ctx); } else { if (!glamor_glx_screen_init(&glamor_priv->ctx)) goto fail; } glamor_make_current(glamor_priv); if (epoxy_is_desktop_gl()) glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP; else glamor_priv->gl_flavor = GLAMOR_GL_ES2; gl_version = epoxy_gl_version(); /* assume a core profile if we are GL 3.1 and don't have ARB_compatibility */ glamor_priv->is_core_profile = gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility"); shading_version_string = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION); if (!shading_version_string) { LogMessage(X_WARNING, "glamor%d: Failed to get GLSL version\n", screen->myNum); goto fail; } shading_version_offset = 0; if (strncmp("OpenGL ES GLSL ES ", shading_version_string, 18) == 0) shading_version_offset = 18; if (sscanf(shading_version_string + shading_version_offset, "%i.%i", &glsl_major, &glsl_minor) != 2) { LogMessage(X_WARNING, "glamor%d: Failed to parse GLSL version string %s\n", screen->myNum, shading_version_string); goto fail; } glamor_priv->glsl_version = glsl_major * 100 + glsl_minor; if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { /* Force us back to the base version of our programs on an ES * context, anyway. Basically glamor only uses desktop 1.20 * or 1.30 currently. 1.30's new features are also present in * ES 3.0, but our glamor_program.c constructions use a lot of * compatibility features (to reduce the diff between 1.20 and * 1.30 programs). */ glamor_priv->glsl_version = 120; } /* We'd like to require GL_ARB_map_buffer_range or * GL_OES_map_buffer_range, since it offers more information to * the driver than plain old glMapBuffer() or glBufferSubData(). * It's been supported on Mesa on the desktop since 2009 and on * GLES2 since October 2012. It's supported on Apple's iOS * drivers for SGX535 and A7, but apparently not on most Android * devices (the OES extension spec wasn't released until June * 2012). * * 82% of 0 A.D. players (desktop GL) submitting hardware reports * have support for it, with most of the ones lacking it being on * Windows with Intel 4-series (G45) graphics or older. */ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { if (gl_version < 21) { ErrorF("Require OpenGL version 2.1 or later.\n"); goto fail; } if (!glamor_priv->is_core_profile && !epoxy_has_gl_extension("GL_ARB_texture_border_clamp")) { ErrorF("GL_ARB_texture_border_clamp required\n"); goto fail; } if (!glamor_check_instruction_count(gl_version)) goto fail; /* Glamor rendering assumes that platforms with GLSL 130+ * have instanced arrays, but this is not always the case. * etnaviv offers GLSL 140 with OpenGL 2.1. */ if (glamor_priv->glsl_version >= 130 && !epoxy_has_gl_extension("GL_ARB_instanced_arrays")) glamor_priv->glsl_version = 120; } else { if (gl_version < 20) { ErrorF("Require Open GLES2.0 or later.\n"); goto fail; } if (!epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888")) { ErrorF("GL_EXT_texture_format_BGRA8888 required\n"); goto fail; } if (!epoxy_has_gl_extension("GL_OES_texture_border_clamp")) { ErrorF("GL_OES_texture_border_clamp required\n"); goto fail; } } if (!epoxy_has_gl_extension("GL_ARB_vertex_array_object") && !epoxy_has_gl_extension("GL_OES_vertex_array_object")) { ErrorF("GL_{ARB,OES}_vertex_array_object required\n"); goto fail; } glamor_priv->has_rw_pbo = FALSE; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) glamor_priv->has_rw_pbo = TRUE; glamor_priv->has_khr_debug = epoxy_has_gl_extension("GL_KHR_debug"); glamor_priv->has_pack_invert = epoxy_has_gl_extension("GL_MESA_pack_invert"); glamor_priv->has_fbo_blit = epoxy_has_gl_extension("GL_EXT_framebuffer_blit"); glamor_priv->has_map_buffer_range = epoxy_has_gl_extension("GL_ARB_map_buffer_range") || epoxy_has_gl_extension("GL_EXT_map_buffer_range"); glamor_priv->has_buffer_storage = epoxy_has_gl_extension("GL_ARB_buffer_storage"); glamor_priv->has_mesa_tile_raster_order = epoxy_has_gl_extension("GL_MESA_tile_raster_order"); glamor_priv->has_nv_texture_barrier = epoxy_has_gl_extension("GL_NV_texture_barrier"); glamor_priv->has_unpack_subimage = glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP || epoxy_gl_version() >= 30 || epoxy_has_gl_extension("GL_EXT_unpack_subimage"); glamor_priv->has_pack_subimage = glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP || epoxy_gl_version() >= 30 || epoxy_has_gl_extension("GL_NV_pack_subimage"); glamor_priv->has_dual_blend = glamor_priv->glsl_version >= 130 && epoxy_has_gl_extension("GL_ARB_blend_func_extended"); glamor_priv->can_copyplane = (gl_version >= 30); glamor_setup_debug_output(screen); glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) && !glamor_priv->is_core_profile; /* Driver-specific hack: Avoid using GL_QUADS on VC4, where * they'll be emulated more expensively than we can with our * cached IB. */ if (strstr((char *)glGetString(GL_VENDOR), "Broadcom") && strstr((char *)glGetString(GL_RENDERER), "VC4")) glamor_priv->use_quads = FALSE; glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size); glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size); glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[0]); glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[1]); #ifdef MAX_FBO_SIZE glamor_priv->max_fbo_size = MAX_FBO_SIZE; #endif glamor_priv->has_texture_swizzle = (epoxy_has_gl_extension("GL_ARB_texture_swizzle") || (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP && gl_version >= 30)); glamor_priv->one_channel_format = GL_ALPHA; if (epoxy_has_gl_extension("GL_ARB_texture_rg") && glamor_priv->has_texture_swizzle) { glamor_priv->one_channel_format = GL_RED; } glamor_set_debug_level(&glamor_debug_level); if (!glamor_font_init(screen)) goto fail; glamor_priv->saved_procs.block_handler = screen->BlockHandler; screen->BlockHandler = _glamor_block_handler; if (!glamor_composite_glyphs_init(screen)) { ErrorF("Failed to initialize composite masks\n"); goto fail; } glamor_priv->saved_procs.create_gc = screen->CreateGC; screen->CreateGC = glamor_create_gc; glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap; screen->CreatePixmap = glamor_create_pixmap; glamor_priv->saved_procs.get_spans = screen->GetSpans; screen->GetSpans = glamor_get_spans; glamor_priv->saved_procs.get_image = screen->GetImage; screen->GetImage = glamor_get_image; glamor_priv->saved_procs.change_window_attributes = screen->ChangeWindowAttributes; screen->ChangeWindowAttributes = glamor_change_window_attributes; glamor_priv->saved_procs.copy_window = screen->CopyWindow; screen->CopyWindow = glamor_copy_window; glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion; screen->BitmapToRegion = glamor_bitmap_to_region; glamor_priv->saved_procs.composite = ps->Composite; ps->Composite = glamor_composite; glamor_priv->saved_procs.trapezoids = ps->Trapezoids; ps->Trapezoids = glamor_trapezoids; glamor_priv->saved_procs.triangles = ps->Triangles; ps->Triangles = glamor_triangles; glamor_priv->saved_procs.addtraps = ps->AddTraps; ps->AddTraps = glamor_add_traps; glamor_priv->saved_procs.composite_rects = ps->CompositeRects; ps->CompositeRects = glamor_composite_rectangles; glamor_priv->saved_procs.glyphs = ps->Glyphs; ps->Glyphs = glamor_composite_glyphs; glamor_init_vbo(screen); glamor_init_gradient_shader(screen); glamor_pixmap_init(screen); glamor_sync_init(screen); glamor_priv->screen = screen; return TRUE; fail: /* Restore default CloseScreen and DestroyPixmap handlers */ screen->CloseScreen = glamor_priv->saved_procs.close_screen; screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap; free_glamor_private: free(glamor_priv); glamor_set_screen_private(screen, NULL); return FALSE; } static void glamor_release_screen_priv(ScreenPtr screen) { glamor_screen_private *glamor_priv; glamor_priv = glamor_get_screen_private(screen); glamor_fini_vbo(screen); glamor_pixmap_fini(screen); free(glamor_priv); glamor_set_screen_private(screen, NULL); } Bool glamor_close_screen(ScreenPtr screen) { glamor_screen_private *glamor_priv; PixmapPtr screen_pixmap; PictureScreenPtr ps = GetPictureScreenIfSet(screen); glamor_priv = glamor_get_screen_private(screen); glamor_sync_close(screen); glamor_composite_glyphs_fini(screen); screen->CloseScreen = glamor_priv->saved_procs.close_screen; screen->CreateGC = glamor_priv->saved_procs.create_gc; screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap; screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap; screen->GetSpans = glamor_priv->saved_procs.get_spans; screen->ChangeWindowAttributes = glamor_priv->saved_procs.change_window_attributes; screen->CopyWindow = glamor_priv->saved_procs.copy_window; screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region; screen->BlockHandler = glamor_priv->saved_procs.block_handler; ps->Composite = glamor_priv->saved_procs.composite; ps->Trapezoids = glamor_priv->saved_procs.trapezoids; ps->Triangles = glamor_priv->saved_procs.triangles; ps->CompositeRects = glamor_priv->saved_procs.composite_rects; ps->Glyphs = glamor_priv->saved_procs.glyphs; screen_pixmap = screen->GetScreenPixmap(screen); glamor_pixmap_destroy_fbo(screen_pixmap); glamor_release_screen_priv(screen); return screen->CloseScreen(screen); } void glamor_fini(ScreenPtr screen) { /* Do nothing currently. */ } void glamor_enable_dri3(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_priv->dri3_enabled = TRUE; } Bool glamor_supports_pixmap_import_export(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); return glamor_priv->dri3_enabled; } _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen, GetDrawableModifiersFuncPtr func) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_priv->get_drawable_modifiers = func; } _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers) { struct glamor_screen_private *glamor_priv = glamor_get_screen_private(draw->pScreen); if (glamor_priv->get_drawable_modifiers) { return glamor_priv->get_drawable_modifiers(draw, format, num_modifiers, modifiers); } *num_modifiers = 0; *modifiers = NULL; return TRUE; } static int _glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, CARD32 *size, uint64_t *modifier) { glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); if (!glamor_priv->dri3_enabled) return 0; switch (pixmap_priv->type) { case GLAMOR_TEXTURE_DRM: case GLAMOR_TEXTURE_ONLY: if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ? GL_RGB10_A2 : GL_RGBA, 0)) return 0; if (modifier) { return glamor_egl_fds_from_pixmap(screen, pixmap, fds, strides, offsets, modifier); } else { CARD16 stride; fds[0] = glamor_egl_fd_from_pixmap(screen, pixmap, &stride, size); strides[0] = stride; return fds[0] >= 0; } default: break; } return 0; } _X_EXPORT int glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier) { return _glamor_fds_from_pixmap(screen, pixmap, fds, strides, offsets, NULL, modifier); } _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { int fd; int ret; uint32_t stride32; ret = _glamor_fds_from_pixmap(screen, pixmap, &fd, &stride32, NULL, size, NULL); if (ret != 1) return -1; *stride = stride32; return fd; } _X_EXPORT int glamor_shareable_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { unsigned orig_usage_hint = pixmap->usage_hint; int ret; /* * The actual difference between a sharable and non sharable buffer * is decided 4 call levels deep in glamor_make_pixmap_exportable() * based on pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED * 2 of those calls are also exported API, so we cannot just add a flag. */ pixmap->usage_hint = CREATE_PIXMAP_USAGE_SHARED; ret = glamor_fd_from_pixmap(screen, pixmap, stride, size); pixmap->usage_hint = orig_usage_hint; return ret; } int glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); switch (pixmap_priv->type) { case GLAMOR_TEXTURE_DRM: case GLAMOR_TEXTURE_ONLY: if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ? GL_RGB10_A2 : GL_RGBA, 0)) return -1; return glamor_egl_fd_name_from_pixmap(pixmap->drawable.pScreen, pixmap, stride, size); default: break; } return -1; } void glamor_finish(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glFinish(); } xorg-server-1.20.8/glamor/Makefile.in0000644000175000017500000011323613640201511014333 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @XV_TRUE@am__append_1 = \ @XV_TRUE@ glamor_xv.c subdir = glamor ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libglamor_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libglamor_la_SOURCES_DIST = glamor.c glamor_context.h \ glamor_copy.c glamor_core.c glamor_dash.c glamor_debug.h \ glamor_font.c glamor_font.h glamor_glx.c \ glamor_composite_glyphs.c glamor_image.c glamor_lines.c \ glamor_segs.c glamor_render.c glamor_gradient.c \ glamor_prepare.c glamor_prepare.h glamor_program.c \ glamor_program.h glamor_rects.c glamor_spans.c glamor_text.c \ glamor_transfer.c glamor_transfer.h glamor_transform.c \ glamor_transform.h glamor_trapezoid.c glamor_triangles.c \ glamor_addtraps.c glamor_glyphblt.c glamor_points.c \ glamor_priv.h glamor_pixmap.c glamor_largepixmap.c \ glamor_picture.c glamor_vbo.c glamor_window.c glamor_fbo.c \ glamor_compositerects.c glamor_utils.c glamor_utils.h \ glamor_sync.c glamor.h glamor_xv.c @XV_TRUE@am__objects_1 = glamor_xv.lo am_libglamor_la_OBJECTS = glamor.lo glamor_copy.lo glamor_core.lo \ glamor_dash.lo glamor_font.lo glamor_glx.lo \ glamor_composite_glyphs.lo glamor_image.lo glamor_lines.lo \ glamor_segs.lo glamor_render.lo glamor_gradient.lo \ glamor_prepare.lo glamor_program.lo glamor_rects.lo \ glamor_spans.lo glamor_text.lo glamor_transfer.lo \ glamor_transform.lo glamor_trapezoid.lo glamor_triangles.lo \ glamor_addtraps.lo glamor_glyphblt.lo glamor_points.lo \ glamor_pixmap.lo glamor_largepixmap.lo glamor_picture.lo \ glamor_vbo.lo glamor_window.lo glamor_fbo.lo \ glamor_compositerects.lo glamor_utils.lo glamor_sync.lo \ $(am__objects_1) libglamor_la_OBJECTS = $(am_libglamor_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libglamor_egl_stubs_la_LIBADD = am_libglamor_egl_stubs_la_OBJECTS = glamor_egl_stubs.lo libglamor_egl_stubs_la_OBJECTS = $(am_libglamor_egl_stubs_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/glamor.Plo \ ./$(DEPDIR)/glamor_addtraps.Plo \ ./$(DEPDIR)/glamor_composite_glyphs.Plo \ ./$(DEPDIR)/glamor_compositerects.Plo \ ./$(DEPDIR)/glamor_copy.Plo ./$(DEPDIR)/glamor_core.Plo \ ./$(DEPDIR)/glamor_dash.Plo ./$(DEPDIR)/glamor_egl_stubs.Plo \ ./$(DEPDIR)/glamor_fbo.Plo ./$(DEPDIR)/glamor_font.Plo \ ./$(DEPDIR)/glamor_glx.Plo ./$(DEPDIR)/glamor_glyphblt.Plo \ ./$(DEPDIR)/glamor_gradient.Plo ./$(DEPDIR)/glamor_image.Plo \ ./$(DEPDIR)/glamor_largepixmap.Plo \ ./$(DEPDIR)/glamor_lines.Plo ./$(DEPDIR)/glamor_picture.Plo \ ./$(DEPDIR)/glamor_pixmap.Plo ./$(DEPDIR)/glamor_points.Plo \ ./$(DEPDIR)/glamor_prepare.Plo ./$(DEPDIR)/glamor_program.Plo \ ./$(DEPDIR)/glamor_rects.Plo ./$(DEPDIR)/glamor_render.Plo \ ./$(DEPDIR)/glamor_segs.Plo ./$(DEPDIR)/glamor_spans.Plo \ ./$(DEPDIR)/glamor_sync.Plo ./$(DEPDIR)/glamor_text.Plo \ ./$(DEPDIR)/glamor_transfer.Plo \ ./$(DEPDIR)/glamor_transform.Plo \ ./$(DEPDIR)/glamor_trapezoid.Plo \ ./$(DEPDIR)/glamor_triangles.Plo ./$(DEPDIR)/glamor_utils.Plo \ ./$(DEPDIR)/glamor_vbo.Plo ./$(DEPDIR)/glamor_window.Plo \ ./$(DEPDIR)/glamor_xv.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libglamor_la_SOURCES) $(libglamor_egl_stubs_la_SOURCES) DIST_SOURCES = $(am__libglamor_la_SOURCES_DIST) \ $(libglamor_egl_stubs_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libglamor.la libglamor_egl_stubs.la libglamor_la_LIBADD = $(GLAMOR_LIBS) AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS) libglamor_la_SOURCES = glamor.c glamor_context.h glamor_copy.c \ glamor_core.c glamor_dash.c glamor_debug.h glamor_font.c \ glamor_font.h glamor_glx.c glamor_composite_glyphs.c \ glamor_image.c glamor_lines.c glamor_segs.c glamor_render.c \ glamor_gradient.c glamor_prepare.c glamor_prepare.h \ glamor_program.c glamor_program.h glamor_rects.c \ glamor_spans.c glamor_text.c glamor_transfer.c \ glamor_transfer.h glamor_transform.c glamor_transform.h \ glamor_trapezoid.c glamor_triangles.c glamor_addtraps.c \ glamor_glyphblt.c glamor_points.c glamor_priv.h \ glamor_pixmap.c glamor_largepixmap.c glamor_picture.c \ glamor_vbo.c glamor_window.c glamor_fbo.c \ glamor_compositerects.c glamor_utils.c glamor_utils.h \ glamor_sync.c glamor.h $(am__append_1) libglamor_egl_stubs_la_SOURCES = \ glamor_egl_stubs.c \ glamor_egl_ext.h \ glamor_egl.h sdk_HEADERS = glamor.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glamor/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign glamor/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libglamor.la: $(libglamor_la_OBJECTS) $(libglamor_la_DEPENDENCIES) $(EXTRA_libglamor_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libglamor_la_OBJECTS) $(libglamor_la_LIBADD) $(LIBS) libglamor_egl_stubs.la: $(libglamor_egl_stubs_la_OBJECTS) $(libglamor_egl_stubs_la_DEPENDENCIES) $(EXTRA_libglamor_egl_stubs_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libglamor_egl_stubs_la_OBJECTS) $(libglamor_egl_stubs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_addtraps.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_composite_glyphs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_compositerects.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_copy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_core.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_dash.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_egl_stubs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_fbo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_font.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_glx.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_glyphblt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_gradient.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_image.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_largepixmap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_lines.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_picture.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_pixmap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_points.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_prepare.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_program.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_rects.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_render.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_segs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_spans.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_sync.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_text.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_transfer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_transform.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_trapezoid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_triangles.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_utils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_vbo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_window.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_xv.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/glamor.Plo -rm -f ./$(DEPDIR)/glamor_addtraps.Plo -rm -f ./$(DEPDIR)/glamor_composite_glyphs.Plo -rm -f ./$(DEPDIR)/glamor_compositerects.Plo -rm -f ./$(DEPDIR)/glamor_copy.Plo -rm -f ./$(DEPDIR)/glamor_core.Plo -rm -f ./$(DEPDIR)/glamor_dash.Plo -rm -f ./$(DEPDIR)/glamor_egl_stubs.Plo -rm -f ./$(DEPDIR)/glamor_fbo.Plo -rm -f ./$(DEPDIR)/glamor_font.Plo -rm -f ./$(DEPDIR)/glamor_glx.Plo -rm -f ./$(DEPDIR)/glamor_glyphblt.Plo -rm -f ./$(DEPDIR)/glamor_gradient.Plo -rm -f ./$(DEPDIR)/glamor_image.Plo -rm -f ./$(DEPDIR)/glamor_largepixmap.Plo -rm -f ./$(DEPDIR)/glamor_lines.Plo -rm -f ./$(DEPDIR)/glamor_picture.Plo -rm -f ./$(DEPDIR)/glamor_pixmap.Plo -rm -f ./$(DEPDIR)/glamor_points.Plo -rm -f ./$(DEPDIR)/glamor_prepare.Plo -rm -f ./$(DEPDIR)/glamor_program.Plo -rm -f ./$(DEPDIR)/glamor_rects.Plo -rm -f ./$(DEPDIR)/glamor_render.Plo -rm -f ./$(DEPDIR)/glamor_segs.Plo -rm -f ./$(DEPDIR)/glamor_spans.Plo -rm -f ./$(DEPDIR)/glamor_sync.Plo -rm -f ./$(DEPDIR)/glamor_text.Plo -rm -f ./$(DEPDIR)/glamor_transfer.Plo -rm -f ./$(DEPDIR)/glamor_transform.Plo -rm -f ./$(DEPDIR)/glamor_trapezoid.Plo -rm -f ./$(DEPDIR)/glamor_triangles.Plo -rm -f ./$(DEPDIR)/glamor_utils.Plo -rm -f ./$(DEPDIR)/glamor_vbo.Plo -rm -f ./$(DEPDIR)/glamor_window.Plo -rm -f ./$(DEPDIR)/glamor_xv.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/glamor.Plo -rm -f ./$(DEPDIR)/glamor_addtraps.Plo -rm -f ./$(DEPDIR)/glamor_composite_glyphs.Plo -rm -f ./$(DEPDIR)/glamor_compositerects.Plo -rm -f ./$(DEPDIR)/glamor_copy.Plo -rm -f ./$(DEPDIR)/glamor_core.Plo -rm -f ./$(DEPDIR)/glamor_dash.Plo -rm -f ./$(DEPDIR)/glamor_egl_stubs.Plo -rm -f ./$(DEPDIR)/glamor_fbo.Plo -rm -f ./$(DEPDIR)/glamor_font.Plo -rm -f ./$(DEPDIR)/glamor_glx.Plo -rm -f ./$(DEPDIR)/glamor_glyphblt.Plo -rm -f ./$(DEPDIR)/glamor_gradient.Plo -rm -f ./$(DEPDIR)/glamor_image.Plo -rm -f ./$(DEPDIR)/glamor_largepixmap.Plo -rm -f ./$(DEPDIR)/glamor_lines.Plo -rm -f ./$(DEPDIR)/glamor_picture.Plo -rm -f ./$(DEPDIR)/glamor_pixmap.Plo -rm -f ./$(DEPDIR)/glamor_points.Plo -rm -f ./$(DEPDIR)/glamor_prepare.Plo -rm -f ./$(DEPDIR)/glamor_program.Plo -rm -f ./$(DEPDIR)/glamor_rects.Plo -rm -f ./$(DEPDIR)/glamor_render.Plo -rm -f ./$(DEPDIR)/glamor_segs.Plo -rm -f ./$(DEPDIR)/glamor_spans.Plo -rm -f ./$(DEPDIR)/glamor_sync.Plo -rm -f ./$(DEPDIR)/glamor_text.Plo -rm -f ./$(DEPDIR)/glamor_transfer.Plo -rm -f ./$(DEPDIR)/glamor_transform.Plo -rm -f ./$(DEPDIR)/glamor_trapezoid.Plo -rm -f ./$(DEPDIR)/glamor_triangles.Plo -rm -f ./$(DEPDIR)/glamor_utils.Plo -rm -f ./$(DEPDIR)/glamor_vbo.Plo -rm -f ./$(DEPDIR)/glamor_window.Plo -rm -f ./$(DEPDIR)/glamor_xv.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/glamor/glamor_spans.c0000644000175000017500000003002613640201473015121 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_transform.h" #include "glamor_transfer.h" glamor_program fill_spans_progs[4]; static const glamor_facet glamor_facet_fillspans_130 = { .name = "fill_spans", .version = 130, .vs_vars = "attribute vec3 primitive;\n", .vs_exec = (" vec2 pos = vec2(primitive.z,1) * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" GLAMOR_POS(gl_Position, (primitive.xy + pos))), }; static const glamor_facet glamor_facet_fillspans_120 = { .name = "fill_spans", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (" vec2 pos = vec2(0,0);\n" GLAMOR_POS(gl_Position, primitive.xy)), }; static Bool glamor_fill_spans_gl(DrawablePtr drawable, GCPtr gc, int n, DDXPointPtr points, int *widths, int sorted) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; glamor_program *prog; int off_x, off_y; GLshort *v; char *vbo_offset; int c; int box_index; Bool ret = FALSE; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_make_current(glamor_priv); if (glamor_priv->glsl_version >= 130) { prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program, &glamor_facet_fillspans_130); if (!prog) goto bail; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, n * (4 * sizeof (GLshort)), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); glVertexAttribPointer(GLAMOR_VERTEX_POS, 3, GL_SHORT, GL_FALSE, 4 * sizeof (GLshort), vbo_offset); for (c = 0; c < n; c++) { v[0] = points->x; v[1] = points->y; v[2] = *widths++; points++; v += 4; } glamor_put_vbo_space(screen); } else { prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program, &glamor_facet_fillspans_120); if (!prog) goto bail; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, n * 8 * sizeof (short), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 2 * sizeof (short), vbo_offset); for (c = 0; c < n; c++) { v[0] = points->x; v[1] = points->y; v[2] = points->x; v[3] = points->y + 1; v[4] = points->x + *widths; v[5] = points->y + 1; v[6] = points->x + *widths; v[7] = points->y; widths++; points++; v += 8; } glamor_put_vbo_space(screen); } glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { int nbox = RegionNumRects(gc->pCompositeClip); BoxPtr box = RegionRects(gc->pCompositeClip); if (!glamor_set_destination_drawable(drawable, box_index, FALSE, FALSE, prog->matrix_uniform, &off_x, &off_y)) goto bail; while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; if (glamor_priv->glsl_version >= 130) glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n); else { glamor_glDrawArrays_GL_QUADS(glamor_priv, n); } } } ret = TRUE; bail: glDisable(GL_SCISSOR_TEST); if (glamor_priv->glsl_version >= 130) glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } static void glamor_fill_spans_bail(DrawablePtr drawable, GCPtr gc, int n, DDXPointPtr points, int *widths, int sorted) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc)) { fbFillSpans(drawable, gc, n, points, widths, sorted); } glamor_finish_access_gc(gc); glamor_finish_access(drawable); } void glamor_fill_spans(DrawablePtr drawable, GCPtr gc, int n, DDXPointPtr points, int *widths, int sorted) { if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted)) return; glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted); } static Bool glamor_get_spans_gl(DrawablePtr drawable, int wmax, DDXPointPtr points, int *widths, int count, char *dst) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; int box_index; int n; char *d; GLenum type; GLenum format; int off_x, off_y; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); glamor_format_for_pixmap(pixmap, &format, &type); glamor_make_current(glamor_priv); glamor_pixmap_loop(pixmap_priv, box_index) { BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_index); glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_index); glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); glPixelStorei(GL_PACK_ALIGNMENT, 4); d = dst; for (n = 0; n < count; n++) { int x1 = points[n].x + off_x; int y = points[n].y + off_y; int w = widths[n]; int x2 = x1 + w; char *l; l = d; d += PixmapBytePad(w, drawable->depth); /* clip */ if (x1 < box->x1) { l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3); x1 = box->x1; } if (x2 > box->x2) x2 = box->x2; if (x1 >= x2) continue; if (y < box->y1) continue; if (y >= box->y2) continue; glReadPixels(x1 - box->x1, y - box->y1, x2 - x1, 1, format, type, l); } } return TRUE; bail: return FALSE; } static void glamor_get_spans_bail(DrawablePtr drawable, int wmax, DDXPointPtr points, int *widths, int count, char *dst) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) fbGetSpans(drawable, wmax, points, widths, count, dst); glamor_finish_access(drawable); } void glamor_get_spans(DrawablePtr drawable, int wmax, DDXPointPtr points, int *widths, int count, char *dst) { if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst)) return; glamor_get_spans_bail(drawable, wmax, points, widths, count, dst); } static Bool glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src, DDXPointPtr points, int *widths, int numPoints, int sorted) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; int box_index; int n; char *s; GLenum type; GLenum format; int off_x, off_y; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; if (gc->alu != GXcopy) goto bail; if (!glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); glamor_format_for_pixmap(pixmap, &format, &type); glamor_make_current(glamor_priv); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glamor_pixmap_loop(pixmap_priv, box_index) { BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_index); glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_index); glamor_bind_texture(glamor_priv, GL_TEXTURE0, fbo, TRUE); s = src; for (n = 0; n < numPoints; n++) { BoxPtr clip_box = RegionRects(gc->pCompositeClip); int nclip_box = RegionNumRects(gc->pCompositeClip); int w = widths[n]; int y = points[n].y; int x = points[n].x; while (nclip_box--) { int x1 = x; int x2 = x + w; int y1 = y; char *l = s; /* clip to composite clip */ if (x1 < clip_box->x1) { l += (clip_box->x1 - x1) * (drawable->bitsPerPixel >> 3); x1 = clip_box->x1; } if (x2 > clip_box->x2) x2 = clip_box->x2; if (y < clip_box->y1) continue; if (y >= clip_box->y2) continue; /* adjust to pixmap coordinates */ x1 += off_x; x2 += off_x; y1 += off_y; if (x1 < box->x1) { l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3); x1 = box->x1; } if (x2 > box->x2) x2 = box->x2; if (x1 >= x2) continue; if (y1 < box->y1) continue; if (y1 >= box->y2) continue; glTexSubImage2D(GL_TEXTURE_2D, 0, x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, l); } s += PixmapBytePad(w, drawable->depth); } } return TRUE; bail: return FALSE; } static void glamor_set_spans_bail(DrawablePtr drawable, GCPtr gc, char *src, DDXPointPtr points, int *widths, int numPoints, int sorted) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc)) fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted); glamor_finish_access_gc(gc); glamor_finish_access(drawable); } void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, DDXPointPtr points, int *widths, int numPoints, int sorted) { if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted)) return; glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted); } xorg-server-1.20.8/glamor/glamor_font.c0000644000175000017500000001712313640201473014746 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_font.h" #include static int glamor_font_generation; static int glamor_font_private_index; static int glamor_font_screen_count; glamor_font_t * glamor_font_get(ScreenPtr screen, FontPtr font) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_font_t *privates; glamor_font_t *glamor_font; int overall_width, overall_height; int num_rows; int num_cols; int glyph_width_pixels; int glyph_width_bytes; int glyph_height; int row, col; unsigned char c[2]; CharInfoPtr glyph; unsigned long count; char *bits; if (glamor_priv->glsl_version < 130) return NULL; privates = FontGetPrivate(font, glamor_font_private_index); if (!privates) { privates = calloc(glamor_font_screen_count, sizeof (glamor_font_t)); if (!privates) return NULL; xfont2_font_set_private(font, glamor_font_private_index, privates); } glamor_font = &privates[screen->myNum]; if (glamor_font->realized) return glamor_font; /* Figure out how many glyphs are in the font */ num_cols = font->info.lastCol - font->info.firstCol + 1; num_rows = font->info.lastRow - font->info.firstRow + 1; /* Figure out the size of each glyph */ glyph_width_pixels = font->info.maxbounds.rightSideBearing - font->info.minbounds.leftSideBearing; glyph_height = font->info.maxbounds.ascent + font->info.maxbounds.descent; glyph_width_bytes = (glyph_width_pixels + 7) >> 3; glamor_font->glyph_width_pixels = glyph_width_pixels; glamor_font->glyph_width_bytes = glyph_width_bytes; glamor_font->glyph_height = glyph_height; /* * Layout the font two blocks of columns wide. * This avoids a problem with some fonts that are too high to fit. */ glamor_font->row_width = glyph_width_bytes * num_cols; if (num_rows > 1) { overall_width = glamor_font->row_width * 2; overall_height = glyph_height * ((num_rows + 1) / 2); } else { overall_width = glamor_font->row_width; overall_height = glyph_height; } if (overall_width > glamor_priv->max_fbo_size || overall_height > glamor_priv->max_fbo_size) { /* fallback if we don't fit inside a texture */ return NULL; } bits = malloc(overall_width * overall_height); if (!bits) return NULL; /* Check whether the font has a default character */ c[0] = font->info.lastRow + 1; c[1] = font->info.lastCol + 1; (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph); glamor_font->default_char = count ? glyph : NULL; glamor_font->default_row = font->info.defaultCh >> 8; glamor_font->default_col = font->info.defaultCh; glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glGenTextures(1, &glamor_font->texture_id); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); /* Paint all of the glyphs */ for (row = 0; row < num_rows; row++) { for (col = 0; col < num_cols; col++) { c[0] = row + font->info.firstRow; c[1] = col + font->info.firstCol; (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph); if (count) { char *dst; char *src = glyph->bits; unsigned y; dst = bits; /* get offset of start of first row */ dst += (row / 2) * glyph_height * overall_width; /* add offset into second row */ dst += (row & 1) ? glamor_font->row_width : 0; dst += col * glyph_width_bytes; for (y = 0; y < GLYPHHEIGHTPIXELS(glyph); y++) { memcpy(dst, src, GLYPHWIDTHBYTES(glyph)); dst += overall_width; src += GLYPHWIDTHBYTESPADDED(glyph); } } } } glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glamor_priv->suppress_gl_out_of_memory_logging = true; glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, bits); glamor_priv->suppress_gl_out_of_memory_logging = false; if (glGetError() == GL_OUT_OF_MEMORY) return NULL; free(bits); glamor_font->realized = TRUE; return glamor_font; } static Bool glamor_realize_font(ScreenPtr screen, FontPtr font) { return TRUE; } static Bool glamor_unrealize_font(ScreenPtr screen, FontPtr font) { glamor_screen_private *glamor_priv; glamor_font_t *privates = FontGetPrivate(font, glamor_font_private_index); glamor_font_t *glamor_font; int s; if (!privates) return TRUE; glamor_font = &privates[screen->myNum]; if (!glamor_font->realized) return TRUE; /* Unrealize the font, freeing the allocated texture */ glamor_font->realized = FALSE; glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); glDeleteTextures(1, &glamor_font->texture_id); /* Check to see if all of the screens are done with this font * and free the private when that happens */ for (s = 0; s < glamor_font_screen_count; s++) if (privates[s].realized) return TRUE; free(privates); xfont2_font_set_private(font, glamor_font_private_index, NULL); return TRUE; } Bool glamor_font_init(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); if (glamor_priv->glsl_version < 130) return TRUE; if (glamor_font_generation != serverGeneration) { glamor_font_private_index = xfont2_allocate_font_private_index(); if (glamor_font_private_index == -1) return FALSE; glamor_font_screen_count = 0; glamor_font_generation = serverGeneration; } if (screen->myNum >= glamor_font_screen_count) glamor_font_screen_count = screen->myNum + 1; screen->RealizeFont = glamor_realize_font; screen->UnrealizeFont = glamor_unrealize_font; return TRUE; } xorg-server-1.20.8/glamor/glamor_composite_glyphs.c0000644000175000017500000005110113640201473017362 00000000000000/* * Copyright © 2014 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 #include "Xprintf.h" #include "glamor_priv.h" #include "glamor_transform.h" #include "glamor_transfer.h" #include #define DEFAULT_ATLAS_DIM 1024 static DevPrivateKeyRec glamor_glyph_private_key; struct glamor_glyph_private { int16_t x; int16_t y; uint32_t serial; }; struct glamor_glyph_atlas { PixmapPtr atlas; PictFormatPtr format; int x, y; int row_height; int nglyph; uint32_t serial; }; static inline struct glamor_glyph_private *glamor_get_glyph_private(PixmapPtr pixmap) { return dixLookupPrivate(&pixmap->devPrivates, &glamor_glyph_private_key); } static inline void glamor_copy_glyph(PixmapPtr glyph_pixmap, DrawablePtr atlas_draw, int16_t x, int16_t y) { DrawablePtr glyph_draw = &glyph_pixmap->drawable; BoxRec box = { .x1 = 0, .y1 = 0, .x2 = glyph_draw->width, .y2 = glyph_draw->height, }; PixmapPtr upload_pixmap = glyph_pixmap; if (glyph_pixmap->drawable.bitsPerPixel != atlas_draw->bitsPerPixel) { /* If we're dealing with 1-bit glyphs, we copy them to a * temporary 8-bit pixmap and upload them from there, since * that's what GL can handle. */ ScreenPtr screen = atlas_draw->pScreen; GCPtr scratch_gc; ChangeGCVal changes[2]; upload_pixmap = glamor_create_pixmap(screen, glyph_draw->width, glyph_draw->height, atlas_draw->depth, GLAMOR_CREATE_PIXMAP_CPU); if (!upload_pixmap) return; scratch_gc = GetScratchGC(upload_pixmap->drawable.depth, screen); if (!scratch_gc) { glamor_destroy_pixmap(upload_pixmap); return; } changes[0].val = 0xff; changes[1].val = 0x00; if (ChangeGC(NullClient, scratch_gc, GCForeground|GCBackground, changes) != Success) { glamor_destroy_pixmap(upload_pixmap); FreeScratchGC(scratch_gc); return; } ValidateGC(&upload_pixmap->drawable, scratch_gc); (*scratch_gc->ops->CopyPlane)(glyph_draw, &upload_pixmap->drawable, scratch_gc, 0, 0, glyph_draw->width, glyph_draw->height, 0, 0, 0x1); } glamor_upload_boxes((PixmapPtr) atlas_draw, &box, 1, 0, 0, x, y, upload_pixmap->devPrivate.ptr, upload_pixmap->devKind); if (upload_pixmap != glyph_pixmap) glamor_destroy_pixmap(upload_pixmap); } static Bool glamor_glyph_atlas_init(ScreenPtr screen, struct glamor_glyph_atlas *atlas) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PictFormatPtr format = atlas->format; atlas->atlas = glamor_create_pixmap(screen, glamor_priv->glyph_atlas_dim, glamor_priv->glyph_atlas_dim, format->depth, GLAMOR_CREATE_FBO_NO_FBO); if (!glamor_pixmap_has_fbo(atlas->atlas)) { glamor_destroy_pixmap(atlas->atlas); atlas->atlas = NULL; } atlas->x = 0; atlas->y = 0; atlas->row_height = 0; atlas->serial++; atlas->nglyph = 0; return TRUE; } static Bool glamor_glyph_can_add(struct glamor_glyph_atlas *atlas, int dim, DrawablePtr glyph_draw) { /* Step down */ if (atlas->x + glyph_draw->width > dim) { atlas->x = 0; atlas->y += atlas->row_height; atlas->row_height = 0; } /* Check for overfull */ if (atlas->y + glyph_draw->height > dim) return FALSE; return TRUE; } static Bool glamor_glyph_add(struct glamor_glyph_atlas *atlas, DrawablePtr glyph_draw) { PixmapPtr glyph_pixmap = (PixmapPtr) glyph_draw; struct glamor_glyph_private *glyph_priv = glamor_get_glyph_private(glyph_pixmap); glamor_copy_glyph(glyph_pixmap, &atlas->atlas->drawable, atlas->x, atlas->y); glyph_priv->x = atlas->x; glyph_priv->y = atlas->y; glyph_priv->serial = atlas->serial; atlas->x += glyph_draw->width; if (atlas->row_height < glyph_draw->height) atlas->row_height = glyph_draw->height; atlas->nglyph++; return TRUE; } static const glamor_facet glamor_facet_composite_glyphs_130 = { .name = "composite_glyphs", .version = 130, .vs_vars = ("attribute vec4 primitive;\n" "attribute vec2 source;\n" "varying vec2 glyph_pos;\n"), .vs_exec = (" vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" GLAMOR_POS(gl_Position, (primitive.xy + pos)) " glyph_pos = (source + pos) * ATLAS_DIM_INV;\n"), .fs_vars = ("varying vec2 glyph_pos;\n" "out vec4 color0;\n" "out vec4 color1;\n"), .fs_exec = (" vec4 mask = texture2D(atlas, glyph_pos);\n"), .source_name = "source", .locations = glamor_program_location_atlas, }; static const glamor_facet glamor_facet_composite_glyphs_120 = { .name = "composite_glyphs", .vs_vars = ("attribute vec2 primitive;\n" "attribute vec2 source;\n" "varying vec2 glyph_pos;\n"), .vs_exec = (" vec2 pos = vec2(0,0);\n" GLAMOR_POS(gl_Position, primitive.xy) " glyph_pos = source.xy * ATLAS_DIM_INV;\n"), .fs_vars = ("varying vec2 glyph_pos;\n"), .fs_exec = (" vec4 mask = texture2D(atlas, glyph_pos);\n"), .source_name = "source", .locations = glamor_program_location_atlas, }; static inline Bool glamor_glyph_use_130(glamor_screen_private *glamor_priv) { return glamor_priv->glsl_version >= 130; } static Bool glamor_glyphs_init_facet(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); return asprintf(&glamor_priv->glyph_defines, "#define ATLAS_DIM_INV %20.18f\n", 1.0/glamor_priv->glyph_atlas_dim) > 0; } static void glamor_glyphs_fini_facet(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); free(glamor_priv->glyph_defines); } static void glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog, struct glamor_glyph_atlas *atlas, int nglyph) { DrawablePtr drawable = dst->pDrawable; glamor_screen_private *glamor_priv = glamor_get_screen_private(drawable->pScreen); PixmapPtr atlas_pixmap = atlas->atlas; glamor_pixmap_private *atlas_priv = glamor_get_pixmap_private(atlas_pixmap); glamor_pixmap_fbo *atlas_fbo = glamor_pixmap_fbo_at(atlas_priv, 0); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); int box_index; int off_x, off_y; glamor_put_vbo_space(drawable->pScreen); glEnable(GL_SCISSOR_TEST); glamor_bind_texture(glamor_priv, GL_TEXTURE1, atlas_fbo, FALSE); for (;;) { if (!glamor_use_program_render(prog, op, src, dst)) break; glUniform1i(prog->atlas_uniform, 1); glamor_pixmap_loop(pixmap_priv, box_index) { BoxPtr box = RegionRects(dst->pCompositeClip); int nbox = RegionNumRects(dst->pCompositeClip); glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y); /* Run over the clip list, drawing the glyphs * in each box */ while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; if (glamor_glyph_use_130(glamor_priv)) glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph); else glamor_glDrawArrays_GL_QUADS(glamor_priv, nglyph); } } if (prog->alpha != glamor_program_alpha_ca_first) break; prog++; } glDisable(GL_SCISSOR_TEST); if (glamor_glyph_use_130(glamor_priv)) { glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); } glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisable(GL_BLEND); } static GLshort * glamor_glyph_start(ScreenPtr screen, int count) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); GLshort *v; char *vbo_offset; /* Set up the vertex buffers for the font and destination */ if (glamor_glyph_use_130(glamor_priv)) { v = glamor_get_vbo_space(screen, count * (6 * sizeof (GLshort)), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE, 6 * sizeof (GLshort), vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 1); glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_SHORT, GL_FALSE, 6 * sizeof (GLshort), vbo_offset + 4 * sizeof (GLshort)); } else { v = glamor_get_vbo_space(screen, count * (16 * sizeof (GLshort)), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 4 * sizeof (GLshort), vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_SHORT, GL_FALSE, 4 * sizeof (GLshort), vbo_offset + 2 * sizeof (GLshort)); } return v; } static inline struct glamor_glyph_atlas * glamor_atlas_for_glyph(glamor_screen_private *glamor_priv, DrawablePtr drawable) { if (drawable->depth == 32) return glamor_priv->glyph_atlas_argb; else return glamor_priv->glyph_atlas_a; } void glamor_composite_glyphs(CARD8 op, PicturePtr src, PicturePtr dst, PictFormatPtr glyph_format, INT16 x_src, INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs) { int glyphs_queued; GLshort *v = NULL; DrawablePtr drawable = dst->pDrawable; ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_program *prog = NULL; glamor_program_render *glyphs_program = &glamor_priv->glyphs_program; struct glamor_glyph_atlas *glyph_atlas = NULL; int x = 0, y = 0; int n; int glyph_atlas_dim = glamor_priv->glyph_atlas_dim; int glyph_max_dim = glamor_priv->glyph_max_dim; int nglyph = 0; int screen_num = screen->myNum; for (n = 0; n < nlist; n++) nglyph += list[n].len; glamor_make_current(glamor_priv); glyphs_queued = 0; while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; list++; while (n--) { GlyphPtr glyph = *glyphs++; /* Glyph not empty? */ if (glyph->info.width && glyph->info.height) { PicturePtr glyph_pict = GlyphPicture(glyph)[screen_num]; DrawablePtr glyph_draw = glyph_pict->pDrawable; /* Need to draw with slow path? */ if (_X_UNLIKELY(glyph_draw->width > glyph_max_dim || glyph_draw->height > glyph_max_dim || !glamor_pixmap_is_memory((PixmapPtr)glyph_draw))) { if (glyphs_queued) { glamor_glyphs_flush(op, src, dst, prog, glyph_atlas, glyphs_queued); glyphs_queued = 0; } bail_one: glamor_composite(op, src, glyph_pict, dst, x_src + (x - glyph->info.x), (y - glyph->info.y), 0, 0, x - glyph->info.x, y - glyph->info.y, glyph_draw->width, glyph_draw->height); } else { struct glamor_glyph_private *glyph_priv = glamor_get_glyph_private((PixmapPtr)(glyph_draw)); struct glamor_glyph_atlas *next_atlas = glamor_atlas_for_glyph(glamor_priv, glyph_draw); /* Switching source glyph format? */ if (_X_UNLIKELY(next_atlas != glyph_atlas)) { if (glyphs_queued) { glamor_glyphs_flush(op, src, dst, prog, glyph_atlas, glyphs_queued); glyphs_queued = 0; } glyph_atlas = next_atlas; } /* Glyph not cached in current atlas? */ if (_X_UNLIKELY(glyph_priv->serial != glyph_atlas->serial)) { if (!glamor_glyph_can_add(glyph_atlas, glyph_atlas_dim, glyph_draw)) { if (glyphs_queued) { glamor_glyphs_flush(op, src, dst, prog, glyph_atlas, glyphs_queued); glyphs_queued = 0; } if (glyph_atlas->atlas) { (*screen->DestroyPixmap)(glyph_atlas->atlas); glyph_atlas->atlas = NULL; } } if (!glyph_atlas->atlas) { glamor_glyph_atlas_init(screen, glyph_atlas); if (!glyph_atlas->atlas) goto bail_one; } glamor_glyph_add(glyph_atlas, glyph_draw); } /* First glyph in the current atlas? */ if (_X_UNLIKELY(glyphs_queued == 0)) { if (glamor_glyph_use_130(glamor_priv)) prog = glamor_setup_program_render(op, src, glyph_pict, dst, glyphs_program, &glamor_facet_composite_glyphs_130, glamor_priv->glyph_defines); else prog = glamor_setup_program_render(op, src, glyph_pict, dst, glyphs_program, &glamor_facet_composite_glyphs_120, glamor_priv->glyph_defines); if (!prog) goto bail_one; v = glamor_glyph_start(screen, nglyph); } /* Add the glyph */ glyphs_queued++; if (_X_LIKELY(glamor_glyph_use_130(glamor_priv))) { v[0] = x - glyph->info.x; v[1] = y - glyph->info.y; v[2] = glyph_draw->width; v[3] = glyph_draw->height; v[4] = glyph_priv->x; v[5] = glyph_priv->y; v += 6; } else { v[0] = x - glyph->info.x; v[1] = y - glyph->info.y; v[2] = glyph_priv->x; v[3] = glyph_priv->y; v += 4; v[0] = x - glyph->info.x + glyph_draw->width; v[1] = y - glyph->info.y; v[2] = glyph_priv->x + glyph_draw->width; v[3] = glyph_priv->y; v += 4; v[0] = x - glyph->info.x + glyph_draw->width; v[1] = y - glyph->info.y + glyph_draw->height; v[2] = glyph_priv->x + glyph_draw->width; v[3] = glyph_priv->y + glyph_draw->height; v += 4; v[0] = x - glyph->info.x; v[1] = y - glyph->info.y + glyph_draw->height; v[2] = glyph_priv->x; v[3] = glyph_priv->y + glyph_draw->height; v += 4; } } } x += glyph->info.xOff; y += glyph->info.yOff; nglyph--; } } if (glyphs_queued) glamor_glyphs_flush(op, src, dst, prog, glyph_atlas, glyphs_queued); return; } static struct glamor_glyph_atlas * glamor_alloc_glyph_atlas(ScreenPtr screen, int depth, CARD32 f) { PictFormatPtr format; struct glamor_glyph_atlas *glyph_atlas; format = PictureMatchFormat(screen, depth, f); if (!format) return NULL; glyph_atlas = calloc (1, sizeof (struct glamor_glyph_atlas)); if (!glyph_atlas) return NULL; glyph_atlas->format = format; glyph_atlas->serial = 1; return glyph_atlas; } Bool glamor_composite_glyphs_init(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); if (!dixRegisterPrivateKey(&glamor_glyph_private_key, PRIVATE_PIXMAP, sizeof (struct glamor_glyph_private))) return FALSE; /* Make glyph atlases of a reasonable size, but no larger than the maximum * supported by the hardware */ glamor_priv->glyph_atlas_dim = MIN(DEFAULT_ATLAS_DIM, glamor_priv->max_fbo_size); /* Don't stick huge glyphs in the atlases */ glamor_priv->glyph_max_dim = glamor_priv->glyph_atlas_dim / 8; glamor_priv->glyph_atlas_a = glamor_alloc_glyph_atlas(screen, 8, PICT_a8); if (!glamor_priv->glyph_atlas_a) return FALSE; glamor_priv->glyph_atlas_argb = glamor_alloc_glyph_atlas(screen, 32, PICT_a8r8g8b8); if (!glamor_priv->glyph_atlas_argb) { free (glamor_priv->glyph_atlas_a); return FALSE; } if (!glamor_glyphs_init_facet(screen)) return FALSE; return TRUE; } static void glamor_free_glyph_atlas(struct glamor_glyph_atlas *atlas) { if (!atlas) return; if (atlas->atlas) (*atlas->atlas->drawable.pScreen->DestroyPixmap)(atlas->atlas); free (atlas); } void glamor_composite_glyphs_fini(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_glyphs_fini_facet(screen); glamor_free_glyph_atlas(glamor_priv->glyph_atlas_a); glamor_free_glyph_atlas(glamor_priv->glyph_atlas_argb); } xorg-server-1.20.8/glamor/glamor_transform.c0000644000175000017500000002272513640201473016017 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_transform.h" /* * Set up rendering to target the specified drawable, computing an * appropriate transform for the vertex shader to convert * drawable-relative coordinates into pixmap-relative coordinates. If * requested, the offset from pixmap origin coordinates back to window * system coordinates will be returned in *p_off_x, *p_off_y so that * clipping computations can be adjusted as appropriate */ Bool glamor_set_destination_drawable(DrawablePtr drawable, int box_index, Bool do_drawable_translate, Bool center_offset, GLint matrix_uniform_location, int *p_off_x, int *p_off_y) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); int off_x, off_y; BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_index); int w = box->x2 - box->x1; int h = box->y2 - box->y1; float scale_x = 2.0f / (float) w; float scale_y = 2.0f / (float) h; float center_adjust = 0.0f; glamor_pixmap_fbo *pixmap_fbo; pixmap_fbo = glamor_pixmap_fbo_at(pixmap_priv, box_index); if (!pixmap_fbo) return FALSE; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); off_x -= box->x1; off_y -= box->y1; if (p_off_x) { *p_off_x = off_x; *p_off_y = off_y; } /* A tricky computation to find the right value for the two linear functions * that transform rendering coordinates to pixmap coordinates * * pixmap_x = render_x + drawable->x + off_x * pixmap_y = render_y + drawable->y + off_y * * gl_x = pixmap_x * 2 / width - 1 * gl_y = pixmap_y * 2 / height - 1 * * gl_x = (render_x + drawable->x + off_x) * 2 / width - 1 * * gl_x = (render_x) * 2 / width + (drawable->x + off_x) * 2 / width - 1 */ if (do_drawable_translate) { off_x += drawable->x; off_y += drawable->y; } /* * To get GL_POINTS drawn in the right spot, we need to adjust the * coordinates by 1/2 a pixel. */ if (center_offset) center_adjust = 0.5f; glUniform4f(matrix_uniform_location, scale_x, (off_x + center_adjust) * scale_x - 1.0f, scale_y, (off_y + center_adjust) * scale_y - 1.0f); glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_fbo, 0, 0, w, h); return TRUE; } /* * Set up for solid rendering to the specified pixmap using alu, fg and planemask * from the specified GC. Load the target color into the specified uniform */ void glamor_set_color_depth(ScreenPtr pScreen, int depth, CARD32 pixel, GLint uniform) { glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen); float color[4]; glamor_get_rgba_from_pixel(pixel, &color[0], &color[1], &color[2], &color[3], format_for_depth(depth)); if ((depth == 1 || depth == 8) && glamor_priv->one_channel_format == GL_RED) color[0] = color[3]; glUniform4fv(uniform, 1, color); } Bool glamor_set_solid(PixmapPtr pixmap, GCPtr gc, Bool use_alu, GLint uniform) { CARD32 pixel; int alu = use_alu ? gc->alu : GXcopy; if (!glamor_set_planemask(gc->depth, gc->planemask)) return FALSE; pixel = gc->fgPixel; if (!glamor_set_alu(pixmap->drawable.pScreen, alu)) { switch (gc->alu) { case GXclear: pixel = 0; break; case GXcopyInverted: pixel = ~pixel; break; case GXset: pixel = ~0 & gc->planemask; break; default: return FALSE; } } glamor_set_color(pixmap, gc->fgPixel, uniform); return TRUE; } Bool glamor_set_texture_pixmap(PixmapPtr texture, Bool destination_red) { glamor_pixmap_private *texture_priv; texture_priv = glamor_get_pixmap_private(texture); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(texture_priv)) return FALSE; if (glamor_pixmap_priv_is_large(texture_priv)) return FALSE; glamor_bind_texture(glamor_get_screen_private(texture->drawable.pScreen), GL_TEXTURE0, texture_priv->fbo, destination_red); /* we're not setting the sampler uniform here as we always use * GL_TEXTURE0, and the default value for uniforms is zero. So, * save a bit of CPU time by taking advantage of that. */ return TRUE; } Bool glamor_set_texture(PixmapPtr texture, Bool destination_red, int off_x, int off_y, GLint offset_uniform, GLint size_inv_uniform) { if (!glamor_set_texture_pixmap(texture, destination_red)) return FALSE; glUniform2f(offset_uniform, off_x, off_y); glUniform2f(size_inv_uniform, 1.0f/texture->drawable.width, 1.0f/texture->drawable.height); return TRUE; } Bool glamor_set_tiled(PixmapPtr pixmap, GCPtr gc, GLint offset_uniform, GLint size_inv_uniform) { if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu)) return FALSE; if (!glamor_set_planemask(gc->depth, gc->planemask)) return FALSE; return glamor_set_texture(gc->tile.pixmap, TRUE, -gc->patOrg.x, -gc->patOrg.y, offset_uniform, size_inv_uniform); } static PixmapPtr glamor_get_stipple_pixmap(GCPtr gc) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); ScreenPtr screen = gc->pScreen; PixmapPtr bitmap; PixmapPtr pixmap; GCPtr scratch_gc; ChangeGCVal changes[2]; if (gc_priv->stipple) return gc_priv->stipple; bitmap = gc->stipple; if (!bitmap) goto bail; pixmap = glamor_create_pixmap(screen, bitmap->drawable.width, bitmap->drawable.height, 8, GLAMOR_CREATE_NO_LARGE); if (!pixmap) goto bail; scratch_gc = GetScratchGC(8, screen); if (!scratch_gc) goto bail_pixmap; changes[0].val = 0xff; changes[1].val = 0x00; if (ChangeGC(NullClient, scratch_gc, GCForeground|GCBackground, changes) != Success) goto bail_gc; ValidateGC(&pixmap->drawable, scratch_gc); (*scratch_gc->ops->CopyPlane)(&bitmap->drawable, &pixmap->drawable, scratch_gc, 0, 0, bitmap->drawable.width, bitmap->drawable.height, 0, 0, 0x1); FreeScratchGC(scratch_gc); gc_priv->stipple = pixmap; glamor_track_stipple(gc); return pixmap; bail_gc: FreeScratchGC(scratch_gc); bail_pixmap: glamor_destroy_pixmap(pixmap); bail: return NULL; } Bool glamor_set_stippled(PixmapPtr pixmap, GCPtr gc, GLint fg_uniform, GLint offset_uniform, GLint size_uniform) { PixmapPtr stipple; stipple = glamor_get_stipple_pixmap(gc); if (!stipple) return FALSE; if (!glamor_set_solid(pixmap, gc, TRUE, fg_uniform)) return FALSE; return glamor_set_texture(stipple, FALSE, -gc->patOrg.x, -gc->patOrg.y, offset_uniform, size_uniform); } xorg-server-1.20.8/glamor/glamor_sync.c0000644000175000017500000001003313640201473014745 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "misyncshm.h" #include "misyncstr.h" #if XSYNC /* * This whole file exists to wrap a sync fence trigger operation so * that we can flush GL to provide serialization between the server * and the shm fence client */ static DevPrivateKeyRec glamor_sync_fence_key; struct glamor_sync_fence { SyncFenceSetTriggeredFunc set_triggered; }; static inline struct glamor_sync_fence * glamor_get_sync_fence(SyncFence *fence) { return (struct glamor_sync_fence *) dixLookupPrivate(&fence->devPrivates, &glamor_sync_fence_key); } static void glamor_sync_fence_set_triggered (SyncFence *fence) { ScreenPtr screen = fence->pScreen; glamor_screen_private *glamor = glamor_get_screen_private(screen); struct glamor_sync_fence *glamor_fence = glamor_get_sync_fence(fence); /* Flush pending rendering operations */ glamor_make_current(glamor); glFlush(); fence->funcs.SetTriggered = glamor_fence->set_triggered; fence->funcs.SetTriggered(fence); glamor_fence->set_triggered = fence->funcs.SetTriggered; fence->funcs.SetTriggered = glamor_sync_fence_set_triggered; } static void glamor_sync_create_fence(ScreenPtr screen, SyncFence *fence, Bool initially_triggered) { glamor_screen_private *glamor = glamor_get_screen_private(screen); SyncScreenFuncsPtr screen_funcs = miSyncGetScreenFuncs(screen); struct glamor_sync_fence *glamor_fence = glamor_get_sync_fence(fence); screen_funcs->CreateFence = glamor->saved_procs.sync_screen_funcs.CreateFence; screen_funcs->CreateFence(screen, fence, initially_triggered); glamor->saved_procs.sync_screen_funcs.CreateFence = screen_funcs->CreateFence; screen_funcs->CreateFence = glamor_sync_create_fence; glamor_fence->set_triggered = fence->funcs.SetTriggered; fence->funcs.SetTriggered = glamor_sync_fence_set_triggered; } #endif Bool glamor_sync_init(ScreenPtr screen) { #if XSYNC glamor_screen_private *glamor = glamor_get_screen_private(screen); SyncScreenFuncsPtr screen_funcs; if (!dixPrivateKeyRegistered(&glamor_sync_fence_key)) { if (!dixRegisterPrivateKey(&glamor_sync_fence_key, PRIVATE_SYNC_FENCE, sizeof (struct glamor_sync_fence))) return FALSE; } #ifdef HAVE_XSHMFENCE if (!miSyncShmScreenInit(screen)) return FALSE; #else if (!miSyncSetup(screen)) return FALSE; #endif screen_funcs = miSyncGetScreenFuncs(screen); glamor->saved_procs.sync_screen_funcs.CreateFence = screen_funcs->CreateFence; screen_funcs->CreateFence = glamor_sync_create_fence; #endif return TRUE; } void glamor_sync_close(ScreenPtr screen) { #if XSYNC glamor_screen_private *glamor = glamor_get_screen_private(screen); SyncScreenFuncsPtr screen_funcs = miSyncGetScreenFuncs(screen); if (screen_funcs) screen_funcs->CreateFence = glamor->saved_procs.sync_screen_funcs.CreateFence; #endif } xorg-server-1.20.8/glamor/glamor_xv.c0000644000175000017500000004412313640201473014435 00000000000000/* * Copyright © 2013 Red Hat * * 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. * * Authors: * Dave Airlie * * some code is derived from the xf86-video-ati radeon driver, mainly * the calculations. */ /** @file glamor_xv.c * * Xv acceleration implementation */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glamor_priv.h" #include "glamor_transform.h" #include "glamor_transfer.h" #include #include "../hw/xfree86/common/fourcc.h" /* Reference color space transform data */ typedef struct tagREF_TRANSFORM { float RefLuma; float RefRCb; float RefRCr; float RefGCb; float RefGCr; float RefBCb; float RefBCr; } REF_TRANSFORM; #define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0) #define RTFBrightness(a) (((a)*1.0)/2000.0) #define RTFIntensity(a) (((a)*1.0)/2000.0) #define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0) #define RTFHue(a) (((a)*3.1416)/1000.0) static const glamor_facet glamor_facet_xv_planar = { .name = "xv_planar", .version = 120, .source_name = "v_texcoord0", .vs_vars = ("attribute vec2 position;\n" "attribute vec2 v_texcoord0;\n" "varying vec2 tcs;\n"), .vs_exec = (GLAMOR_POS(gl_Position, position) " tcs = v_texcoord0;\n"), .fs_vars = ("uniform sampler2D y_sampler;\n" "uniform sampler2D u_sampler;\n" "uniform sampler2D v_sampler;\n" "uniform vec4 offsetyco;\n" "uniform vec4 ucogamma;\n" "uniform vec4 vco;\n" "varying vec2 tcs;\n"), .fs_exec = ( " float sample;\n" " vec4 temp1;\n" " sample = texture2D(y_sampler, tcs).w;\n" " temp1.xyz = offsetyco.www * vec3(sample) + offsetyco.xyz;\n" " sample = texture2D(u_sampler, tcs).w;\n" " temp1.xyz = ucogamma.xyz * vec3(sample) + temp1.xyz;\n" " sample = texture2D(v_sampler, tcs).w;\n" " temp1.xyz = clamp(vco.xyz * vec3(sample) + temp1.xyz, 0.0, 1.0);\n" " temp1.w = 1.0;\n" " gl_FragColor = temp1;\n" ), }; #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) XvAttributeRec glamor_xv_attributes[] = { {XvSettable | XvGettable, -1000, 1000, (char *)"XV_BRIGHTNESS"}, {XvSettable | XvGettable, -1000, 1000, (char *)"XV_CONTRAST"}, {XvSettable | XvGettable, -1000, 1000, (char *)"XV_SATURATION"}, {XvSettable | XvGettable, -1000, 1000, (char *)"XV_HUE"}, {XvSettable | XvGettable, 0, 1, (char *)"XV_COLORSPACE"}, {0, 0, 0, NULL} }; int glamor_xv_num_attributes = ARRAY_SIZE(glamor_xv_attributes) - 1; Atom glamorBrightness, glamorContrast, glamorSaturation, glamorHue, glamorColorspace, glamorGamma; XvImageRec glamor_xv_images[] = { XVIMAGE_YV12, XVIMAGE_I420, }; int glamor_xv_num_images = ARRAY_SIZE(glamor_xv_images); static void glamor_init_xv_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); GLint sampler_loc; glamor_build_program(screen, &glamor_priv->xv_prog, &glamor_facet_xv_planar, NULL, NULL, NULL); glUseProgram(glamor_priv->xv_prog.prog); sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "y_sampler"); glUniform1i(sampler_loc, 0); sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "u_sampler"); glUniform1i(sampler_loc, 1); sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "v_sampler"); glUniform1i(sampler_loc, 2); } #define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v)) void glamor_xv_stop_video(glamor_port_private *port_priv) { } static void glamor_xv_free_port_data(glamor_port_private *port_priv) { int i; for (i = 0; i < 3; i++) { if (port_priv->src_pix[i]) { glamor_destroy_pixmap(port_priv->src_pix[i]); port_priv->src_pix[i] = NULL; } } RegionUninit(&port_priv->clip); RegionNull(&port_priv->clip); } int glamor_xv_set_port_attribute(glamor_port_private *port_priv, Atom attribute, INT32 value) { if (attribute == glamorBrightness) port_priv->brightness = ClipValue(value, -1000, 1000); else if (attribute == glamorHue) port_priv->hue = ClipValue(value, -1000, 1000); else if (attribute == glamorContrast) port_priv->contrast = ClipValue(value, -1000, 1000); else if (attribute == glamorSaturation) port_priv->saturation = ClipValue(value, -1000, 1000); else if (attribute == glamorGamma) port_priv->gamma = ClipValue(value, 100, 10000); else if (attribute == glamorColorspace) port_priv->transform_index = ClipValue(value, 0, 1); else return BadMatch; return Success; } int glamor_xv_get_port_attribute(glamor_port_private *port_priv, Atom attribute, INT32 *value) { if (attribute == glamorBrightness) *value = port_priv->brightness; else if (attribute == glamorHue) *value = port_priv->hue; else if (attribute == glamorContrast) *value = port_priv->contrast; else if (attribute == glamorSaturation) *value = port_priv->saturation; else if (attribute == glamorGamma) *value = port_priv->gamma; else if (attribute == glamorColorspace) *value = port_priv->transform_index; else return BadMatch; return Success; } int glamor_xv_query_image_attributes(int id, unsigned short *w, unsigned short *h, int *pitches, int *offsets) { int size = 0, tmp; if (offsets) offsets[0] = 0; switch (id) { case FOURCC_YV12: case FOURCC_I420: *w = ALIGN(*w, 2); *h = ALIGN(*h, 2); size = ALIGN(*w, 4); if (pitches) pitches[0] = size; size *= *h; if (offsets) offsets[1] = size; tmp = ALIGN(*w >> 1, 4); if (pitches) pitches[1] = pitches[2] = tmp; tmp *= (*h >> 1); size += tmp; if (offsets) offsets[2] = size; size += tmp; break; } return size; } /* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces note the difference to the parameters used in overlay are due to 10bit vs. float calcs */ static REF_TRANSFORM trans[2] = { {1.1643, 0.0, 1.5960, -0.3918, -0.8129, 2.0172, 0.0}, /* BT.601 */ {1.1643, 0.0, 1.7927, -0.2132, -0.5329, 2.1124, 0.0} /* BT.709 */ }; void glamor_xv_render(glamor_port_private *port_priv) { ScreenPtr screen = port_priv->pPixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = port_priv->pPixmap; glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_pixmap_private *src_pixmap_priv[3]; BoxPtr box = REGION_RECTS(&port_priv->clip); int nBox = REGION_NUM_RECTS(&port_priv->clip); GLfloat src_xscale[3], src_yscale[3]; int i; const float Loff = -0.0627; const float Coff = -0.502; float uvcosf, uvsinf; float yco; float uco[3], vco[3], off[3]; float bright, cont, gamma; int ref = port_priv->transform_index; GLint uloc; GLfloat *v; char *vbo_offset; int dst_box_index; if (!glamor_priv->xv_prog.prog) glamor_init_xv_shader(screen); cont = RTFContrast(port_priv->contrast); bright = RTFBrightness(port_priv->brightness); gamma = (float) port_priv->gamma / 1000.0; uvcosf = RTFSaturation(port_priv->saturation) * cos(RTFHue(port_priv->hue)); uvsinf = RTFSaturation(port_priv->saturation) * sin(RTFHue(port_priv->hue)); /* overlay video also does pre-gamma contrast/sat adjust, should we? */ yco = trans[ref].RefLuma * cont; uco[0] = -trans[ref].RefRCr * uvsinf; uco[1] = trans[ref].RefGCb * uvcosf - trans[ref].RefGCr * uvsinf; uco[2] = trans[ref].RefBCb * uvcosf; vco[0] = trans[ref].RefRCr * uvcosf; vco[1] = trans[ref].RefGCb * uvsinf + trans[ref].RefGCr * uvcosf; vco[2] = trans[ref].RefBCb * uvsinf; off[0] = Loff * yco + Coff * (uco[0] + vco[0]) + bright; off[1] = Loff * yco + Coff * (uco[1] + vco[1]) + bright; off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright; gamma = 1.0; glamor_set_alu(screen, GXcopy); for (i = 0; i < 3; i++) { if (port_priv->src_pix[i]) { src_pixmap_priv[i] = glamor_get_pixmap_private(port_priv->src_pix[i]); pixmap_priv_get_scale(src_pixmap_priv[i], &src_xscale[i], &src_yscale[i]); } } glamor_make_current(glamor_priv); glUseProgram(glamor_priv->xv_prog.prog); uloc = glGetUniformLocation(glamor_priv->xv_prog.prog, "offsetyco"); glUniform4f(uloc, off[0], off[1], off[2], yco); uloc = glGetUniformLocation(glamor_priv->xv_prog.prog, "ucogamma"); glUniform4f(uloc, uco[0], uco[1], uco[2], gamma); uloc = glGetUniformLocation(glamor_priv->xv_prog.prog, "vco"); glUniform4f(uloc, vco[0], vco[1], vco[2], 0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->fbo->tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->fbo->tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->fbo->tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glEnable(GL_SCISSOR_TEST); v = glamor_get_vbo_space(screen, 3 * 4 * sizeof(GLfloat), &vbo_offset); /* Set up a single primitive covering the area being drawn. We'll * clip it to port_priv->clip using GL scissors instead of just * emitting a GL_QUAD per box, because this way we hopefully avoid * diagonal tearing between the two trangles used to rasterize a * GL_QUAD. */ i = 0; v[i++] = port_priv->drw_x; v[i++] = port_priv->drw_y; v[i++] = port_priv->drw_x + port_priv->dst_w * 2; v[i++] = port_priv->drw_y; v[i++] = port_priv->drw_x; v[i++] = port_priv->drw_y + port_priv->dst_h * 2; v[i++] = t_from_x_coord_x(src_xscale[0], port_priv->src_x); v[i++] = t_from_x_coord_y(src_yscale[0], port_priv->src_y); v[i++] = t_from_x_coord_x(src_xscale[0], port_priv->src_x + port_priv->src_w * 2); v[i++] = t_from_x_coord_y(src_yscale[0], port_priv->src_y); v[i++] = t_from_x_coord_x(src_xscale[0], port_priv->src_x); v[i++] = t_from_x_coord_y(src_yscale[0], port_priv->src_y + port_priv->src_h * 2); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), vbo_offset); glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), vbo_offset + 6 * sizeof(GLfloat)); glamor_put_vbo_space(screen); /* Now draw our big triangle, clipped to each of the clip boxes. */ glamor_pixmap_loop(pixmap_priv, dst_box_index) { int dst_off_x, dst_off_y; glamor_set_destination_drawable(port_priv->pDraw, dst_box_index, FALSE, FALSE, glamor_priv->xv_prog.matrix_uniform, &dst_off_x, &dst_off_y); for (i = 0; i < nBox; i++) { int dstx, dsty, dstw, dsth; dstx = box[i].x1 + dst_off_x; dsty = box[i].y1 + dst_off_y; dstw = box[i].x2 - box[i].x1; dsth = box[i].y2 - box[i].y1; glScissor(dstx, dsty, dstw, dsth); glDrawArrays(GL_TRIANGLE_FAN, 0, 3); } } glDisable(GL_SCISSOR_TEST); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); DamageDamageRegion(port_priv->pDraw, &port_priv->clip); glamor_xv_free_port_data(port_priv); } int glamor_xv_put_image(glamor_port_private *port_priv, DrawablePtr pDrawable, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int id, unsigned char *buf, short width, short height, Bool sync, RegionPtr clipBoxes) { ScreenPtr pScreen = pDrawable->pScreen; int srcPitch, srcPitch2; int top, nlines; int s2offset, s3offset, tmp; BoxRec full_box, half_box; s2offset = s3offset = srcPitch2 = 0; if (!port_priv->src_pix[0] || (width != port_priv->src_pix_w || height != port_priv->src_pix_h)) { int i; for (i = 0; i < 3; i++) if (port_priv->src_pix[i]) glamor_destroy_pixmap(port_priv->src_pix[i]); port_priv->src_pix[0] = glamor_create_pixmap(pScreen, width, height, 8, GLAMOR_CREATE_FBO_NO_FBO); port_priv->src_pix[1] = glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, GLAMOR_CREATE_FBO_NO_FBO); port_priv->src_pix[2] = glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, GLAMOR_CREATE_FBO_NO_FBO); port_priv->src_pix_w = width; port_priv->src_pix_h = height; if (!port_priv->src_pix[0] || !port_priv->src_pix[1] || !port_priv->src_pix[2]) return BadAlloc; } top = (src_y) & ~1; nlines = (src_y + src_h) - top; switch (id) { case FOURCC_YV12: case FOURCC_I420: srcPitch = ALIGN(width, 4); srcPitch2 = ALIGN(width >> 1, 4); s2offset = srcPitch * height; s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1)); s2offset += ((top >> 1) * srcPitch2); s3offset += ((top >> 1) * srcPitch2); if (id == FOURCC_YV12) { tmp = s2offset; s2offset = s3offset; s3offset = tmp; } full_box.x1 = 0; full_box.y1 = 0; full_box.x2 = width; full_box.y2 = nlines; half_box.x1 = 0; half_box.y1 = 0; half_box.x2 = width >> 1; half_box.y2 = (nlines + 1) >> 1; glamor_upload_boxes(port_priv->src_pix[0], &full_box, 1, 0, 0, 0, 0, buf + (top * srcPitch), srcPitch); glamor_upload_boxes(port_priv->src_pix[1], &half_box, 1, 0, 0, 0, 0, buf + s2offset, srcPitch2); glamor_upload_boxes(port_priv->src_pix[2], &half_box, 1, 0, 0, 0, 0, buf + s3offset, srcPitch2); break; default: return BadMatch; } if (pDrawable->type == DRAWABLE_WINDOW) port_priv->pPixmap = pScreen->GetWindowPixmap((WindowPtr) pDrawable); else port_priv->pPixmap = (PixmapPtr) pDrawable; RegionCopy(&port_priv->clip, clipBoxes); port_priv->src_x = src_x; port_priv->src_y = src_y - top; port_priv->src_w = src_w; port_priv->src_h = src_h; port_priv->dst_w = drw_w; port_priv->dst_h = drw_h; port_priv->drw_x = drw_x; port_priv->drw_y = drw_y; port_priv->w = width; port_priv->h = height; port_priv->pDraw = pDrawable; glamor_xv_render(port_priv); return Success; } void glamor_xv_init_port(glamor_port_private *port_priv) { port_priv->brightness = 0; port_priv->contrast = 0; port_priv->saturation = 0; port_priv->hue = 0; port_priv->gamma = 1000; port_priv->transform_index = 0; REGION_NULL(pScreen, &port_priv->clip); } void glamor_xv_core_init(ScreenPtr screen) { glamorBrightness = MAKE_ATOM("XV_BRIGHTNESS"); glamorContrast = MAKE_ATOM("XV_CONTRAST"); glamorSaturation = MAKE_ATOM("XV_SATURATION"); glamorHue = MAKE_ATOM("XV_HUE"); glamorGamma = MAKE_ATOM("XV_GAMMA"); glamorColorspace = MAKE_ATOM("XV_COLORSPACE"); } xorg-server-1.20.8/glamor/glamor_render.c0000644000175000017500000017627513640201473015275 00000000000000/* * Copyright © 2009 Intel Corporation * * 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. * * Authors: * Eric Anholt * Zhigang Gong * Junyan He * */ /** @file glamor_render.c * * Render acceleration implementation */ #include "glamor_priv.h" #include "mipict.h" #include "fbpict.h" #if 0 //#define DEBUGF(str, ...) do {} while(0) #define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) //#define DEBUGRegionPrint(x) do {} while (0) #define DEBUGRegionPrint RegionPrint #endif static struct blendinfo composite_op_info[] = { [PictOpClear] = {0, 0, GL_ZERO, GL_ZERO}, [PictOpSrc] = {0, 0, GL_ONE, GL_ZERO}, [PictOpDst] = {0, 0, GL_ZERO, GL_ONE}, [PictOpOver] = {0, 1, GL_ONE, GL_ONE_MINUS_SRC_ALPHA}, [PictOpOverReverse] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ONE}, [PictOpIn] = {1, 0, GL_DST_ALPHA, GL_ZERO}, [PictOpInReverse] = {0, 1, GL_ZERO, GL_SRC_ALPHA}, [PictOpOut] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ZERO}, [PictOpOutReverse] = {0, 1, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA}, [PictOpAtop] = {1, 1, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, [PictOpAtopReverse] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA}, [PictOpXor] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, [PictOpAdd] = {0, 0, GL_ONE, GL_ONE}, }; #define RepeatFix 10 static GLuint glamor_create_composite_fs(struct shader_key *key) { const char *repeat_define = "#define RepeatNone 0\n" "#define RepeatNormal 1\n" "#define RepeatPad 2\n" "#define RepeatReflect 3\n" "#define RepeatFix 10\n" "uniform int source_repeat_mode;\n" "uniform int mask_repeat_mode;\n"; const char *relocate_texture = "vec2 rel_tex_coord(vec2 texture, vec4 wh, int repeat) \n" "{\n" " vec2 rel_tex; \n" " rel_tex = texture * wh.xy; \n" " if (repeat == RepeatFix + RepeatNone)\n" " return rel_tex; \n" " else if (repeat == RepeatFix + RepeatNormal) \n" " rel_tex = floor(rel_tex) + (fract(rel_tex) / wh.xy); \n" " else if (repeat == RepeatFix + RepeatPad) { \n" " if (rel_tex.x >= 1.0) \n" " rel_tex.x = 1.0 - wh.z * wh.x / 2.; \n" " else if (rel_tex.x < 0.0) \n" " rel_tex.x = 0.0; \n" " if (rel_tex.y >= 1.0) \n" " rel_tex.y = 1.0 - wh.w * wh.y / 2.; \n" " else if (rel_tex.y < 0.0) \n" " rel_tex.y = 0.0; \n" " rel_tex = rel_tex / wh.xy; \n" " } else if (repeat == RepeatFix + RepeatReflect) {\n" " if ((1.0 - mod(abs(floor(rel_tex.x)), 2.0)) < 0.001)\n" " rel_tex.x = 2.0 - (1.0 - fract(rel_tex.x)) / wh.x;\n" " else \n" " rel_tex.x = fract(rel_tex.x) / wh.x;\n" " if ((1.0 - mod(abs(floor(rel_tex.y)), 2.0)) < 0.001)\n" " rel_tex.y = 2.0 - (1.0 - fract(rel_tex.y)) / wh.y;\n" " else \n" " rel_tex.y = fract(rel_tex.y) / wh.y;\n" " } \n" " return rel_tex; \n" "}\n"; /* The texture and the pixmap size is not match eaxctly, so can't sample it directly. * rel_sampler will recalculate the texture coords.*/ const char *rel_sampler = " vec4 rel_sampler_rgba(sampler2D tex_image, vec2 tex, vec4 wh, int repeat)\n" "{\n" " if (repeat >= RepeatFix) {\n" " tex = rel_tex_coord(tex, wh, repeat);\n" " if (repeat == RepeatFix + RepeatNone) {\n" " if (tex.x < 0.0 || tex.x >= 1.0 || \n" " tex.y < 0.0 || tex.y >= 1.0)\n" " return vec4(0.0, 0.0, 0.0, 0.0);\n" " tex = (fract(tex) / wh.xy);\n" " }\n" " }\n" " return texture2D(tex_image, tex);\n" "}\n" " vec4 rel_sampler_rgbx(sampler2D tex_image, vec2 tex, vec4 wh, int repeat)\n" "{\n" " if (repeat >= RepeatFix) {\n" " tex = rel_tex_coord(tex, wh, repeat);\n" " if (repeat == RepeatFix + RepeatNone) {\n" " if (tex.x < 0.0 || tex.x >= 1.0 || \n" " tex.y < 0.0 || tex.y >= 1.0)\n" " return vec4(0.0, 0.0, 0.0, 0.0);\n" " tex = (fract(tex) / wh.xy);\n" " }\n" " }\n" " return vec4(texture2D(tex_image, tex).rgb, 1.0);\n" "}\n"; const char *source_solid_fetch = "uniform vec4 source;\n" "vec4 get_source()\n" "{\n" " return source;\n" "}\n"; const char *source_alpha_pixmap_fetch = "varying vec2 source_texture;\n" "uniform sampler2D source_sampler;\n" "uniform vec4 source_wh;" "vec4 get_source()\n" "{\n" " return rel_sampler_rgba(source_sampler, source_texture,\n" " source_wh, source_repeat_mode);\n" "}\n"; const char *source_pixmap_fetch = "varying vec2 source_texture;\n" "uniform sampler2D source_sampler;\n" "uniform vec4 source_wh;\n" "vec4 get_source()\n" "{\n" " return rel_sampler_rgbx(source_sampler, source_texture,\n" " source_wh, source_repeat_mode);\n" "}\n"; const char *mask_none = "vec4 get_mask()\n" "{\n" " return vec4(0.0, 0.0, 0.0, 1.0);\n" "}\n"; const char *mask_solid_fetch = "uniform vec4 mask;\n" "vec4 get_mask()\n" "{\n" " return mask;\n" "}\n"; const char *mask_alpha_pixmap_fetch = "varying vec2 mask_texture;\n" "uniform sampler2D mask_sampler;\n" "uniform vec4 mask_wh;\n" "vec4 get_mask()\n" "{\n" " return rel_sampler_rgba(mask_sampler, mask_texture,\n" " mask_wh, mask_repeat_mode);\n" "}\n"; const char *mask_pixmap_fetch = "varying vec2 mask_texture;\n" "uniform sampler2D mask_sampler;\n" "uniform vec4 mask_wh;\n" "vec4 get_mask()\n" "{\n" " return rel_sampler_rgbx(mask_sampler, mask_texture,\n" " mask_wh, mask_repeat_mode);\n" "}\n"; const char *dest_swizzle_default = "vec4 dest_swizzle(vec4 color)\n" "{" " return color;" "}"; const char *dest_swizzle_alpha_to_red = "vec4 dest_swizzle(vec4 color)\n" "{" " float undef;\n" " return vec4(color.a, undef, undef, undef);" "}"; const char *in_normal = "void main()\n" "{\n" " gl_FragColor = dest_swizzle(get_source() * get_mask().a);\n" "}\n"; const char *in_ca_source = "void main()\n" "{\n" " gl_FragColor = dest_swizzle(get_source() * get_mask());\n" "}\n"; const char *in_ca_alpha = "void main()\n" "{\n" " gl_FragColor = dest_swizzle(get_source().a * get_mask());\n" "}\n"; const char *in_ca_dual_blend = "out vec4 color0;\n" "out vec4 color1;\n" "void main()\n" "{\n" " color0 = dest_swizzle(get_source() * get_mask());\n" " color1 = dest_swizzle(get_source().a * get_mask());\n" "}\n"; const char *header_ca_dual_blend = "#version 130\n"; char *source; const char *source_fetch; const char *mask_fetch = ""; const char *in; const char *header; const char *header_norm = ""; const char *dest_swizzle; GLuint prog; switch (key->source) { case SHADER_SOURCE_SOLID: source_fetch = source_solid_fetch; break; case SHADER_SOURCE_TEXTURE_ALPHA: source_fetch = source_alpha_pixmap_fetch; break; case SHADER_SOURCE_TEXTURE: source_fetch = source_pixmap_fetch; break; default: FatalError("Bad composite shader source"); } switch (key->mask) { case SHADER_MASK_NONE: mask_fetch = mask_none; break; case SHADER_MASK_SOLID: mask_fetch = mask_solid_fetch; break; case SHADER_MASK_TEXTURE_ALPHA: mask_fetch = mask_alpha_pixmap_fetch; break; case SHADER_MASK_TEXTURE: mask_fetch = mask_pixmap_fetch; break; default: FatalError("Bad composite shader mask"); } /* If we're storing to an a8 texture but our texture format is * GL_RED because of a core context, then we need to make sure to * put the alpha into the red channel. */ switch (key->dest_swizzle) { case SHADER_DEST_SWIZZLE_DEFAULT: dest_swizzle = dest_swizzle_default; break; case SHADER_DEST_SWIZZLE_ALPHA_TO_RED: dest_swizzle = dest_swizzle_alpha_to_red; break; default: FatalError("Bad composite shader dest swizzle"); } header = header_norm; switch (key->in) { case glamor_program_alpha_normal: in = in_normal; break; case glamor_program_alpha_ca_first: in = in_ca_source; break; case glamor_program_alpha_ca_second: in = in_ca_alpha; break; case glamor_program_alpha_dual_blend: in = in_ca_dual_blend; header = header_ca_dual_blend; break; default: FatalError("Bad composite IN type"); } XNFasprintf(&source, "%s" GLAMOR_DEFAULT_PRECISION "%s%s%s%s%s%s%s", header, repeat_define, relocate_texture, rel_sampler, source_fetch, mask_fetch, dest_swizzle, in); prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source); free(source); return prog; } static GLuint glamor_create_composite_vs(struct shader_key *key) { const char *main_opening = "attribute vec4 v_position;\n" "attribute vec4 v_texcoord0;\n" "attribute vec4 v_texcoord1;\n" "varying vec2 source_texture;\n" "varying vec2 mask_texture;\n" "void main()\n" "{\n" " gl_Position = v_position;\n"; const char *source_coords = " source_texture = v_texcoord0.xy;\n"; const char *mask_coords = " mask_texture = v_texcoord1.xy;\n"; const char *main_closing = "}\n"; const char *source_coords_setup = ""; const char *mask_coords_setup = ""; char *source; GLuint prog; if (key->source != SHADER_SOURCE_SOLID) source_coords_setup = source_coords; if (key->mask != SHADER_MASK_NONE && key->mask != SHADER_MASK_SOLID) mask_coords_setup = mask_coords; XNFasprintf(&source, "%s%s%s%s", main_opening, source_coords_setup, mask_coords_setup, main_closing); prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, source); free(source); return prog; } static void glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key, glamor_composite_shader *shader) { GLuint vs, fs, prog; GLint source_sampler_uniform_location, mask_sampler_uniform_location; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); vs = glamor_create_composite_vs(key); if (vs == 0) return; fs = glamor_create_composite_fs(key); if (fs == 0) return; prog = glCreateProgram(); glAttachShader(prog, vs); glAttachShader(prog, fs); glBindAttribLocation(prog, GLAMOR_VERTEX_POS, "v_position"); glBindAttribLocation(prog, GLAMOR_VERTEX_SOURCE, "v_texcoord0"); glBindAttribLocation(prog, GLAMOR_VERTEX_MASK, "v_texcoord1"); if (key->in == glamor_program_alpha_dual_blend) { glBindFragDataLocationIndexed(prog, 0, 0, "color0"); glBindFragDataLocationIndexed(prog, 0, 1, "color1"); } glamor_link_glsl_prog(screen, prog, "composite"); shader->prog = prog; glUseProgram(prog); if (key->source == SHADER_SOURCE_SOLID) { shader->source_uniform_location = glGetUniformLocation(prog, "source"); } else { source_sampler_uniform_location = glGetUniformLocation(prog, "source_sampler"); glUniform1i(source_sampler_uniform_location, 0); shader->source_wh = glGetUniformLocation(prog, "source_wh"); shader->source_repeat_mode = glGetUniformLocation(prog, "source_repeat_mode"); } if (key->mask != SHADER_MASK_NONE) { if (key->mask == SHADER_MASK_SOLID) { shader->mask_uniform_location = glGetUniformLocation(prog, "mask"); } else { mask_sampler_uniform_location = glGetUniformLocation(prog, "mask_sampler"); glUniform1i(mask_sampler_uniform_location, 1); shader->mask_wh = glGetUniformLocation(prog, "mask_wh"); shader->mask_repeat_mode = glGetUniformLocation(prog, "mask_repeat_mode"); } } } static glamor_composite_shader * glamor_lookup_composite_shader(ScreenPtr screen, struct shader_key *key) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_composite_shader *shader; shader = &glamor_priv->composite_shader[key->source][key->mask][key->in][key->dest_swizzle]; if (shader->prog == 0) glamor_create_composite_shader(screen, key, shader); return shader; } static GLenum glamor_translate_blend_alpha_to_red(GLenum blend) { switch (blend) { case GL_SRC_ALPHA: return GL_SRC_COLOR; case GL_DST_ALPHA: return GL_DST_COLOR; case GL_ONE_MINUS_SRC_ALPHA: return GL_ONE_MINUS_SRC_COLOR; case GL_ONE_MINUS_DST_ALPHA: return GL_ONE_MINUS_DST_COLOR; default: return blend; } } static Bool glamor_set_composite_op(ScreenPtr screen, CARD8 op, struct blendinfo *op_info_result, PicturePtr dest, PicturePtr mask, enum ca_state ca_state, struct shader_key *key) { GLenum source_blend, dest_blend; struct blendinfo *op_info; if (op >= ARRAY_SIZE(composite_op_info)) { glamor_fallback("unsupported render op %d \n", op); return GL_FALSE; } op_info = &composite_op_info[op]; source_blend = op_info->source_blend; dest_blend = op_info->dest_blend; /* If there's no dst alpha channel, adjust the blend op so that we'll treat * it as always 1. */ if (PICT_FORMAT_A(dest->format) == 0 && op_info->dest_alpha) { if (source_blend == GL_DST_ALPHA) source_blend = GL_ONE; else if (source_blend == GL_ONE_MINUS_DST_ALPHA) source_blend = GL_ZERO; } /* Set up the source alpha value for blending in component alpha mode. */ if (ca_state == CA_DUAL_BLEND) { switch (dest_blend) { case GL_SRC_ALPHA: dest_blend = GL_SRC1_COLOR; break; case GL_ONE_MINUS_SRC_ALPHA: dest_blend = GL_ONE_MINUS_SRC1_COLOR; break; } } else if (mask && mask->componentAlpha && PICT_FORMAT_RGB(mask->format) != 0 && op_info->source_alpha) { switch (dest_blend) { case GL_SRC_ALPHA: dest_blend = GL_SRC_COLOR; break; case GL_ONE_MINUS_SRC_ALPHA: dest_blend = GL_ONE_MINUS_SRC_COLOR; break; } } /* If we're outputting our alpha to the red channel, then any * reads of alpha for blending need to come from the red channel. */ if (key->dest_swizzle == SHADER_DEST_SWIZZLE_ALPHA_TO_RED) { source_blend = glamor_translate_blend_alpha_to_red(source_blend); dest_blend = glamor_translate_blend_alpha_to_red(dest_blend); } op_info_result->source_blend = source_blend; op_info_result->dest_blend = dest_blend; op_info_result->source_alpha = op_info->source_alpha; op_info_result->dest_alpha = op_info->dest_alpha; return TRUE; } static void glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, PicturePtr picture, PixmapPtr pixmap, GLuint wh_location, GLuint repeat_location, glamor_pixmap_private *dest_priv) { glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_pixmap_fbo *fbo = pixmap_priv->fbo; float wh[4]; int repeat_type; glamor_make_current(glamor_priv); /* The red channel swizzling doesn't depend on whether we're using * 'fbo' as source or mask as we must have the same answer in case * the same fbo is being used for both. That means the mask * channel will sometimes get red bits in the R channel, and * sometimes get zero bits in the R channel, which is harmless. */ glamor_bind_texture(glamor_priv, GL_TEXTURE0 + unit, fbo, glamor_fbo_red_is_alpha(glamor_priv, dest_priv->fbo)); repeat_type = picture->repeatType; switch (picture->repeatType) { case RepeatNone: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); break; case RepeatNormal: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); break; case RepeatPad: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); break; case RepeatReflect: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); break; } switch (picture->filter) { default: case PictFilterFast: case PictFilterNearest: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); break; case PictFilterGood: case PictFilterBest: case PictFilterBilinear: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); break; } /* Handle RepeatNone in the shader when the source is missing the * alpha channel, as GL will return an alpha for 1 if the texture * is RGB (no alpha), which we use for 16bpp textures. */ if (glamor_pixmap_priv_is_large(pixmap_priv) || (!PICT_FORMAT_A(picture->format) && repeat_type == RepeatNone && picture->transform)) { glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, pixmap_priv); glUniform4fv(wh_location, 1, wh); repeat_type += RepeatFix; } glUniform1i(repeat_location, repeat_type); } static void glamor_set_composite_solid(float *color, GLint uniform_location) { glUniform4fv(uniform_location, 1, color); } static char glamor_get_picture_location(PicturePtr picture) { if (picture == NULL) return ' '; if (picture->pDrawable == NULL) { switch (picture->pSourcePict->type) { case SourcePictTypeSolidFill: return 'c'; case SourcePictTypeLinear: return 'l'; case SourcePictTypeRadial: return 'r'; default: return '?'; } } return glamor_get_drawable_location(picture->pDrawable); } static void * glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); int vert_size; char *vbo_offset; float *vb; glamor_priv->render_nr_quads = 0; glamor_priv->vb_stride = 2 * sizeof(float); if (glamor_priv->has_source_coords) glamor_priv->vb_stride += 2 * sizeof(float); if (glamor_priv->has_mask_coords) glamor_priv->vb_stride += 2 * sizeof(float); vert_size = n_verts * glamor_priv->vb_stride; glamor_make_current(glamor_priv); vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); if (glamor_priv->has_source_coords) { glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, vbo_offset + 2 * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); } if (glamor_priv->has_mask_coords) { glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, vbo_offset + (glamor_priv->has_source_coords ? 4 : 2) * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_MASK); } return vb; } static void glamor_flush_composite_rects(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_make_current(glamor_priv); if (!glamor_priv->render_nr_quads) return; glamor_glDrawArrays_GL_QUADS(glamor_priv, glamor_priv->render_nr_quads); } static const int pict_format_combine_tab[][3] = { {PICT_TYPE_ARGB, PICT_TYPE_A, PICT_TYPE_ARGB}, {PICT_TYPE_ABGR, PICT_TYPE_A, PICT_TYPE_ABGR}, }; static Bool combine_pict_format(PictFormatShort * des, const PictFormatShort src, const PictFormatShort mask, glamor_program_alpha in_ca) { PictFormatShort new_vis; int src_type, mask_type, src_bpp; int i; if (src == mask) { *des = src; return TRUE; } src_bpp = PICT_FORMAT_BPP(src); assert(src_bpp == PICT_FORMAT_BPP(mask)); new_vis = PICT_FORMAT_VIS(src) | PICT_FORMAT_VIS(mask); switch (in_ca) { case glamor_program_alpha_normal: src_type = PICT_FORMAT_TYPE(src); mask_type = PICT_TYPE_A; break; case glamor_program_alpha_ca_first: src_type = PICT_FORMAT_TYPE(src); mask_type = PICT_FORMAT_TYPE(mask); break; case glamor_program_alpha_ca_second: src_type = PICT_TYPE_A; mask_type = PICT_FORMAT_TYPE(mask); break; case glamor_program_alpha_dual_blend: src_type = PICT_FORMAT_TYPE(src); mask_type = PICT_FORMAT_TYPE(mask); break; default: return FALSE; } if (src_type == mask_type) { *des = PICT_VISFORMAT(src_bpp, src_type, new_vis); return TRUE; } for (i = 0; i < ARRAY_SIZE(pict_format_combine_tab); i++) { if ((src_type == pict_format_combine_tab[i][0] && mask_type == pict_format_combine_tab[i][1]) || (src_type == pict_format_combine_tab[i][1] && mask_type == pict_format_combine_tab[i][0])) { *des = PICT_VISFORMAT(src_bpp, pict_format_combine_tab[i] [2], new_vis); return TRUE; } } return FALSE; } static void glamor_set_normalize_tcoords_generic(PixmapPtr pixmap, glamor_pixmap_private *priv, int repeat_type, float *matrix, float xscale, float yscale, int x1, int y1, int x2, int y2, float *texcoords, int stride) { if (!matrix && repeat_type == RepeatNone) glamor_set_normalize_tcoords_ext(priv, xscale, yscale, x1, y1, x2, y2, texcoords, stride); else if (matrix && repeat_type == RepeatNone) glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, yscale, x1, y1, x2, y2, texcoords, stride); else if (!matrix && repeat_type != RepeatNone) glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type, xscale, yscale, x1, y1, x2, y2, texcoords, stride); else if (matrix && repeat_type != RepeatNone) glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, repeat_type, matrix, xscale, yscale, x1, y1, x2, y2, texcoords, stride); } /** * Returns whether the general composite path supports this picture * format for a pixmap that is permanently stored in an FBO (as * opposed to the dynamic upload path). * * We could support many more formats by using GL_ARB_texture_view to * parse the same bits as different formats. For now, we only support * tweaking whether we sample the alpha bits, or just force them to 1. */ static Bool glamor_render_format_is_supported(PicturePtr picture) { PictFormatShort storage_format; /* Source-only pictures should always work */ if (!picture->pDrawable) return TRUE; storage_format = format_for_depth(picture->pDrawable->depth); switch (picture->format) { case PICT_x2r10g10b10: return storage_format == PICT_x2r10g10b10; case PICT_a8r8g8b8: case PICT_x8r8g8b8: return storage_format == PICT_a8r8g8b8 || storage_format == PICT_x8r8g8b8; case PICT_a8: return storage_format == PICT_a8; default: return FALSE; } } static Bool glamor_composite_choose_shader(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, PixmapPtr source_pixmap, PixmapPtr mask_pixmap, PixmapPtr dest_pixmap, glamor_pixmap_private *source_pixmap_priv, glamor_pixmap_private *mask_pixmap_priv, glamor_pixmap_private *dest_pixmap_priv, struct shader_key *s_key, glamor_composite_shader ** shader, struct blendinfo *op_info, PictFormatShort *psaved_source_format, enum ca_state ca_state) { ScreenPtr screen = dest->pDrawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); Bool source_needs_upload = FALSE; Bool mask_needs_upload = FALSE; PictFormatShort saved_source_format = 0; struct shader_key key; GLfloat source_solid_color[4]; GLfloat mask_solid_color[4]; Bool ret = FALSE; if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) { glamor_fallback("dest has no fbo.\n"); goto fail; } if (!glamor_render_format_is_supported(dest)) { glamor_fallback("Unsupported dest picture format.\n"); goto fail; } memset(&key, 0, sizeof(key)); if (!source) { key.source = SHADER_SOURCE_SOLID; source_solid_color[0] = 0.0; source_solid_color[1] = 0.0; source_solid_color[2] = 0.0; source_solid_color[3] = 0.0; } else if (!source->pDrawable) { SourcePictPtr sp = source->pSourcePict; if (sp->type == SourcePictTypeSolidFill) { key.source = SHADER_SOURCE_SOLID; glamor_get_rgba_from_color(&sp->solidFill.fullcolor, source_solid_color); } else goto fail; } else { if (PICT_FORMAT_A(source->format)) key.source = SHADER_SOURCE_TEXTURE_ALPHA; else key.source = SHADER_SOURCE_TEXTURE; } if (mask) { if (!mask->pDrawable) { SourcePictPtr sp = mask->pSourcePict; if (sp->type == SourcePictTypeSolidFill) { key.mask = SHADER_MASK_SOLID; glamor_get_rgba_from_color(&sp->solidFill.fullcolor, mask_solid_color); } else goto fail; } else { if (PICT_FORMAT_A(mask->format)) key.mask = SHADER_MASK_TEXTURE_ALPHA; else key.mask = SHADER_MASK_TEXTURE; } if (!mask->componentAlpha) { key.in = glamor_program_alpha_normal; } else { if (op == PictOpClear) key.mask = SHADER_MASK_NONE; else if (glamor_priv->has_dual_blend) key.in = glamor_program_alpha_dual_blend; else if (op == PictOpSrc || op == PictOpAdd || op == PictOpIn || op == PictOpOut || op == PictOpOverReverse) key.in = glamor_program_alpha_ca_second; else if (op == PictOpOutReverse || op == PictOpInReverse) { key.in = glamor_program_alpha_ca_first; } else { glamor_fallback("Unsupported component alpha op: %d\n", op); goto fail; } } } else { key.mask = SHADER_MASK_NONE; } if (dest_pixmap->drawable.bitsPerPixel <= 8 && glamor_priv->one_channel_format == GL_RED) { key.dest_swizzle = SHADER_DEST_SWIZZLE_ALPHA_TO_RED; } else { key.dest_swizzle = SHADER_DEST_SWIZZLE_DEFAULT; } if (source && source->alphaMap) { glamor_fallback("source alphaMap\n"); goto fail; } if (mask && mask->alphaMap) { glamor_fallback("mask alphaMap\n"); goto fail; } if (key.source == SHADER_SOURCE_TEXTURE || key.source == SHADER_SOURCE_TEXTURE_ALPHA) { if (source_pixmap == dest_pixmap) { /* XXX source and the dest share the same texture. * Does it need special handle? */ glamor_fallback("source == dest\n"); } if (source_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) { source_needs_upload = TRUE; } } if (key.mask == SHADER_MASK_TEXTURE || key.mask == SHADER_MASK_TEXTURE_ALPHA) { if (mask_pixmap == dest_pixmap) { glamor_fallback("mask == dest\n"); goto fail; } if (mask_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) { mask_needs_upload = TRUE; } } if (source_needs_upload && mask_needs_upload && source_pixmap == mask_pixmap) { if (source->format != mask->format) { saved_source_format = source->format; if (!combine_pict_format(&source->format, source->format, mask->format, key.in)) { glamor_fallback("combine source %x mask %x failed.\n", source->format, mask->format); goto fail; } /* XXX * By default, glamor_upload_picture_to_texture will wire alpha to 1 * if one picture doesn't have alpha. So we don't do that again in * rendering function. But here is a special case, as source and * mask share the same texture but may have different formats. For * example, source doesn't have alpha, but mask has alpha. Then the * texture will have the alpha value for the mask. And will not wire * to 1 for the source. In this case, we have to use different shader * to wire the source's alpha to 1. * * But this may cause a potential problem if the source's repeat mode * is REPEAT_NONE, and if the source is smaller than the dest, then * for the region not covered by the source may be painted incorrectly. * because we wire the alpha to 1. * **/ if (!PICT_FORMAT_A(saved_source_format) && PICT_FORMAT_A(mask->format)) key.source = SHADER_SOURCE_TEXTURE; if (!PICT_FORMAT_A(mask->format) && PICT_FORMAT_A(saved_source_format)) key.mask = SHADER_MASK_TEXTURE; } if (!glamor_upload_picture_to_texture(source)) { glamor_fallback("Failed to upload source texture.\n"); goto fail; } mask_needs_upload = FALSE; } else { if (source_needs_upload) { if (!glamor_upload_picture_to_texture(source)) { glamor_fallback("Failed to upload source texture.\n"); goto fail; } } else { if (source && !glamor_render_format_is_supported(source)) { glamor_fallback("Unsupported source picture format.\n"); goto fail; } } if (mask_needs_upload) { if (!glamor_upload_picture_to_texture(mask)) { glamor_fallback("Failed to upload mask texture.\n"); goto fail; } } else if (mask) { if (!glamor_render_format_is_supported(mask)) { glamor_fallback("Unsupported mask picture format.\n"); goto fail; } } } /* If the source and mask are two differently-formatted views of * the same pixmap bits, and the pixmap was already uploaded (so * the dynamic code above doesn't apply), then fall back to * software. We should use texture views to fix this properly. */ if (source_pixmap && source_pixmap == mask_pixmap && source->format != mask->format) { goto fail; } if (!glamor_set_composite_op(screen, op, op_info, dest, mask, ca_state, &key)) { goto fail; } *shader = glamor_lookup_composite_shader(screen, &key); if ((*shader)->prog == 0) { glamor_fallback("no shader program for this render acccel mode\n"); goto fail; } if (key.source == SHADER_SOURCE_SOLID) memcpy(&(*shader)->source_solid_color[0], source_solid_color, 4 * sizeof(float)); else { (*shader)->source_pixmap = source_pixmap; (*shader)->source = source; } if (key.mask == SHADER_MASK_SOLID) memcpy(&(*shader)->mask_solid_color[0], mask_solid_color, 4 * sizeof(float)); else { (*shader)->mask_pixmap = mask_pixmap; (*shader)->mask = mask; } ret = TRUE; memcpy(s_key, &key, sizeof(key)); *psaved_source_format = saved_source_format; goto done; fail: if (saved_source_format) source->format = saved_source_format; done: return ret; } static void glamor_composite_set_shader_blend(glamor_screen_private *glamor_priv, glamor_pixmap_private *dest_priv, struct shader_key *key, glamor_composite_shader *shader, struct blendinfo *op_info) { glamor_make_current(glamor_priv); glUseProgram(shader->prog); if (key->source == SHADER_SOURCE_SOLID) { glamor_set_composite_solid(shader->source_solid_color, shader->source_uniform_location); } else { glamor_set_composite_texture(glamor_priv, 0, shader->source, shader->source_pixmap, shader->source_wh, shader->source_repeat_mode, dest_priv); } if (key->mask != SHADER_MASK_NONE) { if (key->mask == SHADER_MASK_SOLID) { glamor_set_composite_solid(shader->mask_solid_color, shader->mask_uniform_location); } else { glamor_set_composite_texture(glamor_priv, 1, shader->mask, shader->mask_pixmap, shader->mask_wh, shader->mask_repeat_mode, dest_priv); } } if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) glDisable(GL_COLOR_LOGIC_OP); if (op_info->source_blend == GL_ONE && op_info->dest_blend == GL_ZERO) { glDisable(GL_BLEND); } else { glEnable(GL_BLEND); glBlendFunc(op_info->source_blend, op_info->dest_blend); } } static Bool glamor_composite_with_shader(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, PixmapPtr source_pixmap, PixmapPtr mask_pixmap, PixmapPtr dest_pixmap, glamor_pixmap_private *source_pixmap_priv, glamor_pixmap_private *mask_pixmap_priv, glamor_pixmap_private *dest_pixmap_priv, int nrect, glamor_composite_rect_t *rects, enum ca_state ca_state) { ScreenPtr screen = dest->pDrawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); GLfloat dst_xscale, dst_yscale; GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1; struct shader_key key, key_ca; int dest_x_off, dest_y_off; int source_x_off, source_y_off; int mask_x_off, mask_y_off; PictFormatShort saved_source_format = 0; float src_matrix[9], mask_matrix[9]; float *psrc_matrix = NULL, *pmask_matrix = NULL; int nrect_max; Bool ret = FALSE; glamor_composite_shader *shader = NULL, *shader_ca = NULL; struct blendinfo op_info, op_info_ca; if (!glamor_composite_choose_shader(op, source, mask, dest, source_pixmap, mask_pixmap, dest_pixmap, source_pixmap_priv, mask_pixmap_priv, dest_pixmap_priv, &key, &shader, &op_info, &saved_source_format, ca_state)) { glamor_fallback("glamor_composite_choose_shader failed\n"); goto fail; } if (ca_state == CA_TWO_PASS) { if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest, source_pixmap, mask_pixmap, dest_pixmap, source_pixmap_priv, mask_pixmap_priv, dest_pixmap_priv, &key_ca, &shader_ca, &op_info_ca, &saved_source_format, ca_state)) { glamor_fallback("glamor_composite_choose_shader failed\n"); goto fail; } } glamor_make_current(glamor_priv); glamor_set_destination_pixmap_priv_nc(glamor_priv, dest_pixmap, dest_pixmap_priv); glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv, &key, shader, &op_info); glamor_set_alu(screen, GXcopy); glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID; glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID); dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable); dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap, &dest_x_off, &dest_y_off); pixmap_priv_get_dest_scale(dest_pixmap, dest_pixmap_priv, &dst_xscale, &dst_yscale); if (glamor_priv->has_source_coords) { glamor_get_drawable_deltas(source->pDrawable, source_pixmap, &source_x_off, &source_y_off); pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale); if (source->transform) { psrc_matrix = src_matrix; glamor_picture_get_matrixf(source, psrc_matrix); } } if (glamor_priv->has_mask_coords) { glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap, &mask_x_off, &mask_y_off); pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale); if (mask->transform) { pmask_matrix = mask_matrix; glamor_picture_get_matrixf(mask, pmask_matrix); } } nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4); if (nrect < 100) { BoxRec bounds = glamor_start_rendering_bounds(); for (int i = 0; i < nrect; i++) { BoxRec box = { .x1 = rects[i].x_dst, .y1 = rects[i].y_dst, .x2 = rects[i].x_dst + rects[i].width, .y2 = rects[i].y_dst + rects[i].height, }; glamor_bounds_union_box(&bounds, &box); } if (bounds.x1 >= bounds.x2 || bounds.y1 >= bounds.y2) goto disable_va; glEnable(GL_SCISSOR_TEST); glScissor(bounds.x1 + dest_x_off, bounds.y1 + dest_y_off, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); } while (nrect) { int mrect, rect_processed; int vb_stride; float *vertices; mrect = nrect > nrect_max ? nrect_max : nrect; vertices = glamor_setup_composite_vbo(screen, mrect * 4); rect_processed = mrect; vb_stride = glamor_priv->vb_stride / sizeof(float); while (mrect--) { INT16 x_source; INT16 y_source; INT16 x_mask; INT16 y_mask; INT16 x_dest; INT16 y_dest; CARD16 width; CARD16 height; x_dest = rects->x_dst + dest_x_off; y_dest = rects->y_dst + dest_y_off; x_source = rects->x_src + source_x_off; y_source = rects->y_src + source_y_off; x_mask = rects->x_mask + mask_x_off; y_mask = rects->y_mask + mask_y_off; width = rects->width; height = rects->height; DEBUGF ("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n", x_dest, y_dest, x_source, y_source, x_mask, y_mask, width, height); glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale, dst_yscale, x_dest, y_dest, x_dest + width, y_dest + height, vertices, vb_stride); vertices += 2; if (key.source != SHADER_SOURCE_SOLID) { glamor_set_normalize_tcoords_generic(source_pixmap, source_pixmap_priv, source->repeatType, psrc_matrix, src_xscale, src_yscale, x_source, y_source, x_source + width, y_source + height, vertices, vb_stride); vertices += 2; } if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) { glamor_set_normalize_tcoords_generic(mask_pixmap, mask_pixmap_priv, mask->repeatType, pmask_matrix, mask_xscale, mask_yscale, x_mask, y_mask, x_mask + width, y_mask + height, vertices, vb_stride); vertices += 2; } glamor_priv->render_nr_quads++; rects++; /* We've incremented by one of our 4 verts, now do the other 3. */ vertices += 3 * vb_stride; } glamor_put_vbo_space(screen); glamor_flush_composite_rects(screen); nrect -= rect_processed; if (ca_state == CA_TWO_PASS) { glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv, &key_ca, shader_ca, &op_info_ca); glamor_flush_composite_rects(screen); if (nrect) glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv, &key, shader, &op_info); } } glDisable(GL_SCISSOR_TEST); disable_va: glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); glDisable(GL_BLEND); DEBUGF("finish rendering.\n"); if (saved_source_format) source->format = saved_source_format; ret = TRUE; fail: if (mask_pixmap && glamor_pixmap_is_memory(mask_pixmap)) glamor_pixmap_destroy_fbo(mask_pixmap); if (source_pixmap && glamor_pixmap_is_memory(source_pixmap)) glamor_pixmap_destroy_fbo(source_pixmap); return ret; } static PicturePtr glamor_convert_gradient_picture(ScreenPtr screen, PicturePtr source, int x_source, int y_source, int width, int height) { PixmapPtr pixmap; PicturePtr dst = NULL; int error; PictFormatPtr pFormat; PictFormatShort format; if (source->pDrawable) { pFormat = source->pFormat; format = pFormat->format; } else { format = PICT_a8r8g8b8; pFormat = PictureMatchFormat(screen, 32, format); } if (!source->pDrawable) { if (source->pSourcePict->type == SourcePictTypeLinear) { dst = glamor_generate_linear_gradient_picture(screen, source, x_source, y_source, width, height, format); } else if (source->pSourcePict->type == SourcePictTypeRadial) { dst = glamor_generate_radial_gradient_picture(screen, source, x_source, y_source, width, height, format); } if (dst) { return dst; } } pixmap = glamor_create_pixmap(screen, width, height, PIXMAN_FORMAT_DEPTH(format), GLAMOR_CREATE_PIXMAP_CPU); if (!pixmap) return NULL; dst = CreatePicture(0, &pixmap->drawable, pFormat, 0, 0, serverClient, &error); glamor_destroy_pixmap(pixmap); if (!dst) return NULL; ValidatePicture(dst); fbComposite(PictOpSrc, source, NULL, dst, x_source, y_source, 0, 0, 0, 0, width, height); return dst; } Bool glamor_composite_clipped_region(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, PixmapPtr source_pixmap, PixmapPtr mask_pixmap, PixmapPtr dest_pixmap, RegionPtr region, int x_source, int y_source, int x_mask, int y_mask, int x_dest, int y_dest) { glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap); glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap); glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); glamor_screen_private *glamor_priv = glamor_get_screen_private(dest_pixmap->drawable.pScreen); ScreenPtr screen = dest->pDrawable->pScreen; PicturePtr temp_src = source, temp_mask = mask; PixmapPtr temp_src_pixmap = source_pixmap; PixmapPtr temp_mask_pixmap = mask_pixmap; glamor_pixmap_private *temp_src_priv = source_pixmap_priv; glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv; int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask; BoxPtr extent; glamor_composite_rect_t rect[10]; glamor_composite_rect_t *prect = rect; int prect_size = ARRAY_SIZE(rect); int ok = FALSE; int i; int width; int height; BoxPtr box; int nbox; enum ca_state ca_state = CA_NONE; extent = RegionExtents(region); box = RegionRects(region); nbox = RegionNumRects(region); width = extent->x2 - extent->x1; height = extent->y2 - extent->y1; x_temp_src = x_source; y_temp_src = y_source; x_temp_mask = x_mask; y_temp_mask = y_mask; DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n", x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height); /* Is the composite operation equivalent to a copy? */ if (source && !mask && !source->alphaMap && !dest->alphaMap && source->pDrawable && !source->transform /* CopyArea is only defined with matching depths. */ && dest->pDrawable->depth == source->pDrawable->depth && ((op == PictOpSrc && (source->format == dest->format || (PICT_FORMAT_COLOR(dest->format) && PICT_FORMAT_COLOR(source->format) && dest->format == PICT_FORMAT(PICT_FORMAT_BPP(source->format), PICT_FORMAT_TYPE(source->format), 0, PICT_FORMAT_R(source->format), PICT_FORMAT_G(source->format), PICT_FORMAT_B(source->format))))) || (op == PictOpOver && source->format == dest->format && !PICT_FORMAT_A(source->format))) && x_source >= 0 && y_source >= 0 && (x_source + width) <= source->pDrawable->width && (y_source + height) <= source->pDrawable->height) { x_source += source->pDrawable->x; y_source += source->pDrawable->y; x_dest += dest->pDrawable->x; y_dest += dest->pDrawable->y; glamor_copy(source->pDrawable, dest->pDrawable, NULL, box, nbox, x_source - x_dest, y_source - y_dest, FALSE, FALSE, 0, NULL); ok = TRUE; goto out; } /* XXX is it possible source mask have non-zero drawable.x/y? */ if (source && ((!source->pDrawable && (source->pSourcePict->type != SourcePictTypeSolidFill)) || (source->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv) && (source_pixmap->drawable.width != width || source_pixmap->drawable.height != height)))) { temp_src = glamor_convert_gradient_picture(screen, source, extent->x1 + x_source - x_dest - dest->pDrawable->x, extent->y1 + y_source - y_dest - dest->pDrawable->y, width, height); if (!temp_src) { temp_src = source; goto out; } temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable); temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap); x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x; y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y; } if (mask && ((!mask->pDrawable && (mask->pSourcePict->type != SourcePictTypeSolidFill)) || (mask->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(mask_pixmap_priv) && (mask_pixmap->drawable.width != width || mask_pixmap->drawable.height != height)))) { /* XXX if mask->pDrawable is the same as source->pDrawable, we have an opportunity * to do reduce one conversion. */ temp_mask = glamor_convert_gradient_picture(screen, mask, extent->x1 + x_mask - x_dest - dest->pDrawable->x, extent->y1 + y_mask - y_dest - dest->pDrawable->y, width, height); if (!temp_mask) { temp_mask = mask; goto out; } temp_mask_pixmap = (PixmapPtr) (temp_mask->pDrawable); temp_mask_priv = glamor_get_pixmap_private(temp_mask_pixmap); x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x; y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y; } if (mask && mask->componentAlpha) { if (glamor_priv->has_dual_blend) { ca_state = CA_DUAL_BLEND; } else { if (op == PictOpOver) { if (glamor_pixmap_is_memory(mask_pixmap)) { glamor_fallback("two pass not supported on memory pximaps\n"); goto out; } ca_state = CA_TWO_PASS; op = PictOpOutReverse; } } } if (temp_src_pixmap == dest_pixmap) { glamor_fallback("source and dest pixmaps are the same\n"); goto out; } if (temp_mask_pixmap == dest_pixmap) { glamor_fallback("mask and dest pixmaps are the same\n"); goto out; } x_dest += dest->pDrawable->x; y_dest += dest->pDrawable->y; if (temp_src && temp_src->pDrawable) { x_temp_src += temp_src->pDrawable->x; y_temp_src += temp_src->pDrawable->y; } if (temp_mask && temp_mask->pDrawable) { x_temp_mask += temp_mask->pDrawable->x; y_temp_mask += temp_mask->pDrawable->y; } if (nbox > ARRAY_SIZE(rect)) { prect = calloc(nbox, sizeof(*prect)); if (prect) prect_size = nbox; else { prect = rect; prect_size = ARRAY_SIZE(rect); } } while (nbox) { int box_cnt; box_cnt = nbox > prect_size ? prect_size : nbox; for (i = 0; i < box_cnt; i++) { prect[i].x_src = box[i].x1 + x_temp_src - x_dest; prect[i].y_src = box[i].y1 + y_temp_src - y_dest; prect[i].x_mask = box[i].x1 + x_temp_mask - x_dest; prect[i].y_mask = box[i].y1 + y_temp_mask - y_dest; prect[i].x_dst = box[i].x1; prect[i].y_dst = box[i].y1; prect[i].width = box[i].x2 - box[i].x1; prect[i].height = box[i].y2 - box[i].y1; DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst); } ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest, temp_src_pixmap, temp_mask_pixmap, dest_pixmap, temp_src_priv, temp_mask_priv, dest_pixmap_priv, box_cnt, prect, ca_state); if (!ok) break; nbox -= box_cnt; box += box_cnt; } if (prect != rect) free(prect); out: if (temp_src != source) FreePicture(temp_src, 0); if (temp_mask != mask) FreePicture(temp_mask, 0); return ok; } void glamor_composite(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, INT16 x_source, INT16 y_source, INT16 x_mask, INT16 y_mask, INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height) { ScreenPtr screen = dest->pDrawable->pScreen; PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable); PixmapPtr source_pixmap = NULL, mask_pixmap = NULL; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); RegionRec region; BoxPtr extent; int nbox, ok = FALSE; int force_clip = 0; if (source->pDrawable) { source_pixmap = glamor_get_drawable_pixmap(source->pDrawable); if (glamor_pixmap_drm_only(source_pixmap)) goto fail; } if (mask && mask->pDrawable) { mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable); if (glamor_pixmap_drm_only(mask_pixmap)) goto fail; } DEBUGF ("source pixmap %p (%d %d) mask(%d %d) dest(%d %d) width %d height %d \n", source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height); if (!glamor_pixmap_has_fbo(dest_pixmap)) goto fail; if (op >= ARRAY_SIZE(composite_op_info)) { glamor_fallback("Unsupported composite op %x\n", op); goto fail; } if (mask && mask->componentAlpha && !glamor_priv->has_dual_blend) { if (op == PictOpAtop || op == PictOpAtopReverse || op == PictOpXor || op >= PictOpSaturate) { glamor_fallback("glamor_composite(): component alpha op %x\n", op); goto fail; } } if ((source && source->filter >= PictFilterConvolution) || (mask && mask->filter >= PictFilterConvolution)) { glamor_fallback("glamor_composite(): unsupported filter\n"); goto fail; } if (!miComputeCompositeRegion(®ion, source, mask, dest, x_source + (source_pixmap ? source->pDrawable->x : 0), y_source + (source_pixmap ? source->pDrawable->y : 0), x_mask + (mask_pixmap ? mask->pDrawable->x : 0), y_mask + (mask_pixmap ? mask->pDrawable->y : 0), x_dest + dest->pDrawable->x, y_dest + dest->pDrawable->y, width, height)) { return; } nbox = REGION_NUM_RECTS(®ion); DEBUGF("first clipped when compositing.\n"); DEBUGRegionPrint(®ion); extent = RegionExtents(®ion); if (nbox == 0) return; /* If destination is not a large pixmap, but the region is larger * than texture size limitation, and source or mask is memory pixmap, * then there may be need to load a large memory pixmap to a * texture, and this is not permitted. Then we force to clip the * destination and make sure latter will not upload a large memory * pixmap. */ if (!glamor_check_fbo_size(glamor_priv, extent->x2 - extent->x1, extent->y2 - extent->y1) && glamor_pixmap_is_large(dest_pixmap) && ((source_pixmap && (glamor_pixmap_is_memory(source_pixmap) || source->repeatType == RepeatPad)) || (mask_pixmap && (glamor_pixmap_is_memory(mask_pixmap) || mask->repeatType == RepeatPad)) || (!source_pixmap && (source->pSourcePict->type != SourcePictTypeSolidFill)) || (!mask_pixmap && mask && mask->pSourcePict->type != SourcePictTypeSolidFill))) force_clip = 1; if (force_clip || glamor_pixmap_is_large(dest_pixmap) || (source_pixmap && glamor_pixmap_is_large(source_pixmap)) || (mask_pixmap && glamor_pixmap_is_large(mask_pixmap))) ok = glamor_composite_largepixmap_region(op, source, mask, dest, source_pixmap, mask_pixmap, dest_pixmap, ®ion, force_clip, x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height); else ok = glamor_composite_clipped_region(op, source, mask, dest, source_pixmap, mask_pixmap, dest_pixmap, ®ion, x_source, y_source, x_mask, y_mask, x_dest, y_dest); REGION_UNINIT(dest->pDrawable->pScreen, ®ion); if (ok) return; fail: glamor_fallback ("from picts %p:%p %dx%d / %p:%p %d x %d (%c,%c) to pict %p:%p %dx%d (%c)\n", source, source->pDrawable, source->pDrawable ? source->pDrawable->width : 0, source->pDrawable ? source->pDrawable->height : 0, mask, (!mask) ? NULL : mask->pDrawable, (!mask || !mask->pDrawable) ? 0 : mask->pDrawable->width, (!mask || !mask->pDrawable) ? 0 : mask->pDrawable->height, glamor_get_picture_location(source), glamor_get_picture_location(mask), dest, dest->pDrawable, dest->pDrawable->width, dest->pDrawable->height, glamor_get_picture_location(dest)); if (glamor_prepare_access_picture_box(dest, GLAMOR_ACCESS_RW, x_dest, y_dest, width, height) && glamor_prepare_access_picture_box(source, GLAMOR_ACCESS_RO, x_source, y_source, width, height) && glamor_prepare_access_picture_box(mask, GLAMOR_ACCESS_RO, x_mask, y_mask, width, height)) { fbComposite(op, source, mask, dest, x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height); } glamor_finish_access_picture(mask); glamor_finish_access_picture(source); glamor_finish_access_picture(dest); } xorg-server-1.20.8/glamor/glamor_utils.h0000644000175000017500000006245213640201473015152 00000000000000/* * Copyright © 2009 Intel Corporation * * 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. * * Authors: * Zhigang Gong * */ #ifndef GLAMOR_PRIV_H #error This file can only be included by glamor_priv.h #endif #ifndef __GLAMOR_UTILS_H__ #define __GLAMOR_UTILS_H__ #include "glamor_prepare.h" #include "mipict.h" #define v_from_x_coord_x(_xscale_, _x_) ( 2 * (_x_) * (_xscale_) - 1.0) #define v_from_x_coord_y(_yscale_, _y_) (2 * (_y_) * (_yscale_) - 1.0) #define t_from_x_coord_x(_xscale_, _x_) ((_x_) * (_xscale_)) #define t_from_x_coord_y(_yscale_, _y_) ((_y_) * (_yscale_)) #define pixmap_priv_get_dest_scale(pixmap, _pixmap_priv_, _pxscale_, _pyscale_) \ do { \ int _w_,_h_; \ PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, _pixmap_priv_, _w_, _h_); \ *(_pxscale_) = 1.0 / _w_; \ *(_pyscale_) = 1.0 / _h_; \ } while(0) #define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ do { \ *(_pxscale_) = 1.0 / (_pixmap_priv_)->fbo->width; \ *(_pyscale_) = 1.0 / (_pixmap_priv_)->fbo->height; \ } while(0) #define PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, w, h) \ do { \ if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \ w = priv->box.x2 - priv->box.x1; \ h = priv->box.y2 - priv->box.y1; \ } else { \ w = (pixmap)->drawable.width; \ h = (pixmap)->drawable.height; \ } \ } while(0) #define glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, priv) \ do { \ int actual_w, actual_h; \ PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, actual_w, actual_h); \ wh[0] = (float)priv->fbo->width / actual_w; \ wh[1] = (float)priv->fbo->height / actual_h; \ wh[2] = 1.0 / priv->fbo->width; \ wh[3] = 1.0 / priv->fbo->height; \ } while(0) #define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \ do { \ if (_X_UNLIKELY(_priv_ && glamor_pixmap_priv_is_large(_priv_))) { \ *(_xoff_) = - (_priv_)->box.x1; \ *(_yoff_) = - (_priv_)->box.y1; \ } else { \ *(_xoff_) = 0; \ *(_yoff_) = 0; \ } \ } while(0) #define xFixedToFloat(_val_) ((float)xFixedToInt(_val_) \ + ((float)xFixedFrac(_val_) / 65536.0)) #define glamor_picture_get_matrixf(_picture_, _matrix_) \ do { \ int _i_; \ if ((_picture_)->transform) \ { \ for(_i_ = 0; _i_ < 3; _i_++) \ { \ (_matrix_)[_i_ * 3 + 0] = \ xFixedToFloat((_picture_)->transform->matrix[_i_][0]); \ (_matrix_)[_i_ * 3 + 1] = \ xFixedToFloat((_picture_)->transform->matrix[_i_][1]); \ (_matrix_)[_i_ * 3 + 2] = \ xFixedToFloat((_picture_)->transform->matrix[_i_][2]); \ } \ } \ } while(0) #define fmod(x, w) (x - w * floor((float)x/w)) #define fmodulus(x, w, c) do {c = fmod(x, w); \ c = c >= 0 ? c : c + w;} \ while(0) /* @x: is current coord * @x2: is the right/bottom edge * @w: is current width or height * @odd: is output value, 0 means we are in an even region, 1 means we are in a * odd region. * @c: is output value, equal to x mod w. */ #define fodd_repeat_mod(x, x2, w, odd, c) \ do { \ float shift; \ fmodulus((x), w, c); \ shift = fabs((x) - (c)); \ shift = floor(fabs(round(shift)) / w); \ odd = (int)shift & 1; \ if (odd && (((x2 % w) == 0) && \ round(fabs(x)) == x2)) \ odd = 0; \ } while(0) /* @txy: output value, is the corrected coords. * @xy: input coords to be fixed up. * @cd: xy mod wh, is a input value. * @wh: current width or height. * @bxy1,bxy2: current box edge's x1/x2 or y1/y2 * * case 1: * ---------- * | * | * | | * ---------- * tx = (c - x1) mod w * * case 2: * --------- * * | | * | | * --------- * tx = - (c - (x1 mod w)) * * case 3: * * ---------- * | | * * | | * ---------- * tx = ((x2 mod x) - c) + (x2 - x1) **/ #define __glamor_repeat_reflect_fixup(txy, xy, \ cd, wh, bxy1, bxy2) \ do { \ cd = wh - cd; \ if ( xy >= bxy1 && xy < bxy2) { \ cd = cd - bxy1; \ fmodulus(cd, wh, txy); \ } else if (xy < bxy1) { \ float bxy1_mod; \ fmodulus(bxy1, wh, bxy1_mod); \ txy = -(cd - bxy1_mod); \ } \ else if (xy >= bxy2) { \ float bxy2_mod; \ fmodulus(bxy2, wh, bxy2_mod); \ if (bxy2_mod == 0) \ bxy2_mod = wh; \ txy = (bxy2_mod - cd) + bxy2 - bxy1; \ } else {assert(0); txy = 0;} \ } while(0) #define _glamor_repeat_reflect_fixup(txy, xy, cd, odd, \ wh, bxy1, bxy2) \ do { \ if (odd) { \ __glamor_repeat_reflect_fixup(txy, xy, \ cd, wh, bxy1, bxy2); \ } else \ txy = xy - bxy1; \ } while(0) #define _glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \ tx1, ty1, \ _x1_, _y1_) \ do { \ int odd_x, odd_y; \ float c, d; \ fodd_repeat_mod(_x1_,priv->box.x2, \ (pixmap)->drawable.width, \ odd_x, c); \ fodd_repeat_mod(_y1_, priv->box.y2, \ (pixmap)->drawable.height, \ odd_y, d); \ DEBUGF("c %f d %f oddx %d oddy %d \n", \ c, d, odd_x, odd_y); \ DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \ priv->box.x1, priv->fbo->width); \ DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \ priv->box.y1, priv->fbo->height); \ _glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \ (pixmap)->drawable.width, \ priv->box.x1, priv->box.x2); \ _glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \ (pixmap)->drawable.height, \ priv->box.y1, priv->box.y2); \ } while(0) #define _glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \ ty1, tx2, ty2, \ _x1_, _y1_, _x2_, \ _y2_, c, d, odd_x, odd_y) \ do { \ if (repeat_type == RepeatReflect) { \ DEBUGF("x1 y1 %d %d\n", \ _x1_, _y1_ ); \ DEBUGF("width %d box.x1 %d \n", \ (pixmap)->drawable.width, \ priv->box.x1); \ if (odd_x) { \ c = (pixmap)->drawable.width \ - c; \ tx1 = c - priv->box.x1; \ tx2 = tx1 - ((_x2_) - (_x1_)); \ } else { \ tx1 = c - priv->box.x1; \ tx2 = tx1 + ((_x2_) - (_x1_)); \ } \ if (odd_y){ \ d = (pixmap)->drawable.height\ - d; \ ty1 = d - priv->box.y1; \ ty2 = ty1 - ((_y2_) - (_y1_)); \ } else { \ ty1 = d - priv->box.y1; \ ty2 = ty1 + ((_y2_) - (_y1_)); \ } \ } else { /* RepeatNormal*/ \ tx1 = (c - priv->box.x1); \ ty1 = (d - priv->box.y1); \ tx2 = tx1 + ((_x2_) - (_x1_)); \ ty2 = ty1 + ((_y2_) - (_y1_)); \ } \ } while(0) /* _x1_ ... _y2_ may has fractional. */ #define glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, tx1, \ ty1, _x1_, _y1_) \ do { \ DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \ (pixmap)->drawable.width, \ priv->box.x1, priv->box.x2, priv->box.y1, \ priv->box.y2); \ DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \ if (repeat_type != RepeatReflect) { \ tx1 = _x1_ - priv->box.x1; \ ty1 = _y1_ - priv->box.y1; \ } else \ _glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \ tx1, ty1, \ _x1_, _y1_); \ DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \ } while(0) /* _x1_ ... _y2_ must be integer. */ #define glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \ ty1, tx2, ty2, _x1_, _y1_, _x2_, \ _y2_) \ do { \ int c, d; \ int odd_x = 0, odd_y = 0; \ DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \ (pixmap)->drawable.width, \ priv->box.x1, priv->box.x2, \ priv->box.y1, priv->box.y2); \ modulus((_x1_), (pixmap)->drawable.width, c); \ modulus((_y1_), (pixmap)->drawable.height, d); \ DEBUGF("c %d d %d \n", c, d); \ if (repeat_type == RepeatReflect) { \ odd_x = abs((_x1_ - c) \ / ((pixmap)->drawable.width)) & 1; \ odd_y = abs((_y1_ - d) \ / ((pixmap)->drawable.height)) & 1; \ } \ _glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, ty1, tx2, ty2, \ _x1_, _y1_, _x2_, _y2_, c, d, \ odd_x, odd_y); \ } while(0) #define glamor_transform_point(matrix, tx, ty, x, y) \ do { \ int _i_; \ float _result_[4]; \ for (_i_ = 0; _i_ < 3; _i_++) { \ _result_[_i_] = (matrix)[_i_ * 3] * (x) + (matrix)[_i_ * 3 + 1] * (y) \ + (matrix)[_i_ * 3 + 2]; \ } \ tx = _result_[0] / _result_[2]; \ ty = _result_[1] / _result_[2]; \ } while(0) #define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_, \ texcoord) \ do { \ (texcoord)[0] = t_from_x_coord_x(xscale, _tx_); \ (texcoord)[1] = t_from_x_coord_y(yscale, _ty_); \ DEBUGF("normalized point tx %f ty %f \n", (texcoord)[0], \ (texcoord)[1]); \ } while(0) #define glamor_set_transformed_point(priv, matrix, xscale, \ yscale, texcoord, \ x, y) \ do { \ float tx, ty; \ int fbo_x_off, fbo_y_off; \ pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ glamor_transform_point(matrix, tx, ty, x, y); \ DEBUGF("tx %f ty %f fbooff %d %d \n", \ tx, ty, fbo_x_off, fbo_y_off); \ \ tx += fbo_x_off; \ ty += fbo_y_off; \ (texcoord)[0] = t_from_x_coord_x(xscale, tx); \ (texcoord)[1] = t_from_x_coord_y(yscale, ty); \ DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]); \ } while(0) #define glamor_set_transformed_normalize_tcoords_ext( priv, \ matrix, \ xscale, \ yscale, \ tx1, ty1, tx2, ty2, \ texcoords, \ stride) \ do { \ glamor_set_transformed_point(priv, matrix, xscale, yscale, \ texcoords, tx1, ty1); \ glamor_set_transformed_point(priv, matrix, xscale, yscale, \ texcoords + 1 * stride, tx2, ty1); \ glamor_set_transformed_point(priv, matrix, xscale, yscale, \ texcoords + 2 * stride, tx2, ty2); \ glamor_set_transformed_point(priv, matrix, xscale, yscale, \ texcoords + 3 * stride, tx1, ty2); \ } while (0) #define glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, \ repeat_type, \ matrix, \ xscale, \ yscale, \ _x1_, _y1_, \ _x2_, _y2_, \ texcoords, \ stride) \ do { \ if (_X_LIKELY(glamor_pixmap_priv_is_small(priv))) { \ glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \ yscale, _x1_, _y1_, \ _x2_, _y2_, \ texcoords, stride); \ } else { \ float tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4; \ float ttx1, tty1, ttx2, tty2, ttx3, tty3, ttx4, tty4; \ DEBUGF("original coords %d %d %d %d\n", _x1_, _y1_, _x2_, _y2_); \ glamor_transform_point(matrix, tx1, ty1, _x1_, _y1_); \ glamor_transform_point(matrix, tx2, ty2, _x2_, _y1_); \ glamor_transform_point(matrix, tx3, ty3, _x2_, _y2_); \ glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \ DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \ tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \ ttx1, tty1, \ tx1, ty1); \ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \ ttx2, tty2, \ tx2, ty2); \ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \ ttx3, tty3, \ tx3, ty3); \ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \ ttx4, tty4, \ tx4, ty4); \ DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1, \ ttx2, tty2, ttx3, tty3, ttx4, tty4); \ _glamor_set_normalize_tpoint(xscale, yscale, ttx1, tty1, \ texcoords); \ _glamor_set_normalize_tpoint(xscale, yscale, ttx2, tty2, \ texcoords + 1 * stride); \ _glamor_set_normalize_tpoint(xscale, yscale, ttx3, tty3, \ texcoords + 2 * stride); \ _glamor_set_normalize_tpoint(xscale, yscale, ttx4, tty4, \ texcoords + 3 * stride); \ } \ } while (0) #define glamor_set_repeat_transformed_normalize_tcoords( pixmap, \ priv, \ repeat_type, \ matrix, \ xscale, \ yscale, \ _x1_, _y1_, \ _x2_, _y2_, \ texcoords) \ do { \ glamor_set_repeat_transformed_normalize_tcoords_ext( pixmap, \ priv, \ repeat_type, \ matrix, \ xscale, \ yscale, \ _x1_, _y1_, \ _x2_, _y2_, \ texcoords, \ 2); \ } while (0) #define _glamor_set_normalize_tcoords(xscale, yscale, tx1, \ ty1, tx2, ty2, \ vertices, stride) \ do { \ /* vertices may be write-only, so we use following \ * temporary variable. */ \ float _t0_, _t1_, _t2_, _t5_; \ (vertices)[0] = _t0_ = t_from_x_coord_x(xscale, tx1); \ (vertices)[1 * stride] = _t2_ = t_from_x_coord_x(xscale, tx2); \ (vertices)[2 * stride] = _t2_; \ (vertices)[3 * stride] = _t0_; \ (vertices)[1] = _t1_ = t_from_x_coord_y(yscale, ty1); \ (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y(yscale, ty2); \ (vertices)[1 * stride + 1] = _t1_; \ (vertices)[3 * stride + 1] = _t5_; \ } while(0) #define glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \ x1, y1, x2, y2, \ vertices, stride) \ do { \ if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \ float tx1, tx2, ty1, ty2; \ int fbo_x_off, fbo_y_off; \ pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ tx1 = x1 + fbo_x_off; \ tx2 = x2 + fbo_x_off; \ ty1 = y1 + fbo_y_off; \ ty2 = y2 + fbo_y_off; \ _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \ tx2, ty2, vertices, \ stride); \ } else \ _glamor_set_normalize_tcoords(xscale, yscale, x1, y1, \ x2, y2, vertices, stride); \ } while(0) #define glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type, \ xscale, yscale, \ _x1_, _y1_, _x2_, _y2_, \ vertices, stride) \ do { \ if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \ float tx1, tx2, ty1, ty2; \ if (repeat_type == RepeatPad) { \ tx1 = _x1_ - priv->box.x1; \ ty1 = _y1_ - priv->box.y1; \ tx2 = tx1 + ((_x2_) - (_x1_)); \ ty2 = ty1 + ((_y2_) - (_y1_)); \ } else { \ glamor_get_repeat_coords(pixmap, priv, repeat_type, \ tx1, ty1, tx2, ty2, \ _x1_, _y1_, _x2_, _y2_); \ } \ _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \ tx2, ty2, vertices, \ stride); \ } else \ _glamor_set_normalize_tcoords(xscale, yscale, _x1_, _y1_, \ _x2_, _y2_, vertices, \ stride); \ } while(0) #define glamor_set_normalize_tcoords_tri_stripe(xscale, yscale, \ x1, y1, x2, y2, \ vertices) \ do { \ (vertices)[0] = t_from_x_coord_x(xscale, x1); \ (vertices)[2] = t_from_x_coord_x(xscale, x2); \ (vertices)[6] = (vertices)[2]; \ (vertices)[4] = (vertices)[0]; \ (vertices)[1] = t_from_x_coord_y(yscale, y1); \ (vertices)[7] = t_from_x_coord_y(yscale, y2); \ (vertices)[3] = (vertices)[1]; \ (vertices)[5] = (vertices)[7]; \ } while(0) #define glamor_set_tcoords_tri_strip(x1, y1, x2, y2, vertices) \ do { \ (vertices)[0] = (x1); \ (vertices)[2] = (x2); \ (vertices)[6] = (vertices)[2]; \ (vertices)[4] = (vertices)[0]; \ (vertices)[1] = (y1); \ (vertices)[7] = (y2); \ (vertices)[3] = (vertices)[1]; \ (vertices)[5] = (vertices)[7]; \ } while(0) #define glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \ x1, y1, x2, y2, \ vertices, stride) \ do { \ int fbo_x_off, fbo_y_off; \ /* vertices may be write-only, so we use following \ * temporary variable. */ \ float _t0_, _t1_, _t2_, _t5_; \ pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ (vertices)[0] = _t0_ = v_from_x_coord_x(xscale, x1 + fbo_x_off); \ (vertices)[1 * stride] = _t2_ = v_from_x_coord_x(xscale, \ x2 + fbo_x_off); \ (vertices)[2 * stride] = _t2_; \ (vertices)[3 * stride] = _t0_; \ (vertices)[1] = _t1_ = v_from_x_coord_y(yscale, y1 + fbo_y_off); \ (vertices)[2 * stride + 1] = _t5_ = \ v_from_x_coord_y(yscale, y2 + fbo_y_off); \ (vertices)[1 * stride + 1] = _t1_; \ (vertices)[3 * stride + 1] = _t5_; \ } while(0) #define glamor_set_normalize_vcoords_tri_strip(xscale, yscale, \ x1, y1, x2, y2, \ vertices) \ do { \ (vertices)[0] = v_from_x_coord_x(xscale, x1); \ (vertices)[2] = v_from_x_coord_x(xscale, x2); \ (vertices)[6] = (vertices)[2]; \ (vertices)[4] = (vertices)[0]; \ (vertices)[1] = v_from_x_coord_y(yscale, y1); \ (vertices)[7] = v_from_x_coord_y(yscale, y2); \ (vertices)[3] = (vertices)[1]; \ (vertices)[5] = (vertices)[7]; \ } while(0) #define glamor_set_normalize_pt(xscale, yscale, x, y, \ pt) \ do { \ (pt)[0] = t_from_x_coord_x(xscale, x); \ (pt)[1] = t_from_x_coord_y(yscale, y); \ } while(0) #define glamor_set_circle_centre(width, height, x, y, \ c) \ do { \ (c)[0] = (float)x; \ (c)[1] = (float)y; \ } while(0) #define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define glamor_check_fbo_size(_glamor_,_w_, _h_) ((_w_) > 0 && (_h_) > 0 \ && (_w_) <= _glamor_->max_fbo_size \ && (_h_) <= _glamor_->max_fbo_size) /* For 1bpp pixmap, we don't store it as texture. */ #define glamor_check_pixmap_fbo_depth(_depth_) ( \ _depth_ == 8 \ || _depth_ == 15 \ || _depth_ == 16 \ || _depth_ == 24 \ || _depth_ == 30 \ || _depth_ == 32) #define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL) /** * Borrow from uxa. */ static inline CARD32 format_for_depth(int depth) { switch (depth) { case 1: return PICT_a1; case 4: return PICT_a4; case 8: return PICT_a8; case 15: return PICT_x1r5g5b5; case 16: return PICT_r5g6b5; default: case 24: return PICT_x8r8g8b8; case 30: return PICT_x2r10g10b10; case 32: return PICT_a8r8g8b8; } } static inline GLenum gl_iformat_for_pixmap(PixmapPtr pixmap) { glamor_screen_private *glamor_priv = glamor_get_screen_private((pixmap)->drawable.pScreen); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) { return glamor_priv->one_channel_format; } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && (pixmap)->drawable.depth == 30) { return GL_RGB10_A2; } else { return GL_RGBA; } } static inline CARD32 format_for_pixmap(PixmapPtr pixmap) { return format_for_depth((pixmap)->drawable.depth); } #define REVERT_NONE 0 #define REVERT_NORMAL 1 #define REVERT_UPLOADING_A1 3 #define SWAP_UPLOADING 2 #define SWAP_NONE_UPLOADING 3 /* borrowed from uxa */ static inline Bool glamor_get_rgba_from_pixel(CARD32 pixel, float *red, float *green, float *blue, float *alpha, CARD32 format) { int rbits, bbits, gbits, abits; int rshift, bshift, gshift, ashift; rbits = PICT_FORMAT_R(format); gbits = PICT_FORMAT_G(format); bbits = PICT_FORMAT_B(format); abits = PICT_FORMAT_A(format); if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) { rshift = gshift = bshift = ashift = 0; } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { bshift = 0; gshift = bbits; rshift = gshift + gbits; ashift = rshift + rbits; } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) { rshift = 0; gshift = rbits; bshift = gshift + gbits; ashift = bshift + bbits; } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) { ashift = 0; rshift = abits; if (abits == 0) rshift = PICT_FORMAT_BPP(format) - (rbits + gbits + bbits); gshift = rshift + rbits; bshift = gshift + gbits; } else { return FALSE; } #define COLOR_INT_TO_FLOAT(_fc_, _p_, _s_, _bits_) \ *_fc_ = (((_p_) >> (_s_)) & (( 1 << (_bits_)) - 1)) \ / (float)((1<<(_bits_)) - 1) if (rbits) COLOR_INT_TO_FLOAT(red, pixel, rshift, rbits); else *red = 0; if (gbits) COLOR_INT_TO_FLOAT(green, pixel, gshift, gbits); else *green = 0; if (bbits) COLOR_INT_TO_FLOAT(blue, pixel, bshift, bbits); else *blue = 0; if (abits) COLOR_INT_TO_FLOAT(alpha, pixel, ashift, abits); else *alpha = 1; return TRUE; } static inline void glamor_get_rgba_from_color(const xRenderColor *color, float rgba[4]) { rgba[0] = color->red / (float)UINT16_MAX; rgba[1] = color->green / (float)UINT16_MAX; rgba[2] = color->blue / (float)UINT16_MAX; rgba[3] = color->alpha / (float)UINT16_MAX; } inline static Bool glamor_is_large_pixmap(PixmapPtr pixmap) { glamor_pixmap_private *priv; priv = glamor_get_pixmap_private(pixmap); return (glamor_pixmap_priv_is_large(priv)); } static inline void glamor_make_current(glamor_screen_private *glamor_priv) { if (lastGLContext != glamor_priv->ctx.ctx) { lastGLContext = glamor_priv->ctx.ctx; glamor_priv->ctx.make_current(&glamor_priv->ctx); } } static inline BoxRec glamor_no_rendering_bounds(void) { BoxRec bounds = { .x1 = 0, .y1 = 0, .x2 = MAXSHORT, .y2 = MAXSHORT, }; return bounds; } static inline BoxRec glamor_start_rendering_bounds(void) { BoxRec bounds = { .x1 = MAXSHORT, .y1 = MAXSHORT, .x2 = 0, .y2 = 0, }; return bounds; } static inline void glamor_bounds_union_rect(BoxPtr bounds, xRectangle *rect) { bounds->x1 = min(bounds->x1, rect->x); bounds->y1 = min(bounds->y1, rect->y); bounds->x2 = min(SHRT_MAX, max(bounds->x2, rect->x + rect->width)); bounds->y2 = min(SHRT_MAX, max(bounds->y2, rect->y + rect->height)); } static inline void glamor_bounds_union_box(BoxPtr bounds, BoxPtr box) { bounds->x1 = min(bounds->x1, box->x1); bounds->y1 = min(bounds->y1, box->y1); bounds->x2 = max(bounds->x2, box->x2); bounds->y2 = max(bounds->y2, box->y2); } /** * Helper function for implementing draws with GL_QUADS on GLES2, * where we don't have them. */ static inline void glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count) { if (glamor_priv->use_quads) { glDrawArrays(GL_QUADS, 0, count * 4); } else { glamor_gldrawarrays_quads_using_indices(glamor_priv, count); } } #endif xorg-server-1.20.8/glamor/glamor_debug.h0000644000175000017500000000520013640201473015064 00000000000000/* * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. * * Authors: * Zhigang Gong * */ #ifndef __GLAMOR_DEBUG_H__ #define __GLAMOR_DEBUG_H__ #define GLAMOR_DEBUG_NONE 0 #define GLAMOR_DEBUG_UNIMPL 0 #define GLAMOR_DEBUG_FALLBACK 1 #define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2 #define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3 extern void AbortServer(void) _X_NORETURN; #define GLAMOR_PANIC(_format_, ...) \ do { \ LogMessageVerb(X_NONE, 0, "Glamor Fatal Error" \ " at %32s line %d: " _format_ "\n", \ __FUNCTION__, __LINE__, \ ##__VA_ARGS__ ); \ exit(1); \ } while(0) #define __debug_output_message(_format_, _prefix_, ...) \ LogMessageVerb(X_NONE, 0, \ "%32s:\t" _format_ , \ /*_prefix_,*/ \ __FUNCTION__, \ ##__VA_ARGS__) #define glamor_debug_output(_level_, _format_,...) \ do { \ if (glamor_debug_level >= _level_) \ __debug_output_message(_format_, \ "Glamor debug", \ ##__VA_ARGS__); \ } while(0) #define glamor_fallback(_format_,...) \ do { \ if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) \ __debug_output_message(_format_, \ "Glamor fallback", \ ##__VA_ARGS__);} while(0) #define DEBUGF(str, ...) do {} while(0) //#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) #define DEBUGRegionPrint(x) do {} while (0) //#define DEBUGRegionPrint RegionPrint #endif xorg-server-1.20.8/glamor/glamor_egl_stubs.c0000644000175000017500000000360613640201473015770 00000000000000/* * Copyright © 2013 Intel Corporation * * 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. */ /** @file glamor_egl_stubs.c * * Stubbed out glamor_egl.c functions for servers other than Xorg. */ #include "dix-config.h" #include "glamor.h" void glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) { } int glamor_egl_fd_name_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { return -1; } int glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *offsets, uint32_t *strides, uint64_t *modifier) { return 0; } int glamor_egl_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { return -1; } xorg-server-1.20.8/glamor/glamor_transfer.c0000644000175000017500000002064013640201473015622 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_transfer.h" /* XXX a kludge for now */ void glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) { switch (pixmap->drawable.depth) { case 24: case 32: *format = GL_BGRA; *type = GL_UNSIGNED_INT_8_8_8_8_REV; break; case 30: *format = GL_BGRA; *type = GL_UNSIGNED_INT_2_10_10_10_REV; break; case 16: *format = GL_RGB; *type = GL_UNSIGNED_SHORT_5_6_5; break; case 15: *format = GL_BGRA; *type = GL_UNSIGNED_SHORT_1_5_5_5_REV; break; case 8: *format = glamor_get_screen_private(pixmap->drawable.pScreen)->one_channel_format; *type = GL_UNSIGNED_BYTE; break; default: FatalError("Invalid pixmap depth %d\n", pixmap->drawable.depth); break; } } /* * Write a region of bits into a pixmap */ void glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, int dx_src, int dy_src, int dx_dst, int dy_dst, uint8_t *bits, uint32_t byte_stride) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); int box_index; int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3; GLenum type; GLenum format; glamor_format_for_pixmap(pixmap, &format, &type); glamor_make_current(glamor_priv); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); if (glamor_priv->has_unpack_subimage) glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel); glamor_pixmap_loop(priv, box_index) { BoxPtr box = glamor_pixmap_box_at(priv, box_index); glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(priv, box_index); BoxPtr boxes = in_boxes; int nbox = in_nbox; glamor_bind_texture(glamor_priv, GL_TEXTURE0, fbo, TRUE); while (nbox--) { /* compute drawable coordinates */ int x1 = MAX(boxes->x1 + dx_dst, box->x1); int x2 = MIN(boxes->x2 + dx_dst, box->x2); int y1 = MAX(boxes->y1 + dy_dst, box->y1); int y2 = MIN(boxes->y2 + dy_dst, box->y2); size_t ofs = (y1 - dy_dst + dy_src) * byte_stride; ofs += (x1 - dx_dst + dx_src) * bytes_per_pixel; boxes++; if (x2 <= x1 || y2 <= y1) continue; if (glamor_priv->has_unpack_subimage || x2 - x1 == byte_stride / bytes_per_pixel) { glTexSubImage2D(GL_TEXTURE_2D, 0, x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs); } else { for (; y1 < y2; y1++, ofs += byte_stride) glTexSubImage2D(GL_TEXTURE_2D, 0, x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs); } } } if (glamor_priv->has_unpack_subimage) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } /* * Upload a region of data */ void glamor_upload_region(PixmapPtr pixmap, RegionPtr region, int region_x, int region_y, uint8_t *bits, uint32_t byte_stride) { glamor_upload_boxes(pixmap, RegionRects(region), RegionNumRects(region), -region_x, -region_y, 0, 0, bits, byte_stride); } /* * Take the data in the pixmap and stuff it back into the FBO */ void glamor_upload_pixmap(PixmapPtr pixmap) { BoxRec box; box.x1 = 0; box.x2 = pixmap->drawable.width; box.y1 = 0; box.y2 = pixmap->drawable.height; glamor_upload_boxes(pixmap, &box, 1, 0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind); } /* * Read stuff from the pixmap FBOs and write to memory */ void glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, int dx_src, int dy_src, int dx_dst, int dy_dst, uint8_t *bits, uint32_t byte_stride) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); int box_index; int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3; GLenum type; GLenum format; glamor_format_for_pixmap(pixmap, &format, &type); glamor_make_current(glamor_priv); glPixelStorei(GL_PACK_ALIGNMENT, 4); if (glamor_priv->has_pack_subimage) glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel); glamor_pixmap_loop(priv, box_index) { BoxPtr box = glamor_pixmap_box_at(priv, box_index); glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(priv, box_index); BoxPtr boxes = in_boxes; int nbox = in_nbox; /* This should not be called on GLAMOR_FBO_NO_FBO-allocated pixmaps. */ assert(fbo->fb); glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); while (nbox--) { /* compute drawable coordinates */ int x1 = MAX(boxes->x1 + dx_src, box->x1); int x2 = MIN(boxes->x2 + dx_src, box->x2); int y1 = MAX(boxes->y1 + dy_src, box->y1); int y2 = MIN(boxes->y2 + dy_src, box->y2); size_t ofs = (y1 - dy_src + dy_dst) * byte_stride; ofs += (x1 - dx_src + dx_dst) * bytes_per_pixel; boxes++; if (x2 <= x1 || y2 <= y1) continue; if (glamor_priv->has_pack_subimage || x2 - x1 == byte_stride / bytes_per_pixel) { glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs); } else { for (; y1 < y2; y1++, ofs += byte_stride) glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs); } } } if (glamor_priv->has_pack_subimage) glPixelStorei(GL_PACK_ROW_LENGTH, 0); } /* * Read data from the pixmap FBO */ void glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits) { BoxRec box; box.x1 = x; box.x2 = x + w; box.y1 = y; box.y2 = y + h; glamor_download_boxes(pixmap, &box, 1, 0, 0, -x, -y, bits, PixmapBytePad(w, pixmap->drawable.depth)); } /* * Pull the data from the FBO down to the pixmap */ void glamor_download_pixmap(PixmapPtr pixmap) { BoxRec box; box.x1 = 0; box.x2 = pixmap->drawable.width; box.y1 = 0; box.y2 = pixmap->drawable.height; glamor_download_boxes(pixmap, &box, 1, 0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind); } xorg-server-1.20.8/glamor/glamor_transfer.h0000644000175000017500000000416313640201473015631 00000000000000/* * Copyright © 2014 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 _GLAMOR_TRANSFER_H_ #define _GLAMOR_TRANSFER_H_ void glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type); void glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, int dx_src, int dy_src, int dx_dst, int dy_dst, uint8_t *bits, uint32_t byte_stride); void glamor_upload_region(PixmapPtr pixmap, RegionPtr region, int region_x, int region_y, uint8_t *bits, uint32_t byte_stride); void glamor_upload_pixmap(PixmapPtr pixmap); void glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, int dx_src, int dy_src, int dx_dst, int dy_dst, uint8_t *bits, uint32_t byte_stride); void glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits); void glamor_download_pixmap(PixmapPtr pixmap); #endif /* _GLAMOR_TRANSFER_H_ */ xorg-server-1.20.8/glamor/glamor_rects.c0000644000175000017500000001502113640201473015113 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_program.h" #include "glamor_transform.h" static const glamor_facet glamor_facet_polyfillrect_130 = { .name = "poly_fill_rect", .version = 130, .vs_vars = "attribute vec4 primitive;\n", .vs_exec = (" vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" GLAMOR_POS(gl_Position, (primitive.xy + pos))), }; static const glamor_facet glamor_facet_polyfillrect_120 = { .name = "poly_fill_rect", .vs_vars = "attribute vec2 primitive;\n", .vs_exec = (" vec2 pos = vec2(0,0);\n" GLAMOR_POS(gl_Position, primitive.xy)), }; static Bool glamor_poly_fill_rect_gl(DrawablePtr drawable, GCPtr gc, int nrect, xRectangle *prect) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; glamor_program *prog; int off_x, off_y; GLshort *v; char *vbo_offset; int box_index; Bool ret = FALSE; BoxRec bounds = glamor_no_rendering_bounds(); pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_make_current(glamor_priv); if (nrect < 100) { bounds = glamor_start_rendering_bounds(); for (int i = 0; i < nrect; i++) glamor_bounds_union_rect(&bounds, &prect[i]); } if (glamor_priv->glsl_version >= 130) { prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_fill_rect_program, &glamor_facet_polyfillrect_130); if (!prog) goto bail; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, nrect * sizeof (xRectangle), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE, 4 * sizeof (short), vbo_offset); memcpy(v, prect, nrect * sizeof (xRectangle)); glamor_put_vbo_space(screen); } else { int n; prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_fill_rect_program, &glamor_facet_polyfillrect_120); if (!prog) goto bail; /* Set up the vertex buffers for the points */ v = glamor_get_vbo_space(drawable->pScreen, nrect * 8 * sizeof (short), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 2 * sizeof (short), vbo_offset); for (n = 0; n < nrect; n++) { v[0] = prect->x; v[1] = prect->y; v[2] = prect->x; v[3] = prect->y + prect->height; v[4] = prect->x + prect->width; v[5] = prect->y + prect->height; v[6] = prect->x + prect->width; v[7] = prect->y; prect++; v += 8; } glamor_put_vbo_space(screen); } glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { int nbox = RegionNumRects(gc->pCompositeClip); BoxPtr box = RegionRects(gc->pCompositeClip); if (!glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y)) goto bail; while (nbox--) { BoxRec scissor = { .x1 = max(box->x1, bounds.x1 + drawable->x), .y1 = max(box->y1, bounds.y1 + drawable->y), .x2 = min(box->x2, bounds.x2 + drawable->x), .y2 = min(box->y2, bounds.y2 + drawable->y), }; box++; if (scissor.x1 >= scissor.x2 || scissor.y1 >= scissor.y2) continue; glScissor(scissor.x1 + off_x, scissor.y1 + off_y, scissor.x2 - scissor.x1, scissor.y2 - scissor.y1); if (glamor_priv->glsl_version >= 130) glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect); else { glamor_glDrawArrays_GL_QUADS(glamor_priv, nrect); } } } ret = TRUE; bail: glDisable(GL_SCISSOR_TEST); if (glamor_priv->glsl_version >= 130) glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return ret; } static void glamor_poly_fill_rect_bail(DrawablePtr drawable, GCPtr gc, int nrect, xRectangle *prect) { glamor_fallback("to %p (%c)\n", drawable, glamor_get_drawable_location(drawable)); if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc)) { fbPolyFillRect(drawable, gc, nrect, prect); } glamor_finish_access_gc(gc); glamor_finish_access(drawable); } void glamor_poly_fill_rect(DrawablePtr drawable, GCPtr gc, int nrect, xRectangle *prect) { if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect)) return; glamor_poly_fill_rect_bail(drawable, gc, nrect, prect); } xorg-server-1.20.8/glamor/glamor_image.c0000644000175000017500000001252513640201473015063 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_transfer.h" #include "glamor_transform.h" /* * PutImage. Only does ZPixmap right now as other formats are quite a bit harder */ static Bool glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; uint32_t byte_stride = PixmapBytePad(w, drawable->depth); RegionRec region; BoxRec box; int off_x, off_y; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) return FALSE; if (gc->alu != GXcopy) goto bail; if (!glamor_pm_is_solid(gc->depth, gc->planemask)) goto bail; if (format == XYPixmap && drawable->depth == 1 && leftPad == 0) format = ZPixmap; if (format != ZPixmap) goto bail; x += drawable->x; y += drawable->y; box.x1 = x; box.y1 = y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®ion, &box, 1); RegionIntersect(®ion, ®ion, gc->pCompositeClip); glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); if (off_x || off_y) { x += off_x; y += off_y; RegionTranslate(®ion, off_x, off_y); } glamor_make_current(glamor_priv); glamor_upload_region(pixmap, ®ion, x, y, (uint8_t *) bits, byte_stride); RegionUninit(®ion); return TRUE; bail: return FALSE; } static void glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits) { if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RW, x, y, w, h)) fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits); glamor_finish_access(drawable); } void glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits) { if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits)) return; glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits); } static Bool glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h, unsigned int format, unsigned long plane_mask, char *d) { PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv; uint32_t byte_stride = PixmapBytePad(w, drawable->depth); BoxRec box; int off_x, off_y; pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; if (format != ZPixmap) goto bail; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); box.x1 = x; box.x2 = x + w; box.y1 = y; box.y2 = y + h; glamor_download_boxes(pixmap, &box, 1, drawable->x + off_x, drawable->y + off_y, -x, -y, (uint8_t *) d, byte_stride); if (!glamor_pm_is_solid(drawable->depth, plane_mask)) { FbStip pm = fbReplicatePixel(plane_mask, drawable->bitsPerPixel); FbStip *dst = (void *)d; uint32_t dstStride = byte_stride / sizeof(FbStip); for (int i = 0; i < dstStride * h; i++) dst[i] &= pm; } return TRUE; bail: return FALSE; } static void glamor_get_image_bail(DrawablePtr drawable, int x, int y, int w, int h, unsigned int format, unsigned long plane_mask, char *d) { if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RO, x, y, w, h)) fbGetImage(drawable, x, y, w, h, format, plane_mask, d); glamor_finish_access(drawable); } void glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h, unsigned int format, unsigned long plane_mask, char *d) { if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d)) return; glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d); } xorg-server-1.20.8/glamor/glamor_fbo.c0000644000175000017500000002543213640201473014550 00000000000000/* * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. * * Authors: * Zhigang Gong * */ #include #include "glamor_priv.h" void glamor_destroy_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) { glamor_make_current(glamor_priv); if (fbo->fb) glDeleteFramebuffers(1, &fbo->fb); if (fbo->tex) glDeleteTextures(1, &fbo->tex); free(fbo); } static int glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) { int status, err = 0; glamor_make_current(glamor_priv); if (fbo->fb == 0) glGenFramebuffers(1, &fbo->fb); assert(fbo->tex != 0); glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo->tex, 0); status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { const char *str; switch (status) { case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: str = "incomplete attachment"; break; case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: str = "incomplete/missing attachment"; break; case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: str = "incomplete draw buffer"; break; case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: str = "incomplete read buffer"; break; case GL_FRAMEBUFFER_UNSUPPORTED: str = "unsupported"; break; case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: str = "incomplete multiple"; break; default: str = "unknown error"; break; } glamor_fallback("glamor: Failed to create fbo, %s\n", str); err = -1; } return err; } glamor_pixmap_fbo * glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, int w, int h, GLenum format, GLint tex, int flag) { glamor_pixmap_fbo *fbo; fbo = calloc(1, sizeof(*fbo)); if (fbo == NULL) return NULL; fbo->tex = tex; fbo->width = w; fbo->height = h; fbo->format = format; if (flag != GLAMOR_CREATE_FBO_NO_FBO) { if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) { glamor_destroy_fbo(glamor_priv, fbo); fbo = NULL; } } return fbo; } static int _glamor_create_tex(glamor_screen_private *glamor_priv, int w, int h, GLenum format) { unsigned int tex; GLenum iformat = format; if (format == GL_RGB10_A2) format = GL_RGBA; glamor_make_current(glamor_priv); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); if (format == glamor_priv->one_channel_format && format == GL_RED) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED); glamor_priv->suppress_gl_out_of_memory_logging = true; glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, GL_UNSIGNED_BYTE, NULL); glamor_priv->suppress_gl_out_of_memory_logging = false; if (glGetError() == GL_OUT_OF_MEMORY) { if (!glamor_priv->logged_any_fbo_allocation_failure) { LogMessageVerb(X_WARNING, 0, "glamor: Failed to allocate %dx%d " "FBO due to GL_OUT_OF_MEMORY.\n", w, h); LogMessageVerb(X_WARNING, 0, "glamor: Expect reduced performance.\n"); glamor_priv->logged_any_fbo_allocation_failure = true; } glDeleteTextures(1, &tex); return 0; } return tex; } glamor_pixmap_fbo * glamor_create_fbo(glamor_screen_private *glamor_priv, int w, int h, GLenum format, int flag) { GLint tex = _glamor_create_tex(glamor_priv, w, h, format); if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */ return NULL; return glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag); } /** * Create storage for the w * h region, using FBOs of the GL's maximum * supported size. */ glamor_pixmap_fbo * glamor_create_fbo_array(glamor_screen_private *glamor_priv, int w, int h, GLenum format, int flag, int block_w, int block_h, glamor_pixmap_private *priv) { int block_wcnt; int block_hcnt; glamor_pixmap_fbo **fbo_array; BoxPtr box_array; int i, j; priv->block_w = block_w; priv->block_h = block_h; block_wcnt = (w + block_w - 1) / block_w; block_hcnt = (h + block_h - 1) / block_h; box_array = calloc(block_wcnt * block_hcnt, sizeof(box_array[0])); if (box_array == NULL) return NULL; fbo_array = calloc(block_wcnt * block_hcnt, sizeof(glamor_pixmap_fbo *)); if (fbo_array == NULL) { free(box_array); return FALSE; } for (i = 0; i < block_hcnt; i++) { int block_y1, block_y2; int fbo_w, fbo_h; block_y1 = i * block_h; block_y2 = (block_y1 + block_h) > h ? h : (block_y1 + block_h); fbo_h = block_y2 - block_y1; for (j = 0; j < block_wcnt; j++) { box_array[i * block_wcnt + j].x1 = j * block_w; box_array[i * block_wcnt + j].y1 = block_y1; box_array[i * block_wcnt + j].x2 = (j + 1) * block_w > w ? w : (j + 1) * block_w; box_array[i * block_wcnt + j].y2 = block_y2; fbo_w = box_array[i * block_wcnt + j].x2 - box_array[i * block_wcnt + j].x1; fbo_array[i * block_wcnt + j] = glamor_create_fbo(glamor_priv, fbo_w, fbo_h, format, GLAMOR_CREATE_PIXMAP_FIXUP); if (fbo_array[i * block_wcnt + j] == NULL) goto cleanup; } } priv->box = box_array[0]; priv->box_array = box_array; priv->fbo_array = fbo_array; priv->block_wcnt = block_wcnt; priv->block_hcnt = block_hcnt; return fbo_array[0]; cleanup: for (i = 0; i < block_wcnt * block_hcnt; i++) if (fbo_array[i]) glamor_destroy_fbo(glamor_priv, fbo_array[i]); free(box_array); free(fbo_array); return NULL; } void glamor_pixmap_clear_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) { glamor_make_current(glamor_priv); assert(fbo->fb != 0 && fbo->tex != 0); glamor_set_destination_pixmap_fbo(glamor_priv, fbo, 0, 0, fbo->width, fbo->height); glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); } glamor_pixmap_fbo * glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv) { glamor_pixmap_fbo *fbo; if (pixmap_priv == NULL) return NULL; fbo = pixmap_priv->fbo; if (fbo == NULL) return NULL; pixmap_priv->fbo = NULL; return fbo; } /* The pixmap must not be attached to another fbo. */ void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo) { glamor_pixmap_private *pixmap_priv; pixmap_priv = glamor_get_pixmap_private(pixmap); if (pixmap_priv->fbo) return; pixmap_priv->fbo = fbo; switch (pixmap_priv->type) { case GLAMOR_TEXTURE_ONLY: case GLAMOR_TEXTURE_DRM: pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL; pixmap->devPrivate.ptr = NULL; default: break; } } void glamor_pixmap_destroy_fbo(PixmapPtr pixmap) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); glamor_pixmap_fbo *fbo; if (glamor_pixmap_priv_is_large(priv)) { int i; for (i = 0; i < priv->block_wcnt * priv->block_hcnt; i++) glamor_destroy_fbo(glamor_priv, priv->fbo_array[i]); free(priv->fbo_array); priv->fbo_array = NULL; } else { fbo = glamor_pixmap_detach_fbo(priv); if (fbo) glamor_destroy_fbo(glamor_priv, fbo); } } Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) { glamor_screen_private *glamor_priv; glamor_pixmap_private *pixmap_priv; glamor_pixmap_fbo *fbo; glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); pixmap_priv = glamor_get_pixmap_private(pixmap); if (pixmap_priv->fbo == NULL) { fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width, pixmap->drawable.height, format, flag); if (fbo == NULL) return FALSE; glamor_pixmap_attach_fbo(pixmap, fbo); } else { /* We do have a fbo, but it may lack of fb or tex. */ if (!pixmap_priv->fbo->tex) pixmap_priv->fbo->tex = _glamor_create_tex(glamor_priv, pixmap->drawable.width, pixmap->drawable.height, format); if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0) if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->fbo) != 0) return FALSE; } return TRUE; } _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back) { glamor_pixmap_private *front_priv, *back_priv; glamor_pixmap_fbo *temp_fbo; front_priv = glamor_get_pixmap_private(front); back_priv = glamor_get_pixmap_private(back); temp_fbo = front_priv->fbo; front_priv->fbo = back_priv->fbo; back_priv->fbo = temp_fbo; } xorg-server-1.20.8/glamor/glamor_prepare.c0000644000175000017500000002256713640201473015446 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include "glamor_prepare.h" #include "glamor_transfer.h" /* * Make a pixmap ready to draw with fb by * creating a PBO large enough for the whole object * and downloading all of the FBOs into it. */ static Bool glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) { ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); int gl_access, gl_usage; RegionRec region; if (priv->type == GLAMOR_DRM_ONLY) return FALSE; if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) return TRUE; glamor_make_current(glamor_priv); RegionInit(®ion, box, 1); /* See if it's already mapped */ if (pixmap->devPrivate.ptr) { /* * Someone else has mapped this pixmap; * we'll assume that it's directly mapped * by a lower level driver */ if (!priv->prepared) return TRUE; /* In X, multiple Drawables can be stored in the same Pixmap (such as * each individual window in a non-composited screen pixmap, or the * reparented window contents inside the window-manager-decorated window * pixmap on a composited screen). * * As a result, when doing a series of mappings for a fallback, we may * need to add more boxes to the set of data we've downloaded, as we go. */ RegionSubtract(®ion, ®ion, &priv->prepare_region); if (!RegionNotEmpty(®ion)) return TRUE; if (access == GLAMOR_ACCESS_RW) FatalError("attempt to remap buffer as writable"); if (priv->pbo) { glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo); glUnmapBuffer(GL_PIXEL_PACK_BUFFER); pixmap->devPrivate.ptr = NULL; } } else { RegionInit(&priv->prepare_region, box, 1); if (glamor_priv->has_rw_pbo) { if (priv->pbo == 0) glGenBuffers(1, &priv->pbo); gl_usage = GL_STREAM_READ; glamor_priv->suppress_gl_out_of_memory_logging = true; glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo); glBufferData(GL_PIXEL_PACK_BUFFER, pixmap->devKind * pixmap->drawable.height, NULL, gl_usage); glamor_priv->suppress_gl_out_of_memory_logging = false; if (glGetError() == GL_OUT_OF_MEMORY) { if (!glamor_priv->logged_any_pbo_allocation_failure) { LogMessageVerb(X_WARNING, 0, "glamor: Failed to allocate %d " "bytes PBO due to GL_OUT_OF_MEMORY.\n", pixmap->devKind * pixmap->drawable.height); glamor_priv->logged_any_pbo_allocation_failure = true; } glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); glDeleteBuffers(1, &priv->pbo); priv->pbo = 0; } } if (!priv->pbo) { pixmap->devPrivate.ptr = xallocarray(pixmap->devKind, pixmap->drawable.height); if (!pixmap->devPrivate.ptr) return FALSE; } priv->map_access = access; } glamor_download_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion), 0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind); RegionUninit(®ion); if (priv->pbo) { if (priv->map_access == GLAMOR_ACCESS_RW) gl_access = GL_READ_WRITE; else gl_access = GL_READ_ONLY; pixmap->devPrivate.ptr = glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } priv->prepared = TRUE; return TRUE; } /* * When we're done with the drawable, unmap the PBO, reupload * if we were writing to it and then unbind it to release the memory */ static void glamor_fini_pixmap(PixmapPtr pixmap) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) return; if (!priv->prepared) return; if (priv->pbo) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo); glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); pixmap->devPrivate.ptr = NULL; } if (priv->map_access == GLAMOR_ACCESS_RW) { glamor_upload_boxes(pixmap, RegionRects(&priv->prepare_region), RegionNumRects(&priv->prepare_region), 0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind); } RegionUninit(&priv->prepare_region); if (priv->pbo) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); glDeleteBuffers(1, &priv->pbo); priv->pbo = 0; } else { free(pixmap->devPrivate.ptr); pixmap->devPrivate.ptr = NULL; } priv->prepared = FALSE; } Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access) { PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); BoxRec box; int off_x, off_y; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); box.x1 = drawable->x + off_x; box.x2 = box.x1 + drawable->width; box.y1 = drawable->y + off_y; box.y2 = box.y1 + drawable->height; return glamor_prep_pixmap_box(pixmap, access, &box); } Bool glamor_prepare_access_box(DrawablePtr drawable, glamor_access_t access, int x, int y, int w, int h) { PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); BoxRec box; int off_x, off_y; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); box.x1 = drawable->x + x + off_x; box.x2 = box.x1 + w; box.y1 = drawable->y + y + off_y; box.y2 = box.y1 + h; return glamor_prep_pixmap_box(pixmap, access, &box); } void glamor_finish_access(DrawablePtr drawable) { glamor_fini_pixmap(glamor_get_drawable_pixmap(drawable)); } /* * Make a picture ready to use with fb. */ Bool glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access) { if (!picture || !picture->pDrawable) return TRUE; return glamor_prepare_access(picture->pDrawable, access); } Bool glamor_prepare_access_picture_box(PicturePtr picture, glamor_access_t access, int x, int y, int w, int h) { if (!picture || !picture->pDrawable) return TRUE; /* If a transform is set, we don't know what the bounds is on the * source, so just prepare the whole pixmap. XXX: We could * potentially work out where in the source would be sampled based * on the transform, and we don't need do do this for destination * pixmaps at all. */ if (picture->transform) { return glamor_prepare_access_box(picture->pDrawable, access, 0, 0, picture->pDrawable->width, picture->pDrawable->height); } else { return glamor_prepare_access_box(picture->pDrawable, access, x, y, w, h); } } void glamor_finish_access_picture(PicturePtr picture) { if (!picture || !picture->pDrawable) return; glamor_finish_access(picture->pDrawable); } /* * Make a GC ready to use with fb. This just * means making sure the appropriate fill pixmap is * in CPU memory again */ Bool glamor_prepare_access_gc(GCPtr gc) { switch (gc->fillStyle) { case FillTiled: return glamor_prepare_access(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RO); case FillStippled: case FillOpaqueStippled: return glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO); } return TRUE; } /* * Free any temporary CPU pixmaps for the GC */ void glamor_finish_access_gc(GCPtr gc) { switch (gc->fillStyle) { case FillTiled: glamor_finish_access(&gc->tile.pixmap->drawable); break; case FillStippled: case FillOpaqueStippled: glamor_finish_access(&gc->stipple->drawable); break; } } xorg-server-1.20.8/glamor/glamor_largepixmap.c0000644000175000017500000017023213640201473016312 00000000000000#include #include /* For INT16_MAX */ #include "glamor_priv.h" static void glamor_get_transform_extent_from_box(struct pixman_box32 *box, struct pixman_transform *transform); static inline glamor_pixmap_private * __glamor_large(glamor_pixmap_private *pixmap_priv) { assert(glamor_pixmap_priv_is_large(pixmap_priv)); return pixmap_priv; } /** * Clip the boxes regards to each pixmap's block array. * * Should translate the region to relative coords to the pixmap, * start at (0,0). */ #if 0 //#define DEBUGF(str, ...) do {} while(0) #define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) //#define DEBUGRegionPrint(x) do {} while (0) #define DEBUGRegionPrint RegionPrint #endif static glamor_pixmap_clipped_regions * __glamor_compute_clipped_regions(int block_w, int block_h, int block_stride, int x, int y, int w, int h, RegionPtr region, int *n_region, int reverse, int upsidedown) { glamor_pixmap_clipped_regions *clipped_regions; BoxPtr extent; int start_x, start_y, end_x, end_y; int start_block_x, start_block_y; int end_block_x, end_block_y; int loop_start_block_x, loop_start_block_y; int loop_end_block_x, loop_end_block_y; int loop_block_stride; int i, j, delta_i, delta_j; RegionRec temp_region; RegionPtr current_region; int block_idx; int k = 0; int temp_block_idx; extent = RegionExtents(region); start_x = MAX(x, extent->x1); start_y = MAX(y, extent->y1); end_x = MIN(x + w, extent->x2); end_y = MIN(y + h, extent->y2); DEBUGF("start compute clipped regions:\n"); DEBUGF("block w %d h %d x %d y %d w %d h %d, block_stride %d \n", block_w, block_h, x, y, w, h, block_stride); DEBUGRegionPrint(region); DEBUGF("start_x %d start_y %d end_x %d end_y %d \n", start_x, start_y, end_x, end_y); if (start_x >= end_x || start_y >= end_y) { *n_region = 0; return NULL; } start_block_x = (start_x - x) / block_w; start_block_y = (start_y - y) / block_h; end_block_x = (end_x - x) / block_w; end_block_y = (end_y - y) / block_h; clipped_regions = calloc((end_block_x - start_block_x + 1) * (end_block_y - start_block_y + 1), sizeof(*clipped_regions)); DEBUGF("startx %d starty %d endx %d endy %d \n", start_x, start_y, end_x, end_y); DEBUGF("start_block_x %d end_block_x %d \n", start_block_x, end_block_x); DEBUGF("start_block_y %d end_block_y %d \n", start_block_y, end_block_y); if (!reverse) { loop_start_block_x = start_block_x; loop_end_block_x = end_block_x + 1; delta_i = 1; } else { loop_start_block_x = end_block_x; loop_end_block_x = start_block_x - 1; delta_i = -1; } if (!upsidedown) { loop_start_block_y = start_block_y; loop_end_block_y = end_block_y + 1; delta_j = 1; } else { loop_start_block_y = end_block_y; loop_end_block_y = start_block_y - 1; delta_j = -1; } loop_block_stride = delta_j * block_stride; block_idx = (loop_start_block_y - delta_j) * block_stride; for (j = loop_start_block_y; j != loop_end_block_y; j += delta_j) { block_idx += loop_block_stride; temp_block_idx = block_idx + loop_start_block_x; for (i = loop_start_block_x; i != loop_end_block_x; i += delta_i, temp_block_idx += delta_i) { BoxRec temp_box; temp_box.x1 = x + i * block_w; temp_box.y1 = y + j * block_h; temp_box.x2 = MIN(temp_box.x1 + block_w, end_x); temp_box.y2 = MIN(temp_box.y1 + block_h, end_y); RegionInitBoxes(&temp_region, &temp_box, 1); DEBUGF("block idx %d \n", temp_block_idx); DEBUGRegionPrint(&temp_region); current_region = RegionCreate(NULL, 4); RegionIntersect(current_region, &temp_region, region); DEBUGF("i %d j %d region: \n", i, j); DEBUGRegionPrint(current_region); if (RegionNumRects(current_region)) { clipped_regions[k].region = current_region; clipped_regions[k].block_idx = temp_block_idx; k++; } else RegionDestroy(current_region); RegionUninit(&temp_region); } } *n_region = k; return clipped_regions; } /** * Do a two round clipping, * first is to clip the region regard to current pixmap's * block array. Then for each clipped region, do a inner * block clipping. This is to make sure the final result * will be shapped by inner_block_w and inner_block_h, and * the final region also will not cross the pixmap's block * boundary. * * This is mainly used by transformation support when do * compositing. */ glamor_pixmap_clipped_regions * glamor_compute_clipped_regions_ext(PixmapPtr pixmap, RegionPtr region, int *n_region, int inner_block_w, int inner_block_h, int reverse, int upsidedown) { glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_pixmap_clipped_regions *clipped_regions, *inner_regions, *result_regions; int i, j, x, y, k, inner_n_regions; int width, height; BoxPtr box_array; BoxRec small_box; int block_w, block_h; DEBUGF("ext called \n"); if (glamor_pixmap_priv_is_small(pixmap_priv)) { clipped_regions = calloc(1, sizeof(*clipped_regions)); if (clipped_regions == NULL) { *n_region = 0; return NULL; } clipped_regions[0].region = RegionCreate(NULL, 1); clipped_regions[0].block_idx = 0; RegionCopy(clipped_regions[0].region, region); *n_region = 1; block_w = pixmap->drawable.width; block_h = pixmap->drawable.height; box_array = &small_box; small_box.x1 = small_box.y1 = 0; small_box.x2 = block_w; small_box.y2 = block_h; } else { glamor_pixmap_private *priv = __glamor_large(pixmap_priv); clipped_regions = __glamor_compute_clipped_regions(priv->block_w, priv->block_h, priv->block_wcnt, 0, 0, pixmap->drawable.width, pixmap->drawable.height, region, n_region, reverse, upsidedown); if (clipped_regions == NULL) { *n_region = 0; return NULL; } block_w = priv->block_w; block_h = priv->block_h; box_array = priv->box_array; } if (inner_block_w >= block_w && inner_block_h >= block_h) return clipped_regions; result_regions = calloc(*n_region * ((block_w + inner_block_w - 1) / inner_block_w) * ((block_h + inner_block_h - 1) / inner_block_h), sizeof(*result_regions)); k = 0; for (i = 0; i < *n_region; i++) { x = box_array[clipped_regions[i].block_idx].x1; y = box_array[clipped_regions[i].block_idx].y1; width = box_array[clipped_regions[i].block_idx].x2 - x; height = box_array[clipped_regions[i].block_idx].y2 - y; inner_regions = __glamor_compute_clipped_regions(inner_block_w, inner_block_h, 0, x, y, width, height, clipped_regions[i]. region, &inner_n_regions, reverse, upsidedown); for (j = 0; j < inner_n_regions; j++) { result_regions[k].region = inner_regions[j].region; result_regions[k].block_idx = clipped_regions[i].block_idx; k++; } free(inner_regions); } *n_region = k; free(clipped_regions); return result_regions; } /* * * For the repeat pad mode, we can simply convert the region and * let the out-of-box region can cover the needed edge of the source/mask * Then apply a normal clip we can get what we want. */ static RegionPtr _glamor_convert_pad_region(RegionPtr region, int w, int h) { RegionPtr pad_region; int nrect; BoxPtr box; int overlap; nrect = RegionNumRects(region); box = RegionRects(region); pad_region = RegionCreate(NULL, 4); if (pad_region == NULL) return NULL; while (nrect--) { BoxRec pad_box; RegionRec temp_region; pad_box = *box; if (pad_box.x1 < 0 && pad_box.x2 <= 0) pad_box.x2 = 1; else if (pad_box.x1 >= w && pad_box.x2 > w) pad_box.x1 = w - 1; if (pad_box.y1 < 0 && pad_box.y2 <= 0) pad_box.y2 = 1; else if (pad_box.y1 >= h && pad_box.y2 > h) pad_box.y1 = h - 1; RegionInitBoxes(&temp_region, &pad_box, 1); RegionAppend(pad_region, &temp_region); RegionUninit(&temp_region); box++; } RegionValidate(pad_region, &overlap); return pad_region; } /* * For one type of large pixmap, its one direction is not exceed the * size limitation, and in another word, on one direction it has only * one block. * * This case of reflect repeating, we can optimize it and avoid repeat * clip on that direction. We can just enlarge the repeat box and can * cover all the dest region on that direction. But latter, we need to * fixup the clipped result to get a correct coords for the subsequent * processing. This function is to do the coords correction. * * */ static void _glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh) { int odd1, odd2; int c1, c2; if (*xy2 - *xy1 > wh) { *xy1 = 0; *xy2 = wh; return; } modulus(*xy1, wh, c1); odd1 = ((*xy1 - c1) / wh) & 0x1; modulus(*xy2, wh, c2); odd2 = ((*xy2 - c2) / wh) & 0x1; if (odd1 && odd2) { *xy1 = wh - c2; *xy2 = wh - c1; } else if (odd1 && !odd2) { *xy1 = 0; *xy2 = MAX(c2, wh - c1); } else if (!odd1 && odd2) { *xy2 = wh; *xy1 = MIN(c1, wh - c2); } else { *xy1 = c1; *xy2 = c2; } } /** * Clip the boxes regards to each pixmap's block array. * * Should translate the region to relative coords to the pixmap, * start at (0,0). * * @is_transform: if it is set, it has a transform matrix. * */ static glamor_pixmap_clipped_regions * _glamor_compute_clipped_regions(PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv, RegionPtr region, int *n_region, int repeat_type, int is_transform, int reverse, int upsidedown) { glamor_pixmap_clipped_regions *clipped_regions; BoxPtr extent; int i, j; RegionPtr current_region; int pixmap_width, pixmap_height; int m; BoxRec repeat_box; RegionRec repeat_region; int right_shift = 0; int down_shift = 0; int x_center_shift = 0, y_center_shift = 0; glamor_pixmap_private *priv; DEBUGRegionPrint(region); if (glamor_pixmap_priv_is_small(pixmap_priv)) { clipped_regions = calloc(1, sizeof(*clipped_regions)); clipped_regions[0].region = RegionCreate(NULL, 1); clipped_regions[0].block_idx = 0; RegionCopy(clipped_regions[0].region, region); *n_region = 1; return clipped_regions; } priv = __glamor_large(pixmap_priv); pixmap_width = pixmap->drawable.width; pixmap_height = pixmap->drawable.height; if (repeat_type == 0 || repeat_type == RepeatPad) { RegionPtr saved_region = NULL; if (repeat_type == RepeatPad) { saved_region = region; region = _glamor_convert_pad_region(saved_region, pixmap_width, pixmap_height); if (region == NULL) { *n_region = 0; return NULL; } } clipped_regions = __glamor_compute_clipped_regions(priv->block_w, priv->block_h, priv->block_wcnt, 0, 0, pixmap->drawable.width, pixmap->drawable.height, region, n_region, reverse, upsidedown); if (saved_region) RegionDestroy(region); return clipped_regions; } extent = RegionExtents(region); x_center_shift = extent->x1 / pixmap_width; if (x_center_shift < 0) x_center_shift--; if (abs(x_center_shift) & 1) x_center_shift++; y_center_shift = extent->y1 / pixmap_height; if (y_center_shift < 0) y_center_shift--; if (abs(y_center_shift) & 1) y_center_shift++; if (extent->x1 < 0) right_shift = ((-extent->x1 + pixmap_width - 1) / pixmap_width); if (extent->y1 < 0) down_shift = ((-extent->y1 + pixmap_height - 1) / pixmap_height); if (right_shift != 0 || down_shift != 0) { if (repeat_type == RepeatReflect) { right_shift = (right_shift + 1) & ~1; down_shift = (down_shift + 1) & ~1; } RegionTranslate(region, right_shift * pixmap_width, down_shift * pixmap_height); } extent = RegionExtents(region); /* Tile a large pixmap to another large pixmap. * We can't use the target large pixmap as the * loop variable, instead we need to loop for all * the blocks in the tile pixmap. * * simulate repeat each single block to cover the * target's blocks. Two special case: * a block_wcnt == 1 or block_hcnt ==1, then we * only need to loop one direction as the other * direction is fully included in the first block. * * For the other cases, just need to start * from a proper shiftx/shifty, and then increase * y by tile_height each time to walk trhough the * target block and then walk trhough the target * at x direction by increate tile_width each time. * * This way, we can consolidate all the sub blocks * of the target boxes into one tile source's block. * * */ m = 0; clipped_regions = calloc(priv->block_wcnt * priv->block_hcnt, sizeof(*clipped_regions)); if (clipped_regions == NULL) { *n_region = 0; return NULL; } if (right_shift != 0 || down_shift != 0) { DEBUGF("region to be repeated shifted \n"); DEBUGRegionPrint(region); } DEBUGF("repeat pixmap width %d height %d \n", pixmap_width, pixmap_height); DEBUGF("extent x1 %d y1 %d x2 %d y2 %d \n", extent->x1, extent->y1, extent->x2, extent->y2); for (j = 0; j < priv->block_hcnt; j++) { for (i = 0; i < priv->block_wcnt; i++) { int dx = pixmap_width; int dy = pixmap_height; int idx; int shift_x; int shift_y; int saved_y1, saved_y2; int x_idx = 0, y_idx = 0, saved_y_idx = 0; RegionRec temp_region; BoxRec reflect_repeat_box; BoxPtr valid_repeat_box; shift_x = (extent->x1 / pixmap_width) * pixmap_width; shift_y = (extent->y1 / pixmap_height) * pixmap_height; idx = j * priv->block_wcnt + i; if (repeat_type == RepeatReflect) { x_idx = (extent->x1 / pixmap_width); y_idx = (extent->y1 / pixmap_height); } /* Construct a rect to clip the target region. */ repeat_box.x1 = shift_x + priv->box_array[idx].x1; repeat_box.y1 = shift_y + priv->box_array[idx].y1; if (priv->block_wcnt == 1) { repeat_box.x2 = extent->x2; dx = extent->x2 - repeat_box.x1; } else repeat_box.x2 = shift_x + priv->box_array[idx].x2; if (priv->block_hcnt == 1) { repeat_box.y2 = extent->y2; dy = extent->y2 - repeat_box.y1; } else repeat_box.y2 = shift_y + priv->box_array[idx].y2; current_region = RegionCreate(NULL, 4); RegionInit(&temp_region, NULL, 4); DEBUGF("init repeat box %d %d %d %d \n", repeat_box.x1, repeat_box.y1, repeat_box.x2, repeat_box.y2); if (repeat_type == RepeatNormal) { saved_y1 = repeat_box.y1; saved_y2 = repeat_box.y2; for (; repeat_box.x1 < extent->x2; repeat_box.x1 += dx, repeat_box.x2 += dx) { repeat_box.y1 = saved_y1; repeat_box.y2 = saved_y2; for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2; repeat_box.y1 < extent->y2; repeat_box.y1 += dy, repeat_box.y2 += dy) { RegionInitBoxes(&repeat_region, &repeat_box, 1); DEBUGF("Start to clip repeat region: \n"); DEBUGRegionPrint(&repeat_region); RegionIntersect(&temp_region, &repeat_region, region); DEBUGF("clip result:\n"); DEBUGRegionPrint(&temp_region); RegionAppend(current_region, &temp_region); RegionUninit(&repeat_region); } } } else if (repeat_type == RepeatReflect) { saved_y1 = repeat_box.y1; saved_y2 = repeat_box.y2; saved_y_idx = y_idx; for (;; repeat_box.x1 += dx, repeat_box.x2 += dx) { repeat_box.y1 = saved_y1; repeat_box.y2 = saved_y2; y_idx = saved_y_idx; reflect_repeat_box.x1 = (x_idx & 1) ? ((2 * x_idx + 1) * dx - repeat_box.x2) : repeat_box.x1; reflect_repeat_box.x2 = (x_idx & 1) ? ((2 * x_idx + 1) * dx - repeat_box.x1) : repeat_box.x2; valid_repeat_box = &reflect_repeat_box; if (valid_repeat_box->x1 >= extent->x2) break; for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2;; repeat_box.y1 += dy, repeat_box.y2 += dy) { DEBUGF("x_idx %d y_idx %d dx %d dy %d\n", x_idx, y_idx, dx, dy); DEBUGF("repeat box %d %d %d %d \n", repeat_box.x1, repeat_box.y1, repeat_box.x2, repeat_box.y2); if (priv->block_hcnt > 1) { reflect_repeat_box.y1 = (y_idx & 1) ? ((2 * y_idx + 1) * dy - repeat_box.y2) : repeat_box.y1; reflect_repeat_box.y2 = (y_idx & 1) ? ((2 * y_idx + 1) * dy - repeat_box.y1) : repeat_box.y2; } else { reflect_repeat_box.y1 = repeat_box.y1; reflect_repeat_box.y2 = repeat_box.y2; } DEBUGF("valid_repeat_box x1 %d y1 %d \n", valid_repeat_box->x1, valid_repeat_box->y1); if (valid_repeat_box->y1 >= extent->y2) break; RegionInitBoxes(&repeat_region, valid_repeat_box, 1); DEBUGF("start to clip repeat[reflect] region: \n"); DEBUGRegionPrint(&repeat_region); RegionIntersect(&temp_region, &repeat_region, region); DEBUGF("result:\n"); DEBUGRegionPrint(&temp_region); if (is_transform && RegionNumRects(&temp_region)) { BoxRec temp_box; BoxPtr temp_extent; temp_extent = RegionExtents(&temp_region); if (priv->block_wcnt > 1) { if (x_idx & 1) { temp_box.x1 = ((2 * x_idx + 1) * dx - temp_extent->x2); temp_box.x2 = ((2 * x_idx + 1) * dx - temp_extent->x1); } else { temp_box.x1 = temp_extent->x1; temp_box.x2 = temp_extent->x2; } modulus(temp_box.x1, pixmap_width, temp_box.x1); modulus(temp_box.x2, pixmap_width, temp_box.x2); if (temp_box.x2 == 0) temp_box.x2 = pixmap_width; } else { temp_box.x1 = temp_extent->x1; temp_box.x2 = temp_extent->x2; _glamor_largepixmap_reflect_fixup(&temp_box.x1, &temp_box.x2, pixmap_width); } if (priv->block_hcnt > 1) { if (y_idx & 1) { temp_box.y1 = ((2 * y_idx + 1) * dy - temp_extent->y2); temp_box.y2 = ((2 * y_idx + 1) * dy - temp_extent->y1); } else { temp_box.y1 = temp_extent->y1; temp_box.y2 = temp_extent->y2; } modulus(temp_box.y1, pixmap_height, temp_box.y1); modulus(temp_box.y2, pixmap_height, temp_box.y2); if (temp_box.y2 == 0) temp_box.y2 = pixmap_height; } else { temp_box.y1 = temp_extent->y1; temp_box.y2 = temp_extent->y2; _glamor_largepixmap_reflect_fixup(&temp_box.y1, &temp_box.y2, pixmap_height); } RegionInitBoxes(&temp_region, &temp_box, 1); RegionTranslate(&temp_region, x_center_shift * pixmap_width, y_center_shift * pixmap_height); DEBUGF("for transform result:\n"); DEBUGRegionPrint(&temp_region); } RegionAppend(current_region, &temp_region); RegionUninit(&repeat_region); y_idx++; } x_idx++; } } DEBUGF("dx %d dy %d \n", dx, dy); if (RegionNumRects(current_region)) { if ((right_shift != 0 || down_shift != 0) && !(is_transform && repeat_type == RepeatReflect)) RegionTranslate(current_region, -right_shift * pixmap_width, -down_shift * pixmap_height); clipped_regions[m].region = current_region; clipped_regions[m].block_idx = idx; m++; } else RegionDestroy(current_region); RegionUninit(&temp_region); } } if (right_shift != 0 || down_shift != 0) RegionTranslate(region, -right_shift * pixmap_width, -down_shift * pixmap_height); *n_region = m; return clipped_regions; } glamor_pixmap_clipped_regions * glamor_compute_clipped_regions(PixmapPtr pixmap, RegionPtr region, int *n_region, int repeat_type, int reverse, int upsidedown) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); return _glamor_compute_clipped_regions(pixmap, priv, region, n_region, repeat_type, 0, reverse, upsidedown); } /* XXX overflow still exist. maybe we need to change to use region32. * by default. Or just use region32 for repeat cases? **/ static glamor_pixmap_clipped_regions * glamor_compute_transform_clipped_regions(PixmapPtr pixmap, struct pixman_transform *transform, RegionPtr region, int *n_region, int dx, int dy, int repeat_type, int reverse, int upsidedown) { glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); BoxPtr temp_extent; struct pixman_box32 temp_box; struct pixman_box16 short_box; RegionPtr temp_region; glamor_pixmap_clipped_regions *ret; temp_region = RegionCreate(NULL, 4); temp_extent = RegionExtents(region); DEBUGF("dest region \n"); DEBUGRegionPrint(region); /* dx/dy may exceed MAX SHORT. we have to use * a box32 to represent it.*/ temp_box.x1 = temp_extent->x1 + dx; temp_box.x2 = temp_extent->x2 + dx; temp_box.y1 = temp_extent->y1 + dy; temp_box.y2 = temp_extent->y2 + dy; DEBUGF("source box %d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2, temp_box.y2); if (transform) glamor_get_transform_extent_from_box(&temp_box, transform); if (repeat_type == RepeatNone) { if (temp_box.x1 < 0) temp_box.x1 = 0; if (temp_box.y1 < 0) temp_box.y1 = 0; temp_box.x2 = MIN(temp_box.x2, pixmap->drawable.width); temp_box.y2 = MIN(temp_box.y2, pixmap->drawable.height); } /* Now copy back the box32 to a box16 box, avoiding overflow. */ short_box.x1 = MIN(temp_box.x1, INT16_MAX); short_box.y1 = MIN(temp_box.y1, INT16_MAX); short_box.x2 = MIN(temp_box.x2, INT16_MAX); short_box.y2 = MIN(temp_box.y2, INT16_MAX); RegionInitBoxes(temp_region, &short_box, 1); DEBUGF("copy to temp source region \n"); DEBUGRegionPrint(temp_region); ret = _glamor_compute_clipped_regions(pixmap, priv, temp_region, n_region, repeat_type, 1, reverse, upsidedown); DEBUGF("n_regions = %d \n", *n_region); RegionDestroy(temp_region); return ret; } /* * As transform and repeatpad mode. * We may get a clipped result which in multipe regions. * It's not easy to do a 2nd round clipping just as we do * without transform/repeatPad. As it's not easy to reverse * the 2nd round clipping result with a transform/repeatPad mode, * or even impossible for some transformation. * * So we have to merge the fragmental region into one region * if the clipped result cross the region boundary. */ static void glamor_merge_clipped_regions(PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv, int repeat_type, glamor_pixmap_clipped_regions *clipped_regions, int *n_regions, int *need_clean_fbo) { BoxRec temp_box, copy_box; RegionPtr temp_region; glamor_pixmap_private *temp_priv; PixmapPtr temp_pixmap; int overlap; int i; int pixmap_width, pixmap_height; glamor_pixmap_private *priv; priv = __glamor_large(pixmap_priv); pixmap_width = pixmap->drawable.width; pixmap_height =pixmap->drawable.height; temp_region = RegionCreate(NULL, 4); for (i = 0; i < *n_regions; i++) { DEBUGF("Region %d:\n", i); DEBUGRegionPrint(clipped_regions[i].region); RegionAppend(temp_region, clipped_regions[i].region); } RegionValidate(temp_region, &overlap); DEBUGF("temp region: \n"); DEBUGRegionPrint(temp_region); temp_box = *RegionExtents(temp_region); DEBUGF("need copy region: \n"); DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2, temp_box.y2); temp_pixmap = glamor_create_pixmap(pixmap->drawable.pScreen, temp_box.x2 - temp_box.x1, temp_box.y2 - temp_box.y1, pixmap->drawable.depth, GLAMOR_CREATE_PIXMAP_FIXUP); if (temp_pixmap == NULL) { assert(0); return; } temp_priv = glamor_get_pixmap_private(temp_pixmap); assert(glamor_pixmap_priv_is_small(temp_priv)); priv->box = temp_box; if (temp_box.x1 >= 0 && temp_box.x2 <= pixmap_width && temp_box.y1 >= 0 && temp_box.y2 <= pixmap_height) { int dx, dy; copy_box.x1 = 0; copy_box.y1 = 0; copy_box.x2 = temp_box.x2 - temp_box.x1; copy_box.y2 = temp_box.y2 - temp_box.y1; dx = temp_box.x1; dy = temp_box.y1; glamor_copy(&pixmap->drawable, &temp_pixmap->drawable, NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL); // glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width, // temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff00); } else { for (i = 0; i < *n_regions; i++) { BoxPtr box; int nbox; box = REGION_RECTS(clipped_regions[i].region); nbox = REGION_NUM_RECTS(clipped_regions[i].region); while (nbox--) { int dx, dy, c, d; DEBUGF("box x1 %d y1 %d x2 %d y2 %d \n", box->x1, box->y1, box->x2, box->y2); modulus(box->x1, pixmap_width, c); dx = c - (box->x1 - temp_box.x1); copy_box.x1 = box->x1 - temp_box.x1; copy_box.x2 = box->x2 - temp_box.x1; modulus(box->y1, pixmap_height, d); dy = d - (box->y1 - temp_box.y1); copy_box.y1 = box->y1 - temp_box.y1; copy_box.y2 = box->y2 - temp_box.y1; DEBUGF("copying box %d %d %d %d, dx %d dy %d\n", copy_box.x1, copy_box.y1, copy_box.x2, copy_box.y2, dx, dy); glamor_copy(&pixmap->drawable, &temp_pixmap->drawable, NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL); box++; } } //glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width, // temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff); } /* The first region will be released at caller side. */ for (i = 1; i < *n_regions; i++) RegionDestroy(clipped_regions[i].region); RegionDestroy(temp_region); priv->box = temp_box; priv->fbo = glamor_pixmap_detach_fbo(temp_priv); DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n", priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2); glamor_destroy_pixmap(temp_pixmap); *need_clean_fbo = 1; *n_regions = 1; } /** * Given an expected transformed block width and block height, * * This function calculate a new block width and height which * guarantee the transform result will not exceed the given * block width and height. * * For large block width and height (> 2048), we choose a * smaller new width and height and to reduce the cross region * boundary and can avoid some overhead. * **/ static Bool glamor_get_transform_block_size(struct pixman_transform *transform, int block_w, int block_h, int *transformed_block_w, int *transformed_block_h) { double a, b, c, d, e, f, g, h; double scale; int width, height; a = pixman_fixed_to_double(transform->matrix[0][0]); b = pixman_fixed_to_double(transform->matrix[0][1]); c = pixman_fixed_to_double(transform->matrix[1][0]); d = pixman_fixed_to_double(transform->matrix[1][1]); scale = pixman_fixed_to_double(transform->matrix[2][2]); if (block_w > 2048) { /* For large block size, we shrink it to smaller box, * thus latter we may get less cross boundary regions and * thus can avoid some extra copy. * **/ width = block_w / 4; height = block_h / 4; } else { width = block_w - 2; height = block_h - 2; } e = a + b; f = c + d; g = a - b; h = c - d; e = MIN(block_w, floor(width * scale) / MAX(fabs(e), fabs(g))); f = MIN(block_h, floor(height * scale) / MAX(fabs(f), fabs(h))); *transformed_block_w = MIN(e, f) - 1; *transformed_block_h = *transformed_block_w; if (*transformed_block_w <= 0 || *transformed_block_h <= 0) return FALSE; DEBUGF("original block_w/h %d %d, fixed %d %d \n", block_w, block_h, *transformed_block_w, *transformed_block_h); return TRUE; } #define VECTOR_FROM_POINT(p, x, y) do {\ p.v[0] = x; \ p.v[1] = y; \ p.v[2] = 1.0; } while (0) static void glamor_get_transform_extent_from_box(struct pixman_box32 *box, struct pixman_transform *transform) { struct pixman_f_vector p0, p1, p2, p3; float min_x, min_y, max_x, max_y; struct pixman_f_transform ftransform; VECTOR_FROM_POINT(p0, box->x1, box->y1); VECTOR_FROM_POINT(p1, box->x2, box->y1); VECTOR_FROM_POINT(p2, box->x2, box->y2); VECTOR_FROM_POINT(p3, box->x1, box->y2); pixman_f_transform_from_pixman_transform(&ftransform, transform); pixman_f_transform_point(&ftransform, &p0); pixman_f_transform_point(&ftransform, &p1); pixman_f_transform_point(&ftransform, &p2); pixman_f_transform_point(&ftransform, &p3); min_x = MIN(p0.v[0], p1.v[0]); min_x = MIN(min_x, p2.v[0]); min_x = MIN(min_x, p3.v[0]); min_y = MIN(p0.v[1], p1.v[1]); min_y = MIN(min_y, p2.v[1]); min_y = MIN(min_y, p3.v[1]); max_x = MAX(p0.v[0], p1.v[0]); max_x = MAX(max_x, p2.v[0]); max_x = MAX(max_x, p3.v[0]); max_y = MAX(p0.v[1], p1.v[1]); max_y = MAX(max_y, p2.v[1]); max_y = MAX(max_y, p3.v[1]); box->x1 = floor(min_x) - 1; box->y1 = floor(min_y) - 1; box->x2 = ceil(max_x) + 1; box->y2 = ceil(max_y) + 1; } static void _glamor_process_transformed_clipped_region(PixmapPtr pixmap, glamor_pixmap_private *priv, int repeat_type, glamor_pixmap_clipped_regions * clipped_regions, int *n_regions, int *need_clean_fbo) { int shift_x, shift_y; if (*n_regions != 1) { /* Merge all source regions into one region. */ glamor_merge_clipped_regions(pixmap, priv, repeat_type, clipped_regions, n_regions, need_clean_fbo); } else { glamor_set_pixmap_fbo_current(priv, clipped_regions[0].block_idx); if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) { /* The required source areas are in one region, * we need to shift the corresponding box's coords to proper position, * thus we can calculate the relative coords correctly.*/ BoxPtr temp_box; int rem; temp_box = RegionExtents(clipped_regions[0].region); modulus(temp_box->x1, pixmap->drawable.width, rem); shift_x = (temp_box->x1 - rem) / pixmap->drawable.width; modulus(temp_box->y1, pixmap->drawable.height, rem); shift_y = (temp_box->y1 - rem) / pixmap->drawable.height; if (shift_x != 0) { __glamor_large(priv)->box.x1 += shift_x * pixmap->drawable.width; __glamor_large(priv)->box.x2 += shift_x * pixmap->drawable.width; } if (shift_y != 0) { __glamor_large(priv)->box.y1 += shift_y * pixmap->drawable.height; __glamor_large(priv)->box.y2 += shift_y * pixmap->drawable.height; } } } } Bool glamor_composite_largepixmap_region(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, PixmapPtr source_pixmap, PixmapPtr mask_pixmap, PixmapPtr dest_pixmap, RegionPtr region, Bool force_clip, INT16 x_source, INT16 y_source, INT16 x_mask, INT16 y_mask, INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height) { ScreenPtr screen = dest_pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap); glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap); glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); glamor_pixmap_clipped_regions *clipped_dest_regions; glamor_pixmap_clipped_regions *clipped_source_regions; glamor_pixmap_clipped_regions *clipped_mask_regions; int n_dest_regions; int n_mask_regions; int n_source_regions; int i, j, k; int need_clean_source_fbo = 0; int need_clean_mask_fbo = 0; int is_normal_source_fbo = 0; int is_normal_mask_fbo = 0; int fixed_block_width, fixed_block_height; int dest_block_width, dest_block_height; int null_source, null_mask; glamor_pixmap_private *need_free_source_pixmap_priv = NULL; glamor_pixmap_private *need_free_mask_pixmap_priv = NULL; int source_repeat_type = 0, mask_repeat_type = 0; int ok = TRUE; if (source_pixmap == dest_pixmap) { glamor_fallback("source and dest pixmaps are the same\n"); return FALSE; } if (mask_pixmap == dest_pixmap) { glamor_fallback("mask and dest pixmaps are the same\n"); return FALSE; } if (source->repeat) source_repeat_type = source->repeatType; else source_repeat_type = RepeatNone; if (mask && mask->repeat) mask_repeat_type = mask->repeatType; else mask_repeat_type = RepeatNone; if (glamor_pixmap_priv_is_large(dest_pixmap_priv)) { dest_block_width = __glamor_large(dest_pixmap_priv)->block_w; dest_block_height = __glamor_large(dest_pixmap_priv)->block_h; } else { dest_block_width = dest_pixmap->drawable.width; dest_block_height = dest_pixmap->drawable.height; } fixed_block_width = dest_block_width; fixed_block_height = dest_block_height; /* If we got an totally out-of-box region for a source or mask * region without repeat, we need to set it as null_source and * give it a solid color (0,0,0,0). */ null_source = 0; null_mask = 0; RegionTranslate(region, -dest->pDrawable->x, -dest->pDrawable->y); /* need to transform the dest region to the correct sourcei/mask region. * it's a little complex, as one single edge of the * target region may be transformed to cross a block boundary of the * source or mask. Then it's impossible to handle it as usual way. * We may have to split the original dest region to smaller region, and * make sure each region's transformed region can fit into one texture, * and then continue this loop again, and each time when a transformed region * cross the bound, we need to copy it to a single pixmap and do the composition * with the new pixmap. If the transformed region doesn't cross a source/mask's * boundary then we don't need to copy. * */ if (source_pixmap_priv && source->transform && glamor_pixmap_priv_is_large(source_pixmap_priv)) { int source_transformed_block_width, source_transformed_block_height; if (!glamor_get_transform_block_size(source->transform, __glamor_large(source_pixmap_priv)->block_w, __glamor_large(source_pixmap_priv)->block_h, &source_transformed_block_width, &source_transformed_block_height)) { DEBUGF("source block size less than 1, fallback.\n"); RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y); return FALSE; } fixed_block_width = min(fixed_block_width, source_transformed_block_width); fixed_block_height = min(fixed_block_height, source_transformed_block_height); DEBUGF("new source block size %d x %d \n", fixed_block_width, fixed_block_height); } if (mask_pixmap_priv && mask->transform && glamor_pixmap_priv_is_large(mask_pixmap_priv)) { int mask_transformed_block_width, mask_transformed_block_height; if (!glamor_get_transform_block_size(mask->transform, __glamor_large(mask_pixmap_priv)->block_w, __glamor_large(mask_pixmap_priv)->block_h, &mask_transformed_block_width, &mask_transformed_block_height)) { DEBUGF("mask block size less than 1, fallback.\n"); RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y); return FALSE; } fixed_block_width = min(fixed_block_width, mask_transformed_block_width); fixed_block_height = min(fixed_block_height, mask_transformed_block_height); DEBUGF("new mask block size %d x %d \n", fixed_block_width, fixed_block_height); } /*compute the correct block width and height whose transformed source/mask *region can fit into one texture.*/ if (force_clip || fixed_block_width < dest_block_width || fixed_block_height < dest_block_height) clipped_dest_regions = glamor_compute_clipped_regions_ext(dest_pixmap, region, &n_dest_regions, fixed_block_width, fixed_block_height, 0, 0); else clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap, region, &n_dest_regions, 0, 0, 0); DEBUGF("dest clipped result %d region: \n", n_dest_regions); if (source_pixmap_priv && (source_pixmap_priv == dest_pixmap_priv || source_pixmap_priv == mask_pixmap_priv) && glamor_pixmap_priv_is_large(source_pixmap_priv)) { /* XXX self-copy... */ need_free_source_pixmap_priv = source_pixmap_priv; source_pixmap_priv = malloc(sizeof(*source_pixmap_priv)); *source_pixmap_priv = *need_free_source_pixmap_priv; need_free_source_pixmap_priv = source_pixmap_priv; } assert(mask_pixmap_priv != dest_pixmap_priv); for (i = 0; i < n_dest_regions; i++) { DEBUGF("dest region %d idx %d\n", i, clipped_dest_regions[i].block_idx); DEBUGRegionPrint(clipped_dest_regions[i].region); glamor_set_pixmap_fbo_current(dest_pixmap_priv, clipped_dest_regions[i].block_idx); if (source_pixmap_priv && glamor_pixmap_priv_is_large(source_pixmap_priv)) { if (!source->transform && source_repeat_type != RepeatPad) { RegionTranslate(clipped_dest_regions[i].region, x_source - x_dest, y_source - y_dest); clipped_source_regions = glamor_compute_clipped_regions(source_pixmap, clipped_dest_regions[i]. region, &n_source_regions, source_repeat_type, 0, 0); is_normal_source_fbo = 1; } else { clipped_source_regions = glamor_compute_transform_clipped_regions(source_pixmap, source->transform, clipped_dest_regions [i].region, &n_source_regions, x_source - x_dest, y_source - y_dest, source_repeat_type, 0, 0); is_normal_source_fbo = 0; if (n_source_regions == 0) { /* Pad the out-of-box region to (0,0,0,0). */ null_source = 1; n_source_regions = 1; } else _glamor_process_transformed_clipped_region (source_pixmap, source_pixmap_priv, source_repeat_type, clipped_source_regions, &n_source_regions, &need_clean_source_fbo); } DEBUGF("source clipped result %d region: \n", n_source_regions); for (j = 0; j < n_source_regions; j++) { if (is_normal_source_fbo) glamor_set_pixmap_fbo_current(source_pixmap_priv, clipped_source_regions[j].block_idx); if (mask_pixmap_priv && glamor_pixmap_priv_is_large(mask_pixmap_priv)) { if (is_normal_mask_fbo && is_normal_source_fbo) { /* both mask and source are normal fbo box without transform or repeatpad. * The region is clipped against source and then we clip it against mask here.*/ DEBUGF("source region %d idx %d\n", j, clipped_source_regions[j].block_idx); DEBUGRegionPrint(clipped_source_regions[j].region); RegionTranslate(clipped_source_regions[j].region, -x_source + x_mask, -y_source + y_mask); clipped_mask_regions = glamor_compute_clipped_regions(mask_pixmap, clipped_source_regions [j].region, &n_mask_regions, mask_repeat_type, 0, 0); is_normal_mask_fbo = 1; } else if (is_normal_mask_fbo && !is_normal_source_fbo) { assert(n_source_regions == 1); /* The source fbo is not a normal fbo box, it has transform or repeatpad. * the valid clip region should be the clip dest region rather than the * clip source region.*/ RegionTranslate(clipped_dest_regions[i].region, -x_dest + x_mask, -y_dest + y_mask); clipped_mask_regions = glamor_compute_clipped_regions(mask_pixmap, clipped_dest_regions [i].region, &n_mask_regions, mask_repeat_type, 0, 0); is_normal_mask_fbo = 1; } else { /* This mask region has transform or repeatpad, we need clip it against the previous * valid region rather than the mask region. */ if (!is_normal_source_fbo) clipped_mask_regions = glamor_compute_transform_clipped_regions (mask_pixmap, mask->transform, clipped_dest_regions[i].region, &n_mask_regions, x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0, 0); else clipped_mask_regions = glamor_compute_transform_clipped_regions (mask_pixmap, mask->transform, clipped_source_regions[j].region, &n_mask_regions, x_mask - x_source, y_mask - y_source, mask_repeat_type, 0, 0); is_normal_mask_fbo = 0; if (n_mask_regions == 0) { /* Pad the out-of-box region to (0,0,0,0). */ null_mask = 1; n_mask_regions = 1; } else _glamor_process_transformed_clipped_region (mask_pixmap, mask_pixmap_priv, mask_repeat_type, clipped_mask_regions, &n_mask_regions, &need_clean_mask_fbo); } DEBUGF("mask clipped result %d region: \n", n_mask_regions); #define COMPOSITE_REGION(region) do { \ if (!glamor_composite_clipped_region(op, \ null_source ? NULL : source, \ null_mask ? NULL : mask, dest, \ null_source ? NULL : source_pixmap, \ null_mask ? NULL : mask_pixmap, \ dest_pixmap, region, \ x_source, y_source, x_mask, y_mask, \ x_dest, y_dest)) { \ assert(0); \ } \ } while(0) for (k = 0; k < n_mask_regions; k++) { DEBUGF("mask region %d idx %d\n", k, clipped_mask_regions[k].block_idx); DEBUGRegionPrint(clipped_mask_regions[k].region); if (is_normal_mask_fbo) { glamor_set_pixmap_fbo_current(mask_pixmap_priv, clipped_mask_regions[k]. block_idx); DEBUGF("mask fbo off %d %d \n", __glamor_large(mask_pixmap_priv)->box.x1, __glamor_large(mask_pixmap_priv)->box.y1); DEBUGF("start composite mask hasn't transform.\n"); RegionTranslate(clipped_mask_regions[k].region, x_dest - x_mask + dest->pDrawable->x, y_dest - y_mask + dest->pDrawable->y); COMPOSITE_REGION(clipped_mask_regions[k].region); } else if (!is_normal_mask_fbo && !is_normal_source_fbo) { DEBUGF ("start composite both mask and source have transform.\n"); RegionTranslate(clipped_dest_regions[i].region, dest->pDrawable->x, dest->pDrawable->y); COMPOSITE_REGION(clipped_dest_regions[i].region); } else { DEBUGF ("start composite only mask has transform.\n"); RegionTranslate(clipped_source_regions[j].region, x_dest - x_source + dest->pDrawable->x, y_dest - y_source + dest->pDrawable->y); COMPOSITE_REGION(clipped_source_regions[j].region); } RegionDestroy(clipped_mask_regions[k].region); } free(clipped_mask_regions); if (null_mask) null_mask = 0; if (need_clean_mask_fbo) { assert(is_normal_mask_fbo == 0); glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo); mask_pixmap_priv->fbo = NULL; need_clean_mask_fbo = 0; } } else { if (is_normal_source_fbo) { RegionTranslate(clipped_source_regions[j].region, -x_source + x_dest + dest->pDrawable->x, -y_source + y_dest + dest->pDrawable->y); COMPOSITE_REGION(clipped_source_regions[j].region); } else { /* Source has transform or repeatPad. dest regions is the right * region to do the composite. */ RegionTranslate(clipped_dest_regions[i].region, dest->pDrawable->x, dest->pDrawable->y); COMPOSITE_REGION(clipped_dest_regions[i].region); } } if (clipped_source_regions && clipped_source_regions[j].region) RegionDestroy(clipped_source_regions[j].region); } free(clipped_source_regions); if (null_source) null_source = 0; if (need_clean_source_fbo) { assert(is_normal_source_fbo == 0); glamor_destroy_fbo(glamor_priv, source_pixmap_priv->fbo); source_pixmap_priv->fbo = NULL; need_clean_source_fbo = 0; } } else { if (mask_pixmap_priv && glamor_pixmap_priv_is_large(mask_pixmap_priv)) { if (!mask->transform && mask_repeat_type != RepeatPad) { RegionTranslate(clipped_dest_regions[i].region, x_mask - x_dest, y_mask - y_dest); clipped_mask_regions = glamor_compute_clipped_regions(mask_pixmap, clipped_dest_regions[i]. region, &n_mask_regions, mask_repeat_type, 0, 0); is_normal_mask_fbo = 1; } else { clipped_mask_regions = glamor_compute_transform_clipped_regions (mask_pixmap, mask->transform, clipped_dest_regions[i].region, &n_mask_regions, x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0, 0); is_normal_mask_fbo = 0; if (n_mask_regions == 0) { /* Pad the out-of-box region to (0,0,0,0). */ null_mask = 1; n_mask_regions = 1; } else _glamor_process_transformed_clipped_region (mask_pixmap, mask_pixmap_priv, mask_repeat_type, clipped_mask_regions, &n_mask_regions, &need_clean_mask_fbo); } for (k = 0; k < n_mask_regions; k++) { DEBUGF("mask region %d idx %d\n", k, clipped_mask_regions[k].block_idx); DEBUGRegionPrint(clipped_mask_regions[k].region); if (is_normal_mask_fbo) { glamor_set_pixmap_fbo_current(mask_pixmap_priv, clipped_mask_regions[k]. block_idx); RegionTranslate(clipped_mask_regions[k].region, x_dest - x_mask + dest->pDrawable->x, y_dest - y_mask + dest->pDrawable->y); COMPOSITE_REGION(clipped_mask_regions[k].region); } else { RegionTranslate(clipped_dest_regions[i].region, dest->pDrawable->x, dest->pDrawable->y); COMPOSITE_REGION(clipped_dest_regions[i].region); } RegionDestroy(clipped_mask_regions[k].region); } free(clipped_mask_regions); if (null_mask) null_mask = 0; if (need_clean_mask_fbo) { glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo); mask_pixmap_priv->fbo = NULL; need_clean_mask_fbo = 0; } } else { RegionTranslate(clipped_dest_regions[i].region, dest->pDrawable->x, dest->pDrawable->y); COMPOSITE_REGION(clipped_dest_regions[i].region); } } RegionDestroy(clipped_dest_regions[i].region); } free(clipped_dest_regions); free(need_free_source_pixmap_priv); free(need_free_mask_pixmap_priv); ok = TRUE; return ok; } xorg-server-1.20.8/glamor/glamor.h0000644000175000017500000004163113640201473013726 00000000000000/* * Copyright © 2008 Intel Corporation * * 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. * * Authors: * Eric Anholt * Zhigang Gong * */ #ifndef GLAMOR_H #define GLAMOR_H #include #include #include #include #include #include #ifdef GLAMOR_FOR_XORG #include #endif struct glamor_context; struct gbm_bo; struct gbm_device; /* * glamor_pixmap_type : glamor pixmap's type. * @MEMORY: pixmap is in memory. * @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer. * @SEPARATE_TEXTURE: The texture is created from a DRM buffer, but * the format is incompatible, so this type of pixmap * will never fallback to DDX layer. * @DRM_ONLY: pixmap is in a external DRM buffer. * @TEXTURE_ONLY: pixmap is in an internal texture. */ typedef enum glamor_pixmap_type { GLAMOR_MEMORY = 0, /* Newly calloc()ed pixmaps are memory. */ GLAMOR_TEXTURE_DRM, GLAMOR_DRM_ONLY, GLAMOR_TEXTURE_ONLY, } glamor_pixmap_type_t; typedef Bool (*GetDrawableModifiersFuncPtr) (DrawablePtr draw, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); #define GLAMOR_EGL_EXTERNAL_BUFFER 3 #define GLAMOR_USE_EGL_SCREEN (1 << 0) #define GLAMOR_NO_DRI3 (1 << 1) #define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \ | GLAMOR_NO_DRI3) /* until we need geometry shaders GL3.1 should suffice. */ #define GLAMOR_GL_CORE_VER_MAJOR 3 #define GLAMOR_GL_CORE_VER_MINOR 1 /* @glamor_init: Initialize glamor internal data structure. * * @screen: Current screen pointer. * @flags: Please refer the flags description above. * * @GLAMOR_USE_EGL_SCREEN: * If you are using EGL layer, then please set this bit * on, otherwise, clear it. * * @GLAMOR_NO_DRI3 * Disable the built-in DRI3 support * * This function initializes necessary internal data structure * for glamor. And before calling into this function, the OpenGL * environment should be ready. Should be called before any real * glamor rendering or texture allocation functions. And should * be called after the DDX's screen initialization or at the last * step of the DDX's screen initialization. */ extern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags); extern _X_EXPORT void glamor_fini(ScreenPtr screen); /* This function is used to free the glamor private screen's * resources. If the DDX driver is not set GLAMOR_USE_SCREEN, * then, DDX need to call this function at proper stage, if * it is the xorg DDX driver,then it should be called at free * screen stage not the close screen stage. The reason is after * call to this function, the xorg DDX may need to destroy the * screen pixmap which must be a glamor pixmap and requires * the internal data structure still exist at that time. * Otherwise, the glamor internal structure will not be freed.*/ extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen); extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap); extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex); extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type); extern _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap); extern _X_EXPORT void glamor_block_handler(ScreenPtr screen); extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, unsigned int usage); extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap); #define GLAMOR_CREATE_PIXMAP_CPU 0x100 #define GLAMOR_CREATE_PIXMAP_FIXUP 0x101 #define GLAMOR_CREATE_FBO_NO_FBO 0x103 #define GLAMOR_CREATE_NO_LARGE 0x105 #define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106 /* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo). * * @front: front pixmap. * @back: back pixmap. * * Used by the DRI2 page flip. This function will exchange the KHR images and * fbos of the two pixmaps. * */ extern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back); extern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back); /* The DDX is not supposed to call these four functions */ extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen); extern _X_EXPORT int glamor_egl_fds_from_pixmap(ScreenPtr, PixmapPtr, int *, uint32_t *, uint32_t *, uint64_t *); extern _X_EXPORT int glamor_egl_fd_name_from_pixmap(ScreenPtr, PixmapPtr, CARD16 *, CARD32 *); extern _X_EXPORT struct gbm_device *glamor_egl_get_gbm_device(ScreenPtr screen); extern _X_EXPORT int glamor_egl_fd_from_pixmap(ScreenPtr, PixmapPtr, CARD16 *, CARD32 *); /* @glamor_supports_pixmap_import_export: Returns whether * glamor_fds_from_pixmap(), glamor_name_from_pixmap(), and * glamor_pixmap_from_fds() are supported. * * @screen: Current screen pointer. * * To have DRI3 support enabled, glamor and glamor_egl need to be * initialized. glamor also has to be compiled with gbm support. * * The EGL layer needs to have the following extensions working: * * .EGL_KHR_surfaceless_context * */ extern _X_EXPORT Bool glamor_supports_pixmap_import_export(ScreenPtr screen); /* @glamor_fds_from_pixmap: Get a dma-buf fd from a pixmap. * * @screen: Current screen pointer. * @pixmap: The pixmap from which we want the fd. * @fds, @strides, @offsets: Pointers to fill info of each plane. * @modifier: Pointer to fill the modifier of the buffer. * * the pixmap and the buffer associated by the fds will share the same * content. The caller is responsible to close the returned file descriptors. * Returns the number of planes, -1 on error. * */ extern _X_EXPORT int glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier); /* @glamor_fd_from_pixmap: Get a dma-buf fd from a pixmap. * * @screen: Current screen pointer. * @pixmap: The pixmap from which we want the fd. * @stride, @size: Pointers to fill the stride and size of the * buffer associated to the fd. * * the pixmap and the buffer associated by the fd will share the same * content. * Returns the fd on success, -1 on error. * */ extern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size); /* @glamor_shareable_fd_from_pixmap: Get a dma-buf fd suitable for sharing * with other GPUs from a pixmap. * * @screen: Current screen pointer. * @pixmap: The pixmap from which we want the fd. * @stride, @size: Pointers to fill the stride and size of the * buffer associated to the fd. * * The returned fd will point to a buffer which is suitable for sharing * across GPUs (not using GPU specific tiling). * The pixmap and the buffer associated by the fd will share the same * content. * The pixmap's stride may be modified by this function. * Returns the fd on success, -1 on error. * */ extern _X_EXPORT int glamor_shareable_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size); /** * @glamor_name_from_pixmap: Gets a gem name from a pixmap. * * @pixmap: The pixmap from which we want the gem name. * * the pixmap and the buffer associated by the gem name will share the * same content. This function can be used by the DDX to support DRI2, * and needs the same set of buffer export GL extensions as DRI3 * support. * * Returns the name on success, -1 on error. * */ extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size); /* @glamor_gbm_bo_from_pixmap: Get a GBM bo from a pixmap. * * @screen: Current screen pointer. * @pixmap: The pixmap from which we want the fd. * @stride, @size: Pointers to fill the stride and size of the * buffer associated to the fd. * * the pixmap and the buffer represented by the gbm_bo will share the same * content. * * Returns the gbm_bo on success, NULL on error. * */ extern _X_EXPORT struct gbm_bo *glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap); /* @glamor_pixmap_from_fds: Creates a pixmap to wrap a dma-buf fds. * * @screen: Current screen pointer. * @num_fds: Number of fds to import * @fds: The dma-buf fds to import. * @width: The width of the buffers. * @height: The height of the buffers. * @stride: The stride of the buffers. * @depth: The depth of the buffers. * @bpp: The bpp of the buffers. * @modifier: The modifier of the buffers. * * Returns a valid pixmap if the import succeeded, else NULL. * */ extern _X_EXPORT PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds, CARD16 width, CARD16 height, const CARD32 *strides, const CARD32 *offsets, CARD8 depth, CARD8 bpp, uint64_t modifier); /* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd. * * @screen: Current screen pointer. * @fd: The dma-buf fd to import. * @width: The width of the buffer. * @height: The height of the buffer. * @stride: The stride of the buffer. * @depth: The depth of the buffer. * @bpp: The bpp of the buffer. * * Returns a valid pixmap if the import succeeded, else NULL. * */ extern _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen, int fd, CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp); /* @glamor_back_pixmap_from_fd: Backs an existing pixmap with a dma-buf fd. * * @pixmap: Pixmap to change backing for * @fd: The dma-buf fd to import. * @width: The width of the buffer. * @height: The height of the buffer. * @stride: The stride of the buffer. * @depth: The depth of the buffer. * @bpp: The number of bpp of the buffer. * * Returns TRUE if successful, FALSE on failure. * */ extern _X_EXPORT Bool glamor_back_pixmap_from_fd(PixmapPtr pixmap, int fd, CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp); extern _X_EXPORT Bool glamor_get_formats(ScreenPtr screen, CARD32 *num_formats, CARD32 **formats); extern _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); extern _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); extern _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen, GetDrawableModifiersFuncPtr func); #ifdef GLAMOR_FOR_XORG #define GLAMOR_EGL_MODULE_NAME "glamoregl" /* @glamor_egl_init: Initialize EGL environment. * * @scrn: Current screen info pointer. * @fd: Current drm fd. * * This function creates and intialize EGL contexts. * Should be called from DDX's preInit function. * Return TRUE if success, otherwise return FALSE. * */ extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd); extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen); /* @glamor_egl_create_textured_screen: Create textured screen pixmap. * * @screen: screen pointer to be processed. * @handle: screen pixmap's BO handle. * @stride: screen pixmap's stride in bytes. * * This function is similar with the create_textured_pixmap. As the * screen pixmap is a special, we handle it separately in this function. */ extern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride); /* Obsolete entrypoint, temporarily left here for API compatibility * for xf86-video-ati. */ #define glamor_egl_create_textured_screen_ext(a, b, c, d) \ glamor_egl_create_textured_screen(a, b, c) /* * @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from * a BO handle. * * @pixmap: The pixmap need to be processed. * @handle: The BO's handle attached to this pixmap at DDX layer. * @stride: Stride in bytes for this pixmap. * * This function try to create a texture from the handle and attach * the texture to the pixmap , thus glamor can render to this pixmap * as well. Return true if successful, otherwise return FALSE. */ extern _X_EXPORT Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride); /* * @glamor_egl_create_textured_pixmap_from_bo: Try to create a textured pixmap * from a gbm_bo. * * @pixmap: The pixmap need to be processed. * @bo: a pointer on a gbm_bo structure attached to this pixmap at DDX layer. * * This function is similar to glamor_egl_create_textured_pixmap. */ extern _X_EXPORT Bool glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, struct gbm_bo *bo, Bool used_modifiers); extern _X_EXPORT const char *glamor_egl_get_driver_name(ScreenPtr screen); #endif extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx); extern _X_EXPORT int glamor_create_gc(GCPtr gc); extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable); extern _X_EXPORT void glamor_destroy_gc(GCPtr gc); #define HAS_GLAMOR_DESTROY_GC 1 extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask); extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region); extern _X_EXPORT void glamor_finish(ScreenPtr screen); #define HAS_GLAMOR_TEXT 1 #ifdef GLAMOR_FOR_XORG extern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen, int num_texture_ports); #endif #endif /* GLAMOR_H */ xorg-server-1.20.8/glamor/meson.build0000644000175000017500000000232613640201473014434 00000000000000srcs_glamor = [ 'glamor.c', 'glamor_copy.c', 'glamor_core.c', 'glamor_dash.c', 'glamor_font.c', 'glamor_glx.c', 'glamor_composite_glyphs.c', 'glamor_image.c', 'glamor_lines.c', 'glamor_segs.c', 'glamor_render.c', 'glamor_gradient.c', 'glamor_prepare.c', 'glamor_program.c', 'glamor_rects.c', 'glamor_spans.c', 'glamor_text.c', 'glamor_transfer.c', 'glamor_transform.c', 'glamor_trapezoid.c', 'glamor_triangles.c', 'glamor_addtraps.c', 'glamor_glyphblt.c', 'glamor_points.c', 'glamor_pixmap.c', 'glamor_largepixmap.c', 'glamor_picture.c', 'glamor_vbo.c', 'glamor_window.c', 'glamor_fbo.c', 'glamor_compositerects.c', 'glamor_utils.c', 'glamor_sync.c', ] if build_xv srcs_glamor += 'glamor_xv.c' endif epoxy_dep = dependency('epoxy') glamor = static_library('glamor', srcs_glamor, include_directories: inc, dependencies: [ common_dep, epoxy_dep, ], ) glamor_egl_stubs = static_library('glamor_egl_stubs', 'glamor_egl_stubs.c', include_directories: inc, dependencies: common_dep, ) if build_xorg install_data('glamor.h', install_dir: xorgsdkdir) endif xorg-server-1.20.8/glamor/glamor_core.c0000644000175000017500000002111713640201473014726 00000000000000/* * Copyright © 2001 Keith Packard * Copyright © 2008 Intel Corporation * * 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. * * Authors: * Eric Anholt * */ /** @file glamor_core.c * * This file covers core X rendering in glamor. */ #include #include "glamor_priv.h" Bool glamor_get_drawable_location(const DrawablePtr drawable) { PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); if (pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) return 'm'; else return 'f'; } GLint glamor_compile_glsl_prog(GLenum type, const char *source) { GLint ok; GLint prog; prog = glCreateShader(type); glShaderSource(prog, 1, (const GLchar **) &source, NULL); glCompileShader(prog); glGetShaderiv(prog, GL_COMPILE_STATUS, &ok); if (!ok) { GLchar *info; GLint size; glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size); info = malloc(size); if (info) { glGetShaderInfoLog(prog, size, NULL, info); ErrorF("Failed to compile %s: %s\n", type == GL_FRAGMENT_SHADER ? "FS" : "VS", info); ErrorF("Program source:\n%s", source); free(info); } else ErrorF("Failed to get shader compilation info.\n"); FatalError("GLSL compile failure\n"); } return prog; } void glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...) { GLint ok; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); if (glamor_priv->has_khr_debug) { char *label; va_list va; va_start(va, format); XNFvasprintf(&label, format, va); glObjectLabel(GL_PROGRAM, prog, -1, label); free(label); va_end(va); } glLinkProgram(prog); glGetProgramiv(prog, GL_LINK_STATUS, &ok); if (!ok) { GLchar *info; GLint size; glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); info = malloc(size); glGetProgramInfoLog(prog, size, NULL, info); ErrorF("Failed to link: %s\n", info); FatalError("GLSL link failure\n"); } } static GCOps glamor_gc_ops = { .FillSpans = glamor_fill_spans, .SetSpans = glamor_set_spans, .PutImage = glamor_put_image, .CopyArea = glamor_copy_area, .CopyPlane = glamor_copy_plane, .PolyPoint = glamor_poly_point, .Polylines = glamor_poly_lines, .PolySegment = glamor_poly_segment, .PolyRectangle = miPolyRectangle, .PolyArc = miPolyArc, .FillPolygon = miFillPolygon, .PolyFillRect = glamor_poly_fill_rect, .PolyFillArc = miPolyFillArc, .PolyText8 = glamor_poly_text8, .PolyText16 = glamor_poly_text16, .ImageText8 = glamor_image_text8, .ImageText16 = glamor_image_text16, .ImageGlyphBlt = miImageGlyphBlt, .PolyGlyphBlt = glamor_poly_glyph_blt, .PushPixels = glamor_push_pixels, }; /* * When the stipple is changed or drawn to, invalidate any * cached copy */ static void glamor_invalidate_stipple(GCPtr gc) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); if (gc_priv->stipple) { if (gc_priv->stipple_damage) DamageUnregister(gc_priv->stipple_damage); glamor_destroy_pixmap(gc_priv->stipple); gc_priv->stipple = NULL; } } static void glamor_stipple_damage_report(DamagePtr damage, RegionPtr region, void *closure) { GCPtr gc = closure; glamor_invalidate_stipple(gc); } static void glamor_stipple_damage_destroy(DamagePtr damage, void *closure) { GCPtr gc = closure; glamor_gc_private *gc_priv = glamor_get_gc_private(gc); gc_priv->stipple_damage = NULL; glamor_invalidate_stipple(gc); } void glamor_track_stipple(GCPtr gc) { if (gc->stipple) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); if (!gc_priv->stipple_damage) gc_priv->stipple_damage = DamageCreate(glamor_stipple_damage_report, glamor_stipple_damage_destroy, DamageReportNonEmpty, TRUE, gc->pScreen, gc); if (gc_priv->stipple_damage) DamageRegister(&gc->stipple->drawable, gc_priv->stipple_damage); } } /** * uxa_validate_gc() sets the ops to glamor's implementations, which may be * accelerated or may sync the card and fall back to fb. */ void glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable) { /* fbValidateGC will do direct access to pixmaps if the tiling has changed. * Preempt fbValidateGC by doing its work and masking the change out, so * that we can do the Prepare/finish_access. */ if (changes & GCTile) { if (!gc->tileIsPixel) { glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(gc->tile.pixmap); if ((!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) && FbEvenTile(gc->tile.pixmap->drawable.width * drawable->bitsPerPixel)) { glamor_fallback ("GC %p tile changed %p.\n", gc, gc->tile.pixmap); if (glamor_prepare_access (&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW)) { fbPadPixmap(gc->tile.pixmap); glamor_finish_access(&gc->tile.pixmap->drawable); } } } /* Mask out the GCTile change notification, now that we've done FB's * job for it. */ changes &= ~GCTile; } if (changes & GCStipple) glamor_invalidate_stipple(gc); if (changes & GCStipple && gc->stipple) { /* We can't inline stipple handling like we do for GCTile because * it sets fbgc privates. */ if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) { fbValidateGC(gc, changes, drawable); glamor_finish_access(&gc->stipple->drawable); } } else { fbValidateGC(gc, changes, drawable); } if (changes & GCDashList) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); if (gc_priv->dash) { glamor_destroy_pixmap(gc_priv->dash); gc_priv->dash = NULL; } } gc->ops = &glamor_gc_ops; } void glamor_destroy_gc(GCPtr gc) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); if (gc_priv->dash) { glamor_destroy_pixmap(gc_priv->dash); gc_priv->dash = NULL; } glamor_invalidate_stipple(gc); if (gc_priv->stipple_damage) DamageDestroy(gc_priv->stipple_damage); miDestroyGC(gc); } static GCFuncs glamor_gc_funcs = { glamor_validate_gc, miChangeGC, miCopyGC, glamor_destroy_gc, miChangeClip, miDestroyClip, miCopyClip }; /** * exaCreateGC makes a new GC and hooks up its funcs handler, so that * exaValidateGC() will get called. */ int glamor_create_gc(GCPtr gc) { glamor_gc_private *gc_priv = glamor_get_gc_private(gc); gc_priv->dash = NULL; gc_priv->stipple = NULL; if (!fbCreateGC(gc)) return FALSE; gc->funcs = &glamor_gc_funcs; return TRUE; } RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap) { RegionPtr ret; glamor_fallback("pixmap %p \n", pixmap); if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO)) return NULL; ret = fbPixmapToRegion(pixmap); glamor_finish_access(&pixmap->drawable); return ret; } xorg-server-1.20.8/glamor/glamor_text.c0000644000175000017500000003731313640201473014767 00000000000000/* * Copyright © 2014 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 "glamor_priv.h" #include #include "glamor_transform.h" /* * Fill in the array of charinfo pointers for the provided characters. For * missing characters, place a NULL in the array so that the charinfo array * aligns exactly with chars */ static void glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font, int count, char *chars, Bool sixteen, CharInfoPtr *charinfo) { unsigned long nglyphs; FontEncoding encoding; int char_step; int c; if (sixteen) { char_step = 2; if (FONTLASTROW(font) == 0) encoding = Linear16Bit; else encoding = TwoD16Bit; } else { char_step = 1; encoding = Linear8Bit; } /* If the font has a default character, then we shouldn't have to * worry about missing glyphs, so just get the whole string all at * once. Otherwise, we have to fetch chars one at a time to notice * missing ones. */ if (glamor_font->default_char) { GetGlyphs(font, (unsigned long) count, (unsigned char *) chars, encoding, &nglyphs, charinfo); /* Make sure it worked. There's a bug in libXfont through * version 1.4.7 which would cause it to fail when the font is * a 2D font without a first row, and the application sends a * 1-d request. In this case, libXfont would return zero * glyphs, even when the font had a default character. * * It's easy enough for us to work around that bug here by * simply checking the returned nglyphs and falling through to * the one-at-a-time code below. Not doing this check would * result in uninitialized memory accesses in the rendering code. */ if (nglyphs == count) return; } for (c = 0; c < count; c++) { GetGlyphs(font, 1, (unsigned char *) chars, encoding, &nglyphs, &charinfo[c]); if (!nglyphs) charinfo[c] = NULL; chars += char_step; } } /* * Construct quads for the provided list of characters and draw them */ static int glamor_text(DrawablePtr drawable, GCPtr gc, glamor_font_t *glamor_font, glamor_program *prog, int x, int y, int count, char *s_chars, CharInfoPtr *charinfo, Bool sixteen) { unsigned char *chars = (unsigned char *) s_chars; FontPtr font = gc->font; int off_x, off_y; int c; int nglyph; GLshort *v; char *vbo_offset; CharInfoPtr ci; int firstRow = font->info.firstRow; int firstCol = font->info.firstCol; int glyph_spacing_x = glamor_font->glyph_width_bytes * 8; int glyph_spacing_y = glamor_font->glyph_height; int box_index; PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); /* Set the font as texture 1 */ glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id); glUniform1i(prog->font_uniform, 1); /* Set up the vertex buffers for the font and destination */ v = glamor_get_vbo_space(drawable->pScreen, count * (6 * sizeof (GLshort)), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE, 6 * sizeof (GLshort), vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 1); glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_SHORT, GL_FALSE, 6 * sizeof (GLshort), vbo_offset + 4 * sizeof (GLshort)); /* Set the vertex coordinates */ nglyph = 0; for (c = 0; c < count; c++) { if ((ci = *charinfo++)) { int x1 = x + ci->metrics.leftSideBearing; int y1 = y - ci->metrics.ascent; int width = GLYPHWIDTHPIXELS(ci); int height = GLYPHHEIGHTPIXELS(ci); int tx, ty = 0; int row = 0, col; int second_row = 0; x += ci->metrics.characterWidth; if (sixteen) { if (ci == glamor_font->default_char) { row = glamor_font->default_row; col = glamor_font->default_col; } else { row = chars[0]; col = chars[1]; } if (FONTLASTROW(font) != 0) { ty = ((row - firstRow) / 2) * glyph_spacing_y; second_row = (row - firstRow) & 1; } else col += row << 8; } else { if (ci == glamor_font->default_char) col = glamor_font->default_col; else col = chars[0]; } tx = (col - firstCol) * glyph_spacing_x; /* adjust for second row layout */ tx += second_row * glamor_font->row_width * 8; v[ 0] = x1; v[ 1] = y1; v[ 2] = width; v[ 3] = height; v[ 4] = tx; v[ 5] = ty; v += 6; nglyph++; } chars += 1 + sixteen; } glamor_put_vbo_space(drawable->pScreen); if (nglyph != 0) { glEnable(GL_SCISSOR_TEST); glamor_pixmap_loop(pixmap_priv, box_index) { BoxPtr box = RegionRects(gc->pCompositeClip); int nbox = RegionNumRects(gc->pCompositeClip); glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y); /* Run over the clip list, drawing the glyphs * in each box */ while (nbox--) { glScissor(box->x1 + off_x, box->y1 + off_y, box->x2 - box->x1, box->y2 - box->y1); box++; glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph); } } glDisable(GL_SCISSOR_TEST); } glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); return x; } static const char vs_vars_text[] = "attribute vec4 primitive;\n" "attribute vec2 source;\n" "varying vec2 glyph_pos;\n"; static const char vs_exec_text[] = " vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" GLAMOR_POS(gl_Position, (primitive.xy + pos)) " glyph_pos = source + pos;\n"; static const char fs_vars_text[] = "varying vec2 glyph_pos;\n"; static const char fs_exec_text[] = " ivec2 itile_texture = ivec2(glyph_pos);\n" " uint x = uint(itile_texture.x & 7);\n" " itile_texture.x >>= 3;\n" " uint texel = texelFetch(font, itile_texture, 0).x;\n" " uint bit = (texel >> x) & uint(1);\n" " if (bit == uint(0))\n" " discard;\n"; static const char fs_exec_te[] = " ivec2 itile_texture = ivec2(glyph_pos);\n" " uint x = uint(itile_texture.x & 7);\n" " itile_texture.x >>= 3;\n" " uint texel = texelFetch(font, itile_texture, 0).x;\n" " uint bit = (texel >> x) & uint(1);\n" " if (bit == uint(0))\n" " gl_FragColor = bg;\n" " else\n" " gl_FragColor = fg;\n"; static const glamor_facet glamor_facet_poly_text = { .name = "poly_text", .version = 130, .vs_vars = vs_vars_text, .vs_exec = vs_exec_text, .fs_vars = fs_vars_text, .fs_exec = fs_exec_text, .source_name = "source", .locations = glamor_program_location_font, }; static Bool glamor_poly_text(DrawablePtr drawable, GCPtr gc, int x, int y, int count, char *chars, Bool sixteen, int *final_pos) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_program *prog; glamor_pixmap_private *pixmap_priv; glamor_font_t *glamor_font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ glamor_font = glamor_font_get(drawable->pScreen, gc->font); if (!glamor_font) goto bail; glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo); pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) goto bail; glamor_make_current(glamor_priv); prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text); if (!prog) goto bail; x = glamor_text(drawable, gc, glamor_font, prog, x, y, count, chars, charinfo, sixteen); *final_pos = x; return TRUE; bail: return FALSE; } int glamor_poly_text8(DrawablePtr drawable, GCPtr gc, int x, int y, int count, char *chars) { int final_pos; if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, &final_pos)) return final_pos; return miPolyText8(drawable, gc, x, y, count, chars); } int glamor_poly_text16(DrawablePtr drawable, GCPtr gc, int x, int y, int count, unsigned short *chars) { int final_pos; if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, &final_pos)) return final_pos; return miPolyText16(drawable, gc, x, y, count, chars); } /* * Draw image text, which is always solid in copy mode and has the * background cleared while painting the text. For fonts which have * their bitmap metrics exactly equal to the area to clear, we can use * the accelerated version which paints both fg and bg at the same * time. Otherwise, clear the whole area and then paint the glyphs on * top */ static const glamor_facet glamor_facet_image_text = { .name = "image_text", .version = 130, .vs_vars = vs_vars_text, .vs_exec = vs_exec_text, .fs_vars = fs_vars_text, .fs_exec = fs_exec_text, .source_name = "source", .locations = glamor_program_location_font, }; static Bool use_image_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { return glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform); } static const glamor_facet glamor_facet_image_fill = { .name = "solid", .fs_exec = " gl_FragColor = fg;\n", .locations = glamor_program_location_fg, .use = use_image_solid, }; static Bool glamor_te_text_use(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) { if (!glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform)) return FALSE; glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform); return TRUE; } static const glamor_facet glamor_facet_te_text = { .name = "te_text", .version = 130, .vs_vars = vs_vars_text, .vs_exec = vs_exec_text, .fs_vars = fs_vars_text, .fs_exec = fs_exec_te, .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_font, .source_name = "source", .use = glamor_te_text_use, }; static Bool glamor_image_text(DrawablePtr drawable, GCPtr gc, int x, int y, int count, char *chars, Bool sixteen) { ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_program *prog; glamor_pixmap_private *pixmap_priv; glamor_font_t *glamor_font; const glamor_facet *prim_facet; const glamor_facet *fill_facet; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ pixmap_priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) return FALSE; glamor_font = glamor_font_get(drawable->pScreen, gc->font); if (!glamor_font) return FALSE; glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo); glamor_make_current(glamor_priv); if (TERMINALFONT(gc->font)) prog = &glamor_priv->te_text_prog; else prog = &glamor_priv->image_text_prog; if (prog->failed) goto bail; if (!prog->prog) { if (TERMINALFONT(gc->font)) { prim_facet = &glamor_facet_te_text; fill_facet = NULL; } else { prim_facet = &glamor_facet_image_text; fill_facet = &glamor_facet_image_fill; } if (!glamor_build_program(screen, prog, prim_facet, fill_facet, NULL, NULL)) goto bail; } if (!TERMINALFONT(gc->font)) { int width = 0; int c; RegionRec region; BoxRec box; int off_x, off_y; /* Check planemask before drawing background to * bail early if it's not OK */ if (!glamor_set_planemask(gc->depth, gc->planemask)) goto bail; for (c = 0; c < count; c++) if (charinfo[c]) width += charinfo[c]->metrics.characterWidth; glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); if (width >= 0) { box.x1 = drawable->x + x; box.x2 = drawable->x + x + width; } else { box.x1 = drawable->x + x + width; box.x2 = drawable->x + x; } box.y1 = drawable->y + y - gc->font->info.fontAscent; box.y2 = drawable->y + y + gc->font->info.fontDescent; RegionInit(®ion, &box, 1); RegionIntersect(®ion, ®ion, gc->pCompositeClip); RegionTranslate(®ion, off_x, off_y); glamor_solid_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion), gc->bgPixel); RegionUninit(®ion); } if (!glamor_use_program(pixmap, gc, prog, NULL)) goto bail; (void) glamor_text(drawable, gc, glamor_font, prog, x, y, count, chars, charinfo, sixteen); return TRUE; bail: return FALSE; } void glamor_image_text8(DrawablePtr drawable, GCPtr gc, int x, int y, int count, char *chars) { if (!glamor_image_text(drawable, gc, x, y, count, chars, FALSE)) miImageText8(drawable, gc, x, y, count, chars); } void glamor_image_text16(DrawablePtr drawable, GCPtr gc, int x, int y, int count, unsigned short *chars) { if (!glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE)) miImageText16(drawable, gc, x, y, count, chars); } xorg-server-1.20.8/glamor/glamor_transform.h0000644000175000017500000000736213640201473016024 00000000000000/* * Copyright © 2014 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 _GLAMOR_TRANSFORM_H_ #define _GLAMOR_TRANSFORM_H_ Bool glamor_set_destination_drawable(DrawablePtr drawable, int box_index, Bool do_drawable_translate, Bool center_offset, GLint matrix_uniform_location, int *p_off_x, int *p_off_y); void glamor_set_color_depth(ScreenPtr pScreen, int depth, CARD32 pixel, GLint uniform); static inline void glamor_set_color(PixmapPtr pixmap, CARD32 pixel, GLint uniform) { glamor_set_color_depth(pixmap->drawable.pScreen, pixmap->drawable.depth, pixel, uniform); } Bool glamor_set_texture_pixmap(PixmapPtr texture, Bool destination_red); Bool glamor_set_texture(PixmapPtr texture, Bool destination_red, int off_x, int off_y, GLint offset_uniform, GLint size_uniform); Bool glamor_set_solid(PixmapPtr pixmap, GCPtr gc, Bool use_alu, GLint uniform); Bool glamor_set_tiled(PixmapPtr pixmap, GCPtr gc, GLint offset_uniform, GLint size_uniform); Bool glamor_set_stippled(PixmapPtr pixmap, GCPtr gc, GLint fg_uniform, GLint offset_uniform, GLint size_uniform); /* * Vertex shader bits that transform X coordinates to pixmap * coordinates using the matrix computed above */ #define GLAMOR_DECLARE_MATRIX "uniform vec4 v_matrix;\n" #define GLAMOR_X_POS(x) #x " *v_matrix.x + v_matrix.y" #define GLAMOR_Y_POS(y) #y " *v_matrix.z + v_matrix.w" #if 0 #define GLAMOR_POS(dst,src) \ " " #dst ".x = " #src ".x * v_matrix.x + v_matrix.y;\n" \ " " #dst ".y = " #src ".y * v_matrix.z + v_matrix.w;\n" \ " " #dst ".z = 0.0;\n" \ " " #dst ".w = 1.0;\n" #endif #define GLAMOR_POS(dst,src) \ " " #dst ".xy = " #src ".xy * v_matrix.xz + v_matrix.yw;\n" \ " " #dst ".zw = vec2(0.0,1.0);\n" #endif /* _GLAMOR_TRANSFORM_H_ */ xorg-server-1.20.8/glamor/glamor_addtraps.c0000644000175000017500000000306513640201473015602 00000000000000/* * Copyright © 2009 Intel Corporation * Copyright © 1998 Keith Packard * * 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. * * Authors: * Zhigang Gong * */ #include "glamor_priv.h" void glamor_add_traps(PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntrap, xTrap *traps) { if (glamor_prepare_access_picture(pPicture, GLAMOR_ACCESS_RW)) { fbAddTraps(pPicture, x_off, y_off, ntrap, traps); } glamor_finish_access_picture(pPicture); } xorg-server-1.20.8/render/0000755000175000017500000000000013640201533012342 500000000000000xorg-server-1.20.8/render/mirect.c0000644000175000017500000000751313640201473013722 00000000000000/* * * Copyright © 2000 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" static void miColorRects(PicturePtr pDst, PicturePtr pClipPict, xRenderColor * color, int nRect, xRectangle *rects, int xoff, int yoff) { CARD32 pixel; GCPtr pGC; ChangeGCVal tmpval[5]; RegionPtr pClip; unsigned long mask; miRenderColorToPixel(pDst->pFormat, color, &pixel); pGC = GetScratchGC(pDst->pDrawable->depth, pDst->pDrawable->pScreen); if (!pGC) return; tmpval[0].val = GXcopy; tmpval[1].val = pixel; tmpval[2].val = pDst->subWindowMode; mask = GCFunction | GCForeground | GCSubwindowMode; if (pClipPict->clientClip) { tmpval[3].val = pDst->clipOrigin.x - xoff; tmpval[4].val = pDst->clipOrigin.y - yoff; mask |= GCClipXOrigin | GCClipYOrigin; pClip = RegionCreate(NULL, 1); RegionCopy(pClip, (RegionPtr) pClipPict->clientClip); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); } ChangeGC(NullClient, pGC, mask, tmpval); ValidateGC(pDst->pDrawable, pGC); if (xoff || yoff) { int i; for (i = 0; i < nRect; i++) { rects[i].x -= xoff; rects[i].y -= yoff; } } (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects); if (xoff || yoff) { int i; for (i = 0; i < nRect; i++) { rects[i].x += xoff; rects[i].y += yoff; } } FreeScratchGC(pGC); } void miCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects) { if (color->alpha == 0xffff) { if (op == PictOpOver) op = PictOpSrc; } if (op == PictOpClear) color->red = color->green = color->blue = color->alpha = 0; if (op == PictOpSrc || op == PictOpClear) { miColorRects(pDst, pDst, color, nRect, rects, 0, 0); if (pDst->alphaMap) miColorRects(pDst->alphaMap, pDst, color, nRect, rects, pDst->alphaOrigin.x, pDst->alphaOrigin.y); } else { int error; PicturePtr pSrc = CreateSolidPicture(0, color, &error); if (pSrc) { while (nRect--) { CompositePicture(op, pSrc, 0, pDst, 0, 0, 0, 0, rects->x, rects->y, rects->width, rects->height); rects++; } FreePicture((void *) pSrc, 0); } } } xorg-server-1.20.8/render/Makefile.am0000644000175000017500000000044413640201473014323 00000000000000noinst_LTLIBRARIES = librender.la AM_CFLAGS = $(DIX_CFLAGS) librender_la_SOURCES = \ animcur.c \ filter.c \ glyph.c \ matrix.c \ miindex.c \ mipict.c \ mirect.c \ mitrap.c \ mitri.c \ picture.c \ render.c if XORG sdk_HEADERS = picture.h mipict.h glyphstr.h picturestr.h endif xorg-server-1.20.8/render/miindex.c0000644000175000017500000002247713640201473014102 00000000000000/* * * Copyright © 2001 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #ifndef _MIINDEX_H_ #define _MIINDEX_H_ #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" #include "colormapst.h" #define NUM_CUBE_LEVELS 4 #define NUM_GRAY_LEVELS 13 static Bool miBuildRenderColormap(ColormapPtr pColormap, Pixel * pixels, int *nump) { int r, g, b; unsigned short red, green, blue; Pixel pixel; Bool used[MI_MAX_INDEXED]; int needed; int policy; int cube, gray; int i, n; if (pColormap->mid != pColormap->pScreen->defColormap) { policy = PictureCmapPolicyAll; } else { int avail = pColormap->pVisual->ColormapEntries; policy = PictureCmapPolicy; if (policy == PictureCmapPolicyDefault) { if (avail >= 256 && (pColormap->pVisual->class | DynamicClass) == PseudoColor) policy = PictureCmapPolicyColor; else if (avail >= 64) policy = PictureCmapPolicyGray; else policy = PictureCmapPolicyMono; } } /* * Make sure enough cells are free for the chosen policy */ for (;;) { switch (policy) { case PictureCmapPolicyAll: needed = 0; break; case PictureCmapPolicyColor: needed = 71; break; case PictureCmapPolicyGray: needed = 11; break; case PictureCmapPolicyMono: default: needed = 0; break; } if (needed <= pColormap->freeRed) break; policy--; } /* * Compute size of cube and gray ramps */ cube = gray = 0; switch (policy) { case PictureCmapPolicyAll: /* * Allocate as big a cube as possible */ if ((pColormap->pVisual->class | DynamicClass) == PseudoColor) { for (cube = 1; cube * cube * cube < pColormap->pVisual->ColormapEntries; cube++); cube--; if (cube == 1) cube = 0; } else cube = 0; /* * Figure out how many gray levels to use so that they * line up neatly with the cube */ if (cube) { needed = pColormap->pVisual->ColormapEntries - (cube * cube * cube); /* levels to fill in with */ gray = needed / (cube - 1); /* total levels */ gray = (gray + 1) * (cube - 1) + 1; } else gray = pColormap->pVisual->ColormapEntries; break; case PictureCmapPolicyColor: cube = NUM_CUBE_LEVELS; /* fall through ... */ case PictureCmapPolicyGray: gray = NUM_GRAY_LEVELS; break; case PictureCmapPolicyMono: default: gray = 2; break; } memset(used, '\0', pColormap->pVisual->ColormapEntries * sizeof(Bool)); for (r = 0; r < cube; r++) for (g = 0; g < cube; g++) for (b = 0; b < cube; b++) { pixel = 0; red = (r * 65535 + (cube - 1) / 2) / (cube - 1); green = (g * 65535 + (cube - 1) / 2) / (cube - 1); blue = (b * 65535 + (cube - 1) / 2) / (cube - 1); if (AllocColor(pColormap, &red, &green, &blue, &pixel, 0) != Success) return FALSE; used[pixel] = TRUE; } for (g = 0; g < gray; g++) { pixel = 0; red = green = blue = (g * 65535 + (gray - 1) / 2) / (gray - 1); if (AllocColor(pColormap, &red, &green, &blue, &pixel, 0) != Success) return FALSE; used[pixel] = TRUE; } n = 0; for (i = 0; i < pColormap->pVisual->ColormapEntries; i++) if (used[i]) pixels[n++] = i; *nump = n; return TRUE; } /* 0 <= red, green, blue < 32 */ static Pixel FindBestColor(miIndexedPtr pIndexed, Pixel * pixels, int num, int red, int green, int blue) { Pixel best = pixels[0]; int bestDist = 1 << 30; int dist; int dr, dg, db; while (num--) { Pixel pixel = *pixels++; CARD32 v = pIndexed->rgba[pixel]; dr = ((v >> 19) & 0x1f); dg = ((v >> 11) & 0x1f); db = ((v >> 3) & 0x1f); dr = dr - red; dg = dg - green; db = db - blue; dist = dr * dr + dg * dg + db * db; if (dist < bestDist) { bestDist = dist; best = pixel; } } return best; } /* 0 <= gray < 32768 */ static Pixel FindBestGray(miIndexedPtr pIndexed, Pixel * pixels, int num, int gray) { Pixel best = pixels[0]; int bestDist = 1 << 30; int dist; int dr; int r; while (num--) { Pixel pixel = *pixels++; CARD32 v = pIndexed->rgba[pixel]; r = v & 0xff; r = r | (r << 8); dr = gray - (r >> 1); dist = dr * dr; if (dist < bestDist) { bestDist = dist; best = pixel; } } return best; } Bool miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat) { ColormapPtr pColormap = pFormat->index.pColormap; VisualPtr pVisual = pColormap->pVisual; miIndexedPtr pIndexed; Pixel pixels[MI_MAX_INDEXED]; xrgb rgb[MI_MAX_INDEXED]; int num; int i; Pixel p, r, g, b; if (pVisual->ColormapEntries > MI_MAX_INDEXED) return FALSE; if (pVisual->class & DynamicClass) { if (!miBuildRenderColormap(pColormap, pixels, &num)) return FALSE; } else { num = pVisual->ColormapEntries; for (p = 0; p < num; p++) pixels[p] = p; } pIndexed = malloc(sizeof(miIndexedRec)); if (!pIndexed) return FALSE; pFormat->index.nvalues = num; pFormat->index.pValues = xallocarray(num, sizeof(xIndexValue)); if (!pFormat->index.pValues) { free(pIndexed); return FALSE; } /* * Build mapping from pixel value to ARGB */ QueryColors(pColormap, num, pixels, rgb, serverClient); for (i = 0; i < num; i++) { p = pixels[i]; pFormat->index.pValues[i].pixel = p; pFormat->index.pValues[i].red = rgb[i].red; pFormat->index.pValues[i].green = rgb[i].green; pFormat->index.pValues[i].blue = rgb[i].blue; pFormat->index.pValues[i].alpha = 0xffff; pIndexed->rgba[p] = (0xff000000 | ((rgb[i].red & 0xff00) << 8) | ((rgb[i].green & 0xff00)) | ((rgb[i].blue & 0xff00) >> 8)); } /* * Build mapping from RGB to pixel value. This could probably be * done a bit quicker... */ switch (pVisual->class | DynamicClass) { case GrayScale: pIndexed->color = FALSE; for (r = 0; r < 32768; r++) pIndexed->ent[r] = FindBestGray(pIndexed, pixels, num, r); break; case PseudoColor: pIndexed->color = TRUE; p = 0; for (r = 0; r < 32; r++) for (g = 0; g < 32; g++) for (b = 0; b < 32; b++) { pIndexed->ent[p] = FindBestColor(pIndexed, pixels, num, r, g, b); p++; } break; } pFormat->index.devPrivate = pIndexed; return TRUE; } void miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat) { free(pFormat->index.devPrivate); pFormat->index.devPrivate = NULL; free(pFormat->index.pValues); pFormat->index.pValues = NULL; } void miUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem * pdef) { miIndexedPtr pIndexed = pFormat->index.devPrivate; if (pIndexed) { while (ndef--) { pIndexed->rgba[pdef->pixel] = (0xff000000 | ((pdef->red & 0xff00) << 8) | ((pdef->green & 0xff00)) | ((pdef->blue & 0xff00) >> 8)); pdef++; } } } #endif /* _MIINDEX_H_ */ xorg-server-1.20.8/render/mipict.c0000644000175000017500000004540513640201473013726 00000000000000/* * * Copyright © 1999 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" int miCreatePicture(PicturePtr pPicture) { return Success; } void miDestroyPicture(PicturePtr pPicture) { if (pPicture->freeCompClip) RegionDestroy(pPicture->pCompositeClip); } static void miDestroyPictureClip(PicturePtr pPicture) { if (pPicture->clientClip) RegionDestroy(pPicture->clientClip); pPicture->clientClip = NULL; } static int miChangePictureClip(PicturePtr pPicture, int type, void *value, int n) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); RegionPtr clientClip; switch (type) { case CT_PIXMAP: /* convert the pixmap to a region */ clientClip = BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; (*pScreen->DestroyPixmap) ((PixmapPtr) value); break; case CT_REGION: clientClip = value; break; case CT_NONE: clientClip = 0; break; default: clientClip = RegionFromRects(n, (xRectangle *) value, type); if (!clientClip) return BadAlloc; free(value); break; } (*ps->DestroyPictureClip) (pPicture); pPicture->clientClip = clientClip; pPicture->stateChanges |= CPClipMask; return Success; } static void miChangePicture(PicturePtr pPicture, Mask mask) { return; } static void miValidatePicture(PicturePtr pPicture, Mask mask) { DrawablePtr pDrawable = pPicture->pDrawable; if ((mask & (CPClipXOrigin | CPClipYOrigin | CPClipMask | CPSubwindowMode)) || (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) { if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDrawable; RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if (pPicture->subWindowMode == IncludeInferiors) { pregWin = NotClippedByChildren(pWin); freeTmpClip = TRUE; } else { pregWin = &pWin->clipList; freeTmpClip = FALSE; } freeCompClip = pPicture->freeCompClip; /* * if there is no client clip, we can get by with just keeping the * pointer we got, and remembering whether or not should destroy * (or maybe re-use) it later. this way, we avoid unnecessary * copying of regions. (this wins especially if many clients clip * by children and have no client clip.) */ if (!pPicture->clientClip) { if (freeCompClip) RegionDestroy(pPicture->pCompositeClip); pPicture->pCompositeClip = pregWin; pPicture->freeCompClip = freeTmpClip; } else { /* * we need one 'real' region to put into the composite clip. if * pregWin the current composite clip are real, we can get rid of * one. if pregWin is real and the current composite clip isn't, * use pregWin for the composite clip. if the current composite * clip is real and pregWin isn't, use the current composite * clip. if neither is real, create a new region. */ RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); if (freeCompClip) { RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); if (freeTmpClip) RegionDestroy(pregWin); } else if (freeTmpClip) { RegionIntersect(pregWin, pregWin, pPicture->clientClip); pPicture->pCompositeClip = pregWin; } else { pPicture->pCompositeClip = RegionCreate(NullBox, 0); RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); } pPicture->freeCompClip = TRUE; RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } } /* end of composite clip for a window */ else { BoxRec pixbounds; /* XXX should we translate by drawable.x/y here ? */ /* If you want pixmaps in offscreen memory, yes */ pixbounds.x1 = pDrawable->x; pixbounds.y1 = pDrawable->y; pixbounds.x2 = pDrawable->x + pDrawable->width; pixbounds.y2 = pDrawable->y + pDrawable->height; if (pPicture->freeCompClip) { RegionReset(pPicture->pCompositeClip, &pixbounds); } else { pPicture->freeCompClip = TRUE; pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); } if (pPicture->clientClip) { if (pDrawable->x || pDrawable->y) { RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } else { RegionTranslate(pPicture->pCompositeClip, -pPicture->clipOrigin.x, -pPicture->clipOrigin.y); RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); RegionTranslate(pPicture->pCompositeClip, pPicture->clipOrigin.x, pPicture->clipOrigin.y); } } } /* end of composite clip for pixmap */ } } static int miChangePictureTransform(PicturePtr pPicture, PictTransform * transform) { return Success; } static int miChangePictureFilter(PicturePtr pPicture, int filter, xFixed * params, int nparams) { return Success; } #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) static inline pixman_bool_t miClipPictureReg(pixman_region16_t * pRegion, pixman_region16_t * pClip, int dx, int dy) { if (pixman_region_n_rects(pRegion) == 1 && pixman_region_n_rects(pClip) == 1) { pixman_box16_t *pRbox = pixman_region_rectangles(pRegion, NULL); pixman_box16_t *pCbox = pixman_region_rectangles(pClip, NULL); int v; if (pRbox->x1 < (v = pCbox->x1 + dx)) pRbox->x1 = BOUND(v); if (pRbox->x2 > (v = pCbox->x2 + dx)) pRbox->x2 = BOUND(v); if (pRbox->y1 < (v = pCbox->y1 + dy)) pRbox->y1 = BOUND(v); if (pRbox->y2 > (v = pCbox->y2 + dy)) pRbox->y2 = BOUND(v); if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) { pixman_region_init(pRegion); } } else if (!pixman_region_not_empty(pClip)) return FALSE; else { if (dx || dy) pixman_region_translate(pRegion, -dx, -dy); if (!pixman_region_intersect(pRegion, pRegion, pClip)) return FALSE; if (dx || dy) pixman_region_translate(pRegion, dx, dy); } return pixman_region_not_empty(pRegion); } static inline Bool miClipPictureSrc(RegionPtr pRegion, PicturePtr pPicture, int dx, int dy) { if (pPicture->clientClip) { Bool result; pixman_region_translate(pPicture->clientClip, pPicture->clipOrigin.x + dx, pPicture->clipOrigin.y + dy); result = RegionIntersect(pRegion, pRegion, pPicture->clientClip); pixman_region_translate(pPicture->clientClip, -(pPicture->clipOrigin.x + dx), -(pPicture->clipOrigin.y + dy)); if (!result) return FALSE; } return TRUE; } static void SourceValidateOnePicture(PicturePtr pPicture) { DrawablePtr pDrawable = pPicture->pDrawable; ScreenPtr pScreen; if (!pDrawable) return; pScreen = pDrawable->pScreen; if (pScreen->SourceValidate) { pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width, pDrawable->height, pPicture->subWindowMode); } } void miCompositeSourceValidate(PicturePtr pPicture) { SourceValidateOnePicture(pPicture); if (pPicture->alphaMap) SourceValidateOnePicture(pPicture->alphaMap); } /* * returns FALSE if the final region is empty. Indistinguishable from * an allocation failure, but rendering ignores those anyways. */ Bool miComputeCompositeRegion(RegionPtr pRegion, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { int v; pRegion->extents.x1 = xDst; v = xDst + width; pRegion->extents.x2 = BOUND(v); pRegion->extents.y1 = yDst; v = yDst + height; pRegion->extents.y2 = BOUND(v); pRegion->data = 0; /* Check for empty operation */ if (pRegion->extents.x1 >= pRegion->extents.x2 || pRegion->extents.y1 >= pRegion->extents.y2) { pixman_region_init(pRegion); return FALSE; } /* clip against dst */ if (!miClipPictureReg(pRegion, pDst->pCompositeClip, 0, 0)) { pixman_region_fini(pRegion); return FALSE; } if (pDst->alphaMap) { if (!miClipPictureReg(pRegion, pDst->alphaMap->pCompositeClip, -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) { pixman_region_fini(pRegion); return FALSE; } } /* clip against src */ if (!miClipPictureSrc(pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { pixman_region_fini(pRegion); return FALSE; } if (pSrc->alphaMap) { if (!miClipPictureSrc(pRegion, pSrc->alphaMap, xDst - (xSrc - pSrc->alphaOrigin.x), yDst - (ySrc - pSrc->alphaOrigin.y))) { pixman_region_fini(pRegion); return FALSE; } } /* clip against mask */ if (pMask) { if (!miClipPictureSrc(pRegion, pMask, xDst - xMask, yDst - yMask)) { pixman_region_fini(pRegion); return FALSE; } if (pMask->alphaMap) { if (!miClipPictureSrc(pRegion, pMask->alphaMap, xDst - (xMask - pMask->alphaOrigin.x), yDst - (yMask - pMask->alphaOrigin.y))) { pixman_region_fini(pRegion); return FALSE; } } } miCompositeSourceValidate(pSrc); if (pMask) miCompositeSourceValidate(pMask); return TRUE; } void miRenderColorToPixel(PictFormatPtr format, xRenderColor * color, CARD32 *pixel) { CARD32 r, g, b, a; miIndexedPtr pIndexed; switch (format->type) { case PictTypeDirect: r = color->red >> (16 - Ones(format->direct.redMask)); g = color->green >> (16 - Ones(format->direct.greenMask)); b = color->blue >> (16 - Ones(format->direct.blueMask)); a = color->alpha >> (16 - Ones(format->direct.alphaMask)); r = r << format->direct.red; g = g << format->direct.green; b = b << format->direct.blue; a = a << format->direct.alpha; *pixel = r | g | b | a; break; case PictTypeIndexed: pIndexed = (miIndexedPtr) (format->index.devPrivate); if (pIndexed->color) { r = color->red >> 11; g = color->green >> 11; b = color->blue >> 11; *pixel = miIndexToEnt15(pIndexed, (r << 10) | (g << 5) | b); } else { r = color->red >> 8; g = color->green >> 8; b = color->blue >> 8; *pixel = miIndexToEntY24(pIndexed, (r << 16) | (g << 8) | b); } break; } } static CARD16 miFillColor(CARD32 pixel, int bits) { while (bits < 16) { pixel |= pixel << bits; bits <<= 1; } return (CARD16) pixel; } Bool miIsSolidAlpha(PicturePtr pSrc) { ScreenPtr pScreen; char line[1]; if (!pSrc->pDrawable) return FALSE; pScreen = pSrc->pDrawable->pScreen; /* Alpha-only */ if (PICT_FORMAT_TYPE(pSrc->format) != PICT_TYPE_A) return FALSE; /* repeat */ if (!pSrc->repeat) return FALSE; /* 1x1 */ if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1) return FALSE; line[0] = 1; (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line); switch (pSrc->pDrawable->bitsPerPixel) { case 1: return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80; case 4: return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0; case 8: return (CARD8) line[0] == 0xff; default: return FALSE; } } void miRenderPixelToColor(PictFormatPtr format, CARD32 pixel, xRenderColor * color) { CARD32 r, g, b, a; miIndexedPtr pIndexed; switch (format->type) { case PictTypeDirect: r = (pixel >> format->direct.red) & format->direct.redMask; g = (pixel >> format->direct.green) & format->direct.greenMask; b = (pixel >> format->direct.blue) & format->direct.blueMask; a = (pixel >> format->direct.alpha) & format->direct.alphaMask; color->red = miFillColor(r, Ones(format->direct.redMask)); color->green = miFillColor(g, Ones(format->direct.greenMask)); color->blue = miFillColor(b, Ones(format->direct.blueMask)); color->alpha = miFillColor(a, Ones(format->direct.alphaMask)); break; case PictTypeIndexed: pIndexed = (miIndexedPtr) (format->index.devPrivate); pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED - 1)]; r = (pixel >> 16) & 0xff; g = (pixel >> 8) & 0xff; b = (pixel) & 0xff; color->red = miFillColor(r, 8); color->green = miFillColor(g, 8); color->blue = miFillColor(b, 8); color->alpha = 0xffff; break; } } static void miTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points) { xTriangle *tris, *tri; int ntri; ntri = npoints - 2; tris = xallocarray(ntri, sizeof(xTriangle)); if (!tris) return; for (tri = tris; npoints >= 3; npoints--, points++, tri++) { tri->p1 = points[0]; tri->p2 = points[1]; tri->p3 = points[2]; } CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); free(tris); } static void miTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points) { xTriangle *tris, *tri; xPointFixed *first; int ntri; ntri = npoints - 2; tris = xallocarray(ntri, sizeof(xTriangle)); if (!tris) return; first = points++; for (tri = tris; npoints >= 3; npoints--, points++, tri++) { tri->p1 = *first; tri->p2 = points[0]; tri->p3 = points[1]; } CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); free(tris); } Bool miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; if (!PictureInit(pScreen, formats, nformats)) return FALSE; ps = GetPictureScreen(pScreen); ps->CreatePicture = miCreatePicture; ps->DestroyPicture = miDestroyPicture; ps->ChangePictureClip = miChangePictureClip; ps->DestroyPictureClip = miDestroyPictureClip; ps->ChangePicture = miChangePicture; ps->ValidatePicture = miValidatePicture; ps->InitIndexed = miInitIndexed; ps->CloseIndexed = miCloseIndexed; ps->UpdateIndexed = miUpdateIndexed; ps->ChangePictureTransform = miChangePictureTransform; ps->ChangePictureFilter = miChangePictureFilter; ps->RealizeGlyph = miRealizeGlyph; ps->UnrealizeGlyph = miUnrealizeGlyph; /* MI rendering routines */ ps->Composite = 0; /* requires DDX support */ ps->Glyphs = miGlyphs; ps->CompositeRects = miCompositeRects; ps->Trapezoids = 0; ps->Triangles = 0; ps->RasterizeTrapezoid = 0; /* requires DDX support */ ps->AddTraps = 0; /* requires DDX support */ ps->AddTriangles = 0; /* requires DDX support */ ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */ ps->TriFan = miTriFan; return TRUE; } xorg-server-1.20.8/render/mitri.c0000644000175000017500000000443013640201473013556 00000000000000/* * * 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" void miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds) { bounds->x1 = xFixedToInt(points->x); bounds->x2 = xFixedToInt(xFixedCeil(points->x)); bounds->y1 = xFixedToInt(points->y); bounds->y2 = xFixedToInt(xFixedCeil(points->y)); points++; npoint--; while (npoint-- > 0) { INT16 x1 = xFixedToInt(points->x); INT16 x2 = xFixedToInt(xFixedCeil(points->x)); INT16 y1 = xFixedToInt(points->y); INT16 y2 = xFixedToInt(xFixedCeil(points->y)); if (x1 < bounds->x1) bounds->x1 = x1; else if (x2 > bounds->x2) bounds->x2 = x2; if (y1 < bounds->y1) bounds->y1 = y1; else if (y2 > bounds->y2) bounds->y2 = y2; points++; } } void miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds) { miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds); } xorg-server-1.20.8/render/picturestr.h0000644000175000017500000004425013640201473014647 00000000000000/* * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifndef _PICTURESTR_H_ #define _PICTURESTR_H_ #include "scrnintstr.h" #include "glyphstr.h" #include "resource.h" #include "privates.h" typedef struct _DirectFormat { CARD16 red, redMask; CARD16 green, greenMask; CARD16 blue, blueMask; CARD16 alpha, alphaMask; } DirectFormatRec; typedef struct _IndexFormat { VisualID vid; ColormapPtr pColormap; int nvalues; xIndexValue *pValues; void *devPrivate; } IndexFormatRec; typedef struct _PictFormat { CARD32 id; CARD32 format; /* except bpp */ unsigned char type; unsigned char depth; DirectFormatRec direct; IndexFormatRec index; } PictFormatRec; typedef struct pixman_vector PictVector, *PictVectorPtr; typedef struct pixman_transform PictTransform, *PictTransformPtr; #define pict_f_vector pixman_f_vector #define pict_f_transform pixman_f_transform #define PICT_GRADIENT_STOPTABLE_SIZE 1024 #define SourcePictTypeSolidFill 0 #define SourcePictTypeLinear 1 #define SourcePictTypeRadial 2 #define SourcePictTypeConical 3 typedef struct _PictSolidFill { unsigned int type; CARD32 color; xRenderColor fullcolor; } PictSolidFill, *PictSolidFillPtr; typedef struct _PictGradientStop { xFixed x; xRenderColor color; } PictGradientStop, *PictGradientStopPtr; typedef struct _PictGradient { unsigned int type; int nstops; PictGradientStopPtr stops; } PictGradient, *PictGradientPtr; typedef struct _PictLinearGradient { unsigned int type; int nstops; PictGradientStopPtr stops; xPointFixed p1; xPointFixed p2; } PictLinearGradient, *PictLinearGradientPtr; typedef struct _PictCircle { xFixed x; xFixed y; xFixed radius; } PictCircle, *PictCirclePtr; typedef struct _PictRadialGradient { unsigned int type; int nstops; PictGradientStopPtr stops; PictCircle c1; PictCircle c2; } PictRadialGradient, *PictRadialGradientPtr; typedef struct _PictConicalGradient { unsigned int type; int nstops; PictGradientStopPtr stops; xPointFixed center; xFixed angle; } PictConicalGradient, *PictConicalGradientPtr; typedef union _SourcePict { unsigned int type; PictSolidFill solidFill; PictGradient gradient; PictLinearGradient linear; PictRadialGradient radial; PictConicalGradient conical; } SourcePict, *SourcePictPtr; typedef struct _Picture { DrawablePtr pDrawable; PictFormatPtr pFormat; PictFormatShort format; /* PICT_FORMAT */ int refcnt; CARD32 id; unsigned int repeat:1; unsigned int graphicsExposures:1; unsigned int subWindowMode:1; unsigned int polyEdge:1; unsigned int polyMode:1; unsigned int freeCompClip:1; unsigned int componentAlpha:1; unsigned int repeatType:2; unsigned int filter:3; unsigned int stateChanges:CPLastBit; unsigned int unused:18 - CPLastBit; PicturePtr pNext; /* chain on same drawable */ PicturePtr alphaMap; DDXPointRec alphaOrigin; DDXPointRec clipOrigin; RegionPtr clientClip; unsigned long serialNumber; RegionPtr pCompositeClip; PrivateRec *devPrivates; PictTransform *transform; SourcePictPtr pSourcePict; xFixed *filter_params; int filter_nparams; } PictureRec; typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id, xFixed * params, int nparams, int *width, int *height); typedef struct { char *name; int id; PictFilterValidateParamsProcPtr ValidateParams; int width, height; } PictFilterRec, *PictFilterPtr; #define PictFilterNearest 0 #define PictFilterBilinear 1 #define PictFilterFast 2 #define PictFilterGood 3 #define PictFilterBest 4 #define PictFilterConvolution 5 /* if you add an 8th filter, expand the filter bitfield above */ typedef struct { char *alias; int alias_id; int filter_id; } PictFilterAliasRec, *PictFilterAliasPtr; typedef int (*CreatePictureProcPtr) (PicturePtr pPicture); typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture, int clipType, void *value, int n); typedef void (*DestroyPictureClipProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture, PictTransform * transform); typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture, int filter, xFixed * params, int nparams); typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture); typedef void (*ChangePictureProcPtr) (PicturePtr pPicture, Mask mask); typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture, Mask mask); typedef void (*CompositeProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); typedef void (*GlyphsProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr * glyphs); typedef void (*CompositeRectsProcPtr) (CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects); typedef void (*RasterizeTrapezoidProcPtr) (PicturePtr pMask, xTrapezoid * trap, int x_off, int y_off); typedef void (*TrapezoidsProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps); typedef void (*TrianglesProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris); typedef void (*TriStripProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed * points); typedef void (*TriFanProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed * points); typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat); typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat); typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem * pdef); typedef void (*AddTrapsProcPtr) (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap * traps); typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntri, xTriangle * tris); typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph); typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph); typedef struct _PictureScreen { PictFormatPtr formats; PictFormatPtr fallback; int nformats; CreatePictureProcPtr CreatePicture; DestroyPictureProcPtr DestroyPicture; ChangePictureClipProcPtr ChangePictureClip; DestroyPictureClipProcPtr DestroyPictureClip; ChangePictureProcPtr ChangePicture; ValidatePictureProcPtr ValidatePicture; CompositeProcPtr Composite; GlyphsProcPtr Glyphs; /* unused */ CompositeRectsProcPtr CompositeRects; DestroyWindowProcPtr DestroyWindow; CloseScreenProcPtr CloseScreen; StoreColorsProcPtr StoreColors; InitIndexedProcPtr InitIndexed; CloseIndexedProcPtr CloseIndexed; UpdateIndexedProcPtr UpdateIndexed; int subpixel; PictFilterPtr filters; int nfilters; PictFilterAliasPtr filterAliases; int nfilterAliases; /** * Called immediately after a picture's transform is changed through the * SetPictureTransform request. Not called for source-only pictures. */ ChangePictureTransformProcPtr ChangePictureTransform; /** * Called immediately after a picture's transform is changed through the * SetPictureFilter request. Not called for source-only pictures. */ ChangePictureFilterProcPtr ChangePictureFilter; DestroyPictureFilterProcPtr DestroyPictureFilter; TrapezoidsProcPtr Trapezoids; TrianglesProcPtr Triangles; RasterizeTrapezoidProcPtr RasterizeTrapezoid; AddTrianglesProcPtr AddTriangles; AddTrapsProcPtr AddTraps; RealizeGlyphProcPtr RealizeGlyph; UnrealizeGlyphProcPtr UnrealizeGlyph; #define PICTURE_SCREEN_VERSION 2 TriStripProcPtr TriStrip; TriFanProcPtr TriFan; } PictureScreenRec, *PictureScreenPtr; extern _X_EXPORT DevPrivateKeyRec PictureScreenPrivateKeyRec; #define PictureScreenPrivateKey (&PictureScreenPrivateKeyRec) extern _X_EXPORT DevPrivateKeyRec PictureWindowPrivateKeyRec; #define PictureWindowPrivateKey (&PictureWindowPrivateKeyRec) extern RESTYPE PictureType; extern RESTYPE PictFormatType; extern RESTYPE GlyphSetType; #define GetPictureScreen(s) ((PictureScreenPtr)dixLookupPrivate(&(s)->devPrivates, PictureScreenPrivateKey)) #define GetPictureScreenIfSet(s) (dixPrivateKeyRegistered(PictureScreenPrivateKey) ? GetPictureScreen(s) : NULL) #define SetPictureScreen(s,p) dixSetPrivate(&(s)->devPrivates, PictureScreenPrivateKey, p) #define GetPictureWindow(w) ((PicturePtr)dixLookupPrivate(&(w)->devPrivates, PictureWindowPrivateKey)) #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p) #define VERIFY_PICTURE(pPicture, pid, client, mode) {\ int tmprc = dixLookupResourceByType((void *)&(pPicture), pid,\ PictureType, client, mode);\ if (tmprc != Success)\ return tmprc;\ } #define VERIFY_ALPHA(pPicture, pid, client, mode) {\ if (pid == None) \ pPicture = 0; \ else { \ VERIFY_PICTURE(pPicture, pid, client, mode); \ } \ } \ extern _X_EXPORT PictFormatPtr PictureWindowFormat(WindowPtr pWindow); extern _X_EXPORT Bool PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel); extern _X_EXPORT int PictureGetSubpixelOrder(ScreenPtr pScreen); extern _X_EXPORT PictFormatPtr PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual); extern _X_EXPORT PictFormatPtr PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 format); extern _X_EXPORT Bool PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats); extern _X_EXPORT int PictureGetFilterId(const char *filter, int len, Bool makeit); extern _X_EXPORT char *PictureGetFilterName(int id); extern _X_EXPORT int PictureAddFilter(ScreenPtr pScreen, const char *filter, PictFilterValidateParamsProcPtr ValidateParams, int width, int height); extern _X_EXPORT Bool PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias); extern _X_EXPORT Bool PictureSetDefaultFilters(ScreenPtr pScreen); extern _X_EXPORT void PictureResetFilters(ScreenPtr pScreen); extern _X_EXPORT PictFilterPtr PictureFindFilter(ScreenPtr pScreen, char *name, int len); extern _X_EXPORT int SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter, xFixed * params, int nparams); extern _X_EXPORT int SetPictureFilter(PicturePtr pPicture, char *name, int len, xFixed * params, int nparams); extern _X_EXPORT Bool PictureFinishInit(void); extern _X_EXPORT PicturePtr CreatePicture(Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, Mask mask, XID *list, ClientPtr client, int *error); extern _X_EXPORT int ChangePicture(PicturePtr pPicture, Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client); extern _X_EXPORT int SetPictureClipRects(PicturePtr pPicture, int xOrigin, int yOrigin, int nRect, xRectangle *rects); extern _X_EXPORT int SetPictureClipRegion(PicturePtr pPicture, int xOrigin, int yOrigin, RegionPtr pRegion); extern _X_EXPORT int SetPictureTransform(PicturePtr pPicture, PictTransform * transform); extern _X_EXPORT void ValidatePicture(PicturePtr pPicture); extern _X_EXPORT int FreePicture(void *pPicture, XID pid); extern _X_EXPORT void CompositePicture(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); extern _X_EXPORT void CompositeGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs); extern _X_EXPORT void CompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects); extern _X_EXPORT void CompositeTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps); extern _X_EXPORT void CompositeTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntriangles, xTriangle * triangles); extern _X_EXPORT void CompositeTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points); extern _X_EXPORT void CompositeTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points); Bool AnimCurInit(ScreenPtr pScreen); int AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid); extern _X_EXPORT void AddTraps(PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntraps, xTrap * traps); extern _X_EXPORT PicturePtr CreateSolidPicture(Picture pid, xRenderColor * color, int *error); extern _X_EXPORT PicturePtr CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2, int nStops, xFixed * stops, xRenderColor * colors, int *error); extern _X_EXPORT PicturePtr CreateRadialGradientPicture(Picture pid, xPointFixed * inner, xPointFixed * outer, xFixed innerRadius, xFixed outerRadius, int nStops, xFixed * stops, xRenderColor * colors, int *error); extern _X_EXPORT PicturePtr CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle, int nStops, xFixed * stops, xRenderColor * colors, int *error); #ifdef PANORAMIX extern void PanoramiXRenderInit(void); extern void PanoramiXRenderReset(void); #endif /* * matrix.c */ extern _X_EXPORT void PictTransform_from_xRenderTransform(PictTransformPtr pict, xRenderTransform * render); extern _X_EXPORT void xRenderTransform_from_PictTransform(xRenderTransform * render, PictTransformPtr pict); extern _X_EXPORT Bool PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector); extern _X_EXPORT Bool PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector); #endif /* _PICTURESTR_H_ */ xorg-server-1.20.8/render/matrix.c0000644000175000017500000000547013640201473013743 00000000000000/* * 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" void PictTransform_from_xRenderTransform(PictTransformPtr pict, xRenderTransform * render) { pict->matrix[0][0] = render->matrix11; pict->matrix[0][1] = render->matrix12; pict->matrix[0][2] = render->matrix13; pict->matrix[1][0] = render->matrix21; pict->matrix[1][1] = render->matrix22; pict->matrix[1][2] = render->matrix23; pict->matrix[2][0] = render->matrix31; pict->matrix[2][1] = render->matrix32; pict->matrix[2][2] = render->matrix33; } void xRenderTransform_from_PictTransform(xRenderTransform * render, PictTransformPtr pict) { render->matrix11 = pict->matrix[0][0]; render->matrix12 = pict->matrix[0][1]; render->matrix13 = pict->matrix[0][2]; render->matrix21 = pict->matrix[1][0]; render->matrix22 = pict->matrix[1][1]; render->matrix23 = pict->matrix[1][2]; render->matrix31 = pict->matrix[2][0]; render->matrix32 = pict->matrix[2][1]; render->matrix33 = pict->matrix[2][2]; } Bool PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector) { return pixman_transform_point(transform, vector); } Bool PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector) { return pixman_transform_point_3d(transform, vector); } xorg-server-1.20.8/render/mipict.h0000644000175000017500000000752113640201473013730 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifndef _MIPICT_H_ #define _MIPICT_H_ #include "picturestr.h" #define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */ #if MI_MAX_INDEXED <= 256 typedef CARD8 miIndexType; #endif typedef struct _miIndexed { Bool color; CARD32 rgba[MI_MAX_INDEXED]; miIndexType ent[32768]; } miIndexedRec, *miIndexedPtr; #define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \ (((s) >> 6) & 0x03e0) | \ (((s) >> 9) & 0x7c00)) #define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15]) #define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24)) #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)]) extern _X_EXPORT int miCreatePicture(PicturePtr pPicture); extern _X_EXPORT void miDestroyPicture(PicturePtr pPicture); extern _X_EXPORT void miCompositeSourceValidate(PicturePtr pPicture); extern _X_EXPORT Bool miComputeCompositeRegion(RegionPtr pRegion, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); extern _X_EXPORT Bool miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats); extern _X_EXPORT Bool miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph); extern _X_EXPORT void miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph); extern _X_EXPORT void miGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs); extern _X_EXPORT void miRenderColorToPixel(PictFormatPtr pPict, xRenderColor * color, CARD32 *pixel); extern _X_EXPORT void miRenderPixelToColor(PictFormatPtr pPict, CARD32 pixel, xRenderColor * color); extern _X_EXPORT Bool miIsSolidAlpha(PicturePtr pSrc); extern _X_EXPORT void miCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects); extern _X_EXPORT void miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box); extern _X_EXPORT void miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds); extern _X_EXPORT void miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds); extern _X_EXPORT Bool miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat); extern _X_EXPORT void miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat); extern _X_EXPORT void miUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem * pdef); #endif /* _MIPICT_H_ */ xorg-server-1.20.8/render/picture.c0000644000175000017500000013567613640201473014126 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" #include "xace.h" #ifdef PANORAMIX #include "panoramiXsrv.h" #endif DevPrivateKeyRec PictureScreenPrivateKeyRec; DevPrivateKeyRec PictureWindowPrivateKeyRec; static int PictureGeneration; RESTYPE PictureType; RESTYPE PictFormatType; RESTYPE GlyphSetType; int PictureCmapPolicy = PictureCmapPolicyDefault; PictFormatPtr PictureWindowFormat(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; return PictureMatchVisual(pScreen, pWindow->drawable.depth, WindowGetVisual(pWindow)); } static Bool PictureDestroyWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; while ((pPicture = GetPictureWindow(pWindow))) { SetPictureWindow(pWindow, pPicture->pNext); if (pPicture->id) FreeResource(pPicture->id, PictureType); FreePicture((void *) pPicture, pPicture->id); } pScreen->DestroyWindow = ps->DestroyWindow; ret = (*pScreen->DestroyWindow) (pWindow); ps->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = PictureDestroyWindow; return ret; } static Bool PictureCloseScreen(ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; int n; pScreen->CloseScreen = ps->CloseScreen; ret = (*pScreen->CloseScreen) (pScreen); PictureResetFilters(pScreen); for (n = 0; n < ps->nformats; n++) if (ps->formats[n].type == PictTypeIndexed) (*ps->CloseIndexed) (pScreen, &ps->formats[n]); GlyphUninit(pScreen); SetPictureScreen(pScreen, 0); free(ps->formats); free(ps); return ret; } static void PictureStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef) { ScreenPtr pScreen = pColormap->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); pScreen->StoreColors = ps->StoreColors; (*pScreen->StoreColors) (pColormap, ndef, pdef); ps->StoreColors = pScreen->StoreColors; pScreen->StoreColors = PictureStoreColors; if (pColormap->class == PseudoColor || pColormap->class == GrayScale) { PictFormatPtr format = ps->formats; int nformats = ps->nformats; while (nformats--) { if (format->type == PictTypeIndexed && format->index.pColormap == pColormap) { (*ps->UpdateIndexed) (pScreen, format, ndef, pdef); break; } format++; } } } static int visualDepth(ScreenPtr pScreen, VisualPtr pVisual) { int d, v; DepthPtr pDepth; for (d = 0; d < pScreen->numDepths; d++) { pDepth = &pScreen->allowedDepths[d]; for (v = 0; v < pDepth->numVids; v++) if (pDepth->vids[v] == pVisual->vid) return pDepth->depth; } return 0; } typedef struct _formatInit { CARD32 format; CARD8 depth; } FormatInitRec, *FormatInitPtr; static void addFormat(FormatInitRec formats[256], int *nformat, CARD32 format, CARD8 depth) { int n; for (n = 0; n < *nformat; n++) if (formats[n].format == format && formats[n].depth == depth) return; formats[*nformat].format = format; formats[*nformat].depth = depth; ++*nformat; } #define Mask(n) ((1 << (n)) - 1) static PictFormatPtr PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp) { int nformats = 0, f; PictFormatPtr pFormats; FormatInitRec formats[1024]; CARD32 format; CARD8 depth; VisualPtr pVisual; int v; int bpp; int type; int r, g, b; int d; DepthPtr pDepth; nformats = 0; /* formats required by protocol */ formats[nformats].format = PICT_a1; formats[nformats].depth = 1; nformats++; formats[nformats].format = PICT_FORMAT(BitsPerPixel(8), PICT_TYPE_A, 8, 0, 0, 0); formats[nformats].depth = 8; nformats++; formats[nformats].format = PICT_FORMAT(BitsPerPixel(4), PICT_TYPE_A, 4, 0, 0, 0); formats[nformats].depth = 4; nformats++; formats[nformats].format = PICT_a8r8g8b8; formats[nformats].depth = 32; nformats++; formats[nformats].format = PICT_x8r8g8b8; formats[nformats].depth = 32; nformats++; formats[nformats].format = PICT_b8g8r8a8; formats[nformats].depth = 32; nformats++; formats[nformats].format = PICT_b8g8r8x8; formats[nformats].depth = 32; nformats++; /* now look through the depths and visuals adding other formats */ for (v = 0; v < pScreen->numVisuals; v++) { pVisual = &pScreen->visuals[v]; depth = visualDepth(pScreen, pVisual); if (!depth) continue; bpp = BitsPerPixel(depth); switch (pVisual->class) { case DirectColor: case TrueColor: r = Ones(pVisual->redMask); g = Ones(pVisual->greenMask); b = Ones(pVisual->blueMask); type = PICT_TYPE_OTHER; /* * Current rendering code supports only three direct formats, * fields must be packed together at the bottom of the pixel */ if (pVisual->offsetBlue == 0 && pVisual->offsetGreen == b && pVisual->offsetRed == b + g) { type = PICT_TYPE_ARGB; } else if (pVisual->offsetRed == 0 && pVisual->offsetGreen == r && pVisual->offsetBlue == r + g) { type = PICT_TYPE_ABGR; } else if (pVisual->offsetRed == pVisual->offsetGreen - r && pVisual->offsetGreen == pVisual->offsetBlue - g && pVisual->offsetBlue == bpp - b) { type = PICT_TYPE_BGRA; } if (type != PICT_TYPE_OTHER) { format = PICT_FORMAT(bpp, type, 0, r, g, b); addFormat(formats, &nformats, format, depth); } break; case StaticColor: case PseudoColor: format = PICT_VISFORMAT(bpp, PICT_TYPE_COLOR, v); addFormat(formats, &nformats, format, depth); break; case StaticGray: case GrayScale: format = PICT_VISFORMAT(bpp, PICT_TYPE_GRAY, v); addFormat(formats, &nformats, format, depth); break; } } /* * Walk supported depths and add useful Direct formats */ for (d = 0; d < pScreen->numDepths; d++) { pDepth = &pScreen->allowedDepths[d]; bpp = BitsPerPixel(pDepth->depth); format = 0; switch (bpp) { case 16: /* depth 12 formats */ if (pDepth->depth >= 12) { addFormat(formats, &nformats, PICT_x4r4g4b4, pDepth->depth); addFormat(formats, &nformats, PICT_x4b4g4r4, pDepth->depth); } /* depth 15 formats */ if (pDepth->depth >= 15) { addFormat(formats, &nformats, PICT_x1r5g5b5, pDepth->depth); addFormat(formats, &nformats, PICT_x1b5g5r5, pDepth->depth); } /* depth 16 formats */ if (pDepth->depth >= 16) { addFormat(formats, &nformats, PICT_a1r5g5b5, pDepth->depth); addFormat(formats, &nformats, PICT_a1b5g5r5, pDepth->depth); addFormat(formats, &nformats, PICT_r5g6b5, pDepth->depth); addFormat(formats, &nformats, PICT_b5g6r5, pDepth->depth); addFormat(formats, &nformats, PICT_a4r4g4b4, pDepth->depth); addFormat(formats, &nformats, PICT_a4b4g4r4, pDepth->depth); } break; case 32: if (pDepth->depth >= 24) { addFormat(formats, &nformats, PICT_x8r8g8b8, pDepth->depth); addFormat(formats, &nformats, PICT_x8b8g8r8, pDepth->depth); } if (pDepth->depth >= 30) { addFormat(formats, &nformats, PICT_a2r10g10b10, pDepth->depth); addFormat(formats, &nformats, PICT_x2r10g10b10, pDepth->depth); addFormat(formats, &nformats, PICT_a2b10g10r10, pDepth->depth); addFormat(formats, &nformats, PICT_x2b10g10r10, pDepth->depth); } break; } } pFormats = calloc(nformats, sizeof(PictFormatRec)); if (!pFormats) return 0; for (f = 0; f < nformats; f++) { pFormats[f].id = FakeClientID(0); pFormats[f].depth = formats[f].depth; format = formats[f].format; pFormats[f].format = format; switch (PICT_FORMAT_TYPE(format)) { case PICT_TYPE_ARGB: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format)); if (pFormats[f].direct.alphaMask) pFormats[f].direct.alpha = (PICT_FORMAT_R(format) + PICT_FORMAT_G(format) + PICT_FORMAT_B(format)); pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format)); pFormats[f].direct.red = (PICT_FORMAT_G(format) + PICT_FORMAT_B(format)); pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format)); pFormats[f].direct.green = PICT_FORMAT_B(format); pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format)); pFormats[f].direct.blue = 0; break; case PICT_TYPE_ABGR: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format)); if (pFormats[f].direct.alphaMask) pFormats[f].direct.alpha = (PICT_FORMAT_B(format) + PICT_FORMAT_G(format) + PICT_FORMAT_R(format)); pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format)); pFormats[f].direct.blue = (PICT_FORMAT_G(format) + PICT_FORMAT_R(format)); pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format)); pFormats[f].direct.green = PICT_FORMAT_R(format); pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format)); pFormats[f].direct.red = 0; break; case PICT_TYPE_BGRA: pFormats[f].type = PictTypeDirect; pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format)); pFormats[f].direct.blue = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format)); pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format)); pFormats[f].direct.green = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) - PICT_FORMAT_G(format)); pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format)); pFormats[f].direct.red = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) - PICT_FORMAT_G(format) - PICT_FORMAT_R(format)); pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format)); pFormats[f].direct.alpha = 0; break; case PICT_TYPE_A: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alpha = 0; pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format)); /* remaining fields already set to zero */ break; case PICT_TYPE_COLOR: case PICT_TYPE_GRAY: pFormats[f].type = PictTypeIndexed; pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid; break; } } *nformatp = nformats; return pFormats; } static VisualPtr PictureFindVisual(ScreenPtr pScreen, VisualID visual) { int i; VisualPtr pVisual; for (i = 0, pVisual = pScreen->visuals; i < pScreen->numVisuals; i++, pVisual++) { if (pVisual->vid == visual) return pVisual; } return 0; } static Bool PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); if (format->type != PictTypeIndexed || format->index.pColormap) return TRUE; if (format->index.vid == pScreen->rootVisual) { dixLookupResourceByType((void **) &format->index.pColormap, pScreen->defColormap, RT_COLORMAP, serverClient, DixGetAttrAccess); } else { VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid); if (CreateColormap(FakeClientID(0), pScreen, pVisual, &format->index.pColormap, AllocNone, 0) != Success) return FALSE; } if (!ps->InitIndexed(pScreen, format)) return FALSE; return TRUE; } static Bool PictureInitIndexedFormats(ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; if (!ps) return FALSE; format = ps->formats; nformat = ps->nformats; while (nformat--) if (!PictureInitIndexedFormat(pScreen, format++)) return FALSE; return TRUE; } Bool PictureFinishInit(void) { int s; for (s = 0; s < screenInfo.numScreens; s++) { if (!PictureInitIndexedFormats(screenInfo.screens[s])) return FALSE; (void) AnimCurInit(screenInfo.screens[s]); } return TRUE; } Bool PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); if (!ps) return FALSE; ps->subpixel = subpixel; return TRUE; } int PictureGetSubpixelOrder(ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); if (!ps) return SubPixelUnknown; return ps->subpixel; } PictFormatPtr PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; int type; if (!ps) return 0; format = ps->formats; nformat = ps->nformats; switch (pVisual->class) { case StaticGray: case GrayScale: case StaticColor: case PseudoColor: type = PictTypeIndexed; break; case TrueColor: case DirectColor: type = PictTypeDirect; break; default: return 0; } while (nformat--) { if (format->depth == depth && format->type == type) { if (type == PictTypeIndexed) { if (format->index.vid == pVisual->vid) return format; } else { if (format->direct.redMask << format->direct.red == pVisual->redMask && format->direct.greenMask << format->direct.green == pVisual->greenMask && format->direct.blueMask << format->direct.blue == pVisual->blueMask) { return format; } } } format++; } return 0; } PictFormatPtr PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 f) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; if (!ps) return 0; format = ps->formats; nformat = ps->nformats; while (nformat--) { if (format->depth == depth && format->format == (f & 0xffffff)) return format; format++; } return 0; } int PictureParseCmapPolicy(const char *name) { if (strcmp(name, "default") == 0) return PictureCmapPolicyDefault; else if (strcmp(name, "mono") == 0) return PictureCmapPolicyMono; else if (strcmp(name, "gray") == 0) return PictureCmapPolicyGray; else if (strcmp(name, "color") == 0) return PictureCmapPolicyColor; else if (strcmp(name, "all") == 0) return PictureCmapPolicyAll; else return PictureCmapPolicyInvalid; } /** @see GetDefaultBytes */ static void GetPictureBytes(void *value, XID id, ResourceSizePtr size) { PicturePtr picture = value; /* Currently only pixmap bytes are reported to clients. */ size->resourceSize = 0; size->refCnt = picture->refcnt; /* Calculate pixmap reference sizes. */ size->pixmapRefSize = 0; if (picture->pDrawable && (picture->pDrawable->type == DRAWABLE_PIXMAP)) { SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); ResourceSizeRec pixmapSize = { 0, 0, 0 }; PixmapPtr pixmap = (PixmapPtr)picture->pDrawable; pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize); size->pixmapRefSize += pixmapSize.pixmapRefSize; } } static int FreePictFormat(void *pPictFormat, XID pid) { return Success; } Bool PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; int n; CARD32 type, a, r, g, b; if (PictureGeneration != serverGeneration) { PictureType = CreateNewResourceType(FreePicture, "PICTURE"); if (!PictureType) return FALSE; SetResourceTypeSizeFunc(PictureType, GetPictureBytes); PictFormatType = CreateNewResourceType(FreePictFormat, "PICTFORMAT"); if (!PictFormatType) return FALSE; GlyphSetType = CreateNewResourceType(FreeGlyphSet, "GLYPHSET"); if (!GlyphSetType) return FALSE; PictureGeneration = serverGeneration; } if (!dixRegisterPrivateKey(&PictureScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&PictureWindowPrivateKeyRec, PRIVATE_WINDOW, 0)) return FALSE; if (!formats) { formats = PictureCreateDefaultFormats(pScreen, &nformats); if (!formats) return FALSE; } for (n = 0; n < nformats; n++) { if (!AddResource (formats[n].id, PictFormatType, (void *) (formats + n))) { int i; for (i = 0; i < n; i++) FreeResource(formats[i].id, RT_NONE); free(formats); return FALSE; } if (formats[n].type == PictTypeIndexed) { VisualPtr pVisual = PictureFindVisual(pScreen, formats[n].index.vid); if ((pVisual->class | DynamicClass) == PseudoColor) type = PICT_TYPE_COLOR; else type = PICT_TYPE_GRAY; a = r = g = b = 0; } else { if ((formats[n].direct.redMask | formats[n].direct.blueMask | formats[n].direct.greenMask) == 0) type = PICT_TYPE_A; else if (formats[n].direct.red > formats[n].direct.blue) type = PICT_TYPE_ARGB; else if (formats[n].direct.red == 0) type = PICT_TYPE_ABGR; else type = PICT_TYPE_BGRA; a = Ones(formats[n].direct.alphaMask); r = Ones(formats[n].direct.redMask); g = Ones(formats[n].direct.greenMask); b = Ones(formats[n].direct.blueMask); } formats[n].format = PICT_FORMAT(0, type, a, r, g, b); } ps = (PictureScreenPtr) malloc(sizeof(PictureScreenRec)); if (!ps) { free(formats); return FALSE; } SetPictureScreen(pScreen, ps); ps->formats = formats; ps->fallback = formats; ps->nformats = nformats; ps->filters = 0; ps->nfilters = 0; ps->filterAliases = 0; ps->nfilterAliases = 0; ps->subpixel = SubPixelUnknown; ps->CloseScreen = pScreen->CloseScreen; ps->DestroyWindow = pScreen->DestroyWindow; ps->StoreColors = pScreen->StoreColors; pScreen->DestroyWindow = PictureDestroyWindow; pScreen->CloseScreen = PictureCloseScreen; pScreen->StoreColors = PictureStoreColors; if (!PictureSetDefaultFilters(pScreen)) { PictureResetFilters(pScreen); SetPictureScreen(pScreen, 0); free(formats); free(ps); return FALSE; } return TRUE; } static void SetPictureToDefaults(PicturePtr pPicture) { pPicture->refcnt = 1; pPicture->repeat = 0; pPicture->graphicsExposures = FALSE; pPicture->subWindowMode = ClipByChildren; pPicture->polyEdge = PolyEdgeSharp; pPicture->polyMode = PolyModePrecise; pPicture->freeCompClip = FALSE; pPicture->componentAlpha = FALSE; pPicture->repeatType = RepeatNone; pPicture->alphaMap = 0; pPicture->alphaOrigin.x = 0; pPicture->alphaOrigin.y = 0; pPicture->clipOrigin.x = 0; pPicture->clipOrigin.y = 0; pPicture->clientClip = 0; pPicture->transform = 0; pPicture->filter = PictureGetFilterId(FilterNearest, -1, TRUE); pPicture->filter_params = 0; pPicture->filter_nparams = 0; pPicture->serialNumber = GC_CHANGE_SERIAL_BIT; pPicture->stateChanges = -1; pPicture->pSourcePict = 0; } PicturePtr CreatePicture(Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, Mask vmask, XID *vlist, ClientPtr client, int *error) { PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen); pPicture = dixAllocateScreenObjectWithPrivates(pDrawable->pScreen, PictureRec, PRIVATE_PICTURE); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pDrawable = pDrawable; pPicture->pFormat = pFormat; pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24); /* security creation/labeling check */ *error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture, RT_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess); if (*error != Success) goto out; if (pDrawable->type == DRAWABLE_PIXMAP) { ++((PixmapPtr) pDrawable)->refcnt; pPicture->pNext = 0; } else { pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable)); SetPictureWindow(((WindowPtr) pDrawable), pPicture); } SetPictureToDefaults(pPicture); if (vmask) *error = ChangePicture(pPicture, vmask, vlist, 0, client); else *error = Success; if (*error == Success) *error = (*ps->CreatePicture) (pPicture); out: if (*error != Success) { FreePicture(pPicture, (XID) 0); pPicture = 0; } return pPicture; } static CARD32 xRenderColorToCard32(xRenderColor c) { return (c.alpha >> 8 << 24) | (c.red >> 8 << 16) | (c.green & 0xff00) | (c.blue >> 8); } static void initGradient(SourcePictPtr pGradient, int stopCount, xFixed * stopPoints, xRenderColor * stopColors, int *error) { int i; xFixed dpos; if (stopCount <= 0) { *error = BadValue; return; } dpos = -1; for (i = 0; i < stopCount; ++i) { if (stopPoints[i] < dpos || stopPoints[i] > (1 << 16)) { *error = BadValue; return; } dpos = stopPoints[i]; } pGradient->gradient.stops = xallocarray(stopCount, sizeof(PictGradientStop)); if (!pGradient->gradient.stops) { *error = BadAlloc; return; } pGradient->gradient.nstops = stopCount; for (i = 0; i < stopCount; ++i) { pGradient->gradient.stops[i].x = stopPoints[i]; pGradient->gradient.stops[i].color = stopColors[i]; } } static PicturePtr createSourcePicture(void) { PicturePtr pPicture; pPicture = dixAllocateScreenObjectWithPrivates(NULL, PictureRec, PRIVATE_PICTURE); if (!pPicture) return 0; pPicture->pDrawable = 0; pPicture->pFormat = 0; pPicture->pNext = 0; pPicture->format = PICT_a8r8g8b8; SetPictureToDefaults(pPicture); return pPicture; } PicturePtr CreateSolidPicture(Picture pid, xRenderColor * color, int *error) { PicturePtr pPicture; pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->type = SourcePictTypeSolidFill; pPicture->pSourcePict->solidFill.color = xRenderColorToCard32(*color); memcpy(&pPicture->pSourcePict->solidFill.fullcolor, color, sizeof(*color)); return pPicture; } PicturePtr CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2, int nStops, xFixed * stops, xRenderColor * colors, int *error) { PicturePtr pPicture; if (nStops < 1) { *error = BadValue; return 0; } pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->linear.type = SourcePictTypeLinear; pPicture->pSourcePict->linear.p1 = *p1; pPicture->pSourcePict->linear.p2 = *p2; initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { free(pPicture); return 0; } return pPicture; } PicturePtr CreateRadialGradientPicture(Picture pid, xPointFixed * inner, xPointFixed * outer, xFixed innerRadius, xFixed outerRadius, int nStops, xFixed * stops, xRenderColor * colors, int *error) { PicturePtr pPicture; PictRadialGradient *radial; if (nStops < 1) { *error = BadValue; return 0; } pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } radial = &pPicture->pSourcePict->radial; radial->type = SourcePictTypeRadial; radial->c1.x = inner->x; radial->c1.y = inner->y; radial->c1.radius = innerRadius; radial->c2.x = outer->x; radial->c2.y = outer->y; radial->c2.radius = outerRadius; initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { free(pPicture); return 0; } return pPicture; } PicturePtr CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle, int nStops, xFixed * stops, xRenderColor * colors, int *error) { PicturePtr pPicture; if (nStops < 1) { *error = BadValue; return 0; } pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->conical.type = SourcePictTypeConical; pPicture->pSourcePict->conical.center = *center; pPicture->pSourcePict->conical.angle = angle; initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { free(pPicture); return 0; } return pPicture; } static int cpAlphaMap(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode) { #ifdef PANORAMIX if (!noPanoramiXExtension) { PanoramiXRes *res; int err = dixLookupResourceByType((void **)&res, id, XRT_PICTURE, client, mode); if (err != Success) return err; id = res->info[screen->myNum].id; } #endif return dixLookupResourceByType(result, id, PictureType, client, mode); } static int cpClipMask(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode) { #ifdef PANORAMIX if (!noPanoramiXExtension) { PanoramiXRes *res; int err = dixLookupResourceByType((void **)&res, id, XRT_PIXMAP, client, mode); if (err != Success) return err; id = res->info[screen->myNum].id; } #endif return dixLookupResourceByType(result, id, RT_PIXMAP, client, mode); } #define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val) #define NEXT_PTR(_type) ((_type) ulist++->ptr) int ChangePicture(PicturePtr pPicture, Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client) { ScreenPtr pScreen = pPicture->pDrawable ? pPicture->pDrawable->pScreen : 0; PictureScreenPtr ps = pScreen ? GetPictureScreen(pScreen) : 0; BITS32 index2; int error = 0; BITS32 maskQ; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; maskQ = vmask; while (vmask && !error) { index2 = (BITS32) lowbit(vmask); vmask &= ~index2; pPicture->stateChanges |= index2; switch (index2) { case CPRepeat: { unsigned int newr; newr = NEXT_VAL(unsigned int); if (newr <= RepeatReflect) { pPicture->repeat = (newr != RepeatNone); pPicture->repeatType = newr; } else { client->errorValue = newr; error = BadValue; } } break; case CPAlphaMap: { PicturePtr pAlpha; if (vlist) { Picture pid = NEXT_VAL(Picture); if (pid == None) pAlpha = 0; else { error = cpAlphaMap((void **) &pAlpha, pid, pScreen, client, DixReadAccess); if (error != Success) { client->errorValue = pid; break; } if (pAlpha->pDrawable == NULL || pAlpha->pDrawable->type != DRAWABLE_PIXMAP) { client->errorValue = pid; error = BadMatch; break; } } } else pAlpha = NEXT_PTR(PicturePtr); if (!error) { if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP) pAlpha->refcnt++; if (pPicture->alphaMap) FreePicture((void *) pPicture->alphaMap, (XID) 0); pPicture->alphaMap = pAlpha; } } break; case CPAlphaXOrigin: pPicture->alphaOrigin.x = NEXT_VAL(INT16); break; case CPAlphaYOrigin: pPicture->alphaOrigin.y = NEXT_VAL(INT16); break; case CPClipXOrigin: pPicture->clipOrigin.x = NEXT_VAL(INT16); break; case CPClipYOrigin: pPicture->clipOrigin.y = NEXT_VAL(INT16); break; case CPClipMask: { Pixmap pid; PixmapPtr pPixmap; int clipType; if (!pScreen) return BadDrawable; if (vlist) { pid = NEXT_VAL(Pixmap); if (pid == None) { clipType = CT_NONE; pPixmap = NullPixmap; } else { clipType = CT_PIXMAP; error = cpClipMask((void **) &pPixmap, pid, pScreen, client, DixReadAccess); if (error != Success) { client->errorValue = pid; break; } } } else { pPixmap = NEXT_PTR(PixmapPtr); if (pPixmap) clipType = CT_PIXMAP; else clipType = CT_NONE; } if (pPixmap) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pScreen)) { error = BadMatch; break; } else { clipType = CT_PIXMAP; pPixmap->refcnt++; } } error = (*ps->ChangePictureClip) (pPicture, clipType, (void *) pPixmap, 0); break; } case CPGraphicsExposure: { unsigned int newe; newe = NEXT_VAL(unsigned int); if (newe <= xTrue) pPicture->graphicsExposures = newe; else { client->errorValue = newe; error = BadValue; } } break; case CPSubwindowMode: { unsigned int news; news = NEXT_VAL(unsigned int); if (news == ClipByChildren || news == IncludeInferiors) pPicture->subWindowMode = news; else { client->errorValue = news; error = BadValue; } } break; case CPPolyEdge: { unsigned int newe; newe = NEXT_VAL(unsigned int); if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth) pPicture->polyEdge = newe; else { client->errorValue = newe; error = BadValue; } } break; case CPPolyMode: { unsigned int newm; newm = NEXT_VAL(unsigned int); if (newm == PolyModePrecise || newm == PolyModeImprecise) pPicture->polyMode = newm; else { client->errorValue = newm; error = BadValue; } } break; case CPDither: (void) NEXT_VAL(Atom); /* unimplemented */ break; case CPComponentAlpha: { unsigned int newca; newca = NEXT_VAL(unsigned int); if (newca <= xTrue) pPicture->componentAlpha = newca; else { client->errorValue = newca; error = BadValue; } } break; default: client->errorValue = maskQ; error = BadValue; break; } } if (ps) (*ps->ChangePicture) (pPicture, maskQ); return error; } int SetPictureClipRects(PicturePtr pPicture, int xOrigin, int yOrigin, int nRect, xRectangle *rects) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); RegionPtr clientClip; int result; clientClip = RegionFromRects(nRect, rects, CT_UNSORTED); if (!clientClip) return BadAlloc; result = (*ps->ChangePictureClip) (pPicture, CT_REGION, (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; pPicture->clipOrigin.y = yOrigin; pPicture->stateChanges |= CPClipXOrigin | CPClipYOrigin | CPClipMask; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; } return result; } int SetPictureClipRegion(PicturePtr pPicture, int xOrigin, int yOrigin, RegionPtr pRegion) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); RegionPtr clientClip; int result; int type; if (pRegion) { type = CT_REGION; clientClip = RegionCreate(RegionExtents(pRegion), RegionNumRects(pRegion)); if (!clientClip) return BadAlloc; if (!RegionCopy(clientClip, pRegion)) { RegionDestroy(clientClip); return BadAlloc; } } else { type = CT_NONE; clientClip = 0; } result = (*ps->ChangePictureClip) (pPicture, type, (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; pPicture->clipOrigin.y = yOrigin; pPicture->stateChanges |= CPClipXOrigin | CPClipYOrigin | CPClipMask; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; } return result; } static Bool transformIsIdentity(PictTransform * t) { return ((t->matrix[0][0] == t->matrix[1][1]) && (t->matrix[0][0] == t->matrix[2][2]) && (t->matrix[0][0] != 0) && (t->matrix[0][1] == 0) && (t->matrix[0][2] == 0) && (t->matrix[1][0] == 0) && (t->matrix[1][2] == 0) && (t->matrix[2][0] == 0) && (t->matrix[2][1] == 0)); } int SetPictureTransform(PicturePtr pPicture, PictTransform * transform) { if (transform && transformIsIdentity(transform)) transform = 0; if (transform) { if (!pPicture->transform) { pPicture->transform = (PictTransform *) malloc(sizeof(PictTransform)); if (!pPicture->transform) return BadAlloc; } *pPicture->transform = *transform; } else { free(pPicture->transform); pPicture->transform = NULL; } pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; if (pPicture->pDrawable != NULL) { int result; PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen); result = (*ps->ChangePictureTransform) (pPicture, transform); return result; } return Success; } static void ValidateOnePicture(PicturePtr pPicture) { if (pPicture->pDrawable && pPicture->serialNumber != pPicture->pDrawable->serialNumber) { PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen); (*ps->ValidatePicture) (pPicture, pPicture->stateChanges); pPicture->stateChanges = 0; pPicture->serialNumber = pPicture->pDrawable->serialNumber; } } void ValidatePicture(PicturePtr pPicture) { ValidateOnePicture(pPicture); if (pPicture->alphaMap) ValidateOnePicture(pPicture->alphaMap); } int FreePicture(void *value, XID pid) { PicturePtr pPicture = (PicturePtr) value; if (--pPicture->refcnt == 0) { free(pPicture->transform); free(pPicture->filter_params); if (pPicture->pSourcePict) { if (pPicture->pSourcePict->type != SourcePictTypeSolidFill) free(pPicture->pSourcePict->linear.stops); free(pPicture->pSourcePict); } if (pPicture->pDrawable) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); if (pPicture->alphaMap) FreePicture((void *) pPicture->alphaMap, (XID) 0); (*ps->DestroyPicture) (pPicture); (*ps->DestroyPictureClip) (pPicture); if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; PicturePtr *pPrev; for (pPrev = (PicturePtr *) dixLookupPrivateAddr (&pWindow->devPrivates, PictureWindowPrivateKey); *pPrev; pPrev = &(*pPrev)->pNext) { if (*pPrev == pPicture) { *pPrev = pPicture->pNext; break; } } } else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) { (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable); } } dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE); } return Success; } /** * ReduceCompositeOp is used to choose simpler ops for cases where alpha * channels are always one and so math on the alpha channel per pixel becomes * unnecessary. It may also avoid destination reads sometimes if apps aren't * being careful to avoid these cases. */ static CARD8 ReduceCompositeOp(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height) { Bool no_src_alpha, no_dst_alpha; /* Sampling off the edge of a RepeatNone picture introduces alpha * even if the picture itself doesn't have alpha. We don't try to * detect every case where we don't sample off the edge, just the * simplest case where there is no transform on the source * picture. */ no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) && PICT_FORMAT_A(pSrc->format) == 0 && (pSrc->repeatType != RepeatNone || (!pSrc->transform && xSrc >= 0 && ySrc >= 0 && xSrc + width <= pSrc->pDrawable->width && ySrc + height <= pSrc->pDrawable->height)) && pSrc->alphaMap == NULL && pMask == NULL; no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) && PICT_FORMAT_A(pDst->format) == 0 && pDst->alphaMap == NULL; /* TODO, maybe: Conjoint and Disjoint op reductions? */ /* Deal with simplifications where the source alpha is always 1. */ if (no_src_alpha) { switch (op) { case PictOpOver: op = PictOpSrc; break; case PictOpInReverse: op = PictOpDst; break; case PictOpOutReverse: op = PictOpClear; break; case PictOpAtop: op = PictOpIn; break; case PictOpAtopReverse: op = PictOpOverReverse; break; case PictOpXor: op = PictOpOut; break; default: break; } } /* Deal with simplifications when the destination alpha is always 1 */ if (no_dst_alpha) { switch (op) { case PictOpOverReverse: op = PictOpDst; break; case PictOpIn: op = PictOpSrc; break; case PictOpOut: op = PictOpClear; break; case PictOpAtop: op = PictOpOver; break; case PictOpXor: op = PictOpOutReverse; break; default: break; } } /* Reduce some con/disjoint ops to the basic names. */ switch (op) { case PictOpDisjointClear: case PictOpConjointClear: op = PictOpClear; break; case PictOpDisjointSrc: case PictOpConjointSrc: op = PictOpSrc; break; case PictOpDisjointDst: case PictOpConjointDst: op = PictOpDst; break; default: break; } return op; } void CompositePicture(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture(pSrc); if (pMask) ValidatePicture(pMask); ValidatePicture(pDst); op = ReduceCompositeOp(op, pSrc, pMask, pDst, xSrc, ySrc, width, height); if (op == PictOpDst) return; (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); } void CompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture(pDst); (*ps->CompositeRects) (op, pDst, color, nRect, rects); } void CompositeTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture(pSrc); ValidatePicture(pDst); (*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps); } void CompositeTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntriangles, xTriangle * triangles) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture(pSrc); ValidatePicture(pDst); (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles, triangles); } void CompositeTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); if (npoints < 3) return; ValidatePicture(pSrc); ValidatePicture(pDst); (*ps->TriStrip) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points); } void CompositeTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); if (npoints < 3) return; ValidatePicture(pSrc); ValidatePicture(pDst); (*ps->TriFan) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points); } void AddTraps(PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap * traps) { PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen); ValidatePicture(pPicture); (*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps); } xorg-server-1.20.8/render/animcur.c0000644000175000017500000002621113640201473014071 00000000000000/* * * 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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. */ /* * Animated cursors for X. Not specific to Render in any way, but * stuck there because Render has the other cool cursor extension. * Besides, everyone has Render. * * Implemented as a simple layer over the core cursor code; it * creates composite cursors out of a set of static cursors and * delta times between each image. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" #include "picturestr.h" #include "inputstr.h" #include "xace.h" typedef struct _AnimCurElt { CursorPtr pCursor; /* cursor to show */ CARD32 delay; /* in ms */ } AnimCurElt; typedef struct _AnimCur { int nelt; /* number of elements in the elts array */ AnimCurElt *elts; /* actually allocated right after the structure */ OsTimerPtr timer; } AnimCurRec, *AnimCurPtr; typedef struct _AnimScrPriv { CloseScreenProcPtr CloseScreen; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; SetCursorPositionProcPtr SetCursorPosition; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; } AnimCurScreenRec, *AnimCurScreenPtr; static unsigned char empty[4]; static CursorBits animCursorBits = { empty, empty, 2, 1, 1, 0, 0, 1 }; static DevPrivateKeyRec AnimCurScreenPrivateKeyRec; #define IsAnimCur(c) ((c) && ((c)->bits == &animCursorBits)) #define GetAnimCur(c) ((AnimCurPtr) ((((char *)(c) + CURSOR_REC_SIZE)))) #define GetAnimCurScreen(s) ((AnimCurScreenPtr)dixLookupPrivate(&(s)->devPrivates, &AnimCurScreenPrivateKeyRec)) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) static Bool AnimCurCloseScreen(ScreenPtr pScreen) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap(as, pScreen, CloseScreen); Unwrap(as, pScreen, CursorLimits); Unwrap(as, pScreen, DisplayCursor); Unwrap(as, pScreen, SetCursorPosition); Unwrap(as, pScreen, RealizeCursor); Unwrap(as, pScreen, UnrealizeCursor); Unwrap(as, pScreen, RecolorCursor); ret = (*pScreen->CloseScreen) (pScreen); return ret; } static void AnimCurCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Unwrap(as, pScreen, CursorLimits); if (IsAnimCur(pCursor)) { AnimCurPtr ac = GetAnimCur(pCursor); (*pScreen->CursorLimits) (pDev, pScreen, ac->elts[0].pCursor, pHotBox, pTopLeftBox); } else { (*pScreen->CursorLimits) (pDev, pScreen, pCursor, pHotBox, pTopLeftBox); } Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); } /* * The cursor animation timer has expired, go display any relevant cursor changes * and compute a new timeout value */ static CARD32 AnimCurTimerNotify(OsTimerPtr timer, CARD32 now, void *arg) { DeviceIntPtr dev = arg; ScreenPtr pScreen = dev->spriteInfo->anim.pScreen; AnimCurScreenPtr as = GetAnimCurScreen(pScreen); AnimCurPtr ac = GetAnimCur(dev->spriteInfo->sprite->current); int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt; DisplayCursorProcPtr DisplayCursor = pScreen->DisplayCursor; /* * Not a simple Unwrap/Wrap as this isn't called along the DisplayCursor * wrapper chain. */ pScreen->DisplayCursor = as->DisplayCursor; (void) (*pScreen->DisplayCursor) (dev, pScreen, ac->elts[elt].pCursor); as->DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = DisplayCursor; dev->spriteInfo->anim.elt = elt; dev->spriteInfo->anim.pCursor = ac->elts[elt].pCursor; return ac->elts[elt].delay; } static void AnimCurCancelTimer(DeviceIntPtr pDev) { CursorPtr cur = pDev->spriteInfo->sprite ? pDev->spriteInfo->sprite->current : NULL; if (IsAnimCur(cur)) TimerCancel(GetAnimCur(cur)->timer); } static Bool AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret = TRUE; if (IsFloating(pDev)) return FALSE; Unwrap(as, pScreen, DisplayCursor); if (IsAnimCur(pCursor)) { if (pCursor != pDev->spriteInfo->sprite->current) { AnimCurPtr ac = GetAnimCur(pCursor); AnimCurCancelTimer(pDev); ret = (*pScreen->DisplayCursor) (pDev, pScreen, ac->elts[0].pCursor); if (ret) { pDev->spriteInfo->anim.elt = 0; pDev->spriteInfo->anim.pCursor = pCursor; pDev->spriteInfo->anim.pScreen = pScreen; ac->timer = TimerSet(ac->timer, 0, ac->elts[0].delay, AnimCurTimerNotify, pDev); } } } else { AnimCurCancelTimer(pDev); pDev->spriteInfo->anim.pCursor = 0; pDev->spriteInfo->anim.pScreen = 0; ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); } Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); return ret; } static Bool AnimCurSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap(as, pScreen, SetCursorPosition); if (pDev->spriteInfo->anim.pCursor) { pDev->spriteInfo->anim.pScreen = pScreen; } ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); return ret; } static Bool AnimCurRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap(as, pScreen, RealizeCursor); if (IsAnimCur(pCursor)) ret = TRUE; else ret = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor); Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor); return ret; } static Bool AnimCurUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap(as, pScreen, UnrealizeCursor); if (IsAnimCur(pCursor)) { AnimCurPtr ac = GetAnimCur(pCursor); int i; if (pScreen->myNum == 0) for (i = 0; i < ac->nelt; i++) FreeCursor(ac->elts[i].pCursor, 0); ret = TRUE; } else ret = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor); Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); return ret; } static void AnimCurRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, Bool displayed) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Unwrap(as, pScreen, RecolorCursor); if (IsAnimCur(pCursor)) { AnimCurPtr ac = GetAnimCur(pCursor); int i; for (i = 0; i < ac->nelt; i++) (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor, displayed && pDev->spriteInfo->anim.elt == i); } else (*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed); Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor); } Bool AnimCurInit(ScreenPtr pScreen) { AnimCurScreenPtr as; if (!dixRegisterPrivateKey(&AnimCurScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(AnimCurScreenRec))) return FALSE; as = GetAnimCurScreen(pScreen); Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor); Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor); return TRUE; } int AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid) { CursorPtr pCursor; int rc = BadAlloc, i; AnimCurPtr ac; for (i = 0; i < screenInfo.numScreens; i++) if (!GetAnimCurScreen(screenInfo.screens[i])) return BadImplementation; for (i = 0; i < ncursor; i++) if (IsAnimCur(cursors[i])) return BadMatch; pCursor = (CursorPtr) calloc(CURSOR_REC_SIZE + sizeof(AnimCurRec) + ncursor * sizeof(AnimCurElt), 1); if (!pCursor) return rc; dixInitPrivates(pCursor, pCursor + 1, PRIVATE_CURSOR); pCursor->bits = &animCursorBits; pCursor->refcnt = 1; pCursor->foreRed = cursors[0]->foreRed; pCursor->foreGreen = cursors[0]->foreGreen; pCursor->foreBlue = cursors[0]->foreBlue; pCursor->backRed = cursors[0]->backRed; pCursor->backGreen = cursors[0]->backGreen; pCursor->backBlue = cursors[0]->backBlue; pCursor->id = cid; ac = GetAnimCur(pCursor); ac->timer = TimerSet(NULL, 0, 0, AnimCurTimerNotify, NULL); /* security creation/labeling check */ if (ac->timer) rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor, RT_NONE, NULL, DixCreateAccess); if (rc != Success) { TimerFree(ac->timer); dixFiniPrivates(pCursor, PRIVATE_CURSOR); free(pCursor); return rc; } /* * Fill in the AnimCurRec */ animCursorBits.refcnt++; ac->nelt = ncursor; ac->elts = (AnimCurElt *) (ac + 1); for (i = 0; i < ncursor; i++) { ac->elts[i].pCursor = RefCursor(cursors[i]); ac->elts[i].delay = deltas[i]; } *ppCursor = pCursor; return Success; } xorg-server-1.20.8/render/Makefile.in0000644000175000017500000007375113640201515014344 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = render ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librender_la_LIBADD = am_librender_la_OBJECTS = animcur.lo filter.lo glyph.lo matrix.lo \ miindex.lo mipict.lo mirect.lo mitrap.lo mitri.lo picture.lo \ render.lo librender_la_OBJECTS = $(am_librender_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/animcur.Plo ./$(DEPDIR)/filter.Plo \ ./$(DEPDIR)/glyph.Plo ./$(DEPDIR)/matrix.Plo \ ./$(DEPDIR)/miindex.Plo ./$(DEPDIR)/mipict.Plo \ ./$(DEPDIR)/mirect.Plo ./$(DEPDIR)/mitrap.Plo \ ./$(DEPDIR)/mitri.Plo ./$(DEPDIR)/picture.Plo \ ./$(DEPDIR)/render.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(librender_la_SOURCES) DIST_SOURCES = $(librender_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__sdk_HEADERS_DIST = picture.h mipict.h glyphstr.h picturestr.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = librender.la AM_CFLAGS = $(DIX_CFLAGS) librender_la_SOURCES = \ animcur.c \ filter.c \ glyph.c \ matrix.c \ miindex.c \ mipict.c \ mirect.c \ mitrap.c \ mitri.c \ picture.c \ render.c @XORG_TRUE@sdk_HEADERS = picture.h mipict.h glyphstr.h picturestr.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign render/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign render/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } librender.la: $(librender_la_OBJECTS) $(librender_la_DEPENDENCIES) $(EXTRA_librender_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(librender_la_OBJECTS) $(librender_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animcur.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glyph.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miindex.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mipict.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mirect.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mitrap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mitri.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/picture.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/animcur.Plo -rm -f ./$(DEPDIR)/filter.Plo -rm -f ./$(DEPDIR)/glyph.Plo -rm -f ./$(DEPDIR)/matrix.Plo -rm -f ./$(DEPDIR)/miindex.Plo -rm -f ./$(DEPDIR)/mipict.Plo -rm -f ./$(DEPDIR)/mirect.Plo -rm -f ./$(DEPDIR)/mitrap.Plo -rm -f ./$(DEPDIR)/mitri.Plo -rm -f ./$(DEPDIR)/picture.Plo -rm -f ./$(DEPDIR)/render.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/animcur.Plo -rm -f ./$(DEPDIR)/filter.Plo -rm -f ./$(DEPDIR)/glyph.Plo -rm -f ./$(DEPDIR)/matrix.Plo -rm -f ./$(DEPDIR)/miindex.Plo -rm -f ./$(DEPDIR)/mipict.Plo -rm -f ./$(DEPDIR)/mirect.Plo -rm -f ./$(DEPDIR)/mitrap.Plo -rm -f ./$(DEPDIR)/mitri.Plo -rm -f ./$(DEPDIR)/picture.Plo -rm -f ./$(DEPDIR)/render.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/render/mitrap.c0000644000175000017500000000520013640201473013722 00000000000000/* * * 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "servermd.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" static xFixed miLineFixedX(xLineFixed * l, xFixed y, Bool ceil) { xFixed dx = l->p2.x - l->p1.x; xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; xFixed dy = l->p2.y - l->p1.y; if (ceil) ex += (dy - 1); return l->p1.x + (xFixed) (ex / dy); } void miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box) { box->y1 = MAXSHORT; box->y2 = MINSHORT; box->x1 = MAXSHORT; box->x2 = MINSHORT; for (; ntrap; ntrap--, traps++) { INT16 x1, y1, x2, y2; if (!xTrapezoidValid(traps)) continue; y1 = xFixedToInt(traps->top); if (y1 < box->y1) box->y1 = y1; y2 = xFixedToInt(xFixedCeil(traps->bottom)); if (y2 > box->y2) box->y2 = y2; x1 = xFixedToInt(min(miLineFixedX(&traps->left, traps->top, FALSE), miLineFixedX(&traps->left, traps->bottom, FALSE))); if (x1 < box->x1) box->x1 = x1; x2 = xFixedToInt(xFixedCeil (max (miLineFixedX(&traps->right, traps->top, TRUE), miLineFixedX(&traps->right, traps->bottom, TRUE)))); if (x2 > box->x2) box->x2 = x2; } } xorg-server-1.20.8/render/render.c0000644000175000017500000027661313640201473013727 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "resource.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "colormapst.h" #include "extnsionst.h" #include "extinit.h" #include "servermd.h" #include #include #include "picturestr.h" #include "glyphstr.h" #include #include "cursorstr.h" #include "xace.h" #include "protocol-versions.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #include static int ProcRenderQueryVersion(ClientPtr pClient); static int ProcRenderQueryPictFormats(ClientPtr pClient); static int ProcRenderQueryPictIndexValues(ClientPtr pClient); static int ProcRenderQueryDithers(ClientPtr pClient); static int ProcRenderCreatePicture(ClientPtr pClient); static int ProcRenderChangePicture(ClientPtr pClient); static int ProcRenderSetPictureClipRectangles(ClientPtr pClient); static int ProcRenderFreePicture(ClientPtr pClient); static int ProcRenderComposite(ClientPtr pClient); static int ProcRenderScale(ClientPtr pClient); static int ProcRenderTrapezoids(ClientPtr pClient); static int ProcRenderTriangles(ClientPtr pClient); static int ProcRenderTriStrip(ClientPtr pClient); static int ProcRenderTriFan(ClientPtr pClient); static int ProcRenderColorTrapezoids(ClientPtr pClient); static int ProcRenderColorTriangles(ClientPtr pClient); static int ProcRenderTransform(ClientPtr pClient); static int ProcRenderCreateGlyphSet(ClientPtr pClient); static int ProcRenderReferenceGlyphSet(ClientPtr pClient); static int ProcRenderFreeGlyphSet(ClientPtr pClient); static int ProcRenderAddGlyphs(ClientPtr pClient); static int ProcRenderAddGlyphsFromPicture(ClientPtr pClient); static int ProcRenderFreeGlyphs(ClientPtr pClient); static int ProcRenderCompositeGlyphs(ClientPtr pClient); static int ProcRenderFillRectangles(ClientPtr pClient); static int ProcRenderCreateCursor(ClientPtr pClient); static int ProcRenderSetPictureTransform(ClientPtr pClient); static int ProcRenderQueryFilters(ClientPtr pClient); static int ProcRenderSetPictureFilter(ClientPtr pClient); static int ProcRenderCreateAnimCursor(ClientPtr pClient); static int ProcRenderAddTraps(ClientPtr pClient); static int ProcRenderCreateSolidFill(ClientPtr pClient); static int ProcRenderCreateLinearGradient(ClientPtr pClient); static int ProcRenderCreateRadialGradient(ClientPtr pClient); static int ProcRenderCreateConicalGradient(ClientPtr pClient); static int ProcRenderDispatch(ClientPtr pClient); static int SProcRenderQueryVersion(ClientPtr pClient); static int SProcRenderQueryPictFormats(ClientPtr pClient); static int SProcRenderQueryPictIndexValues(ClientPtr pClient); static int SProcRenderQueryDithers(ClientPtr pClient); static int SProcRenderCreatePicture(ClientPtr pClient); static int SProcRenderChangePicture(ClientPtr pClient); static int SProcRenderSetPictureClipRectangles(ClientPtr pClient); static int SProcRenderFreePicture(ClientPtr pClient); static int SProcRenderComposite(ClientPtr pClient); static int SProcRenderScale(ClientPtr pClient); static int SProcRenderTrapezoids(ClientPtr pClient); static int SProcRenderTriangles(ClientPtr pClient); static int SProcRenderTriStrip(ClientPtr pClient); static int SProcRenderTriFan(ClientPtr pClient); static int SProcRenderColorTrapezoids(ClientPtr pClient); static int SProcRenderColorTriangles(ClientPtr pClient); static int SProcRenderTransform(ClientPtr pClient); static int SProcRenderCreateGlyphSet(ClientPtr pClient); static int SProcRenderReferenceGlyphSet(ClientPtr pClient); static int SProcRenderFreeGlyphSet(ClientPtr pClient); static int SProcRenderAddGlyphs(ClientPtr pClient); static int SProcRenderAddGlyphsFromPicture(ClientPtr pClient); static int SProcRenderFreeGlyphs(ClientPtr pClient); static int SProcRenderCompositeGlyphs(ClientPtr pClient); static int SProcRenderFillRectangles(ClientPtr pClient); static int SProcRenderCreateCursor(ClientPtr pClient); static int SProcRenderSetPictureTransform(ClientPtr pClient); static int SProcRenderQueryFilters(ClientPtr pClient); static int SProcRenderSetPictureFilter(ClientPtr pClient); static int SProcRenderCreateAnimCursor(ClientPtr pClient); static int SProcRenderAddTraps(ClientPtr pClient); static int SProcRenderCreateSolidFill(ClientPtr pClient); static int SProcRenderCreateLinearGradient(ClientPtr pClient); static int SProcRenderCreateRadialGradient(ClientPtr pClient); static int SProcRenderCreateConicalGradient(ClientPtr pClient); static int SProcRenderDispatch(ClientPtr pClient); int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr) = { ProcRenderQueryVersion, ProcRenderQueryPictFormats, ProcRenderQueryPictIndexValues, ProcRenderQueryDithers, ProcRenderCreatePicture, ProcRenderChangePicture, ProcRenderSetPictureClipRectangles, ProcRenderFreePicture, ProcRenderComposite, ProcRenderScale, ProcRenderTrapezoids, ProcRenderTriangles, ProcRenderTriStrip, ProcRenderTriFan, ProcRenderColorTrapezoids, ProcRenderColorTriangles, ProcRenderTransform, ProcRenderCreateGlyphSet, ProcRenderReferenceGlyphSet, ProcRenderFreeGlyphSet, ProcRenderAddGlyphs, ProcRenderAddGlyphsFromPicture, ProcRenderFreeGlyphs, ProcRenderCompositeGlyphs, ProcRenderCompositeGlyphs, ProcRenderCompositeGlyphs, ProcRenderFillRectangles, ProcRenderCreateCursor, ProcRenderSetPictureTransform, ProcRenderQueryFilters, ProcRenderSetPictureFilter, ProcRenderCreateAnimCursor, ProcRenderAddTraps, ProcRenderCreateSolidFill, ProcRenderCreateLinearGradient, ProcRenderCreateRadialGradient, ProcRenderCreateConicalGradient}; int (*SProcRenderVector[RenderNumberRequests]) (ClientPtr) = { SProcRenderQueryVersion, SProcRenderQueryPictFormats, SProcRenderQueryPictIndexValues, SProcRenderQueryDithers, SProcRenderCreatePicture, SProcRenderChangePicture, SProcRenderSetPictureClipRectangles, SProcRenderFreePicture, SProcRenderComposite, SProcRenderScale, SProcRenderTrapezoids, SProcRenderTriangles, SProcRenderTriStrip, SProcRenderTriFan, SProcRenderColorTrapezoids, SProcRenderColorTriangles, SProcRenderTransform, SProcRenderCreateGlyphSet, SProcRenderReferenceGlyphSet, SProcRenderFreeGlyphSet, SProcRenderAddGlyphs, SProcRenderAddGlyphsFromPicture, SProcRenderFreeGlyphs, SProcRenderCompositeGlyphs, SProcRenderCompositeGlyphs, SProcRenderCompositeGlyphs, SProcRenderFillRectangles, SProcRenderCreateCursor, SProcRenderSetPictureTransform, SProcRenderQueryFilters, SProcRenderSetPictureFilter, SProcRenderCreateAnimCursor, SProcRenderAddTraps, SProcRenderCreateSolidFill, SProcRenderCreateLinearGradient, SProcRenderCreateRadialGradient, SProcRenderCreateConicalGradient}; int RenderErrBase; static DevPrivateKeyRec RenderClientPrivateKeyRec; #define RenderClientPrivateKey (&RenderClientPrivateKeyRec ) typedef struct _RenderClient { int major_version; int minor_version; } RenderClientRec, *RenderClientPtr; #define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey)) #ifdef PANORAMIX RESTYPE XRT_PICTURE; #endif void RenderExtensionInit(void) { ExtensionEntry *extEntry; if (!PictureType) return; if (!PictureFinishInit()) return; if (!dixRegisterPrivateKey (&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec))) return; extEntry = AddExtension(RENDER_NAME, 0, RenderNumberErrors, ProcRenderDispatch, SProcRenderDispatch, NULL, StandardMinorOpcode); if (!extEntry) return; RenderErrBase = extEntry->errorBase; #ifdef PANORAMIX if (XRT_PICTURE) SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture); #endif SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture); SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat); SetResourceTypeErrorValue(GlyphSetType, RenderErrBase + BadGlyphSet); } static int ProcRenderQueryVersion(ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient(client); xRenderQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xRenderQueryVersionReq); REQUEST_SIZE_MATCH(xRenderQueryVersionReq); pRenderClient->major_version = stuff->majorVersion; pRenderClient->minor_version = stuff->minorVersion; if ((stuff->majorVersion * 1000 + stuff->minorVersion) < (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION)) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_RENDER_MAJOR_VERSION; rep.minorVersion = SERVER_RENDER_MINOR_VERSION; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep); return Success; } static VisualPtr findVisual(ScreenPtr pScreen, VisualID vid) { VisualPtr pVisual; int v; for (v = 0; v < pScreen->numVisuals; v++) { pVisual = pScreen->visuals + v; if (pVisual->vid == vid) return pVisual; } return 0; } static int ProcRenderQueryPictFormats(ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient(client); xRenderQueryPictFormatsReply *reply; xPictScreen *pictScreen; xPictDepth *pictDepth; xPictVisual *pictVisual; xPictFormInfo *pictForm; CARD32 *pictSubpixel; ScreenPtr pScreen; VisualPtr pVisual; DepthPtr pDepth; int v, d; PictureScreenPtr ps; PictFormatPtr pFormat; int nformat; int ndepth; int nvisual; int rlength; int s; int numScreens; int numSubpixel; /* REQUEST(xRenderQueryPictFormatsReq); */ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); #ifdef PANORAMIX if (noPanoramiXExtension) numScreens = screenInfo.numScreens; else numScreens = ((xConnSetup *) ConnectionInfo)->numRoots; #else numScreens = screenInfo.numScreens; #endif ndepth = nformat = nvisual = 0; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; for (d = 0; d < pScreen->numDepths; d++) { pDepth = pScreen->allowedDepths + d; ++ndepth; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual(pScreen, pDepth->vids[v]); if (pVisual && PictureMatchVisual(pScreen, pDepth->depth, pVisual)) ++nvisual; } } ps = GetPictureScreenIfSet(pScreen); if (ps) nformat += ps->nformats; } if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6) numSubpixel = 0; else numSubpixel = numScreens; rlength = (sizeof(xRenderQueryPictFormatsReply) + nformat * sizeof(xPictFormInfo) + numScreens * sizeof(xPictScreen) + ndepth * sizeof(xPictDepth) + nvisual * sizeof(xPictVisual) + numSubpixel * sizeof(CARD32)); reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength); if (!reply) return BadAlloc; reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = bytes_to_int32(rlength - sizeof(xGenericReply)); reply->numFormats = nformat; reply->numScreens = numScreens; reply->numDepths = ndepth; reply->numVisuals = nvisual; reply->numSubpixel = numSubpixel; pictForm = (xPictFormInfo *) (reply + 1); for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) { for (nformat = 0, pFormat = ps->formats; nformat < ps->nformats; nformat++, pFormat++) { pictForm->id = pFormat->id; pictForm->type = pFormat->type; pictForm->depth = pFormat->depth; pictForm->direct.red = pFormat->direct.red; pictForm->direct.redMask = pFormat->direct.redMask; pictForm->direct.green = pFormat->direct.green; pictForm->direct.greenMask = pFormat->direct.greenMask; pictForm->direct.blue = pFormat->direct.blue; pictForm->direct.blueMask = pFormat->direct.blueMask; pictForm->direct.alpha = pFormat->direct.alpha; pictForm->direct.alphaMask = pFormat->direct.alphaMask; if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) pictForm->colormap = pFormat->index.pColormap->mid; else pictForm->colormap = None; if (client->swapped) { swapl(&pictForm->id); swaps(&pictForm->direct.red); swaps(&pictForm->direct.redMask); swaps(&pictForm->direct.green); swaps(&pictForm->direct.greenMask); swaps(&pictForm->direct.blue); swaps(&pictForm->direct.blueMask); swaps(&pictForm->direct.alpha); swaps(&pictForm->direct.alphaMask); swapl(&pictForm->colormap); } pictForm++; } } } pictScreen = (xPictScreen *) pictForm; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; pictDepth = (xPictDepth *) (pictScreen + 1); ndepth = 0; for (d = 0; d < pScreen->numDepths; d++) { pictVisual = (xPictVisual *) (pictDepth + 1); pDepth = pScreen->allowedDepths + d; nvisual = 0; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual(pScreen, pDepth->vids[v]); if (pVisual && (pFormat = PictureMatchVisual(pScreen, pDepth->depth, pVisual))) { pictVisual->visual = pVisual->vid; pictVisual->format = pFormat->id; if (client->swapped) { swapl(&pictVisual->visual); swapl(&pictVisual->format); } pictVisual++; nvisual++; } } pictDepth->depth = pDepth->depth; pictDepth->nPictVisuals = nvisual; if (client->swapped) { swaps(&pictDepth->nPictVisuals); } ndepth++; pictDepth = (xPictDepth *) pictVisual; } pictScreen->nDepth = ndepth; ps = GetPictureScreenIfSet(pScreen); if (ps) pictScreen->fallback = ps->fallback->id; else pictScreen->fallback = 0; if (client->swapped) { swapl(&pictScreen->nDepth); swapl(&pictScreen->fallback); } pictScreen = (xPictScreen *) pictDepth; } pictSubpixel = (CARD32 *) pictScreen; for (s = 0; s < numSubpixel; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) *pictSubpixel = ps->subpixel; else *pictSubpixel = SubPixelUnknown; if (client->swapped) { swapl(pictSubpixel); } ++pictSubpixel; } if (client->swapped) { swaps(&reply->sequenceNumber); swapl(&reply->length); swapl(&reply->numFormats); swapl(&reply->numScreens); swapl(&reply->numDepths); swapl(&reply->numVisuals); swapl(&reply->numSubpixel); } WriteToClient(client, rlength, reply); free(reply); return Success; } static int ProcRenderQueryPictIndexValues(ClientPtr client) { PictFormatPtr pFormat; int rc, num; int rlength; int i; REQUEST(xRenderQueryPictIndexValuesReq); xRenderQueryPictIndexValuesReply *reply; xIndexValue *values; REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); rc = dixLookupResourceByType((void **) &pFormat, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; if (pFormat->type != PictTypeIndexed) { client->errorValue = stuff->format; return BadMatch; } num = pFormat->index.nvalues; rlength = (sizeof(xRenderQueryPictIndexValuesReply) + num * sizeof(xIndexValue)); reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength); if (!reply) return BadAlloc; reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = bytes_to_int32(rlength - sizeof(xGenericReply)); reply->numIndexValues = num; values = (xIndexValue *) (reply + 1); memcpy(reply + 1, pFormat->index.pValues, num * sizeof(xIndexValue)); if (client->swapped) { for (i = 0; i < num; i++) { swapl(&values[i].pixel); swaps(&values[i].red); swaps(&values[i].green); swaps(&values[i].blue); swaps(&values[i].alpha); } swaps(&reply->sequenceNumber); swapl(&reply->length); swapl(&reply->numIndexValues); } WriteToClient(client, rlength, reply); free(reply); return Success; } static int ProcRenderQueryDithers(ClientPtr client) { return BadImplementation; } static int ProcRenderCreatePicture(ClientPtr client) { PicturePtr pPicture; DrawablePtr pDrawable; PictFormatPtr pFormat; int len, error, rc; REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); LEGAL_NEW_RESOURCE(stuff->pid, client); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess | DixAddAccess); if (rc != Success) return rc; rc = dixLookupResourceByType((void **) &pFormat, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; if (pFormat->depth != pDrawable->depth) return BadMatch; len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq)); if (Ones(stuff->mask) != len) return BadLength; pPicture = CreatePicture(stuff->pid, pDrawable, pFormat, stuff->mask, (XID *) (stuff + 1), client, &error); if (!pPicture) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } static int ProcRenderChangePicture(ClientPtr client) { PicturePtr pPicture; REQUEST(xRenderChangePictureReq); int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq)); if (Ones(stuff->mask) != len) return BadLength; return ChangePicture(pPicture, stuff->mask, (XID *) (stuff + 1), (DevUnion *) 0, client); } static int ProcRenderSetPictureClipRectangles(ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); PicturePtr pPicture; int nr; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); if (!pPicture->pDrawable) return RenderErrBase + BadPicture; nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq); if (nr & 4) return BadLength; nr >>= 3; return SetPictureClipRects(pPicture, stuff->xOrigin, stuff->yOrigin, nr, (xRectangle *) &stuff[1]); } static int ProcRenderFreePicture(ClientPtr client) { PicturePtr pPicture; REQUEST(xRenderFreePictureReq); REQUEST_SIZE_MATCH(xRenderFreePictureReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess); FreeResource(stuff->picture, RT_NONE); return Success; } static Bool PictOpValid(CARD8 op) { if ( /*PictOpMinimum <= op && */ op <= PictOpMaximum) return TRUE; if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum) return TRUE; if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum) return TRUE; if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum) return TRUE; return FALSE; } static int ProcRenderComposite(ClientPtr client) { PicturePtr pSrc, pMask, pDst; REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); VERIFY_ALPHA(pMask, stuff->mask, client, DixReadAccess); if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask && pMask-> pDrawable && pDst-> pDrawable-> pScreen != pMask-> pDrawable-> pScreen)) return BadMatch; CompositePicture(stuff->op, pSrc, pMask, pDst, stuff->xSrc, stuff->ySrc, stuff->xMask, stuff->yMask, stuff->xDst, stuff->yDst, stuff->width, stuff->height); return Success; } static int ProcRenderScale(ClientPtr client) { return BadImplementation; } static int ProcRenderTrapezoids(ClientPtr client) { int rc, ntraps; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; } else pFormat = 0; ntraps = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq); if (ntraps % sizeof(xTrapezoid)) return BadLength; ntraps /= sizeof(xTrapezoid); if (ntraps) CompositeTrapezoids(stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntraps, (xTrapezoid *) &stuff[1]); return Success; } static int ProcRenderTriangles(ClientPtr client) { int rc, ntris; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; } else pFormat = 0; ntris = (client->req_len << 2) - sizeof(xRenderTrianglesReq); if (ntris % sizeof(xTriangle)) return BadLength; ntris /= sizeof(xTriangle); if (ntris) CompositeTriangles(stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntris, (xTriangle *) &stuff[1]); return Success; } static int ProcRenderTriStrip(ClientPtr client) { int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; } else pFormat = 0; npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq)); if (npoints & 4) return BadLength; npoints >>= 3; if (npoints >= 3) CompositeTriStrip(stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, npoints, (xPointFixed *) &stuff[1]); return Success; } static int ProcRenderTriFan(ClientPtr client) { int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; } else pFormat = 0; npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq)); if (npoints & 4) return BadLength; npoints >>= 3; if (npoints >= 3) CompositeTriFan(stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, npoints, (xPointFixed *) &stuff[1]); return Success; } static int ProcRenderColorTrapezoids(ClientPtr client) { return BadImplementation; } static int ProcRenderColorTriangles(ClientPtr client) { return BadImplementation; } static int ProcRenderTransform(ClientPtr client) { return BadImplementation; } static int ProcRenderCreateGlyphSet(ClientPtr client) { GlyphSetPtr glyphSet; PictFormatPtr format; int rc, f; REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); rc = dixLookupResourceByType((void **) &format, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; switch (format->depth) { case 1: f = GlyphFormat1; break; case 4: f = GlyphFormat4; break; case 8: f = GlyphFormat8; break; case 16: f = GlyphFormat16; break; case 32: f = GlyphFormat32; break; default: return BadMatch; } if (format->type != PictTypeDirect) return BadMatch; glyphSet = AllocateGlyphSet(f, format); if (!glyphSet) return BadAlloc; /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType, glyphSet, RT_NONE, NULL, DixCreateAccess); if (rc != Success) return rc; if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet)) return BadAlloc; return Success; } static int ProcRenderReferenceGlyphSet(ClientPtr client) { GlyphSetPtr glyphSet; int rc; REQUEST(xRenderReferenceGlyphSetReq); REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); rc = dixLookupResourceByType((void **) &glyphSet, stuff->existing, GlyphSetType, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->existing; return rc; } glyphSet->refcnt++; if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet)) return BadAlloc; return Success; } #define NLOCALDELTA 64 #define NLOCALGLYPH 256 static int ProcRenderFreeGlyphSet(ClientPtr client) { GlyphSetPtr glyphSet; int rc; REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixDestroyAccess); if (rc != Success) { client->errorValue = stuff->glyphset; return rc; } FreeResource(stuff->glyphset, RT_NONE); return Success; } typedef struct _GlyphNew { Glyph id; GlyphPtr glyph; Bool found; unsigned char sha1[20]; } GlyphNewRec, *GlyphNewPtr; #define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) static int ProcRenderAddGlyphs(ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderAddGlyphsReq); GlyphNewRec glyphsLocal[NLOCALGLYPH]; GlyphNewPtr glyphsBase, glyphs, glyph_new; int remain, nglyphs; CARD32 *gids; xGlyphInfo *gi; CARD8 *bits; unsigned int size; int err; int i, screen; PicturePtr pSrc = NULL, pDst = NULL; PixmapPtr pSrcPix = NULL, pDstPix = NULL; CARD32 component_alpha; REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); err = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixAddAccess); if (err != Success) { client->errorValue = stuff->glyphset; return err; } err = BadAlloc; nglyphs = stuff->nglyphs; if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec)) return BadAlloc; component_alpha = NeedsComponent(glyphSet->format->format); if (nglyphs <= NLOCALGLYPH) { memset(glyphsLocal, 0, sizeof(glyphsLocal)); glyphsBase = glyphsLocal; } else { glyphsBase = (GlyphNewPtr) calloc(nglyphs, sizeof(GlyphNewRec)); if (!glyphsBase) return BadAlloc; } remain = (client->req_len << 2) - sizeof(xRenderAddGlyphsReq); glyphs = glyphsBase; gids = (CARD32 *) (stuff + 1); gi = (xGlyphInfo *) (gids + nglyphs); bits = (CARD8 *) (gi + nglyphs); remain -= (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs; /* protect against bad nglyphs */ if (gi < ((xGlyphInfo *) stuff) || gi > ((xGlyphInfo *) ((CARD32 *) stuff + client->req_len)) || bits < ((CARD8 *) stuff) || bits > ((CARD8 *) ((CARD32 *) stuff + client->req_len))) { err = BadLength; goto bail; } for (i = 0; i < nglyphs; i++) { size_t padded_width; glyph_new = &glyphs[i]; padded_width = PixmapBytePad(gi[i].width, glyphSet->format->depth); if (gi[i].height && padded_width > (UINT32_MAX - sizeof(GlyphRec)) / gi[i].height) break; size = gi[i].height * padded_width; if (remain < size) break; err = HashGlyph(&gi[i], bits, size, glyph_new->sha1); if (err) goto bail; glyph_new->glyph = FindGlyphByHash(glyph_new->sha1, glyphSet->fdepth); if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph) { glyph_new->found = TRUE; } else { GlyphPtr glyph; glyph_new->found = FALSE; glyph_new->glyph = glyph = AllocateGlyph(&gi[i], glyphSet->fdepth); if (!glyph) { err = BadAlloc; goto bail; } for (screen = 0; screen < screenInfo.numScreens; screen++) { int width = gi[i].width; int height = gi[i].height; int depth = glyphSet->format->depth; ScreenPtr pScreen; int error; /* Skip work if it's invisibly small anyway */ if (!width || !height) break; pScreen = screenInfo.screens[screen]; pSrcPix = GetScratchPixmapHeader(pScreen, width, height, depth, depth, -1, bits); if (!pSrcPix) { err = BadAlloc; goto bail; } pSrc = CreatePicture(0, &pSrcPix->drawable, glyphSet->format, 0, NULL, serverClient, &error); if (!pSrc) { err = BadAlloc; goto bail; } pDstPix = (pScreen->CreatePixmap) (pScreen, width, height, depth, CREATE_PIXMAP_USAGE_GLYPH_PICTURE); if (!pDstPix) { err = BadAlloc; goto bail; } pDst = CreatePicture(0, &pDstPix->drawable, glyphSet->format, CPComponentAlpha, &component_alpha, serverClient, &error); SetGlyphPicture(glyph, pScreen, pDst); /* The picture takes a reference to the pixmap, so we drop ours. */ (pScreen->DestroyPixmap) (pDstPix); pDstPix = NULL; if (!pDst) { err = BadAlloc; goto bail; } CompositePicture(PictOpSrc, pSrc, None, pDst, 0, 0, 0, 0, 0, 0, width, height); FreePicture((void *) pSrc, 0); pSrc = NULL; FreeScratchPixmapHeader(pSrcPix); pSrcPix = NULL; } memcpy(glyph_new->glyph->sha1, glyph_new->sha1, 20); } glyph_new->id = gids[i]; if (size & 3) size += 4 - (size & 3); bits += size; remain -= size; } if (remain || i < nglyphs) { err = BadLength; goto bail; } if (!ResizeGlyphSet(glyphSet, nglyphs)) { err = BadAlloc; goto bail; } for (i = 0; i < nglyphs; i++) AddGlyph(glyphSet, glyphs[i].glyph, glyphs[i].id); if (glyphsBase != glyphsLocal) free(glyphsBase); return Success; bail: if (pSrc) FreePicture((void *) pSrc, 0); if (pSrcPix) FreeScratchPixmapHeader(pSrcPix); for (i = 0; i < nglyphs; i++) if (glyphs[i].glyph && !glyphs[i].found) free(glyphs[i].glyph); if (glyphsBase != glyphsLocal) free(glyphsBase); return err; } static int ProcRenderAddGlyphsFromPicture(ClientPtr client) { return BadImplementation; } static int ProcRenderFreeGlyphs(ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); GlyphSetPtr glyphSet; int rc, nglyph; CARD32 *gids; CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixRemoveAccess); if (rc != Success) { client->errorValue = stuff->glyphset; return rc; } nglyph = bytes_to_int32((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)); gids = (CARD32 *) (stuff + 1); while (nglyph-- > 0) { glyph = *gids++; if (!DeleteGlyph(glyphSet, glyph)) { client->errorValue = glyph; return RenderErrBase + BadGlyph; } } return Success; } static int ProcRenderCompositeGlyphs(ClientPtr client) { GlyphSetPtr glyphSet; GlyphSet gs; PicturePtr pSrc, pDst; PictFormatPtr pFormat; GlyphListRec listsLocal[NLOCALDELTA]; GlyphListPtr lists, listsBase; GlyphPtr glyphsLocal[NLOCALGLYPH]; Glyph glyph; GlyphPtr *glyphs, *glyphsBase; xGlyphElt *elt; CARD8 *buffer, *end; int nglyph; int nlist; int space; int size; int rc, n; REQUEST(xRenderCompositeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); switch (stuff->renderReqType) { default: size = 1; break; case X_RenderCompositeGlyphs16: size = 2; break; case X_RenderCompositeGlyphs32: size = 4; break; } if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; } else pFormat = 0; rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixUseAccess); if (rc != Success) return rc; buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); nglyph = 0; nlist = 0; while (buffer + sizeof(xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof(xGlyphElt); if (elt->len == 0xff) { buffer += 4; } else { nlist++; nglyph += elt->len; space = size * elt->len; if (space & 3) space += 4 - (space & 3); buffer += space; } } if (nglyph <= NLOCALGLYPH) glyphsBase = glyphsLocal; else { glyphsBase = xallocarray(nglyph, sizeof(GlyphPtr)); if (!glyphsBase) return BadAlloc; } if (nlist <= NLOCALDELTA) listsBase = listsLocal; else { listsBase = xallocarray(nlist, sizeof(GlyphListRec)); if (!listsBase) { rc = BadAlloc; goto bail; } } buffer = (CARD8 *) (stuff + 1); glyphs = glyphsBase; lists = listsBase; while (buffer + sizeof(xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof(xGlyphElt); if (elt->len == 0xff) { if (buffer + sizeof(GlyphSet) < end) { memcpy(&gs, buffer, sizeof(GlyphSet)); rc = dixLookupResourceByType((void **) &glyphSet, gs, GlyphSetType, client, DixUseAccess); if (rc != Success) goto bail; } buffer += 4; } else { lists->xOff = elt->deltax; lists->yOff = elt->deltay; lists->format = glyphSet->format; lists->len = 0; n = elt->len; while (n--) { if (buffer + size <= end) { switch (size) { case 1: glyph = *((CARD8 *) buffer); break; case 2: glyph = *((CARD16 *) buffer); break; case 4: default: glyph = *((CARD32 *) buffer); break; } if ((*glyphs = FindGlyph(glyphSet, glyph))) { lists->len++; glyphs++; } } buffer += size; } space = size * elt->len; if (space & 3) buffer += 4 - (space & 3); lists++; } } if (buffer > end) { rc = BadLength; goto bail; } CompositeGlyphs(stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase); rc = Success; bail: if (glyphsBase != glyphsLocal) free(glyphsBase); if (listsBase != listsLocal) free(listsBase); return rc; } static int ProcRenderFillRectangles(ClientPtr client) { PicturePtr pDst; int things; REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess); if (!pDst->pDrawable) return BadDrawable; things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq); if (things & 4) return BadLength; things >>= 3; CompositeRects(stuff->op, pDst, &stuff->color, things, (xRectangle *) &stuff[1]); return Success; } static void RenderSetBit(unsigned char *line, int x, int bit) { unsigned char mask; if (screenInfo.bitmapBitOrder == LSBFirst) mask = (1 << (x & 7)); else mask = (0x80 >> (x & 7)); /* XXX assumes byte order is host byte order */ line += (x >> 3); if (bit) *line |= mask; else *line &= ~mask; } #define DITHER_DIM 2 static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = { {1, 3,}, {4, 2,}, }; #define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) static int ProcRenderCreateCursor(ClientPtr client) { REQUEST(xRenderCreateCursorReq); PicturePtr pSrc; ScreenPtr pScreen; unsigned short width, height; CARD32 *argbbits, *argb; unsigned char *srcbits, *srcline; unsigned char *mskbits, *mskline; int stride; int x, y; int nbytes_mono; CursorMetricRec cm; CursorPtr pCursor; CARD32 twocolor[3]; int rc, ncolor; REQUEST_SIZE_MATCH(xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); if (!pSrc->pDrawable) return BadDrawable; pScreen = pSrc->pDrawable->pScreen; width = pSrc->pDrawable->width; height = pSrc->pDrawable->height; if (height && width > UINT32_MAX / (height * sizeof(CARD32))) return BadAlloc; if (stuff->x > width || stuff->y > height) return BadMatch; argbbits = malloc(width * height * sizeof(CARD32)); if (!argbbits) return BadAlloc; stride = BitmapBytePad(width); nbytes_mono = stride * height; srcbits = calloc(1, nbytes_mono); if (!srcbits) { free(argbbits); return BadAlloc; } mskbits = calloc(1, nbytes_mono); if (!mskbits) { free(argbbits); free(srcbits); return BadAlloc; } /* what kind of maniac creates a cursor from a window picture though */ if (pSrc->pDrawable->type == DRAWABLE_WINDOW) pScreen->SourceValidate(pSrc->pDrawable, 0, 0, width, height, IncludeInferiors); if (pSrc->format == PICT_a8r8g8b8) { (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); } else { PixmapPtr pPixmap; PicturePtr pPicture; PictFormatPtr pFormat; int error; pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); if (!pFormat) { free(argbbits); free(srcbits); free(mskbits); return BadImplementation; } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free(argbbits); free(srcbits); free(mskbits); return BadAlloc; } pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0, client, &error); if (!pPicture) { free(argbbits); free(srcbits); free(mskbits); return error; } (*pScreen->DestroyPixmap) (pPixmap); CompositePicture(PictOpSrc, pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); FreePicture(pPicture, 0); } /* * Check whether the cursor can be directly supported by * the core cursor code */ ncolor = 0; argb = argbbits; for (y = 0; ncolor <= 2 && y < height; y++) { for (x = 0; ncolor <= 2 && x < width; x++) { CARD32 p = *argb++; CARD32 a = (p >> 24); if (a == 0) /* transparent */ continue; if (a == 0xff) { /* opaque */ int n; for (n = 0; n < ncolor; n++) if (p == twocolor[n]) break; if (n == ncolor) twocolor[ncolor++] = p; } else ncolor = 3; } } /* * Convert argb image to two plane cursor */ srcline = srcbits; mskline = mskbits; argb = argbbits; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { CARD32 p = *argb++; if (ncolor <= 2) { CARD32 a = ((p >> 24)); RenderSetBit(mskline, x, a != 0); RenderSetBit(srcline, x, a != 0 && p == twocolor[0]); } else { CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255; CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255; CARD32 d = orderedDither[y & (DITHER_DIM - 1)][x & (DITHER_DIM - 1)]; /* Set mask from dithered alpha value */ RenderSetBit(mskline, x, a > d); /* Set src from dithered intensity value */ RenderSetBit(srcline, x, a > d && i <= d); } } srcline += stride; mskline += stride; } /* * Dither to white and black if the cursor has more than two colors */ if (ncolor > 2) { twocolor[0] = 0xff000000; twocolor[1] = 0xffffffff; } else { free(argbbits); argbbits = 0; } #define GetByte(p,s) (((p) >> (s)) & 0xff) #define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8)) cm.width = width; cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm, GetColor(twocolor[0], 16), GetColor(twocolor[0], 8), GetColor(twocolor[0], 0), GetColor(twocolor[1], 16), GetColor(twocolor[1], 8), GetColor(twocolor[1], 0), &pCursor, client, stuff->cid); if (rc != Success) goto bail; if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) { rc = BadAlloc; goto bail; } return Success; bail: free(srcbits); free(mskbits); return rc; } static int ProcRenderSetPictureTransform(ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); PicturePtr pPicture; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); return SetPictureTransform(pPicture, (PictTransform *) &stuff->transform); } static int ProcRenderQueryFilters(ClientPtr client) { REQUEST(xRenderQueryFiltersReq); DrawablePtr pDrawable; xRenderQueryFiltersReply *reply; int nbytesName; int nnames; ScreenPtr pScreen; PictureScreenPtr ps; int i, j, len, total_bytes, rc; INT16 *aliases; char *names; REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pDrawable->pScreen; nbytesName = 0; nnames = 0; ps = GetPictureScreenIfSet(pScreen); if (ps) { for (i = 0; i < ps->nfilters; i++) nbytesName += 1 + strlen(ps->filters[i].name); for (i = 0; i < ps->nfilterAliases; i++) nbytesName += 1 + strlen(ps->filterAliases[i].alias); nnames = ps->nfilters + ps->nfilterAliases; } len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName); total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2); reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes); if (!reply) return BadAlloc; aliases = (INT16 *) (reply + 1); names = (char *) (aliases + ((nnames + 1) & ~1)); reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = len; reply->numAliases = nnames; reply->numFilters = nnames; if (ps) { /* fill in alias values */ for (i = 0; i < ps->nfilters; i++) aliases[i] = FilterAliasNone; for (i = 0; i < ps->nfilterAliases; i++) { for (j = 0; j < ps->nfilters; j++) if (ps->filterAliases[i].filter_id == ps->filters[j].id) break; if (j == ps->nfilters) { for (j = 0; j < ps->nfilterAliases; j++) if (ps->filterAliases[i].filter_id == ps->filterAliases[j].alias_id) { break; } if (j == ps->nfilterAliases) j = FilterAliasNone; else j = j + ps->nfilters; } aliases[i + ps->nfilters] = j; } /* fill in filter names */ for (i = 0; i < ps->nfilters; i++) { j = strlen(ps->filters[i].name); *names++ = j; memcpy(names, ps->filters[i].name, j); names += j; } /* fill in filter alias names */ for (i = 0; i < ps->nfilterAliases; i++) { j = strlen(ps->filterAliases[i].alias); *names++ = j; memcpy(names, ps->filterAliases[i].alias, j); names += j; } } if (client->swapped) { for (i = 0; i < reply->numAliases; i++) { swaps(&aliases[i]); } swaps(&reply->sequenceNumber); swapl(&reply->length); swapl(&reply->numAliases); swapl(&reply->numFilters); } WriteToClient(client, total_bytes, reply); free(reply); return Success; } static int ProcRenderSetPictureFilter(ClientPtr client) { REQUEST(xRenderSetPictureFilterReq); PicturePtr pPicture; int result; xFixed *params; int nparams; char *name; REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); name = (char *) (stuff + 1); params = (xFixed *) (name + pad_to_int32(stuff->nbytes)); nparams = ((xFixed *) stuff + client->req_len) - params; if (nparams < 0) return BadLength; result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams); return result; } static int ProcRenderCreateAnimCursor(ClientPtr client) { REQUEST(xRenderCreateAnimCursorReq); CursorPtr *cursors; CARD32 *deltas; CursorPtr pCursor; int ncursor; xAnimCursorElt *elt; int i; int ret; REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); if (client->req_len & 1) return BadLength; ncursor = (client->req_len - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1; cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32)); if (!cursors) return BadAlloc; deltas = (CARD32 *) (cursors + ncursor); elt = (xAnimCursorElt *) (stuff + 1); for (i = 0; i < ncursor; i++) { ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor, RT_CURSOR, client, DixReadAccess); if (ret != Success) { free(cursors); return ret; } deltas[i] = elt->delay; elt++; } ret = AnimCursorCreate(cursors, deltas, ncursor, &pCursor, client, stuff->cid); free(cursors); if (ret != Success) return ret; if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) return Success; return BadAlloc; } static int ProcRenderAddTraps(ClientPtr client) { int ntraps; PicturePtr pPicture; REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess); if (!pPicture->pDrawable) return BadDrawable; ntraps = (client->req_len << 2) - sizeof(xRenderAddTrapsReq); if (ntraps % sizeof(xTrap)) return BadLength; ntraps /= sizeof(xTrap); if (ntraps) AddTraps(pPicture, stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]); return Success; } static int ProcRenderCreateSolidFill(ClientPtr client) { PicturePtr pPicture; int error = 0; REQUEST(xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq); LEGAL_NEW_RESOURCE(stuff->pid, client); pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); if (!pPicture) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateLinearGradient(ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateLinearGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *) (stuff + 1); colors = (xRenderColor *) (stops + stuff->nStops); pPicture = CreateLinearGradientPicture(stuff->pid, &stuff->p1, &stuff->p2, stuff->nStops, stops, colors, &error); if (!pPicture) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateRadialGradient(ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *) (stuff + 1); colors = (xRenderColor *) (stops + stuff->nStops); pPicture = CreateRadialGradientPicture(stuff->pid, &stuff->inner, &stuff->outer, stuff->inner_radius, stuff->outer_radius, stuff->nStops, stops, colors, &error); if (!pPicture) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateConicalGradient(ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *) (stuff + 1); colors = (xRenderColor *) (stops + stuff->nStops); pPicture = CreateConicalGradientPicture(stuff->pid, &stuff->center, stuff->angle, stuff->nStops, stops, colors, &error); if (!pPicture) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } static int ProcRenderDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data < RenderNumberRequests) return (*ProcRenderVector[stuff->data]) (client); else return BadRequest; } static int _X_COLD SProcRenderQueryVersion(ClientPtr client) { REQUEST(xRenderQueryVersionReq); REQUEST_SIZE_MATCH(xRenderQueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderQueryPictFormats(ClientPtr client) { REQUEST(xRenderQueryPictFormatsReq); REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); swaps(&stuff->length); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderQueryPictIndexValues(ClientPtr client) { REQUEST(xRenderQueryPictIndexValuesReq); REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); swaps(&stuff->length); swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderQueryDithers(ClientPtr client) { return BadImplementation; } static int _X_COLD SProcRenderCreatePicture(ClientPtr client) { REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->drawable); swapl(&stuff->format); swapl(&stuff->mask); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderChangePicture(ClientPtr client) { REQUEST(xRenderChangePictureReq); REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); swaps(&stuff->length); swapl(&stuff->picture); swapl(&stuff->mask); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderSetPictureClipRectangles(ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); swaps(&stuff->length); swapl(&stuff->picture); swaps(&stuff->xOrigin); swaps(&stuff->yOrigin); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderFreePicture(ClientPtr client) { REQUEST(xRenderFreePictureReq); REQUEST_SIZE_MATCH(xRenderFreePictureReq); swaps(&stuff->length); swapl(&stuff->picture); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderComposite(ClientPtr client) { REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->mask); swapl(&stuff->dst); swaps(&stuff->xSrc); swaps(&stuff->ySrc); swaps(&stuff->xMask); swaps(&stuff->yMask); swaps(&stuff->xDst); swaps(&stuff->yDst); swaps(&stuff->width); swaps(&stuff->height); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderScale(ClientPtr client) { return BadImplementation; } static int _X_COLD SProcRenderTrapezoids(ClientPtr client) { REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->maskFormat); swaps(&stuff->xSrc); swaps(&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderTriangles(ClientPtr client) { REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->maskFormat); swaps(&stuff->xSrc); swaps(&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderTriStrip(ClientPtr client) { REQUEST(xRenderTriStripReq); REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->maskFormat); swaps(&stuff->xSrc); swaps(&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderTriFan(ClientPtr client) { REQUEST(xRenderTriFanReq); REQUEST_AT_LEAST_SIZE(xRenderTriFanReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->maskFormat); swaps(&stuff->xSrc); swaps(&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderColorTrapezoids(ClientPtr client) { return BadImplementation; } static int _X_COLD SProcRenderColorTriangles(ClientPtr client) { return BadImplementation; } static int _X_COLD SProcRenderTransform(ClientPtr client) { return BadImplementation; } static int _X_COLD SProcRenderCreateGlyphSet(ClientPtr client) { REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); swaps(&stuff->length); swapl(&stuff->gsid); swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderReferenceGlyphSet(ClientPtr client) { REQUEST(xRenderReferenceGlyphSetReq); REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); swaps(&stuff->length); swapl(&stuff->gsid); swapl(&stuff->existing); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderFreeGlyphSet(ClientPtr client) { REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); swaps(&stuff->length); swapl(&stuff->glyphset); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderAddGlyphs(ClientPtr client) { register int i; CARD32 *gids; void *end; xGlyphInfo *gi; REQUEST(xRenderAddGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); swaps(&stuff->length); swapl(&stuff->glyphset); swapl(&stuff->nglyphs); if (stuff->nglyphs & 0xe0000000) return BadLength; end = (CARD8 *) stuff + (client->req_len << 2); gids = (CARD32 *) (stuff + 1); gi = (xGlyphInfo *) (gids + stuff->nglyphs); if ((char *) end - (char *) (gids + stuff->nglyphs) < 0) return BadLength; if ((char *) end - (char *) (gi + stuff->nglyphs) < 0) return BadLength; for (i = 0; i < stuff->nglyphs; i++) { swapl(&gids[i]); swaps(&gi[i].width); swaps(&gi[i].height); swaps(&gi[i].x); swaps(&gi[i].y); swaps(&gi[i].xOff); swaps(&gi[i].yOff); } return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderAddGlyphsFromPicture(ClientPtr client) { return BadImplementation; } static int _X_COLD SProcRenderFreeGlyphs(ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); swaps(&stuff->length); swapl(&stuff->glyphset); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderCompositeGlyphs(ClientPtr client) { xGlyphElt *elt; CARD8 *buffer; CARD8 *end; int space; int i; int size; REQUEST(xRenderCompositeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); switch (stuff->renderReqType) { default: size = 1; break; case X_RenderCompositeGlyphs16: size = 2; break; case X_RenderCompositeGlyphs32: size = 4; break; } swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->maskFormat); swapl(&stuff->glyphset); swaps(&stuff->xSrc); swaps(&stuff->ySrc); buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); while (buffer + sizeof(xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof(xGlyphElt); swaps(&elt->deltax); swaps(&elt->deltay); i = elt->len; if (i == 0xff) { swapl((int *) buffer); buffer += 4; } else { space = size * i; switch (size) { case 1: buffer += i; break; case 2: while (i--) { swaps((short *) buffer); buffer += 2; } break; case 4: while (i--) { swapl((int *) buffer); buffer += 4; } break; } if (space & 3) buffer += 4 - (space & 3); } } return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderFillRectangles(ClientPtr client) { REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq); swaps(&stuff->length); swapl(&stuff->dst); swaps(&stuff->color.red); swaps(&stuff->color.green); swaps(&stuff->color.blue); swaps(&stuff->color.alpha); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderCreateCursor(ClientPtr client) { REQUEST(xRenderCreateCursorReq); REQUEST_SIZE_MATCH(xRenderCreateCursorReq); swaps(&stuff->length); swapl(&stuff->cid); swapl(&stuff->src); swaps(&stuff->x); swaps(&stuff->y); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderSetPictureTransform(ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); swaps(&stuff->length); swapl(&stuff->picture); swapl(&stuff->transform.matrix11); swapl(&stuff->transform.matrix12); swapl(&stuff->transform.matrix13); swapl(&stuff->transform.matrix21); swapl(&stuff->transform.matrix22); swapl(&stuff->transform.matrix23); swapl(&stuff->transform.matrix31); swapl(&stuff->transform.matrix32); swapl(&stuff->transform.matrix33); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderQueryFilters(ClientPtr client) { REQUEST(xRenderQueryFiltersReq); REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); swaps(&stuff->length); swapl(&stuff->drawable); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderSetPictureFilter(ClientPtr client) { REQUEST(xRenderSetPictureFilterReq); REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); swaps(&stuff->length); swapl(&stuff->picture); swaps(&stuff->nbytes); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderCreateAnimCursor(ClientPtr client) { REQUEST(xRenderCreateAnimCursorReq); REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq); swaps(&stuff->length); swapl(&stuff->cid); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderAddTraps(ClientPtr client) { REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); swaps(&stuff->length); swapl(&stuff->picture); swaps(&stuff->xOff); swaps(&stuff->yOff); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderCreateSolidFill(ClientPtr client) { REQUEST(xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq); swaps(&stuff->length); swapl(&stuff->pid); swaps(&stuff->color.alpha); swaps(&stuff->color.red); swaps(&stuff->color.green); swaps(&stuff->color.blue); return (*ProcRenderVector[stuff->renderReqType]) (client); } static void _X_COLD swapStops(void *stuff, int num) { int i; CARD32 *stops; CARD16 *colors; stops = (CARD32 *) (stuff); for (i = 0; i < num; ++i) { swapl(stops); ++stops; } colors = (CARD16 *) (stops); for (i = 0; i < 4 * num; ++i) { swaps(colors); ++colors; } } static int _X_COLD SProcRenderCreateLinearGradient(ClientPtr client) { int len; REQUEST(xRenderCreateLinearGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->p1.x); swapl(&stuff->p1.y); swapl(&stuff->p2.x); swapl(&stuff->p2.y); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff + 1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderCreateRadialGradient(ClientPtr client) { int len; REQUEST(xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->inner.x); swapl(&stuff->inner.y); swapl(&stuff->outer.x); swapl(&stuff->outer.y); swapl(&stuff->inner_radius); swapl(&stuff->outer_radius); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff + 1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderCreateConicalGradient(ClientPtr client) { int len; REQUEST(xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->center.x); swapl(&stuff->center.y); swapl(&stuff->angle); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff + 1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int _X_COLD SProcRenderDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data < RenderNumberRequests) return (*SProcRenderVector[stuff->data]) (client); else return BadRequest; } #ifdef PANORAMIX #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\ int rc = dixLookupResourceByType((void **)&(pPicture), pid,\ XRT_PICTURE, client, mode);\ if (rc != Success)\ return rc;\ } #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\ if (pid == None) \ pPicture = 0; \ else { \ VERIFY_XIN_PICTURE(pPicture, pid, client, mode); \ } \ } \ int (*PanoramiXSaveRenderVector[RenderNumberRequests]) (ClientPtr); static int PanoramiXRenderCreatePicture(ClientPtr client) { REQUEST(xRenderCreatePictureReq); PanoramiXRes *refDraw, *newPict; int result, j; REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; panoramix_setup_ids(newPict, client, stuff->pid); if (refDraw->type == XRT_WINDOW && stuff->drawable == screenInfo.screens[0]->root->drawable.id) { newPict->u.pict.root = TRUE; } else newPict->u.pict.root = FALSE; FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPict->info[j].id; stuff->drawable = refDraw->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client); if (result != Success) break; } if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else free(newPict); return result; } static int PanoramiXRenderChangePicture(ClientPtr client) { PanoramiXRes *pict; int result = Success, j; REQUEST(xRenderChangePictureReq); REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderChangePicture]) (client); if (result != Success) break; } return result; } static int PanoramiXRenderSetPictureClipRectangles(ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles]) (client); if (result != Success) break; } return result; } static int PanoramiXRenderSetPictureTransform(ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client); if (result != Success) break; } return result; } static int PanoramiXRenderSetPictureFilter(ClientPtr client) { REQUEST(xRenderSetPictureFilterReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client); if (result != Success) break; } return result; } static int PanoramiXRenderFreePicture(ClientPtr client) { PanoramiXRes *pict; int result = Success, j; REQUEST(xRenderFreePictureReq); REQUEST_SIZE_MATCH(xRenderFreePictureReq); client->errorValue = stuff->picture; VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client); if (result != Success) break; } /* Since ProcRenderFreePicture is using FreeResource, it will free our resource for us on the last pass through the loop above */ return result; } static int PanoramiXRenderComposite(ClientPtr client) { PanoramiXRes *src, *msk, *dst; int result = Success, j; xRenderCompositeReq orig; REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_ALPHA(msk, stuff->mask, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); orig = *stuff; FOR_NSCREENS_FORWARD(j) { stuff->src = src->info[j].id; if (src->u.pict.root) { stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x; stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y; } stuff->dst = dst->info[j].id; if (dst->u.pict.root) { stuff->xDst = orig.xDst - screenInfo.screens[j]->x; stuff->yDst = orig.yDst - screenInfo.screens[j]->y; } if (msk) { stuff->mask = msk->info[j].id; if (msk->u.pict.root) { stuff->xMask = orig.xMask - screenInfo.screens[j]->x; stuff->yMask = orig.yMask - screenInfo.screens[j]->y; } } result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client); if (result != Success) break; } return result; } static int PanoramiXRenderCompositeGlyphs(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderCompositeGlyphsReq); xGlyphElt origElt, *elt; INT16 xSrc, ySrc; REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); if (client->req_len << 2 >= (sizeof(xRenderCompositeGlyphsReq) + sizeof(xGlyphElt))) { elt = (xGlyphElt *) (stuff + 1); origElt = *elt; xSrc = stuff->xSrc; ySrc = stuff->ySrc; FOR_NSCREENS_FORWARD(j) { stuff->src = src->info[j].id; if (src->u.pict.root) { stuff->xSrc = xSrc - screenInfo.screens[j]->x; stuff->ySrc = ySrc - screenInfo.screens[j]->y; } stuff->dst = dst->info[j].id; if (dst->u.pict.root) { elt->deltax = origElt.deltax - screenInfo.screens[j]->x; elt->deltay = origElt.deltay - screenInfo.screens[j]->y; } result = (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client); if (result != Success) break; } } return result; } static int PanoramiXRenderFillRectangles(ClientPtr client) { PanoramiXRes *dst; int result = Success, j; REQUEST(xRenderFillRectanglesReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); extra_len = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq); if (extra_len && (extra = (char *) malloc(extra_len))) { memcpy(extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy(stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = screenInfo.screens[j]->x; int y_off = screenInfo.screens[j]->y; if (x_off || y_off) { xRectangle *rects = (xRectangle *) (stuff + 1); int i = extra_len / sizeof(xRectangle); while (i--) { rects->x -= x_off; rects->y -= y_off; rects++; } } } stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client); if (result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTrapezoids(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTrapezoidsReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); extra_len = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq); if (extra_len && (extra = (char *) malloc(extra_len))) { memcpy(extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy(stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = screenInfo.screens[j]->x; int y_off = screenInfo.screens[j]->y; if (x_off || y_off) { xTrapezoid *trap = (xTrapezoid *) (stuff + 1); int i = extra_len / sizeof(xTrapezoid); while (i--) { trap->top -= y_off; trap->bottom -= y_off; trap->left.p1.x -= x_off; trap->left.p1.y -= y_off; trap->left.p2.x -= x_off; trap->left.p2.y -= y_off; trap->right.p1.x -= x_off; trap->right.p1.y -= y_off; trap->right.p2.x -= x_off; trap->right.p2.y -= y_off; trap++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client); if (result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTriangles(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTrianglesReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); extra_len = (client->req_len << 2) - sizeof(xRenderTrianglesReq); if (extra_len && (extra = (char *) malloc(extra_len))) { memcpy(extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy(stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = screenInfo.screens[j]->x; int y_off = screenInfo.screens[j]->y; if (x_off || y_off) { xTriangle *tri = (xTriangle *) (stuff + 1); int i = extra_len / sizeof(xTriangle); while (i--) { tri->p1.x -= x_off; tri->p1.y -= y_off; tri->p2.x -= x_off; tri->p2.y -= y_off; tri->p3.x -= x_off; tri->p3.y -= y_off; tri++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client); if (result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTriStrip(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTriStripReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); extra_len = (client->req_len << 2) - sizeof(xRenderTriStripReq); if (extra_len && (extra = (char *) malloc(extra_len))) { memcpy(extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy(stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = screenInfo.screens[j]->x; int y_off = screenInfo.screens[j]->y; if (x_off || y_off) { xPointFixed *fixed = (xPointFixed *) (stuff + 1); int i = extra_len / sizeof(xPointFixed); while (i--) { fixed->x -= x_off; fixed->y -= y_off; fixed++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client); if (result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTriFan(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTriFanReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE(xRenderTriFanReq); VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); extra_len = (client->req_len << 2) - sizeof(xRenderTriFanReq); if (extra_len && (extra = (char *) malloc(extra_len))) { memcpy(extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy(stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = screenInfo.screens[j]->x; int y_off = screenInfo.screens[j]->y; if (x_off || y_off) { xPointFixed *fixed = (xPointFixed *) (stuff + 1); int i = extra_len / sizeof(xPointFixed); while (i--) { fixed->x -= x_off; fixed->y -= y_off; fixed++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client); if (result != Success) break; } free(extra); } return result; } static int PanoramiXRenderAddTraps(ClientPtr client) { PanoramiXRes *picture; int result = Success, j; REQUEST(xRenderAddTrapsReq); char *extra; int extra_len; INT16 x_off, y_off; REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); VERIFY_XIN_PICTURE(picture, stuff->picture, client, DixWriteAccess); extra_len = (client->req_len << 2) - sizeof(xRenderAddTrapsReq); if (extra_len && (extra = (char *) malloc(extra_len))) { memcpy(extra, stuff + 1, extra_len); x_off = stuff->xOff; y_off = stuff->yOff; FOR_NSCREENS_FORWARD(j) { if (j) memcpy(stuff + 1, extra, extra_len); stuff->picture = picture->info[j].id; if (picture->u.pict.root) { stuff->xOff = x_off + screenInfo.screens[j]->x; stuff->yOff = y_off + screenInfo.screens[j]->y; } result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client); if (result != Success) break; } free(extra); } return result; } static int PanoramiXRenderCreateSolidFill(ClientPtr client) { REQUEST(xRenderCreateSolidFillReq); PanoramiXRes *newPict; int result = Success, j; REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq); if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; panoramix_setup_ids(newPict, client, stuff->pid); newPict->u.pict.root = FALSE; FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client); if (result != Success) break; } if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else free(newPict); return result; } static int PanoramiXRenderCreateLinearGradient(ClientPtr client) { REQUEST(xRenderCreateLinearGradientReq); PanoramiXRes *newPict; int result = Success, j; REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq); if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; panoramix_setup_ids(newPict, client, stuff->pid); newPict->u.pict.root = FALSE; FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client); if (result != Success) break; } if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else free(newPict); return result; } static int PanoramiXRenderCreateRadialGradient(ClientPtr client) { REQUEST(xRenderCreateRadialGradientReq); PanoramiXRes *newPict; int result = Success, j; REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq); if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; panoramix_setup_ids(newPict, client, stuff->pid); newPict->u.pict.root = FALSE; FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client); if (result != Success) break; } if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else free(newPict); return result; } static int PanoramiXRenderCreateConicalGradient(ClientPtr client) { REQUEST(xRenderCreateConicalGradientReq); PanoramiXRes *newPict; int result = Success, j; REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; panoramix_setup_ids(newPict, client, stuff->pid); newPict->u.pict.root = FALSE; FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient]) (client); if (result != Success) break; } if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else free(newPict); return result; } void PanoramiXRenderInit(void) { int i; XRT_PICTURE = CreateNewResourceType(XineramaDeleteResource, "XineramaPicture"); if (RenderErrBase) SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture); for (i = 0; i < RenderNumberRequests; i++) PanoramiXSaveRenderVector[i] = ProcRenderVector[i]; /* * Stuff in Xinerama aware request processing hooks */ ProcRenderVector[X_RenderCreatePicture] = PanoramiXRenderCreatePicture; ProcRenderVector[X_RenderChangePicture] = PanoramiXRenderChangePicture; ProcRenderVector[X_RenderSetPictureTransform] = PanoramiXRenderSetPictureTransform; ProcRenderVector[X_RenderSetPictureFilter] = PanoramiXRenderSetPictureFilter; ProcRenderVector[X_RenderSetPictureClipRectangles] = PanoramiXRenderSetPictureClipRectangles; ProcRenderVector[X_RenderFreePicture] = PanoramiXRenderFreePicture; ProcRenderVector[X_RenderComposite] = PanoramiXRenderComposite; ProcRenderVector[X_RenderCompositeGlyphs8] = PanoramiXRenderCompositeGlyphs; ProcRenderVector[X_RenderCompositeGlyphs16] = PanoramiXRenderCompositeGlyphs; ProcRenderVector[X_RenderCompositeGlyphs32] = PanoramiXRenderCompositeGlyphs; ProcRenderVector[X_RenderFillRectangles] = PanoramiXRenderFillRectangles; ProcRenderVector[X_RenderTrapezoids] = PanoramiXRenderTrapezoids; ProcRenderVector[X_RenderTriangles] = PanoramiXRenderTriangles; ProcRenderVector[X_RenderTriStrip] = PanoramiXRenderTriStrip; ProcRenderVector[X_RenderTriFan] = PanoramiXRenderTriFan; ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps; ProcRenderVector[X_RenderCreateSolidFill] = PanoramiXRenderCreateSolidFill; ProcRenderVector[X_RenderCreateLinearGradient] = PanoramiXRenderCreateLinearGradient; ProcRenderVector[X_RenderCreateRadialGradient] = PanoramiXRenderCreateRadialGradient; ProcRenderVector[X_RenderCreateConicalGradient] = PanoramiXRenderCreateConicalGradient; } void PanoramiXRenderReset(void) { int i; for (i = 0; i < RenderNumberRequests; i++) ProcRenderVector[i] = PanoramiXSaveRenderVector[i]; RenderErrBase = 0; } #endif /* PANORAMIX */ xorg-server-1.20.8/render/glyphstr.h0000644000175000017500000000711213640201473014313 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifndef _GLYPHSTR_H_ #define _GLYPHSTR_H_ #include #include "picture.h" #include "screenint.h" #include "regionstr.h" #include "miscstruct.h" #include "privates.h" #define GlyphFormat1 0 #define GlyphFormat4 1 #define GlyphFormat8 2 #define GlyphFormat16 3 #define GlyphFormat32 4 #define GlyphFormatNum 5 typedef struct _Glyph { CARD32 refcnt; PrivateRec *devPrivates; unsigned char sha1[20]; CARD32 size; /* info + bitmap */ xGlyphInfo info; /* per-screen pixmaps follow */ } GlyphRec, *GlyphPtr; #define GlyphPicture(glyph) ((PicturePtr *) ((glyph) + 1)) typedef struct _GlyphRef { CARD32 signature; GlyphPtr glyph; } GlyphRefRec, *GlyphRefPtr; #define DeletedGlyph ((GlyphPtr) 1) typedef struct _GlyphHashSet { CARD32 entries; CARD32 size; CARD32 rehash; } GlyphHashSetRec, *GlyphHashSetPtr; typedef struct _GlyphHash { GlyphRefPtr table; GlyphHashSetPtr hashSet; CARD32 tableEntries; } GlyphHashRec, *GlyphHashPtr; typedef struct _GlyphSet { CARD32 refcnt; int fdepth; PictFormatPtr format; GlyphHashRec hash; PrivateRec *devPrivates; } GlyphSetRec, *GlyphSetPtr; #define GlyphSetGetPrivate(pGlyphSet,k) \ dixLookupPrivate(&(pGlyphSet)->devPrivates, k) #define GlyphSetSetPrivate(pGlyphSet,k,ptr) \ dixSetPrivate(&(pGlyphSet)->devPrivates, k, ptr) typedef struct _GlyphList { INT16 xOff; INT16 yOff; CARD8 len; PictFormatPtr format; } GlyphListRec, *GlyphListPtr; extern void GlyphUninit(ScreenPtr pScreen); extern GlyphPtr FindGlyphByHash(unsigned char sha1[20], int format); extern int HashGlyph(xGlyphInfo * gi, CARD8 *bits, unsigned long size, unsigned char sha1[20]); extern void AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id); extern Bool DeleteGlyph(GlyphSetPtr glyphSet, Glyph id); extern GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id); extern GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format); extern Bool ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change); extern GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format); extern int FreeGlyphSet(void *value, XID gid); #define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */ extern _X_EXPORT PicturePtr GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen); extern _X_EXPORT void SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture); #endif /* _GLYPHSTR_H_ */ xorg-server-1.20.8/render/glyph.c0000644000175000017500000004557113640201473013570 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xsha1.h" #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" #include "glyphstr.h" #include "mipict.h" /* * From Knuth -- a good choice for hash/rehash values is p, p-2 where * p and p-2 are both prime. These tables are sized to have an extra 10% * free to avoid exponential performance degradation as the hash table fills */ static GlyphHashSetRec glyphHashSets[] = { {32, 43, 41}, {64, 73, 71}, {128, 151, 149}, {256, 283, 281}, {512, 571, 569}, {1024, 1153, 1151}, {2048, 2269, 2267}, {4096, 4519, 4517}, {8192, 9013, 9011}, {16384, 18043, 18041}, {32768, 36109, 36107}, {65536, 72091, 72089}, {131072, 144409, 144407}, {262144, 288361, 288359}, {524288, 576883, 576881}, {1048576, 1153459, 1153457}, {2097152, 2307163, 2307161}, {4194304, 4613893, 4613891}, {8388608, 9227641, 9227639}, {16777216, 18455029, 18455027}, {33554432, 36911011, 36911009}, {67108864, 73819861, 73819859}, {134217728, 147639589, 147639587}, {268435456, 295279081, 295279079}, {536870912, 590559793, 590559791} }; #define NGLYPHHASHSETS ARRAY_SIZE(glyphHashSets) static GlyphHashRec globalGlyphs[GlyphFormatNum]; void GlyphUninit(ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); GlyphPtr glyph; int fdepth, i; for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) { if (!globalGlyphs[fdepth].hashSet) continue; for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) { glyph = globalGlyphs[fdepth].table[i].glyph; if (glyph && glyph != DeletedGlyph) { if (GetGlyphPicture(glyph, pScreen)) { FreePicture((void *) GetGlyphPicture(glyph, pScreen), 0); SetGlyphPicture(glyph, pScreen, NULL); } (*ps->UnrealizeGlyph) (pScreen, glyph); } } } } static GlyphHashSetPtr FindGlyphHashSet(CARD32 filled) { int i; for (i = 0; i < NGLYPHHASHSETS; i++) if (glyphHashSets[i].entries >= filled) return &glyphHashSets[i]; return 0; } static GlyphRefPtr FindGlyphRef(GlyphHashPtr hash, CARD32 signature, Bool match, unsigned char sha1[20]) { CARD32 elt, step, s; GlyphPtr glyph; GlyphRefPtr table, gr, del; CARD32 tableSize = hash->hashSet->size; table = hash->table; elt = signature % tableSize; step = 0; del = 0; for (;;) { gr = &table[elt]; s = gr->signature; glyph = gr->glyph; if (!glyph) { if (del) gr = del; break; } if (glyph == DeletedGlyph) { if (!del) del = gr; else if (gr == del) break; } else if (s == signature && (!match || memcmp(glyph->sha1, sha1, 20) == 0)) { break; } if (!step) { step = signature % hash->hashSet->rehash; if (!step) step = 1; } elt += step; if (elt >= tableSize) elt -= tableSize; } return gr; } int HashGlyph(xGlyphInfo * gi, CARD8 *bits, unsigned long size, unsigned char sha1[20]) { void *ctx = x_sha1_init(); int success; if (!ctx) return BadAlloc; success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo)); if (!success) return BadAlloc; success = x_sha1_update(ctx, bits, size); if (!success) return BadAlloc; success = x_sha1_final(ctx, sha1); if (!success) return BadAlloc; return Success; } GlyphPtr FindGlyphByHash(unsigned char sha1[20], int format) { GlyphRefPtr gr; CARD32 signature = *(CARD32 *) sha1; if (!globalGlyphs[format].hashSet) return NULL; gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, sha1); if (gr->glyph && gr->glyph != DeletedGlyph) return gr->glyph; else return NULL; } #ifdef CHECK_DUPLICATES void DuplicateRef(GlyphPtr glyph, char *where) { ErrorF("Duplicate Glyph 0x%x from %s\n", glyph, where); } void CheckDuplicates(GlyphHashPtr hash, char *where) { GlyphPtr g; int i, j; for (i = 0; i < hash->hashSet->size; i++) { g = hash->table[i].glyph; if (!g || g == DeletedGlyph) continue; for (j = i + 1; j < hash->hashSet->size; j++) if (hash->table[j].glyph == g) DuplicateRef(g, where); } } #else #define CheckDuplicates(a,b) #define DuplicateRef(a,b) #endif static void FreeGlyphPicture(GlyphPtr glyph) { PictureScreenPtr ps; int i; for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; if (GetGlyphPicture(glyph, pScreen)) FreePicture((void *) GetGlyphPicture(glyph, pScreen), 0); ps = GetPictureScreenIfSet(pScreen); if (ps) (*ps->UnrealizeGlyph) (pScreen, glyph); } } static void FreeGlyph(GlyphPtr glyph, int format) { CheckDuplicates(&globalGlyphs[format], "FreeGlyph"); if (--glyph->refcnt == 0) { GlyphRefPtr gr; int i; int first; CARD32 signature; first = -1; for (i = 0; i < globalGlyphs[format].hashSet->size; i++) if (globalGlyphs[format].table[i].glyph == glyph) { if (first != -1) DuplicateRef(glyph, "FreeGlyph check"); first = i; } signature = *(CARD32 *) glyph->sha1; gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, glyph->sha1); if (gr - globalGlyphs[format].table != first) DuplicateRef(glyph, "Found wrong one"); if (gr->glyph && gr->glyph != DeletedGlyph) { gr->glyph = DeletedGlyph; gr->signature = 0; globalGlyphs[format].tableEntries--; } FreeGlyphPicture(glyph); dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH); } } void AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) { GlyphRefPtr gr; CARD32 signature; CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph top global"); /* Locate existing matching glyph */ signature = *(CARD32 *) glyph->sha1; gr = FindGlyphRef(&globalGlyphs[glyphSet->fdepth], signature, TRUE, glyph->sha1); if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) { FreeGlyphPicture(glyph); dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH); glyph = gr->glyph; } else if (gr->glyph != glyph) { gr->glyph = glyph; gr->signature = signature; globalGlyphs[glyphSet->fdepth].tableEntries++; } /* Insert/replace glyphset value */ gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0); ++glyph->refcnt; if (gr->glyph && gr->glyph != DeletedGlyph) FreeGlyph(gr->glyph, glyphSet->fdepth); else glyphSet->hash.tableEntries++; gr->glyph = glyph; gr->signature = id; CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom"); } Bool DeleteGlyph(GlyphSetPtr glyphSet, Glyph id) { GlyphRefPtr gr; GlyphPtr glyph; gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0); glyph = gr->glyph; if (glyph && glyph != DeletedGlyph) { gr->glyph = DeletedGlyph; glyphSet->hash.tableEntries--; FreeGlyph(glyph, glyphSet->fdepth); return TRUE; } return FALSE; } GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id) { GlyphPtr glyph; glyph = FindGlyphRef(&glyphSet->hash, id, FALSE, 0)->glyph; if (glyph == DeletedGlyph) glyph = 0; return glyph; } GlyphPtr AllocateGlyph(xGlyphInfo * gi, int fdepth) { PictureScreenPtr ps; int size; GlyphPtr glyph; int i; int head_size; head_size = sizeof(GlyphRec) + screenInfo.numScreens * sizeof(PicturePtr); size = (head_size + dixPrivatesSize(PRIVATE_GLYPH)); glyph = (GlyphPtr) malloc(size); if (!glyph) return 0; glyph->refcnt = 0; glyph->size = size + sizeof(xGlyphInfo); glyph->info = *gi; dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH); for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; SetGlyphPicture(glyph, pScreen, NULL); ps = GetPictureScreenIfSet(pScreen); if (ps) { if (!(*ps->RealizeGlyph) (pScreen, glyph)) goto bail; } } return glyph; bail: while (i--) { ps = GetPictureScreenIfSet(screenInfo.screens[i]); if (ps) (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); } dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH); return 0; } static Bool AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet) { hash->table = calloc(hashSet->size, sizeof(GlyphRefRec)); if (!hash->table) return FALSE; hash->hashSet = hashSet; hash->tableEntries = 0; return TRUE; } static Bool ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global) { CARD32 tableEntries; GlyphHashSetPtr hashSet; GlyphHashRec newHash; GlyphRefPtr gr; GlyphPtr glyph; int i; int oldSize; CARD32 s; tableEntries = hash->tableEntries + change; hashSet = FindGlyphHashSet(tableEntries); if (hashSet == hash->hashSet) return TRUE; if (global) CheckDuplicates(hash, "ResizeGlyphHash top"); if (!AllocateGlyphHash(&newHash, hashSet)) return FALSE; if (hash->table) { oldSize = hash->hashSet->size; for (i = 0; i < oldSize; i++) { glyph = hash->table[i].glyph; if (glyph && glyph != DeletedGlyph) { s = hash->table[i].signature; gr = FindGlyphRef(&newHash, s, global, glyph->sha1); gr->signature = s; gr->glyph = glyph; ++newHash.tableEntries; } } free(hash->table); } *hash = newHash; if (global) CheckDuplicates(hash, "ResizeGlyphHash bottom"); return TRUE; } Bool ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change) { return (ResizeGlyphHash(&glyphSet->hash, change, FALSE) && ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], change, TRUE)); } GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format) { GlyphSetPtr glyphSet; if (!globalGlyphs[fdepth].hashSet) { if (!AllocateGlyphHash(&globalGlyphs[fdepth], &glyphHashSets[0])) return FALSE; } glyphSet = dixAllocateObjectWithPrivates(GlyphSetRec, PRIVATE_GLYPHSET); if (!glyphSet) return FALSE; if (!AllocateGlyphHash(&glyphSet->hash, &glyphHashSets[0])) { free(glyphSet); return FALSE; } glyphSet->refcnt = 1; glyphSet->fdepth = fdepth; glyphSet->format = format; return glyphSet; } int FreeGlyphSet(void *value, XID gid) { GlyphSetPtr glyphSet = (GlyphSetPtr) value; if (--glyphSet->refcnt == 0) { CARD32 i, tableSize = glyphSet->hash.hashSet->size; GlyphRefPtr table = glyphSet->hash.table; GlyphPtr glyph; for (i = 0; i < tableSize; i++) { glyph = table[i].glyph; if (glyph && glyph != DeletedGlyph) FreeGlyph(glyph, glyphSet->fdepth); } if (!globalGlyphs[glyphSet->fdepth].tableEntries) { free(globalGlyphs[glyphSet->fdepth].table); globalGlyphs[glyphSet->fdepth].table = 0; globalGlyphs[glyphSet->fdepth].hashSet = 0; } else ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], 0, TRUE); free(table); dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET); } return Success; } static void GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents) { int x1, x2, y1, y2; int n; GlyphPtr glyph; int x, y; x = 0; y = 0; extents->x1 = MAXSHORT; extents->x2 = MINSHORT; extents->y1 = MAXSHORT; extents->y2 = MINSHORT; while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; list++; while (n--) { glyph = *glyphs++; x1 = x - glyph->info.x; if (x1 < MINSHORT) x1 = MINSHORT; y1 = y - glyph->info.y; if (y1 < MINSHORT) y1 = MINSHORT; x2 = x1 + glyph->info.width; if (x2 > MAXSHORT) x2 = MAXSHORT; y2 = y1 + glyph->info.height; if (y2 > MAXSHORT) y2 = MAXSHORT; if (x1 < extents->x1) extents->x1 = x1; if (x2 > extents->x2) extents->x2 = x2; if (y1 < extents->y1) extents->y1 = y1; if (y2 > extents->y2) extents->y2 = y2; x += glyph->info.xOff; y += glyph->info.yOff; } } } #define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) void CompositeGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture(pSrc); ValidatePicture(pDst); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs); } Bool miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph) { return TRUE; } void miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph) { } void miGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) { PicturePtr pPicture; PixmapPtr pMaskPixmap = 0; PicturePtr pMask; ScreenPtr pScreen = pDst->pDrawable->pScreen; int width = 0, height = 0; int x, y; int xDst = list->xOff, yDst = list->yOff; int n; GlyphPtr glyph; int error; BoxRec extents = { 0, 0, 0, 0 }; CARD32 component_alpha; if (maskFormat) { GCPtr pGC; xRectangle rect; GlyphExtents(nlist, list, glyphs, &extents); if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) return; width = extents.x2 - extents.x1; height = extents.y2 - extents.y1; pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pMaskPixmap) return; component_alpha = NeedsComponent(maskFormat->format); pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pMask) { (*pScreen->DestroyPixmap) (pMaskPixmap); return; } pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen); ValidateGC(&pMaskPixmap->drawable, pGC); rect.x = 0; rect.y = 0; rect.width = width; rect.height = height; (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect); FreeScratchGC(pGC); x = -extents.x1; y = -extents.y1; } else { pMask = pDst; x = 0; y = 0; } while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; while (n--) { glyph = *glyphs++; pPicture = GetGlyphPicture(glyph, pScreen); if (pPicture) { if (maskFormat) { CompositePicture(PictOpAdd, pPicture, None, pMask, 0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.width, glyph->info.height); } else { CompositePicture(op, pSrc, pPicture, pDst, xSrc + (x - glyph->info.x) - xDst, ySrc + (y - glyph->info.y) - yDst, 0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.width, glyph->info.height); } } x += glyph->info.xOff; y += glyph->info.yOff; } list++; } if (maskFormat) { x = extents.x1; y = extents.y1; CompositePicture(op, pSrc, pMask, pDst, xSrc + x - xDst, ySrc + y - yDst, 0, 0, x, y, width, height); FreePicture((void *) pMask, (XID) 0); (*pScreen->DestroyPixmap) (pMaskPixmap); } } PicturePtr GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen) { if (pScreen->isGPU) return NULL; return GlyphPicture(glyph)[pScreen->myNum]; } void SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture) { GlyphPicture(glyph)[pScreen->myNum] = picture; } xorg-server-1.20.8/render/filter.c0000644000175000017500000002350213640201473013720 00000000000000/* * Copyright © 2002 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" static char **filterNames; static int nfilterNames; /* * standard but not required filters don't have constant indices */ int PictureGetFilterId(const char *filter, int len, Bool makeit) { int i; char *name; char **names; if (len < 0) len = strlen(filter); for (i = 0; i < nfilterNames; i++) if (!CompareISOLatin1Lowered((const unsigned char *) filterNames[i], -1, (const unsigned char *) filter, len)) return i; if (!makeit) return -1; name = malloc(len + 1); if (!name) return -1; memcpy(name, filter, len); name[len] = '\0'; if (filterNames) names = reallocarray(filterNames, nfilterNames + 1, sizeof(char *)); else names = malloc(sizeof(char *)); if (!names) { free(name); return -1; } filterNames = names; i = nfilterNames++; filterNames[i] = name; return i; } static Bool PictureSetDefaultIds(void) { /* careful here -- this list must match the #define values */ if (PictureGetFilterId(FilterNearest, -1, TRUE) != PictFilterNearest) return FALSE; if (PictureGetFilterId(FilterBilinear, -1, TRUE) != PictFilterBilinear) return FALSE; if (PictureGetFilterId(FilterFast, -1, TRUE) != PictFilterFast) return FALSE; if (PictureGetFilterId(FilterGood, -1, TRUE) != PictFilterGood) return FALSE; if (PictureGetFilterId(FilterBest, -1, TRUE) != PictFilterBest) return FALSE; if (PictureGetFilterId(FilterConvolution, -1, TRUE) != PictFilterConvolution) return FALSE; return TRUE; } char * PictureGetFilterName(int id) { if (0 <= id && id < nfilterNames) return filterNames[id]; else return 0; } static void PictureFreeFilterIds(void) { int i; for (i = 0; i < nfilterNames; i++) free(filterNames[i]); free(filterNames); nfilterNames = 0; filterNames = 0; } int PictureAddFilter(ScreenPtr pScreen, const char *filter, PictFilterValidateParamsProcPtr ValidateParams, int width, int height) { PictureScreenPtr ps = GetPictureScreen(pScreen); int id = PictureGetFilterId(filter, -1, TRUE); int i; PictFilterPtr filters; if (id < 0) return -1; /* * It's an error to attempt to reregister a filter */ for (i = 0; i < ps->nfilters; i++) if (ps->filters[i].id == id) return -1; if (ps->filters) filters = reallocarray(ps->filters, ps->nfilters + 1, sizeof(PictFilterRec)); else filters = malloc(sizeof(PictFilterRec)); if (!filters) return -1; ps->filters = filters; i = ps->nfilters++; ps->filters[i].name = PictureGetFilterName(id); ps->filters[i].id = id; ps->filters[i].ValidateParams = ValidateParams; ps->filters[i].width = width; ps->filters[i].height = height; return id; } Bool PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias) { PictureScreenPtr ps = GetPictureScreen(pScreen); int filter_id = PictureGetFilterId(filter, -1, FALSE); int alias_id = PictureGetFilterId(alias, -1, TRUE); int i; if (filter_id < 0 || alias_id < 0) return FALSE; for (i = 0; i < ps->nfilterAliases; i++) if (ps->filterAliases[i].alias_id == alias_id) break; if (i == ps->nfilterAliases) { PictFilterAliasPtr aliases; if (ps->filterAliases) aliases = reallocarray(ps->filterAliases, ps->nfilterAliases + 1, sizeof(PictFilterAliasRec)); else aliases = malloc(sizeof(PictFilterAliasRec)); if (!aliases) return FALSE; ps->filterAliases = aliases; ps->filterAliases[i].alias = PictureGetFilterName(alias_id); ps->filterAliases[i].alias_id = alias_id; ps->nfilterAliases++; } ps->filterAliases[i].filter_id = filter_id; return TRUE; } PictFilterPtr PictureFindFilter(ScreenPtr pScreen, char *name, int len) { PictureScreenPtr ps = GetPictureScreen(pScreen); int id = PictureGetFilterId(name, len, FALSE); int i; if (id < 0) return 0; /* Check for an alias, allow them to recurse */ for (i = 0; i < ps->nfilterAliases; i++) if (ps->filterAliases[i].alias_id == id) { id = ps->filterAliases[i].filter_id; i = 0; } /* find the filter */ for (i = 0; i < ps->nfilters; i++) if (ps->filters[i].id == id) return &ps->filters[i]; return 0; } static Bool convolutionFilterValidateParams(ScreenPtr pScreen, int filter, xFixed * params, int nparams, int *width, int *height) { int w, h; if (nparams < 3) return FALSE; if (xFixedFrac(params[0]) || xFixedFrac(params[1])) return FALSE; w = xFixedToInt(params[0]); h = xFixedToInt(params[1]); nparams -= 2; if (w * h > nparams) return FALSE; *width = w; *height = h; return TRUE; } Bool PictureSetDefaultFilters(ScreenPtr pScreen) { if (!filterNames) if (!PictureSetDefaultIds()) return FALSE; if (PictureAddFilter(pScreen, FilterNearest, 0, 1, 1) < 0) return FALSE; if (PictureAddFilter(pScreen, FilterBilinear, 0, 2, 2) < 0) return FALSE; if (!PictureSetFilterAlias(pScreen, FilterNearest, FilterFast)) return FALSE; if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterGood)) return FALSE; if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterBest)) return FALSE; if (PictureAddFilter (pScreen, FilterConvolution, convolutionFilterValidateParams, 0, 0) < 0) return FALSE; return TRUE; } void PictureResetFilters(ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); free(ps->filters); free(ps->filterAliases); /* Free the filters when the last screen is closed */ if (pScreen->myNum == 0) PictureFreeFilterIds(); } int SetPictureFilter(PicturePtr pPicture, char *name, int len, xFixed * params, int nparams) { PictFilterPtr pFilter; ScreenPtr pScreen; if (pPicture->pDrawable != NULL) pScreen = pPicture->pDrawable->pScreen; else pScreen = screenInfo.screens[0]; pFilter = PictureFindFilter(pScreen, name, len); if (!pFilter) return BadName; if (pPicture->pDrawable == NULL) { int s; /* For source pictures, the picture isn't tied to a screen. So, ensure * that all screens can handle a filter we set for the picture. */ for (s = 1; s < screenInfo.numScreens; s++) { PictFilterPtr pScreenFilter; pScreenFilter = PictureFindFilter(screenInfo.screens[s], name, len); if (!pScreenFilter || pScreenFilter->id != pFilter->id) return BadMatch; } } return SetPicturePictFilter(pPicture, pFilter, params, nparams); } int SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter, xFixed * params, int nparams) { ScreenPtr pScreen; int i; if (pPicture->pDrawable) pScreen = pPicture->pDrawable->pScreen; else pScreen = screenInfo.screens[0]; if (pFilter->ValidateParams) { int width, height; if (!(*pFilter->ValidateParams) (pScreen, pFilter->id, params, nparams, &width, &height)) return BadMatch; } else if (nparams) return BadMatch; if (nparams != pPicture->filter_nparams) { xFixed *new_params = xallocarray(nparams, sizeof(xFixed)); if (!new_params && nparams) return BadAlloc; free(pPicture->filter_params); pPicture->filter_params = new_params; pPicture->filter_nparams = nparams; } for (i = 0; i < nparams; i++) pPicture->filter_params[i] = params[i]; pPicture->filter = pFilter->id; if (pPicture->pDrawable) { PictureScreenPtr ps = GetPictureScreen(pScreen); int result; result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter, params, nparams); return result; } return Success; } xorg-server-1.20.8/render/picture.h0000644000175000017500000001642213640201473014116 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifndef _PICTURE_H_ #define _PICTURE_H_ #include "privates.h" #include typedef struct _DirectFormat *DirectFormatPtr; typedef struct _PictFormat *PictFormatPtr; typedef struct _Picture *PicturePtr; /* * While the protocol is generous in format support, the * sample implementation allows only packed RGB and GBR * representations for data to simplify software rendering, */ #define PICT_FORMAT(bpp,type,a,r,g,b) PIXMAN_FORMAT(bpp, type, a, r, g, b) /* * gray/color formats use a visual index instead of argb */ #define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | \ ((type) << 16) | \ ((vi))) #define PICT_FORMAT_BPP(f) PIXMAN_FORMAT_BPP(f) #define PICT_FORMAT_TYPE(f) PIXMAN_FORMAT_TYPE(f) #define PICT_FORMAT_A(f) PIXMAN_FORMAT_A(f) #define PICT_FORMAT_R(f) PIXMAN_FORMAT_R(f) #define PICT_FORMAT_G(f) PIXMAN_FORMAT_G(f) #define PICT_FORMAT_B(f) PIXMAN_FORMAT_B(f) #define PICT_FORMAT_RGB(f) PIXMAN_FORMAT_RGB(f) #define PICT_FORMAT_VIS(f) PIXMAN_FORMAT_VIS(f) #define PICT_TYPE_OTHER PIXMAN_TYPE_OTHER #define PICT_TYPE_A PIXMAN_TYPE_A #define PICT_TYPE_ARGB PIXMAN_TYPE_ARGB #define PICT_TYPE_ABGR PIXMAN_TYPE_ABGR #define PICT_TYPE_COLOR PIXMAN_TYPE_COLOR #define PICT_TYPE_GRAY PIXMAN_TYPE_GRAY #define PICT_TYPE_BGRA PIXMAN_TYPE_BGRA #define PICT_FORMAT_COLOR(f) PIXMAN_FORMAT_COLOR(f) /* 32bpp formats */ typedef enum _PictFormatShort { PICT_a2r10g10b10 = PIXMAN_a2r10g10b10, PICT_x2r10g10b10 = PIXMAN_x2r10g10b10, PICT_a2b10g10r10 = PIXMAN_a2b10g10r10, PICT_x2b10g10r10 = PIXMAN_x2b10g10r10, PICT_a8r8g8b8 = PIXMAN_a8r8g8b8, PICT_x8r8g8b8 = PIXMAN_x8r8g8b8, PICT_a8b8g8r8 = PIXMAN_a8b8g8r8, PICT_x8b8g8r8 = PIXMAN_x8b8g8r8, PICT_b8g8r8a8 = PIXMAN_b8g8r8a8, PICT_b8g8r8x8 = PIXMAN_b8g8r8x8, /* 24bpp formats */ PICT_r8g8b8 = PIXMAN_r8g8b8, PICT_b8g8r8 = PIXMAN_b8g8r8, /* 16bpp formats */ PICT_r5g6b5 = PIXMAN_r5g6b5, PICT_b5g6r5 = PIXMAN_b5g6r5, PICT_a1r5g5b5 = PIXMAN_a1r5g5b5, PICT_x1r5g5b5 = PIXMAN_x1r5g5b5, PICT_a1b5g5r5 = PIXMAN_a1b5g5r5, PICT_x1b5g5r5 = PIXMAN_x1b5g5r5, PICT_a4r4g4b4 = PIXMAN_a4r4g4b4, PICT_x4r4g4b4 = PIXMAN_x4r4g4b4, PICT_a4b4g4r4 = PIXMAN_a4b4g4r4, PICT_x4b4g4r4 = PIXMAN_x4b4g4r4, /* 8bpp formats */ PICT_a8 = PIXMAN_a8, PICT_r3g3b2 = PIXMAN_r3g3b2, PICT_b2g3r3 = PIXMAN_b2g3r3, PICT_a2r2g2b2 = PIXMAN_a2r2g2b2, PICT_a2b2g2r2 = PIXMAN_a2b2g2r2, PICT_c8 = PIXMAN_c8, PICT_g8 = PIXMAN_g8, PICT_x4a4 = PIXMAN_x4a4, PICT_x4c4 = PIXMAN_x4c4, PICT_x4g4 = PIXMAN_x4g4, /* 4bpp formats */ PICT_a4 = PIXMAN_a4, PICT_r1g2b1 = PIXMAN_r1g2b1, PICT_b1g2r1 = PIXMAN_b1g2r1, PICT_a1r1g1b1 = PIXMAN_a1r1g1b1, PICT_a1b1g1r1 = PIXMAN_a1b1g1r1, PICT_c4 = PIXMAN_c4, PICT_g4 = PIXMAN_g4, /* 1bpp formats */ PICT_a1 = PIXMAN_a1, PICT_g1 = PIXMAN_g1 } PictFormatShort; /* * For dynamic indexed visuals (GrayScale and PseudoColor), these control the * selection of colors allocated for drawing to Pictures. The default * policy depends on the size of the colormap: * * Size Default Policy * ---------------------------- * < 64 PolicyMono * < 256 PolicyGray * 256 PolicyColor (only on PseudoColor) * * The actual allocation code lives in miindex.c, and so is * austensibly server dependent, but that code does: * * PolicyMono Allocate no additional colors, use black and white * PolicyGray Allocate 13 gray levels (11 cells used) * PolicyColor Allocate a 4x4x4 cube and 13 gray levels (71 cells used) * PolicyAll Allocate as big a cube as possible, fill with gray (all) * * Here's a picture to help understand how many colors are * actually allocated (this is just the gray ramp): * * gray level * all 0000 1555 2aaa 4000 5555 6aaa 8000 9555 aaaa bfff d555 eaaa ffff * b/w 0000 ffff * 4x4x4 5555 aaaa * extra 1555 2aaa 4000 6aaa 8000 9555 bfff d555 eaaa * * The default colormap supplies two gray levels (black/white), the * 4x4x4 cube allocates another two and nine more are allocated to fill * in the 13 levels. When the 4x4x4 cube is not allocated, a total of * 11 cells are allocated. */ #define PictureCmapPolicyInvalid -1 #define PictureCmapPolicyDefault 0 #define PictureCmapPolicyMono 1 #define PictureCmapPolicyGray 2 #define PictureCmapPolicyColor 3 #define PictureCmapPolicyAll 4 extern int PictureCmapPolicy; extern int PictureParseCmapPolicy(const char *name); extern int RenderErrBase; /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */ typedef pixman_fixed_32_32_t xFixed_32_32; typedef pixman_fixed_48_16_t xFixed_48_16; #define MAX_FIXED_48_16 pixman_max_fixed_48_16 #define MIN_FIXED_48_16 pixman_min_fixed_48_16 typedef pixman_fixed_1_31_t xFixed_1_31; typedef pixman_fixed_1_16_t xFixed_1_16; typedef pixman_fixed_16_16_t xFixed_16_16; /* * An unadorned "xFixed" is the same as xFixed_16_16, * (since it's quite common in the code) */ typedef pixman_fixed_t xFixed; #define XFIXED_BITS 16 #define xFixedToInt(f) pixman_fixed_to_int(f) #define IntToxFixed(i) pixman_int_to_fixed(i) #define xFixedE pixman_fixed_e #define xFixed1 pixman_fixed_1 #define xFixed1MinusE pixman_fixed_1_minus_e #define xFixedFrac(f) pixman_fixed_frac(f) #define xFixedFloor(f) pixman_fixed_floor(f) #define xFixedCeil(f) pixman_fixed_ceil(f) #define xFixedFraction(f) pixman_fixed_fraction(f) #define xFixedMod2(f) pixman_fixed_mod2(f) /* whether 't' is a well defined not obviously empty trapezoid */ #define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \ (t)->right.p1.y != (t)->right.p2.y && \ ((t)->bottom > (t)->top)) /* * Standard NTSC luminance conversions: * * y = r * 0.299 + g * 0.587 + b * 0.114 * * Approximate this for a bit more speed: * * y = (r * 153 + g * 301 + b * 58) / 512 * * This gives 17 bits of luminance; to get 15 bits, lop the low two */ #define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \ (((s) >> 8) & 0xff) * 301 + \ (((s) ) & 0xff) * 58) >> 2) #endif /* _PICTURE_H_ */ xorg-server-1.20.8/render/meson.build0000644000175000017500000000073113640201473014430 00000000000000srcs_render = [ 'animcur.c', 'filter.c', 'glyph.c', 'matrix.c', 'miindex.c', 'mipict.c', 'mirect.c', 'mitrap.c', 'mitri.c', 'picture.c', 'render.c', ] hdrs_render = [ 'glyphstr.h', 'mipict.h', 'picture.h', 'picturestr.h', ] libxserver_render = static_library('libxserver_render', srcs_render, include_directories: inc, dependencies: common_dep, ) install_data(hdrs_render, install_dir: xorgsdkdir) xorg-server-1.20.8/ltmain.sh0000644000175000017500000117416513640201501012635 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-10-04.22; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote ARG # -------------- # Aesthetically quote one ARG, store the result into $func_quote_result. Note # that we keep attention to performance here (so far O(N) complexity as long as # func_append is O(1)). func_quote () { $debug_cmd func_quote_result=$1 case $func_quote_result in *[\\\`\"\$]*) case $func_quote_result in *[\[\*\?]*) func_quote_result=`$ECHO "$func_quote_result" | $SED "$sed_quote_subst"` return 0 ;; esac func_quote_old_IFS=$IFS for _G_char in '\' '`' '"' '$' do # STATE($1) PREV($2) SEPARATOR($3) set start "" "" func_quote_result=dummy"$_G_char$func_quote_result$_G_char"dummy IFS=$_G_char for _G_part in $func_quote_result do case $1 in quote) func_append func_quote_result "$3$2" set quote "$_G_part" "\\$_G_char" ;; start) set first "" "" func_quote_result= ;; first) set quote "$_G_part" "" ;; esac done IFS=$func_quote_old_IFS done ;; *) ;; esac } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do func_quote "$1" _G_unquoted_arg=$func_quote_result if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" func_quote "$ECHO" qECHO=$func_quote_result $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac # As we are forced to pass -nostdlib to g++ during linking, the option # -pthread{,s} is not in effect; add the -lpthread to $deplist # explicitly to link correctly. if test "$tagname" = CXX -a x"$with_gcc" = xyes; then case "$arg" in -pthread*) func_append deplibs " -lpthread" ;; esac fi continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*|-fuse-ld=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done func_quote "(cd `pwd`; $relink_command)" relink_command=$func_quote_result fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" func_quote "$relink_command" relink_command=$func_quote_result if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: xorg-server-1.20.8/damageext/0000755000175000017500000000000013640201533013022 500000000000000xorg-server-1.20.8/damageext/Makefile.am0000644000175000017500000000017613640201473015005 00000000000000noinst_LTLIBRARIES = libdamageext.la AM_CFLAGS = $(DIX_CFLAGS) libdamageext_la_SOURCES = \ damageext.c \ damageextint.h xorg-server-1.20.8/damageext/damageext.c0000644000175000017500000005131113640201473015051 00000000000000/* * Copyright © 2002 Keith Packard * Copyright 2013 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "damageextint.h" #include "damagestr.h" #include "protocol-versions.h" #include "extinit.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" typedef struct { DamageExtPtr ext; DamagePtr damage[MAXSCREENS]; } PanoramiXDamageRes; static RESTYPE XRT_DAMAGE; static int (*PanoramiXSaveDamageCreate) (ClientPtr); #endif static unsigned char DamageReqCode; static int DamageEventBase; static RESTYPE DamageExtType; static DevPrivateKeyRec DamageClientPrivateKeyRec; #define DamageClientPrivateKey (&DamageClientPrivateKeyRec) static void DamageNoteCritical(ClientPtr pClient) { DamageClientPtr pDamageClient = GetDamageClient(pClient); /* Composite extension marks clients with manual Subwindows as critical */ if (pDamageClient->critical > 0) { SetCriticalOutputPending(); pClient->smart_priority = SMART_MAX_PRIORITY; } } static void damageGetGeometry(DrawablePtr draw, int *x, int *y, int *w, int *h) { #ifdef PANORAMIX if (!noPanoramiXExtension && draw->type == DRAWABLE_WINDOW) { WindowPtr win = (WindowPtr)draw; if (!win->parent) { *x = screenInfo.x; *y = screenInfo.y; *w = screenInfo.width; *h = screenInfo.height; return; } } #endif *x = draw->x; *y = draw->y; *w = draw->width; *h = draw->height; } static void DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) { ClientPtr pClient = pDamageExt->pClient; DrawablePtr pDrawable = pDamageExt->pDrawable; xDamageNotifyEvent ev; int i, x, y, w, h; damageGetGeometry(pDrawable, &x, &y, &w, &h); UpdateCurrentTimeIf(); ev = (xDamageNotifyEvent) { .type = DamageEventBase + XDamageNotify, .level = pDamageExt->level, .drawable = pDamageExt->drawable, .damage = pDamageExt->id, .timestamp = currentTime.milliseconds, .geometry.x = x, .geometry.y = y, .geometry.width = w, .geometry.height = h }; if (pBoxes) { for (i = 0; i < nBoxes; i++) { ev.level = pDamageExt->level; if (i < nBoxes - 1) ev.level |= DamageNotifyMore; ev.area.x = pBoxes[i].x1; ev.area.y = pBoxes[i].y1; ev.area.width = pBoxes[i].x2 - pBoxes[i].x1; ev.area.height = pBoxes[i].y2 - pBoxes[i].y1; WriteEventsToClient(pClient, 1, (xEvent *) &ev); } } else { ev.area.x = 0; ev.area.y = 0; ev.area.width = w; ev.area.height = h; WriteEventsToClient(pClient, 1, (xEvent *) &ev); } DamageNoteCritical(pClient); } static void DamageExtReport(DamagePtr pDamage, RegionPtr pRegion, void *closure) { DamageExtPtr pDamageExt = closure; switch (pDamageExt->level) { case DamageReportRawRegion: case DamageReportDeltaRegion: DamageExtNotify(pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion)); break; case DamageReportBoundingBox: DamageExtNotify(pDamageExt, RegionExtents(pRegion), 1); break; case DamageReportNonEmpty: DamageExtNotify(pDamageExt, NullBox, 0); break; case DamageReportNone: break; } } static void DamageExtDestroy(DamagePtr pDamage, void *closure) { DamageExtPtr pDamageExt = closure; pDamageExt->pDamage = 0; if (pDamageExt->id) FreeResource(pDamageExt->id, RT_NONE); } void DamageExtSetCritical(ClientPtr pClient, Bool critical) { DamageClientPtr pDamageClient = GetDamageClient(pClient); if (pDamageClient) pDamageClient->critical += critical ? 1 : -1; } static int ProcDamageQueryVersion(ClientPtr client) { DamageClientPtr pDamageClient = GetDamageClient(client); xDamageQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xDamageQueryVersionReq); REQUEST_SIZE_MATCH(xDamageQueryVersionReq); if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION; if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION && stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION) rep.minorVersion = stuff->minorVersion; else rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION; } pDamageClient->major_version = rep.majorVersion; pDamageClient->minor_version = rep.minorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xDamageQueryVersionReply), &rep); return Success; } static void DamageExtRegister(DrawablePtr pDrawable, DamagePtr pDamage, Bool report) { DamageSetReportAfterOp(pDamage, TRUE); DamageRegister(pDrawable, pDamage); if (report) { RegionPtr pRegion = &((WindowPtr) pDrawable)->borderClip; RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y); DamageReportDamage(pDamage, pRegion); RegionTranslate(pRegion, pDrawable->x, pDrawable->y); } } static DamageExtPtr DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level, ClientPtr client, XID id, XID drawable) { DamageExtPtr pDamageExt = malloc(sizeof(DamageExtRec)); if (!pDamageExt) return NULL; pDamageExt->id = id; pDamageExt->drawable = drawable; pDamageExt->pDrawable = pDrawable; pDamageExt->level = level; pDamageExt->pClient = client; pDamageExt->pDamage = DamageCreate(DamageExtReport, DamageExtDestroy, level, FALSE, pDrawable->pScreen, pDamageExt); if (!pDamageExt->pDamage) { free(pDamageExt); return NULL; } if (!AddResource(id, DamageExtType, (void *) pDamageExt)) return NULL; DamageExtRegister(pDrawable, pDamageExt->pDamage, pDrawable->type == DRAWABLE_WINDOW); return pDamageExt; } static DamageExtPtr doDamageCreate(ClientPtr client, int *rc) { DrawablePtr pDrawable; DamageExtPtr pDamageExt; DamageReportLevel level; REQUEST(xDamageCreateReq); *rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixGetAttrAccess | DixReadAccess); if (*rc != Success) return NULL; switch (stuff->level) { case XDamageReportRawRectangles: level = DamageReportRawRegion; break; case XDamageReportDeltaRectangles: level = DamageReportDeltaRegion; break; case XDamageReportBoundingBox: level = DamageReportBoundingBox; break; case XDamageReportNonEmpty: level = DamageReportNonEmpty; break; default: client->errorValue = stuff->level; *rc = BadValue; return NULL; } pDamageExt = DamageExtCreate(pDrawable, level, client, stuff->damage, stuff->drawable); if (!pDamageExt) *rc = BadAlloc; return pDamageExt; } static int ProcDamageCreate(ClientPtr client) { int rc; REQUEST(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); doDamageCreate(client, &rc); return rc; } static int ProcDamageDestroy(ClientPtr client) { REQUEST(xDamageDestroyReq); DamageExtPtr pDamageExt; REQUEST_SIZE_MATCH(xDamageDestroyReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); FreeResource(stuff->damage, RT_NONE); return Success; } #ifdef PANORAMIX static RegionPtr DamageExtSubtractWindowClip(DamageExtPtr pDamageExt) { WindowPtr win = (WindowPtr)pDamageExt->pDrawable; PanoramiXRes *res = NULL; RegionPtr ret; int i; if (!win->parent) return &PanoramiXScreenRegion; dixLookupResourceByType((void **)&res, win->drawable.id, XRT_WINDOW, serverClient, DixReadAccess); if (!res) return NULL; ret = RegionCreate(NULL, 0); if (!ret) return NULL; FOR_NSCREENS_FORWARD(i) { ScreenPtr screen; if (Success != dixLookupWindow(&win, res->info[i].id, serverClient, DixReadAccess)) goto out; screen = win->drawable.pScreen; RegionTranslate(ret, -screen->x, -screen->y); if (!RegionUnion(ret, ret, &win->borderClip)) goto out; RegionTranslate(ret, screen->x, screen->y); } return ret; out: RegionDestroy(ret); return NULL; } static void DamageExtFreeWindowClip(RegionPtr reg) { if (reg != &PanoramiXScreenRegion) RegionDestroy(reg); } #endif /* * DamageSubtract intersects with borderClip, so we must reconstruct the * protocol's perspective of same... */ static Bool DamageExtSubtract(DamageExtPtr pDamageExt, const RegionPtr pRegion) { DamagePtr pDamage = pDamageExt->pDamage; #ifdef PANORAMIX if (!noPanoramiXExtension) { RegionPtr damage = DamageRegion(pDamage); RegionSubtract(damage, damage, pRegion); if (pDamageExt->pDrawable->type == DRAWABLE_WINDOW) { DrawablePtr pDraw = pDamageExt->pDrawable; RegionPtr clip = DamageExtSubtractWindowClip(pDamageExt); if (clip) { RegionTranslate(clip, -pDraw->x, -pDraw->y); RegionIntersect(damage, damage, clip); RegionTranslate(clip, pDraw->x, pDraw->y); DamageExtFreeWindowClip(clip); } } return RegionNotEmpty(damage); } #endif return DamageSubtract(pDamage, pRegion); } static int ProcDamageSubtract(ClientPtr client) { REQUEST(xDamageSubtractReq); DamageExtPtr pDamageExt; RegionPtr pRepair; RegionPtr pParts; REQUEST_SIZE_MATCH(xDamageSubtractReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess); VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess); if (pDamageExt->level != DamageReportRawRegion) { DamagePtr pDamage = pDamageExt->pDamage; if (pRepair) { if (pParts) RegionIntersect(pParts, DamageRegion(pDamage), pRepair); if (DamageExtSubtract(pDamageExt, pRepair)) DamageExtReport(pDamage, DamageRegion(pDamage), (void *) pDamageExt); } else { if (pParts) RegionCopy(pParts, DamageRegion(pDamage)); DamageEmpty(pDamage); } } return Success; } static int ProcDamageAdd(ClientPtr client) { REQUEST(xDamageAddReq); DrawablePtr pDrawable; RegionPtr pRegion; int rc; REQUEST_SIZE_MATCH(xDamageAddReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixWriteAccess); if (rc != Success) return rc; /* The region is relative to the drawable origin, so translate it out to * screen coordinates like damage expects. */ RegionTranslate(pRegion, pDrawable->x, pDrawable->y); DamageDamageRegion(pDrawable, pRegion); RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y); return Success; } /* Major version controls available requests */ static const int version_requests[] = { X_DamageQueryVersion, /* before client sends QueryVersion */ X_DamageAdd, /* Version 1 */ }; static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { /*************** Version 1 ******************/ ProcDamageQueryVersion, ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract, /*************** Version 1.1 ****************/ ProcDamageAdd, }; static int ProcDamageDispatch(ClientPtr client) { REQUEST(xDamageReq); DamageClientPtr pDamageClient = GetDamageClient(client); if (pDamageClient->major_version >= ARRAY_SIZE(version_requests)) return BadRequest; if (stuff->damageReqType > version_requests[pDamageClient->major_version]) return BadRequest; return (*ProcDamageVector[stuff->damageReqType]) (client); } static int _X_COLD SProcDamageQueryVersion(ClientPtr client) { REQUEST(xDamageQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageQueryVersionReq); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int _X_COLD SProcDamageCreate(ClientPtr client) { REQUEST(xDamageCreateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageCreateReq); swapl(&stuff->damage); swapl(&stuff->drawable); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int _X_COLD SProcDamageDestroy(ClientPtr client) { REQUEST(xDamageDestroyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageDestroyReq); swapl(&stuff->damage); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int _X_COLD SProcDamageSubtract(ClientPtr client) { REQUEST(xDamageSubtractReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageSubtractReq); swapl(&stuff->damage); swapl(&stuff->repair); swapl(&stuff->parts); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int _X_COLD SProcDamageAdd(ClientPtr client) { REQUEST(xDamageAddReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageSubtractReq); swapl(&stuff->drawable); swapl(&stuff->region); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { /*************** Version 1 ******************/ SProcDamageQueryVersion, SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract, /*************** Version 1.1 ****************/ SProcDamageAdd, }; static int _X_COLD SProcDamageDispatch(ClientPtr client) { REQUEST(xDamageReq); if (stuff->damageReqType >= XDamageNumberRequests) return BadRequest; return (*SProcDamageVector[stuff->damageReqType]) (client); } static int FreeDamageExt(void *value, XID did) { DamageExtPtr pDamageExt = (DamageExtPtr) value; /* * Get rid of the resource table entry hanging from the window id */ pDamageExt->id = 0; if (pDamageExt->pDamage) { DamageDestroy(pDamageExt->pDamage); } free(pDamageExt); return Success; } static void _X_COLD SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to) { to->type = from->type; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->drawable, to->drawable); cpswapl(from->damage, to->damage); cpswaps(from->area.x, to->area.x); cpswaps(from->area.y, to->area.y); cpswaps(from->area.width, to->area.width); cpswaps(from->area.height, to->area.height); cpswaps(from->geometry.x, to->geometry.x); cpswaps(from->geometry.y, to->geometry.y); cpswaps(from->geometry.width, to->geometry.width); cpswaps(from->geometry.height, to->geometry.height); } #ifdef PANORAMIX static void PanoramiXDamageReport(DamagePtr pDamage, RegionPtr pRegion, void *closure) { PanoramiXDamageRes *res = closure; DamageExtPtr pDamageExt = res->ext; WindowPtr pWin = (WindowPtr)pDamage->pDrawable; ScreenPtr pScreen = pDamage->pScreen; /* happens on unmap? sigh xinerama */ if (RegionNil(pRegion)) return; /* translate root windows if necessary */ if (!pWin->parent) RegionTranslate(pRegion, pScreen->x, pScreen->y); /* add our damage to the protocol view */ DamageReportDamage(pDamageExt->pDamage, pRegion); /* empty our view */ DamageEmpty(pDamage); } static void PanoramiXDamageExtDestroy(DamagePtr pDamage, void *closure) { PanoramiXDamageRes *damage = closure; damage->damage[pDamage->pScreen->myNum] = NULL; } static int PanoramiXDamageCreate(ClientPtr client) { PanoramiXDamageRes *damage; PanoramiXRes *draw; int i, rc; REQUEST(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); rc = dixLookupResourceByClass((void **)&draw, stuff->drawable, XRC_DRAWABLE, client, DixGetAttrAccess | DixReadAccess); if (rc != Success) return rc; if (!(damage = calloc(1, sizeof(PanoramiXDamageRes)))) return BadAlloc; if (!AddResource(stuff->damage, XRT_DAMAGE, damage)) return BadAlloc; damage->ext = doDamageCreate(client, &rc); if (rc == Success && draw->type == XRT_WINDOW) { FOR_NSCREENS_FORWARD(i) { DrawablePtr pDrawable; DamagePtr pDamage = DamageCreate(PanoramiXDamageReport, PanoramiXDamageExtDestroy, DamageReportRawRegion, FALSE, screenInfo.screens[i], damage); if (!pDamage) { rc = BadAlloc; } else { damage->damage[i] = pDamage; rc = dixLookupDrawable(&pDrawable, draw->info[i].id, client, M_WINDOW, DixGetAttrAccess | DixReadAccess); } if (rc != Success) break; DamageExtRegister(pDrawable, pDamage, i != 0); } } if (rc != Success) FreeResource(stuff->damage, RT_NONE); return rc; } static int PanoramiXDamageDelete(void *res, XID id) { int i; PanoramiXDamageRes *damage = res; FOR_NSCREENS_BACKWARD(i) { if (damage->damage[i]) { DamageDestroy(damage->damage[i]); damage->damage[i] = NULL; } } free(damage); return 1; } void PanoramiXDamageInit(void) { XRT_DAMAGE = CreateNewResourceType(PanoramiXDamageDelete, "XineramaDamage"); if (!XRT_DAMAGE) FatalError("Couldn't Xineramify Damage extension\n"); PanoramiXSaveDamageCreate = ProcDamageVector[X_DamageCreate]; ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate; } void PanoramiXDamageReset(void) { ProcDamageVector[X_DamageCreate] = PanoramiXSaveDamageCreate; } #endif /* PANORAMIX */ void DamageExtensionInit(void) { ExtensionEntry *extEntry; int s; for (s = 0; s < screenInfo.numScreens; s++) DamageSetup(screenInfo.screens[s]); DamageExtType = CreateNewResourceType(FreeDamageExt, "DamageExt"); if (!DamageExtType) return; if (!dixRegisterPrivateKey (&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec))) return; if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents, XDamageNumberErrors, ProcDamageDispatch, SProcDamageDispatch, NULL, StandardMinorOpcode)) != 0) { DamageReqCode = (unsigned char) extEntry->base; DamageEventBase = extEntry->eventBase; EventSwapVector[DamageEventBase + XDamageNotify] = (EventSwapPtr) SDamageNotifyEvent; SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage); #ifdef PANORAMIX if (XRT_DAMAGE) SetResourceTypeErrorValue(XRT_DAMAGE, extEntry->errorBase + BadDamage); #endif } } xorg-server-1.20.8/damageext/damageextint.h0000644000175000017500000000457013640201473015576 00000000000000/* * Copyright © 2002 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #ifndef _DAMAGEEXTINT_H_ #define _DAMAGEEXTINT_H_ #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include #include "windowstr.h" #include "selection.h" #include "scrnintstr.h" #include "damage.h" #include "xfixes.h" typedef struct _DamageClient { CARD32 major_version; CARD32 minor_version; int critical; } DamageClientRec, *DamageClientPtr; #define GetDamageClient(pClient) ((DamageClientPtr)dixLookupPrivate(&(pClient)->devPrivates, DamageClientPrivateKey)) typedef struct _DamageExt { DamagePtr pDamage; DrawablePtr pDrawable; DamageReportLevel level; ClientPtr pClient; XID id; XID drawable; } DamageExtRec, *DamageExtPtr; #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \ int rc = dixLookupResourceByType((void **)&(pDamageExt), rid, \ DamageExtType, client, mode); \ if (rc != Success) \ return rc; \ } void DamageExtSetCritical(ClientPtr pClient, Bool critical); void PanoramiXDamageInit(void); void PanoramiXDamageReset(void); #endif /* _DAMAGEEXTINT_H_ */ xorg-server-1.20.8/damageext/Makefile.in0000644000175000017500000006343713640201511015020 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = damageext ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdamageext_la_LIBADD = am_libdamageext_la_OBJECTS = damageext.lo libdamageext_la_OBJECTS = $(am_libdamageext_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/damageext.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdamageext_la_SOURCES) DIST_SOURCES = $(libdamageext_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdamageext.la AM_CFLAGS = $(DIX_CFLAGS) libdamageext_la_SOURCES = \ damageext.c \ damageextint.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign damageext/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign damageext/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdamageext.la: $(libdamageext_la_OBJECTS) $(libdamageext_la_DEPENDENCIES) $(EXTRA_libdamageext_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libdamageext_la_OBJECTS) $(libdamageext_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/damageext.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/damageext.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/damageext.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/damageext/meson.build0000644000175000017500000000025513640201473015111 00000000000000srcs_damageext = [ 'damageext.c', ] libxserver_damageext = static_library('libxserver_damageext', srcs_damageext, include_directories: inc, dependencies: common_dep, ) xorg-server-1.20.8/fb/0000755000175000017500000000000013640201532011451 500000000000000xorg-server-1.20.8/fb/Makefile.am0000644000175000017500000000140413640201473013430 00000000000000noinst_LTLIBRARIES = libfb.la libwfb.la AM_CFLAGS = $(DIX_CFLAGS) if XORG sdk_HEADERS = fb.h fbrop.h fboverlay.h wfbrename.h fbpict.h endif libfb_la_CFLAGS = $(AM_CFLAGS) libfb_la_LIBADD = $(PIXMAN_LIBS) libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libwfb_la_LIBADD = $(PIXMAN_LIBS) libfb_la_SOURCES = \ fb.h \ fballpriv.c \ fbarc.c \ fbbits.c \ fbbits.h \ fbblt.c \ fbbltone.c \ fbcmap_mi.c \ fbcopy.c \ fbfill.c \ fbfillrect.c \ fbfillsp.c \ fbgc.c \ fbgetsp.c \ fbglyph.c \ fbimage.c \ fbline.c \ fboverlay.c \ fboverlay.h \ fbpict.c \ fbpict.h \ fbpixmap.c \ fbpoint.c \ fbpush.c \ fbrop.h \ fbscreen.c \ fbseg.c \ fbsetsp.c \ fbsolid.c \ fbtrap.c \ fbutil.c \ fbwindow.c libwfb_la_SOURCES = $(libfb_la_SOURCES) xorg-server-1.20.8/fb/fboverlay.h0000644000175000017500000000672313640201473013547 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifndef _FBOVERLAY_H_ #define _FBOVERLAY_H_ #include "privates.h" extern _X_EXPORT DevPrivateKey fbOverlayGetScreenPrivateKey(void); #ifndef FB_OVERLAY_MAX #define FB_OVERLAY_MAX 2 #endif typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int); typedef struct _fbOverlayLayer { union { struct { void *pbits; int width; int depth; } init; struct { PixmapPtr pixmap; RegionRec region; } run; } u; CARD32 key; /* special pixel value */ } FbOverlayLayer; typedef struct _fbOverlayScrPriv { int nlayers; fbOverlayPaintKeyProc PaintKey; miCopyProc CopyWindow; FbOverlayLayer layer[FB_OVERLAY_MAX]; } FbOverlayScrPrivRec, *FbOverlayScrPrivPtr; #define fbOverlayGetScrPriv(s) \ dixLookupPrivate(&(s)->devPrivates, fbOverlayGetScreenPrivateKey()) extern _X_EXPORT Bool fbOverlayCreateWindow(WindowPtr pWin); extern _X_EXPORT Bool fbOverlayCloseScreen(ScreenPtr pScreen); extern _X_EXPORT int fbOverlayWindowLayer(WindowPtr pWin); extern _X_EXPORT Bool fbOverlayCreateScreenResources(ScreenPtr pScreen); extern _X_EXPORT void fbOverlayPaintKey(DrawablePtr pDrawable, RegionPtr pRegion, CARD32 pixel, int layer); extern _X_EXPORT void fbOverlayUpdateLayerRegion(ScreenPtr pScreen, int layer, RegionPtr prgn); extern _X_EXPORT void fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); extern _X_EXPORT void fbOverlayWindowExposures(WindowPtr pWin, RegionPtr prgn); extern _X_EXPORT Bool fbOverlaySetupScreen(ScreenPtr pScreen, void *pbits1, void *pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2); extern _X_EXPORT Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, void *pbits1, void *pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2, int depth1, int depth2); #endif /* _FBOVERLAY_H_ */ xorg-server-1.20.8/fb/fbtrap.c0000644000175000017500000001312713640201473013023 00000000000000/* * Copyright © 2004 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" #include "picturestr.h" #include "mipict.h" #include "fbpict.h" #include "damage.h" void fbAddTraps(PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntrap, xTrap * traps) { pixman_image_t *image; int dst_xoff, dst_yoff; if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff))) return; pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff, ntrap, (pixman_trap_t *) traps); free_pixman_pict(pPicture, image); } void fbRasterizeTrapezoid(PicturePtr pPicture, xTrapezoid * trap, int x_off, int y_off) { pixman_image_t *image; int dst_xoff, dst_yoff; if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff))) return; pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *) trap, x_off + dst_xoff, y_off + dst_yoff); free_pixman_pict(pPicture, image); } void fbAddTriangles(PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri, xTriangle * tris) { pixman_image_t *image; int dst_xoff, dst_yoff; if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff))) return; pixman_add_triangles(image, dst_xoff + x_off, dst_yoff + y_off, ntri, (pixman_triangle_t *) tris); free_pixman_pict(pPicture, image); } typedef void (*CompositeShapesFunc) (pixman_op_t op, pixman_image_t * src, pixman_image_t * dst, pixman_format_code_t mask_format, int x_src, int y_src, int x_dst, int y_dst, int n_shapes, const uint8_t * shapes); static void fbShapes(CompositeShapesFunc composite, pixman_op_t op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, int16_t xSrc, int16_t ySrc, int nshapes, int shape_size, const uint8_t * shapes) { pixman_image_t *src, *dst; int src_xoff, src_yoff; int dst_xoff, dst_yoff; miCompositeSourceValidate(pSrc); src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff); dst = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff); if (src && dst) { pixman_format_code_t format; DamageRegionAppend(pDst->pDrawable, pDst->pCompositeClip); if (!maskFormat) { int i; if (pDst->polyEdge == PolyEdgeSharp) format = PIXMAN_a1; else format = PIXMAN_a8; for (i = 0; i < nshapes; ++i) { composite(op, src, dst, format, xSrc + src_xoff, ySrc + src_yoff, dst_xoff, dst_yoff, 1, shapes + i * shape_size); } } else { switch (PICT_FORMAT_A(maskFormat->format)) { case 1: format = PIXMAN_a1; break; case 4: format = PIXMAN_a4; break; default: case 8: format = PIXMAN_a8; break; } composite(op, src, dst, format, xSrc + src_xoff, ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes); } DamageRegionProcessPending(pDst->pDrawable); } free_pixman_pict(pSrc, src); free_pixman_pict(pDst, dst); } void fbTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps) { xSrc -= (traps[0].left.p1.x >> 16); ySrc -= (traps[0].left.p1.y >> 16); fbShapes((CompositeShapesFunc) pixman_composite_trapezoids, op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, sizeof(xTrapezoid), (const uint8_t *) traps); } void fbTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris) { xSrc -= (tris[0].p1.x >> 16); ySrc -= (tris[0].p1.y >> 16); fbShapes((CompositeShapesFunc) pixman_composite_triangles, op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, sizeof(xTriangle), (const uint8_t *) tris); } xorg-server-1.20.8/fb/fbpoint.c0000644000175000017500000000721513640201473013207 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" typedef void (*FbDots) (FbBits * dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint * pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); static void fbDots(FbBits * dstOrig, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint * pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig) { FbStip *dst = (FbStip *) dstOrig; int x1, y1, x2, y2; int x, y; FbStip *d; FbStip and = andOrig; FbStip xor = xorOrig; dstStride = FbBitsStrideToStipStride(dstStride); x1 = pBox->x1; y1 = pBox->y1; x2 = pBox->x2; y2 = pBox->y2; while (npt--) { x = pts->x + xorg; y = pts->y + yorg; pts++; if (x1 <= x && x < x2 && y1 <= y && y < y2) { FbStip mask; x = (x + xoff) * dstBpp; d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT); x &= FB_STIP_MASK; mask = FbStipMask(x, dstBpp); WRITE(d, FbDoMaskRRop(READ(d), and, xor, mask)); } } } void fbPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nptInit, xPoint * pptInit) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); RegionPtr pClip = fbGetCompositeClip(pGC); FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbDots dots; FbBits and, xor; xPoint *ppt; int npt; BoxPtr pBox; int nBox; /* make pointlist origin relative */ ppt = pptInit; npt = nptInit; if (mode == CoordModePrevious) { npt--; while (npt--) { ppt++; ppt->x += (ppt - 1)->x; ppt->y += (ppt - 1)->y; } } fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); and = pPriv->and; xor = pPriv->xor; dots = fbDots; switch (dstBpp) { case 8: dots = fbDots8; break; case 16: dots = fbDots16; break; case 32: dots = fbDots32; break; } for (nBox = RegionNumRects(pClip), pBox = RegionRects(pClip); nBox--; pBox++) (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor); fbFinishAccess(pDrawable); } xorg-server-1.20.8/fb/fbfillsp.c0000644000175000017500000000547313640201473013353 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" void fbFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted) { RegionPtr pClip = fbGetCompositeClip(pGC); BoxPtr pextent, pbox; int nbox; int extentX1, extentX2, extentY1, extentY2; int fullX1, fullX2, fullY1; int partX1, partX2; pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; extentY2 = pextent->y2; while (n--) { fullX1 = ppt->x; fullY1 = ppt->y; fullX2 = fullX1 + (int) *pwidth; ppt++; pwidth++; if (fullY1 < extentY1 || extentY2 <= fullY1) continue; if (fullX1 < extentX1) fullX1 = extentX1; if (fullX2 > extentX2) fullX2 = extentX2; if (fullX1 >= fullX2) continue; nbox = RegionNumRects(pClip); if (nbox == 1) { fbFill(pDrawable, pGC, fullX1, fullY1, fullX2 - fullX1, 1); } else { pbox = RegionRects(pClip); while (nbox--) { if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) { partX1 = pbox->x1; if (partX1 < fullX1) partX1 = fullX1; partX2 = pbox->x2; if (partX2 > fullX2) partX2 = fullX2; if (partX2 > partX1) { fbFill(pDrawable, pGC, partX1, fullY1, partX2 - partX1, 1); } } pbox++; } } } } xorg-server-1.20.8/fb/fbrop.h0000644000175000017500000001055613640201473012665 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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 _FBROP_H_ #define _FBROP_H_ typedef struct _mergeRopBits { FbBits ca1, cx1, ca2, cx2; } FbMergeRopRec, *FbMergeRopPtr; extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16]; #define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2; #define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx; #define FbInitializeMergeRop(alu,pm) {\ const FbMergeRopRec *_bits; \ _bits = &FbMergeRopBits[alu]; \ _ca1 = _bits->ca1 & pm; \ _cx1 = _bits->cx1 | ~pm; \ _ca2 = _bits->ca2 & pm; \ _cx2 = _bits->cx2 & pm; \ } #define FbDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \ (((alu) >> 1 & 5) == ((alu) & 5))) #define FbDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0) /* AND has higher precedence than XOR */ #define FbDoMergeRop(src, dst) \ (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2)) #define FbDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2) #define FbDoMaskMergeRop(src, dst, mask) \ (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask))) #define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \ FbBits __xor = ((src) & _ca2) ^ _cx2; \ FbDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \ } #define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \ FbBits __xor = ((src) & _ca2) ^ _cx2; \ FbDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \ } #define FbDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) #define FbDoMaskRRop(dst, and, xor, mask) \ (((dst) & ((and) | ~(mask))) ^ (xor & mask)) /* * Take a single bit (0 or 1) and generate a full mask */ #define fbFillFromBit(b,t) (~((t) ((b) & 1)-1)) #define fbXorT(rop,fg,pm,t) ((((fg) & fbFillFromBit((rop) >> 1,t)) | \ (~(fg) & fbFillFromBit((rop) >> 3,t))) & (pm)) #define fbAndT(rop,fg,pm,t) ((((fg) & fbFillFromBit (rop ^ (rop>>1),t)) | \ (~(fg) & fbFillFromBit((rop>>2) ^ (rop>>3),t))) | \ ~(pm)) #define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,FbBits) #define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,FbBits) #define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,FbStip) #define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,FbStip) /* * Stippling operations; */ #define FbStippleRRop(dst, b, fa, fx, ba, bx) \ (FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b) #define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \ (FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b)) #define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \ FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } #define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \ FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ FbDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } #define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b))) /* * Compute rop for using tile code for 1-bit dest stipples; modifies * existing rop to flip depending on pixel values */ #define FbStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3) #define FbOpaqueStipple1Rop(alu,fg,bg) (FbStipple1RopPick(alu,fg) | \ (FbStipple1RopPick(alu,bg) << 2)) #define FbStipple1Rop(alu,fg) (FbStipple1RopPick(alu,fg) | 4) #endif xorg-server-1.20.8/fb/fbcmap_mi.c0000644000175000017500000000637713640201473013473 00000000000000/* * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 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 version of fbcmap.c is implemented in terms of mi functions. * These functions used to be in fbcmap.c and depended upon the symbol * XFree86Server being defined. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #include "micmap.h" int fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps) { return miListInstalledColormaps(pScreen, pmaps); } void fbInstallColormap(ColormapPtr pmap) { miInstallColormap(pmap); } void fbUninstallColormap(ColormapPtr pmap) { miUninstallColormap(pmap); } void fbResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual) { miResolveColor(pred, pgreen, pblue, pVisual); } Bool fbInitializeColormap(ColormapPtr pmap) { return miInitializeColormap(pmap); } int fbExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem * indefs, xColorItem * outdefs) { return miExpandDirectColors(pmap, ndef, indefs, outdefs); } Bool fbCreateDefColormap(ScreenPtr pScreen) { return miCreateDefColormap(pScreen); } void fbClearVisualTypes(void) { miClearVisualTypes(); } Bool fbSetVisualTypes(int depth, int visuals, int bitsPerRGB) { return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); } Bool fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, Pixel redMask, Pixel greenMask, Pixel blueMask) { return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1, redMask, greenMask, blueMask); } /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which coorespond to * the set which can be used with this version of fb. */ Bool fbInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB) { return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB, -1); } xorg-server-1.20.8/fb/fbpixmap.c0000644000175000017500000002536513640201473013362 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" PixmapPtr fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint) { PixmapPtr pPixmap; size_t datasize; size_t paddedWidth; int adjust; int base; int bpp = BitsPerPixel(depth); paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits); if (paddedWidth / 4 > 32767 || height > 32767) return NullPixmap; datasize = height * paddedWidth; base = pScreen->totalPixmapSize; adjust = 0; if (base & 7) adjust = 8 - (base & 7); datasize += adjust; #ifdef FB_DEBUG datasize += 2 * paddedWidth; #endif pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) return NullPixmap; pPixmap->drawable.type = DRAWABLE_PIXMAP; pPixmap->drawable.class = 0; pPixmap->drawable.pScreen = pScreen; pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = bpp; pPixmap->drawable.id = 0; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = paddedWidth; pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap + base + adjust); pPixmap->master_pixmap = NULL; #ifdef FB_DEBUG pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth); fbInitializeDrawable(&pPixmap->drawable); #endif #ifdef COMPOSITE pPixmap->screen_x = 0; pPixmap->screen_y = 0; #endif pPixmap->usage_hint = usage_hint; return pPixmap; } Bool fbDestroyPixmap(PixmapPtr pPixmap) { if (--pPixmap->refcnt) return TRUE; FreePixmap(pPixmap); return TRUE; } #define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ (!((reg)->data->numRects && \ ((r-1)->y1 == (ry1)) && \ ((r-1)->y2 == (ry2)) && \ ((r-1)->x1 <= (rx1)) && \ ((r-1)->x2 >= (rx2))))) \ { \ if ((reg)->data->numRects == (reg)->data->size) \ { \ RegionRectAlloc(reg, 1); \ fr = RegionBoxptr(reg); \ r = fr + (reg)->data->numRects; \ } \ r->x1 = (rx1); \ r->y1 = (ry1); \ r->x2 = (rx2); \ r->y2 = (ry2); \ (reg)->data->numRects++; \ if(r->x1 < (reg)->extents.x1) \ (reg)->extents.x1 = r->x1; \ if(r->x2 > (reg)->extents.x2) \ (reg)->extents.x2 = r->x2; \ r++; \ } /* Convert bitmap clip mask into clipping region. * First, goes through each line and makes boxes by noting the transitions * from 0 to 1 and 1 to 0. * Then it coalesces the current line with the previous if they have boxes * at the same X coordinates. */ RegionPtr fbPixmapToRegion(PixmapPtr pPix) { register RegionPtr pReg; FbBits *pw, w; register int ib; int width, h, base, rx1 = 0, crects; FbBits *pwLineEnd; int irectPrevStart, irectLineStart; register BoxPtr prectO, prectN; BoxPtr FirstRect, rects, prectLineStart; Bool fInBox, fSame; register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1); FbBits *pwLine; int nWidth; pReg = RegionCreate(NULL, 1); if (!pReg) return NullRegion; FirstRect = RegionBoxptr(pReg); rects = FirstRect; fbPrepareAccess(&pPix->drawable); pwLine = (FbBits *) pPix->devPrivate.ptr; nWidth = pPix->devKind >> (FB_SHIFT - 3); width = pPix->drawable.width; pReg->extents.x1 = width - 1; pReg->extents.x2 = 0; irectPrevStart = -1; for (h = 0; h < pPix->drawable.height; h++) { pw = pwLine; pwLine += nWidth; irectLineStart = rects - FirstRect; /* If the Screen left most bit of the word is set, we're starting in * a box */ if (READ(pw) & mask0) { fInBox = TRUE; rx1 = 0; } else fInBox = FALSE; /* Process all words which are fully in the pixmap */ pwLineEnd = pw + (width >> FB_SHIFT); for (base = 0; pw < pwLineEnd; base += FB_UNIT) { w = READ(pw++); if (fInBox) { if (!~w) continue; } else { if (!w) continue; } for (ib = 0; ib < FB_UNIT; ib++) { /* If the Screen left most bit of the word is set, we're * starting a box */ if (w & mask0) { if (!fInBox) { rx1 = base + ib; /* start new box */ fInBox = TRUE; } } else { if (fInBox) { /* end box */ ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1); fInBox = FALSE; } } /* Shift the word VISUALLY left one. */ w = FbScrLeft(w, 1); } } if (width & FB_MASK) { /* Process final partial word on line */ w = READ(pw++); for (ib = 0; ib < (width & FB_MASK); ib++) { /* If the Screen left most bit of the word is set, we're * starting a box */ if (w & mask0) { if (!fInBox) { rx1 = base + ib; /* start new box */ fInBox = TRUE; } } else { if (fInBox) { /* end box */ ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1); fInBox = FALSE; } } /* Shift the word VISUALLY left one. */ w = FbScrLeft(w, 1); } } /* If scanline ended with last bit set, end the box */ if (fInBox) { ADDRECT(pReg, rects, FirstRect, rx1, h, base + (width & FB_MASK), h + 1); } /* if all rectangles on this line have the same x-coords as * those on the previous line, then add 1 to all the previous y2s and * throw away all the rectangles from this line */ fSame = FALSE; if (irectPrevStart != -1) { crects = irectLineStart - irectPrevStart; if (crects == ((rects - FirstRect) - irectLineStart)) { prectO = FirstRect + irectPrevStart; prectN = prectLineStart = FirstRect + irectLineStart; fSame = TRUE; while (prectO < prectLineStart) { if ((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2)) { fSame = FALSE; break; } prectO++; prectN++; } if (fSame) { prectO = FirstRect + irectPrevStart; while (prectO < prectLineStart) { prectO->y2 += 1; prectO++; } rects -= crects; pReg->data->numRects -= crects; } } } if (!fSame) irectPrevStart = irectLineStart; } if (!pReg->data->numRects) pReg->extents.x1 = pReg->extents.x2 = 0; else { pReg->extents.y1 = RegionBoxptr(pReg)->y1; pReg->extents.y2 = RegionEnd(pReg)->y2; if (pReg->data->numRects == 1) { free(pReg->data); pReg->data = (RegDataPtr) NULL; } } fbFinishAccess(&pPix->drawable); #ifdef DEBUG if (!RegionIsValid(pReg)) FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); #endif return pReg; } #ifdef FB_DEBUG #ifndef WIN32 #include #else #include #endif static Bool fbValidateBits(FbStip * bits, int stride, FbStip data) { while (stride--) { if (*bits != data) { #ifdef WIN32 NCD_DEBUG((DEBUG_FAILURE, "fdValidateBits failed at 0x%x (is 0x%x want 0x%x)", bits, *bits, data)); #else fprintf(stderr, "fbValidateBits failed\n"); #endif return FALSE; } bits++; } } void fbValidateDrawable(DrawablePtr pDrawable) { FbStip *bits, *first, *last; int stride, bpp; int xoff, yoff; int height; Bool failed; if (pDrawable->type != DRAWABLE_PIXMAP) pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable); fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff); first = bits - stride; last = bits + stride * pDrawable->height; if (!fbValidateBits(first, stride, FB_HEAD_BITS) || !fbValidateBits(last, stride, FB_TAIL_BITS)) fbInitializeDrawable(pDrawable); fbFinishAccess(pDrawable); } void fbSetBits(FbStip * bits, int stride, FbStip data) { while (stride--) *bits++ = data; } void fbInitializeDrawable(DrawablePtr pDrawable) { FbStip *bits, *first, *last; int stride, bpp; int xoff, yoff; fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff); first = bits - stride; last = bits + stride * pDrawable->height; fbSetBits(first, stride, FB_HEAD_BITS); fbSetBits(last, stride, FB_TAIL_BITS); fbFinishAccess(pDrawable); } #endif /* FB_DEBUG */ xorg-server-1.20.8/fb/fbsolid.c0000644000175000017500000000425113640201473013165 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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. */ #define FbSelectPart(xor,o,t) xor #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbSolid(FbBits * dst, FbStride dstStride, int dstX, int bpp, int width, int height, FbBits and, FbBits xor) { FbBits startmask, endmask; int n, nmiddle; int startbyte, endbyte; dst += dstX >> FB_SHIFT; dstX &= FB_MASK; FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte, nmiddle, endmask, endbyte); if (startmask) dstStride--; dstStride -= nmiddle; while (height--) { if (startmask) { FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor); dst++; } n = nmiddle; if (!and) while (n--) WRITE(dst++, xor); else while (n--) { WRITE(dst, FbDoRRop(READ(dst), and, xor)); dst++; } if (endmask) FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor); dst += dstStride; } } xorg-server-1.20.8/fb/fbgetsp.c0000644000175000017500000000433113640201473013174 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" void fbGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart) { FbBits *src, *dst; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; int xoff; /* * XFree86 DDX empties the root borderClip when the VT is * switched away; this checks for that case */ if (!fbDrawableEnabled(pDrawable)) return; fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); while (nspans--) { xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3)); dst = (FbBits *) (pchardstStart - xoff); xoff <<= 3; fbBlt(src + (ppt->y + srcYoff) * srcStride, srcStride, (ppt->x + srcXoff) * srcBpp, dst, 1, xoff, *pwidth * srcBpp, 1, GXcopy, FB_ALLONES, srcBpp, FALSE, FALSE); pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth); ppt++; pwidth++; } fbFinishAccess(pDrawable); } xorg-server-1.20.8/fb/fbcopy.c0000644000175000017500000002241413640201473013026 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" void fbCopyNtoN(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { CARD8 alu = pGC ? pGC->alu : GXcopy; FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES; FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { #ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */ if (pm == FB_ALLONES && alu == GXcopy && !reverse && !upsidedown) { if (!pixman_blt ((uint32_t *) src, (uint32_t *) dst, srcStride, dstStride, srcBpp, dstBpp, (pbox->x1 + dx + srcXoff), (pbox->y1 + dy + srcYoff), (pbox->x1 + dstXoff), (pbox->y1 + dstYoff), (pbox->x2 - pbox->x1), (pbox->y2 - pbox->y1))) goto fallback; else goto next; } fallback: #endif fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), alu, pm, dstBpp, reverse, upsidedown); #ifndef FB_ACCESS_WRAPPER next: #endif pbox++; } fbFinishAccess(pDstDrawable); fbFinishAccess(pSrcDrawable); } void fbCopy1toN(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { if (dstBpp == 1) { fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), FbOpaqueStipple1Rop(pGC->alu, pGC->fgPixel, pGC->bgPixel), pPriv->pm, dstBpp, reverse, upsidedown); } else { fbBltOne((FbStip *) (src + (pbox->y1 + dy + srcYoff) * srcStride), srcStride * (FB_UNIT / FB_STIP_UNIT), (pbox->x1 + dx + srcXoff), dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor); } pbox++; } fbFinishAccess(pDstDrawable); fbFinishAccess(pSrcDrawable); } void fbCopyNto1(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); while (nbox--) { if (pDstDrawable->bitsPerPixel == 1) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetStipDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbBltPlane(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * srcBpp, (pbox->y2 - pbox->y1), (FbStip) pPriv->and, (FbStip) pPriv->xor, (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor, bitplane); fbFinishAccess(pDstDrawable); fbFinishAccess(pSrcDrawable); } else { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbStip *tmp; FbStride tmpStride; int width, height; width = pbox->x2 - pbox->x1; height = pbox->y2 - pbox->y1; tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT); tmp = xallocarray(tmpStride * height, sizeof(FbStip)); if (!tmp) return; fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbBltPlane(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, srcBpp, tmp, tmpStride, 0, width * srcBpp, height, fbAndStip(GXcopy, FB_ALLONES, FB_ALLONES), fbXorStip(GXcopy, FB_ALLONES, FB_ALLONES), fbAndStip(GXcopy, 0, FB_ALLONES), fbXorStip(GXcopy, 0, FB_ALLONES), bitplane); fbBltOne(tmp, tmpStride, 0, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor); free(tmp); fbFinishAccess(pDstDrawable); fbFinishAccess(pSrcDrawable); } pbox++; } } RegionPtr fbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut) { return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, fbCopyNtoN, 0, 0); } RegionPtr fbCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, unsigned long bitplane) { if (pSrcDrawable->bitsPerPixel > 1) return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, fbCopyNto1, (Pixel) bitplane, 0); else if (bitplane & 1) return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, fbCopy1toN, (Pixel) bitplane, 0); else return miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut); } xorg-server-1.20.8/fb/fbpict.c0000644000175000017500000003414213640201473013014 00000000000000/* * * Copyright © 2000 SuSE, Inc. * Copyright © 2007 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #include "picturestr.h" #include "mipict.h" #include "fbpict.h" void fbComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { pixman_image_t *src, *mask, *dest; int src_xoff, src_yoff; int msk_xoff, msk_yoff; int dst_xoff, dst_yoff; miCompositeSourceValidate(pSrc); if (pMask) miCompositeSourceValidate(pMask); src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff); mask = image_from_pict(pMask, FALSE, &msk_xoff, &msk_yoff); dest = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff); if (src && dest && !(pMask && !mask)) { pixman_image_composite(op, src, mask, dest, xSrc + src_xoff, ySrc + src_yoff, xMask + msk_xoff, yMask + msk_yoff, xDst + dst_xoff, yDst + dst_yoff, width, height); } free_pixman_pict(pSrc, src); free_pixman_pict(pMask, mask); free_pixman_pict(pDst, dest); } static pixman_glyph_cache_t *glyphCache; void fbDestroyGlyphCache(void) { if (glyphCache) { pixman_glyph_cache_destroy (glyphCache); glyphCache = NULL; } } static void fbUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr pGlyph) { if (glyphCache) pixman_glyph_cache_remove (glyphCache, pGlyph, NULL); } void fbGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs) { #define N_STACK_GLYPHS 512 ScreenPtr pScreen = pDst->pDrawable->pScreen; pixman_glyph_t stack_glyphs[N_STACK_GLYPHS]; pixman_glyph_t *pglyphs = stack_glyphs; pixman_image_t *srcImage, *dstImage; int srcXoff, srcYoff, dstXoff, dstYoff; GlyphPtr glyph; int n_glyphs; int x, y; int i, n; int xDst = list->xOff, yDst = list->yOff; miCompositeSourceValidate(pSrc); n_glyphs = 0; for (i = 0; i < nlist; ++i) n_glyphs += list[i].len; if (!glyphCache) glyphCache = pixman_glyph_cache_create(); pixman_glyph_cache_freeze (glyphCache); if (n_glyphs > N_STACK_GLYPHS) { if (!(pglyphs = xallocarray(n_glyphs, sizeof(pixman_glyph_t)))) goto out; } i = 0; x = y = 0; while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; while (n--) { const void *g; glyph = *glyphs++; if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) { pixman_image_t *glyphImage; PicturePtr pPicture; int xoff, yoff; pPicture = GetGlyphPicture(glyph, pScreen); if (!pPicture) { n_glyphs--; goto next; } if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff))) goto out; g = pixman_glyph_cache_insert(glyphCache, glyph, NULL, glyph->info.x, glyph->info.y, glyphImage); free_pixman_pict(pPicture, glyphImage); if (!g) goto out; } pglyphs[i].x = x; pglyphs[i].y = y; pglyphs[i].glyph = g; i++; next: x += glyph->info.xOff; y += glyph->info.yOff; } list++; } if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff))) goto out; if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff))) goto out_free_src; if (maskFormat) { pixman_format_code_t format; pixman_box32_t extents; format = maskFormat->format | (maskFormat->depth << 24); pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents); pixman_composite_glyphs(op, srcImage, dstImage, format, xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst, extents.x1, extents.y1, extents.x1 + dstXoff, extents.y1 + dstYoff, extents.x2 - extents.x1, extents.y2 - extents.y1, glyphCache, n_glyphs, pglyphs); } else { pixman_composite_glyphs_no_mask(op, srcImage, dstImage, xSrc + srcXoff - xDst, ySrc + srcYoff - yDst, dstXoff, dstYoff, glyphCache, n_glyphs, pglyphs); } free_pixman_pict(pDst, dstImage); out_free_src: free_pixman_pict(pSrc, srcImage); out: pixman_glyph_cache_thaw(glyphCache); if (pglyphs != stack_glyphs) free(pglyphs); } static pixman_image_t * create_solid_fill_image(PicturePtr pict) { PictSolidFill *solid = &pict->pSourcePict->solidFill; /* pixman_color_t and xRenderColor have the same layout */ pixman_color_t *color = (pixman_color_t *)&solid->fullcolor; return pixman_image_create_solid_fill(color); } static pixman_image_t * create_linear_gradient_image(PictGradient * gradient) { PictLinearGradient *linear = (PictLinearGradient *) gradient; pixman_point_fixed_t p1; pixman_point_fixed_t p2; p1.x = linear->p1.x; p1.y = linear->p1.y; p2.x = linear->p2.x; p2.y = linear->p2.y; return pixman_image_create_linear_gradient(&p1, &p2, (pixman_gradient_stop_t *) gradient->stops, gradient->nstops); } static pixman_image_t * create_radial_gradient_image(PictGradient * gradient) { PictRadialGradient *radial = (PictRadialGradient *) gradient; pixman_point_fixed_t c1; pixman_point_fixed_t c2; c1.x = radial->c1.x; c1.y = radial->c1.y; c2.x = radial->c2.x; c2.y = radial->c2.y; return pixman_image_create_radial_gradient(&c1, &c2, radial->c1.radius, radial->c2.radius, (pixman_gradient_stop_t *) gradient->stops, gradient->nstops); } static pixman_image_t * create_conical_gradient_image(PictGradient * gradient) { PictConicalGradient *conical = (PictConicalGradient *) gradient; pixman_point_fixed_t center; center.x = conical->center.x; center.y = conical->center.y; return pixman_image_create_conical_gradient(¢er, conical->angle, (pixman_gradient_stop_t *) gradient->stops, gradient->nstops); } static pixman_image_t * create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff) { PixmapPtr pixmap; FbBits *bits; FbStride stride; int bpp; pixman_image_t *image; fbGetDrawablePixmap(pict->pDrawable, pixmap, *xoff, *yoff); fbGetPixmapBitsData(pixmap, bits, stride, bpp); image = pixman_image_create_bits((pixman_format_code_t) pict->format, pixmap->drawable.width, pixmap->drawable.height, (uint32_t *) bits, stride * sizeof(FbStride)); if (!image) return NULL; #ifdef FB_ACCESS_WRAPPER pixman_image_set_accessors(image, (pixman_read_memory_func_t) wfbReadMemory, (pixman_write_memory_func_t) wfbWriteMemory); #endif /* pCompositeClip is undefined for source pictures, so * only set the clip region for pictures with drawables */ if (has_clip) { if (pict->clientClip) pixman_image_set_has_client_clip(image, TRUE); if (*xoff || *yoff) pixman_region_translate(pict->pCompositeClip, *xoff, *yoff); pixman_image_set_clip_region(image, pict->pCompositeClip); if (*xoff || *yoff) pixman_region_translate(pict->pCompositeClip, -*xoff, -*yoff); } /* Indexed table */ if (pict->pFormat->index.devPrivate) pixman_image_set_indexed(image, pict->pFormat->index.devPrivate); /* Add in drawable origin to position within the image */ *xoff += pict->pDrawable->x; *yoff += pict->pDrawable->y; return image; } static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map); static void image_destroy(pixman_image_t *image, void *data) { fbFinishAccess((DrawablePtr)data); } static void set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map) { pixman_repeat_t repeat; pixman_filter_t filter; if (pict->transform) { /* For source images, adjust the transform to account * for the drawable offset within the pixman image, * then set the offset to 0 as it will be used * to compute positions within the transformed image. */ if (!has_clip) { struct pixman_transform adjusted; adjusted = *pict->transform; pixman_transform_translate(&adjusted, NULL, pixman_int_to_fixed(*xoff), pixman_int_to_fixed(*yoff)); pixman_image_set_transform(image, &adjusted); *xoff = 0; *yoff = 0; } else pixman_image_set_transform(image, pict->transform); } switch (pict->repeatType) { default: case RepeatNone: repeat = PIXMAN_REPEAT_NONE; break; case RepeatPad: repeat = PIXMAN_REPEAT_PAD; break; case RepeatNormal: repeat = PIXMAN_REPEAT_NORMAL; break; case RepeatReflect: repeat = PIXMAN_REPEAT_REFLECT; break; } pixman_image_set_repeat(image, repeat); /* Fetch alpha map unless 'pict' is being used * as the alpha map for this operation */ if (pict->alphaMap && !is_alpha_map) { int alpha_xoff, alpha_yoff; pixman_image_t *alpha_map = image_from_pict_internal(pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE); pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y); free_pixman_pict(pict->alphaMap, alpha_map); } pixman_image_set_component_alpha(image, pict->componentAlpha); switch (pict->filter) { default: case PictFilterNearest: case PictFilterFast: filter = PIXMAN_FILTER_NEAREST; break; case PictFilterBilinear: case PictFilterGood: filter = PIXMAN_FILTER_BILINEAR; break; case PictFilterConvolution: filter = PIXMAN_FILTER_CONVOLUTION; break; } if (pict->pDrawable) pixman_image_set_destroy_function(image, &image_destroy, pict->pDrawable); pixman_image_set_filter(image, filter, (pixman_fixed_t *) pict->filter_params, pict->filter_nparams); pixman_image_set_source_clipping(image, TRUE); } static pixman_image_t * image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map) { pixman_image_t *image = NULL; if (!pict) return NULL; if (pict->pDrawable) { image = create_bits_picture(pict, has_clip, xoff, yoff); } else if (pict->pSourcePict) { SourcePict *sp = pict->pSourcePict; if (sp->type == SourcePictTypeSolidFill) { image = create_solid_fill_image(pict); } else { PictGradient *gradient = &pict->pSourcePict->gradient; if (sp->type == SourcePictTypeLinear) image = create_linear_gradient_image(gradient); else if (sp->type == SourcePictTypeRadial) image = create_radial_gradient_image(gradient); else if (sp->type == SourcePictTypeConical) image = create_conical_gradient_image(gradient); } *xoff = *yoff = 0; } if (image) set_image_properties(image, pict, has_clip, xoff, yoff, is_alpha_map); return image; } pixman_image_t * image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff) { return image_from_pict_internal(pict, has_clip, xoff, yoff, FALSE); } void free_pixman_pict(PicturePtr pict, pixman_image_t * image) { if (image) pixman_image_unref(image); } Bool fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; if (!miPictureInit(pScreen, formats, nformats)) return FALSE; ps = GetPictureScreen(pScreen); ps->Composite = fbComposite; ps->Glyphs = fbGlyphs; ps->UnrealizeGlyph = fbUnrealizeGlyph; ps->CompositeRects = miCompositeRects; ps->RasterizeTrapezoid = fbRasterizeTrapezoid; ps->Trapezoids = fbTrapezoids; ps->AddTraps = fbAddTraps; ps->AddTriangles = fbAddTriangles; ps->Triangles = fbTriangles; return TRUE; } xorg-server-1.20.8/fb/fbline.c0000644000175000017500000001013713640201473013002 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" static void fbZeroLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { int x1, y1, x2, y2; int x, y; int dashOffset; x = pDrawable->x; y = pDrawable->y; x1 = ppt->x; y1 = ppt->y; dashOffset = pGC->dashOffset; while (--npt) { ++ppt; x2 = ppt->x; y2 = ppt->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } fbSegment(pDrawable, pGC, x1 + x, y1 + y, x2 + x, y2 + y, npt == 1 && pGC->capStyle != CapNotLast, &dashOffset); x1 = x2; y1 = y2; } } static void fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs) { int dashOffset; int x, y; Bool drawLast = pGC->capStyle != CapNotLast; x = pDrawable->x; y = pDrawable->y; while (nseg--) { dashOffset = pGC->dashOffset; fbSegment(pDrawable, pGC, pSegs->x1 + x, pSegs->y1 + y, pSegs->x2 + x, pSegs->y2 + y, drawLast, &dashOffset); pSegs++; } } void fbFixCoordModePrevious(int npt, DDXPointPtr ppt) { int x, y; x = ppt->x; y = ppt->y; npt--; while (npt--) { ppt++; x = (ppt->x += x); y = (ppt->y += y); } } void fbPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt); if (pGC->lineWidth == 0) { line = fbZeroLine; if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && RegionNumRects(fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: line = fbPolyline8; break; case 16: line = fbPolyline16; break; case 32: line = fbPolyline32; break; } } } else { if (pGC->lineStyle != LineSolid) line = miWideDash; else line = miWideLine; } (*line) (pDrawable, pGC, mode, npt, ppt); } void fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg) { void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg); if (pGC->lineWidth == 0) { seg = fbZeroSegment; if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && RegionNumRects(fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: seg = fbPolySegment8; break; case 16: seg = fbPolySegment16; break; case 32: seg = fbPolySegment32; break; } } } else { seg = miPolySegment; } (*seg) (pDrawable, pGC, nseg, pseg); } xorg-server-1.20.8/fb/fbscreen.c0000644000175000017500000001541313640201473013334 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" Bool fbCloseScreen(ScreenPtr pScreen) { int d; DepthPtr depths = pScreen->allowedDepths; fbDestroyGlyphCache(); for (d = 0; d < pScreen->numDepths; d++) free(depths[d].vids); free(depths); free(pScreen->visuals); if (pScreen->devPrivate) FreePixmap((PixmapPtr)pScreen->devPrivate); return TRUE; } Bool fbRealizeFont(ScreenPtr pScreen, FontPtr pFont) { return TRUE; } Bool fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) { return TRUE; } void fbQueryBestSize(int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen) { unsigned short w; switch (class) { case CursorShape: if (*width > pScreen->width) *width = pScreen->width; if (*height > pScreen->height) *height = pScreen->height; break; case TileShape: case StippleShape: w = *width; if ((w & (w - 1)) && w < FB_UNIT) { for (w = 1; w < *width; w <<= 1); *width = w; } } } PixmapPtr _fbGetWindowPixmap(WindowPtr pWindow) { return fbGetWindowPixmap(pWindow); } void _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap) { dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(pWindow), pPixmap); } Bool fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ int dpiy, int width, /* pixel width of frame buffer */ int bpp) { /* bits per pixel for screen */ if (!fbAllocatePrivates(pScreen)) return FALSE; pScreen->defColormap = FakeClientID(0); /* let CreateDefColormap do whatever it wants for pixels */ pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; pScreen->QueryBestSize = fbQueryBestSize; /* SaveScreen */ pScreen->GetImage = fbGetImage; pScreen->GetSpans = fbGetSpans; pScreen->CreateWindow = fbCreateWindow; pScreen->DestroyWindow = fbDestroyWindow; pScreen->PositionWindow = fbPositionWindow; pScreen->ChangeWindowAttributes = fbChangeWindowAttributes; pScreen->RealizeWindow = fbRealizeWindow; pScreen->UnrealizeWindow = fbUnrealizeWindow; pScreen->CopyWindow = fbCopyWindow; pScreen->CreatePixmap = fbCreatePixmap; pScreen->DestroyPixmap = fbDestroyPixmap; pScreen->RealizeFont = fbRealizeFont; pScreen->UnrealizeFont = fbUnrealizeFont; pScreen->CreateGC = fbCreateGC; pScreen->CreateColormap = fbInitializeColormap; pScreen->DestroyColormap = (void (*)(ColormapPtr)) NoopDDA; pScreen->InstallColormap = fbInstallColormap; pScreen->UninstallColormap = fbUninstallColormap; pScreen->ListInstalledColormaps = fbListInstalledColormaps; pScreen->StoreColors = (void (*)(ColormapPtr, int, xColorItem *)) NoopDDA; pScreen->ResolveColor = fbResolveColor; pScreen->BitmapToRegion = fbPixmapToRegion; pScreen->GetWindowPixmap = _fbGetWindowPixmap; pScreen->SetWindowPixmap = _fbSetWindowPixmap; return TRUE; } #ifdef FB_ACCESS_WRAPPER Bool wfbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap) #else Bool fbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp) #endif { VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int rootdepth; VisualID defaultVisual; #ifdef FB_DEBUG int stride; ysize -= 2; stride = (width * bpp) / 8; fbSetBits((FbStip *) pbits, stride / sizeof(FbStip), FB_HEAD_BITS); pbits = (void *) ((char *) pbits + stride); fbSetBits((FbStip *) ((char *) pbits + stride * ysize), stride / sizeof(FbStip), FB_TAIL_BITS); #endif /* fb requires power-of-two bpp */ if (Ones(bpp) != 1) return FALSE; #ifdef FB_ACCESS_WRAPPER fbGetScreenPrivate(pScreen)->setupWrap = setupWrap; fbGetScreenPrivate(pScreen)->finishWrap = finishWrap; #endif rootdepth = 0; if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual, ((unsigned long) 1 << (bpp - 1)), 8)) return FALSE; if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, defaultVisual, nvisuals, visuals)) return FALSE; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbCloseScreen; return TRUE; } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ #ifdef FB_ACCESS_WRAPPER Bool wfbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap) { if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)) return FALSE; if (!wfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, setupWrap, finishWrap)) return FALSE; return TRUE; } #else Bool fbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp) { if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)) return FALSE; if (!fbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)) return FALSE; return TRUE; } #endif xorg-server-1.20.8/fb/fbsetsp.c0000644000175000017500000000543313640201473013214 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" void fbSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); RegionPtr pClip = fbGetCompositeClip(pGC); FbBits *dst, *d, *s; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxPtr pbox; int n; int xoff; int x1, x2; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nspans--) { d = dst + (ppt->y + dstYoff) * dstStride; xoff = (int) (((long) src) & (FB_MASK >> 3)); s = (FbBits *) (src - xoff); xoff <<= 3; n = RegionNumRects(pClip); pbox = RegionRects(pClip); while (n--) { if (pbox->y1 > ppt->y) break; if (pbox->y2 > ppt->y) { x1 = ppt->x; x2 = x1 + *pwidth; if (pbox->x1 > x1) x1 = pbox->x1; if (pbox->x2 < x2) x2 = pbox->x2; if (x1 < x2) fbBlt((FbBits *) s, 0, (x1 - ppt->x) * dstBpp + xoff, d, dstStride, (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, 1, pGC->alu, pPriv->pm, dstBpp, FALSE, FALSE); } } src += PixmapBytePad(*pwidth, pDrawable->depth); ppt++; pwidth++; } fbValidateDrawable(pDrawable); fbFinishAccess(pDrawable); } xorg-server-1.20.8/fb/wfbrename.h0000644000175000017500000001136513640201473013522 00000000000000#define fbAddTraps wfbAddTraps #define fbAddTriangles wfbAddTriangles #define fbAllocatePrivates wfbAllocatePrivates #define fbArc16 wfbArc16 #define fbArc32 wfbArc32 #define fbArc8 wfbArc8 #define fbBlt wfbBlt #define fbBltOne wfbBltOne #define fbBltPlane wfbBltPlane #define fbBltStip wfbBltStip #define fbBres wfbBres #define fbBresDash wfbBresDash #define fbBresDash16 wfbBresDash16 #define fbBresDash32 wfbBresDash32 #define fbBresDash8 wfbBresDash8 #define fbBresFill wfbBresFill #define fbBresFillDash wfbBresFillDash #define fbBresSolid wfbBresSolid #define fbBresSolid16 wfbBresSolid16 #define fbBresSolid32 wfbBresSolid32 #define fbBresSolid8 wfbBresSolid8 #define fbChangeWindowAttributes wfbChangeWindowAttributes #define fbClearVisualTypes wfbClearVisualTypes #define fbCloseScreen wfbCloseScreen #define fbComposite wfbComposite #define fbCopy1toN wfbCopy1toN #define fbCopyArea wfbCopyArea #define fbCopyNto1 wfbCopyNto1 #define fbCopyNtoN wfbCopyNtoN #define fbCopyPlane wfbCopyPlane #define fbCopyRegion wfbCopyRegion #define fbCopyWindow wfbCopyWindow #define fbCopyWindowProc wfbCopyWindowProc #define fbCreateDefColormap wfbCreateDefColormap #define fbCreateGC wfbCreateGC #define fbCreatePixmap wfbCreatePixmap #define fbCreateWindow wfbCreateWindow #define fbDestroyGlyphCache wfbDestroyGlyphCache #define fbDestroyPixmap wfbDestroyPixmap #define fbDestroyWindow wfbDestroyWindow #define fbDoCopy wfbDoCopy #define fbDots wfbDots #define fbDots16 wfbDots16 #define fbDots32 wfbDots32 #define fbDots8 wfbDots8 #define fbExpandDirectColors wfbExpandDirectColors #define fbFill wfbFill #define fbFillRegionSolid wfbFillRegionSolid #define fbFillSpans wfbFillSpans #define fbFixCoordModePrevious wfbFixCoordModePrevious #define fbGCFuncs wfbGCFuncs #define fbGCOps wfbGCOps #define fbGeneration wfbGeneration #define fbGetImage wfbGetImage #define fbGetScreenPrivateKey wfbGetScreenPrivateKey #define fbGetSpans wfbGetSpans #define _fbGetWindowPixmap _wfbGetWindowPixmap #define fbGlyph16 wfbGlyph16 #define fbGlyph32 wfbGlyph32 #define fbGlyph8 wfbGlyph8 #define fbGlyphs wfbGlyphs #define fbImageGlyphBlt wfbImageGlyphBlt #define fbIn wfbIn #define fbInitializeColormap wfbInitializeColormap #define fbInitVisuals wfbInitVisuals #define fbListInstalledColormaps wfbListInstalledColormaps #define FbMergeRopBits wFbMergeRopBits #define fbOver wfbOver #define fbOverlayCloseScreen wfbOverlayCloseScreen #define fbOverlayCopyWindow wfbOverlayCopyWindow #define fbOverlayCreateScreenResources wfbOverlayCreateScreenResources #define fbOverlayCreateWindow wfbOverlayCreateWindow #define fbOverlayFinishScreenInit wfbOverlayFinishScreenInit #define fbOverlayGeneration wfbOverlayGeneration #define fbOverlayGetScreenPrivateKey wfbOverlayGetScreenPrivateKey #define fbOverlayPaintKey wfbOverlayPaintKey #define fbOverlaySetupScreen wfbOverlaySetupScreen #define fbOverlayUpdateLayerRegion wfbOverlayUpdateLayerRegion #define fbOverlayWindowExposures wfbOverlayWindowExposures #define fbOverlayWindowLayer wfbOverlayWindowLayer #define fbPadPixmap wfbPadPixmap #define fbPictureInit wfbPictureInit #define fbPixmapToRegion wfbPixmapToRegion #define fbPolyArc wfbPolyArc #define fbPolyFillRect wfbPolyFillRect #define fbPolyGlyphBlt wfbPolyGlyphBlt #define fbPolyLine wfbPolyLine #define fbPolyline16 wfbPolyline16 #define fbPolyline32 wfbPolyline32 #define fbPolyline8 wfbPolyline8 #define fbPolyPoint wfbPolyPoint #define fbPolySegment wfbPolySegment #define fbPolySegment16 wfbPolySegment16 #define fbPolySegment32 wfbPolySegment32 #define fbPolySegment8 wfbPolySegment8 #define fbPositionWindow wfbPositionWindow #define fbPushFill wfbPushFill #define fbPushImage wfbPushImage #define fbPushPattern wfbPushPattern #define fbPushPixels wfbPushPixels #define fbPutImage wfbPutImage #define fbPutXYImage wfbPutXYImage #define fbPutZImage wfbPutZImage #define fbQueryBestSize wfbQueryBestSize #define fbRasterizeTrapezoid wfbRasterizeTrapezoid #define fbRealizeFont wfbRealizeFont #define fbReplicatePixel wfbReplicatePixel #define fbResolveColor wfbResolveColor #define fbScreenPrivateKeyRec wfbScreenPrivateKeyRec #define fbSegment wfbSegment #define fbSelectBres wfbSelectBres #define fbSetSpans wfbSetSpans #define fbSetupScreen wfbSetupScreen #define fbSetVisualTypes wfbSetVisualTypes #define fbSetVisualTypesAndMasks wfbSetVisualTypesAndMasks #define _fbSetWindowPixmap _wfbSetWindowPixmap #define fbSolid wfbSolid #define fbSolidBoxClipped wfbSolidBoxClipped #define fbTrapezoids wfbTrapezoids #define fbTriangles wfbTriangles #define fbUninstallColormap wfbUninstallColormap #define fbUnrealizeWindow wfbUnrealizeWindow #define fbUnrealizeFont wfbUnrealizeFont #define fbValidateGC wfbValidateGC #define fbWinPrivateKeyRec wfbWinPrivateKeyRec #define free_pixman_pict wfb_free_pixman_pict #define image_from_pict wfb_image_from_pict xorg-server-1.20.8/fb/Makefile.in0000644000175000017500000027662413640201511013454 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = fb ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libfb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libfb_la_OBJECTS = libfb_la-fballpriv.lo libfb_la-fbarc.lo \ libfb_la-fbbits.lo libfb_la-fbblt.lo libfb_la-fbbltone.lo \ libfb_la-fbcmap_mi.lo libfb_la-fbcopy.lo libfb_la-fbfill.lo \ libfb_la-fbfillrect.lo libfb_la-fbfillsp.lo libfb_la-fbgc.lo \ libfb_la-fbgetsp.lo libfb_la-fbglyph.lo libfb_la-fbimage.lo \ libfb_la-fbline.lo libfb_la-fboverlay.lo libfb_la-fbpict.lo \ libfb_la-fbpixmap.lo libfb_la-fbpoint.lo libfb_la-fbpush.lo \ libfb_la-fbscreen.lo libfb_la-fbseg.lo libfb_la-fbsetsp.lo \ libfb_la-fbsolid.lo libfb_la-fbtrap.lo libfb_la-fbutil.lo \ libfb_la-fbwindow.lo libfb_la_OBJECTS = $(am_libfb_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libfb_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libwfb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__objects_1 = libwfb_la-fballpriv.lo libwfb_la-fbarc.lo \ libwfb_la-fbbits.lo libwfb_la-fbblt.lo libwfb_la-fbbltone.lo \ libwfb_la-fbcmap_mi.lo libwfb_la-fbcopy.lo libwfb_la-fbfill.lo \ libwfb_la-fbfillrect.lo libwfb_la-fbfillsp.lo \ libwfb_la-fbgc.lo libwfb_la-fbgetsp.lo libwfb_la-fbglyph.lo \ libwfb_la-fbimage.lo libwfb_la-fbline.lo \ libwfb_la-fboverlay.lo libwfb_la-fbpict.lo \ libwfb_la-fbpixmap.lo libwfb_la-fbpoint.lo libwfb_la-fbpush.lo \ libwfb_la-fbscreen.lo libwfb_la-fbseg.lo libwfb_la-fbsetsp.lo \ libwfb_la-fbsolid.lo libwfb_la-fbtrap.lo libwfb_la-fbutil.lo \ libwfb_la-fbwindow.lo am_libwfb_la_OBJECTS = $(am__objects_1) libwfb_la_OBJECTS = $(am_libwfb_la_OBJECTS) libwfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwfb_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/libfb_la-fballpriv.Plo \ ./$(DEPDIR)/libfb_la-fbarc.Plo ./$(DEPDIR)/libfb_la-fbbits.Plo \ ./$(DEPDIR)/libfb_la-fbblt.Plo \ ./$(DEPDIR)/libfb_la-fbbltone.Plo \ ./$(DEPDIR)/libfb_la-fbcmap_mi.Plo \ ./$(DEPDIR)/libfb_la-fbcopy.Plo \ ./$(DEPDIR)/libfb_la-fbfill.Plo \ ./$(DEPDIR)/libfb_la-fbfillrect.Plo \ ./$(DEPDIR)/libfb_la-fbfillsp.Plo \ ./$(DEPDIR)/libfb_la-fbgc.Plo ./$(DEPDIR)/libfb_la-fbgetsp.Plo \ ./$(DEPDIR)/libfb_la-fbglyph.Plo \ ./$(DEPDIR)/libfb_la-fbimage.Plo \ ./$(DEPDIR)/libfb_la-fbline.Plo \ ./$(DEPDIR)/libfb_la-fboverlay.Plo \ ./$(DEPDIR)/libfb_la-fbpict.Plo \ ./$(DEPDIR)/libfb_la-fbpixmap.Plo \ ./$(DEPDIR)/libfb_la-fbpoint.Plo \ ./$(DEPDIR)/libfb_la-fbpush.Plo \ ./$(DEPDIR)/libfb_la-fbscreen.Plo \ ./$(DEPDIR)/libfb_la-fbseg.Plo \ ./$(DEPDIR)/libfb_la-fbsetsp.Plo \ ./$(DEPDIR)/libfb_la-fbsolid.Plo \ ./$(DEPDIR)/libfb_la-fbtrap.Plo \ ./$(DEPDIR)/libfb_la-fbutil.Plo \ ./$(DEPDIR)/libfb_la-fbwindow.Plo \ ./$(DEPDIR)/libwfb_la-fballpriv.Plo \ ./$(DEPDIR)/libwfb_la-fbarc.Plo \ ./$(DEPDIR)/libwfb_la-fbbits.Plo \ ./$(DEPDIR)/libwfb_la-fbblt.Plo \ ./$(DEPDIR)/libwfb_la-fbbltone.Plo \ ./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo \ ./$(DEPDIR)/libwfb_la-fbcopy.Plo \ ./$(DEPDIR)/libwfb_la-fbfill.Plo \ ./$(DEPDIR)/libwfb_la-fbfillrect.Plo \ ./$(DEPDIR)/libwfb_la-fbfillsp.Plo \ ./$(DEPDIR)/libwfb_la-fbgc.Plo \ ./$(DEPDIR)/libwfb_la-fbgetsp.Plo \ ./$(DEPDIR)/libwfb_la-fbglyph.Plo \ ./$(DEPDIR)/libwfb_la-fbimage.Plo \ ./$(DEPDIR)/libwfb_la-fbline.Plo \ ./$(DEPDIR)/libwfb_la-fboverlay.Plo \ ./$(DEPDIR)/libwfb_la-fbpict.Plo \ ./$(DEPDIR)/libwfb_la-fbpixmap.Plo \ ./$(DEPDIR)/libwfb_la-fbpoint.Plo \ ./$(DEPDIR)/libwfb_la-fbpush.Plo \ ./$(DEPDIR)/libwfb_la-fbscreen.Plo \ ./$(DEPDIR)/libwfb_la-fbseg.Plo \ ./$(DEPDIR)/libwfb_la-fbsetsp.Plo \ ./$(DEPDIR)/libwfb_la-fbsolid.Plo \ ./$(DEPDIR)/libwfb_la-fbtrap.Plo \ ./$(DEPDIR)/libwfb_la-fbutil.Plo \ ./$(DEPDIR)/libwfb_la-fbwindow.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libfb_la_SOURCES) $(libwfb_la_SOURCES) DIST_SOURCES = $(libfb_la_SOURCES) $(libwfb_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__sdk_HEADERS_DIST = fb.h fbrop.h fboverlay.h wfbrename.h fbpict.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libfb.la libwfb.la AM_CFLAGS = $(DIX_CFLAGS) @XORG_TRUE@sdk_HEADERS = fb.h fbrop.h fboverlay.h wfbrename.h fbpict.h libfb_la_CFLAGS = $(AM_CFLAGS) libfb_la_LIBADD = $(PIXMAN_LIBS) libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libwfb_la_LIBADD = $(PIXMAN_LIBS) libfb_la_SOURCES = \ fb.h \ fballpriv.c \ fbarc.c \ fbbits.c \ fbbits.h \ fbblt.c \ fbbltone.c \ fbcmap_mi.c \ fbcopy.c \ fbfill.c \ fbfillrect.c \ fbfillsp.c \ fbgc.c \ fbgetsp.c \ fbglyph.c \ fbimage.c \ fbline.c \ fboverlay.c \ fboverlay.h \ fbpict.c \ fbpict.h \ fbpixmap.c \ fbpoint.c \ fbpush.c \ fbrop.h \ fbscreen.c \ fbseg.c \ fbsetsp.c \ fbsolid.c \ fbtrap.c \ fbutil.c \ fbwindow.c libwfb_la_SOURCES = $(libfb_la_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign fb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign fb/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libfb.la: $(libfb_la_OBJECTS) $(libfb_la_DEPENDENCIES) $(EXTRA_libfb_la_DEPENDENCIES) $(AM_V_CCLD)$(libfb_la_LINK) $(libfb_la_OBJECTS) $(libfb_la_LIBADD) $(LIBS) libwfb.la: $(libwfb_la_OBJECTS) $(libwfb_la_DEPENDENCIES) $(EXTRA_libwfb_la_DEPENDENCIES) $(AM_V_CCLD)$(libwfb_la_LINK) $(libwfb_la_OBJECTS) $(libwfb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fballpriv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbarc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbbits.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbblt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbbltone.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcmap_mi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcopy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbfill.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbfillrect.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbfillsp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbgc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbgetsp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbglyph.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbimage.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbline.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fboverlay.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbpict.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbpixmap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbpoint.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbpush.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbscreen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbseg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbsetsp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbsolid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbtrap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbutil.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbwindow.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fballpriv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbarc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbbits.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbblt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbbltone.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcopy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbfill.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbfillrect.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbfillsp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbgc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbgetsp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbglyph.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbimage.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbline.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fboverlay.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbpict.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbpixmap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbpoint.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbpush.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbscreen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbseg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbsetsp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbsolid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbtrap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbutil.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbwindow.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libfb_la-fballpriv.lo: fballpriv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fballpriv.lo -MD -MP -MF $(DEPDIR)/libfb_la-fballpriv.Tpo -c -o libfb_la-fballpriv.lo `test -f 'fballpriv.c' || echo '$(srcdir)/'`fballpriv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fballpriv.Tpo $(DEPDIR)/libfb_la-fballpriv.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fballpriv.c' object='libfb_la-fballpriv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fballpriv.lo `test -f 'fballpriv.c' || echo '$(srcdir)/'`fballpriv.c libfb_la-fbarc.lo: fbarc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbarc.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbarc.Tpo -c -o libfb_la-fbarc.lo `test -f 'fbarc.c' || echo '$(srcdir)/'`fbarc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbarc.Tpo $(DEPDIR)/libfb_la-fbarc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbarc.c' object='libfb_la-fbarc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbarc.lo `test -f 'fbarc.c' || echo '$(srcdir)/'`fbarc.c libfb_la-fbbits.lo: fbbits.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbbits.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbbits.Tpo -c -o libfb_la-fbbits.lo `test -f 'fbbits.c' || echo '$(srcdir)/'`fbbits.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbbits.Tpo $(DEPDIR)/libfb_la-fbbits.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbbits.c' object='libfb_la-fbbits.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbbits.lo `test -f 'fbbits.c' || echo '$(srcdir)/'`fbbits.c libfb_la-fbblt.lo: fbblt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbblt.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbblt.Tpo -c -o libfb_la-fbblt.lo `test -f 'fbblt.c' || echo '$(srcdir)/'`fbblt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbblt.Tpo $(DEPDIR)/libfb_la-fbblt.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbblt.c' object='libfb_la-fbblt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbblt.lo `test -f 'fbblt.c' || echo '$(srcdir)/'`fbblt.c libfb_la-fbbltone.lo: fbbltone.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbbltone.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbbltone.Tpo -c -o libfb_la-fbbltone.lo `test -f 'fbbltone.c' || echo '$(srcdir)/'`fbbltone.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbbltone.Tpo $(DEPDIR)/libfb_la-fbbltone.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbbltone.c' object='libfb_la-fbbltone.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbbltone.lo `test -f 'fbbltone.c' || echo '$(srcdir)/'`fbbltone.c libfb_la-fbcmap_mi.lo: fbcmap_mi.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbcmap_mi.Tpo -c -o libfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbcmap_mi.Tpo $(DEPDIR)/libfb_la-fbcmap_mi.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbcmap_mi.c' object='libfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c libfb_la-fbcopy.lo: fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbcopy.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbcopy.Tpo -c -o libfb_la-fbcopy.lo `test -f 'fbcopy.c' || echo '$(srcdir)/'`fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbcopy.Tpo $(DEPDIR)/libfb_la-fbcopy.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbcopy.c' object='libfb_la-fbcopy.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbcopy.lo `test -f 'fbcopy.c' || echo '$(srcdir)/'`fbcopy.c libfb_la-fbfill.lo: fbfill.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbfill.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbfill.Tpo -c -o libfb_la-fbfill.lo `test -f 'fbfill.c' || echo '$(srcdir)/'`fbfill.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbfill.Tpo $(DEPDIR)/libfb_la-fbfill.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbfill.c' object='libfb_la-fbfill.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbfill.lo `test -f 'fbfill.c' || echo '$(srcdir)/'`fbfill.c libfb_la-fbfillrect.lo: fbfillrect.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbfillrect.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbfillrect.Tpo -c -o libfb_la-fbfillrect.lo `test -f 'fbfillrect.c' || echo '$(srcdir)/'`fbfillrect.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbfillrect.Tpo $(DEPDIR)/libfb_la-fbfillrect.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbfillrect.c' object='libfb_la-fbfillrect.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbfillrect.lo `test -f 'fbfillrect.c' || echo '$(srcdir)/'`fbfillrect.c libfb_la-fbfillsp.lo: fbfillsp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbfillsp.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbfillsp.Tpo -c -o libfb_la-fbfillsp.lo `test -f 'fbfillsp.c' || echo '$(srcdir)/'`fbfillsp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbfillsp.Tpo $(DEPDIR)/libfb_la-fbfillsp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbfillsp.c' object='libfb_la-fbfillsp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbfillsp.lo `test -f 'fbfillsp.c' || echo '$(srcdir)/'`fbfillsp.c libfb_la-fbgc.lo: fbgc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbgc.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbgc.Tpo -c -o libfb_la-fbgc.lo `test -f 'fbgc.c' || echo '$(srcdir)/'`fbgc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbgc.Tpo $(DEPDIR)/libfb_la-fbgc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbgc.c' object='libfb_la-fbgc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbgc.lo `test -f 'fbgc.c' || echo '$(srcdir)/'`fbgc.c libfb_la-fbgetsp.lo: fbgetsp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbgetsp.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbgetsp.Tpo -c -o libfb_la-fbgetsp.lo `test -f 'fbgetsp.c' || echo '$(srcdir)/'`fbgetsp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbgetsp.Tpo $(DEPDIR)/libfb_la-fbgetsp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbgetsp.c' object='libfb_la-fbgetsp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbgetsp.lo `test -f 'fbgetsp.c' || echo '$(srcdir)/'`fbgetsp.c libfb_la-fbglyph.lo: fbglyph.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbglyph.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbglyph.Tpo -c -o libfb_la-fbglyph.lo `test -f 'fbglyph.c' || echo '$(srcdir)/'`fbglyph.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbglyph.Tpo $(DEPDIR)/libfb_la-fbglyph.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbglyph.c' object='libfb_la-fbglyph.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbglyph.lo `test -f 'fbglyph.c' || echo '$(srcdir)/'`fbglyph.c libfb_la-fbimage.lo: fbimage.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbimage.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbimage.Tpo -c -o libfb_la-fbimage.lo `test -f 'fbimage.c' || echo '$(srcdir)/'`fbimage.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbimage.Tpo $(DEPDIR)/libfb_la-fbimage.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbimage.c' object='libfb_la-fbimage.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbimage.lo `test -f 'fbimage.c' || echo '$(srcdir)/'`fbimage.c libfb_la-fbline.lo: fbline.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbline.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbline.Tpo -c -o libfb_la-fbline.lo `test -f 'fbline.c' || echo '$(srcdir)/'`fbline.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbline.Tpo $(DEPDIR)/libfb_la-fbline.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbline.c' object='libfb_la-fbline.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbline.lo `test -f 'fbline.c' || echo '$(srcdir)/'`fbline.c libfb_la-fboverlay.lo: fboverlay.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fboverlay.lo -MD -MP -MF $(DEPDIR)/libfb_la-fboverlay.Tpo -c -o libfb_la-fboverlay.lo `test -f 'fboverlay.c' || echo '$(srcdir)/'`fboverlay.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fboverlay.Tpo $(DEPDIR)/libfb_la-fboverlay.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fboverlay.c' object='libfb_la-fboverlay.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fboverlay.lo `test -f 'fboverlay.c' || echo '$(srcdir)/'`fboverlay.c libfb_la-fbpict.lo: fbpict.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbpict.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbpict.Tpo -c -o libfb_la-fbpict.lo `test -f 'fbpict.c' || echo '$(srcdir)/'`fbpict.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbpict.Tpo $(DEPDIR)/libfb_la-fbpict.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpict.c' object='libfb_la-fbpict.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbpict.lo `test -f 'fbpict.c' || echo '$(srcdir)/'`fbpict.c libfb_la-fbpixmap.lo: fbpixmap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbpixmap.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbpixmap.Tpo -c -o libfb_la-fbpixmap.lo `test -f 'fbpixmap.c' || echo '$(srcdir)/'`fbpixmap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbpixmap.Tpo $(DEPDIR)/libfb_la-fbpixmap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpixmap.c' object='libfb_la-fbpixmap.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbpixmap.lo `test -f 'fbpixmap.c' || echo '$(srcdir)/'`fbpixmap.c libfb_la-fbpoint.lo: fbpoint.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbpoint.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbpoint.Tpo -c -o libfb_la-fbpoint.lo `test -f 'fbpoint.c' || echo '$(srcdir)/'`fbpoint.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbpoint.Tpo $(DEPDIR)/libfb_la-fbpoint.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpoint.c' object='libfb_la-fbpoint.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbpoint.lo `test -f 'fbpoint.c' || echo '$(srcdir)/'`fbpoint.c libfb_la-fbpush.lo: fbpush.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbpush.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbpush.Tpo -c -o libfb_la-fbpush.lo `test -f 'fbpush.c' || echo '$(srcdir)/'`fbpush.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbpush.Tpo $(DEPDIR)/libfb_la-fbpush.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpush.c' object='libfb_la-fbpush.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbpush.lo `test -f 'fbpush.c' || echo '$(srcdir)/'`fbpush.c libfb_la-fbscreen.lo: fbscreen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbscreen.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbscreen.Tpo -c -o libfb_la-fbscreen.lo `test -f 'fbscreen.c' || echo '$(srcdir)/'`fbscreen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbscreen.Tpo $(DEPDIR)/libfb_la-fbscreen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbscreen.c' object='libfb_la-fbscreen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbscreen.lo `test -f 'fbscreen.c' || echo '$(srcdir)/'`fbscreen.c libfb_la-fbseg.lo: fbseg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbseg.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbseg.Tpo -c -o libfb_la-fbseg.lo `test -f 'fbseg.c' || echo '$(srcdir)/'`fbseg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbseg.Tpo $(DEPDIR)/libfb_la-fbseg.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbseg.c' object='libfb_la-fbseg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbseg.lo `test -f 'fbseg.c' || echo '$(srcdir)/'`fbseg.c libfb_la-fbsetsp.lo: fbsetsp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbsetsp.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbsetsp.Tpo -c -o libfb_la-fbsetsp.lo `test -f 'fbsetsp.c' || echo '$(srcdir)/'`fbsetsp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbsetsp.Tpo $(DEPDIR)/libfb_la-fbsetsp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbsetsp.c' object='libfb_la-fbsetsp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbsetsp.lo `test -f 'fbsetsp.c' || echo '$(srcdir)/'`fbsetsp.c libfb_la-fbsolid.lo: fbsolid.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbsolid.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbsolid.Tpo -c -o libfb_la-fbsolid.lo `test -f 'fbsolid.c' || echo '$(srcdir)/'`fbsolid.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbsolid.Tpo $(DEPDIR)/libfb_la-fbsolid.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbsolid.c' object='libfb_la-fbsolid.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbsolid.lo `test -f 'fbsolid.c' || echo '$(srcdir)/'`fbsolid.c libfb_la-fbtrap.lo: fbtrap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbtrap.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbtrap.Tpo -c -o libfb_la-fbtrap.lo `test -f 'fbtrap.c' || echo '$(srcdir)/'`fbtrap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbtrap.Tpo $(DEPDIR)/libfb_la-fbtrap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbtrap.c' object='libfb_la-fbtrap.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbtrap.lo `test -f 'fbtrap.c' || echo '$(srcdir)/'`fbtrap.c libfb_la-fbutil.lo: fbutil.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbutil.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbutil.Tpo -c -o libfb_la-fbutil.lo `test -f 'fbutil.c' || echo '$(srcdir)/'`fbutil.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbutil.Tpo $(DEPDIR)/libfb_la-fbutil.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbutil.c' object='libfb_la-fbutil.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbutil.lo `test -f 'fbutil.c' || echo '$(srcdir)/'`fbutil.c libfb_la-fbwindow.lo: fbwindow.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbwindow.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbwindow.Tpo -c -o libfb_la-fbwindow.lo `test -f 'fbwindow.c' || echo '$(srcdir)/'`fbwindow.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbwindow.Tpo $(DEPDIR)/libfb_la-fbwindow.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbwindow.c' object='libfb_la-fbwindow.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbwindow.lo `test -f 'fbwindow.c' || echo '$(srcdir)/'`fbwindow.c libwfb_la-fballpriv.lo: fballpriv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fballpriv.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fballpriv.Tpo -c -o libwfb_la-fballpriv.lo `test -f 'fballpriv.c' || echo '$(srcdir)/'`fballpriv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fballpriv.Tpo $(DEPDIR)/libwfb_la-fballpriv.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fballpriv.c' object='libwfb_la-fballpriv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fballpriv.lo `test -f 'fballpriv.c' || echo '$(srcdir)/'`fballpriv.c libwfb_la-fbarc.lo: fbarc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbarc.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbarc.Tpo -c -o libwfb_la-fbarc.lo `test -f 'fbarc.c' || echo '$(srcdir)/'`fbarc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbarc.Tpo $(DEPDIR)/libwfb_la-fbarc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbarc.c' object='libwfb_la-fbarc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbarc.lo `test -f 'fbarc.c' || echo '$(srcdir)/'`fbarc.c libwfb_la-fbbits.lo: fbbits.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbbits.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbbits.Tpo -c -o libwfb_la-fbbits.lo `test -f 'fbbits.c' || echo '$(srcdir)/'`fbbits.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbbits.Tpo $(DEPDIR)/libwfb_la-fbbits.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbbits.c' object='libwfb_la-fbbits.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbbits.lo `test -f 'fbbits.c' || echo '$(srcdir)/'`fbbits.c libwfb_la-fbblt.lo: fbblt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbblt.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbblt.Tpo -c -o libwfb_la-fbblt.lo `test -f 'fbblt.c' || echo '$(srcdir)/'`fbblt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbblt.Tpo $(DEPDIR)/libwfb_la-fbblt.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbblt.c' object='libwfb_la-fbblt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbblt.lo `test -f 'fbblt.c' || echo '$(srcdir)/'`fbblt.c libwfb_la-fbbltone.lo: fbbltone.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbbltone.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbbltone.Tpo -c -o libwfb_la-fbbltone.lo `test -f 'fbbltone.c' || echo '$(srcdir)/'`fbbltone.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbbltone.Tpo $(DEPDIR)/libwfb_la-fbbltone.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbbltone.c' object='libwfb_la-fbbltone.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbbltone.lo `test -f 'fbbltone.c' || echo '$(srcdir)/'`fbbltone.c libwfb_la-fbcmap_mi.lo: fbcmap_mi.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo -c -o libwfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo $(DEPDIR)/libwfb_la-fbcmap_mi.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbcmap_mi.c' object='libwfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c libwfb_la-fbcopy.lo: fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbcopy.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbcopy.Tpo -c -o libwfb_la-fbcopy.lo `test -f 'fbcopy.c' || echo '$(srcdir)/'`fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbcopy.Tpo $(DEPDIR)/libwfb_la-fbcopy.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbcopy.c' object='libwfb_la-fbcopy.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbcopy.lo `test -f 'fbcopy.c' || echo '$(srcdir)/'`fbcopy.c libwfb_la-fbfill.lo: fbfill.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbfill.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbfill.Tpo -c -o libwfb_la-fbfill.lo `test -f 'fbfill.c' || echo '$(srcdir)/'`fbfill.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbfill.Tpo $(DEPDIR)/libwfb_la-fbfill.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbfill.c' object='libwfb_la-fbfill.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbfill.lo `test -f 'fbfill.c' || echo '$(srcdir)/'`fbfill.c libwfb_la-fbfillrect.lo: fbfillrect.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbfillrect.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbfillrect.Tpo -c -o libwfb_la-fbfillrect.lo `test -f 'fbfillrect.c' || echo '$(srcdir)/'`fbfillrect.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbfillrect.Tpo $(DEPDIR)/libwfb_la-fbfillrect.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbfillrect.c' object='libwfb_la-fbfillrect.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbfillrect.lo `test -f 'fbfillrect.c' || echo '$(srcdir)/'`fbfillrect.c libwfb_la-fbfillsp.lo: fbfillsp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbfillsp.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbfillsp.Tpo -c -o libwfb_la-fbfillsp.lo `test -f 'fbfillsp.c' || echo '$(srcdir)/'`fbfillsp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbfillsp.Tpo $(DEPDIR)/libwfb_la-fbfillsp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbfillsp.c' object='libwfb_la-fbfillsp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbfillsp.lo `test -f 'fbfillsp.c' || echo '$(srcdir)/'`fbfillsp.c libwfb_la-fbgc.lo: fbgc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbgc.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbgc.Tpo -c -o libwfb_la-fbgc.lo `test -f 'fbgc.c' || echo '$(srcdir)/'`fbgc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbgc.Tpo $(DEPDIR)/libwfb_la-fbgc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbgc.c' object='libwfb_la-fbgc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbgc.lo `test -f 'fbgc.c' || echo '$(srcdir)/'`fbgc.c libwfb_la-fbgetsp.lo: fbgetsp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbgetsp.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbgetsp.Tpo -c -o libwfb_la-fbgetsp.lo `test -f 'fbgetsp.c' || echo '$(srcdir)/'`fbgetsp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbgetsp.Tpo $(DEPDIR)/libwfb_la-fbgetsp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbgetsp.c' object='libwfb_la-fbgetsp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbgetsp.lo `test -f 'fbgetsp.c' || echo '$(srcdir)/'`fbgetsp.c libwfb_la-fbglyph.lo: fbglyph.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbglyph.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbglyph.Tpo -c -o libwfb_la-fbglyph.lo `test -f 'fbglyph.c' || echo '$(srcdir)/'`fbglyph.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbglyph.Tpo $(DEPDIR)/libwfb_la-fbglyph.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbglyph.c' object='libwfb_la-fbglyph.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbglyph.lo `test -f 'fbglyph.c' || echo '$(srcdir)/'`fbglyph.c libwfb_la-fbimage.lo: fbimage.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbimage.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbimage.Tpo -c -o libwfb_la-fbimage.lo `test -f 'fbimage.c' || echo '$(srcdir)/'`fbimage.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbimage.Tpo $(DEPDIR)/libwfb_la-fbimage.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbimage.c' object='libwfb_la-fbimage.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbimage.lo `test -f 'fbimage.c' || echo '$(srcdir)/'`fbimage.c libwfb_la-fbline.lo: fbline.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbline.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbline.Tpo -c -o libwfb_la-fbline.lo `test -f 'fbline.c' || echo '$(srcdir)/'`fbline.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbline.Tpo $(DEPDIR)/libwfb_la-fbline.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbline.c' object='libwfb_la-fbline.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbline.lo `test -f 'fbline.c' || echo '$(srcdir)/'`fbline.c libwfb_la-fboverlay.lo: fboverlay.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fboverlay.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fboverlay.Tpo -c -o libwfb_la-fboverlay.lo `test -f 'fboverlay.c' || echo '$(srcdir)/'`fboverlay.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fboverlay.Tpo $(DEPDIR)/libwfb_la-fboverlay.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fboverlay.c' object='libwfb_la-fboverlay.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fboverlay.lo `test -f 'fboverlay.c' || echo '$(srcdir)/'`fboverlay.c libwfb_la-fbpict.lo: fbpict.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbpict.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbpict.Tpo -c -o libwfb_la-fbpict.lo `test -f 'fbpict.c' || echo '$(srcdir)/'`fbpict.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbpict.Tpo $(DEPDIR)/libwfb_la-fbpict.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpict.c' object='libwfb_la-fbpict.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbpict.lo `test -f 'fbpict.c' || echo '$(srcdir)/'`fbpict.c libwfb_la-fbpixmap.lo: fbpixmap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbpixmap.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbpixmap.Tpo -c -o libwfb_la-fbpixmap.lo `test -f 'fbpixmap.c' || echo '$(srcdir)/'`fbpixmap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbpixmap.Tpo $(DEPDIR)/libwfb_la-fbpixmap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpixmap.c' object='libwfb_la-fbpixmap.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbpixmap.lo `test -f 'fbpixmap.c' || echo '$(srcdir)/'`fbpixmap.c libwfb_la-fbpoint.lo: fbpoint.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbpoint.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbpoint.Tpo -c -o libwfb_la-fbpoint.lo `test -f 'fbpoint.c' || echo '$(srcdir)/'`fbpoint.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbpoint.Tpo $(DEPDIR)/libwfb_la-fbpoint.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpoint.c' object='libwfb_la-fbpoint.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbpoint.lo `test -f 'fbpoint.c' || echo '$(srcdir)/'`fbpoint.c libwfb_la-fbpush.lo: fbpush.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbpush.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbpush.Tpo -c -o libwfb_la-fbpush.lo `test -f 'fbpush.c' || echo '$(srcdir)/'`fbpush.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbpush.Tpo $(DEPDIR)/libwfb_la-fbpush.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbpush.c' object='libwfb_la-fbpush.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbpush.lo `test -f 'fbpush.c' || echo '$(srcdir)/'`fbpush.c libwfb_la-fbscreen.lo: fbscreen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbscreen.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbscreen.Tpo -c -o libwfb_la-fbscreen.lo `test -f 'fbscreen.c' || echo '$(srcdir)/'`fbscreen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbscreen.Tpo $(DEPDIR)/libwfb_la-fbscreen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbscreen.c' object='libwfb_la-fbscreen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbscreen.lo `test -f 'fbscreen.c' || echo '$(srcdir)/'`fbscreen.c libwfb_la-fbseg.lo: fbseg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbseg.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbseg.Tpo -c -o libwfb_la-fbseg.lo `test -f 'fbseg.c' || echo '$(srcdir)/'`fbseg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbseg.Tpo $(DEPDIR)/libwfb_la-fbseg.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbseg.c' object='libwfb_la-fbseg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbseg.lo `test -f 'fbseg.c' || echo '$(srcdir)/'`fbseg.c libwfb_la-fbsetsp.lo: fbsetsp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbsetsp.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbsetsp.Tpo -c -o libwfb_la-fbsetsp.lo `test -f 'fbsetsp.c' || echo '$(srcdir)/'`fbsetsp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbsetsp.Tpo $(DEPDIR)/libwfb_la-fbsetsp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbsetsp.c' object='libwfb_la-fbsetsp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbsetsp.lo `test -f 'fbsetsp.c' || echo '$(srcdir)/'`fbsetsp.c libwfb_la-fbsolid.lo: fbsolid.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbsolid.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbsolid.Tpo -c -o libwfb_la-fbsolid.lo `test -f 'fbsolid.c' || echo '$(srcdir)/'`fbsolid.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbsolid.Tpo $(DEPDIR)/libwfb_la-fbsolid.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbsolid.c' object='libwfb_la-fbsolid.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbsolid.lo `test -f 'fbsolid.c' || echo '$(srcdir)/'`fbsolid.c libwfb_la-fbtrap.lo: fbtrap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbtrap.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbtrap.Tpo -c -o libwfb_la-fbtrap.lo `test -f 'fbtrap.c' || echo '$(srcdir)/'`fbtrap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbtrap.Tpo $(DEPDIR)/libwfb_la-fbtrap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbtrap.c' object='libwfb_la-fbtrap.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbtrap.lo `test -f 'fbtrap.c' || echo '$(srcdir)/'`fbtrap.c libwfb_la-fbutil.lo: fbutil.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbutil.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbutil.Tpo -c -o libwfb_la-fbutil.lo `test -f 'fbutil.c' || echo '$(srcdir)/'`fbutil.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbutil.Tpo $(DEPDIR)/libwfb_la-fbutil.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbutil.c' object='libwfb_la-fbutil.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbutil.lo `test -f 'fbutil.c' || echo '$(srcdir)/'`fbutil.c libwfb_la-fbwindow.lo: fbwindow.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbwindow.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbwindow.Tpo -c -o libwfb_la-fbwindow.lo `test -f 'fbwindow.c' || echo '$(srcdir)/'`fbwindow.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbwindow.Tpo $(DEPDIR)/libwfb_la-fbwindow.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbwindow.c' object='libwfb_la-fbwindow.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbwindow.lo `test -f 'fbwindow.c' || echo '$(srcdir)/'`fbwindow.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/libfb_la-fballpriv.Plo -rm -f ./$(DEPDIR)/libfb_la-fbarc.Plo -rm -f ./$(DEPDIR)/libfb_la-fbbits.Plo -rm -f ./$(DEPDIR)/libfb_la-fbblt.Plo -rm -f ./$(DEPDIR)/libfb_la-fbbltone.Plo -rm -f ./$(DEPDIR)/libfb_la-fbcmap_mi.Plo -rm -f ./$(DEPDIR)/libfb_la-fbcopy.Plo -rm -f ./$(DEPDIR)/libfb_la-fbfill.Plo -rm -f ./$(DEPDIR)/libfb_la-fbfillrect.Plo -rm -f ./$(DEPDIR)/libfb_la-fbfillsp.Plo -rm -f ./$(DEPDIR)/libfb_la-fbgc.Plo -rm -f ./$(DEPDIR)/libfb_la-fbgetsp.Plo -rm -f ./$(DEPDIR)/libfb_la-fbglyph.Plo -rm -f ./$(DEPDIR)/libfb_la-fbimage.Plo -rm -f ./$(DEPDIR)/libfb_la-fbline.Plo -rm -f ./$(DEPDIR)/libfb_la-fboverlay.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpict.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpixmap.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpoint.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpush.Plo -rm -f ./$(DEPDIR)/libfb_la-fbscreen.Plo -rm -f ./$(DEPDIR)/libfb_la-fbseg.Plo -rm -f ./$(DEPDIR)/libfb_la-fbsetsp.Plo -rm -f ./$(DEPDIR)/libfb_la-fbsolid.Plo -rm -f ./$(DEPDIR)/libfb_la-fbtrap.Plo -rm -f ./$(DEPDIR)/libfb_la-fbutil.Plo -rm -f ./$(DEPDIR)/libfb_la-fbwindow.Plo -rm -f ./$(DEPDIR)/libwfb_la-fballpriv.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbarc.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbbits.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbblt.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbbltone.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbcopy.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbfill.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbfillrect.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbfillsp.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbgc.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbgetsp.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbglyph.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbimage.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbline.Plo -rm -f ./$(DEPDIR)/libwfb_la-fboverlay.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpict.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpixmap.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpoint.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpush.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbscreen.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbseg.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbsetsp.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbsolid.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbtrap.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbutil.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbwindow.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libfb_la-fballpriv.Plo -rm -f ./$(DEPDIR)/libfb_la-fbarc.Plo -rm -f ./$(DEPDIR)/libfb_la-fbbits.Plo -rm -f ./$(DEPDIR)/libfb_la-fbblt.Plo -rm -f ./$(DEPDIR)/libfb_la-fbbltone.Plo -rm -f ./$(DEPDIR)/libfb_la-fbcmap_mi.Plo -rm -f ./$(DEPDIR)/libfb_la-fbcopy.Plo -rm -f ./$(DEPDIR)/libfb_la-fbfill.Plo -rm -f ./$(DEPDIR)/libfb_la-fbfillrect.Plo -rm -f ./$(DEPDIR)/libfb_la-fbfillsp.Plo -rm -f ./$(DEPDIR)/libfb_la-fbgc.Plo -rm -f ./$(DEPDIR)/libfb_la-fbgetsp.Plo -rm -f ./$(DEPDIR)/libfb_la-fbglyph.Plo -rm -f ./$(DEPDIR)/libfb_la-fbimage.Plo -rm -f ./$(DEPDIR)/libfb_la-fbline.Plo -rm -f ./$(DEPDIR)/libfb_la-fboverlay.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpict.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpixmap.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpoint.Plo -rm -f ./$(DEPDIR)/libfb_la-fbpush.Plo -rm -f ./$(DEPDIR)/libfb_la-fbscreen.Plo -rm -f ./$(DEPDIR)/libfb_la-fbseg.Plo -rm -f ./$(DEPDIR)/libfb_la-fbsetsp.Plo -rm -f ./$(DEPDIR)/libfb_la-fbsolid.Plo -rm -f ./$(DEPDIR)/libfb_la-fbtrap.Plo -rm -f ./$(DEPDIR)/libfb_la-fbutil.Plo -rm -f ./$(DEPDIR)/libfb_la-fbwindow.Plo -rm -f ./$(DEPDIR)/libwfb_la-fballpriv.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbarc.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbbits.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbblt.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbbltone.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbcopy.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbfill.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbfillrect.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbfillsp.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbgc.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbgetsp.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbglyph.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbimage.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbline.Plo -rm -f ./$(DEPDIR)/libwfb_la-fboverlay.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpict.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpixmap.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpoint.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbpush.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbscreen.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbseg.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbsetsp.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbsolid.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbtrap.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbutil.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbwindow.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/fb/fballpriv.c0000644000175000017500000000372413640201473013530 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" static DevPrivateKeyRec fbScreenPrivateKeyRec; DevPrivateKey fbGetScreenPrivateKey(void) { return &fbScreenPrivateKeyRec; } Bool fbAllocatePrivates(ScreenPtr pScreen) { FbScreenPrivPtr pScrPriv; if (!dixRegisterPrivateKey (&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(FbScreenPrivRec))) return FALSE; pScrPriv = fbGetScreenPrivate(pScreen); if (!dixRegisterScreenSpecificPrivateKey (pScreen, &pScrPriv->gcPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec))) return FALSE; if (!dixRegisterScreenSpecificPrivateKey (pScreen, &pScrPriv->winPrivateKeyRec, PRIVATE_WINDOW, 0)) return FALSE; return TRUE; } #ifdef FB_ACCESS_WRAPPER ReadMemoryProcPtr wfbReadMemory; WriteMemoryProcPtr wfbWriteMemory; #endif xorg-server-1.20.8/fb/fbpict.h0000644000175000017500000000507413640201473013023 00000000000000/* * * Copyright © 2000 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #ifndef _FBPICT_H_ #define _FBPICT_H_ /* fbpict.c */ extern _X_EXPORT void fbComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); /* fbtrap.c */ extern _X_EXPORT void fbAddTraps(PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap * traps); extern _X_EXPORT void fbRasterizeTrapezoid(PicturePtr alpha, xTrapezoid * trap, int x_off, int y_off); extern _X_EXPORT void fbAddTriangles(PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntri, xTriangle * tris); extern _X_EXPORT void fbTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps); extern _X_EXPORT void fbTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris); extern _X_EXPORT void fbGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs); #endif /* _FBPICT_H_ */ xorg-server-1.20.8/fb/fbwindow.c0000644000175000017500000001242213640201473013361 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" Bool fbCreateWindow(WindowPtr pWin) { dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin), fbGetScreenPixmap(pWin->drawable.pScreen)); return TRUE; } Bool fbDestroyWindow(WindowPtr pWin) { return TRUE; } Bool fbRealizeWindow(WindowPtr pWindow) { return TRUE; } Bool fbPositionWindow(WindowPtr pWin, int x, int y) { return TRUE; } Bool fbUnrealizeWindow(WindowPtr pWindow) { return TRUE; } void fbCopyWindowProc(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown); pbox++; } fbFinishAccess(pDstDrawable); fbFinishAccess(pSrcDrawable); } void fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { RegionRec rgnDst; int dx, dy; PixmapPtr pPixmap = fbGetWindowPixmap(pWin); DrawablePtr pDrawable = &pPixmap->drawable; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; RegionTranslate(prgnSrc, -dx, -dy); RegionNull(&rgnDst); RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); #ifdef COMPOSITE if (pPixmap->screen_x || pPixmap->screen_y) RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); #endif miCopyRegion(pDrawable, pDrawable, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); RegionUninit(&rgnDst); fbValidateDrawable(&pWin->drawable); } static void fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap) { PixmapPtr pPixmap = *ppPixmap; if (FbEvenTile(pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel)) fbPadPixmap(pPixmap); } Bool fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { if (mask & CWBackPixmap) { if (pWin->backgroundState == BackgroundPixmap) fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap); } if (mask & CWBorderPixmap) { if (pWin->borderIsPixel == FALSE) fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap); } return TRUE; } void fbFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, FbBits and, FbBits xor) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int n = RegionNumRects(pRegion); BoxPtr pbox = RegionRects(pRegion); #ifndef FB_ACCESS_WRAPPER int try_mmx = 0; if (!and) try_mmx = 1; #endif fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (n--) { #ifndef FB_ACCESS_WRAPPER if (!try_mmx || !pixman_fill((uint32_t *) dst, dstStride, dstBpp, pbox->x1 + dstXoff, pbox->y1 + dstYoff, (pbox->x2 - pbox->x1), (pbox->y2 - pbox->y1), xor)) { #endif fbSolid(dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, (pbox->x2 - pbox->x1) * dstBpp, pbox->y2 - pbox->y1, and, xor); #ifndef FB_ACCESS_WRAPPER } #endif fbValidateDrawable(pDrawable); pbox++; } fbFinishAccess(pDrawable); } xorg-server-1.20.8/fb/fbimage.c0000644000175000017500000002003213640201473013130 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" void fbPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); unsigned long i; FbStride srcStride; FbStip *src = (FbStip *) pImage; x += pDrawable->x; y += pDrawable->y; switch (format) { case XYBitmap: srcStride = BitmapBytePad(w + leftPad) / sizeof(FbStip); fbPutXYImage(pDrawable, fbGetCompositeClip(pGC), pPriv->fg, pPriv->bg, pPriv->pm, pGC->alu, TRUE, x, y, w, h, src, srcStride, leftPad); break; case XYPixmap: srcStride = BitmapBytePad(w + leftPad) / sizeof(FbStip); for (i = (unsigned long) 1 << (pDrawable->depth - 1); i; i >>= 1) { if (i & pGC->planemask) { fbPutXYImage(pDrawable, fbGetCompositeClip(pGC), FB_ALLONES, 0, fbReplicatePixel(i, pDrawable->bitsPerPixel), pGC->alu, TRUE, x, y, w, h, src, srcStride, leftPad); } src += srcStride * h; } break; case ZPixmap: srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof(FbStip); fbPutZImage(pDrawable, fbGetCompositeClip(pGC), pGC->alu, pPriv->pm, x, y, w, h, src, srcStride); } } void fbPutZImage(DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, FbStip * src, FbStride srcStride) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; fbBltStip(src + (y1 - y) * srcStride, srcStride, (x1 - x) * dstBpp, dst + (y1 + dstYoff) * dstStride, dstStride, (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp); } fbFinishAccess(pDrawable); } void fbPutXYImage(DrawablePtr pDrawable, RegionPtr pClip, FbBits fg, FbBits bg, FbBits pm, int alu, Bool opaque, int x, int y, int width, int height, FbStip * src, FbStride srcStride, int srcX) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); if (dstBpp == 1) { if (opaque) alu = FbOpaqueStipple1Rop(alu, fg, bg); else alu = FbStipple1Rop(alu, fg); } else { fgand = fbAnd(alu, fg, pm); fgxor = fbXor(alu, fg, pm); if (opaque) { bgand = fbAnd(alu, bg, pm); bgxor = fbXor(alu, bg, pm); } else { bgand = fbAnd(GXnoop, (FbBits) 0, FB_ALLONES); bgxor = fbXor(GXnoop, (FbBits) 0, FB_ALLONES); } } for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; if (dstBpp == 1) { fbBltStip(src + (y1 - y) * srcStride, srcStride, (x1 - x) + srcX, (FbStip *) (dst + (y1 + dstYoff) * dstStride), FbBitsStrideToStipStride(dstStride), (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp); } else { fbBltOne(src + (y1 - y) * srcStride, srcStride, (x1 - x) + srcX, dst + (y1 + dstYoff) * dstStride, dstStride, (x1 + dstXoff) * dstBpp, dstBpp, (x2 - x1) * dstBpp, (y2 - y1), fgand, fgxor, bgand, bgxor); } } fbFinishAccess(pDrawable); } void fbGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbStip *dst; FbStride dstStride; /* * XFree86 DDX empties the root borderClip when the VT is * switched away; this checks for that case */ if (!fbDrawableEnabled(pDrawable)) return; fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); x += pDrawable->x; y += pDrawable->y; dst = (FbStip *) d; if (format == ZPixmap || srcBpp == 1) { FbBits pm; pm = fbReplicatePixel(planeMask, srcBpp); dstStride = PixmapBytePad(w, pDrawable->depth); dstStride /= sizeof(FbStip); fbBltStip((FbStip *) (src + (y + srcYoff) * srcStride), FbBitsStrideToStipStride(srcStride), (x + srcXoff) * srcBpp, dst, dstStride, 0, w * srcBpp, h, GXcopy, FB_ALLONES, srcBpp); if (pm != FB_ALLONES) { for (int i = 0; i < dstStride * h; i++) dst[i] &= pm; } } else { dstStride = BitmapBytePad(w) / sizeof(FbStip); fbBltPlane(src + (y + srcYoff) * srcStride, srcStride, (x + srcXoff) * srcBpp, srcBpp, dst, dstStride, 0, w * srcBpp, h, fbAndStip(GXcopy, FB_STIP_ALLONES, FB_STIP_ALLONES), fbXorStip(GXcopy, FB_STIP_ALLONES, FB_STIP_ALLONES), fbAndStip(GXcopy, 0, FB_STIP_ALLONES), fbXorStip(GXcopy, 0, FB_STIP_ALLONES), planeMask); } fbFinishAccess(pDrawable); } xorg-server-1.20.8/fb/fb.h0000644000175000017500000007566513640201473012160 00000000000000/* * * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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 _FB_H_ #define _FB_H_ #include #include #include "scrnintstr.h" #include "pixmap.h" #include "pixmapstr.h" #include "region.h" #include "gcstruct.h" #include "colormap.h" #include "miscstruct.h" #include "servermd.h" #include "windowstr.h" #include "privates.h" #include "mi.h" #include "migc.h" #include "picturestr.h" #ifdef FB_ACCESS_WRAPPER #include "wfbrename.h" #define FBPREFIX(x) wfb##x #define WRITE(ptr, val) ((*wfbWriteMemory)((ptr), (val), sizeof(*(ptr)))) #define READ(ptr) ((*wfbReadMemory)((ptr), sizeof(*(ptr)))) #define MEMCPY_WRAPPED(dst, src, size) do { \ size_t _i; \ CARD8 *_dst = (CARD8*)(dst), *_src = (CARD8*)(src); \ for(_i = 0; _i < size; _i++) { \ WRITE(_dst +_i, READ(_src + _i)); \ } \ } while(0) #define MEMSET_WRAPPED(dst, val, size) do { \ size_t _i; \ CARD8 *_dst = (CARD8*)(dst); \ for(_i = 0; _i < size; _i++) { \ WRITE(_dst +_i, (val)); \ } \ } while(0) #else #define FBPREFIX(x) fb##x #define WRITE(ptr, val) (*(ptr) = (val)) #define READ(ptr) (*(ptr)) #define MEMCPY_WRAPPED(dst, src, size) memcpy((dst), (src), (size)) #define MEMSET_WRAPPED(dst, val, size) memset((dst), (val), (size)) #endif /* * This single define controls the basic size of data manipulated * by this software; it must be log2(sizeof (FbBits) * 8) */ #ifndef FB_SHIFT #define FB_SHIFT LOG2_BITMAP_PAD #endif #define FB_UNIT (1 << FB_SHIFT) #define FB_MASK (FB_UNIT - 1) #define FB_ALLONES ((FbBits) -1) #if GLYPHPADBYTES != 4 #error "GLYPHPADBYTES must be 4" #endif #define FB_STIP_SHIFT LOG2_BITMAP_PAD #define FB_STIP_UNIT (1 << FB_STIP_SHIFT) #define FB_STIP_MASK (FB_STIP_UNIT - 1) #define FB_STIP_ALLONES ((FbStip) -1) #define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0) #define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0) #define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) #define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) #define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1)) #if FB_SHIFT == 5 typedef CARD32 FbBits; #else #error "Unsupported FB_SHIFT" #endif #if LOG2_BITMAP_PAD == FB_SHIFT typedef FbBits FbStip; #endif typedef int FbStride; #ifdef FB_DEBUG extern _X_EXPORT void fbValidateDrawable(DrawablePtr d); extern _X_EXPORT void fbInitializeDrawable(DrawablePtr d); extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data); #define FB_HEAD_BITS (FbStip) (0xbaadf00d) #define FB_TAIL_BITS (FbStip) (0xbaddf0ad) #else #define fbValidateDrawable(d) #define fdInitializeDrawable(d) #endif #include "fbrop.h" #if BITMAP_BIT_ORDER == LSBFirst #define FbScrLeft(x,n) ((x) >> (n)) #define FbScrRight(x,n) ((x) << (n)) /* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */ #define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1)) #define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n))) #define FbPatternOffsetBits 0 #else #define FbScrLeft(x,n) ((x) << (n)) #define FbScrRight(x,n) ((x) >> (n)) /* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) #define FbStipMoveLsb(x,s,n) (x) #define FbPatternOffsetBits (sizeof (FbBits) - 1) #endif #include "micoord.h" #define FbStipLeft(x,n) FbScrLeft(x,n) #define FbStipRight(x,n) FbScrRight(x,n) #define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0) #define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0) #define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0) #define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0) #define FbLeftMask(x) ( ((x) & FB_MASK) ? \ FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0) #define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \ FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0) #define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \ FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0) #define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \ FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0) #define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \ FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK)) #define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \ FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK)) #define FbMaskBits(x,w,l,n,r) { \ n = (w); \ r = FbRightMask((x)+n); \ l = FbLeftMask(x); \ if (l) { \ n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ n = 0; \ l &= r; \ r = 0; \ } \ } \ n >>= FB_SHIFT; \ } #define FbByteMaskInvalid 0x10 #define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1))) #define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o))) #define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3)) #define FbStorePart(dst,off,t,xor) (WRITE(FbPtrOffset(dst,off,t), \ FbSelectPart(xor,off,t))) #ifndef FbSelectPart #define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t) #endif #define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \ n = (w); \ lb = 0; \ rb = 0; \ r = FbRightMask((x)+n); \ if (r) { \ /* compute right byte length */ \ if ((copy) && (((x) + n) & 7) == 0) { \ rb = (((x) + n) & FB_MASK) >> 3; \ } else { \ rb = FbByteMaskInvalid; \ } \ } \ l = FbLeftMask(x); \ if (l) { \ /* compute left byte length */ \ if ((copy) && ((x) & 7) == 0) { \ lb = ((x) & FB_MASK) >> 3; \ } else { \ lb = FbByteMaskInvalid; \ } \ /* subtract out the portion painted by leftMask */ \ n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ if (lb != FbByteMaskInvalid) { \ if (rb == FbByteMaskInvalid) { \ lb = FbByteMaskInvalid; \ } else if (rb) { \ lb |= (rb - lb) << (FB_SHIFT - 3); \ rb = 0; \ } \ } \ n = 0; \ l &= r; \ r = 0; \ }\ } \ n >>= FB_SHIFT; \ } #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ switch (lb) { \ case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ break; \ case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case sizeof (FbBits) - 3: \ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ case sizeof (FbBits) - 2: \ FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \ break; \ case sizeof (FbBits) - 1: \ FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \ break; \ default: \ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, l)); \ break; \ } \ } #define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ switch (rb) { \ case 1: \ FbStorePart(dst,0,CARD8,xor); \ break; \ case 2: \ FbStorePart(dst,0,CARD16,xor); \ break; \ case 3: \ FbStorePart(dst,0,CARD16,xor); \ FbStorePart(dst,2,CARD8,xor); \ break; \ default: \ WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, r)); \ } \ } #define FbMaskStip(x,w,l,n,r) { \ n = (w); \ r = FbRightStipMask((x)+n); \ l = FbLeftStipMask(x); \ if (l) { \ n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \ if (n < 0) { \ n = 0; \ l &= r; \ r = 0; \ } \ } \ n >>= FB_STIP_SHIFT; \ } /* * These macros are used to transparently stipple * in copy mode; the expected usage is with 'n' constant * so all of the conditional parts collapse into a minimal * sequence of partial word writes * * 'n' is the bytemask of which bytes to store, 'a' is the address * of the FbBits base unit, 'o' is the offset within that unit * * The term "lane" comes from the hardware term "byte-lane" which */ #define FbLaneCase1(n,a,o) \ if ((n) == 0x01) { \ WRITE((CARD8 *) ((a)+FbPatternOffset(o,CARD8)), fgxor); \ } #define FbLaneCase2(n,a,o) \ if ((n) == 0x03) { \ WRITE((CARD16 *) ((a)+FbPatternOffset(o,CARD16)), fgxor); \ } else { \ FbLaneCase1((n)&1,a,o) \ FbLaneCase1((n)>>1,a,(o)+1) \ } #define FbLaneCase4(n,a,o) \ if ((n) == 0x0f) { \ WRITE((CARD32 *) ((a)+FbPatternOffset(o,CARD32)), fgxor); \ } else { \ FbLaneCase2((n)&3,a,o) \ FbLaneCase2((n)>>2,a,(o)+2) \ } #define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0) /* Macros for dealing with dashing */ #define FbDashDeclare \ unsigned char *__dash, *__firstDash, *__lastDash #define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \ (even) = TRUE; \ __firstDash = (pGC)->dash; \ __lastDash = __firstDash + (pGC)->numInDashList; \ (dashOffset) %= (pPriv)->dashLength; \ \ __dash = __firstDash; \ while ((dashOffset) >= ((dashlen) = *__dash)) \ { \ (dashOffset) -= (dashlen); \ (even) = 1-(even); \ if (++__dash == __lastDash) \ __dash = __firstDash; \ } \ (dashlen) -= (dashOffset); \ } #define FbDashNext(dashlen) { \ if (++__dash == __lastDash) \ __dash = __firstDash; \ (dashlen) = *__dash; \ } /* as numInDashList is always even, this case can skip a test */ #define FbDashNextEven(dashlen) { \ (dashlen) = *++__dash; \ } #define FbDashNextOdd(dashlen) FbDashNext(dashlen) #define FbDashStep(dashlen,even) { \ if (!--(dashlen)) { \ FbDashNext(dashlen); \ (even) = 1-(even); \ } \ } extern _X_EXPORT const GCOps fbGCOps; extern _X_EXPORT const GCFuncs fbGCFuncs; /* Framebuffer access wrapper */ typedef FbBits(*ReadMemoryProcPtr) (const void *src, int size); typedef void (*WriteMemoryProcPtr) (void *dst, FbBits value, int size); typedef void (*SetupWrapProcPtr) (ReadMemoryProcPtr * pRead, WriteMemoryProcPtr * pWrite, DrawablePtr pDraw); typedef void (*FinishWrapProcPtr) (DrawablePtr pDraw); #ifdef FB_ACCESS_WRAPPER #define fbPrepareAccess(pDraw) \ fbGetScreenPrivate((pDraw)->pScreen)->setupWrap( \ &wfbReadMemory, \ &wfbWriteMemory, \ (pDraw)) #define fbFinishAccess(pDraw) \ fbGetScreenPrivate((pDraw)->pScreen)->finishWrap(pDraw) #else #define fbPrepareAccess(pPix) #define fbFinishAccess(pDraw) #endif extern _X_EXPORT DevPrivateKey fbGetScreenPrivateKey(void); /* private field of a screen */ typedef struct { #ifdef FB_ACCESS_WRAPPER SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */ FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */ #endif DevPrivateKeyRec gcPrivateKeyRec; DevPrivateKeyRec winPrivateKeyRec; } FbScreenPrivRec, *FbScreenPrivPtr; #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, fbGetScreenPrivateKey())) /* private field of GC */ typedef struct { FbBits and, xor; /* reduced rop values */ FbBits bgand, bgxor; /* for stipples */ FbBits fg, bg, pm; /* expanded and filled */ unsigned int dashLength; /* total of all dash elements */ } FbGCPrivRec, *FbGCPrivPtr; #define fbGetGCPrivateKey(pGC) (&fbGetScreenPrivate((pGC)->pScreen)->gcPrivateKeyRec) #define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\ dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey(pGC))) #define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip) #define fbGetExpose(pGC) ((pGC)->fExpose) #define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate) #define fbGetWinPrivateKey(pWin) (&fbGetScreenPrivate(((DrawablePtr) (pWin))->pScreen)->winPrivateKeyRec) #define fbGetWindowPixmap(pWin) ((PixmapPtr)\ dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey(pWin))) #define __fbPixDrawableX(pPix) ((pPix)->drawable.x) #define __fbPixDrawableY(pPix) ((pPix)->drawable.y) #ifdef COMPOSITE #define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix) - (pPix)->screen_x) #define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix) - (pPix)->screen_y) #else #define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix)) #define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix)) #endif #define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix)) #define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix)) #define fbGetDrawablePixmap(pDrawable, pixmap, xoff, yoff) { \ if ((pDrawable)->type != DRAWABLE_PIXMAP) { \ (pixmap) = fbGetWindowPixmap(pDrawable); \ (xoff) = __fbPixOffXWin(pixmap); \ (yoff) = __fbPixOffYWin(pixmap); \ } else { \ (pixmap) = (PixmapPtr) (pDrawable); \ (xoff) = __fbPixOffXPix(pixmap); \ (yoff) = __fbPixOffYPix(pixmap); \ } \ fbPrepareAccess(pDrawable); \ } #define fbGetPixmapBitsData(pixmap, pointer, stride, bpp) { \ (pointer) = (FbBits *) (pixmap)->devPrivate.ptr; \ (stride) = ((int) (pixmap)->devKind) / sizeof (FbBits); (void)(stride); \ (bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \ } #define fbGetPixmapStipData(pixmap, pointer, stride, bpp) { \ (pointer) = (FbStip *) (pixmap)->devPrivate.ptr; \ (stride) = ((int) (pixmap)->devKind) / sizeof (FbStip); (void)(stride); \ (bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \ } #define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ PixmapPtr _pPix; \ fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \ fbGetPixmapBitsData(_pPix, pointer, stride, bpp); \ } #define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ PixmapPtr _pPix; \ fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \ fbGetPixmapStipData(_pPix, pointer, stride, bpp); \ } /* * XFree86 empties the root BorderClip when the VT is inactive, * here's a macro which uses that to disable GetImage and GetSpans */ #define fbWindowEnabled(pWin) \ RegionNotEmpty(&(pWin)->borderClip) #define fbDrawableEnabled(pDrawable) \ ((pDrawable)->type == DRAWABLE_PIXMAP ? \ TRUE : fbWindowEnabled((WindowPtr) pDrawable)) #define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0) /* * Accelerated tiles are power of 2 width <= FB_UNIT */ #define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w)) /* * fballpriv.c */ extern _X_EXPORT Bool fbAllocatePrivates(ScreenPtr pScreen); /* * fbarc.c */ extern _X_EXPORT void fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs); /* * fbbits.c */ extern _X_EXPORT void fbBresSolid8(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbBresDash8(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbDots8(FbBits * dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint * pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); extern _X_EXPORT void fbArc8(FbBits * dst, FbStride dstStride, int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor); extern _X_EXPORT void fbGlyph8(FbBits * dstLine, FbStride dstStride, int dstBpp, FbStip * stipple, FbBits fg, int height, int shift); extern _X_EXPORT void fbPolyline8(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); extern _X_EXPORT void fbPolySegment8(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg); extern _X_EXPORT void fbBresSolid16(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbBresDash16(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbDots16(FbBits * dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint * pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); extern _X_EXPORT void fbArc16(FbBits * dst, FbStride dstStride, int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor); extern _X_EXPORT void fbGlyph16(FbBits * dstLine, FbStride dstStride, int dstBpp, FbStip * stipple, FbBits fg, int height, int shift); extern _X_EXPORT void fbPolyline16(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); extern _X_EXPORT void fbPolySegment16(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg); extern _X_EXPORT void fbBresSolid32(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbBresDash32(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbDots32(FbBits * dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint * pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); extern _X_EXPORT void fbArc32(FbBits * dst, FbStride dstStride, int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor); extern _X_EXPORT void fbGlyph32(FbBits * dstLine, FbStride dstStride, int dstBpp, FbStip * stipple, FbBits fg, int height, int shift); extern _X_EXPORT void fbPolyline32(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); extern _X_EXPORT void fbPolySegment32(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg); /* * fbblt.c */ extern _X_EXPORT void fbBlt(FbBits * src, FbStride srcStride, int srcX, FbBits * dst, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown); extern _X_EXPORT void fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */ int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */ int dstX, int width, int height, int alu, FbBits pm, int bpp); /* * fbbltone.c */ extern _X_EXPORT void fbBltOne(FbStip * src, FbStride srcStride, int srcX, FbBits * dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbBits fgand, FbBits fbxor, FbBits bgand, FbBits bgxor); extern _X_EXPORT void fbBltPlane(FbBits * src, FbStride srcStride, int srcX, int srcBpp, FbStip * dst, FbStride dstStride, int dstX, int width, int height, FbStip fgand, FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask); /* * fbcmap_mi.c */ extern _X_EXPORT int fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps); extern _X_EXPORT void fbInstallColormap(ColormapPtr pmap); extern _X_EXPORT void fbUninstallColormap(ColormapPtr pmap); extern _X_EXPORT void fbResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual); extern _X_EXPORT Bool fbInitializeColormap(ColormapPtr pmap); extern _X_EXPORT int fbExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem * indefs, xColorItem * outdefs); extern _X_EXPORT Bool fbCreateDefColormap(ScreenPtr pScreen); extern _X_EXPORT void fbClearVisualTypes(void); extern _X_EXPORT Bool fbSetVisualTypes(int depth, int visuals, int bitsPerRGB); extern _X_EXPORT Bool fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, Pixel redMask, Pixel greenMask, Pixel blueMask); extern _X_EXPORT Bool fbInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB); /* * fbcopy.c */ extern _X_EXPORT void fbCopyNtoN(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); extern _X_EXPORT void fbCopy1toN(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); extern _X_EXPORT void fbCopyNto1(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); extern _X_EXPORT RegionPtr fbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut); extern _X_EXPORT RegionPtr fbCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, unsigned long bitplane); /* * fbfill.c */ extern _X_EXPORT void fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height); extern _X_EXPORT void fbSolidBoxClipped(DrawablePtr pDrawable, RegionPtr pClip, int xa, int ya, int xb, int yb, FbBits and, FbBits xor); /* * fbfillrect.c */ extern _X_EXPORT void fbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectInit, xRectangle *prectInit); #define fbPolyFillArc miPolyFillArc #define fbFillPolygon miFillPolygon /* * fbfillsp.c */ extern _X_EXPORT void fbFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); /* * fbgc.c */ extern _X_EXPORT Bool fbCreateGC(GCPtr pGC); extern _X_EXPORT void fbPadPixmap(PixmapPtr pPixmap); extern _X_EXPORT void fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); /* * fbgetsp.c */ extern _X_EXPORT void fbGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart); /* * fbglyph.c */ extern _X_EXPORT void fbPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase); extern _X_EXPORT void fbImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase); /* * fbimage.c */ extern _X_EXPORT void fbPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage); extern _X_EXPORT void fbPutZImage(DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, FbStip * src, FbStride srcStride); extern _X_EXPORT void fbPutXYImage(DrawablePtr pDrawable, RegionPtr pClip, FbBits fg, FbBits bg, FbBits pm, int alu, Bool opaque, int x, int y, int width, int height, FbStip * src, FbStride srcStride, int srcX); extern _X_EXPORT void fbGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); /* * fbline.c */ extern _X_EXPORT void fbPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); extern _X_EXPORT void fbFixCoordModePrevious(int npt, DDXPointPtr ppt); extern _X_EXPORT void fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg); #define fbPolyRectangle miPolyRectangle /* * fbpict.c */ extern _X_EXPORT Bool fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats); extern _X_EXPORT void fbDestroyGlyphCache(void); /* * fbpixmap.c */ extern _X_EXPORT PixmapPtr fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); extern _X_EXPORT Bool fbDestroyPixmap(PixmapPtr pPixmap); extern _X_EXPORT RegionPtr fbPixmapToRegion(PixmapPtr pPix); /* * fbpoint.c */ extern _X_EXPORT void fbPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, xPoint * pptInit); /* * fbpush.c */ extern _X_EXPORT void fbPushImage(DrawablePtr pDrawable, GCPtr pGC, FbStip * src, FbStride srcStride, int srcX, int x, int y, int width, int height); extern _X_EXPORT void fbPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg); /* * fbscreen.c */ extern _X_EXPORT Bool fbCloseScreen(ScreenPtr pScreen); extern _X_EXPORT Bool fbRealizeFont(ScreenPtr pScreen, FontPtr pFont); extern _X_EXPORT Bool fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont); extern _X_EXPORT void fbQueryBestSize(int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen); extern _X_EXPORT PixmapPtr _fbGetWindowPixmap(WindowPtr pWindow); extern _X_EXPORT void _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap); extern _X_EXPORT Bool fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ int dpiy, int width, /* pixel width of frame buffer */ int bpp); /* bits per pixel of frame buffer */ #ifdef FB_ACCESS_WRAPPER extern _X_EXPORT Bool wfbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap); extern _X_EXPORT Bool wfbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap); #endif extern _X_EXPORT Bool fbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); extern _X_EXPORT Bool fbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); /* * fbseg.c */ typedef void FbBres(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); extern _X_EXPORT void fbSegment(DrawablePtr pDrawable, GCPtr pGC, int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset); /* * fbsetsp.c */ extern _X_EXPORT void fbSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); /* * fbsolid.c */ extern _X_EXPORT void fbSolid(FbBits * dst, FbStride dstStride, int dstX, int bpp, int width, int height, FbBits and, FbBits xor); /* * fbutil.c */ extern _X_EXPORT FbBits fbReplicatePixel(Pixel p, int bpp); #ifdef FB_ACCESS_WRAPPER extern _X_EXPORT ReadMemoryProcPtr wfbReadMemory; extern _X_EXPORT WriteMemoryProcPtr wfbWriteMemory; #endif /* * fbwindow.c */ extern _X_EXPORT Bool fbCreateWindow(WindowPtr pWin); extern _X_EXPORT Bool fbDestroyWindow(WindowPtr pWin); extern _X_EXPORT Bool fbRealizeWindow(WindowPtr pWindow); extern _X_EXPORT Bool fbPositionWindow(WindowPtr pWin, int x, int y); extern _X_EXPORT Bool fbUnrealizeWindow(WindowPtr pWindow); extern _X_EXPORT void fbCopyWindowProc(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); extern _X_EXPORT void fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); extern _X_EXPORT Bool fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask); extern _X_EXPORT void fbFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, FbBits and, FbBits xor); extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff); extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *); #endif /* _FB_H_ */ xorg-server-1.20.8/fb/fbbits.h0000644000175000017500000006051013640201473013021 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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. */ /* * This file defines functions for drawing some primitives using * underlying datatypes instead of masks */ #define isClipped(c,ul,lr) (((c) | ((c) - (ul)) | ((lr) - (c))) & 0x80008000) #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef BITSSTORE #define STORE(b,x) BITSSTORE(b,x) #else #define STORE(b,x) WRITE((b), (x)) #endif #ifdef BITSRROP #define RROP(b,a,x) BITSRROP(b,a,x) #else #define RROP(b,a,x) WRITE((b), FbDoRRop (READ(b), (a), (x))) #endif #ifdef BITSUNIT #define UNIT BITSUNIT #define USE_SOLID #else #define UNIT BITS #endif /* * Define the following before including this file: * * BRESSOLID name of function for drawing a solid segment * BRESDASH name of function for drawing a dashed segment * DOTS name of function for drawing dots * ARC name of function for drawing a solid arc * BITS type of underlying unit */ #ifdef BRESSOLID void BRESSOLID(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); UNIT *bits; FbStride bitsStride; FbStride majorStep, minorStep; BITS xor = (BITS) pPriv->xor; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff); bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT)); if (signdy < 0) bitsStride = -bitsStride; if (axis == X_AXIS) { majorStep = signdx; minorStep = bitsStride; } else { majorStep = bitsStride; minorStep = signdx; } while (len--) { STORE(bits, xor); bits += majorStep; e += e1; if (e >= 0) { bits += minorStep; e += e3; } } fbFinishAccess(pDrawable); } #endif #ifdef BRESDASH void BRESDASH(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); UNIT *bits; FbStride bitsStride; FbStride majorStep, minorStep; BITS xorfg, xorbg; FbDashDeclare; int dashlen; Bool even; Bool doOdd; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); doOdd = pGC->lineStyle == LineDoubleDash; xorfg = (BITS) pPriv->xor; xorbg = (BITS) pPriv->bgxor; FbDashInit(pGC, pPriv, dashOffset, dashlen, even); bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff); bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT)); if (signdy < 0) bitsStride = -bitsStride; if (axis == X_AXIS) { majorStep = signdx; minorStep = bitsStride; } else { majorStep = bitsStride; minorStep = signdx; } if (dashlen >= len) dashlen = len; if (doOdd) { if (!even) goto doubleOdd; for (;;) { len -= dashlen; while (dashlen--) { STORE(bits, xorfg); bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextEven(dashlen); if (dashlen >= len) dashlen = len; doubleOdd: len -= dashlen; while (dashlen--) { STORE(bits, xorbg); bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextOdd(dashlen); if (dashlen >= len) dashlen = len; } } else { if (!even) goto onOffOdd; for (;;) { len -= dashlen; while (dashlen--) { STORE(bits, xorfg); bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextEven(dashlen); if (dashlen >= len) dashlen = len; onOffOdd: len -= dashlen; while (dashlen--) { bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextOdd(dashlen); if (dashlen >= len) dashlen = len; } } fbFinishAccess(pDrawable); } #endif #ifdef DOTS void DOTS(FbBits * dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint * ptsOrig, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor) { INT32 *pts = (INT32 *) ptsOrig; UNIT *bits = (UNIT *) dst; UNIT *point; BITS bxor = (BITS) xor; BITS band = (BITS) and; FbStride bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT)); INT32 ul, lr; INT32 pt; ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg); lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1); bits += bitsStride * (yorg + yoff) + (xorg + xoff); if (and == 0) { while (npt--) { pt = *pts++; if (!isClipped(pt, ul, lr)) { point = bits + intToY(pt) * bitsStride + intToX(pt); STORE(point, bxor); } } } else { while (npt--) { pt = *pts++; if (!isClipped(pt, ul, lr)) { point = bits + intToY(pt) * bitsStride + intToX(pt); RROP(point, band, bxor); } } } } #endif #ifdef ARC #define ARCCOPY(d) STORE(d,xorBits) #define ARCRROP(d) RROP(d,andBits,xorBits) void ARC(FbBits * dst, FbStride dstStride, int dstBpp, xArc * arc, int drawX, int drawY, FbBits and, FbBits xor) { UNIT *bits; FbStride bitsStride; miZeroArcRec info; Bool do360; int x; UNIT *yorgp, *yorgop; BITS andBits, xorBits; int yoffset, dyoffset; int y, a, b, d, mask; int k1, k3, dx, dy; bits = (UNIT *) dst; bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT)); andBits = (BITS) and; xorBits = (BITS) xor; do360 = miZeroArcSetup(arc, &info, TRUE); yorgp = bits + ((info.yorg + drawY) * bitsStride); yorgop = bits + ((info.yorgo + drawY) * bitsStride); info.xorg = (info.xorg + drawX); info.xorgo = (info.xorgo + drawX); MIARCSETUP(); yoffset = y ? bitsStride : 0; dyoffset = 0; mask = info.initialMask; if (!(arc->width & 1)) { if (andBits == 0) { if (mask & 2) ARCCOPY(yorgp + info.xorgo); if (mask & 8) ARCCOPY(yorgop + info.xorgo); } else { if (mask & 2) ARCRROP(yorgp + info.xorgo); if (mask & 8) ARCRROP(yorgop + info.xorgo); } } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { int xoffset = bitsStride; UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg; UNIT *yorgohb = yorghb - info.h; yorgp += info.xorg; yorgop += info.xorg; yorghb += info.h; while (1) { if (andBits == 0) { ARCCOPY(yorgp + yoffset + x); ARCCOPY(yorgp + yoffset - x); ARCCOPY(yorgop - yoffset - x); ARCCOPY(yorgop - yoffset + x); } else { ARCRROP(yorgp + yoffset + x); ARCRROP(yorgp + yoffset - x); ARCRROP(yorgop - yoffset - x); ARCRROP(yorgop - yoffset + x); } if (a < 0) break; if (andBits == 0) { ARCCOPY(yorghb - xoffset - y); ARCCOPY(yorgohb - xoffset + y); ARCCOPY(yorgohb + xoffset + y); ARCCOPY(yorghb + xoffset - y); } else { ARCRROP(yorghb - xoffset - y); ARCRROP(yorgohb - xoffset + y); ARCRROP(yorgohb + xoffset + y); ARCRROP(yorghb + xoffset - y); } xoffset += bitsStride; MIARCCIRCLESTEP(yoffset += bitsStride; ); } yorgp -= info.xorg; yorgop -= info.xorg; x = info.w; yoffset = info.h * bitsStride; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = bitsStride; ); if (andBits == 0) { ARCCOPY(yorgp + yoffset + info.xorg + x); ARCCOPY(yorgp + yoffset + info.xorgo - x); ARCCOPY(yorgop - yoffset + info.xorgo - x); ARCCOPY(yorgop - yoffset + info.xorg + x); } else { ARCRROP(yorgp + yoffset + info.xorg + x); ARCRROP(yorgp + yoffset + info.xorgo - x); ARCRROP(yorgop - yoffset + info.xorgo - x); ARCRROP(yorgop - yoffset + info.xorg + x); } MIARCSTEP(yoffset += dyoffset; , yoffset += bitsStride; ); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = bitsStride; ); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } if (andBits == 0) { if (mask & 1) ARCCOPY(yorgp + yoffset + info.xorg + x); if (mask & 2) ARCCOPY(yorgp + yoffset + info.xorgo - x); if (mask & 4) ARCCOPY(yorgop - yoffset + info.xorgo - x); if (mask & 8) ARCCOPY(yorgop - yoffset + info.xorg + x); } else { if (mask & 1) ARCRROP(yorgp + yoffset + info.xorg + x); if (mask & 2) ARCRROP(yorgp + yoffset + info.xorgo - x); if (mask & 4) ARCRROP(yorgop - yoffset + info.xorgo - x); if (mask & 8) ARCRROP(yorgop - yoffset + info.xorg + x); } if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(yoffset += dyoffset; , yoffset += bitsStride; ); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; if (andBits == 0) { if (mask & 1) ARCCOPY(yorgp + yoffset + info.xorg + x); if (mask & 4) ARCCOPY(yorgop - yoffset + info.xorgo - x); if (arc->height & 1) { if (mask & 2) ARCCOPY(yorgp + yoffset + info.xorgo - x); if (mask & 8) ARCCOPY(yorgop - yoffset + info.xorg + x); } } else { if (mask & 1) ARCRROP(yorgp + yoffset + info.xorg + x); if (mask & 4) ARCRROP(yorgop - yoffset + info.xorgo - x); if (arc->height & 1) { if (mask & 2) ARCRROP(yorgp + yoffset + info.xorgo - x); if (mask & 8) ARCRROP(yorgop - yoffset + info.xorg + x); } } } #undef ARCCOPY #undef ARCRROP #endif #ifdef GLYPH #if BITMAP_BIT_ORDER == LSBFirst #define WRITE_ADDR1(n) (n) #define WRITE_ADDR2(n) (n) #define WRITE_ADDR4(n) (n) #else #define WRITE_ADDR1(n) ((n) ^ 3) #define WRITE_ADDR2(n) ((n) ^ 2) #define WRITE_ADDR4(n) ((n)) #endif #define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg)) #ifdef BITS2 #define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg)) #else #define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg)) #endif #ifdef BITS4 #define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg)) #else #define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg)) #endif void GLYPH(FbBits * dstBits, FbStride dstStride, int dstBpp, FbStip * stipple, FbBits fg, int x, int height) { int lshift; FbStip bits; BITS *dstLine; BITS *dst; int n; int shift; dstLine = (BITS *) dstBits; dstLine += x & ~3; dstStride *= (sizeof(FbBits) / sizeof(BITS)); shift = x & 3; lshift = 4 - shift; while (height--) { bits = *stipple++; dst = (BITS *) dstLine; n = lshift; while (bits) { switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) { case 0: break; case 1: WRITE1(dst, 0, fg); break; case 2: WRITE1(dst, 1, fg); break; case 3: WRITE2(dst, 0, fg); break; case 4: WRITE1(dst, 2, fg); break; case 5: WRITE1(dst, 0, fg); WRITE1(dst, 2, fg); break; case 6: WRITE1(dst, 1, fg); WRITE1(dst, 2, fg); break; case 7: WRITE2(dst, 0, fg); WRITE1(dst, 2, fg); break; case 8: WRITE1(dst, 3, fg); break; case 9: WRITE1(dst, 0, fg); WRITE1(dst, 3, fg); break; case 10: WRITE1(dst, 1, fg); WRITE1(dst, 3, fg); break; case 11: WRITE2(dst, 0, fg); WRITE1(dst, 3, fg); break; case 12: WRITE2(dst, 2, fg); break; case 13: WRITE1(dst, 0, fg); WRITE2(dst, 2, fg); break; case 14: WRITE1(dst, 1, fg); WRITE2(dst, 2, fg); break; case 15: WRITE4(dst, 0, fg); break; } bits = FbStipLeft(bits, n); n = 4; dst += 4; } dstLine += dstStride; } } #undef WRITE_ADDR1 #undef WRITE_ADDR2 #undef WRITE_ADDR4 #undef WRITE1 #undef WRITE2 #undef WRITE4 #endif #ifdef POLYLINE void POLYLINE(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig) { INT32 *pts = (INT32 *) ptsOrig; int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); BoxPtr pBox = RegionExtents(fbGetCompositeClip(pGC)); FbBits *dst; int dstStride; int dstBpp; int dstXoff, dstYoff; UNIT *bits, *bitsBase; FbStride bitsStride; BITS xor = fbGetGCPrivate(pGC)->xor; BITS and = fbGetGCPrivate(pGC)->and; int dashoffset = 0; INT32 ul, lr; INT32 pt1, pt2; int e, e1, e3, len; int stepmajor, stepminor; int octant; if (mode == CoordModePrevious) fbFixCoordModePrevious(npt, ptsOrig); fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT)); bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff); ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff); lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1); pt1 = *pts++; npt--; pt2 = *pts++; npt--; for (;;) { if (isClipped(pt1, ul, lr) | isClipped(pt2, ul, lr)) { fbSegment(pDrawable, pGC, intToX(pt1) + xoff, intToY(pt1) + yoff, intToX(pt2) + xoff, intToY(pt2) + yoff, npt == 0 && pGC->capStyle != CapNotLast, &dashoffset); if (!npt) { fbFinishAccess(pDrawable); return; } pt1 = pt2; pt2 = *pts++; npt--; } else { bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1); for (;;) { CalcLineDeltas(intToX(pt1), intToY(pt1), intToX(pt2), intToY(pt2), len, e1, stepmajor, stepminor, 1, bitsStride, octant); if (len < e1) { e3 = len; len = e1; e1 = e3; e3 = stepminor; stepminor = stepmajor; stepmajor = e3; SetYMajorOctant(octant); } e = -len; e1 <<= 1; e3 = e << 1; FIXUP_ERROR(e, octant, bias); if (and == 0) { while (len--) { STORE(bits, xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } else { while (len--) { RROP(bits, and, xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } if (!npt) { if (pGC->capStyle != CapNotLast && pt2 != *((INT32 *) ptsOrig)) { RROP(bits, and, xor); } fbFinishAccess(pDrawable); return; } pt1 = pt2; pt2 = *pts++; --npt; if (isClipped(pt2, ul, lr)) break; } } } fbFinishAccess(pDrawable); } #endif #ifdef POLYSEGMENT void POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg) { INT32 *pts = (INT32 *) pseg; int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); BoxPtr pBox = RegionExtents(fbGetCompositeClip(pGC)); FbBits *dst; int dstStride; int dstBpp; int dstXoff, dstYoff; UNIT *bits, *bitsBase; FbStride bitsStride; FbBits xorBits = fbGetGCPrivate(pGC)->xor; FbBits andBits = fbGetGCPrivate(pGC)->and; BITS xor = xorBits; BITS and = andBits; int dashoffset = 0; INT32 ul, lr; INT32 pt1, pt2; int e, e1, e3, len; int stepmajor, stepminor; int octant; Bool capNotLast; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT)); bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff); ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff); lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1); capNotLast = pGC->capStyle == CapNotLast; while (nseg--) { pt1 = *pts++; pt2 = *pts++; if (isClipped(pt1, ul, lr) | isClipped(pt2, ul, lr)) { fbSegment(pDrawable, pGC, intToX(pt1) + xoff, intToY(pt1) + yoff, intToX(pt2) + xoff, intToY(pt2) + yoff, !capNotLast, &dashoffset); } else { CalcLineDeltas(intToX(pt1), intToY(pt1), intToX(pt2), intToY(pt2), len, e1, stepmajor, stepminor, 1, bitsStride, octant); if (e1 == 0 && len > 3) { int x1, x2; FbBits *dstLine; int dstX, width; FbBits startmask, endmask; int nmiddle; if (stepmajor < 0) { x1 = intToX(pt2); x2 = intToX(pt1) + 1; if (capNotLast) x1++; } else { x1 = intToX(pt1); x2 = intToX(pt2); if (!capNotLast) x2++; } dstX = (x1 + xoff + dstXoff) * (sizeof(UNIT) * 8); width = (x2 - x1) * (sizeof(UNIT) * 8); dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride; dstLine += dstX >> FB_SHIFT; dstX &= FB_MASK; FbMaskBits(dstX, width, startmask, nmiddle, endmask); if (startmask) { WRITE(dstLine, FbDoMaskRRop(READ(dstLine), andBits, xorBits, startmask)); dstLine++; } if (!andBits) while (nmiddle--) WRITE(dstLine++, xorBits); else while (nmiddle--) { WRITE(dstLine, FbDoRRop(READ(dstLine), andBits, xorBits)); dstLine++; } if (endmask) WRITE(dstLine, FbDoMaskRRop(READ(dstLine), andBits, xorBits, endmask)); } else { bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1); if (len < e1) { e3 = len; len = e1; e1 = e3; e3 = stepminor; stepminor = stepmajor; stepmajor = e3; SetYMajorOctant(octant); } e = -len; e1 <<= 1; e3 = e << 1; FIXUP_ERROR(e, octant, bias); if (!capNotLast) len++; if (and == 0) { while (len--) { STORE(bits, xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } else { while (len--) { RROP(bits, and, xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } } } } fbFinishAccess(pDrawable); } #endif #undef STORE #undef RROP #undef UNIT #undef USE_SOLID #undef isClipped xorg-server-1.20.8/fb/fbgc.c0000644000175000017500000001162313640201473012445 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" const GCFuncs fbGCFuncs = { fbValidateGC, miChangeGC, miCopyGC, miDestroyGC, miChangeClip, miDestroyClip, miCopyClip, }; const GCOps fbGCOps = { fbFillSpans, fbSetSpans, fbPutImage, fbCopyArea, fbCopyPlane, fbPolyPoint, fbPolyLine, fbPolySegment, fbPolyRectangle, fbPolyArc, miFillPolygon, fbPolyFillRect, fbPolyFillArc, miPolyText8, miPolyText16, miImageText8, miImageText16, fbImageGlyphBlt, fbPolyGlyphBlt, fbPushPixels }; Bool fbCreateGC(GCPtr pGC) { pGC->ops = (GCOps *) &fbGCOps; pGC->funcs = (GCFuncs *) &fbGCFuncs; /* fb wants to translate before scan conversion */ pGC->miTranslate = 1; pGC->fExpose = 1; return TRUE; } /* * Pad pixmap to FB_UNIT bits wide */ void fbPadPixmap(PixmapPtr pPixmap) { int width; FbBits *bits; FbBits b; FbBits mask; int height; int w; int stride; int bpp; _X_UNUSED int xOff, yOff; fbGetDrawable(&pPixmap->drawable, bits, stride, bpp, xOff, yOff); width = pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel; height = pPixmap->drawable.height; mask = FbBitsMask(0, width); while (height--) { b = READ(bits) & mask; w = width; while (w < FB_UNIT) { b = b | FbScrRight(b, w); w <<= 1; } WRITE(bits, b); bits += stride; } fbFinishAccess(&pPixmap->drawable); } void fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbBits mask; /* * if the client clip is different or moved OR the subwindowMode has * changed OR the window's clip has changed since the last validation * we need to recompute the composite clip */ if ((changes & (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode)) || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) ) { miComputeCompositeClip(pGC, pDrawable); } if (changes & GCTile) { if (!pGC->tileIsPixel && FbEvenTile(pGC->tile.pixmap->drawable.width * pDrawable->bitsPerPixel)) fbPadPixmap(pGC->tile.pixmap); } if (changes & GCStipple) { if (pGC->stipple) { if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel < FB_UNIT) fbPadPixmap(pGC->stipple); } } /* * Recompute reduced rop values */ if (changes & (GCForeground | GCBackground | GCPlaneMask | GCFunction)) { int s; FbBits depthMask; mask = FbFullMask(pDrawable->bitsPerPixel); depthMask = FbFullMask(pDrawable->depth); pPriv->fg = pGC->fgPixel & mask; pPriv->bg = pGC->bgPixel & mask; if ((pGC->planemask & depthMask) == depthMask) pPriv->pm = mask; else pPriv->pm = pGC->planemask & mask; s = pDrawable->bitsPerPixel; while (s < FB_UNIT) { pPriv->fg |= pPriv->fg << s; pPriv->bg |= pPriv->bg << s; pPriv->pm |= pPriv->pm << s; s <<= 1; } pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm); pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm); pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm); pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm); } if (changes & GCDashList) { unsigned short n = pGC->numInDashList; unsigned char *dash = pGC->dash; unsigned int dashLength = 0; while (n--) dashLength += (unsigned int) *dash++; pPriv->dashLength = dashLength; } } xorg-server-1.20.8/fb/fbutil.c0000644000175000017500000000521613640201473013032 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" FbBits fbReplicatePixel(Pixel p, int bpp) { FbBits b = p; b &= FbFullMask(bpp); while (bpp < FB_UNIT) { b |= b << bpp; bpp <<= 1; } return b; } #define O 0 #define I FB_ALLONES const FbMergeRopRec FbMergeRopBits[16] = { {O, O, O, O}, /* clear 0x0 0 */ {I, O, O, O}, /* and 0x1 src AND dst */ {I, O, I, O}, /* andReverse 0x2 src AND NOT dst */ {O, O, I, O}, /* copy 0x3 src */ {I, I, O, O}, /* andInverted 0x4 NOT src AND dst */ {O, I, O, O}, /* noop 0x5 dst */ {O, I, I, O}, /* xor 0x6 src XOR dst */ {I, I, I, O}, /* or 0x7 src OR dst */ {I, I, I, I}, /* nor 0x8 NOT src AND NOT dst */ {O, I, I, I}, /* equiv 0x9 NOT src XOR dst */ {O, I, O, I}, /* invert 0xa NOT dst */ {I, I, O, I}, /* orReverse 0xb src OR NOT dst */ {O, O, I, I}, /* copyInverted 0xc NOT src */ {I, O, I, I}, /* orInverted 0xd NOT src OR dst */ {I, O, O, I}, /* nand 0xe NOT src OR NOT dst */ {O, O, O, I}, /* set 0xf 1 */ }; xorg-server-1.20.8/fb/fbfillrect.c0000644000175000017500000000647413640201473013670 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" void fbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect) { RegionPtr pClip = fbGetCompositeClip(pGC); register BoxPtr pbox; BoxPtr pextent; int extentX1, extentX2, extentY1, extentY2; int fullX1, fullX2, fullY1, fullY2; int partX1, partX2, partY1, partY2; int xorg, yorg; int n; xorg = pDrawable->x; yorg = pDrawable->y; pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; extentY2 = pextent->y2; while (nrect--) { fullX1 = prect->x + xorg; fullY1 = prect->y + yorg; fullX2 = fullX1 + (int) prect->width; fullY2 = fullY1 + (int) prect->height; prect++; if (fullX1 < extentX1) fullX1 = extentX1; if (fullY1 < extentY1) fullY1 = extentY1; if (fullX2 > extentX2) fullX2 = extentX2; if (fullY2 > extentY2) fullY2 = extentY2; if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) continue; n = RegionNumRects(pClip); if (n == 1) { fbFill(pDrawable, pGC, fullX1, fullY1, fullX2 - fullX1, fullY2 - fullY1); } else { pbox = RegionRects(pClip); /* * clip the rectangle to each box in the clip region * this is logically equivalent to calling Intersect() */ while (n--) { partX1 = pbox->x1; if (partX1 < fullX1) partX1 = fullX1; partY1 = pbox->y1; if (partY1 < fullY1) partY1 = fullY1; partX2 = pbox->x2; if (partX2 > fullX2) partX2 = fullX2; partY2 = pbox->y2; if (partY2 > fullY2) partY2 = fullY2; pbox++; if (partX1 < partX2 && partY1 < partY2) fbFill(pDrawable, pGC, partX1, partY1, partX2 - partX1, partY2 - partY1); } } } } xorg-server-1.20.8/fb/fbfill.c0000644000175000017500000002115013640201473012776 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" static void fbTile(FbBits * dst, FbStride dstStride, int dstX, int width, int height, FbBits * tile, FbStride tileStride, int tileWidth, int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot) { int tileX, tileY; int widthTmp; int h, w; int x, y; modulus(-yRot, tileHeight, tileY); y = 0; while (height) { h = tileHeight - tileY; if (h > height) h = height; height -= h; widthTmp = width; x = dstX; modulus(dstX - xRot, tileWidth, tileX); while (widthTmp) { w = tileWidth - tileX; if (w > widthTmp) w = widthTmp; widthTmp -= w; fbBlt(tile + tileY * tileStride, tileStride, tileX, dst + y * dstStride, dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE); x += w; tileX = 0; } y += h; tileY = 0; } } static void fbStipple(FbBits * dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip * stip, FbStride stipStride, int stipWidth, int stipHeight, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot) { int stipX, stipY, sx; int widthTmp; int h, w; int x, y; modulus(-yRot, stipHeight, stipY); modulus(dstX / dstBpp - xRot, stipWidth, stipX); y = 0; while (height) { h = stipHeight - stipY; if (h > height) h = height; height -= h; widthTmp = width; x = dstX; sx = stipX; while (widthTmp) { w = (stipWidth - sx) * dstBpp; if (w > widthTmp) w = widthTmp; widthTmp -= w; fbBltOne(stip + stipY * stipStride, stipStride, sx, dst + y * dstStride, dstStride, x, dstBpp, w, h, fgand, fgxor, bgand, bgxor); x += w; sx = 0; } y += h; stipY = 0; } } void fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); switch (pGC->fillStyle) { case FillSolid: #ifndef FB_ACCESS_WRAPPER if (pPriv->and || !pixman_fill((uint32_t *) dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor)) #endif fbSolid(dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, pPriv->and, pPriv->xor); break; case FillStippled: case FillOpaqueStippled:{ PixmapPtr pStip = pGC->stipple; int stipWidth = pStip->drawable.width; int stipHeight = pStip->drawable.height; if (dstBpp == 1) { int alu; FbBits *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; if (pGC->fillStyle == FillStippled) alu = FbStipple1Rop(pGC->alu, pGC->fgPixel); else alu = FbOpaqueStipple1Rop(pGC->alu, pGC->fgPixel, pGC->bgPixel); fbGetDrawable(&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbTile(dst + (y + dstYoff) * dstStride, dstStride, x + dstXoff, width, height, stip, stipStride, stipWidth, stipHeight, alu, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff), pGC->patOrg.y + pDrawable->y - y); fbFinishAccess(&pStip->drawable); } else { FbStip *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; FbBits fgand, fgxor, bgand, bgxor; fgand = pPriv->and; fgxor = pPriv->xor; if (pGC->fillStyle == FillStippled) { bgand = fbAnd(GXnoop, (FbBits) 0, FB_ALLONES); bgxor = fbXor(GXnoop, (FbBits) 0, FB_ALLONES); } else { bgand = pPriv->bgand; bgxor = pPriv->bgxor; } fbGetStipDrawable(&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbStipple(dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, stip, stipStride, stipWidth, stipHeight, fgand, fgxor, bgand, bgxor, pGC->patOrg.x + pDrawable->x + dstXoff, pGC->patOrg.y + pDrawable->y - y); fbFinishAccess(&pStip->drawable); } break; } case FillTiled:{ PixmapPtr pTile = pGC->tile.pixmap; FbBits *tile; FbStride tileStride; int tileBpp; int tileWidth; int tileHeight; _X_UNUSED int tileXoff, tileYoff; fbGetDrawable(&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; fbTile(dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, width * dstBpp, height, tile, tileStride, tileWidth * tileBpp, tileHeight, pGC->alu, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, pGC->patOrg.y + pDrawable->y - y); fbFinishAccess(&pTile->drawable); break; } } fbValidateDrawable(pDrawable); fbFinishAccess(pDrawable); } void fbSolidBoxClipped(DrawablePtr pDrawable, RegionPtr pClip, int x1, int y1, int x2, int y2, FbBits and, FbBits xor) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxPtr pbox; int nbox; int partX1, partX2, partY1, partY2; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { partX1 = pbox->x1; if (partX1 < x1) partX1 = x1; partX2 = pbox->x2; if (partX2 > x2) partX2 = x2; if (partX2 <= partX1) continue; partY1 = pbox->y1; if (partY1 < y1) partY1 = y1; partY2 = pbox->y2; if (partY2 > y2) partY2 = y2; if (partY2 <= partY1) continue; #ifndef FB_ACCESS_WRAPPER if (and || !pixman_fill((uint32_t *) dst, dstStride, dstBpp, partX1 + dstXoff, partY1 + dstYoff, (partX2 - partX1), (partY2 - partY1), xor)) #endif fbSolid(dst + (partY1 + dstYoff) * dstStride, dstStride, (partX1 + dstXoff) * dstBpp, dstBpp, (partX2 - partX1) * dstBpp, (partY2 - partY1), and, xor); } fbFinishAccess(pDrawable); } xorg-server-1.20.8/fb/fbglyph.c0000644000175000017500000001637413640201473013207 00000000000000/* * * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" #include #include "dixfontstr.h" static Bool fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height) { BoxRec box; BoxPtr pExtents = RegionExtents(pRegion); /* * Check extents by hand to avoid 16 bit overflows */ if (x < (int) pExtents->x1) return FALSE; if ((int) pExtents->x2 < x + width) return FALSE; if (y < (int) pExtents->y1) return FALSE; if ((int) pExtents->y2 < y + height) return FALSE; box.x1 = x; box.x2 = x + width; box.y1 = y; box.y2 = y + height; return RegionContainsRect(pRegion, &box) == rgnIN; } void fbPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr pci; unsigned char *pglyph; /* pointer bits in glyph */ int gx, gy; int gWidth, gHeight; /* width and height of glyph */ FbStride gStride; /* stride of glyph */ void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int); FbBits *dst = 0; FbStride dstStride = 0; int dstBpp = 0; int dstXoff = 0, dstYoff = 0; glyph = 0; if (pGC->fillStyle == FillSolid && pPriv->and == 0) { dstBpp = pDrawable->bitsPerPixel; switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; case 32: glyph = fbGlyph32; break; } } x += pDrawable->x; y += pDrawable->y; while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { gx = x + pci->metrics.leftSideBearing; gy = y - pci->metrics.ascent; if (glyph && gWidth <= sizeof(FbStip) * 8 && fbGlyphIn(fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, (FbStip *) pglyph, pPriv->xor, gx + dstXoff, gHeight); fbFinishAccess(pDrawable); } else { gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof(FbStip); fbPushImage(pDrawable, pGC, (FbStip *) pglyph, gStride, 0, gx, gy, gWidth, gHeight); } } x += pci->metrics.characterWidth; } } void fbImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppciInit, void *pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr *ppci; CharInfoPtr pci; unsigned char *pglyph; /* pointer bits in glyph */ int gWidth, gHeight; /* width and height of glyph */ FbStride gStride; /* stride of glyph */ Bool opaque; int n; int gx, gy; void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int); FbBits *dst = 0; FbStride dstStride = 0; int dstBpp = 0; int dstXoff = 0, dstYoff = 0; glyph = 0; if (pPriv->and == 0) { dstBpp = pDrawable->bitsPerPixel; switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; case 32: glyph = fbGlyph32; break; } } x += pDrawable->x; y += pDrawable->y; if (TERMINALFONT(pGC->font) && !glyph) { opaque = TRUE; } else { int xBack, widthBack; int yBack, heightBack; ppci = ppciInit; n = nglyph; widthBack = 0; while (n--) widthBack += (*ppci++)->metrics.characterWidth; xBack = x; if (widthBack < 0) { xBack += widthBack; widthBack = -widthBack; } yBack = y - FONTASCENT(pGC->font); heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); fbSolidBoxClipped(pDrawable, fbGetCompositeClip(pGC), xBack, yBack, xBack + widthBack, yBack + heightBack, fbAnd(GXcopy, pPriv->bg, pPriv->pm), fbXor(GXcopy, pPriv->bg, pPriv->pm)); opaque = FALSE; } ppci = ppciInit; while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { gx = x + pci->metrics.leftSideBearing; gy = y - pci->metrics.ascent; if (glyph && gWidth <= sizeof(FbStip) * 8 && fbGlyphIn(fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight); fbFinishAccess(pDrawable); } else { gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof(FbStip); fbPutXYImage(pDrawable, fbGetCompositeClip(pGC), pPriv->fg, pPriv->bg, pPriv->pm, GXcopy, opaque, gx, gy, gWidth, gHeight, (FbStip *) pglyph, gStride, 0); } } x += pci->metrics.characterWidth; } } xorg-server-1.20.8/fb/fbarc.c0000644000175000017500000001167613640201473012631 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" #include "mizerarc.h" #include typedef void (*FbArc) (FbBits * dst, FbStride dstStride, int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor); void fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) { FbArc arc; if (pGC->lineWidth == 0) { arc = 0; if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid) { switch (pDrawable->bitsPerPixel) { case 8: arc = fbArc8; break; case 16: arc = fbArc16; break; case 32: arc = fbArc32; break; } } if (arc) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxRec box; int x2, y2; RegionPtr cclip; #ifdef FB_ACCESS_WRAPPER int wrapped = 1; #endif cclip = fbGetCompositeClip(pGC); fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (narcs--) { if (miCanZeroArc(parcs)) { box.x1 = parcs->x + pDrawable->x; box.y1 = parcs->y + pDrawable->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int) parcs->width + 1; box.x2 = x2; y2 = box.y1 + (int) parcs->height + 1; box.y2 = y2; if ((x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && (RegionContainsRect(cclip, &box) == rgnIN)) { #ifdef FB_ACCESS_WRAPPER if (!wrapped) { fbPrepareAccess(pDrawable); wrapped = 1; } #endif (*arc) (dst, dstStride, dstBpp, parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff, pPriv->and, pPriv->xor); } else { #ifdef FB_ACCESS_WRAPPER if (wrapped) { fbFinishAccess(pDrawable); wrapped = 0; } #endif miZeroPolyArc(pDrawable, pGC, 1, parcs); } } else { #ifdef FB_ACCESS_WRAPPER if (wrapped) { fbFinishAccess(pDrawable); wrapped = 0; } #endif miPolyArc(pDrawable, pGC, 1, parcs); } parcs++; } #ifdef FB_ACCESS_WRAPPER if (wrapped) { fbFinishAccess(pDrawable); wrapped = 0; } #endif } else miZeroPolyArc(pDrawable, pGC, narcs, parcs); } else miPolyArc(pDrawable, pGC, narcs, parcs); } xorg-server-1.20.8/fb/fbbits.c0000644000175000017500000000507413640201473013020 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" #include "miline.h" #include "mizerarc.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef BITS #undef BITS2 #undef BITS4 #define BRESSOLID fbBresSolid8 #define BRESDASH fbBresDash8 #define DOTS fbDots8 #define ARC fbArc8 #define GLYPH fbGlyph8 #define POLYLINE fbPolyline8 #define POLYSEGMENT fbPolySegment8 #define BITS BYTE #define BITS2 CARD16 #define BITS4 CARD32 #include "fbbits.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef POLYLINE #undef POLYSEGMENT #undef BITS #undef BITS2 #undef BITS4 #define BRESSOLID fbBresSolid16 #define BRESDASH fbBresDash16 #define DOTS fbDots16 #define ARC fbArc16 #define GLYPH fbGlyph16 #define POLYLINE fbPolyline16 #define POLYSEGMENT fbPolySegment16 #define BITS CARD16 #define BITS2 CARD32 #include "fbbits.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef POLYLINE #undef POLYSEGMENT #undef BITS #undef BITS2 #define BRESSOLID fbBresSolid32 #define BRESDASH fbBresDash32 #define DOTS fbDots32 #define ARC fbArc32 #define GLYPH fbGlyph32 #define POLYLINE fbPolyline32 #define POLYSEGMENT fbPolySegment32 #define BITS CARD32 #include "fbbits.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef POLYLINE #undef POLYSEGMENT #undef BITS xorg-server-1.20.8/fb/fbblt.c0000644000175000017500000002514313640201473012637 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" #define InitializeShifts(sx,dx,ls,rs) { \ if (sx != dx) { \ if (sx > dx) { \ ls = sx - dx; \ rs = FB_UNIT - ls; \ } else { \ rs = dx - sx; \ ls = FB_UNIT - rs; \ } \ } \ } void fbBlt(FbBits * srcLine, FbStride srcStride, int srcX, FbBits * dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown) { FbBits *src, *dst; int leftShift, rightShift; FbBits startmask, endmask; FbBits bits, bits1; int n, nmiddle; Bool destInvarient; int startbyte, endbyte; FbDeclareMergeRop(); if (alu == GXcopy && pm == FB_ALLONES && !(srcX & 7) && !(dstX & 7) && !(width & 7)) { CARD8 *src_byte = (CARD8 *) srcLine + (srcX >> 3); CARD8 *dst_byte = (CARD8 *) dstLine + (dstX >> 3); FbStride src_byte_stride = srcStride << (FB_SHIFT - 3); FbStride dst_byte_stride = dstStride << (FB_SHIFT - 3); int width_byte = (width >> 3); /* Make sure there's no overlap; we can't use memcpy in that * case as it's not well defined, so fall through to the * general code */ if (src_byte + width_byte <= dst_byte || dst_byte + width_byte <= src_byte) { int i; if (!upsidedown) for (i = 0; i < height; i++) MEMCPY_WRAPPED(dst_byte + i * dst_byte_stride, src_byte + i * src_byte_stride, width_byte); else for (i = height - 1; i >= 0; i--) MEMCPY_WRAPPED(dst_byte + i * dst_byte_stride, src_byte + i * src_byte_stride, width_byte); return; } } FbInitializeMergeRop(alu, pm); destInvarient = FbDestInvarientMergeRop(); if (upsidedown) { srcLine += (height - 1) * (srcStride); dstLine += (height - 1) * (dstStride); srcStride = -srcStride; dstStride = -dstStride; } FbMaskBitsBytes(dstX, width, destInvarient, startmask, startbyte, nmiddle, endmask, endbyte); if (reverse) { srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; srcX = (srcX + width - 1) & FB_MASK; dstX = (dstX + width - 1) & FB_MASK; } else { srcLine += srcX >> FB_SHIFT; dstLine += dstX >> FB_SHIFT; srcX &= FB_MASK; dstX &= FB_MASK; } if (srcX == dstX) { while (height--) { src = srcLine; srcLine += srcStride; dst = dstLine; dstLine += dstStride; if (reverse) { if (endmask) { bits = READ(--src); --dst; FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } n = nmiddle; if (destInvarient) { while (n--) WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src))); } else { while (n--) { bits = READ(--src); --dst; WRITE(dst, FbDoMergeRop(bits, READ(dst))); } } if (startmask) { bits = READ(--src); --dst; FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); } } else { if (startmask) { bits = READ(src++); FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); dst++; } n = nmiddle; if (destInvarient) { #if 0 /* * This provides some speedup on screen->screen blts * over the PCI bus, usually about 10%. But fb * isn't usually used for this operation... */ if (_ca2 + 1 == 0 && _cx2 == 0) { FbBits t1, t2, t3, t4; while (n >= 4) { t1 = *src++; t2 = *src++; t3 = *src++; t4 = *src++; *dst++ = t1; *dst++ = t2; *dst++ = t3; *dst++ = t4; n -= 4; } } #endif while (n--) WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++))); } else { while (n--) { bits = READ(src++); WRITE(dst, FbDoMergeRop(bits, READ(dst))); dst++; } } if (endmask) { bits = READ(src); FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } } } } else { if (srcX > dstX) { leftShift = srcX - dstX; rightShift = FB_UNIT - leftShift; } else { rightShift = dstX - srcX; leftShift = FB_UNIT - rightShift; } while (height--) { src = srcLine; srcLine += srcStride; dst = dstLine; dstLine += dstStride; bits1 = 0; if (reverse) { if (srcX < dstX) bits1 = READ(--src); if (endmask) { bits = FbScrRight(bits1, rightShift); if (FbScrRight(endmask, leftShift)) { bits1 = READ(--src); bits |= FbScrLeft(bits1, leftShift); } --dst; FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } n = nmiddle; if (destInvarient) { while (n--) { bits = FbScrRight(bits1, rightShift); bits1 = READ(--src); bits |= FbScrLeft(bits1, leftShift); --dst; WRITE(dst, FbDoDestInvarientMergeRop(bits)); } } else { while (n--) { bits = FbScrRight(bits1, rightShift); bits1 = READ(--src); bits |= FbScrLeft(bits1, leftShift); --dst; WRITE(dst, FbDoMergeRop(bits, READ(dst))); } } if (startmask) { bits = FbScrRight(bits1, rightShift); if (FbScrRight(startmask, leftShift)) { bits1 = READ(--src); bits |= FbScrLeft(bits1, leftShift); } --dst; FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); } } else { if (srcX > dstX) bits1 = READ(src++); if (startmask) { bits = FbScrLeft(bits1, leftShift); if (FbScrLeft(startmask, rightShift)) { bits1 = READ(src++); bits |= FbScrRight(bits1, rightShift); } FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); dst++; } n = nmiddle; if (destInvarient) { while (n--) { bits = FbScrLeft(bits1, leftShift); bits1 = READ(src++); bits |= FbScrRight(bits1, rightShift); WRITE(dst, FbDoDestInvarientMergeRop(bits)); dst++; } } else { while (n--) { bits = FbScrLeft(bits1, leftShift); bits1 = READ(src++); bits |= FbScrRight(bits1, rightShift); WRITE(dst, FbDoMergeRop(bits, READ(dst))); dst++; } } if (endmask) { bits = FbScrLeft(bits1, leftShift); if (FbScrLeft(endmask, rightShift)) { bits1 = READ(src); bits |= FbScrRight(bits1, rightShift); } FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } } } } } void fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */ int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */ int dstX, int width, int height, int alu, FbBits pm, int bpp) { fbBlt((FbBits *) src, FbStipStrideToBitsStride(srcStride), srcX, (FbBits *) dst, FbStipStrideToBitsStride(dstStride), dstX, width, height, alu, pm, bpp, FALSE, FALSE); } xorg-server-1.20.8/fb/meson.build0000644000175000017500000000152413640201473013541 00000000000000srcs_fb = [ 'fballpriv.c', 'fbarc.c', 'fbbits.c', 'fbblt.c', 'fbbltone.c', 'fbcmap_mi.c', 'fbcopy.c', 'fbfill.c', 'fbfillrect.c', 'fbfillsp.c', 'fbgc.c', 'fbgetsp.c', 'fbglyph.c', 'fbimage.c', 'fbline.c', 'fboverlay.c', 'fbpict.c', 'fbpixmap.c', 'fbpoint.c', 'fbpush.c', 'fbscreen.c', 'fbseg.c', 'fbsetsp.c', 'fbsolid.c', 'fbtrap.c', 'fbutil.c', 'fbwindow.c', ] hdrs_fb = [ 'fb.h', 'fboverlay.h', 'fbpict.h', 'fbrop.h', 'wfbrename.h' ] libxserver_fb = static_library('libxserver_fb', srcs_fb, include_directories: inc, dependencies: common_dep, pic: true, ) wfb_args = '-DFB_ACCESS_WRAPPER' libxserver_wfb = static_library('libxserver_wfb', srcs_fb, c_args: wfb_args, include_directories: inc, dependencies: common_dep, pic: true, build_by_default: false, ) install_data(hdrs_fb, install_dir: xorgsdkdir) xorg-server-1.20.8/fb/fbbltone.c0000644000175000017500000003520213640201473013336 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" /* * Stipple masks are independent of bit/byte order as long * as bitorder == byteorder. FB doesn't handle the case * where these differ */ #define BitsMask(x,w) ((FB_ALLONES << ((x) & FB_MASK)) & \ (FB_ALLONES >> ((FB_UNIT - ((x) + (w))) & FB_MASK))) #define Mask(x,w) BitsMask((x)*(w),(w)) #define SelMask(b,n,w) ((((b) >> n) & 1) * Mask(n,w)) #define C1(b,w) \ (SelMask(b,0,w)) #define C2(b,w) \ (SelMask(b,0,w) | \ SelMask(b,1,w)) #define C4(b,w) \ (SelMask(b,0,w) | \ SelMask(b,1,w) | \ SelMask(b,2,w) | \ SelMask(b,3,w)) #define C8(b,w) \ (SelMask(b,0,w) | \ SelMask(b,1,w) | \ SelMask(b,2,w) | \ SelMask(b,3,w) | \ SelMask(b,4,w) | \ SelMask(b,5,w) | \ SelMask(b,6,w) | \ SelMask(b,7,w)) static const FbBits fbStipple8Bits[256] = { C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4), C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4), C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4), C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4), C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4), C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4), C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4), C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4), C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4), C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4), C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4), C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4), C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4), C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4), C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4), C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4), C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4), C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4), C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4), C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4), C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4), C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4), C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4), C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4), C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4), C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4), C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4), C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4), C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4), C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4), C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4), C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4), C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4), C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4), C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4), C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4), C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4), C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4), C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4), C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4), C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4), C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4), C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4), }; static const FbBits fbStipple4Bits[16] = { C4(0, 8), C4(1, 8), C4(2, 8), C4(3, 8), C4(4, 8), C4(5, 8), C4(6, 8), C4(7, 8), C4(8, 8), C4(9, 8), C4(10, 8), C4(11, 8), C4(12, 8), C4(13, 8), C4(14, 8), C4(15, 8), }; static const FbBits fbStipple2Bits[4] = { C2(0, 16), C2(1, 16), C2(2, 16), C2(3, 16), }; static const FbBits fbStipple1Bits[2] = { C1(0, 32), C1(1, 32), }; #ifdef __clang__ /* shift overflow is intentional */ #pragma clang diagnostic ignored "-Wshift-overflow" #endif /* * Example: srcX = 13 dstX = 8 (FB unit 32 dstBpp 8) * * **** **** **** **** **** **** **** **** * ^ * ******** ******** ******** ******** * ^ * leftShift = 12 * rightShift = 20 * * Example: srcX = 0 dstX = 8 (FB unit 32 dstBpp 8) * * **** **** **** **** **** **** **** **** * ^ * ******** ******** ******** ******** * ^ * * leftShift = 24 * rightShift = 8 */ #define LoadBits {\ if (leftShift) { \ bitsRight = (src < srcEnd ? READ(src++) : 0); \ bits = (FbStipLeft (bitsLeft, leftShift) | \ FbStipRight(bitsRight, rightShift)); \ bitsLeft = bitsRight; \ } else \ bits = (src < srcEnd ? READ(src++) : 0); \ } void fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ FbBits fgand, /* rrop values */ FbBits fgxor, FbBits bgand, FbBits bgxor) { const FbBits *fbBits; FbBits *srcEnd; int pixelsPerDst; /* dst pixels per FbBits */ int unitsPerSrc; /* src patterns per FbStip */ int leftShift, rightShift; /* align source with dest */ FbBits startmask, endmask; /* dest scanline masks */ FbStip bits = 0, bitsLeft, bitsRight; /* source bits */ FbStip left; FbBits mask; int nDst; /* dest longwords (w.o. end) */ int w; int n, nmiddle; int dstS; /* stipple-relative dst X coordinate */ Bool copy; /* accelerate dest-invariant */ Bool transparent; /* accelerate 0 nop */ int srcinc; /* source units consumed */ Bool endNeedsLoad = FALSE; /* need load for endmask */ int startbyte, endbyte; /* * Do not read past the end of the buffer! */ srcEnd = src + height * srcStride; /* * Number of destination units in FbBits == number of stipple pixels * used each time */ pixelsPerDst = FB_UNIT / dstBpp; /* * Number of source stipple patterns in FbStip */ unitsPerSrc = FB_STIP_UNIT / pixelsPerDst; copy = FALSE; transparent = FALSE; if (bgand == 0 && fgand == 0) copy = TRUE; else if (bgand == FB_ALLONES && bgxor == 0) transparent = TRUE; /* * Adjust source and dest to nearest FbBits boundary */ src += srcX >> FB_STIP_SHIFT; dst += dstX >> FB_SHIFT; srcX &= FB_STIP_MASK; dstX &= FB_MASK; FbMaskBitsBytes(dstX, width, copy, startmask, startbyte, nmiddle, endmask, endbyte); /* * Compute effective dest alignment requirement for * source -- must align source to dest unit boundary */ dstS = dstX / dstBpp; /* * Compute shift constants for effective alignement */ if (srcX >= dstS) { leftShift = srcX - dstS; rightShift = FB_STIP_UNIT - leftShift; } else { rightShift = dstS - srcX; leftShift = FB_STIP_UNIT - rightShift; } /* * Get pointer to stipple mask array for this depth */ fbBits = 0; /* unused */ switch (pixelsPerDst) { case 8: fbBits = fbStipple8Bits; break; case 4: fbBits = fbStipple4Bits; break; case 2: fbBits = fbStipple2Bits; break; case 1: fbBits = fbStipple1Bits; break; default: return; } /* * Compute total number of destination words written, but * don't count endmask */ nDst = nmiddle; if (startmask) nDst++; dstStride -= nDst; /* * Compute total number of source words consumed */ srcinc = (nDst + unitsPerSrc - 1) / unitsPerSrc; if (srcX > dstS) srcinc++; if (endmask) { endNeedsLoad = nDst % unitsPerSrc == 0; if (endNeedsLoad) srcinc++; } srcStride -= srcinc; /* * Copy rectangle */ while (height--) { w = nDst; /* total units across scanline */ n = unitsPerSrc; /* units avail in single stipple */ if (n > w) n = w; bitsLeft = 0; if (srcX > dstS) bitsLeft = READ(src++); if (n) { /* * Load first set of stipple bits */ LoadBits; /* * Consume stipple bits for startmask */ if (startmask) { mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)]; if (mask || !transparent) FbDoLeftMaskByteStippleRRop(dst, mask, fgand, fgxor, bgand, bgxor, startbyte, startmask); bits = FbStipLeft(bits, pixelsPerDst); dst++; n--; w--; } /* * Consume stipple bits across scanline */ for (;;) { w -= n; if (copy) { while (n--) { mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)]; WRITE(dst, FbOpaqueStipple(mask, fgxor, bgxor)); dst++; bits = FbStipLeft(bits, pixelsPerDst); } } else { while (n--) { left = FbLeftStipBits(bits, pixelsPerDst); if (left || !transparent) { mask = fbBits[left]; WRITE(dst, FbStippleRRop(READ(dst), mask, fgand, fgxor, bgand, bgxor)); } dst++; bits = FbStipLeft(bits, pixelsPerDst); } } if (!w) break; /* * Load another set and reset number of available units */ LoadBits; n = unitsPerSrc; if (n > w) n = w; } } /* * Consume stipple bits for endmask */ if (endmask) { if (endNeedsLoad) { LoadBits; } mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)]; if (mask || !transparent) FbDoRightMaskByteStippleRRop(dst, mask, fgand, fgxor, bgand, bgxor, endbyte, endmask); } dst += dstStride; src += srcStride; } } /* * Not very efficient, but simple -- copy a single plane * from an N bit image to a 1 bit image */ void fbBltPlane(FbBits * src, FbStride srcStride, int srcX, int srcBpp, FbStip * dst, FbStride dstStride, int dstX, int width, int height, FbStip fgand, FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask) { FbBits *s; FbBits pm; FbBits srcMask; FbBits srcMaskFirst; FbBits srcMask0 = 0; FbBits srcBits; FbStip dstBits; FbStip *d; FbStip dstMask; FbStip dstMaskFirst; FbStip dstUnion; int w; int wt; if (!width) return; src += srcX >> FB_SHIFT; srcX &= FB_MASK; dst += dstX >> FB_STIP_SHIFT; dstX &= FB_STIP_MASK; w = width / srcBpp; pm = fbReplicatePixel(planeMask, srcBpp); srcMaskFirst = pm & FbBitsMask(srcX, srcBpp); srcMask0 = pm & FbBitsMask(0, srcBpp); dstMaskFirst = FbStipMask(dstX, 1); while (height--) { d = dst; dst += dstStride; s = src; src += srcStride; srcMask = srcMaskFirst; srcBits = READ(s++); dstMask = dstMaskFirst; dstUnion = 0; dstBits = 0; wt = w; while (wt--) { if (!srcMask) { srcBits = READ(s++); srcMask = srcMask0; } if (!dstMask) { WRITE(d, FbStippleRRopMask(READ(d), dstBits, fgand, fgxor, bgand, bgxor, dstUnion)); d++; dstMask = FbStipMask(0, 1); dstUnion = 0; dstBits = 0; } if (srcBits & srcMask) dstBits |= dstMask; dstUnion |= dstMask; if (srcBpp == FB_UNIT) srcMask = 0; else srcMask = FbScrRight(srcMask, srcBpp); dstMask = FbStipRight(dstMask, 1); } if (dstUnion) WRITE(d, FbStippleRRopMask(READ(d), dstBits, fgand, fgxor, bgand, bgxor, dstUnion)); } } xorg-server-1.20.8/fb/fbseg.c0000644000175000017500000003113013640201473012625 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include #include "fb.h" #include "miline.h" #define fbBresShiftMask(mask,dir,bpp) ((bpp == FB_STIP_UNIT) ? 0 : \ ((dir < 0) ? FbStipLeft(mask,bpp) : \ FbStipRight(mask,bpp))) static void fbBresSolid(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbStip and = (FbStip) pPriv->and; FbStip xor = (FbStip) pPriv->xor; FbStip mask, mask0; FbStip bits; fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * dstBpp; dst += x1 >> FB_STIP_SHIFT; x1 &= FB_STIP_MASK; mask0 = FbStipMask(0, dstBpp); mask = FbStipRight(mask0, x1); if (signdx < 0) mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp); if (signdy < 0) dstStride = -dstStride; if (axis == X_AXIS) { bits = 0; while (len--) { bits |= mask; mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits)); bits = 0; dst += signdx; mask = mask0; } e += e1; if (e >= 0) { if (bits) { WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits)); bits = 0; } dst += dstStride; e += e3; } } if (bits) WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits)); } else { while (len--) { WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask)); dst += dstStride; e += e1; if (e >= 0) { e += e3; mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { dst += signdx; mask = mask0; } } } } fbFinishAccess(pDrawable); } static void fbBresDash(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbStip and = (FbStip) pPriv->and; FbStip xor = (FbStip) pPriv->xor; FbStip bgand = (FbStip) pPriv->bgand; FbStip bgxor = (FbStip) pPriv->bgxor; FbStip mask, mask0; FbDashDeclare; int dashlen; Bool even; Bool doOdd; fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); doOdd = pGC->lineStyle == LineDoubleDash; FbDashInit(pGC, pPriv, dashOffset, dashlen, even); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * dstBpp; dst += x1 >> FB_STIP_SHIFT; x1 &= FB_STIP_MASK; mask0 = FbStipMask(0, dstBpp); mask = FbStipRight(mask0, x1); if (signdx < 0) mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp); if (signdy < 0) dstStride = -dstStride; while (len--) { if (even) WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask)); else if (doOdd) WRITE(dst, FbDoMaskRRop(READ(dst), bgand, bgxor, mask)); if (axis == X_AXIS) { mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { dst += signdx; mask = mask0; } e += e1; if (e >= 0) { dst += dstStride; e += e3; } } else { dst += dstStride; e += e1; if (e >= 0) { e += e3; mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { dst += signdx; mask = mask0; } } } FbDashStep(dashlen, even); } fbFinishAccess(pDrawable); } static void fbBresFill(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { while (len--) { fbFill(pDrawable, pGC, x1, y1, 1, 1); if (axis == X_AXIS) { x1 += signdx; e += e1; if (e >= 0) { e += e3; y1 += signdy; } } else { y1 += signdy; e += e1; if (e >= 0) { e += e3; x1 += signdx; } } } } static void fbSetFg(DrawablePtr pDrawable, GCPtr pGC, Pixel fg) { if (fg != pGC->fgPixel) { ChangeGCVal val; val.val = fg; ChangeGC(NullClient, pGC, GCForeground, &val); ValidateGC(pDrawable, pGC); } } static void fbBresFillDash(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbDashDeclare; int dashlen; Bool even; Bool doOdd; Bool doBg; Pixel fg, bg; fg = pGC->fgPixel; bg = pGC->bgPixel; /* whether to fill the odd dashes */ doOdd = pGC->lineStyle == LineDoubleDash; /* whether to switch fg to bg when filling odd dashes */ doBg = doOdd && (pGC->fillStyle == FillSolid || pGC->fillStyle == FillStippled); /* compute current dash position */ FbDashInit(pGC, pPriv, dashOffset, dashlen, even); while (len--) { if (even || doOdd) { if (doBg) { if (even) fbSetFg(pDrawable, pGC, fg); else fbSetFg(pDrawable, pGC, bg); } fbFill(pDrawable, pGC, x1, y1, 1, 1); } if (axis == X_AXIS) { x1 += signdx; e += e1; if (e >= 0) { e += e3; y1 += signdy; } } else { y1 += signdy; e += e1; if (e >= 0) { e += e3; x1 += signdx; } } FbDashStep(dashlen, even); } if (doBg) fbSetFg(pDrawable, pGC, fg); } /* * For drivers that want to bail drawing some lines, this * function takes care of selecting the appropriate rasterizer * based on the contents of the specified GC. */ static FbBres * fbSelectBres(DrawablePtr pDrawable, GCPtr pGC) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); int dstBpp = pDrawable->bitsPerPixel; FbBres *bres; if (pGC->lineStyle == LineSolid) { bres = fbBresFill; if (pGC->fillStyle == FillSolid) { bres = fbBresSolid; if (pPriv->and == 0) { switch (dstBpp) { case 8: bres = fbBresSolid8; break; case 16: bres = fbBresSolid16; break; case 32: bres = fbBresSolid32; break; } } } } else { bres = fbBresFillDash; if (pGC->fillStyle == FillSolid) { bres = fbBresDash; if (pPriv->and == 0 && (pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0)) { switch (dstBpp) { case 8: bres = fbBresDash8; break; case 16: bres = fbBresDash16; break; case 32: bres = fbBresDash32; break; } } } } return bres; } void fbSegment(DrawablePtr pDrawable, GCPtr pGC, int x1, int y1, int x2, int y2, Bool drawLast, int *dashOffset) { FbBres *bres; RegionPtr pClip = fbGetCompositeClip(pGC); BoxPtr pBox; int nBox; int adx; /* abs values of dx and dy */ int ady; int signdx; /* sign of dx and dy */ int signdy; int e, e1, e2, e3; /* bresenham error and increments */ int len; /* length of segment */ int axis; /* major axis */ int octant; int dashoff; int doff; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ nBox = RegionNumRects(pClip); pBox = RegionRects(pClip); bres = fbSelectBres(pDrawable, pGC); CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { axis = X_AXIS; e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; len = adx; } else { axis = Y_AXIS; e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; SetYMajorOctant(octant); len = ady; } FIXUP_ERROR(e, octant, bias); /* * Adjust error terms to compare against zero */ e3 = e2 - e1; e = e - e1; /* we have bresenham parameters and two points. all we have to do now is clip and draw. */ if (drawLast) len++; dashoff = *dashOffset; *dashOffset = dashoff + len; while (nBox--) { oc1 = 0; oc2 = 0; OUTCODES(oc1, x1, y1, pBox); OUTCODES(oc2, x2, y2, pBox); if ((oc1 | oc2) == 0) { (*bres) (pDrawable, pGC, dashoff, signdx, signdy, axis, x1, y1, e, e1, e3, len); break; } else if (oc1 & oc2) { pBox++; } else { int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2 - 1, pBox->y2 - 1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &clip1, &clip2, octant, bias, oc1, oc2) == -1) { pBox++; continue; } if (axis == X_AXIS) len = abs(new_x2 - new_x1); else len = abs(new_y2 - new_y1); if (clip2 != 0 || drawLast) len++; if (len) { /* unwind bresenham error term to first point */ doff = dashoff; err = e; if (clip1) { clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); if (axis == X_AXIS) { doff += clipdx; err += e3 * clipdy + e1 * clipdx; } else { doff += clipdy; err += e3 * clipdx + e1 * clipdy; } } (*bres) (pDrawable, pGC, doff, signdx, signdy, axis, new_x1, new_y1, err, e1, e3, len); } pBox++; } } /* while (nBox--) */ } xorg-server-1.20.8/fb/fbpush.c0000644000175000017500000001316513640201473013036 00000000000000/* * Copyright © 1998 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H #include #endif #include "fb.h" static void fbPushPattern(DrawablePtr pDrawable, GCPtr pGC, FbStip * src, FbStride srcStride, int srcX, int x, int y, int width, int height) { FbStip *s, bitsMask, bitsMask0, bits; int xspan; int w; int lenspan; src += srcX >> FB_STIP_SHIFT; srcX &= FB_STIP_MASK; bitsMask0 = FbStipMask(srcX, 1); while (height--) { bitsMask = bitsMask0; w = width; s = src; src += srcStride; bits = READ(s++); xspan = x; while (w) { if (bits & bitsMask) { lenspan = 0; do { lenspan++; if (lenspan == w) break; bitsMask = FbStipRight(bitsMask, 1); if (!bitsMask) { bits = READ(s++); bitsMask = FbBitsMask(0, 1); } } while (bits & bitsMask); fbFill(pDrawable, pGC, xspan, y, lenspan, 1); xspan += lenspan; w -= lenspan; } else { do { w--; xspan++; if (!w) break; bitsMask = FbStipRight(bitsMask, 1); if (!bitsMask) { bits = READ(s++); bitsMask = FbBitsMask(0, 1); } } while (!(bits & bitsMask)); } } y++; } } static void fbPushFill(DrawablePtr pDrawable, GCPtr pGC, FbStip * src, FbStride srcStride, int srcX, int x, int y, int width, int height) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); if (pGC->fillStyle == FillSolid) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int dstX; int dstWidth; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst = dst + (y + dstYoff) * dstStride; dstX = (x + dstXoff) * dstBpp; dstWidth = width * dstBpp; if (dstBpp == 1) { fbBltStip(src, srcStride, srcX, (FbStip *) dst, FbBitsStrideToStipStride(dstStride), dstX, dstWidth, height, FbStipple1Rop(pGC->alu, pGC->fgPixel), pPriv->pm, dstBpp); } else { fbBltOne(src, srcStride, srcX, dst, dstStride, dstX, dstBpp, dstWidth, height, pPriv->and, pPriv->xor, fbAnd(GXnoop, (FbBits) 0, FB_ALLONES), fbXor(GXnoop, (FbBits) 0, FB_ALLONES)); } fbFinishAccess(pDrawable); } else { fbPushPattern(pDrawable, pGC, src, srcStride, srcX, x, y, width, height); } } void fbPushImage(DrawablePtr pDrawable, GCPtr pGC, FbStip * src, FbStride srcStride, int srcX, int x, int y, int width, int height) { RegionPtr pClip = fbGetCompositeClip(pGC); int nbox; BoxPtr pbox; int x1, y1, x2, y2; for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; fbPushFill(pDrawable, pGC, src + (y1 - y) * srcStride, srcStride, srcX + (x1 - x), x1, y1, x2 - x1, y2 - y1); } } void fbPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) { FbStip *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; fbGetStipDrawable(&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbPushImage(pDrawable, pGC, stip, stipStride, 0, xOrg, yOrg, dx, dy); } xorg-server-1.20.8/fb/fboverlay.c0000644000175000017500000002417413640201473013542 00000000000000/* * * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * 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: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #include "fboverlay.h" #include "shmint.h" static DevPrivateKeyRec fbOverlayScreenPrivateKeyRec; #define fbOverlayScreenPrivateKey (&fbOverlayScreenPrivateKeyRec) DevPrivateKey fbOverlayGetScreenPrivateKey(void) { return fbOverlayScreenPrivateKey; } /* * Replace this if you want something supporting * multiple overlays with the same depth */ Bool fbOverlayCreateWindow(WindowPtr pWin) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); int i; PixmapPtr pPixmap; if (pWin->drawable.class != InputOutput) return TRUE; for (i = 0; i < pScrPriv->nlayers; i++) { pPixmap = pScrPriv->layer[i].u.run.pixmap; if (pWin->drawable.depth == pPixmap->drawable.depth) { dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin), pPixmap); /* * Make sure layer keys are written correctly by * having non-root layers set to full while the * root layer is set to empty. This will cause * all of the layers to get painted when the root * is mapped */ if (!pWin->parent) { RegionEmpty(&pScrPriv->layer[i].u.run.region); } return TRUE; } } return FALSE; } Bool fbOverlayCloseScreen(ScreenPtr pScreen) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); int i; for (i = 0; i < pScrPriv->nlayers; i++) { (*pScreen->DestroyPixmap) (pScrPriv->layer[i].u.run.pixmap); RegionUninit(&pScrPriv->layer[i].u.run.region); } return TRUE; } /* * Return layer containing this window */ int fbOverlayWindowLayer(WindowPtr pWin) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); int i; for (i = 0; i < pScrPriv->nlayers; i++) if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin)) == (void *) pScrPriv->layer[i].u.run.pixmap) return i; return 0; } Bool fbOverlayCreateScreenResources(ScreenPtr pScreen) { int i; FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); PixmapPtr pPixmap; void *pbits; int width; int depth; BoxRec box; if (!miCreateScreenResources(pScreen)) return FALSE; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; for (i = 0; i < pScrPriv->nlayers; i++) { pbits = pScrPriv->layer[i].u.init.pbits; width = pScrPriv->layer[i].u.init.width; depth = pScrPriv->layer[i].u.init.depth; pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width, pScreen->height, depth, BitsPerPixel(depth), PixmapBytePad(width, depth), pbits)) return FALSE; pScrPriv->layer[i].u.run.pixmap = pPixmap; RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0); } pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap; return TRUE; } void fbOverlayPaintKey(DrawablePtr pDrawable, RegionPtr pRegion, CARD32 pixel, int layer) { fbFillRegionSolid(pDrawable, pRegion, 0, fbReplicatePixel(pixel, pDrawable->bitsPerPixel)); } /* * Track visible region for each layer */ void fbOverlayUpdateLayerRegion(ScreenPtr pScreen, int layer, RegionPtr prgn) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); int i; RegionRec rgnNew; if (!prgn || !RegionNotEmpty(prgn)) return; for (i = 0; i < pScrPriv->nlayers; i++) { if (i == layer) { /* add new piece to this fb */ RegionUnion(&pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); } else if (RegionNotEmpty(&pScrPriv->layer[i].u.run.region)) { /* paint new piece with chroma key */ RegionNull(&rgnNew); RegionIntersect(&rgnNew, prgn, &pScrPriv->layer[i].u.run.region); (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable, &rgnNew, pScrPriv->layer[i].key, i); RegionUninit(&rgnNew); /* remove piece from other fbs */ RegionSubtract(&pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); } } } /* * Copy only areas in each layer containing real bits */ void fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); RegionRec rgnDst; int dx, dy; int i; RegionRec layerRgn[FB_OVERLAY_MAX]; PixmapPtr pPixmap; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; /* * Clip to existing bits */ RegionTranslate(prgnSrc, -dx, -dy); RegionNull(&rgnDst); RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); RegionTranslate(&rgnDst, dx, dy); /* * Compute the portion of each fb affected by this copy */ for (i = 0; i < pScrPriv->nlayers; i++) { RegionNull(&layerRgn[i]); RegionIntersect(&layerRgn[i], &rgnDst, &pScrPriv->layer[i].u.run.region); if (RegionNotEmpty(&layerRgn[i])) { RegionTranslate(&layerRgn[i], -dx, -dy); pPixmap = pScrPriv->layer[i].u.run.pixmap; miCopyRegion(&pPixmap->drawable, &pPixmap->drawable, 0, &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0, (void *) (long) i); } } /* * Update regions */ for (i = 0; i < pScrPriv->nlayers; i++) { if (RegionNotEmpty(&layerRgn[i])) fbOverlayUpdateLayerRegion(pScreen, i, &layerRgn[i]); RegionUninit(&layerRgn[i]); } RegionUninit(&rgnDst); } void fbOverlayWindowExposures(WindowPtr pWin, RegionPtr prgn) { fbOverlayUpdateLayerRegion(pWin->drawable.pScreen, fbOverlayWindowLayer(pWin), prgn); miWindowExposures(pWin, prgn); } Bool fbOverlaySetupScreen(ScreenPtr pScreen, void *pbits1, void *pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2) { return fbSetupScreen(pScreen, pbits1, xsize, ysize, dpix, dpiy, width1, bpp1); } Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, void *pbits1, void *pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2, int depth1, int depth2) { VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; VisualID defaultVisual; FbOverlayScrPrivPtr pScrPriv; if (!dixRegisterPrivateKey (&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (bpp1 == 24 || bpp2 == 24) return FALSE; pScrPriv = malloc(sizeof(FbOverlayScrPrivRec)); if (!pScrPriv) return FALSE; if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &depth1, &defaultVisual, ((unsigned long) 1 << (bpp1 - 1)) | ((unsigned long) 1 << (bpp2 - 1)), 8)) { free(pScrPriv); return FALSE; } if (!miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0, depth1, ndepths, depths, defaultVisual, nvisuals, visuals)) { free(pScrPriv); return FALSE; } /* MI thinks there's no frame buffer */ #ifdef MITSHM ShmRegisterFbFuncs(pScreen); #endif pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 2; pScrPriv->nlayers = 2; pScrPriv->PaintKey = fbOverlayPaintKey; pScrPriv->CopyWindow = fbCopyWindowProc; pScrPriv->layer[0].u.init.pbits = pbits1; pScrPriv->layer[0].u.init.width = width1; pScrPriv->layer[0].u.init.depth = depth1; pScrPriv->layer[1].u.init.pbits = pbits2; pScrPriv->layer[1].u.init.width = width2; pScrPriv->layer[1].u.init.depth = depth2; dixSetPrivate(&pScreen->devPrivates, fbOverlayScreenPrivateKey, pScrPriv); /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbOverlayCloseScreen; pScreen->CreateScreenResources = fbOverlayCreateScreenResources; pScreen->CreateWindow = fbOverlayCreateWindow; pScreen->WindowExposures = fbOverlayWindowExposures; pScreen->CopyWindow = fbOverlayCopyWindow; return TRUE; } xorg-server-1.20.8/randr/0000755000175000017500000000000013640201533012171 500000000000000xorg-server-1.20.8/randr/rrtransform.h0000644000175000017500000000524213640201473014647 00000000000000/* * 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 #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, PictTransformPtr transform, struct pict_f_transform *f_transform, struct pict_f_transform *f_inverse); #endif /* _RRTRANSFORM_H_ */ xorg-server-1.20.8/randr/rrxinerama.c0000644000175000017500000003212713640201473014435 00000000000000/* * 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. */ /* * This Xinerama implementation comes from the SiS driver which has * the following notice: */ /* * SiS driver main code * * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Author: Thomas Winischhofer * - driver entirely rewritten since 2001, only basic structure taken from * old code (except sis_dri.c, sis_shadow.c, sis_accel.c and parts of * sis_dga.c; these were mostly taken over; sis_dri.c was changed for * new versions of the DRI layer) * * This notice covers the entire driver code unless indicated otherwise. * * Formerly based on code which was * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. * Written by: * Alan Hourihane , * Mike Chapman , * Juanjo Santamarta , * Mitani Hiroshi , * David Thomas . */ #include "randrstr.h" #include "swaprep.h" #include #include "protocol-versions.h" /* Xinerama is not multi-screen capable; just report about screen 0 */ #define RR_XINERAMA_SCREEN 0 static int ProcRRXineramaQueryVersion(ClientPtr client); static int ProcRRXineramaGetState(ClientPtr client); static int ProcRRXineramaGetScreenCount(ClientPtr client); static int ProcRRXineramaGetScreenSize(ClientPtr client); static int ProcRRXineramaIsActive(ClientPtr client); static int ProcRRXineramaQueryScreens(ClientPtr client); static int _X_COLD SProcRRXineramaDispatch(ClientPtr client); Bool noRRXineramaExtension = FALSE; /* Proc */ int ProcRRXineramaQueryVersion(ClientPtr client) { xPanoramiXQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION, .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION }; REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep); return Success; } int ProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; register int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; Bool active = FALSE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) { /* XXX do we need more than this? */ active = TRUE; } rep = (xPanoramiXGetStateReply) { .type = X_Reply, .state = active, .sequenceNumber = client->sequence, .length = 0, .window = stuff->window }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep); return Success; } static int RRXineramaScreenCount(ScreenPtr pScreen) { return RRMonitorCountList(pScreen); } static Bool RRXineramaScreenActive(ScreenPtr pScreen) { return RRXineramaScreenCount(pScreen) > 0; } int ProcRRXineramaGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; rep = (xPanoramiXGetScreenCountReply) { .type = X_Reply, .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen), .sequenceNumber = client->sequence, .length = 0, .window = stuff->window }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep); return Success; } int ProcRRXineramaGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin, pRoot; ScreenPtr pScreen; xPanoramiXGetScreenSizeReply rep; register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pRoot = pScreen->root; rep = (xPanoramiXGetScreenSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .width = pRoot->drawable.width, .height = pRoot->drawable.height, .window = stuff->window, .screen = stuff->screen }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.width); swapl(&rep.height); swapl(&rep.window); swapl(&rep.screen); } WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep); return Success; } int ProcRRXineramaIsActive(ClientPtr client) { xXineramaIsActiveReply rep; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); rep = (xXineramaIsActiveReply) { .type = X_Reply, .length = 0, .sequenceNumber = client->sequence, .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.state); } WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep); return Success; } static void RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor) { xXineramaScreenInfo scratch; scratch.x_org = monitor->geometry.box.x1; scratch.y_org = monitor->geometry.box.y1; scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1; scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1; if (client->swapped) { swaps(&scratch.x_org); swaps(&scratch.y_org); swaps(&scratch.width); swaps(&scratch.height); } WriteToClient(client, sz_XineramaScreenInfo, &scratch); } int ProcRRXineramaQueryScreens(ClientPtr client) { xXineramaQueryScreensReply rep; ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; int m; RRMonitorPtr monitors = NULL; int nmonitors = 0; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); if (RRXineramaScreenActive(pScreen)) { RRGetInfo(pScreen, FALSE); if (!RRMonitorMakeList(pScreen, TRUE, &monitors, &nmonitors)) return BadAlloc; } rep = (xXineramaQueryScreensReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo), .number = nmonitors }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.number); } WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep); for (m = 0; m < nmonitors; m++) RRXineramaWriteMonitor(client, &monitors[m]); if (monitors) RRMonitorFreeList(monitors, nmonitors); return Success; } static int ProcRRXineramaDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_PanoramiXQueryVersion: return ProcRRXineramaQueryVersion(client); case X_PanoramiXGetState: return ProcRRXineramaGetState(client); case X_PanoramiXGetScreenCount: return ProcRRXineramaGetScreenCount(client); case X_PanoramiXGetScreenSize: return ProcRRXineramaGetScreenSize(client); case X_XineramaIsActive: return ProcRRXineramaIsActive(client); case X_XineramaQueryScreens: return ProcRRXineramaQueryScreens(client); } return BadRequest; } /* SProc */ static int _X_COLD SProcRRXineramaQueryVersion(ClientPtr client) { REQUEST(xPanoramiXQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); return ProcRRXineramaQueryVersion(client); } static int _X_COLD SProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); swapl(&stuff->window); return ProcRRXineramaGetState(client); } static int _X_COLD SProcRRXineramaGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); swapl(&stuff->window); return ProcRRXineramaGetScreenCount(client); } static int _X_COLD SProcRRXineramaGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); swapl(&stuff->window); swapl(&stuff->screen); return ProcRRXineramaGetScreenSize(client); } static int _X_COLD SProcRRXineramaIsActive(ClientPtr client) { REQUEST(xXineramaIsActiveReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); return ProcRRXineramaIsActive(client); } static int _X_COLD SProcRRXineramaQueryScreens(ClientPtr client) { REQUEST(xXineramaQueryScreensReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); return ProcRRXineramaQueryScreens(client); } int SProcRRXineramaDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_PanoramiXQueryVersion: return SProcRRXineramaQueryVersion(client); case X_PanoramiXGetState: return SProcRRXineramaGetState(client); case X_PanoramiXGetScreenCount: return SProcRRXineramaGetScreenCount(client); case X_PanoramiXGetScreenSize: return SProcRRXineramaGetScreenSize(client); case X_XineramaIsActive: return SProcRRXineramaIsActive(client); case X_XineramaQueryScreens: return SProcRRXineramaQueryScreens(client); } return BadRequest; } void RRXineramaExtensionInit(void) { #ifdef PANORAMIX if (!noPanoramiXExtension) return; #endif if (noRRXineramaExtension) return; /* * Xinerama isn't capable enough to have multiple protocol screens each * with their own output geometry. So if there's more than one protocol * screen, just don't even try. */ if (screenInfo.numScreens > 1) return; (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0, ProcRRXineramaDispatch, SProcRRXineramaDispatch, NULL, StandardMinorOpcode); } xorg-server-1.20.8/randr/Makefile.am0000644000175000017500000000075113640201473014153 00000000000000noinst_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 \ rrlease.c \ rrmode.c \ rrmonitor.c \ rroutput.c \ rrpointer.c \ rrproperty.c \ rrprovider.c \ rrproviderproperty.c \ rrscreen.c \ rrsdispatch.c \ rrtransform.h \ rrtransform.c if XINERAMA librandr_la_SOURCES += ${XINERAMA_SRCS} endif xorg-server-1.20.8/randr/rrsdispatch.c0000644000175000017500000004526713640201473014624 00000000000000/* * 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 _X_COLD SProcRRQueryVersion(ClientPtr client) { REQUEST(xRRQueryVersionReq); REQUEST_SIZE_MATCH(xRRQueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetScreenInfo(ClientPtr client) { REQUEST(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetScreenConfig(ClientPtr client) { REQUEST(xRRSetScreenConfigReq); if (RRClientKnowsRates(client)) { REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); swaps(&stuff->rate); } else { REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq); } swaps(&stuff->length); swapl(&stuff->drawable); swapl(&stuff->timestamp); swaps(&stuff->sizeID); swaps(&stuff->rotation); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSelectInput(ClientPtr client) { REQUEST(xRRSelectInputReq); REQUEST_SIZE_MATCH(xRRSelectInputReq); swaps(&stuff->length); swapl(&stuff->window); swaps(&stuff->enable); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetScreenSizeRange(ClientPtr client) { REQUEST(xRRGetScreenSizeRangeReq); REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetScreenSize(ClientPtr client) { REQUEST(xRRSetScreenSizeReq); REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); swaps(&stuff->length); swapl(&stuff->window); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->widthInMillimeters); swapl(&stuff->heightInMillimeters); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetScreenResources(ClientPtr client) { REQUEST(xRRGetScreenResourcesReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetOutputInfo(ClientPtr client) { REQUEST(xRRGetOutputInfoReq); REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->configTimestamp); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRListOutputProperties(ClientPtr client) { REQUEST(xRRListOutputPropertiesReq); REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); swaps(&stuff->length); swapl(&stuff->output); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRQueryOutputProperty(ClientPtr client) { REQUEST(xRRQueryOutputPropertyReq); REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRConfigureOutputProperty(ClientPtr client) { REQUEST(xRRConfigureOutputPropertyReq); REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); SwapRestL(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRChangeOutputProperty(ClientPtr client) { REQUEST(xRRChangeOutputPropertyReq); REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); 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 _X_COLD SProcRRDeleteOutputProperty(ClientPtr client) { REQUEST(xRRDeleteOutputPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetOutputProperty(ClientPtr client) { REQUEST(xRRGetOutputPropertyReq); REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRCreateMode(ClientPtr client) { xRRModeInfo *modeinfo; REQUEST(xRRCreateModeReq); REQUEST_AT_LEAST_SIZE(xRRCreateModeReq); swaps(&stuff->length); swapl(&stuff->window); modeinfo = &stuff->modeInfo; swapl(&modeinfo->id); swaps(&modeinfo->width); swaps(&modeinfo->height); swapl(&modeinfo->dotClock); swaps(&modeinfo->hSyncStart); swaps(&modeinfo->hSyncEnd); swaps(&modeinfo->hTotal); swaps(&modeinfo->vSyncStart); swaps(&modeinfo->vSyncEnd); swaps(&modeinfo->vTotal); swaps(&modeinfo->nameLength); swapl(&modeinfo->modeFlags); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRDestroyMode(ClientPtr client) { REQUEST(xRRDestroyModeReq); REQUEST_SIZE_MATCH(xRRDestroyModeReq); swaps(&stuff->length); swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRAddOutputMode(ClientPtr client) { REQUEST(xRRAddOutputModeReq); REQUEST_SIZE_MATCH(xRRAddOutputModeReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRDeleteOutputMode(ClientPtr client) { REQUEST(xRRDeleteOutputModeReq); REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetCrtcInfo(ClientPtr client) { REQUEST(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); swaps(&stuff->length); swapl(&stuff->crtc); swapl(&stuff->configTimestamp); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetCrtcConfig(ClientPtr client) { REQUEST(xRRSetCrtcConfigReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); swaps(&stuff->length); swapl(&stuff->crtc); swapl(&stuff->timestamp); swapl(&stuff->configTimestamp); swaps(&stuff->x); swaps(&stuff->y); swapl(&stuff->mode); swaps(&stuff->rotation); SwapRestL(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetCrtcGammaSize(ClientPtr client) { REQUEST(xRRGetCrtcGammaSizeReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetCrtcGamma(ClientPtr client) { REQUEST(xRRGetCrtcGammaReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetCrtcGamma(ClientPtr client) { REQUEST(xRRSetCrtcGammaReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq); swaps(&stuff->length); swapl(&stuff->crtc); swaps(&stuff->size); SwapRestS(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetCrtcTransform(ClientPtr client) { int nparams; char *filter; CARD32 *params; REQUEST(xRRSetCrtcTransformReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq); swaps(&stuff->length); swapl(&stuff->crtc); SwapLongs((CARD32 *) &stuff->transform, bytes_to_int32(sizeof(xRenderTransform))); swaps(&stuff->nbytesFilter); 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 _X_COLD SProcRRGetCrtcTransform(ClientPtr client) { REQUEST(xRRGetCrtcTransformReq); REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRGetPanning(ClientPtr client) { REQUEST(xRRGetPanningReq); REQUEST_SIZE_MATCH(xRRGetPanningReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetPanning(ClientPtr client) { REQUEST(xRRSetPanningReq); REQUEST_SIZE_MATCH(xRRSetPanningReq); swaps(&stuff->length); swapl(&stuff->crtc); swapl(&stuff->timestamp); swaps(&stuff->left); swaps(&stuff->top); swaps(&stuff->width); swaps(&stuff->height); swaps(&stuff->track_left); swaps(&stuff->track_top); swaps(&stuff->track_width); swaps(&stuff->track_height); swaps(&stuff->border_left); swaps(&stuff->border_top); swaps(&stuff->border_right); swaps(&stuff->border_bottom); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD SProcRRSetOutputPrimary(ClientPtr client) { REQUEST(xRRSetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->output); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRGetOutputPrimary(ClientPtr client) { REQUEST(xRRGetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); swaps(&stuff->length); swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRGetProviders(ClientPtr client) { REQUEST(xRRGetProvidersReq); REQUEST_SIZE_MATCH(xRRGetProvidersReq); swaps(&stuff->length); swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRGetProviderInfo(ClientPtr client) { REQUEST(xRRGetProviderInfoReq); REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRSetProviderOffloadSink(ClientPtr client) { REQUEST(xRRSetProviderOffloadSinkReq); REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->sink_provider); swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRSetProviderOutputSource(ClientPtr client) { REQUEST(xRRSetProviderOutputSourceReq); REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->source_provider); swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRListProviderProperties(ClientPtr client) { REQUEST(xRRListProviderPropertiesReq); REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); swaps(&stuff->length); swapl(&stuff->provider); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRQueryProviderProperty(ClientPtr client) { REQUEST(xRRQueryProviderPropertyReq); REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRConfigureProviderProperty(ClientPtr client) { REQUEST(xRRConfigureProviderPropertyReq); REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); /* TODO: no way to specify format? */ SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRChangeProviderProperty(ClientPtr client) { REQUEST(xRRChangeProviderPropertyReq); REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; } return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRDeleteProviderProperty(ClientPtr client) { REQUEST(xRRDeleteProviderPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRGetProviderProperty(ClientPtr client) { REQUEST(xRRGetProviderPropertyReq); REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRGetMonitors(ClientPtr client) { REQUEST(xRRGetMonitorsReq); REQUEST_SIZE_MATCH(xRRGetMonitorsReq); swaps(&stuff->length); swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRSetMonitor(ClientPtr client) { REQUEST(xRRSetMonitorReq); REQUEST_AT_LEAST_SIZE(xRRGetMonitorsReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->monitor.name); swaps(&stuff->monitor.noutput); swaps(&stuff->monitor.x); swaps(&stuff->monitor.y); swaps(&stuff->monitor.width); swaps(&stuff->monitor.height); SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRDeleteMonitor(ClientPtr client) { REQUEST(xRRDeleteMonitorReq); REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->name); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRCreateLease(ClientPtr client) { REQUEST(xRRCreateLeaseReq); REQUEST_AT_LEAST_SIZE(xRRCreateLeaseReq); swaps(&stuff->length); swapl(&stuff->window); swaps(&stuff->nCrtcs); swaps(&stuff->nOutputs); SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD SProcRRFreeLease(ClientPtr client) { REQUEST(xRRFreeLeaseReq); REQUEST_SIZE_MATCH(xRRFreeLeaseReq); swaps(&stuff->length); swapl(&stuff->lid); 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 */ SProcRRGetProviders, /* 32 */ SProcRRGetProviderInfo, /* 33 */ SProcRRSetProviderOffloadSink, /* 34 */ SProcRRSetProviderOutputSource, /* 35 */ SProcRRListProviderProperties, /* 36 */ SProcRRQueryProviderProperty, /* 37 */ SProcRRConfigureProviderProperty, /* 38 */ SProcRRChangeProviderProperty, /* 39 */ SProcRRDeleteProviderProperty, /* 40 */ SProcRRGetProviderProperty, /* 41 */ /* V1.5 additions */ SProcRRGetMonitors, /* 42 */ SProcRRSetMonitor, /* 43 */ SProcRRDeleteMonitor, /* 44 */ /* V1.6 additions */ SProcRRCreateLease, /* 45 */ SProcRRFreeLease, /* 46 */ }; xorg-server-1.20.8/randr/rrpointer.c0000644000175000017500000001113213640201473014302 00000000000000/* * 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 "inputstr.h" /* * When the pointer moves, check to see if the specified position is outside * any of theavailable CRTCs and move it to a 'sensible' place if so, where * sensible is the closest monitor to the departing edge. * * Returns whether the position was adjusted */ static Bool RRCrtcContainsPosition(RRCrtcPtr crtc, int x, int y) { RRModePtr mode = crtc->mode; int scan_width, scan_height; if (!mode) return FALSE; RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height); if (crtc->x <= x && x < crtc->x + scan_width && crtc->y <= y && y < crtc->y + scan_height) return TRUE; return FALSE; } /* * Find the CRTC nearest the specified position, ignoring 'skip' */ static void RRPointerToNearestCrtc(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, RRCrtcPtr skip) { rrScrPriv(pScreen); int c; RRCrtcPtr nearest = NULL; int best = 0; int best_dx = 0, best_dy = 0; for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; RRModePtr mode = crtc->mode; int dx, dy; int dist; int scan_width, scan_height; if (!mode) continue; if (crtc == skip) continue; RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height); if (x < crtc->x) dx = crtc->x - x; else if (x > crtc->x + scan_width - 1) dx = crtc->x + (scan_width - 1) - x; else dx = 0; if (y < crtc->y) dy = crtc->y - y; else if (y > crtc->y + scan_height - 1) dy = crtc->y + (scan_height - 1) - y; else dy = 0; dist = dx * dx + dy * dy; if (!nearest || dist < best) { nearest = crtc; best_dx = dx; best_dy = dy; best = dist; } } if (best_dx || best_dy) (*pScreen->SetCursorPosition) (pDev, pScreen, x + best_dx, y + best_dy, TRUE); pScrPriv->pointerCrtc = nearest; } void RRPointerMoved(ScreenPtr pScreen, int x, int y) { rrScrPriv(pScreen); RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc; int c; /* Check last known CRTC */ if (pointerCrtc && RRCrtcContainsPosition(pointerCrtc, x, y)) return; /* Check all CRTCs */ for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; if (RRCrtcContainsPosition(crtc, x, y)) { /* Remember containing CRTC */ pScrPriv->pointerCrtc = crtc; return; } } /* None contain pointer, find nearest */ ErrorF("RRPointerMoved: Untested, may cause \"bogus pointer event\"\n"); RRPointerToNearestCrtc(inputInfo.pointer, pScreen, x, y, pointerCrtc); } /* * When the screen is reconfigured, move all pointers to the nearest * CRTC */ void RRPointerScreenConfigured(ScreenPtr pScreen) { WindowPtr pRoot; ScreenPtr pCurrentScreen; int x, y; DeviceIntPtr pDev; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (IsPointerDevice(pDev)) { pRoot = GetCurrentRootWindow(pDev); pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL; if (pScreen == pCurrentScreen) { GetSpritePosition(pDev, &x, &y); RRPointerToNearestCrtc(pDev, pScreen, x, y, NULL); } } } } xorg-server-1.20.8/randr/rrmode.c0000644000175000017500000002265113640201473013556 00000000000000/* * 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" RESTYPE RRModeType; static Bool RRModeEqual(xRRModeInfo * a, xRRModeInfo * b) { if (a->width != b->width) return FALSE; if (a->height != b->height) return FALSE; if (a->dotClock != b->dotClock) return FALSE; if (a->hSyncStart != b->hSyncStart) return FALSE; if (a->hSyncEnd != b->hSyncEnd) return FALSE; if (a->hTotal != b->hTotal) return FALSE; if (a->hSkew != b->hSkew) return FALSE; if (a->vSyncStart != b->vSyncStart) return FALSE; if (a->vSyncEnd != b->vSyncEnd) return FALSE; if (a->vTotal != b->vTotal) return FALSE; if (a->nameLength != b->nameLength) return FALSE; if (a->modeFlags != b->modeFlags) return FALSE; return TRUE; } /* * Keep a list so it's easy to find modes in the resource database. */ static int num_modes; static RRModePtr *modes; static RRModePtr RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen) { RRModePtr mode, *newModes; if (!RRInit()) return NULL; mode = malloc(sizeof(RRModeRec) + modeInfo->nameLength + 1); if (!mode) return NULL; mode->refcnt = 1; mode->mode = *modeInfo; mode->name = (char *) (mode + 1); memcpy(mode->name, name, modeInfo->nameLength); mode->name[modeInfo->nameLength] = '\0'; mode->userScreen = userScreen; if (num_modes) newModes = reallocarray(modes, num_modes + 1, sizeof(RRModePtr)); else newModes = malloc(sizeof(RRModePtr)); if (!newModes) { free(mode); return NULL; } mode->mode.id = FakeClientID(0); if (!AddResource(mode->mode.id, RRModeType, (void *) mode)) { free(newModes); return NULL; } modes = newModes; modes[num_modes++] = mode; /* * give the caller a reference to this mode */ ++mode->refcnt; return mode; } static RRModePtr RRModeFindByName(const char *name, CARD16 nameLength) { int i; RRModePtr mode; for (i = 0; i < num_modes; i++) { mode = modes[i]; if (mode->mode.nameLength == nameLength && !memcmp(name, mode->name, nameLength)) { return mode; } } return NULL; } RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name) { int i; for (i = 0; i < num_modes; i++) { RRModePtr mode = modes[i]; if (RRModeEqual(&mode->mode, modeInfo) && !memcmp(name, mode->name, modeInfo->nameLength)) { ++mode->refcnt; return mode; } } return RRModeCreate(modeInfo, name, NULL); } static RRModePtr RRModeCreateUser(ScreenPtr pScreen, xRRModeInfo * modeInfo, const char *name, int *error) { RRModePtr mode; mode = RRModeFindByName(name, modeInfo->nameLength); if (mode) { *error = BadName; return NULL; } mode = RRModeCreate(modeInfo, name, pScreen); if (!mode) { *error = BadAlloc; return NULL; } *error = Success; return mode; } RRModePtr * RRModesForScreen(ScreenPtr pScreen, int *num_ret) { rrScrPriv(pScreen); int o, c, m; RRModePtr *screen_modes; int num_screen_modes = 0; screen_modes = xallocarray((num_modes ? num_modes : 1), sizeof(RRModePtr)); if (!screen_modes) return NULL; /* * Add modes from all outputs */ for (o = 0; o < pScrPriv->numOutputs; o++) { RROutputPtr output = pScrPriv->outputs[o]; int n; for (m = 0; m < output->numModes + output->numUserModes; m++) { RRModePtr mode = (m < output->numModes ? output->modes[m] : output->userModes[m - output->numModes]); for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } } /* * Add modes from all crtcs. The goal is to * make sure all available and active modes * are visible to the client */ for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; RRModePtr mode = crtc->mode; int n; if (!mode) continue; for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } /* * Add all user modes for this screen */ for (m = 0; m < num_modes; m++) { RRModePtr mode = modes[m]; int n; if (mode->userScreen != pScreen) continue; for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } *num_ret = num_screen_modes; return screen_modes; } void RRModeDestroy(RRModePtr mode) { int m; if (--mode->refcnt > 0) return; for (m = 0; m < num_modes; m++) { if (modes[m] == mode) { memmove(modes + m, modes + m + 1, (num_modes - m - 1) * sizeof(RRModePtr)); num_modes--; if (!num_modes) { free(modes); modes = NULL; } break; } } free(mode); } static int RRModeDestroyResource(void *value, XID pid) { RRModeDestroy((RRModePtr) value); return 1; } /* * Initialize mode type */ Bool RRModeInit(void) { assert(num_modes == 0); assert(modes == NULL); RRModeType = CreateNewResourceType(RRModeDestroyResource, "MODE"); if (!RRModeType) return FALSE; return TRUE; } /* * Initialize mode type error value */ void RRModeInitErrorValue(void) { SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode); } int ProcRRCreateMode(ClientPtr client) { REQUEST(xRRCreateModeReq); xRRCreateModeReply rep; WindowPtr pWin; ScreenPtr pScreen; xRRModeInfo *modeInfo; long units_after; char *name; int error, rc; RRModePtr mode; REQUEST_AT_LEAST_SIZE(xRRCreateModeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; modeInfo = &stuff->modeInfo; name = (char *) (stuff + 1); units_after = (stuff->length - bytes_to_int32(sizeof(xRRCreateModeReq))); /* check to make sure requested name fits within the data provided */ if (bytes_to_int32(modeInfo->nameLength) > units_after) return BadLength; mode = RRModeCreateUser(pScreen, modeInfo, name, &error); if (!mode) return error; rep = (xRRCreateModeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .mode = mode->mode.id }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.mode); } WriteToClient(client, sizeof(xRRCreateModeReply), &rep); /* Drop out reference to this mode */ RRModeDestroy(mode); return Success; } int ProcRRDestroyMode(ClientPtr client) { REQUEST(xRRDestroyModeReq); RRModePtr mode; REQUEST_SIZE_MATCH(xRRDestroyModeReq); VERIFY_RR_MODE(stuff->mode, mode, DixDestroyAccess); if (!mode->userScreen) return BadMatch; if (mode->refcnt > 1) return BadAccess; FreeResource(stuff->mode, 0); return Success; } int ProcRRAddOutputMode(ClientPtr client) { REQUEST(xRRAddOutputModeReq); RRModePtr mode; RROutputPtr output; REQUEST_SIZE_MATCH(xRRAddOutputModeReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess); if (RROutputIsLeased(output)) return BadAccess; return RROutputAddUserMode(output, mode); } int ProcRRDeleteOutputMode(ClientPtr client) { REQUEST(xRRDeleteOutputModeReq); RRModePtr mode; RROutputPtr output; REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess); if (RROutputIsLeased(output)) return BadAccess; return RROutputDeleteUserMode(output, mode); } xorg-server-1.20.8/randr/rrscreen.c0000644000175000017500000010344513640201473014112 00000000000000/* * 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 CARD16 RR10CurrentSizeID(ScreenPtr pScreen); /* * Edit connection information block so that new clients * see the current screen size on connect */ static void RREditConnectionInfo(ScreenPtr pScreen) { xConnSetup *connSetup; char *vendor; xPixmapFormat *formats; xWindowRoot *root; xDepth *depth; xVisualType *visual; int screen = 0; int d; if (ConnectionInfo == NULL) return; connSetup = (xConnSetup *) ConnectionInfo; vendor = (char *) connSetup + sizeof(xConnSetup); formats = (xPixmapFormat *) ((char *) vendor + pad_to_int32(connSetup->nbytesVendor)); root = (xWindowRoot *) ((char *) formats + sizeof(xPixmapFormat) * screenInfo.numPixmapFormats); while (screen != pScreen->myNum) { depth = (xDepth *) ((char *) root + sizeof(xWindowRoot)); for (d = 0; d < root->nDepths; d++) { visual = (xVisualType *) ((char *) depth + sizeof(xDepth)); depth = (xDepth *) ((char *) visual + depth->nVisuals * sizeof(xVisualType)); } root = (xWindowRoot *) ((char *) depth); screen++; } root->pixWidth = pScreen->width; root->pixHeight = pScreen->height; root->mmWidth = pScreen->mmWidth; root->mmHeight = pScreen->mmHeight; } void RRSendConfigNotify(ScreenPtr pScreen) { WindowPtr pWin = pScreen->root; xEvent event = { .u.configureNotify.window = pWin->drawable.id, .u.configureNotify.aboveSibling = None, .u.configureNotify.x = 0, .u.configureNotify.y = 0, /* XXX xinerama stuff ? */ .u.configureNotify.width = pWin->drawable.width, .u.configureNotify.height = pWin->drawable.height, .u.configureNotify.borderWidth = wBorderWidth(pWin), .u.configureNotify.override = pWin->overrideRedirect }; event.u.u.type = ConfigureNotify; DeliverEvents(pWin, &event, 1, NullWindow); } void RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen) { rrScrPriv(pScreen); RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL; WindowPtr pRoot = pScreen->root; xRRScreenChangeNotifyEvent se = { .type = RRScreenChangeNotify + RREventBase, .rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0), .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .root = pRoot->drawable.id, .window = pWin->drawable.id, .subpixelOrder = PictureGetSubpixelOrder(pScreen), .sizeID = RR10CurrentSizeID(pScreen) }; if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) { se.widthInPixels = pScreen->height; se.heightInPixels = pScreen->width; se.widthInMillimeters = pScreen->mmHeight; se.heightInMillimeters = pScreen->mmWidth; } else { se.widthInPixels = pScreen->width; se.heightInPixels = pScreen->height; se.widthInMillimeters = pScreen->mmWidth; se.heightInMillimeters = pScreen->mmHeight; } WriteEventsToClient(client, 1, (xEvent *) &se); } /* * 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 */ void RRScreenSizeNotify(ScreenPtr pScreen) { rrScrPriv(pScreen); /* * Deliver ConfigureNotify events when root changes * pixel size */ if (pScrPriv->width == pScreen->width && pScrPriv->height == pScreen->height && pScrPriv->mmWidth == pScreen->mmWidth && pScrPriv->mmHeight == pScreen->mmHeight) return; pScrPriv->width = pScreen->width; pScrPriv->height = pScreen->height; pScrPriv->mmWidth = pScreen->mmWidth; pScrPriv->mmHeight = pScreen->mmHeight; RRSetChanged(pScreen); /* pScrPriv->sizeChanged = TRUE; */ RRTellChanged(pScreen); RRSendConfigNotify(pScreen); RREditConnectionInfo(pScreen); RRPointerScreenConfigured(pScreen); /* * Fix pointer bounds and location */ ScreenRestructured(pScreen); } /* * Request that the screen be resized */ Bool RRScreenSizeSet(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { rrScrPriv(pScreen); #if RANDR_12_INTERFACE if (pScrPriv->rrScreenSetSize) { return (*pScrPriv->rrScreenSetSize) (pScreen, width, height, mmWidth, mmHeight); } #endif #if RANDR_10_INTERFACE if (pScrPriv->rrSetConfig) { return TRUE; /* can't set size separately */ } #endif return FALSE; } /* * Retrieve valid screen size range */ int ProcRRGetScreenSizeRange(ClientPtr client) { REQUEST(xRRGetScreenSizeRangeReq); xRRGetScreenSizeRangeReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int rc; REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetScreenSizeRangeReply) { .type = X_Reply, .pad = 0, .sequenceNumber = client->sequence, .length = 0 }; if (pScrPriv) { if (!RRGetInfo(pScreen, FALSE)) return BadAlloc; rep.minWidth = pScrPriv->minWidth; rep.minHeight = pScrPriv->minHeight; rep.maxWidth = pScrPriv->maxWidth; rep.maxHeight = pScrPriv->maxHeight; } else { rep.maxWidth = rep.minWidth = pScreen->width; rep.maxHeight = rep.minHeight = pScreen->height; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.minWidth); swaps(&rep.minHeight); swaps(&rep.maxWidth); swaps(&rep.maxHeight); } WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), &rep); return Success; } int ProcRRSetScreenSize(ClientPtr client) { REQUEST(xRRSetScreenSizeReq); WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int i, rc; REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) return BadMatch; if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width) { client->errorValue = stuff->width; return BadValue; } if (stuff->height < pScrPriv->minHeight || pScrPriv->maxHeight < stuff->height) { client->errorValue = stuff->height; return BadValue; } for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; RRModePtr mode = crtc->mode; if (!RRCrtcIsLeased(crtc) && mode) { int source_width = mode->mode.width; int source_height = mode->mode.height; Rotation rotation = crtc->rotation; if (rotation & (RR_Rotate_90 | RR_Rotate_270)) { source_width = mode->mode.height; source_height = mode->mode.width; } if (crtc->x + source_width > stuff->width || crtc->y + source_height > stuff->height) return BadMatch; } } if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0) { client->errorValue = 0; return BadValue; } if (!RRScreenSizeSet(pScreen, stuff->width, stuff->height, stuff->widthInMillimeters, stuff->heightInMillimeters)) { return BadMatch; } return Success; } #define update_totals(gpuscreen, pScrPriv) do { \ total_crtcs += pScrPriv->numCrtcs; \ total_outputs += pScrPriv->numOutputs; \ modes = RRModesForScreen(gpuscreen, &num_modes); \ if (!modes) \ return BadAlloc; \ for (j = 0; j < num_modes; j++) \ total_name_len += modes[j]->mode.nameLength; \ total_modes += num_modes; \ free(modes); \ } while(0) static inline void swap_modeinfos(xRRModeInfo *modeinfos, int i) { swapl(&modeinfos[i].id); swaps(&modeinfos[i].width); swaps(&modeinfos[i].height); swapl(&modeinfos[i].dotClock); swaps(&modeinfos[i].hSyncStart); swaps(&modeinfos[i].hSyncEnd); swaps(&modeinfos[i].hTotal); swaps(&modeinfos[i].hSkew); swaps(&modeinfos[i].vSyncStart); swaps(&modeinfos[i].vSyncEnd); swaps(&modeinfos[i].vTotal); swaps(&modeinfos[i].nameLength); swapl(&modeinfos[i].modeFlags); } #define update_arrays(gpuscreen, pScrPriv, primary_crtc, has_primary) do { \ for (j = 0; j < pScrPriv->numCrtcs; j++) { \ if (has_primary && \ primary_crtc == pScrPriv->crtcs[j]) { \ has_primary = 0; \ continue; \ }\ crtcs[crtc_count] = pScrPriv->crtcs[j]->id; \ if (client->swapped) \ swapl(&crtcs[crtc_count]); \ crtc_count++; \ } \ for (j = 0; j < pScrPriv->numOutputs; j++) { \ outputs[output_count] = pScrPriv->outputs[j]->id; \ if (client->swapped) \ swapl(&outputs[output_count]); \ output_count++; \ } \ { \ RRModePtr mode; \ modes = RRModesForScreen(gpuscreen, &num_modes); \ for (j = 0; j < num_modes; j++) { \ mode = modes[j]; \ modeinfos[mode_count] = mode->mode; \ if (client->swapped) { \ swap_modeinfos(modeinfos, mode_count); \ } \ memcpy(names, mode->name, mode->mode.nameLength); \ names += mode->mode.nameLength; \ mode_count++; \ } \ free(modes); \ } \ } while (0) static int rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) { int j; int total_crtcs, total_outputs, total_modes, total_name_len; int crtc_count, output_count, mode_count; ScreenPtr iter; rrScrPrivPtr pScrPriv; int num_modes; RRModePtr *modes; xRRGetScreenResourcesReply rep; unsigned long extraLen; CARD8 *extra; RRCrtc *crtcs; RRCrtcPtr primary_crtc = NULL; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; int has_primary = 0; /* we need to iterate all the GPU masters and all their output slaves */ total_crtcs = 0; total_outputs = 0; total_modes = 0; total_name_len = 0; pScrPriv = rrGetScrPriv(pScreen); if (query && pScrPriv) if (!RRGetInfo(pScreen, query)) return BadAlloc; update_totals(pScreen, pScrPriv); xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { if (!iter->is_output_slave) continue; pScrPriv = rrGetScrPriv(iter); if (query) if (!RRGetInfo(iter, query)) return BadAlloc; update_totals(iter, pScrPriv); } pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .nCrtcs = total_crtcs, .nOutputs = total_outputs, .nModes = total_modes, .nbytesNames = total_name_len }; rep.length = (total_crtcs + total_outputs + total_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + bytes_to_int32(total_name_len)); extraLen = rep.length << 2; if (extraLen) { extra = malloc(extraLen); if (!extra) { return BadAlloc; } } else extra = NULL; crtcs = (RRCrtc *)extra; outputs = (RROutput *)(crtcs + total_crtcs); modeinfos = (xRRModeInfo *)(outputs + total_outputs); names = (CARD8 *)(modeinfos + total_modes); crtc_count = 0; output_count = 0; mode_count = 0; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { has_primary = 1; primary_crtc = pScrPriv->primaryOutput->crtc; crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) swapl(&crtcs[0]); crtc_count = 1; } update_arrays(pScreen, pScrPriv, primary_crtc, has_primary); xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { if (!iter->is_output_slave) continue; pScrPriv = rrGetScrPriv(iter); update_arrays(iter, pScrPriv, primary_crtc, has_primary); } assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.configTimestamp); swaps(&rep.nCrtcs); swaps(&rep.nOutputs); swaps(&rep.nModes); swaps(&rep.nbytesNames); } WriteToClient(client, sizeof(xRRGetScreenResourcesReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } static int rrGetScreenResources(ClientPtr client, Bool query) { REQUEST(xRRGetScreenResourcesReq); xRRGetScreenResourcesReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; int i, rc, has_primary = 0; RRCrtc *crtcs; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (query && pScrPriv) if (!RRGetInfo(pScreen, query)) return BadAlloc; if (pScreen->output_slaves) return rrGetMultiScreenResources(client, query, pScreen); if (!pScrPriv) { rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds, .nCrtcs = 0, .nOutputs = 0, .nModes = 0, .nbytesNames = 0 }; extra = NULL; extraLen = 0; } else { RRModePtr *modes; int num_modes; modes = RRModesForScreen(pScreen, &num_modes); if (!modes) return BadAlloc; rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .nCrtcs = pScrPriv->numCrtcs, .nOutputs = pScrPriv->numOutputs, .nModes = num_modes, .nbytesNames = 0 }; for (i = 0; i < num_modes; i++) rep.nbytesNames += modes[i]->mode.nameLength; rep.length = (pScrPriv->numCrtcs + pScrPriv->numOutputs + num_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + bytes_to_int32(rep.nbytesNames)); extraLen = rep.length << 2; if (extraLen) { extra = calloc(1, extraLen); if (!extra) { free(modes); return BadAlloc; } } else extra = NULL; crtcs = (RRCrtc *) extra; outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs); modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs); names = (CARD8 *) (modeinfos + num_modes); if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { has_primary = 1; crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) swapl(&crtcs[0]); } for (i = 0; i < pScrPriv->numCrtcs; i++) { if (has_primary && pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) { has_primary = 0; continue; } crtcs[i + has_primary] = pScrPriv->crtcs[i]->id; if (client->swapped) swapl(&crtcs[i + has_primary]); } for (i = 0; i < pScrPriv->numOutputs; i++) { outputs[i] = pScrPriv->outputs[i]->id; if (client->swapped) swapl(&outputs[i]); } for (i = 0; i < num_modes; i++) { RRModePtr mode = modes[i]; modeinfos[i] = mode->mode; if (client->swapped) { swapl(&modeinfos[i].id); swaps(&modeinfos[i].width); swaps(&modeinfos[i].height); swapl(&modeinfos[i].dotClock); swaps(&modeinfos[i].hSyncStart); swaps(&modeinfos[i].hSyncEnd); swaps(&modeinfos[i].hTotal); swaps(&modeinfos[i].hSkew); swaps(&modeinfos[i].vSyncStart); swaps(&modeinfos[i].vSyncEnd); swaps(&modeinfos[i].vTotal); swaps(&modeinfos[i].nameLength); swapl(&modeinfos[i].modeFlags); } memcpy(names, mode->name, mode->mode.nameLength); names += mode->mode.nameLength; } free(modes); assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.configTimestamp); swaps(&rep.nCrtcs); swaps(&rep.nOutputs); swaps(&rep.nModes); swaps(&rep.nbytesNames); } WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *) &rep); if (extraLen) { WriteToClient(client, extraLen, (char *) extra); free(extra); } return Success; } int ProcRRGetScreenResources(ClientPtr client) { return rrGetScreenResources(client, TRUE); } int ProcRRGetScreenResourcesCurrent(ClientPtr client) { return rrGetScreenResources(client, FALSE); } typedef struct _RR10Data { RRScreenSizePtr sizes; int nsize; int nrefresh; int size; CARD16 refresh; } RR10DataRec, *RR10DataPtr; /* * Convert 1.2 monitor data into 1.0 screen data */ static RR10DataPtr RR10GetData(ScreenPtr pScreen, RROutputPtr output) { RR10DataPtr data; RRScreenSizePtr size; int nmode = output->numModes + output->numUserModes; int o, os, l, r; RRScreenRatePtr refresh; CARD16 vRefresh; RRModePtr mode; Bool *used; /* Make sure there is plenty of space for any combination */ data = malloc(sizeof(RR10DataRec) + sizeof(RRScreenSize) * nmode + sizeof(RRScreenRate) * nmode + sizeof(Bool) * nmode); if (!data) return NULL; size = (RRScreenSizePtr) (data + 1); refresh = (RRScreenRatePtr) (size + nmode); used = (Bool *) (refresh + nmode); memset(used, '\0', sizeof(Bool) * nmode); data->sizes = size; data->nsize = 0; data->nrefresh = 0; data->size = 0; data->refresh = 0; /* * find modes not yet listed */ for (o = 0; o < output->numModes + output->numUserModes; o++) { if (used[o]) continue; if (o < output->numModes) mode = output->modes[o]; else mode = output->userModes[o - output->numModes]; l = data->nsize; size[l].id = data->nsize; size[l].width = mode->mode.width; size[l].height = mode->mode.height; if (output->mmWidth && output->mmHeight) { size[l].mmWidth = output->mmWidth; size[l].mmHeight = output->mmHeight; } else { size[l].mmWidth = pScreen->mmWidth; size[l].mmHeight = pScreen->mmHeight; } size[l].nRates = 0; size[l].pRates = &refresh[data->nrefresh]; data->nsize++; /* * Find all modes with matching size */ for (os = o; os < output->numModes + output->numUserModes; os++) { if (os < output->numModes) mode = output->modes[os]; else mode = output->userModes[os - output->numModes]; if (mode->mode.width == size[l].width && mode->mode.height == size[l].height) { vRefresh = RRVerticalRefresh(&mode->mode); used[os] = TRUE; for (r = 0; r < size[l].nRates; r++) if (vRefresh == size[l].pRates[r].rate) break; if (r == size[l].nRates) { size[l].pRates[r].rate = vRefresh; size[l].pRates[r].mode = mode; size[l].nRates++; data->nrefresh++; } if (mode == output->crtc->mode) { data->size = l; data->refresh = vRefresh; } } } } return data; } int ProcRRGetScreenInfo(ClientPtr client) { REQUEST(xRRGetScreenInfoReq); xRRGetScreenInfoReply rep; WindowPtr pWin; int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; RROutputPtr output; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) if (!RRGetInfo(pScreen, TRUE)) return BadAlloc; output = RRFirstOutput(pScreen); if (!pScrPriv || !output) { rep = (xRRGetScreenInfoReply) { .type = X_Reply, .setOfRotations = RR_Rotate_0, .sequenceNumber = client->sequence, .length = 0, .root = pWin->drawable.pScreen->root->drawable.id, .timestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds, .nSizes = 0, .sizeID = 0, .rotation = RR_Rotate_0, .rate = 0, .nrateEnts = 0 }; extra = 0; extraLen = 0; } else { int i, j; xScreenSizes *size; CARD16 *rates; CARD8 *data8; Bool has_rate = RRClientKnowsRates(client); RR10DataPtr pData; RRScreenSizePtr pSize; pData = RR10GetData(pScreen, output); if (!pData) return BadAlloc; rep = (xRRGetScreenInfoReply) { .type = X_Reply, .setOfRotations = output->crtc->rotations, .sequenceNumber = client->sequence, .length = 0, .root = pWin->drawable.pScreen->root->drawable.id, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .rotation = output->crtc->rotation, .nSizes = pData->nsize, .nrateEnts = pData->nrefresh + pData->nsize, .sizeID = pData->size, .rate = pData->refresh }; extraLen = rep.nSizes * sizeof(xScreenSizes); if (has_rate) extraLen += rep.nrateEnts * sizeof(CARD16); if (extraLen) { extra = (CARD8 *) malloc(extraLen); if (!extra) { free(pData); return BadAlloc; } } else extra = NULL; /* * First comes the size information */ size = (xScreenSizes *) extra; rates = (CARD16 *) (size + rep.nSizes); for (i = 0; i < pData->nsize; i++) { pSize = &pData->sizes[i]; size->widthInPixels = pSize->width; size->heightInPixels = pSize->height; size->widthInMillimeters = pSize->mmWidth; size->heightInMillimeters = pSize->mmHeight; if (client->swapped) { swaps(&size->widthInPixels); swaps(&size->heightInPixels); swaps(&size->widthInMillimeters); swaps(&size->heightInMillimeters); } size++; if (has_rate) { *rates = pSize->nRates; if (client->swapped) { swaps(rates); } rates++; for (j = 0; j < pSize->nRates; j++) { *rates = pSize->pRates[j].rate; if (client->swapped) { swaps(rates); } rates++; } } } free(pData); data8 = (CARD8 *) rates; if (data8 - (CARD8 *) extra != extraLen) FatalError("RRGetScreenInfo bad extra len %ld != %ld\n", (unsigned long) (data8 - (CARD8 *) extra), extraLen); rep.length = bytes_to_int32(extraLen); } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.configTimestamp); swaps(&rep.rotation); swaps(&rep.nSizes); swaps(&rep.sizeID); swaps(&rep.rate); swaps(&rep.nrateEnts); } WriteToClient(client, sizeof(xRRGetScreenInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } int ProcRRSetScreenConfig(ClientPtr client) { REQUEST(xRRSetScreenConfigReq); xRRSetScreenConfigReply rep; DrawablePtr pDraw; int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; TimeStamp time; int i; Rotation rotation; int rate; Bool has_rate; CARD8 status; RROutputPtr output; RRCrtcPtr crtc; RRModePtr mode; RR10DataPtr pData = NULL; RRScreenSizePtr pSize; int width, height; UpdateCurrentTime(); if (RRClientKnowsRates(client)) { REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); has_rate = TRUE; } else { REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq); has_rate = FALSE; } rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess); if (rc != Success) return rc; pScreen = pDraw->pScreen; pScrPriv = rrGetScrPriv(pScreen); time = ClientTimeToServerTime(stuff->timestamp); if (!pScrPriv) { time = currentTime; status = RRSetConfigFailed; goto sendReply; } if (!RRGetInfo(pScreen, FALSE)) return BadAlloc; output = RRFirstOutput(pScreen); if (!output) { time = currentTime; status = RRSetConfigFailed; goto sendReply; } crtc = output->crtc; /* * If the client's config timestamp is not the same as the last config * timestamp, then the config information isn't up-to-date and * can't even be validated. * * Note that the client only knows about the milliseconds part of the * timestamp, so using CompareTimeStamps here would cause randr to suddenly * stop working after several hours have passed (freedesktop bug #6502). */ if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) { status = RRSetConfigInvalidConfigTime; goto sendReply; } pData = RR10GetData(pScreen, output); if (!pData) return BadAlloc; if (stuff->sizeID >= pData->nsize) { /* * Invalid size ID */ client->errorValue = stuff->sizeID; free(pData); return BadValue; } pSize = &pData->sizes[stuff->sizeID]; /* * 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(pData); return BadValue; } if ((~crtc->rotations) & rotation) { /* * requested rotation or reflection not supported by screen */ client->errorValue = stuff->rotation; free(pData); return BadMatch; } /* * Validate requested refresh */ if (has_rate) rate = (int) stuff->rate; else rate = 0; if (rate) { for (i = 0; i < pSize->nRates; i++) { if (pSize->pRates[i].rate == rate) break; } if (i == pSize->nRates) { /* * Invalid rate */ client->errorValue = rate; free(pData); return BadValue; } mode = pSize->pRates[i].mode; } else mode = pSize->pRates[0].mode; /* * Make sure the requested set-time is not older than * the last set-time */ if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) { status = RRSetConfigInvalidTime; goto sendReply; } /* * If the screen size is changing, adjust all of the other outputs * to fit the new size, mirroring as much as possible */ width = mode->mode.width; height = mode->mode.height; if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) { client->errorValue = width; free(pData); return BadValue; } if (height < pScrPriv->minHeight || pScrPriv->maxHeight < height) { client->errorValue = height; free(pData); return BadValue; } if (rotation & (RR_Rotate_90 | RR_Rotate_270)) { width = mode->mode.height; height = mode->mode.width; } if (width != pScreen->width || height != pScreen->height) { int c; for (c = 0; c < pScrPriv->numCrtcs; c++) { if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0, 0, NULL)) { status = RRSetConfigFailed; /* XXX recover from failure */ goto sendReply; } } if (!RRScreenSizeSet(pScreen, width, height, pScreen->mmWidth, pScreen->mmHeight)) { status = RRSetConfigFailed; /* XXX recover from failure */ goto sendReply; } } if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output)) status = RRSetConfigFailed; else { pScrPriv->lastSetTime = time; status = RRSetConfigSuccess; } /* * XXX Configure other crtcs to mirror as much as possible */ sendReply: free(pData); rep = (xRRSetScreenConfigReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds, .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, .root = pDraw->pScreen->root->drawable.id, /* .subpixelOrder = ?? */ }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.newTimestamp); swapl(&rep.newConfigTimestamp); swapl(&rep.root); } WriteToClient(client, sizeof(xRRSetScreenConfigReply), &rep); return Success; } static CARD16 RR10CurrentSizeID(ScreenPtr pScreen) { CARD16 sizeID = 0xffff; RROutputPtr output = RRFirstOutput(pScreen); if (output) { RR10DataPtr data = RR10GetData(pScreen, output); if (data) { int i; for (i = 0; i < data->nsize; i++) if (data->sizes[i].width == pScreen->width && data->sizes[i].height == pScreen->height) { sizeID = (CARD16) i; break; } free(data); } } return sizeID; } xorg-server-1.20.8/randr/rrcrtc.c0000644000175000017500000015726013640201473013572 00000000000000/* * Copyright © 2006 Keith Packard * Copyright 2010 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. */ #include "randrstr.h" #include "swaprep.h" #include "mipointer.h" #include 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); RRSetChanged(pScreen); /* * 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 */ crtcs = reallocarray(pScrPriv->crtcs, pScrPriv->numCrtcs + 1, sizeof(RRCrtcPtr)); if (!crtcs) return NULL; 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, (void *) crtc)) return NULL; /* attach the screen and crtc together */ crtc->pScreen = pScreen; pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; RRResourcesChanged(pScreen); 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 = reallocarray(crtc->outputs, numOutputs, sizeof(RROutputPtr)); else newoutputs = xallocarray(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); RRModePtr mode = crtc->mode; xRRCrtcChangeNotifyEvent ce = { .type = RRNotify + RREventBase, .subCode = RRNotify_CrtcChange, .timestamp = pScrPriv->lastSetTime.milliseconds, .window = pWin->drawable.id, .crtc = crtc->id, .mode = mode ? mode->mode.id : None, .rotation = crtc->rotation, .x = mode ? crtc->x : 0, .y = mode ? crtc->y : 0, .width = mode ? mode->mode.width : 0, .height = mode ? mode->mode.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; } static Bool cursor_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) { rrScrPriv(crtc->pScreen); BoxRec bounds; if (crtc->mode == NULL) return FALSE; memset(&bounds, 0, sizeof(bounds)); if (pScrPriv->rrGetPanning) pScrPriv->rrGetPanning(crtc->pScreen, crtc, NULL, &bounds, NULL); if (bounds.y2 <= bounds.y1 || bounds.x2 <= bounds.x1) { bounds.x1 = 0; bounds.y1 = 0; bounds.x2 = crtc->mode->mode.width; bounds.y2 = crtc->mode->mode.height; } pixman_f_transform_bounds(&crtc->f_transform, &bounds); *left = bounds.x1; *right = bounds.x2; *top = bounds.y1; *bottom = bounds.y2; return TRUE; } /* overlapping counts as adjacent */ static Bool crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b) { /* left, right, top, bottom... */ int al, ar, at, ab; int bl, br, bt, bb; int cl, cr, ct, cb; /* the overlap, if any */ if (!cursor_bounds(a, &al, &ar, &at, &ab)) return FALSE; if (!cursor_bounds(b, &bl, &br, &bt, &bb)) return FALSE; cl = max(al, bl); cr = min(ar, br); ct = max(at, bt); cb = min(ab, bb); return (cl <= cr) && (ct <= cb); } /* Depth-first search and mark all CRTCs reachable from cur */ static void mark_crtcs(rrScrPrivPtr pScrPriv, int *reachable, int cur) { int i; reachable[cur] = TRUE; for (i = 0; i < pScrPriv->numCrtcs; ++i) { if (reachable[i]) continue; if (crtcs_adjacent(pScrPriv->crtcs[cur], pScrPriv->crtcs[i])) mark_crtcs(pScrPriv, reachable, i); } } static void RRComputeContiguity(ScreenPtr pScreen) { rrScrPriv(pScreen); Bool discontiguous = TRUE; int i, n = pScrPriv->numCrtcs; int *reachable = calloc(n, sizeof(int)); if (!reachable) goto out; /* Find first enabled CRTC and start search for reachable CRTCs from it */ for (i = 0; i < n; ++i) { if (pScrPriv->crtcs[i]->mode) { mark_crtcs(pScrPriv, reachable, i); break; } } /* Check that all enabled CRTCs were marked as reachable */ for (i = 0; i < n; ++i) if (pScrPriv->crtcs[i]->mode && !reachable[i]) goto out; discontiguous = FALSE; out: free(reachable); pScrPriv->discontiguous = discontiguous; } static void rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) { ScreenPtr master = crtc->pScreen->current_master; if (master && pPixmap->master_pixmap) { /* * Unref the pixmap twice: once for the original reference, and once * for the reference implicitly added by PixmapShareToSlave. */ PixmapUnshareSlavePixmap(pPixmap); master->DestroyPixmap(pPixmap->master_pixmap); master->DestroyPixmap(pPixmap->master_pixmap); } crtc->pScreen->DestroyPixmap(pPixmap); } void RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc) { rrScrPriv(crtc->pScreen); if (crtc->scanout_pixmap) { ScreenPtr master = crtc->pScreen->current_master; DrawablePtr mrootdraw = &master->root->drawable; if (crtc->scanout_pixmap_back) { pScrPriv->rrDisableSharedPixmapFlipping(crtc); if (mrootdraw) { master->StopFlippingPixmapTracking(mrootdraw, crtc->scanout_pixmap, crtc->scanout_pixmap_back); } rrDestroySharedPixmap(crtc, crtc->scanout_pixmap_back); crtc->scanout_pixmap_back = NULL; } else { pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL); if (mrootdraw) { master->StopPixmapTracking(mrootdraw, crtc->scanout_pixmap); } } rrDestroySharedPixmap(crtc, crtc->scanout_pixmap); crtc->scanout_pixmap = NULL; } RRCrtcChanged(crtc, TRUE); } static PixmapPtr rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr master, int width, int height, int depth, int x, int y, Rotation rotation) { PixmapPtr mpix, spix; mpix = master->CreatePixmap(master, width, height, depth, CREATE_PIXMAP_USAGE_SHARED); if (!mpix) return NULL; spix = PixmapShareToSlave(mpix, crtc->pScreen); if (spix == NULL) { master->DestroyPixmap(mpix); return NULL; } return spix; } static Bool rrGetPixmapSharingSyncProp(int numOutputs, RROutputPtr * outputs) { /* Determine if the user wants prime syncing */ int o; const char *syncStr = PRIME_SYNC_PROP; Atom syncProp = MakeAtom(syncStr, strlen(syncStr), FALSE); if (syncProp == None) return TRUE; /* If one output doesn't want sync, no sync */ for (o = 0; o < numOutputs; o++) { RRPropertyValuePtr val; /* Try pending value first, then current value */ if ((val = RRGetOutputProperty(outputs[o], syncProp, TRUE)) && val->data) { if (!(*(char *) val->data)) return FALSE; continue; } if ((val = RRGetOutputProperty(outputs[o], syncProp, FALSE)) && val->data) { if (!(*(char *) val->data)) return FALSE; continue; } } return TRUE; } static void rrSetPixmapSharingSyncProp(char val, int numOutputs, RROutputPtr * outputs) { int o; const char *syncStr = PRIME_SYNC_PROP; Atom syncProp = MakeAtom(syncStr, strlen(syncStr), FALSE); if (syncProp == None) return; for (o = 0; o < numOutputs; o++) { RRPropertyPtr prop = RRQueryOutputProperty(outputs[o], syncProp); if (prop) RRChangeOutputProperty(outputs[o], syncProp, XA_INTEGER, 8, PropModeReplace, 1, &val, FALSE, TRUE); } } static Bool rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height, int x, int y, Rotation rotation, Bool sync, int numOutputs, RROutputPtr * outputs) { ScreenPtr master = crtc->pScreen->current_master; rrScrPrivPtr pMasterScrPriv = rrGetScrPriv(master); rrScrPrivPtr pSlaveScrPriv = rrGetScrPriv(crtc->pScreen); DrawablePtr mrootdraw = &master->root->drawable; int depth = mrootdraw->depth; PixmapPtr spix_front; /* Create a pixmap on the master screen, then get a shared handle for it. Create a shared pixmap on the slave screen using the handle. If sync == FALSE -- Set slave screen to scanout shared linear pixmap. Set the master screen to do dirty updates to the shared pixmap from the screen pixmap on its own accord. If sync == TRUE -- If any of the below steps fail, clean up and fall back to sync == FALSE. Create another shared pixmap on the slave screen using the handle. Set slave screen to prepare for scanout and flipping between shared linear pixmaps. Set the master screen to do dirty updates to the shared pixmaps from the screen pixmap when prompted to by us or the slave. Prompt the master to do a dirty update on the first shared pixmap, then defer to the slave. */ if (crtc->scanout_pixmap) RRCrtcDetachScanoutPixmap(crtc); if (width == 0 && height == 0) { return TRUE; } spix_front = rrCreateSharedPixmap(crtc, master, width, height, depth, x, y, rotation); if (spix_front == NULL) { ErrorF("randr: failed to create shared pixmap\n"); return FALSE; } /* Both source and sink must support required ABI funcs for flipping */ if (sync && pSlaveScrPriv->rrEnableSharedPixmapFlipping && pSlaveScrPriv->rrDisableSharedPixmapFlipping && pMasterScrPriv->rrStartFlippingPixmapTracking && master->PresentSharedPixmap && master->StopFlippingPixmapTracking) { PixmapPtr spix_back = rrCreateSharedPixmap(crtc, master, width, height, depth, x, y, rotation); if (spix_back == NULL) goto fail; if (!pSlaveScrPriv->rrEnableSharedPixmapFlipping(crtc, spix_front, spix_back)) goto fail; crtc->scanout_pixmap = spix_front; crtc->scanout_pixmap_back = spix_back; if (!pMasterScrPriv->rrStartFlippingPixmapTracking(crtc, mrootdraw, spix_front, spix_back, x, y, 0, 0, rotation)) { pSlaveScrPriv->rrDisableSharedPixmapFlipping(crtc); goto fail; } master->PresentSharedPixmap(spix_front); return TRUE; fail: /* If flipping funcs fail, just fall back to unsynchronized */ if (spix_back) rrDestroySharedPixmap(crtc, spix_back); crtc->scanout_pixmap = NULL; crtc->scanout_pixmap_back = NULL; } if (sync) { /* Wanted sync, didn't get it */ ErrorF("randr: falling back to unsynchronized pixmap sharing\n"); /* Set output property to 0 to indicate to user */ rrSetPixmapSharingSyncProp(0, numOutputs, outputs); } if (!pSlaveScrPriv->rrCrtcSetScanoutPixmap(crtc, spix_front)) { rrDestroySharedPixmap(crtc, spix_front); ErrorF("randr: failed to set shadow slave pixmap\n"); return FALSE; } crtc->scanout_pixmap = spix_front; master->StartPixmapTracking(mrootdraw, spix_front, x, y, 0, 0, rotation); return TRUE; } static void crtc_to_box(BoxPtr box, RRCrtcPtr crtc) { box->x1 = crtc->x; box->y1 = crtc->y; switch (crtc->rotation) { case RR_Rotate_0: case RR_Rotate_180: default: box->x2 = crtc->x + crtc->mode->mode.width; box->y2 = crtc->y + crtc->mode->mode.height; break; case RR_Rotate_90: case RR_Rotate_270: box->x2 = crtc->x + crtc->mode->mode.height; box->y2 = crtc->y + crtc->mode->mode.width; break; } } static Bool rrCheckPixmapBounding(ScreenPtr pScreen, RRCrtcPtr rr_crtc, Rotation rotation, int x, int y, int w, int h) { RegionRec root_pixmap_region, total_region, new_crtc_region; int c; BoxRec newbox; BoxPtr newsize; ScreenPtr slave; int new_width, new_height; PixmapPtr screen_pixmap = pScreen->GetScreenPixmap(pScreen); rrScrPriv(pScreen); PixmapRegionInit(&root_pixmap_region, screen_pixmap); RegionInit(&total_region, NULL, 0); /* have to iterate all the crtcs of the attached gpu masters and all their output slaves */ for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; if (crtc == rr_crtc) { newbox.x1 = x; newbox.y1 = y; if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) { newbox.x2 = x + h; newbox.y2 = y + w; } else { newbox.x2 = x + w; newbox.y2 = y + h; } } else { if (!crtc->mode) continue; crtc_to_box(&newbox, crtc); } RegionInit(&new_crtc_region, &newbox, 1); RegionUnion(&total_region, &total_region, &new_crtc_region); } xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) { rrScrPrivPtr slave_priv = rrGetScrPriv(slave); if (!slave->is_output_slave) continue; for (c = 0; c < slave_priv->numCrtcs; c++) { RRCrtcPtr slave_crtc = slave_priv->crtcs[c]; if (slave_crtc == rr_crtc) { newbox.x1 = x; newbox.y1 = y; if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) { newbox.x2 = x + h; newbox.y2 = y + w; } else { newbox.x2 = x + w; newbox.y2 = y + h; } } else { if (!slave_crtc->mode) continue; crtc_to_box(&newbox, slave_crtc); } RegionInit(&new_crtc_region, &newbox, 1); RegionUnion(&total_region, &total_region, &new_crtc_region); } } newsize = RegionExtents(&total_region); new_width = newsize->x2; new_height = newsize->y2; if (new_width < screen_pixmap->drawable.width) new_width = screen_pixmap->drawable.width; if (new_height < screen_pixmap->drawable.height) new_height = screen_pixmap->drawable.height; if (new_width <= screen_pixmap->drawable.width && new_height <= screen_pixmap->drawable.height) { } else { pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0); } /* set shatters TODO */ return TRUE; } /* * 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; Bool recompute = TRUE; Bool crtcChanged; int o; rrScrPriv(pScreen); crtcChanged = FALSE; for (o = 0; o < numOutputs; o++) { if (outputs[o] && outputs[o]->crtc != crtc) { crtcChanged = TRUE; break; } } /* 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) && !crtcChanged) { recompute = FALSE; ret = TRUE; } else { if (pScreen->isGPU) { ScreenPtr master = pScreen->current_master; int width = 0, height = 0; if (mode) { width = mode->mode.width; height = mode->mode.height; } ret = rrCheckPixmapBounding(master, crtc, rotation, x, y, width, height); if (!ret) return FALSE; if (pScreen->current_master) { Bool sync = rrGetPixmapSharingSyncProp(numOutputs, outputs); ret = rrSetupPixmapSharing(crtc, width, height, x, y, rotation, sync, numOutputs, outputs); } } #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) { RRTellChanged(pScreen); for (o = 0; o < numOutputs; o++) RRPostPendingProperties(outputs[o]); } } if (recompute) RRComputeContiguity(pScreen); 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 !RRTransformEqual(&crtc->client_current_transform, &crtc->client_pending_transform); } /* * Destroy a Crtc at shutdown */ void RRCrtcDestroy(RRCrtcPtr crtc) { FreeResource(crtc->id, 0); } static int RRCrtcDestroyResource(void *value, XID pid) { RRCrtcPtr crtc = (RRCrtcPtr) value; ScreenPtr pScreen = crtc->pScreen; if (pScreen) { rrScrPriv(pScreen); int i; RRLeasePtr lease, next; xorg_list_for_each_entry_safe(lease, next, &pScrPriv->leases, list) { int c; for (c = 0; c < lease->numCrtcs; c++) { if (lease->crtcs[c] == crtc) { RRTerminateLease(lease); break; } } } 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; } } RRResourcesChanged(pScreen); } if (crtc->scanout_pixmap) RRCrtcDetachScanoutPixmap(crtc); free(crtc->gammaRed); if (crtc->mode) RRModeDestroy(crtc->mode); free(crtc->outputs); 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) { 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 = xallocarray(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 = NULL; unsigned long extraLen; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRModePtr mode; RROutput *outputs; RROutput *possible; int i, j, k; int width, height; BoxRec panned_area; Bool leased; REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); leased = RRCrtcIsLeased(crtc); /* All crtcs must be associated with screens before client * requests are processed */ pScreen = crtc->pScreen; pScrPriv = rrGetScrPriv(pScreen); mode = crtc->mode; rep = (xRRGetCrtcInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds }; if (leased) { rep.x = rep.y = rep.width = rep.height = 0; rep.mode = 0; rep.rotation = RR_Rotate_0; rep.rotations = RR_Rotate_0; rep.nOutput = 0; rep.nPossibleOutput = 0; rep.length = 0; extraLen = 0; } else { 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++) { if (!RROutputIsLeased(pScrPriv->outputs[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; } 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]); } k = 0; for (i = 0; i < pScrPriv->numOutputs; i++) { if (!RROutputIsLeased(pScrPriv->outputs[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]); k++; } } } } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.x); swaps(&rep.y); swaps(&rep.width); swaps(&rep.height); swapl(&rep.mode); swaps(&rep.rotation); swaps(&rep.rotations); swaps(&rep.nOutput); swaps(&rep.nPossibleOutput); } WriteToClient(client, sizeof(xRRGetCrtcInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, 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 time; Rotation rotation; int ret, i, j; CARD8 status; REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq))); VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess); if (RRCrtcIsLeased(crtc)) return BadAccess; 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 = xallocarray(numOutputs, sizeof(RROutputPtr)); if (!outputs) return BadAlloc; } else outputs = NULL; outputIds = (RROutput *) (stuff + 1); for (i = 0; i < numOutputs; i++) { ret = dixLookupResourceByType((void **) (outputs + i), outputIds[i], RROutputType, client, DixSetAttrAccess); if (ret != Success) { free(outputs); return ret; } if (RROutputIsLeased(outputs[i])) { free(outputs); return BadAccess; } /* 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); if (!pScrPriv) { time = currentTime; 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; int width, height; if (pScreen->isGPU) { width = pScreen->current_master->width; height = pScreen->current_master->height; } else { width = pScreen->width; height = pScreen->height; } 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 > width) { client->errorValue = stuff->x; free(outputs); return BadValue; } if (stuff->y + source_height > height) { client->errorValue = stuff->y; free(outputs); return BadValue; } } #endif } if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y, rotation, numOutputs, outputs)) { status = RRSetConfigFailed; goto sendReply; } status = RRSetConfigSuccess; pScrPriv->lastSetTime = time; sendReply: free(outputs); rep = (xRRSetCrtcConfigReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.newTimestamp); } WriteToClient(client, sizeof(xRRSetCrtcConfigReply), &rep); return Success; } int ProcRRGetPanning(ClientPtr client) { REQUEST(xRRGetPanningReq); xRRGetPanningReply rep; RRCrtcPtr crtc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; BoxRec total; BoxRec tracking; INT16 border[4]; 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; rep = (xRRGetPanningReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = 1, .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); swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.left); swaps(&rep.top); swaps(&rep.width); swaps(&rep.height); swaps(&rep.track_left); swaps(&rep.track_top); swaps(&rep.track_width); swaps(&rep.track_height); swaps(&rep.border_left); swaps(&rep.border_top); swaps(&rep.border_right); swaps(&rep.border_bottom); } WriteToClient(client, sizeof(xRRGetPanningReply), &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]; CARD8 status; REQUEST_SIZE_MATCH(xRRSetPanningReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); if (RRCrtcIsLeased(crtc)) return BadAccess; /* All crtcs must be associated with screens before client * requests are processed */ pScreen = crtc->pScreen; pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) { time = currentTime; 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; status = RRSetConfigSuccess; sendReply: rep = (xRRSetPanningReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.newTimestamp); } WriteToClient(client, sizeof(xRRSetPanningReply), &rep); return Success; } int ProcRRGetCrtcGammaSize(ClientPtr client) { REQUEST(xRRGetCrtcGammaSizeReq); xRRGetCrtcGammaSizeReply reply; RRCrtcPtr crtc; REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); /* Gamma retrieval failed, any better error? */ if (!RRCrtcGammaGet(crtc)) return RRErrorBase + BadRRCrtc; reply = (xRRGetCrtcGammaSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .size = crtc->gammaSize }; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swaps(&reply.size); } WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), &reply); return Success; } int ProcRRGetCrtcGamma(ClientPtr client) { REQUEST(xRRGetCrtcGammaReq); xRRGetCrtcGammaReply reply; RRCrtcPtr crtc; 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 = (xRRGetCrtcGammaReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(len), .size = crtc->gammaSize }; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swaps(&reply.size); } WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &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); if (RRCrtcIsLeased(crtc)) return BadAccess; 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); if (RRCrtcIsLeased(crtc)) return BadAccess; 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; 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); swaps(nparamsFilter); 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 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 = calloc(1, 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, ¤t->transform); extra += transform_filter_encode(client, extra, &reply->currentNbytesFilter, &reply->currentNparamsFilter, current); if (client->swapped) { swaps(&reply->sequenceNumber); swapl(&reply->length); } WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply); free(reply); return Success; } static Bool check_all_screen_crtcs(ScreenPtr pScreen, int *x, int *y) { rrScrPriv(pScreen); int i; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; int left, right, top, bottom; if (!cursor_bounds(crtc, &left, &right, &top, &bottom)) continue; if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom)) return TRUE; } return FALSE; } static Bool constrain_all_screen_crtcs(DeviceIntPtr pDev, ScreenPtr pScreen, int *x, int *y) { rrScrPriv(pScreen); int i; /* if we're trying to escape, clamp to the CRTC we're coming from */ for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; int nx, ny; int left, right, top, bottom; if (!cursor_bounds(crtc, &left, &right, &top, &bottom)) continue; miPointerGetPosition(pDev, &nx, &ny); if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) { if (*x < left) *x = left; if (*x >= right) *x = right - 1; if (*y < top) *y = top; if (*y >= bottom) *y = bottom - 1; return TRUE; } } return FALSE; } void RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x, int *y) { rrScrPriv(pScreen); Bool ret; ScreenPtr slave; /* intentional dead space -> let it float */ if (pScrPriv->discontiguous) return; /* if we're moving inside a crtc, we're fine */ ret = check_all_screen_crtcs(pScreen, x, y); if (ret == TRUE) return; xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) { if (!slave->is_output_slave) continue; ret = check_all_screen_crtcs(slave, x, y); if (ret == TRUE) return; } /* if we're trying to escape, clamp to the CRTC we're coming from */ ret = constrain_all_screen_crtcs(pDev, pScreen, x, y); if (ret == TRUE) return; xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) { if (!slave->is_output_slave) continue; ret = constrain_all_screen_crtcs(pDev, slave, x, y); if (ret == TRUE) return; } } Bool RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable) { rrScrPriv(pDrawable->pScreen); Bool ret = TRUE; PixmapPtr *saved_scanout_pixmap; int i; saved_scanout_pixmap = malloc(sizeof(PixmapPtr)*pScrPriv->numCrtcs); if (saved_scanout_pixmap == NULL) return FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; Bool size_fits; saved_scanout_pixmap[i] = crtc->scanout_pixmap; if (!crtc->mode && enable) continue; if (!crtc->scanout_pixmap && !enable) continue; /* not supported with double buffering, needs ABI change for 2 ppix */ if (crtc->scanout_pixmap_back) { ret = FALSE; continue; } size_fits = (crtc->mode && crtc->x == pDrawable->x && crtc->y == pDrawable->y && crtc->mode->mode.width == pDrawable->width && crtc->mode->mode.height == pDrawable->height); /* is the pixmap already set? */ if (crtc->scanout_pixmap == pPixmap) { /* if its a disable then don't care about size */ if (enable == FALSE) { /* set scanout to NULL */ crtc->scanout_pixmap = NULL; } else if (!size_fits) { /* if the size no longer fits then drop off */ crtc->scanout_pixmap = NULL; pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap); (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y, crtc->rotation, crtc->numOutputs, crtc->outputs); saved_scanout_pixmap[i] = crtc->scanout_pixmap; ret = FALSE; } else { /* if the size fits then we are already setup */ } } else { if (!size_fits) ret = FALSE; else if (enable) crtc->scanout_pixmap = pPixmap; else /* reject an attempt to disable someone else's scanout_pixmap */ ret = FALSE; } } for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; if (crtc->scanout_pixmap == saved_scanout_pixmap[i]) continue; if (ret) { pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap); (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y, crtc->rotation, crtc->numOutputs, crtc->outputs); } else crtc->scanout_pixmap = saved_scanout_pixmap[i]; } free(saved_scanout_pixmap); return ret; } Bool RRHasScanoutPixmap(ScreenPtr pScreen) { rrScrPriv(pScreen); int i; if (!pScreen->is_output_slave) return FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; if (crtc->scanout_pixmap) return TRUE; } return FALSE; } xorg-server-1.20.8/randr/rrtransform.c0000644000175000017500000002243413640201473014644 00000000000000/* * 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 = xallocarray(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 = fabs(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(~0u); 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(~0u); 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(~0u); 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(~0u); 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; } } xorg-server-1.20.8/randr/Makefile.in0000644000175000017500000007712613640201515014173 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @XINERAMA_TRUE@am__append_1 = ${XINERAMA_SRCS} subdir = randr ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librandr_la_LIBADD = am__librandr_la_SOURCES_DIST = randr.c randrstr.h rrcrtc.c \ rrdispatch.c rrinfo.c rrlease.c rrmode.c rrmonitor.c \ rroutput.c rrpointer.c rrproperty.c rrprovider.c \ rrproviderproperty.c rrscreen.c rrsdispatch.c rrtransform.h \ rrtransform.c rrxinerama.c am__objects_1 = rrxinerama.lo @XINERAMA_TRUE@am__objects_2 = $(am__objects_1) am_librandr_la_OBJECTS = randr.lo rrcrtc.lo rrdispatch.lo rrinfo.lo \ rrlease.lo rrmode.lo rrmonitor.lo rroutput.lo rrpointer.lo \ rrproperty.lo rrprovider.lo rrproviderproperty.lo rrscreen.lo \ rrsdispatch.lo rrtransform.lo $(am__objects_2) librandr_la_OBJECTS = $(am_librandr_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/randr.Plo ./$(DEPDIR)/rrcrtc.Plo \ ./$(DEPDIR)/rrdispatch.Plo ./$(DEPDIR)/rrinfo.Plo \ ./$(DEPDIR)/rrlease.Plo ./$(DEPDIR)/rrmode.Plo \ ./$(DEPDIR)/rrmonitor.Plo ./$(DEPDIR)/rroutput.Plo \ ./$(DEPDIR)/rrpointer.Plo ./$(DEPDIR)/rrproperty.Plo \ ./$(DEPDIR)/rrprovider.Plo ./$(DEPDIR)/rrproviderproperty.Plo \ ./$(DEPDIR)/rrscreen.Plo ./$(DEPDIR)/rrsdispatch.Plo \ ./$(DEPDIR)/rrtransform.Plo ./$(DEPDIR)/rrxinerama.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(librandr_la_SOURCES) DIST_SOURCES = $(am__librandr_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__sdk_HEADERS_DIST = randrstr.h rrtransform.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = librandr.la AM_CFLAGS = $(DIX_CFLAGS) XINERAMA_SRCS = rrxinerama.c @XORG_TRUE@sdk_HEADERS = randrstr.h rrtransform.h librandr_la_SOURCES = randr.c randrstr.h rrcrtc.c rrdispatch.c \ rrinfo.c rrlease.c rrmode.c rrmonitor.c rroutput.c rrpointer.c \ rrproperty.c rrprovider.c rrproviderproperty.c rrscreen.c \ rrsdispatch.c rrtransform.h rrtransform.c $(am__append_1) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign randr/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign randr/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } librandr.la: $(librandr_la_OBJECTS) $(librandr_la_DEPENDENCIES) $(EXTRA_librandr_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(librandr_la_OBJECTS) $(librandr_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrcrtc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrdispatch.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrinfo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrlease.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrmode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrmonitor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rroutput.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrpointer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrproperty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrprovider.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrproviderproperty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrscreen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrsdispatch.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrtransform.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrxinerama.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/randr.Plo -rm -f ./$(DEPDIR)/rrcrtc.Plo -rm -f ./$(DEPDIR)/rrdispatch.Plo -rm -f ./$(DEPDIR)/rrinfo.Plo -rm -f ./$(DEPDIR)/rrlease.Plo -rm -f ./$(DEPDIR)/rrmode.Plo -rm -f ./$(DEPDIR)/rrmonitor.Plo -rm -f ./$(DEPDIR)/rroutput.Plo -rm -f ./$(DEPDIR)/rrpointer.Plo -rm -f ./$(DEPDIR)/rrproperty.Plo -rm -f ./$(DEPDIR)/rrprovider.Plo -rm -f ./$(DEPDIR)/rrproviderproperty.Plo -rm -f ./$(DEPDIR)/rrscreen.Plo -rm -f ./$(DEPDIR)/rrsdispatch.Plo -rm -f ./$(DEPDIR)/rrtransform.Plo -rm -f ./$(DEPDIR)/rrxinerama.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/randr.Plo -rm -f ./$(DEPDIR)/rrcrtc.Plo -rm -f ./$(DEPDIR)/rrdispatch.Plo -rm -f ./$(DEPDIR)/rrinfo.Plo -rm -f ./$(DEPDIR)/rrlease.Plo -rm -f ./$(DEPDIR)/rrmode.Plo -rm -f ./$(DEPDIR)/rrmonitor.Plo -rm -f ./$(DEPDIR)/rroutput.Plo -rm -f ./$(DEPDIR)/rrpointer.Plo -rm -f ./$(DEPDIR)/rrproperty.Plo -rm -f ./$(DEPDIR)/rrprovider.Plo -rm -f ./$(DEPDIR)/rrproviderproperty.Plo -rm -f ./$(DEPDIR)/rrscreen.Plo -rm -f ./$(DEPDIR)/rrsdispatch.Plo -rm -f ./$(DEPDIR)/rrtransform.Plo -rm -f ./$(DEPDIR)/rrxinerama.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/randr/rrprovider.c0000644000175000017500000003351013640201473014460 00000000000000/* * Copyright © 2012 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. * * Authors: Dave Airlie */ #include "randrstr.h" #include "swaprep.h" #include RESTYPE RRProviderType; /* * Initialize provider type error value */ void RRProviderInitErrorValue(void) { SetResourceTypeErrorValue(RRProviderType, RRErrorBase + BadRRProvider); } #define ADD_PROVIDER(_pScreen) do { \ pScrPriv = rrGetScrPriv((_pScreen)); \ if (pScrPriv->provider) { \ providers[count_providers] = pScrPriv->provider->id; \ if (client->swapped) \ swapl(&providers[count_providers]); \ count_providers++; \ } \ } while(0) int ProcRRGetProviders (ClientPtr client) { REQUEST(xRRGetProvidersReq); xRRGetProvidersReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int rc; CARD8 *extra; unsigned int extraLen; RRProvider *providers; int total_providers = 0, count_providers = 0; ScreenPtr iter; REQUEST_SIZE_MATCH(xRRGetProvidersReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv->provider) total_providers++; xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { pScrPriv = rrGetScrPriv(iter); total_providers += pScrPriv->provider ? 1 : 0; } pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) { rep = (xRRGetProvidersReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = currentTime.milliseconds, .nProviders = 0 }; extra = NULL; extraLen = 0; } else { rep = (xRRGetProvidersReply) { .type = X_Reply, .sequenceNumber = client->sequence, .timestamp = pScrPriv->lastSetTime.milliseconds, .nProviders = total_providers, .length = total_providers }; extraLen = rep.length << 2; if (extraLen) { extra = malloc(extraLen); if (!extra) return BadAlloc; } else extra = NULL; providers = (RRProvider *)extra; ADD_PROVIDER(pScreen); xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { ADD_PROVIDER(iter); } } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.nProviders); } WriteToClient(client, sizeof(xRRGetProvidersReply), (char *)&rep); if (extraLen) { WriteToClient (client, extraLen, (char *) extra); free(extra); } return Success; } int ProcRRGetProviderInfo (ClientPtr client) { REQUEST(xRRGetProviderInfoReq); xRRGetProviderInfoReply rep; rrScrPrivPtr pScrPriv, pScrProvPriv; RRProviderPtr provider; ScreenPtr pScreen; CARD8 *extra; unsigned int extraLen = 0; RRCrtc *crtcs; RROutput *outputs; int i; char *name; ScreenPtr provscreen; RRProvider *providers; uint32_t *prov_cap; REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetProviderInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = 0, .capabilities = provider->capabilities, .nameLength = provider->nameLength, .timestamp = pScrPriv->lastSetTime.milliseconds, .nCrtcs = pScrPriv->numCrtcs, .nOutputs = pScrPriv->numOutputs, .nAssociatedProviders = 0 }; /* count associated providers */ if (provider->offload_sink) rep.nAssociatedProviders++; if (provider->output_source && provider->output_source != provider->offload_sink) rep.nAssociatedProviders++; xorg_list_for_each_entry(provscreen, &pScreen->slave_list, slave_head) { if (provscreen->is_output_slave || provscreen->is_offload_slave) rep.nAssociatedProviders++; } rep.length = (pScrPriv->numCrtcs + pScrPriv->numOutputs + (rep.nAssociatedProviders * 2) + bytes_to_int32(rep.nameLength)); extraLen = rep.length << 2; if (extraLen) { extra = malloc(extraLen); if (!extra) return BadAlloc; } else extra = NULL; crtcs = (RRCrtc *)extra; outputs = (RROutput *)(crtcs + rep.nCrtcs); providers = (RRProvider *)(outputs + rep.nOutputs); prov_cap = (unsigned int *)(providers + rep.nAssociatedProviders); name = (char *)(prov_cap + rep.nAssociatedProviders); for (i = 0; i < pScrPriv->numCrtcs; i++) { crtcs[i] = pScrPriv->crtcs[i]->id; if (client->swapped) swapl(&crtcs[i]); } for (i = 0; i < pScrPriv->numOutputs; i++) { outputs[i] = pScrPriv->outputs[i]->id; if (client->swapped) swapl(&outputs[i]); } i = 0; if (provider->offload_sink) { providers[i] = provider->offload_sink->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = RR_Capability_SinkOffload; if (client->swapped) swapl(&prov_cap[i]); i++; } if (provider->output_source) { providers[i] = provider->output_source->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = RR_Capability_SourceOutput; swapl(&prov_cap[i]); i++; } xorg_list_for_each_entry(provscreen, &pScreen->slave_list, slave_head) { if (!provscreen->is_output_slave && !provscreen->is_offload_slave) continue; pScrProvPriv = rrGetScrPriv(provscreen); providers[i] = pScrProvPriv->provider->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = 0; if (provscreen->is_output_slave) prov_cap[i] |= RR_Capability_SinkOutput; if (provscreen->is_offload_slave) prov_cap[i] |= RR_Capability_SourceOffload; if (client->swapped) swapl(&prov_cap[i]); i++; } memcpy(name, provider->name, rep.nameLength); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.capabilities); swaps(&rep.nCrtcs); swaps(&rep.nOutputs); swaps(&rep.nameLength); } WriteToClient(client, sizeof(xRRGetProviderInfoReply), (char *)&rep); if (extraLen) { WriteToClient (client, extraLen, (char *) extra); free(extra); } return Success; } static void RRInitPrimeSyncProps(ScreenPtr pScreen) { /* * TODO: When adding support for different sources for different outputs, * make sure this sets up the output properties only on outputs associated * with the correct source provider. */ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); const char *syncStr = PRIME_SYNC_PROP; Atom syncProp = MakeAtom(syncStr, strlen(syncStr), TRUE); int defaultVal = TRUE; INT32 validVals[2] = {FALSE, TRUE}; int i; for (i = 0; i < pScrPriv->numOutputs; i++) { if (!RRQueryOutputProperty(pScrPriv->outputs[i], syncProp)) { RRConfigureOutputProperty(pScrPriv->outputs[i], syncProp, TRUE, FALSE, FALSE, 2, &validVals[0]); RRChangeOutputProperty(pScrPriv->outputs[i], syncProp, XA_INTEGER, 8, PropModeReplace, 1, &defaultVal, FALSE, FALSE); } } } static void RRFiniPrimeSyncProps(ScreenPtr pScreen) { /* * TODO: When adding support for different sources for different outputs, * make sure this tears down the output properties only on outputs * associated with the correct source provider. */ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); int i; const char *syncStr = PRIME_SYNC_PROP; Atom syncProp = MakeAtom(syncStr, strlen(syncStr), FALSE); if (syncProp == None) return; for (i = 0; i < pScrPriv->numOutputs; i++) { RRDeleteOutputProperty(pScrPriv->outputs[i], syncProp); } } int ProcRRSetProviderOutputSource(ClientPtr client) { REQUEST(xRRSetProviderOutputSourceReq); rrScrPrivPtr pScrPriv; RRProviderPtr provider, source_provider = NULL; ScreenPtr pScreen; REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!(provider->capabilities & RR_Capability_SinkOutput)) return BadValue; if (stuff->source_provider) { VERIFY_RR_PROVIDER(stuff->source_provider, source_provider, DixReadAccess); if (!(source_provider->capabilities & RR_Capability_SourceOutput)) return BadValue; } pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); if (!pScreen->isGPU) return BadValue; pScrPriv->rrProviderSetOutputSource(pScreen, provider, source_provider); RRInitPrimeSyncProps(pScreen); provider->changed = TRUE; RRSetChanged(pScreen); RRTellChanged (pScreen); return Success; } int ProcRRSetProviderOffloadSink(ClientPtr client) { REQUEST(xRRSetProviderOffloadSinkReq); rrScrPrivPtr pScrPriv; RRProviderPtr provider, sink_provider = NULL; ScreenPtr pScreen; REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!(provider->capabilities & RR_Capability_SourceOffload)) return BadValue; if (!provider->pScreen->isGPU) return BadValue; if (stuff->sink_provider) { VERIFY_RR_PROVIDER(stuff->sink_provider, sink_provider, DixReadAccess); if (!(sink_provider->capabilities & RR_Capability_SinkOffload)) return BadValue; } pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); pScrPriv->rrProviderSetOffloadSink(pScreen, provider, sink_provider); provider->changed = TRUE; RRSetChanged(pScreen); RRTellChanged (pScreen); return Success; } RRProviderPtr RRProviderCreate(ScreenPtr pScreen, const char *name, int nameLength) { RRProviderPtr provider; rrScrPrivPtr pScrPriv; pScrPriv = rrGetScrPriv(pScreen); provider = calloc(1, sizeof(RRProviderRec) + nameLength + 1); if (!provider) return NULL; provider->id = FakeClientID(0); provider->pScreen = pScreen; provider->name = (char *) (provider + 1); provider->nameLength = nameLength; memcpy(provider->name, name, nameLength); provider->name[nameLength] = '\0'; provider->changed = FALSE; if (!AddResource (provider->id, RRProviderType, (void *) provider)) return NULL; pScrPriv->provider = provider; return provider; } /* * Destroy a provider at shutdown */ void RRProviderDestroy (RRProviderPtr provider) { RRFiniPrimeSyncProps(provider->pScreen); FreeResource (provider->id, 0); } void RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities) { provider->capabilities = capabilities; } static int RRProviderDestroyResource (void *value, XID pid) { RRProviderPtr provider = (RRProviderPtr)value; ScreenPtr pScreen = provider->pScreen; if (pScreen) { rrScrPriv(pScreen); if (pScrPriv->rrProviderDestroy) (*pScrPriv->rrProviderDestroy)(pScreen, provider); pScrPriv->provider = NULL; } free(provider); return 1; } Bool RRProviderInit(void) { RRProviderType = CreateNewResourceType(RRProviderDestroyResource, "Provider"); if (!RRProviderType) return FALSE; return TRUE; } extern _X_EXPORT Bool RRProviderLookup(XID id, RRProviderPtr *provider_p) { int rc = dixLookupResourceByType((void **)provider_p, id, RRProviderType, NullClient, DixReadAccess); if (rc == Success) return TRUE; return FALSE; } void RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); xRRProviderChangeNotifyEvent pe = { .type = RRNotify + RREventBase, .subCode = RRNotify_ProviderChange, .timestamp = pScrPriv->lastSetTime.milliseconds, .window = pWin->drawable.id, .provider = provider->id }; WriteEventsToClient(client, 1, (xEvent *) &pe); } xorg-server-1.20.8/randr/rrmonitor.c0000644000175000017500000005576113640201473014331 00000000000000/* * Copyright © 2014 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" static Atom RRMonitorCrtcName(RRCrtcPtr crtc) { char name[20]; if (crtc->numOutputs) { RROutputPtr output = crtc->outputs[0]; return MakeAtom(output->name, output->nameLength, TRUE); } sprintf(name, "Monitor-%08lx", (unsigned long int)crtc->id); return MakeAtom(name, strlen(name), TRUE); } static Bool RRMonitorCrtcPrimary(RRCrtcPtr crtc) { ScreenPtr screen = crtc->pScreen; rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int o; for (o = 0; o < crtc->numOutputs; o++) if (crtc->outputs[o] == pScrPriv->primaryOutput) return TRUE; return FALSE; } #define DEFAULT_PIXELS_PER_MM (96.0 / 25.4) static void RRMonitorGetCrtcGeometry(RRCrtcPtr crtc, RRMonitorGeometryPtr geometry) { ScreenPtr screen = crtc->pScreen; rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); BoxRec panned_area; /* Check to see if crtc is panned and return the full area when applicable. */ if (pScrPriv && pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(screen, crtc, &panned_area, NULL, NULL) && (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) { geometry->box = panned_area; } else { int width, height; RRCrtcGetScanoutSize(crtc, &width, &height); geometry->box.x1 = crtc->x; geometry->box.y1 = crtc->y; geometry->box.x2 = geometry->box.x1 + width; geometry->box.y2 = geometry->box.y1 + height; } if (crtc->numOutputs && crtc->outputs[0]->mmWidth && crtc->outputs[0]->mmHeight) { RROutputPtr output = crtc->outputs[0]; geometry->mmWidth = output->mmWidth; geometry->mmHeight = output->mmHeight; } else { geometry->mmWidth = floor ((geometry->box.x2 - geometry->box.x1) / DEFAULT_PIXELS_PER_MM + 0.5); geometry->mmHeight = floor ((geometry->box.y2 - geometry->box.y1) / DEFAULT_PIXELS_PER_MM + 0.5); } } static Bool RRMonitorSetFromServer(RRCrtcPtr crtc, RRMonitorPtr monitor) { int o; monitor->name = RRMonitorCrtcName(crtc); monitor->pScreen = crtc->pScreen; monitor->numOutputs = crtc->numOutputs; monitor->outputs = calloc(crtc->numOutputs, sizeof(RROutput)); if (!monitor->outputs) return FALSE; for (o = 0; o < crtc->numOutputs; o++) monitor->outputs[o] = crtc->outputs[o]->id; monitor->primary = RRMonitorCrtcPrimary(crtc); monitor->automatic = TRUE; RRMonitorGetCrtcGeometry(crtc, &monitor->geometry); return TRUE; } static Bool RRMonitorAutomaticGeometry(RRMonitorPtr monitor) { return (monitor->geometry.box.x1 == 0 && monitor->geometry.box.y1 == 0 && monitor->geometry.box.x2 == 0 && monitor->geometry.box.y2 == 0); } static void RRMonitorGetGeometry(RRMonitorPtr monitor, RRMonitorGeometryPtr geometry) { if (RRMonitorAutomaticGeometry(monitor) && monitor->numOutputs > 0) { ScreenPtr screen = monitor->pScreen; rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); RRMonitorGeometryRec first = { .box = { 0, 0, 0, 0 }, .mmWidth = 0, .mmHeight = 0 }; RRMonitorGeometryRec this; int c, o, co; int active_crtcs = 0; *geometry = first; for (o = 0; o < monitor->numOutputs; o++) { RRCrtcPtr crtc = NULL; Bool in_use = FALSE; for (c = 0; !in_use && c < pScrPriv->numCrtcs; c++) { crtc = pScrPriv->crtcs[c]; if (!crtc->mode) continue; for (co = 0; !in_use && co < crtc->numOutputs; co++) if (monitor->outputs[o] == crtc->outputs[co]->id) in_use = TRUE; } if (!in_use) continue; RRMonitorGetCrtcGeometry(crtc, &this); if (active_crtcs == 0) { first = this; *geometry = this; } else { geometry->box.x1 = min(this.box.x1, geometry->box.x1); geometry->box.x2 = max(this.box.x2, geometry->box.x2); geometry->box.y1 = min(this.box.y1, geometry->box.y1); geometry->box.y2 = max(this.box.y2, geometry->box.y2); } active_crtcs++; } /* Adjust physical sizes to account for total area */ if (active_crtcs > 1 && first.box.x2 != first.box.x1 && first.box.y2 != first.box.y1) { geometry->mmWidth = (this.box.x2 - this.box.x1) / (first.box.x2 - first.box.x1) * first.mmWidth; geometry->mmHeight = (this.box.y2 - this.box.y1) / (first.box.y2 - first.box.y1) * first.mmHeight; } } else { *geometry = monitor->geometry; } } static Bool RRMonitorSetFromClient(RRMonitorPtr client_monitor, RRMonitorPtr monitor) { monitor->name = client_monitor->name; monitor->pScreen = client_monitor->pScreen; monitor->numOutputs = client_monitor->numOutputs; monitor->outputs = calloc(client_monitor->numOutputs, sizeof (RROutput)); if (!monitor->outputs && client_monitor->numOutputs) return FALSE; memcpy(monitor->outputs, client_monitor->outputs, client_monitor->numOutputs * sizeof (RROutput)); monitor->primary = client_monitor->primary; monitor->automatic = client_monitor->automatic; RRMonitorGetGeometry(client_monitor, &monitor->geometry); return TRUE; } typedef struct _rrMonitorList { int num_client; int num_server; RRCrtcPtr *server_crtc; int num_crtcs; int client_primary; int server_primary; } RRMonitorListRec, *RRMonitorListPtr; static Bool RRMonitorInitList(ScreenPtr screen, RRMonitorListPtr mon_list, Bool get_active) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m, o, c, sc; int numCrtcs; ScreenPtr slave; if (!RRGetInfo(screen, FALSE)) return FALSE; /* Count the number of crtcs in this and any slave screens */ numCrtcs = pScrPriv->numCrtcs; xorg_list_for_each_entry(slave, &screen->slave_list, slave_head) { rrScrPrivPtr pSlavePriv; if (!slave->is_output_slave) continue; pSlavePriv = rrGetScrPriv(slave); numCrtcs += pSlavePriv->numCrtcs; } mon_list->num_crtcs = numCrtcs; mon_list->server_crtc = calloc(numCrtcs * 2, sizeof (RRCrtcPtr)); if (!mon_list->server_crtc) return FALSE; /* Collect pointers to all of the active crtcs */ c = 0; for (sc = 0; sc < pScrPriv->numCrtcs; sc++, c++) { if (pScrPriv->crtcs[sc]->mode != NULL) mon_list->server_crtc[c] = pScrPriv->crtcs[sc]; } xorg_list_for_each_entry(slave, &screen->slave_list, slave_head) { rrScrPrivPtr pSlavePriv; if (!slave->is_output_slave) continue; pSlavePriv = rrGetScrPriv(slave); for (sc = 0; sc < pSlavePriv->numCrtcs; sc++, c++) { if (pSlavePriv->crtcs[sc]->mode != NULL) mon_list->server_crtc[c] = pSlavePriv->crtcs[sc]; } } /* Walk the list of client-defined monitors, clearing the covered * CRTCs from the full list and finding whether one of the * monitors is primary */ mon_list->num_client = pScrPriv->numMonitors; mon_list->client_primary = -1; for (m = 0; m < pScrPriv->numMonitors; m++) { RRMonitorPtr monitor = pScrPriv->monitors[m]; if (get_active) { RRMonitorGeometryRec geom; RRMonitorGetGeometry(monitor, &geom); if (geom.box.x2 - geom.box.x1 == 0 || geom.box.y2 - geom.box.y1 == 0) { mon_list->num_client--; continue; } } if (monitor->primary && mon_list->client_primary == -1) mon_list->client_primary = m; for (o = 0; o < monitor->numOutputs; o++) { for (c = 0; c < numCrtcs; c++) { RRCrtcPtr crtc = mon_list->server_crtc[c]; if (crtc) { int co; for (co = 0; co < crtc->numOutputs; co++) if (crtc->outputs[co]->id == monitor->outputs[o]) { mon_list->server_crtc[c] = NULL; break; } } } } } /* Now look at the active CRTCs, and count * those not covered by a client monitor, as well * as finding whether one of them is marked primary */ mon_list->num_server = 0; mon_list->server_primary = -1; for (c = 0; c < mon_list->num_crtcs; c++) { RRCrtcPtr crtc = mon_list->server_crtc[c]; if (!crtc) continue; mon_list->num_server++; if (RRMonitorCrtcPrimary(crtc) && mon_list->server_primary == -1) mon_list->server_primary = c; } return TRUE; } static void RRMonitorFiniList(RRMonitorListPtr list) { free(list->server_crtc); } /* Construct a complete list of protocol-visible monitors, including * the manually generated ones as well as those generated * automatically from the remaining CRCTs */ Bool RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr *monitors_ret, int *nmon_ret) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); RRMonitorListRec list; int m, c; RRMonitorPtr mon, monitors; Bool has_primary = FALSE; if (!pScrPriv) return FALSE; if (!RRMonitorInitList(screen, &list, get_active)) return FALSE; monitors = calloc(list.num_client + list.num_server, sizeof (RRMonitorRec)); if (!monitors) { RRMonitorFiniList(&list); return FALSE; } mon = monitors; /* Fill in the primary monitor data first */ if (list.client_primary >= 0) { RRMonitorSetFromClient(pScrPriv->monitors[list.client_primary], mon); mon++; } else if (list.server_primary >= 0) { RRMonitorSetFromServer(list.server_crtc[list.server_primary], mon); mon++; } /* Fill in the client-defined monitors next */ for (m = 0; m < pScrPriv->numMonitors; m++) { if (m == list.client_primary) continue; if (get_active) { RRMonitorGeometryRec geom; RRMonitorGetGeometry(pScrPriv->monitors[m], &geom); if (geom.box.x2 - geom.box.x1 == 0 || geom.box.y2 - geom.box.y1 == 0) { continue; } } RRMonitorSetFromClient(pScrPriv->monitors[m], mon); if (has_primary) mon->primary = FALSE; else if (mon->primary) has_primary = TRUE; mon++; } /* And finish with the list of crtc-inspired monitors */ for (c = 0; c < list.num_crtcs; c++) { RRCrtcPtr crtc = list.server_crtc[c]; if (c == list.server_primary && list.client_primary < 0) continue; if (!list.server_crtc[c]) continue; RRMonitorSetFromServer(crtc, mon); if (has_primary) mon->primary = FALSE; else if (mon->primary) has_primary = TRUE; mon++; } RRMonitorFiniList(&list); *nmon_ret = list.num_client + list.num_server; *monitors_ret = monitors; return TRUE; } int RRMonitorCountList(ScreenPtr screen) { RRMonitorListRec list; int nmon; if (!RRMonitorInitList(screen, &list, FALSE)) return -1; nmon = list.num_client + list.num_server; RRMonitorFiniList(&list); return nmon; } void RRMonitorFree(RRMonitorPtr monitor) { free(monitor); } RRMonitorPtr RRMonitorAlloc(int noutput) { RRMonitorPtr monitor; monitor = calloc(1, sizeof (RRMonitorRec) + noutput * sizeof (RROutput)); if (!monitor) return NULL; monitor->numOutputs = noutput; monitor->outputs = (RROutput *) (monitor + 1); return monitor; } static int RRMonitorDelete(ClientPtr client, ScreenPtr screen, Atom name) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m; if (!pScrPriv) { client->errorValue = name; return BadAtom; } for (m = 0; m < pScrPriv->numMonitors; m++) { RRMonitorPtr monitor = pScrPriv->monitors[m]; if (monitor->name == name) { memmove(pScrPriv->monitors + m, pScrPriv->monitors + m + 1, (pScrPriv->numMonitors - (m + 1)) * sizeof (RRMonitorPtr)); --pScrPriv->numMonitors; RRMonitorFree(monitor); return Success; } } client->errorValue = name; return BadValue; } static Bool RRMonitorMatchesOutputName(ScreenPtr screen, Atom name) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int o; const char *str = NameForAtom(name); int len = strlen(str); for (o = 0; o < pScrPriv->numOutputs; o++) { RROutputPtr output = pScrPriv->outputs[o]; if (output->nameLength == len && !memcmp(output->name, str, len)) return TRUE; } return FALSE; } int RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m; ScreenPtr slave; RRMonitorPtr *monitors; if (!pScrPriv) return BadAlloc; /* 'name' must not match the name of any Output on the screen, or * a Value error results. */ if (RRMonitorMatchesOutputName(screen, monitor->name)) { client->errorValue = monitor->name; return BadValue; } xorg_list_for_each_entry(slave, &screen->slave_list, slave_head) { if (!slave->is_output_slave) continue; if (RRMonitorMatchesOutputName(slave, monitor->name)) { client->errorValue = monitor->name; return BadValue; } } /* 'name' must not match the name of any Monitor on the screen, or * a Value error results. */ for (m = 0; m < pScrPriv->numMonitors; m++) { if (pScrPriv->monitors[m]->name == monitor->name) { client->errorValue = monitor->name; return BadValue; } } /* Allocate space for the new pointer. This is done before * removing matching monitors as it may fail, and the request * needs to not have any side-effects on failure */ if (pScrPriv->numMonitors) monitors = reallocarray(pScrPriv->monitors, pScrPriv->numMonitors + 1, sizeof (RRMonitorPtr)); else monitors = malloc(sizeof (RRMonitorPtr)); if (!monitors) return BadAlloc; pScrPriv->monitors = monitors; for (m = 0; m < pScrPriv->numMonitors; m++) { RRMonitorPtr existing = pScrPriv->monitors[m]; int o, eo; /* If 'name' matches an existing Monitor on the screen, the * existing one will be deleted as if RRDeleteMonitor were called. */ if (existing->name == monitor->name) { (void) RRMonitorDelete(client, screen, existing->name); continue; } /* For each output in 'info.outputs', each one is removed from all * pre-existing Monitors. If removing the output causes the list * of outputs for that Monitor to become empty, then that * Monitor will be deleted as if RRDeleteMonitor were called. */ for (eo = 0; eo < existing->numOutputs; eo++) { for (o = 0; o < monitor->numOutputs; o++) { if (monitor->outputs[o] == existing->outputs[eo]) { memmove(existing->outputs + eo, existing->outputs + eo + 1, (existing->numOutputs - (eo + 1)) * sizeof (RROutput)); --existing->numOutputs; --eo; break; } } if (existing->numOutputs == 0) { (void) RRMonitorDelete(client, screen, existing->name); break; } } if (monitor->primary) existing->primary = FALSE; } /* Add the new one to the list */ pScrPriv->monitors[pScrPriv->numMonitors++] = monitor; return Success; } void RRMonitorFreeList(RRMonitorPtr monitors, int nmon) { int m; for (m = 0; m < nmon; m++) free(monitors[m].outputs); free(monitors); } void RRMonitorInit(ScreenPtr screen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); if (!pScrPriv) return; pScrPriv->numMonitors = 0; pScrPriv->monitors = NULL; } void RRMonitorClose(ScreenPtr screen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m; if (!pScrPriv) return; for (m = 0; m < pScrPriv->numMonitors; m++) RRMonitorFree(pScrPriv->monitors[m]); free(pScrPriv->monitors); pScrPriv->monitors = NULL; pScrPriv->numMonitors = 0; } static CARD32 RRMonitorTimestamp(ScreenPtr screen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); /* XXX should take client monitor changes into account */ return pScrPriv->lastConfigTime.milliseconds; } int ProcRRGetMonitors(ClientPtr client) { REQUEST(xRRGetMonitorsReq); xRRGetMonitorsReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, }; WindowPtr window; ScreenPtr screen; int r; RRMonitorPtr monitors; int nmonitors; int noutputs; int m; Bool get_active; REQUEST_SIZE_MATCH(xRRGetMonitorsReq); r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (r != Success) return r; screen = window->drawable.pScreen; get_active = stuff->get_active; if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors)) return BadAlloc; rep.timestamp = RRMonitorTimestamp(screen); noutputs = 0; for (m = 0; m < nmonitors; m++) { rep.length += SIZEOF(xRRMonitorInfo) >> 2; rep.length += monitors[m].numOutputs; noutputs += monitors[m].numOutputs; } rep.nmonitors = nmonitors; rep.noutputs = noutputs; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.nmonitors); swapl(&rep.noutputs); } WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; for (m = 0; m < nmonitors; m++) { RRMonitorPtr monitor = &monitors[m]; xRRMonitorInfo info = { .name = monitor->name, .primary = monitor->primary, .automatic = monitor->automatic, .noutput = monitor->numOutputs, .x = monitor->geometry.box.x1, .y = monitor->geometry.box.y1, .width = monitor->geometry.box.x2 - monitor->geometry.box.x1, .height = monitor->geometry.box.y2 - monitor->geometry.box.y1, .widthInMillimeters = monitor->geometry.mmWidth, .heightInMillimeters = monitor->geometry.mmHeight, }; if (client->swapped) { swapl(&info.name); swaps(&info.noutput); swaps(&info.x); swaps(&info.y); swaps(&info.width); swaps(&info.height); swapl(&info.widthInMillimeters); swapl(&info.heightInMillimeters); } WriteToClient(client, sizeof(xRRMonitorInfo), &info); WriteSwappedDataToClient(client, monitor->numOutputs * sizeof (RROutput), monitor->outputs); } RRMonitorFreeList(monitors, nmonitors); return Success; } int ProcRRSetMonitor(ClientPtr client) { REQUEST(xRRSetMonitorReq); WindowPtr window; ScreenPtr screen; RRMonitorPtr monitor; int r; REQUEST_AT_LEAST_SIZE(xRRSetMonitorReq); if (stuff->monitor.noutput != stuff->length - (SIZEOF(xRRSetMonitorReq) >> 2)) return BadLength; r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (r != Success) return r; screen = window->drawable.pScreen; if (!ValidAtom(stuff->monitor.name)) return BadAtom; /* Allocate the new monitor */ monitor = RRMonitorAlloc(stuff->monitor.noutput); if (!monitor) return BadAlloc; /* Fill in the bits from the request */ monitor->pScreen = screen; monitor->name = stuff->monitor.name; monitor->primary = stuff->monitor.primary; monitor->automatic = FALSE; memcpy(monitor->outputs, stuff + 1, stuff->monitor.noutput * sizeof (RROutput)); monitor->geometry.box.x1 = stuff->monitor.x; monitor->geometry.box.y1 = stuff->monitor.y; monitor->geometry.box.x2 = stuff->monitor.x + stuff->monitor.width; monitor->geometry.box.y2 = stuff->monitor.y + stuff->monitor.height; monitor->geometry.mmWidth = stuff->monitor.widthInMillimeters; monitor->geometry.mmHeight = stuff->monitor.heightInMillimeters; r = RRMonitorAdd(client, screen, monitor); if (r == Success) RRSendConfigNotify(screen); else RRMonitorFree(monitor); return r; } int ProcRRDeleteMonitor(ClientPtr client) { REQUEST(xRRDeleteMonitorReq); WindowPtr window; ScreenPtr screen; int r; REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (r != Success) return r; screen = window->drawable.pScreen; if (!ValidAtom(stuff->name)) { client->errorValue = stuff->name; return BadAtom; } r = RRMonitorDelete(client, screen, stuff->name); if (r == Success) RRSendConfigNotify(screen); return r; } xorg-server-1.20.8/randr/rroutput.c0000644000175000017500000004557713640201473014206 00000000000000/* * 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. */ #include "randrstr.h" #include RESTYPE RROutputType; /* * Notify the output of some change */ void RROutputChanged(RROutputPtr output, Bool configChanged) { /* set changed bits on the master screen only */ ScreenPtr pScreen = output->pScreen; rrScrPrivPtr mastersp; output->changed = TRUE; if (!pScreen) return; if (pScreen->isGPU) { ScreenPtr master = pScreen->current_master; if (!master) return; mastersp = rrGetScrPriv(master); } else { mastersp = rrGetScrPriv(pScreen); } RRSetChanged(pScreen); if (configChanged) mastersp->configChanged = TRUE; } /* * Create an output */ RROutputPtr RROutputCreate(ScreenPtr pScreen, const char *name, int nameLength, void *devPrivate) { RROutputPtr output; RROutputPtr *outputs; rrScrPrivPtr pScrPriv; Atom nonDesktopAtom; if (!RRInit()) return NULL; pScrPriv = rrGetScrPriv(pScreen); outputs = reallocarray(pScrPriv->outputs, pScrPriv->numOutputs + 1, sizeof(RROutputPtr)); if (!outputs) return NULL; pScrPriv->outputs = outputs; output = malloc(sizeof(RROutputRec) + nameLength + 1); if (!output) return NULL; output->id = FakeClientID(0); output->pScreen = pScreen; output->name = (char *) (output + 1); output->nameLength = nameLength; memcpy(output->name, name, nameLength); output->name[nameLength] = '\0'; output->connection = RR_UnknownConnection; output->subpixelOrder = SubPixelUnknown; output->mmWidth = 0; output->mmHeight = 0; output->crtc = NULL; output->numCrtcs = 0; output->crtcs = NULL; output->numClones = 0; output->clones = NULL; output->numModes = 0; output->numPreferred = 0; output->modes = NULL; output->numUserModes = 0; output->userModes = NULL; output->properties = NULL; output->pendingProperties = FALSE; output->changed = FALSE; output->nonDesktop = FALSE; output->devPrivate = devPrivate; if (!AddResource(output->id, RROutputType, (void *) output)) return NULL; pScrPriv->outputs[pScrPriv->numOutputs++] = output; nonDesktopAtom = MakeAtom(RR_PROPERTY_NON_DESKTOP, strlen(RR_PROPERTY_NON_DESKTOP), TRUE); if (nonDesktopAtom != BAD_RESOURCE) { static const INT32 values[2] = { 0, 1 }; (void) RRConfigureOutputProperty(output, nonDesktopAtom, FALSE, FALSE, FALSE, 2, values); } RROutputSetNonDesktop(output, FALSE); RRResourcesChanged(pScreen); return output; } /* * Notify extension that output parameters have been changed */ Bool RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones) { RROutputPtr *newClones; int i; if (numClones == output->numClones) { for (i = 0; i < numClones; i++) if (output->clones[i] != clones[i]) break; if (i == numClones) return TRUE; } if (numClones) { newClones = xallocarray(numClones, sizeof(RROutputPtr)); if (!newClones) return FALSE; } else newClones = NULL; free(output->clones); memcpy(newClones, clones, numClones * sizeof(RROutputPtr)); output->clones = newClones; output->numClones = numClones; RROutputChanged(output, TRUE); return TRUE; } Bool RROutputSetModes(RROutputPtr output, RRModePtr * modes, int numModes, int numPreferred) { RRModePtr *newModes; int i; if (numModes == output->numModes && numPreferred == output->numPreferred) { for (i = 0; i < numModes; i++) if (output->modes[i] != modes[i]) break; if (i == numModes) { for (i = 0; i < numModes; i++) RRModeDestroy(modes[i]); return TRUE; } } if (numModes) { newModes = xallocarray(numModes, sizeof(RRModePtr)); if (!newModes) return FALSE; } else newModes = NULL; if (output->modes) { for (i = 0; i < output->numModes; i++) RRModeDestroy(output->modes[i]); free(output->modes); } memcpy(newModes, modes, numModes * sizeof(RRModePtr)); output->modes = newModes; output->numModes = numModes; output->numPreferred = numPreferred; RROutputChanged(output, TRUE); return TRUE; } int RROutputAddUserMode(RROutputPtr output, RRModePtr mode) { int m; ScreenPtr pScreen = output->pScreen; rrScrPriv(pScreen); RRModePtr *newModes; /* Check to see if this mode is already listed for this output */ for (m = 0; m < output->numModes + output->numUserModes; m++) { RRModePtr e = (m < output->numModes ? output->modes[m] : output->userModes[m - output->numModes]); if (mode == e) return Success; } /* Check with the DDX to see if this mode is OK */ if (pScrPriv->rrOutputValidateMode) if (!pScrPriv->rrOutputValidateMode(pScreen, output, mode)) return BadMatch; if (output->userModes) newModes = reallocarray(output->userModes, output->numUserModes + 1, sizeof(RRModePtr)); else newModes = malloc(sizeof(RRModePtr)); if (!newModes) return BadAlloc; output->userModes = newModes; output->userModes[output->numUserModes++] = mode; ++mode->refcnt; RROutputChanged(output, TRUE); RRTellChanged(pScreen); return Success; } int RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode) { int m; /* Find this mode in the user mode list */ for (m = 0; m < output->numUserModes; m++) { RRModePtr e = output->userModes[m]; if (mode == e) break; } /* Not there, access error */ if (m == output->numUserModes) return BadAccess; /* make sure the mode isn't active for this output */ if (output->crtc && output->crtc->mode == mode) return BadMatch; memmove(output->userModes + m, output->userModes + m + 1, (output->numUserModes - m - 1) * sizeof(RRModePtr)); output->numUserModes--; RRModeDestroy(mode); return Success; } Bool RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs) { RRCrtcPtr *newCrtcs; int i; if (numCrtcs == output->numCrtcs) { for (i = 0; i < numCrtcs; i++) if (output->crtcs[i] != crtcs[i]) break; if (i == numCrtcs) return TRUE; } if (numCrtcs) { newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr)); if (!newCrtcs) return FALSE; } else newCrtcs = NULL; free(output->crtcs); memcpy(newCrtcs, crtcs, numCrtcs * sizeof(RRCrtcPtr)); output->crtcs = newCrtcs; output->numCrtcs = numCrtcs; RROutputChanged(output, TRUE); return TRUE; } Bool RROutputSetConnection(RROutputPtr output, CARD8 connection) { if (output->connection == connection) return TRUE; output->connection = connection; RROutputChanged(output, TRUE); return TRUE; } Bool RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder) { if (output->subpixelOrder == subpixelOrder) return TRUE; output->subpixelOrder = subpixelOrder; RROutputChanged(output, FALSE); return TRUE; } Bool RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight) { if (output->mmWidth == mmWidth && output->mmHeight == mmHeight) return TRUE; output->mmWidth = mmWidth; output->mmHeight = mmHeight; RROutputChanged(output, FALSE); return TRUE; } Bool RROutputSetNonDesktop(RROutputPtr output, Bool nonDesktop) { const char *nonDesktopStr = RR_PROPERTY_NON_DESKTOP; Atom nonDesktopProp = MakeAtom(nonDesktopStr, strlen(nonDesktopStr), TRUE); uint32_t value = nonDesktop ? 1 : 0; if (nonDesktopProp == None || nonDesktopProp == BAD_RESOURCE) return FALSE; return RRChangeOutputProperty(output, nonDesktopProp, XA_INTEGER, 32, PropModeReplace, 1, &value, TRUE, FALSE) == Success; } void RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); RRCrtcPtr crtc = output->crtc; RRModePtr mode = crtc ? crtc->mode : NULL; xRROutputChangeNotifyEvent oe = { .type = RRNotify + RREventBase, .subCode = RRNotify_OutputChange, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .window = pWin->drawable.id, .output = output->id, .crtc = crtc ? crtc->id : None, .mode = mode ? mode->mode.id : None, .rotation = crtc ? crtc->rotation : RR_Rotate_0, .connection = output->nonDesktop ? RR_Disconnected : output->connection, .subpixelOrder = output->subpixelOrder }; WriteEventsToClient(client, 1, (xEvent *) &oe); } /* * Destroy a Output at shutdown */ void RROutputDestroy(RROutputPtr output) { FreeResource(output->id, 0); } static int RROutputDestroyResource(void *value, XID pid) { RROutputPtr output = (RROutputPtr) value; ScreenPtr pScreen = output->pScreen; int m; if (pScreen) { rrScrPriv(pScreen); int i; RRLeasePtr lease, next; xorg_list_for_each_entry_safe(lease, next, &pScrPriv->leases, list) { int o; for (o = 0; o < lease->numOutputs; o++) { if (lease->outputs[o] == output) { RRTerminateLease(lease); break; } } } if (pScrPriv->primaryOutput == output) pScrPriv->primaryOutput = NULL; for (i = 0; i < pScrPriv->numOutputs; i++) { if (pScrPriv->outputs[i] == output) { memmove(pScrPriv->outputs + i, pScrPriv->outputs + i + 1, (pScrPriv->numOutputs - (i + 1)) * sizeof(RROutputPtr)); --pScrPriv->numOutputs; break; } } RRResourcesChanged(pScreen); } if (output->modes) { for (m = 0; m < output->numModes; m++) RRModeDestroy(output->modes[m]); free(output->modes); } for (m = 0; m < output->numUserModes; m++) RRModeDestroy(output->userModes[m]); free(output->userModes); free(output->crtcs); free(output->clones); RRDeleteAllOutputProperties(output); free(output); return 1; } /* * Initialize output type */ Bool RROutputInit(void) { RROutputType = CreateNewResourceType(RROutputDestroyResource, "OUTPUT"); if (!RROutputType) return FALSE; return TRUE; } /* * Initialize output type error value */ void RROutputInitErrorValue(void) { SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput); } #define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32) int ProcRRGetOutputInfo(ClientPtr client) { REQUEST(xRRGetOutputInfoReq); xRRGetOutputInfoReply rep; RROutputPtr output; CARD8 *extra; unsigned long extraLen; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRCrtc *crtcs; RRMode *modes; RROutput *clones; char *name; int i; Bool leased; REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); leased = RROutputIsLeased(output); pScreen = output->pScreen; pScrPriv = rrGetScrPriv(pScreen); if (leased) { rep = (xRRGetOutputInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = bytes_to_int32(OutputInfoExtra), .timestamp = pScrPriv->lastSetTime.milliseconds, .crtc = None, .mmWidth = 0, .mmHeight = 0, .connection = RR_Disconnected, .subpixelOrder = SubPixelUnknown, .nCrtcs = 0, .nModes = 0, .nPreferred = 0, .nClones = 0, .nameLength = output->nameLength }; extraLen = bytes_to_int32(rep.nameLength) << 2; if (extraLen) { rep.length += bytes_to_int32(extraLen); extra = calloc(1, extraLen); if (!extra) return BadAlloc; } else extra = NULL; name = (char *) extra; } else { rep = (xRRGetOutputInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = bytes_to_int32(OutputInfoExtra), .timestamp = pScrPriv->lastSetTime.milliseconds, .crtc = output->crtc ? output->crtc->id : None, .mmWidth = output->mmWidth, .mmHeight = output->mmHeight, .connection = output->nonDesktop ? RR_Disconnected : output->connection, .subpixelOrder = output->subpixelOrder, .nCrtcs = output->numCrtcs, .nModes = output->numModes + output->numUserModes, .nPreferred = output->numPreferred, .nClones = output->numClones, .nameLength = output->nameLength }; extraLen = ((output->numCrtcs + output->numModes + output->numUserModes + output->numClones + bytes_to_int32(rep.nameLength)) << 2); if (extraLen) { rep.length += bytes_to_int32(extraLen); extra = calloc(1, extraLen); if (!extra) return BadAlloc; } else extra = NULL; crtcs = (RRCrtc *) extra; modes = (RRMode *) (crtcs + output->numCrtcs); clones = (RROutput *) (modes + output->numModes + output->numUserModes); name = (char *) (clones + output->numClones); for (i = 0; i < output->numCrtcs; i++) { crtcs[i] = output->crtcs[i]->id; if (client->swapped) swapl(&crtcs[i]); } for (i = 0; i < output->numModes + output->numUserModes; i++) { if (i < output->numModes) modes[i] = output->modes[i]->mode.id; else modes[i] = output->userModes[i - output->numModes]->mode.id; if (client->swapped) swapl(&modes[i]); } for (i = 0; i < output->numClones; i++) { clones[i] = output->clones[i]->id; if (client->swapped) swapl(&clones[i]); } } memcpy(name, output->name, output->nameLength); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.crtc); swapl(&rep.mmWidth); swapl(&rep.mmHeight); swaps(&rep.nCrtcs); swaps(&rep.nModes); swaps(&rep.nPreferred); swaps(&rep.nClones); swaps(&rep.nameLength); } WriteToClient(client, sizeof(xRRGetOutputInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } static void RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv, RROutputPtr output) { if (pScrPriv->primaryOutput == output) return; /* clear the old primary */ if (pScrPriv->primaryOutput) { RROutputChanged(pScrPriv->primaryOutput, 0); pScrPriv->primaryOutput = NULL; } /* set the new primary */ if (output) { pScrPriv->primaryOutput = output; RROutputChanged(output, 0); } pScrPriv->layoutChanged = TRUE; RRTellChanged(pScreen); } int ProcRRSetOutputPrimary(ClientPtr client) { REQUEST(xRRSetOutputPrimaryReq); RROutputPtr output = NULL; WindowPtr pWin; rrScrPrivPtr pScrPriv; int ret; ScreenPtr slave; REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); ret = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (ret != Success) return ret; if (stuff->output) { VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (RROutputIsLeased(output)) return BadAccess; if (!output->pScreen->isGPU && output->pScreen != pWin->drawable.pScreen) { client->errorValue = stuff->window; return BadMatch; } if (output->pScreen->isGPU && output->pScreen->current_master != pWin->drawable.pScreen) { client->errorValue = stuff->window; return BadMatch; } } pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); if (pScrPriv) { RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); xorg_list_for_each_entry(slave, &pWin->drawable.pScreen->slave_list, slave_head) { if (slave->is_output_slave) RRSetPrimaryOutput(slave, rrGetScrPriv(slave), output); } } return Success; } int ProcRRGetOutputPrimary(ClientPtr client) { REQUEST(xRRGetOutputPrimaryReq); WindowPtr pWin; rrScrPrivPtr pScrPriv; xRRGetOutputPrimaryReply rep; RROutputPtr primary = NULL; int rc; REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); if (pScrPriv) primary = pScrPriv->primaryOutput; rep = (xRRGetOutputPrimaryReply) { .type = X_Reply, .sequenceNumber = client->sequence, .output = primary ? primary->id : None }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.output); } WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep); return Success; } xorg-server-1.20.8/randr/randr.c0000644000175000017500000005147413640201473013401 00000000000000/* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett-Packard Company * Copyright © 2006 Intel Corporation * Copyright © 2017 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. * * Author: Jim Gettys, Hewlett-Packard Company, Inc. * Keith Packard, Intel Corporation */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "randrstr.h" #include "extinit.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, void *closure, void *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(ScreenPtr pScreen) { rrScrPriv(pScreen); int j; RRLeasePtr lease, next; unwrap(pScrPriv, pScreen, CloseScreen); xorg_list_for_each_entry_safe(lease, next, &pScrPriv->leases, list) RRTerminateLease(lease); for (j = pScrPriv->numCrtcs - 1; j >= 0; j--) RRCrtcDestroy(pScrPriv->crtcs[j]); for (j = pScrPriv->numOutputs - 1; j >= 0; j--) RROutputDestroy(pScrPriv->outputs[j]); if (pScrPriv->provider) RRProviderDestroy(pScrPriv->provider); RRMonitorClose(pScreen); free(pScrPriv->crtcs); free(pScrPriv->outputs); free(pScrPriv); RRNScreens -= 1; /* ok, one fewer screen with RandR running */ return (*pScreen->CloseScreen) (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 SRRProviderChangeNotifyEvent(xRRProviderChangeNotifyEvent * from, xRRProviderChangeNotifyEvent * 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->provider, to->provider); } static void SRRProviderPropertyNotifyEvent(xRRProviderPropertyNotifyEvent * from, xRRProviderPropertyNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->window, to->window); cpswapl(from->provider, to->provider); cpswapl(from->atom, to->atom); cpswapl(from->timestamp, to->timestamp); to->state = from->state; /* pad1 */ /* pad2 */ /* pad3 */ /* pad4 */ } static void _X_COLD SRRResourceChangeNotifyEvent(xRRResourceChangeNotifyEvent * from, xRRResourceChangeNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->timestamp, to->timestamp); cpswapl(from->window, to->window); } static void _X_COLD SRRLeaseNotifyEvent(xRRLeaseNotifyEvent * from, xRRLeaseNotifyEvent * 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->lease, to->lease); to->created = from->created; } static void _X_COLD 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; case RRNotify_ProviderChange: SRRProviderChangeNotifyEvent((xRRProviderChangeNotifyEvent *) from, (xRRProviderChangeNotifyEvent *) to); break; case RRNotify_ProviderProperty: SRRProviderPropertyNotifyEvent((xRRProviderPropertyNotifyEvent *) from, (xRRProviderPropertyNotifyEvent *) to); break; case RRNotify_ResourceChange: SRRResourceChangeNotifyEvent((xRRResourceChangeNotifyEvent *) from, (xRRResourceChangeNotifyEvent *) to); break; case RRNotify_Lease: SRRLeaseNotifyEvent((xRRLeaseNotifyEvent *) from, (xRRLeaseNotifyEvent *) 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; if (!RRProviderInit()) return FALSE; if (!RRLeaseInit()) 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); pScreen->ConstrainCursorHarder = RRConstrainCursorHarder; pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap; pScrPriv->numOutputs = 0; pScrPriv->outputs = NULL; pScrPriv->numCrtcs = 0; pScrPriv->crtcs = NULL; xorg_list_init(&pScrPriv->leases); RRMonitorInit(pScreen); RRNScreens += 1; /* keep count of screens that implement randr */ return TRUE; } /*ARGSUSED*/ static int RRFreeClient(void *data, XID id) { RREventPtr pRREvent; WindowPtr pWin; RREventPtr *pHead, pCur, pPrev; pRREvent = (RREventPtr) data; pWin = pRREvent->window; dixLookupResourceByType((void **) &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((void *) pRREvent); return 1; } /*ARGSUSED*/ static int RRFreeEvents(void *data, XID id) { RREventPtr *pHead, pCur, pNext; pHead = (RREventPtr *) data; for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, RRClientType); free((void *) pCur); } free((void *) 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(); RRProviderInitErrorValue(); #ifdef PANORAMIX RRXineramaExtensionInit(); #endif } void RRResourcesChanged(ScreenPtr pScreen) { rrScrPriv(pScreen); pScrPriv->resourcesChanged = TRUE; RRSetChanged(pScreen); } static void RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); xRRResourceChangeNotifyEvent re = { .type = RRNotify + RREventBase, .subCode = RRNotify_ResourceChange, .timestamp = pScrPriv->lastSetTime.milliseconds, .window = pWin->drawable.id }; WriteEventsToClient(client, 1, (xEvent *) &re); } static int TellChanged(WindowPtr pWin, void *value) { RREventPtr *pHead, pRREvent; ClientPtr client; ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr iter; rrScrPrivPtr pSlaveScrPriv; rrScrPriv(pScreen); int i; dixLookupResourceByType((void **) &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); } xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { if (!iter->is_output_slave) continue; pSlaveScrPriv = rrGetScrPriv(iter); for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pSlaveScrPriv->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); } xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { if (!iter->is_output_slave) continue; pSlaveScrPriv = rrGetScrPriv(iter); for (i = 0; i < pSlaveScrPriv->numOutputs; i++) { RROutputPtr output = pSlaveScrPriv->outputs[i]; if (output->changed) RRDeliverOutputEvent(client, pWin, output); } } } if (pRREvent->mask & RRProviderChangeNotifyMask) { xorg_list_for_each_entry(iter, &pScreen->slave_list, slave_head) { pSlaveScrPriv = rrGetScrPriv(iter); if (pSlaveScrPriv->provider->changed) RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider); } } if (pRREvent->mask & RRResourceChangeNotifyMask) { if (pScrPriv->resourcesChanged) { RRDeliverResourceEvent(client, pWin); } } if (pRREvent->mask & RRLeaseNotifyMask) { if (pScrPriv->leasesChanged) { RRDeliverLeaseEvent(client, pWin); } } } return WT_WALKCHILDREN; } void RRSetChanged(ScreenPtr pScreen) { /* set changed bits on the master screen only */ ScreenPtr master; rrScrPriv(pScreen); rrScrPrivPtr mastersp; if (pScreen->isGPU) { master = pScreen->current_master; if (!master) return; mastersp = rrGetScrPriv(master); } else { master = pScreen; mastersp = pScrPriv; } mastersp->changed = TRUE; } /* * Something changed; send events and adjust pointer position */ void RRTellChanged(ScreenPtr pScreen) { ScreenPtr master; rrScrPriv(pScreen); rrScrPrivPtr mastersp; int i; ScreenPtr iter; rrScrPrivPtr pSlaveScrPriv; if (pScreen->isGPU) { master = pScreen->current_master; if (!master) return; mastersp = rrGetScrPriv(master); } else { master = pScreen; mastersp = pScrPriv; } xorg_list_for_each_entry(iter, &master->slave_list, slave_head) { pSlaveScrPriv = rrGetScrPriv(iter); if (!iter->is_output_slave) continue; if (CompareTimeStamps(mastersp->lastSetTime, pSlaveScrPriv->lastSetTime) == EARLIER) { mastersp->lastSetTime = pSlaveScrPriv->lastSetTime; } } if (mastersp->changed) { UpdateCurrentTimeIf(); if (mastersp->configChanged) { mastersp->lastConfigTime = currentTime; mastersp->configChanged = FALSE; } pScrPriv->changed = FALSE; mastersp->changed = FALSE; WalkTree(master, TellChanged, (void *) master); mastersp->resourcesChanged = FALSE; for (i = 0; i < pScrPriv->numOutputs; i++) pScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) pScrPriv->crtcs[i]->changed = FALSE; xorg_list_for_each_entry(iter, &master->slave_list, slave_head) { pSlaveScrPriv = rrGetScrPriv(iter); pSlaveScrPriv->provider->changed = FALSE; if (iter->is_output_slave) { for (i = 0; i < pSlaveScrPriv->numOutputs; i++) pSlaveScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) pSlaveScrPriv->crtcs[i]->changed = FALSE; } } if (mastersp->layoutChanged) { pScrPriv->layoutChanged = FALSE; RRPointerScreenConfigured(master); RRSendConfigNotify(master); } } } /* * 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) return NULL; 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; UpdateCurrentTimeIf(); return (*ProcRandrVector[stuff->data]) (client); } static int _X_COLD SProcRRDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data]) return BadRequest; UpdateCurrentTimeIf(); return (*SProcRandrVector[stuff->data]) (client); } xorg-server-1.20.8/randr/rrdispatch.c0000644000175000017500000002331213640201473014424 00000000000000/* * 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 version_compare(pRRClient->major_version, pRRClient->minor_version, 1, 1) >= 0; } static int ProcRRQueryVersion(ClientPtr client) { xRRQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xRRQueryVersionReq); rrClientPriv(client); REQUEST_SIZE_MATCH(xRRQueryVersionReq); pRRClient->major_version = stuff->majorVersion; pRRClient->minor_version = stuff->minorVersion; if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_RANDR_MAJOR_VERSION, SERVER_RANDR_MINOR_VERSION) < 0) { 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); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xRRQueryVersionReply), &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((void **) &pHead, pWin->drawable.id, RREventType, client, DixWriteAccess); if (rc != Success && rc != BadValue) return rc; if (stuff->enable & (RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask | RRProviderChangeNotifyMask | RRProviderPropertyNotifyMask | RRResourceChangeNotifyMask)) { 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, (void *) 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, (void *) pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; } *pHead = 0; } pRREvent->next = *pHead; *pHead = pRREvent; } /* * Now see if the client needs an event */ if (pScrPriv) { pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; if (CompareTimeStamps(pTimes->setTime, pScrPriv->lastSetTime) != 0 || CompareTimeStamps(pTimes->configTime, pScrPriv->lastConfigTime) != 0) { if (pRREvent->mask & RRScreenChangeNotifyMask) { RRDeliverScreenEvent(client, pWin, pScreen); } if (pRREvent->mask & RRCrtcChangeNotifyMask) { int i; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRDeliverCrtcEvent(client, pWin, pScrPriv->crtcs[i]); } } if (pRREvent->mask & RROutputChangeNotifyMask) { int i; for (i = 0; i < pScrPriv->numOutputs; i++) { RRDeliverOutputEvent(client, pWin, pScrPriv->outputs[i]); } } /* We don't check for RROutputPropertyNotifyMask, as randrproto.txt doesn't * say if there ought to be notifications of changes to output properties * if those changes occurred before the time RRSelectInput is called. */ } } } 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 */ ProcRRGetProviders, /* 32 */ ProcRRGetProviderInfo, /* 33 */ ProcRRSetProviderOffloadSink, /* 34 */ ProcRRSetProviderOutputSource, /* 35 */ ProcRRListProviderProperties, /* 36 */ ProcRRQueryProviderProperty, /* 37 */ ProcRRConfigureProviderProperty, /* 38 */ ProcRRChangeProviderProperty, /* 39 */ ProcRRDeleteProviderProperty, /* 40 */ ProcRRGetProviderProperty, /* 41 */ /* V1.5 additions */ ProcRRGetMonitors, /* 42 */ ProcRRSetMonitor, /* 43 */ ProcRRDeleteMonitor, /* 44 */ /* V1.6 additions */ ProcRRCreateLease, /* 45 */ ProcRRFreeLease, /* 46 */ }; xorg-server-1.20.8/randr/rrproperty.c0000644000175000017500000005444113640201473014520 00000000000000/* * 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 "propertyst.h" #include "swaprep.h" #include static int DeliverPropertyEvent(WindowPtr pWin, void *value) { xRROutputPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); if (!pHead) return WT_WALKCHILDREN; for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { if (!(pRREvent->mask & RROutputPropertyNotifyMask)) continue; event->window = pRREvent->window->drawable.id; WriteEventsToClient(pRREvent->client, 1, (xEvent *) event); } return WT_WALKCHILDREN; } static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event) { if (!(dispatchException & (DE_RESET | DE_TERMINATE))) WalkTree(pScreen, DeliverPropertyEvent, event); } static void RRDestroyOutputProperty(RRPropertyPtr prop) { free(prop->valid_values); free(prop->current.data); free(prop->pending.data); free(prop); } static void RRDeleteProperty(RROutputRec * output, RRPropertyRec * prop) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, .output = output->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); RRDestroyOutputProperty(prop); } void RRDeleteAllOutputProperties(RROutputPtr output) { RRPropertyPtr prop, next; for (prop = output->properties; prop; prop = next) { next = prop->next; RRDeleteProperty(output, prop); } } static void RRInitOutputPropertyValue(RRPropertyValuePtr property_value) { property_value->type = None; property_value->format = 0; property_value->size = 0; property_value->data = NULL; } static RRPropertyPtr RRCreateOutputProperty(Atom property) { RRPropertyPtr prop; prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec)); if (!prop) return NULL; prop->next = NULL; prop->propertyName = property; prop->is_pending = FALSE; prop->range = FALSE; prop->immutable = FALSE; prop->num_valid = 0; prop->valid_values = NULL; RRInitOutputPropertyValue(&prop->current); RRInitOutputPropertyValue(&prop->pending); return prop; } void RRDeleteOutputProperty(RROutputPtr output, Atom property) { RRPropertyRec *prop, **prev; for (prev = &output->properties; (prop = *prev); prev = &(prop->next)) if (prop->propertyName == property) { *prev = prop->next; RRDeleteProperty(output, prop); return; } } static void RRNoticePropertyChange(RROutputPtr output, Atom property, RRPropertyValuePtr value) { const char *non_desktop_str = RR_PROPERTY_NON_DESKTOP; Atom non_desktop_prop = MakeAtom(non_desktop_str, strlen(non_desktop_str), FALSE); if (property == non_desktop_prop) { if (value->type == XA_INTEGER && value->format == 32 && value->size >= 1) { uint32_t nonDesktopData; Bool nonDesktop; memcpy(&nonDesktopData, value->data, sizeof (nonDesktopData)); nonDesktop = nonDesktopData != 0; if (nonDesktop != output->nonDesktop) { output->nonDesktop = nonDesktop; RROutputChanged(output, 0); RRTellChanged(output->pScreen); } } } } int RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, const void *value, Bool sendevent, Bool pending) { RRPropertyPtr prop; rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); int size_in_bytes; unsigned long total_len; RRPropertyValuePtr prop_value; RRPropertyValueRec new_value; Bool add = FALSE; size_in_bytes = format >> 3; /* first see if property already exists */ prop = RRQueryOutputProperty(output, property); if (!prop) { /* just add to list */ prop = RRCreateOutputProperty(property); if (!prop) return BadAlloc; add = TRUE; mode = PropModeReplace; } if (pending && prop->is_pending) prop_value = &prop->pending; else prop_value = &prop->current; /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) return BadMatch; if ((prop_value->type != type) && (mode != PropModeReplace)) return BadMatch; new_value = *prop_value; if (mode == PropModeReplace) total_len = len; else total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { void *new_data = NULL, *old_data = NULL; new_value.data = xallocarray(total_len, size_in_bytes); if (!new_value.data && total_len && size_in_bytes) { if (add) RRDestroyOutputProperty(prop); return BadAlloc; } new_value.size = len; new_value.type = type; new_value.format = format; switch (mode) { case PropModeReplace: new_data = new_value.data; old_data = NULL; break; case PropModeAppend: new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } if (new_data) memcpy((char *) new_data, (char *) value, len * size_in_bytes); if (old_data) memcpy((char *) old_data, (char *) prop_value->data, prop_value->size * size_in_bytes); if (pending && pScrPriv->rrOutputSetProperty && !pScrPriv->rrOutputSetProperty(output->pScreen, output, prop->propertyName, &new_value)) { free(new_value.data); if (add) RRDestroyOutputProperty(prop); return BadValue; } free(prop_value->data); *prop_value = new_value; } else if (len == 0) { /* do nothing */ } if (add) { prop->next = output->properties; output->properties = prop; } if (pending && prop->is_pending) output->pendingProperties = TRUE; if (!(pending && prop->is_pending)) RRNoticePropertyChange(output, prop->propertyName, prop_value); if (sendevent) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, .output = output->id, .state = PropertyNewValue, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); } return Success; } Bool RRPostPendingProperties(RROutputPtr output) { RRPropertyValuePtr pending_value; RRPropertyValuePtr current_value; RRPropertyPtr property; Bool ret = TRUE; if (!output->pendingProperties) return TRUE; output->pendingProperties = FALSE; for (property = output->properties; property; property = property->next) { /* Skip non-pending properties */ if (!property->is_pending) continue; pending_value = &property->pending; current_value = &property->current; /* * If the pending and current values are equal, don't mark it * as changed (which would deliver an event) */ if (pending_value->type == current_value->type && pending_value->format == current_value->format && pending_value->size == current_value->size && !memcmp(pending_value->data, current_value->data, pending_value->size * (pending_value->format / 8))) continue; if (RRChangeOutputProperty(output, property->propertyName, pending_value->type, pending_value->format, PropModeReplace, pending_value->size, pending_value->data, TRUE, FALSE) != Success) ret = FALSE; } return ret; } RRPropertyPtr RRQueryOutputProperty(RROutputPtr output, Atom property) { RRPropertyPtr prop; for (prop = output->properties; prop; prop = prop->next) if (prop->propertyName == property) return prop; return NULL; } RRPropertyValuePtr RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending) { RRPropertyPtr prop = RRQueryOutputProperty(output, property); rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); if (!prop) return NULL; if (pending && prop->is_pending) return &prop->pending; else { #if RANDR_13_INTERFACE /* If we can, try to update the property value first */ if (pScrPriv->rrOutputGetProperty) pScrPriv->rrOutputGetProperty(output->pScreen, output, prop->propertyName); #endif return &prop->current; } } int RRConfigureOutputProperty(RROutputPtr output, Atom property, Bool pending, Bool range, Bool immutable, int num_values, const INT32 *values) { RRPropertyPtr prop = RRQueryOutputProperty(output, property); Bool add = FALSE; INT32 *new_values; if (!prop) { prop = RRCreateOutputProperty(property); if (!prop) return BadAlloc; add = TRUE; } else if (prop->immutable && !immutable) return BadAccess; /* * ranges must have even number of values */ if (range && (num_values & 1)) { if (add) RRDestroyOutputProperty(prop); return BadMatch; } new_values = xallocarray(num_values, sizeof(INT32)); if (!new_values && num_values) { if (add) RRDestroyOutputProperty(prop); return BadAlloc; } if (num_values) memcpy(new_values, values, num_values * sizeof(INT32)); /* * Property moving from pending to non-pending * loses any pending values */ if (prop->is_pending && !pending) { free(prop->pending.data); RRInitOutputPropertyValue(&prop->pending); } prop->is_pending = pending; prop->range = range; prop->immutable = immutable; prop->num_valid = num_values; free(prop->valid_values); prop->valid_values = new_values; if (add) { prop->next = output->properties; output->properties = prop; } return Success; } int ProcRRListOutputProperties(ClientPtr client) { REQUEST(xRRListOutputPropertiesReq); Atom *pAtoms = NULL; xRRListOutputPropertiesReply rep; int numProps = 0; RROutputPtr output; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); for (prop = output->properties; prop; prop = prop->next) numProps++; if (numProps) if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) return BadAlloc; rep = (xRRListOutputPropertiesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(numProps * sizeof(Atom)), .nAtoms = numProps }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.nAtoms); } WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep); if (numProps) { /* Copy property name atoms to reply buffer */ Atom *temppAtoms = pAtoms; for (prop = output->properties; prop; prop = prop->next) *temppAtoms++ = prop->propertyName; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); free(pAtoms); } return Success; } int ProcRRQueryOutputProperty(ClientPtr client) { REQUEST(xRRQueryOutputPropertyReq); xRRQueryOutputPropertyReply rep; RROutputPtr output; RRPropertyPtr prop; char *extra = NULL; REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); prop = RRQueryOutputProperty(output, stuff->property); if (!prop) return BadName; if (prop->num_valid) { extra = xallocarray(prop->num_valid, sizeof(INT32)); if (!extra) return BadAlloc; } rep = (xRRQueryOutputPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = prop->num_valid, .pending = prop->is_pending, .range = prop->range, .immutable = prop->immutable }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep); if (prop->num_valid) { memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), extra); free(extra); } return Success; } int ProcRRConfigureOutputProperty(ClientPtr client) { REQUEST(xRRConfigureOutputPropertyReq); RROutputPtr output; int num_valid; REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (RROutputIsLeased(output)) return BadAccess; num_valid = stuff->length - bytes_to_int32(sizeof(xRRConfigureOutputPropertyReq)); return RRConfigureOutputProperty(output, stuff->property, stuff->pending, stuff->range, FALSE, num_valid, (INT32 *) (stuff + 1)); } int ProcRRChangeOutputProperty(ClientPtr client) { REQUEST(xRRChangeOutputPropertyReq); RROutputPtr output; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq)))) return BadLength; sizeInBytes = format >> 3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } err = RRChangeOutputProperty(output, stuff->property, stuff->type, (int) format, (int) mode, len, (void *) &stuff[1], TRUE, TRUE); if (err != Success) return err; else return Success; } int ProcRRDeleteOutputProperty(ClientPtr client) { REQUEST(xRRDeleteOutputPropertyReq); RROutputPtr output; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); UpdateCurrentTime(); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (RROutputIsLeased(output)) return BadAccess; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } prop = RRQueryOutputProperty(output, stuff->property); if (!prop) { client->errorValue = stuff->property; return BadName; } if (prop->immutable) { client->errorValue = stuff->property; return BadAccess; } RRDeleteOutputProperty(output, stuff->property); return Success; } int ProcRRGetOutputProperty(ClientPtr client) { REQUEST(xRRGetOutputPropertyReq); RRPropertyPtr prop, *prev; RRPropertyValuePtr prop_value; unsigned long n, len, ind; RROutputPtr output; xRRGetOutputPropertyReply reply; char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); if (stuff->delete) UpdateCurrentTime(); VERIFY_RR_OUTPUT(stuff->output, output, stuff->delete ? DixWriteAccess : DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return BadValue; } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } for (prev = &output->properties; (prop = *prev); prev = &prop->next) if (prop->propertyName == stuff->property) break; reply = (xRRGetOutputPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence }; if (!prop) { reply.nItems = 0; reply.length = 0; reply.bytesAfter = 0; reply.propertyType = None; reply.format = 0; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; } if (prop->immutable && stuff->delete) return BadAccess; prop_value = RRGetOutputProperty(output, stuff->property, stuff->pending); if (!prop_value) return BadAtom; /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = prop_value->size; reply.format = prop_value->format; reply.length = 0; reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; } /* * Return type, format, value to client */ n = (prop_value->format / 8) * prop_value->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); if (len) { extra = malloc(len); if (!extra) return BadAlloc; } reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); else reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, .output = output->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); } if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } WriteSwappedDataToClient(client, len, extra); free(extra); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyOutputProperty(prop); } return Success; } xorg-server-1.20.8/randr/rrlease.c0000644000175000017500000002156513640201473013726 00000000000000/* * Copyright © 2017 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" #include RESTYPE RRLeaseType; /* * Notify of some lease change */ void RRDeliverLeaseEvent(ClientPtr client, WindowPtr window) { ScreenPtr screen = window->drawable.pScreen; rrScrPrivPtr scr_priv = rrGetScrPriv(screen); RRLeasePtr lease; UpdateCurrentTimeIf(); xorg_list_for_each_entry(lease, &scr_priv->leases, list) { if (lease->id != None && (lease->state == RRLeaseCreating || lease->state == RRLeaseTerminating)) { xRRLeaseNotifyEvent le = (xRRLeaseNotifyEvent) { .type = RRNotify + RREventBase, .subCode = RRNotify_Lease, .timestamp = currentTime.milliseconds, .window = window->drawable.id, .lease = lease->id, .created = lease->state == RRLeaseCreating, }; WriteEventsToClient(client, 1, (xEvent *) &le); } } } /* * Change the state of a lease and let anyone watching leases know */ static void RRLeaseChangeState(RRLeasePtr lease, RRLeaseState old, RRLeaseState new) { ScreenPtr screen = lease->screen; rrScrPrivPtr scr_priv = rrGetScrPriv(screen); lease->state = old; scr_priv->leasesChanged = TRUE; RRSetChanged(lease->screen); RRTellChanged(lease->screen); scr_priv->leasesChanged = FALSE; lease->state = new; } /* * Allocate and initialize a lease */ static RRLeasePtr RRLeaseAlloc(ScreenPtr screen, RRLease lid, int numCrtcs, int numOutputs) { RRLeasePtr lease; lease = calloc(1, sizeof(RRLeaseRec) + numCrtcs * sizeof (RRCrtcPtr) + numOutputs * sizeof(RROutputPtr)); if (!lease) return NULL; lease->screen = screen; xorg_list_init(&lease->list); lease->id = lid; lease->state = RRLeaseCreating; lease->numCrtcs = numCrtcs; lease->numOutputs = numOutputs; lease->crtcs = (RRCrtcPtr *) (lease + 1); lease->outputs = (RROutputPtr *) (lease->crtcs + numCrtcs); return lease; } /* * Check if a crtc is leased */ Bool RRCrtcIsLeased(RRCrtcPtr crtc) { ScreenPtr screen = crtc->pScreen; rrScrPrivPtr scr_priv = rrGetScrPriv(screen); RRLeasePtr lease; int c; xorg_list_for_each_entry(lease, &scr_priv->leases, list) { for (c = 0; c < lease->numCrtcs; c++) if (lease->crtcs[c] == crtc) return TRUE; } return FALSE; } /* * Check if an output is leased */ Bool RROutputIsLeased(RROutputPtr output) { ScreenPtr screen = output->pScreen; rrScrPrivPtr scr_priv = rrGetScrPriv(screen); RRLeasePtr lease; int o; xorg_list_for_each_entry(lease, &scr_priv->leases, list) { for (o = 0; o < lease->numOutputs; o++) if (lease->outputs[o] == output) return TRUE; } return FALSE; } /* * A lease has been terminated. * The driver is responsible for noticing and * calling this function when that happens */ void RRLeaseTerminated(RRLeasePtr lease) { /* Notify clients with events, but only if this isn't during lease creation */ if (lease->state == RRLeaseRunning) RRLeaseChangeState(lease, RRLeaseTerminating, RRLeaseTerminating); if (lease->id != None) FreeResource(lease->id, RT_NONE); xorg_list_del(&lease->list); } /* * A lease is completely shut down and is * ready to be deallocated */ void RRLeaseFree(RRLeasePtr lease) { free(lease); } /* * Ask the driver to terminate a lease. The * driver will call RRLeaseTerminated when that has * finished, which may be some time after this function returns * if the driver operation is asynchronous */ void RRTerminateLease(RRLeasePtr lease) { ScreenPtr screen = lease->screen; rrScrPrivPtr scr_priv = rrGetScrPriv(screen); scr_priv->rrTerminateLease(screen, lease); } /* * Destroy a lease resource ID. All this * does is note that the lease no longer has an ID, and * so doesn't appear over the protocol anymore. */ static int RRLeaseDestroyResource(void *value, XID pid) { RRLeasePtr lease = value; lease->id = None; return 1; } /* * Create the lease resource type during server initialization */ Bool RRLeaseInit(void) { RRLeaseType = CreateNewResourceType(RRLeaseDestroyResource, "LEASE"); if (!RRLeaseType) return FALSE; return TRUE; } int ProcRRCreateLease(ClientPtr client) { REQUEST(xRRCreateLeaseReq); xRRCreateLeaseReply rep; WindowPtr window; ScreenPtr screen; rrScrPrivPtr scr_priv; RRLeasePtr lease; RRCrtc *crtcIds; RROutput *outputIds; int fd; int rc; unsigned long len; int c, o; REQUEST_AT_LEAST_SIZE(xRRCreateLeaseReq); LEGAL_NEW_RESOURCE(stuff->lid, client); rc = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; len = client->req_len - bytes_to_int32(sizeof(xRRCreateLeaseReq)); if (len != stuff->nCrtcs + stuff->nOutputs) return BadLength; screen = window->drawable.pScreen; scr_priv = rrGetScrPriv(screen); if (!scr_priv) return BadMatch; if (!scr_priv->rrCreateLease) return BadMatch; /* Allocate a structure to hold all of the lease information */ lease = RRLeaseAlloc(screen, stuff->lid, stuff->nCrtcs, stuff->nOutputs); if (!lease) return BadAlloc; /* Look up all of the crtcs */ crtcIds = (RRCrtc *) (stuff + 1); for (c = 0; c < stuff->nCrtcs; c++) { RRCrtcPtr crtc; rc = dixLookupResourceByType((void **)&crtc, crtcIds[c], RRCrtcType, client, DixSetAttrAccess); if (rc != Success) { client->errorValue = crtcIds[c]; goto bail_lease; } if (RRCrtcIsLeased(crtc)) { client->errorValue = crtcIds[c]; rc = BadAccess; goto bail_lease; } lease->crtcs[c] = crtc; } /* Look up all of the outputs */ outputIds = (RROutput *) (crtcIds + stuff->nCrtcs); for (o = 0; o < stuff->nOutputs; o++) { RROutputPtr output; rc = dixLookupResourceByType((void **)&output, outputIds[o], RROutputType, client, DixSetAttrAccess); if (rc != Success) { client->errorValue = outputIds[o]; goto bail_lease; } if (RROutputIsLeased(output)) { client->errorValue = outputIds[o]; rc = BadAccess; goto bail_lease; } lease->outputs[o] = output; } rc = scr_priv->rrCreateLease(screen, lease, &fd); if (rc != Success) goto bail_lease; xorg_list_add(&scr_priv->leases, &lease->list); if (!AddResource(stuff->lid, RRLeaseType, lease)) { close(fd); return BadAlloc; } if (WriteFdToClient(client, fd, TRUE) < 0) { RRTerminateLease(lease); close(fd); return BadAlloc; } RRLeaseChangeState(lease, RRLeaseCreating, RRLeaseRunning); rep = (xRRCreateLeaseReply) { .type = X_Reply, .nfd = 1, .sequenceNumber = client->sequence, .length = 0, }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof (rep), &rep); return Success; bail_lease: free(lease); return rc; } int ProcRRFreeLease(ClientPtr client) { REQUEST(xRRFreeLeaseReq); RRLeasePtr lease; REQUEST_SIZE_MATCH(xRRFreeLeaseReq); VERIFY_RR_LEASE(stuff->lid, lease, DixDestroyAccess); if (stuff->terminate) RRTerminateLease(lease); else /* Get rid of the resource database entry */ FreeResource(stuff->lid, RT_NONE); return Success; } xorg-server-1.20.8/randr/rrproviderproperty.c0000644000175000017500000005302213640201473016265 00000000000000/* * 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 "propertyst.h" #include "swaprep.h" static int DeliverPropertyEvent(WindowPtr pWin, void *value) { xRRProviderPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); if (!pHead) return WT_WALKCHILDREN; for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { if (!(pRREvent->mask & RRProviderPropertyNotifyMask)) continue; event->window = pRREvent->window->drawable.id; WriteEventsToClient(pRREvent->client, 1, (xEvent *) event); } return WT_WALKCHILDREN; } static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event) { if (!(dispatchException & (DE_RESET | DE_TERMINATE))) WalkTree(pScreen, DeliverPropertyEvent, event); } static void RRDestroyProviderProperty(RRPropertyPtr prop) { free(prop->valid_values); free(prop->current.data); free(prop->pending.data); free(prop); } static void RRDeleteProperty(RRProviderRec * provider, RRPropertyRec * prop) { xRRProviderPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_ProviderProperty, .provider = provider->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); RRDestroyProviderProperty(prop); } void RRDeleteAllProviderProperties(RRProviderPtr provider) { RRPropertyPtr prop, next; for (prop = provider->properties; prop; prop = next) { next = prop->next; RRDeleteProperty(provider, prop); } } static void RRInitProviderPropertyValue(RRPropertyValuePtr property_value) { property_value->type = None; property_value->format = 0; property_value->size = 0; property_value->data = NULL; } static RRPropertyPtr RRCreateProviderProperty(Atom property) { RRPropertyPtr prop; prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec)); if (!prop) return NULL; prop->next = NULL; prop->propertyName = property; prop->is_pending = FALSE; prop->range = FALSE; prop->immutable = FALSE; prop->num_valid = 0; prop->valid_values = NULL; RRInitProviderPropertyValue(&prop->current); RRInitProviderPropertyValue(&prop->pending); return prop; } void RRDeleteProviderProperty(RRProviderPtr provider, Atom property) { RRPropertyRec *prop, **prev; for (prev = &provider->properties; (prop = *prev); prev = &(prop->next)) if (prop->propertyName == property) { *prev = prop->next; RRDeleteProperty(provider, prop); return; } } int RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent, Bool pending) { RRPropertyPtr prop; rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen); int size_in_bytes; int total_size; unsigned long total_len; RRPropertyValuePtr prop_value; RRPropertyValueRec new_value; Bool add = FALSE; size_in_bytes = format >> 3; /* first see if property already exists */ prop = RRQueryProviderProperty(provider, property); if (!prop) { /* just add to list */ prop = RRCreateProviderProperty(property); if (!prop) return BadAlloc; add = TRUE; mode = PropModeReplace; } if (pending && prop->is_pending) prop_value = &prop->pending; else prop_value = &prop->current; /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) return BadMatch; if ((prop_value->type != type) && (mode != PropModeReplace)) return BadMatch; new_value = *prop_value; if (mode == PropModeReplace) total_len = len; else total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { void *new_data = NULL, *old_data = NULL; total_size = total_len * size_in_bytes; new_value.data = (void *) malloc(total_size); if (!new_value.data && total_size) { if (add) RRDestroyProviderProperty(prop); return BadAlloc; } new_value.size = len; new_value.type = type; new_value.format = format; switch (mode) { case PropModeReplace: new_data = new_value.data; old_data = NULL; break; case PropModeAppend: new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } if (new_data) memcpy((char *) new_data, (char *) value, len * size_in_bytes); if (old_data) memcpy((char *) old_data, (char *) prop_value->data, prop_value->size * size_in_bytes); if (pending && pScrPriv->rrProviderSetProperty && !pScrPriv->rrProviderSetProperty(provider->pScreen, provider, prop->propertyName, &new_value)) { if (add) RRDestroyProviderProperty(prop); free(new_value.data); return BadValue; } free(prop_value->data); *prop_value = new_value; } else if (len == 0) { /* do nothing */ } if (add) { prop->next = provider->properties; provider->properties = prop; } if (pending && prop->is_pending) provider->pendingProperties = TRUE; if (sendevent) { xRRProviderPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_ProviderProperty, .provider = provider->id, .state = PropertyNewValue, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); } return Success; } Bool RRPostProviderPendingProperties(RRProviderPtr provider) { RRPropertyValuePtr pending_value; RRPropertyValuePtr current_value; RRPropertyPtr property; Bool ret = TRUE; if (!provider->pendingProperties) return TRUE; provider->pendingProperties = FALSE; for (property = provider->properties; property; property = property->next) { /* Skip non-pending properties */ if (!property->is_pending) continue; pending_value = &property->pending; current_value = &property->current; /* * If the pending and current values are equal, don't mark it * as changed (which would deliver an event) */ if (pending_value->type == current_value->type && pending_value->format == current_value->format && pending_value->size == current_value->size && !memcmp(pending_value->data, current_value->data, pending_value->size * (pending_value->format / 8))) continue; if (RRChangeProviderProperty(provider, property->propertyName, pending_value->type, pending_value->format, PropModeReplace, pending_value->size, pending_value->data, TRUE, FALSE) != Success) ret = FALSE; } return ret; } RRPropertyPtr RRQueryProviderProperty(RRProviderPtr provider, Atom property) { RRPropertyPtr prop; for (prop = provider->properties; prop; prop = prop->next) if (prop->propertyName == property) return prop; return NULL; } RRPropertyValuePtr RRGetProviderProperty(RRProviderPtr provider, Atom property, Bool pending) { RRPropertyPtr prop = RRQueryProviderProperty(provider, property); rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen); if (!prop) return NULL; if (pending && prop->is_pending) return &prop->pending; else { #if RANDR_13_INTERFACE /* If we can, try to update the property value first */ if (pScrPriv->rrProviderGetProperty) pScrPriv->rrProviderGetProperty(provider->pScreen, provider, prop->propertyName); #endif return &prop->current; } } int RRConfigureProviderProperty(RRProviderPtr provider, Atom property, Bool pending, Bool range, Bool immutable, int num_values, INT32 *values) { RRPropertyPtr prop = RRQueryProviderProperty(provider, property); Bool add = FALSE; INT32 *new_values; if (!prop) { prop = RRCreateProviderProperty(property); if (!prop) return BadAlloc; add = TRUE; } else if (prop->immutable && !immutable) return BadAccess; /* * ranges must have even number of values */ if (range && (num_values & 1)) { if (add) RRDestroyProviderProperty(prop); return BadMatch; } new_values = xallocarray(num_values, sizeof(INT32)); if (!new_values && num_values) { if (add) RRDestroyProviderProperty(prop); return BadAlloc; } if (num_values) memcpy(new_values, values, num_values * sizeof(INT32)); /* * Property moving from pending to non-pending * loses any pending values */ if (prop->is_pending && !pending) { free(prop->pending.data); RRInitProviderPropertyValue(&prop->pending); } prop->is_pending = pending; prop->range = range; prop->immutable = immutable; prop->num_valid = num_values; free(prop->valid_values); prop->valid_values = new_values; if (add) { prop->next = provider->properties; provider->properties = prop; } return Success; } int ProcRRListProviderProperties(ClientPtr client) { REQUEST(xRRListProviderPropertiesReq); Atom *pAtoms = NULL, *temppAtoms; xRRListProviderPropertiesReply rep; int numProps = 0; RRProviderPtr provider; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); for (prop = provider->properties; prop; prop = prop->next) numProps++; if (numProps) if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) return BadAlloc; rep = (xRRListProviderPropertiesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(numProps * sizeof(Atom)), .nAtoms = numProps }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.nAtoms); } temppAtoms = pAtoms; for (prop = provider->properties; prop; prop = prop->next) *temppAtoms++ = prop->propertyName; WriteToClient(client, sizeof(xRRListProviderPropertiesReply), (char *) &rep); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); free(pAtoms); } return Success; } int ProcRRQueryProviderProperty(ClientPtr client) { REQUEST(xRRQueryProviderPropertyReq); xRRQueryProviderPropertyReply rep; RRProviderPtr provider; RRPropertyPtr prop; char *extra = NULL; REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); prop = RRQueryProviderProperty(provider, stuff->property); if (!prop) return BadName; if (prop->num_valid) { extra = xallocarray(prop->num_valid, sizeof(INT32)); if (!extra) return BadAlloc; } rep = (xRRQueryProviderPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = prop->num_valid, .pending = prop->is_pending, .range = prop->range, .immutable = prop->immutable }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xRRQueryProviderPropertyReply), (char *) &rep); if (prop->num_valid) { memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), extra); free(extra); } return Success; } int ProcRRConfigureProviderProperty(ClientPtr client) { REQUEST(xRRConfigureProviderPropertyReq); RRProviderPtr provider; int num_valid; REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); num_valid = stuff->length - bytes_to_int32(sizeof(xRRConfigureProviderPropertyReq)); return RRConfigureProviderProperty(provider, stuff->property, stuff->pending, stuff->range, FALSE, num_valid, (INT32 *) (stuff + 1)); } int ProcRRChangeProviderProperty(ClientPtr client) { REQUEST(xRRChangeProviderPropertyReq); RRProviderPtr provider; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq)))) return BadLength; sizeInBytes = format >> 3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeProviderPropertyReq, totalSize); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } err = RRChangeProviderProperty(provider, stuff->property, stuff->type, (int) format, (int) mode, len, (void *) &stuff[1], TRUE, TRUE); if (err != Success) return err; else return Success; } int ProcRRDeleteProviderProperty(ClientPtr client) { REQUEST(xRRDeleteProviderPropertyReq); RRProviderPtr provider; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); UpdateCurrentTime(); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } prop = RRQueryProviderProperty(provider, stuff->property); if (!prop) { client->errorValue = stuff->property; return BadName; } if (prop->immutable) { client->errorValue = stuff->property; return BadAccess; } RRDeleteProviderProperty(provider, stuff->property); return Success; } int ProcRRGetProviderProperty(ClientPtr client) { REQUEST(xRRGetProviderPropertyReq); RRPropertyPtr prop, *prev; RRPropertyValuePtr prop_value; unsigned long n, len, ind; RRProviderPtr provider; xRRGetProviderPropertyReply reply = { .type = X_Reply, .sequenceNumber = client->sequence }; char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); if (stuff->delete) UpdateCurrentTime(); VERIFY_RR_PROVIDER(stuff->provider, provider, stuff->delete ? DixWriteAccess : DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return BadValue; } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } for (prev = &provider->properties; (prop = *prev); prev = &prop->next) if (prop->propertyName == stuff->property) break; if (!prop) { reply.nItems = 0; reply.length = 0; reply.bytesAfter = 0; reply.propertyType = None; reply.format = 0; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); return Success; } if (prop->immutable && stuff->delete) return BadAccess; prop_value = RRGetProviderProperty(provider, stuff->property, stuff->pending); if (!prop_value) return BadAtom; /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = prop_value->size; reply.format = prop_value->format; reply.length = 0; reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); return Success; } /* * Return type, format, value to client */ n = (prop_value->format / 8) * prop_value->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); if (len) { extra = malloc(len); if (!extra) return BadAlloc; } reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); else reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { xRRProviderPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_ProviderProperty, .provider = provider->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); } if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } WriteSwappedDataToClient(client, len, extra); free(extra); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyProviderProperty(prop); } return Success; } xorg-server-1.20.8/randr/randrstr.h0000644000175000017500000007565613640201473014147 00000000000000/* * 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 #endif #ifndef _RANDRSTR_H_ #define _RANDRSTR_H_ #include #include #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 #include #include /* we share subpixel order information */ #include "picturestr.h" #include /* 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 0x0104 typedef XID RRMode; typedef XID RROutput; typedef XID RRCrtc; typedef XID RRProvider; typedef XID RRLease; extern int RREventBase, RRErrorBase; extern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr); extern 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; typedef struct _rrProvider RRProviderRec, *RRProviderPtr; typedef struct _rrMonitor RRMonitorRec, *RRMonitorPtr; typedef struct _rrLease RRLeaseRec, *RRLeasePtr; 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 */ void *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; PixmapPtr scanout_pixmap; PixmapPtr scanout_pixmap_back; }; 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; Bool nonDesktop; RRPropertyPtr properties; Bool pendingProperties; void *devPrivate; }; struct _rrProvider { RRProvider id; ScreenPtr pScreen; uint32_t capabilities; char *name; int nameLength; RRPropertyPtr properties; Bool pendingProperties; Bool changed; struct _rrProvider *offload_sink; struct _rrProvider *output_source; }; typedef struct _rrMonitorGeometry { BoxRec box; CARD32 mmWidth; CARD32 mmHeight; } RRMonitorGeometryRec, *RRMonitorGeometryPtr; struct _rrMonitor { Atom name; ScreenPtr pScreen; int numOutputs; RROutput *outputs; Bool primary; Bool automatic; RRMonitorGeometryRec geometry; }; typedef enum _rrLeaseState { RRLeaseCreating, RRLeaseRunning, RRLeaseTerminating } RRLeaseState; struct _rrLease { struct xorg_list list; ScreenPtr screen; RRLease id; RRLeaseState state; void *devPrivate; int numCrtcs; RRCrtcPtr *crtcs; int numOutputs; RROutputPtr *outputs; }; #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 (*RRProviderGetPropertyProcPtr) (ScreenPtr pScreen, RRProviderPtr provider, Atom property); typedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen, RRProviderPtr provider, Atom property, RRPropertyValuePtr value); typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations); typedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pscreen); typedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen, RRProviderPtr provider, RRProviderPtr output_source); typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen, RRProviderPtr provider, RRProviderPtr offload_sink); typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen, RRProviderPtr provider); /* Additions for 1.6 */ typedef int (*RRCreateLeaseProcPtr)(ScreenPtr screen, RRLeasePtr lease, int *fd); typedef void (*RRTerminateLeaseProcPtr)(ScreenPtr screen, RRLeasePtr lease); /* 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 Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap); typedef Bool (*RRStartFlippingPixmapTrackingProcPtr)(RRCrtcPtr, DrawablePtr, PixmapPtr, PixmapPtr, int x, int y, int dst_x, int dst_y, Rotation rotation); typedef Bool (*RREnableSharedPixmapFlippingProcPtr)(RRCrtcPtr, PixmapPtr front, PixmapPtr back); typedef void (*RRDisableSharedPixmapFlippingProcPtr)(RRCrtcPtr); 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 /* TODO #if RANDR_15_INTERFACE */ RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap; RRStartFlippingPixmapTrackingProcPtr rrStartFlippingPixmapTracking; RREnableSharedPixmapFlippingProcPtr rrEnableSharedPixmapFlipping; RRDisableSharedPixmapFlippingProcPtr rrDisableSharedPixmapFlipping; RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource; RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink; RRProviderGetPropertyProcPtr rrProviderGetProperty; RRProviderSetPropertyProcPtr rrProviderSetProperty; RRCreateLeaseProcPtr rrCreateLease; RRTerminateLeaseProcPtr rrTerminateLease; /* * 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 */ Bool resourcesChanged; /* screen resources change */ Bool leasesChanged; /* leases change */ 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 Bool discontiguous; RRProviderPtr provider; RRProviderDestroyProcPtr rrProviderDestroy; int numMonitors; RRMonitorPtr *monitors; struct xorg_list leases; } 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 RESTYPE RRClientType, RREventType; /* resource types for event masks */ extern DevPrivateKeyRec RRClientPrivateKeyRec; #define RRClientPrivateKey (&RRClientPrivateKeyRec) extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType, RRLeaseType; #define VERIFY_RR_OUTPUT(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RROutputType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_CRTC(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRCrtcType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_MODE(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRModeType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_PROVIDER(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRProviderType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_LEASE(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRLeaseType, 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) #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); extern _X_EXPORT void RRResourcesChanged(ScreenPtr pScreen); /* randr.c */ /* set a screen change on the primary screen */ extern _X_EXPORT void RRSetChanged(ScreenPtr pScreen); /* * 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 Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop); 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 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); /* * 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); /* * Detach and free a scanout pixmap */ extern _X_EXPORT void RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc); extern _X_EXPORT Bool RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable); /* * Return if the screen has any scanout_pixmap's attached */ extern _X_EXPORT Bool RRHasScanoutPixmap(ScreenPtr pScreen); /* * 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); void RRConstrainCursorHarder(DeviceIntPtr, ScreenPtr, int, int *, int *); /* rrdispatch.c */ extern _X_EXPORT Bool RRClientKnowsRates(ClientPtr pClient); /* rrlease.c */ void RRDeliverLeaseEvent(ClientPtr client, WindowPtr window); extern _X_EXPORT void RRLeaseTerminated(RRLeasePtr lease); extern _X_EXPORT void RRLeaseFree(RRLeasePtr lease); extern _X_EXPORT Bool RRCrtcIsLeased(RRCrtcPtr crtc); extern _X_EXPORT Bool RROutputIsLeased(RROutputPtr output); void RRTerminateLease(RRLeasePtr lease); Bool RRLeaseInit(void); /* 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, const void *value, Bool sendevent, Bool pending); extern _X_EXPORT int RRConfigureOutputProperty(RROutputPtr output, Atom property, Bool pending, Bool range, Bool immutable, int num_values, const 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); /* rrprovider.c */ #define PRIME_SYNC_PROP "PRIME Synchronization" extern _X_EXPORT void RRProviderInitErrorValue(void); extern _X_EXPORT int ProcRRGetProviders(ClientPtr client); extern _X_EXPORT int ProcRRGetProviderInfo(ClientPtr client); extern _X_EXPORT int ProcRRSetProviderOutputSource(ClientPtr client); extern _X_EXPORT int ProcRRSetProviderOffloadSink(ClientPtr client); extern _X_EXPORT Bool RRProviderInit(void); extern _X_EXPORT RRProviderPtr RRProviderCreate(ScreenPtr pScreen, const char *name, int nameLength); extern _X_EXPORT void RRProviderDestroy (RRProviderPtr provider); extern _X_EXPORT void RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities); extern _X_EXPORT Bool RRProviderLookup(XID id, RRProviderPtr *provider_p); extern _X_EXPORT void RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider); /* rrproviderproperty.c */ extern _X_EXPORT void RRDeleteAllProviderProperties(RRProviderPtr provider); extern _X_EXPORT RRPropertyValuePtr RRGetProviderProperty(RRProviderPtr provider, Atom property, Bool pending); extern _X_EXPORT RRPropertyPtr RRQueryProviderProperty(RRProviderPtr provider, Atom property); extern _X_EXPORT void RRDeleteProviderProperty(RRProviderPtr provider, Atom property); extern _X_EXPORT int RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent, Bool pending); extern _X_EXPORT int RRConfigureProviderProperty(RRProviderPtr provider, Atom property, Bool pending, Bool range, Bool immutable, int num_values, INT32 *values); extern _X_EXPORT Bool RRPostProviderPendingProperties(RRProviderPtr provider); extern _X_EXPORT int ProcRRGetProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRListProviderProperties(ClientPtr client); extern _X_EXPORT int ProcRRQueryProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRConfigureProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRChangeProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRDeleteProviderProperty(ClientPtr client); /* rrxinerama.c */ #ifdef XINERAMA extern _X_EXPORT void RRXineramaExtensionInit(void); #endif void RRMonitorInit(ScreenPtr screen); Bool RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr *monitors_ret, int *nmon_ret); int RRMonitorCountList(ScreenPtr screen); void RRMonitorFreeList(RRMonitorPtr monitors, int nmon); void RRMonitorClose(ScreenPtr screen); RRMonitorPtr RRMonitorAlloc(int noutput); int RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor); void RRMonitorFree(RRMonitorPtr monitor); int ProcRRGetMonitors(ClientPtr client); int ProcRRSetMonitor(ClientPtr client); int ProcRRDeleteMonitor(ClientPtr client); int ProcRRCreateLease(ClientPtr client); int ProcRRFreeLease(ClientPtr client); #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 */ xorg-server-1.20.8/randr/meson.build0000644000175000017500000000113013640201473014251 00000000000000srcs_randr = [ 'randr.c', 'rrcrtc.c', 'rrdispatch.c', 'rrinfo.c', 'rrlease.c', 'rrmode.c', 'rrmonitor.c', 'rroutput.c', 'rrpointer.c', 'rrproperty.c', 'rrprovider.c', 'rrproviderproperty.c', 'rrscreen.c', 'rrsdispatch.c', 'rrtransform.c', ] hdrs_randr = [ 'randrstr.h', 'rrtransform.h', ] if build_xinerama srcs_randr += 'rrxinerama.c' endif libxserver_randr = static_library('libxserver_randr', srcs_randr, include_directories: inc, dependencies: common_dep, ) install_data(hdrs_randr, install_dir: xorgsdkdir) xorg-server-1.20.8/randr/rrinfo.c0000644000175000017500000002145713640201473013570 00000000000000/* * 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)); snprintf(name, sizeof(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 = reallocarray(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; CARD16 width, height; /* * 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++) { mode = (i < output->numModes ? output->modes[i] : output->userModes[i - output->numModes]); width = mode->mode.width; 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; RRSetChanged(pScreen); 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 = reallocarray(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 = reallocarray(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 xorg-server-1.20.8/dri3/0000755000175000017500000000000013640201533011724 500000000000000xorg-server-1.20.8/dri3/dri3_request.c0000644000175000017500000004740313640201473014434 00000000000000/* * Copyright © 2013 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 #endif #include "dri3_priv.h" #include #include #include #include "../Xext/syncsdk.h" #include #include static Bool dri3_screen_can_one_point_two(ScreenPtr screen) { dri3_screen_priv_ptr dri3 = dri3_screen_priv(screen); if (dri3 && dri3->info && dri3->info->version >= 2 && dri3->info->pixmap_from_fds && dri3->info->fds_from_pixmap && dri3->info->get_formats && dri3->info->get_modifiers && dri3->info->get_drawable_modifiers) return TRUE; return FALSE; } static int proc_dri3_query_version(ClientPtr client) { REQUEST(xDRI3QueryVersionReq); xDRI3QueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_DRI3_MAJOR_VERSION, .minorVersion = SERVER_DRI3_MINOR_VERSION }; REQUEST_SIZE_MATCH(xDRI3QueryVersionReq); for (int i = 0; i < screenInfo.numScreens; i++) { if (!dri3_screen_can_one_point_two(screenInfo.screens[i])) { rep.minorVersion = 0; break; } } for (int i = 0; i < screenInfo.numGPUScreens; i++) { if (!dri3_screen_can_one_point_two(screenInfo.gpuscreens[i])) { rep.minorVersion = 0; break; } } /* From DRI3 proto: * * The client sends the highest supported version to the server * and the server sends the highest version it supports, but no * higher than the requested version. */ if (rep.majorVersion > stuff->majorVersion || (rep.majorVersion == stuff->majorVersion && rep.minorVersion > stuff->minorVersion)) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(rep), &rep); return Success; } int dri3_send_open_reply(ClientPtr client, int fd) { xDRI3OpenReply rep = { .type = X_Reply, .nfd = 1, .sequenceNumber = client->sequence, .length = 0, }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } if (WriteFdToClient(client, fd, TRUE) < 0) { close(fd); return BadAlloc; } WriteToClient(client, sizeof (rep), &rep); return Success; } static int proc_dri3_open(ClientPtr client) { REQUEST(xDRI3OpenReq); RRProviderPtr provider; DrawablePtr drawable; ScreenPtr screen; int fd; int status; REQUEST_SIZE_MATCH(xDRI3OpenReq); status = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixGetAttrAccess); if (status != Success) return status; if (stuff->provider == None) provider = NULL; else if (!RRProviderType) { return BadMatch; } else { VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (drawable->pScreen != provider->pScreen) return BadMatch; } screen = drawable->pScreen; status = dri3_open(client, screen, provider, &fd); if (status != Success) return status; if (client->ignoreCount == 0) return dri3_send_open_reply(client, fd); return Success; } static int proc_dri3_pixmap_from_buffer(ClientPtr client) { REQUEST(xDRI3PixmapFromBufferReq); int fd; DrawablePtr drawable; PixmapPtr pixmap; CARD32 stride, offset; int rc; SetReqFds(client, 1); REQUEST_SIZE_MATCH(xDRI3PixmapFromBufferReq); LEGAL_NEW_RESOURCE(stuff->pixmap, client); rc = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->drawable; return rc; } if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } if (stuff->width > 32767 || stuff->height > 32767) return BadAlloc; if (stuff->depth != 1) { DepthPtr depth = drawable->pScreen->allowedDepths; int i; for (i = 0; i < drawable->pScreen->numDepths; i++, depth++) if (depth->depth == stuff->depth) break; if (i == drawable->pScreen->numDepths) { client->errorValue = stuff->depth; return BadValue; } } fd = ReadFdFromClient(client); if (fd < 0) return BadValue; offset = 0; stride = stuff->stride; rc = dri3_pixmap_from_fds(&pixmap, drawable->pScreen, 1, &fd, stuff->width, stuff->height, &stride, &offset, stuff->depth, stuff->bpp, DRM_FORMAT_MOD_INVALID); close (fd); if (rc != Success) return rc; pixmap->drawable.id = stuff->pixmap; /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, pixmap, RT_NONE, NULL, DixCreateAccess); if (rc != Success) { (*drawable->pScreen->DestroyPixmap) (pixmap); return rc; } if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap)) return BadAlloc; return Success; } static int proc_dri3_buffer_from_pixmap(ClientPtr client) { REQUEST(xDRI3BufferFromPixmapReq); xDRI3BufferFromPixmapReply rep = { .type = X_Reply, .nfd = 1, .sequenceNumber = client->sequence, .length = 0, }; int rc; int fd; PixmapPtr pixmap; REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq); rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->pixmap; return rc; } rep.width = pixmap->drawable.width; rep.height = pixmap->drawable.height; rep.depth = pixmap->drawable.depth; rep.bpp = pixmap->drawable.bitsPerPixel; fd = dri3_fd_from_pixmap(pixmap, &rep.stride, &rep.size); if (fd < 0) return BadPixmap; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.size); swaps(&rep.width); swaps(&rep.height); swaps(&rep.stride); } if (WriteFdToClient(client, fd, TRUE) < 0) { close(fd); return BadAlloc; } WriteToClient(client, sizeof(rep), &rep); return Success; } static int proc_dri3_fence_from_fd(ClientPtr client) { REQUEST(xDRI3FenceFromFDReq); DrawablePtr drawable; int fd; int status; SetReqFds(client, 1); REQUEST_SIZE_MATCH(xDRI3FenceFromFDReq); LEGAL_NEW_RESOURCE(stuff->fence, client); status = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess); if (status != Success) return status; fd = ReadFdFromClient(client); if (fd < 0) return BadValue; status = SyncCreateFenceFromFD(client, drawable, stuff->fence, fd, stuff->initially_triggered); return status; } static int proc_dri3_fd_from_fence(ClientPtr client) { REQUEST(xDRI3FDFromFenceReq); xDRI3FDFromFenceReply rep = { .type = X_Reply, .nfd = 1, .sequenceNumber = client->sequence, .length = 0, }; DrawablePtr drawable; int fd; int status; SyncFence *fence; REQUEST_SIZE_MATCH(xDRI3FDFromFenceReq); status = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess); if (status != Success) return status; status = SyncVerifyFence(&fence, stuff->fence, client, DixWriteAccess); if (status != Success) return status; fd = SyncFDFromFence(client, drawable, fence); if (fd < 0) return BadMatch; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } if (WriteFdToClient(client, fd, FALSE) < 0) return BadAlloc; WriteToClient(client, sizeof(rep), &rep); return Success; } static int proc_dri3_get_supported_modifiers(ClientPtr client) { REQUEST(xDRI3GetSupportedModifiersReq); xDRI3GetSupportedModifiersReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, }; WindowPtr window; ScreenPtr pScreen; CARD64 *window_modifiers = NULL; CARD64 *screen_modifiers = NULL; CARD32 nwindowmodifiers = 0; CARD32 nscreenmodifiers = 0; int status; int i; REQUEST_SIZE_MATCH(xDRI3GetSupportedModifiersReq); status = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (status != Success) return status; pScreen = window->drawable.pScreen; dri3_get_supported_modifiers(pScreen, &window->drawable, stuff->depth, stuff->bpp, &nwindowmodifiers, &window_modifiers, &nscreenmodifiers, &screen_modifiers); rep.numWindowModifiers = nwindowmodifiers; rep.numScreenModifiers = nscreenmodifiers; rep.length = bytes_to_int32(rep.numWindowModifiers * sizeof(CARD64)) + bytes_to_int32(rep.numScreenModifiers * sizeof(CARD64)); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.numWindowModifiers); swapl(&rep.numScreenModifiers); for (i = 0; i < nwindowmodifiers; i++) swapll(&window_modifiers[i]); for (i = 0; i < nscreenmodifiers; i++) swapll(&screen_modifiers[i]); } WriteToClient(client, sizeof(rep), &rep); WriteToClient(client, nwindowmodifiers * sizeof(CARD64), window_modifiers); WriteToClient(client, nscreenmodifiers * sizeof(CARD64), screen_modifiers); free(window_modifiers); free(screen_modifiers); return Success; } static int proc_dri3_pixmap_from_buffers(ClientPtr client) { REQUEST(xDRI3PixmapFromBuffersReq); int fds[4]; CARD32 strides[4], offsets[4]; ScreenPtr screen; WindowPtr window; PixmapPtr pixmap; int rc; int i; SetReqFds(client, stuff->num_buffers); REQUEST_SIZE_MATCH(xDRI3PixmapFromBuffersReq); LEGAL_NEW_RESOURCE(stuff->pixmap, client); rc = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; return rc; } screen = window->drawable.pScreen; if (!stuff->width || !stuff->height || !stuff->bpp || !stuff->depth) { client->errorValue = 0; return BadValue; } if (stuff->width > 32767 || stuff->height > 32767) return BadAlloc; if (stuff->depth != 1) { DepthPtr depth = screen->allowedDepths; int j; for (j = 0; j < screen->numDepths; j++, depth++) if (depth->depth == stuff->depth) break; if (j == screen->numDepths) { client->errorValue = stuff->depth; return BadValue; } } if (!stuff->num_buffers || stuff->num_buffers > 4) { client->errorValue = stuff->num_buffers; return BadValue; } for (i = 0; i < stuff->num_buffers; i++) { fds[i] = ReadFdFromClient(client); if (fds[i] < 0) { while (--i >= 0) close(fds[i]); return BadValue; } } strides[0] = stuff->stride0; strides[1] = stuff->stride1; strides[2] = stuff->stride2; strides[3] = stuff->stride3; offsets[0] = stuff->offset0; offsets[1] = stuff->offset1; offsets[2] = stuff->offset2; offsets[3] = stuff->offset3; rc = dri3_pixmap_from_fds(&pixmap, screen, stuff->num_buffers, fds, stuff->width, stuff->height, strides, offsets, stuff->depth, stuff->bpp, stuff->modifier); for (i = 0; i < stuff->num_buffers; i++) close (fds[i]); if (rc != Success) return rc; pixmap->drawable.id = stuff->pixmap; /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, pixmap, RT_NONE, NULL, DixCreateAccess); if (rc != Success) { (*screen->DestroyPixmap) (pixmap); return rc; } if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap)) return BadAlloc; return Success; } static int proc_dri3_buffers_from_pixmap(ClientPtr client) { REQUEST(xDRI3BuffersFromPixmapReq); xDRI3BuffersFromPixmapReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, }; int rc; int fds[4]; int num_fds; uint32_t strides[4], offsets[4]; uint64_t modifier; int i; PixmapPtr pixmap; REQUEST_SIZE_MATCH(xDRI3BuffersFromPixmapReq); rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->pixmap; return rc; } num_fds = dri3_fds_from_pixmap(pixmap, fds, strides, offsets, &modifier); if (num_fds == 0) return BadPixmap; rep.nfd = num_fds; rep.length = bytes_to_int32(num_fds * 2 * sizeof(CARD32)); rep.width = pixmap->drawable.width; rep.height = pixmap->drawable.height; rep.depth = pixmap->drawable.depth; rep.bpp = pixmap->drawable.bitsPerPixel; rep.modifier = modifier; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.width); swaps(&rep.height); swapll(&rep.modifier); for (i = 0; i < num_fds; i++) { swapl(&strides[i]); swapl(&offsets[i]); } } for (i = 0; i < num_fds; i++) { if (WriteFdToClient(client, fds[i], TRUE) < 0) { while (i--) close(fds[i]); return BadAlloc; } } WriteToClient(client, sizeof(rep), &rep); WriteToClient(client, num_fds * sizeof(CARD32), strides); WriteToClient(client, num_fds * sizeof(CARD32), offsets); return Success; } int (*proc_dri3_vector[DRI3NumberRequests]) (ClientPtr) = { proc_dri3_query_version, /* 0 */ proc_dri3_open, /* 1 */ proc_dri3_pixmap_from_buffer, /* 2 */ proc_dri3_buffer_from_pixmap, /* 3 */ proc_dri3_fence_from_fd, /* 4 */ proc_dri3_fd_from_fence, /* 5 */ proc_dri3_get_supported_modifiers, /* 6 */ proc_dri3_pixmap_from_buffers, /* 7 */ proc_dri3_buffers_from_pixmap, /* 8 */ }; int proc_dri3_dispatch(ClientPtr client) { REQUEST(xReq); if (!client->local) return BadMatch; if (stuff->data >= DRI3NumberRequests || !proc_dri3_vector[stuff->data]) return BadRequest; return (*proc_dri3_vector[stuff->data]) (client); } static int _X_COLD sproc_dri3_query_version(ClientPtr client) { REQUEST(xDRI3QueryVersionReq); REQUEST_SIZE_MATCH(xDRI3QueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_open(ClientPtr client) { REQUEST(xDRI3OpenReq); REQUEST_SIZE_MATCH(xDRI3OpenReq); swaps(&stuff->length); swapl(&stuff->drawable); swapl(&stuff->provider); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_pixmap_from_buffer(ClientPtr client) { REQUEST(xDRI3PixmapFromBufferReq); REQUEST_SIZE_MATCH(xDRI3PixmapFromBufferReq); swaps(&stuff->length); swapl(&stuff->pixmap); swapl(&stuff->drawable); swapl(&stuff->size); swaps(&stuff->width); swaps(&stuff->height); swaps(&stuff->stride); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_buffer_from_pixmap(ClientPtr client) { REQUEST(xDRI3BufferFromPixmapReq); REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq); swaps(&stuff->length); swapl(&stuff->pixmap); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_fence_from_fd(ClientPtr client) { REQUEST(xDRI3FenceFromFDReq); REQUEST_SIZE_MATCH(xDRI3FenceFromFDReq); swaps(&stuff->length); swapl(&stuff->drawable); swapl(&stuff->fence); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_fd_from_fence(ClientPtr client) { REQUEST(xDRI3FDFromFenceReq); REQUEST_SIZE_MATCH(xDRI3FDFromFenceReq); swaps(&stuff->length); swapl(&stuff->drawable); swapl(&stuff->fence); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_get_supported_modifiers(ClientPtr client) { REQUEST(xDRI3GetSupportedModifiersReq); REQUEST_SIZE_MATCH(xDRI3GetSupportedModifiersReq); swaps(&stuff->length); swapl(&stuff->window); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_pixmap_from_buffers(ClientPtr client) { REQUEST(xDRI3PixmapFromBuffersReq); REQUEST_SIZE_MATCH(xDRI3PixmapFromBuffersReq); swaps(&stuff->length); swapl(&stuff->pixmap); swapl(&stuff->window); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->stride0); swapl(&stuff->offset0); swapl(&stuff->stride1); swapl(&stuff->offset1); swapl(&stuff->stride2); swapl(&stuff->offset2); swapl(&stuff->stride3); swapl(&stuff->offset3); swapll(&stuff->modifier); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } static int _X_COLD sproc_dri3_buffers_from_pixmap(ClientPtr client) { REQUEST(xDRI3BuffersFromPixmapReq); REQUEST_SIZE_MATCH(xDRI3BuffersFromPixmapReq); swaps(&stuff->length); swapl(&stuff->pixmap); return (*proc_dri3_vector[stuff->dri3ReqType]) (client); } int (*sproc_dri3_vector[DRI3NumberRequests]) (ClientPtr) = { sproc_dri3_query_version, /* 0 */ sproc_dri3_open, /* 1 */ sproc_dri3_pixmap_from_buffer, /* 2 */ sproc_dri3_buffer_from_pixmap, /* 3 */ sproc_dri3_fence_from_fd, /* 4 */ sproc_dri3_fd_from_fence, /* 5 */ sproc_dri3_get_supported_modifiers, /* 6 */ sproc_dri3_pixmap_from_buffers, /* 7 */ sproc_dri3_buffers_from_pixmap, /* 8 */ }; int _X_COLD sproc_dri3_dispatch(ClientPtr client) { REQUEST(xReq); if (!client->local) return BadMatch; if (stuff->data >= DRI3NumberRequests || !sproc_dri3_vector[stuff->data]) return BadRequest; return (*sproc_dri3_vector[stuff->data]) (client); } xorg-server-1.20.8/dri3/Makefile.am0000644000175000017500000000032413640201473013702 00000000000000noinst_LTLIBRARIES = libdri3.la AM_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ @DIX_CFLAGS@ @XORG_CFLAGS@ libdri3_la_SOURCES = \ dri3.h \ dri3_priv.h \ dri3.c \ dri3_request.c \ dri3_screen.c sdk_HEADERS = dri3.h xorg-server-1.20.8/dri3/dri3.c0000644000175000017500000000652513640201473012664 00000000000000/* * Copyright © 2013 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 #endif #include "dri3_priv.h" #include static int dri3_request; DevPrivateKeyRec dri3_screen_private_key; static int dri3_screen_generation; static Bool dri3_close_screen(ScreenPtr screen) { dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen); unwrap(screen_priv, screen, CloseScreen); free(screen_priv); return (*screen->CloseScreen) (screen); } Bool dri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info) { dri3_screen_generation = serverGeneration; if (!dixRegisterPrivateKey(&dri3_screen_private_key, PRIVATE_SCREEN, 0)) return FALSE; if (!dri3_screen_priv(screen)) { dri3_screen_priv_ptr screen_priv = calloc(1, sizeof (dri3_screen_priv_rec)); if (!screen_priv) return FALSE; wrap(screen_priv, screen, CloseScreen, dri3_close_screen); screen_priv->info = info; dixSetPrivate(&screen->devPrivates, &dri3_screen_private_key, screen_priv); } return TRUE; } void dri3_extension_init(void) { ExtensionEntry *extension; int i; /* If no screens support DRI3, there's no point offering the * extension at all */ if (dri3_screen_generation != serverGeneration) return; #ifdef PANORAMIX if (!noPanoramiXExtension) return; #endif extension = AddExtension(DRI3_NAME, DRI3NumberEvents, DRI3NumberErrors, proc_dri3_dispatch, sproc_dri3_dispatch, NULL, StandardMinorOpcode); if (!extension) goto bail; dri3_request = extension->base; for (i = 0; i < screenInfo.numScreens; i++) { if (!dri3_screen_init(screenInfo.screens[i], NULL)) goto bail; } return; bail: FatalError("Cannot initialize DRI3 extension"); } uint32_t drm_format_for_depth(uint32_t depth, uint32_t bpp) { switch (bpp) { case 16: return DRM_FORMAT_RGB565; case 24: return DRM_FORMAT_XRGB8888; case 30: return DRM_FORMAT_XRGB2101010; case 32: return DRM_FORMAT_ARGB8888; default: return 0; } } xorg-server-1.20.8/dri3/dri3.h0000644000175000017500000001150513640201473012663 00000000000000/* * Copyright © 2013 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 _DRI3_H_ #define _DRI3_H_ #ifdef DRI3 #include #include #define DRI3_SCREEN_INFO_VERSION 2 typedef int (*dri3_open_proc)(ScreenPtr screen, RRProviderPtr provider, int *fd); typedef int (*dri3_open_client_proc)(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd); typedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen, int fd, CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp); typedef PixmapPtr (*dri3_pixmap_from_fds_proc) (ScreenPtr screen, CARD8 num_fds, const int *fds, CARD16 width, CARD16 height, const CARD32 *strides, const CARD32 *offsets, CARD8 depth, CARD8 bpp, CARD64 modifier); typedef int (*dri3_fd_from_pixmap_proc) (ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size); typedef int (*dri3_fds_from_pixmap_proc) (ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier); typedef int (*dri3_get_formats_proc) (ScreenPtr screen, CARD32 *num_formats, CARD32 **formats); typedef int (*dri3_get_modifiers_proc) (ScreenPtr screen, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); typedef int (*dri3_get_drawable_modifiers_proc) (DrawablePtr draw, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); typedef struct dri3_screen_info { uint32_t version; dri3_open_proc open; dri3_pixmap_from_fd_proc pixmap_from_fd; dri3_fd_from_pixmap_proc fd_from_pixmap; /* Version 1 */ dri3_open_client_proc open_client; /* Version 2 */ dri3_pixmap_from_fds_proc pixmap_from_fds; dri3_fds_from_pixmap_proc fds_from_pixmap; dri3_get_formats_proc get_formats; dri3_get_modifiers_proc get_modifiers; dri3_get_drawable_modifiers_proc get_drawable_modifiers; } dri3_screen_info_rec, *dri3_screen_info_ptr; extern _X_EXPORT Bool dri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info); extern _X_EXPORT int dri3_send_open_reply(ClientPtr client, int fd); extern _X_EXPORT uint32_t drm_format_for_depth(uint32_t depth, uint32_t bpp); #endif #endif /* _DRI3_H_ */ xorg-server-1.20.8/dri3/Makefile.in0000644000175000017500000007056013640201511013715 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = dri3 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdri3_la_LIBADD = am_libdri3_la_OBJECTS = dri3.lo dri3_request.lo dri3_screen.lo libdri3_la_OBJECTS = $(am_libdri3_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dri3.Plo \ ./$(DEPDIR)/dri3_request.Plo ./$(DEPDIR)/dri3_screen.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdri3_la_SOURCES) DIST_SOURCES = $(libdri3_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdri3.la AM_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ @DIX_CFLAGS@ @XORG_CFLAGS@ libdri3_la_SOURCES = \ dri3.h \ dri3_priv.h \ dri3.c \ dri3_request.c \ dri3_screen.c sdk_HEADERS = dri3.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign dri3/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign dri3/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdri3.la: $(libdri3_la_OBJECTS) $(libdri3_la_DEPENDENCIES) $(EXTRA_libdri3_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libdri3_la_OBJECTS) $(libdri3_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri3.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri3_request.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri3_screen.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/dri3.Plo -rm -f ./$(DEPDIR)/dri3_request.Plo -rm -f ./$(DEPDIR)/dri3_screen.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/dri3.Plo -rm -f ./$(DEPDIR)/dri3_request.Plo -rm -f ./$(DEPDIR)/dri3_screen.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/dri3/dri3_priv.h0000644000175000017500000000665513640201473013735 00000000000000/* * Copyright © 2013 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 _DRI3PRIV_H_ #define _DRI3PRIV_H_ #include #include "scrnintstr.h" #include "misc.h" #include "list.h" #include "windowstr.h" #include "dixstruct.h" #include #include "dri3.h" extern DevPrivateKeyRec dri3_screen_private_key; typedef struct dri3_dmabuf_format { uint32_t format; uint32_t num_modifiers; uint64_t *modifiers; } dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr; typedef struct dri3_screen_priv { CloseScreenProcPtr CloseScreen; ConfigNotifyProcPtr ConfigNotify; DestroyWindowProcPtr DestroyWindow; Bool formats_cached; CARD32 num_formats; dri3_dmabuf_format_ptr formats; const dri3_screen_info_rec *info; } dri3_screen_priv_rec, *dri3_screen_priv_ptr; #define wrap(priv,real,mem,func) {\ priv->mem = real->mem; \ real->mem = func; \ } #define unwrap(priv,real,mem) {\ real->mem = priv->mem; \ } static inline dri3_screen_priv_ptr dri3_screen_priv(ScreenPtr screen) { return (dri3_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &dri3_screen_private_key); } int proc_dri3_dispatch(ClientPtr client); int sproc_dri3_dispatch(ClientPtr client); /* DDX interface */ int dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd); int dri3_pixmap_from_fds(PixmapPtr *ppixmap, ScreenPtr screen, CARD8 num_fds, const int *fds, CARD16 width, CARD16 height, const CARD32 *strides, const CARD32 *offsets, CARD8 depth, CARD8 bpp, CARD64 modifier); int dri3_fd_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size); int dri3_fds_from_pixmap(PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier); int dri3_get_supported_modifiers(ScreenPtr screen, DrawablePtr drawable, CARD8 depth, CARD8 bpp, CARD32 *num_drawable_modifiers, CARD64 **drawable_modifiers, CARD32 *num_screen_modifiers, CARD64 **screen_modifiers); #endif /* _DRI3PRIV_H_ */ xorg-server-1.20.8/dri3/dri3_screen.c0000644000175000017500000002333413640201473014220 00000000000000/* * Copyright © 2013 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 #endif #include "dri3_priv.h" #include #include #include #include #include #include int dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd) { dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; if (info == NULL) return BadMatch; if (info->version >= 1 && info->open_client != NULL) return (*info->open_client) (client, screen, provider, fd); if (info->open != NULL) return (*info->open) (screen, provider, fd); return BadMatch; } int dri3_pixmap_from_fds(PixmapPtr *ppixmap, ScreenPtr screen, CARD8 num_fds, const int *fds, CARD16 width, CARD16 height, const CARD32 *strides, const CARD32 *offsets, CARD8 depth, CARD8 bpp, CARD64 modifier) { dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; PixmapPtr pixmap; if (!info) return BadImplementation; if (info->version >= 2 && info->pixmap_from_fds != NULL) { pixmap = (*info->pixmap_from_fds) (screen, num_fds, fds, width, height, strides, offsets, depth, bpp, modifier); } else if (info->pixmap_from_fd != NULL && num_fds == 1) { pixmap = (*info->pixmap_from_fd) (screen, fds[0], width, height, strides[0], depth, bpp); } else { return BadImplementation; } if (!pixmap) return BadAlloc; *ppixmap = pixmap; return Success; } int dri3_fds_from_pixmap(PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier) { ScreenPtr screen = pixmap->drawable.pScreen; dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; if (!info) return 0; if (info->version >= 2 && info->fds_from_pixmap != NULL) { return (*info->fds_from_pixmap)(screen, pixmap, fds, strides, offsets, modifier); } else if (info->fd_from_pixmap != NULL) { CARD16 stride; CARD32 size; fds[0] = (*info->fd_from_pixmap)(screen, pixmap, &stride, &size); if (fds[0] < 0) return 0; strides[0] = stride; offsets[0] = 0; *modifier = DRM_FORMAT_MOD_INVALID; return 1; } else { return 0; } } int dri3_fd_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { ScreenPtr screen = pixmap->drawable.pScreen; dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; uint32_t strides[4]; uint32_t offsets[4]; uint64_t modifier; int fds[4]; int num_fds; if (!info) return -1; /* Preferentially use the old interface, allowing the implementation to * ensure the buffer is in a single-plane format which doesn't need * modifiers. */ if (info->fd_from_pixmap != NULL) return (*info->fd_from_pixmap)(screen, pixmap, stride, size); if (info->version < 2 || info->fds_from_pixmap == NULL) return -1; /* If using the new interface, make sure that it's a single plane starting * at 0 within the BO. We don't check the modifier, as the client may * have an auxiliary mechanism for determining the modifier itself. */ num_fds = info->fds_from_pixmap(screen, pixmap, fds, strides, offsets, &modifier); if (num_fds != 1 || offsets[0] != 0) { int i; for (i = 0; i < num_fds; i++) close(fds[i]); return -1; } *stride = strides[0]; *size = size[0]; return fds[0]; } static int cache_formats_and_modifiers(ScreenPtr screen) { dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; CARD32 num_formats; CARD32 *formats; uint32_t num_modifiers; uint64_t *modifiers; int i; if (ds->formats_cached) return Success; if (!info) return BadImplementation; if (info->version < 2 || !info->get_formats || !info->get_modifiers) { ds->formats = NULL; ds->num_formats = 0; ds->formats_cached = TRUE; return Success; } if (!info->get_formats(screen, &num_formats, &formats)) return BadAlloc; if (!num_formats) { ds->num_formats = 0; ds->formats_cached = TRUE; return Success; } ds->formats = calloc(num_formats, sizeof(dri3_dmabuf_format_rec)); if (!ds->formats) return BadAlloc; for (i = 0; i < num_formats; i++) { dri3_dmabuf_format_ptr iter = &ds->formats[i]; if (!info->get_modifiers(screen, formats[i], &num_modifiers, &modifiers)) continue; if (!num_modifiers) continue; iter->format = formats[i]; iter->num_modifiers = num_modifiers; iter->modifiers = modifiers; } ds->num_formats = i; ds->formats_cached = TRUE; return Success; } int dri3_get_supported_modifiers(ScreenPtr screen, DrawablePtr drawable, CARD8 depth, CARD8 bpp, CARD32 *num_intersect_modifiers, CARD64 **intersect_modifiers, CARD32 *num_screen_modifiers, CARD64 **screen_modifiers) { dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; int i, j; int ret; uint32_t num_drawable_mods; uint64_t *drawable_mods; CARD64 *intersect_mods = NULL; CARD64 *screen_mods = NULL; CARD32 format; dri3_dmabuf_format_ptr screen_format = NULL; ret = cache_formats_and_modifiers(screen); if (ret != Success) return ret; format = drm_format_for_depth(depth, bpp); if (format == 0) return BadValue; /* Find screen-global modifiers from cache */ for (i = 0; i < ds->num_formats; i++) { if (ds->formats[i].format == format) { screen_format = &ds->formats[i]; break; } } if (screen_format == NULL) return BadMatch; if (screen_format->num_modifiers == 0) { *num_screen_modifiers = 0; *num_intersect_modifiers = 0; return Success; } if (!info->get_drawable_modifiers || !info->get_drawable_modifiers(drawable, format, &num_drawable_mods, &drawable_mods)) { num_drawable_mods = 0; drawable_mods = NULL; } /* We're allocating slightly more memory than necessary but it reduces * the complexity of finding the intersection set. */ screen_mods = malloc(screen_format->num_modifiers * sizeof(CARD64)); if (!screen_mods) return BadAlloc; if (num_drawable_mods > 0) { intersect_mods = malloc(screen_format->num_modifiers * sizeof(CARD64)); if (!intersect_mods) { free(screen_mods); return BadAlloc; } } *num_screen_modifiers = 0; *num_intersect_modifiers = 0; for (i = 0; i < screen_format->num_modifiers; i++) { CARD64 modifier = screen_format->modifiers[i]; Bool intersect = FALSE; for (j = 0; j < num_drawable_mods; j++) { if (drawable_mods[j] == modifier) { intersect = TRUE; break; } } if (intersect) { intersect_mods[*num_intersect_modifiers] = modifier; *num_intersect_modifiers += 1; } else { screen_mods[*num_screen_modifiers] = modifier; *num_screen_modifiers += 1; } } assert(*num_intersect_modifiers + *num_screen_modifiers == screen_format->num_modifiers); *intersect_modifiers = intersect_mods; *screen_modifiers = screen_mods; free(drawable_mods); return Success; } xorg-server-1.20.8/dri3/meson.build0000644000175000017500000000061013640201473014006 00000000000000srcs_dri3 = [ 'dri3.c', 'dri3_request.c', 'dri3_screen.c', ] hdrs_dri3 = [ 'dri3.h', ] libxserver_dri3 = [] if build_dri3 libxserver_dri3 = static_library('libxserver_dri3', srcs_dri3, include_directories: inc, dependencies: [ common_dep, libdrm_dep ], c_args: '-DHAVE_XORG_CONFIG_H' ) endif install_data(hdrs_dri3, install_dir: xorgsdkdir) xorg-server-1.20.8/xorg-server.m40000644000175000017500000000360413640201473013536 00000000000000dnl Copyright 2005 Red Hat, Inc dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation. dnl dnl The above copyright notice and this permission notice shall be included dnl in all copies or substantial portions of the Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR dnl OTHER DEALINGS IN THE SOFTWARE. dnl dnl Except as contained in this notice, the name of the copyright holders shall dnl not be used in advertising or otherwise to promote the sale, use or dnl other dealings in this Software without prior written authorization dnl from the copyright holders. dnl # XORG_DRIVER_CHECK_EXT(MACRO, PROTO) # -------------------------- # Checks for the MACRO define in xorg-server.h (from the sdk). If it # is defined, then add the given PROTO to $REQUIRED_MODULES. AC_DEFUN([XORG_DRIVER_CHECK_EXT],[ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "xorg-server.h" #if !defined $1 #error $1 not defined #endif ]])], [_EXT_CHECK=yes], [_EXT_CHECK=no]) CFLAGS="$SAVE_CFLAGS" AC_MSG_CHECKING([if $1 is defined]) AC_MSG_RESULT([$_EXT_CHECK]) if test "$_EXT_CHECK" != no; then REQUIRED_MODULES="$REQUIRED_MODULES $2" fi ]) xorg-server-1.20.8/glx/0000755000175000017500000000000013640201533011655 500000000000000xorg-server-1.20.8/glx/indirect_size_get.c0000644000175000017500000010717113640201473015445 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2004 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include #include #include "indirect_size_get.h" #include "glxserver.h" #include "indirect_util.h" #include "indirect_size.h" #if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) #define PURE __attribute__((pure)) #else #define PURE #endif #if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) #define FASTCALL __attribute__((fastcall)) #else #define FASTCALL #endif #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL) #undef HAVE_ALIAS #endif #ifdef HAVE_ALIAS #define ALIAS2(from,to) \ _X_INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ __attribute__ ((alias( # to ))); #define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size ) #else #define ALIAS(from,to) \ _X_INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ { return __gl ## to ## _size( e ); } #endif _X_INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum e) { switch (e) { case GL_BYTE: case GL_UNSIGNED_BYTE: return 1; case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_2_BYTES: case GL_HALF_FLOAT: return 2; case GL_3_BYTES: return 3; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_4_BYTES: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum e) { switch (e) { case GL_FOG_INDEX: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_MODE: case GL_FOG_OFFSET_VALUE_SGIX: case GL_FOG_DISTANCE_MODE_NV: return 1; case GL_FOG_COLOR: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glLightfv_size(GLenum e) { switch (e) { case GL_SPOT_EXPONENT: case GL_SPOT_CUTOFF: case GL_CONSTANT_ATTENUATION: case GL_LINEAR_ATTENUATION: case GL_QUADRATIC_ATTENUATION: return 1; case GL_SPOT_DIRECTION: return 3; case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_POSITION: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glLightModelfv_size(GLenum e) { switch (e) { case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: /* case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/ return 1; case GL_LIGHT_MODEL_AMBIENT: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glMaterialfv_size(GLenum e) { switch (e) { case GL_SHININESS: return 1; case GL_COLOR_INDEXES: return 3; case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_EMISSION: case GL_AMBIENT_AND_DIFFUSE: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glTexParameterfv_size(GLenum e) { switch (e) { case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_PRIORITY: case GL_TEXTURE_WRAP_R: case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: /* case GL_SHADOW_AMBIENT_SGIX:*/ case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_CLIPMAP_FRAME_SGIX: case GL_TEXTURE_LOD_BIAS_S_SGIX: case GL_TEXTURE_LOD_BIAS_T_SGIX: case GL_TEXTURE_LOD_BIAS_R_SGIX: case GL_GENERATE_MIPMAP: /* case GL_GENERATE_MIPMAP_SGIS:*/ case GL_TEXTURE_COMPARE_SGIX: case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_TEXTURE_MAX_CLAMP_S_SGIX: case GL_TEXTURE_MAX_CLAMP_T_SGIX: case GL_TEXTURE_MAX_CLAMP_R_SGIX: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: /* case GL_TEXTURE_LOD_BIAS_EXT:*/ case GL_TEXTURE_STORAGE_HINT_APPLE: case GL_STORAGE_PRIVATE_APPLE: case GL_STORAGE_CACHED_APPLE: case GL_STORAGE_SHARED_APPLE: case GL_DEPTH_TEXTURE_MODE: /* case GL_DEPTH_TEXTURE_MODE_ARB:*/ case GL_TEXTURE_COMPARE_MODE: /* case GL_TEXTURE_COMPARE_MODE_ARB:*/ case GL_TEXTURE_COMPARE_FUNC: /* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; case GL_TEXTURE_CLIPMAP_CENTER_SGIX: case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: return 2; case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: return 3; case GL_TEXTURE_BORDER_COLOR: case GL_POST_TEXTURE_FILTER_BIAS_SGIX: case GL_POST_TEXTURE_FILTER_SCALE_SGIX: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glTexEnvfv_size(GLenum e) { switch (e) { case GL_ALPHA_SCALE: case GL_TEXTURE_ENV_MODE: case GL_TEXTURE_LOD_BIAS: case GL_COMBINE_RGB: case GL_COMBINE_ALPHA: case GL_RGB_SCALE: case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: case GL_SOURCE2_RGB: case GL_SOURCE3_RGB_NV: case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: case GL_SOURCE3_ALPHA_NV: case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: case GL_OPERAND2_RGB: case GL_OPERAND3_RGB_NV: case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: case GL_OPERAND3_ALPHA_NV: case GL_BUMP_TARGET_ATI: case GL_COORD_REPLACE_ARB: /* case GL_COORD_REPLACE_NV:*/ return 1; case GL_TEXTURE_ENV_COLOR: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glTexGendv_size(GLenum e) { switch (e) { case GL_TEXTURE_GEN_MODE: return 1; case GL_OBJECT_PLANE: case GL_EYE_PLANE: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glMap1d_size(GLenum e) { switch (e) { case GL_MAP1_INDEX: case GL_MAP1_TEXTURE_COORD_1: return 1; case GL_MAP1_TEXTURE_COORD_2: return 2; case GL_MAP1_NORMAL: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_VERTEX_3: return 3; case GL_MAP1_COLOR_4: case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_VERTEX_4: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum e) { switch (e) { case GL_MAP2_INDEX: case GL_MAP2_TEXTURE_COORD_1: return 1; case GL_MAP2_TEXTURE_COORD_2: return 2; case GL_MAP2_NORMAL: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_VERTEX_3: return 3; case GL_MAP2_COLOR_4: case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_VERTEX_4: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum e) { switch (e) { case GL_CURRENT_INDEX: case GL_CURRENT_RASTER_INDEX: case GL_CURRENT_RASTER_POSITION_VALID: case GL_CURRENT_RASTER_DISTANCE: case GL_POINT_SMOOTH: case GL_POINT_SIZE: case GL_SMOOTH_POINT_SIZE_GRANULARITY: case GL_LINE_SMOOTH: case GL_LINE_WIDTH: case GL_LINE_WIDTH_GRANULARITY: case GL_LINE_STIPPLE: case GL_LINE_STIPPLE_PATTERN: case GL_LINE_STIPPLE_REPEAT: case GL_LIST_MODE: case GL_MAX_LIST_NESTING: case GL_LIST_BASE: case GL_LIST_INDEX: case GL_POLYGON_SMOOTH: case GL_POLYGON_STIPPLE: case GL_EDGE_FLAG: case GL_CULL_FACE: case GL_CULL_FACE_MODE: case GL_FRONT_FACE: case GL_LIGHTING: case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: case GL_SHADE_MODEL: case GL_COLOR_MATERIAL_FACE: case GL_COLOR_MATERIAL_PARAMETER: case GL_COLOR_MATERIAL: case GL_FOG: case GL_FOG_INDEX: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_MODE: case GL_DEPTH_TEST: case GL_DEPTH_WRITEMASK: case GL_DEPTH_CLEAR_VALUE: case GL_DEPTH_FUNC: case GL_STENCIL_TEST: case GL_STENCIL_CLEAR_VALUE: case GL_STENCIL_FUNC: case GL_STENCIL_VALUE_MASK: case GL_STENCIL_FAIL: case GL_STENCIL_PASS_DEPTH_FAIL: case GL_STENCIL_PASS_DEPTH_PASS: case GL_STENCIL_REF: case GL_STENCIL_WRITEMASK: case GL_MATRIX_MODE: case GL_NORMALIZE: case GL_MODELVIEW_STACK_DEPTH: case GL_PROJECTION_STACK_DEPTH: case GL_TEXTURE_STACK_DEPTH: case GL_ATTRIB_STACK_DEPTH: case GL_CLIENT_ATTRIB_STACK_DEPTH: case GL_ALPHA_TEST: case GL_ALPHA_TEST_FUNC: case GL_ALPHA_TEST_REF: case GL_DITHER: case GL_BLEND_DST: case GL_BLEND_SRC: case GL_BLEND: case GL_LOGIC_OP_MODE: case GL_LOGIC_OP: case GL_AUX_BUFFERS: case GL_DRAW_BUFFER: case GL_READ_BUFFER: case GL_SCISSOR_TEST: case GL_INDEX_CLEAR_VALUE: case GL_INDEX_WRITEMASK: case GL_INDEX_MODE: case GL_RGBA_MODE: case GL_DOUBLEBUFFER: case GL_STEREO: case GL_RENDER_MODE: case GL_PERSPECTIVE_CORRECTION_HINT: case GL_POINT_SMOOTH_HINT: case GL_LINE_SMOOTH_HINT: case GL_POLYGON_SMOOTH_HINT: case GL_FOG_HINT: case GL_TEXTURE_GEN_S: case GL_TEXTURE_GEN_T: case GL_TEXTURE_GEN_R: case GL_TEXTURE_GEN_Q: case GL_PIXEL_MAP_I_TO_I: case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: case GL_UNPACK_SWAP_BYTES: case GL_UNPACK_LSB_FIRST: case GL_UNPACK_ROW_LENGTH: case GL_UNPACK_SKIP_ROWS: case GL_UNPACK_SKIP_PIXELS: case GL_UNPACK_ALIGNMENT: case GL_PACK_SWAP_BYTES: case GL_PACK_LSB_FIRST: case GL_PACK_ROW_LENGTH: case GL_PACK_SKIP_ROWS: case GL_PACK_SKIP_PIXELS: case GL_PACK_ALIGNMENT: case GL_MAP_COLOR: case GL_MAP_STENCIL: case GL_INDEX_SHIFT: case GL_INDEX_OFFSET: case GL_RED_SCALE: case GL_RED_BIAS: case GL_ZOOM_X: case GL_ZOOM_Y: case GL_GREEN_SCALE: case GL_GREEN_BIAS: case GL_BLUE_SCALE: case GL_BLUE_BIAS: case GL_ALPHA_SCALE: case GL_ALPHA_BIAS: case GL_DEPTH_SCALE: case GL_DEPTH_BIAS: case GL_MAX_EVAL_ORDER: case GL_MAX_LIGHTS: case GL_MAX_CLIP_PLANES: case GL_MAX_TEXTURE_SIZE: case GL_MAX_PIXEL_MAP_TABLE: case GL_MAX_ATTRIB_STACK_DEPTH: case GL_MAX_MODELVIEW_STACK_DEPTH: case GL_MAX_NAME_STACK_DEPTH: case GL_MAX_PROJECTION_STACK_DEPTH: case GL_MAX_TEXTURE_STACK_DEPTH: case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: case GL_SUBPIXEL_BITS: case GL_INDEX_BITS: case GL_RED_BITS: case GL_GREEN_BITS: case GL_BLUE_BITS: case GL_ALPHA_BITS: case GL_DEPTH_BITS: case GL_STENCIL_BITS: case GL_ACCUM_RED_BITS: case GL_ACCUM_GREEN_BITS: case GL_ACCUM_BLUE_BITS: case GL_ACCUM_ALPHA_BITS: case GL_NAME_STACK_DEPTH: case GL_AUTO_NORMAL: case GL_MAP1_COLOR_4: case GL_MAP1_INDEX: case GL_MAP1_NORMAL: case GL_MAP1_TEXTURE_COORD_1: case GL_MAP1_TEXTURE_COORD_2: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_VERTEX_3: case GL_MAP1_VERTEX_4: case GL_MAP2_COLOR_4: case GL_MAP2_INDEX: case GL_MAP2_NORMAL: case GL_MAP2_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_VERTEX_3: case GL_MAP2_VERTEX_4: case GL_MAP1_GRID_SEGMENTS: case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_POLYGON_OFFSET_UNITS: case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: case GL_LIGHT3: case GL_LIGHT4: case GL_LIGHT5: case GL_LIGHT6: case GL_LIGHT7: case GL_BLEND_EQUATION: /* case GL_BLEND_EQUATION_EXT:*/ case GL_CONVOLUTION_1D: case GL_CONVOLUTION_2D: case GL_SEPARABLE_2D: case GL_MAX_CONVOLUTION_WIDTH: /* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ case GL_MAX_CONVOLUTION_HEIGHT: /* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ case GL_POST_CONVOLUTION_RED_SCALE: /* case GL_POST_CONVOLUTION_RED_SCALE_EXT:*/ case GL_POST_CONVOLUTION_GREEN_SCALE: /* case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:*/ case GL_POST_CONVOLUTION_BLUE_SCALE: /* case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:*/ case GL_POST_CONVOLUTION_ALPHA_SCALE: /* case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:*/ case GL_POST_CONVOLUTION_RED_BIAS: /* case GL_POST_CONVOLUTION_RED_BIAS_EXT:*/ case GL_POST_CONVOLUTION_GREEN_BIAS: /* case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:*/ case GL_POST_CONVOLUTION_BLUE_BIAS: /* case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:*/ case GL_POST_CONVOLUTION_ALPHA_BIAS: /* case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:*/ case GL_HISTOGRAM: case GL_MINMAX: case GL_POLYGON_OFFSET_FACTOR: case GL_RESCALE_NORMAL: /* case GL_RESCALE_NORMAL_EXT:*/ case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_2D: case GL_TEXTURE_BINDING_3D: case GL_PACK_SKIP_IMAGES: case GL_PACK_IMAGE_HEIGHT: case GL_UNPACK_SKIP_IMAGES: case GL_UNPACK_IMAGE_HEIGHT: case GL_TEXTURE_3D: case GL_MAX_3D_TEXTURE_SIZE: case GL_VERTEX_ARRAY: case GL_NORMAL_ARRAY: case GL_COLOR_ARRAY: case GL_INDEX_ARRAY: case GL_TEXTURE_COORD_ARRAY: case GL_EDGE_FLAG_ARRAY: case GL_VERTEX_ARRAY_SIZE: case GL_VERTEX_ARRAY_TYPE: case GL_VERTEX_ARRAY_STRIDE: case GL_NORMAL_ARRAY_TYPE: case GL_NORMAL_ARRAY_STRIDE: case GL_COLOR_ARRAY_SIZE: case GL_COLOR_ARRAY_TYPE: case GL_COLOR_ARRAY_STRIDE: case GL_INDEX_ARRAY_TYPE: case GL_INDEX_ARRAY_STRIDE: case GL_TEXTURE_COORD_ARRAY_SIZE: case GL_TEXTURE_COORD_ARRAY_TYPE: case GL_TEXTURE_COORD_ARRAY_STRIDE: case GL_EDGE_FLAG_ARRAY_STRIDE: case GL_MULTISAMPLE: /* case GL_MULTISAMPLE_ARB:*/ case GL_SAMPLE_ALPHA_TO_COVERAGE: /* case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:*/ case GL_SAMPLE_ALPHA_TO_ONE: /* case GL_SAMPLE_ALPHA_TO_ONE_ARB:*/ case GL_SAMPLE_COVERAGE: /* case GL_SAMPLE_COVERAGE_ARB:*/ case GL_SAMPLE_BUFFERS: /* case GL_SAMPLE_BUFFERS_ARB:*/ case GL_SAMPLES: /* case GL_SAMPLES_ARB:*/ case GL_SAMPLE_COVERAGE_VALUE: /* case GL_SAMPLE_COVERAGE_VALUE_ARB:*/ case GL_SAMPLE_COVERAGE_INVERT: /* case GL_SAMPLE_COVERAGE_INVERT_ARB:*/ case GL_COLOR_MATRIX_STACK_DEPTH: case GL_MAX_COLOR_MATRIX_STACK_DEPTH: case GL_POST_COLOR_MATRIX_RED_SCALE: case GL_POST_COLOR_MATRIX_GREEN_SCALE: case GL_POST_COLOR_MATRIX_BLUE_SCALE: case GL_POST_COLOR_MATRIX_ALPHA_SCALE: case GL_POST_COLOR_MATRIX_RED_BIAS: case GL_POST_COLOR_MATRIX_GREEN_BIAS: case GL_POST_COLOR_MATRIX_BLUE_BIAS: case GL_POST_COLOR_MATRIX_ALPHA_BIAS: case GL_BLEND_DST_RGB: case GL_BLEND_SRC_RGB: case GL_BLEND_DST_ALPHA: case GL_BLEND_SRC_ALPHA: case GL_COLOR_TABLE: case GL_POST_CONVOLUTION_COLOR_TABLE: case GL_POST_COLOR_MATRIX_COLOR_TABLE: case GL_MAX_ELEMENTS_VERTICES: case GL_MAX_ELEMENTS_INDICES: case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: case GL_POINT_SIZE_MIN: case GL_POINT_SIZE_MAX: case GL_POINT_FADE_THRESHOLD_SIZE: case GL_OCCLUSION_TEST_HP: case GL_OCCLUSION_TEST_RESULT_HP: case GL_LIGHT_MODEL_COLOR_CONTROL: case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB: case GL_RESET_NOTIFICATION_STRATEGY_ARB: case GL_CURRENT_FOG_COORD: case GL_FOG_COORDINATE_ARRAY_TYPE: case GL_FOG_COORDINATE_ARRAY_STRIDE: case GL_FOG_COORD_ARRAY: case GL_COLOR_SUM_ARB: case GL_SECONDARY_COLOR_ARRAY_SIZE: case GL_SECONDARY_COLOR_ARRAY_TYPE: case GL_SECONDARY_COLOR_ARRAY_STRIDE: case GL_SECONDARY_COLOR_ARRAY: case GL_ACTIVE_TEXTURE: /* case GL_ACTIVE_TEXTURE_ARB:*/ case GL_CLIENT_ACTIVE_TEXTURE: /* case GL_CLIENT_ACTIVE_TEXTURE_ARB:*/ case GL_MAX_TEXTURE_UNITS: /* case GL_MAX_TEXTURE_UNITS_ARB:*/ case GL_MAX_RENDERBUFFER_SIZE: /* case GL_MAX_RENDERBUFFER_SIZE_EXT:*/ case GL_TEXTURE_COMPRESSION_HINT: /* case GL_TEXTURE_COMPRESSION_HINT_ARB:*/ case GL_TEXTURE_RECTANGLE_ARB: /* case GL_TEXTURE_RECTANGLE_NV:*/ case GL_TEXTURE_BINDING_RECTANGLE_ARB: /* case GL_TEXTURE_BINDING_RECTANGLE_NV:*/ case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB: /* case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:*/ case GL_MAX_TEXTURE_LOD_BIAS: case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: case GL_MAX_SHININESS_NV: case GL_MAX_SPOT_EXPONENT_NV: case GL_TEXTURE_CUBE_MAP: /* case GL_TEXTURE_CUBE_MAP_ARB:*/ case GL_TEXTURE_BINDING_CUBE_MAP: /* case GL_TEXTURE_BINDING_CUBE_MAP_ARB:*/ case GL_MAX_CUBE_MAP_TEXTURE_SIZE: /* case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:*/ case GL_MULTISAMPLE_FILTER_HINT_NV: case GL_FOG_DISTANCE_MODE_NV: case GL_VERTEX_PROGRAM_ARB: case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: case GL_MAX_PROGRAM_MATRICES_ARB: case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: case GL_PROGRAM_ERROR_POSITION_ARB: case GL_DEPTH_CLAMP: /* case GL_DEPTH_CLAMP_NV:*/ case GL_NUM_COMPRESSED_TEXTURE_FORMATS: /* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/ case GL_MAX_VERTEX_UNITS_ARB: case GL_ACTIVE_VERTEX_UNITS_ARB: case GL_WEIGHT_SUM_UNITY_ARB: case GL_VERTEX_BLEND_ARB: case GL_CURRENT_WEIGHT_ARB: case GL_WEIGHT_ARRAY_TYPE_ARB: case GL_WEIGHT_ARRAY_STRIDE_ARB: case GL_WEIGHT_ARRAY_SIZE_ARB: case GL_WEIGHT_ARRAY_ARB: case GL_PACK_INVERT_MESA: case GL_STENCIL_BACK_FUNC_ATI: case GL_STENCIL_BACK_FAIL_ATI: case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: case GL_FRAGMENT_PROGRAM_ARB: case GL_MAX_DRAW_BUFFERS_ARB: /* case GL_MAX_DRAW_BUFFERS_ATI:*/ case GL_DRAW_BUFFER0_ARB: /* case GL_DRAW_BUFFER0_ATI:*/ case GL_DRAW_BUFFER1_ARB: /* case GL_DRAW_BUFFER1_ATI:*/ case GL_DRAW_BUFFER2_ARB: /* case GL_DRAW_BUFFER2_ATI:*/ case GL_DRAW_BUFFER3_ARB: /* case GL_DRAW_BUFFER3_ATI:*/ case GL_DRAW_BUFFER4_ARB: /* case GL_DRAW_BUFFER4_ATI:*/ case GL_DRAW_BUFFER5_ARB: /* case GL_DRAW_BUFFER5_ATI:*/ case GL_DRAW_BUFFER6_ARB: /* case GL_DRAW_BUFFER6_ATI:*/ case GL_DRAW_BUFFER7_ARB: /* case GL_DRAW_BUFFER7_ATI:*/ case GL_DRAW_BUFFER8_ARB: /* case GL_DRAW_BUFFER8_ATI:*/ case GL_DRAW_BUFFER9_ARB: /* case GL_DRAW_BUFFER9_ATI:*/ case GL_DRAW_BUFFER10_ARB: /* case GL_DRAW_BUFFER10_ATI:*/ case GL_DRAW_BUFFER11_ARB: /* case GL_DRAW_BUFFER11_ATI:*/ case GL_DRAW_BUFFER12_ARB: /* case GL_DRAW_BUFFER12_ATI:*/ case GL_DRAW_BUFFER13_ARB: /* case GL_DRAW_BUFFER13_ATI:*/ case GL_DRAW_BUFFER14_ARB: /* case GL_DRAW_BUFFER14_ATI:*/ case GL_DRAW_BUFFER15_ARB: /* case GL_DRAW_BUFFER15_ATI:*/ case GL_BLEND_EQUATION_ALPHA_EXT: case GL_MATRIX_PALETTE_ARB: case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: case GL_MAX_PALETTE_MATRICES_ARB: case GL_CURRENT_PALETTE_MATRIX_ARB: case GL_MATRIX_INDEX_ARRAY_ARB: case GL_CURRENT_MATRIX_INDEX_ARB: case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: case GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT: case GL_TEXTURE_CUBE_MAP_SEAMLESS: case GL_POINT_SPRITE_ARB: /* case GL_POINT_SPRITE_NV:*/ case GL_POINT_SPRITE_R_MODE_NV: case GL_MAX_VERTEX_ATTRIBS_ARB: case GL_MAX_TEXTURE_COORDS_ARB: case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: case GL_DEPTH_BOUNDS_TEST_EXT: case GL_ARRAY_BUFFER_BINDING_ARB: case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: case GL_STENCIL_TEST_TWO_SIDE_EXT: case GL_ACTIVE_STENCIL_FACE_EXT: case GL_SAMPLER_BINDING: case GL_TEXTURE_BINDING_1D_ARRAY_EXT: case GL_TEXTURE_BINDING_2D_ARRAY_EXT: case GL_FRAMEBUFFER_BINDING: /* case GL_DRAW_FRAMEBUFFER_BINDING_EXT:*/ case GL_RENDERBUFFER_BINDING: /* case GL_RENDERBUFFER_BINDING_EXT:*/ case GL_READ_FRAMEBUFFER_BINDING: /* case GL_READ_FRAMEBUFFER_BINDING_EXT:*/ case GL_MAX_COLOR_ATTACHMENTS: /* case GL_MAX_COLOR_ATTACHMENTS_EXT:*/ case GL_MAX_SAMPLES: /* case GL_MAX_SAMPLES_EXT:*/ case GL_MAX_SERVER_WAIT_TIMEOUT: case GL_MAX_DEBUG_MESSAGE_LENGTH_ARB: case GL_MAX_DEBUG_LOGGED_MESSAGES_ARB: case GL_DEBUG_LOGGED_MESSAGES_ARB: case GL_RASTER_POSITION_UNCLIPPED_IBM: return 1; case GL_SMOOTH_POINT_SIZE_RANGE: case GL_LINE_WIDTH_RANGE: case GL_POLYGON_MODE: case GL_DEPTH_RANGE: case GL_MAX_VIEWPORT_DIMS: case GL_MAP1_GRID_DOMAIN: case GL_MAP2_GRID_SEGMENTS: case GL_ALIASED_POINT_SIZE_RANGE: case GL_ALIASED_LINE_WIDTH_RANGE: case GL_DEPTH_BOUNDS_EXT: return 2; case GL_CURRENT_NORMAL: case GL_POINT_DISTANCE_ATTENUATION: return 3; case GL_CURRENT_COLOR: case GL_CURRENT_TEXTURE_COORDS: case GL_CURRENT_RASTER_COLOR: case GL_CURRENT_RASTER_TEXTURE_COORDS: case GL_CURRENT_RASTER_POSITION: case GL_LIGHT_MODEL_AMBIENT: case GL_FOG_COLOR: case GL_ACCUM_CLEAR_VALUE: case GL_VIEWPORT: case GL_SCISSOR_BOX: case GL_COLOR_CLEAR_VALUE: case GL_COLOR_WRITEMASK: case GL_MAP2_GRID_DOMAIN: case GL_BLEND_COLOR: /* case GL_BLEND_COLOR_EXT:*/ case GL_CURRENT_SECONDARY_COLOR: return 4; case GL_MODELVIEW_MATRIX: case GL_PROJECTION_MATRIX: case GL_TEXTURE_MATRIX: case GL_MODELVIEW0_ARB: case GL_COLOR_MATRIX: case GL_MODELVIEW1_ARB: case GL_CURRENT_MATRIX_ARB: case GL_MODELVIEW2_ARB: case GL_MODELVIEW3_ARB: case GL_MODELVIEW4_ARB: case GL_MODELVIEW5_ARB: case GL_MODELVIEW6_ARB: case GL_MODELVIEW7_ARB: case GL_MODELVIEW8_ARB: case GL_MODELVIEW9_ARB: case GL_MODELVIEW10_ARB: case GL_MODELVIEW11_ARB: case GL_MODELVIEW12_ARB: case GL_MODELVIEW13_ARB: case GL_MODELVIEW14_ARB: case GL_MODELVIEW15_ARB: case GL_MODELVIEW16_ARB: case GL_MODELVIEW17_ARB: case GL_MODELVIEW18_ARB: case GL_MODELVIEW19_ARB: case GL_MODELVIEW20_ARB: case GL_MODELVIEW21_ARB: case GL_MODELVIEW22_ARB: case GL_MODELVIEW23_ARB: case GL_MODELVIEW24_ARB: case GL_MODELVIEW25_ARB: case GL_MODELVIEW26_ARB: case GL_MODELVIEW27_ARB: case GL_MODELVIEW28_ARB: case GL_MODELVIEW29_ARB: case GL_MODELVIEW30_ARB: case GL_MODELVIEW31_ARB: case GL_TRANSPOSE_CURRENT_MATRIX_ARB: return 16; case GL_FOG_COORDINATE_SOURCE: case GL_COMPRESSED_TEXTURE_FORMATS: case GL_RGBA_INTEGER_MODE_EXT: return __glGetBooleanv_variable_size(e); default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum e) { switch (e) { case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_PRIORITY: case GL_TEXTURE_RESIDENT: case GL_TEXTURE_WRAP_R: case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: /* case GL_SHADOW_AMBIENT_SGIX:*/ case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_CLIPMAP_FRAME_SGIX: case GL_TEXTURE_LOD_BIAS_S_SGIX: case GL_TEXTURE_LOD_BIAS_T_SGIX: case GL_TEXTURE_LOD_BIAS_R_SGIX: case GL_GENERATE_MIPMAP: /* case GL_GENERATE_MIPMAP_SGIS:*/ case GL_TEXTURE_COMPARE_SGIX: case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_TEXTURE_MAX_CLAMP_S_SGIX: case GL_TEXTURE_MAX_CLAMP_T_SGIX: case GL_TEXTURE_MAX_CLAMP_R_SGIX: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: /* case GL_TEXTURE_LOD_BIAS_EXT:*/ case GL_TEXTURE_RANGE_LENGTH_APPLE: case GL_TEXTURE_STORAGE_HINT_APPLE: case GL_DEPTH_TEXTURE_MODE: /* case GL_DEPTH_TEXTURE_MODE_ARB:*/ case GL_TEXTURE_COMPARE_MODE: /* case GL_TEXTURE_COMPARE_MODE_ARB:*/ case GL_TEXTURE_COMPARE_FUNC: /* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; case GL_TEXTURE_CLIPMAP_CENTER_SGIX: case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: return 2; case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: return 3; case GL_TEXTURE_BORDER_COLOR: case GL_POST_TEXTURE_FILTER_BIAS_SGIX: case GL_POST_TEXTURE_FILTER_SCALE_SGIX: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum e) { switch (e) { case GL_TEXTURE_WIDTH: case GL_TEXTURE_HEIGHT: case GL_TEXTURE_COMPONENTS: case GL_TEXTURE_BORDER: case GL_TEXTURE_RED_SIZE: /* case GL_TEXTURE_RED_SIZE_EXT:*/ case GL_TEXTURE_GREEN_SIZE: /* case GL_TEXTURE_GREEN_SIZE_EXT:*/ case GL_TEXTURE_BLUE_SIZE: /* case GL_TEXTURE_BLUE_SIZE_EXT:*/ case GL_TEXTURE_ALPHA_SIZE: /* case GL_TEXTURE_ALPHA_SIZE_EXT:*/ case GL_TEXTURE_LUMINANCE_SIZE: /* case GL_TEXTURE_LUMINANCE_SIZE_EXT:*/ case GL_TEXTURE_INTENSITY_SIZE: /* case GL_TEXTURE_INTENSITY_SIZE_EXT:*/ case GL_TEXTURE_DEPTH: case GL_TEXTURE_INDEX_SIZE_EXT: case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: /* case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB:*/ case GL_TEXTURE_COMPRESSED: /* case GL_TEXTURE_COMPRESSED_ARB:*/ case GL_TEXTURE_DEPTH_SIZE: /* case GL_TEXTURE_DEPTH_SIZE_ARB:*/ case GL_TEXTURE_STENCIL_SIZE: /* case GL_TEXTURE_STENCIL_SIZE_EXT:*/ return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetPointerv_size(GLenum e) { switch (e) { case GL_DEBUG_CALLBACK_FUNCTION_ARB: case GL_DEBUG_CALLBACK_USER_PARAM_ARB: return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum e) { switch (e) { case GL_COLOR_TABLE_SCALE: case GL_COLOR_TABLE_BIAS: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum e) { switch (e) { case GL_COLOR_TABLE_FORMAT: /* case GL_COLOR_TABLE_FORMAT_EXT:*/ case GL_COLOR_TABLE_WIDTH: /* case GL_COLOR_TABLE_WIDTH_EXT:*/ case GL_COLOR_TABLE_RED_SIZE: /* case GL_COLOR_TABLE_RED_SIZE_EXT:*/ case GL_COLOR_TABLE_GREEN_SIZE: /* case GL_COLOR_TABLE_GREEN_SIZE_EXT:*/ case GL_COLOR_TABLE_BLUE_SIZE: /* case GL_COLOR_TABLE_BLUE_SIZE_EXT:*/ case GL_COLOR_TABLE_ALPHA_SIZE: /* case GL_COLOR_TABLE_ALPHA_SIZE_EXT:*/ case GL_COLOR_TABLE_LUMINANCE_SIZE: /* case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:*/ case GL_COLOR_TABLE_INTENSITY_SIZE: /* case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:*/ return 1; case GL_COLOR_TABLE_SCALE: case GL_COLOR_TABLE_BIAS: return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum e) { switch (e) { case GL_CONVOLUTION_BORDER_MODE: /* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ return 1; case GL_CONVOLUTION_FILTER_SCALE: /* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ case GL_CONVOLUTION_FILTER_BIAS: /* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ case GL_CONVOLUTION_BORDER_COLOR: /* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetConvolutionParameterfv_size(GLenum e) { switch (e) { case GL_CONVOLUTION_BORDER_MODE: /* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ case GL_CONVOLUTION_FORMAT: /* case GL_CONVOLUTION_FORMAT_EXT:*/ case GL_CONVOLUTION_WIDTH: /* case GL_CONVOLUTION_WIDTH_EXT:*/ case GL_CONVOLUTION_HEIGHT: /* case GL_CONVOLUTION_HEIGHT_EXT:*/ case GL_MAX_CONVOLUTION_WIDTH: /* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ case GL_MAX_CONVOLUTION_HEIGHT: /* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ return 1; case GL_CONVOLUTION_FILTER_SCALE: /* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ case GL_CONVOLUTION_FILTER_BIAS: /* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ case GL_CONVOLUTION_BORDER_COLOR: /* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ return 4; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum e) { switch (e) { case GL_HISTOGRAM_WIDTH: case GL_HISTOGRAM_FORMAT: case GL_HISTOGRAM_RED_SIZE: case GL_HISTOGRAM_GREEN_SIZE: case GL_HISTOGRAM_BLUE_SIZE: case GL_HISTOGRAM_ALPHA_SIZE: case GL_HISTOGRAM_LUMINANCE_SIZE: case GL_HISTOGRAM_SINK: return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum e) { switch (e) { case GL_MINMAX_FORMAT: case GL_MINMAX_SINK: return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glPointParameterfv_size(GLenum e) { switch (e) { case GL_POINT_SIZE_MIN: /* case GL_POINT_SIZE_MIN_ARB:*/ /* case GL_POINT_SIZE_MIN_SGIS:*/ case GL_POINT_SIZE_MAX: /* case GL_POINT_SIZE_MAX_ARB:*/ /* case GL_POINT_SIZE_MAX_SGIS:*/ case GL_POINT_FADE_THRESHOLD_SIZE: /* case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/ /* case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/ case GL_POINT_SPRITE_R_MODE_NV: case GL_POINT_SPRITE_COORD_ORIGIN: return 1; case GL_POINT_DISTANCE_ATTENUATION: /* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/ /* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/ return 3; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectiv_size(GLenum e) { switch (e) { case GL_QUERY_RESULT_ARB: case GL_QUERY_RESULT_AVAILABLE_ARB: return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetQueryiv_size(GLenum e) { switch (e) { case GL_QUERY_COUNTER_BITS_ARB: case GL_CURRENT_QUERY_ARB: case GL_ANY_SAMPLES_PASSED: return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum e) { switch (e) { case GL_PROGRAM_LENGTH_ARB: case GL_PROGRAM_BINDING_ARB: case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: case GL_PROGRAM_TEX_INDIRECTIONS_ARB: case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: case GL_PROGRAM_FORMAT_ARB: case GL_PROGRAM_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: case GL_PROGRAM_TEMPORARIES_ARB: case GL_MAX_PROGRAM_TEMPORARIES_ARB: case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: case GL_PROGRAM_PARAMETERS_ARB: case GL_MAX_PROGRAM_PARAMETERS_ARB: case GL_PROGRAM_NATIVE_PARAMETERS_ARB: case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: case GL_PROGRAM_ATTRIBS_ARB: case GL_MAX_PROGRAM_ATTRIBS_ARB: case GL_PROGRAM_NATIVE_ATTRIBS_ARB: case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: case GL_PROGRAM_ADDRESS_REGISTERS_ARB: case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB: case GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV: case GL_MAX_PROGRAM_CALL_DEPTH_NV: case GL_MAX_PROGRAM_IF_DEPTH_NV: case GL_MAX_PROGRAM_LOOP_DEPTH_NV: case GL_MAX_PROGRAM_LOOP_COUNT_NV: return 1; default: return 0; } } _X_INTERNAL PURE FASTCALL GLint __glGetFramebufferAttachmentParameteriv_size(GLenum e) { switch (e) { case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: /* case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:*/ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: /* case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:*/ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: /* case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:*/ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: /* case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT:*/ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: return 1; default: return 0; } } ALIAS(Fogiv, Fogfv) ALIAS(Lightiv, Lightfv) ALIAS(LightModeliv, LightModelfv) ALIAS(Materialiv, Materialfv) ALIAS(TexParameteriv, TexParameterfv) ALIAS(TexEnviv, TexEnvfv) ALIAS(TexGenfv, TexGendv) ALIAS(TexGeniv, TexGendv) ALIAS(Map1f, Map1d) ALIAS(Map2f, Map2d) ALIAS(GetDoublev, GetBooleanv) ALIAS(GetFloatv, GetBooleanv) ALIAS(GetIntegerv, GetBooleanv) ALIAS(GetLightfv, Lightfv) ALIAS(GetLightiv, Lightfv) ALIAS(GetMaterialfv, Materialfv) ALIAS(GetMaterialiv, Materialfv) ALIAS(GetTexEnvfv, TexEnvfv) ALIAS(GetTexEnviv, TexEnvfv) ALIAS(GetTexGendv, TexGendv) ALIAS(GetTexGenfv, TexGendv) ALIAS(GetTexGeniv, TexGendv) ALIAS(GetTexParameteriv, GetTexParameterfv) ALIAS(GetTexLevelParameteriv, GetTexLevelParameterfv) ALIAS(ColorTableParameteriv, ColorTableParameterfv) ALIAS(GetColorTableParameteriv, GetColorTableParameterfv) ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) ALIAS(GetConvolutionParameteriv, GetConvolutionParameterfv) ALIAS(GetHistogramParameteriv, GetHistogramParameterfv) ALIAS(GetMinmaxParameteriv, GetMinmaxParameterfv) ALIAS(PointParameteriv, PointParameterfv) ALIAS(GetQueryObjectuiv, GetQueryObjectiv) #undef PURE #undef FASTCALL xorg-server-1.20.8/glx/glxext.c0000644000175000017500000004734313640201473013272 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include #include #include #include "privates.h" #include #include "extinit.h" #include "glx_extinit.h" #include "unpack.h" #include "glxutil.h" #include "glxext.h" #include "indirect_table.h" #include "indirect_util.h" #include "glxvndabi.h" /* ** X resources. */ static int glxGeneration; RESTYPE __glXContextRes; RESTYPE __glXDrawableRes; static DevPrivateKeyRec glxClientPrivateKeyRec; static GlxServerVendor *glvnd_vendor = NULL; #define glxClientPrivateKey (&glxClientPrivateKeyRec) /* ** Forward declarations. */ static int __glXDispatch(ClientPtr); static GLboolean __glXFreeContext(__GLXcontext * cx); /* * This procedure is called when the client who created the context goes away * OR when glXDestroyContext is called. If the context is current for a client * the dispatch layer will have moved the context struct to a fake resource ID * and cx here will be NULL. Otherwise we really free the context. */ static int ContextGone(__GLXcontext * cx, XID id) { if (!cx) return TRUE; if (!cx->currentClient) __glXFreeContext(cx); return TRUE; } static __GLXcontext *glxPendingDestroyContexts; static __GLXcontext *glxAllContexts; static int glxBlockClients; /* ** Destroy routine that gets called when a drawable is freed. A drawable ** contains the ancillary buffers needed for rendering. */ static Bool DrawableGone(__GLXdrawable * glxPriv, XID xid) { __GLXcontext *c, *next; if (glxPriv->type == GLX_DRAWABLE_WINDOW) { /* If this was created by glXCreateWindow, free the matching resource */ if (glxPriv->drawId != glxPriv->pDraw->id) { if (xid == glxPriv->drawId) FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE); else FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); } /* otherwise this window was implicitly created by MakeCurrent */ } for (c = glxAllContexts; c; c = next) { next = c->next; if (c->currentClient && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) { /* flush the context */ glFlush(); /* just force a re-bind the next time through */ (*c->loseCurrent) (c); lastGLContext = NULL; } if (c->drawPriv == glxPriv) c->drawPriv = NULL; if (c->readPriv == glxPriv) c->readPriv = NULL; } /* drop our reference to any backing pixmap */ if (glxPriv->type == GLX_DRAWABLE_PIXMAP) glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr) glxPriv->pDraw); glxPriv->destroy(glxPriv); return TRUE; } Bool __glXAddContext(__GLXcontext * cx) { /* Register this context as a resource. */ if (!AddResource(cx->id, __glXContextRes, (void *)cx)) { return FALSE; } cx->next = glxAllContexts; glxAllContexts = cx; return TRUE; } static void __glXRemoveFromContextList(__GLXcontext * cx) { __GLXcontext *c, *prev; if (cx == glxAllContexts) glxAllContexts = cx->next; else { prev = glxAllContexts; for (c = glxAllContexts; c; c = c->next) { if (c == cx) prev->next = c->next; prev = c; } } } /* ** Free a context. */ static GLboolean __glXFreeContext(__GLXcontext * cx) { if (cx->idExists || cx->currentClient) return GL_FALSE; __glXRemoveFromContextList(cx); free(cx->feedbackBuf); free(cx->selectBuf); free(cx->largeCmdBuf); if (cx == lastGLContext) { lastGLContext = NULL; } /* We can get here through both regular dispatching from * __glXDispatch() or as a callback from the resource manager. In * the latter case we need to lift the DRI lock manually. */ if (!glxBlockClients) { cx->destroy(cx); } else { cx->next = glxPendingDestroyContexts; glxPendingDestroyContexts = cx; } return GL_TRUE; } /************************************************************************/ /* ** These routines can be used to check whether a particular GL command ** has caused an error. Specifically, we use them to check whether a ** given query has caused an error, in which case a zero-length data ** reply is sent to the client. */ static GLboolean errorOccured = GL_FALSE; /* ** The GL was will call this routine if an error occurs. */ void __glXErrorCallBack(GLenum code) { errorOccured = GL_TRUE; } /* ** Clear the error flag before calling the GL command. */ void __glXClearErrorOccured(void) { errorOccured = GL_FALSE; } /* ** Check if the GL command caused an error. */ GLboolean __glXErrorOccured(void) { return errorOccured; } static int __glXErrorBase; int __glXEventBase; int __glXError(int error) { return __glXErrorBase + error; } __GLXclientState * glxGetClient(ClientPtr pClient) { return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey); } static void glxClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; __GLXclientState *cl = glxGetClient(pClient); switch (pClient->clientState) { case ClientStateGone: free(cl->returnBuf); free(cl->GLClientextensions); cl->returnBuf = NULL; cl->GLClientextensions = NULL; break; default: break; } } /************************************************************************/ static __GLXprovider *__glXProviderStack = &__glXDRISWRastProvider; void GlxPushProvider(__GLXprovider * provider) { provider->next = __glXProviderStack; __glXProviderStack = provider; } static Bool checkScreenVisuals(void) { int i, j; for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr screen = screenInfo.screens[i]; for (j = 0; j < screen->numVisuals; j++) { if ((screen->visuals[j].class == TrueColor || screen->visuals[j].class == DirectColor) && screen->visuals[j].nplanes > 12) return TRUE; } } return FALSE; } static void GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size) { __GLXdrawable *draw = value; size->resourceSize = 0; size->pixmapRefSize = 0; size->refCnt = 1; if (draw->type == GLX_DRAWABLE_PIXMAP) { SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); ResourceSizeRec pixmapSize = { 0, }; pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize); size->pixmapRefSize += pixmapSize.pixmapRefSize; } } static void xorgGlxCloseExtension(const ExtensionEntry *extEntry) { if (glvnd_vendor != NULL) { glxServer.destroyVendor(glvnd_vendor); glvnd_vendor = NULL; } lastGLContext = NULL; } static int xorgGlxHandleRequest(ClientPtr client) { return __glXDispatch(client); } static ScreenPtr screenNumToScreen(int screen) { if (screen < 0 || screen >= screenInfo.numScreens) return NULL; return screenInfo.screens[screen]; } static int maybe_swap32(ClientPtr client, int x) { return client->swapped ? bswap_32(x) : x; } static GlxServerVendor * vendorForScreen(ClientPtr client, int screen) { screen = maybe_swap32(client, screen); return glxServer.getVendorForScreen(client, screenNumToScreen(screen)); } /* this ought to be generated */ static int xorgGlxThunkRequest(ClientPtr client) { REQUEST(xGLXVendorPrivateReq); CARD32 vendorCode = maybe_swap32(client, stuff->vendorCode); GlxServerVendor *vendor = NULL; XID resource = 0; int ret; switch (vendorCode) { case X_GLXvop_QueryContextInfoEXT: { xGLXQueryContextInfoEXTReq *req = (void *)stuff; REQUEST_AT_LEAST_SIZE(*req); if (!(vendor = glxServer.getXIDMap(maybe_swap32(client, req->context)))) return __glXError(GLXBadContext); break; } case X_GLXvop_GetFBConfigsSGIX: { xGLXGetFBConfigsSGIXReq *req = (void *)stuff; REQUEST_AT_LEAST_SIZE(*req); if (!(vendor = vendorForScreen(client, req->screen))) return BadValue; break; } case X_GLXvop_CreateContextWithConfigSGIX: { xGLXCreateContextWithConfigSGIXReq *req = (void *)stuff; REQUEST_AT_LEAST_SIZE(*req); resource = maybe_swap32(client, req->context); if (!(vendor = vendorForScreen(client, req->screen))) return BadValue; break; } case X_GLXvop_CreateGLXPixmapWithConfigSGIX: { xGLXCreateGLXPixmapWithConfigSGIXReq *req = (void *)stuff; REQUEST_AT_LEAST_SIZE(*req); resource = maybe_swap32(client, req->glxpixmap); if (!(vendor = vendorForScreen(client, req->screen))) return BadValue; break; } case X_GLXvop_CreateGLXPbufferSGIX: { xGLXCreateGLXPbufferSGIXReq *req = (void *)stuff; REQUEST_AT_LEAST_SIZE(*req); resource = maybe_swap32(client, req->pbuffer); if (!(vendor = vendorForScreen(client, req->screen))) return BadValue; break; } /* same offset for the drawable for these three */ case X_GLXvop_DestroyGLXPbufferSGIX: case X_GLXvop_ChangeDrawableAttributesSGIX: case X_GLXvop_GetDrawableAttributesSGIX: { xGLXGetDrawableAttributesSGIXReq *req = (void *)stuff; REQUEST_AT_LEAST_SIZE(*req); if (!(vendor = glxServer.getXIDMap(maybe_swap32(client, req->drawable)))) return __glXError(GLXBadDrawable); break; } /* most things just use the standard context tag */ default: { /* size checked by vnd layer already */ GLXContextTag tag = maybe_swap32(client, stuff->contextTag); vendor = glxServer.getContextTag(client, tag); if (!vendor) return __glXError(GLXBadContextTag); break; } } /* If we're creating a resource, add the map now */ if (resource) { LEGAL_NEW_RESOURCE(resource, client); if (!glxServer.addXIDMap(resource, vendor)) return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret == Success && vendorCode == X_GLXvop_DestroyGLXPbufferSGIX) { xGLXDestroyGLXPbufferSGIXReq *req = (void *)stuff; glxServer.removeXIDMap(maybe_swap32(client, req->pbuffer)); } if (ret != Success) glxServer.removeXIDMap(resource); return ret; } static GlxServerDispatchProc xorgGlxGetDispatchAddress(CARD8 minorOpcode, CARD32 vendorCode) { /* we don't support any other GLX opcodes */ if (minorOpcode != X_GLXVendorPrivate && minorOpcode != X_GLXVendorPrivateWithReply) return NULL; /* we only support some vendor private requests */ if (!__glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, vendorCode, FALSE)) return NULL; return xorgGlxThunkRequest; } static Bool xorgGlxServerPreInit(const ExtensionEntry *extEntry) { if (glxGeneration != serverGeneration) { /* Mesa requires at least one True/DirectColor visual */ if (!checkScreenVisuals()) return FALSE; __glXContextRes = CreateNewResourceType((DeleteType) ContextGone, "GLXContext"); __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone, "GLXDrawable"); if (!__glXContextRes || !__glXDrawableRes) return FALSE; if (!dixRegisterPrivateKey (&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(__GLXclientState))) return FALSE; if (!AddCallback(&ClientStateCallback, glxClientCallback, 0)) return FALSE; __glXErrorBase = extEntry->errorBase; __glXEventBase = extEntry->eventBase; SetResourceTypeSizeFunc(__glXDrawableRes, GetGLXDrawableBytes); #if PRESENT __glXregisterPresentCompleteNotify(); #endif glxGeneration = serverGeneration; } return glxGeneration == serverGeneration; } static void xorgGlxInitGLVNDVendor(void) { if (glvnd_vendor == NULL) { GlxServerImports *imports = NULL; imports = glxServer.allocateServerImports(); if (imports != NULL) { imports->extensionCloseDown = xorgGlxCloseExtension; imports->handleRequest = xorgGlxHandleRequest; imports->getDispatchAddress = xorgGlxGetDispatchAddress; imports->makeCurrent = xorgGlxMakeCurrent; glvnd_vendor = glxServer.createVendor(imports); glxServer.freeServerImports(imports); } } } static void xorgGlxServerInit(CallbackListPtr *pcbl, void *param, void *ext) { const ExtensionEntry *extEntry = ext; int i; if (!xorgGlxServerPreInit(extEntry)) { return; } xorgGlxInitGLVNDVendor(); if (!glvnd_vendor) { return; } for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; __GLXprovider *p; if (glxServer.getVendorForScreen(NULL, pScreen) != NULL) { // There's already a vendor registered. LogMessage(X_INFO, "GLX: Another vendor is already registered for screen %d\n", i); continue; } for (p = __glXProviderStack; p != NULL; p = p->next) { __GLXscreen *glxScreen = p->screenProbe(pScreen); if (glxScreen != NULL) { LogMessage(X_INFO, "GLX: Initialized %s GL provider for screen %d\n", p->name, i); break; } } if (p) { glxServer.setScreenVendor(pScreen, glvnd_vendor); } else { LogMessage(X_INFO, "GLX: no usable GL providers found for screen %d\n", i); } } } Bool xorgGlxCreateVendor(void) { return AddCallback(glxServer.extensionInitCallback, xorgGlxServerInit, NULL); } /************************************************************************/ /* ** Make a context the current one for the GL (in this implementation, there ** is only one instance of the GL, and we use it to serve all GL clients by ** switching it between different contexts). While we are at it, look up ** a context by its tag and return its (__GLXcontext *). */ __GLXcontext * __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error) { ClientPtr client = cl->client; REQUEST(xGLXSingleReq); __GLXcontext *cx; /* ** See if the context tag is legal; it is managed by the extension, ** so if it's invalid, we have an implementation error. */ cx = __glXLookupContextByTag(cl, tag); if (!cx) { cl->client->errorValue = tag; *error = __glXError(GLXBadContextTag); return 0; } /* If we're expecting a glXRenderLarge request, this better be one. */ if (cx->largeCmdRequestsSoFar != 0 && stuff->glxCode != X_GLXRenderLarge) { client->errorValue = stuff->glxCode; *error = __glXError(GLXBadLargeRequest); return 0; } if (!cx->isDirect) { if (cx->drawPriv == NULL) { /* ** The drawable has vanished. It must be a window, because only ** windows can be destroyed from under us; GLX pixmaps are ** refcounted and don't go away until no one is using them. */ *error = __glXError(GLXBadCurrentWindow); return 0; } } if (cx->wait && (*cx->wait) (cx, cl, error)) return NULL; if (cx == lastGLContext) { /* No need to re-bind */ return cx; } /* Make this context the current one for the GL. */ if (!cx->isDirect) { /* * If it is being forced, it means that this context was already made * current. So it cannot just be made current again without decrementing * refcount's */ (*cx->loseCurrent) (cx); lastGLContext = cx; if (!(*cx->makeCurrent) (cx)) { /* Bind failed, and set the error code. Bummer */ lastGLContext = NULL; cl->client->errorValue = cx->id; *error = __glXError(GLXBadContextState); return 0; } } return cx; } /************************************************************************/ void glxSuspendClients(void) { int i; for (i = 1; i < currentMaxClients; i++) { if (clients[i] && glxGetClient(clients[i])->client) IgnoreClient(clients[i]); } glxBlockClients = TRUE; } void glxResumeClients(void) { __GLXcontext *cx, *next; int i; glxBlockClients = FALSE; for (i = 1; i < currentMaxClients; i++) { if (clients[i] && glxGetClient(clients[i])->client) AttendClient(clients[i]); } for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) { next = cx->next; cx->destroy(cx); } glxPendingDestroyContexts = NULL; } static glx_gpa_proc _get_proc_address; void __glXsetGetProcAddress(glx_gpa_proc get_proc_address) { _get_proc_address = get_proc_address; } void *__glGetProcAddress(const char *proc) { void *ret = (void *) _get_proc_address(proc); return ret ? ret : (void *) NoopDDA; } /* ** Top level dispatcher; all commands are executed from here down. */ static int __glXDispatch(ClientPtr client) { REQUEST(xGLXSingleReq); CARD8 opcode; __GLXdispatchSingleProcPtr proc; __GLXclientState *cl; int retval = BadRequest; opcode = stuff->glxCode; cl = glxGetClient(client); if (!cl->client) cl->client = client; /* If we're currently blocking GLX clients, just put this guy to * sleep, reset the request and return. */ if (glxBlockClients) { ResetCurrentRequest(client); client->sequence--; IgnoreClient(client); return Success; } /* ** Use the opcode to index into the procedure table. */ proc = __glXGetProtocolDecodeFunction(&Single_dispatch_info, opcode, client->swapped); if (proc != NULL) retval = (*proc) (cl, (GLbyte *) stuff); return retval; } xorg-server-1.20.8/glx/vndservermapping.c0000644000175000017500000001470713640201473015347 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #include "vndserver.h" #include #include "vndservervendor.h" static ClientPtr requestClient = NULL; void GlxSetRequestClient(ClientPtr client) { requestClient = client; } static GlxServerVendor *LookupXIDMapResource(XID id) { void *ptr = NULL; int rv; rv = dixLookupResourceByType(&ptr, id, idResource, NULL, DixReadAccess); if (rv == Success) { return (GlxServerVendor *) ptr; } else { return NULL; } } GlxServerVendor *GlxGetXIDMap(XID id) { GlxServerVendor *vendor = LookupXIDMapResource(id); if (vendor == NULL) { // If we haven't seen this XID before, then it may be a drawable that // wasn't created through GLX, like a regular X window or pixmap. Try // to look up a matching drawable to find a screen number for it. void *ptr = NULL; int rv = dixLookupResourceByClass(&ptr, id, RC_DRAWABLE, NULL, DixGetAttrAccess); if (rv == Success && ptr != NULL) { DrawablePtr draw = (DrawablePtr) ptr; vendor = GlxGetVendorForScreen(requestClient, draw->pScreen); } } return vendor; } Bool GlxAddXIDMap(XID id, GlxServerVendor *vendor) { if (id == 0 || vendor == NULL) { return FALSE; } if (LookupXIDMapResource(id) != NULL) { return FALSE; } return AddResource(id, idResource, vendor); } void GlxRemoveXIDMap(XID id) { FreeResourceByType(id, idResource, FALSE); } GlxContextTagInfo *GlxAllocContextTag(ClientPtr client, GlxServerVendor *vendor) { GlxClientPriv *cl; unsigned int index; if (vendor == NULL) { return NULL; } cl = GlxGetClientData(client); if (cl == NULL) { return NULL; } // Look for a free tag index. for (index=0; indexcontextTagCount; index++) { if (cl->contextTags[index].vendor == NULL) { break; } } if (index >= cl->contextTagCount) { // We didn't find a free entry, so grow the array. GlxContextTagInfo *newTags; unsigned int newSize = cl->contextTagCount * 2; if (newSize == 0) { // TODO: What's a good starting size for this? newSize = 16; } newTags = (GlxContextTagInfo *) realloc(cl->contextTags, newSize * sizeof(GlxContextTagInfo)); if (newTags == NULL) { return NULL; } memset(&newTags[cl->contextTagCount], 0, (newSize - cl->contextTagCount) * sizeof(GlxContextTagInfo)); index = cl->contextTagCount; cl->contextTags = newTags; cl->contextTagCount = newSize; } assert(index >= 0); assert(index < cl->contextTagCount); memset(&cl->contextTags[index], 0, sizeof(GlxContextTagInfo)); cl->contextTags[index].tag = (GLXContextTag) (index + 1); cl->contextTags[index].client = client; cl->contextTags[index].vendor = vendor; return &cl->contextTags[index]; } GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag) { GlxClientPriv *cl = GlxGetClientData(client); if (cl == NULL) { return NULL; } if (tag > 0 && (tag - 1) < cl->contextTagCount) { if (cl->contextTags[tag - 1].vendor != NULL) { assert(cl->contextTags[tag - 1].client == client); return &cl->contextTags[tag - 1]; } } return NULL; } void GlxFreeContextTag(GlxContextTagInfo *tagInfo) { if (tagInfo != NULL) { tagInfo->vendor = NULL; tagInfo->vendor = NULL; tagInfo->data = NULL; tagInfo->context = None; tagInfo->drawable = None; tagInfo->readdrawable = None; } } Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor) { GlxScreenPriv *priv; if (vendor == NULL) { return FALSE; } priv = GlxGetScreen(screen); if (priv == NULL) { return FALSE; } if (priv->vendor != NULL) { return FALSE; } priv->vendor = vendor; return TRUE; } Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor) { GlxClientPriv *cl; if (screen == NULL || screen->isGPU) { return FALSE; } cl = GlxGetClientData(client); if (cl == NULL) { return FALSE; } if (vendor != NULL) { cl->vendors[screen->myNum] = vendor; } else { cl->vendors[screen->myNum] = GlxGetVendorForScreen(NULL, screen); } return TRUE; } GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen) { // Note that the client won't be sending GPU screen numbers, so we don't // need per-client mappings for them. if (client != NULL && !screen->isGPU) { GlxClientPriv *cl = GlxGetClientData(client); if (cl != NULL) { return cl->vendors[screen->myNum]; } else { return NULL; } } else { GlxScreenPriv *priv = GlxGetScreen(screen); if (priv != NULL) { return priv->vendor; } else { return NULL; } } } xorg-server-1.20.8/glx/Makefile.am0000644000175000017500000000354213640201473013640 00000000000000if DRI2 GLXDRI_LIBRARY = libglxdri.la endif noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY) libglxvnd.la AM_CFLAGS = \ @DIX_CFLAGS@ \ @GL_CFLAGS@ \ @XLIB_CFLAGS@ \ @LIBDRM_CFLAGS@ \ @GLX_DEFINES@ \ @GLX_ARCH_DEFINES@ sdk_HEADERS = vndserver.h AM_CPPFLAGS = \ -I$(top_srcdir)/hw/xfree86/os-support \ -I$(top_srcdir)/hw/xfree86/os-support/bus \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/dri \ -I$(top_srcdir)/hw/xfree86/dri2 \ -I$(top_srcdir)/mi \ -I$(top_srcdir)/present indirect_sources = \ indirect_dispatch.c \ indirect_dispatch.h \ indirect_dispatch_swap.c \ indirect_reqsize.c \ indirect_reqsize.h \ indirect_size.h \ indirect_size_get.c \ indirect_size_get.h \ indirect_table.c libglxdri_la_SOURCES = if DRI2 libglxdri_la_SOURCES += glxdri2.c endif libglxdri_la_LIBADD = $(DLOPEN_LIBS) libglx_la_SOURCES = \ $(indirect_sources) \ clientinfo.c \ createcontext.c \ extension_string.c \ extension_string.h \ indirect_util.c \ indirect_util.h \ indirect_program.c \ indirect_table.h \ indirect_texture_compression.c \ glxbyteorder.h \ glxcmds.c \ glxcmdsswap.c \ glxcontext.h \ glxdrawable.h \ glxext.c \ glxext.h \ glxdriswrast.c \ glxdricommon.c \ glxdricommon.h \ glxscreens.c \ glxscreens.h \ glxserver.h \ glxutil.h \ render2.c \ render2swap.c \ renderpix.c \ renderpixswap.c \ rensize.c \ single2.c \ single2swap.c \ singlepix.c \ singlepixswap.c \ singlesize.c \ singlesize.h \ swap_interval.c \ unpack.h \ xfont.c libglx_la_LIBADD = $(DLOPEN_LIBS) libglxvnd_la_SOURCES = \ vndcmds.c \ vndext.c \ vndservermapping.c \ vndservervendor.h \ vndservervendor.c EXTRA_DIST = vnd_dispatch_stubs.c xorg-server-1.20.8/glx/glxdri2.c0000644000175000017500000007430713640201473013332 00000000000000/* * Copyright © 2007 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 Red Hat, * Inc not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Red Hat, Inc makes no representations about the * suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL RED HAT, INC 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_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #define _XF86DRI_SERVER_ #include #include #include #include "glxserver.h" #include "glxutil.h" #include "glxdricommon.h" #include "extension_string.h" typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; #define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \ | __DRI_CTX_FLAG_FORWARD_COMPATIBLE \ | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) struct __GLXDRIscreen { __GLXscreen base; __DRIscreen *driScreen; void *driver; int fd; xf86EnterVTProc *enterVT; xf86LeaveVTProc *leaveVT; const __DRIcoreExtension *core; const __DRIdri2Extension *dri2; const __DRI2flushExtension *flush; const __DRIcopySubBufferExtension *copySubBuffer; const __DRIswapControlExtension *swapControl; const __DRItexBufferExtension *texBuffer; const __DRIconfig **driConfigs; }; struct __GLXDRIcontext { __GLXcontext base; __DRIcontext *driContext; }; #define MAX_DRAWABLE_BUFFERS 5 struct __GLXDRIdrawable { __GLXdrawable base; __DRIdrawable *driDrawable; __GLXDRIscreen *screen; /* Dimensions as last reported by DRI2GetBuffers. */ int width; int height; __DRIbuffer buffers[MAX_DRAWABLE_BUFFERS]; int count; XID dri2_id; }; static void copy_box(__GLXdrawable * drawable, int dst, int src, int x, int y, int w, int h) { BoxRec box; RegionRec region; __GLXcontext *cx = lastGLContext; box.x1 = x; box.y1 = y; box.x2 = x + w; box.y2 = y + h; RegionInit(®ion, &box, 0); DRI2CopyRegion(drawable->pDraw, ®ion, dst, src); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } } /* white lie */ extern glx_func_ptr glXGetProcAddressARB(const char *); static void __glXDRIdrawableDestroy(__GLXdrawable * drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; const __DRIcoreExtension *core = private->screen->core; FreeResource(private->dri2_id, FALSE); (*core->destroyDrawable) (private->driDrawable); __glXDrawableRelease(drawable); free(private); } static void __glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable, int x, int y, int w, int h) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; copy_box(drawable, x, private->height - y - h, w, h, DRI2BufferFrontLeft, DRI2BufferBackLeft); } static void __glXDRIdrawableWaitX(__GLXdrawable * drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; copy_box(drawable, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft, 0, 0, private->width, private->height); } static void __glXDRIdrawableWaitGL(__GLXdrawable * drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; copy_box(drawable, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft, 0, 0, private->width, private->height); } static void __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, CARD32 sbc) { __GLXdrawable *drawable = data; int glx_type; switch (type) { case DRI2_EXCHANGE_COMPLETE: glx_type = GLX_EXCHANGE_COMPLETE_INTEL; break; default: /* unknown swap completion type, * BLIT is a reasonable default, so * fall through ... */ case DRI2_BLIT_COMPLETE: glx_type = GLX_BLIT_COMPLETE_INTEL; break; case DRI2_FLIP_COMPLETE: glx_type = GLX_FLIP_COMPLETE_INTEL; break; } __glXsendSwapEvent(drawable, glx_type, ust, msc, sbc); } /* * Copy or flip back to front, honoring the swap interval if possible. * * If the kernel supports it, we request an event for the frame when the * swap should happen, then perform the copy when we receive it. */ static GLboolean __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable) { __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable; __GLXDRIscreen *screen = priv->screen; CARD64 unused; __GLXcontext *cx = lastGLContext; int status; if (screen->flush) { (*screen->flush->flush) (priv->driDrawable); (*screen->flush->invalidate) (priv->driDrawable); } status = DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, __glXdriSwapEvent, drawable); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } return status == Success; } static int __glXDRIdrawableSwapInterval(__GLXdrawable * drawable, int interval) { __GLXcontext *cx = lastGLContext; if (interval <= 0) /* || interval > BIGNUM? */ return GLX_BAD_VALUE; DRI2SwapInterval(drawable->pDraw, interval); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } return 0; } static void __glXDRIcontextDestroy(__GLXcontext * baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; (*screen->core->destroyContext) (context->driContext); __glXContextDestroy(&context->base); free(context); } static int __glXDRIcontextMakeCurrent(__GLXcontext * baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; return (*screen->core->bindContext) (context->driContext, draw->driDrawable, read->driDrawable); } static int __glXDRIcontextLoseCurrent(__GLXcontext * baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; return (*screen->core->unbindContext) (context->driContext); } static int __glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc, unsigned long mask) { __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst; __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc; __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen; return (*screen->core->copyContext) (dst->driContext, src->driContext, mask); } static Bool __glXDRIcontextWait(__GLXcontext * baseContext, __GLXclientState * cl, int *error) { __GLXcontext *cx = lastGLContext; Bool ret; ret = DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } if (ret) { *error = cl->client->noClientException; return TRUE; } return FALSE; } static int __glXDRIbindTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * glxPixmap) { __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap; const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer; __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; if (texBuffer == NULL) return Success; if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) { (*texBuffer->setTexBuffer2) (context->driContext, glxPixmap->target, glxPixmap->format, drawable->driDrawable); } else { texBuffer->setTexBuffer(context->driContext, glxPixmap->target, drawable->driDrawable); } return Success; } static int __glXDRIreleaseTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * pixmap) { /* FIXME: Just unbind the texture? */ return Success; } static Bool dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs, const uint32_t *attribs, unsigned *major_ver, unsigned *minor_ver, uint32_t *flags, int *api, int *reset, unsigned *error) { unsigned i; if (num_attribs == 0) return TRUE; if (attribs == NULL) { *error = BadImplementation; return FALSE; } *major_ver = 1; *minor_ver = 0; *reset = __DRI_CTX_RESET_NO_NOTIFICATION; for (i = 0; i < num_attribs; i++) { switch (attribs[i * 2]) { case GLX_CONTEXT_MAJOR_VERSION_ARB: *major_ver = attribs[i * 2 + 1]; break; case GLX_CONTEXT_MINOR_VERSION_ARB: *minor_ver = attribs[i * 2 + 1]; break; case GLX_CONTEXT_FLAGS_ARB: *flags = attribs[i * 2 + 1]; break; case GLX_RENDER_TYPE: break; case GLX_CONTEXT_PROFILE_MASK_ARB: switch (attribs[i * 2 + 1]) { case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: *api = __DRI_API_OPENGL_CORE; break; case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: *api = __DRI_API_OPENGL; break; case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: *api = __DRI_API_GLES2; break; default: *error = __glXError(GLXBadProfileARB); return FALSE; } break; case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB: if (screen->dri2->base.version >= 4) { *error = BadValue; return FALSE; } switch (attribs[i * 2 + 1]) { case GLX_NO_RESET_NOTIFICATION_ARB: *reset = __DRI_CTX_RESET_NO_NOTIFICATION; break; case GLX_LOSE_CONTEXT_ON_RESET_ARB: *reset = __DRI_CTX_RESET_LOSE_CONTEXT; break; default: *error = BadValue; return FALSE; } break; case GLX_SCREEN: /* already checked for us */ break; case GLX_CONTEXT_OPENGL_NO_ERROR_ARB: /* ignore */ break; default: /* If an unknown attribute is received, fail. */ *error = BadValue; return FALSE; } } /* Unknown flag value. */ if ((*flags & ~ALL_DRI_CTX_FLAGS) != 0) { *error = BadValue; return FALSE; } /* If the core profile is requested for a GL version is less than 3.2, * request the non-core profile from the DRI driver. The core profile * only makes sense for GL versions >= 3.2, and many DRI drivers that * don't support OpenGL 3.2 may fail the request for a core profile. */ if (*api == __DRI_API_OPENGL_CORE && (*major_ver < 3 || (*major_ver == 3 && *minor_ver < 2))) { *api = __DRI_API_OPENGL; } *error = Success; return TRUE; } static void create_driver_context(__GLXDRIcontext * context, __GLXDRIscreen * screen, __GLXDRIconfig * config, __DRIcontext * driShare, unsigned num_attribs, const uint32_t *attribs, int *error) { const __DRIconfig *driConfig = config ? config->driConfig : NULL; context->driContext = NULL; if (screen->dri2->base.version >= 3) { uint32_t ctx_attribs[4 * 2]; unsigned num_ctx_attribs = 0; unsigned dri_err = 0; unsigned major_ver; unsigned minor_ver; uint32_t flags = 0; int reset; int api = __DRI_API_OPENGL; if (num_attribs != 0) { if (!dri2_convert_glx_attribs(screen, num_attribs, attribs, &major_ver, &minor_ver, &flags, &api, &reset, (unsigned *) error)) return; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; ctx_attribs[num_ctx_attribs++] = major_ver; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION; ctx_attribs[num_ctx_attribs++] = minor_ver; if (flags != 0) { ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS; /* The current __DRI_CTX_FLAG_* values are identical to the * GLX_CONTEXT_*_BIT values. */ ctx_attribs[num_ctx_attribs++] = flags; } if (reset != __DRI_CTX_RESET_NO_NOTIFICATION) { ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY; ctx_attribs[num_ctx_attribs++] = reset; } assert(num_ctx_attribs <= ARRAY_SIZE(ctx_attribs)); } context->driContext = (*screen->dri2->createContextAttribs)(screen->driScreen, api, driConfig, driShare, num_ctx_attribs / 2, ctx_attribs, &dri_err, context); switch (dri_err) { case __DRI_CTX_ERROR_SUCCESS: *error = Success; break; case __DRI_CTX_ERROR_NO_MEMORY: *error = BadAlloc; break; case __DRI_CTX_ERROR_BAD_API: *error = __glXError(GLXBadProfileARB); break; case __DRI_CTX_ERROR_BAD_VERSION: case __DRI_CTX_ERROR_BAD_FLAG: *error = __glXError(GLXBadFBConfig); break; case __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE: case __DRI_CTX_ERROR_UNKNOWN_FLAG: default: *error = BadValue; break; } return; } if (num_attribs != 0) { *error = BadValue; return; } context->driContext = (*screen->dri2->createNewContext) (screen->driScreen, driConfig, driShare, context); } static __GLXcontext * __glXDRIscreenCreateContext(__GLXscreen * baseScreen, __GLXconfig * glxConfig, __GLXcontext * baseShareContext, unsigned num_attribs, const uint32_t *attribs, int *error) { __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; __GLXDRIcontext *context, *shareContext; __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; __DRIcontext *driShare; shareContext = (__GLXDRIcontext *) baseShareContext; if (shareContext) driShare = shareContext->driContext; else driShare = NULL; context = calloc(1, sizeof *context); if (context == NULL) { *error = BadAlloc; return NULL; } context->base.config = glxConfig; context->base.destroy = __glXDRIcontextDestroy; context->base.makeCurrent = __glXDRIcontextMakeCurrent; context->base.loseCurrent = __glXDRIcontextLoseCurrent; context->base.copy = __glXDRIcontextCopy; context->base.bindTexImage = __glXDRIbindTexImage; context->base.releaseTexImage = __glXDRIreleaseTexImage; context->base.wait = __glXDRIcontextWait; create_driver_context(context, screen, config, driShare, num_attribs, attribs, error); if (context->driContext == NULL) { free(context); return NULL; } return &context->base; } static void __glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv, XID id) { __GLXDRIdrawable *private = priv; __GLXDRIscreen *screen = private->screen; if (screen->flush) (*screen->flush->invalidate) (private->driDrawable); } static __GLXdrawable * __glXDRIscreenCreateDrawable(ClientPtr client, __GLXscreen * screen, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig * glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; __GLXDRIdrawable *private; __GLXcontext *cx = lastGLContext; Bool ret; private = calloc(1, sizeof *private); if (private == NULL) return NULL; private->screen = driScreen; if (!__glXDrawableInit(&private->base, screen, pDraw, type, glxDrawId, glxConfig)) { free(private); return NULL; } private->base.destroy = __glXDRIdrawableDestroy; private->base.swapBuffers = __glXDRIdrawableSwapBuffers; private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer; private->base.waitGL = __glXDRIdrawableWaitGL; private->base.waitX = __glXDRIdrawableWaitX; ret = DRI2CreateDrawable2(client, pDraw, drawId, __glXDRIinvalidateBuffers, private, &private->dri2_id); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } if (ret) { free(private); return NULL; } private->driDrawable = (*driScreen->dri2->createNewDrawable) (driScreen->driScreen, config->driConfig, private); return &private->base; } static __DRIbuffer * dri2GetBuffers(__DRIdrawable * driDrawable, int *width, int *height, unsigned int *attachments, int count, int *out_count, void *loaderPrivate) { __GLXDRIdrawable *private = loaderPrivate; DRI2BufferPtr *buffers; int i; int j; __GLXcontext *cx = lastGLContext; buffers = DRI2GetBuffers(private->base.pDraw, width, height, attachments, count, out_count); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); /* If DRI2GetBuffers() changed the GL context, it may also have * invalidated the DRI2 buffers, so let's get them again */ buffers = DRI2GetBuffers(private->base.pDraw, width, height, attachments, count, out_count); assert(lastGLContext == cx); } if (*out_count > MAX_DRAWABLE_BUFFERS) { *out_count = 0; return NULL; } private->width = *width; private->height = *height; /* This assumes the DRI2 buffer attachment tokens matches the * __DRIbuffer tokens. */ j = 0; for (i = 0; i < *out_count; i++) { /* Do not send the real front buffer of a window to the client. */ if ((private->base.pDraw->type == DRAWABLE_WINDOW) && (buffers[i]->attachment == DRI2BufferFrontLeft)) { continue; } private->buffers[j].attachment = buffers[i]->attachment; private->buffers[j].name = buffers[i]->name; private->buffers[j].pitch = buffers[i]->pitch; private->buffers[j].cpp = buffers[i]->cpp; private->buffers[j].flags = buffers[i]->flags; j++; } *out_count = j; return private->buffers; } static __DRIbuffer * dri2GetBuffersWithFormat(__DRIdrawable * driDrawable, int *width, int *height, unsigned int *attachments, int count, int *out_count, void *loaderPrivate) { __GLXDRIdrawable *private = loaderPrivate; DRI2BufferPtr *buffers; int i; int j = 0; __GLXcontext *cx = lastGLContext; buffers = DRI2GetBuffersWithFormat(private->base.pDraw, width, height, attachments, count, out_count); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); /* If DRI2GetBuffersWithFormat() changed the GL context, it may also have * invalidated the DRI2 buffers, so let's get them again */ buffers = DRI2GetBuffersWithFormat(private->base.pDraw, width, height, attachments, count, out_count); assert(lastGLContext == cx); } if (*out_count > MAX_DRAWABLE_BUFFERS) { *out_count = 0; return NULL; } private->width = *width; private->height = *height; /* This assumes the DRI2 buffer attachment tokens matches the * __DRIbuffer tokens. */ for (i = 0; i < *out_count; i++) { /* Do not send the real front buffer of a window to the client. */ if ((private->base.pDraw->type == DRAWABLE_WINDOW) && (buffers[i]->attachment == DRI2BufferFrontLeft)) { continue; } private->buffers[j].attachment = buffers[i]->attachment; private->buffers[j].name = buffers[i]->name; private->buffers[j].pitch = buffers[i]->pitch; private->buffers[j].cpp = buffers[i]->cpp; private->buffers[j].flags = buffers[i]->flags; j++; } *out_count = j; return private->buffers; } static void dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) loaderPrivate; (void) driDrawable; copy_box(loaderPrivate, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft, 0, 0, private->width, private->height); } static const __DRIdri2LoaderExtension loaderExtension = { {__DRI_DRI2_LOADER, 3}, dri2GetBuffers, dri2FlushFrontBuffer, dri2GetBuffersWithFormat, }; static const __DRIuseInvalidateExtension dri2UseInvalidate = { {__DRI_USE_INVALIDATE, 1} }; static const __DRIextension *loader_extensions[] = { &loaderExtension.base, &dri2UseInvalidate.base, NULL }; static Bool glxDRIEnterVT(ScrnInfoPtr scrn) { Bool ret; __GLXDRIscreen *screen = (__GLXDRIscreen *) glxGetScreen(xf86ScrnToScreen(scrn)); LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n"); scrn->EnterVT = screen->enterVT; ret = scrn->EnterVT(scrn); screen->enterVT = scrn->EnterVT; scrn->EnterVT = glxDRIEnterVT; if (!ret) return FALSE; glxResumeClients(); return TRUE; } static void glxDRILeaveVT(ScrnInfoPtr scrn) { __GLXDRIscreen *screen = (__GLXDRIscreen *) glxGetScreen(xf86ScrnToScreen(scrn)); LogMessageVerbSigSafe(X_INFO, -1, "AIGLX: Suspending AIGLX clients for VT switch\n"); glxSuspendClients(); scrn->LeaveVT = screen->leaveVT; (*screen->leaveVT) (scrn); screen->leaveVT = scrn->LeaveVT; scrn->LeaveVT = glxDRILeaveVT; } /** * Initialize extension flags in glx_enable_bits when a new screen is created * * @param screen The screen where glx_enable_bits are to be set. */ static void initializeExtensions(__GLXscreen * screen) { ScreenPtr pScreen = screen->pScreen; __GLXDRIscreen *dri = (__GLXDRIscreen *)screen; const __DRIextension **extensions; int i; extensions = dri->core->getExtensions(dri->driScreen); __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_no_config_context"); if (dri->dri2->base.version >= 3) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context"); __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_no_error"); __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_profile"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_create_context_es_profile"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_create_context_es2_profile"); } if (DRI2HasSwapControl(pScreen)) { __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event"); __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control"); } /* enable EXT_framebuffer_sRGB extension (even if there are no sRGB capable fbconfigs) */ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_framebuffer_sRGB"); /* enable ARB_fbconfig_float extension (even if there are no float fbconfigs) */ __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float"); /* enable EXT_fbconfig_packed_float (even if there are no packed float fbconfigs) */ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_fbconfig_packed_float"); for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { dri->texBuffer = (const __DRItexBufferExtension *) extensions[i]; __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_texture_from_pixmap"); } if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 && extensions[i]->version >= 3) { dri->flush = (__DRI2flushExtension *) extensions[i]; } if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0 && dri->dri2->base.version >= 3) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_robustness"); } #ifdef __DRI2_FLUSH_CONTROL if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_context_flush_control"); } #endif /* Ignore unknown extensions */ } } static void __glXDRIscreenDestroy(__GLXscreen * baseScreen) { int i; ScrnInfoPtr pScrn = xf86ScreenToScrn(baseScreen->pScreen); __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; (*screen->core->destroyScreen) (screen->driScreen); dlclose(screen->driver); __glXScreenDestroy(baseScreen); if (screen->driConfigs) { for (i = 0; screen->driConfigs[i] != NULL; i++) free((__DRIconfig **) screen->driConfigs[i]); free(screen->driConfigs); } pScrn->EnterVT = screen->enterVT; pScrn->LeaveVT = screen->leaveVT; free(screen); } enum { GLXOPT_VENDOR_LIBRARY, }; static const OptionInfoRec GLXOptions[] = { { GLXOPT_VENDOR_LIBRARY, "GlxVendorLibrary", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; static __GLXscreen * __glXDRIscreenProbe(ScreenPtr pScreen) { const char *driverName, *deviceName; __GLXDRIscreen *screen; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); const char *glvnd = NULL; OptionInfoPtr options; screen = calloc(1, sizeof *screen); if (screen == NULL) return NULL; if (!DRI2Connect(serverClient, pScreen, DRI2DriverDRI, &screen->fd, &driverName, &deviceName)) { LogMessage(X_INFO, "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum); goto handle_error; } screen->base.destroy = __glXDRIscreenDestroy; screen->base.createContext = __glXDRIscreenCreateContext; screen->base.createDrawable = __glXDRIscreenCreateDrawable; screen->base.swapInterval = __glXDRIdrawableSwapInterval; screen->base.pScreen = pScreen; __glXInitExtensionEnableBits(screen->base.glx_enable_bits); screen->driver = glxProbeDriver(driverName, (void **) &screen->core, __DRI_CORE, 1, (void **) &screen->dri2, __DRI_DRI2, 1); if (screen->driver == NULL) { goto handle_error; } screen->driScreen = (*screen->dri2->createNewScreen) (pScreen->myNum, screen->fd, loader_extensions, &screen->driConfigs, screen); if (screen->driScreen == NULL) { LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n"); goto handle_error; } initializeExtensions(&screen->base); screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs); options = xnfalloc(sizeof(GLXOptions)); memcpy(options, GLXOptions, sizeof(GLXOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); glvnd = xf86GetOptValString(options, GLXOPT_VENDOR_LIBRARY); if (glvnd) screen->base.glvnd = xnfstrdup(glvnd); free(options); if (!screen->base.glvnd) screen->base.glvnd = strdup("mesa"); __glXScreenInit(&screen->base, pScreen); screen->enterVT = pScrn->EnterVT; pScrn->EnterVT = glxDRIEnterVT; screen->leaveVT = pScrn->LeaveVT; pScrn->LeaveVT = glxDRILeaveVT; __glXsetGetProcAddress(glXGetProcAddressARB); LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName); return &screen->base; handle_error: if (screen->driver) dlclose(screen->driver); free(screen); return NULL; } _X_EXPORT __GLXprovider __glXDRI2Provider = { __glXDRIscreenProbe, "DRI2", NULL }; xorg-server-1.20.8/glx/indirect_size.h0000644000175000017500000000716613640201473014616 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2004 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _INDIRECT_SIZE_H_ ) #define _INDIRECT_SIZE_H_ /** * \file * Prototypes for functions used to determine the number of data elements in * various GLX protocol messages. * * \author Ian Romanick */ #include #if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) #define PURE __attribute__((pure)) #else #define PURE #endif #if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) #define FASTCALL __attribute__((fastcall)) #else #define FASTCALL #endif extern _X_INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glFogiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glLightfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glLightiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glLightModelfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glLightModeliv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glMaterialfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glMaterialiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexEnvfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexEnviv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexGendv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexGenfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glTexGeniv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glMap1d_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glMap1f_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glPointParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glPointParameteriv_size(GLenum); #undef PURE #undef FASTCALL #endif /* !defined( _INDIRECT_SIZE_H_ ) */ xorg-server-1.20.8/glx/indirect_table.h0000644000175000017500000000655613640201473014735 00000000000000/* * (C) Copyright IBM Corporation 2005, 2006 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * \file indirect_table.h * * \author Ian Romanick */ #ifndef INDIRECT_TABLE_H #define INDIRECT_TABLE_H #include /** */ struct __glXDispatchInfo { /** * Number of significant bits in the protocol opcode. Opcodes with values * larger than ((1 << bits) - 1) are invalid. */ unsigned bits; /** */ const int_fast16_t *dispatch_tree; /** * Array of protocol decode and dispatch functions index by the opcode * search tree (i.e., \c dispatch_tree). The first element in each pair * is the non-byte-swapped version, and the second element is the * byte-swapped version. */ const void *(*dispatch_functions)[2]; /** * Pointer to size validation data. This table is indexed with the same * value as ::dispatch_functions. * * The first element in the pair is the size, in bytes, of the fixed-size * portion of the protocol. * * For opcodes that have a variable-size portion, the second value is an * index in \c size_func_table to calculate that size. If there is no * variable-size portion, this index will be ~0. * * \note * If size checking is not to be performed on this type of protocol * data, this pointer will be \c NULL. */ const int_fast16_t(*size_table)[2]; /** * Array of functions used to calculate the variable-size portion of * protocol messages. Indexed by the second element of the entries * in \c ::size_table. * * \note * If size checking is not to be performed on this type of protocol * data, this pointer will be \c NULL. */ const gl_proto_size_func *size_func_table; }; /** * Sentinel value for an empty leaf in the \c dispatch_tree. */ #define EMPTY_LEAF INT_FAST16_MIN /** * Declare the index \c x as a leaf index. */ #define LEAF(x) -x /** * Determine if an index is a leaf index. */ #define IS_LEAF_INDEX(x) ((x) <= 0) extern const struct __glXDispatchInfo Single_dispatch_info; extern const struct __glXDispatchInfo Render_dispatch_info; extern const struct __glXDispatchInfo VendorPriv_dispatch_info; #endif /* INDIRECT_TABLE_H */ xorg-server-1.20.8/glx/indirect_util.h0000644000175000017500000000455413640201473014617 00000000000000/* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __GLX_INDIRECT_UTIL_H__ #define __GLX_INDIRECT_UTIL_H__ extern GLint __glGetBooleanv_variable_size(GLenum e); extern void *__glXGetAnswerBuffer(__GLXclientState * cl, size_t required_size, void *local_buffer, size_t local_size, unsigned alignment); extern void __glXSendReply(ClientPtr client, const void *data, size_t elements, size_t element_size, GLboolean always_array, CARD32 retval); extern void __glXSendReplySwap(ClientPtr client, const void *data, size_t elements, size_t element_size, GLboolean always_array, CARD32 retval); struct __glXDispatchInfo; extern void *__glXGetProtocolDecodeFunction(const struct __glXDispatchInfo *dispatch_info, int opcode, int swapped_version); extern int __glXGetProtocolSizeData(const struct __glXDispatchInfo *dispatch_info, int opcode, __GLXrenderSizeData * data); #endif /* __GLX_INDIRECT_UTIL_H__ */ xorg-server-1.20.8/glx/renderpixswap.c0000644000175000017500000000664213640201473014647 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "unpack.h" #include "indirect_dispatch.h" void __glXDispSwap_SeparableFilter2D(GLbyte * pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLint hdrlen, image1len; __GLX_DECLARE_SWAP_VARIABLES; hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); __GLX_SWAP_INT((GLbyte *) &hdr->alignment); __GLX_SWAP_INT((GLbyte *) &hdr->target); __GLX_SWAP_INT((GLbyte *) &hdr->internalformat); __GLX_SWAP_INT((GLbyte *) &hdr->width); __GLX_SWAP_INT((GLbyte *) &hdr->height); __GLX_SWAP_INT((GLbyte *) &hdr->format); __GLX_SWAP_INT((GLbyte *) &hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); /* XXX check this usage - internal code called ** a version without the packing parameters */ image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1, 0, hdr->rowLength, 0, hdr->skipRows, hdr->alignment); image1len = __GLX_PAD(image1len); glSeparableFilter2D(hdr->target, hdr->internalformat, hdr->width, hdr->height, hdr->format, hdr->type, ((GLubyte *) hdr + hdrlen), ((GLubyte *) hdr + hdrlen + image1len)); } xorg-server-1.20.8/glx/extension_string.h0000644000175000017500000000565513640201473015366 00000000000000/* * (C) Copyright IBM Corporation 2002-2006 * 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 * on the rights to use, copy, modify, merge, publish, distribute, sub * license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file extension_string.h * Routines to manage the GLX extension string and GLX version for AIGLX * drivers. This code is loosely based on src/glx/x11/glxextensions.c from * Mesa. * * \author Ian Romanick */ #ifndef GLX_EXTENSION_STRING_H #define GLX_EXTENSION_STRING_H enum { /* GLX_ARB_get_proc_address is implemented on the client. */ ARB_context_flush_control_bit = 0, ARB_create_context_bit, ARB_create_context_no_error_bit, ARB_create_context_profile_bit, ARB_create_context_robustness_bit, ARB_fbconfig_float_bit, ARB_framebuffer_sRGB_bit, ARB_multisample_bit, EXT_create_context_es_profile_bit, EXT_create_context_es2_profile_bit, EXT_fbconfig_packed_float_bit, EXT_import_context_bit, EXT_libglvnd_bit, EXT_no_config_context_bit, EXT_stereo_tree_bit, EXT_texture_from_pixmap_bit, EXT_visual_info_bit, EXT_visual_rating_bit, MESA_copy_sub_buffer_bit, OML_swap_method_bit, SGI_make_current_read_bit, SGI_swap_control_bit, SGI_video_sync_bit, SGIS_multisample_bit, SGIX_fbconfig_bit, SGIX_pbuffer_bit, SGIX_visual_select_group_bit, INTEL_swap_event_bit, __NUM_GLX_EXTS, }; /* For extensions which have identical ARB and EXT implementation * in GLX area, use one enabling bit for both. */ #define EXT_framebuffer_sRGB_bit ARB_framebuffer_sRGB_bit #define __GLX_EXT_BYTES ((__NUM_GLX_EXTS + 7) / 8) extern int __glXGetExtensionString(const unsigned char *enable_bits, char *buffer); extern void __glXEnableExtension(unsigned char *enable_bits, const char *ext); extern void __glXInitExtensionEnableBits(unsigned char *enable_bits); #endif /* GLX_EXTENSION_STRING_H */ xorg-server-1.20.8/glx/single2swap.c0000644000175000017500000002005513640201473014204 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "indirect_dispatch.h" #include "unpack.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; GLsizei size; GLenum type; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 8); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); size = *(GLsizei *) (pc + 0); type = *(GLenum *) (pc + 4); if (cx->feedbackBufSize < size) { cx->feedbackBuf = reallocarray(cx->feedbackBuf, (size_t) size, __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { cl->client->errorValue = size; return BadAlloc; } cx->feedbackBufSize = size; } glFeedbackBuffer(size, type, cx->feedbackBuf); return Success; } int __glXDispSwap_SelectBuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; __GLX_DECLARE_SWAP_VARIABLES; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); size = *(GLsizei *) (pc + 0); if (cx->selectBufSize < size) { cx->selectBuf = reallocarray(cx->selectBuf, (size_t) size, __GLX_SIZE_CARD32); if (!cx->selectBuf) { cl->client->errorValue = size; return BadAlloc; } cx->selectBufSize = size; } glSelectBuffer(size, cx->selectBuf); return Success; } int __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; xGLXRenderModeReply reply; GLint nitems = 0, retBytes = 0, retval, newModeCheck; GLubyte *retBuffer = NULL; GLenum newMode; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc); newMode = *(GLenum *) pc; retval = glRenderMode(newMode); /* Check that render mode worked */ glGetIntegerv(GL_RENDER_MODE, &newModeCheck); if (newModeCheck != newMode) { /* Render mode change failed. Bail */ newMode = newModeCheck; goto noChangeAllowed; } /* ** Render mode might have still failed if we get here. But in this ** case we can't really tell, nor does it matter. If it did fail, it ** will return 0, and thus we won't send any data across the wire. */ switch (cx->renderMode) { case GL_RENDER: cx->renderMode = newMode; break; case GL_FEEDBACK: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->feedbackBufSize; } else { nitems = retval; } retBytes = nitems * __GLX_SIZE_FLOAT32; retBuffer = (GLubyte *) cx->feedbackBuf; __GLX_SWAP_FLOAT_ARRAY((GLbyte *) retBuffer, nitems); cx->renderMode = newMode; break; case GL_SELECT: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->selectBufSize; } else { GLuint *bp = cx->selectBuf; GLint i; /* ** Figure out how many bytes of data need to be sent. Parse ** the selection buffer to determine this fact as the ** return value is the number of hits, not the number of ** items in the buffer. */ nitems = 0; i = retval; while (--i >= 0) { GLuint n; /* Parse select data for this hit */ n = *bp; bp += 3 + n; } nitems = bp - cx->selectBuf; } retBytes = nitems * __GLX_SIZE_CARD32; retBuffer = (GLubyte *) cx->selectBuf; __GLX_SWAP_INT_ARRAY((GLbyte *) retBuffer, nitems); cx->renderMode = newMode; break; } /* ** First reply is the number of elements returned in the feedback or ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; reply = (xGLXRenderModeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = nitems, .retval = retval, .size = nitems, .newMode = newMode }; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.retval); __GLX_SWAP_INT(&reply.size); __GLX_SWAP_INT(&reply.newMode); WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDispSwap_Flush(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } glFlush(); return Success; } int __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; xGLXSingleReply reply = { 0, }; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } /* Do a local glFinish */ glFinish(); /* Send empty reply packet to indicate finish is finished */ __GLX_BEGIN_REPLY(0); __GLX_PUT_RETVAL(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_GetString(__GLXclientState * cl, GLbyte * pc) { return DoGetString(cl, pc, GL_TRUE); } xorg-server-1.20.8/glx/singlepix.c0000644000175000017500000004054713640201473013760 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" int __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc) { GLsizei width, height; GLenum format, type; GLboolean swapBytes, lsbFirst; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; xGLXSingleReply reply = { 0, }; REQUEST_FIXED_SIZE(xGLXSingleReq, 28); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; width = *(GLsizei *) (pc + 8); height = *(GLsizei *) (pc + 12); format = *(GLenum *) (pc + 16); type = *(GLenum *) (pc + 20); swapBytes = *(GLboolean *) (pc + 24); lsbFirst = *(GLboolean *) (pc + 25); compsize = __glReadPixels_size(format, type, width, height); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4), *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12), *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc) { GLint level, compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width = 0, height = 0, depth = 1; xGLXSingleReply reply = { 0, }; REQUEST_FIXED_SIZE(xGLXSingleReq, 20); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; level = *(GLint *) (pc + 4); format = *(GLenum *) (pc + 8); type = *(GLenum *) (pc + 12); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 16); glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); if (target == GL_TEXTURE_3D) { glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); } /* * The three queries above might fail if we're in a state where queries * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target, level, format, type, width, height, depth); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *) &reply)->width = width; ((xGLXGetTexImageReply *) &reply)->height = height; ((xGLXGetTexImageReply *) &reply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc) { GLboolean lsbFirst; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLubyte answerBuffer[200]; char *answer; xGLXSingleReply reply = { 0, }; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *) (pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1); __glXClearErrorOccured(); glGetPolygonStipple((GLubyte *) answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(128); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(128); } return Success; } static int GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize, compsize2; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width = 0, height = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); /* target must be SEPARABLE_2D, however I guess we can let the GL barf on this one.... */ glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); if ((compsize = safe_pad(compsize)) < 0) return BadLength; if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1); __glXClearErrorOccured(); glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer, answer + compsize, NULL); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize + compsize2); ((xGLXGetSeparableFilterReply *) &reply)->width = width; ((xGLXGetSeparableFilterReply *) &reply)->height = height; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize + compsize2); } return Success; } int __glXDisp_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDisp_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width = 0, height = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); if (target == GL_CONVOLUTION_1D) { height = 1; } else { glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); } /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetConvolutionFilterReply *) &reply)->width = width; ((xGLXGetConvolutionFilterReply *) &reply)->height = height; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDisp_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); reset = *(GLboolean *) (pc + 13); glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetHistogram(target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetHistogramReply *) &reply)->width = width; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetHistogram(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDisp_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); reset = *(GLboolean *) (pc + 13); compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetMinmax(target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetMinmax(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDisp_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } target = *(GLenum *) (pc + 0); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); swapBytes = *(GLboolean *) (pc + 12); glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetColorTableReply *) &reply)->width = width; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetColorTable(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDisp_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } xorg-server-1.20.8/glx/glxscreens.c0000644000175000017500000003320413640201473014123 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "extinit.h" #include "privates.h" #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "protocol-versions.h" #ifdef COMPOSITE #include "compositeext.h" #endif static DevPrivateKeyRec glxScreenPrivateKeyRec; #define glxScreenPrivateKey (&glxScreenPrivateKeyRec) const char GLServerVersion[] = "1.4"; static const char GLServerExtensions[] = "GL_ARB_depth_texture " "GL_ARB_draw_buffers " "GL_ARB_fragment_program " "GL_ARB_fragment_program_shadow " "GL_ARB_imaging " "GL_ARB_multisample " "GL_ARB_multitexture " "GL_ARB_occlusion_query " "GL_ARB_point_parameters " "GL_ARB_point_sprite " "GL_ARB_shadow " "GL_ARB_shadow_ambient " "GL_ARB_texture_border_clamp " "GL_ARB_texture_compression " "GL_ARB_texture_cube_map " "GL_ARB_texture_env_add " "GL_ARB_texture_env_combine " "GL_ARB_texture_env_crossbar " "GL_ARB_texture_env_dot3 " "GL_ARB_texture_mirrored_repeat " "GL_ARB_texture_non_power_of_two " "GL_ARB_transpose_matrix " "GL_ARB_vertex_program " "GL_ARB_window_pos " "GL_EXT_abgr " "GL_EXT_bgra " "GL_EXT_blend_color " "GL_EXT_blend_equation_separate " "GL_EXT_blend_func_separate " "GL_EXT_blend_logic_op " "GL_EXT_blend_minmax " "GL_EXT_blend_subtract " "GL_EXT_clip_volume_hint " "GL_EXT_copy_texture " "GL_EXT_draw_range_elements " "GL_EXT_fog_coord " "GL_EXT_framebuffer_object " "GL_EXT_multi_draw_arrays " "GL_EXT_packed_pixels " "GL_EXT_paletted_texture " "GL_EXT_point_parameters " "GL_EXT_polygon_offset " "GL_EXT_rescale_normal " "GL_EXT_secondary_color " "GL_EXT_separate_specular_color " "GL_EXT_shadow_funcs " "GL_EXT_shared_texture_palette " "GL_EXT_stencil_two_side " "GL_EXT_stencil_wrap " "GL_EXT_subtexture " "GL_EXT_texture " "GL_EXT_texture3D " "GL_EXT_texture_compression_dxt1 " "GL_EXT_texture_compression_s3tc " "GL_EXT_texture_edge_clamp " "GL_EXT_texture_env_add " "GL_EXT_texture_env_combine " "GL_EXT_texture_env_dot3 " "GL_EXT_texture_filter_anisotropic " "GL_EXT_texture_lod " "GL_EXT_texture_lod_bias " "GL_EXT_texture_mirror_clamp " "GL_EXT_texture_object " "GL_EXT_texture_rectangle " "GL_EXT_vertex_array " "GL_3DFX_texture_compression_FXT1 " "GL_APPLE_packed_pixels " "GL_ATI_draw_buffers " "GL_ATI_texture_env_combine3 " "GL_ATI_texture_mirror_once " "GL_HP_occlusion_test " "GL_IBM_texture_mirrored_repeat " "GL_INGR_blend_func_separate " "GL_MESA_pack_invert " "GL_MESA_ycbcr_texture " "GL_NV_blend_square " "GL_NV_depth_clamp " "GL_NV_fog_distance " "GL_NV_fragment_program_option " "GL_NV_fragment_program2 " "GL_NV_light_max_exponent " "GL_NV_multisample_filter_hint " "GL_NV_point_sprite " "GL_NV_texgen_reflection " "GL_NV_texture_compression_vtc " "GL_NV_texture_env_combine4 " "GL_NV_texture_expand_normal " "GL_NV_texture_rectangle " "GL_NV_vertex_program2_option " "GL_NV_vertex_program3 " "GL_OES_compressed_paletted_texture " "GL_SGI_color_matrix " "GL_SGI_color_table " "GL_SGIS_generate_mipmap " "GL_SGIS_multisample " "GL_SGIS_point_parameters " "GL_SGIS_texture_border_clamp " "GL_SGIS_texture_edge_clamp " "GL_SGIS_texture_lod " "GL_SGIX_depth_texture " "GL_SGIX_shadow " "GL_SGIX_shadow_ambient " "GL_SUN_slice_accum "; static Bool glxCloseScreen(ScreenPtr pScreen) { __GLXscreen *pGlxScreen = glxGetScreen(pScreen); pScreen->CloseScreen = pGlxScreen->CloseScreen; pGlxScreen->destroy(pGlxScreen); return pScreen->CloseScreen(pScreen); } __GLXscreen * glxGetScreen(ScreenPtr pScreen) { return dixLookupPrivate(&pScreen->devPrivates, glxScreenPrivateKey); } GLint glxConvertToXVisualType(int visualType) { static const int x_visual_types[] = { TrueColor, DirectColor, PseudoColor, StaticColor, GrayScale, StaticGray }; return ((unsigned) (visualType - GLX_TRUE_COLOR) < 6) ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1; } /* This code inspired by composite/compinit.c. We could move this to * mi/ and share it with composite.*/ static VisualPtr AddScreenVisuals(ScreenPtr pScreen, int count, int d) { int i; DepthPtr depth; depth = NULL; for (i = 0; i < pScreen->numDepths; i++) { if (pScreen->allowedDepths[i].depth == d) { depth = &pScreen->allowedDepths[i]; break; } } if (depth == NULL) return NULL; if (ResizeVisualArray(pScreen, count, depth) == FALSE) return NULL; /* Return a pointer to the first of the added visuals. */ return pScreen->visuals + pScreen->numVisuals - count; } static int findFirstSet(unsigned int v) { int i; for (i = 0; i < 32; i++) if (v & (1 << i)) return i; return -1; } static void initGlxVisual(VisualPtr visual, __GLXconfig * config) { int maxBits; maxBits = max(config->redBits, max(config->greenBits, config->blueBits)); config->visualID = visual->vid; visual->class = glxConvertToXVisualType(config->visualType); visual->bitsPerRGBValue = maxBits; visual->ColormapEntries = 1 << maxBits; visual->nplanes = config->redBits + config->greenBits + config->blueBits; visual->redMask = config->redMask; visual->greenMask = config->greenMask; visual->blueMask = config->blueMask; visual->offsetRed = findFirstSet(config->redMask); visual->offsetGreen = findFirstSet(config->greenMask); visual->offsetBlue = findFirstSet(config->blueMask); } static __GLXconfig * pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual) { __GLXconfig *best = NULL, *config; int best_score = 0; for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) { int score = 0; if (config->redMask != visual->redMask || config->greenMask != visual->greenMask || config->blueMask != visual->blueMask) continue; if (config->visualRating != GLX_NONE) continue; /* Ignore multisampled configs */ if (config->sampleBuffers) continue; if (glxConvertToXVisualType(config->visualType) != visual->class) continue; /* If it's the 32-bit RGBA visual, demand a 32-bit fbconfig. */ if (visual->nplanes == 32 && config->rgbBits != 32) continue; /* If it's the 32-bit RGBA visual, do not pick sRGB capable config. * This can cause issues with compositors that are not sRGB aware. */ if (visual->nplanes == 32 && config->sRGBCapable == GL_TRUE) continue; /* Can't use the same FBconfig for multiple X visuals. I think. */ if (config->visualID != 0) continue; #ifdef COMPOSITE if (!noCompositeExtension) { /* Use only duplicated configs for compIsAlternateVisuals */ if (!!compIsAlternateVisual(pGlxScreen->pScreen, visual->vid) != !!config->duplicatedForComp) continue; } #endif /* * If possible, use the same swapmethod for all built-in visual * fbconfigs, to avoid getting the 32-bit composite visual when * requesting, for example, a SWAP_COPY fbconfig. */ if (config->swapMethod == GLX_SWAP_UNDEFINED_OML) score += 32; if (config->swapMethod == GLX_SWAP_EXCHANGE_OML) score += 16; if (config->doubleBufferMode > 0) score += 8; if (config->depthBits > 0) score += 4; if (config->stencilBits > 0) score += 2; if (config->alphaBits > 0) score++; if (score > best_score) { best = config; best_score = score; } } return best; } void __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen) { __GLXconfig *m; __GLXconfig *config; int i; if (!dixRegisterPrivateKey(&glxScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return; pGlxScreen->pScreen = pScreen; pGlxScreen->GLextensions = strdup(GLServerExtensions); pGlxScreen->GLXextensions = NULL; pGlxScreen->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = glxCloseScreen; i = 0; for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) { m->fbconfigID = FakeClientID(0); m->visualID = 0; i++; } pGlxScreen->numFBConfigs = i; pGlxScreen->visuals = calloc(pGlxScreen->numFBConfigs, sizeof(__GLXconfig *)); /* First, try to choose featureful FBconfigs for the existing X visuals. * Note that if multiple X visuals end up with the same FBconfig being * chosen, the later X visuals don't get GLX visuals (because we want to * prioritize the root visual being GLX). */ for (i = 0; i < pScreen->numVisuals; i++) { VisualPtr visual = &pScreen->visuals[i]; config = pickFBConfig(pGlxScreen, visual); if (config) { pGlxScreen->visuals[pGlxScreen->numVisuals++] = config; config->visualID = visual->vid; #ifdef COMPOSITE if (!noCompositeExtension) { if (compIsAlternateVisual(pScreen, visual->vid)) config->visualSelectGroup++; } #endif } } /* Then, add new visuals corresponding to all FBconfigs that didn't have * an existing, appropriate visual. */ for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) { int depth; VisualPtr visual; if (config->visualID != 0) continue; /* Only count RGB bits and not alpha, as we're not trying to create * visuals for compositing (that's what the 32-bit composite visual * set up above is for. */ depth = config->redBits + config->greenBits + config->blueBits; #ifdef COMPOSITE if (!noCompositeExtension) { if (config->duplicatedForComp) { depth += config->alphaBits; config->visualSelectGroup++; } } #endif /* Make sure that our FBconfig's depth can actually be displayed * (corresponds to an existing visual). */ for (i = 0; i < pScreen->numVisuals; i++) { if (depth == pScreen->visuals[i].nplanes) break; } /* if it can't, fix up the fbconfig to not advertise window support */ if (i == pScreen->numVisuals) config->drawableType &= ~(GLX_WINDOW_BIT); /* fbconfig must support window drawables */ if (!(config->drawableType & GLX_WINDOW_BIT)) { config->visualID = 0; continue; } /* Create a new X visual for our FBconfig. */ visual = AddScreenVisuals(pScreen, 1, depth); if (visual == NULL) continue; #ifdef COMPOSITE if (!noCompositeExtension) { if (config->duplicatedForComp) (void) CompositeRegisterAlternateVisuals(pScreen, &visual->vid, 1); } #endif pGlxScreen->visuals[pGlxScreen->numVisuals++] = config; initGlxVisual(visual, config); } dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, pGlxScreen); if (pGlxScreen->glvnd) __glXEnableExtension(pGlxScreen->glx_enable_bits, "GLX_EXT_libglvnd"); i = __glXGetExtensionString(pGlxScreen->glx_enable_bits, NULL); if (i > 0) { pGlxScreen->GLXextensions = xnfalloc(i); (void) __glXGetExtensionString(pGlxScreen->glx_enable_bits, pGlxScreen->GLXextensions); } } void __glXScreenDestroy(__GLXscreen * screen) { __GLXconfig *config, *next; free(screen->glvnd); free(screen->GLXextensions); free(screen->GLextensions); free(screen->visuals); for (config = screen->fbconfigs; config != NULL; config = next) { next = config->next; free(config); } } xorg-server-1.20.8/glx/vndcmds.c0000644000175000017500000004011613640201473013404 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #include #include "hashtable.h" #include "vndserver.h" #include "vndservervendor.h" /** * The length of the dispatchFuncs array. Every opcode above this is a * X_GLsop_* code, which all can use the same handler. */ #define OPCODE_ARRAY_LEN 100 // This hashtable is used to keep track of the dispatch stubs for // GLXVendorPrivate and GLXVendorPrivateWithReply. typedef struct GlxVendorPrivDispatchRec { CARD32 vendorCode; GlxServerDispatchProc proc; HashTable hh; } GlxVendorPrivDispatch; static GlxServerDispatchProc dispatchFuncs[OPCODE_ARRAY_LEN] = {}; static HashTable vendorPrivHash = NULL; static HtGenericHashSetupRec vendorPrivSetup = { .keySize = sizeof(CARD32) }; static int DispatchBadRequest(ClientPtr client) { return BadRequest; } static GlxVendorPrivDispatch *LookupVendorPrivDispatch(CARD32 vendorCode, Bool create) { GlxVendorPrivDispatch *disp = NULL; disp = ht_find(vendorPrivHash, &vendorCode); if (disp == NULL && create) { if ((disp = ht_add(vendorPrivHash, &vendorCode))) { disp->vendorCode = vendorCode; disp->proc = NULL; } } return disp; } static GlxServerDispatchProc GetVendorDispatchFunc(CARD8 opcode, CARD32 vendorCode) { GlxServerVendor *vendor; xorg_list_for_each_entry(vendor, &GlxVendorList, entry) { GlxServerDispatchProc proc = vendor->glxvc.getDispatchAddress(opcode, vendorCode); if (proc != NULL) { return proc; } } return DispatchBadRequest; } static void SetReplyHeader(ClientPtr client, void *replyPtr) { xGenericReply *rep = (xGenericReply *) replyPtr; rep->type = X_Reply; rep->sequenceNumber = client->sequence; rep->length = 0; } /* Include the trivial dispatch handlers */ #include "vnd_dispatch_stubs.c" static int dispatch_GLXQueryVersion(ClientPtr client) { xGLXQueryVersionReply reply; REQUEST_SIZE_MATCH(xGLXQueryVersionReq); SetReplyHeader(client, &reply); reply.majorVersion = GlxCheckSwap(client, 1); reply.minorVersion = GlxCheckSwap(client, 4); WriteToClient(client, sz_xGLXQueryVersionReply, &reply); return Success; } /* broken header workaround */ #ifndef X_GLXSetClientInfo2ARB #define X_GLXSetClientInfo2ARB X_GLXSetConfigInfo2ARB #endif /** * This function is used for X_GLXClientInfo, X_GLXSetClientInfoARB, and * X_GLXSetClientInfo2ARB. */ static int dispatch_GLXClientInfo(ClientPtr client) { GlxServerVendor *vendor; void *requestCopy = NULL; size_t requestSize = client->req_len * 4; if (client->minorOp == X_GLXClientInfo) { REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); } else if (client->minorOp == X_GLXSetClientInfoARB) { REQUEST_AT_LEAST_SIZE(xGLXSetClientInfoARBReq); } else if (client->minorOp == X_GLXSetClientInfo2ARB) { REQUEST_AT_LEAST_SIZE(xGLXSetClientInfo2ARBReq); } else { return BadImplementation; } // We'll forward this request to each vendor library. Since a vendor might // modify the request data in place (e.g., for byte swapping), make a copy // of the request first. requestCopy = malloc(requestSize); if (requestCopy == NULL) { return BadAlloc; } memcpy(requestCopy, client->requestBuffer, requestSize); xorg_list_for_each_entry(vendor, &GlxVendorList, entry) { vendor->glxvc.handleRequest(client); // Revert the request buffer back to our copy. memcpy(client->requestBuffer, requestCopy, requestSize); } free(requestCopy); return Success; } static int CommonLoseCurrent(ClientPtr client, GlxContextTagInfo *tagInfo) { int ret; ret = tagInfo->vendor->glxvc.makeCurrent(client, tagInfo->tag, // No old context tag, None, None, None, 0); if (ret == Success) { GlxFreeContextTag(tagInfo); } return ret; } static int CommonMakeNewCurrent(ClientPtr client, GlxServerVendor *vendor, GLXDrawable drawable, GLXDrawable readdrawable, GLXContextID context, GLXContextTag *newContextTag) { int ret = BadAlloc; GlxContextTagInfo *tagInfo; tagInfo = GlxAllocContextTag(client, vendor); if (tagInfo) { ret = vendor->glxvc.makeCurrent(client, 0, // No old context tag, drawable, readdrawable, context, tagInfo->tag); if (ret == Success) { tagInfo->drawable = drawable; tagInfo->readdrawable = readdrawable; tagInfo->context = context; *newContextTag = tagInfo->tag; } else { GlxFreeContextTag(tagInfo); } } return ret; } static int CommonMakeCurrent(ClientPtr client, GLXContextTag oldContextTag, GLXDrawable drawable, GLXDrawable readdrawable, GLXContextID context) { xGLXMakeCurrentReply reply = {}; GlxContextTagInfo *oldTag = NULL; GlxServerVendor *newVendor = NULL; oldContextTag = GlxCheckSwap(client, oldContextTag); drawable = GlxCheckSwap(client, drawable); readdrawable = GlxCheckSwap(client, readdrawable); context = GlxCheckSwap(client, context); SetReplyHeader(client, &reply); if (oldContextTag != 0) { oldTag = GlxLookupContextTag(client, oldContextTag); if (oldTag == NULL) { return GlxErrorBase + GLXBadContextTag; } } if (context != 0) { newVendor = GlxGetXIDMap(context); if (newVendor == NULL) { return GlxErrorBase + GLXBadContext; } } if (oldTag == NULL && newVendor == NULL) { // Nothing to do here. Just send a successful reply. reply.contextTag = 0; } else if (oldTag != NULL && newVendor != NULL && oldTag->context == context && oldTag->drawable == drawable && oldTag->readdrawable == readdrawable) { // The old and new values are all the same, so send a successful reply. reply.contextTag = oldTag->tag; } else { // TODO: For switching contexts in a single vendor, just make one // makeCurrent call? // TODO: When changing vendors, would it be better to do the // MakeCurrent(new) first, then the LoseCurrent(old)? // If the MakeCurrent(new) fails, then the old context will still be current. // If the LoseCurrent(old) fails, then we can (probably) undo the MakeCurrent(new) with // a LoseCurrent(old). // But, if the recovery LoseCurrent(old) fails, then we're really in a bad state. // Clear the old context first. if (oldTag != NULL) { int ret = CommonLoseCurrent(client, oldTag); if (ret != Success) { return ret; } oldTag = NULL; } if (newVendor != NULL) { int ret = CommonMakeNewCurrent(client, newVendor, drawable, readdrawable, context, &reply.contextTag); if (ret != Success) { return ret; } } else { reply.contextTag = 0; } } reply.contextTag = GlxCheckSwap(client, reply.contextTag); WriteToClient(client, sz_xGLXMakeCurrentReply, &reply); return Success; } static int dispatch_GLXMakeCurrent(ClientPtr client) { REQUEST(xGLXMakeCurrentReq); REQUEST_SIZE_MATCH(*stuff); return CommonMakeCurrent(client, stuff->oldContextTag, stuff->drawable, stuff->drawable, stuff->context); } static int dispatch_GLXMakeContextCurrent(ClientPtr client) { REQUEST(xGLXMakeContextCurrentReq); REQUEST_SIZE_MATCH(*stuff); return CommonMakeCurrent(client, stuff->oldContextTag, stuff->drawable, stuff->readdrawable, stuff->context); } static int dispatch_GLXMakeCurrentReadSGI(ClientPtr client) { REQUEST(xGLXMakeCurrentReadSGIReq); REQUEST_SIZE_MATCH(*stuff); return CommonMakeCurrent(client, stuff->oldContextTag, stuff->drawable, stuff->readable, stuff->context); } static int dispatch_GLXCopyContext(ClientPtr client) { REQUEST(xGLXCopyContextReq); GlxServerVendor *vendor; REQUEST_SIZE_MATCH(*stuff); // If we've got a context tag, then we'll use it to select a vendor. If we // don't have a tag, then we'll look up one of the contexts. In either // case, it's up to the vendor library to make sure that the context ID's // are valid. if (stuff->contextTag != 0) { GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, GlxCheckSwap(client, stuff->contextTag)); if (tagInfo == NULL) { return GlxErrorBase + GLXBadContextTag; } vendor = tagInfo->vendor; } else { vendor = GlxGetXIDMap(GlxCheckSwap(client, stuff->source)); if (vendor == NULL) { return GlxErrorBase + GLXBadContext; } } return vendor->glxvc.handleRequest(client); } static int dispatch_GLXSwapBuffers(ClientPtr client) { GlxServerVendor *vendor = NULL; REQUEST(xGLXSwapBuffersReq); REQUEST_SIZE_MATCH(*stuff); if (stuff->contextTag != 0) { // If the request has a context tag, then look up a vendor from that. // The vendor library is then responsible for validating the drawable. GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, GlxCheckSwap(client, stuff->contextTag)); if (tagInfo == NULL) { return GlxErrorBase + GLXBadContextTag; } vendor = tagInfo->vendor; } else { // We don't have a context tag, so look up the vendor from the // drawable. vendor = GlxGetXIDMap(GlxCheckSwap(client, stuff->drawable)); if (vendor == NULL) { return GlxErrorBase + GLXBadDrawable; } } return vendor->glxvc.handleRequest(client); } /** * This is a generic handler for all of the X_GLXsop* requests. */ static int dispatch_GLXSingle(ClientPtr client) { REQUEST(xGLXSingleReq); GlxContextTagInfo *tagInfo; REQUEST_AT_LEAST_SIZE(*stuff); tagInfo = GlxLookupContextTag(client, GlxCheckSwap(client, stuff->contextTag)); if (tagInfo != NULL) { return tagInfo->vendor->glxvc.handleRequest(client); } else { return GlxErrorBase + GLXBadContextTag; } } static int dispatch_GLXVendorPriv(ClientPtr client) { GlxVendorPrivDispatch *disp; REQUEST(xGLXVendorPrivateReq); REQUEST_AT_LEAST_SIZE(*stuff); disp = LookupVendorPrivDispatch(GlxCheckSwap(client, stuff->vendorCode), TRUE); if (disp == NULL) { return BadAlloc; } if (disp->proc == NULL) { // We don't have a dispatch function for this request yet. Check with // each vendor library to find one. // Note that even if none of the vendors provides a dispatch stub, // we'll still add an entry to the dispatch table, so that we don't // have to look it up again later. disp->proc = GetVendorDispatchFunc(stuff->glxCode, GlxCheckSwap(client, stuff->vendorCode)); } return disp->proc(client); } Bool GlxDispatchInit(void) { GlxVendorPrivDispatch *disp; vendorPrivHash = ht_create(sizeof(CARD32), sizeof(GlxVendorPrivDispatch), ht_generic_hash, ht_generic_compare, (void *) &vendorPrivSetup); if (!vendorPrivHash) { return FALSE; } // Assign a custom dispatch stub GLXMakeCurrentReadSGI. This is the only // vendor private request that we need to deal with in libglvnd itself. disp = LookupVendorPrivDispatch(X_GLXvop_MakeCurrentReadSGI, TRUE); if (disp == NULL) { return FALSE; } disp->proc = dispatch_GLXMakeCurrentReadSGI; // Assign the dispatch stubs for requests that need special handling. dispatchFuncs[X_GLXQueryVersion] = dispatch_GLXQueryVersion; dispatchFuncs[X_GLXMakeCurrent] = dispatch_GLXMakeCurrent; dispatchFuncs[X_GLXMakeContextCurrent] = dispatch_GLXMakeContextCurrent; dispatchFuncs[X_GLXCopyContext] = dispatch_GLXCopyContext; dispatchFuncs[X_GLXSwapBuffers] = dispatch_GLXSwapBuffers; dispatchFuncs[X_GLXClientInfo] = dispatch_GLXClientInfo; dispatchFuncs[X_GLXSetClientInfoARB] = dispatch_GLXClientInfo; dispatchFuncs[X_GLXSetClientInfo2ARB] = dispatch_GLXClientInfo; dispatchFuncs[X_GLXVendorPrivate] = dispatch_GLXVendorPriv; dispatchFuncs[X_GLXVendorPrivateWithReply] = dispatch_GLXVendorPriv; // Assign the trivial stubs dispatchFuncs[X_GLXRender] = dispatch_Render; dispatchFuncs[X_GLXRenderLarge] = dispatch_RenderLarge; dispatchFuncs[X_GLXCreateContext] = dispatch_CreateContext; dispatchFuncs[X_GLXDestroyContext] = dispatch_DestroyContext; dispatchFuncs[X_GLXWaitGL] = dispatch_WaitGL; dispatchFuncs[X_GLXWaitX] = dispatch_WaitX; dispatchFuncs[X_GLXUseXFont] = dispatch_UseXFont; dispatchFuncs[X_GLXCreateGLXPixmap] = dispatch_CreateGLXPixmap; dispatchFuncs[X_GLXGetVisualConfigs] = dispatch_GetVisualConfigs; dispatchFuncs[X_GLXDestroyGLXPixmap] = dispatch_DestroyGLXPixmap; dispatchFuncs[X_GLXQueryExtensionsString] = dispatch_QueryExtensionsString; dispatchFuncs[X_GLXQueryServerString] = dispatch_QueryServerString; dispatchFuncs[X_GLXChangeDrawableAttributes] = dispatch_ChangeDrawableAttributes; dispatchFuncs[X_GLXCreateNewContext] = dispatch_CreateNewContext; dispatchFuncs[X_GLXCreatePbuffer] = dispatch_CreatePbuffer; dispatchFuncs[X_GLXCreatePixmap] = dispatch_CreatePixmap; dispatchFuncs[X_GLXCreateWindow] = dispatch_CreateWindow; dispatchFuncs[X_GLXCreateContextAttribsARB] = dispatch_CreateContextAttribsARB; dispatchFuncs[X_GLXDestroyPbuffer] = dispatch_DestroyPbuffer; dispatchFuncs[X_GLXDestroyPixmap] = dispatch_DestroyPixmap; dispatchFuncs[X_GLXDestroyWindow] = dispatch_DestroyWindow; dispatchFuncs[X_GLXGetDrawableAttributes] = dispatch_GetDrawableAttributes; dispatchFuncs[X_GLXGetFBConfigs] = dispatch_GetFBConfigs; dispatchFuncs[X_GLXQueryContext] = dispatch_QueryContext; dispatchFuncs[X_GLXIsDirect] = dispatch_IsDirect; return TRUE; } void GlxDispatchReset(void) { memset(dispatchFuncs, 0, sizeof(dispatchFuncs)); ht_destroy(vendorPrivHash); vendorPrivHash = NULL; } int GlxDispatchRequest(ClientPtr client) { REQUEST(xReq); int result; if (GlxExtensionEntry->base == 0) return BadRequest; GlxSetRequestClient(client); if (stuff->data < OPCODE_ARRAY_LEN) { if (dispatchFuncs[stuff->data] == NULL) { // Try to find a dispatch stub. dispatchFuncs[stuff->data] = GetVendorDispatchFunc(stuff->data, 0); } result = dispatchFuncs[stuff->data](client); } else { result = dispatch_GLXSingle(client); } GlxSetRequestClient(NULL); return result; } xorg-server-1.20.8/glx/indirect_dispatch_swap.c0000644000175000017500000047611613640201473016475 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include #include "glxserver.h" #include "indirect_size.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxbyteorder.h" #include "indirect_util.h" #include "singlesize.h" #define __GLX_PAD(x) (((x) + 3) & ~3) typedef struct { __GLX_PIXEL_3D_HDR; } __GLXpixel3DHeader; extern GLboolean __glXErrorOccured(void); extern void __glXClearErrorOccured(void); static const unsigned dummy_answer[2] = { 0, 0 }; static GLsizei bswap_CARD32(const void *src) { union { uint32_t dst; GLsizei ret; } x; x.dst = bswap_32(*(uint32_t *) src); return x.ret; } static GLshort bswap_CARD16(const void *src) { union { uint16_t dst; GLshort ret; } x; x.dst = bswap_16(*(uint16_t *) src); return x.ret; } static GLenum bswap_ENUM(const void *src) { union { uint32_t dst; GLenum ret; } x; x.dst = bswap_32(*(uint32_t *) src); return x.ret; } static GLsync bswap_CARD64(const void *src) { union { uint64_t dst; GLsync ret; } x; x.dst = bswap_64(*(uint64_t *) src); return x.ret; } static GLdouble bswap_FLOAT64(const void *src) { union { uint64_t dst; GLdouble ret; } x; x.dst = bswap_64(*(uint64_t *) src); return x.ret; } static GLfloat bswap_FLOAT32(const void *src) { union { uint32_t dst; GLfloat ret; } x; x.dst = bswap_32(*(uint32_t *) src); return x.ret; } static void * bswap_16_array(uint16_t * src, unsigned count) { unsigned i; for (i = 0; i < count; i++) { uint16_t temp = bswap_16(src[i]); src[i] = temp; } return src; } static void * bswap_32_array(uint32_t * src, unsigned count) { unsigned i; for (i = 0; i < count; i++) { uint32_t temp = bswap_32(src[i]); src[i] = temp; } return src; } static void * bswap_64_array(uint64_t * src, unsigned count) { unsigned i; for (i = 0; i < count; i++) { uint64_t temp = bswap_64(src[i]); src[i] = temp; } return src; } int __glXDispSwap_NewList(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glNewList((GLuint) bswap_CARD32(pc + 0), (GLenum) bswap_ENUM(pc + 4)); error = Success; } return error; } int __glXDispSwap_EndList(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glEndList(); error = Success; } return error; } void __glXDispSwap_CallList(GLbyte * pc) { glCallList((GLuint) bswap_CARD32(pc + 0)); } void __glXDispSwap_CallLists(GLbyte * pc) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); const GLenum type = (GLenum) bswap_ENUM(pc + 4); const GLvoid *lists; switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_2_BYTES: case GL_3_BYTES: case GL_4_BYTES: lists = (const GLvoid *) (pc + 8); break; case GL_SHORT: case GL_UNSIGNED_SHORT: lists = (const GLvoid *) bswap_16_array((uint16_t *) (pc + 8), n); break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: lists = (const GLvoid *) bswap_32_array((uint32_t *) (pc + 8), n); break; default: return; } glCallLists(n, type, lists); } int __glXDispSwap_DeleteLists(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glDeleteLists((GLuint) bswap_CARD32(pc + 0), (GLsizei) bswap_CARD32(pc + 4)); error = Success; } return error; } int __glXDispSwap_GenLists(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLuint retval; retval = glGenLists((GLsizei) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_ListBase(GLbyte * pc) { glListBase((GLuint) bswap_CARD32(pc + 0)); } void __glXDispSwap_Begin(GLbyte * pc) { glBegin((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_Bitmap(GLbyte * pc) { const GLubyte *const bitmap = (const GLubyte *) ((pc + 44)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glBitmap((GLsizei) bswap_CARD32(pc + 20), (GLsizei) bswap_CARD32(pc + 24), (GLfloat) bswap_FLOAT32(pc + 28), (GLfloat) bswap_FLOAT32(pc + 32), (GLfloat) bswap_FLOAT32(pc + 36), (GLfloat) bswap_FLOAT32(pc + 40), bitmap); } void __glXDispSwap_Color3bv(GLbyte * pc) { glColor3bv((const GLbyte *) (pc + 0)); } void __glXDispSwap_Color3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glColor3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_Color3fv(GLbyte * pc) { glColor3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Color3iv(GLbyte * pc) { glColor3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Color3sv(GLbyte * pc) { glColor3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_Color3ubv(GLbyte * pc) { glColor3ubv((const GLubyte *) (pc + 0)); } void __glXDispSwap_Color3uiv(GLbyte * pc) { glColor3uiv((const GLuint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Color3usv(GLbyte * pc) { glColor3usv((const GLushort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_Color4bv(GLbyte * pc) { glColor4bv((const GLbyte *) (pc + 0)); } void __glXDispSwap_Color4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glColor4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4)); } void __glXDispSwap_Color4fv(GLbyte * pc) { glColor4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_Color4iv(GLbyte * pc) { glColor4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_Color4sv(GLbyte * pc) { glColor4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4)); } void __glXDispSwap_Color4ubv(GLbyte * pc) { glColor4ubv((const GLubyte *) (pc + 0)); } void __glXDispSwap_Color4uiv(GLbyte * pc) { glColor4uiv((const GLuint *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_Color4usv(GLbyte * pc) { glColor4usv((const GLushort *) bswap_16_array((uint16_t *) (pc + 0), 4)); } void __glXDispSwap_EdgeFlagv(GLbyte * pc) { glEdgeFlagv((const GLboolean *) (pc + 0)); } void __glXDispSwap_End(GLbyte * pc) { glEnd(); } void __glXDispSwap_Indexdv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glIndexdv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1)); } void __glXDispSwap_Indexfv(GLbyte * pc) { glIndexfv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1)); } void __glXDispSwap_Indexiv(GLbyte * pc) { glIndexiv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 1)); } void __glXDispSwap_Indexsv(GLbyte * pc) { glIndexsv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 1)); } void __glXDispSwap_Normal3bv(GLbyte * pc) { glNormal3bv((const GLbyte *) (pc + 0)); } void __glXDispSwap_Normal3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glNormal3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_Normal3fv(GLbyte * pc) { glNormal3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Normal3iv(GLbyte * pc) { glNormal3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Normal3sv(GLbyte * pc) { glNormal3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_RasterPos2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glRasterPos2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2)); } void __glXDispSwap_RasterPos2fv(GLbyte * pc) { glRasterPos2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_RasterPos2iv(GLbyte * pc) { glRasterPos2iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_RasterPos2sv(GLbyte * pc) { glRasterPos2sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2)); } void __glXDispSwap_RasterPos3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glRasterPos3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_RasterPos3fv(GLbyte * pc) { glRasterPos3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_RasterPos3iv(GLbyte * pc) { glRasterPos3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_RasterPos3sv(GLbyte * pc) { glRasterPos3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_RasterPos4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glRasterPos4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4)); } void __glXDispSwap_RasterPos4fv(GLbyte * pc) { glRasterPos4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_RasterPos4iv(GLbyte * pc) { glRasterPos4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_RasterPos4sv(GLbyte * pc) { glRasterPos4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4)); } void __glXDispSwap_Rectdv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glRectdv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 16), 2)); } void __glXDispSwap_Rectfv(GLbyte * pc) { glRectfv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 2)); } void __glXDispSwap_Rectiv(GLbyte * pc) { glRectiv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2), (const GLint *) bswap_32_array((uint32_t *) (pc + 8), 2)); } void __glXDispSwap_Rectsv(GLbyte * pc) { glRectsv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 2)); } void __glXDispSwap_TexCoord1dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glTexCoord1dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1)); } void __glXDispSwap_TexCoord1fv(GLbyte * pc) { glTexCoord1fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1)); } void __glXDispSwap_TexCoord1iv(GLbyte * pc) { glTexCoord1iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 1)); } void __glXDispSwap_TexCoord1sv(GLbyte * pc) { glTexCoord1sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 1)); } void __glXDispSwap_TexCoord2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glTexCoord2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2)); } void __glXDispSwap_TexCoord2fv(GLbyte * pc) { glTexCoord2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_TexCoord2iv(GLbyte * pc) { glTexCoord2iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_TexCoord2sv(GLbyte * pc) { glTexCoord2sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2)); } void __glXDispSwap_TexCoord3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glTexCoord3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_TexCoord3fv(GLbyte * pc) { glTexCoord3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_TexCoord3iv(GLbyte * pc) { glTexCoord3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_TexCoord3sv(GLbyte * pc) { glTexCoord3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_TexCoord4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glTexCoord4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4)); } void __glXDispSwap_TexCoord4fv(GLbyte * pc) { glTexCoord4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_TexCoord4iv(GLbyte * pc) { glTexCoord4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_TexCoord4sv(GLbyte * pc) { glTexCoord4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4)); } void __glXDispSwap_Vertex2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glVertex2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2)); } void __glXDispSwap_Vertex2fv(GLbyte * pc) { glVertex2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_Vertex2iv(GLbyte * pc) { glVertex2iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_Vertex2sv(GLbyte * pc) { glVertex2sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2)); } void __glXDispSwap_Vertex3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glVertex3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_Vertex3fv(GLbyte * pc) { glVertex3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Vertex3iv(GLbyte * pc) { glVertex3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_Vertex3sv(GLbyte * pc) { glVertex3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_Vertex4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glVertex4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4)); } void __glXDispSwap_Vertex4fv(GLbyte * pc) { glVertex4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_Vertex4iv(GLbyte * pc) { glVertex4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4)); } void __glXDispSwap_Vertex4sv(GLbyte * pc) { glVertex4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4)); } void __glXDispSwap_ClipPlane(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif glClipPlane((GLenum) bswap_ENUM(pc + 32), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4)); } void __glXDispSwap_ColorMaterial(GLbyte * pc) { glColorMaterial((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4)); } void __glXDispSwap_CullFace(GLbyte * pc) { glCullFace((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_Fogf(GLbyte * pc) { glFogf((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_Fogfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), __glFogfv_size(pname)); glFogfv(pname, params); } void __glXDispSwap_Fogi(GLbyte * pc) { glFogi((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4)); } void __glXDispSwap_Fogiv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 4), __glFogiv_size(pname)); glFogiv(pname, params); } void __glXDispSwap_FrontFace(GLbyte * pc) { glFrontFace((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_Hint(GLbyte * pc) { glHint((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4)); } void __glXDispSwap_Lightf(GLbyte * pc) { glLightf((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_Lightfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glLightfv_size(pname)); glLightfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_Lighti(GLbyte * pc) { glLighti((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_Lightiv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glLightiv_size(pname)); glLightiv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_LightModelf(GLbyte * pc) { glLightModelf((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_LightModelfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), __glLightModelfv_size(pname)); glLightModelfv(pname, params); } void __glXDispSwap_LightModeli(GLbyte * pc) { glLightModeli((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4)); } void __glXDispSwap_LightModeliv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 4), __glLightModeliv_size(pname)); glLightModeliv(pname, params); } void __glXDispSwap_LineStipple(GLbyte * pc) { glLineStipple((GLint) bswap_CARD32(pc + 0), (GLushort) bswap_CARD16(pc + 4)); } void __glXDispSwap_LineWidth(GLbyte * pc) { glLineWidth((GLfloat) bswap_FLOAT32(pc + 0)); } void __glXDispSwap_Materialf(GLbyte * pc) { glMaterialf((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_Materialfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glMaterialfv_size(pname)); glMaterialfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_Materiali(GLbyte * pc) { glMateriali((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_Materialiv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glMaterialiv_size(pname)); glMaterialiv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_PointSize(GLbyte * pc) { glPointSize((GLfloat) bswap_FLOAT32(pc + 0)); } void __glXDispSwap_PolygonMode(GLbyte * pc) { glPolygonMode((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4)); } void __glXDispSwap_PolygonStipple(GLbyte * pc) { const GLubyte *const mask = (const GLubyte *) ((pc + 20)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glPolygonStipple(mask); } void __glXDispSwap_Scissor(GLbyte * pc) { glScissor((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLsizei) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12)); } void __glXDispSwap_ShadeModel(GLbyte * pc) { glShadeModel((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_TexParameterf(GLbyte * pc) { glTexParameterf((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_TexParameterfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glTexParameterfv_size(pname)); glTexParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_TexParameteri(GLbyte * pc) { glTexParameteri((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_TexParameteriv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glTexParameteriv_size(pname)); glTexParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_TexImage1D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 52)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glTexImage1D((GLenum) bswap_ENUM(pc + 20), (GLint) bswap_CARD32(pc + 24), (GLint) bswap_CARD32(pc + 28), (GLsizei) bswap_CARD32(pc + 32), (GLint) bswap_CARD32(pc + 40), (GLenum) bswap_ENUM(pc + 44), (GLenum) bswap_ENUM(pc + 48), pixels); } void __glXDispSwap_TexImage2D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 52)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glTexImage2D((GLenum) bswap_ENUM(pc + 20), (GLint) bswap_CARD32(pc + 24), (GLint) bswap_CARD32(pc + 28), (GLsizei) bswap_CARD32(pc + 32), (GLsizei) bswap_CARD32(pc + 36), (GLint) bswap_CARD32(pc + 40), (GLenum) bswap_ENUM(pc + 44), (GLenum) bswap_ENUM(pc + 48), pixels); } void __glXDispSwap_TexEnvf(GLbyte * pc) { glTexEnvf((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_TexEnvfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glTexEnvfv_size(pname)); glTexEnvfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_TexEnvi(GLbyte * pc) { glTexEnvi((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_TexEnviv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glTexEnviv_size(pname)); glTexEnviv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_TexGend(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glTexGend((GLenum) bswap_ENUM(pc + 8), (GLenum) bswap_ENUM(pc + 12), (GLdouble) bswap_FLOAT64(pc + 0)); } void __glXDispSwap_TexGendv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLdouble *params; #ifdef __GLX_ALIGN64 const GLuint compsize = __glTexGendv_size(pname); const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif params = (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), __glTexGendv_size(pname)); glTexGendv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_TexGenf(GLbyte * pc) { glTexGenf((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_TexGenfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glTexGenfv_size(pname)); glTexGenfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_TexGeni(GLbyte * pc) { glTexGeni((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_TexGeniv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glTexGeniv_size(pname)); glTexGeniv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_InitNames(GLbyte * pc) { glInitNames(); } void __glXDispSwap_LoadName(GLbyte * pc) { glLoadName((GLuint) bswap_CARD32(pc + 0)); } void __glXDispSwap_PassThrough(GLbyte * pc) { glPassThrough((GLfloat) bswap_FLOAT32(pc + 0)); } void __glXDispSwap_PopName(GLbyte * pc) { glPopName(); } void __glXDispSwap_PushName(GLbyte * pc) { glPushName((GLuint) bswap_CARD32(pc + 0)); } void __glXDispSwap_DrawBuffer(GLbyte * pc) { glDrawBuffer((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_Clear(GLbyte * pc) { glClear((GLbitfield) bswap_CARD32(pc + 0)); } void __glXDispSwap_ClearAccum(GLbyte * pc) { glClearAccum((GLfloat) bswap_FLOAT32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8), (GLfloat) bswap_FLOAT32(pc + 12)); } void __glXDispSwap_ClearIndex(GLbyte * pc) { glClearIndex((GLfloat) bswap_FLOAT32(pc + 0)); } void __glXDispSwap_ClearColor(GLbyte * pc) { glClearColor((GLclampf) bswap_FLOAT32(pc + 0), (GLclampf) bswap_FLOAT32(pc + 4), (GLclampf) bswap_FLOAT32(pc + 8), (GLclampf) bswap_FLOAT32(pc + 12)); } void __glXDispSwap_ClearStencil(GLbyte * pc) { glClearStencil((GLint) bswap_CARD32(pc + 0)); } void __glXDispSwap_ClearDepth(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glClearDepth((GLclampd) bswap_FLOAT64(pc + 0)); } void __glXDispSwap_StencilMask(GLbyte * pc) { glStencilMask((GLuint) bswap_CARD32(pc + 0)); } void __glXDispSwap_ColorMask(GLbyte * pc) { glColorMask(*(GLboolean *) (pc + 0), *(GLboolean *) (pc + 1), *(GLboolean *) (pc + 2), *(GLboolean *) (pc + 3)); } void __glXDispSwap_DepthMask(GLbyte * pc) { glDepthMask(*(GLboolean *) (pc + 0)); } void __glXDispSwap_IndexMask(GLbyte * pc) { glIndexMask((GLuint) bswap_CARD32(pc + 0)); } void __glXDispSwap_Accum(GLbyte * pc) { glAccum((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_Disable(GLbyte * pc) { glDisable((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_Enable(GLbyte * pc) { glEnable((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_PopAttrib(GLbyte * pc) { glPopAttrib(); } void __glXDispSwap_PushAttrib(GLbyte * pc) { glPushAttrib((GLbitfield) bswap_CARD32(pc + 0)); } void __glXDispSwap_MapGrid1d(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif glMapGrid1d((GLint) bswap_CARD32(pc + 16), (GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8)); } void __glXDispSwap_MapGrid1f(GLbyte * pc) { glMapGrid1f((GLint) bswap_CARD32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_MapGrid2d(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 40); pc -= 4; } #endif glMapGrid2d((GLint) bswap_CARD32(pc + 32), (GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8), (GLint) bswap_CARD32(pc + 36), (GLdouble) bswap_FLOAT64(pc + 16), (GLdouble) bswap_FLOAT64(pc + 24)); } void __glXDispSwap_MapGrid2f(GLbyte * pc) { glMapGrid2f((GLint) bswap_CARD32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLfloat) bswap_FLOAT32(pc + 16), (GLfloat) bswap_FLOAT32(pc + 20)); } void __glXDispSwap_EvalCoord1dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glEvalCoord1dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1)); } void __glXDispSwap_EvalCoord1fv(GLbyte * pc) { glEvalCoord1fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1)); } void __glXDispSwap_EvalCoord2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glEvalCoord2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2)); } void __glXDispSwap_EvalCoord2fv(GLbyte * pc) { glEvalCoord2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2)); } void __glXDispSwap_EvalMesh1(GLbyte * pc) { glEvalMesh1((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_EvalPoint1(GLbyte * pc) { glEvalPoint1((GLint) bswap_CARD32(pc + 0)); } void __glXDispSwap_EvalMesh2(GLbyte * pc) { glEvalMesh2((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16)); } void __glXDispSwap_EvalPoint2(GLbyte * pc) { glEvalPoint2((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4)); } void __glXDispSwap_AlphaFunc(GLbyte * pc) { glAlphaFunc((GLenum) bswap_ENUM(pc + 0), (GLclampf) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_BlendFunc(GLbyte * pc) { glBlendFunc((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4)); } void __glXDispSwap_LogicOp(GLbyte * pc) { glLogicOp((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_StencilFunc(GLbyte * pc) { glStencilFunc((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLuint) bswap_CARD32(pc + 8)); } void __glXDispSwap_StencilOp(GLbyte * pc) { glStencilOp((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8)); } void __glXDispSwap_DepthFunc(GLbyte * pc) { glDepthFunc((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_PixelZoom(GLbyte * pc) { glPixelZoom((GLfloat) bswap_FLOAT32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_PixelTransferf(GLbyte * pc) { glPixelTransferf((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_PixelTransferi(GLbyte * pc) { glPixelTransferi((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4)); } int __glXDispSwap_PixelStoref(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glPixelStoref((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); error = Success; } return error; } int __glXDispSwap_PixelStorei(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glPixelStorei((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4)); error = Success; } return error; } void __glXDispSwap_PixelMapfv(GLbyte * pc) { const GLsizei mapsize = (GLsizei) bswap_CARD32(pc + 4); glPixelMapfv((GLenum) bswap_ENUM(pc + 0), mapsize, (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 0)); } void __glXDispSwap_PixelMapuiv(GLbyte * pc) { const GLsizei mapsize = (GLsizei) bswap_CARD32(pc + 4); glPixelMapuiv((GLenum) bswap_ENUM(pc + 0), mapsize, (const GLuint *) bswap_32_array((uint32_t *) (pc + 8), 0)); } void __glXDispSwap_PixelMapusv(GLbyte * pc) { const GLsizei mapsize = (GLsizei) bswap_CARD32(pc + 4); glPixelMapusv((GLenum) bswap_ENUM(pc + 0), mapsize, (const GLushort *) bswap_16_array((uint16_t *) (pc + 8), 0)); } void __glXDispSwap_ReadBuffer(GLbyte * pc) { glReadBuffer((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_CopyPixels(GLbyte * pc) { glCopyPixels((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLsizei) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12), (GLenum) bswap_ENUM(pc + 16)); } void __glXDispSwap_DrawPixels(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 36)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glDrawPixels((GLsizei) bswap_CARD32(pc + 20), (GLsizei) bswap_CARD32(pc + 24), (GLenum) bswap_ENUM(pc + 28), (GLenum) bswap_ENUM(pc + 32), pixels); } int __glXDispSwap_GetBooleanv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetBooleanv_size(pname); GLboolean answerBuffer[200]; GLboolean *params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetBooleanv(pname, params); __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetClipPlane(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLdouble equation[4]; glGetClipPlane((GLenum) bswap_ENUM(pc + 0), equation); (void) bswap_64_array((uint64_t *) equation, 4); __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0); error = Success; } return error; } int __glXDispSwap_GetDoublev(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetDoublev_size(pname); GLdouble answerBuffer[200]; GLdouble *params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetDoublev(pname, params); (void) bswap_64_array((uint64_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetError(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLenum retval; retval = glGetError(); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDispSwap_GetFloatv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetFloatv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetFloatv(pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetIntegerv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetIntegerv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetIntegerv(pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetLightfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetLightfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetLightfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetLightiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetLightiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetLightiv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMapdv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = (GLenum) bswap_ENUM(pc + 0); const GLenum query = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMapdv_size(target, query); GLdouble answerBuffer[200]; GLdouble *v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); if (v == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMapdv(target, query, v); (void) bswap_64_array((uint64_t *) v, compsize); __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMapfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = (GLenum) bswap_ENUM(pc + 0); const GLenum query = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMapfv_size(target, query); GLfloat answerBuffer[200]; GLfloat *v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (v == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMapfv(target, query, v); (void) bswap_32_array((uint32_t *) v, compsize); __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMapiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = (GLenum) bswap_ENUM(pc + 0); const GLenum query = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMapiv_size(target, query); GLint answerBuffer[200]; GLint *v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (v == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMapiv(target, query, v); (void) bswap_32_array((uint32_t *) v, compsize); __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMaterialfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMaterialfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMaterialfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMaterialiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMaterialiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMaterialiv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetPixelMapfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum map = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetPixelMapfv_size(map); GLfloat answerBuffer[200]; GLfloat *values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (values == NULL) return BadAlloc; __glXClearErrorOccured(); glGetPixelMapfv(map, values); (void) bswap_32_array((uint32_t *) values, compsize); __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetPixelMapuiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum map = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetPixelMapuiv_size(map); GLuint answerBuffer[200]; GLuint *values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (values == NULL) return BadAlloc; __glXClearErrorOccured(); glGetPixelMapuiv(map, values); (void) bswap_32_array((uint32_t *) values, compsize); __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetPixelMapusv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum map = (GLenum) bswap_ENUM(pc + 0); const GLuint compsize = __glGetPixelMapusv_size(map); GLushort answerBuffer[200]; GLushort *values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); if (values == NULL) return BadAlloc; __glXClearErrorOccured(); glGetPixelMapusv(map, values); (void) bswap_16_array((uint16_t *) values, compsize); __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexEnvfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexEnvfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexEnvfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexEnviv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexEnviv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexEnviv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexGendv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexGendv_size(pname); GLdouble answerBuffer[200]; GLdouble *params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexGendv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_64_array((uint64_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexGenfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexGenfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexGenfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexGeniv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexGeniv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexGeniv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetTexParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 8); const GLuint compsize = __glGetTexLevelParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexLevelParameterfv((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 8); const GLuint compsize = __glGetTexLevelParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexLevelParameteriv((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_IsEnabled(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsEnabled((GLenum) bswap_ENUM(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDispSwap_IsList(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsList((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_DepthRange(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glDepthRange((GLclampd) bswap_FLOAT64(pc + 0), (GLclampd) bswap_FLOAT64(pc + 8)); } void __glXDispSwap_Frustum(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 48); pc -= 4; } #endif glFrustum((GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8), (GLdouble) bswap_FLOAT64(pc + 16), (GLdouble) bswap_FLOAT64(pc + 24), (GLdouble) bswap_FLOAT64(pc + 32), (GLdouble) bswap_FLOAT64(pc + 40)); } void __glXDispSwap_LoadIdentity(GLbyte * pc) { glLoadIdentity(); } void __glXDispSwap_LoadMatrixf(GLbyte * pc) { glLoadMatrixf((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 16)); } void __glXDispSwap_LoadMatrixd(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 128); pc -= 4; } #endif glLoadMatrixd((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 16)); } void __glXDispSwap_MatrixMode(GLbyte * pc) { glMatrixMode((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_MultMatrixf(GLbyte * pc) { glMultMatrixf((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 16)); } void __glXDispSwap_MultMatrixd(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 128); pc -= 4; } #endif glMultMatrixd((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 16)); } void __glXDispSwap_Ortho(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 48); pc -= 4; } #endif glOrtho((GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8), (GLdouble) bswap_FLOAT64(pc + 16), (GLdouble) bswap_FLOAT64(pc + 24), (GLdouble) bswap_FLOAT64(pc + 32), (GLdouble) bswap_FLOAT64(pc + 40)); } void __glXDispSwap_PopMatrix(GLbyte * pc) { glPopMatrix(); } void __glXDispSwap_PushMatrix(GLbyte * pc) { glPushMatrix(); } void __glXDispSwap_Rotated(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glRotated((GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8), (GLdouble) bswap_FLOAT64(pc + 16), (GLdouble) bswap_FLOAT64(pc + 24)); } void __glXDispSwap_Rotatef(GLbyte * pc) { glRotatef((GLfloat) bswap_FLOAT32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8), (GLfloat) bswap_FLOAT32(pc + 12)); } void __glXDispSwap_Scaled(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glScaled((GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8), (GLdouble) bswap_FLOAT64(pc + 16)); } void __glXDispSwap_Scalef(GLbyte * pc) { glScalef((GLfloat) bswap_FLOAT32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_Translated(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glTranslated((GLdouble) bswap_FLOAT64(pc + 0), (GLdouble) bswap_FLOAT64(pc + 8), (GLdouble) bswap_FLOAT64(pc + 16)); } void __glXDispSwap_Translatef(GLbyte * pc) { glTranslatef((GLfloat) bswap_FLOAT32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_Viewport(GLbyte * pc) { glViewport((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLsizei) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12)); } void __glXDispSwap_BindTexture(GLbyte * pc) { glBindTexture((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4)); } void __glXDispSwap_Indexubv(GLbyte * pc) { glIndexubv((const GLubyte *) (pc + 0)); } void __glXDispSwap_PolygonOffset(GLbyte * pc) { glPolygonOffset((GLfloat) bswap_FLOAT32(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } int __glXDispSwap_AreTexturesResident(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLboolean retval; GLboolean answerBuffer[200]; GLboolean *residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); if (residences == NULL) return BadAlloc; retval = glAreTexturesResident(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0), residences); __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); error = Success; } return error; } int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLboolean retval; GLboolean answerBuffer[200]; GLboolean *residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); if (residences == NULL) return BadAlloc; retval = glAreTexturesResident(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0), residences); __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); error = Success; } return error; } void __glXDispSwap_CopyTexImage1D(GLbyte * pc) { glCopyTexImage1D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20), (GLint) bswap_CARD32(pc + 24)); } void __glXDispSwap_CopyTexImage2D(GLbyte * pc) { glCopyTexImage2D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20), (GLsizei) bswap_CARD32(pc + 24), (GLint) bswap_CARD32(pc + 28)); } void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc) { glCopyTexSubImage1D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20)); } void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc) { glCopyTexSubImage2D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLint) bswap_CARD32(pc + 20), (GLsizei) bswap_CARD32(pc + 24), (GLsizei) bswap_CARD32(pc + 28)); } int __glXDispSwap_DeleteTextures(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); glDeleteTextures(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0)); error = Success; } return error; } int __glXDispSwap_DeleteTexturesEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); glDeleteTextures(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0)); error = Success; } return error; } int __glXDispSwap_GenTextures(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLuint answerBuffer[200]; GLuint *textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (textures == NULL) return BadAlloc; glGenTextures(n, textures); (void) bswap_32_array((uint32_t *) textures, n); __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDispSwap_GenTexturesEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLuint answerBuffer[200]; GLuint *textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (textures == NULL) return BadAlloc; glGenTextures(n, textures); (void) bswap_32_array((uint32_t *) textures, n); __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDispSwap_IsTexture(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsTexture((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDispSwap_IsTextureEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsTexture((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_PrioritizeTextures(GLbyte * pc) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); glPrioritizeTextures(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0), (const GLclampf *) bswap_32_array((uint32_t *) (pc + 4), 0)); } void __glXDispSwap_TexSubImage1D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 56)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glTexSubImage1D((GLenum) bswap_ENUM(pc + 20), (GLint) bswap_CARD32(pc + 24), (GLint) bswap_CARD32(pc + 28), (GLsizei) bswap_CARD32(pc + 36), (GLenum) bswap_ENUM(pc + 44), (GLenum) bswap_ENUM(pc + 48), pixels); } void __glXDispSwap_TexSubImage2D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 56)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glTexSubImage2D((GLenum) bswap_ENUM(pc + 20), (GLint) bswap_CARD32(pc + 24), (GLint) bswap_CARD32(pc + 28), (GLint) bswap_CARD32(pc + 32), (GLsizei) bswap_CARD32(pc + 36), (GLsizei) bswap_CARD32(pc + 40), (GLenum) bswap_ENUM(pc + 44), (GLenum) bswap_ENUM(pc + 48), pixels); } void __glXDispSwap_BlendColor(GLbyte * pc) { glBlendColor((GLclampf) bswap_FLOAT32(pc + 0), (GLclampf) bswap_FLOAT32(pc + 4), (GLclampf) bswap_FLOAT32(pc + 8), (GLclampf) bswap_FLOAT32(pc + 12)); } void __glXDispSwap_BlendEquation(GLbyte * pc) { glBlendEquation((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_ColorTable(GLbyte * pc) { const GLvoid *const table = (const GLvoid *) ((pc + 40)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glColorTable((GLenum) bswap_ENUM(pc + 20), (GLenum) bswap_ENUM(pc + 24), (GLsizei) bswap_CARD32(pc + 28), (GLenum) bswap_ENUM(pc + 32), (GLenum) bswap_ENUM(pc + 36), table); } void __glXDispSwap_ColorTableParameterfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glColorTableParameterfv_size(pname)); glColorTableParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_ColorTableParameteriv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glColorTableParameteriv_size(pname)); glColorTableParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_CopyColorTable(GLbyte * pc) { glCopyColorTable((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16)); } int __glXDispSwap_GetColorTableParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetColorTableParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetColorTableParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetColorTableParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetColorTableParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetColorTableParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } void __glXDispSwap_ColorSubTable(GLbyte * pc) { const GLvoid *const data = (const GLvoid *) ((pc + 40)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glColorSubTable((GLenum) bswap_ENUM(pc + 20), (GLsizei) bswap_CARD32(pc + 24), (GLsizei) bswap_CARD32(pc + 28), (GLenum) bswap_ENUM(pc + 32), (GLenum) bswap_ENUM(pc + 36), data); } void __glXDispSwap_CopyColorSubTable(GLbyte * pc) { glCopyColorSubTable((GLenum) bswap_ENUM(pc + 0), (GLsizei) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16)); } void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc) { const GLvoid *const image = (const GLvoid *) ((pc + 44)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glConvolutionFilter1D((GLenum) bswap_ENUM(pc + 20), (GLenum) bswap_ENUM(pc + 24), (GLsizei) bswap_CARD32(pc + 28), (GLenum) bswap_ENUM(pc + 36), (GLenum) bswap_ENUM(pc + 40), image); } void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc) { const GLvoid *const image = (const GLvoid *) ((pc + 44)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glConvolutionFilter2D((GLenum) bswap_ENUM(pc + 20), (GLenum) bswap_ENUM(pc + 24), (GLsizei) bswap_CARD32(pc + 28), (GLsizei) bswap_CARD32(pc + 32), (GLenum) bswap_ENUM(pc + 36), (GLenum) bswap_ENUM(pc + 40), image); } void __glXDispSwap_ConvolutionParameterf(GLbyte * pc) { glConvolutionParameterf((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8)); } void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), __glConvolutionParameterfv_size (pname)); glConvolutionParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_ConvolutionParameteri(GLbyte * pc) { glConvolutionParameteri((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8)); } void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 8), __glConvolutionParameteriv_size(pname)); glConvolutionParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); } void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc) { glCopyConvolutionFilter1D((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16)); } void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc) { glCopyConvolutionFilter2D((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20)); } int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetConvolutionParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetConvolutionParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetConvolutionParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetConvolutionParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetHistogramParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetHistogramParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetHistogramParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetHistogramParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetHistogramParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetHistogramParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMinmaxParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMinmaxParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMinmaxParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetMinmaxParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } void __glXDispSwap_Histogram(GLbyte * pc) { glHistogram((GLenum) bswap_ENUM(pc + 0), (GLsizei) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), *(GLboolean *) (pc + 12)); } void __glXDispSwap_Minmax(GLbyte * pc) { glMinmax((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), *(GLboolean *) (pc + 8)); } void __glXDispSwap_ResetHistogram(GLbyte * pc) { glResetHistogram((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_ResetMinmax(GLbyte * pc) { glResetMinmax((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_TexImage3D(GLbyte * pc) { const CARD32 ptr_is_null = *(CARD32 *) (pc + 76); const GLvoid *const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80)); __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32(&hdr->imageHeight)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32(&hdr->skipImages)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glTexImage3D((GLenum) bswap_ENUM(pc + 36), (GLint) bswap_CARD32(pc + 40), (GLint) bswap_CARD32(pc + 44), (GLsizei) bswap_CARD32(pc + 48), (GLsizei) bswap_CARD32(pc + 52), (GLsizei) bswap_CARD32(pc + 56), (GLint) bswap_CARD32(pc + 64), (GLenum) bswap_ENUM(pc + 68), (GLenum) bswap_ENUM(pc + 72), pixels); } void __glXDispSwap_TexSubImage3D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 88)); __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength)); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32(&hdr->imageHeight)); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows)); glPixelStorei(GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32(&hdr->skipImages)); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32(&hdr->skipPixels)); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment)); glTexSubImage3D((GLenum) bswap_ENUM(pc + 36), (GLint) bswap_CARD32(pc + 40), (GLint) bswap_CARD32(pc + 44), (GLint) bswap_CARD32(pc + 48), (GLint) bswap_CARD32(pc + 52), (GLsizei) bswap_CARD32(pc + 60), (GLsizei) bswap_CARD32(pc + 64), (GLsizei) bswap_CARD32(pc + 68), (GLenum) bswap_ENUM(pc + 76), (GLenum) bswap_ENUM(pc + 80), pixels); } void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc) { glCopyTexSubImage3D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLint) bswap_CARD32(pc + 20), (GLint) bswap_CARD32(pc + 24), (GLsizei) bswap_CARD32(pc + 28), (GLsizei) bswap_CARD32(pc + 32)); } void __glXDispSwap_ActiveTexture(GLbyte * pc) { glActiveTextureARB((GLenum) bswap_ENUM(pc + 0)); } void __glXDispSwap_MultiTexCoord1dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 12); pc -= 4; } #endif glMultiTexCoord1dvARB((GLenum) bswap_ENUM(pc + 8), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1)); } void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc) { glMultiTexCoord1fvARB((GLenum) bswap_ENUM(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 1)); } void __glXDispSwap_MultiTexCoord1iv(GLbyte * pc) { glMultiTexCoord1ivARB((GLenum) bswap_ENUM(pc + 0), (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 1)); } void __glXDispSwap_MultiTexCoord1sv(GLbyte * pc) { glMultiTexCoord1svARB((GLenum) bswap_ENUM(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 1)); } void __glXDispSwap_MultiTexCoord2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif glMultiTexCoord2dvARB((GLenum) bswap_ENUM(pc + 16), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2)); } void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc) { glMultiTexCoord2fvARB((GLenum) bswap_ENUM(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 2)); } void __glXDispSwap_MultiTexCoord2iv(GLbyte * pc) { glMultiTexCoord2ivARB((GLenum) bswap_ENUM(pc + 0), (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 2)); } void __glXDispSwap_MultiTexCoord2sv(GLbyte * pc) { glMultiTexCoord2svARB((GLenum) bswap_ENUM(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 2)); } void __glXDispSwap_MultiTexCoord3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 28); pc -= 4; } #endif glMultiTexCoord3dvARB((GLenum) bswap_ENUM(pc + 24), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc) { glMultiTexCoord3fvARB((GLenum) bswap_ENUM(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 3)); } void __glXDispSwap_MultiTexCoord3iv(GLbyte * pc) { glMultiTexCoord3ivARB((GLenum) bswap_ENUM(pc + 0), (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 3)); } void __glXDispSwap_MultiTexCoord3sv(GLbyte * pc) { glMultiTexCoord3svARB((GLenum) bswap_ENUM(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 3)); } void __glXDispSwap_MultiTexCoord4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif glMultiTexCoord4dvARB((GLenum) bswap_ENUM(pc + 32), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4)); } void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc) { glMultiTexCoord4fvARB((GLenum) bswap_ENUM(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_MultiTexCoord4iv(GLbyte * pc) { glMultiTexCoord4ivARB((GLenum) bswap_ENUM(pc + 0), (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_MultiTexCoord4sv(GLbyte * pc) { glMultiTexCoord4svARB((GLenum) bswap_ENUM(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 4)); } void __glXDispSwap_CompressedTexImage1D(GLbyte * pc) { PFNGLCOMPRESSEDTEXIMAGE1DPROC CompressedTexImage1D = __glGetProcAddress("glCompressedTexImage1D"); const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 20); CompressedTexImage1D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLsizei) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), imageSize, (const GLvoid *) (pc + 24)); } void __glXDispSwap_CompressedTexImage2D(GLbyte * pc) { PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D = __glGetProcAddress("glCompressedTexImage2D"); const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 24); CompressedTexImage2D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLsizei) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16), (GLint) bswap_CARD32(pc + 20), imageSize, (const GLvoid *) (pc + 28)); } void __glXDispSwap_CompressedTexImage3D(GLbyte * pc) { PFNGLCOMPRESSEDTEXIMAGE3DPROC CompressedTexImage3D = __glGetProcAddress("glCompressedTexImage3D"); const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 28); CompressedTexImage3D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLsizei) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20), (GLint) bswap_CARD32(pc + 24), imageSize, (const GLvoid *) (pc + 32)); } void __glXDispSwap_CompressedTexSubImage1D(GLbyte * pc) { PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC CompressedTexSubImage1D = __glGetProcAddress("glCompressedTexSubImage1D"); const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 20); CompressedTexSubImage1D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12), (GLenum) bswap_ENUM(pc + 16), imageSize, (const GLvoid *) (pc + 24)); } void __glXDispSwap_CompressedTexSubImage2D(GLbyte * pc) { PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC CompressedTexSubImage2D = __glGetProcAddress("glCompressedTexSubImage2D"); const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 28); CompressedTexSubImage2D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20), (GLenum) bswap_ENUM(pc + 24), imageSize, (const GLvoid *) (pc + 32)); } void __glXDispSwap_CompressedTexSubImage3D(GLbyte * pc) { PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC CompressedTexSubImage3D = __glGetProcAddress("glCompressedTexSubImage3D"); const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 36); CompressedTexSubImage3D((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLsizei) bswap_CARD32(pc + 20), (GLsizei) bswap_CARD32(pc + 24), (GLsizei) bswap_CARD32(pc + 28), (GLenum) bswap_ENUM(pc + 32), imageSize, (const GLvoid *) (pc + 40)); } void __glXDispSwap_SampleCoverage(GLbyte * pc) { PFNGLSAMPLECOVERAGEPROC SampleCoverage = __glGetProcAddress("glSampleCoverage"); SampleCoverage((GLclampf) bswap_FLOAT32(pc + 0), *(GLboolean *) (pc + 4)); } void __glXDispSwap_BlendFuncSeparate(GLbyte * pc) { PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate = __glGetProcAddress("glBlendFuncSeparate"); BlendFuncSeparate((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLenum) bswap_ENUM(pc + 12)); } void __glXDispSwap_FogCoorddv(GLbyte * pc) { PFNGLFOGCOORDDVPROC FogCoorddv = __glGetProcAddress("glFogCoorddv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif FogCoorddv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1)); } void __glXDispSwap_PointParameterf(GLbyte * pc) { PFNGLPOINTPARAMETERFPROC PointParameterf = __glGetProcAddress("glPointParameterf"); PointParameterf((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4)); } void __glXDispSwap_PointParameterfv(GLbyte * pc) { PFNGLPOINTPARAMETERFVPROC PointParameterfv = __glGetProcAddress("glPointParameterfv"); const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLfloat *params; params = (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), __glPointParameterfv_size(pname)); PointParameterfv(pname, params); } void __glXDispSwap_PointParameteri(GLbyte * pc) { PFNGLPOINTPARAMETERIPROC PointParameteri = __glGetProcAddress("glPointParameteri"); PointParameteri((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4)); } void __glXDispSwap_PointParameteriv(GLbyte * pc) { PFNGLPOINTPARAMETERIVPROC PointParameteriv = __glGetProcAddress("glPointParameteriv"); const GLenum pname = (GLenum) bswap_ENUM(pc + 0); const GLint *params; params = (const GLint *) bswap_32_array((uint32_t *) (pc + 4), __glPointParameteriv_size(pname)); PointParameteriv(pname, params); } void __glXDispSwap_SecondaryColor3bv(GLbyte * pc) { PFNGLSECONDARYCOLOR3BVPROC SecondaryColor3bv = __glGetProcAddress("glSecondaryColor3bv"); SecondaryColor3bv((const GLbyte *) (pc + 0)); } void __glXDispSwap_SecondaryColor3dv(GLbyte * pc) { PFNGLSECONDARYCOLOR3DVPROC SecondaryColor3dv = __glGetProcAddress("glSecondaryColor3dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif SecondaryColor3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3)); } void __glXDispSwap_SecondaryColor3iv(GLbyte * pc) { PFNGLSECONDARYCOLOR3IVPROC SecondaryColor3iv = __glGetProcAddress("glSecondaryColor3iv"); SecondaryColor3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_SecondaryColor3sv(GLbyte * pc) { PFNGLSECONDARYCOLOR3SVPROC SecondaryColor3sv = __glGetProcAddress("glSecondaryColor3sv"); SecondaryColor3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_SecondaryColor3ubv(GLbyte * pc) { PFNGLSECONDARYCOLOR3UBVPROC SecondaryColor3ubv = __glGetProcAddress("glSecondaryColor3ubv"); SecondaryColor3ubv((const GLubyte *) (pc + 0)); } void __glXDispSwap_SecondaryColor3uiv(GLbyte * pc) { PFNGLSECONDARYCOLOR3UIVPROC SecondaryColor3uiv = __glGetProcAddress("glSecondaryColor3uiv"); SecondaryColor3uiv((const GLuint *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_SecondaryColor3usv(GLbyte * pc) { PFNGLSECONDARYCOLOR3USVPROC SecondaryColor3usv = __glGetProcAddress("glSecondaryColor3usv"); SecondaryColor3usv((const GLushort *) bswap_16_array((uint16_t *) (pc + 0), 3)); } void __glXDispSwap_WindowPos3fv(GLbyte * pc) { PFNGLWINDOWPOS3FVPROC WindowPos3fv = __glGetProcAddress("glWindowPos3fv"); WindowPos3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_BeginQuery(GLbyte * pc) { PFNGLBEGINQUERYPROC BeginQuery = __glGetProcAddress("glBeginQuery"); BeginQuery((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4)); } int __glXDispSwap_DeleteQueries(__GLXclientState * cl, GLbyte * pc) { PFNGLDELETEQUERIESPROC DeleteQueries = __glGetProcAddress("glDeleteQueries"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); DeleteQueries(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0)); error = Success; } return error; } void __glXDispSwap_EndQuery(GLbyte * pc) { PFNGLENDQUERYPROC EndQuery = __glGetProcAddress("glEndQuery"); EndQuery((GLenum) bswap_ENUM(pc + 0)); } int __glXDispSwap_GenQueries(__GLXclientState * cl, GLbyte * pc) { PFNGLGENQUERIESPROC GenQueries = __glGetProcAddress("glGenQueries"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLuint answerBuffer[200]; GLuint *ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (ids == NULL) return BadAlloc; GenQueries(n, ids); (void) bswap_32_array((uint32_t *) ids, n); __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDispSwap_GetQueryObjectiv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETQUERYOBJECTIVPROC GetQueryObjectiv = __glGetProcAddress("glGetQueryObjectiv"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetQueryObjectiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetQueryObjectiv((GLuint) bswap_CARD32(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetQueryObjectuiv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETQUERYOBJECTUIVPROC GetQueryObjectuiv = __glGetProcAddress("glGetQueryObjectuiv"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetQueryObjectuiv_size(pname); GLuint answerBuffer[200]; GLuint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetQueryObjectuiv((GLuint) bswap_CARD32(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetQueryiv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETQUERYIVPROC GetQueryiv = __glGetProcAddress("glGetQueryiv"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetQueryiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetQueryiv((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_IsQuery(__GLXclientState * cl, GLbyte * pc) { PFNGLISQUERYPROC IsQuery = __glGetProcAddress("glIsQuery"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsQuery((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_BlendEquationSeparate(GLbyte * pc) { PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate = __glGetProcAddress("glBlendEquationSeparate"); BlendEquationSeparate((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4)); } void __glXDispSwap_DrawBuffers(GLbyte * pc) { PFNGLDRAWBUFFERSPROC DrawBuffers = __glGetProcAddress("glDrawBuffers"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); DrawBuffers(n, (const GLenum *) bswap_32_array((uint32_t *) (pc + 4), 0)); } void __glXDispSwap_VertexAttrib1dv(GLbyte * pc) { PFNGLVERTEXATTRIB1DVPROC VertexAttrib1dv = __glGetProcAddress("glVertexAttrib1dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 12); pc -= 4; } #endif VertexAttrib1dv((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 1)); } void __glXDispSwap_VertexAttrib1sv(GLbyte * pc) { PFNGLVERTEXATTRIB1SVPROC VertexAttrib1sv = __glGetProcAddress("glVertexAttrib1sv"); VertexAttrib1sv((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 1)); } void __glXDispSwap_VertexAttrib2dv(GLbyte * pc) { PFNGLVERTEXATTRIB2DVPROC VertexAttrib2dv = __glGetProcAddress("glVertexAttrib2dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif VertexAttrib2dv((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 2)); } void __glXDispSwap_VertexAttrib2sv(GLbyte * pc) { PFNGLVERTEXATTRIB2SVPROC VertexAttrib2sv = __glGetProcAddress("glVertexAttrib2sv"); VertexAttrib2sv((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 2)); } void __glXDispSwap_VertexAttrib3dv(GLbyte * pc) { PFNGLVERTEXATTRIB3DVPROC VertexAttrib3dv = __glGetProcAddress("glVertexAttrib3dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 28); pc -= 4; } #endif VertexAttrib3dv((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 3)); } void __glXDispSwap_VertexAttrib3sv(GLbyte * pc) { PFNGLVERTEXATTRIB3SVPROC VertexAttrib3sv = __glGetProcAddress("glVertexAttrib3sv"); VertexAttrib3sv((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 3)); } void __glXDispSwap_VertexAttrib4Nbv(GLbyte * pc) { PFNGLVERTEXATTRIB4NBVPROC VertexAttrib4Nbv = __glGetProcAddress("glVertexAttrib4Nbv"); VertexAttrib4Nbv((GLuint) bswap_CARD32(pc + 0), (const GLbyte *) (pc + 4)); } void __glXDispSwap_VertexAttrib4Niv(GLbyte * pc) { PFNGLVERTEXATTRIB4NIVPROC VertexAttrib4Niv = __glGetProcAddress("glVertexAttrib4Niv"); VertexAttrib4Niv((GLuint) bswap_CARD32(pc + 0), (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4Nsv(GLbyte * pc) { PFNGLVERTEXATTRIB4NSVPROC VertexAttrib4Nsv = __glGetProcAddress("glVertexAttrib4Nsv"); VertexAttrib4Nsv((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4Nubv(GLbyte * pc) { PFNGLVERTEXATTRIB4NUBVPROC VertexAttrib4Nubv = __glGetProcAddress("glVertexAttrib4Nubv"); VertexAttrib4Nubv((GLuint) bswap_CARD32(pc + 0), (const GLubyte *) (pc + 4)); } void __glXDispSwap_VertexAttrib4Nuiv(GLbyte * pc) { PFNGLVERTEXATTRIB4NUIVPROC VertexAttrib4Nuiv = __glGetProcAddress("glVertexAttrib4Nuiv"); VertexAttrib4Nuiv((GLuint) bswap_CARD32(pc + 0), (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4Nusv(GLbyte * pc) { PFNGLVERTEXATTRIB4NUSVPROC VertexAttrib4Nusv = __glGetProcAddress("glVertexAttrib4Nusv"); VertexAttrib4Nusv((GLuint) bswap_CARD32(pc + 0), (const GLushort *) bswap_16_array((uint16_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4bv(GLbyte * pc) { PFNGLVERTEXATTRIB4BVPROC VertexAttrib4bv = __glGetProcAddress("glVertexAttrib4bv"); VertexAttrib4bv((GLuint) bswap_CARD32(pc + 0), (const GLbyte *) (pc + 4)); } void __glXDispSwap_VertexAttrib4dv(GLbyte * pc) { PFNGLVERTEXATTRIB4DVPROC VertexAttrib4dv = __glGetProcAddress("glVertexAttrib4dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif VertexAttrib4dv((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4iv(GLbyte * pc) { PFNGLVERTEXATTRIB4IVPROC VertexAttrib4iv = __glGetProcAddress("glVertexAttrib4iv"); VertexAttrib4iv((GLuint) bswap_CARD32(pc + 0), (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4sv(GLbyte * pc) { PFNGLVERTEXATTRIB4SVPROC VertexAttrib4sv = __glGetProcAddress("glVertexAttrib4sv"); VertexAttrib4sv((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4ubv(GLbyte * pc) { PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv = __glGetProcAddress("glVertexAttrib4ubv"); VertexAttrib4ubv((GLuint) bswap_CARD32(pc + 0), (const GLubyte *) (pc + 4)); } void __glXDispSwap_VertexAttrib4uiv(GLbyte * pc) { PFNGLVERTEXATTRIB4UIVPROC VertexAttrib4uiv = __glGetProcAddress("glVertexAttrib4uiv"); VertexAttrib4uiv((GLuint) bswap_CARD32(pc + 0), (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4usv(GLbyte * pc) { PFNGLVERTEXATTRIB4USVPROC VertexAttrib4usv = __glGetProcAddress("glVertexAttrib4usv"); VertexAttrib4usv((GLuint) bswap_CARD32(pc + 0), (const GLushort *) bswap_16_array((uint16_t *) (pc + 4), 4)); } void __glXDispSwap_ClampColor(GLbyte * pc) { PFNGLCLAMPCOLORPROC ClampColor = __glGetProcAddress("glClampColor"); ClampColor((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4)); } void __glXDispSwap_BindProgramARB(GLbyte * pc) { PFNGLBINDPROGRAMARBPROC BindProgramARB = __glGetProcAddress("glBindProgramARB"); BindProgramARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4)); } int __glXDispSwap_DeleteProgramsARB(__GLXclientState * cl, GLbyte * pc) { PFNGLDELETEPROGRAMSARBPROC DeleteProgramsARB = __glGetProcAddress("glDeleteProgramsARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); DeleteProgramsARB(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0)); error = Success; } return error; } int __glXDispSwap_GenProgramsARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGENPROGRAMSARBPROC GenProgramsARB = __glGetProcAddress("glGenProgramsARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLuint answerBuffer[200]; GLuint *programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (programs == NULL) return BadAlloc; GenProgramsARB(n, programs); (void) bswap_32_array((uint32_t *) programs, n); __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMENVPARAMETERDVARBPROC GetProgramEnvParameterdvARB = __glGetProcAddress("glGetProgramEnvParameterdvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLdouble params[4]; GetProgramEnvParameterdvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), params); (void) bswap_64_array((uint64_t *) params, 4); __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMENVPARAMETERFVARBPROC GetProgramEnvParameterfvARB = __glGetProcAddress("glGetProgramEnvParameterfvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLfloat params[4]; GetProgramEnvParameterfvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), params); (void) bswap_32_array((uint32_t *) params, 4); __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GetProgramLocalParameterdvARB = __glGetProcAddress("glGetProgramLocalParameterdvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLdouble params[4]; GetProgramLocalParameterdvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), params); (void) bswap_64_array((uint64_t *) params, 4); __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GetProgramLocalParameterfvARB = __glGetProcAddress("glGetProgramLocalParameterfvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLfloat params[4]; GetProgramLocalParameterfvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), params); (void) bswap_32_array((uint32_t *) params, 4); __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetProgramivARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMIVARBPROC GetProgramivARB = __glGetProcAddress("glGetProgramivARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = (GLenum) bswap_ENUM(pc + 4); const GLuint compsize = __glGetProgramivARB_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetProgramivARB((GLenum) bswap_ENUM(pc + 0), pname, params); (void) bswap_32_array((uint32_t *) params, compsize); __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_IsProgramARB(__GLXclientState * cl, GLbyte * pc) { PFNGLISPROGRAMARBPROC IsProgramARB = __glGetProcAddress("glIsProgramARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsProgramARB((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc) { PFNGLPROGRAMENVPARAMETER4DVARBPROC ProgramEnvParameter4dvARB = __glGetProcAddress("glProgramEnvParameter4dvARB"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 40); pc -= 4; } #endif ProgramEnvParameter4dvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), 4)); } void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc) { PFNGLPROGRAMENVPARAMETER4FVARBPROC ProgramEnvParameter4fvARB = __glGetProcAddress("glProgramEnvParameter4fvARB"); ProgramEnvParameter4fvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 4)); } void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc) { PFNGLPROGRAMLOCALPARAMETER4DVARBPROC ProgramLocalParameter4dvARB = __glGetProcAddress("glProgramLocalParameter4dvARB"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 40); pc -= 4; } #endif ProgramLocalParameter4dvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), 4)); } void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc) { PFNGLPROGRAMLOCALPARAMETER4FVARBPROC ProgramLocalParameter4fvARB = __glGetProcAddress("glProgramLocalParameter4fvARB"); ProgramLocalParameter4fvARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 4)); } void __glXDispSwap_ProgramStringARB(GLbyte * pc) { PFNGLPROGRAMSTRINGARBPROC ProgramStringARB = __glGetProcAddress("glProgramStringARB"); const GLsizei len = (GLsizei) bswap_CARD32(pc + 8); ProgramStringARB((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), len, (const GLvoid *) (pc + 12)); } void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB1FVARBPROC VertexAttrib1fvARB = __glGetProcAddress("glVertexAttrib1fvARB"); VertexAttrib1fvARB((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 1)); } void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB2FVARBPROC VertexAttrib2fvARB = __glGetProcAddress("glVertexAttrib2fvARB"); VertexAttrib2fvARB((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 2)); } void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB3FVARBPROC VertexAttrib3fvARB = __glGetProcAddress("glVertexAttrib3fvARB"); VertexAttrib3fvARB((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 3)); } void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB4FVARBPROC VertexAttrib4fvARB = __glGetProcAddress("glVertexAttrib4fvARB"); VertexAttrib4fvARB((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_BindFramebuffer(GLbyte * pc) { PFNGLBINDFRAMEBUFFERPROC BindFramebuffer = __glGetProcAddress("glBindFramebuffer"); BindFramebuffer((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4)); } void __glXDispSwap_BindRenderbuffer(GLbyte * pc) { PFNGLBINDRENDERBUFFERPROC BindRenderbuffer = __glGetProcAddress("glBindRenderbuffer"); BindRenderbuffer((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4)); } void __glXDispSwap_BlitFramebuffer(GLbyte * pc) { PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer = __glGetProcAddress("glBlitFramebuffer"); BlitFramebuffer((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLint) bswap_CARD32(pc + 20), (GLint) bswap_CARD32(pc + 24), (GLint) bswap_CARD32(pc + 28), (GLbitfield) bswap_CARD32(pc + 32), (GLenum) bswap_ENUM(pc + 36)); } int __glXDispSwap_CheckFramebufferStatus(__GLXclientState * cl, GLbyte * pc) { PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus = __glGetProcAddress("glCheckFramebufferStatus"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLenum retval; retval = CheckFramebufferStatus((GLenum) bswap_ENUM(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_DeleteFramebuffers(GLbyte * pc) { PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers = __glGetProcAddress("glDeleteFramebuffers"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); DeleteFramebuffers(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0)); } void __glXDispSwap_DeleteRenderbuffers(GLbyte * pc) { PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers = __glGetProcAddress("glDeleteRenderbuffers"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); DeleteRenderbuffers(n, (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 0)); } void __glXDispSwap_FramebufferRenderbuffer(GLbyte * pc) { PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer = __glGetProcAddress("glFramebufferRenderbuffer"); FramebufferRenderbuffer((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLuint) bswap_CARD32(pc + 12)); } void __glXDispSwap_FramebufferTexture1D(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURE1DPROC FramebufferTexture1D = __glGetProcAddress("glFramebufferTexture1D"); FramebufferTexture1D((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLuint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16)); } void __glXDispSwap_FramebufferTexture2D(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D = __glGetProcAddress("glFramebufferTexture2D"); FramebufferTexture2D((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLuint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16)); } void __glXDispSwap_FramebufferTexture3D(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURE3DPROC FramebufferTexture3D = __glGetProcAddress("glFramebufferTexture3D"); FramebufferTexture3D((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLuint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16), (GLint) bswap_CARD32(pc + 20)); } void __glXDispSwap_FramebufferTextureLayer(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURELAYERPROC FramebufferTextureLayer = __glGetProcAddress("glFramebufferTextureLayer"); FramebufferTextureLayer((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLuint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16)); } int __glXDispSwap_GenFramebuffers(__GLXclientState * cl, GLbyte * pc) { PFNGLGENFRAMEBUFFERSPROC GenFramebuffers = __glGetProcAddress("glGenFramebuffers"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLuint answerBuffer[200]; GLuint *framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (framebuffers == NULL) return BadAlloc; GenFramebuffers(n, framebuffers); (void) bswap_32_array((uint32_t *) framebuffers, n); __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDispSwap_GenRenderbuffers(__GLXclientState * cl, GLbyte * pc) { PFNGLGENRENDERBUFFERSPROC GenRenderbuffers = __glGetProcAddress("glGenRenderbuffers"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = (GLsizei) bswap_CARD32(pc + 0); GLuint answerBuffer[200]; GLuint *renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (renderbuffers == NULL) return BadAlloc; GenRenderbuffers(n, renderbuffers); (void) bswap_32_array((uint32_t *) renderbuffers, n); __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0); error = Success; } return error; } void __glXDispSwap_GenerateMipmap(GLbyte * pc) { PFNGLGENERATEMIPMAPPROC GenerateMipmap = __glGetProcAddress("glGenerateMipmap"); GenerateMipmap((GLenum) bswap_ENUM(pc + 0)); } int __glXDispSwap_GetFramebufferAttachmentParameteriv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC GetFramebufferAttachmentParameteriv = __glGetProcAddress("glGetFramebufferAttachmentParameteriv"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLint params[1]; GetFramebufferAttachmentParameteriv((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8), params); (void) bswap_32_array((uint32_t *) params, 1); __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_GetRenderbufferParameteriv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETRENDERBUFFERPARAMETERIVPROC GetRenderbufferParameteriv = __glGetProcAddress("glGetRenderbufferParameteriv"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLint params[1]; GetRenderbufferParameteriv((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), params); (void) bswap_32_array((uint32_t *) params, 1); __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDispSwap_IsFramebuffer(__GLXclientState * cl, GLbyte * pc) { PFNGLISFRAMEBUFFERPROC IsFramebuffer = __glGetProcAddress("glIsFramebuffer"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsFramebuffer((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDispSwap_IsRenderbuffer(__GLXclientState * cl, GLbyte * pc) { PFNGLISRENDERBUFFERPROC IsRenderbuffer = __glGetProcAddress("glIsRenderbuffer"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsRenderbuffer((GLuint) bswap_CARD32(pc + 0)); __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDispSwap_RenderbufferStorage(GLbyte * pc) { PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage = __glGetProcAddress("glRenderbufferStorage"); RenderbufferStorage((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4), (GLsizei) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12)); } void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc) { PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample = __glGetProcAddress("glRenderbufferStorageMultisample"); RenderbufferStorageMultisample((GLenum) bswap_ENUM(pc + 0), (GLsizei) bswap_CARD32(pc + 4), (GLenum) bswap_ENUM(pc + 8), (GLsizei) bswap_CARD32(pc + 12), (GLsizei) bswap_CARD32(pc + 16)); } void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc) { PFNGLSECONDARYCOLOR3FVEXTPROC SecondaryColor3fvEXT = __glGetProcAddress("glSecondaryColor3fvEXT"); SecondaryColor3fvEXT((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3)); } void __glXDispSwap_FogCoordfvEXT(GLbyte * pc) { PFNGLFOGCOORDFVEXTPROC FogCoordfvEXT = __glGetProcAddress("glFogCoordfvEXT"); FogCoordfvEXT((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1)); } void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB1DVNVPROC VertexAttrib1dvNV = __glGetProcAddress("glVertexAttrib1dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 12); pc -= 4; } #endif VertexAttrib1dvNV((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 1)); } void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB1FVNVPROC VertexAttrib1fvNV = __glGetProcAddress("glVertexAttrib1fvNV"); VertexAttrib1fvNV((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 1)); } void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc) { PFNGLVERTEXATTRIB1SVNVPROC VertexAttrib1svNV = __glGetProcAddress("glVertexAttrib1svNV"); VertexAttrib1svNV((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 1)); } void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB2DVNVPROC VertexAttrib2dvNV = __glGetProcAddress("glVertexAttrib2dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif VertexAttrib2dvNV((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 2)); } void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB2FVNVPROC VertexAttrib2fvNV = __glGetProcAddress("glVertexAttrib2fvNV"); VertexAttrib2fvNV((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 2)); } void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc) { PFNGLVERTEXATTRIB2SVNVPROC VertexAttrib2svNV = __glGetProcAddress("glVertexAttrib2svNV"); VertexAttrib2svNV((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 2)); } void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB3DVNVPROC VertexAttrib3dvNV = __glGetProcAddress("glVertexAttrib3dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 28); pc -= 4; } #endif VertexAttrib3dvNV((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 3)); } void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB3FVNVPROC VertexAttrib3fvNV = __glGetProcAddress("glVertexAttrib3fvNV"); VertexAttrib3fvNV((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 3)); } void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc) { PFNGLVERTEXATTRIB3SVNVPROC VertexAttrib3svNV = __glGetProcAddress("glVertexAttrib3svNV"); VertexAttrib3svNV((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 3)); } void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB4DVNVPROC VertexAttrib4dvNV = __glGetProcAddress("glVertexAttrib4dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif VertexAttrib4dvNV((GLuint) bswap_CARD32(pc + 0), (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB4FVNVPROC VertexAttrib4fvNV = __glGetProcAddress("glVertexAttrib4fvNV"); VertexAttrib4fvNV((GLuint) bswap_CARD32(pc + 0), (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc) { PFNGLVERTEXATTRIB4SVNVPROC VertexAttrib4svNV = __glGetProcAddress("glVertexAttrib4svNV"); VertexAttrib4svNV((GLuint) bswap_CARD32(pc + 0), (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 4)); } void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc) { PFNGLVERTEXATTRIB4UBVNVPROC VertexAttrib4ubvNV = __glGetProcAddress("glVertexAttrib4ubvNV"); VertexAttrib4ubvNV((GLuint) bswap_CARD32(pc + 0), (const GLubyte *) (pc + 4)); } void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS1DVNVPROC VertexAttribs1dvNV = __glGetProcAddress("glVertexAttribs1dvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs1dvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS1FVNVPROC VertexAttribs1fvNV = __glGetProcAddress("glVertexAttribs1fvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs1fvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS1SVNVPROC VertexAttribs1svNV = __glGetProcAddress("glVertexAttribs1svNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs1svNV((GLuint) bswap_CARD32(pc + 0), n, (const GLshort *) bswap_16_array((uint16_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS2DVNVPROC VertexAttribs2dvNV = __glGetProcAddress("glVertexAttribs2dvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs2dvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS2FVNVPROC VertexAttribs2fvNV = __glGetProcAddress("glVertexAttribs2fvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs2fvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS2SVNVPROC VertexAttribs2svNV = __glGetProcAddress("glVertexAttribs2svNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs2svNV((GLuint) bswap_CARD32(pc + 0), n, (const GLshort *) bswap_16_array((uint16_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS3DVNVPROC VertexAttribs3dvNV = __glGetProcAddress("glVertexAttribs3dvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs3dvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS3FVNVPROC VertexAttribs3fvNV = __glGetProcAddress("glVertexAttribs3fvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs3fvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS3SVNVPROC VertexAttribs3svNV = __glGetProcAddress("glVertexAttribs3svNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs3svNV((GLuint) bswap_CARD32(pc + 0), n, (const GLshort *) bswap_16_array((uint16_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4DVNVPROC VertexAttribs4dvNV = __glGetProcAddress("glVertexAttribs4dvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs4dvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4FVNVPROC VertexAttribs4fvNV = __glGetProcAddress("glVertexAttribs4fvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs4fvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4SVNVPROC VertexAttribs4svNV = __glGetProcAddress("glVertexAttribs4svNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs4svNV((GLuint) bswap_CARD32(pc + 0), n, (const GLshort *) bswap_16_array((uint16_t *) (pc + 8), 0)); } void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4UBVNVPROC VertexAttribs4ubvNV = __glGetProcAddress("glVertexAttribs4ubvNV"); const GLsizei n = (GLsizei) bswap_CARD32(pc + 4); VertexAttribs4ubvNV((GLuint) bswap_CARD32(pc + 0), n, (const GLubyte *) (pc + 8)); } void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc) { PFNGLACTIVESTENCILFACEEXTPROC ActiveStencilFaceEXT = __glGetProcAddress("glActiveStencilFaceEXT"); ActiveStencilFaceEXT((GLenum) bswap_ENUM(pc + 0)); } xorg-server-1.20.8/glx/xfont.c0000644000175000017500000001322313640201473013103 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "unpack.h" #include "indirect_dispatch.h" #include #include #include #include /* ** Make a single GL bitmap from a single X glyph */ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) { int i, j; int widthPadded; /* width of glyph in bytes, as padded by X */ int allocBytes; /* bytes to allocate to store bitmap */ int w; /* width of glyph in bits */ int h; /* height of glyph */ register unsigned char *pglyph; register unsigned char *p; unsigned char *allocbuf; #define __GL_CHAR_BUF_SIZE 2048 unsigned char buf[__GL_CHAR_BUF_SIZE]; w = GLYPHWIDTHPIXELS(pci); h = GLYPHHEIGHTPIXELS(pci); widthPadded = GLYPHWIDTHBYTESPADDED(pci); /* ** Use the local buf if possible, otherwise malloc. */ allocBytes = widthPadded * h; if (allocBytes <= __GL_CHAR_BUF_SIZE) { p = buf; allocbuf = 0; } else { p = (unsigned char *) malloc(allocBytes); if (!p) return BadAlloc; allocbuf = p; } /* ** We have to reverse the picture, top to bottom */ pglyph = FONTGLYPHBITS(FONTGLYPHS(font), pci) + (h - 1) * widthPadded; for (j = 0; j < h; j++) { for (i = 0; i < widthPadded; i++) { p[i] = pglyph[i]; } pglyph -= widthPadded; p += widthPadded; } glBitmap(w, h, -pci->metrics.leftSideBearing, pci->metrics.descent, pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf); free(allocbuf); return Success; #undef __GL_CHAR_BUF_SIZE } /* ** Create a GL bitmap for each character in the X font. The bitmap is stored ** in a display list. */ static int MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base) { unsigned long i, nglyphs; CARD8 chs[2]; /* the font index we are going after */ CharInfoPtr pci; int rv; /* return value */ int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit; glPixelStorei(GL_UNPACK_SWAP_BYTES, FALSE); glPixelStorei(GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); glPixelStorei(GL_UNPACK_ALIGNMENT, GLYPHPADBYTES); for (i = 0; i < count; i++) { chs[0] = (first + i) >> 8; /* high byte is first byte */ chs[1] = first + i; (*pFont->get_glyphs) (pFont, 1, chs, (FontEncoding) encoding, &nglyphs, &pci); /* ** Define a display list containing just a glBitmap() call. */ glNewList(list_base + i, GL_COMPILE); if (nglyphs) { rv = __glXMakeBitmapFromGlyph(pFont, pci); if (rv) { return rv; } } glEndList(); } return Success; } /************************************************************************/ int __glXDisp_UseXFont(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXUseXFontReq *req; FontPtr pFont; GLuint currentListIndex; __GLXcontext *cx; int error; req = (xGLXUseXFontReq *) pc; cx = __glXForceCurrent(cl, req->contextTag, &error); if (!cx) { return error; } glGetIntegerv(GL_LIST_INDEX, (GLint *) ¤tListIndex); if (currentListIndex != 0) { /* ** A display list is currently being made. It is an error ** to try to make a font during another lists construction. */ client->errorValue = cx->id; return __glXError(GLXBadContextState); } /* ** Font can actually be either the ID of a font or the ID of a GC ** containing a font. */ error = dixLookupFontable(&pFont, req->font, client, DixReadAccess); if (error != Success) return error; return MakeBitmapsFromFont(pFont, req->first, req->count, req->listBase); } xorg-server-1.20.8/glx/glxcmdsswap.c0000644000175000017500000005177213640201473014314 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include "glxutil.h" #include #include #include #include #include "glxext.h" #include "indirect_dispatch.h" #include "indirect_table.h" #include "indirect_util.h" /************************************************************************/ /* ** Byteswapping versions of GLX commands. In most cases they just swap ** the incoming arguments and then call the unswapped routine. For commands ** that have replies, a separate swapping routine for the reply is provided; ** it is called at the end of the unswapped routine. */ int __glXDispSwap_CreateContext(__GLXclientState * cl, GLbyte * pc) { xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->visual); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->shareList); return __glXDisp_CreateContext(cl, pc); } int __glXDispSwap_CreateNewContext(__GLXclientState * cl, GLbyte * pc) { xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->renderType); __GLX_SWAP_INT(&req->shareList); return __glXDisp_CreateNewContext(cl, pc); } int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->renderType); __GLX_SWAP_INT(&req->shareList); return __glXDisp_CreateContextWithConfigSGIX(cl, pc); } int __glXDispSwap_DestroyContext(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); return __glXDisp_DestroyContext(cl, pc); } int __glXDispSwap_MakeCurrent(__GLXclientState * cl, GLbyte * pc) { return BadImplementation; } int __glXDispSwap_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc) { return BadImplementation; } int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) { return BadImplementation; } int __glXDispSwap_IsDirect(__GLXclientState * cl, GLbyte * pc) { xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); return __glXDisp_IsDirect(cl, pc); } int __glXDispSwap_QueryVersion(__GLXclientState * cl, GLbyte * pc) { xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->majorVersion); __GLX_SWAP_INT(&req->minorVersion); return __glXDisp_QueryVersion(cl, pc); } int __glXDispSwap_WaitGL(__GLXclientState * cl, GLbyte * pc) { xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); return __glXDisp_WaitGL(cl, pc); } int __glXDispSwap_WaitX(__GLXclientState * cl, GLbyte * pc) { xGLXWaitXReq *req = (xGLXWaitXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); return __glXDisp_WaitX(cl, pc); } int __glXDispSwap_CopyContext(__GLXclientState * cl, GLbyte * pc) { xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->source); __GLX_SWAP_INT(&req->dest); __GLX_SWAP_INT(&req->mask); return __glXDisp_CopyContext(cl, pc); } int __glXDispSwap_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc) { xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->screen); return __glXDisp_GetVisualConfigs(cl, pc); } int __glXDispSwap_GetFBConfigs(__GLXclientState * cl, GLbyte * pc) { xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->screen); return __glXDisp_GetFBConfigs(cl, pc); } int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq); __GLX_SWAP_INT(&req->screen); return __glXDisp_GetFBConfigsSGIX(cl, pc); } int __glXDispSwap_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) { xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->visual); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); return __glXDisp_CreateGLXPixmap(cl, pc); } int __glXDispSwap_CreatePixmap(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; CARD32 *attribs; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); __GLX_SWAP_INT(&req->numAttribs); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); attribs = (CARD32 *) (req + 1); __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_CreatePixmap(cl, pc); } int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc); } int __glXDispSwap_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->glxpixmap); return __glXDisp_DestroyGLXPixmap(cl, pc); } int __glXDispSwap_DestroyPixmap(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->glxpixmap); return __glXDisp_DestroyGLXPixmap(cl, pc); } int __glXDispSwap_QueryContext(__GLXclientState * cl, GLbyte * pc) { xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->context); return __glXDisp_QueryContext(cl, pc); } int __glXDispSwap_CreatePbuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pbuffer); __GLX_SWAP_INT(&req->numAttribs); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); attribs = (CARD32 *) (req + 1); __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_CreatePbuffer(cl, pc); } int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pbuffer); __GLX_SWAP_INT(&req->width); __GLX_SWAP_INT(&req->height); return __glXDisp_CreateGLXPbufferSGIX(cl, pc); } int __glXDispSwap_DestroyPbuffer(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->pbuffer); return __glXDisp_DestroyPbuffer(cl, pc); } int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); __GLX_SWAP_INT(&req->pbuffer); return __glXDisp_DestroyGLXPbufferSGIX(cl, pc); } int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->numAttribs); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len) return BadLength; attribs = (CARD32 *) (req + 1); __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_ChangeDrawableAttributes(cl, pc); } int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXChangeDrawableAttributesSGIXReq *req = (xGLXChangeDrawableAttributesSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->numAttribs); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3); attribs = (CARD32 *) (req + 1); __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc); } int __glXDispSwap_CreateWindow(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->window); __GLX_SWAP_INT(&req->glxwindow); __GLX_SWAP_INT(&req->numAttribs); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); attribs = (CARD32 *) (req + 1); __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_CreateWindow(cl, pc); } int __glXDispSwap_DestroyWindow(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq); __GLX_SWAP_INT(&req->glxwindow); return __glXDisp_DestroyWindow(cl, pc); } int __glXDispSwap_SwapBuffers(__GLXclientState * cl, GLbyte * pc) { xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->drawable); return __glXDisp_SwapBuffers(cl, pc); } int __glXDispSwap_UseXFont(__GLXclientState * cl, GLbyte * pc) { xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->font); __GLX_SWAP_INT(&req->first); __GLX_SWAP_INT(&req->count); __GLX_SWAP_INT(&req->listBase); return __glXDisp_UseXFont(cl, pc); } int __glXDispSwap_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc) { xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); return __glXDisp_QueryExtensionsString(cl, pc); } int __glXDispSwap_QueryServerString(__GLXclientState * cl, GLbyte * pc) { xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->name); return __glXDisp_QueryServerString(cl, pc); } int __glXDispSwap_ClientInfo(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->major); __GLX_SWAP_INT(&req->minor); __GLX_SWAP_INT(&req->numbytes); return __glXDisp_ClientInfo(cl, pc); } int __glXDispSwap_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); return __glXDisp_QueryContextInfoEXT(cl, pc); } int __glXDispSwap_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXDrawable *drawId; int *buffer; CARD32 *num_attribs; __GLX_DECLARE_SWAP_VARIABLES; if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len) return BadLength; pc += __GLX_VENDPRIV_HDR_SIZE; drawId = ((GLXDrawable *) (pc)); buffer = ((int *) (pc + 4)); num_attribs = ((CARD32 *) (pc + 8)); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(drawId); __GLX_SWAP_INT(buffer); __GLX_SWAP_INT(num_attribs); return __glXDisp_BindTexImageEXT(cl, (GLbyte *) pc); } int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXDrawable *drawId; int *buffer; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); pc += __GLX_VENDPRIV_HDR_SIZE; drawId = ((GLXDrawable *) (pc)); buffer = ((int *) (pc + 4)); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(drawId); __GLX_SWAP_INT(buffer); return __glXDisp_ReleaseTexImageEXT(cl, (GLbyte *) pc); } int __glXDispSwap_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXDrawable *drawId; int *buffer; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); (void) drawId; (void) buffer; pc += __GLX_VENDPRIV_HDR_SIZE; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(pc); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); return __glXDisp_CopySubBufferMESA(cl, pc); } int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *) pc; CARD32 *data; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); data = (CARD32 *) (req + 1); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(data); return __glXDisp_GetDrawableAttributesSGIX(cl, pc); } int __glXDispSwap_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); return __glXDisp_GetDrawableAttributes(cl, pc); } /************************************************************************/ /* ** Render and Renderlarge are not in the GLX API. They are used by the GLX ** client library to send batches of GL rendering commands. */ int __glXDispSwap_Render(__GLXclientState * cl, GLbyte * pc) { return __glXDisp_Render(cl, pc); } /* ** Execute a large rendering request (one that spans multiple X requests). */ int __glXDispSwap_RenderLarge(__GLXclientState * cl, GLbyte * pc) { return __glXDisp_RenderLarge(cl, pc); } /************************************************************************/ /* ** No support is provided for the vendor-private requests other than ** allocating these entry points in the dispatch table. */ int __glXDispSwap_VendorPrivate(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req; GLint vendorcode; __GLXdispatchVendorPrivProcPtr proc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); req = (xGLXVendorPrivateReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); vendorcode = req->vendorCode; proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, vendorcode, 1); if (proc != NULL) { return (*proc) (cl, (GLbyte *) req); } cl->client->errorValue = req->vendorCode; return __glXError(GLXUnsupportedPrivateRequest); } int __glXDispSwap_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateWithReplyReq *req; GLint vendorcode; __GLXdispatchVendorPrivProcPtr proc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateWithReplyReq); req = (xGLXVendorPrivateWithReplyReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); vendorcode = req->vendorCode; proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, vendorcode, 1); if (proc != NULL) { return (*proc) (cl, (GLbyte *) req); } cl->client->errorValue = req->vendorCode; return __glXError(GLXUnsupportedPrivateRequest); } xorg-server-1.20.8/glx/glxbyteorder.h0000644000175000017500000000303213640201473014461 00000000000000/* * (C) Copyright IBM Corporation 2006, 2007 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file glxbyteorder.h * Platform glue for handling byte-ordering issues in GLX protocol. * * \author Ian Romanick */ #if !defined(__GLXBYTEORDER_H__) #define __GLXBYTEORDER_H__ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #endif /* !defined(__GLXBYTEORDER_H__) */ xorg-server-1.20.8/glx/rensize.c0000644000175000017500000003472313640201473013434 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include "GL/glxproto.h" #include "unpack.h" #include "indirect_size.h" #include "indirect_reqsize.h" #define SWAPL(a) \ (((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \ ((a & 0xff00U)<<8) | ((a & 0xffU)<<24)) int __glXMap1dReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum target; GLint order; target = *(GLenum *) (pc + 16); order = *(GLint *) (pc + 20); if (swap) { target = SWAPL(target); order = SWAPL(order); } if (order < 1) return -1; return safe_mul(8, safe_mul(__glMap1d_size(target), order)); } int __glXMap1fReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum target; GLint order; target = *(GLenum *) (pc + 0); order = *(GLint *) (pc + 12); if (swap) { target = SWAPL(target); order = SWAPL(order); } if (order < 1) return -1; return safe_mul(4, safe_mul(__glMap1f_size(target), order)); } static int Map2Size(int k, int majorOrder, int minorOrder) { if (majorOrder < 1 || minorOrder < 1) return -1; return safe_mul(k, safe_mul(majorOrder, minorOrder)); } int __glXMap2dReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum target; GLint uorder, vorder; target = *(GLenum *) (pc + 32); uorder = *(GLint *) (pc + 36); vorder = *(GLint *) (pc + 40); if (swap) { target = SWAPL(target); uorder = SWAPL(uorder); vorder = SWAPL(vorder); } return safe_mul(8, Map2Size(__glMap2d_size(target), uorder, vorder)); } int __glXMap2fReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum target; GLint uorder, vorder; target = *(GLenum *) (pc + 0); uorder = *(GLint *) (pc + 12); vorder = *(GLint *) (pc + 24); if (swap) { target = SWAPL(target); uorder = SWAPL(uorder); vorder = SWAPL(vorder); } return safe_mul(4, Map2Size(__glMap2f_size(target), uorder, vorder)); } /** * Calculate the size of an image. * * The size of an image sent to the server from the client or sent from the * server to the client is calculated. The size is based on the dimensions * of the image, the type of pixel data, padding in the image, and the * alignment requirements of the image. * * \param format Format of the pixels. Same as the \c format parameter * to \c glTexImage1D * \param type Type of the pixel data. Same as the \c type parameter * to \c glTexImage1D * \param target Typically the texture target of the image. If the * target is one of \c GL_PROXY_*, the size returned is * always zero. For uses that do not have a texture target * (e.g, glDrawPixels), zero should be specified. * \param w Width of the image data. Must be >= 1. * \param h Height of the image data. Must be >= 1, even for 1D * images. * \param d Depth of the image data. Must be >= 1, even for 1D or * 2D images. * \param imageHeight If non-zero, defines the true height of a volumetric * image. This value will be used instead of \c h for * calculating the size of the image. * \param rowLength If non-zero, defines the true width of an image. This * value will be used instead of \c w for calculating the * size of the image. * \param skipImages Number of extra layers of image data in a volumtric * image that are to be skipped before the real data. * \param skipRows Number of extra rows of image data in an image that are * to be skipped before the real data. * \param alignment Specifies the alignment for the start of each pixel row * in memory. This value must be one of 1, 2, 4, or 8. * * \returns * The size of the image is returned. If the specified \c format and \c type * are invalid, -1 is returned. If \c target is one of \c GL_PROXY_*, zero * is returned. */ int __glXImageSize(GLenum format, GLenum type, GLenum target, GLsizei w, GLsizei h, GLsizei d, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment) { GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding, imageSize; if (w == 0 || h == 0 || d == 0) return 0; if (w < 0 || h < 0 || d < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } /* proxy targets have no data */ switch (target) { case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_2D: case GL_PROXY_TEXTURE_3D: case GL_PROXY_TEXTURE_4D_SGIS: case GL_PROXY_TEXTURE_CUBE_MAP: case GL_PROXY_TEXTURE_RECTANGLE_ARB: case GL_PROXY_HISTOGRAM: case GL_PROXY_COLOR_TABLE: case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP: return 0; } /* real data has to have real sizes */ if (imageHeight < 0 || rowLength < 0 || skipImages < 0 || skipRows < 0) return -1; if (alignment != 1 && alignment != 2 && alignment != 4 && alignment != 8) return -1; if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = w; } rowSize = bits_to_bytes(groupsPerRow); if (rowSize < 0) return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } return safe_mul(safe_add(h, skipRows), rowSize); } else { switch (format) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: case GL_INTENSITY: case GL_RED_INTEGER_EXT: case GL_GREEN_INTEGER_EXT: case GL_BLUE_INTEGER_EXT: case GL_ALPHA_INTEGER_EXT: case GL_LUMINANCE_INTEGER_EXT: elementsPerGroup = 1; break; case GL_422_EXT: case GL_422_REV_EXT: case GL_422_AVERAGE_EXT: case GL_422_REV_AVERAGE_EXT: case GL_DEPTH_STENCIL_NV: case GL_DEPTH_STENCIL_MESA: case GL_YCBCR_422_APPLE: case GL_YCBCR_MESA: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA_INTEGER_EXT: elementsPerGroup = 2; break; case GL_RGB: case GL_BGR: case GL_RGB_INTEGER_EXT: case GL_BGR_INTEGER_EXT: elementsPerGroup = 3; break; case GL_RGBA: case GL_BGRA: case GL_RGBA_INTEGER_EXT: case GL_BGRA_INTEGER_EXT: case GL_ABGR_EXT: elementsPerGroup = 4; break; default: return -1; } switch (type) { case GL_UNSIGNED_BYTE: case GL_BYTE: bytesPerElement = 1; break; case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: bytesPerElement = 1; elementsPerGroup = 1; break; case GL_UNSIGNED_SHORT: case GL_SHORT: bytesPerElement = 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: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: case GL_UNSIGNED_SHORT_15_1_MESA: case GL_UNSIGNED_SHORT_1_15_REV_MESA: bytesPerElement = 2; elementsPerGroup = 1; break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: bytesPerElement = 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: case GL_UNSIGNED_INT_24_8_NV: case GL_UNSIGNED_INT_24_8_MESA: case GL_UNSIGNED_INT_8_24_REV_MESA: bytesPerElement = 4; elementsPerGroup = 1; break; default: return -1; } /* known safe by the switches above, not checked */ groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = w; } if ((rowSize = safe_mul(groupsPerRow, groupSize)) < 0) return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } if (imageHeight > 0) h = imageHeight; h = safe_add(h, skipRows); imageSize = safe_mul(h, rowSize); return safe_mul(safe_add(d, skipImages), imageSize); } } /* XXX this is used elsewhere - should it be exported from glxserver.h? */ int __glXTypeSize(GLenum enm) { switch (enm) { case GL_BYTE: return sizeof(GLbyte); case GL_UNSIGNED_BYTE: return sizeof(GLubyte); case GL_SHORT: return sizeof(GLshort); case GL_UNSIGNED_SHORT: return sizeof(GLushort); case GL_INT: return sizeof(GLint); case GL_UNSIGNED_INT: return sizeof(GLint); case GL_FLOAT: return sizeof(GLfloat); case GL_DOUBLE: return sizeof(GLdouble); default: return -1; } } int __glXDrawArraysReqSize(const GLbyte * pc, Bool swap, int reqlen) { __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; __GLXdispatchDrawArraysComponentHeader *compHeader; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLint arrayElementSize = 0; GLint x, size; int i; if (swap) { numVertexes = SWAPL(numVertexes); numComponents = SWAPL(numComponents); } pc += sizeof(__GLXdispatchDrawArraysHeader); reqlen -= sizeof(__GLXdispatchDrawArraysHeader); size = safe_mul(sizeof(__GLXdispatchDrawArraysComponentHeader), numComponents); if (size < 0 || reqlen < 0 || reqlen < size) return -1; compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; GLint component = compHeader[i].component; if (swap) { datatype = SWAPL(datatype); numVals = SWAPL(numVals); component = SWAPL(component); } switch (component) { case GL_VERTEX_ARRAY: case GL_COLOR_ARRAY: case GL_TEXTURE_COORD_ARRAY: break; case GL_SECONDARY_COLOR_ARRAY: case GL_NORMAL_ARRAY: if (numVals != 3) { /* bad size */ return -1; } break; case GL_FOG_COORD_ARRAY: case GL_INDEX_ARRAY: if (numVals != 1) { /* bad size */ return -1; } break; case GL_EDGE_FLAG_ARRAY: if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { /* bad size or bad type */ return -1; } break; default: /* unknown component type */ return -1; } x = safe_pad(safe_mul(numVals, __glXTypeSize(datatype))); if ((arrayElementSize = safe_add(arrayElementSize, x)) < 0) return -1; pc += sizeof(__GLXdispatchDrawArraysComponentHeader); } return safe_add(size, safe_mul(numVertexes, arrayElementSize)); } int __glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLint image1size, image2size; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint alignment = hdr->alignment; if (swap) { format = SWAPL(format); type = SWAPL(type); w = SWAPL(w); h = SWAPL(h); rowLength = SWAPL(rowLength); alignment = SWAPL(alignment); } /* XXX Should rowLength be used for either or both image? */ image1size = __glXImageSize(format, type, 0, w, 1, 1, 0, rowLength, 0, 0, alignment); image2size = __glXImageSize(format, type, 0, h, 1, 1, 0, rowLength, 0, 0, alignment); return safe_add(safe_pad(image1size), image2size); } xorg-server-1.20.8/glx/glxext.h0000644000175000017500000000525013640201473013266 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxext_h_ #define _glxext_h_ /* * 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. */ /* doing #include & #include could cause problems * with overlapping definitions, so let's use the easy way */ #ifndef GLX_RGBA_FLOAT_BIT_ARB #define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 #endif #ifndef GLX_RGBA_FLOAT_TYPE_ARB #define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 #endif #ifndef GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT #define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 #endif #ifndef GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT #define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 #endif extern void __glXFlushContextCache(void); extern Bool __glXAddContext(__GLXcontext * cx); extern void __glXErrorCallBack(GLenum code); extern void __glXClearErrorOccured(void); extern GLboolean __glXErrorOccured(void); extern const char GLServerVersion[]; extern int DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap); extern int xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId, XID contextId, GLXContextTag newContextTag); #endif /* _glxext_h_ */ xorg-server-1.20.8/glx/indirect_dispatch.c0000644000175000017500000040146613640201473015437 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include #include "glxserver.h" #include "indirect_size.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxbyteorder.h" #include "indirect_util.h" #include "singlesize.h" #define __GLX_PAD(x) (((x) + 3) & ~3) typedef struct { __GLX_PIXEL_3D_HDR; } __GLXpixel3DHeader; extern GLboolean __glXErrorOccured(void); extern void __glXClearErrorOccured(void); static const unsigned dummy_answer[2] = { 0, 0 }; int __glXDisp_NewList(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glNewList(*(GLuint *) (pc + 0), *(GLenum *) (pc + 4)); error = Success; } return error; } int __glXDisp_EndList(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glEndList(); error = Success; } return error; } void __glXDisp_CallList(GLbyte * pc) { glCallList(*(GLuint *) (pc + 0)); } void __glXDisp_CallLists(GLbyte * pc) { const GLsizei n = *(GLsizei *) (pc + 0); const GLenum type = *(GLenum *) (pc + 4); const GLvoid *lists = (const GLvoid *) (pc + 8); lists = (const GLvoid *) (pc + 8); glCallLists(n, type, lists); } int __glXDisp_DeleteLists(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glDeleteLists(*(GLuint *) (pc + 0), *(GLsizei *) (pc + 4)); error = Success; } return error; } int __glXDisp_GenLists(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLuint retval; retval = glGenLists(*(GLsizei *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_ListBase(GLbyte * pc) { glListBase(*(GLuint *) (pc + 0)); } void __glXDisp_Begin(GLbyte * pc) { glBegin(*(GLenum *) (pc + 0)); } void __glXDisp_Bitmap(GLbyte * pc) { const GLubyte *const bitmap = (const GLubyte *) ((pc + 44)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glBitmap(*(GLsizei *) (pc + 20), *(GLsizei *) (pc + 24), *(GLfloat *) (pc + 28), *(GLfloat *) (pc + 32), *(GLfloat *) (pc + 36), *(GLfloat *) (pc + 40), bitmap); } void __glXDisp_Color3bv(GLbyte * pc) { glColor3bv((const GLbyte *) (pc + 0)); } void __glXDisp_Color3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glColor3dv((const GLdouble *) (pc + 0)); } void __glXDisp_Color3fv(GLbyte * pc) { glColor3fv((const GLfloat *) (pc + 0)); } void __glXDisp_Color3iv(GLbyte * pc) { glColor3iv((const GLint *) (pc + 0)); } void __glXDisp_Color3sv(GLbyte * pc) { glColor3sv((const GLshort *) (pc + 0)); } void __glXDisp_Color3ubv(GLbyte * pc) { glColor3ubv((const GLubyte *) (pc + 0)); } void __glXDisp_Color3uiv(GLbyte * pc) { glColor3uiv((const GLuint *) (pc + 0)); } void __glXDisp_Color3usv(GLbyte * pc) { glColor3usv((const GLushort *) (pc + 0)); } void __glXDisp_Color4bv(GLbyte * pc) { glColor4bv((const GLbyte *) (pc + 0)); } void __glXDisp_Color4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glColor4dv((const GLdouble *) (pc + 0)); } void __glXDisp_Color4fv(GLbyte * pc) { glColor4fv((const GLfloat *) (pc + 0)); } void __glXDisp_Color4iv(GLbyte * pc) { glColor4iv((const GLint *) (pc + 0)); } void __glXDisp_Color4sv(GLbyte * pc) { glColor4sv((const GLshort *) (pc + 0)); } void __glXDisp_Color4ubv(GLbyte * pc) { glColor4ubv((const GLubyte *) (pc + 0)); } void __glXDisp_Color4uiv(GLbyte * pc) { glColor4uiv((const GLuint *) (pc + 0)); } void __glXDisp_Color4usv(GLbyte * pc) { glColor4usv((const GLushort *) (pc + 0)); } void __glXDisp_EdgeFlagv(GLbyte * pc) { glEdgeFlagv((const GLboolean *) (pc + 0)); } void __glXDisp_End(GLbyte * pc) { glEnd(); } void __glXDisp_Indexdv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glIndexdv((const GLdouble *) (pc + 0)); } void __glXDisp_Indexfv(GLbyte * pc) { glIndexfv((const GLfloat *) (pc + 0)); } void __glXDisp_Indexiv(GLbyte * pc) { glIndexiv((const GLint *) (pc + 0)); } void __glXDisp_Indexsv(GLbyte * pc) { glIndexsv((const GLshort *) (pc + 0)); } void __glXDisp_Normal3bv(GLbyte * pc) { glNormal3bv((const GLbyte *) (pc + 0)); } void __glXDisp_Normal3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glNormal3dv((const GLdouble *) (pc + 0)); } void __glXDisp_Normal3fv(GLbyte * pc) { glNormal3fv((const GLfloat *) (pc + 0)); } void __glXDisp_Normal3iv(GLbyte * pc) { glNormal3iv((const GLint *) (pc + 0)); } void __glXDisp_Normal3sv(GLbyte * pc) { glNormal3sv((const GLshort *) (pc + 0)); } void __glXDisp_RasterPos2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glRasterPos2dv((const GLdouble *) (pc + 0)); } void __glXDisp_RasterPos2fv(GLbyte * pc) { glRasterPos2fv((const GLfloat *) (pc + 0)); } void __glXDisp_RasterPos2iv(GLbyte * pc) { glRasterPos2iv((const GLint *) (pc + 0)); } void __glXDisp_RasterPos2sv(GLbyte * pc) { glRasterPos2sv((const GLshort *) (pc + 0)); } void __glXDisp_RasterPos3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glRasterPos3dv((const GLdouble *) (pc + 0)); } void __glXDisp_RasterPos3fv(GLbyte * pc) { glRasterPos3fv((const GLfloat *) (pc + 0)); } void __glXDisp_RasterPos3iv(GLbyte * pc) { glRasterPos3iv((const GLint *) (pc + 0)); } void __glXDisp_RasterPos3sv(GLbyte * pc) { glRasterPos3sv((const GLshort *) (pc + 0)); } void __glXDisp_RasterPos4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glRasterPos4dv((const GLdouble *) (pc + 0)); } void __glXDisp_RasterPos4fv(GLbyte * pc) { glRasterPos4fv((const GLfloat *) (pc + 0)); } void __glXDisp_RasterPos4iv(GLbyte * pc) { glRasterPos4iv((const GLint *) (pc + 0)); } void __glXDisp_RasterPos4sv(GLbyte * pc) { glRasterPos4sv((const GLshort *) (pc + 0)); } void __glXDisp_Rectdv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glRectdv((const GLdouble *) (pc + 0), (const GLdouble *) (pc + 16)); } void __glXDisp_Rectfv(GLbyte * pc) { glRectfv((const GLfloat *) (pc + 0), (const GLfloat *) (pc + 8)); } void __glXDisp_Rectiv(GLbyte * pc) { glRectiv((const GLint *) (pc + 0), (const GLint *) (pc + 8)); } void __glXDisp_Rectsv(GLbyte * pc) { glRectsv((const GLshort *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_TexCoord1dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glTexCoord1dv((const GLdouble *) (pc + 0)); } void __glXDisp_TexCoord1fv(GLbyte * pc) { glTexCoord1fv((const GLfloat *) (pc + 0)); } void __glXDisp_TexCoord1iv(GLbyte * pc) { glTexCoord1iv((const GLint *) (pc + 0)); } void __glXDisp_TexCoord1sv(GLbyte * pc) { glTexCoord1sv((const GLshort *) (pc + 0)); } void __glXDisp_TexCoord2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glTexCoord2dv((const GLdouble *) (pc + 0)); } void __glXDisp_TexCoord2fv(GLbyte * pc) { glTexCoord2fv((const GLfloat *) (pc + 0)); } void __glXDisp_TexCoord2iv(GLbyte * pc) { glTexCoord2iv((const GLint *) (pc + 0)); } void __glXDisp_TexCoord2sv(GLbyte * pc) { glTexCoord2sv((const GLshort *) (pc + 0)); } void __glXDisp_TexCoord3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glTexCoord3dv((const GLdouble *) (pc + 0)); } void __glXDisp_TexCoord3fv(GLbyte * pc) { glTexCoord3fv((const GLfloat *) (pc + 0)); } void __glXDisp_TexCoord3iv(GLbyte * pc) { glTexCoord3iv((const GLint *) (pc + 0)); } void __glXDisp_TexCoord3sv(GLbyte * pc) { glTexCoord3sv((const GLshort *) (pc + 0)); } void __glXDisp_TexCoord4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glTexCoord4dv((const GLdouble *) (pc + 0)); } void __glXDisp_TexCoord4fv(GLbyte * pc) { glTexCoord4fv((const GLfloat *) (pc + 0)); } void __glXDisp_TexCoord4iv(GLbyte * pc) { glTexCoord4iv((const GLint *) (pc + 0)); } void __glXDisp_TexCoord4sv(GLbyte * pc) { glTexCoord4sv((const GLshort *) (pc + 0)); } void __glXDisp_Vertex2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glVertex2dv((const GLdouble *) (pc + 0)); } void __glXDisp_Vertex2fv(GLbyte * pc) { glVertex2fv((const GLfloat *) (pc + 0)); } void __glXDisp_Vertex2iv(GLbyte * pc) { glVertex2iv((const GLint *) (pc + 0)); } void __glXDisp_Vertex2sv(GLbyte * pc) { glVertex2sv((const GLshort *) (pc + 0)); } void __glXDisp_Vertex3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glVertex3dv((const GLdouble *) (pc + 0)); } void __glXDisp_Vertex3fv(GLbyte * pc) { glVertex3fv((const GLfloat *) (pc + 0)); } void __glXDisp_Vertex3iv(GLbyte * pc) { glVertex3iv((const GLint *) (pc + 0)); } void __glXDisp_Vertex3sv(GLbyte * pc) { glVertex3sv((const GLshort *) (pc + 0)); } void __glXDisp_Vertex4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glVertex4dv((const GLdouble *) (pc + 0)); } void __glXDisp_Vertex4fv(GLbyte * pc) { glVertex4fv((const GLfloat *) (pc + 0)); } void __glXDisp_Vertex4iv(GLbyte * pc) { glVertex4iv((const GLint *) (pc + 0)); } void __glXDisp_Vertex4sv(GLbyte * pc) { glVertex4sv((const GLshort *) (pc + 0)); } void __glXDisp_ClipPlane(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif glClipPlane(*(GLenum *) (pc + 32), (const GLdouble *) (pc + 0)); } void __glXDisp_ColorMaterial(GLbyte * pc) { glColorMaterial(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)); } void __glXDisp_CullFace(GLbyte * pc) { glCullFace(*(GLenum *) (pc + 0)); } void __glXDisp_Fogf(GLbyte * pc) { glFogf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)); } void __glXDisp_Fogfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 0); const GLfloat *params; params = (const GLfloat *) (pc + 4); glFogfv(pname, params); } void __glXDisp_Fogi(GLbyte * pc) { glFogi(*(GLenum *) (pc + 0), *(GLint *) (pc + 4)); } void __glXDisp_Fogiv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 0); const GLint *params; params = (const GLint *) (pc + 4); glFogiv(pname, params); } void __glXDisp_FrontFace(GLbyte * pc) { glFrontFace(*(GLenum *) (pc + 0)); } void __glXDisp_Hint(GLbyte * pc) { glHint(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)); } void __glXDisp_Lightf(GLbyte * pc) { glLightf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_Lightfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glLightfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_Lighti(GLbyte * pc) { glLighti(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_Lightiv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glLightiv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_LightModelf(GLbyte * pc) { glLightModelf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)); } void __glXDisp_LightModelfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 0); const GLfloat *params; params = (const GLfloat *) (pc + 4); glLightModelfv(pname, params); } void __glXDisp_LightModeli(GLbyte * pc) { glLightModeli(*(GLenum *) (pc + 0), *(GLint *) (pc + 4)); } void __glXDisp_LightModeliv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 0); const GLint *params; params = (const GLint *) (pc + 4); glLightModeliv(pname, params); } void __glXDisp_LineStipple(GLbyte * pc) { glLineStipple(*(GLint *) (pc + 0), *(GLushort *) (pc + 4)); } void __glXDisp_LineWidth(GLbyte * pc) { glLineWidth(*(GLfloat *) (pc + 0)); } void __glXDisp_Materialf(GLbyte * pc) { glMaterialf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_Materialfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glMaterialfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_Materiali(GLbyte * pc) { glMateriali(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_Materialiv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glMaterialiv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_PointSize(GLbyte * pc) { glPointSize(*(GLfloat *) (pc + 0)); } void __glXDisp_PolygonMode(GLbyte * pc) { glPolygonMode(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)); } void __glXDisp_PolygonStipple(GLbyte * pc) { const GLubyte *const mask = (const GLubyte *) ((pc + 20)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glPolygonStipple(mask); } void __glXDisp_Scissor(GLbyte * pc) { glScissor(*(GLint *) (pc + 0), *(GLint *) (pc + 4), *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12)); } void __glXDisp_ShadeModel(GLbyte * pc) { glShadeModel(*(GLenum *) (pc + 0)); } void __glXDisp_TexParameterf(GLbyte * pc) { glTexParameterf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_TexParameterfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glTexParameterfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_TexParameteri(GLbyte * pc) { glTexParameteri(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_TexParameteriv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glTexParameteriv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_TexImage1D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 52)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage1D(*(GLenum *) (pc + 20), *(GLint *) (pc + 24), *(GLint *) (pc + 28), *(GLsizei *) (pc + 32), *(GLint *) (pc + 40), *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels); } void __glXDisp_TexImage2D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 52)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage2D(*(GLenum *) (pc + 20), *(GLint *) (pc + 24), *(GLint *) (pc + 28), *(GLsizei *) (pc + 32), *(GLsizei *) (pc + 36), *(GLint *) (pc + 40), *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels); } void __glXDisp_TexEnvf(GLbyte * pc) { glTexEnvf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_TexEnvfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glTexEnvfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_TexEnvi(GLbyte * pc) { glTexEnvi(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_TexEnviv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glTexEnviv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_TexGend(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glTexGend(*(GLenum *) (pc + 8), *(GLenum *) (pc + 12), *(GLdouble *) (pc + 0)); } void __glXDisp_TexGendv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLdouble *params; #ifdef __GLX_ALIGN64 const GLuint compsize = __glTexGendv_size(pname); const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif params = (const GLdouble *) (pc + 8); glTexGendv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_TexGenf(GLbyte * pc) { glTexGenf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_TexGenfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glTexGenfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_TexGeni(GLbyte * pc) { glTexGeni(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_TexGeniv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glTexGeniv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_InitNames(GLbyte * pc) { glInitNames(); } void __glXDisp_LoadName(GLbyte * pc) { glLoadName(*(GLuint *) (pc + 0)); } void __glXDisp_PassThrough(GLbyte * pc) { glPassThrough(*(GLfloat *) (pc + 0)); } void __glXDisp_PopName(GLbyte * pc) { glPopName(); } void __glXDisp_PushName(GLbyte * pc) { glPushName(*(GLuint *) (pc + 0)); } void __glXDisp_DrawBuffer(GLbyte * pc) { glDrawBuffer(*(GLenum *) (pc + 0)); } void __glXDisp_Clear(GLbyte * pc) { glClear(*(GLbitfield *) (pc + 0)); } void __glXDisp_ClearAccum(GLbyte * pc) { glClearAccum(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8), *(GLfloat *) (pc + 12)); } void __glXDisp_ClearIndex(GLbyte * pc) { glClearIndex(*(GLfloat *) (pc + 0)); } void __glXDisp_ClearColor(GLbyte * pc) { glClearColor(*(GLclampf *) (pc + 0), *(GLclampf *) (pc + 4), *(GLclampf *) (pc + 8), *(GLclampf *) (pc + 12)); } void __glXDisp_ClearStencil(GLbyte * pc) { glClearStencil(*(GLint *) (pc + 0)); } void __glXDisp_ClearDepth(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glClearDepth(*(GLclampd *) (pc + 0)); } void __glXDisp_StencilMask(GLbyte * pc) { glStencilMask(*(GLuint *) (pc + 0)); } void __glXDisp_ColorMask(GLbyte * pc) { glColorMask(*(GLboolean *) (pc + 0), *(GLboolean *) (pc + 1), *(GLboolean *) (pc + 2), *(GLboolean *) (pc + 3)); } void __glXDisp_DepthMask(GLbyte * pc) { glDepthMask(*(GLboolean *) (pc + 0)); } void __glXDisp_IndexMask(GLbyte * pc) { glIndexMask(*(GLuint *) (pc + 0)); } void __glXDisp_Accum(GLbyte * pc) { glAccum(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)); } void __glXDisp_Disable(GLbyte * pc) { glDisable(*(GLenum *) (pc + 0)); } void __glXDisp_Enable(GLbyte * pc) { glEnable(*(GLenum *) (pc + 0)); } void __glXDisp_PopAttrib(GLbyte * pc) { glPopAttrib(); } void __glXDisp_PushAttrib(GLbyte * pc) { glPushAttrib(*(GLbitfield *) (pc + 0)); } void __glXDisp_MapGrid1d(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif glMapGrid1d(*(GLint *) (pc + 16), *(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8)); } void __glXDisp_MapGrid1f(GLbyte * pc) { glMapGrid1f(*(GLint *) (pc + 0), *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_MapGrid2d(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 40); pc -= 4; } #endif glMapGrid2d(*(GLint *) (pc + 32), *(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8), *(GLint *) (pc + 36), *(GLdouble *) (pc + 16), *(GLdouble *) (pc + 24)); } void __glXDisp_MapGrid2f(GLbyte * pc) { glMapGrid2f(*(GLint *) (pc + 0), *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8), *(GLint *) (pc + 12), *(GLfloat *) (pc + 16), *(GLfloat *) (pc + 20)); } void __glXDisp_EvalCoord1dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif glEvalCoord1dv((const GLdouble *) (pc + 0)); } void __glXDisp_EvalCoord1fv(GLbyte * pc) { glEvalCoord1fv((const GLfloat *) (pc + 0)); } void __glXDisp_EvalCoord2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glEvalCoord2dv((const GLdouble *) (pc + 0)); } void __glXDisp_EvalCoord2fv(GLbyte * pc) { glEvalCoord2fv((const GLfloat *) (pc + 0)); } void __glXDisp_EvalMesh1(GLbyte * pc) { glEvalMesh1(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_EvalPoint1(GLbyte * pc) { glEvalPoint1(*(GLint *) (pc + 0)); } void __glXDisp_EvalMesh2(GLbyte * pc) { glEvalMesh2(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16)); } void __glXDisp_EvalPoint2(GLbyte * pc) { glEvalPoint2(*(GLint *) (pc + 0), *(GLint *) (pc + 4)); } void __glXDisp_AlphaFunc(GLbyte * pc) { glAlphaFunc(*(GLenum *) (pc + 0), *(GLclampf *) (pc + 4)); } void __glXDisp_BlendFunc(GLbyte * pc) { glBlendFunc(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)); } void __glXDisp_LogicOp(GLbyte * pc) { glLogicOp(*(GLenum *) (pc + 0)); } void __glXDisp_StencilFunc(GLbyte * pc) { glStencilFunc(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLuint *) (pc + 8)); } void __glXDisp_StencilOp(GLbyte * pc) { glStencilOp(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8)); } void __glXDisp_DepthFunc(GLbyte * pc) { glDepthFunc(*(GLenum *) (pc + 0)); } void __glXDisp_PixelZoom(GLbyte * pc) { glPixelZoom(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4)); } void __glXDisp_PixelTransferf(GLbyte * pc) { glPixelTransferf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)); } void __glXDisp_PixelTransferi(GLbyte * pc) { glPixelTransferi(*(GLenum *) (pc + 0), *(GLint *) (pc + 4)); } int __glXDisp_PixelStoref(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glPixelStoref(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)); error = Success; } return error; } int __glXDisp_PixelStorei(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { glPixelStorei(*(GLenum *) (pc + 0), *(GLint *) (pc + 4)); error = Success; } return error; } void __glXDisp_PixelMapfv(GLbyte * pc) { const GLsizei mapsize = *(GLsizei *) (pc + 4); glPixelMapfv(*(GLenum *) (pc + 0), mapsize, (const GLfloat *) (pc + 8)); } void __glXDisp_PixelMapuiv(GLbyte * pc) { const GLsizei mapsize = *(GLsizei *) (pc + 4); glPixelMapuiv(*(GLenum *) (pc + 0), mapsize, (const GLuint *) (pc + 8)); } void __glXDisp_PixelMapusv(GLbyte * pc) { const GLsizei mapsize = *(GLsizei *) (pc + 4); glPixelMapusv(*(GLenum *) (pc + 0), mapsize, (const GLushort *) (pc + 8)); } void __glXDisp_ReadBuffer(GLbyte * pc) { glReadBuffer(*(GLenum *) (pc + 0)); } void __glXDisp_CopyPixels(GLbyte * pc) { glCopyPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4), *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12), *(GLenum *) (pc + 16)); } void __glXDisp_DrawPixels(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 36)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glDrawPixels(*(GLsizei *) (pc + 20), *(GLsizei *) (pc + 24), *(GLenum *) (pc + 28), *(GLenum *) (pc + 32), pixels); } int __glXDisp_GetBooleanv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 0); const GLuint compsize = __glGetBooleanv_size(pname); GLboolean answerBuffer[200]; GLboolean *params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetBooleanv(pname, params); __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetClipPlane(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLdouble equation[4]; glGetClipPlane(*(GLenum *) (pc + 0), equation); __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0); error = Success; } return error; } int __glXDisp_GetDoublev(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 0); const GLuint compsize = __glGetDoublev_size(pname); GLdouble answerBuffer[200]; GLdouble *params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetDoublev(pname, params); __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetError(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLenum retval; retval = glGetError(); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDisp_GetFloatv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 0); const GLuint compsize = __glGetFloatv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetFloatv(pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetIntegerv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 0); const GLuint compsize = __glGetIntegerv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetIntegerv(pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetLightfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetLightfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetLightfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetLightiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetLightiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetLightiv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMapdv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = *(GLenum *) (pc + 0); const GLenum query = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMapdv_size(target, query); GLdouble answerBuffer[200]; GLdouble *v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); if (v == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMapdv(target, query, v); __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMapfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = *(GLenum *) (pc + 0); const GLenum query = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMapfv_size(target, query); GLfloat answerBuffer[200]; GLfloat *v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (v == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMapfv(target, query, v); __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMapiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = *(GLenum *) (pc + 0); const GLenum query = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMapiv_size(target, query); GLint answerBuffer[200]; GLint *v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (v == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMapiv(target, query, v); __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMaterialfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMaterialfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMaterialfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMaterialiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMaterialiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMaterialiv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetPixelMapfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum map = *(GLenum *) (pc + 0); const GLuint compsize = __glGetPixelMapfv_size(map); GLfloat answerBuffer[200]; GLfloat *values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (values == NULL) return BadAlloc; __glXClearErrorOccured(); glGetPixelMapfv(map, values); __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetPixelMapuiv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum map = *(GLenum *) (pc + 0); const GLuint compsize = __glGetPixelMapuiv_size(map); GLuint answerBuffer[200]; GLuint *values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (values == NULL) return BadAlloc; __glXClearErrorOccured(); glGetPixelMapuiv(map, values); __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetPixelMapusv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum map = *(GLenum *) (pc + 0); const GLuint compsize = __glGetPixelMapusv_size(map); GLushort answerBuffer[200]; GLushort *values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); if (values == NULL) return BadAlloc; __glXClearErrorOccured(); glGetPixelMapusv(map, values); __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexEnvfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexEnvfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexEnvfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexEnviv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexEnviv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexEnviv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexGendv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexGendv_size(pname); GLdouble answerBuffer[200]; GLdouble *params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexGendv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexGenfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexGenfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexGenfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexGeniv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexGeniv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexGeniv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetTexParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexLevelParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 8); const GLuint compsize = __glGetTexLevelParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexLevelParameterfv(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetTexLevelParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 8); const GLuint compsize = __glGetTexLevelParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetTexLevelParameteriv(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_IsEnabled(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsEnabled(*(GLenum *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDisp_IsList(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsList(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_DepthRange(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 16); pc -= 4; } #endif glDepthRange(*(GLclampd *) (pc + 0), *(GLclampd *) (pc + 8)); } void __glXDisp_Frustum(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 48); pc -= 4; } #endif glFrustum(*(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16), *(GLdouble *) (pc + 24), *(GLdouble *) (pc + 32), *(GLdouble *) (pc + 40)); } void __glXDisp_LoadIdentity(GLbyte * pc) { glLoadIdentity(); } void __glXDisp_LoadMatrixf(GLbyte * pc) { glLoadMatrixf((const GLfloat *) (pc + 0)); } void __glXDisp_LoadMatrixd(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 128); pc -= 4; } #endif glLoadMatrixd((const GLdouble *) (pc + 0)); } void __glXDisp_MatrixMode(GLbyte * pc) { glMatrixMode(*(GLenum *) (pc + 0)); } void __glXDisp_MultMatrixf(GLbyte * pc) { glMultMatrixf((const GLfloat *) (pc + 0)); } void __glXDisp_MultMatrixd(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 128); pc -= 4; } #endif glMultMatrixd((const GLdouble *) (pc + 0)); } void __glXDisp_Ortho(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 48); pc -= 4; } #endif glOrtho(*(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16), *(GLdouble *) (pc + 24), *(GLdouble *) (pc + 32), *(GLdouble *) (pc + 40)); } void __glXDisp_PopMatrix(GLbyte * pc) { glPopMatrix(); } void __glXDisp_PushMatrix(GLbyte * pc) { glPushMatrix(); } void __glXDisp_Rotated(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 32); pc -= 4; } #endif glRotated(*(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16), *(GLdouble *) (pc + 24)); } void __glXDisp_Rotatef(GLbyte * pc) { glRotatef(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8), *(GLfloat *) (pc + 12)); } void __glXDisp_Scaled(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glScaled(*(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16)); } void __glXDisp_Scalef(GLbyte * pc) { glScalef(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_Translated(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif glTranslated(*(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16)); } void __glXDisp_Translatef(GLbyte * pc) { glTranslatef(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_Viewport(GLbyte * pc) { glViewport(*(GLint *) (pc + 0), *(GLint *) (pc + 4), *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12)); } void __glXDisp_BindTexture(GLbyte * pc) { glBindTexture(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4)); } void __glXDisp_Indexubv(GLbyte * pc) { glIndexubv((const GLubyte *) (pc + 0)); } void __glXDisp_PolygonOffset(GLbyte * pc) { glPolygonOffset(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4)); } int __glXDisp_AreTexturesResident(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLboolean retval; GLboolean answerBuffer[200]; GLboolean *residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); if (residences == NULL) return BadAlloc; retval = glAreTexturesResident(n, (const GLuint *) (pc + 4), residences); __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); error = Success; } return error; } int __glXDisp_AreTexturesResidentEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLboolean retval; GLboolean answerBuffer[200]; GLboolean *residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); if (residences == NULL) return BadAlloc; retval = glAreTexturesResident(n, (const GLuint *) (pc + 4), residences); __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); error = Success; } return error; } void __glXDisp_CopyTexImage1D(GLbyte * pc) { glCopyTexImage1D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLsizei *) (pc + 20), *(GLint *) (pc + 24)); } void __glXDisp_CopyTexImage2D(GLbyte * pc) { glCopyTexImage2D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLsizei *) (pc + 20), *(GLsizei *) (pc + 24), *(GLint *) (pc + 28)); } void __glXDisp_CopyTexSubImage1D(GLbyte * pc) { glCopyTexSubImage1D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLsizei *) (pc + 20)); } void __glXDisp_CopyTexSubImage2D(GLbyte * pc) { glCopyTexSubImage2D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLint *) (pc + 20), *(GLsizei *) (pc + 24), *(GLsizei *) (pc + 28)); } int __glXDisp_DeleteTextures(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); glDeleteTextures(n, (const GLuint *) (pc + 4)); error = Success; } return error; } int __glXDisp_DeleteTexturesEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); glDeleteTextures(n, (const GLuint *) (pc + 4)); error = Success; } return error; } int __glXDisp_GenTextures(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLuint answerBuffer[200]; GLuint *textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (textures == NULL) return BadAlloc; glGenTextures(n, textures); __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDisp_GenTexturesEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLuint answerBuffer[200]; GLuint *textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (textures == NULL) return BadAlloc; glGenTextures(n, textures); __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDisp_IsTexture(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsTexture(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDisp_IsTextureEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = glIsTexture(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_PrioritizeTextures(GLbyte * pc) { const GLsizei n = *(GLsizei *) (pc + 0); glPrioritizeTextures(n, (const GLuint *) (pc + 4), (const GLclampf *) (pc + 4)); } void __glXDisp_TexSubImage1D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 56)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage1D(*(GLenum *) (pc + 20), *(GLint *) (pc + 24), *(GLint *) (pc + 28), *(GLsizei *) (pc + 36), *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels); } void __glXDisp_TexSubImage2D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 56)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage2D(*(GLenum *) (pc + 20), *(GLint *) (pc + 24), *(GLint *) (pc + 28), *(GLint *) (pc + 32), *(GLsizei *) (pc + 36), *(GLsizei *) (pc + 40), *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels); } void __glXDisp_BlendColor(GLbyte * pc) { glBlendColor(*(GLclampf *) (pc + 0), *(GLclampf *) (pc + 4), *(GLclampf *) (pc + 8), *(GLclampf *) (pc + 12)); } void __glXDisp_BlendEquation(GLbyte * pc) { glBlendEquation(*(GLenum *) (pc + 0)); } void __glXDisp_ColorTable(GLbyte * pc) { const GLvoid *const table = (const GLvoid *) ((pc + 40)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glColorTable(*(GLenum *) (pc + 20), *(GLenum *) (pc + 24), *(GLsizei *) (pc + 28), *(GLenum *) (pc + 32), *(GLenum *) (pc + 36), table); } void __glXDisp_ColorTableParameterfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glColorTableParameterfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_ColorTableParameteriv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glColorTableParameteriv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_CopyColorTable(GLbyte * pc) { glCopyColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLsizei *) (pc + 16)); } int __glXDisp_GetColorTableParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetColorTableParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetColorTableParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetColorTableParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetColorTableParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetColorTableParameterivSGI(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetColorTableParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetColorTableParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } void __glXDisp_ColorSubTable(GLbyte * pc) { const GLvoid *const data = (const GLvoid *) ((pc + 40)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glColorSubTable(*(GLenum *) (pc + 20), *(GLsizei *) (pc + 24), *(GLsizei *) (pc + 28), *(GLenum *) (pc + 32), *(GLenum *) (pc + 36), data); } void __glXDisp_CopyColorSubTable(GLbyte * pc) { glCopyColorSubTable(*(GLenum *) (pc + 0), *(GLsizei *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLsizei *) (pc + 16)); } void __glXDisp_ConvolutionFilter1D(GLbyte * pc) { const GLvoid *const image = (const GLvoid *) ((pc + 44)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glConvolutionFilter1D(*(GLenum *) (pc + 20), *(GLenum *) (pc + 24), *(GLsizei *) (pc + 28), *(GLenum *) (pc + 36), *(GLenum *) (pc + 40), image); } void __glXDisp_ConvolutionFilter2D(GLbyte * pc) { const GLvoid *const image = (const GLvoid *) ((pc + 44)); __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glConvolutionFilter2D(*(GLenum *) (pc + 20), *(GLenum *) (pc + 24), *(GLsizei *) (pc + 28), *(GLsizei *) (pc + 32), *(GLenum *) (pc + 36), *(GLenum *) (pc + 40), image); } void __glXDisp_ConvolutionParameterf(GLbyte * pc) { glConvolutionParameterf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)); } void __glXDisp_ConvolutionParameterfv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLfloat *params; params = (const GLfloat *) (pc + 8); glConvolutionParameterfv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_ConvolutionParameteri(GLbyte * pc) { glConvolutionParameteri(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8)); } void __glXDisp_ConvolutionParameteriv(GLbyte * pc) { const GLenum pname = *(GLenum *) (pc + 4); const GLint *params; params = (const GLint *) (pc + 8); glConvolutionParameteriv(*(GLenum *) (pc + 0), pname, params); } void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc) { glCopyConvolutionFilter1D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLsizei *) (pc + 16)); } void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc) { glCopyConvolutionFilter2D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLsizei *) (pc + 16), *(GLsizei *) (pc + 20)); } int __glXDisp_GetConvolutionParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetConvolutionParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetConvolutionParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetConvolutionParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetConvolutionParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetConvolutionParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetConvolutionParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetHistogramParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetHistogramParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetHistogramParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetHistogramParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetHistogramParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetHistogramParameterivEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetHistogramParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetHistogramParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMinmaxParameterfv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMinmaxParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMinmaxParameterfv_size(pname); GLfloat answerBuffer[200]; GLfloat *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameterfv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMinmaxParameteriv(__GLXclientState * cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMinmaxParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetMinmaxParameteriv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); glGetMinmaxParameteriv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } void __glXDisp_Histogram(GLbyte * pc) { glHistogram(*(GLenum *) (pc + 0), *(GLsizei *) (pc + 4), *(GLenum *) (pc + 8), *(GLboolean *) (pc + 12)); } void __glXDisp_Minmax(GLbyte * pc) { glMinmax(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLboolean *) (pc + 8)); } void __glXDisp_ResetHistogram(GLbyte * pc) { glResetHistogram(*(GLenum *) (pc + 0)); } void __glXDisp_ResetMinmax(GLbyte * pc) { glResetMinmax(*(GLenum *) (pc + 0)); } void __glXDisp_TexImage3D(GLbyte * pc) { const CARD32 ptr_is_null = *(CARD32 *) (pc + 76); const GLvoid *const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80)); __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage3D(*(GLenum *) (pc + 36), *(GLint *) (pc + 40), *(GLint *) (pc + 44), *(GLsizei *) (pc + 48), *(GLsizei *) (pc + 52), *(GLsizei *) (pc + 56), *(GLint *) (pc + 64), *(GLenum *) (pc + 68), *(GLenum *) (pc + 72), pixels); } void __glXDisp_TexSubImage3D(GLbyte * pc) { const GLvoid *const pixels = (const GLvoid *) ((pc + 88)); __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage3D(*(GLenum *) (pc + 36), *(GLint *) (pc + 40), *(GLint *) (pc + 44), *(GLint *) (pc + 48), *(GLint *) (pc + 52), *(GLsizei *) (pc + 60), *(GLsizei *) (pc + 64), *(GLsizei *) (pc + 68), *(GLenum *) (pc + 76), *(GLenum *) (pc + 80), pixels); } void __glXDisp_CopyTexSubImage3D(GLbyte * pc) { glCopyTexSubImage3D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLint *) (pc + 20), *(GLint *) (pc + 24), *(GLsizei *) (pc + 28), *(GLsizei *) (pc + 32)); } void __glXDisp_ActiveTexture(GLbyte * pc) { glActiveTextureARB(*(GLenum *) (pc + 0)); } void __glXDisp_MultiTexCoord1dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 12); pc -= 4; } #endif glMultiTexCoord1dvARB(*(GLenum *) (pc + 8), (const GLdouble *) (pc + 0)); } void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc) { glMultiTexCoord1fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_MultiTexCoord1iv(GLbyte * pc) { glMultiTexCoord1ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4)); } void __glXDisp_MultiTexCoord1sv(GLbyte * pc) { glMultiTexCoord1svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_MultiTexCoord2dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif glMultiTexCoord2dvARB(*(GLenum *) (pc + 16), (const GLdouble *) (pc + 0)); } void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc) { glMultiTexCoord2fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_MultiTexCoord2iv(GLbyte * pc) { glMultiTexCoord2ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4)); } void __glXDisp_MultiTexCoord2sv(GLbyte * pc) { glMultiTexCoord2svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_MultiTexCoord3dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 28); pc -= 4; } #endif glMultiTexCoord3dvARB(*(GLenum *) (pc + 24), (const GLdouble *) (pc + 0)); } void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc) { glMultiTexCoord3fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_MultiTexCoord3iv(GLbyte * pc) { glMultiTexCoord3ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4)); } void __glXDisp_MultiTexCoord3sv(GLbyte * pc) { glMultiTexCoord3svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_MultiTexCoord4dv(GLbyte * pc) { #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif glMultiTexCoord4dvARB(*(GLenum *) (pc + 32), (const GLdouble *) (pc + 0)); } void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc) { glMultiTexCoord4fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_MultiTexCoord4iv(GLbyte * pc) { glMultiTexCoord4ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4)); } void __glXDisp_MultiTexCoord4sv(GLbyte * pc) { glMultiTexCoord4svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_CompressedTexImage1D(GLbyte * pc) { PFNGLCOMPRESSEDTEXIMAGE1DPROC CompressedTexImage1D = __glGetProcAddress("glCompressedTexImage1D"); const GLsizei imageSize = *(GLsizei *) (pc + 20); CompressedTexImage1D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLsizei *) (pc + 12), *(GLint *) (pc + 16), imageSize, (const GLvoid *) (pc + 24)); } void __glXDisp_CompressedTexImage2D(GLbyte * pc) { PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D = __glGetProcAddress("glCompressedTexImage2D"); const GLsizei imageSize = *(GLsizei *) (pc + 24); CompressedTexImage2D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLsizei *) (pc + 12), *(GLsizei *) (pc + 16), *(GLint *) (pc + 20), imageSize, (const GLvoid *) (pc + 28)); } void __glXDisp_CompressedTexImage3D(GLbyte * pc) { PFNGLCOMPRESSEDTEXIMAGE3DPROC CompressedTexImage3D = __glGetProcAddress("glCompressedTexImage3D"); const GLsizei imageSize = *(GLsizei *) (pc + 28); CompressedTexImage3D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLsizei *) (pc + 12), *(GLsizei *) (pc + 16), *(GLsizei *) (pc + 20), *(GLint *) (pc + 24), imageSize, (const GLvoid *) (pc + 32)); } void __glXDisp_CompressedTexSubImage1D(GLbyte * pc) { PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC CompressedTexSubImage1D = __glGetProcAddress("glCompressedTexSubImage1D"); const GLsizei imageSize = *(GLsizei *) (pc + 20); CompressedTexSubImage1D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLsizei *) (pc + 12), *(GLenum *) (pc + 16), imageSize, (const GLvoid *) (pc + 24)); } void __glXDisp_CompressedTexSubImage2D(GLbyte * pc) { PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC CompressedTexSubImage2D = __glGetProcAddress("glCompressedTexSubImage2D"); const GLsizei imageSize = *(GLsizei *) (pc + 28); CompressedTexSubImage2D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLsizei *) (pc + 16), *(GLsizei *) (pc + 20), *(GLenum *) (pc + 24), imageSize, (const GLvoid *) (pc + 32)); } void __glXDisp_CompressedTexSubImage3D(GLbyte * pc) { PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC CompressedTexSubImage3D = __glGetProcAddress("glCompressedTexSubImage3D"); const GLsizei imageSize = *(GLsizei *) (pc + 36); CompressedTexSubImage3D(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLsizei *) (pc + 20), *(GLsizei *) (pc + 24), *(GLsizei *) (pc + 28), *(GLenum *) (pc + 32), imageSize, (const GLvoid *) (pc + 40)); } void __glXDisp_SampleCoverage(GLbyte * pc) { PFNGLSAMPLECOVERAGEPROC SampleCoverage = __glGetProcAddress("glSampleCoverage"); SampleCoverage(*(GLclampf *) (pc + 0), *(GLboolean *) (pc + 4)); } void __glXDisp_BlendFuncSeparate(GLbyte * pc) { PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate = __glGetProcAddress("glBlendFuncSeparate"); BlendFuncSeparate(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), *(GLenum *) (pc + 12)); } void __glXDisp_FogCoorddv(GLbyte * pc) { PFNGLFOGCOORDDVPROC FogCoorddv = __glGetProcAddress("glFogCoorddv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 8); pc -= 4; } #endif FogCoorddv((const GLdouble *) (pc + 0)); } void __glXDisp_PointParameterf(GLbyte * pc) { PFNGLPOINTPARAMETERFPROC PointParameterf = __glGetProcAddress("glPointParameterf"); PointParameterf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)); } void __glXDisp_PointParameterfv(GLbyte * pc) { PFNGLPOINTPARAMETERFVPROC PointParameterfv = __glGetProcAddress("glPointParameterfv"); const GLenum pname = *(GLenum *) (pc + 0); const GLfloat *params; params = (const GLfloat *) (pc + 4); PointParameterfv(pname, params); } void __glXDisp_PointParameteri(GLbyte * pc) { PFNGLPOINTPARAMETERIPROC PointParameteri = __glGetProcAddress("glPointParameteri"); PointParameteri(*(GLenum *) (pc + 0), *(GLint *) (pc + 4)); } void __glXDisp_PointParameteriv(GLbyte * pc) { PFNGLPOINTPARAMETERIVPROC PointParameteriv = __glGetProcAddress("glPointParameteriv"); const GLenum pname = *(GLenum *) (pc + 0); const GLint *params; params = (const GLint *) (pc + 4); PointParameteriv(pname, params); } void __glXDisp_SecondaryColor3bv(GLbyte * pc) { PFNGLSECONDARYCOLOR3BVPROC SecondaryColor3bv = __glGetProcAddress("glSecondaryColor3bv"); SecondaryColor3bv((const GLbyte *) (pc + 0)); } void __glXDisp_SecondaryColor3dv(GLbyte * pc) { PFNGLSECONDARYCOLOR3DVPROC SecondaryColor3dv = __glGetProcAddress("glSecondaryColor3dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 24); pc -= 4; } #endif SecondaryColor3dv((const GLdouble *) (pc + 0)); } void __glXDisp_SecondaryColor3iv(GLbyte * pc) { PFNGLSECONDARYCOLOR3IVPROC SecondaryColor3iv = __glGetProcAddress("glSecondaryColor3iv"); SecondaryColor3iv((const GLint *) (pc + 0)); } void __glXDisp_SecondaryColor3sv(GLbyte * pc) { PFNGLSECONDARYCOLOR3SVPROC SecondaryColor3sv = __glGetProcAddress("glSecondaryColor3sv"); SecondaryColor3sv((const GLshort *) (pc + 0)); } void __glXDisp_SecondaryColor3ubv(GLbyte * pc) { PFNGLSECONDARYCOLOR3UBVPROC SecondaryColor3ubv = __glGetProcAddress("glSecondaryColor3ubv"); SecondaryColor3ubv((const GLubyte *) (pc + 0)); } void __glXDisp_SecondaryColor3uiv(GLbyte * pc) { PFNGLSECONDARYCOLOR3UIVPROC SecondaryColor3uiv = __glGetProcAddress("glSecondaryColor3uiv"); SecondaryColor3uiv((const GLuint *) (pc + 0)); } void __glXDisp_SecondaryColor3usv(GLbyte * pc) { PFNGLSECONDARYCOLOR3USVPROC SecondaryColor3usv = __glGetProcAddress("glSecondaryColor3usv"); SecondaryColor3usv((const GLushort *) (pc + 0)); } void __glXDisp_WindowPos3fv(GLbyte * pc) { PFNGLWINDOWPOS3FVPROC WindowPos3fv = __glGetProcAddress("glWindowPos3fv"); WindowPos3fv((const GLfloat *) (pc + 0)); } void __glXDisp_BeginQuery(GLbyte * pc) { PFNGLBEGINQUERYPROC BeginQuery = __glGetProcAddress("glBeginQuery"); BeginQuery(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4)); } int __glXDisp_DeleteQueries(__GLXclientState * cl, GLbyte * pc) { PFNGLDELETEQUERIESPROC DeleteQueries = __glGetProcAddress("glDeleteQueries"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); DeleteQueries(n, (const GLuint *) (pc + 4)); error = Success; } return error; } void __glXDisp_EndQuery(GLbyte * pc) { PFNGLENDQUERYPROC EndQuery = __glGetProcAddress("glEndQuery"); EndQuery(*(GLenum *) (pc + 0)); } int __glXDisp_GenQueries(__GLXclientState * cl, GLbyte * pc) { PFNGLGENQUERIESPROC GenQueries = __glGetProcAddress("glGenQueries"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLuint answerBuffer[200]; GLuint *ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (ids == NULL) return BadAlloc; GenQueries(n, ids); __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDisp_GetQueryObjectiv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETQUERYOBJECTIVPROC GetQueryObjectiv = __glGetProcAddress("glGetQueryObjectiv"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetQueryObjectiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetQueryObjectiv(*(GLuint *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetQueryObjectuiv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETQUERYOBJECTUIVPROC GetQueryObjectuiv = __glGetProcAddress("glGetQueryObjectuiv"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetQueryObjectuiv_size(pname); GLuint answerBuffer[200]; GLuint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetQueryObjectuiv(*(GLuint *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetQueryiv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETQUERYIVPROC GetQueryiv = __glGetProcAddress("glGetQueryiv"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetQueryiv_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetQueryiv(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_IsQuery(__GLXclientState * cl, GLbyte * pc) { PFNGLISQUERYPROC IsQuery = __glGetProcAddress("glIsQuery"); xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsQuery(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_BlendEquationSeparate(GLbyte * pc) { PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate = __glGetProcAddress("glBlendEquationSeparate"); BlendEquationSeparate(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)); } void __glXDisp_DrawBuffers(GLbyte * pc) { PFNGLDRAWBUFFERSPROC DrawBuffers = __glGetProcAddress("glDrawBuffers"); const GLsizei n = *(GLsizei *) (pc + 0); DrawBuffers(n, (const GLenum *) (pc + 4)); } void __glXDisp_VertexAttrib1dv(GLbyte * pc) { PFNGLVERTEXATTRIB1DVPROC VertexAttrib1dv = __glGetProcAddress("glVertexAttrib1dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 12); pc -= 4; } #endif VertexAttrib1dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib1sv(GLbyte * pc) { PFNGLVERTEXATTRIB1SVPROC VertexAttrib1sv = __glGetProcAddress("glVertexAttrib1sv"); VertexAttrib1sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib2dv(GLbyte * pc) { PFNGLVERTEXATTRIB2DVPROC VertexAttrib2dv = __glGetProcAddress("glVertexAttrib2dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif VertexAttrib2dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib2sv(GLbyte * pc) { PFNGLVERTEXATTRIB2SVPROC VertexAttrib2sv = __glGetProcAddress("glVertexAttrib2sv"); VertexAttrib2sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib3dv(GLbyte * pc) { PFNGLVERTEXATTRIB3DVPROC VertexAttrib3dv = __glGetProcAddress("glVertexAttrib3dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 28); pc -= 4; } #endif VertexAttrib3dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib3sv(GLbyte * pc) { PFNGLVERTEXATTRIB3SVPROC VertexAttrib3sv = __glGetProcAddress("glVertexAttrib3sv"); VertexAttrib3sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib4Nbv(GLbyte * pc) { PFNGLVERTEXATTRIB4NBVPROC VertexAttrib4Nbv = __glGetProcAddress("glVertexAttrib4Nbv"); VertexAttrib4Nbv(*(GLuint *) (pc + 0), (const GLbyte *) (pc + 4)); } void __glXDisp_VertexAttrib4Niv(GLbyte * pc) { PFNGLVERTEXATTRIB4NIVPROC VertexAttrib4Niv = __glGetProcAddress("glVertexAttrib4Niv"); VertexAttrib4Niv(*(GLuint *) (pc + 0), (const GLint *) (pc + 4)); } void __glXDisp_VertexAttrib4Nsv(GLbyte * pc) { PFNGLVERTEXATTRIB4NSVPROC VertexAttrib4Nsv = __glGetProcAddress("glVertexAttrib4Nsv"); VertexAttrib4Nsv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib4Nubv(GLbyte * pc) { PFNGLVERTEXATTRIB4NUBVPROC VertexAttrib4Nubv = __glGetProcAddress("glVertexAttrib4Nubv"); VertexAttrib4Nubv(*(GLuint *) (pc + 0), (const GLubyte *) (pc + 4)); } void __glXDisp_VertexAttrib4Nuiv(GLbyte * pc) { PFNGLVERTEXATTRIB4NUIVPROC VertexAttrib4Nuiv = __glGetProcAddress("glVertexAttrib4Nuiv"); VertexAttrib4Nuiv(*(GLuint *) (pc + 0), (const GLuint *) (pc + 4)); } void __glXDisp_VertexAttrib4Nusv(GLbyte * pc) { PFNGLVERTEXATTRIB4NUSVPROC VertexAttrib4Nusv = __glGetProcAddress("glVertexAttrib4Nusv"); VertexAttrib4Nusv(*(GLuint *) (pc + 0), (const GLushort *) (pc + 4)); } void __glXDisp_VertexAttrib4bv(GLbyte * pc) { PFNGLVERTEXATTRIB4BVPROC VertexAttrib4bv = __glGetProcAddress("glVertexAttrib4bv"); VertexAttrib4bv(*(GLuint *) (pc + 0), (const GLbyte *) (pc + 4)); } void __glXDisp_VertexAttrib4dv(GLbyte * pc) { PFNGLVERTEXATTRIB4DVPROC VertexAttrib4dv = __glGetProcAddress("glVertexAttrib4dv"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif VertexAttrib4dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib4iv(GLbyte * pc) { PFNGLVERTEXATTRIB4IVPROC VertexAttrib4iv = __glGetProcAddress("glVertexAttrib4iv"); VertexAttrib4iv(*(GLuint *) (pc + 0), (const GLint *) (pc + 4)); } void __glXDisp_VertexAttrib4sv(GLbyte * pc) { PFNGLVERTEXATTRIB4SVPROC VertexAttrib4sv = __glGetProcAddress("glVertexAttrib4sv"); VertexAttrib4sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib4ubv(GLbyte * pc) { PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv = __glGetProcAddress("glVertexAttrib4ubv"); VertexAttrib4ubv(*(GLuint *) (pc + 0), (const GLubyte *) (pc + 4)); } void __glXDisp_VertexAttrib4uiv(GLbyte * pc) { PFNGLVERTEXATTRIB4UIVPROC VertexAttrib4uiv = __glGetProcAddress("glVertexAttrib4uiv"); VertexAttrib4uiv(*(GLuint *) (pc + 0), (const GLuint *) (pc + 4)); } void __glXDisp_VertexAttrib4usv(GLbyte * pc) { PFNGLVERTEXATTRIB4USVPROC VertexAttrib4usv = __glGetProcAddress("glVertexAttrib4usv"); VertexAttrib4usv(*(GLuint *) (pc + 0), (const GLushort *) (pc + 4)); } void __glXDisp_ClampColor(GLbyte * pc) { PFNGLCLAMPCOLORPROC ClampColor = __glGetProcAddress("glClampColor"); ClampColor(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)); } void __glXDisp_BindProgramARB(GLbyte * pc) { PFNGLBINDPROGRAMARBPROC BindProgramARB = __glGetProcAddress("glBindProgramARB"); BindProgramARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4)); } int __glXDisp_DeleteProgramsARB(__GLXclientState * cl, GLbyte * pc) { PFNGLDELETEPROGRAMSARBPROC DeleteProgramsARB = __glGetProcAddress("glDeleteProgramsARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); DeleteProgramsARB(n, (const GLuint *) (pc + 4)); error = Success; } return error; } int __glXDisp_GenProgramsARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGENPROGRAMSARBPROC GenProgramsARB = __glGetProcAddress("glGenProgramsARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLuint answerBuffer[200]; GLuint *programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (programs == NULL) return BadAlloc; GenProgramsARB(n, programs); __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDisp_GetProgramEnvParameterdvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMENVPARAMETERDVARBPROC GetProgramEnvParameterdvARB = __glGetProcAddress("glGetProgramEnvParameterdvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLdouble params[4]; GetProgramEnvParameterdvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), params); __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetProgramEnvParameterfvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMENVPARAMETERFVARBPROC GetProgramEnvParameterfvARB = __glGetProcAddress("glGetProgramEnvParameterfvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLfloat params[4]; GetProgramEnvParameterfvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), params); __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetProgramLocalParameterdvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GetProgramLocalParameterdvARB = __glGetProcAddress("glGetProgramLocalParameterdvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLdouble params[4]; GetProgramLocalParameterdvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), params); __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GetProgramLocalParameterfvARB = __glGetProcAddress("glGetProgramLocalParameterfvARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLfloat params[4]; GetProgramLocalParameterfvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), params); __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetProgramivARB(__GLXclientState * cl, GLbyte * pc) { PFNGLGETPROGRAMIVARBPROC GetProgramivARB = __glGetProcAddress("glGetProgramivARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLenum pname = *(GLenum *) (pc + 4); const GLuint compsize = __glGetProgramivARB_size(pname); GLint answerBuffer[200]; GLint *params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); if (params == NULL) return BadAlloc; __glXClearErrorOccured(); GetProgramivARB(*(GLenum *) (pc + 0), pname, params); __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_IsProgramARB(__GLXclientState * cl, GLbyte * pc) { PFNGLISPROGRAMARBPROC IsProgramARB = __glGetProcAddress("glIsProgramARB"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsProgramARB(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc) { PFNGLPROGRAMENVPARAMETER4DVARBPROC ProgramEnvParameter4dvARB = __glGetProcAddress("glProgramEnvParameter4dvARB"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 40); pc -= 4; } #endif ProgramEnvParameter4dvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), (const GLdouble *) (pc + 8)); } void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc) { PFNGLPROGRAMENVPARAMETER4FVARBPROC ProgramEnvParameter4fvARB = __glGetProcAddress("glProgramEnvParameter4fvARB"); ProgramEnvParameter4fvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), (const GLfloat *) (pc + 8)); } void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc) { PFNGLPROGRAMLOCALPARAMETER4DVARBPROC ProgramLocalParameter4dvARB = __glGetProcAddress("glProgramLocalParameter4dvARB"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 40); pc -= 4; } #endif ProgramLocalParameter4dvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), (const GLdouble *) (pc + 8)); } void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc) { PFNGLPROGRAMLOCALPARAMETER4FVARBPROC ProgramLocalParameter4fvARB = __glGetProcAddress("glProgramLocalParameter4fvARB"); ProgramLocalParameter4fvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4), (const GLfloat *) (pc + 8)); } void __glXDisp_ProgramStringARB(GLbyte * pc) { PFNGLPROGRAMSTRINGARBPROC ProgramStringARB = __glGetProcAddress("glProgramStringARB"); const GLsizei len = *(GLsizei *) (pc + 8); ProgramStringARB(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), len, (const GLvoid *) (pc + 12)); } void __glXDisp_VertexAttrib1fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB1FVARBPROC VertexAttrib1fvARB = __glGetProcAddress("glVertexAttrib1fvARB"); VertexAttrib1fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib2fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB2FVARBPROC VertexAttrib2fvARB = __glGetProcAddress("glVertexAttrib2fvARB"); VertexAttrib2fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib3fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB3FVARBPROC VertexAttrib3fvARB = __glGetProcAddress("glVertexAttrib3fvARB"); VertexAttrib3fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib4fvARB(GLbyte * pc) { PFNGLVERTEXATTRIB4FVARBPROC VertexAttrib4fvARB = __glGetProcAddress("glVertexAttrib4fvARB"); VertexAttrib4fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_BindFramebuffer(GLbyte * pc) { PFNGLBINDFRAMEBUFFERPROC BindFramebuffer = __glGetProcAddress("glBindFramebuffer"); BindFramebuffer(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4)); } void __glXDisp_BindRenderbuffer(GLbyte * pc) { PFNGLBINDRENDERBUFFERPROC BindRenderbuffer = __glGetProcAddress("glBindRenderbuffer"); BindRenderbuffer(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4)); } void __glXDisp_BlitFramebuffer(GLbyte * pc) { PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer = __glGetProcAddress("glBlitFramebuffer"); BlitFramebuffer(*(GLint *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16), *(GLint *) (pc + 20), *(GLint *) (pc + 24), *(GLint *) (pc + 28), *(GLbitfield *) (pc + 32), *(GLenum *) (pc + 36)); } int __glXDisp_CheckFramebufferStatus(__GLXclientState * cl, GLbyte * pc) { PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus = __glGetProcAddress("glCheckFramebufferStatus"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLenum retval; retval = CheckFramebufferStatus(*(GLenum *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_DeleteFramebuffers(GLbyte * pc) { PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers = __glGetProcAddress("glDeleteFramebuffers"); const GLsizei n = *(GLsizei *) (pc + 0); DeleteFramebuffers(n, (const GLuint *) (pc + 4)); } void __glXDisp_DeleteRenderbuffers(GLbyte * pc) { PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers = __glGetProcAddress("glDeleteRenderbuffers"); const GLsizei n = *(GLsizei *) (pc + 0); DeleteRenderbuffers(n, (const GLuint *) (pc + 4)); } void __glXDisp_FramebufferRenderbuffer(GLbyte * pc) { PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer = __glGetProcAddress("glFramebufferRenderbuffer"); FramebufferRenderbuffer(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), *(GLuint *) (pc + 12)); } void __glXDisp_FramebufferTexture1D(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURE1DPROC FramebufferTexture1D = __glGetProcAddress("glFramebufferTexture1D"); FramebufferTexture1D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), *(GLuint *) (pc + 12), *(GLint *) (pc + 16)); } void __glXDisp_FramebufferTexture2D(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D = __glGetProcAddress("glFramebufferTexture2D"); FramebufferTexture2D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), *(GLuint *) (pc + 12), *(GLint *) (pc + 16)); } void __glXDisp_FramebufferTexture3D(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURE3DPROC FramebufferTexture3D = __glGetProcAddress("glFramebufferTexture3D"); FramebufferTexture3D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), *(GLuint *) (pc + 12), *(GLint *) (pc + 16), *(GLint *) (pc + 20)); } void __glXDisp_FramebufferTextureLayer(GLbyte * pc) { PFNGLFRAMEBUFFERTEXTURELAYERPROC FramebufferTextureLayer = __glGetProcAddress("glFramebufferTextureLayer"); FramebufferTextureLayer(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLuint *) (pc + 8), *(GLint *) (pc + 12), *(GLint *) (pc + 16)); } int __glXDisp_GenFramebuffers(__GLXclientState * cl, GLbyte * pc) { PFNGLGENFRAMEBUFFERSPROC GenFramebuffers = __glGetProcAddress("glGenFramebuffers"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLuint answerBuffer[200]; GLuint *framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (framebuffers == NULL) return BadAlloc; GenFramebuffers(n, framebuffers); __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0); error = Success; } return error; } int __glXDisp_GenRenderbuffers(__GLXclientState * cl, GLbyte * pc) { PFNGLGENRENDERBUFFERSPROC GenRenderbuffers = __glGetProcAddress("glGenRenderbuffers"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { const GLsizei n = *(GLsizei *) (pc + 0); GLuint answerBuffer[200]; GLuint *renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); if (renderbuffers == NULL) return BadAlloc; GenRenderbuffers(n, renderbuffers); __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0); error = Success; } return error; } void __glXDisp_GenerateMipmap(GLbyte * pc) { PFNGLGENERATEMIPMAPPROC GenerateMipmap = __glGetProcAddress("glGenerateMipmap"); GenerateMipmap(*(GLenum *) (pc + 0)); } int __glXDisp_GetFramebufferAttachmentParameteriv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC GetFramebufferAttachmentParameteriv = __glGetProcAddress("glGetFramebufferAttachmentParameteriv"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLint params[1]; GetFramebufferAttachmentParameteriv(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), params); __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_GetRenderbufferParameteriv(__GLXclientState * cl, GLbyte * pc) { PFNGLGETRENDERBUFFERPARAMETERIVPROC GetRenderbufferParameteriv = __glGetProcAddress("glGetRenderbufferParameteriv"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLint params[1]; GetRenderbufferParameteriv(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), params); __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); error = Success; } return error; } int __glXDisp_IsFramebuffer(__GLXclientState * cl, GLbyte * pc) { PFNGLISFRAMEBUFFERPROC IsFramebuffer = __glGetProcAddress("glIsFramebuffer"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsFramebuffer(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } int __glXDisp_IsRenderbuffer(__GLXclientState * cl, GLbyte * pc) { PFNGLISRENDERBUFFERPROC IsRenderbuffer = __glGetProcAddress("glIsRenderbuffer"); xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLboolean retval; retval = IsRenderbuffer(*(GLuint *) (pc + 0)); __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); error = Success; } return error; } void __glXDisp_RenderbufferStorage(GLbyte * pc) { PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage = __glGetProcAddress("glRenderbufferStorage"); RenderbufferStorage(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12)); } void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc) { PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample = __glGetProcAddress("glRenderbufferStorageMultisample"); RenderbufferStorageMultisample(*(GLenum *) (pc + 0), *(GLsizei *) (pc + 4), *(GLenum *) (pc + 8), *(GLsizei *) (pc + 12), *(GLsizei *) (pc + 16)); } void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc) { PFNGLSECONDARYCOLOR3FVEXTPROC SecondaryColor3fvEXT = __glGetProcAddress("glSecondaryColor3fvEXT"); SecondaryColor3fvEXT((const GLfloat *) (pc + 0)); } void __glXDisp_FogCoordfvEXT(GLbyte * pc) { PFNGLFOGCOORDFVEXTPROC FogCoordfvEXT = __glGetProcAddress("glFogCoordfvEXT"); FogCoordfvEXT((const GLfloat *) (pc + 0)); } void __glXDisp_VertexAttrib1dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB1DVNVPROC VertexAttrib1dvNV = __glGetProcAddress("glVertexAttrib1dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 12); pc -= 4; } #endif VertexAttrib1dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib1fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB1FVNVPROC VertexAttrib1fvNV = __glGetProcAddress("glVertexAttrib1fvNV"); VertexAttrib1fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib1svNV(GLbyte * pc) { PFNGLVERTEXATTRIB1SVNVPROC VertexAttrib1svNV = __glGetProcAddress("glVertexAttrib1svNV"); VertexAttrib1svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib2dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB2DVNVPROC VertexAttrib2dvNV = __glGetProcAddress("glVertexAttrib2dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 20); pc -= 4; } #endif VertexAttrib2dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib2fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB2FVNVPROC VertexAttrib2fvNV = __glGetProcAddress("glVertexAttrib2fvNV"); VertexAttrib2fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib2svNV(GLbyte * pc) { PFNGLVERTEXATTRIB2SVNVPROC VertexAttrib2svNV = __glGetProcAddress("glVertexAttrib2svNV"); VertexAttrib2svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib3dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB3DVNVPROC VertexAttrib3dvNV = __glGetProcAddress("glVertexAttrib3dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 28); pc -= 4; } #endif VertexAttrib3dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib3fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB3FVNVPROC VertexAttrib3fvNV = __glGetProcAddress("glVertexAttrib3fvNV"); VertexAttrib3fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib3svNV(GLbyte * pc) { PFNGLVERTEXATTRIB3SVNVPROC VertexAttrib3svNV = __glGetProcAddress("glVertexAttrib3svNV"); VertexAttrib3svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib4dvNV(GLbyte * pc) { PFNGLVERTEXATTRIB4DVNVPROC VertexAttrib4dvNV = __glGetProcAddress("glVertexAttrib4dvNV"); #ifdef __GLX_ALIGN64 if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, 36); pc -= 4; } #endif VertexAttrib4dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4)); } void __glXDisp_VertexAttrib4fvNV(GLbyte * pc) { PFNGLVERTEXATTRIB4FVNVPROC VertexAttrib4fvNV = __glGetProcAddress("glVertexAttrib4fvNV"); VertexAttrib4fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4)); } void __glXDisp_VertexAttrib4svNV(GLbyte * pc) { PFNGLVERTEXATTRIB4SVNVPROC VertexAttrib4svNV = __glGetProcAddress("glVertexAttrib4svNV"); VertexAttrib4svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4)); } void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc) { PFNGLVERTEXATTRIB4UBVNVPROC VertexAttrib4ubvNV = __glGetProcAddress("glVertexAttrib4ubvNV"); VertexAttrib4ubvNV(*(GLuint *) (pc + 0), (const GLubyte *) (pc + 4)); } void __glXDisp_VertexAttribs1dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS1DVNVPROC VertexAttribs1dvNV = __glGetProcAddress("glVertexAttribs1dvNV"); const GLsizei n = *(GLsizei *) (pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs1dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8)); } void __glXDisp_VertexAttribs1fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS1FVNVPROC VertexAttribs1fvNV = __glGetProcAddress("glVertexAttribs1fvNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs1fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8)); } void __glXDisp_VertexAttribs1svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS1SVNVPROC VertexAttribs1svNV = __glGetProcAddress("glVertexAttribs1svNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs1svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8)); } void __glXDisp_VertexAttribs2dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS2DVNVPROC VertexAttribs2dvNV = __glGetProcAddress("glVertexAttribs2dvNV"); const GLsizei n = *(GLsizei *) (pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs2dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8)); } void __glXDisp_VertexAttribs2fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS2FVNVPROC VertexAttribs2fvNV = __glGetProcAddress("glVertexAttribs2fvNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs2fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8)); } void __glXDisp_VertexAttribs2svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS2SVNVPROC VertexAttribs2svNV = __glGetProcAddress("glVertexAttribs2svNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs2svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8)); } void __glXDisp_VertexAttribs3dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS3DVNVPROC VertexAttribs3dvNV = __glGetProcAddress("glVertexAttribs3dvNV"); const GLsizei n = *(GLsizei *) (pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs3dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8)); } void __glXDisp_VertexAttribs3fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS3FVNVPROC VertexAttribs3fvNV = __glGetProcAddress("glVertexAttribs3fvNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs3fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8)); } void __glXDisp_VertexAttribs3svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS3SVNVPROC VertexAttribs3svNV = __glGetProcAddress("glVertexAttribs3svNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs3svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8)); } void __glXDisp_VertexAttribs4dvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4DVNVPROC VertexAttribs4dvNV = __glGetProcAddress("glVertexAttribs4dvNV"); const GLsizei n = *(GLsizei *) (pc + 4); #ifdef __GLX_ALIGN64 const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; if ((unsigned long) (pc) & 7) { (void) memmove(pc - 4, pc, cmdlen); pc -= 4; } #endif VertexAttribs4dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8)); } void __glXDisp_VertexAttribs4fvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4FVNVPROC VertexAttribs4fvNV = __glGetProcAddress("glVertexAttribs4fvNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs4fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8)); } void __glXDisp_VertexAttribs4svNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4SVNVPROC VertexAttribs4svNV = __glGetProcAddress("glVertexAttribs4svNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs4svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8)); } void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc) { PFNGLVERTEXATTRIBS4UBVNVPROC VertexAttribs4ubvNV = __glGetProcAddress("glVertexAttribs4ubvNV"); const GLsizei n = *(GLsizei *) (pc + 4); VertexAttribs4ubvNV(*(GLuint *) (pc + 0), n, (const GLubyte *) (pc + 8)); } void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc) { PFNGLACTIVESTENCILFACEEXTPROC ActiveStencilFaceEXT = __glGetProcAddress("glActiveStencilFaceEXT"); ActiveStencilFaceEXT(*(GLenum *) (pc + 0)); } xorg-server-1.20.8/glx/vndservervendor.h0000644000175000017500000000421513640201473015207 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #ifndef VND_SERVER_VENDOR_H #define VND_SERVER_VENDOR_H #include #include "glxvndabi.h" #include "list.h" #if defined(__cplusplus) extern "C" { #endif /** * Info related to a single vendor library. */ struct GlxServerVendorRec { GlxServerImports glxvc; struct xorg_list entry; }; /** * A linked list of vendor libraries. * * Note that this list only includes vendor libraries that were successfully * initialized. */ extern struct xorg_list GlxVendorList; GlxServerVendor *GlxCreateVendor(const GlxServerImports *imports); void GlxDestroyVendor(GlxServerVendor *vendor); void GlxVendorExtensionReset(const ExtensionEntry *extEntry); #if defined(__cplusplus) } #endif #endif // VND_SERVER_VENDOR_H xorg-server-1.20.8/glx/vnd_dispatch_stubs.c0000644000175000017500000003676113640201473015647 00000000000000 #include #include #include "vndserver.h" // HACK: The opcode in old glxproto.h has a typo in it. #if !defined(X_GLXCreateContextAttribsARB) #define X_GLXCreateContextAttribsARB X_GLXCreateContextAtrribsARB #endif static int dispatch_Render(ClientPtr client) { REQUEST(xGLXRenderReq); CARD32 contextTag; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); contextTag = GlxCheckSwap(client, stuff->contextTag); vendor = glxServer.getContextTag(client, contextTag); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = contextTag; return GlxErrorBase + GLXBadContextTag; } } static int dispatch_RenderLarge(ClientPtr client) { REQUEST(xGLXRenderLargeReq); CARD32 contextTag; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); contextTag = GlxCheckSwap(client, stuff->contextTag); vendor = glxServer.getContextTag(client, contextTag); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = contextTag; return GlxErrorBase + GLXBadContextTag; } } static int dispatch_CreateContext(ClientPtr client) { REQUEST(xGLXCreateContextReq); CARD32 screen, context; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); context = GlxCheckSwap(client, stuff->context); LEGAL_NEW_RESOURCE(context, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(context, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(context); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_DestroyContext(ClientPtr client) { REQUEST(xGLXDestroyContextReq); CARD32 context; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); context = GlxCheckSwap(client, stuff->context); vendor = glxServer.getXIDMap(context); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); if (ret == Success) { glxServer.removeXIDMap(context); } return ret; } else { client->errorValue = context; return GlxErrorBase + GLXBadContext; } } static int dispatch_WaitGL(ClientPtr client) { REQUEST(xGLXWaitGLReq); CARD32 contextTag; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); contextTag = GlxCheckSwap(client, stuff->contextTag); vendor = glxServer.getContextTag(client, contextTag); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = contextTag; return GlxErrorBase + GLXBadContextTag; } } static int dispatch_WaitX(ClientPtr client) { REQUEST(xGLXWaitXReq); CARD32 contextTag; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); contextTag = GlxCheckSwap(client, stuff->contextTag); vendor = glxServer.getContextTag(client, contextTag); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = contextTag; return GlxErrorBase + GLXBadContextTag; } } static int dispatch_UseXFont(ClientPtr client) { REQUEST(xGLXUseXFontReq); CARD32 contextTag; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); contextTag = GlxCheckSwap(client, stuff->contextTag); vendor = glxServer.getContextTag(client, contextTag); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = contextTag; return GlxErrorBase + GLXBadContextTag; } } static int dispatch_CreateGLXPixmap(ClientPtr client) { REQUEST(xGLXCreateGLXPixmapReq); CARD32 screen, glxpixmap; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); LEGAL_NEW_RESOURCE(glxpixmap, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(glxpixmap, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(glxpixmap); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_GetVisualConfigs(ClientPtr client) { REQUEST(xGLXGetVisualConfigsReq); CARD32 screen; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_DestroyGLXPixmap(ClientPtr client) { REQUEST(xGLXDestroyGLXPixmapReq); CARD32 glxpixmap; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); vendor = glxServer.getXIDMap(glxpixmap); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = glxpixmap; return GlxErrorBase + GLXBadPixmap; } } static int dispatch_QueryExtensionsString(ClientPtr client) { REQUEST(xGLXQueryExtensionsStringReq); CARD32 screen; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_QueryServerString(ClientPtr client) { REQUEST(xGLXQueryServerStringReq); CARD32 screen; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_ChangeDrawableAttributes(ClientPtr client) { REQUEST(xGLXChangeDrawableAttributesReq); CARD32 drawable; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); drawable = GlxCheckSwap(client, stuff->drawable); vendor = glxServer.getXIDMap(drawable); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = drawable; return BadDrawable; } } static int dispatch_CreateNewContext(ClientPtr client) { REQUEST(xGLXCreateNewContextReq); CARD32 screen, context; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); context = GlxCheckSwap(client, stuff->context); LEGAL_NEW_RESOURCE(context, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(context, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(context); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_CreatePbuffer(ClientPtr client) { REQUEST(xGLXCreatePbufferReq); CARD32 screen, pbuffer; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); screen = GlxCheckSwap(client, stuff->screen); pbuffer = GlxCheckSwap(client, stuff->pbuffer); LEGAL_NEW_RESOURCE(pbuffer, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(pbuffer, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(pbuffer); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_CreatePixmap(ClientPtr client) { REQUEST(xGLXCreatePixmapReq); CARD32 screen, glxpixmap; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); screen = GlxCheckSwap(client, stuff->screen); glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); LEGAL_NEW_RESOURCE(glxpixmap, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(glxpixmap, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(glxpixmap); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_CreateWindow(ClientPtr client) { REQUEST(xGLXCreateWindowReq); CARD32 screen, glxwindow; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); screen = GlxCheckSwap(client, stuff->screen); glxwindow = GlxCheckSwap(client, stuff->glxwindow); LEGAL_NEW_RESOURCE(glxwindow, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(glxwindow, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(glxwindow); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_CreateContextAttribsARB(ClientPtr client) { REQUEST(xGLXCreateContextAttribsARBReq); CARD32 screen, context; GlxServerVendor *vendor = NULL; REQUEST_AT_LEAST_SIZE(*stuff); screen = GlxCheckSwap(client, stuff->screen); context = GlxCheckSwap(client, stuff->context); LEGAL_NEW_RESOURCE(context, client); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; if (!glxServer.addXIDMap(context, vendor)) { return BadAlloc; } ret = glxServer.forwardRequest(vendor, client); if (ret != Success) { glxServer.removeXIDMap(context); } return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_DestroyPbuffer(ClientPtr client) { REQUEST(xGLXDestroyPbufferReq); CARD32 pbuffer; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); pbuffer = GlxCheckSwap(client, stuff->pbuffer); vendor = glxServer.getXIDMap(pbuffer); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); if (ret == Success) { glxServer.removeXIDMap(pbuffer); } return ret; } else { client->errorValue = pbuffer; return GlxErrorBase + GLXBadPbuffer; } } static int dispatch_DestroyPixmap(ClientPtr client) { REQUEST(xGLXDestroyPixmapReq); CARD32 glxpixmap; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); vendor = glxServer.getXIDMap(glxpixmap); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); if (ret == Success) { glxServer.removeXIDMap(glxpixmap); } return ret; } else { client->errorValue = glxpixmap; return GlxErrorBase + GLXBadPixmap; } } static int dispatch_DestroyWindow(ClientPtr client) { REQUEST(xGLXDestroyWindowReq); CARD32 glxwindow; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); glxwindow = GlxCheckSwap(client, stuff->glxwindow); vendor = glxServer.getXIDMap(glxwindow); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); if (ret == Success) { glxServer.removeXIDMap(glxwindow); } return ret; } else { client->errorValue = glxwindow; return GlxErrorBase + GLXBadWindow; } } static int dispatch_GetDrawableAttributes(ClientPtr client) { REQUEST(xGLXGetDrawableAttributesReq); CARD32 drawable; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); drawable = GlxCheckSwap(client, stuff->drawable); vendor = glxServer.getXIDMap(drawable); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = drawable; return BadDrawable; } } static int dispatch_GetFBConfigs(ClientPtr client) { REQUEST(xGLXGetFBConfigsReq); CARD32 screen; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); screen = GlxCheckSwap(client, stuff->screen); if (screen < screenInfo.numScreens) { vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); } if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = screen; return BadMatch; } } static int dispatch_QueryContext(ClientPtr client) { REQUEST(xGLXQueryContextReq); CARD32 context; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); context = GlxCheckSwap(client, stuff->context); vendor = glxServer.getXIDMap(context); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = context; return GlxErrorBase + GLXBadContext; } } static int dispatch_IsDirect(ClientPtr client) { REQUEST(xGLXIsDirectReq); CARD32 context; GlxServerVendor *vendor = NULL; REQUEST_SIZE_MATCH(*stuff); context = GlxCheckSwap(client, stuff->context); vendor = glxServer.getXIDMap(context); if (vendor != NULL) { int ret; ret = glxServer.forwardRequest(vendor, client); return ret; } else { client->errorValue = context; return GlxErrorBase + GLXBadContext; } } xorg-server-1.20.8/glx/glxdricommon.h0000644000175000017500000000331213640201473014452 00000000000000/* * 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. */ #ifndef _GLX_dri_common_h #define _GLX_dri_common_h typedef struct __GLXDRIconfig __GLXDRIconfig; struct __GLXDRIconfig { __GLXconfig config; const __DRIconfig *driConfig; }; __GLXconfig *glxConvertConfigs(const __DRIcoreExtension * core, const __DRIconfig ** configs); void *glxProbeDriver(const char *name, void **coreExt, const char *coreName, int coreVersion, void **renderExt, const char *renderName, int renderVersion); #endif xorg-server-1.20.8/glx/vndext.c0000644000175000017500000002136013640201473013256 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #include "vndserver.h" #include #include #include #include #include #include #include #include "vndservervendor.h" ExtensionEntry *GlxExtensionEntry; int GlxErrorBase = 0; static CallbackListRec vndInitCallbackList; static CallbackListPtr vndInitCallbackListPtr = &vndInitCallbackList; static DevPrivateKeyRec glvXGLVScreenPrivKey; static DevPrivateKeyRec glvXGLVClientPrivKey; // The resource type used to keep track of the vendor library for XID's. RESTYPE idResource; static int idResourceDeleteCallback(void *value, XID id) { return 0; } static GlxScreenPriv * xglvGetScreenPrivate(ScreenPtr pScreen) { return dixLookupPrivate(&pScreen->devPrivates, &glvXGLVScreenPrivKey); } static void xglvSetScreenPrivate(ScreenPtr pScreen, void *priv) { dixSetPrivate(&pScreen->devPrivates, &glvXGLVScreenPrivKey, priv); } GlxScreenPriv * GlxGetScreen(ScreenPtr pScreen) { if (pScreen != NULL) { GlxScreenPriv *priv = xglvGetScreenPrivate(pScreen); if (priv == NULL) { priv = calloc(1, sizeof(GlxScreenPriv)); if (priv == NULL) { return NULL; } xglvSetScreenPrivate(pScreen, priv); } return priv; } else { return NULL; } } static void GlxMappingReset(void) { int i; for (i=0; idevPrivates, &glvXGLVClientPrivKey); } static void xglvSetClientPrivate(ClientPtr pClient, void *priv) { dixSetPrivate(&pClient->devPrivates, &glvXGLVClientPrivKey, priv); } GlxClientPriv * GlxGetClientData(ClientPtr client) { GlxClientPriv *cl = xglvGetClientPrivate(client); if (cl == NULL) { cl = calloc(1, sizeof(GlxClientPriv) + screenInfo.numScreens * sizeof(GlxServerVendor *)); if (cl != NULL) { int i; cl->vendors = (GlxServerVendor **) (cl + 1); for (i=0; ivendors[i] = GlxGetVendorForScreen(NULL, screenInfo.screens[i]); } xglvSetClientPrivate(client, cl); } } return cl; } void GlxFreeClientData(ClientPtr client) { GlxClientPriv *cl = xglvGetClientPrivate(client); if (cl != NULL) { unsigned int i; for (i = 0; i < cl->contextTagCount; i++) { GlxContextTagInfo *tag = &cl->contextTags[i]; if (tag->vendor != NULL) { tag->vendor->glxvc.makeCurrent(client, tag->tag, None, None, None, 0); } } xglvSetClientPrivate(client, NULL); free(cl->contextTags); free(cl); } } static void GLXClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr client = clientinfo->client; switch (client->clientState) { case ClientStateRetained: case ClientStateGone: GlxFreeClientData(client); break; } } static void GLXReset(ExtensionEntry *extEntry) { // xf86Msg(X_INFO, "GLX: GLXReset\n"); GlxVendorExtensionReset(extEntry); GlxDispatchReset(); GlxMappingReset(); if ((dispatchException & DE_TERMINATE) == DE_TERMINATE) { while (vndInitCallbackList.list != NULL) { CallbackPtr next = vndInitCallbackList.list->next; free(vndInitCallbackList.list); vndInitCallbackList.list = next; } } } void GlxExtensionInit(void) { ExtensionEntry *extEntry; GlxExtensionEntry = NULL; // Init private keys, per-screen data if (!dixRegisterPrivateKey(&glvXGLVScreenPrivKey, PRIVATE_SCREEN, 0)) return; if (!dixRegisterPrivateKey(&glvXGLVClientPrivKey, PRIVATE_CLIENT, 0)) return; if (!GlxMappingInit()) { return; } if (!GlxDispatchInit()) { return; } if (!AddCallback(&ClientStateCallback, GLXClientCallback, NULL)) { return; } extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, __GLX_NUMBER_ERRORS, GlxDispatchRequest, GlxDispatchRequest, GLXReset, StandardMinorOpcode); if (!extEntry) { return; } GlxExtensionEntry = extEntry; GlxErrorBase = extEntry->errorBase; CallCallbacks(&vndInitCallbackListPtr, extEntry); /* We'd better have found at least one vendor */ for (int i = 0; i < screenInfo.numScreens; i++) if (GlxGetVendorForScreen(serverClient, screenInfo.screens[i])) return; extEntry->base = 0; } static int GlxForwardRequest(GlxServerVendor *vendor, ClientPtr client) { return vendor->glxvc.handleRequest(client); } static GlxServerVendor * GlxGetContextTag(ClientPtr client, GLXContextTag tag) { GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, tag); if (tagInfo != NULL) { return tagInfo->vendor; } else { return NULL; } } static Bool GlxSetContextTagPrivate(ClientPtr client, GLXContextTag tag, void *data) { GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, tag); if (tagInfo != NULL) { tagInfo->data = data; return TRUE; } else { return FALSE; } } static void * GlxGetContextTagPrivate(ClientPtr client, GLXContextTag tag) { GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, tag); if (tagInfo != NULL) { return tagInfo->data; } else { return NULL; } } static GlxServerImports * GlxAllocateServerImports(void) { return calloc(1, sizeof(GlxServerImports)); } static void GlxFreeServerImports(GlxServerImports *imports) { free(imports); } _X_EXPORT const GlxServerExports glxServer = { .majorVersion = GLXSERVER_VENDOR_ABI_MAJOR_VERSION, .minorVersion = GLXSERVER_VENDOR_ABI_MINOR_VERSION, .extensionInitCallback = &vndInitCallbackListPtr, .allocateServerImports = GlxAllocateServerImports, .freeServerImports = GlxFreeServerImports, .createVendor = GlxCreateVendor, .destroyVendor = GlxDestroyVendor, .setScreenVendor = GlxSetScreenVendor, .addXIDMap = GlxAddXIDMap, .getXIDMap = GlxGetXIDMap, .removeXIDMap = GlxRemoveXIDMap, .getContextTag = GlxGetContextTag, .setContextTagPrivate = GlxSetContextTagPrivate, .getContextTagPrivate = GlxGetContextTagPrivate, .getVendorForScreen = GlxGetVendorForScreen, .forwardRequest = GlxForwardRequest, .setClientScreenVendor = GlxSetClientScreenVendor, }; const GlxServerExports * glvndGetExports(void) { return &glxServer; } xorg-server-1.20.8/glx/glxscreens.h0000644000175000017500000001221413640201473014126 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_screens_h_ #define _GLX_screens_h_ /* * 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 "extension_string.h" #include "glxvndabi.h" typedef struct __GLXconfig __GLXconfig; struct __GLXconfig { /* Management */ __GLXconfig *next; #ifdef COMPOSITE GLboolean duplicatedForComp; #endif GLuint doubleBufferMode; GLuint stereoMode; GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ GLuint redMask, greenMask, blueMask, alphaMask; GLint rgbBits; /* total bits for rgb */ GLint indexBits; /* total bits for colorindex */ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; GLint depthBits; GLint stencilBits; GLint numAuxBuffers; GLint level; /* GLX */ GLint visualID; GLint visualType; /**< One of the GLX X visual types. (i.e., * \c GLX_TRUE_COLOR, etc.) */ /* EXT_visual_rating / GLX 1.2 */ GLint visualRating; /* EXT_visual_info / GLX 1.2 */ GLint transparentPixel; /* colors are floats scaled to ints */ GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; GLint transparentIndex; /* ARB_multisample / SGIS_multisample */ GLint sampleBuffers; GLint samples; /* SGIX_fbconfig / GLX 1.3 */ GLint drawableType; GLint renderType; GLint fbconfigID; /* SGIX_pbuffer / GLX 1.3 */ GLint maxPbufferWidth; GLint maxPbufferHeight; GLint maxPbufferPixels; GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ /* SGIX_visual_select_group */ GLint visualSelectGroup; /* OML_swap_method */ GLint swapMethod; /* EXT_texture_from_pixmap */ GLint bindToTextureRgb; GLint bindToTextureRgba; GLint bindToMipmapTexture; GLint bindToTextureTargets; GLint yInverted; /* ARB_framebuffer_sRGB */ GLint sRGBCapable; }; GLint glxConvertToXVisualType(int visualType); /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an ** interface for context management on a screen. */ typedef struct __GLXscreen __GLXscreen; struct __GLXscreen { void (*destroy) (__GLXscreen * screen); __GLXcontext *(*createContext) (__GLXscreen * screen, __GLXconfig * modes, __GLXcontext * shareContext, unsigned num_attribs, const uint32_t *attribs, int *error); __GLXdrawable *(*createDrawable) (ClientPtr client, __GLXscreen * context, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig * modes); int (*swapInterval) (__GLXdrawable * drawable, int interval); ScreenPtr pScreen; /* Linked list of valid fbconfigs for this screen. */ __GLXconfig *fbconfigs; int numFBConfigs; /* Subset of fbconfigs that are exposed as GLX visuals. */ __GLXconfig **visuals; GLint numVisuals; char *GLextensions; char *GLXextensions; char *glvnd; unsigned char glx_enable_bits[__GLX_EXT_BYTES]; Bool (*CloseScreen) (ScreenPtr pScreen); }; void __glXScreenInit(__GLXscreen * screen, ScreenPtr pScreen); void __glXScreenDestroy(__GLXscreen * screen); #endif /* !__GLX_screens_h__ */ xorg-server-1.20.8/glx/createcontext.c0000644000175000017500000003020213640201473014611 00000000000000/* * Copyright © 2011 Intel Corporation * * 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 #endif #include #include "glxserver.h" #include "glxext.h" #include "indirect_dispatch.h" #include "opaque.h" #define ALL_VALID_FLAGS \ (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB \ | GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB) static Bool validate_GL_version(int major_version, int minor_version) { if (major_version <= 0 || minor_version < 0) return FALSE; switch (major_version) { case 1: if (minor_version > 5) return FALSE; break; case 2: if (minor_version > 1) return FALSE; break; case 3: if (minor_version > 3) return FALSE; break; default: break; } return TRUE; } static Bool validate_render_type(uint32_t render_type) { switch (render_type) { case GLX_RGBA_TYPE: case GLX_COLOR_INDEX_TYPE: case GLX_RGBA_FLOAT_TYPE_ARB: case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT: return TRUE; default: return FALSE; } } int __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateContextAttribsARBReq *req = (xGLXCreateContextAttribsARBReq *) pc; int32_t *attribs = (req->numAttribs != 0) ? (int32_t *) (req + 1) : NULL; unsigned i; int major_version = 1; int minor_version = 0; uint32_t flags = 0; uint32_t render_type = GLX_RGBA_TYPE; #ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB uint32_t flush = GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB; #endif __GLXcontext *ctx = NULL; __GLXcontext *shareCtx = NULL; __GLXscreen *glxScreen; __GLXconfig *config = NULL; int err; /* The GLX_ARB_create_context_robustness spec says: * * "The default value for GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB * is GLX_NO_RESET_NOTIFICATION_ARB." */ int reset = GLX_NO_RESET_NOTIFICATION_ARB; /* The GLX_ARB_create_context_profile spec says: * * "The default value for GLX_CONTEXT_PROFILE_MASK_ARB is * GLX_CONTEXT_CORE_PROFILE_BIT_ARB." * * The core profile only makes sense for OpenGL versions 3.2 and later. * If the version ultimately specified is less than 3.2, the core profile * bit is cleared (see below). */ int profile = GLX_CONTEXT_CORE_PROFILE_BIT_ARB; /* Verify that the size of the packet matches the size inferred from the * sizes specified for the various fields. */ const unsigned expected_size = (sz_xGLXCreateContextAttribsARBReq + (req->numAttribs * 8)) / 4; if (req->length != expected_size) return BadLength; /* The GLX_ARB_create_context spec says: * * "* If is not a valid GLXFBConfig, GLXBadFBConfig is * generated." * * On the client, the screen comes from the FBConfig, so GLXBadFBConfig * should be issued if the screen is nonsense. */ if (!validGlxScreen(client, req->screen, &glxScreen, &err)) return __glXError(GLXBadFBConfig); if (req->fbconfig) { if (!validGlxFBConfig(client, glxScreen, req->fbconfig, &config, &err)) return __glXError(GLXBadFBConfig); } /* Validate the context with which the new context should share resources. */ if (req->shareList != None) { if (!validGlxContext(client, req->shareList, DixReadAccess, &shareCtx, &err)) return err; /* The crazy condition is because C doesn't have a logical XOR * operator. Comparing directly for equality may fail if one is 1 and * the other is 2 even though both are logically true. */ if (!!req->isDirect != !!shareCtx->isDirect) { client->errorValue = req->shareList; return BadMatch; } /* The GLX_ARB_create_context spec says: * * "* If the server context state for ...was * created on a different screen than the one referenced by * ...BadMatch is generated." */ if (glxScreen != shareCtx->pGlxScreen) { client->errorValue = shareCtx->pGlxScreen->pScreen->myNum; return BadMatch; } } for (i = 0; i < req->numAttribs; i++) { switch (attribs[i * 2]) { case GLX_CONTEXT_MAJOR_VERSION_ARB: major_version = attribs[2 * i + 1]; break; case GLX_CONTEXT_MINOR_VERSION_ARB: minor_version = attribs[2 * i + 1]; break; case GLX_CONTEXT_FLAGS_ARB: flags = attribs[2 * i + 1]; break; case GLX_RENDER_TYPE: /* Not valid for GLX_EXT_no_config_context */ if (!req->fbconfig) return BadValue; render_type = attribs[2 * i + 1]; break; case GLX_CONTEXT_PROFILE_MASK_ARB: profile = attribs[2 * i + 1]; break; case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB: reset = attribs[2 * i + 1]; if (reset != GLX_NO_RESET_NOTIFICATION_ARB && reset != GLX_LOSE_CONTEXT_ON_RESET_ARB) return BadValue; break; #ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB: flush = attribs[2 * i + 1]; if (flush != GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB && flush != GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB) return BadValue; break; #endif case GLX_SCREEN: /* Only valid for GLX_EXT_no_config_context */ if (req->fbconfig) return BadValue; /* Must match the value in the request header */ if (attribs[2 * i + 1] != req->screen) return BadValue; break; case GLX_CONTEXT_OPENGL_NO_ERROR_ARB: /* ignore */ break; default: if (!req->isDirect) return BadValue; break; } } /* The GLX_ARB_create_context spec says: * * "If attributes GLX_CONTEXT_MAJOR_VERSION_ARB and * GLX_CONTEXT_MINOR_VERSION_ARB, when considered together * with attributes GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB and * GLX_RENDER_TYPE, specify an OpenGL version and feature set * that are not defined, BadMatch is generated. * * ...Feature deprecation was introduced with OpenGL 3.0, so * forward-compatible contexts may only be requested for * OpenGL 3.0 and above. Thus, examples of invalid * combinations of attributes include: * * - Major version < 1 or > 3 * - Major version == 1 and minor version < 0 or > 5 * - Major version == 2 and minor version < 0 or > 1 * - Major version == 3 and minor version > 2 * - Forward-compatible flag set and major version < 3 * - Color index rendering and major version >= 3" */ if (!validate_GL_version(major_version, minor_version)) return BadMatch; if (major_version < 3 && ((flags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) != 0)) return BadMatch; if (major_version >= 3 && render_type == GLX_COLOR_INDEX_TYPE) return BadMatch; if (!validate_render_type(render_type)) return BadValue; if ((flags & ~ALL_VALID_FLAGS) != 0) return BadValue; /* The GLX_ARB_create_context_profile spec says: * * "* If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set; has * any bits set other than GLX_CONTEXT_CORE_PROFILE_BIT_ARB and * GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; has more than one of * these bits set; or if the implementation does not support the * requested profile, then GLXBadProfileARB is generated." * * The GLX_EXT_create_context_es2_profile spec doesn't exactly say what * is supposed to happen if an invalid version is set, but it doesn't * much matter as support for GLES contexts is only defined for direct * contexts (at the moment anyway) so we can leave it up to the driver * to validate. */ switch (profile) { case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: break; default: return __glXError(GLXBadProfileARB); } /* The GLX_ARB_create_context_robustness spec says: * * "* If the reset notification behavior of and the * newly created context are different, BadMatch is generated." */ if (shareCtx != NULL && shareCtx->resetNotificationStrategy != reset) return BadMatch; /* There is no GLX protocol for desktop OpenGL versions after 1.4. There * is no GLX protocol for any version of OpenGL ES. If the application is * requested an indirect rendering context for a version that cannot be * satisfied, reject it. * * The GLX_ARB_create_context spec says: * * "* If does not support compatible OpenGL contexts * providing the requested API major and minor version, * forward-compatible flag, and debug context flag, GLXBadFBConfig * is generated." */ if (!req->isDirect && (major_version > 1 || minor_version > 4 || profile == GLX_CONTEXT_ES2_PROFILE_BIT_EXT)) { return __glXError(GLXBadFBConfig); } /* Allocate memory for the new context */ if (req->isDirect) { ctx = __glXdirectContextCreate(glxScreen, config, shareCtx); err = BadAlloc; } else { /* Only allow creating indirect GLX contexts if allowed by * server command line. Indirect GLX is of limited use (since * it's only GL 1.4), it's slower than direct contexts, and * it's a massive attack surface for buffer overflow type * errors. */ if (!enableIndirectGLX) { client->errorValue = req->isDirect; return BadValue; } ctx = glxScreen->createContext(glxScreen, config, shareCtx, req->numAttribs, (uint32_t *) attribs, &err); } if (ctx == NULL) return err; ctx->pGlxScreen = glxScreen; ctx->config = config; ctx->id = req->context; ctx->share_id = req->shareList; ctx->idExists = TRUE; ctx->isDirect = req->isDirect; ctx->renderMode = GL_RENDER; ctx->resetNotificationStrategy = reset; #ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB ctx->releaseBehavior = flush; #endif /* Add the new context to the various global tables of GLX contexts. */ if (!__glXAddContext(ctx)) { (*ctx->destroy) (ctx); client->errorValue = req->context; return BadAlloc; } return Success; } int __glXDispSwap_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) { return BadRequest; } xorg-server-1.20.8/glx/single2.c0000644000175000017500000002563413640201473013321 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include #include #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "indirect_dispatch.h" #include "unpack.h" int __glXDisp_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; GLsizei size; GLenum type; __GLXcontext *cx; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 8); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; size = *(GLsizei *) (pc + 0); type = *(GLenum *) (pc + 4); if (cx->feedbackBufSize < size) { cx->feedbackBuf = reallocarray(cx->feedbackBuf, (size_t) size, __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { cl->client->errorValue = size; return BadAlloc; } cx->feedbackBufSize = size; } glFeedbackBuffer(size, type, cx->feedbackBuf); return Success; } int __glXDisp_SelectBuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; size = *(GLsizei *) (pc + 0); if (cx->selectBufSize < size) { cx->selectBuf = reallocarray(cx->selectBuf, (size_t) size, __GLX_SIZE_CARD32); if (!cx->selectBuf) { cl->client->errorValue = size; return BadAlloc; } cx->selectBufSize = size; } glSelectBuffer(size, cx->selectBuf); return Success; } int __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXRenderModeReply reply; __GLXcontext *cx; GLint nitems = 0, retBytes = 0, retval, newModeCheck; GLubyte *retBuffer = NULL; GLenum newMode; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; newMode = *(GLenum *) pc; retval = glRenderMode(newMode); /* Check that render mode worked */ glGetIntegerv(GL_RENDER_MODE, &newModeCheck); if (newModeCheck != newMode) { /* Render mode change failed. Bail */ newMode = newModeCheck; goto noChangeAllowed; } /* ** Render mode might have still failed if we get here. But in this ** case we can't really tell, nor does it matter. If it did fail, it ** will return 0, and thus we won't send any data across the wire. */ switch (cx->renderMode) { case GL_RENDER: cx->renderMode = newMode; break; case GL_FEEDBACK: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->feedbackBufSize; } else { nitems = retval; } retBytes = nitems * __GLX_SIZE_FLOAT32; retBuffer = (GLubyte *) cx->feedbackBuf; cx->renderMode = newMode; break; case GL_SELECT: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->selectBufSize; } else { GLuint *bp = cx->selectBuf; GLint i; /* ** Figure out how many bytes of data need to be sent. Parse ** the selection buffer to determine this fact as the ** return value is the number of hits, not the number of ** items in the buffer. */ nitems = 0; i = retval; while (--i >= 0) { GLuint n; /* Parse select data for this hit */ n = *bp; bp += 3 + n; } nitems = bp - cx->selectBuf; } retBytes = nitems * __GLX_SIZE_CARD32; retBuffer = (GLubyte *) cx->selectBuf; cx->renderMode = newMode; break; } /* ** First reply is the number of elements returned in the feedback or ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; reply = (xGLXRenderModeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = nitems, .retval = retval, .size = nitems, .newMode = newMode }; WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDisp_Flush(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } glFlush(); return Success; } int __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; xGLXSingleReply reply = { 0, }; REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } /* Do a local glFinish */ glFinish(); /* Send empty reply packet to indicate finish is finished */ client = cl->client; __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } #define SEPARATOR " " static char * __glXcombine_strings(const char *cext_string, const char *sext_string) { size_t clen, slen; char *combo_string, *token, *s1; const char *s2, *end; /* safeguard to prevent potentially fatal errors in the string functions */ if (!cext_string) cext_string = ""; if (!sext_string) sext_string = ""; /* ** String can't be longer than min(cstring, sstring) ** pull tokens out of shortest string ** include space in combo_string for final separator and null terminator */ clen = strlen(cext_string); slen = strlen(sext_string); if (clen > slen) { combo_string = (char *) malloc(slen + 2); s1 = (char *) malloc(slen + 2); if (s1) strcpy(s1, sext_string); s2 = cext_string; } else { combo_string = (char *) malloc(clen + 2); s1 = (char *) malloc(clen + 2); if (s1) strcpy(s1, cext_string); s2 = sext_string; } if (!combo_string || !s1) { free(combo_string); free(s1); return NULL; } combo_string[0] = '\0'; /* Get first extension token */ token = strtok(s1, SEPARATOR); while (token != NULL) { /* ** if token in second string then save it ** beware of extension names which are prefixes of other extension names */ const char *p = s2; end = p + strlen(p); while (p < end) { size_t n = strcspn(p, SEPARATOR); if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) { combo_string = strcat(combo_string, token); combo_string = strcat(combo_string, SEPARATOR); } p += (n + 1); } /* Get next extension token */ token = strtok(NULL, SEPARATOR); } free(s1); return combo_string; } int DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap) { ClientPtr client = cl->client; __GLXcontext *cx; GLenum name; const char *string; xGLXSingleReply reply = { 0, }; __GLX_DECLARE_SWAP_VARIABLES; int error; char *buf = NULL, *buf1 = NULL; GLint length = 0; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); /* If the client has the opposite byte order, swap the contextTag and * the name. */ if (need_swap) { __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE); } cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; name = *(GLenum *) (pc + 0); string = (const char *) glGetString(name); if (string == NULL) string = ""; /* ** Restrict extensions to those that are supported by both the ** implementation and the connection. That is, return the ** intersection of client, server, and core extension strings. */ if (name == GL_EXTENSIONS) { buf1 = __glXcombine_strings(string, cl->GLClientextensions); buf = __glXcombine_strings(buf1, cx->pGlxScreen->GLextensions); free(buf1); string = buf; } else if (name == GL_VERSION) { if (atof(string) > atof(GLServerVersion)) { if (asprintf(&buf, "%s (%s)", GLServerVersion, string) == -1) { string = GLServerVersion; } else { string = buf; } } } if (string) { length = strlen((const char *) string) + 1; } __GLX_BEGIN_REPLY(length); __GLX_PUT_SIZE(length); if (need_swap) { __GLX_SWAP_REPLY_SIZE(); __GLX_SWAP_REPLY_HEADER(); } __GLX_SEND_HEADER(); WriteToClient(client, length, string); free(buf); return Success; } int __glXDisp_GetString(__GLXclientState * cl, GLbyte * pc) { return DoGetString(cl, pc, GL_FALSE); } xorg-server-1.20.8/glx/glxserver.h0000644000175000017500000001266013640201473013777 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_server_h_ #define _GLX_server_h_ /* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB #define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 #endif /* ** GLX resources. */ typedef XID GLXContextID; typedef XID GLXDrawable; typedef struct __GLXclientStateRec __GLXclientState; typedef struct __GLXdrawable __GLXdrawable; typedef struct __GLXcontext __GLXcontext; #include "glxscreens.h" #include "glxdrawable.h" #include "glxcontext.h" #include "glx_extinit.h" extern __GLXscreen *glxGetScreen(ScreenPtr pScreen); extern __GLXclientState *glxGetClient(ClientPtr pClient); /************************************************************************/ void __glXScreenInitVisuals(__GLXscreen * screen); /* ** The last context used (from the server's persective) is cached. */ extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag, int *); int __glXError(int error); /************************************************************************/ enum { GLX_MINIMAL_VISUALS, GLX_TYPICAL_VISUALS, GLX_ALL_VISUALS }; void glxSuspendClients(void); void glxResumeClients(void); typedef void (*glx_func_ptr)(void); typedef glx_func_ptr (*glx_gpa_proc)(const char *); void __glXsetGetProcAddress(glx_gpa_proc get_proc_address); void *__glGetProcAddress(const char *); void __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust, CARD64 msc, CARD32 sbc); #if PRESENT void __glXregisterPresentCompleteNotify(void); #endif /* ** State kept per client. */ struct __GLXclientStateRec { /* ** Buffer for returned data. */ GLbyte *returnBuf; GLint returnBufSize; /* Back pointer to X client record */ ClientPtr client; char *GLClientextensions; }; /************************************************************************/ /* ** Dispatch tables. */ typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *); typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *); typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *); /* * Tables for computing the size of each rendering command. */ typedef int (*gl_proto_size_func) (const GLbyte *, Bool, int); typedef struct { int bytes; gl_proto_size_func varsize; } __GLXrenderSizeData; /************************************************************************/ /* ** X resources. */ extern RESTYPE __glXContextRes; extern RESTYPE __glXClientRes; extern RESTYPE __glXDrawableRes; /************************************************************************/ /* * Routines for computing the size of variably-sized rendering commands. */ static _X_INLINE int safe_add(int a, int b) { if (a < 0 || b < 0) return -1; if (INT_MAX - a < b) return -1; return a + b; } static _X_INLINE int safe_mul(int a, int b) { if (a < 0 || b < 0) return -1; if (a == 0 || b == 0) return 0; if (a > INT_MAX / b) return -1; return a * b; } static _X_INLINE int safe_pad(int a) { int ret; if (a < 0) return -1; if ((ret = safe_add(a, 3)) < 0) return -1; return ret & (GLuint)~3; } extern int __glXTypeSize(GLenum enm); extern int __glXImageSize(GLenum format, GLenum type, GLenum target, GLsizei w, GLsizei h, GLsizei d, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment); extern unsigned glxMajorVersion; extern unsigned glxMinorVersion; extern int __glXEventBase; #endif /* !__GLX_server_h__ */ xorg-server-1.20.8/glx/extension_string.c0000644000175000017500000001461613640201473015356 00000000000000/* * (C) Copyright IBM Corporation 2002-2006 * 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 * on the rights to use, copy, modify, merge, publish, distribute, sub * license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file extension_string.c * Routines to manage the GLX extension string and GLX version for AIGLX * drivers. This code is loosely based on src/glx/x11/glxextensions.c from * Mesa. * * \author Ian Romanick */ #include #include "extension_string.h" #define SET_BIT(m,b) (m[ (b) / 8 ] |= (1U << ((b) % 8))) #define CLR_BIT(m,b) (m[ (b) / 8 ] &= ~(1U << ((b) % 8))) #define IS_SET(m,b) ((m[ (b) / 8 ] & (1U << ((b) % 8))) != 0) #define CONCAT(a,b) a ## b #define GLX(n) "GLX_" # n, 4 + sizeof( # n ) - 1, CONCAT(n,_bit) #define VER(a,b) a, b #define Y 1 #define N 0 #define EXT_ENABLED(bit,supported) (IS_SET(supported, bit)) struct extension_info { const char *const name; unsigned name_len; unsigned char bit; /** * This is the lowest version of GLX that "requires" this extension. * For example, GLX 1.3 requires SGIX_fbconfig, SGIX_pbuffer, and * SGI_make_current_read. If the extension is not required by any known * version of GLX, use 0, 0. */ unsigned char version_major; unsigned char version_minor; /** * Is driver support forced by the ABI? */ unsigned char driver_support; }; /** * List of known GLX Extensions. * The last Y/N switch informs whether the support of this extension is always enabled. */ static const struct extension_info known_glx_extensions[] = { /* GLX_ARB_get_proc_address is implemented on the client. */ /* *INDENT-OFF* */ { GLX(ARB_context_flush_control), VER(0,0), N, }, { GLX(ARB_create_context), VER(0,0), N, }, { GLX(ARB_create_context_no_error), VER(0,0), N, }, { GLX(ARB_create_context_profile), VER(0,0), N, }, { GLX(ARB_create_context_robustness), VER(0,0), N, }, { GLX(ARB_fbconfig_float), VER(0,0), N, }, { GLX(ARB_framebuffer_sRGB), VER(0,0), N, }, { GLX(ARB_multisample), VER(1,4), Y, }, { GLX(EXT_create_context_es_profile), VER(0,0), N, }, { GLX(EXT_create_context_es2_profile), VER(0,0), N, }, { GLX(EXT_fbconfig_packed_float), VER(0,0), N, }, { GLX(EXT_framebuffer_sRGB), VER(0,0), N, }, { GLX(EXT_import_context), VER(0,0), Y, }, { GLX(EXT_libglvnd), VER(0,0), N, }, { GLX(EXT_no_config_context), VER(0,0), N, }, { GLX(EXT_stereo_tree), VER(0,0), N, }, { GLX(EXT_texture_from_pixmap), VER(0,0), N, }, { GLX(EXT_visual_info), VER(0,0), Y, }, { GLX(EXT_visual_rating), VER(0,0), Y, }, { GLX(MESA_copy_sub_buffer), VER(0,0), N, }, { GLX(OML_swap_method), VER(0,0), Y, }, { GLX(SGI_make_current_read), VER(1,3), Y, }, { GLX(SGI_swap_control), VER(0,0), N, }, { GLX(SGIS_multisample), VER(0,0), Y, }, { GLX(SGIX_fbconfig), VER(1,3), Y, }, { GLX(SGIX_pbuffer), VER(1,3), Y, }, { GLX(SGIX_visual_select_group), VER(0,0), Y, }, { GLX(INTEL_swap_event), VER(0,0), N, }, { NULL } /* *INDENT-ON* */ }; /** * Create a GLX extension string for a set of enable bits. * * Creates a GLX extension string for the set of bit in \c enable_bits. This * string is then stored in \c buffer if buffer is not \c NULL. This allows * two-pass operation. On the first pass the caller passes \c NULL for * \c buffer, and the function determines how much space is required to store * the extension string. The caller allocates the buffer and calls the * function again. * * \param enable_bits Bits representing the enabled extensions. * \param buffer Buffer to store the extension string. May be \c NULL. * * \return * The number of characters in \c buffer that were written to. If \c buffer * is \c NULL, this is the size of buffer that must be allocated by the * caller. */ int __glXGetExtensionString(const unsigned char *enable_bits, char *buffer) { unsigned i; int length = 0; for (i = 0; known_glx_extensions[i].name != NULL; i++) { const unsigned bit = known_glx_extensions[i].bit; const size_t len = known_glx_extensions[i].name_len; if (EXT_ENABLED(bit, enable_bits)) { if (buffer != NULL) { (void) memcpy(&buffer[length], known_glx_extensions[i].name, len); buffer[length + len + 0] = ' '; buffer[length + len + 1] = '\0'; } length += len + 1; } } return length + 1; } void __glXEnableExtension(unsigned char *enable_bits, const char *ext) { const size_t ext_name_len = strlen(ext); unsigned i; for (i = 0; known_glx_extensions[i].name != NULL; i++) { if ((ext_name_len == known_glx_extensions[i].name_len) && (memcmp(ext, known_glx_extensions[i].name, ext_name_len) == 0)) { SET_BIT(enable_bits, known_glx_extensions[i].bit); break; } } } void __glXInitExtensionEnableBits(unsigned char *enable_bits) { unsigned i; (void) memset(enable_bits, 0, __GLX_EXT_BYTES); for (i = 0; known_glx_extensions[i].name != NULL; i++) { if (known_glx_extensions[i].driver_support) { SET_BIT(enable_bits, known_glx_extensions[i].bit); } } } xorg-server-1.20.8/glx/swap_interval.c0000644000175000017500000000541713640201473014631 00000000000000/* * (C) Copyright IBM Corporation 2006 * 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 * on the rights to use, copy, modify, merge, publish, distribute, sub * license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxbyteorder.h" static int DoSwapInterval(__GLXclientState * cl, GLbyte * pc, int do_swap); int DoSwapInterval(__GLXclientState * cl, GLbyte * pc, int do_swap) { xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc; ClientPtr client = cl->client; const GLXContextTag tag = req->contextTag; __GLXcontext *cx; GLint interval; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 4); cx = __glXLookupContextByTag(cl, tag); if ((cx == NULL) || (cx->pGlxScreen == NULL)) { client->errorValue = tag; return __glXError(GLXBadContext); } if (cx->pGlxScreen->swapInterval == NULL) { LogMessage(X_ERROR, "AIGLX: cx->pGlxScreen->swapInterval == NULL\n"); client->errorValue = tag; return __glXError(GLXUnsupportedPrivateRequest); } if (cx->drawPriv == NULL) { client->errorValue = tag; return BadValue; } pc += __GLX_VENDPRIV_HDR_SIZE; interval = (do_swap) ? bswap_32(*(int *) (pc + 0)) : *(int *) (pc + 0); if (interval <= 0) return BadValue; (void) (*cx->pGlxScreen->swapInterval) (cx->drawPriv, interval); return Success; } int __glXDisp_SwapIntervalSGI(__GLXclientState * cl, GLbyte * pc) { return DoSwapInterval(cl, pc, 0); } int __glXDispSwap_SwapIntervalSGI(__GLXclientState * cl, GLbyte * pc) { return DoSwapInterval(cl, pc, 1); } xorg-server-1.20.8/glx/indirect_reqsize.h0000644000175000017500000003040713640201473015320 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _INDIRECT_REQSIZE_H_ ) #define _INDIRECT_REQSIZE_H_ #include #if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) #define PURE __attribute__((pure)) #else #define PURE #endif extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXLightModelfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXLightModelivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPolygonStippleReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexParameterivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXColorTableParameterivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXColorSubTableReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXCompressedTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXCompressedTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXCompressedTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPointParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXPointParameterivReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXDrawBuffersReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXProgramStringARBReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXDeleteFramebuffersReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXDeleteRenderbuffersReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte * pc, Bool swap, int reqlen); extern PURE _X_HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte * pc, Bool swap, int reqlen); #undef PURE #endif /* !defined( _INDIRECT_REQSIZE_H_ ) */ xorg-server-1.20.8/glx/render2.c0000644000175000017500000001735613640201473013321 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include "unpack.h" #include "indirect_size.h" #include "indirect_dispatch.h" void __glXDisp_Map1f(GLbyte * pc) { GLint order, k; GLfloat u1, u2, *points; GLenum target; target = *(GLenum *) (pc + 0); order = *(GLint *) (pc + 12); u1 = *(GLfloat *) (pc + 4); u2 = *(GLfloat *) (pc + 8); points = (GLfloat *) (pc + 16); k = __glMap1f_size(target); glMap1f(target, u1, u2, k, order, points); } void __glXDisp_Map2f(GLbyte * pc) { GLint uorder, vorder, ustride, vstride, k; GLfloat u1, u2, v1, v2, *points; GLenum target; 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 = __glMap2f_size(target); ustride = vorder * k; vstride = k; glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } void __glXDisp_Map1d(GLbyte * pc) { GLint order, k; #ifdef __GLX_ALIGN64 GLint compsize; #endif GLenum target; GLdouble u1, u2, *points; target = *(GLenum *) (pc + 16); order = *(GLint *) (pc + 20); k = __glMap1d_size(target); #ifdef __GLX_ALIGN64 if (order < 0 || k < 0) { compsize = 0; } else { compsize = order * k; } #endif __GLX_GET_DOUBLE(u1, pc); __GLX_GET_DOUBLE(u2, pc + 8); 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 glMap1d(target, u1, u2, k, order, points); } void __glXDisp_Map2d(GLbyte * pc) { GLdouble u1, u2, v1, v2, *points; GLint uorder, vorder, ustride, vstride, k; #ifdef __GLX_ALIGN64 GLint compsize; #endif GLenum target; target = *(GLenum *) (pc + 32); uorder = *(GLint *) (pc + 36); vorder = *(GLint *) (pc + 40); k = __glMap2d_size(target); #ifdef __GLX_ALIGN64 if (vorder < 0 || uorder < 0 || k < 0) { compsize = 0; } else { compsize = uorder * vorder * k; } #endif __GLX_GET_DOUBLE(u1, pc); __GLX_GET_DOUBLE(u2, pc + 8); __GLX_GET_DOUBLE(v1, pc + 16); __GLX_GET_DOUBLE(v2, pc + 24); 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 glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } void __glXDisp_DrawArrays(GLbyte * pc) { __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; __GLXdispatchDrawArraysComponentHeader *compHeader; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLenum primType = hdr->primType; GLint stride = 0; int i; pc += sizeof(__GLXdispatchDrawArraysHeader); compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; /* compute stride (same for all component arrays) */ for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); } pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); /* set up component arrays */ for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; switch (component) { case GL_VERTEX_ARRAY: glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(numVals, datatype, stride, pc); break; case GL_NORMAL_ARRAY: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(datatype, stride, pc); break; case GL_COLOR_ARRAY: glEnableClientState(GL_COLOR_ARRAY); glColorPointer(numVals, datatype, stride, pc); break; case GL_INDEX_ARRAY: glEnableClientState(GL_INDEX_ARRAY); glIndexPointer(datatype, stride, pc); break; case GL_TEXTURE_COORD_ARRAY: glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(numVals, datatype, stride, pc); break; case GL_EDGE_FLAG_ARRAY: glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *) pc); break; case GL_SECONDARY_COLOR_ARRAY: { PFNGLSECONDARYCOLORPOINTERPROC SecondaryColorPointerEXT = __glGetProcAddress("glSecondaryColorPointerEXT"); glEnableClientState(GL_SECONDARY_COLOR_ARRAY); SecondaryColorPointerEXT(numVals, datatype, stride, pc); break; } case GL_FOG_COORD_ARRAY: { PFNGLFOGCOORDPOINTERPROC FogCoordPointerEXT = __glGetProcAddress("glFogCoordPointerEXT"); glEnableClientState(GL_FOG_COORD_ARRAY); FogCoordPointerEXT(datatype, stride, pc); break; } default: break; } pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); } glDrawArrays(primType, 0, numVertexes); /* turn off anything we might have turned on */ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_INDEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); glDisableClientState(GL_FOG_COORD_ARRAY); } xorg-server-1.20.8/glx/glxutil.h0000644000175000017500000000431613640201473013445 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxcmds_h_ #define _glxcmds_h_ /* * 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. */ extern GLboolean __glXDrawableInit(__GLXdrawable * drawable, __GLXscreen * screen, DrawablePtr pDraw, int type, XID drawID, __GLXconfig * config); extern void __glXDrawableRelease(__GLXdrawable * drawable); /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag); /* init helper routines */ extern void *__glXglDDXScreenInfo(void); extern void *__glXglDDXExtensionInfo(void); #endif /* _glxcmds_h_ */ xorg-server-1.20.8/glx/Makefile.in0000644000175000017500000011307613640201511013646 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @DRI2_TRUE@am__append_1 = glxdri2.c subdir = glx ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libglx_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__objects_1 = indirect_dispatch.lo indirect_dispatch_swap.lo \ indirect_reqsize.lo indirect_size_get.lo indirect_table.lo am_libglx_la_OBJECTS = $(am__objects_1) clientinfo.lo createcontext.lo \ extension_string.lo indirect_util.lo indirect_program.lo \ indirect_texture_compression.lo glxcmds.lo glxcmdsswap.lo \ glxext.lo glxdriswrast.lo glxdricommon.lo glxscreens.lo \ render2.lo render2swap.lo renderpix.lo renderpixswap.lo \ rensize.lo single2.lo single2swap.lo singlepix.lo \ singlepixswap.lo singlesize.lo swap_interval.lo xfont.lo libglx_la_OBJECTS = $(am_libglx_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libglxdri_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libglxdri_la_SOURCES_DIST = glxdri2.c @DRI2_TRUE@am__objects_2 = glxdri2.lo am_libglxdri_la_OBJECTS = $(am__objects_2) libglxdri_la_OBJECTS = $(am_libglxdri_la_OBJECTS) @DRI2_TRUE@am_libglxdri_la_rpath = libglxvnd_la_LIBADD = am_libglxvnd_la_OBJECTS = vndcmds.lo vndext.lo vndservermapping.lo \ vndservervendor.lo libglxvnd_la_OBJECTS = $(am_libglxvnd_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/clientinfo.Plo \ ./$(DEPDIR)/createcontext.Plo ./$(DEPDIR)/extension_string.Plo \ ./$(DEPDIR)/glxcmds.Plo ./$(DEPDIR)/glxcmdsswap.Plo \ ./$(DEPDIR)/glxdri2.Plo ./$(DEPDIR)/glxdricommon.Plo \ ./$(DEPDIR)/glxdriswrast.Plo ./$(DEPDIR)/glxext.Plo \ ./$(DEPDIR)/glxscreens.Plo ./$(DEPDIR)/indirect_dispatch.Plo \ ./$(DEPDIR)/indirect_dispatch_swap.Plo \ ./$(DEPDIR)/indirect_program.Plo \ ./$(DEPDIR)/indirect_reqsize.Plo \ ./$(DEPDIR)/indirect_size_get.Plo \ ./$(DEPDIR)/indirect_table.Plo \ ./$(DEPDIR)/indirect_texture_compression.Plo \ ./$(DEPDIR)/indirect_util.Plo ./$(DEPDIR)/render2.Plo \ ./$(DEPDIR)/render2swap.Plo ./$(DEPDIR)/renderpix.Plo \ ./$(DEPDIR)/renderpixswap.Plo ./$(DEPDIR)/rensize.Plo \ ./$(DEPDIR)/single2.Plo ./$(DEPDIR)/single2swap.Plo \ ./$(DEPDIR)/singlepix.Plo ./$(DEPDIR)/singlepixswap.Plo \ ./$(DEPDIR)/singlesize.Plo ./$(DEPDIR)/swap_interval.Plo \ ./$(DEPDIR)/vndcmds.Plo ./$(DEPDIR)/vndext.Plo \ ./$(DEPDIR)/vndservermapping.Plo \ ./$(DEPDIR)/vndservervendor.Plo ./$(DEPDIR)/xfont.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libglx_la_SOURCES) $(libglxdri_la_SOURCES) \ $(libglxvnd_la_SOURCES) DIST_SOURCES = $(libglx_la_SOURCES) $(am__libglxdri_la_SOURCES_DIST) \ $(libglxvnd_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @DRI2_TRUE@GLXDRI_LIBRARY = libglxdri.la noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY) libglxvnd.la AM_CFLAGS = \ @DIX_CFLAGS@ \ @GL_CFLAGS@ \ @XLIB_CFLAGS@ \ @LIBDRM_CFLAGS@ \ @GLX_DEFINES@ \ @GLX_ARCH_DEFINES@ sdk_HEADERS = vndserver.h AM_CPPFLAGS = \ -I$(top_srcdir)/hw/xfree86/os-support \ -I$(top_srcdir)/hw/xfree86/os-support/bus \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/dri \ -I$(top_srcdir)/hw/xfree86/dri2 \ -I$(top_srcdir)/mi \ -I$(top_srcdir)/present indirect_sources = \ indirect_dispatch.c \ indirect_dispatch.h \ indirect_dispatch_swap.c \ indirect_reqsize.c \ indirect_reqsize.h \ indirect_size.h \ indirect_size_get.c \ indirect_size_get.h \ indirect_table.c libglxdri_la_SOURCES = $(am__append_1) libglxdri_la_LIBADD = $(DLOPEN_LIBS) libglx_la_SOURCES = \ $(indirect_sources) \ clientinfo.c \ createcontext.c \ extension_string.c \ extension_string.h \ indirect_util.c \ indirect_util.h \ indirect_program.c \ indirect_table.h \ indirect_texture_compression.c \ glxbyteorder.h \ glxcmds.c \ glxcmdsswap.c \ glxcontext.h \ glxdrawable.h \ glxext.c \ glxext.h \ glxdriswrast.c \ glxdricommon.c \ glxdricommon.h \ glxscreens.c \ glxscreens.h \ glxserver.h \ glxutil.h \ render2.c \ render2swap.c \ renderpix.c \ renderpixswap.c \ rensize.c \ single2.c \ single2swap.c \ singlepix.c \ singlepixswap.c \ singlesize.c \ singlesize.h \ swap_interval.c \ unpack.h \ xfont.c libglx_la_LIBADD = $(DLOPEN_LIBS) libglxvnd_la_SOURCES = \ vndcmds.c \ vndext.c \ vndservermapping.c \ vndservervendor.h \ vndservervendor.c EXTRA_DIST = vnd_dispatch_stubs.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glx/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign glx/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES) $(EXTRA_libglx_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS) libglxdri.la: $(libglxdri_la_OBJECTS) $(libglxdri_la_DEPENDENCIES) $(EXTRA_libglxdri_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libglxdri_la_rpath) $(libglxdri_la_OBJECTS) $(libglxdri_la_LIBADD) $(LIBS) libglxvnd.la: $(libglxvnd_la_OBJECTS) $(libglxvnd_la_DEPENDENCIES) $(EXTRA_libglxvnd_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libglxvnd_la_OBJECTS) $(libglxvnd_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clientinfo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/createcontext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extension_string.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxcmds.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxcmdsswap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxdri2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxdricommon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxdriswrast.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxscreens.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_dispatch.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_dispatch_swap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_program.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_reqsize.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_size_get.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_table.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_texture_compression.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect_util.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render2swap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renderpix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renderpixswap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rensize.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single2swap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/singlepix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/singlepixswap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/singlesize.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap_interval.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vndcmds.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vndext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vndservermapping.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vndservervendor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfont.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/clientinfo.Plo -rm -f ./$(DEPDIR)/createcontext.Plo -rm -f ./$(DEPDIR)/extension_string.Plo -rm -f ./$(DEPDIR)/glxcmds.Plo -rm -f ./$(DEPDIR)/glxcmdsswap.Plo -rm -f ./$(DEPDIR)/glxdri2.Plo -rm -f ./$(DEPDIR)/glxdricommon.Plo -rm -f ./$(DEPDIR)/glxdriswrast.Plo -rm -f ./$(DEPDIR)/glxext.Plo -rm -f ./$(DEPDIR)/glxscreens.Plo -rm -f ./$(DEPDIR)/indirect_dispatch.Plo -rm -f ./$(DEPDIR)/indirect_dispatch_swap.Plo -rm -f ./$(DEPDIR)/indirect_program.Plo -rm -f ./$(DEPDIR)/indirect_reqsize.Plo -rm -f ./$(DEPDIR)/indirect_size_get.Plo -rm -f ./$(DEPDIR)/indirect_table.Plo -rm -f ./$(DEPDIR)/indirect_texture_compression.Plo -rm -f ./$(DEPDIR)/indirect_util.Plo -rm -f ./$(DEPDIR)/render2.Plo -rm -f ./$(DEPDIR)/render2swap.Plo -rm -f ./$(DEPDIR)/renderpix.Plo -rm -f ./$(DEPDIR)/renderpixswap.Plo -rm -f ./$(DEPDIR)/rensize.Plo -rm -f ./$(DEPDIR)/single2.Plo -rm -f ./$(DEPDIR)/single2swap.Plo -rm -f ./$(DEPDIR)/singlepix.Plo -rm -f ./$(DEPDIR)/singlepixswap.Plo -rm -f ./$(DEPDIR)/singlesize.Plo -rm -f ./$(DEPDIR)/swap_interval.Plo -rm -f ./$(DEPDIR)/vndcmds.Plo -rm -f ./$(DEPDIR)/vndext.Plo -rm -f ./$(DEPDIR)/vndservermapping.Plo -rm -f ./$(DEPDIR)/vndservervendor.Plo -rm -f ./$(DEPDIR)/xfont.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/clientinfo.Plo -rm -f ./$(DEPDIR)/createcontext.Plo -rm -f ./$(DEPDIR)/extension_string.Plo -rm -f ./$(DEPDIR)/glxcmds.Plo -rm -f ./$(DEPDIR)/glxcmdsswap.Plo -rm -f ./$(DEPDIR)/glxdri2.Plo -rm -f ./$(DEPDIR)/glxdricommon.Plo -rm -f ./$(DEPDIR)/glxdriswrast.Plo -rm -f ./$(DEPDIR)/glxext.Plo -rm -f ./$(DEPDIR)/glxscreens.Plo -rm -f ./$(DEPDIR)/indirect_dispatch.Plo -rm -f ./$(DEPDIR)/indirect_dispatch_swap.Plo -rm -f ./$(DEPDIR)/indirect_program.Plo -rm -f ./$(DEPDIR)/indirect_reqsize.Plo -rm -f ./$(DEPDIR)/indirect_size_get.Plo -rm -f ./$(DEPDIR)/indirect_table.Plo -rm -f ./$(DEPDIR)/indirect_texture_compression.Plo -rm -f ./$(DEPDIR)/indirect_util.Plo -rm -f ./$(DEPDIR)/render2.Plo -rm -f ./$(DEPDIR)/render2swap.Plo -rm -f ./$(DEPDIR)/renderpix.Plo -rm -f ./$(DEPDIR)/renderpixswap.Plo -rm -f ./$(DEPDIR)/rensize.Plo -rm -f ./$(DEPDIR)/single2.Plo -rm -f ./$(DEPDIR)/single2swap.Plo -rm -f ./$(DEPDIR)/singlepix.Plo -rm -f ./$(DEPDIR)/singlepixswap.Plo -rm -f ./$(DEPDIR)/singlesize.Plo -rm -f ./$(DEPDIR)/swap_interval.Plo -rm -f ./$(DEPDIR)/vndcmds.Plo -rm -f ./$(DEPDIR)/vndext.Plo -rm -f ./$(DEPDIR)/vndservermapping.Plo -rm -f ./$(DEPDIR)/vndservervendor.Plo -rm -f ./$(DEPDIR)/xfont.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/glx/glxdricommon.c0000644000175000017500000003101613640201473014447 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include "extinit.h" #include "glxserver.h" #include "glxext.h" #include "glxcontext.h" #include "glxscreens.h" #include "glxdricommon.h" #define __ATTRIB(attrib, field) \ { attrib, offsetof(__GLXconfig, field) } static const struct { unsigned int attrib, offset; } attribMap[] = { __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), __ATTRIB(__DRI_ATTRIB_LEVEL, level), __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), __ATTRIB(__DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE, sRGBCapable), }; static void setScalar(__GLXconfig * config, unsigned int attrib, unsigned int value) { int i; for (i = 0; i < ARRAY_SIZE(attribMap); i++) if (attribMap[i].attrib == attrib) { *(unsigned int *) ((char *) config + attribMap[i].offset) = value; return; } } static Bool render_type_is_pbuffer_only(unsigned renderType) { /* The GL_ARB_color_buffer_float spec says: * * "Note that floating point rendering is only supported for * GLXPbuffer drawables. The GLX_DRAWABLE_TYPE attribute of the * GLXFBConfig must have the GLX_PBUFFER_BIT bit set and the * GLX_RENDER_TYPE attribute must have the GLX_RGBA_FLOAT_BIT set." */ return !!(renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT | __DRI_ATTRIB_FLOAT_BIT)); } static __GLXconfig * createModeFromConfig(const __DRIcoreExtension * core, const __DRIconfig * driConfig, unsigned int visualType, GLboolean duplicateForComp) { __GLXDRIconfig *config; GLint renderType = 0; unsigned int attrib, value, drawableType = GLX_PBUFFER_BIT; int i; config = calloc(1, sizeof *config); config->driConfig = driConfig; i = 0; while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) { switch (attrib) { case __DRI_ATTRIB_RENDER_TYPE: if (value & __DRI_ATTRIB_RGBA_BIT) renderType |= GLX_RGBA_BIT; if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) renderType |= GLX_COLOR_INDEX_BIT; if (value & __DRI_ATTRIB_FLOAT_BIT) renderType |= GLX_RGBA_FLOAT_BIT_ARB; if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT) renderType |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT; break; case __DRI_ATTRIB_CONFIG_CAVEAT: if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG) config->config.visualRating = GLX_NON_CONFORMANT_CONFIG; else if (value & __DRI_ATTRIB_SLOW_BIT) config->config.visualRating = GLX_SLOW_CONFIG; else config->config.visualRating = GLX_NONE; break; case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS: config->config.bindToTextureTargets = 0; if (value & __DRI_ATTRIB_TEXTURE_1D_BIT) config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT; if (value & __DRI_ATTRIB_TEXTURE_2D_BIT) config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT; if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT) config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT; break; case __DRI_ATTRIB_SWAP_METHOD: /* Workaround for broken dri drivers */ if (value != GLX_SWAP_UNDEFINED_OML && value != GLX_SWAP_COPY_OML && value != GLX_SWAP_EXCHANGE_OML) value = GLX_SWAP_UNDEFINED_OML; /* Fall through. */ default: setScalar(&config->config, attrib, value); break; } } if (!render_type_is_pbuffer_only(renderType)) drawableType |= GLX_WINDOW_BIT | GLX_PIXMAP_BIT; config->config.next = NULL; config->config.visualType = visualType; config->config.renderType = renderType; config->config.drawableType = drawableType; config->config.yInverted = GL_TRUE; #ifdef COMPOSITE if (!noCompositeExtension) { /* * Here we decide what fbconfigs will be duplicated for compositing. * fgbconfigs marked with duplicatedForConf will be reserved for * compositing visuals. * It might look strange to do this decision this late when translation * from a __DRIConfig is already done, but using the __DRIConfig * accessor function becomes worse both with respect to code complexity * and CPU usage. */ if (duplicateForComp && (render_type_is_pbuffer_only(renderType) || config->config.rgbBits != 32 || config->config.redBits != 8 || config->config.greenBits != 8 || config->config.blueBits != 8 || config->config.visualRating != GLX_NONE || config->config.sampleBuffers != 0)) { free(config); return NULL; } config->config.duplicatedForComp = duplicateForComp; } #endif return &config->config; } __GLXconfig * glxConvertConfigs(const __DRIcoreExtension * core, const __DRIconfig ** configs) { __GLXconfig head, *tail; int i; tail = &head; head.next = NULL; for (i = 0; configs[i]; i++) { tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR, GL_FALSE); if (tail->next == NULL) break; tail = tail->next; } for (i = 0; configs[i]; i++) { tail->next = createModeFromConfig(core, configs[i], GLX_DIRECT_COLOR, GL_FALSE); if (tail->next == NULL) break; tail = tail->next; } #ifdef COMPOSITE if (!noCompositeExtension) { /* Duplicate fbconfigs for use with compositing visuals */ for (i = 0; configs[i]; i++) { tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR, GL_TRUE); if (tail->next == NULL) continue; tail = tail->next; } } #endif return head.next; } static const char dri_driver_path[] = DRI_DRIVER_PATH; /* Temporary define to allow building without a dri_interface.h from * updated Mesa. Some day when we don't care about Mesa that old any * more this can be removed. */ #ifndef __DRI_DRIVER_GET_EXTENSIONS #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions" #endif void * glxProbeDriver(const char *driverName, void **coreExt, const char *coreName, int coreVersion, void **renderExt, const char *renderName, int renderVersion) { int i; void *driver; char filename[PATH_MAX]; char *get_extensions_name; const __DRIextension **extensions = NULL; const char *path = NULL; /* Search in LIBGL_DRIVERS_PATH if we're not setuid. */ if (!PrivsElevated()) path = getenv("LIBGL_DRIVERS_PATH"); if (!path) path = dri_driver_path; do { const char *next; int path_len; next = strchr(path, ':'); if (next) { path_len = next - path; next++; } else { path_len = strlen(path); next = NULL; } snprintf(filename, sizeof filename, "%.*s/%s_dri.so", path_len, path, driverName); driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); if (driver != NULL) break; LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n", filename, dlerror()); path = next; } while (path); if (driver == NULL) { LogMessage(X_ERROR, "AIGLX error: unable to load driver %s\n", driverName); goto cleanup_failure; } if (asprintf(&get_extensions_name, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, driverName) != -1) { const __DRIextension **(*get_extensions)(void); get_extensions = dlsym(driver, get_extensions_name); if (get_extensions) extensions = get_extensions(); free(get_extensions_name); } if (!extensions) extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS); if (extensions == NULL) { LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", driverName, dlerror()); goto cleanup_failure; } for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, coreName) == 0 && extensions[i]->version >= coreVersion) { *coreExt = (void *) extensions[i]; } if (strcmp(extensions[i]->name, renderName) == 0 && extensions[i]->version >= renderVersion) { *renderExt = (void *) extensions[i]; } } if (*coreExt == NULL || *renderExt == NULL) { LogMessage(X_ERROR, "AIGLX error: %s does not export required DRI extension\n", driverName); goto cleanup_failure; } return driver; cleanup_failure: if (driver) dlclose(driver); *coreExt = *renderExt = NULL; return NULL; } xorg-server-1.20.8/glx/glxcontext.h0000644000175000017500000001132413640201473014151 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_context_h_ #define _GLX_context_h_ /* * 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. */ struct __GLXcontext { void (*destroy) (__GLXcontext * context); int (*makeCurrent) (__GLXcontext * context); int (*loseCurrent) (__GLXcontext * context); int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask); Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error); /* EXT_texture_from_pixmap */ int (*bindTexImage) (__GLXcontext * baseContext, int buffer, __GLXdrawable * pixmap); int (*releaseTexImage) (__GLXcontext * baseContext, int buffer, __GLXdrawable * pixmap); /* ** list of context structs */ __GLXcontext *next; /* ** config struct for this context */ __GLXconfig *config; /* ** Pointer to screen info data for this context. This is set ** when the context is created. */ __GLXscreen *pGlxScreen; /* ** If this context is current for a client, this will be that client */ ClientPtr currentClient; /* ** The XID of this context. */ XID id; /* ** The XID of the shareList context. */ XID share_id; /* ** Whether this context's ID still exists. */ GLboolean idExists; /* ** Whether this context is a direct rendering context. */ GLboolean isDirect; /* ** Current rendering mode for this context. */ GLenum renderMode; /** * Reset notification strategy used when a GPU reset occurs. */ GLenum resetNotificationStrategy; /** * Context release behavior */ GLenum releaseBehavior; /* ** Buffers for feedback and selection. */ GLfloat *feedbackBuf; GLint feedbackBufSize; /* number of elements allocated */ GLuint *selectBuf; GLint selectBufSize; /* number of elements allocated */ /* ** Keep track of large rendering commands, which span multiple requests. */ GLint largeCmdBytesSoFar; /* bytes received so far */ GLint largeCmdBytesTotal; /* total bytes expected */ GLint largeCmdRequestsSoFar; /* requests received so far */ GLint largeCmdRequestsTotal; /* total requests expected */ GLbyte *largeCmdBuf; GLint largeCmdBufSize; /* ** The drawable private this context is bound to */ __GLXdrawable *drawPriv; __GLXdrawable *readPriv; }; void __glXContextDestroy(__GLXcontext * context); extern int validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen, int *err); extern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id, __GLXconfig ** config, int *err); extern int validGlxContext(ClientPtr client, XID id, int access_mode, __GLXcontext ** context, int *err); extern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen, __GLXconfig * modes, __GLXcontext * shareContext); #endif /* !__GLX_context_h__ */ xorg-server-1.20.8/glx/clientinfo.c0000644000175000017500000001012013640201473014070 00000000000000/* * Copyright © 2011 Intel Corporation * * 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 #endif #include "glxserver.h" #include "indirect_dispatch.h" #include "glxbyteorder.h" #include "unpack.h" static int set_client_info(__GLXclientState * cl, xGLXSetClientInfoARBReq * req, unsigned bytes_per_version) { ClientPtr client = cl->client; char *gl_extensions; char *glx_extensions; int size; REQUEST_AT_LEAST_SIZE(xGLXSetClientInfoARBReq); /* Verify that the size of the packet matches the size inferred from the * sizes specified for the various fields. */ size = sz_xGLXSetClientInfoARBReq; size = safe_add(size, safe_mul(req->numVersions, bytes_per_version)); size = safe_add(size, safe_pad(req->numGLExtensionBytes)); size = safe_add(size, safe_pad(req->numGLXExtensionBytes)); if (size < 0 || req->length != (size / 4)) return BadLength; /* Verify that the actual length of the GL extension string matches what's * encoded in protocol packet. */ gl_extensions = (char *) (req + 1) + (req->numVersions * bytes_per_version); if (req->numGLExtensionBytes != 0 && memchr(gl_extensions, 0, __GLX_PAD(req->numGLExtensionBytes)) == NULL) return BadLength; /* Verify that the actual length of the GLX extension string matches * what's encoded in protocol packet. */ glx_extensions = gl_extensions + __GLX_PAD(req->numGLExtensionBytes); if (req->numGLXExtensionBytes != 0 && memchr(glx_extensions, 0, __GLX_PAD(req->numGLXExtensionBytes)) == NULL) return BadLength; free(cl->GLClientextensions); cl->GLClientextensions = strdup(gl_extensions); return 0; } int __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) { return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 8); } int __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc; REQUEST_AT_LEAST_SIZE(xGLXSetClientInfoARBReq); req->length = bswap_16(req->length); req->numVersions = bswap_32(req->numVersions); req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes); req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes); return __glXDisp_SetClientInfoARB(cl, pc); } int __glXDisp_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc) { return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 12); } int __glXDispSwap_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc; REQUEST_AT_LEAST_SIZE(xGLXSetClientInfoARBReq); req->length = bswap_16(req->length); req->numVersions = bswap_32(req->numVersions); req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes); req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes); return __glXDisp_SetClientInfo2ARB(cl, pc); } xorg-server-1.20.8/glx/render2swap.c0000644000175000017500000002575113640201473014212 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "unpack.h" #include "indirect_size.h" #include "indirect_dispatch.h" 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 = __glMap1f_size(target); if (order <= 0 || k < 0) { /* Erroneous command. */ compsize = 0; } else { compsize = order * k; } __GLX_SWAP_FLOAT_ARRAY(points, compsize); glMap1f(target, u1, u2, k, order, points); } 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 = __glMap2f_size(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); glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } 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 = __glMap1d_size(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 glMap1d(target, u1, u2, k, order, points); } 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 = __glMap2d_size(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 glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } 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; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLenum primType = hdr->primType; GLint stride = 0; int i; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&numVertexes); __GLX_SWAP_INT(&numComponents); __GLX_SWAP_INT(&primType); pc += sizeof(__GLXdispatchDrawArraysHeader); compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; /* compute stride (same for all component arrays) */ for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; __GLX_SWAP_INT(&datatype); __GLX_SWAP_INT(&numVals); __GLX_SWAP_INT(&component); stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); } pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); /* set up component arrays */ for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; __GLX_SWAP_INT(&datatype); __GLX_SWAP_INT(&numVals); __GLX_SWAP_INT(&component); swapArray(numVals, datatype, stride, numVertexes, pc); switch (component) { case GL_VERTEX_ARRAY: glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(numVals, datatype, stride, pc); break; case GL_NORMAL_ARRAY: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(datatype, stride, pc); break; case GL_COLOR_ARRAY: glEnableClientState(GL_COLOR_ARRAY); glColorPointer(numVals, datatype, stride, pc); break; case GL_INDEX_ARRAY: glEnableClientState(GL_INDEX_ARRAY); glIndexPointer(datatype, stride, pc); break; case GL_TEXTURE_COORD_ARRAY: glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(numVals, datatype, stride, pc); break; case GL_EDGE_FLAG_ARRAY: glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *) pc); break; case GL_SECONDARY_COLOR_ARRAY: { PFNGLSECONDARYCOLORPOINTERPROC SecondaryColorPointerEXT = __glGetProcAddress("glSecondaryColorPointerEXT"); glEnableClientState(GL_SECONDARY_COLOR_ARRAY); SecondaryColorPointerEXT(numVals, datatype, stride, pc); break; } case GL_FOG_COORD_ARRAY: { PFNGLFOGCOORDPOINTERPROC FogCoordPointerEXT = __glGetProcAddress("glFogCoordPointerEXT"); glEnableClientState(GL_FOG_COORD_ARRAY); FogCoordPointerEXT(datatype, stride, pc); break; } default: break; } pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); } glDrawArrays(primType, 0, numVertexes); /* turn off anything we might have turned on */ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_INDEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); glDisableClientState(GL_FOG_COORD_ARRAY); } xorg-server-1.20.8/glx/vndserver.h0000644000175000017500000000774713640201473014006 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #ifndef VNDSERVER_H #define VNDSERVER_H #include #include "glxvndabi.h" #define GLXContextID CARD32 #define GLXDrawable CARD32 #if defined(__cplusplus) extern "C" { #endif typedef struct GlxScreenPrivRec { GlxServerVendor *vendor; } GlxScreenPriv; typedef struct GlxContextTagInfoRec { GLXContextTag tag; ClientPtr client; GlxServerVendor *vendor; void *data; GLXContextID context; GLXDrawable drawable; GLXDrawable readdrawable; } GlxContextTagInfo; typedef struct GlxClientPrivRec { GlxContextTagInfo *contextTags; unsigned int contextTagCount; /** * The vendor handles for each screen. */ GlxServerVendor **vendors; } GlxClientPriv; extern int GlxErrorBase; extern RESTYPE idResource; extern ExtensionEntry *GlxExtensionEntry; Bool GlxDispatchInit(void); void GlxDispatchReset(void); /** * Handles a request from the client. * * This function will look up the correct handler function and forward the * request to it. */ int GlxDispatchRequest(ClientPtr client); /** * Looks up the GlxClientPriv struct for a client. If we don't have a * GlxClientPriv struct yet, then allocate one. */ GlxClientPriv *GlxGetClientData(ClientPtr client); /** * Frees any data that's specific to a client. This should be called when a * client disconnects. */ void GlxFreeClientData(ClientPtr client); Bool GlxAddXIDMap(XID id, GlxServerVendor *vendor); GlxServerVendor * GlxGetXIDMap(XID id); void GlxRemoveXIDMap(XID id); /** * Records the client that sent the current request. This is needed in * GlxGetXIDMap to know which client's (screen -> vendor) mapping to use for a * regular X window. */ void GlxSetRequestClient(ClientPtr client); GlxContextTagInfo *GlxAllocContextTag(ClientPtr client, GlxServerVendor *vendor); GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag); void GlxFreeContextTag(GlxContextTagInfo *tagInfo); Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor); Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen); GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen); static inline CARD32 GlxCheckSwap(ClientPtr client, CARD32 value) { if (client->swapped) { value = ((value & 0XFF000000) >> 24) | ((value & 0X00FF0000) >> 8) | ((value & 0X0000FF00) << 8) | ((value & 0X000000FF) << 24); } return value; } #if defined(__cplusplus) } #endif _X_EXPORT const GlxServerExports *glvndGetExports(void); #endif // VNDSERVER_H xorg-server-1.20.8/glx/indirect_util.c0000644000175000017500000002161013640201473014602 00000000000000/* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "indirect_size.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxserver.h" #include "glxbyteorder.h" #include "singlesize.h" #include "glxext.h" #include "indirect_table.h" #include "indirect_util.h" #define __GLX_PAD(a) (((a)+3)&~3) GLint __glGetBooleanv_variable_size(GLenum e) { if (e == GL_COMPRESSED_TEXTURE_FORMATS) { GLint temp; glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &temp); return temp; } else { return 0; } } /** * Get a properly aligned buffer to hold reply data. * * \warning * This function assumes that \c local_buffer is already properly aligned. * It also assumes that \c alignment is a power of two. */ void * __glXGetAnswerBuffer(__GLXclientState * cl, size_t required_size, void *local_buffer, size_t local_size, unsigned alignment) { void *buffer = local_buffer; const intptr_t mask = alignment - 1; if (local_size < required_size) { size_t worst_case_size; intptr_t temp_buf; if (required_size < SIZE_MAX - alignment) worst_case_size = required_size + alignment; else return NULL; if (cl->returnBufSize < worst_case_size) { void *temp = realloc(cl->returnBuf, worst_case_size); if (temp == NULL) { return NULL; } cl->returnBuf = temp; cl->returnBufSize = worst_case_size; } temp_buf = (intptr_t) cl->returnBuf; temp_buf = (temp_buf + mask) & ~mask; buffer = (void *) temp_buf; } return buffer; } /** * Send a GLX reply to the client. * * Technically speaking, there are several different ways to encode a GLX * reply. The primary difference is whether or not certain fields (e.g., * retval, size, and "pad3") are set. This function gets around that by * always setting all of the fields to "reasonable" values. This does no * harm to clients, but it does make the server-side code much more compact. */ void __glXSendReply(ClientPtr client, const void *data, size_t elements, size_t element_size, GLboolean always_array, CARD32 retval) { size_t reply_ints = 0; xGLXSingleReply reply = { 0, }; if (__glXErrorOccured()) { elements = 0; } else if ((elements > 1) || always_array) { reply_ints = bytes_to_int32(elements * element_size); } reply.length = reply_ints; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.size = elements; reply.retval = retval; /* It is faster on almost always every architecture to just copy the 8 * bytes, even when not necessary, than check to see of the value of * elements requires it. Copying the data when not needed will do no * harm. */ (void) memcpy(&reply.pad3, data, 8); WriteToClient(client, sz_xGLXSingleReply, &reply); if (reply_ints != 0) { WriteToClient(client, reply_ints * 4, data); } } /** * Send a GLX reply to the client. * * Technically speaking, there are several different ways to encode a GLX * reply. The primary difference is whether or not certain fields (e.g., * retval, size, and "pad3") are set. This function gets around that by * always setting all of the fields to "reasonable" values. This does no * harm to clients, but it does make the server-side code much more compact. * * \warning * This function assumes that values stored in \c data will be byte-swapped * by the caller if necessary. */ void __glXSendReplySwap(ClientPtr client, const void *data, size_t elements, size_t element_size, GLboolean always_array, CARD32 retval) { size_t reply_ints = 0; xGLXSingleReply reply = { 0, }; if (__glXErrorOccured()) { elements = 0; } else if ((elements > 1) || always_array) { reply_ints = bytes_to_int32(elements * element_size); } reply.length = bswap_32(reply_ints); reply.type = X_Reply; reply.sequenceNumber = bswap_16(client->sequence); reply.size = bswap_32(elements); reply.retval = bswap_32(retval); /* It is faster on almost always every architecture to just copy the 8 * bytes, even when not necessary, than check to see of the value of * elements requires it. Copying the data when not needed will do no * harm. */ (void) memcpy(&reply.pad3, data, 8); WriteToClient(client, sz_xGLXSingleReply, &reply); if (reply_ints != 0) { WriteToClient(client, reply_ints * 4, data); } } static int get_decode_index(const struct __glXDispatchInfo *dispatch_info, unsigned opcode) { int remaining_bits; int next_remain; const int_fast16_t *const tree = dispatch_info->dispatch_tree; int_fast16_t index; remaining_bits = dispatch_info->bits; if (opcode >= (1U << remaining_bits)) { return -1; } index = 0; for ( /* empty */ ; remaining_bits > 0; remaining_bits = next_remain) { unsigned mask; unsigned child_index; /* Calculate the slice of bits used by this node. * * If remaining_bits = 8 and tree[index] = 3, the mask of just the * remaining bits is 0x00ff and the mask for the remaining bits after * this node is 0x001f. By taking 0x00ff & ~0x001f, we get 0x00e0. * This masks the 3 bits that we would want for this node. */ next_remain = remaining_bits - tree[index]; mask = ((1 << remaining_bits) - 1) & ~((1 << next_remain) - 1); /* Using the mask, calculate the index of the opcode in the node. * With that index, fetch the index of the next node. */ child_index = (opcode & mask) >> next_remain; index = tree[index + 1 + child_index]; /* If the next node is an empty leaf, the opcode is for a non-existant * function. We're done. * * If the next node is a non-empty leaf, look up the function pointer * and return it. */ if (index == EMPTY_LEAF) { return -1; } else if (IS_LEAF_INDEX(index)) { unsigned func_index; /* The value stored in the tree for a leaf node is the base of * the function pointers for that leaf node. The offset for the * function for a particular opcode is the remaining bits in the * opcode. */ func_index = -index; func_index += opcode & ((1 << next_remain) - 1); return func_index; } } /* We should *never* get here!!! */ return -1; } void * __glXGetProtocolDecodeFunction(const struct __glXDispatchInfo *dispatch_info, int opcode, int swapped_version) { const int func_index = get_decode_index(dispatch_info, opcode); return (func_index < 0) ? NULL : (void *) dispatch_info-> dispatch_functions[func_index][swapped_version]; } int __glXGetProtocolSizeData(const struct __glXDispatchInfo *dispatch_info, int opcode, __GLXrenderSizeData * data) { if (dispatch_info->size_table != NULL) { const int func_index = get_decode_index(dispatch_info, opcode); if ((func_index >= 0) && (dispatch_info->size_table[func_index][0] != 0)) { const int var_offset = dispatch_info->size_table[func_index][1]; data->bytes = dispatch_info->size_table[func_index][0]; data->varsize = (var_offset != ~0) ? dispatch_info->size_func_table[var_offset] : NULL; return 0; } } return -1; } xorg-server-1.20.8/glx/renderpix.c0000644000175000017500000000547013640201473013752 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "unpack.h" #include "indirect_dispatch.h" void __glXDisp_SeparableFilter2D(GLbyte * pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLint hdrlen, image1len; hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); /* XXX check this usage - internal code called ** a version without the packing parameters */ image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1, 0, hdr->rowLength, 0, hdr->skipRows, hdr->alignment); image1len = __GLX_PAD(image1len); glSeparableFilter2D(hdr->target, hdr->internalformat, hdr->width, hdr->height, hdr->format, hdr->type, ((GLubyte *) hdr + hdrlen), ((GLubyte *) hdr + hdrlen + image1len)); } xorg-server-1.20.8/glx/indirect_dispatch.h0000644000175000017500000025422013640201473015436 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _INDIRECT_DISPATCH_H_ ) #define _INDIRECT_DISPATCH_H_ #include struct __GLXclientStateRec; extern _X_HIDDEN void __glXDisp_MapGrid1d(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MapGrid1d(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MapGrid1f(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MapGrid1f(GLbyte * pc); extern _X_HIDDEN int __glXDisp_NewList(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Histogram(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Histogram(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMapfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord1dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1dv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Color3uiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3uiv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_IsEnabled(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsEnabled(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib4svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_FramebufferTexture1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FramebufferTexture1D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Indexubv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib1sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib1sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color3ubv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_LightModeliv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Normal3bv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Normal3bv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexGeniv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RenderbufferStorage(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RenderbufferStorage(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GenQueries(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenQueries(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BlendColor(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CompressedTexImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CompressedTexImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Scalef(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Scalef(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Normal3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PassThrough(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Viewport(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Viewport(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_DepthRange(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetQueryiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetQueryiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CompressedTexSubImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3uiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3uiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4Nbv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nbv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_DeleteRenderbuffers(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DeleteRenderbuffers(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord3iv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib4usv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4usv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color3fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord4sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PointSize(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PointSize(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PopName(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PopName(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib2dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4Nusv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nusv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ClampColor(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClampColor(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_LineStipple(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LineStipple(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexEnvi(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexEnvi(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttribs3dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs4fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Scaled(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Scaled(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CallLists(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CallLists(GLbyte * pc); extern _X_HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Rotated(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Rotated(GLbyte * pc); extern _X_HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CompressedTexSubImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexParameterf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexParameteri(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexParameteri(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DestroyContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_DrawPixels(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3sv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_MapGrid2d(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MapGrid2d(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MapGrid2f(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MapGrid2f(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Scissor(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Scissor(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Fogf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Fogf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexSubImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexSubImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color4usv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4usv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Fogi(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Fogi(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos3iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color3usv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord2iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2iv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Color3bv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ColorTable(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Accum(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Accum(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexImage(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexImage(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ConvolutionFilter2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_Finish(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ClearStencil(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord4dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos4fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ClearIndex(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc); extern _X_HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PushMatrix(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BindFramebuffer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BindFramebuffer(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BlendFuncSeparate(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BlendFuncSeparate(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Normal3fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_End(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_End(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateContextAttribsARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateContextAttribsARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BindTexture(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib2sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib2sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexGenfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_DrawBuffers(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DrawBuffers(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BlendEquation(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BlendEquation(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetError(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetError(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Indexdv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PushName(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PushName(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib1dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_IsRenderbuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsRenderbuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_DepthMask(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color4iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_StencilOp(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc); extern _X_HIDDEN void __glXDisp_FramebufferTextureLayer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FramebufferTextureLayer(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Ortho(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Ortho(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexEnvfv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_QueryServerString(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_QueryServerString(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color4bv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DeleteLists(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DeleteLists(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_LogicOp(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LogicOp(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ActiveTexture(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ActiveTexture(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3bv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3bv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color4ubv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4ubv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord4iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_DepthFunc(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_BlendFunc(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc); extern _X_HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_CompressedTexImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CompressedTexImage2D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Color4uiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord1sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PushAttrib(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_RasterPos3fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos3fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Indexiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PointParameterfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PointParameterfv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Frustum(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Frustum(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetString(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexEnvf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GenProgramsARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenProgramsARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ClearAccum(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClearAccum(GLbyte * pc); extern _X_HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_FramebufferTexture3D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FramebufferTexture3D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord2dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Lightfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetFramebufferAttachmentParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ClearDepth(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color4fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Lightiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib3sv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_IsQuery(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsQuery(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Rectdv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Materialiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PolygonMode(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4Niv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Niv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexGeni(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexGenf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexGenf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexGend(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexGend(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Color4sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PixelZoom(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ColorTableParameterfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PixelMapuiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PixelMapuiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_BeginQuery(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BeginQuery(GLbyte * pc); extern _X_HIDDEN int __glXDisp_SetClientInfo2ARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_SetClientInfo2ARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_MultiTexCoord3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3iv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc); extern _X_HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_RasterPos2iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos2iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_FrontFace(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FrontFace(GLbyte * pc); extern _X_HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Normal3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Lightf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Lightf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MatrixMode(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MatrixMode(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Lighti(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Lighti(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GenFramebuffers(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenFramebuffers(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_IsFramebuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsFramebuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BlendEquationSeparate(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BlendEquationSeparate(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetDoublev(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetDoublev(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CompressedTexImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CompressedTexImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ClearColor(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc); extern _X_HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3ubv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ubv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PointParameteri(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PointParameteri(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PointParameterf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PointParameterf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexEnviv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4iv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_FramebufferTexture2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FramebufferTexture2D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Bitmap(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_CheckFramebufferStatus(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CheckFramebufferStatus(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BindProgramARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BindProgramARB(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetQueryObjectuiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetQueryObjectuiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Map1d(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Map1d(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Map1f(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Map1f(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexImage2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc); extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Fogiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EndQuery(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EndQuery(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Clear(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Clear(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_LightModeli(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ListBase(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ListBase(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_CallList(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CallList(GLbyte * pc); extern _X_HIDDEN void __glXDisp_GenerateMipmap(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_GenerateMipmap(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Rectiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord1iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetQueryObjectiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetQueryObjectiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_SetClientInfoARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_SetClientInfoARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CompressedTexSubImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage3D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_LineWidth(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexGendv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_WindowPos3fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_WindowPos3fv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DeleteProgramsARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DeleteProgramsARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ShadeModel(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ShadeModel(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Materialfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Materialfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc); extern _X_HIDDEN void __glXDisp_DrawArrays(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SampleCoverage(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SampleCoverage(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color3iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4ubv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_PointParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PointParameteriv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Rotatef(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_BindRenderbuffer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BindRenderbuffer(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PopMatrix(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc); extern _X_HIDDEN void __glXDisp_DeleteFramebuffers(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_DeleteFramebuffers(GLbyte * pc); extern _X_HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_FramebufferRenderbuffer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FramebufferRenderbuffer(GLbyte * pc); extern _X_HIDDEN int __glXDisp_IsProgramARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsProgramARB(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib4uiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4uiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4Nsv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nsv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Map2d(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Map2d(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Map2f(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Map2f(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4bv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4bv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Materialf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Materialf(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Materiali(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Materiali(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Indexsv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_LightModelfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Translated(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Translated(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Translatef(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Translatef(GLbyte * pc); extern _X_HIDDEN void __glXDisp_StencilMask(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc); extern _X_HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetLightiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetLightiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_LoadName(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LoadName(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CullFace(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CullFace(GLbyte * pc); extern _X_HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_StencilFunc(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyPixels(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyPixels(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Rectsv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Rectsv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib4Nubv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nubv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_ClipPlane(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3usv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3usv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord3dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3dv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Indexfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Indexfv(GLbyte * pc); extern _X_HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDisp_BlitFramebuffer(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_BlitFramebuffer(GLbyte * pc); extern _X_HIDDEN void __glXDisp_IndexMask(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_FogCoorddv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_FogCoorddv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_PopAttrib(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Fogfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Fogfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_InitNames(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_InitNames(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Normal3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Minmax(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Minmax(GLbyte * pc); extern _X_HIDDEN int __glXDisp_DeleteQueries(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_DeleteQueries(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Hint(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Hint(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Color4dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc); extern _X_HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Begin(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Begin(GLbyte * pc); extern _X_HIDDEN int __glXDisp_ClientInfo(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_ClientInfo(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Rectfv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Rectfv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_LightModelf(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_LightModelf(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetLightfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetLightfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_Disable(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Disable(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc); extern _X_HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_ColorMask(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_ColorMask(GLbyte * pc); extern _X_HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Enable(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Enable(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GetRenderbufferParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetRenderbufferParameteriv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc); extern _X_HIDDEN int __glXDisp_GenRenderbuffers(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GenRenderbuffers(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); extern _X_HIDDEN void __glXDisp_VertexAttrib4Nuiv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nuiv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_SecondaryColor3sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_SecondaryColor3sv(GLbyte * pc); extern _X_HIDDEN void __glXDisp_MultiTexCoord2sv(GLbyte * pc); extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2sv(GLbyte * pc); #endif /* !defined( _INDIRECT_DISPATCH_H_ ) */ xorg-server-1.20.8/glx/glxdriswrast.c0000644000175000017500000003526513640201473014514 00000000000000/* * Copyright © 2008 George Sapountzis * 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_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include "scrnintstr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "os.h" #include "glxserver.h" #include "glxutil.h" #include "glxdricommon.h" #include "extension_string.h" /* RTLD_LOCAL is not defined on Cygwin */ #ifdef __CYGWIN__ #ifndef RTLD_LOCAL #define RTLD_LOCAL 0 #endif #endif typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; struct __GLXDRIscreen { __GLXscreen base; __DRIscreen *driScreen; void *driver; const __DRIcoreExtension *core; const __DRIswrastExtension *swrast; const __DRIcopySubBufferExtension *copySubBuffer; const __DRItexBufferExtension *texBuffer; const __DRIconfig **driConfigs; }; struct __GLXDRIcontext { __GLXcontext base; __DRIcontext *driContext; }; struct __GLXDRIdrawable { __GLXdrawable base; __DRIdrawable *driDrawable; __GLXDRIscreen *screen; }; /* white lie */ extern glx_func_ptr glXGetProcAddressARB(const char *); static void __glXDRIdrawableDestroy(__GLXdrawable * drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; const __DRIcoreExtension *core = private->screen->core; (*core->destroyDrawable) (private->driDrawable); __glXDrawableRelease(drawable); free(private); } static GLboolean __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; const __DRIcoreExtension *core = private->screen->core; (*core->swapBuffers) (private->driDrawable); return TRUE; } static void __glXDRIdrawableCopySubBuffer(__GLXdrawable * basePrivate, int x, int y, int w, int h) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; const __DRIcopySubBufferExtension *copySubBuffer = private->screen->copySubBuffer; if (copySubBuffer) (*copySubBuffer->copySubBuffer) (private->driDrawable, x, y, w, h); } static void __glXDRIcontextDestroy(__GLXcontext * baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; (*screen->core->destroyContext) (context->driContext); __glXContextDestroy(&context->base); free(context); } static int __glXDRIcontextMakeCurrent(__GLXcontext * baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; return (*screen->core->bindContext) (context->driContext, draw->driDrawable, read->driDrawable); } static int __glXDRIcontextLoseCurrent(__GLXcontext * baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; return (*screen->core->unbindContext) (context->driContext); } static int __glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc, unsigned long mask) { __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst; __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc; __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen; return (*screen->core->copyContext) (dst->driContext, src->driContext, mask); } static int __glXDRIbindTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * glxPixmap) { __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap; const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer; __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; if (texBuffer == NULL) return Success; #if __DRI_TEX_BUFFER_VERSION >= 2 if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) { (*texBuffer->setTexBuffer2) (context->driContext, glxPixmap->target, glxPixmap->format, drawable->driDrawable); } else #endif texBuffer->setTexBuffer(context->driContext, glxPixmap->target, drawable->driDrawable); return Success; } static int __glXDRIreleaseTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * pixmap) { /* FIXME: Just unbind the texture? */ return Success; } static __GLXcontext * __glXDRIscreenCreateContext(__GLXscreen * baseScreen, __GLXconfig * glxConfig, __GLXcontext * baseShareContext, unsigned num_attribs, const uint32_t *attribs, int *error) { __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; __GLXDRIcontext *context, *shareContext; __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; const __DRIconfig *driConfig = config ? config->driConfig : NULL; const __DRIcoreExtension *core = screen->core; __DRIcontext *driShare; /* DRISWRAST won't support createContextAttribs, so these parameters will * never be used. */ (void) num_attribs; (void) attribs; (void) error; shareContext = (__GLXDRIcontext *) baseShareContext; if (shareContext) driShare = shareContext->driContext; else driShare = NULL; context = calloc(1, sizeof *context); if (context == NULL) return NULL; context->base.config = glxConfig; context->base.destroy = __glXDRIcontextDestroy; context->base.makeCurrent = __glXDRIcontextMakeCurrent; context->base.loseCurrent = __glXDRIcontextLoseCurrent; context->base.copy = __glXDRIcontextCopy; context->base.bindTexImage = __glXDRIbindTexImage; context->base.releaseTexImage = __glXDRIreleaseTexImage; context->driContext = (*core->createNewContext) (screen->driScreen, driConfig, driShare, context); return &context->base; } static __GLXdrawable * __glXDRIscreenCreateDrawable(ClientPtr client, __GLXscreen * screen, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig * glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; __GLXDRIdrawable *private; private = calloc(1, sizeof *private); if (private == NULL) return NULL; private->screen = driScreen; if (!__glXDrawableInit(&private->base, screen, pDraw, type, glxDrawId, glxConfig)) { free(private); return NULL; } private->base.destroy = __glXDRIdrawableDestroy; private->base.swapBuffers = __glXDRIdrawableSwapBuffers; private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer; private->driDrawable = (*driScreen->swrast->createNewDrawable) (driScreen->driScreen, config->driConfig, private); return &private->base; } static void swrastGetDrawableInfo(__DRIdrawable * draw, int *x, int *y, int *w, int *h, void *loaderPrivate) { __GLXDRIdrawable *drawable = loaderPrivate; DrawablePtr pDraw = drawable->base.pDraw; *x = pDraw->x; *y = pDraw->y; *w = pDraw->width; *h = pDraw->height; } static void swrastPutImage(__DRIdrawable * draw, int op, int x, int y, int w, int h, char *data, void *loaderPrivate) { __GLXDRIdrawable *drawable = loaderPrivate; DrawablePtr pDraw = drawable->base.pDraw; GCPtr gc; __GLXcontext *cx = lastGLContext; if ((gc = GetScratchGC(pDraw->depth, pDraw->pScreen))) { ValidateGC(pDraw, gc); gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap, data); FreeScratchGC(gc); } if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } } static void swrastGetImage(__DRIdrawable * draw, int x, int y, int w, int h, char *data, void *loaderPrivate) { __GLXDRIdrawable *drawable = loaderPrivate; DrawablePtr pDraw = drawable->base.pDraw; ScreenPtr pScreen = pDraw->pScreen; __GLXcontext *cx = lastGLContext; pScreen->SourceValidate(pDraw, x, y, w, h, IncludeInferiors); pScreen->GetImage(pDraw, x, y, w, h, ZPixmap, ~0L, data); if (cx != lastGLContext) { lastGLContext = cx; cx->makeCurrent(cx); } } static const __DRIswrastLoaderExtension swrastLoaderExtension = { {__DRI_SWRAST_LOADER, 1}, swrastGetDrawableInfo, swrastPutImage, swrastGetImage }; static const __DRIextension *loader_extensions[] = { &swrastLoaderExtension.base, NULL }; static void initializeExtensions(__GLXscreen * screen) { const __DRIextension **extensions; __GLXDRIscreen *dri = (__GLXDRIscreen *)screen; int i; __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_no_config_context"); if (dri->swrast->base.version >= 3) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context"); __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_no_error"); __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_profile"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_create_context_es_profile"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_create_context_es2_profile"); } /* these are harmless to enable unconditionally */ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_framebuffer_sRGB"); __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_fbconfig_packed_float"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_texture_from_pixmap"); extensions = dri->core->getExtensions(dri->driScreen); for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { dri->copySubBuffer = (const __DRIcopySubBufferExtension *) extensions[i]; } if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { dri->texBuffer = (const __DRItexBufferExtension *) extensions[i]; } #ifdef __DRI2_FLUSH_CONTROL if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_context_flush_control"); } #endif } } static void __glXDRIscreenDestroy(__GLXscreen * baseScreen) { int i; __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; (*screen->core->destroyScreen) (screen->driScreen); dlclose(screen->driver); __glXScreenDestroy(baseScreen); if (screen->driConfigs) { for (i = 0; screen->driConfigs[i] != NULL; i++) free((__DRIconfig **) screen->driConfigs[i]); free(screen->driConfigs); } free(screen); } static __GLXscreen * __glXDRIscreenProbe(ScreenPtr pScreen) { const char *driverName = "swrast"; __GLXDRIscreen *screen; screen = calloc(1, sizeof *screen); if (screen == NULL) return NULL; screen->base.destroy = __glXDRIscreenDestroy; screen->base.createContext = __glXDRIscreenCreateContext; screen->base.createDrawable = __glXDRIscreenCreateDrawable; screen->base.swapInterval = NULL; screen->base.pScreen = pScreen; __glXInitExtensionEnableBits(screen->base.glx_enable_bits); screen->driver = glxProbeDriver(driverName, (void **) &screen->core, __DRI_CORE, 1, (void **) &screen->swrast, __DRI_SWRAST, 1); if (screen->driver == NULL) { goto handle_error; } screen->driScreen = (*screen->swrast->createNewScreen) (pScreen->myNum, loader_extensions, &screen->driConfigs, screen); if (screen->driScreen == NULL) { LogMessage(X_ERROR, "IGLX error: Calling driver entry point failed\n"); goto handle_error; } initializeExtensions(&screen->base); screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs); #if !defined(XQUARTZ) && !defined(WIN32) screen->base.glvnd = strdup("mesa"); #endif __glXScreenInit(&screen->base, pScreen); __glXsetGetProcAddress(glXGetProcAddressARB); LogMessage(X_INFO, "IGLX: Loaded and initialized %s\n", driverName); return &screen->base; handle_error: if (screen->driver) dlclose(screen->driver); free(screen); LogMessage(X_ERROR, "GLX: could not load software renderer\n"); return NULL; } __GLXprovider __glXDRISWRastProvider = { __glXDRIscreenProbe, "DRISWRAST", NULL }; xorg-server-1.20.8/glx/vndservervendor.c0000644000175000017500000000652313640201473015206 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #include "vndservervendor.h" struct xorg_list GlxVendorList = { &GlxVendorList, &GlxVendorList }; GlxServerVendor *GlxCreateVendor(const GlxServerImports *imports) { GlxServerVendor *vendor = NULL; if (imports == NULL) { ErrorF("GLX: Vendor library did not provide an imports table\n"); return NULL; } if (imports->extensionCloseDown == NULL || imports->handleRequest == NULL || imports->getDispatchAddress == NULL || imports->makeCurrent == NULL) { ErrorF("GLX: Vendor library is missing required callback functions.\n"); return NULL; } vendor = (GlxServerVendor *) calloc(1, sizeof(GlxServerVendor)); if (vendor == NULL) { ErrorF("GLX: Can't allocate vendor library.\n"); return NULL; } memcpy(&vendor->glxvc, imports, sizeof(GlxServerImports)); xorg_list_append(&vendor->entry, &GlxVendorList); return vendor; } void GlxDestroyVendor(GlxServerVendor *vendor) { if (vendor != NULL) { xorg_list_del(&vendor->entry); free(vendor); } } void GlxVendorExtensionReset(const ExtensionEntry *extEntry) { GlxServerVendor *vendor, *tempVendor; // TODO: Do we allow the driver to destroy a vendor library handle from // here? xorg_list_for_each_entry_safe(vendor, tempVendor, &GlxVendorList, entry) { if (vendor->glxvc.extensionCloseDown != NULL) { vendor->glxvc.extensionCloseDown(extEntry); } } // If the server is exiting instead of starting a new generation, then // free the remaining GlxServerVendor structs. // // XXX this used to be conditional on xf86ServerIsExiting, but it's // cleaner to just always create the vendor struct on every generation, // if nothing else so all ddxes get the same behavior. xorg_list_for_each_entry_safe(vendor, tempVendor, &GlxVendorList, entry) { GlxDestroyVendor(vendor); } } xorg-server-1.20.8/glx/singlesize.h0000644000175000017500000000472013640201473014130 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _singlesize_h_ #define _singlesize_h_ /* * 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 "indirect_size.h" extern GLint __glReadPixels_size(GLenum format, GLenum type, GLint width, GLint height); extern GLint __glGetMap_size(GLenum pname, GLenum query); extern GLint __glGetMapdv_size(GLenum target, GLenum query); extern GLint __glGetMapfv_size(GLenum target, GLenum query); extern GLint __glGetMapiv_size(GLenum target, GLenum query); extern GLint __glGetPixelMap_size(GLenum map); extern GLint __glGetPixelMapfv_size(GLenum map); extern GLint __glGetPixelMapuiv_size(GLenum map); extern GLint __glGetPixelMapusv_size(GLenum map); extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, GLenum type, GLint width, GLint height, GLint depth); #endif /* _singlesize_h_ */ xorg-server-1.20.8/glx/glxdrawable.h0000644000175000017500000000530313640201473014246 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_drawable_h_ #define _GLX_drawable_h_ /* * 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. */ /* We just need to avoid clashing with DRAWABLE_{WINDOW,PIXMAP} */ enum { GLX_DRAWABLE_WINDOW, GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_PBUFFER, GLX_DRAWABLE_ANY }; struct __GLXdrawable { void (*destroy) (__GLXdrawable * private); GLboolean(*swapBuffers) (ClientPtr client, __GLXdrawable *); void (*copySubBuffer) (__GLXdrawable * drawable, int x, int y, int w, int h); void (*waitX) (__GLXdrawable *); void (*waitGL) (__GLXdrawable *); DrawablePtr pDraw; XID drawId; /* ** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or ** GLX_DRAWABLE_PBUFFER. */ int type; /* ** Configuration of the visual to which this drawable was created. */ __GLXconfig *config; GLenum target; GLenum format; /* ** Event mask */ unsigned long eventMask; }; extern int validGlxDrawable(ClientPtr client, XID id, int type, int access_mode, __GLXdrawable **drawable, int *err); #endif /* !__GLX_drawable_h__ */ xorg-server-1.20.8/glx/indirect_program.c0000644000175000017500000001007513640201473015277 00000000000000/* * (C) Copyright IBM Corporation 2005, 2006 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file indirect_program.c * Hand-coded routines needed to support programmable pipeline extensions. * * \author Ian Romanick */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxbyteorder.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" /** * Handle both types of glGetProgramString calls. */ static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc, PFNGLGETPROGRAMIVARBPROC get_programiv, PFNGLGETPROGRAMSTRINGARBPROC get_program_string, Bool do_swap) { xGLXVendorPrivateWithReplyReq *const req = (xGLXVendorPrivateWithReplyReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateWithReplyReq, 8); pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { GLenum target; GLenum pname; GLint compsize = 0; char *answer = NULL, answerBuffer[200]; xGLXSingleReply reply = { 0, }; if (do_swap) { target = (GLenum) bswap_32(*(int *) (pc + 0)); pname = (GLenum) bswap_32(*(int *) (pc + 4)); } else { target = *(GLenum *) (pc + 0); pname = *(GLuint *) (pc + 4); } /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV * enumerants is the same. */ get_programiv(target, GL_PROGRAM_LENGTH_ARB, &compsize); if (compsize != 0) { __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); get_program_string(target, pname, (GLubyte *) answer); } if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *) &reply)->width = compsize; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } error = Success; } return error; } int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc) { PFNGLGETPROGRAMIVARBPROC get_program = __glGetProcAddress("glGetProgramivARB"); PFNGLGETPROGRAMSTRINGARBPROC get_program_string = __glGetProcAddress("glGetProgramStringARB"); return DoGetProgramString(cl, pc, get_program, get_program_string, FALSE); } int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc) { PFNGLGETPROGRAMIVARBPROC get_program = __glGetProcAddress("glGetProgramivARB"); PFNGLGETPROGRAMSTRINGARBPROC get_program_string = __glGetProcAddress("glGetProgramStringARB"); return DoGetProgramString(cl, pc, get_program, get_program_string, TRUE); } xorg-server-1.20.8/glx/meson.build0000644000175000017500000000331613640201473013745 00000000000000srcs_glx = [ 'indirect_dispatch.c', 'indirect_dispatch_swap.c', 'indirect_reqsize.c', 'indirect_size_get.c', 'indirect_table.c', 'clientinfo.c', 'createcontext.c', 'extension_string.c', 'indirect_util.c', 'indirect_program.c', 'indirect_texture_compression.c', 'glxcmds.c', 'glxcmdsswap.c', 'glxext.c', 'glxdriswrast.c', 'glxdricommon.c', 'glxscreens.c', 'render2.c', 'render2swap.c', 'renderpix.c', 'renderpixswap.c', 'rensize.c', 'single2.c', 'single2swap.c', 'singlepix.c', 'singlepixswap.c', 'singlesize.c', 'swap_interval.c', 'xfont.c', ] libxserver_glx = [] if build_glx libxserver_glx = static_library('libxserver_glx', srcs_glx, include_directories: inc, dependencies: [ common_dep, dl_dep, dependency('glproto', version: '>= 1.4.17'), dependency('gl', version: '>= 1.2'), ], c_args: [ glx_align64, # XXX: generated code includes an unused function '-Wno-unused-function', ] ) endif srcs_glxdri2 = [] if build_dri2 or build_dri3 srcs_glxdri2 = files('glxdri2.c') endif srcs_vnd = [ 'vndcmds.c', 'vndext.c', 'vndservermapping.c', 'vndservervendor.c', ] hdrs_vnd = [ 'vndserver.h', ] libglxvnd = '' if build_glx libglxvnd = static_library('libglxvnd', srcs_vnd, include_directories: inc, dependencies: [ common_dep, dl_dep, dependency('glproto', version: '>= 1.4.17'), dependency('gl', version: '>= 1.2'), ], ) install_data(hdrs_vnd, install_dir : xorgsdkdir) endif xorg-server-1.20.8/glx/indirect_size_get.h0000644000175000017500000001023613640201473015445 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2004 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _INDIRECT_SIZE_GET_H_ ) #define _INDIRECT_SIZE_GET_H_ /** * \file * Prototypes for functions used to determine the number of data elements in * various GLX protocol messages. * * \author Ian Romanick */ #include #if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) #define PURE __attribute__((pure)) #else #define PURE #endif #if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) #define FASTCALL __attribute__((fastcall)) #else #define FASTCALL #endif extern _X_INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetDoublev_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetFloatv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetIntegerv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetLightfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetLightiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetMaterialfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetMaterialiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexEnvfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexEnviv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexGendv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexGenfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexGeniv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetPointerv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetConvolutionParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetConvolutionParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectuiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryiv_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum); extern _X_INTERNAL PURE FASTCALL GLint __glGetFramebufferAttachmentParameteriv_size(GLenum); #undef PURE #undef FASTCALL #endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */ xorg-server-1.20.8/glx/singlepixswap.c0000644000175000017500000004414513640201473014651 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "indirect_dispatch.h" #include "indirect_size_get.h" int __glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc) { GLsizei width, height; GLenum format, type; GLboolean swapBytes, lsbFirst; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; xGLXSingleReply reply = { 0, }; REQUEST_FIXED_SIZE(xGLXSingleReq, 28); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); width = *(GLsizei *) (pc + 8); height = *(GLsizei *) (pc + 12); format = *(GLenum *) (pc + 16); type = *(GLenum *) (pc + 20); swapBytes = *(GLboolean *) (pc + 24); lsbFirst = *(GLboolean *) (pc + 25); compsize = __glReadPixels_size(format, type, width, height); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4), *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12), *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc) { GLint level, compsize; GLenum format, type, target; GLboolean swapBytes; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width = 0, height = 0, depth = 1; xGLXSingleReply reply = { 0, }; REQUEST_FIXED_SIZE(xGLXSingleReq, 20); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); level = *(GLint *) (pc + 4); format = *(GLenum *) (pc + 8); type = *(GLenum *) (pc + 12); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 16); glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); if (target == GL_TEXTURE_3D) { glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); } /* * The three queries above might fail if we're in a state where queries * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target, level, format, type, width, height, depth); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); __GLX_SWAP_INT(&depth); ((xGLXGetTexImageReply *) &reply)->width = width; ((xGLXGetTexImageReply *) &reply)->height = height; ((xGLXGetTexImageReply *) &reply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc) { GLboolean lsbFirst; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLubyte answerBuffer[200]; char *answer; xGLXSingleReply reply = { 0, }; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *) (pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1); __glXClearErrorOccured(); glGetPolygonStipple((GLubyte *) answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(128); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(128); } return Success; } static int GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize, compsize2; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width = 0, height = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); /* target must be SEPARABLE_2D, however I guess we can let the GL barf on this one.... */ glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); if ((compsize = safe_pad(compsize)) < 0) return BadLength; if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1); __glXClearErrorOccured(); glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer, answer + compsize, NULL); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize + compsize2); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); ((xGLXGetSeparableFilterReply *) &reply)->width = width; ((xGLXGetSeparableFilterReply *) &reply)->height = height; __GLX_SEND_VOID_ARRAY(compsize + compsize2); } return Success; } int __glXDispSwap_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDispSwap_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width = 0, height = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); if (target == GL_CONVOLUTION_2D) { height = 1; } else { glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); } /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); ((xGLXGetConvolutionFilterReply *) &reply)->width = width; ((xGLXGetConvolutionFilterReply *) &reply)->height = height; __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDispSwap_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); reset = *(GLboolean *) (pc + 13); glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetHistogram(target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); ((xGLXGetHistogramReply *) &reply)->width = width; __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetHistogram(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDispSwap_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); reset = *(GLboolean *) (pc + 13); compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetMinmax(target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMinmax(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDispSwap_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } static int GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); ((xGLXGetColorTableReply *) &reply)->width = width; __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } int __glXDispSwap_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } xorg-server-1.20.8/glx/indirect_reqsize.c0000644000175000017500000005212413640201473015313 00000000000000/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include #include "glxserver.h" #include "glxbyteorder.h" #include "indirect_size.h" #include "indirect_reqsize.h" #if defined(__CYGWIN__) || defined(__MINGW32__) #undef HAVE_ALIAS #endif #ifdef HAVE_ALIAS #define ALIAS2(from,to) \ GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \ __attribute__ ((alias( # to ))); #define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize ) #else #define ALIAS(from,to) \ GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \ { return __glX ## to ## ReqSize( pc, swap, reqlen ); } #endif int __glXCallListsReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 0); GLenum type = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { n = bswap_32(n); type = bswap_32(type); } compsize = __glCallLists_size(type); return safe_pad(safe_mul(compsize, n)); } int __glXBitmapReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLsizei width = *(GLsizei *) (pc + 20); GLsizei height = *(GLsizei *) (pc + 24); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); width = bswap_32(width); height = bswap_32(height); } return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXFogfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glFogfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXLightfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glLightfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXLightModelfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glLightModelfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXMaterialfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glMaterialfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXPolygonStippleReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); } return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXTexParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glTexParameterfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 32); GLenum format = *(GLenum *) (pc + 44); GLenum type = *(GLenum *) (pc + 48); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 32); GLsizei height = *(GLsizei *) (pc + 36); GLenum format = *(GLenum *) (pc + 44); GLenum type = *(GLenum *) (pc + 48); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); height = bswap_32(height); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glTexEnvfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXTexGendvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glTexGendv_size(pname); return safe_pad(safe_mul(compsize, 8)); } int __glXTexGenfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glTexGenfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei mapsize = *(GLsizei *) (pc + 4); if (swap) { mapsize = bswap_32(mapsize); } return safe_pad(safe_mul(mapsize, 4)); } int __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei mapsize = *(GLsizei *) (pc + 4); if (swap) { mapsize = bswap_32(mapsize); } return safe_pad(safe_mul(mapsize, 2)); } int __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLsizei width = *(GLsizei *) (pc + 20); GLsizei height = *(GLsizei *) (pc + 24); GLenum format = *(GLenum *) (pc + 28); GLenum type = *(GLenum *) (pc + 32); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); width = bswap_32(width); height = bswap_32(height); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, 0, width, height, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 0); if (swap) { n = bswap_32(n); } return safe_pad(safe_add(safe_mul(n, 4), safe_mul(n, 4))); } int __glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 36); GLenum format = *(GLenum *) (pc + 44); GLenum type = *(GLenum *) (pc + 48); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 36); GLsizei height = *(GLsizei *) (pc + 40); GLenum format = *(GLenum *) (pc + 44); GLenum type = *(GLenum *) (pc + 48); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); height = bswap_32(height); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXColorTableReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 28); GLenum format = *(GLenum *) (pc + 32); GLenum type = *(GLenum *) (pc + 36); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glColorTableParameterfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXColorSubTableReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei count = *(GLsizei *) (pc + 28); GLenum format = *(GLenum *) (pc + 32); GLenum type = *(GLenum *) (pc + 36); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); count = bswap_32(count); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, count, 1, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 28); GLenum format = *(GLenum *) (pc + 36); GLenum type = *(GLenum *) (pc + 40); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; GLint skip_images = 0; GLint skip_rows = *(GLint *) (pc + 8); GLint alignment = *(GLint *) (pc + 16); GLenum target = *(GLenum *) (pc + 20); GLsizei width = *(GLsizei *) (pc + 28); GLsizei height = *(GLsizei *) (pc + 32); GLenum format = *(GLenum *) (pc + 36); GLenum type = *(GLenum *) (pc + 40); if (swap) { row_length = bswap_32(row_length); skip_rows = bswap_32(skip_rows); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); height = bswap_32(height); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, image_height, row_length, skip_images, skip_rows, alignment); } int __glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glConvolutionParameterfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = *(GLint *) (pc + 8); GLint skip_rows = *(GLint *) (pc + 16); GLint skip_images = *(GLint *) (pc + 20); GLint alignment = *(GLint *) (pc + 32); GLenum target = *(GLenum *) (pc + 36); GLsizei width = *(GLsizei *) (pc + 48); GLsizei height = *(GLsizei *) (pc + 52); GLsizei depth = *(GLsizei *) (pc + 56); GLenum format = *(GLenum *) (pc + 68); GLenum type = *(GLenum *) (pc + 72); if (swap) { row_length = bswap_32(row_length); image_height = bswap_32(image_height); skip_rows = bswap_32(skip_rows); skip_images = bswap_32(skip_images); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); height = bswap_32(height); depth = bswap_32(depth); format = bswap_32(format); type = bswap_32(type); } if (*(CARD32 *) (pc + 76)) return 0; return __glXImageSize(format, type, target, width, height, depth, image_height, row_length, skip_images, skip_rows, alignment); } int __glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = *(GLint *) (pc + 8); GLint skip_rows = *(GLint *) (pc + 16); GLint skip_images = *(GLint *) (pc + 20); GLint alignment = *(GLint *) (pc + 32); GLenum target = *(GLenum *) (pc + 36); GLsizei width = *(GLsizei *) (pc + 60); GLsizei height = *(GLsizei *) (pc + 64); GLsizei depth = *(GLsizei *) (pc + 68); GLenum format = *(GLenum *) (pc + 76); GLenum type = *(GLenum *) (pc + 80); if (swap) { row_length = bswap_32(row_length); image_height = bswap_32(image_height); skip_rows = bswap_32(skip_rows); skip_images = bswap_32(skip_images); alignment = bswap_32(alignment); target = bswap_32(target); width = bswap_32(width); height = bswap_32(height); depth = bswap_32(depth); format = bswap_32(format); type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, depth, image_height, row_length, skip_images, skip_rows, alignment); } int __glXCompressedTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei imageSize = *(GLsizei *) (pc + 20); if (swap) { imageSize = bswap_32(imageSize); } return safe_pad(imageSize); } int __glXCompressedTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei imageSize = *(GLsizei *) (pc + 24); if (swap) { imageSize = bswap_32(imageSize); } return safe_pad(imageSize); } int __glXCompressedTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei imageSize = *(GLsizei *) (pc + 28); if (swap) { imageSize = bswap_32(imageSize); } return safe_pad(imageSize); } int __glXCompressedTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei imageSize = *(GLsizei *) (pc + 36); if (swap) { imageSize = bswap_32(imageSize); } return safe_pad(imageSize); } int __glXPointParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { pname = bswap_32(pname); } compsize = __glPointParameterfv_size(pname); return safe_pad(safe_mul(compsize, 4)); } int __glXDrawBuffersReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 0); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 4)); } int __glXProgramStringARBReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei len = *(GLsizei *) (pc + 8); if (swap) { len = bswap_32(len); } return safe_pad(len); } int __glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 4); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 8)); } int __glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 4); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 16)); } int __glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 4); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 24)); } int __glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 4); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 12)); } int __glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 4); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 6)); } int __glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *) (pc + 4); if (swap) { n = bswap_32(n); } return safe_pad(safe_mul(n, 32)); } ALIAS(Fogiv, Fogfv) ALIAS(Lightiv, Lightfv) ALIAS(LightModeliv, LightModelfv) ALIAS(Materialiv, Materialfv) ALIAS(TexParameteriv, TexParameterfv) ALIAS(TexEnviv, TexEnvfv) ALIAS(TexGeniv, TexGenfv) ALIAS(PixelMapuiv, PixelMapfv) ALIAS(ColorTableParameteriv, ColorTableParameterfv) ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) ALIAS(CompressedTexSubImage1D, CompressedTexImage1D) ALIAS(CompressedTexSubImage2D, CompressedTexImage3D) ALIAS(PointParameteriv, PointParameterfv) ALIAS(DeleteFramebuffers, DrawBuffers) ALIAS(DeleteRenderbuffers, DrawBuffers) ALIAS(VertexAttribs1fvNV, PixelMapfv) ALIAS(VertexAttribs1svNV, PixelMapusv) ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) ALIAS(VertexAttribs2svNV, PixelMapfv) ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) ALIAS(VertexAttribs4ubvNV, PixelMapfv) xorg-server-1.20.8/glx/unpack.h0000644000175000017500000001554613640201473013245 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef __GLX_unpack_h__ #define __GLX_unpack_h__ /* * 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. */ #define __GLX_PAD(s) (((s)+3) & (GLuint)~3) /* ** Fetch the context-id out of a SingleReq request pointed to by pc. */ #define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag) #define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag) /* ** Fetch a double from potentially unaligned memory. */ #ifdef __GLX_ALIGN64 #define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) #define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) #else #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) #endif #define __GLX_BEGIN_REPLY(size) \ reply.length = __GLX_PAD(size) >> 2; \ reply.type = X_Reply; \ reply.sequenceNumber = client->sequence; #define __GLX_SEND_HEADER() \ WriteToClient (client, sz_xGLXSingleReply, &reply); #define __GLX_PUT_RETVAL(a) \ reply.retval = (a); #define __GLX_PUT_SIZE(a) \ reply.size = (a); /* ** Get a buffer to hold returned data, with the given alignment. If we have ** to realloc, allocate size+align, in case the pointer has to be bumped for ** alignment. The answerBuffer should already be aligned. ** ** NOTE: the cast (long)res below assumes a long is large enough to hold a ** pointer. */ #define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ if (size < 0) return BadLength; \ else if ((size) > sizeof(answerBuffer)) { \ int bump; \ if ((cl)->returnBufSize < (size)+(align)) { \ (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ (size)+(align)); \ if (!(cl)->returnBuf) { \ return BadAlloc; \ } \ (cl)->returnBufSize = (size)+(align); \ } \ res = (char*)cl->returnBuf; \ bump = (long)(res) % (align); \ if (bump) res += (align) - (bump); \ } else { \ res = (char *)answerBuffer; \ } #define __GLX_SEND_BYTE_ARRAY(len) \ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer) #define __GLX_SEND_SHORT_ARRAY(len) \ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer) #define __GLX_SEND_INT_ARRAY(len) \ WriteToClient(client, (len)*__GLX_SIZE_INT32, answer) #define __GLX_SEND_FLOAT_ARRAY(len) \ WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer) #define __GLX_SEND_DOUBLE_ARRAY(len) \ WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer) #define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) #define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) #define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len) #define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len) /* ** PERFORMANCE NOTE: ** Machine dependent optimizations abound here; these swapping macros can ** conceivably be replaced with routines that do the job faster. */ #define __GLX_DECLARE_SWAP_VARIABLES \ GLbyte sw #define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \ GLbyte *swapPC; \ GLbyte *swapEnd #define __GLX_SWAP_INT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ ((GLbyte *)(pc))[3] = sw; \ sw = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ ((GLbyte *)(pc))[2] = sw; #define __GLX_SWAP_SHORT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = sw; #define __GLX_SWAP_DOUBLE(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \ ((GLbyte *)(pc))[7] = sw; \ sw = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \ ((GLbyte *)(pc))[6] = sw; \ sw = ((GLbyte *)(pc))[2]; \ ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \ ((GLbyte *)(pc))[5] = sw; \ sw = ((GLbyte *)(pc))[3]; \ ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \ ((GLbyte *)(pc))[4] = sw; #define __GLX_SWAP_FLOAT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ ((GLbyte *)(pc))[3] = sw; \ sw = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ ((GLbyte *)(pc))[2] = sw; #define __GLX_SWAP_INT_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\ while (swapPC < swapEnd) { \ __GLX_SWAP_INT(swapPC); \ swapPC += __GLX_SIZE_INT32; \ } #define __GLX_SWAP_SHORT_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\ while (swapPC < swapEnd) { \ __GLX_SWAP_SHORT(swapPC); \ swapPC += __GLX_SIZE_INT16; \ } #define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\ while (swapPC < swapEnd) { \ __GLX_SWAP_DOUBLE(swapPC); \ swapPC += __GLX_SIZE_FLOAT64; \ } #define __GLX_SWAP_FLOAT_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\ while (swapPC < swapEnd) { \ __GLX_SWAP_FLOAT(swapPC); \ swapPC += __GLX_SIZE_FLOAT32; \ } #define __GLX_SWAP_REPLY_HEADER() \ __GLX_SWAP_SHORT(&reply.sequenceNumber); \ __GLX_SWAP_INT(&reply.length); #define __GLX_SWAP_REPLY_RETVAL() \ __GLX_SWAP_INT(&reply.retval) #define __GLX_SWAP_REPLY_SIZE() \ __GLX_SWAP_INT(&reply.size) #endif /* !__GLX_unpack_h__ */ xorg-server-1.20.8/glx/indirect_texture_compression.c0000644000175000017500000001033613640201473017751 00000000000000/* * (C) Copyright IBM Corporation 2005, 2006 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxbyteorder.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" int __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 8); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = *(GLenum *) (pc + 0); const GLint level = *(GLint *) (pc + 4); GLint compsize = 0; char *answer = NULL, answerBuffer[200]; xGLXSingleReply reply = { 0, }; glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize); if (compsize != 0) { PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB = __glGetProcAddress("glGetCompressedTexImageARB"); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); GetCompressedTexImageARB(target, level, answer); } if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *) &reply)->width = compsize; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } error = Success; } return error; } int __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc) { xGLXSingleReq *const req = (xGLXSingleReq *) pc; int error; __GLXcontext *const cx = __glXForceCurrent(cl, bswap_32(req->contextTag), &error); ClientPtr client = cl->client; REQUEST_FIXED_SIZE(xGLXSingleReq, 8); pc += __GLX_SINGLE_HDR_SIZE; if (cx != NULL) { const GLenum target = (GLenum) bswap_32(*(int *) (pc + 0)); const GLint level = (GLint) bswap_32(*(int *) (pc + 4)); GLint compsize = 0; char *answer = NULL, answerBuffer[200]; xGLXSingleReply reply = { 0, }; glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize); if (compsize != 0) { PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB = __glGetProcAddress("glGetCompressedTexImageARB"); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); GetCompressedTexImageARB(target, level, answer); } if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *) &reply)->width = compsize; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } error = Success; } return error; } xorg-server-1.20.8/glx/indirect_table.c0000644000175000017500000022454313640201473014726 00000000000000/* DO NOT EDIT - This file generated automatically by glX_server_table.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005, 2006 * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include #include "glxserver.h" #include "glxext.h" #include "indirect_dispatch.h" #include "indirect_reqsize.h" #include "indirect_table.h" /*****************************************************************/ /* tree depth = 3 */ static const int_fast16_t Single_dispatch_tree[24] = { /* [0] -> opcode range [0, 256], node depth 1 */ 2, 5, 13, 16, EMPTY_LEAF, /* [5] -> opcode range [0, 64], node depth 2 */ 2, LEAF(0), LEAF(16), 10, EMPTY_LEAF, /* [10] -> opcode range [32, 48], node depth 3 */ 1, LEAF(32), EMPTY_LEAF, /* [13] -> opcode range [64, 128], node depth 2 */ 1, EMPTY_LEAF, LEAF(40), /* [16] -> opcode range [128, 192], node depth 2 */ 2, LEAF(72), LEAF(88), 21, EMPTY_LEAF, /* [21] -> opcode range [160, 176], node depth 3 */ 1, LEAF(104), EMPTY_LEAF, }; static const void *Single_function_table[112][2] = { /* [ 0] = 0 */ {NULL, NULL}, /* [ 1] = 1 */ {__glXDisp_Render, __glXDispSwap_Render}, /* [ 2] = 2 */ {__glXDisp_RenderLarge, __glXDispSwap_RenderLarge}, /* [ 3] = 3 */ {__glXDisp_CreateContext, __glXDispSwap_CreateContext}, /* [ 4] = 4 */ {__glXDisp_DestroyContext, __glXDispSwap_DestroyContext}, /* [ 5] = 5 */ {__glXDisp_MakeCurrent, __glXDispSwap_MakeCurrent}, /* [ 6] = 6 */ {__glXDisp_IsDirect, __glXDispSwap_IsDirect}, /* [ 7] = 7 */ {__glXDisp_QueryVersion, __glXDispSwap_QueryVersion}, /* [ 8] = 8 */ {__glXDisp_WaitGL, __glXDispSwap_WaitGL}, /* [ 9] = 9 */ {__glXDisp_WaitX, __glXDispSwap_WaitX}, /* [ 10] = 10 */ {__glXDisp_CopyContext, __glXDispSwap_CopyContext}, /* [ 11] = 11 */ {__glXDisp_SwapBuffers, __glXDispSwap_SwapBuffers}, /* [ 12] = 12 */ {__glXDisp_UseXFont, __glXDispSwap_UseXFont}, /* [ 13] = 13 */ {__glXDisp_CreateGLXPixmap, __glXDispSwap_CreateGLXPixmap}, /* [ 14] = 14 */ {__glXDisp_GetVisualConfigs, __glXDispSwap_GetVisualConfigs}, /* [ 15] = 15 */ {__glXDisp_DestroyGLXPixmap, __glXDispSwap_DestroyGLXPixmap}, /* [ 16] = 16 */ {__glXDisp_VendorPrivate, __glXDispSwap_VendorPrivate}, /* [ 17] = 17 */ {__glXDisp_VendorPrivateWithReply, __glXDispSwap_VendorPrivateWithReply}, /* [ 18] = 18 */ {__glXDisp_QueryExtensionsString, __glXDispSwap_QueryExtensionsString}, /* [ 19] = 19 */ {__glXDisp_QueryServerString, __glXDispSwap_QueryServerString}, /* [ 20] = 20 */ {__glXDisp_ClientInfo, __glXDispSwap_ClientInfo}, /* [ 21] = 21 */ {__glXDisp_GetFBConfigs, __glXDispSwap_GetFBConfigs}, /* [ 22] = 22 */ {__glXDisp_CreatePixmap, __glXDispSwap_CreatePixmap}, /* [ 23] = 23 */ {__glXDisp_DestroyPixmap, __glXDispSwap_DestroyPixmap}, /* [ 24] = 24 */ {__glXDisp_CreateNewContext, __glXDispSwap_CreateNewContext}, /* [ 25] = 25 */ {__glXDisp_QueryContext, __glXDispSwap_QueryContext}, /* [ 26] = 26 */ {__glXDisp_MakeContextCurrent, __glXDispSwap_MakeContextCurrent}, /* [ 27] = 27 */ {__glXDisp_CreatePbuffer, __glXDispSwap_CreatePbuffer}, /* [ 28] = 28 */ {__glXDisp_DestroyPbuffer, __glXDispSwap_DestroyPbuffer}, /* [ 29] = 29 */ {__glXDisp_GetDrawableAttributes, __glXDispSwap_GetDrawableAttributes}, /* [ 30] = 30 */ {__glXDisp_ChangeDrawableAttributes, __glXDispSwap_ChangeDrawableAttributes}, /* [ 31] = 31 */ {__glXDisp_CreateWindow, __glXDispSwap_CreateWindow}, /* [ 32] = 32 */ {__glXDisp_DestroyWindow, __glXDispSwap_DestroyWindow}, /* [ 33] = 33 */ {__glXDisp_SetClientInfoARB, __glXDispSwap_SetClientInfoARB}, /* [ 34] = 34 */ {__glXDisp_CreateContextAttribsARB, __glXDispSwap_CreateContextAttribsARB}, /* [ 35] = 35 */ {__glXDisp_SetClientInfo2ARB, __glXDispSwap_SetClientInfo2ARB}, /* [ 36] = 36 */ {NULL, NULL}, /* [ 37] = 37 */ {NULL, NULL}, /* [ 38] = 38 */ {NULL, NULL}, /* [ 39] = 39 */ {NULL, NULL}, /* [ 40] = 96 */ {NULL, NULL}, /* [ 41] = 97 */ {NULL, NULL}, /* [ 42] = 98 */ {NULL, NULL}, /* [ 43] = 99 */ {NULL, NULL}, /* [ 44] = 100 */ {NULL, NULL}, /* [ 45] = 101 */ {__glXDisp_NewList, __glXDispSwap_NewList}, /* [ 46] = 102 */ {__glXDisp_EndList, __glXDispSwap_EndList}, /* [ 47] = 103 */ {__glXDisp_DeleteLists, __glXDispSwap_DeleteLists}, /* [ 48] = 104 */ {__glXDisp_GenLists, __glXDispSwap_GenLists}, /* [ 49] = 105 */ {__glXDisp_FeedbackBuffer, __glXDispSwap_FeedbackBuffer}, /* [ 50] = 106 */ {__glXDisp_SelectBuffer, __glXDispSwap_SelectBuffer}, /* [ 51] = 107 */ {__glXDisp_RenderMode, __glXDispSwap_RenderMode}, /* [ 52] = 108 */ {__glXDisp_Finish, __glXDispSwap_Finish}, /* [ 53] = 109 */ {__glXDisp_PixelStoref, __glXDispSwap_PixelStoref}, /* [ 54] = 110 */ {__glXDisp_PixelStorei, __glXDispSwap_PixelStorei}, /* [ 55] = 111 */ {__glXDisp_ReadPixels, __glXDispSwap_ReadPixels}, /* [ 56] = 112 */ {__glXDisp_GetBooleanv, __glXDispSwap_GetBooleanv}, /* [ 57] = 113 */ {__glXDisp_GetClipPlane, __glXDispSwap_GetClipPlane}, /* [ 58] = 114 */ {__glXDisp_GetDoublev, __glXDispSwap_GetDoublev}, /* [ 59] = 115 */ {__glXDisp_GetError, __glXDispSwap_GetError}, /* [ 60] = 116 */ {__glXDisp_GetFloatv, __glXDispSwap_GetFloatv}, /* [ 61] = 117 */ {__glXDisp_GetIntegerv, __glXDispSwap_GetIntegerv}, /* [ 62] = 118 */ {__glXDisp_GetLightfv, __glXDispSwap_GetLightfv}, /* [ 63] = 119 */ {__glXDisp_GetLightiv, __glXDispSwap_GetLightiv}, /* [ 64] = 120 */ {__glXDisp_GetMapdv, __glXDispSwap_GetMapdv}, /* [ 65] = 121 */ {__glXDisp_GetMapfv, __glXDispSwap_GetMapfv}, /* [ 66] = 122 */ {__glXDisp_GetMapiv, __glXDispSwap_GetMapiv}, /* [ 67] = 123 */ {__glXDisp_GetMaterialfv, __glXDispSwap_GetMaterialfv}, /* [ 68] = 124 */ {__glXDisp_GetMaterialiv, __glXDispSwap_GetMaterialiv}, /* [ 69] = 125 */ {__glXDisp_GetPixelMapfv, __glXDispSwap_GetPixelMapfv}, /* [ 70] = 126 */ {__glXDisp_GetPixelMapuiv, __glXDispSwap_GetPixelMapuiv}, /* [ 71] = 127 */ {__glXDisp_GetPixelMapusv, __glXDispSwap_GetPixelMapusv}, /* [ 72] = 128 */ {__glXDisp_GetPolygonStipple, __glXDispSwap_GetPolygonStipple}, /* [ 73] = 129 */ {__glXDisp_GetString, __glXDispSwap_GetString}, /* [ 74] = 130 */ {__glXDisp_GetTexEnvfv, __glXDispSwap_GetTexEnvfv}, /* [ 75] = 131 */ {__glXDisp_GetTexEnviv, __glXDispSwap_GetTexEnviv}, /* [ 76] = 132 */ {__glXDisp_GetTexGendv, __glXDispSwap_GetTexGendv}, /* [ 77] = 133 */ {__glXDisp_GetTexGenfv, __glXDispSwap_GetTexGenfv}, /* [ 78] = 134 */ {__glXDisp_GetTexGeniv, __glXDispSwap_GetTexGeniv}, /* [ 79] = 135 */ {__glXDisp_GetTexImage, __glXDispSwap_GetTexImage}, /* [ 80] = 136 */ {__glXDisp_GetTexParameterfv, __glXDispSwap_GetTexParameterfv}, /* [ 81] = 137 */ {__glXDisp_GetTexParameteriv, __glXDispSwap_GetTexParameteriv}, /* [ 82] = 138 */ {__glXDisp_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameterfv}, /* [ 83] = 139 */ {__glXDisp_GetTexLevelParameteriv, __glXDispSwap_GetTexLevelParameteriv}, /* [ 84] = 140 */ {__glXDisp_IsEnabled, __glXDispSwap_IsEnabled}, /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList}, /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush}, /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident}, /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures}, /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures}, /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture}, /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable}, /* [ 92] = 148 */ {__glXDisp_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameterfv}, /* [ 93] = 149 */ {__glXDisp_GetColorTableParameteriv, __glXDispSwap_GetColorTableParameteriv}, /* [ 94] = 150 */ {__glXDisp_GetConvolutionFilter, __glXDispSwap_GetConvolutionFilter}, /* [ 95] = 151 */ {__glXDisp_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameterfv}, /* [ 96] = 152 */ {__glXDisp_GetConvolutionParameteriv, __glXDispSwap_GetConvolutionParameteriv}, /* [ 97] = 153 */ {__glXDisp_GetSeparableFilter, __glXDispSwap_GetSeparableFilter}, /* [ 98] = 154 */ {__glXDisp_GetHistogram, __glXDispSwap_GetHistogram}, /* [ 99] = 155 */ {__glXDisp_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameterfv}, /* [ 100] = 156 */ {__glXDisp_GetHistogramParameteriv, __glXDispSwap_GetHistogramParameteriv}, /* [ 101] = 157 */ {__glXDisp_GetMinmax, __glXDispSwap_GetMinmax}, /* [ 102] = 158 */ {__glXDisp_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameterfv}, /* [ 103] = 159 */ {__glXDisp_GetMinmaxParameteriv, __glXDispSwap_GetMinmaxParameteriv}, /* [ 104] = 160 */ {__glXDisp_GetCompressedTexImage, __glXDispSwap_GetCompressedTexImage}, /* [ 105] = 161 */ {__glXDisp_DeleteQueries, __glXDispSwap_DeleteQueries}, /* [ 106] = 162 */ {__glXDisp_GenQueries, __glXDispSwap_GenQueries}, /* [ 107] = 163 */ {__glXDisp_IsQuery, __glXDispSwap_IsQuery}, /* [ 108] = 164 */ {__glXDisp_GetQueryiv, __glXDispSwap_GetQueryiv}, /* [ 109] = 165 */ {__glXDisp_GetQueryObjectiv, __glXDispSwap_GetQueryObjectiv}, /* [ 110] = 166 */ {__glXDisp_GetQueryObjectuiv, __glXDispSwap_GetQueryObjectuiv}, /* [ 111] = 167 */ {NULL, NULL}, }; const struct __glXDispatchInfo Single_dispatch_info = { 8, Single_dispatch_tree, Single_function_table, NULL, NULL }; /*****************************************************************/ /* tree depth = 8 */ static const int_fast16_t Render_dispatch_tree[92] = { /* [0] -> opcode range [0, 8192], node depth 1 */ 2, 5, 31, 54, EMPTY_LEAF, /* [5] -> opcode range [0, 2048], node depth 2 */ 1, 8, EMPTY_LEAF, /* [8] -> opcode range [0, 1024], node depth 3 */ 1, 11, EMPTY_LEAF, /* [11] -> opcode range [0, 512], node depth 4 */ 1, 14, EMPTY_LEAF, /* [14] -> opcode range [0, 256], node depth 5 */ 4, LEAF(0), LEAF(16), LEAF(32), LEAF(48), LEAF(64), LEAF(80), LEAF(96), LEAF(112), LEAF(128), LEAF(144), LEAF(160), LEAF(176), LEAF(192), LEAF(208), LEAF(224), EMPTY_LEAF, /* [31] -> opcode range [2048, 4096], node depth 2 */ 1, 34, EMPTY_LEAF, /* [34] -> opcode range [2048, 3072], node depth 3 */ 1, 37, EMPTY_LEAF, /* [37] -> opcode range [2048, 2560], node depth 4 */ 1, 40, EMPTY_LEAF, /* [40] -> opcode range [2048, 2304], node depth 5 */ 1, 43, EMPTY_LEAF, /* [43] -> opcode range [2048, 2176], node depth 6 */ 1, 46, EMPTY_LEAF, /* [46] -> opcode range [2048, 2112], node depth 7 */ 1, 49, EMPTY_LEAF, /* [49] -> opcode range [2048, 2080], node depth 8 */ 2, LEAF(240), LEAF(248), LEAF(256), EMPTY_LEAF, /* [54] -> opcode range [4096, 6144], node depth 2 */ 1, 57, EMPTY_LEAF, /* [57] -> opcode range [4096, 5120], node depth 3 */ 1, 60, EMPTY_LEAF, /* [60] -> opcode range [4096, 4608], node depth 4 */ 1, 63, EMPTY_LEAF, /* [63] -> opcode range [4096, 4352], node depth 5 */ 4, LEAF(264), LEAF(280), 80, EMPTY_LEAF, EMPTY_LEAF, LEAF(296), LEAF(312), LEAF(328), LEAF(344), EMPTY_LEAF, 83, 86, EMPTY_LEAF, 89, LEAF(360), EMPTY_LEAF, /* [80] -> opcode range [4128, 4144], node depth 6 */ 1, LEAF(376), EMPTY_LEAF, /* [83] -> opcode range [4256, 4272], node depth 6 */ 1, EMPTY_LEAF, LEAF(384), /* [86] -> opcode range [4272, 4288], node depth 6 */ 1, LEAF(392), EMPTY_LEAF, /* [89] -> opcode range [4304, 4320], node depth 6 */ 1, EMPTY_LEAF, LEAF(400), }; static const void *Render_function_table[408][2] = { /* [ 0] = 0 */ {NULL, NULL}, /* [ 1] = 1 */ {__glXDisp_CallList, __glXDispSwap_CallList}, /* [ 2] = 2 */ {__glXDisp_CallLists, __glXDispSwap_CallLists}, /* [ 3] = 3 */ {__glXDisp_ListBase, __glXDispSwap_ListBase}, /* [ 4] = 4 */ {__glXDisp_Begin, __glXDispSwap_Begin}, /* [ 5] = 5 */ {__glXDisp_Bitmap, __glXDispSwap_Bitmap}, /* [ 6] = 6 */ {__glXDisp_Color3bv, __glXDispSwap_Color3bv}, /* [ 7] = 7 */ {__glXDisp_Color3dv, __glXDispSwap_Color3dv}, /* [ 8] = 8 */ {__glXDisp_Color3fv, __glXDispSwap_Color3fv}, /* [ 9] = 9 */ {__glXDisp_Color3iv, __glXDispSwap_Color3iv}, /* [ 10] = 10 */ {__glXDisp_Color3sv, __glXDispSwap_Color3sv}, /* [ 11] = 11 */ {__glXDisp_Color3ubv, __glXDispSwap_Color3ubv}, /* [ 12] = 12 */ {__glXDisp_Color3uiv, __glXDispSwap_Color3uiv}, /* [ 13] = 13 */ {__glXDisp_Color3usv, __glXDispSwap_Color3usv}, /* [ 14] = 14 */ {__glXDisp_Color4bv, __glXDispSwap_Color4bv}, /* [ 15] = 15 */ {__glXDisp_Color4dv, __glXDispSwap_Color4dv}, /* [ 16] = 16 */ {__glXDisp_Color4fv, __glXDispSwap_Color4fv}, /* [ 17] = 17 */ {__glXDisp_Color4iv, __glXDispSwap_Color4iv}, /* [ 18] = 18 */ {__glXDisp_Color4sv, __glXDispSwap_Color4sv}, /* [ 19] = 19 */ {__glXDisp_Color4ubv, __glXDispSwap_Color4ubv}, /* [ 20] = 20 */ {__glXDisp_Color4uiv, __glXDispSwap_Color4uiv}, /* [ 21] = 21 */ {__glXDisp_Color4usv, __glXDispSwap_Color4usv}, /* [ 22] = 22 */ {__glXDisp_EdgeFlagv, __glXDispSwap_EdgeFlagv}, /* [ 23] = 23 */ {__glXDisp_End, __glXDispSwap_End}, /* [ 24] = 24 */ {__glXDisp_Indexdv, __glXDispSwap_Indexdv}, /* [ 25] = 25 */ {__glXDisp_Indexfv, __glXDispSwap_Indexfv}, /* [ 26] = 26 */ {__glXDisp_Indexiv, __glXDispSwap_Indexiv}, /* [ 27] = 27 */ {__glXDisp_Indexsv, __glXDispSwap_Indexsv}, /* [ 28] = 28 */ {__glXDisp_Normal3bv, __glXDispSwap_Normal3bv}, /* [ 29] = 29 */ {__glXDisp_Normal3dv, __glXDispSwap_Normal3dv}, /* [ 30] = 30 */ {__glXDisp_Normal3fv, __glXDispSwap_Normal3fv}, /* [ 31] = 31 */ {__glXDisp_Normal3iv, __glXDispSwap_Normal3iv}, /* [ 32] = 32 */ {__glXDisp_Normal3sv, __glXDispSwap_Normal3sv}, /* [ 33] = 33 */ {__glXDisp_RasterPos2dv, __glXDispSwap_RasterPos2dv}, /* [ 34] = 34 */ {__glXDisp_RasterPos2fv, __glXDispSwap_RasterPos2fv}, /* [ 35] = 35 */ {__glXDisp_RasterPos2iv, __glXDispSwap_RasterPos2iv}, /* [ 36] = 36 */ {__glXDisp_RasterPos2sv, __glXDispSwap_RasterPos2sv}, /* [ 37] = 37 */ {__glXDisp_RasterPos3dv, __glXDispSwap_RasterPos3dv}, /* [ 38] = 38 */ {__glXDisp_RasterPos3fv, __glXDispSwap_RasterPos3fv}, /* [ 39] = 39 */ {__glXDisp_RasterPos3iv, __glXDispSwap_RasterPos3iv}, /* [ 40] = 40 */ {__glXDisp_RasterPos3sv, __glXDispSwap_RasterPos3sv}, /* [ 41] = 41 */ {__glXDisp_RasterPos4dv, __glXDispSwap_RasterPos4dv}, /* [ 42] = 42 */ {__glXDisp_RasterPos4fv, __glXDispSwap_RasterPos4fv}, /* [ 43] = 43 */ {__glXDisp_RasterPos4iv, __glXDispSwap_RasterPos4iv}, /* [ 44] = 44 */ {__glXDisp_RasterPos4sv, __glXDispSwap_RasterPos4sv}, /* [ 45] = 45 */ {__glXDisp_Rectdv, __glXDispSwap_Rectdv}, /* [ 46] = 46 */ {__glXDisp_Rectfv, __glXDispSwap_Rectfv}, /* [ 47] = 47 */ {__glXDisp_Rectiv, __glXDispSwap_Rectiv}, /* [ 48] = 48 */ {__glXDisp_Rectsv, __glXDispSwap_Rectsv}, /* [ 49] = 49 */ {__glXDisp_TexCoord1dv, __glXDispSwap_TexCoord1dv}, /* [ 50] = 50 */ {__glXDisp_TexCoord1fv, __glXDispSwap_TexCoord1fv}, /* [ 51] = 51 */ {__glXDisp_TexCoord1iv, __glXDispSwap_TexCoord1iv}, /* [ 52] = 52 */ {__glXDisp_TexCoord1sv, __glXDispSwap_TexCoord1sv}, /* [ 53] = 53 */ {__glXDisp_TexCoord2dv, __glXDispSwap_TexCoord2dv}, /* [ 54] = 54 */ {__glXDisp_TexCoord2fv, __glXDispSwap_TexCoord2fv}, /* [ 55] = 55 */ {__glXDisp_TexCoord2iv, __glXDispSwap_TexCoord2iv}, /* [ 56] = 56 */ {__glXDisp_TexCoord2sv, __glXDispSwap_TexCoord2sv}, /* [ 57] = 57 */ {__glXDisp_TexCoord3dv, __glXDispSwap_TexCoord3dv}, /* [ 58] = 58 */ {__glXDisp_TexCoord3fv, __glXDispSwap_TexCoord3fv}, /* [ 59] = 59 */ {__glXDisp_TexCoord3iv, __glXDispSwap_TexCoord3iv}, /* [ 60] = 60 */ {__glXDisp_TexCoord3sv, __glXDispSwap_TexCoord3sv}, /* [ 61] = 61 */ {__glXDisp_TexCoord4dv, __glXDispSwap_TexCoord4dv}, /* [ 62] = 62 */ {__glXDisp_TexCoord4fv, __glXDispSwap_TexCoord4fv}, /* [ 63] = 63 */ {__glXDisp_TexCoord4iv, __glXDispSwap_TexCoord4iv}, /* [ 64] = 64 */ {__glXDisp_TexCoord4sv, __glXDispSwap_TexCoord4sv}, /* [ 65] = 65 */ {__glXDisp_Vertex2dv, __glXDispSwap_Vertex2dv}, /* [ 66] = 66 */ {__glXDisp_Vertex2fv, __glXDispSwap_Vertex2fv}, /* [ 67] = 67 */ {__glXDisp_Vertex2iv, __glXDispSwap_Vertex2iv}, /* [ 68] = 68 */ {__glXDisp_Vertex2sv, __glXDispSwap_Vertex2sv}, /* [ 69] = 69 */ {__glXDisp_Vertex3dv, __glXDispSwap_Vertex3dv}, /* [ 70] = 70 */ {__glXDisp_Vertex3fv, __glXDispSwap_Vertex3fv}, /* [ 71] = 71 */ {__glXDisp_Vertex3iv, __glXDispSwap_Vertex3iv}, /* [ 72] = 72 */ {__glXDisp_Vertex3sv, __glXDispSwap_Vertex3sv}, /* [ 73] = 73 */ {__glXDisp_Vertex4dv, __glXDispSwap_Vertex4dv}, /* [ 74] = 74 */ {__glXDisp_Vertex4fv, __glXDispSwap_Vertex4fv}, /* [ 75] = 75 */ {__glXDisp_Vertex4iv, __glXDispSwap_Vertex4iv}, /* [ 76] = 76 */ {__glXDisp_Vertex4sv, __glXDispSwap_Vertex4sv}, /* [ 77] = 77 */ {__glXDisp_ClipPlane, __glXDispSwap_ClipPlane}, /* [ 78] = 78 */ {__glXDisp_ColorMaterial, __glXDispSwap_ColorMaterial}, /* [ 79] = 79 */ {__glXDisp_CullFace, __glXDispSwap_CullFace}, /* [ 80] = 80 */ {__glXDisp_Fogf, __glXDispSwap_Fogf}, /* [ 81] = 81 */ {__glXDisp_Fogfv, __glXDispSwap_Fogfv}, /* [ 82] = 82 */ {__glXDisp_Fogi, __glXDispSwap_Fogi}, /* [ 83] = 83 */ {__glXDisp_Fogiv, __glXDispSwap_Fogiv}, /* [ 84] = 84 */ {__glXDisp_FrontFace, __glXDispSwap_FrontFace}, /* [ 85] = 85 */ {__glXDisp_Hint, __glXDispSwap_Hint}, /* [ 86] = 86 */ {__glXDisp_Lightf, __glXDispSwap_Lightf}, /* [ 87] = 87 */ {__glXDisp_Lightfv, __glXDispSwap_Lightfv}, /* [ 88] = 88 */ {__glXDisp_Lighti, __glXDispSwap_Lighti}, /* [ 89] = 89 */ {__glXDisp_Lightiv, __glXDispSwap_Lightiv}, /* [ 90] = 90 */ {__glXDisp_LightModelf, __glXDispSwap_LightModelf}, /* [ 91] = 91 */ {__glXDisp_LightModelfv, __glXDispSwap_LightModelfv}, /* [ 92] = 92 */ {__glXDisp_LightModeli, __glXDispSwap_LightModeli}, /* [ 93] = 93 */ {__glXDisp_LightModeliv, __glXDispSwap_LightModeliv}, /* [ 94] = 94 */ {__glXDisp_LineStipple, __glXDispSwap_LineStipple}, /* [ 95] = 95 */ {__glXDisp_LineWidth, __glXDispSwap_LineWidth}, /* [ 96] = 96 */ {__glXDisp_Materialf, __glXDispSwap_Materialf}, /* [ 97] = 97 */ {__glXDisp_Materialfv, __glXDispSwap_Materialfv}, /* [ 98] = 98 */ {__glXDisp_Materiali, __glXDispSwap_Materiali}, /* [ 99] = 99 */ {__glXDisp_Materialiv, __glXDispSwap_Materialiv}, /* [ 100] = 100 */ {__glXDisp_PointSize, __glXDispSwap_PointSize}, /* [ 101] = 101 */ {__glXDisp_PolygonMode, __glXDispSwap_PolygonMode}, /* [ 102] = 102 */ {__glXDisp_PolygonStipple, __glXDispSwap_PolygonStipple}, /* [ 103] = 103 */ {__glXDisp_Scissor, __glXDispSwap_Scissor}, /* [ 104] = 104 */ {__glXDisp_ShadeModel, __glXDispSwap_ShadeModel}, /* [ 105] = 105 */ {__glXDisp_TexParameterf, __glXDispSwap_TexParameterf}, /* [ 106] = 106 */ {__glXDisp_TexParameterfv, __glXDispSwap_TexParameterfv}, /* [ 107] = 107 */ {__glXDisp_TexParameteri, __glXDispSwap_TexParameteri}, /* [ 108] = 108 */ {__glXDisp_TexParameteriv, __glXDispSwap_TexParameteriv}, /* [ 109] = 109 */ {__glXDisp_TexImage1D, __glXDispSwap_TexImage1D}, /* [ 110] = 110 */ {__glXDisp_TexImage2D, __glXDispSwap_TexImage2D}, /* [ 111] = 111 */ {__glXDisp_TexEnvf, __glXDispSwap_TexEnvf}, /* [ 112] = 112 */ {__glXDisp_TexEnvfv, __glXDispSwap_TexEnvfv}, /* [ 113] = 113 */ {__glXDisp_TexEnvi, __glXDispSwap_TexEnvi}, /* [ 114] = 114 */ {__glXDisp_TexEnviv, __glXDispSwap_TexEnviv}, /* [ 115] = 115 */ {__glXDisp_TexGend, __glXDispSwap_TexGend}, /* [ 116] = 116 */ {__glXDisp_TexGendv, __glXDispSwap_TexGendv}, /* [ 117] = 117 */ {__glXDisp_TexGenf, __glXDispSwap_TexGenf}, /* [ 118] = 118 */ {__glXDisp_TexGenfv, __glXDispSwap_TexGenfv}, /* [ 119] = 119 */ {__glXDisp_TexGeni, __glXDispSwap_TexGeni}, /* [ 120] = 120 */ {__glXDisp_TexGeniv, __glXDispSwap_TexGeniv}, /* [ 121] = 121 */ {__glXDisp_InitNames, __glXDispSwap_InitNames}, /* [ 122] = 122 */ {__glXDisp_LoadName, __glXDispSwap_LoadName}, /* [ 123] = 123 */ {__glXDisp_PassThrough, __glXDispSwap_PassThrough}, /* [ 124] = 124 */ {__glXDisp_PopName, __glXDispSwap_PopName}, /* [ 125] = 125 */ {__glXDisp_PushName, __glXDispSwap_PushName}, /* [ 126] = 126 */ {__glXDisp_DrawBuffer, __glXDispSwap_DrawBuffer}, /* [ 127] = 127 */ {__glXDisp_Clear, __glXDispSwap_Clear}, /* [ 128] = 128 */ {__glXDisp_ClearAccum, __glXDispSwap_ClearAccum}, /* [ 129] = 129 */ {__glXDisp_ClearIndex, __glXDispSwap_ClearIndex}, /* [ 130] = 130 */ {__glXDisp_ClearColor, __glXDispSwap_ClearColor}, /* [ 131] = 131 */ {__glXDisp_ClearStencil, __glXDispSwap_ClearStencil}, /* [ 132] = 132 */ {__glXDisp_ClearDepth, __glXDispSwap_ClearDepth}, /* [ 133] = 133 */ {__glXDisp_StencilMask, __glXDispSwap_StencilMask}, /* [ 134] = 134 */ {__glXDisp_ColorMask, __glXDispSwap_ColorMask}, /* [ 135] = 135 */ {__glXDisp_DepthMask, __glXDispSwap_DepthMask}, /* [ 136] = 136 */ {__glXDisp_IndexMask, __glXDispSwap_IndexMask}, /* [ 137] = 137 */ {__glXDisp_Accum, __glXDispSwap_Accum}, /* [ 138] = 138 */ {__glXDisp_Disable, __glXDispSwap_Disable}, /* [ 139] = 139 */ {__glXDisp_Enable, __glXDispSwap_Enable}, /* [ 140] = 140 */ {NULL, NULL}, /* [ 141] = 141 */ {__glXDisp_PopAttrib, __glXDispSwap_PopAttrib}, /* [ 142] = 142 */ {__glXDisp_PushAttrib, __glXDispSwap_PushAttrib}, /* [ 143] = 143 */ {__glXDisp_Map1d, __glXDispSwap_Map1d}, /* [ 144] = 144 */ {__glXDisp_Map1f, __glXDispSwap_Map1f}, /* [ 145] = 145 */ {__glXDisp_Map2d, __glXDispSwap_Map2d}, /* [ 146] = 146 */ {__glXDisp_Map2f, __glXDispSwap_Map2f}, /* [ 147] = 147 */ {__glXDisp_MapGrid1d, __glXDispSwap_MapGrid1d}, /* [ 148] = 148 */ {__glXDisp_MapGrid1f, __glXDispSwap_MapGrid1f}, /* [ 149] = 149 */ {__glXDisp_MapGrid2d, __glXDispSwap_MapGrid2d}, /* [ 150] = 150 */ {__glXDisp_MapGrid2f, __glXDispSwap_MapGrid2f}, /* [ 151] = 151 */ {__glXDisp_EvalCoord1dv, __glXDispSwap_EvalCoord1dv}, /* [ 152] = 152 */ {__glXDisp_EvalCoord1fv, __glXDispSwap_EvalCoord1fv}, /* [ 153] = 153 */ {__glXDisp_EvalCoord2dv, __glXDispSwap_EvalCoord2dv}, /* [ 154] = 154 */ {__glXDisp_EvalCoord2fv, __glXDispSwap_EvalCoord2fv}, /* [ 155] = 155 */ {__glXDisp_EvalMesh1, __glXDispSwap_EvalMesh1}, /* [ 156] = 156 */ {__glXDisp_EvalPoint1, __glXDispSwap_EvalPoint1}, /* [ 157] = 157 */ {__glXDisp_EvalMesh2, __glXDispSwap_EvalMesh2}, /* [ 158] = 158 */ {__glXDisp_EvalPoint2, __glXDispSwap_EvalPoint2}, /* [ 159] = 159 */ {__glXDisp_AlphaFunc, __glXDispSwap_AlphaFunc}, /* [ 160] = 160 */ {__glXDisp_BlendFunc, __glXDispSwap_BlendFunc}, /* [ 161] = 161 */ {__glXDisp_LogicOp, __glXDispSwap_LogicOp}, /* [ 162] = 162 */ {__glXDisp_StencilFunc, __glXDispSwap_StencilFunc}, /* [ 163] = 163 */ {__glXDisp_StencilOp, __glXDispSwap_StencilOp}, /* [ 164] = 164 */ {__glXDisp_DepthFunc, __glXDispSwap_DepthFunc}, /* [ 165] = 165 */ {__glXDisp_PixelZoom, __glXDispSwap_PixelZoom}, /* [ 166] = 166 */ {__glXDisp_PixelTransferf, __glXDispSwap_PixelTransferf}, /* [ 167] = 167 */ {__glXDisp_PixelTransferi, __glXDispSwap_PixelTransferi}, /* [ 168] = 168 */ {__glXDisp_PixelMapfv, __glXDispSwap_PixelMapfv}, /* [ 169] = 169 */ {__glXDisp_PixelMapuiv, __glXDispSwap_PixelMapuiv}, /* [ 170] = 170 */ {__glXDisp_PixelMapusv, __glXDispSwap_PixelMapusv}, /* [ 171] = 171 */ {__glXDisp_ReadBuffer, __glXDispSwap_ReadBuffer}, /* [ 172] = 172 */ {__glXDisp_CopyPixels, __glXDispSwap_CopyPixels}, /* [ 173] = 173 */ {__glXDisp_DrawPixels, __glXDispSwap_DrawPixels}, /* [ 174] = 174 */ {__glXDisp_DepthRange, __glXDispSwap_DepthRange}, /* [ 175] = 175 */ {__glXDisp_Frustum, __glXDispSwap_Frustum}, /* [ 176] = 176 */ {__glXDisp_LoadIdentity, __glXDispSwap_LoadIdentity}, /* [ 177] = 177 */ {__glXDisp_LoadMatrixf, __glXDispSwap_LoadMatrixf}, /* [ 178] = 178 */ {__glXDisp_LoadMatrixd, __glXDispSwap_LoadMatrixd}, /* [ 179] = 179 */ {__glXDisp_MatrixMode, __glXDispSwap_MatrixMode}, /* [ 180] = 180 */ {__glXDisp_MultMatrixf, __glXDispSwap_MultMatrixf}, /* [ 181] = 181 */ {__glXDisp_MultMatrixd, __glXDispSwap_MultMatrixd}, /* [ 182] = 182 */ {__glXDisp_Ortho, __glXDispSwap_Ortho}, /* [ 183] = 183 */ {__glXDisp_PopMatrix, __glXDispSwap_PopMatrix}, /* [ 184] = 184 */ {__glXDisp_PushMatrix, __glXDispSwap_PushMatrix}, /* [ 185] = 185 */ {__glXDisp_Rotated, __glXDispSwap_Rotated}, /* [ 186] = 186 */ {__glXDisp_Rotatef, __glXDispSwap_Rotatef}, /* [ 187] = 187 */ {__glXDisp_Scaled, __glXDispSwap_Scaled}, /* [ 188] = 188 */ {__glXDisp_Scalef, __glXDispSwap_Scalef}, /* [ 189] = 189 */ {__glXDisp_Translated, __glXDispSwap_Translated}, /* [ 190] = 190 */ {__glXDisp_Translatef, __glXDispSwap_Translatef}, /* [ 191] = 191 */ {__glXDisp_Viewport, __glXDispSwap_Viewport}, /* [ 192] = 192 */ {__glXDisp_PolygonOffset, __glXDispSwap_PolygonOffset}, /* [ 193] = 193 */ {__glXDisp_DrawArrays, __glXDispSwap_DrawArrays}, /* [ 194] = 194 */ {__glXDisp_Indexubv, __glXDispSwap_Indexubv}, /* [ 195] = 195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable}, /* [ 196] = 196 */ {__glXDisp_CopyColorSubTable, __glXDispSwap_CopyColorSubTable}, /* [ 197] = 197 */ {__glXDisp_ActiveTexture, __glXDispSwap_ActiveTexture}, /* [ 198] = 198 */ {__glXDisp_MultiTexCoord1dv, __glXDispSwap_MultiTexCoord1dv}, /* [ 199] = 199 */ {__glXDisp_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1fvARB}, /* [ 200] = 200 */ {__glXDisp_MultiTexCoord1iv, __glXDispSwap_MultiTexCoord1iv}, /* [ 201] = 201 */ {__glXDisp_MultiTexCoord1sv, __glXDispSwap_MultiTexCoord1sv}, /* [ 202] = 202 */ {__glXDisp_MultiTexCoord2dv, __glXDispSwap_MultiTexCoord2dv}, /* [ 203] = 203 */ {__glXDisp_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2fvARB}, /* [ 204] = 204 */ {__glXDisp_MultiTexCoord2iv, __glXDispSwap_MultiTexCoord2iv}, /* [ 205] = 205 */ {__glXDisp_MultiTexCoord2sv, __glXDispSwap_MultiTexCoord2sv}, /* [ 206] = 206 */ {__glXDisp_MultiTexCoord3dv, __glXDispSwap_MultiTexCoord3dv}, /* [ 207] = 207 */ {__glXDisp_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3fvARB}, /* [ 208] = 208 */ {__glXDisp_MultiTexCoord3iv, __glXDispSwap_MultiTexCoord3iv}, /* [ 209] = 209 */ {__glXDisp_MultiTexCoord3sv, __glXDispSwap_MultiTexCoord3sv}, /* [ 210] = 210 */ {__glXDisp_MultiTexCoord4dv, __glXDispSwap_MultiTexCoord4dv}, /* [ 211] = 211 */ {__glXDisp_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4fvARB}, /* [ 212] = 212 */ {__glXDisp_MultiTexCoord4iv, __glXDispSwap_MultiTexCoord4iv}, /* [ 213] = 213 */ {__glXDisp_MultiTexCoord4sv, __glXDispSwap_MultiTexCoord4sv}, /* [ 214] = 214 */ {__glXDisp_CompressedTexImage1D, __glXDispSwap_CompressedTexImage1D}, /* [ 215] = 215 */ {__glXDisp_CompressedTexImage2D, __glXDispSwap_CompressedTexImage2D}, /* [ 216] = 216 */ {__glXDisp_CompressedTexImage3D, __glXDispSwap_CompressedTexImage3D}, /* [ 217] = 217 */ {__glXDisp_CompressedTexSubImage1D, __glXDispSwap_CompressedTexSubImage1D}, /* [ 218] = 218 */ {__glXDisp_CompressedTexSubImage2D, __glXDispSwap_CompressedTexSubImage2D}, /* [ 219] = 219 */ {__glXDisp_CompressedTexSubImage3D, __glXDispSwap_CompressedTexSubImage3D}, /* [ 220] = 220 */ {NULL, NULL}, /* [ 221] = 221 */ {NULL, NULL}, /* [ 222] = 222 */ {NULL, NULL}, /* [ 223] = 223 */ {NULL, NULL}, /* [ 224] = 224 */ {NULL, NULL}, /* [ 225] = 225 */ {NULL, NULL}, /* [ 226] = 226 */ {NULL, NULL}, /* [ 227] = 227 */ {NULL, NULL}, /* [ 228] = 228 */ {NULL, NULL}, /* [ 229] = 229 */ {__glXDisp_SampleCoverage, __glXDispSwap_SampleCoverage}, /* [ 230] = 230 */ {__glXDisp_WindowPos3fv, __glXDispSwap_WindowPos3fv}, /* [ 231] = 231 */ {__glXDisp_BeginQuery, __glXDispSwap_BeginQuery}, /* [ 232] = 232 */ {__glXDisp_EndQuery, __glXDispSwap_EndQuery}, /* [ 233] = 233 */ {__glXDisp_DrawBuffers, __glXDispSwap_DrawBuffers}, /* [ 234] = 234 */ {__glXDisp_ClampColor, __glXDispSwap_ClampColor}, /* [ 235] = 235 */ {NULL, NULL}, /* [ 236] = 236 */ {NULL, NULL}, /* [ 237] = 237 */ {__glXDisp_FramebufferTextureLayer, __glXDispSwap_FramebufferTextureLayer}, /* [ 238] = 238 */ {NULL, NULL}, /* [ 239] = 239 */ {NULL, NULL}, /* [ 240] = 2048 */ {NULL, NULL}, /* [ 241] = 2049 */ {NULL, NULL}, /* [ 242] = 2050 */ {NULL, NULL}, /* [ 243] = 2051 */ {NULL, NULL}, /* [ 244] = 2052 */ {NULL, NULL}, /* [ 245] = 2053 */ {__glXDisp_ColorTable, __glXDispSwap_ColorTable}, /* [ 246] = 2054 */ {__glXDisp_ColorTableParameterfv, __glXDispSwap_ColorTableParameterfv}, /* [ 247] = 2055 */ {__glXDisp_ColorTableParameteriv, __glXDispSwap_ColorTableParameteriv}, /* [ 248] = 2056 */ {__glXDisp_CopyColorTable, __glXDispSwap_CopyColorTable}, /* [ 249] = 2057 */ {NULL, NULL}, /* [ 250] = 2058 */ {NULL, NULL}, /* [ 251] = 2059 */ {NULL, NULL}, /* [ 252] = 2060 */ {NULL, NULL}, /* [ 253] = 2061 */ {NULL, NULL}, /* [ 254] = 2062 */ {NULL, NULL}, /* [ 255] = 2063 */ {NULL, NULL}, /* [ 256] = 2064 */ {NULL, NULL}, /* [ 257] = 2065 */ {__glXDisp_PointParameterf, __glXDispSwap_PointParameterf}, /* [ 258] = 2066 */ {__glXDisp_PointParameterfv, __glXDispSwap_PointParameterfv}, /* [ 259] = 2067 */ {NULL, NULL}, /* [ 260] = 2068 */ {NULL, NULL}, /* [ 261] = 2069 */ {NULL, NULL}, /* [ 262] = 2070 */ {NULL, NULL}, /* [ 263] = 2071 */ {NULL, NULL}, /* [ 264] = 4096 */ {__glXDisp_BlendColor, __glXDispSwap_BlendColor}, /* [ 265] = 4097 */ {__glXDisp_BlendEquation, __glXDispSwap_BlendEquation}, /* [ 266] = 4098 */ {NULL, NULL}, /* [ 267] = 4099 */ {__glXDisp_TexSubImage1D, __glXDispSwap_TexSubImage1D}, /* [ 268] = 4100 */ {__glXDisp_TexSubImage2D, __glXDispSwap_TexSubImage2D}, /* [ 269] = 4101 */ {__glXDisp_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter1D}, /* [ 270] = 4102 */ {__glXDisp_ConvolutionFilter2D, __glXDispSwap_ConvolutionFilter2D}, /* [ 271] = 4103 */ {__glXDisp_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterf}, /* [ 272] = 4104 */ {__glXDisp_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameterfv}, /* [ 273] = 4105 */ {__glXDisp_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteri}, /* [ 274] = 4106 */ {__glXDisp_ConvolutionParameteriv, __glXDispSwap_ConvolutionParameteriv}, /* [ 275] = 4107 */ {__glXDisp_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter1D}, /* [ 276] = 4108 */ {__glXDisp_CopyConvolutionFilter2D, __glXDispSwap_CopyConvolutionFilter2D}, /* [ 277] = 4109 */ {__glXDisp_SeparableFilter2D, __glXDispSwap_SeparableFilter2D}, /* [ 278] = 4110 */ {__glXDisp_Histogram, __glXDispSwap_Histogram}, /* [ 279] = 4111 */ {__glXDisp_Minmax, __glXDispSwap_Minmax}, /* [ 280] = 4112 */ {__glXDisp_ResetHistogram, __glXDispSwap_ResetHistogram}, /* [ 281] = 4113 */ {__glXDisp_ResetMinmax, __glXDispSwap_ResetMinmax}, /* [ 282] = 4114 */ {__glXDisp_TexImage3D, __glXDispSwap_TexImage3D}, /* [ 283] = 4115 */ {__glXDisp_TexSubImage3D, __glXDispSwap_TexSubImage3D}, /* [ 284] = 4116 */ {NULL, NULL}, /* [ 285] = 4117 */ {__glXDisp_BindTexture, __glXDispSwap_BindTexture}, /* [ 286] = 4118 */ {__glXDisp_PrioritizeTextures, __glXDispSwap_PrioritizeTextures}, /* [ 287] = 4119 */ {__glXDisp_CopyTexImage1D, __glXDispSwap_CopyTexImage1D}, /* [ 288] = 4120 */ {__glXDisp_CopyTexImage2D, __glXDispSwap_CopyTexImage2D}, /* [ 289] = 4121 */ {__glXDisp_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage1D}, /* [ 290] = 4122 */ {__glXDisp_CopyTexSubImage2D, __glXDispSwap_CopyTexSubImage2D}, /* [ 291] = 4123 */ {__glXDisp_CopyTexSubImage3D, __glXDispSwap_CopyTexSubImage3D}, /* [ 292] = 4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT}, /* [ 293] = 4125 */ {__glXDisp_FogCoorddv, __glXDispSwap_FogCoorddv}, /* [ 294] = 4126 */ {__glXDisp_SecondaryColor3bv, __glXDispSwap_SecondaryColor3bv}, /* [ 295] = 4127 */ {__glXDisp_SecondaryColor3sv, __glXDispSwap_SecondaryColor3sv}, /* [ 296] = 4176 */ {NULL, NULL}, /* [ 297] = 4177 */ {NULL, NULL}, /* [ 298] = 4178 */ {NULL, NULL}, /* [ 299] = 4179 */ {NULL, NULL}, /* [ 300] = 4180 */ {__glXDisp_BindProgramARB, __glXDispSwap_BindProgramARB}, /* [ 301] = 4181 */ {NULL, NULL}, /* [ 302] = 4182 */ {NULL, NULL}, /* [ 303] = 4183 */ {NULL, NULL}, /* [ 304] = 4184 */ {__glXDisp_ProgramEnvParameter4fvARB, __glXDispSwap_ProgramEnvParameter4fvARB}, /* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB}, /* [ 306] = 4186 */ {NULL, NULL}, /* [ 307] = 4187 */ {NULL, NULL}, /* [ 308] = 4188 */ {NULL, NULL}, /* [ 309] = 4189 */ {__glXDisp_VertexAttrib1sv, __glXDispSwap_VertexAttrib1sv}, /* [ 310] = 4190 */ {__glXDisp_VertexAttrib2sv, __glXDispSwap_VertexAttrib2sv}, /* [ 311] = 4191 */ {__glXDisp_VertexAttrib3sv, __glXDispSwap_VertexAttrib3sv}, /* [ 312] = 4192 */ {__glXDisp_VertexAttrib4sv, __glXDispSwap_VertexAttrib4sv}, /* [ 313] = 4193 */ {__glXDisp_VertexAttrib1fvARB, __glXDispSwap_VertexAttrib1fvARB}, /* [ 314] = 4194 */ {__glXDisp_VertexAttrib2fvARB, __glXDispSwap_VertexAttrib2fvARB}, /* [ 315] = 4195 */ {__glXDisp_VertexAttrib3fvARB, __glXDispSwap_VertexAttrib3fvARB}, /* [ 316] = 4196 */ {__glXDisp_VertexAttrib4fvARB, __glXDispSwap_VertexAttrib4fvARB}, /* [ 317] = 4197 */ {__glXDisp_VertexAttrib1dv, __glXDispSwap_VertexAttrib1dv}, /* [ 318] = 4198 */ {__glXDisp_VertexAttrib2dv, __glXDispSwap_VertexAttrib2dv}, /* [ 319] = 4199 */ {__glXDisp_VertexAttrib3dv, __glXDispSwap_VertexAttrib3dv}, /* [ 320] = 4200 */ {__glXDisp_VertexAttrib4dv, __glXDispSwap_VertexAttrib4dv}, /* [ 321] = 4201 */ {__glXDisp_VertexAttrib4Nubv, __glXDispSwap_VertexAttrib4Nubv}, /* [ 322] = 4202 */ {__glXDisp_VertexAttribs1svNV, __glXDispSwap_VertexAttribs1svNV}, /* [ 323] = 4203 */ {__glXDisp_VertexAttribs2svNV, __glXDispSwap_VertexAttribs2svNV}, /* [ 324] = 4204 */ {__glXDisp_VertexAttribs3svNV, __glXDispSwap_VertexAttribs3svNV}, /* [ 325] = 4205 */ {__glXDisp_VertexAttribs4svNV, __glXDispSwap_VertexAttribs4svNV}, /* [ 326] = 4206 */ {__glXDisp_VertexAttribs1fvNV, __glXDispSwap_VertexAttribs1fvNV}, /* [ 327] = 4207 */ {__glXDisp_VertexAttribs2fvNV, __glXDispSwap_VertexAttribs2fvNV}, /* [ 328] = 4208 */ {__glXDisp_VertexAttribs3fvNV, __glXDispSwap_VertexAttribs3fvNV}, /* [ 329] = 4209 */ {__glXDisp_VertexAttribs4fvNV, __glXDispSwap_VertexAttribs4fvNV}, /* [ 330] = 4210 */ {__glXDisp_VertexAttribs1dvNV, __glXDispSwap_VertexAttribs1dvNV}, /* [ 331] = 4211 */ {__glXDisp_VertexAttribs2dvNV, __glXDispSwap_VertexAttribs2dvNV}, /* [ 332] = 4212 */ {__glXDisp_VertexAttribs3dvNV, __glXDispSwap_VertexAttribs3dvNV}, /* [ 333] = 4213 */ {__glXDisp_VertexAttribs4dvNV, __glXDispSwap_VertexAttribs4dvNV}, /* [ 334] = 4214 */ {__glXDisp_VertexAttribs4ubvNV, __glXDispSwap_VertexAttribs4ubvNV}, /* [ 335] = 4215 */ {__glXDisp_ProgramLocalParameter4fvARB, __glXDispSwap_ProgramLocalParameter4fvARB}, /* [ 336] = 4216 */ {__glXDisp_ProgramLocalParameter4dvARB, __glXDispSwap_ProgramLocalParameter4dvARB}, /* [ 337] = 4217 */ {__glXDisp_ProgramStringARB, __glXDispSwap_ProgramStringARB}, /* [ 338] = 4218 */ {NULL, NULL}, /* [ 339] = 4219 */ {NULL, NULL}, /* [ 340] = 4220 */ {__glXDisp_ActiveStencilFaceEXT, __glXDispSwap_ActiveStencilFaceEXT}, /* [ 341] = 4221 */ {__glXDisp_PointParameteri, __glXDispSwap_PointParameteri}, /* [ 342] = 4222 */ {__glXDisp_PointParameteriv, __glXDispSwap_PointParameteriv}, /* [ 343] = 4223 */ {NULL, NULL}, /* [ 344] = 4224 */ {NULL, NULL}, /* [ 345] = 4225 */ {NULL, NULL}, /* [ 346] = 4226 */ {NULL, NULL}, /* [ 347] = 4227 */ {NULL, NULL}, /* [ 348] = 4228 */ {__glXDisp_BlendEquationSeparate, __glXDispSwap_BlendEquationSeparate}, /* [ 349] = 4229 */ {NULL, NULL}, /* [ 350] = 4230 */ {__glXDisp_VertexAttrib4bv, __glXDispSwap_VertexAttrib4bv}, /* [ 351] = 4231 */ {__glXDisp_VertexAttrib4iv, __glXDispSwap_VertexAttrib4iv}, /* [ 352] = 4232 */ {__glXDisp_VertexAttrib4ubv, __glXDispSwap_VertexAttrib4ubv}, /* [ 353] = 4233 */ {__glXDisp_VertexAttrib4usv, __glXDispSwap_VertexAttrib4usv}, /* [ 354] = 4234 */ {__glXDisp_VertexAttrib4uiv, __glXDispSwap_VertexAttrib4uiv}, /* [ 355] = 4235 */ {__glXDisp_VertexAttrib4Nbv, __glXDispSwap_VertexAttrib4Nbv}, /* [ 356] = 4236 */ {__glXDisp_VertexAttrib4Nsv, __glXDispSwap_VertexAttrib4Nsv}, /* [ 357] = 4237 */ {__glXDisp_VertexAttrib4Niv, __glXDispSwap_VertexAttrib4Niv}, /* [ 358] = 4238 */ {__glXDisp_VertexAttrib4Nusv, __glXDispSwap_VertexAttrib4Nusv}, /* [ 359] = 4239 */ {__glXDisp_VertexAttrib4Nuiv, __glXDispSwap_VertexAttrib4Nuiv}, /* [ 360] = 4320 */ {__glXDisp_DeleteFramebuffers, __glXDispSwap_DeleteFramebuffers}, /* [ 361] = 4321 */ {__glXDisp_FramebufferTexture1D, __glXDispSwap_FramebufferTexture1D}, /* [ 362] = 4322 */ {__glXDisp_FramebufferTexture2D, __glXDispSwap_FramebufferTexture2D}, /* [ 363] = 4323 */ {__glXDisp_FramebufferTexture3D, __glXDispSwap_FramebufferTexture3D}, /* [ 364] = 4324 */ {__glXDisp_FramebufferRenderbuffer, __glXDispSwap_FramebufferRenderbuffer}, /* [ 365] = 4325 */ {__glXDisp_GenerateMipmap, __glXDispSwap_GenerateMipmap}, /* [ 366] = 4326 */ {NULL, NULL}, /* [ 367] = 4327 */ {NULL, NULL}, /* [ 368] = 4328 */ {NULL, NULL}, /* [ 369] = 4329 */ {NULL, NULL}, /* [ 370] = 4330 */ {__glXDisp_BlitFramebuffer, __glXDispSwap_BlitFramebuffer}, /* [ 371] = 4331 */ {__glXDisp_RenderbufferStorageMultisample, __glXDispSwap_RenderbufferStorageMultisample}, /* [ 372] = 4332 */ {NULL, NULL}, /* [ 373] = 4333 */ {NULL, NULL}, /* [ 374] = 4334 */ {NULL, NULL}, /* [ 375] = 4335 */ {NULL, NULL}, /* [ 376] = 4128 */ {__glXDisp_SecondaryColor3iv, __glXDispSwap_SecondaryColor3iv}, /* [ 377] = 4129 */ {__glXDisp_SecondaryColor3fvEXT, __glXDispSwap_SecondaryColor3fvEXT}, /* [ 378] = 4130 */ {__glXDisp_SecondaryColor3dv, __glXDispSwap_SecondaryColor3dv}, /* [ 379] = 4131 */ {__glXDisp_SecondaryColor3ubv, __glXDispSwap_SecondaryColor3ubv}, /* [ 380] = 4132 */ {__glXDisp_SecondaryColor3usv, __glXDispSwap_SecondaryColor3usv}, /* [ 381] = 4133 */ {__glXDisp_SecondaryColor3uiv, __glXDispSwap_SecondaryColor3uiv}, /* [ 382] = 4134 */ {__glXDisp_BlendFuncSeparate, __glXDispSwap_BlendFuncSeparate}, /* [ 383] = 4135 */ {NULL, NULL}, /* [ 384] = 4264 */ {NULL, NULL}, /* [ 385] = 4265 */ {__glXDisp_VertexAttrib1svNV, __glXDispSwap_VertexAttrib1svNV}, /* [ 386] = 4266 */ {__glXDisp_VertexAttrib2svNV, __glXDispSwap_VertexAttrib2svNV}, /* [ 387] = 4267 */ {__glXDisp_VertexAttrib3svNV, __glXDispSwap_VertexAttrib3svNV}, /* [ 388] = 4268 */ {__glXDisp_VertexAttrib4svNV, __glXDispSwap_VertexAttrib4svNV}, /* [ 389] = 4269 */ {__glXDisp_VertexAttrib1fvNV, __glXDispSwap_VertexAttrib1fvNV}, /* [ 390] = 4270 */ {__glXDisp_VertexAttrib2fvNV, __glXDispSwap_VertexAttrib2fvNV}, /* [ 391] = 4271 */ {__glXDisp_VertexAttrib3fvNV, __glXDispSwap_VertexAttrib3fvNV}, /* [ 392] = 4272 */ {__glXDisp_VertexAttrib4fvNV, __glXDispSwap_VertexAttrib4fvNV}, /* [ 393] = 4273 */ {__glXDisp_VertexAttrib1dvNV, __glXDispSwap_VertexAttrib1dvNV}, /* [ 394] = 4274 */ {__glXDisp_VertexAttrib2dvNV, __glXDispSwap_VertexAttrib2dvNV}, /* [ 395] = 4275 */ {__glXDisp_VertexAttrib3dvNV, __glXDispSwap_VertexAttrib3dvNV}, /* [ 396] = 4276 */ {__glXDisp_VertexAttrib4dvNV, __glXDispSwap_VertexAttrib4dvNV}, /* [ 397] = 4277 */ {__glXDisp_VertexAttrib4ubvNV, __glXDispSwap_VertexAttrib4ubvNV}, /* [ 398] = 4278 */ {NULL, NULL}, /* [ 399] = 4279 */ {NULL, NULL}, /* [ 400] = 4312 */ {NULL, NULL}, /* [ 401] = 4313 */ {NULL, NULL}, /* [ 402] = 4314 */ {NULL, NULL}, /* [ 403] = 4315 */ {NULL, NULL}, /* [ 404] = 4316 */ {__glXDisp_BindRenderbuffer, __glXDispSwap_BindRenderbuffer}, /* [ 405] = 4317 */ {__glXDisp_DeleteRenderbuffers, __glXDispSwap_DeleteRenderbuffers}, /* [ 406] = 4318 */ {__glXDisp_RenderbufferStorage, __glXDispSwap_RenderbufferStorage}, /* [ 407] = 4319 */ {__glXDisp_BindFramebuffer, __glXDispSwap_BindFramebuffer}, }; static const int_fast16_t Render_size_table[408][2] = { /* [ 0] = 0 */ {0, ~0}, /* [ 1] = 1 */ {8, ~0}, /* [ 2] = 2 */ {12, 0}, /* [ 3] = 3 */ {8, ~0}, /* [ 4] = 4 */ {8, ~0}, /* [ 5] = 5 */ {48, 1}, /* [ 6] = 6 */ {8, ~0}, /* [ 7] = 7 */ {28, ~0}, /* [ 8] = 8 */ {16, ~0}, /* [ 9] = 9 */ {16, ~0}, /* [ 10] = 10 */ {12, ~0}, /* [ 11] = 11 */ {8, ~0}, /* [ 12] = 12 */ {16, ~0}, /* [ 13] = 13 */ {12, ~0}, /* [ 14] = 14 */ {8, ~0}, /* [ 15] = 15 */ {36, ~0}, /* [ 16] = 16 */ {20, ~0}, /* [ 17] = 17 */ {20, ~0}, /* [ 18] = 18 */ {12, ~0}, /* [ 19] = 19 */ {8, ~0}, /* [ 20] = 20 */ {20, ~0}, /* [ 21] = 21 */ {12, ~0}, /* [ 22] = 22 */ {8, ~0}, /* [ 23] = 23 */ {4, ~0}, /* [ 24] = 24 */ {12, ~0}, /* [ 25] = 25 */ {8, ~0}, /* [ 26] = 26 */ {8, ~0}, /* [ 27] = 27 */ {8, ~0}, /* [ 28] = 28 */ {8, ~0}, /* [ 29] = 29 */ {28, ~0}, /* [ 30] = 30 */ {16, ~0}, /* [ 31] = 31 */ {16, ~0}, /* [ 32] = 32 */ {12, ~0}, /* [ 33] = 33 */ {20, ~0}, /* [ 34] = 34 */ {12, ~0}, /* [ 35] = 35 */ {12, ~0}, /* [ 36] = 36 */ {8, ~0}, /* [ 37] = 37 */ {28, ~0}, /* [ 38] = 38 */ {16, ~0}, /* [ 39] = 39 */ {16, ~0}, /* [ 40] = 40 */ {12, ~0}, /* [ 41] = 41 */ {36, ~0}, /* [ 42] = 42 */ {20, ~0}, /* [ 43] = 43 */ {20, ~0}, /* [ 44] = 44 */ {12, ~0}, /* [ 45] = 45 */ {36, ~0}, /* [ 46] = 46 */ {20, ~0}, /* [ 47] = 47 */ {20, ~0}, /* [ 48] = 48 */ {12, ~0}, /* [ 49] = 49 */ {12, ~0}, /* [ 50] = 50 */ {8, ~0}, /* [ 51] = 51 */ {8, ~0}, /* [ 52] = 52 */ {8, ~0}, /* [ 53] = 53 */ {20, ~0}, /* [ 54] = 54 */ {12, ~0}, /* [ 55] = 55 */ {12, ~0}, /* [ 56] = 56 */ {8, ~0}, /* [ 57] = 57 */ {28, ~0}, /* [ 58] = 58 */ {16, ~0}, /* [ 59] = 59 */ {16, ~0}, /* [ 60] = 60 */ {12, ~0}, /* [ 61] = 61 */ {36, ~0}, /* [ 62] = 62 */ {20, ~0}, /* [ 63] = 63 */ {20, ~0}, /* [ 64] = 64 */ {12, ~0}, /* [ 65] = 65 */ {20, ~0}, /* [ 66] = 66 */ {12, ~0}, /* [ 67] = 67 */ {12, ~0}, /* [ 68] = 68 */ {8, ~0}, /* [ 69] = 69 */ {28, ~0}, /* [ 70] = 70 */ {16, ~0}, /* [ 71] = 71 */ {16, ~0}, /* [ 72] = 72 */ {12, ~0}, /* [ 73] = 73 */ {36, ~0}, /* [ 74] = 74 */ {20, ~0}, /* [ 75] = 75 */ {20, ~0}, /* [ 76] = 76 */ {12, ~0}, /* [ 77] = 77 */ {40, ~0}, /* [ 78] = 78 */ {12, ~0}, /* [ 79] = 79 */ {8, ~0}, /* [ 80] = 80 */ {12, ~0}, /* [ 81] = 81 */ {8, 2}, /* [ 82] = 82 */ {12, ~0}, /* [ 83] = 83 */ {8, 3}, /* [ 84] = 84 */ {8, ~0}, /* [ 85] = 85 */ {12, ~0}, /* [ 86] = 86 */ {16, ~0}, /* [ 87] = 87 */ {12, 4}, /* [ 88] = 88 */ {16, ~0}, /* [ 89] = 89 */ {12, 5}, /* [ 90] = 90 */ {12, ~0}, /* [ 91] = 91 */ {8, 6}, /* [ 92] = 92 */ {12, ~0}, /* [ 93] = 93 */ {8, 7}, /* [ 94] = 94 */ {12, ~0}, /* [ 95] = 95 */ {8, ~0}, /* [ 96] = 96 */ {16, ~0}, /* [ 97] = 97 */ {12, 8}, /* [ 98] = 98 */ {16, ~0}, /* [ 99] = 99 */ {12, 9}, /* [100] = 100 */ {8, ~0}, /* [101] = 101 */ {12, ~0}, /* [102] = 102 */ {24, 10}, /* [103] = 103 */ {20, ~0}, /* [104] = 104 */ {8, ~0}, /* [105] = 105 */ {16, ~0}, /* [106] = 106 */ {12, 11}, /* [107] = 107 */ {16, ~0}, /* [108] = 108 */ {12, 12}, /* [109] = 109 */ {56, 13}, /* [110] = 110 */ {56, 14}, /* [111] = 111 */ {16, ~0}, /* [112] = 112 */ {12, 15}, /* [113] = 113 */ {16, ~0}, /* [114] = 114 */ {12, 16}, /* [115] = 115 */ {20, ~0}, /* [116] = 116 */ {12, 17}, /* [117] = 117 */ {16, ~0}, /* [118] = 118 */ {12, 18}, /* [119] = 119 */ {16, ~0}, /* [120] = 120 */ {12, 19}, /* [121] = 121 */ {4, ~0}, /* [122] = 122 */ {8, ~0}, /* [123] = 123 */ {8, ~0}, /* [124] = 124 */ {4, ~0}, /* [125] = 125 */ {8, ~0}, /* [126] = 126 */ {8, ~0}, /* [127] = 127 */ {8, ~0}, /* [128] = 128 */ {20, ~0}, /* [129] = 129 */ {8, ~0}, /* [130] = 130 */ {20, ~0}, /* [131] = 131 */ {8, ~0}, /* [132] = 132 */ {12, ~0}, /* [133] = 133 */ {8, ~0}, /* [134] = 134 */ {8, ~0}, /* [135] = 135 */ {8, ~0}, /* [136] = 136 */ {8, ~0}, /* [137] = 137 */ {12, ~0}, /* [138] = 138 */ {8, ~0}, /* [139] = 139 */ {8, ~0}, /* [140] = 140 */ {0, ~0}, /* [141] = 141 */ {4, ~0}, /* [142] = 142 */ {8, ~0}, /* [143] = 143 */ {28, 20}, /* [144] = 144 */ {20, 21}, /* [145] = 145 */ {48, 22}, /* [146] = 146 */ {32, 23}, /* [147] = 147 */ {24, ~0}, /* [148] = 148 */ {16, ~0}, /* [149] = 149 */ {44, ~0}, /* [150] = 150 */ {28, ~0}, /* [151] = 151 */ {12, ~0}, /* [152] = 152 */ {8, ~0}, /* [153] = 153 */ {20, ~0}, /* [154] = 154 */ {12, ~0}, /* [155] = 155 */ {16, ~0}, /* [156] = 156 */ {8, ~0}, /* [157] = 157 */ {24, ~0}, /* [158] = 158 */ {12, ~0}, /* [159] = 159 */ {12, ~0}, /* [160] = 160 */ {12, ~0}, /* [161] = 161 */ {8, ~0}, /* [162] = 162 */ {16, ~0}, /* [163] = 163 */ {16, ~0}, /* [164] = 164 */ {8, ~0}, /* [165] = 165 */ {12, ~0}, /* [166] = 166 */ {12, ~0}, /* [167] = 167 */ {12, ~0}, /* [168] = 168 */ {12, 24}, /* [169] = 169 */ {12, 25}, /* [170] = 170 */ {12, 26}, /* [171] = 171 */ {8, ~0}, /* [172] = 172 */ {24, ~0}, /* [173] = 173 */ {40, 27}, /* [174] = 174 */ {20, ~0}, /* [175] = 175 */ {52, ~0}, /* [176] = 176 */ {4, ~0}, /* [177] = 177 */ {68, ~0}, /* [178] = 178 */ {132, ~0}, /* [179] = 179 */ {8, ~0}, /* [180] = 180 */ {68, ~0}, /* [181] = 181 */ {132, ~0}, /* [182] = 182 */ {52, ~0}, /* [183] = 183 */ {4, ~0}, /* [184] = 184 */ {4, ~0}, /* [185] = 185 */ {36, ~0}, /* [186] = 186 */ {20, ~0}, /* [187] = 187 */ {28, ~0}, /* [188] = 188 */ {16, ~0}, /* [189] = 189 */ {28, ~0}, /* [190] = 190 */ {16, ~0}, /* [191] = 191 */ {20, ~0}, /* [192] = 192 */ {12, ~0}, /* [193] = 193 */ {16, 28}, /* [194] = 194 */ {8, ~0}, /* [195] = 195 */ {44, 29}, /* [196] = 196 */ {24, ~0}, /* [197] = 197 */ {8, ~0}, /* [198] = 198 */ {16, ~0}, /* [199] = 199 */ {12, ~0}, /* [200] = 200 */ {12, ~0}, /* [201] = 201 */ {12, ~0}, /* [202] = 202 */ {24, ~0}, /* [203] = 203 */ {16, ~0}, /* [204] = 204 */ {16, ~0}, /* [205] = 205 */ {12, ~0}, /* [206] = 206 */ {32, ~0}, /* [207] = 207 */ {20, ~0}, /* [208] = 208 */ {20, ~0}, /* [209] = 209 */ {16, ~0}, /* [210] = 210 */ {40, ~0}, /* [211] = 211 */ {24, ~0}, /* [212] = 212 */ {24, ~0}, /* [213] = 213 */ {16, ~0}, /* [214] = 214 */ {28, 30}, /* [215] = 215 */ {32, 31}, /* [216] = 216 */ {36, 32}, /* [217] = 217 */ {28, 33}, /* [218] = 218 */ {36, 34}, /* [219] = 219 */ {44, 35}, /* [220] = 220 */ {0, ~0}, /* [221] = 221 */ {0, ~0}, /* [222] = 222 */ {0, ~0}, /* [223] = 223 */ {0, ~0}, /* [224] = 224 */ {0, ~0}, /* [225] = 225 */ {0, ~0}, /* [226] = 226 */ {0, ~0}, /* [227] = 227 */ {0, ~0}, /* [228] = 228 */ {0, ~0}, /* [229] = 229 */ {12, ~0}, /* [230] = 230 */ {16, ~0}, /* [231] = 231 */ {12, ~0}, /* [232] = 232 */ {8, ~0}, /* [233] = 233 */ {8, 36}, /* [234] = 234 */ {12, ~0}, /* [235] = 235 */ {0, ~0}, /* [236] = 236 */ {0, ~0}, /* [237] = 237 */ {24, ~0}, /* [238] = 238 */ {0, ~0}, /* [239] = 239 */ {0, ~0}, /* [240] = 2048 */ {0, ~0}, /* [241] = 2049 */ {0, ~0}, /* [242] = 2050 */ {0, ~0}, /* [243] = 2051 */ {0, ~0}, /* [244] = 2052 */ {0, ~0}, /* [245] = 2053 */ {44, 37}, /* [246] = 2054 */ {12, 38}, /* [247] = 2055 */ {12, 39}, /* [248] = 2056 */ {24, ~0}, /* [249] = 2057 */ {0, ~0}, /* [250] = 2058 */ {0, ~0}, /* [251] = 2059 */ {0, ~0}, /* [252] = 2060 */ {0, ~0}, /* [253] = 2061 */ {0, ~0}, /* [254] = 2062 */ {0, ~0}, /* [255] = 2063 */ {0, ~0}, /* [256] = 2064 */ {0, ~0}, /* [257] = 2065 */ {12, ~0}, /* [258] = 2066 */ {8, 40}, /* [259] = 2067 */ {0, ~0}, /* [260] = 2068 */ {0, ~0}, /* [261] = 2069 */ {0, ~0}, /* [262] = 2070 */ {0, ~0}, /* [263] = 2071 */ {0, ~0}, /* [264] = 4096 */ {20, ~0}, /* [265] = 4097 */ {8, ~0}, /* [266] = 4098 */ {0, ~0}, /* [267] = 4099 */ {60, 41}, /* [268] = 4100 */ {60, 42}, /* [269] = 4101 */ {48, 43}, /* [270] = 4102 */ {48, 44}, /* [271] = 4103 */ {16, ~0}, /* [272] = 4104 */ {12, 45}, /* [273] = 4105 */ {16, ~0}, /* [274] = 4106 */ {12, 46}, /* [275] = 4107 */ {24, ~0}, /* [276] = 4108 */ {28, ~0}, /* [277] = 4109 */ {32, 47}, /* [278] = 4110 */ {20, ~0}, /* [279] = 4111 */ {16, ~0}, /* [280] = 4112 */ {8, ~0}, /* [281] = 4113 */ {8, ~0}, /* [282] = 4114 */ {84, 48}, /* [283] = 4115 */ {92, 49}, /* [284] = 4116 */ {0, ~0}, /* [285] = 4117 */ {12, ~0}, /* [286] = 4118 */ {8, 50}, /* [287] = 4119 */ {32, ~0}, /* [288] = 4120 */ {36, ~0}, /* [289] = 4121 */ {28, ~0}, /* [290] = 4122 */ {36, ~0}, /* [291] = 4123 */ {40, ~0}, /* [292] = 4124 */ {8, ~0}, /* [293] = 4125 */ {12, ~0}, /* [294] = 4126 */ {8, ~0}, /* [295] = 4127 */ {12, ~0}, /* [296] = 4176 */ {0, ~0}, /* [297] = 4177 */ {0, ~0}, /* [298] = 4178 */ {0, ~0}, /* [299] = 4179 */ {0, ~0}, /* [300] = 4180 */ {12, ~0}, /* [301] = 4181 */ {0, ~0}, /* [302] = 4182 */ {0, ~0}, /* [303] = 4183 */ {0, ~0}, /* [304] = 4184 */ {28, ~0}, /* [305] = 4185 */ {44, ~0}, /* [306] = 4186 */ {0, ~0}, /* [307] = 4187 */ {0, ~0}, /* [308] = 4188 */ {0, ~0}, /* [309] = 4189 */ {12, ~0}, /* [310] = 4190 */ {12, ~0}, /* [311] = 4191 */ {16, ~0}, /* [312] = 4192 */ {16, ~0}, /* [313] = 4193 */ {12, ~0}, /* [314] = 4194 */ {16, ~0}, /* [315] = 4195 */ {20, ~0}, /* [316] = 4196 */ {24, ~0}, /* [317] = 4197 */ {16, ~0}, /* [318] = 4198 */ {24, ~0}, /* [319] = 4199 */ {32, ~0}, /* [320] = 4200 */ {40, ~0}, /* [321] = 4201 */ {12, ~0}, /* [322] = 4202 */ {12, 51}, /* [323] = 4203 */ {12, 52}, /* [324] = 4204 */ {12, 53}, /* [325] = 4205 */ {12, 54}, /* [326] = 4206 */ {12, 55}, /* [327] = 4207 */ {12, 56}, /* [328] = 4208 */ {12, 57}, /* [329] = 4209 */ {12, 58}, /* [330] = 4210 */ {12, 59}, /* [331] = 4211 */ {12, 60}, /* [332] = 4212 */ {12, 61}, /* [333] = 4213 */ {12, 62}, /* [334] = 4214 */ {12, 63}, /* [335] = 4215 */ {28, ~0}, /* [336] = 4216 */ {44, ~0}, /* [337] = 4217 */ {16, 64}, /* [338] = 4218 */ {0, ~0}, /* [339] = 4219 */ {0, ~0}, /* [340] = 4220 */ {8, ~0}, /* [341] = 4221 */ {12, ~0}, /* [342] = 4222 */ {8, 65}, /* [343] = 4223 */ {0, ~0}, /* [344] = 4224 */ {0, ~0}, /* [345] = 4225 */ {0, ~0}, /* [346] = 4226 */ {0, ~0}, /* [347] = 4227 */ {0, ~0}, /* [348] = 4228 */ {12, ~0}, /* [349] = 4229 */ {0, ~0}, /* [350] = 4230 */ {12, ~0}, /* [351] = 4231 */ {24, ~0}, /* [352] = 4232 */ {12, ~0}, /* [353] = 4233 */ {16, ~0}, /* [354] = 4234 */ {24, ~0}, /* [355] = 4235 */ {12, ~0}, /* [356] = 4236 */ {16, ~0}, /* [357] = 4237 */ {24, ~0}, /* [358] = 4238 */ {16, ~0}, /* [359] = 4239 */ {24, ~0}, /* [360] = 4320 */ {8, 66}, /* [361] = 4321 */ {24, ~0}, /* [362] = 4322 */ {24, ~0}, /* [363] = 4323 */ {28, ~0}, /* [364] = 4324 */ {20, ~0}, /* [365] = 4325 */ {8, ~0}, /* [366] = 4326 */ {0, ~0}, /* [367] = 4327 */ {0, ~0}, /* [368] = 4328 */ {0, ~0}, /* [369] = 4329 */ {0, ~0}, /* [370] = 4330 */ {44, ~0}, /* [371] = 4331 */ {24, ~0}, /* [372] = 4332 */ {0, ~0}, /* [373] = 4333 */ {0, ~0}, /* [374] = 4334 */ {0, ~0}, /* [375] = 4335 */ {0, ~0}, /* [376] = 4128 */ {16, ~0}, /* [377] = 4129 */ {16, ~0}, /* [378] = 4130 */ {28, ~0}, /* [379] = 4131 */ {8, ~0}, /* [380] = 4132 */ {12, ~0}, /* [381] = 4133 */ {16, ~0}, /* [382] = 4134 */ {20, ~0}, /* [383] = 4135 */ {0, ~0}, /* [384] = 4264 */ {0, ~0}, /* [385] = 4265 */ {12, ~0}, /* [386] = 4266 */ {12, ~0}, /* [387] = 4267 */ {16, ~0}, /* [388] = 4268 */ {16, ~0}, /* [389] = 4269 */ {12, ~0}, /* [390] = 4270 */ {16, ~0}, /* [391] = 4271 */ {20, ~0}, /* [392] = 4272 */ {24, ~0}, /* [393] = 4273 */ {16, ~0}, /* [394] = 4274 */ {24, ~0}, /* [395] = 4275 */ {32, ~0}, /* [396] = 4276 */ {40, ~0}, /* [397] = 4277 */ {12, ~0}, /* [398] = 4278 */ {0, ~0}, /* [399] = 4279 */ {0, ~0}, /* [400] = 4312 */ {0, ~0}, /* [401] = 4313 */ {0, ~0}, /* [402] = 4314 */ {0, ~0}, /* [403] = 4315 */ {0, ~0}, /* [404] = 4316 */ {12, ~0}, /* [405] = 4317 */ {8, 67}, /* [406] = 4318 */ {20, ~0}, /* [407] = 4319 */ {12, ~0}, }; static const gl_proto_size_func Render_size_func_table[68] = { __glXCallListsReqSize, __glXBitmapReqSize, __glXFogfvReqSize, __glXFogivReqSize, __glXLightfvReqSize, __glXLightivReqSize, __glXLightModelfvReqSize, __glXLightModelivReqSize, __glXMaterialfvReqSize, __glXMaterialivReqSize, __glXPolygonStippleReqSize, __glXTexParameterfvReqSize, __glXTexParameterivReqSize, __glXTexImage1DReqSize, __glXTexImage2DReqSize, __glXTexEnvfvReqSize, __glXTexEnvivReqSize, __glXTexGendvReqSize, __glXTexGenfvReqSize, __glXTexGenivReqSize, __glXMap1dReqSize, __glXMap1fReqSize, __glXMap2dReqSize, __glXMap2fReqSize, __glXPixelMapfvReqSize, __glXPixelMapuivReqSize, __glXPixelMapusvReqSize, __glXDrawPixelsReqSize, __glXDrawArraysReqSize, __glXColorSubTableReqSize, __glXCompressedTexImage1DReqSize, __glXCompressedTexImage2DReqSize, __glXCompressedTexImage3DReqSize, __glXCompressedTexSubImage1DReqSize, __glXCompressedTexSubImage2DReqSize, __glXCompressedTexSubImage3DReqSize, __glXDrawBuffersReqSize, __glXColorTableReqSize, __glXColorTableParameterfvReqSize, __glXColorTableParameterivReqSize, __glXPointParameterfvReqSize, __glXTexSubImage1DReqSize, __glXTexSubImage2DReqSize, __glXConvolutionFilter1DReqSize, __glXConvolutionFilter2DReqSize, __glXConvolutionParameterfvReqSize, __glXConvolutionParameterivReqSize, __glXSeparableFilter2DReqSize, __glXTexImage3DReqSize, __glXTexSubImage3DReqSize, __glXPrioritizeTexturesReqSize, __glXVertexAttribs1svNVReqSize, __glXVertexAttribs2svNVReqSize, __glXVertexAttribs3svNVReqSize, __glXVertexAttribs4svNVReqSize, __glXVertexAttribs1fvNVReqSize, __glXVertexAttribs2fvNVReqSize, __glXVertexAttribs3fvNVReqSize, __glXVertexAttribs4fvNVReqSize, __glXVertexAttribs1dvNVReqSize, __glXVertexAttribs2dvNVReqSize, __glXVertexAttribs3dvNVReqSize, __glXVertexAttribs4dvNVReqSize, __glXVertexAttribs4ubvNVReqSize, __glXProgramStringARBReqSize, __glXPointParameterivReqSize, __glXDeleteFramebuffersReqSize, __glXDeleteRenderbuffersReqSize, }; const struct __glXDispatchInfo Render_dispatch_info = { 13, Render_dispatch_tree, Render_function_table, Render_size_table, Render_size_func_table }; /*****************************************************************/ /* tree depth = 12 */ static const int_fast16_t VendorPriv_dispatch_tree[152] = { /* [0] -> opcode range [0, 131072], node depth 1 */ 2, 5, EMPTY_LEAF, 119, EMPTY_LEAF, /* [5] -> opcode range [0, 32768], node depth 2 */ 1, 8, EMPTY_LEAF, /* [8] -> opcode range [0, 16384], node depth 3 */ 1, 11, EMPTY_LEAF, /* [11] -> opcode range [0, 8192], node depth 4 */ 2, 16, EMPTY_LEAF, 78, EMPTY_LEAF, /* [16] -> opcode range [0, 2048], node depth 5 */ 2, 21, EMPTY_LEAF, 36, EMPTY_LEAF, /* [21] -> opcode range [0, 512], node depth 6 */ 1, 24, EMPTY_LEAF, /* [24] -> opcode range [0, 256], node depth 7 */ 1, 27, EMPTY_LEAF, /* [27] -> opcode range [0, 128], node depth 8 */ 1, 30, EMPTY_LEAF, /* [30] -> opcode range [0, 64], node depth 9 */ 1, 33, EMPTY_LEAF, /* [33] -> opcode range [0, 32], node depth 10 */ 1, LEAF(0), EMPTY_LEAF, /* [36] -> opcode range [1024, 1536], node depth 6 */ 2, 41, EMPTY_LEAF, 53, 67, /* [41] -> opcode range [1024, 1152], node depth 7 */ 1, 44, EMPTY_LEAF, /* [44] -> opcode range [1024, 1088], node depth 8 */ 1, 47, EMPTY_LEAF, /* [47] -> opcode range [1024, 1056], node depth 9 */ 1, 50, EMPTY_LEAF, /* [50] -> opcode range [1024, 1040], node depth 10 */ 1, LEAF(16), EMPTY_LEAF, /* [53] -> opcode range [1280, 1408], node depth 7 */ 1, 56, EMPTY_LEAF, /* [56] -> opcode range [1280, 1344], node depth 8 */ 2, 61, LEAF(24), EMPTY_LEAF, 64, /* [61] -> opcode range [1280, 1296], node depth 9 */ 1, EMPTY_LEAF, LEAF(40), /* [64] -> opcode range [1328, 1344], node depth 9 */ 1, LEAF(48), EMPTY_LEAF, /* [67] -> opcode range [1408, 1536], node depth 7 */ 1, 70, EMPTY_LEAF, /* [70] -> opcode range [1408, 1472], node depth 8 */ 1, 73, EMPTY_LEAF, /* [73] -> opcode range [1408, 1440], node depth 9 */ 2, EMPTY_LEAF, LEAF(56), LEAF(64), EMPTY_LEAF, /* [78] -> opcode range [4096, 6144], node depth 5 */ 2, 83, EMPTY_LEAF, 101, EMPTY_LEAF, /* [83] -> opcode range [4096, 4608], node depth 6 */ 1, 86, EMPTY_LEAF, /* [86] -> opcode range [4096, 4352], node depth 7 */ 1, 89, EMPTY_LEAF, /* [89] -> opcode range [4096, 4224], node depth 8 */ 1, 92, EMPTY_LEAF, /* [92] -> opcode range [4096, 4160], node depth 9 */ 1, 95, EMPTY_LEAF, /* [95] -> opcode range [4096, 4128], node depth 10 */ 1, 98, EMPTY_LEAF, /* [98] -> opcode range [4096, 4112], node depth 11 */ 1, LEAF(72), EMPTY_LEAF, /* [101] -> opcode range [5120, 5632], node depth 6 */ 1, 104, EMPTY_LEAF, /* [104] -> opcode range [5120, 5376], node depth 7 */ 1, 107, EMPTY_LEAF, /* [107] -> opcode range [5120, 5248], node depth 8 */ 1, 110, EMPTY_LEAF, /* [110] -> opcode range [5120, 5184], node depth 9 */ 1, EMPTY_LEAF, 113, /* [113] -> opcode range [5152, 5184], node depth 10 */ 1, 116, EMPTY_LEAF, /* [116] -> opcode range [5152, 5168], node depth 11 */ 1, LEAF(80), EMPTY_LEAF, /* [119] -> opcode range [65536, 98304], node depth 2 */ 1, 122, EMPTY_LEAF, /* [122] -> opcode range [65536, 81920], node depth 3 */ 1, 125, EMPTY_LEAF, /* [125] -> opcode range [65536, 73728], node depth 4 */ 1, 128, EMPTY_LEAF, /* [128] -> opcode range [65536, 69632], node depth 5 */ 1, 131, EMPTY_LEAF, /* [131] -> opcode range [65536, 67584], node depth 6 */ 1, 134, EMPTY_LEAF, /* [134] -> opcode range [65536, 66560], node depth 7 */ 1, 137, EMPTY_LEAF, /* [137] -> opcode range [65536, 66048], node depth 8 */ 1, 140, EMPTY_LEAF, /* [140] -> opcode range [65536, 65792], node depth 9 */ 1, 143, EMPTY_LEAF, /* [143] -> opcode range [65536, 65664], node depth 10 */ 1, 146, EMPTY_LEAF, /* [146] -> opcode range [65536, 65600], node depth 11 */ 1, 149, EMPTY_LEAF, /* [149] -> opcode range [65536, 65568], node depth 12 */ 1, LEAF(88), EMPTY_LEAF, }; static const void *VendorPriv_function_table[104][2] = { /* [ 0] = 0 */ {NULL, NULL}, /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT}, /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT}, /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT}, /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT}, /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT}, /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT}, /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT}, /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT}, /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT}, /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT}, /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT}, /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT}, /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT}, /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT}, /* [ 15] = 15 */ {NULL, NULL}, /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT}, /* [ 17] = 1025 */ {NULL, NULL}, /* [ 18] = 1026 */ {NULL, NULL}, /* [ 19] = 1027 */ {NULL, NULL}, /* [ 20] = 1028 */ {NULL, NULL}, /* [ 21] = 1029 */ {NULL, NULL}, /* [ 22] = 1030 */ {NULL, NULL}, /* [ 23] = 1031 */ {NULL, NULL}, /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB}, /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB}, /* [ 26] = 1298 */ {NULL, NULL}, /* [ 27] = 1299 */ {NULL, NULL}, /* [ 28] = 1300 */ {NULL, NULL}, /* [ 29] = 1301 */ {NULL, NULL}, /* [ 30] = 1302 */ {NULL, NULL}, /* [ 31] = 1303 */ {NULL, NULL}, /* [ 32] = 1304 */ {__glXDisp_IsProgramARB, __glXDispSwap_IsProgramARB}, /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB}, /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB}, /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB}, /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB}, /* [ 37] = 1309 */ {NULL, NULL}, /* [ 38] = 1310 */ {NULL, NULL}, /* [ 39] = 1311 */ {NULL, NULL}, /* [ 40] = 1288 */ {NULL, NULL}, /* [ 41] = 1289 */ {NULL, NULL}, /* [ 42] = 1290 */ {NULL, NULL}, /* [ 43] = 1291 */ {NULL, NULL}, /* [ 44] = 1292 */ {NULL, NULL}, /* [ 45] = 1293 */ {NULL, NULL}, /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsARB, __glXDispSwap_DeleteProgramsARB}, /* [ 47] = 1295 */ {__glXDisp_GenProgramsARB, __glXDispSwap_GenProgramsARB}, /* [ 48] = 1328 */ {NULL, NULL}, /* [ 49] = 1329 */ {NULL, NULL}, /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT}, /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT}, /* [ 52] = 1332 */ {NULL, NULL}, /* [ 53] = 1333 */ {NULL, NULL}, /* [ 54] = 1334 */ {NULL, NULL}, /* [ 55] = 1335 */ {NULL, NULL}, /* [ 56] = 1416 */ {NULL, NULL}, /* [ 57] = 1417 */ {NULL, NULL}, /* [ 58] = 1418 */ {NULL, NULL}, /* [ 59] = 1419 */ {NULL, NULL}, /* [ 60] = 1420 */ {NULL, NULL}, /* [ 61] = 1421 */ {NULL, NULL}, /* [ 62] = 1422 */ {__glXDisp_IsRenderbuffer, __glXDispSwap_IsRenderbuffer}, /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffers, __glXDispSwap_GenRenderbuffers}, /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameteriv, __glXDispSwap_GetRenderbufferParameteriv}, /* [ 65] = 1425 */ {__glXDisp_IsFramebuffer, __glXDispSwap_IsFramebuffer}, /* [ 66] = 1426 */ {__glXDisp_GenFramebuffers, __glXDispSwap_GenFramebuffers}, /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatus, __glXDispSwap_CheckFramebufferStatus}, /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameteriv, __glXDispSwap_GetFramebufferAttachmentParameteriv}, /* [ 69] = 1429 */ {NULL, NULL}, /* [ 70] = 1430 */ {NULL, NULL}, /* [ 71] = 1431 */ {NULL, NULL}, /* [ 72] = 4096 */ {NULL, NULL}, /* [ 73] = 4097 */ {NULL, NULL}, /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI}, /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI}, /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI}, /* [ 77] = 4101 */ {NULL, NULL}, /* [ 78] = 4102 */ {NULL, NULL}, /* [ 79] = 4103 */ {NULL, NULL}, /* [ 80] = 5152 */ {NULL, NULL}, /* [ 81] = 5153 */ {NULL, NULL}, /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA}, /* [ 83] = 5155 */ {NULL, NULL}, /* [ 84] = 5156 */ {NULL, NULL}, /* [ 85] = 5157 */ {NULL, NULL}, /* [ 86] = 5158 */ {NULL, NULL}, /* [ 87] = 5159 */ {NULL, NULL}, /* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI}, /* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI}, /* [ 90] = 65538 */ {NULL, NULL}, /* [ 91] = 65539 */ {NULL, NULL}, /* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX}, /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, /* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX}, /* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX}, /* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX}, /* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX}, /* [ 99] = 65547 */ {NULL, NULL}, /* [ 100] = 65548 */ {NULL, NULL}, /* [ 101] = 65549 */ {NULL, NULL}, /* [ 102] = 65550 */ {NULL, NULL}, /* [ 103] = 65551 */ {NULL, NULL}, }; const struct __glXDispatchInfo VendorPriv_dispatch_info = { 17, VendorPriv_dispatch_tree, VendorPriv_function_table, NULL, NULL }; xorg-server-1.20.8/glx/singlesize.c0000644000175000017500000001300013640201473014112 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include "singlesize.h" #include "indirect_size_get.h" /* ** These routines compute the size of variable-size returned parameters. ** Unlike the similar routines that do the same thing for variable-size ** incoming parameters, the samplegl library itself doesn't use these routines. ** Hence, they are located here, in the GLX extension library. */ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) { return __glXImageSize(format, type, 0, w, h, 1, 0, 0, 0, 0, 4); } GLint __glGetMap_size(GLenum target, GLenum query) { GLint k, order = 0, majorMinor[2]; /* ** Assume target and query are both valid. */ switch (target) { case GL_MAP1_COLOR_4: case GL_MAP1_NORMAL: case GL_MAP1_INDEX: case GL_MAP1_TEXTURE_COORD_1: case GL_MAP1_TEXTURE_COORD_2: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_VERTEX_3: case GL_MAP1_VERTEX_4: switch (query) { case GL_COEFF: k = __glMap1d_size(target); glGetMapiv(target, GL_ORDER, &order); /* ** The query above might fail, but then order will be zero anyway. */ return order * k; case GL_DOMAIN: return 2; case GL_ORDER: return 1; } break; case GL_MAP2_COLOR_4: case GL_MAP2_NORMAL: case GL_MAP2_INDEX: case GL_MAP2_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_VERTEX_3: case GL_MAP2_VERTEX_4: switch (query) { case GL_COEFF: k = __glMap2d_size(target); majorMinor[0] = majorMinor[1] = 0; glGetMapiv(target, GL_ORDER, majorMinor); /* ** The query above might fail, but then majorMinor will be zeroes */ return majorMinor[0] * majorMinor[1] * k; case GL_DOMAIN: return 4; case GL_ORDER: return 2; } break; } return -1; } GLint __glGetMapdv_size(GLenum target, GLenum query) { return __glGetMap_size(target, query); } GLint __glGetMapfv_size(GLenum target, GLenum query) { return __glGetMap_size(target, query); } GLint __glGetMapiv_size(GLenum target, GLenum query) { return __glGetMap_size(target, query); } GLint __glGetPixelMap_size(GLenum map) { GLint size; GLenum query; switch (map) { case GL_PIXEL_MAP_I_TO_I: query = GL_PIXEL_MAP_I_TO_I_SIZE; break; case GL_PIXEL_MAP_S_TO_S: query = GL_PIXEL_MAP_S_TO_S_SIZE; break; case GL_PIXEL_MAP_I_TO_R: query = GL_PIXEL_MAP_I_TO_R_SIZE; break; case GL_PIXEL_MAP_I_TO_G: query = GL_PIXEL_MAP_I_TO_G_SIZE; break; case GL_PIXEL_MAP_I_TO_B: query = GL_PIXEL_MAP_I_TO_B_SIZE; break; case GL_PIXEL_MAP_I_TO_A: query = GL_PIXEL_MAP_I_TO_A_SIZE; break; case GL_PIXEL_MAP_R_TO_R: query = GL_PIXEL_MAP_R_TO_R_SIZE; break; case GL_PIXEL_MAP_G_TO_G: query = GL_PIXEL_MAP_G_TO_G_SIZE; break; case GL_PIXEL_MAP_B_TO_B: query = GL_PIXEL_MAP_B_TO_B_SIZE; break; case GL_PIXEL_MAP_A_TO_A: query = GL_PIXEL_MAP_A_TO_A_SIZE; break; default: return -1; } glGetIntegerv(query, &size); return size; } GLint __glGetPixelMapfv_size(GLenum map) { return __glGetPixelMap_size(map); } GLint __glGetPixelMapuiv_size(GLenum map) { return __glGetPixelMap_size(map); } GLint __glGetPixelMapusv_size(GLenum map) { return __glGetPixelMap_size(map); } GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, GLenum type, GLint width, GLint height, GLint depth) { return __glXImageSize(format, type, target, width, height, depth, 0, 0, 0, 0, 4); } xorg-server-1.20.8/glx/glxcmds.c0000644000175000017500000022513413640201473013414 00000000000000/* * 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_DIX_CONFIG_H #include #endif #include #include #include "glxserver.h" #include #include #include #include #include #include "glxutil.h" #include "glxext.h" #include "indirect_dispatch.h" #include "indirect_table.h" #include "indirect_util.h" #include "protocol-versions.h" #include "glxvndabi.h" static char GLXServerVendorName[] = "SGI"; _X_HIDDEN int validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen, int *err) { /* ** Check if screen exists. */ if (screen < 0 || screen >= screenInfo.numScreens) { client->errorValue = screen; *err = BadValue; return FALSE; } *pGlxScreen = glxGetScreen(screenInfo.screens[screen]); return TRUE; } _X_HIDDEN int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id, __GLXconfig ** config, int *err) { __GLXconfig *m; for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) if (m->fbconfigID == id) { *config = m; return TRUE; } client->errorValue = id; *err = __glXError(GLXBadFBConfig); return FALSE; } static int validGlxVisual(ClientPtr client, __GLXscreen * pGlxScreen, XID id, __GLXconfig ** config, int *err) { int i; for (i = 0; i < pGlxScreen->numVisuals; i++) if (pGlxScreen->visuals[i]->visualID == id) { *config = pGlxScreen->visuals[i]; return TRUE; } client->errorValue = id; *err = BadValue; return FALSE; } static int validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config, DrawablePtr pDraw, int *err) { ScreenPtr pScreen = pDraw->pScreen; VisualPtr pVisual = NULL; XID vid; int i; vid = wVisual((WindowPtr) pDraw); for (i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].vid == vid) { pVisual = &pScreen->visuals[i]; break; } } /* FIXME: What exactly should we check here... */ if (pVisual->class != glxConvertToXVisualType(config->visualType) || !(config->drawableType & GLX_WINDOW_BIT)) { client->errorValue = pDraw->id; *err = BadMatch; return FALSE; } return TRUE; } _X_HIDDEN int validGlxContext(ClientPtr client, XID id, int access_mode, __GLXcontext ** context, int *err) { /* no ghost contexts */ if (id & SERVER_BIT) { *err = __glXError(GLXBadContext); return FALSE; } *err = dixLookupResourceByType((void **) context, id, __glXContextRes, client, access_mode); if (*err != Success || (*context)->idExists == GL_FALSE) { client->errorValue = id; if (*err == BadValue || *err == Success) *err = __glXError(GLXBadContext); return FALSE; } return TRUE; } int validGlxDrawable(ClientPtr client, XID id, int type, int access_mode, __GLXdrawable ** drawable, int *err) { int rc; rc = dixLookupResourceByType((void **) drawable, id, __glXDrawableRes, client, access_mode); if (rc != Success && rc != BadValue) { *err = rc; client->errorValue = id; return FALSE; } /* If the ID of the glx drawable we looked up doesn't match the id * we looked for, it's because we looked it up under the X * drawable ID (see DoCreateGLXDrawable). */ if (rc == BadValue || (*drawable)->drawId != id || (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) { client->errorValue = id; switch (type) { case GLX_DRAWABLE_WINDOW: *err = __glXError(GLXBadWindow); return FALSE; case GLX_DRAWABLE_PIXMAP: *err = __glXError(GLXBadPixmap); return FALSE; case GLX_DRAWABLE_PBUFFER: *err = __glXError(GLXBadPbuffer); return FALSE; case GLX_DRAWABLE_ANY: *err = __glXError(GLXBadDrawable); return FALSE; } } return TRUE; } void __glXContextDestroy(__GLXcontext * context) { lastGLContext = NULL; } static void __glXdirectContextDestroy(__GLXcontext * context) { __glXContextDestroy(context); free(context); } static int __glXdirectContextLoseCurrent(__GLXcontext * context) { return GL_TRUE; } _X_HIDDEN __GLXcontext * __glXdirectContextCreate(__GLXscreen * screen, __GLXconfig * modes, __GLXcontext * shareContext) { __GLXcontext *context; context = calloc(1, sizeof(__GLXcontext)); if (context == NULL) return NULL; context->config = modes; context->destroy = __glXdirectContextDestroy; context->loseCurrent = __glXdirectContextLoseCurrent; return context; } /** * Create a GL context with the given properties. This routine is used * to implement \c glXCreateContext, \c glXCreateNewContext, and * \c glXCreateContextWithConfigSGIX. This works because of the hack way * that GLXFBConfigs are implemented. Basically, the FBConfigID is the * same as the VisualID. */ static int DoCreateContext(__GLXclientState * cl, GLXContextID gcId, GLXContextID shareList, __GLXconfig * config, __GLXscreen * pGlxScreen, GLboolean isDirect) { ClientPtr client = cl->client; __GLXcontext *glxc, *shareglxc; int err; /* ** Find the display list space that we want to share. ** ** NOTE: In a multithreaded X server, we would need to keep a reference ** count for each display list so that if one client detroyed a list that ** another client was using, the list would not really be freed until it ** was no longer in use. Since this sample implementation has no support ** for multithreaded servers, we don't do this. */ if (shareList == None) { shareglxc = 0; } else { if (!validGlxContext(client, shareList, DixReadAccess, &shareglxc, &err)) return err; /* Page 26 (page 32 of the PDF) of the GLX 1.4 spec says: * * "The server context state for all sharing contexts must exist * in a single address space or a BadMatch error is generated." * * If the share context is indirect, force the new context to also be * indirect. If the shard context is direct but the new context * cannot be direct, generate BadMatch. */ if (shareglxc->isDirect && !isDirect) { client->errorValue = shareList; return BadMatch; } else if (!shareglxc->isDirect) { /* ** Create an indirect context regardless of what the client asked ** for; this way we can share display list space with shareList. */ isDirect = GL_FALSE; } } /* ** Allocate memory for the new context */ if (!isDirect) { /* Only allow creating indirect GLX contexts if allowed by * server command line. Indirect GLX is of limited use (since * it's only GL 1.4), it's slower than direct contexts, and * it's a massive attack surface for buffer overflow type * errors. */ if (!enableIndirectGLX) { client->errorValue = isDirect; return BadValue; } /* Without any attributes, the only error that the driver should be * able to generate is BadAlloc. As result, just drop the error * returned from the driver on the floor. */ glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc, 0, NULL, &err); } else glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc); if (!glxc) { return BadAlloc; } /* Initialize the GLXcontext structure. */ glxc->pGlxScreen = pGlxScreen; glxc->config = config; glxc->id = gcId; glxc->share_id = shareList; glxc->idExists = GL_TRUE; glxc->isDirect = isDirect; glxc->renderMode = GL_RENDER; /* The GLX_ARB_create_context_robustness spec says: * * "The default value for GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB * is GLX_NO_RESET_NOTIFICATION_ARB." * * Without using glXCreateContextAttribsARB, there is no way to specify a * non-default reset notification strategy. */ glxc->resetNotificationStrategy = GLX_NO_RESET_NOTIFICATION_ARB; #ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB /* The GLX_ARB_context_flush_control spec says: * * "The default value [for GLX_CONTEXT_RELEASE_BEHAVIOR] is * CONTEXT_RELEASE_BEHAVIOR_FLUSH, and may in some cases be changed * using platform-specific context creation extensions." * * Without using glXCreateContextAttribsARB, there is no way to specify a * non-default release behavior. */ glxc->releaseBehavior = GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB; #endif /* Add the new context to the various global tables of GLX contexts. */ if (!__glXAddContext(glxc)) { (*glxc->destroy) (glxc); client->errorValue = gcId; return BadAlloc; } return Success; } int __glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc) { xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err)) return err; return DoCreateContext(cl, req->context, req->shareList, config, pGlxScreen, req->isDirect); } int __glXDisp_CreateNewContext(__GLXclientState * cl, GLbyte * pc) { xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) return err; return DoCreateContext(cl, req->context, req->shareList, config, pGlxScreen, req->isDirect); } int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) return err; return DoCreateContext(cl, req->context, req->shareList, config, pGlxScreen, req->isDirect); } int __glXDisp_DestroyContext(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; __GLXcontext *glxc; int err; if (!validGlxContext(cl->client, req->context, DixDestroyAccess, &glxc, &err)) return err; glxc->idExists = GL_FALSE; if (glxc->currentClient) { XID ghost = FakeClientID(glxc->currentClient->index); if (!AddResource(ghost, __glXContextRes, glxc)) return BadAlloc; ChangeResourceValue(glxc->id, __glXContextRes, NULL); glxc->id = ghost; } FreeResourceByType(req->context, __glXContextRes, FALSE); return Success; } __GLXcontext * __glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag) { return glxServer.getContextTagPrivate(cl->client, tag); } static __GLXconfig * inferConfigForWindow(__GLXscreen *pGlxScreen, WindowPtr pWin) { int i, vid = wVisual(pWin); for (i = 0; i < pGlxScreen->numVisuals; i++) if (pGlxScreen->visuals[i]->visualID == vid) return pGlxScreen->visuals[i]; return NULL; } /** * This is a helper function to handle the legacy (pre GLX 1.3) cases * where passing an X window to glXMakeCurrent is valid. Given a * resource ID, look up the GLX drawable if available, otherwise, make * sure it's an X window and create a GLX drawable one the fly. */ static __GLXdrawable * __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client, int *error) { DrawablePtr pDraw; __GLXdrawable *pGlxDraw; __GLXconfig *config; __GLXscreen *pGlxScreen; int rc; if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, DixWriteAccess, &pGlxDraw, &rc)) { if (glxc != NULL && glxc->config != NULL && glxc->config != pGlxDraw->config) { client->errorValue = drawId; *error = BadMatch; return NULL; } return pGlxDraw; } /* No active context and an unknown drawable, bail. */ if (glxc == NULL) { client->errorValue = drawId; *error = BadMatch; return NULL; } /* The drawId wasn't a GLX drawable. Make sure it's a window and * create a GLXWindow for it. Check that the drawable screen * matches the context screen and that the context fbconfig is * compatible with the window visual. */ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); if (rc != Success || pDraw->type != DRAWABLE_WINDOW) { client->errorValue = drawId; *error = __glXError(GLXBadDrawable); return NULL; } pGlxScreen = glxc->pGlxScreen; if (pDraw->pScreen != pGlxScreen->pScreen) { client->errorValue = pDraw->pScreen->myNum; *error = BadMatch; return NULL; } config = glxc->config; if (!config) config = inferConfigForWindow(pGlxScreen, (WindowPtr)pDraw); if (!config) { /* * If we get here, we've tried to bind a no-config context to a * window without a corresponding fbconfig, presumably because * we don't support GL on it (PseudoColor perhaps). From GLX Section * 3.3.7 "Rendering Contexts": * * "If draw or read are not compatible with ctx a BadMatch error * is generated." */ *error = BadMatch; return NULL; } if (!validGlxFBConfigForWindow(client, config, pDraw, error)) return NULL; pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw, drawId, GLX_DRAWABLE_WINDOW, drawId, config); if (!pGlxDraw) { *error = BadAlloc; return NULL; } /* since we are creating the drawablePrivate, drawId should be new */ if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) { *error = BadAlloc; return NULL; } return pGlxDraw; } /*****************************************************************************/ /* ** Make an OpenGL context and drawable current. */ int xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId, XID contextId, GLXContextTag newContextTag) { __GLXclientState *cl = glxGetClient(client); __GLXcontext *glxc = NULL, *prevglxc = NULL; __GLXdrawable *drawPriv = NULL; __GLXdrawable *readPriv = NULL; int error; /* Drawables but no context makes no sense */ if (!contextId && (drawId || readId)) return BadMatch; /* If either drawable is null, the other must be too */ if ((drawId == None) != (readId == None)) return BadMatch; /* Look up old context. If we have one, it must be in a usable state. */ if (tag != 0) { prevglxc = glxServer.getContextTagPrivate(client, tag); if (prevglxc && prevglxc->renderMode != GL_RENDER) { /* Oops. Not in render mode render. */ client->errorValue = prevglxc->id; return __glXError(GLXBadContextState); } } /* Look up new context. It must not be current for someone else. */ if (contextId != None) { int status; if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error)) return error; if ((glxc != prevglxc) && glxc->currentClient) return BadAccess; if (drawId) { drawPriv = __glXGetDrawable(glxc, drawId, client, &status); if (drawPriv == NULL) return status; } if (readId) { readPriv = __glXGetDrawable(glxc, readId, client, &status); if (readPriv == NULL) return status; } } if (prevglxc) { /* Flush the previous context if needed. */ Bool need_flush = !prevglxc->isDirect; #ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB if (prevglxc->releaseBehavior == GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB) need_flush = GL_FALSE; #endif if (need_flush) { if (!__glXForceCurrent(cl, tag, (int *) &error)) return error; glFlush(); } /* Make the previous context not current. */ if (!(*prevglxc->loseCurrent) (prevglxc)) return __glXError(GLXBadContext); lastGLContext = NULL; if (!prevglxc->isDirect) { prevglxc->drawPriv = NULL; prevglxc->readPriv = NULL; } } if (glxc && !glxc->isDirect) { glxc->drawPriv = drawPriv; glxc->readPriv = readPriv; /* make the context current */ lastGLContext = glxc; if (!(*glxc->makeCurrent) (glxc)) { lastGLContext = NULL; glxc->drawPriv = NULL; glxc->readPriv = NULL; return __glXError(GLXBadContext); } glxc->currentClient = client; glxServer.setContextTagPrivate(client, newContextTag, glxc); } if (prevglxc) { prevglxc->currentClient = NULL; if (!prevglxc->idExists) { FreeResourceByType(prevglxc->id, __glXContextRes, FALSE); } } return Success; } int __glXDisp_MakeCurrent(__GLXclientState * cl, GLbyte * pc) { return BadImplementation; } int __glXDisp_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc) { return BadImplementation; } int __glXDisp_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) { return BadImplementation; } int __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; xGLXIsDirectReply reply; __GLXcontext *glxc; int err; if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err)) return err; reply = (xGLXIsDirectReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .isDirect = glxc->isDirect }; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); } WriteToClient(client, sz_xGLXIsDirectReply, &reply); return Success; } int __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; xGLXQueryVersionReply reply; GLuint major, minor; REQUEST_SIZE_MATCH(xGLXQueryVersionReq); major = req->majorVersion; minor = req->minorVersion; (void) major; (void) minor; /* ** 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 = (xGLXQueryVersionReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_GLX_MAJOR_VERSION, .minorVersion = SERVER_GLX_MINOR_VERSION }; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.majorVersion); __GLX_SWAP_INT(&reply.minorVersion); } WriteToClient(client, sz_xGLXQueryVersionReply, &reply); return Success; } int __glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc) { xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; GLXContextTag tag; __GLXcontext *glxc = NULL; int error; tag = req->contextTag; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) return __glXError(GLXBadContextTag); if (!__glXForceCurrent(cl, req->contextTag, &error)) return error; glFinish(); } if (glxc && glxc->drawPriv->waitGL) (*glxc->drawPriv->waitGL) (glxc->drawPriv); return Success; } int __glXDisp_WaitX(__GLXclientState * cl, GLbyte * pc) { xGLXWaitXReq *req = (xGLXWaitXReq *) pc; GLXContextTag tag; __GLXcontext *glxc = NULL; int error; tag = req->contextTag; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) return __glXError(GLXBadContextTag); if (!__glXForceCurrent(cl, req->contextTag, &error)) return error; } if (glxc && glxc->drawPriv->waitX) (*glxc->drawPriv->waitX) (glxc->drawPriv); return Success; } int __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; GLXContextID source; GLXContextID dest; GLXContextTag tag; unsigned long mask; __GLXcontext *src, *dst; int error; source = req->source; dest = req->dest; tag = req->contextTag; mask = req->mask; if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error)) return error; if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error)) return error; /* ** They must be in the same address space, and same screen. ** NOTE: no support for direct rendering contexts here. */ if (src->isDirect || dst->isDirect || (src->pGlxScreen != dst->pGlxScreen)) { client->errorValue = source; return BadMatch; } /* ** The destination context must not be current for any client. */ if (dst->currentClient) { client->errorValue = dest; return BadAccess; } if (tag) { __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag); if (!tagcx) { return __glXError(GLXBadContextTag); } if (tagcx != src) { /* ** This would be caused by a faulty implementation of the client ** library. */ return BadMatch; } /* ** In this case, glXCopyContext is in both GL and X streams, in terms ** of sequentiality. */ if (__glXForceCurrent(cl, tag, &error)) { /* ** Do whatever is needed to make sure that all preceding requests ** in both streams are completed before the copy is executed. */ glFinish(); } else { return error; } } /* ** Issue copy. The only reason for failure is a bad mask. */ if (!(*dst->copy) (dst, src, mask)) { client->errorValue = mask; return BadValue; } return Success; } enum { GLX_VIS_CONFIG_UNPAIRED = 18, GLX_VIS_CONFIG_PAIRED = 22 }; enum { GLX_VIS_CONFIG_TOTAL = GLX_VIS_CONFIG_UNPAIRED + GLX_VIS_CONFIG_PAIRED }; int __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc) { xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; ClientPtr client = cl->client; xGLXGetVisualConfigsReply reply; __GLXscreen *pGlxScreen; __GLXconfig *modes; CARD32 buf[GLX_VIS_CONFIG_TOTAL]; int p, i, err; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; reply = (xGLXGetVisualConfigsReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = (pGlxScreen->numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2, .numVisuals = pGlxScreen->numVisuals, .numProps = GLX_VIS_CONFIG_TOTAL }; if (client->swapped) { __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.numVisuals); __GLX_SWAP_INT(&reply.numProps); } WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); for (i = 0; i < pGlxScreen->numVisuals; i++) { modes = pGlxScreen->visuals[i]; p = 0; buf[p++] = modes->visualID; buf[p++] = glxConvertToXVisualType(modes->visualType); buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE; buf[p++] = modes->redBits; buf[p++] = modes->greenBits; buf[p++] = modes->blueBits; buf[p++] = modes->alphaBits; buf[p++] = modes->accumRedBits; buf[p++] = modes->accumGreenBits; buf[p++] = modes->accumBlueBits; buf[p++] = modes->accumAlphaBits; buf[p++] = modes->doubleBufferMode; buf[p++] = modes->stereoMode; buf[p++] = modes->rgbBits; buf[p++] = modes->depthBits; buf[p++] = modes->stencilBits; buf[p++] = modes->numAuxBuffers; buf[p++] = modes->level; assert(p == GLX_VIS_CONFIG_UNPAIRED); /* ** Add token/value pairs for extensions. */ buf[p++] = GLX_VISUAL_CAVEAT_EXT; buf[p++] = modes->visualRating; buf[p++] = GLX_TRANSPARENT_TYPE; buf[p++] = modes->transparentPixel; buf[p++] = GLX_TRANSPARENT_RED_VALUE; buf[p++] = modes->transparentRed; buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; buf[p++] = modes->transparentGreen; buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; buf[p++] = modes->transparentBlue; buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; buf[p++] = modes->transparentAlpha; buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; buf[p++] = modes->transparentIndex; buf[p++] = GLX_SAMPLES_SGIS; buf[p++] = modes->samples; buf[p++] = GLX_SAMPLE_BUFFERS_SGIS; buf[p++] = modes->sampleBuffers; buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX; buf[p++] = modes->visualSelectGroup; /* Add attribute only if its value is not default. */ if (modes->sRGBCapable != GL_FALSE) { buf[p++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT; buf[p++] = modes->sRGBCapable; } /* Pad with zeroes, so that attributes count is constant. */ while (p < GLX_VIS_CONFIG_TOTAL) { buf[p++] = 0; buf[p++] = 0; } assert(p == GLX_VIS_CONFIG_TOTAL); if (client->swapped) { __GLX_SWAP_INT_ARRAY(buf, p); } WriteToClient(client, __GLX_SIZE_CARD32 * p, buf); } return Success; } #define __GLX_TOTAL_FBCONFIG_ATTRIBS (44) #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2) /** * Send the set of GLXFBConfigs to the client. There is not currently * and interface into the driver on the server-side to get GLXFBConfigs, * so we "invent" some based on the \c __GLXvisualConfig structures that * the driver does supply. * * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX * is the same, so this routine pulls double duty. */ static int DoGetFBConfigs(__GLXclientState * cl, unsigned screen) { ClientPtr client = cl->client; xGLXGetFBConfigsReply reply; __GLXscreen *pGlxScreen; CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH]; int p, err; __GLXconfig *modes; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err)) return err; reply = (xGLXGetFBConfigsReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = __GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs, .numFBConfigs = pGlxScreen->numFBConfigs, .numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS }; if (client->swapped) { __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.numFBConfigs); __GLX_SWAP_INT(&reply.numAttribs); } WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply); for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) { p = 0; #define WRITE_PAIR(tag,value) \ do { buf[p++] = tag ; buf[p++] = value ; } while( 0 ) WRITE_PAIR(GLX_VISUAL_ID, modes->visualID); WRITE_PAIR(GLX_FBCONFIG_ID, modes->fbconfigID); WRITE_PAIR(GLX_X_RENDERABLE, (modes->drawableType & (GLX_WINDOW_BIT | GLX_PIXMAP_BIT) ? GL_TRUE : GL_FALSE)); WRITE_PAIR(GLX_RGBA, (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE); WRITE_PAIR(GLX_RENDER_TYPE, modes->renderType); WRITE_PAIR(GLX_DOUBLEBUFFER, modes->doubleBufferMode); WRITE_PAIR(GLX_STEREO, modes->stereoMode); WRITE_PAIR(GLX_BUFFER_SIZE, modes->rgbBits); WRITE_PAIR(GLX_LEVEL, modes->level); WRITE_PAIR(GLX_AUX_BUFFERS, modes->numAuxBuffers); WRITE_PAIR(GLX_RED_SIZE, modes->redBits); WRITE_PAIR(GLX_GREEN_SIZE, modes->greenBits); WRITE_PAIR(GLX_BLUE_SIZE, modes->blueBits); WRITE_PAIR(GLX_ALPHA_SIZE, modes->alphaBits); WRITE_PAIR(GLX_ACCUM_RED_SIZE, modes->accumRedBits); WRITE_PAIR(GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits); WRITE_PAIR(GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits); WRITE_PAIR(GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits); WRITE_PAIR(GLX_DEPTH_SIZE, modes->depthBits); WRITE_PAIR(GLX_STENCIL_SIZE, modes->stencilBits); WRITE_PAIR(GLX_X_VISUAL_TYPE, modes->visualType); WRITE_PAIR(GLX_CONFIG_CAVEAT, modes->visualRating); WRITE_PAIR(GLX_TRANSPARENT_TYPE, modes->transparentPixel); WRITE_PAIR(GLX_TRANSPARENT_RED_VALUE, modes->transparentRed); WRITE_PAIR(GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen); WRITE_PAIR(GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue); WRITE_PAIR(GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha); WRITE_PAIR(GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex); WRITE_PAIR(GLX_SWAP_METHOD_OML, modes->swapMethod); WRITE_PAIR(GLX_SAMPLES_SGIS, modes->samples); WRITE_PAIR(GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers); WRITE_PAIR(GLX_VISUAL_SELECT_GROUP_SGIX, modes->visualSelectGroup); WRITE_PAIR(GLX_DRAWABLE_TYPE, modes->drawableType); WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb); WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba); WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture); WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets); /* can't report honestly until mesa is fixed */ WRITE_PAIR(GLX_Y_INVERTED_EXT, GLX_DONT_CARE); if (modes->drawableType & GLX_PBUFFER_BIT) { WRITE_PAIR(GLX_MAX_PBUFFER_WIDTH, modes->maxPbufferWidth); WRITE_PAIR(GLX_MAX_PBUFFER_HEIGHT, modes->maxPbufferHeight); WRITE_PAIR(GLX_MAX_PBUFFER_PIXELS, modes->maxPbufferPixels); WRITE_PAIR(GLX_OPTIMAL_PBUFFER_WIDTH_SGIX, modes->optimalPbufferWidth); WRITE_PAIR(GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX, modes->optimalPbufferHeight); } /* Add attribute only if its value is not default. */ if (modes->sRGBCapable != GL_FALSE) { WRITE_PAIR(GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, modes->sRGBCapable); } /* Pad the remaining place with zeroes, so that attributes count is constant. */ while (p < __GLX_FBCONFIG_ATTRIBS_LENGTH) { WRITE_PAIR(0, 0); } assert(p == __GLX_FBCONFIG_ATTRIBS_LENGTH); if (client->swapped) { __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH, (char *) buf); } return Success; } int __glXDisp_GetFBConfigs(__GLXclientState * cl, GLbyte * pc) { xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; return DoGetFBConfigs(cl, req->screen); } int __glXDisp_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; /* work around mesa bug, don't use REQUEST_SIZE_MATCH */ REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq); return DoGetFBConfigs(cl, req->screen); } GLboolean __glXDrawableInit(__GLXdrawable * drawable, __GLXscreen * screen, DrawablePtr pDraw, int type, XID drawId, __GLXconfig * config) { drawable->pDraw = pDraw; drawable->type = type; drawable->drawId = drawId; drawable->config = config; drawable->eventMask = 0; return GL_TRUE; } void __glXDrawableRelease(__GLXdrawable * drawable) { } static int DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen, __GLXconfig * config, DrawablePtr pDraw, XID drawableId, XID glxDrawableId, int type) { __GLXdrawable *pGlxDraw; if (pGlxScreen->pScreen != pDraw->pScreen) return BadMatch; pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw, drawableId, type, glxDrawableId, config); if (pGlxDraw == NULL) return BadAlloc; if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) return BadAlloc; /* * Windows aren't refcounted, so track both the X and the GLX window * so we get called regardless of destruction order. */ if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW && !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) return BadAlloc; return Success; } static int DoCreateGLXPixmap(ClientPtr client, __GLXscreen * pGlxScreen, __GLXconfig * config, XID drawableId, XID glxDrawableId) { DrawablePtr pDraw; int err; err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess); if (err != Success) { client->errorValue = drawableId; return err; } if (pDraw->type != DRAWABLE_PIXMAP) { client->errorValue = drawableId; return BadPixmap; } err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId, glxDrawableId, GLX_DRAWABLE_PIXMAP); if (err == Success) ((PixmapPtr) pDraw)->refcnt++; return err; } static void determineTextureTarget(ClientPtr client, XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs) { GLenum target = 0; GLenum format = 0; int i, err; __GLXdrawable *pGlxDraw; if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP, DixWriteAccess, &pGlxDraw, &err)) /* We just added it in CreatePixmap, so we should never get here. */ return; for (i = 0; i < numAttribs; i++) { if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) { switch (attribs[2 * i + 1]) { case GLX_TEXTURE_2D_EXT: target = GL_TEXTURE_2D; break; case GLX_TEXTURE_RECTANGLE_EXT: target = GL_TEXTURE_RECTANGLE_ARB; break; } } if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT) format = attribs[2 * i + 1]; } if (!target) { int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height; if (h & (h - 1) || w & (w - 1)) target = GL_TEXTURE_RECTANGLE_ARB; else target = GL_TEXTURE_2D; } pGlxDraw->target = target; pGlxDraw->format = format; } int __glXDisp_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) { xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err)) return err; return DoCreateGLXPixmap(cl->client, pGlxScreen, config, req->pixmap, req->glxpixmap); } int __glXDisp_CreatePixmap(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) return err; err = DoCreateGLXPixmap(cl->client, pGlxScreen, config, req->pixmap, req->glxpixmap); if (err != Success) return err; determineTextureTarget(cl->client, req->glxpixmap, (CARD32 *) (req + 1), req->numAttribs); return Success; } int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) return err; return DoCreateGLXPixmap(cl->client, pGlxScreen, config, req->pixmap, req->glxpixmap); } static int DoDestroyDrawable(__GLXclientState * cl, XID glxdrawable, int type) { __GLXdrawable *pGlxDraw; int err; if (!validGlxDrawable(cl->client, glxdrawable, type, DixDestroyAccess, &pGlxDraw, &err)) return err; FreeResource(glxdrawable, FALSE); return Success; } int __glXDisp_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); } int __glXDisp_DestroyPixmap(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc; /* should be REQUEST_SIZE_MATCH, but mesa's glXDestroyPixmap used to set * length to 3 instead of 2 */ REQUEST_AT_LEAST_SIZE(xGLXDestroyPixmapReq); return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); } static int DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, int width, int height, XID glxDrawableId) { __GLXconfig *config; __GLXscreen *pGlxScreen; PixmapPtr pPixmap; int err; if (!validGlxScreen(client, screenNum, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err)) return err; pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen, width, height, config->rgbBits, 0); if (!pPixmap) return BadAlloc; /* Assign the pixmap the same id as the pbuffer and add it as a * resource so it and the DRI2 drawable will be reclaimed when the * pbuffer is destroyed. */ pPixmap->drawable.id = glxDrawableId; if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap)) return BadAlloc; return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, glxDrawableId, glxDrawableId, GLX_DRAWABLE_PBUFFER); } int __glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; CARD32 *attrs; int width, height, i; REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); attrs = (CARD32 *) (req + 1); width = 0; height = 0; for (i = 0; i < req->numAttribs; i++) { switch (attrs[i * 2]) { case GLX_PBUFFER_WIDTH: width = attrs[i * 2 + 1]; break; case GLX_PBUFFER_HEIGHT: height = attrs[i * 2 + 1]; break; case GLX_LARGEST_PBUFFER: /* FIXME: huh... */ break; } } return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, width, height, req->pbuffer); } int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); /* * We should really handle attributes correctly, but this extension * is so rare I have difficulty caring. */ return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, req->width, req->height, req->pbuffer); } int __glXDisp_DestroyPbuffer(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq); return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER); } int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER); } static int DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable, int numAttribs, CARD32 *attribs) { __GLXdrawable *pGlxDraw; int i, err; if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY, DixSetAttrAccess, &pGlxDraw, &err)) return err; for (i = 0; i < numAttribs; i++) { switch (attribs[i * 2]) { case GLX_EVENT_MASK: /* All we do is to record the event mask so we can send it * back when queried. We never actually clobber the * pbuffers, so we never need to send out the event. */ pGlxDraw->eventMask = attribs[i * 2 + 1]; break; } } return Success; } int __glXDisp_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *) pc; REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } #if 0 /* mesa sends an additional 8 bytes */ REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3); #else if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len) return BadLength; #endif return DoChangeDrawableAttributes(cl->client, req->drawable, req->numAttribs, (CARD32 *) (req + 1)); } int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXChangeDrawableAttributesSGIXReq *req = (xGLXChangeDrawableAttributesSGIXReq *) pc; REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3); return DoChangeDrawableAttributes(cl->client, req->drawable, req->numAttribs, (CARD32 *) (req + 1)); } int __glXDisp_CreateWindow(__GLXclientState * cl, GLbyte * pc) { xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; ClientPtr client = cl->client; DrawablePtr pDraw; int err; REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); if (req->numAttribs > (UINT32_MAX >> 3)) { client->errorValue = req->numAttribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err)) return err; err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess); if (err != Success || pDraw->type != DRAWABLE_WINDOW) { client->errorValue = req->window; return BadWindow; } if (!validGlxFBConfigForWindow(client, config, pDraw, &err)) return err; return DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, req->window, req->glxwindow, GLX_DRAWABLE_WINDOW); } int __glXDisp_DestroyWindow(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; /* mesa's glXDestroyWindow used to set length to 3 instead of 2 */ REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq); return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW); } /*****************************************************************************/ /* ** 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 __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; GLXContextTag tag; XID drawId; __GLXcontext *glxc = NULL; __GLXdrawable *pGlxDraw; int error; tag = req->contextTag; drawId = req->drawable; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) { return __glXError(GLXBadContextTag); } /* ** The calling thread is swapping its current drawable. In this case, ** glxSwapBuffers is in both GL and X streams, in terms of ** sequentiality. */ if (__glXForceCurrent(cl, tag, &error)) { /* ** Do whatever is needed to make sure that all preceding requests ** in both streams are completed before the swap is executed. */ glFinish(); } else { return error; } } pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error); if (pGlxDraw == NULL) return error; if (pGlxDraw->type == DRAWABLE_WINDOW && (*pGlxDraw->swapBuffers) (cl->client, pGlxDraw) == GL_FALSE) return __glXError(GLXBadDrawable); return Success; } static int DoQueryContext(__GLXclientState * cl, GLXContextID gcId) { ClientPtr client = cl->client; __GLXcontext *ctx; xGLXQueryContextInfoEXTReply reply; int nProps = 5; int sendBuf[nProps * 2]; int nReplyBytes; int err; if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err)) return err; reply = (xGLXQueryContextInfoEXTReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = nProps << 1, .n = nProps }; nReplyBytes = reply.length << 2; sendBuf[0] = GLX_SHARE_CONTEXT_EXT; sendBuf[1] = (int) (ctx->share_id); sendBuf[2] = GLX_VISUAL_ID_EXT; sendBuf[3] = (int) (ctx->config ? ctx->config->visualID : 0); sendBuf[4] = GLX_SCREEN_EXT; sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum); sendBuf[6] = GLX_FBCONFIG_ID; sendBuf[7] = (int) (ctx->config ? ctx->config->fbconfigID : 0); sendBuf[8] = GLX_RENDER_TYPE; sendBuf[9] = (int) (ctx->config ? ctx->config->renderType : GLX_DONT_CARE); if (client->swapped) { int length = reply.length; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.n); WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); __GLX_SWAP_INT_ARRAY((int *) sendBuf, length); WriteToClient(client, length << 2, sendBuf); } else { WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); WriteToClient(client, nReplyBytes, sendBuf); } return Success; } int __glXDisp_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); return DoQueryContext(cl, req->context); } int __glXDisp_QueryContext(__GLXclientState * cl, GLbyte * pc) { xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; return DoQueryContext(cl, req->context); } int __glXDisp_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; ClientPtr client = cl->client; __GLXcontext *context; __GLXdrawable *pGlxDraw; GLXDrawable drawId; int buffer; int error; CARD32 num_attribs; if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len) return BadLength; pc += __GLX_VENDPRIV_HDR_SIZE; drawId = *((CARD32 *) (pc)); buffer = *((INT32 *) (pc + 4)); num_attribs = *((CARD32 *) (pc + 8)); if (num_attribs > (UINT32_MAX >> 3)) { client->errorValue = num_attribs; return BadValue; } REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3)); if (buffer != GLX_FRONT_LEFT_EXT) return __glXError(GLXBadPixmap); context = __glXForceCurrent(cl, req->contextTag, &error); if (!context) return error; if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP, DixReadAccess, &pGlxDraw, &error)) return error; if (!context->bindTexImage) return __glXError(GLXUnsupportedPrivateRequest); return context->bindTexImage(context, buffer, pGlxDraw); } int __glXDisp_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; ClientPtr client = cl->client; __GLXdrawable *pGlxDraw; __GLXcontext *context; GLXDrawable drawId; int buffer; int error; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); pc += __GLX_VENDPRIV_HDR_SIZE; drawId = *((CARD32 *) (pc)); buffer = *((INT32 *) (pc + 4)); context = __glXForceCurrent(cl, req->contextTag, &error); if (!context) return error; if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP, DixReadAccess, &pGlxDraw, &error)) return error; if (!context->releaseTexImage) return __glXError(GLXUnsupportedPrivateRequest); return context->releaseTexImage(context, buffer, pGlxDraw); } int __glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXContextTag tag = req->contextTag; __GLXcontext *glxc = NULL; __GLXdrawable *pGlxDraw; ClientPtr client = cl->client; GLXDrawable drawId; int error; int x, y, width, height; (void) client; (void) req; REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); pc += __GLX_VENDPRIV_HDR_SIZE; drawId = *((CARD32 *) (pc)); x = *((INT32 *) (pc + 4)); y = *((INT32 *) (pc + 8)); width = *((INT32 *) (pc + 12)); height = *((INT32 *) (pc + 16)); if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) { return __glXError(GLXBadContextTag); } /* ** The calling thread is swapping its current drawable. In this case, ** glxSwapBuffers is in both GL and X streams, in terms of ** sequentiality. */ if (__glXForceCurrent(cl, tag, &error)) { /* ** Do whatever is needed to make sure that all preceding requests ** in both streams are completed before the swap is executed. */ glFinish(); } else { return error; } } pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error); if (!pGlxDraw) return error; if (pGlxDraw == NULL || pGlxDraw->type != GLX_DRAWABLE_WINDOW || pGlxDraw->copySubBuffer == NULL) return __glXError(GLXBadDrawable); (*pGlxDraw->copySubBuffer) (pGlxDraw, x, y, width, height); return Success; } /* hack for old glxext.h */ #ifndef GLX_STEREO_TREE_EXT #define GLX_STEREO_TREE_EXT 0x20F5 #endif /* ** Get drawable attributes */ static int DoGetDrawableAttributes(__GLXclientState * cl, XID drawId) { ClientPtr client = cl->client; xGLXGetDrawableAttributesReply reply; __GLXdrawable *pGlxDraw = NULL; DrawablePtr pDraw; CARD32 attributes[18]; int num = 0, error; if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, DixGetAttrAccess, &pGlxDraw, &error)) { /* hack for GLX 1.2 naked windows */ int err = dixLookupWindow((WindowPtr *)&pDraw, drawId, client, DixGetAttrAccess); if (err != Success) return error; } if (pGlxDraw) pDraw = pGlxDraw->pDraw; #define ATTRIB(a, v) do { \ attributes[2*num] = (a); \ attributes[2*num+1] = (v); \ num++; \ } while (0) ATTRIB(GLX_Y_INVERTED_EXT, GL_FALSE); ATTRIB(GLX_WIDTH, pDraw->width); ATTRIB(GLX_HEIGHT, pDraw->height); ATTRIB(GLX_SCREEN, pDraw->pScreen->myNum); if (pGlxDraw) { ATTRIB(GLX_TEXTURE_TARGET_EXT, pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT); ATTRIB(GLX_EVENT_MASK, pGlxDraw->eventMask); ATTRIB(GLX_FBCONFIG_ID, pGlxDraw->config->fbconfigID); if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) { ATTRIB(GLX_PRESERVED_CONTENTS, GL_TRUE); } if (pGlxDraw->type == GLX_DRAWABLE_WINDOW) { ATTRIB(GLX_STEREO_TREE_EXT, 0); } } #undef ATTRIB reply = (xGLXGetDrawableAttributesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = num << 1, .numAttribs = num }; if (client->swapped) { int length = reply.length; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.numAttribs); WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply); __GLX_SWAP_INT_ARRAY((int *) attributes, length); WriteToClient(client, length << 2, attributes); } else { WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply); WriteToClient(client, reply.length * sizeof(CARD32), attributes); } return Success; } int __glXDisp_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; /* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */ REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq); return DoGetDrawableAttributes(cl, req->drawable); } int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXGetDrawableAttributesSGIXReq *req = (xGLXGetDrawableAttributesSGIXReq *) pc; REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); return DoGetDrawableAttributes(cl, req->drawable); } /************************************************************************/ /* ** Render and Renderlarge are not in the GLX API. They are used by the GLX ** client library to send batches of GL rendering commands. */ /* ** Reset state used to keep track of large (multi-request) commands. */ static void ResetLargeCommandStatus(__GLXcontext *cx) { cx->largeCmdBytesSoFar = 0; cx->largeCmdBytesTotal = 0; cx->largeCmdRequestsSoFar = 0; cx->largeCmdRequestsTotal = 0; } /* ** Execute all the drawing commands in a request. */ int __glXDisp_Render(__GLXclientState * cl, GLbyte * pc) { xGLXRenderReq *req; ClientPtr client = cl->client; int left, cmdlen, error; int commandsDone; CARD16 opcode; __GLXrenderHeader *hdr; __GLXcontext *glxc; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXRenderReq); req = (xGLXRenderReq *) pc; if (client->swapped) { __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); } glxc = __glXForceCurrent(cl, req->contextTag, &error); if (!glxc) { return error; } commandsDone = 0; pc += sz_xGLXRenderReq; left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData entry; int extra = 0; __GLXdispatchRenderProcPtr proc; int err; if (left < sizeof(__GLXrenderHeader)) return BadLength; /* ** Verify that the header length and the overall length agree. ** Also, each command must be word aligned. */ hdr = (__GLXrenderHeader *) pc; if (client->swapped) { __GLX_SWAP_SHORT(&hdr->length); __GLX_SWAP_SHORT(&hdr->opcode); } cmdlen = hdr->length; opcode = hdr->opcode; if (left < cmdlen) return BadLength; /* ** Check for core opcodes and grab entry data. */ err = __glXGetProtocolSizeData(&Render_dispatch_info, opcode, &entry); proc = (__GLXdispatchRenderProcPtr) __glXGetProtocolDecodeFunction(&Render_dispatch_info, opcode, client->swapped); if ((err < 0) || (proc == NULL)) { client->errorValue = commandsDone; return __glXError(GLXBadRenderRequest); } if (cmdlen < entry.bytes) { return BadLength; } if (entry.varsize) { /* variable size command */ extra = (*entry.varsize) (pc + __GLX_RENDER_HDR_SIZE, client->swapped, left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { return BadLength; } } if (cmdlen != safe_pad(safe_add(entry.bytes, extra))) { return BadLength; } /* ** Skip over the header and execute the command. We allow the ** caller to trash the command memory. This is useful especially ** for things that require double alignment - they can just shift ** the data towards lower memory (trashing the header) by 4 bytes ** and achieve the required alignment. */ (*proc) (pc + __GLX_RENDER_HDR_SIZE); pc += cmdlen; left -= cmdlen; commandsDone++; } return Success; } /* ** Execute a large rendering request (one that spans multiple X requests). */ int __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc) { xGLXRenderLargeReq *req; ClientPtr client = cl->client; size_t dataBytes; __GLXrenderLargeHeader *hdr; __GLXcontext *glxc; int error; CARD16 opcode; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); req = (xGLXRenderLargeReq *) pc; if (client->swapped) { __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->dataBytes); __GLX_SWAP_SHORT(&req->requestNumber); __GLX_SWAP_SHORT(&req->requestTotal); } glxc = __glXForceCurrent(cl, req->contextTag, &error); if (!glxc) { return error; } if (safe_pad(req->dataBytes) < 0) return BadLength; dataBytes = req->dataBytes; /* ** Check the request length. */ if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ ResetLargeCommandStatus(glxc); return BadLength; } pc += sz_xGLXRenderLargeReq; if (glxc->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData entry; int extra = 0; int left = (req->length << 2) - sz_xGLXRenderLargeReq; int cmdlen; int err; /* ** This is the first request of a multi request command. ** Make enough space in the buffer, then copy the entire request. */ if (req->requestNumber != 1) { client->errorValue = req->requestNumber; return __glXError(GLXBadLargeRequest); } if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) return BadLength; hdr = (__GLXrenderLargeHeader *) pc; if (client->swapped) { __GLX_SWAP_INT(&hdr->length); __GLX_SWAP_INT(&hdr->opcode); } opcode = hdr->opcode; if ((cmdlen = safe_pad(hdr->length)) < 0) return BadLength; /* ** Check for core opcodes and grab entry data. */ err = __glXGetProtocolSizeData(&Render_dispatch_info, opcode, &entry); if (err < 0) { client->errorValue = opcode; return __glXError(GLXBadLargeRequest); } if (entry.varsize) { /* ** If it's a variable-size command (a command whose length must ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ extra = (*entry.varsize) (pc + __GLX_RENDER_LARGE_HDR_SIZE, client->swapped, left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { return BadLength; } } /* the +4 is safe because we know entry.bytes is small */ if (cmdlen != safe_pad(safe_add(entry.bytes + 4, extra))) { return BadLength; } /* ** Make enough space in the buffer, then copy the entire request. */ if (glxc->largeCmdBufSize < cmdlen) { GLbyte *newbuf = glxc->largeCmdBuf; if (!(newbuf = realloc(newbuf, cmdlen))) return BadAlloc; glxc->largeCmdBuf = newbuf; glxc->largeCmdBufSize = cmdlen; } memcpy(glxc->largeCmdBuf, pc, dataBytes); glxc->largeCmdBytesSoFar = dataBytes; glxc->largeCmdBytesTotal = cmdlen; glxc->largeCmdRequestsSoFar = 1; glxc->largeCmdRequestsTotal = req->requestTotal; return Success; } else { /* ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. */ if (req->requestNumber != glxc->largeCmdRequestsSoFar + 1) { client->errorValue = req->requestNumber; ResetLargeCommandStatus(glxc); return __glXError(GLXBadLargeRequest); } if (req->requestTotal != glxc->largeCmdRequestsTotal) { client->errorValue = req->requestTotal; ResetLargeCommandStatus(glxc); return __glXError(GLXBadLargeRequest); } /* ** Check that we didn't get too much data. */ if ((bytesSoFar = safe_add(glxc->largeCmdBytesSoFar, dataBytes)) < 0) { client->errorValue = dataBytes; ResetLargeCommandStatus(glxc); return __glXError(GLXBadLargeRequest); } if (bytesSoFar > glxc->largeCmdBytesTotal) { client->errorValue = dataBytes; ResetLargeCommandStatus(glxc); return __glXError(GLXBadLargeRequest); } memcpy(glxc->largeCmdBuf + glxc->largeCmdBytesSoFar, pc, dataBytes); glxc->largeCmdBytesSoFar += dataBytes; glxc->largeCmdRequestsSoFar++; if (req->requestNumber == glxc->largeCmdRequestsTotal) { __GLXdispatchRenderProcPtr proc; /* ** This is the last request; it must have enough bytes to complete ** the command. */ /* NOTE: the pad macro below is needed because the client library ** pads the total byte count, but not the per-request byte counts. ** The Protocol Encoding says the total byte count should not be ** padded, so a proposal will be made to the ARB to relax the ** padding constraint on the total byte count, thus preserving ** backward compatibility. Meanwhile, the padding done below ** fixes a bug that did not allow large commands of odd sizes to ** be accepted by the server. */ if (safe_pad(glxc->largeCmdBytesSoFar) != glxc->largeCmdBytesTotal) { client->errorValue = dataBytes; ResetLargeCommandStatus(glxc); return __glXError(GLXBadLargeRequest); } hdr = (__GLXrenderLargeHeader *) glxc->largeCmdBuf; /* ** The opcode and length field in the header had already been ** swapped when the first request was received. ** ** Use the opcode to index into the procedure table. */ opcode = hdr->opcode; proc = (__GLXdispatchRenderProcPtr) __glXGetProtocolDecodeFunction(&Render_dispatch_info, opcode, client->swapped); if (proc == NULL) { client->errorValue = opcode; return __glXError(GLXBadLargeRequest); } /* ** Skip over the header and execute the command. */ (*proc) (glxc->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE); /* ** Reset for the next RenderLarge series. */ ResetLargeCommandStatus(glxc); } else { /* ** This is neither the first nor the last request. */ } return Success; } } /************************************************************************/ /* ** No support is provided for the vendor-private requests other than ** allocating the entry points in the dispatch table. */ int __glXDisp_VendorPrivate(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLint vendorcode = req->vendorCode; __GLXdispatchVendorPrivProcPtr proc; REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, vendorcode, 0); if (proc != NULL) { return (*proc) (cl, (GLbyte *) req); } cl->client->errorValue = req->vendorCode; return __glXError(GLXUnsupportedPrivateRequest); } int __glXDisp_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLint vendorcode = req->vendorCode; __GLXdispatchVendorPrivProcPtr proc; REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, vendorcode, 0); if (proc != NULL) { return (*proc) (cl, (GLbyte *) req); } cl->client->errorValue = vendorcode; return __glXError(GLXUnsupportedPrivateRequest); } int __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; xGLXQueryExtensionsStringReply reply; __GLXscreen *pGlxScreen; size_t n, length; char *buf; int err; if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; n = strlen(pGlxScreen->GLXextensions) + 1; length = __GLX_PAD(n) >> 2; reply = (xGLXQueryExtensionsStringReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = length, .n = n }; /* Allocate buffer to make sure it's a multiple of 4 bytes big. */ buf = calloc(length, 4); if (buf == NULL) return BadAlloc; memcpy(buf, pGlxScreen->GLXextensions, n); if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.n); WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply); __GLX_SWAP_INT_ARRAY((int *) buf, length); WriteToClient(client, length << 2, buf); } else { WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply); WriteToClient(client, (int) (length << 2), buf); } free(buf); return Success; } #ifndef GLX_VENDOR_NAMES_EXT #define GLX_VENDOR_NAMES_EXT 0x20F6 #endif int __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; xGLXQueryServerStringReply reply; size_t n, length; const char *ptr; char *buf; __GLXscreen *pGlxScreen; int err; if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; switch (req->name) { case GLX_VENDOR: ptr = GLXServerVendorName; break; case GLX_VERSION: ptr = "1.4"; break; case GLX_EXTENSIONS: ptr = pGlxScreen->GLXextensions; break; case GLX_VENDOR_NAMES_EXT: if (pGlxScreen->glvnd) { ptr = pGlxScreen->glvnd; break; } /* else fall through */ default: return BadValue; } n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply = (xGLXQueryServerStringReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = length, .n = n }; buf = calloc(length, 4); if (buf == NULL) { return BadAlloc; } memcpy(buf, ptr, n); if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.n); WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); /** no swap is needed for an array of chars **/ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ WriteToClient(client, length << 2, buf); } else { WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); WriteToClient(client, (int) (length << 2), buf); } free(buf); return Success; } int __glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc) { ClientPtr client = cl->client; xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; const char *buf; REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); buf = (const char *) (req + 1); if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq))) return BadLength; free(cl->GLClientextensions); cl->GLClientextensions = strdup(buf); return Success; } #include void __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust, CARD64 msc, CARD32 sbc) { ClientPtr client = clients[CLIENT_ID(drawable->drawId)]; xGLXBufferSwapComplete2 wire = { .type = __glXEventBase + GLX_BufferSwapComplete }; if (!client) return; if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)) return; wire.event_type = type; wire.drawable = drawable->drawId; wire.ust_hi = ust >> 32; wire.ust_lo = ust & 0xffffffff; wire.msc_hi = msc >> 32; wire.msc_lo = msc & 0xffffffff; wire.sbc = sbc; WriteEventsToClient(client, 1, (xEvent *) &wire); } #if PRESENT static void __glXpresentCompleteNotify(WindowPtr window, CARD8 present_kind, CARD8 present_mode, CARD32 serial, uint64_t ust, uint64_t msc) { __GLXdrawable *drawable; int glx_type; int rc; if (present_kind != PresentCompleteKindPixmap) return; rc = dixLookupResourceByType((void **) &drawable, window->drawable.id, __glXDrawableRes, serverClient, DixGetAttrAccess); if (rc != Success) return; if (present_mode == PresentCompleteModeFlip) glx_type = GLX_FLIP_COMPLETE_INTEL; else glx_type = GLX_BLIT_COMPLETE_INTEL; __glXsendSwapEvent(drawable, glx_type, ust, msc, serial); } #include void __glXregisterPresentCompleteNotify(void) { present_register_complete_notify(__glXpresentCompleteNotify); } #endif xorg-server-1.20.8/record/0000755000175000017500000000000013640201533012341 500000000000000xorg-server-1.20.8/record/Makefile.am0000644000175000017500000000017013640201473014316 00000000000000noinst_LTLIBRARIES = librecord.la AM_CFLAGS = $(DIX_CFLAGS) librecord_la_SOURCES = record.c set.c EXTRA_DIST = set.h xorg-server-1.20.8/record/set.c0000644000175000017500000003062313640201473013227 00000000000000/* 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. */ /* See the header set.h for a description of the set ADT. Implementation Strategy A bit vector is an obvious choice to represent the set, but may take too much memory, depending on the numerically largest member in the set. One expected common case is for the client to ask for *all* protocol. This means it would ask for minor opcodes 0 through 65535. Representing this as a bit vector takes 8K -- and there may be multiple minor opcode intervals, as many as one per major (extension) opcode). In such cases, a list-of-intervals representation would be preferable to reduce memory consumption. Both representations will be implemented, and RecordCreateSet will decide heuristically which one to use based on the set members. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "set.h" static int maxMemberInInterval(RecordSetInterval * pIntervals, int nIntervals) { int i; int maxMember = -1; for (i = 0; i < nIntervals; i++) { if (maxMember < (int) pIntervals[i].last) maxMember = pIntervals[i].last; } return maxMember; } static void NoopDestroySet(RecordSetPtr pSet) { } /***************************************************************************/ /* set operations for bit vector representation */ typedef struct { RecordSetRec baseSet; int maxMember; /* followed by the bit vector itself */ } BitVectorSet, *BitVectorSetPtr; #define BITS_PER_LONG (sizeof(unsigned long) * 8) static void BitVectorDestroySet(RecordSetPtr pSet) { free(pSet); } static unsigned long BitVectorIsMemberOfSet(RecordSetPtr pSet, int pm) { BitVectorSetPtr pbvs = (BitVectorSetPtr) pSet; unsigned long *pbitvec; if ((int) pm > pbvs->maxMember) return FALSE; pbitvec = (unsigned long *) (&pbvs[1]); return (pbitvec[pm / BITS_PER_LONG] & ((unsigned long) 1 << (pm % BITS_PER_LONG))); } static int BitVectorFindBit(RecordSetPtr pSet, int iterbit, Bool bitval) { BitVectorSetPtr pbvs = (BitVectorSetPtr) pSet; unsigned long *pbitvec = (unsigned long *) (&pbvs[1]); int startlong; int startbit; int walkbit; int maxMember; unsigned long skipval; unsigned long bits; unsigned long usefulbits; startlong = iterbit / BITS_PER_LONG; pbitvec += startlong; startbit = startlong * BITS_PER_LONG; skipval = bitval ? 0L : ~0L; maxMember = pbvs->maxMember; if (startbit > maxMember) return -1; bits = *pbitvec; usefulbits = ~(((unsigned long) 1 << (iterbit - startbit)) - 1); if ((bits & usefulbits) == (skipval & usefulbits)) { pbitvec++; startbit += BITS_PER_LONG; while (startbit <= maxMember && *pbitvec == skipval) { pbitvec++; startbit += BITS_PER_LONG; } if (startbit > maxMember) return -1; } walkbit = (startbit < iterbit) ? iterbit - startbit : 0; bits = *pbitvec; while (walkbit < BITS_PER_LONG && ((!(bits & ((unsigned long) 1 << walkbit))) == bitval)) walkbit++; return startbit + walkbit; } static RecordSetIteratePtr BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, RecordSetInterval * pInterval) { int iterbit = (int) (long) pIter; int b; b = BitVectorFindBit(pSet, iterbit, TRUE); if (b == -1) return (RecordSetIteratePtr) 0; pInterval->first = b; b = BitVectorFindBit(pSet, b, FALSE); pInterval->last = (b < 0) ? ((BitVectorSetPtr) pSet)->maxMember : b - 1; return (RecordSetIteratePtr) (long) (pInterval->last + 1); } static RecordSetOperations BitVectorSetOperations = { BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; static RecordSetOperations BitVectorNoFreeOperations = { NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; static int BitVectorSetMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals, int maxMember, int *alignment) { int nlongs; *alignment = sizeof(unsigned long); nlongs = (maxMember + BITS_PER_LONG) / BITS_PER_LONG; return (sizeof(BitVectorSet) + nlongs * sizeof(unsigned long)); } static RecordSetPtr BitVectorCreateSet(RecordSetInterval * pIntervals, int nIntervals, void *pMem, int memsize) { BitVectorSetPtr pbvs; int i, j; unsigned long *pbitvec; /* allocate all storage needed by this set in one chunk */ if (pMem) { memset(pMem, 0, memsize); pbvs = (BitVectorSetPtr) pMem; pbvs->baseSet.ops = &BitVectorNoFreeOperations; } else { pbvs = (BitVectorSetPtr) calloc(1, memsize); if (!pbvs) return NULL; pbvs->baseSet.ops = &BitVectorSetOperations; } pbvs->maxMember = maxMemberInInterval(pIntervals, nIntervals); /* fill in the set */ pbitvec = (unsigned long *) (&pbvs[1]); for (i = 0; i < nIntervals; i++) { for (j = pIntervals[i].first; j <= (int) pIntervals[i].last; j++) { pbitvec[j / BITS_PER_LONG] |= ((unsigned long) 1 << (j % BITS_PER_LONG)); } } return (RecordSetPtr) pbvs; } /***************************************************************************/ /* set operations for interval list representation */ typedef struct { RecordSetRec baseSet; int nIntervals; /* followed by the intervals (RecordSetInterval) */ } IntervalListSet, *IntervalListSetPtr; static void IntervalListDestroySet(RecordSetPtr pSet) { free(pSet); } static unsigned long IntervalListIsMemberOfSet(RecordSetPtr pSet, int pm) { IntervalListSetPtr prls = (IntervalListSetPtr) pSet; RecordSetInterval *pInterval = (RecordSetInterval *) (&prls[1]); int hi, lo, probe; /* binary search */ lo = 0; hi = prls->nIntervals - 1; while (lo <= hi) { probe = (hi + lo) / 2; if (pm >= pInterval[probe].first && pm <= pInterval[probe].last) return 1; else if (pm < pInterval[probe].first) hi = probe - 1; else lo = probe + 1; } return 0; } static RecordSetIteratePtr IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, RecordSetInterval * pIntervalReturn) { RecordSetInterval *pInterval = (RecordSetInterval *) pIter; IntervalListSetPtr prls = (IntervalListSetPtr) pSet; if (pInterval == NULL) { pInterval = (RecordSetInterval *) (&prls[1]); } if ((pInterval - (RecordSetInterval *) (&prls[1])) < prls->nIntervals) { *pIntervalReturn = *pInterval; return (RecordSetIteratePtr) (++pInterval); } else return (RecordSetIteratePtr) NULL; } static RecordSetOperations IntervalListSetOperations = { IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; static RecordSetOperations IntervalListNoFreeOperations = { NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; static int IntervalListMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals, int maxMember, int *alignment) { *alignment = sizeof(unsigned long); return sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval); } static RecordSetPtr IntervalListCreateSet(RecordSetInterval * pIntervals, int nIntervals, void *pMem, int memsize) { IntervalListSetPtr prls; int i, j, k; RecordSetInterval *stackIntervals = NULL; CARD16 first; if (nIntervals > 0) { stackIntervals = xallocarray(nIntervals, sizeof(RecordSetInterval)); if (!stackIntervals) return NULL; /* sort intervals, store in stackIntervals (insertion sort) */ for (i = 0; i < nIntervals; i++) { first = pIntervals[i].first; for (j = 0; j < i; j++) { if (first < stackIntervals[j].first) break; } for (k = i; k > j; k--) { stackIntervals[k] = stackIntervals[k - 1]; } stackIntervals[j] = pIntervals[i]; } /* merge abutting/overlapping intervals */ for (i = 0; i < nIntervals - 1;) { if ((stackIntervals[i].last + (unsigned int) 1) < stackIntervals[i + 1].first) { i++; /* disjoint intervals */ } else { stackIntervals[i].last = max(stackIntervals[i].last, stackIntervals[i + 1].last); nIntervals--; for (j = i + 1; j < nIntervals; j++) stackIntervals[j] = stackIntervals[j + 1]; } } } /* allocate and fill in set structure */ if (pMem) { prls = (IntervalListSetPtr) pMem; prls->baseSet.ops = &IntervalListNoFreeOperations; } else { prls = (IntervalListSetPtr) malloc(sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval)); if (!prls) goto bailout; prls->baseSet.ops = &IntervalListSetOperations; } memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); prls->nIntervals = nIntervals; bailout: free(stackIntervals); return (RecordSetPtr) prls; } typedef RecordSetPtr(*RecordCreateSetProcPtr) (RecordSetInterval * pIntervals, int nIntervals, void *pMem, int memsize); static int _RecordSetMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals, int *alignment, RecordCreateSetProcPtr * ppCreateSet) { int bmsize, rlsize, bma, rla; int maxMember; /* find maximum member of set so we know how big to make the bit vector */ maxMember = maxMemberInInterval(pIntervals, nIntervals); bmsize = BitVectorSetMemoryRequirements(pIntervals, nIntervals, maxMember, &bma); rlsize = IntervalListMemoryRequirements(pIntervals, nIntervals, maxMember, &rla); if (((nIntervals > 1) && (maxMember <= 255)) || (bmsize < rlsize)) { *alignment = bma; *ppCreateSet = BitVectorCreateSet; return bmsize; } else { *alignment = rla; *ppCreateSet = IntervalListCreateSet; return rlsize; } } /***************************************************************************/ /* user-visible functions */ int RecordSetMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals, int *alignment) { RecordCreateSetProcPtr pCreateSet; return _RecordSetMemoryRequirements(pIntervals, nIntervals, alignment, &pCreateSet); } RecordSetPtr RecordCreateSet(RecordSetInterval * pIntervals, int nIntervals, void *pMem, int memsize) { RecordCreateSetProcPtr pCreateSet; int alignment; int size; size = _RecordSetMemoryRequirements(pIntervals, nIntervals, &alignment, &pCreateSet); if (pMem) { if (((long) pMem & (alignment - 1)) || memsize < size) return NULL; } return (*pCreateSet) (pIntervals, nIntervals, pMem, size); } xorg-server-1.20.8/record/Makefile.in0000644000175000017500000006361013640201515014334 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = record ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librecord_la_LIBADD = am_librecord_la_OBJECTS = record.lo set.lo librecord_la_OBJECTS = $(am_librecord_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/record.Plo ./$(DEPDIR)/set.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(librecord_la_SOURCES) DIST_SOURCES = $(librecord_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = librecord.la AM_CFLAGS = $(DIX_CFLAGS) librecord_la_SOURCES = record.c set.c EXTRA_DIST = set.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign record/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign record/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } librecord.la: $(librecord_la_OBJECTS) $(librecord_la_DEPENDENCIES) $(EXTRA_librecord_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(librecord_la_OBJECTS) $(librecord_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/record.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/record.Plo -rm -f ./$(DEPDIR)/set.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/record.Plo -rm -f ./$(DEPDIR)/set.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/record/record.c0000644000175000017500000030465213640201473013720 00000000000000 /* 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 #endif #include "dixstruct.h" #include "extnsionst.h" #include "extinit.h" #include #include "set.h" #include "swaprep.h" #include "inputstr.h" #include "eventconvert.h" #include "scrnintstr.h" #include #include #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((void **)&(_pContext), _contextid, \ RTContext, _client, DixUseAccess); \ if (rc != Success) \ return rc; \ } static int RecordDeleteContext(void *value, XID id); /***************************************************************************/ /* 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, void *data1, int len1, void *data2, int len2) { if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone || pContext->inFlush) return; ++pContext->inFlush; if (pContext->numBufBytes) WriteToClient(pContext->pRecordingClient, pContext->numBufBytes, pContext->replyBuffer); pContext->numBufBytes = 0; if (len1) WriteToClient(pContext->pRecordingClient, len1, data1); if (len2) WriteToClient(pContext->pRecordingClient, len2, 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 - padlen * is its length in bytes. * padlen is the number of pad bytes from a zeroed array. * 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, void *data, int datalen, int padlen, int futurelen) { CARD32 elemHeaderData[2]; int numElemHeaders = 0; Bool recordingClientSwapped = pContext->pRecordingClient->swapped; 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); swapl(&pRep->length); swapl(&pRep->idBase); swapl(&pRep->serverTime); swapl(&pRep->recordedSequenceNumber); } 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]); numElemHeaders++; } if ((pContext->elemHeaders & XRecordFromClientSequence) && (category == XRecordFromClient || category == XRecordClientDied)) { elemHeaderData[numElemHeaders] = pClient->sequence; if (recordingClientSwapped) swapl(&elemHeaderData[numElemHeaders]); numElemHeaders++; } /* adjust reply length */ replylen = pRep->length; if (recordingClientSwapped) swapl(&replylen); replylen += numElemHeaders + bytes_to_int32(datalen) + bytes_to_int32(futurelen); if (recordingClientSwapped) swapl(&replylen); 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) { static char padBuffer[3]; /* as in FlushClient */ memcpy(pContext->replyBuffer + pContext->numBufBytes, data, datalen - padlen); pContext->numBufBytes += datalen - padlen; memcpy(pContext->replyBuffer + pContext->numBufBytes, padBuffer, padlen); pContext->numBufBytes += padlen; } } else { RecordFlushReplyBuffer(pContext, (void *) elemHeaderData, numElemHeaders, (void *) data, datalen - padlen); } } /* 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; 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, (void *) stuff, SIZEOF(xReq), 0, bytesLeft); /* reinsert the extended length field that was squished out */ bigLength = client->req_len + bytes_to_int32(sizeof(bigLength)); if (client->swapped) swapl(&bigLength); RecordAProtocolElement(pContext, client, XRecordFromClient, (void *) &bigLength, sizeof(bigLength), 0, /* continuation */ -1); bytesLeft -= sizeof(bigLength); /* record the rest of the request after the length */ RecordAProtocolElement(pContext, client, XRecordFromClient, (void *) (stuff + 1), bytesLeft, 0, /* 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, (void *) stuff, client->req_len << 2, 0, 0); } else { /* extension, check minor opcode */ int minorop = client->minorOp; 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, (void *) stuff, client->req_len << 2, 0, 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, void *nulldata, void *calldata) { RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; int eci; ReplyInfoRec *pri = (ReplyInfoRec *) calldata; ClientPtr client = pri->client; for (eci = 0; eci < numEnabledContexts; eci++) { pContext = ppAllContexts[eci]; pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask, NULL); if (pRCAP) { int majorop = client->majorOp; if (pContext->continuedReply) { RecordAProtocolElement(pContext, client, XRecordFromServer, (void *) pri->replyData, pri->dataLenBytes, pri->padBytes, /* 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, (void *) pri->replyData, pri->dataLenBytes, 0, pri->bytesRemaining); if (pri->bytesRemaining) pContext->continuedReply = 1; } else { /* extension, check minor opcode */ int minorop = client->minorOp; 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, (void *) pri->replyData, pri->dataLenBytes, 0, 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, void *nulldata, void *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, 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, 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, void *nulldata, void *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 *core_events; EventToCore(pei->event, &core_events, &count); RecordSendProtocolEvents(pRCAP, pContext, core_events, count); free(core_events); } 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, void *nulldata, void *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 = reallocarray(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 = xallocarray(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; void *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 = xallocarray(currentMaxClients + 1, sizeof(XID)); 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 -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; #if defined(ERR) && defined(__sun) #undef ERR /* Avoid conflict with Solaris */ #endif /* 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 = xallocarray(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 = xallocarray(maxSets, sizeof(SetInfoRec)); 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 = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_RECORD_MAJOR_VERSION, .minorVersion = SERVER_RECORD_MINOR_VERSION }; REQUEST_SIZE_MATCH(xRecordQueryVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xRecordQueryVersionReply), &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 = reallocarray(ppAllContexts, numContexts + 1, sizeof(RecordContextPtr)); 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 { return 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 (INT_MAX / 4 < stuff->nClients || (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 = reallocarray(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; for (i = 0; i < nRanges; i++, pRanges++) { swaps(&pRanges->extRequestsMinorFirst); swaps(&pRanges->extRequestsMinorLast); swaps(&pRanges->extRepliesMinorFirst); swaps(&pRanges->extRepliesMinorLast); } } /* RecordSwapRanges */ static int ProcRecordGetContext(ClientPtr client) { RecordContextPtr pContext; REQUEST(xRecordGetContextReq); xRecordGetContextReply rep; RecordClientsAndProtocolPtr pRCAP; int nRCAPs = 0; GetContextRangeInfoPtr pRangeInfo; GetContextRangeInfoPtr pri; int i; int err; CARD32 nClients, length; 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 = xallocarray(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 */ nClients = 0; length = 0; for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo; pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) { nClients += pRCAP->numClients; length += pRCAP->numClients * (bytes_to_int32(sizeof(xRecordClientInfo)) + pri->nRanges * bytes_to_int32(sizeof(xRecordRange))); } /* write the reply header */ rep = (xRecordGetContextReply) { .type = X_Reply, .enabled = pContext->pRecordingClient != NULL, .sequenceNumber = client->sequence, .length = length, .elementHeader = pContext->elemHeaders, .nClients = nClients }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.nClients); } WriteToClient(client, sizeof(xRecordGetContextReply), &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); RecordSwapRanges(pri->pRanges, pri->nRanges); } for (i = 0; i < pRCAP->numClients; i++) { rci.clientResource = pRCAP->pClientIDs[i]; if (client->swapped) swapl(&rci.clientResource); WriteToClient(client, sizeof(xRecordClientInfo), &rci); WriteToClient(client, sizeof(xRecordRange) * pri->nRanges, 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, 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, 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(void *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 _X_COLD SProcRecordQueryVersion(ClientPtr client) { REQUEST(xRecordQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordQueryVersionReq); swaps(&stuff->majorVersion); swaps(&stuff->minorVersion); return ProcRecordQueryVersion(client); } /* SProcRecordQueryVersion */ static int _X_COLD SwapCreateRegister(xRecordRegisterClientsReq * stuff) { int i; XID *pClientID; swapl(&stuff->context); swapl(&stuff->nClients); swapl(&stuff->nRanges); 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); } if (stuff->nRanges > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq) - stuff->nClients) return BadLength; RecordSwapRanges((xRecordRange *) pClientID, stuff->nRanges); return Success; } /* SwapCreateRegister */ static int _X_COLD SProcRecordCreateContext(ClientPtr client) { REQUEST(xRecordCreateContextReq); int status; swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq); if ((status = SwapCreateRegister((void *) stuff)) != Success) return status; return ProcRecordCreateContext(client); } /* SProcRecordCreateContext */ static int _X_COLD SProcRecordRegisterClients(ClientPtr client) { REQUEST(xRecordRegisterClientsReq); int status; swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq); if ((status = SwapCreateRegister((void *) stuff)) != Success) return status; return ProcRecordRegisterClients(client); } /* SProcRecordRegisterClients */ static int _X_COLD SProcRecordUnregisterClients(ClientPtr client) { REQUEST(xRecordUnregisterClientsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq); swapl(&stuff->context); swapl(&stuff->nClients); SwapRestL(stuff); return ProcRecordUnregisterClients(client); } /* SProcRecordUnregisterClients */ static int _X_COLD SProcRecordGetContext(ClientPtr client) { REQUEST(xRecordGetContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordGetContextReq); swapl(&stuff->context); return ProcRecordGetContext(client); } /* SProcRecordGetContext */ static int _X_COLD SProcRecordEnableContext(ClientPtr client) { REQUEST(xRecordEnableContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordEnableContextReq); swapl(&stuff->context); return ProcRecordEnableContext(client); } /* SProcRecordEnableContext */ static int _X_COLD SProcRecordDisableContext(ClientPtr client) { REQUEST(xRecordDisableContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordDisableContextReq); swapl(&stuff->context); return ProcRecordDisableContext(client); } /* SProcRecordDisableContext */ static int _X_COLD SProcRecordFreeContext(ClientPtr client) { REQUEST(xRecordFreeContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordFreeContextReq); swapl(&stuff->context); return ProcRecordFreeContext(client); } /* SProcRecordFreeContext */ static int _X_COLD 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, (void *) pConnSetup, prefixsize + restsize, 0, 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, (void *) pci->prefix, prefixsize, 0, restsize); RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, (void *) pci->setup, restsize, 0, /* 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, void *nulldata, void *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 = xallocarray(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, 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 */ xorg-server-1.20.8/record/set.h0000644000175000017500000001272313640201473013235 00000000000000/* 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. */ /* A Set Abstract Data Type (ADT) for the RECORD Extension David P. Wiggins 7/25/95 The RECORD extension server code needs to maintain sets of numbers that designate protocol message types. In most cases the interval of numbers starts at 0 and does not exceed 255, but in a few cases (minor opcodes of extension requests) the maximum is 65535. This disparity suggests that a single set representation may not be suitable for all sets, especially given that server memory is precious. We introduce a set ADT to hide implementation differences so that multiple simultaneous set representations can exist. A single interface is presented to the set user regardless of the implementation in use for a particular set. The existing RECORD SI appears to require only four set operations: create (given a list of members), destroy, see if a particular number is a member of the set, and iterate over the members of a set. Though many more set operations are imaginable, to keep the code space down, we won't provide any more operations than are needed. The following types and functions/macros define the ADT. */ /* an interval of set members */ typedef struct { CARD16 first; CARD16 last; } RecordSetInterval; typedef struct _RecordSetRec *RecordSetPtr; /* primary set type */ typedef void *RecordSetIteratePtr; /* table of function pointers for set operations. set users should never declare a variable of this type. */ typedef struct { void (*DestroySet) (RecordSetPtr pSet); unsigned long (*IsMemberOfSet) (RecordSetPtr pSet, int possible_member); RecordSetIteratePtr(*IterateSet) (RecordSetPtr pSet, RecordSetIteratePtr pIter, RecordSetInterval * interval); } RecordSetOperations; /* "base class" for sets. set users should never declare a variable of this type. */ typedef struct _RecordSetRec { RecordSetOperations *ops; } RecordSetRec; RecordSetPtr RecordCreateSet(RecordSetInterval * intervals, int nintervals, void *pMem, int memsize); /* RecordCreateSet creates and returns a new set having members specified by intervals and nintervals. nintervals is the number of RecordSetInterval structures pointed to by intervals. The elements belonging to the new set are determined as follows. For each RecordSetInterval structure, the elements between first and last inclusive are members of the new set. If a RecordSetInterval's first field is greater than its last field, the results are undefined. It is valid to create an empty set (nintervals == 0). If RecordCreateSet returns NULL, the set could not be created due to resource constraints. */ int RecordSetMemoryRequirements(RecordSetInterval * /*pIntervals */ , int /*nintervals */ , int * /*alignment */ ); #define RecordDestroySet(_pSet) \ /* void */ (*_pSet->ops->DestroySet)(/* RecordSetPtr */ _pSet) /* RecordDestroySet frees all resources used by _pSet. _pSet should not be used after it is destroyed. */ #define RecordIsMemberOfSet(_pSet, _m) \ /* unsigned long */ (*_pSet->ops->IsMemberOfSet)(/* RecordSetPtr */ _pSet, \ /* int */ _m) /* RecordIsMemberOfSet returns a non-zero value if _m is a member of _pSet, else it returns zero. */ #define RecordIterateSet(_pSet, _pIter, _interval) \ /* RecordSetIteratePtr */ (*_pSet->ops->IterateSet)(/* RecordSetPtr */ _pSet,\ /* RecordSetIteratePtr */ _pIter, /* RecordSetInterval */ _interval) /* RecordIterateSet returns successive intervals of members of _pSet. If _pIter is NULL, the first interval of set members is copied into _interval. The return value should be passed as _pIter in the next call to RecordIterateSet to obtain the next interval. When the return value is NULL, there were no more intervals in the set, and nothing is copied into the _interval parameter. Intervals appear in increasing numerical order with no overlap between intervals. As such, the list of intervals produced by RecordIterateSet may not match the list of intervals that were passed in RecordCreateSet. Typical usage: pIter = NULL; while (pIter = RecordIterateSet(pSet, pIter, &interval)) { process interval; } */ xorg-server-1.20.8/record/meson.build0000644000175000017500000000025013640201473014423 00000000000000srcs_record = [ 'record.c', 'set.c', ] libxserver_record = static_library('libxserver_record', srcs_record, include_directories: inc, dependencies: common_dep, ) xorg-server-1.20.8/include/0000755000175000017500000000000013640201532012505 500000000000000xorg-server-1.20.8/include/dixstruct.h0000644000175000017500000001502613640201473014637 00000000000000/*********************************************************** 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 DIXSTRUCT_H #define DIXSTRUCT_H #include "client.h" #include "dix.h" #include "resource.h" #include "cursor.h" #include "gc.h" #include "pixmap.h" #include "privates.h" #include /* * direct-mapped hash table, used by resource manager to store * translation from client ids to server addresses. */ extern _X_EXPORT CallbackListPtr ClientStateCallback; typedef struct { ClientPtr client; xConnSetupPrefix *prefix; xConnSetup *setup; } NewClientInfoRec; typedef void (*ReplySwapPtr) (ClientPtr /* pClient */ , int /* size */ , void * /* pbuf */ ); extern _X_EXPORT void ReplyNotSwappd(ClientPtr /* pClient */ , int /* size */ , void * /* pbuf */ ) _X_NORETURN; typedef enum { ClientStateInitial, ClientStateRunning, ClientStateRetained, ClientStateGone } ClientState; typedef struct _saveSet { struct _Window *windowPtr; Bool toRoot; Bool map; } SaveSetElt; #define SaveSetWindow(ss) ((ss).windowPtr) #define SaveSetToRoot(ss) ((ss).toRoot) #define SaveSetShouldMap(ss) ((ss).map) #define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w)) #define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr)) #define SaveSetAssignMap(ss,m) ((ss).map = (m)) typedef struct _Client { void *requestBuffer; void *osPrivate; /* for OS layer, including scheduler */ struct xorg_list ready; /* List of clients ready to run */ struct xorg_list output_pending; /* List of clients with output queued */ Mask clientAsMask; short index; unsigned char majorOp, minorOp; unsigned int swapped:1; unsigned int local:1; unsigned int big_requests:1; /* supports large requests */ unsigned int clientGone:1; unsigned int closeDownMode:2; unsigned int clientState:2; signed char smart_priority; short noClientException; /* this client died or needs to be killed */ int priority; ReplySwapPtr pSwapReplyFunc; XID errorValue; int sequence; int ignoreCount; /* count for Attend/IgnoreClient */ int numSaved; SaveSetElt *saveSet; int (**requestVector) (ClientPtr /* pClient */ ); CARD32 req_len; /* length of current request */ unsigned int replyBytesRemaining; PrivateRec *devPrivates; unsigned short mapNotifyMask; unsigned short newKeyboardNotifyMask; unsigned char xkbClientFlags; KeyCode minKC, maxKC; int smart_start_tick; int smart_stop_tick; DeviceIntPtr clientPtr; ClientIdPtr clientIds; int req_fds; } ClientRec; static inline void SetReqFds(ClientPtr client, int req_fds) { if (client->req_fds != 0 && req_fds != client->req_fds) LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds); client->req_fds = req_fds; } /* * Scheduling interface */ extern long SmartScheduleTime; extern long SmartScheduleInterval; extern long SmartScheduleSlice; extern long SmartScheduleMaxSlice; #ifdef HAVE_SETITIMER extern Bool SmartScheduleSignalEnable; #else #define SmartScheduleSignalEnable FALSE #endif extern void SmartScheduleStartTimer(void); extern void SmartScheduleStopTimer(void); /* Client has requests queued or data on the network */ void mark_client_ready(ClientPtr client); /* * Client has requests queued or data on the network, but awaits a * server grab release */ void mark_client_saved_ready(ClientPtr client); /* Client has no requests queued and no data on network */ void mark_client_not_ready(ClientPtr client); static inline Bool client_is_ready(ClientPtr client) { return !xorg_list_is_empty(&client->ready); } Bool clients_are_ready(void); extern struct xorg_list output_pending_clients; static inline void output_pending_mark(ClientPtr client) { if (!client->clientGone && xorg_list_is_empty(&client->output_pending)) xorg_list_append(&client->output_pending, &output_pending_clients); } static inline void output_pending_clear(ClientPtr client) { xorg_list_del(&client->output_pending); } static inline Bool any_output_pending(void) { return !xorg_list_is_empty(&output_pending_clients); } #define SMART_MAX_PRIORITY (20) #define SMART_MIN_PRIORITY (-20) extern void SmartScheduleInit(void); /* This prototype is used pervasively in Xext, dix */ #define DISPATCH_PROC(func) int func(ClientPtr /* client */) typedef struct _WorkQueue { struct _WorkQueue *next; Bool (*function) (ClientPtr /* pClient */ , void * /* closure */ ); ClientPtr client; void *closure; } WorkQueueRec; extern _X_EXPORT TimeStamp currentTime; extern _X_EXPORT int CompareTimeStamps(TimeStamp /*a */ , TimeStamp /*b */ ); extern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c */ ); typedef struct _CallbackRec { CallbackProcPtr proc; void *data; Bool deleted; struct _CallbackRec *next; } CallbackRec, *CallbackPtr; typedef struct _CallbackList { int inCallback; Bool deleted; int numDeleted; CallbackPtr list; } CallbackListRec; /* proc vectors */ extern int (*InitialVector[3]) (ClientPtr /*client */ ); extern _X_EXPORT int (*ProcVector[256]) (ClientPtr /*client */ ); extern _X_EXPORT int (*SwappedProcVector[256]) (ClientPtr /*client */ ); extern ReplySwapPtr ReplySwapVector[256]; extern _X_EXPORT int ProcBadRequest(ClientPtr /*client */ ); #endif /* DIXSTRUCT_H */ xorg-server-1.20.8/include/xkb-config.h.in0000644000175000017500000000111313640201473015232 00000000000000/* xkb-config.h.in: not at all generated. -*- c -*- * */ #ifndef _XKB_CONFIG_H_ #define _XKB_CONFIG_H_ /* Default set of XKB rules. */ #undef XKB_DFLT_RULES /* Default XKB model. */ #undef XKB_DFLT_MODEL /* Default XKB layout. */ #undef XKB_DFLT_LAYOUT /* Default XKB variant. */ #undef XKB_DFLT_VARIANT /* Default XKB options. */ #undef XKB_DFLT_OPTIONS /* Path to XKB definitions. */ #undef XKB_BASE_DIRECTORY /* Path to xkbcomp. */ #undef XKB_BIN_DIRECTORY /* XKB output dir for compiled keymaps. */ #undef XKM_OUTPUT_DIR #endif /* _XKB_CONFIG_H_ */ xorg-server-1.20.8/include/dixaccess.h0000644000175000017500000000515313640201473014554 00000000000000/*********************************************************** 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. ******************************************************************/ #ifndef DIX_ACCESS_H #define DIX_ACCESS_H /* These are the access modes that can be passed in the last parameter * to several of the dix lookup functions. They were originally part * of the Security extension, now used by XACE. * * You can or these values together to indicate multiple modes * simultaneously. */ #define DixUnknownAccess 0 /* don't know intentions */ #define DixReadAccess (1<<0) /* inspecting the object */ #define DixWriteAccess (1<<1) /* changing the object */ #define DixDestroyAccess (1<<2) /* destroying the object */ #define DixCreateAccess (1<<3) /* creating the object */ #define DixGetAttrAccess (1<<4) /* get object attributes */ #define DixSetAttrAccess (1<<5) /* set object attributes */ #define DixListPropAccess (1<<6) /* list properties of object */ #define DixGetPropAccess (1<<7) /* get properties of object */ #define DixSetPropAccess (1<<8) /* set properties of object */ #define DixGetFocusAccess (1<<9) /* get focus of object */ #define DixSetFocusAccess (1<<10) /* set focus of object */ #define DixListAccess (1<<11) /* list objects */ #define DixAddAccess (1<<12) /* add object */ #define DixRemoveAccess (1<<13) /* remove object */ #define DixHideAccess (1<<14) /* hide object */ #define DixShowAccess (1<<15) /* show object */ #define DixBlendAccess (1<<16) /* mix contents of objects */ #define DixGrabAccess (1<<17) /* exclusive access to object */ #define DixFreezeAccess (1<<18) /* freeze status of object */ #define DixForceAccess (1<<19) /* force status of object */ #define DixInstallAccess (1<<20) /* install object */ #define DixUninstallAccess (1<<21) /* uninstall object */ #define DixSendAccess (1<<22) /* send to object */ #define DixReceiveAccess (1<<23) /* receive from object */ #define DixUseAccess (1<<24) /* use object */ #define DixManageAccess (1<<25) /* manage object */ #define DixDebugAccess (1<<26) /* debug object */ #define DixBellAccess (1<<27) /* audible sound */ #define DixPostAccess (1<<28) /* post or follow-up call */ #endif /* DIX_ACCESS_H */ xorg-server-1.20.8/include/gc.h0000644000175000017500000001303513640201473013175 00000000000000/*********************************************************** 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 GC_H #define GC_H #include /* for GContext, Mask */ #include /* for Bool */ #include #include "screenint.h" /* for ScreenPtr */ #include "pixmap.h" /* for DrawablePtr */ /* clientClipType field in GC */ #define CT_NONE 0 #define CT_PIXMAP 1 #define CT_REGION 2 #define CT_UNSORTED 6 #define CT_YSORTED 10 #define CT_YXSORTED 14 #define CT_YXBANDED 18 #define GCQREASON_VALIDATE 1 #define GCQREASON_CHANGE 2 #define GCQREASON_COPY_SRC 3 #define GCQREASON_COPY_DST 4 #define GCQREASON_DESTROY 5 #define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31) #define GC_CALL_VALIDATE_BIT (1L<<30) #define GCExtensionInterest (1L<<29) #define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT)) #define MAX_SERIAL_NUM (1L<<28) #define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \ (globalSerialNumber = 1): globalSerialNumber) typedef struct _GCInterest *GCInterestPtr; typedef struct _GC *GCPtr; typedef struct _GCOps *GCOpsPtr; extern _X_EXPORT void ValidateGC(DrawablePtr /*pDraw */ , GCPtr /*pGC */ ); typedef union { CARD32 val; void *ptr; } ChangeGCVal, *ChangeGCValPtr; extern int ChangeGCXIDs(ClientPtr /*client */ , GCPtr /*pGC */ , BITS32 /*mask */ , CARD32 * /*pval */ ); extern _X_EXPORT int ChangeGC(ClientPtr /*client */ , GCPtr /*pGC */ , BITS32 /*mask */ , ChangeGCValPtr /*pCGCV */ ); extern _X_EXPORT GCPtr CreateGC(DrawablePtr /*pDrawable */ , BITS32 /*mask */ , XID * /*pval */ , int * /*pStatus */ , XID /*gcid */ , ClientPtr /*client */ ); extern _X_EXPORT int CopyGC(GCPtr /*pgcSrc */ , GCPtr /*pgcDst */ , BITS32 /*mask */ ); extern _X_EXPORT int FreeGC(void *pGC, XID gid); extern _X_EXPORT void FreeGCperDepth(int /*screenNum */ ); extern _X_EXPORT Bool CreateGCperDepth(int /*screenNum */ ); extern _X_EXPORT Bool CreateDefaultStipple(int /*screenNum */ ); extern _X_EXPORT void FreeDefaultStipple(int /*screenNum */ ); extern _X_EXPORT int SetDashes(GCPtr /*pGC */ , unsigned /*offset */ , unsigned /*ndash */ , unsigned char * /*pdash */ ); extern _X_EXPORT int VerifyRectOrder(int /*nrects */ , xRectangle * /*prects */ , int /*ordering */ ); extern _X_EXPORT int SetClipRects(GCPtr /*pGC */ , int /*xOrigin */ , int /*yOrigin */ , int /*nrects */ , xRectangle * /*prects */ , int /*ordering */ ); extern _X_EXPORT GCPtr GetScratchGC(unsigned /*depth */ , ScreenPtr /*pScreen */ ); extern _X_EXPORT void FreeScratchGC(GCPtr /*pGC */ ); #endif /* GC_H */ xorg-server-1.20.8/include/hotplug.h0000644000175000017500000000542013640201473014265 00000000000000/* * Copyright © 2006-2007 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifndef HOTPLUG_H #define HOTPLUG_H #include "list.h" extern _X_EXPORT void config_pre_init(void); extern _X_EXPORT void config_init(void); extern _X_EXPORT void config_fini(void); /* Bump this each time you add something to the struct * so that drivers can easily tell what is available */ #define ODEV_ATTRIBUTES_VERSION 1 struct OdevAttributes { /* path to kernel device node - Linux e.g. /dev/dri/card0 */ char *path; /* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */ char *syspath; /* DRI-style bus id */ char *busid; /* Server managed FD */ int fd; /* Major number of the device node pointed to by ODEV_ATTRIB_PATH */ int major; /* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */ int minor; /* kernel driver name */ char *driver; }; /* Note starting with xserver 1.16 this function never fails */ struct OdevAttributes * config_odev_allocate_attributes(void); void config_odev_free_attributes(struct OdevAttributes *attribs); typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs); void config_odev_probe(config_odev_probe_proc_ptr probe_callback); #ifdef CONFIG_UDEV_KMS void NewGPUDeviceRequest(struct OdevAttributes *attribs); void DeleteGPUDeviceRequest(struct OdevAttributes *attribs); #endif #define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0")) struct xf86_platform_device * xf86_find_platform_device_by_devnum(int major, int minor); #endif /* HOTPLUG_H */ xorg-server-1.20.8/include/Makefile.am0000644000175000017500000000245213640201473014470 00000000000000if XORG sdk_HEADERS = \ XIstubs.h \ Xprintf.h \ callback.h \ client.h \ closestr.h \ closure.h \ colormap.h \ colormapst.h \ hotplug.h \ cursor.h \ cursorstr.h \ dix.h \ dixaccess.h \ dixevents.h \ dixfont.h \ dixfontstr.h \ dixgrabs.h \ dixstruct.h \ events.h \ exevents.h \ extension.h \ extinit.h \ extnsionst.h \ gc.h \ gcstruct.h \ globals.h \ glx_extinit.h \ glxvndabi.h \ input.h \ inputstr.h \ list.h \ misc.h \ miscstruct.h \ opaque.h \ nonsdk_extinit.h \ optionstr.h \ os.h \ pixmap.h \ pixmapstr.h \ privates.h \ property.h \ propertyst.h \ ptrveloc.h \ region.h \ regionstr.h \ registry.h \ resource.h \ rgb.h \ screenint.h \ scrnintstr.h \ selection.h \ servermd.h \ site.h \ validate.h \ displaymode.h \ window.h \ windowstr.h \ xkbfile.h \ xkbsrv.h \ xkbstr.h \ xkbrules.h \ xserver_poll.h \ xserver-properties.h nodist_sdk_HEADERS = xorg-server.h endif AM_CFLAGS = $(DIX_CFLAGS) EXTRA_DIST = \ busfault.h dbus-core.h \ dix-config-apple-verbatim.h \ eventconvert.h eventstr.h inpututils.h \ probes.h \ protocol-versions.h \ swaprep.h \ swapreq.h \ systemd-logind.h \ vidmodestr.h \ xorg-config.h.meson.in \ xorg-server.h.meson.in \ xwayland-config.h.meson.in \ xwin-config.h.meson.in \ xsha1.h xorg-server-1.20.8/include/opaque.h0000644000175000017500000000526313640201473014102 00000000000000/* 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. */ #ifndef OPAQUE_H #define OPAQUE_H #include #include "globals.h" extern _X_EXPORT const char *defaultTextFont; extern _X_EXPORT const char *defaultCursorFont; extern _X_EXPORT int MaxClients; extern _X_EXPORT int LimitClients; extern _X_EXPORT volatile char isItTimeToYield; extern _X_EXPORT volatile char dispatchException; /* bit values for dispatchException */ #define DE_RESET 1 #define DE_TERMINATE 2 #define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */ extern _X_EXPORT CARD32 TimeOutValue; extern _X_EXPORT int ScreenSaverBlanking; extern _X_EXPORT int ScreenSaverAllowExposures; extern _X_EXPORT int defaultScreenSaverBlanking; extern _X_EXPORT int defaultScreenSaverAllowExposures; extern _X_EXPORT const char *display; extern _X_EXPORT int displayfd; extern _X_EXPORT Bool explicit_display; extern _X_EXPORT int defaultBackingStore; extern _X_EXPORT Bool disableBackingStore; extern _X_EXPORT Bool enableBackingStore; extern _X_EXPORT Bool enableIndirectGLX; extern _X_EXPORT Bool PartialNetwork; extern _X_EXPORT Bool RunFromSigStopParent; #ifdef RLIMIT_DATA extern _X_EXPORT int limitDataSpace; #endif #ifdef RLIMIT_STACK extern _X_EXPORT int limitStackSpace; #endif #ifdef RLIMIT_NOFILE extern _X_EXPORT int limitNoFile; #endif extern _X_EXPORT Bool defeatAccessControl; extern _X_EXPORT long maxBigRequestSize; extern _X_EXPORT Bool party_like_its_1989; extern _X_EXPORT Bool whiteRoot; extern _X_EXPORT Bool bgNoneRoot; extern _X_EXPORT Bool CoreDump; extern _X_EXPORT Bool NoListenAll; #endif /* OPAQUE_H */ xorg-server-1.20.8/include/window.h0000644000175000017500000002307613640201473014121 00000000000000/*********************************************************** 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 WINDOW_H #define WINDOW_H #include "misc.h" #include "region.h" #include "screenint.h" #include #define TOTALLY_OBSCURED 0 #define UNOBSCURED 1 #define OBSCURED 2 #define VisibilityNotViewable 3 /* return values for tree-walking callback procedures */ #define WT_STOPWALKING 0 #define WT_WALKCHILDREN 1 #define WT_DONTWALKCHILDREN 2 #define WT_NOMATCH 3 #define NullWindow ((WindowPtr) 0) /* Forward declaration, we can't include input.h here */ struct _DeviceIntRec; struct _Cursor; typedef struct _BackingStore *BackingStorePtr; typedef struct _Window *WindowPtr; enum RootClipMode { ROOT_CLIP_NONE = 0, /**< resize the root window to 0x0 */ ROOT_CLIP_FULL = 1, /**< resize the root window to fit screen */ ROOT_CLIP_INPUT_ONLY = 2, /**< as above, but no rendering to screen */ }; typedef int (*VisitWindowProcPtr) (WindowPtr pWin, void *data); extern _X_EXPORT int TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, void *data); extern _X_EXPORT int WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void *data); extern _X_EXPORT Bool CreateRootWindow(ScreenPtr /*pScreen */ ); extern _X_EXPORT void InitRootWindow(WindowPtr /*pWin */ ); typedef WindowPtr (*RealChildHeadProc) (WindowPtr pWin); extern _X_EXPORT void RegisterRealChildHeadProc(RealChildHeadProc proc); extern _X_EXPORT WindowPtr RealChildHead(WindowPtr /*pWin */ ); extern _X_EXPORT WindowPtr CreateWindow(Window /*wid */ , WindowPtr /*pParent */ , int /*x */ , int /*y */ , unsigned int /*w */ , unsigned int /*h */ , unsigned int /*bw */ , unsigned int /*class */ , Mask /*vmask */ , XID * /*vlist */ , int /*depth */ , ClientPtr /*client */ , VisualID /*visual */ , int * /*error */ ); extern _X_EXPORT int DeleteWindow(void *pWin, XID wid); extern _X_EXPORT int DestroySubwindows(WindowPtr /*pWin */ , ClientPtr /*client */ ); /* Quartz support on Mac OS X uses the HIToolbox framework whose ChangeWindowAttributes function conflicts here. */ #ifdef __APPLE__ #define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes #endif extern _X_EXPORT int ChangeWindowAttributes(WindowPtr /*pWin */ , Mask /*vmask */ , XID * /*vlist */ , ClientPtr /*client */ ); extern _X_EXPORT int ChangeWindowDeviceCursor(WindowPtr /*pWin */ , struct _DeviceIntRec * /*pDev */ , struct _Cursor * /*pCursor */ ); extern _X_EXPORT struct _Cursor *WindowGetDeviceCursor(WindowPtr /*pWin */ , struct _DeviceIntRec * /*pDev */ ); /* Quartz support on Mac OS X uses the HIToolbox framework whose GetWindowAttributes function conflicts here. */ #ifdef __APPLE__ #define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x) extern void Darwin_X_GetWindowAttributes( #else extern _X_EXPORT void GetWindowAttributes( #endif WindowPtr /*pWin */ , ClientPtr /*client */ , xGetWindowAttributesReply * /* wa */ ); extern _X_EXPORT void GravityTranslate(int /*x */ , int /*y */ , int /*oldx */ , int /*oldy */ , int /*dw */ , int /*dh */ , unsigned /*gravity */ , int * /*destx */ , int * /*desty */ ); extern _X_EXPORT int ConfigureWindow(WindowPtr /*pWin */ , Mask /*mask */ , XID * /*vlist */ , ClientPtr /*client */ ); extern _X_EXPORT int CirculateWindow(WindowPtr /*pParent */ , int /*direction */ , ClientPtr /*client */ ); extern _X_EXPORT int ReparentWindow(WindowPtr /*pWin */ , WindowPtr /*pParent */ , int /*x */ , int /*y */ , ClientPtr /*client */ ); extern _X_EXPORT int MapWindow(WindowPtr /*pWin */ , ClientPtr /*client */ ); extern _X_EXPORT void MapSubwindows(WindowPtr /*pParent */ , ClientPtr /*client */ ); extern _X_EXPORT int UnmapWindow(WindowPtr /*pWin */ , Bool /*fromConfigure */ ); extern _X_EXPORT void UnmapSubwindows(WindowPtr /*pWin */ ); extern _X_EXPORT void HandleSaveSet(ClientPtr /*client */ ); extern _X_EXPORT Bool PointInWindowIsVisible(WindowPtr /*pWin */ , int /*x */ , int /*y */ ); extern _X_EXPORT RegionPtr NotClippedByChildren(WindowPtr /*pWin */ ); extern _X_EXPORT void SendVisibilityNotify(WindowPtr /*pWin */ ); extern _X_EXPORT int dixSaveScreens(ClientPtr client, int on, int mode); extern _X_EXPORT int SaveScreens(int on, int mode); extern _X_EXPORT WindowPtr FindWindowWithOptional(WindowPtr /*w */ ); extern _X_EXPORT void CheckWindowOptionalNeed(WindowPtr /*w */ ); extern _X_EXPORT Bool MakeWindowOptional(WindowPtr /*pWin */ ); extern _X_EXPORT WindowPtr MoveWindowInStack(WindowPtr /*pWin */ , WindowPtr /*pNextSib */ ); extern _X_EXPORT void SetWinSize(WindowPtr /*pWin */ ); extern _X_EXPORT void SetBorderSize(WindowPtr /*pWin */ ); extern _X_EXPORT void ResizeChildrenWinSize(WindowPtr /*pWin */ , int /*dx */ , int /*dy */ , int /*dw */ , int /*dh */ ); extern _X_EXPORT void SendShapeNotify(WindowPtr /* pWin */ , int /* which */); extern _X_EXPORT RegionPtr CreateBoundingShape(WindowPtr /* pWin */ ); extern _X_EXPORT RegionPtr CreateClipShape(WindowPtr /* pWin */ ); extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, int enable); extern _X_EXPORT void PrintWindowTree(void); extern _X_EXPORT void PrintPassiveGrabs(void); extern _X_EXPORT VisualPtr WindowGetVisual(WindowPtr /*pWin*/); #endif /* WINDOW_H */ xorg-server-1.20.8/include/nonsdk_extinit.h0000644000175000017500000000267713640201473015656 00000000000000/*********************************************************** Copyright 2014 Jon TURNEY 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. ******************************************************************/ #ifndef NONSDK_EXT_INIT_H #define NONSDK_EXT_INIT_H /* this is separate from extinit.h to avoid references to these symbols being pulled in by sdksyms */ extern _X_EXPORT Bool noPseudoramiXExtension; extern void PseudoramiXExtensionInit(void); #endif xorg-server-1.20.8/include/resource.h0000644000175000017500000002472713640201473014445 00000000000000/*********************************************************** Copyright 1987, 1989, 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, 1989 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 RESOURCE_H #define RESOURCE_H 1 #include "misc.h" #include "dixaccess.h" /***************************************************************** * STUFF FOR RESOURCES *****************************************************************/ /* classes for Resource routines */ typedef uint32_t RESTYPE; #define RC_VANILLA ((RESTYPE)0) #define RC_CACHED ((RESTYPE)1<<31) #define RC_DRAWABLE ((RESTYPE)1<<30) /* Use class RC_NEVERRETAIN for resources that should not be retained * regardless of the close down mode when the client dies. (A client's * event selections on objects that it doesn't own are good candidates.) * Extensions can use this too! */ #define RC_NEVERRETAIN ((RESTYPE)1<<29) #define RC_LASTPREDEF RC_NEVERRETAIN #define RC_ANY (~(RESTYPE)0) /* types for Resource routines */ #define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE) #define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) #define RT_GC ((RESTYPE)3) #undef RT_FONT #undef RT_CURSOR #define RT_FONT ((RESTYPE)4) #define RT_CURSOR ((RESTYPE)5) #define RT_COLORMAP ((RESTYPE)6) #define RT_CMAPENTRY ((RESTYPE)7) #define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) #define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) #define RT_LASTPREDEF ((RESTYPE)9) #define RT_NONE ((RESTYPE)0) extern _X_EXPORT unsigned int ResourceClientBits(void); /* bits and fields within a resource id */ #define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */ #define RESOURCE_CLIENT_BITS ResourceClientBits() /* client field offset */ #define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS) /* resource field */ #define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1) /* client field */ #define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET) /* extract the client mask from an XID */ #define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK) /* extract the client id from an XID */ #define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET)) #define SERVER_BIT (Mask)0x40000000 /* use illegal bit */ #ifdef INVALID #undef INVALID /* needed on HP/UX */ #endif /* Invalid resource id */ #define INVALID (0) #define BAD_RESOURCE 0xe0000000 #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) /* Resource state callback */ extern _X_EXPORT CallbackListPtr ResourceStateCallback; typedef enum { ResourceStateAdding, ResourceStateFreeing } ResourceState; typedef struct { ResourceState state; XID id; RESTYPE type; void *value; } ResourceStateInfoRec; typedef int (*DeleteType) (void *value, XID id); typedef void (*FindResType) (void *value, XID id, void *cdata); typedef void (*FindAllRes) (void *value, XID id, RESTYPE type, void *cdata); typedef Bool (*FindComplexResType) (void *value, XID id, void *cdata); /* Structure for estimating resource memory usage. Memory usage * consists of space allocated for the resource itself and of * references to other resources. Currently the most important use for * this structure is to estimate pixmap usage of different resources * more accurately. */ typedef struct { /* Size of resource itself. Zero if not implemented. */ unsigned long resourceSize; /* Size attributed to pixmap references from the resource. */ unsigned long pixmapRefSize; /* Number of references to this resource; typically 1 */ unsigned long refCnt; } ResourceSizeRec, *ResourceSizePtr; typedef void (*SizeType)(void *value, XID id, ResourceSizePtr size); extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType deleteFunc, const char *name); typedef void (*FindTypeSubResources)(void *value, FindAllRes func, void *cdata); extern _X_EXPORT SizeType GetResourceTypeSizeFunc( RESTYPE /*type*/); extern _X_EXPORT void SetResourceTypeFindSubResFunc( RESTYPE /*type*/, FindTypeSubResources /*findFunc*/); extern _X_EXPORT void SetResourceTypeSizeFunc( RESTYPE /*type*/, SizeType /*sizeFunc*/); extern _X_EXPORT void SetResourceTypeErrorValue( RESTYPE /*type*/, int /*errorValue*/); extern _X_EXPORT RESTYPE CreateNewResourceClass(void); extern _X_EXPORT Bool InitClientResources(ClientPtr /*client */ ); extern _X_EXPORT XID FakeClientID(int /*client */ ); /* Quartz support on Mac OS X uses the CarbonCore framework whose AddResource function conflicts here. */ #ifdef __APPLE__ #define AddResource Darwin_X_AddResource #endif extern _X_EXPORT Bool AddResource(XID id, RESTYPE type, void *value); extern _X_EXPORT void FreeResource(XID /*id */ , RESTYPE /*skipDeleteFuncType */ ); extern _X_EXPORT void FreeResourceByType(XID /*id */ , RESTYPE /*type */ , Bool /*skipFree */ ); extern _X_EXPORT Bool ChangeResourceValue(XID id, RESTYPE rtype, void *value); extern _X_EXPORT void FindClientResourcesByType(ClientPtr client, RESTYPE type, FindResType func, void *cdata); extern _X_EXPORT void FindAllClientResources(ClientPtr client, FindAllRes func, void *cdata); /** @brief Iterate through all subresources of a resource. @note The XID argument provided to the FindAllRes function may be 0 for subresources that don't have an XID */ extern _X_EXPORT void FindSubResources(void *resource, RESTYPE type, FindAllRes func, void *cdata); extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ ); extern _X_EXPORT void FreeClientResources(ClientPtr /*client */ ); extern _X_EXPORT void FreeAllResources(void); extern _X_EXPORT Bool LegalNewID(XID /*id */ , ClientPtr /*client */ ); extern _X_EXPORT void *LookupClientResourceComplex(ClientPtr client, RESTYPE type, FindComplexResType func, void *cdata); extern _X_EXPORT int dixLookupResourceByType(void **result, XID id, RESTYPE rtype, ClientPtr client, Mask access_mode); extern _X_EXPORT int dixLookupResourceByClass(void **result, XID id, RESTYPE rclass, ClientPtr client, Mask access_mode); extern _X_EXPORT void GetXIDRange(int /*client */ , Bool /*server */ , XID * /*minp */ , XID * /*maxp */ ); extern _X_EXPORT unsigned int GetXIDList(ClientPtr /*client */ , unsigned int /*count */ , XID * /*pids */ ); extern _X_EXPORT RESTYPE lastResourceType; extern _X_EXPORT RESTYPE TypeMask; /** @brief A hashing function to be used for hashing resource IDs @param id The resource ID to hash @param numBits The number of bits in the resulting hash. Must be >=0. @note This function is really only for handling INITHASHSIZE..MAXHASHSIZE bit hashes, but will handle any number of bits by either masking numBits lower bits of the ID or by providing at most MAXHASHSIZE hashes. */ extern _X_EXPORT int HashResourceID(XID id, int numBits); #endif /* RESOURCE_H */ xorg-server-1.20.8/include/pixmapstr.h0000644000175000017500000001034313640201473014632 00000000000000/*********************************************************** 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 PIXMAPSTRUCT_H #define PIXMAPSTRUCT_H #include "pixmap.h" #include "screenint.h" #include "regionstr.h" #include "privates.h" #include "damage.h" #include #include "picturestr.h" typedef struct _Drawable { unsigned char type; /* DRAWABLE_ */ unsigned char class; /* specific to type */ unsigned char depth; unsigned char bitsPerPixel; XID id; /* resource id */ short x; /* window: screen absolute, pixmap: 0 */ short y; /* window: screen absolute, pixmap: 0 */ unsigned short width; unsigned short height; ScreenPtr pScreen; unsigned long serialNumber; } DrawableRec; /* * PIXMAP -- device dependent */ typedef struct _Pixmap { DrawableRec drawable; PrivateRec *devPrivates; int refcnt; int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */ DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */ #ifdef COMPOSITE short screen_x; short screen_y; #endif unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ PixmapPtr master_pixmap; /* pointer to master copy of pixmap for pixmap sharing */ } PixmapRec; typedef struct _PixmapDirtyUpdate { DrawablePtr src; /* Root window / shared pixmap */ PixmapPtr slave_dst; /* Shared / scanout pixmap */ int x, y; DamagePtr damage; struct xorg_list ent; int dst_x, dst_y; Rotation rotation; PictTransform transform; struct pixman_f_transform f_transform, f_inverse; } PixmapDirtyUpdateRec; static inline void PixmapBox(BoxPtr box, PixmapPtr pixmap) { box->x1 = 0; box->x2 = pixmap->drawable.width; box->y1 = 0; box->y2 = pixmap->drawable.height; } static inline void PixmapRegionInit(RegionPtr region, PixmapPtr pixmap) { BoxRec box; PixmapBox(&box, pixmap); RegionInit(region, &box, 1); } #endif /* PIXMAPSTRUCT_H */ xorg-server-1.20.8/include/displaymode.h0000644000175000017500000000776213640201473015130 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _DISMODEPROC_H_ #define _DISMODEPROC_H_ #include "scrnintstr.h" #define MAXCLOCKS 128 /* These are possible return values for xf86CheckMode() and ValidMode() */ typedef enum { MODE_OK = 0, /* Mode OK */ MODE_HSYNC, /* hsync out of range */ MODE_VSYNC, /* vsync out of range */ MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ MODE_BAD_WIDTH, /* requires an unsupported linepitch */ MODE_NOMODE, /* no mode with a matching name */ MODE_NO_INTERLACE, /* interlaced mode not supported */ MODE_NO_DBLESCAN, /* doublescan mode not supported */ MODE_NO_VSCAN, /* multiscan mode not supported */ MODE_MEM, /* insufficient video memory */ MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ MODE_MEM_VIRT, /* insufficient video memory given virtual size */ MODE_NOCLOCK, /* no fixed clock available */ MODE_CLOCK_HIGH, /* clock required is too high */ MODE_CLOCK_LOW, /* clock required is too low */ MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ MODE_BAD_HVALUE, /* horizontal timing was out of range */ MODE_BAD_VVALUE, /* vertical timing was out of range */ MODE_BAD_VSCAN, /* VScan value out of range */ MODE_HSYNC_NARROW, /* horizontal sync too narrow */ MODE_HSYNC_WIDE, /* horizontal sync too wide */ MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ MODE_HBLANK_WIDE, /* horizontal blanking too wide */ MODE_VSYNC_NARROW, /* vertical sync too narrow */ MODE_VSYNC_WIDE, /* vertical sync too wide */ MODE_VBLANK_NARROW, /* vertical blanking too narrow */ MODE_VBLANK_WIDE, /* vertical blanking too wide */ MODE_PANEL, /* exceeds panel dimensions */ MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ MODE_ONE_WIDTH, /* only one width is supported */ MODE_ONE_HEIGHT, /* only one height is supported */ MODE_ONE_SIZE, /* only one resolution is supported */ MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ MODE_BANDWIDTH, /* mode requires too much memory bandwidth */ MODE_BAD = -2, /* unspecified reason */ MODE_ERROR = -1 /* error condition */ } ModeStatus; /* Video mode */ typedef struct _DisplayModeRec { struct _DisplayModeRec *prev; struct _DisplayModeRec *next; const char *name; /* identifier for the mode */ ModeStatus status; int type; /* These are the values that the user sees/provides */ int Clock; /* pixel clock freq (kHz) */ int HDisplay; /* horizontal timing */ int HSyncStart; int HSyncEnd; int HTotal; int HSkew; int VDisplay; /* vertical timing */ int VSyncStart; int VSyncEnd; int VTotal; int VScan; int Flags; /* These are the values the hardware uses */ int ClockIndex; int SynthClock; /* Actual clock freq to * be programmed (kHz) */ int CrtcHDisplay; int CrtcHBlankStart; int CrtcHSyncStart; int CrtcHSyncEnd; int CrtcHBlankEnd; int CrtcHTotal; int CrtcHSkew; int CrtcVDisplay; int CrtcVBlankStart; int CrtcVSyncStart; int CrtcVSyncEnd; int CrtcVBlankEnd; int CrtcVTotal; Bool CrtcHAdjusted; Bool CrtcVAdjusted; int PrivSize; INT32 *Private; int PrivFlags; float HSync, VRefresh; } DisplayModeRec, *DisplayModePtr; #endif xorg-server-1.20.8/include/xsha1.h0000644000175000017500000000067013640201473013631 00000000000000#ifndef XSHA1_H #define XSHA1_H /* Initialize SHA1 computation. Returns NULL on error. */ void *x_sha1_init(void); /* * Add some data to be hashed. ctx is the value returned by x_sha1_init() * Returns 0 on error, 1 on success. */ int x_sha1_update(void *ctx, void *data, int size); /* * Place the hash in result, and free ctx. * Returns 0 on error, 1 on success. */ int x_sha1_final(void *ctx, unsigned char result[20]); #endif xorg-server-1.20.8/include/propertyst.h0000644000175000017500000000546313640201473015045 00000000000000/*********************************************************** 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 PROPERTYSTRUCT_H #define PROPERTYSTRUCT_H #include "misc.h" #include "property.h" #include "privates.h" /* * PROPERTY -- property element */ typedef struct _Property { struct _Property *next; ATOM propertyName; ATOM type; /* ignored by server */ uint32_t format; /* format of data for swapping - 8,16,32 */ uint32_t size; /* size of data in (format/8) bytes */ void *data; /* private to client */ PrivateRec *devPrivates; } PropertyRec; #endif /* PROPERTYSTRUCT_H */ xorg-server-1.20.8/include/swapreq.h0000644000175000017500000000722213640201473014267 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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 SWAPREQ_H #define SWAPREQ_H 1 extern void SwapColorItem(xColorItem * /* pItem */ ); extern void SwapConnClientPrefix(xConnClientPrefix * /* pCCP */ ); #undef SWAPREQ_PROC #define SWAPREQ_PROC(func) extern int func(ClientPtr /* client */) SWAPREQ_PROC(SProcAllocColor); SWAPREQ_PROC(SProcAllocColorCells); SWAPREQ_PROC(SProcAllocColorPlanes); SWAPREQ_PROC(SProcAllocNamedColor); SWAPREQ_PROC(SProcChangeActivePointerGrab); SWAPREQ_PROC(SProcChangeGC); SWAPREQ_PROC(SProcChangeHosts); SWAPREQ_PROC(SProcChangeKeyboardControl); SWAPREQ_PROC(SProcChangeKeyboardMapping); SWAPREQ_PROC(SProcChangePointerControl); SWAPREQ_PROC(SProcChangeProperty); SWAPREQ_PROC(SProcChangeWindowAttributes); SWAPREQ_PROC(SProcClearToBackground); SWAPREQ_PROC(SProcConfigureWindow); SWAPREQ_PROC(SProcConvertSelection); SWAPREQ_PROC(SProcCopyArea); SWAPREQ_PROC(SProcCopyColormapAndFree); SWAPREQ_PROC(SProcCopyGC); SWAPREQ_PROC(SProcCopyPlane); SWAPREQ_PROC(SProcCreateColormap); SWAPREQ_PROC(SProcCreateCursor); SWAPREQ_PROC(SProcCreateGC); SWAPREQ_PROC(SProcCreateGlyphCursor); SWAPREQ_PROC(SProcCreatePixmap); SWAPREQ_PROC(SProcCreateWindow); SWAPREQ_PROC(SProcDeleteProperty); SWAPREQ_PROC(SProcFillPoly); SWAPREQ_PROC(SProcFreeColors); SWAPREQ_PROC(SProcGetImage); SWAPREQ_PROC(SProcGetMotionEvents); SWAPREQ_PROC(SProcGetProperty); SWAPREQ_PROC(SProcGrabButton); SWAPREQ_PROC(SProcGrabKey); SWAPREQ_PROC(SProcGrabKeyboard); SWAPREQ_PROC(SProcGrabPointer); SWAPREQ_PROC(SProcImageText); SWAPREQ_PROC(SProcInternAtom); SWAPREQ_PROC(SProcListFonts); SWAPREQ_PROC(SProcListFontsWithInfo); SWAPREQ_PROC(SProcLookupColor); SWAPREQ_PROC(SProcNoOperation); SWAPREQ_PROC(SProcOpenFont); SWAPREQ_PROC(SProcPoly); SWAPREQ_PROC(SProcPolyText); SWAPREQ_PROC(SProcPutImage); SWAPREQ_PROC(SProcQueryBestSize); SWAPREQ_PROC(SProcQueryColors); SWAPREQ_PROC(SProcQueryExtension); SWAPREQ_PROC(SProcRecolorCursor); SWAPREQ_PROC(SProcReparentWindow); SWAPREQ_PROC(SProcResourceReq); SWAPREQ_PROC(SProcRotateProperties); SWAPREQ_PROC(SProcSendEvent); SWAPREQ_PROC(SProcSetClipRectangles); SWAPREQ_PROC(SProcSetDashes); SWAPREQ_PROC(SProcSetFontPath); SWAPREQ_PROC(SProcSetInputFocus); SWAPREQ_PROC(SProcSetScreenSaver); SWAPREQ_PROC(SProcSetSelectionOwner); SWAPREQ_PROC(SProcSimpleReq); SWAPREQ_PROC(SProcStoreColors); SWAPREQ_PROC(SProcStoreNamedColor); SWAPREQ_PROC(SProcTranslateCoords); SWAPREQ_PROC(SProcUngrabButton); SWAPREQ_PROC(SProcUngrabKey); SWAPREQ_PROC(SProcWarpPointer); #undef SWAPREQ_PROC #endif /* SWAPREQ_H */ xorg-server-1.20.8/include/busfault.h0000644000175000017500000000311013640201473014422 00000000000000/* * Copyright © 2013 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 _BUSFAULT_H_ #define _BUSFAULT_H_ #include #ifdef BUSFAULT #include typedef void (*busfault_notify_ptr) (void *context); struct busfault * busfault_register_mmap(void *addr, size_t size, busfault_notify_ptr notify, void *context); void busfault_unregister(struct busfault *busfault); void busfault_check(void); Bool busfault_init(void); #endif #endif /* _BUSFAULT_H_ */ xorg-server-1.20.8/include/closure.h0000644000175000017500000000501513640201473014257 00000000000000/*********************************************************** 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 CLOSURE_H #define CLOSURE_H 1 typedef struct _LFclosure *LFclosurePtr; typedef struct _LFWIclosure *LFWIclosurePtr; typedef struct _OFclosure *OFclosurePtr; typedef struct _PTclosure *PTclosurePtr; typedef struct _ITclosure *ITclosurePtr; #endif /* CLOSURE_H */ xorg-server-1.20.8/include/colormap.h0000644000175000017500000001457313640201473014430 00000000000000/* 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 CMAP_H #define CMAP_H 1 #include #include "screenint.h" #include "window.h" /* these follow X.h's AllocNone and AllocAll */ #define CM_PSCREEN 2 #define CM_PWIN 3 /* Passed internally in colormap.c */ #define REDMAP 0 #define GREENMAP 1 #define BLUEMAP 2 #define PSEUDOMAP 3 #define AllocPrivate (-1) #define AllocTemporary (-2) #define DynamicClass 1 /* Values for the flags field of a colormap. These should have 1 bit set * and not overlap */ #define IsDefault 1 #define AllAllocated 2 #define BeingCreated 4 typedef CARD32 Pixel; typedef struct _CMEntry *EntryPtr; /* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */ typedef struct _colorResource *colorResourcePtr; extern _X_EXPORT int CreateColormap(Colormap /*mid */ , ScreenPtr /*pScreen */ , VisualPtr /*pVisual */ , ColormapPtr * /*ppcmap */ , int /*alloc */ , int /*client */ ); extern _X_EXPORT int FreeColormap(void *pmap, XID mid); extern _X_EXPORT int TellLostMap(WindowPtr pwin, void *value); extern _X_EXPORT int TellGainedMap(WindowPtr pwin, void *value); extern _X_EXPORT int CopyColormapAndFree(Colormap /*mid */ , ColormapPtr /*pSrc */ , int /*client */ ); extern _X_EXPORT int AllocColor(ColormapPtr /*pmap */ , unsigned short * /*pred */ , unsigned short * /*pgreen */ , unsigned short * /*pblue */ , Pixel * /*pPix */ , int /*client */ ); extern _X_EXPORT void FakeAllocColor(ColormapPtr /*pmap */ , xColorItem * /*item */ ); extern _X_EXPORT void FakeFreeColor(ColormapPtr /*pmap */ , Pixel /*pixel */ ); extern _X_EXPORT int QueryColors(ColormapPtr /*pmap */ , int /*count */ , Pixel * /*ppixIn */ , xrgb * /*prgbList */ , ClientPtr client); extern _X_EXPORT int FreeClientPixels(void *pcr, XID fakeid); extern _X_EXPORT int AllocColorCells(int /*client */ , ColormapPtr /*pmap */ , int /*colors */ , int /*planes */ , Bool /*contig */ , Pixel * /*ppix */ , Pixel * /*masks */ ); extern _X_EXPORT int AllocColorPlanes(int /*client */ , ColormapPtr /*pmap */ , int /*colors */ , int /*r */ , int /*g */ , int /*b */ , Bool /*contig */ , Pixel * /*pixels */ , Pixel * /*prmask */ , Pixel * /*pgmask */ , Pixel * /*pbmask */ ); extern _X_EXPORT int FreeColors(ColormapPtr /*pmap */ , int /*client */ , int /*count */ , Pixel * /*pixels */ , Pixel /*mask */ ); extern _X_EXPORT int StoreColors(ColormapPtr /*pmap */ , int /*count */ , xColorItem * /*defs */ , ClientPtr client); extern _X_EXPORT int IsMapInstalled(Colormap /*map */ , WindowPtr /*pWin */ ); extern _X_EXPORT Bool ResizeVisualArray(ScreenPtr /* pScreen */ , int /* new_vis_count */ , DepthPtr /* depth */ ); #endif /* CMAP_H */ xorg-server-1.20.8/include/screenint.h0000644000175000017500000000737013640201473014603 00000000000000/*********************************************************** 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 SCREENINT_H #define SCREENINT_H #include "misc.h" typedef struct _PixmapFormat *PixmapFormatPtr; typedef struct _Visual *VisualPtr; typedef struct _Depth *DepthPtr; typedef struct _Screen *ScreenPtr; extern _X_EXPORT int AddScreen(Bool (* /*pfnInit */ )( ScreenPtr /*pScreen */ , int /*argc */ , char ** /*argv */ ), int /*argc */ , char ** /*argv */ ); extern _X_EXPORT int AddGPUScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ , int /*argc */ , char ** /*argv */ ), int argc, char **argv); extern _X_EXPORT void RemoveGPUScreen(ScreenPtr pScreen); extern _X_EXPORT void AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr newScreen); extern _X_EXPORT void DetachUnboundGPU(ScreenPtr unbound); extern _X_EXPORT void AttachOutputGPU(ScreenPtr pScreen, ScreenPtr newScreen); extern _X_EXPORT void DetachOutputGPU(ScreenPtr output); extern _X_EXPORT void AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr newScreen); extern _X_EXPORT void DetachOffloadGPU(ScreenPtr slave); typedef struct _ColormapRec *ColormapPtr; #endif /* SCREENINT_H */ xorg-server-1.20.8/include/xwin-config.h.meson.in0000644000175000017500000000102613640201473016556 00000000000000/* * xwin-config.h.in * * This file has all defines used in the xwin ddx * */ #include /* Winsock networking */ #mesondefine HAS_WINSOCK /* Cygwin has /dev/windows for signaling new win32 messages */ #mesondefine HAS_DEVWINDOWS /* Switch on debug messages */ #mesondefine CYGDEBUG #mesondefine CYGWINDOWING_DEBUG #mesondefine CYGMULTIWINDOW_DEBUG /* Default log location */ #mesondefine DEFAULT_LOGDIR /* Whether we should re-locate the root to where the executable lives */ #mesondefine RELOCATE_PROJECTROOT xorg-server-1.20.8/include/xorg-config.h.in0000644000175000017500000000632513640201473015437 00000000000000/* xorg-config.h.in: not at all generated. -*- c -*- * * This file differs from xorg-server.h.in in that -server is installed * with the rest of the SDK for external drivers/modules to use, whereas * -config is for internal use only (i.e. building the DDX). * */ #ifndef _XORG_CONFIG_H_ #define _XORG_CONFIG_H_ #include #include /* Building Xorg server. */ #undef XORGSERVER /* Current X.Org version. */ #undef XORG_VERSION_CURRENT /* Name of X server. */ #undef __XSERVERNAME__ /* URL to go to for support. */ #undef __VENDORDWEBSUPPORT__ /* Built-in output drivers. */ #undef DRIVERS /* Built-in input drivers. */ #undef IDRIVERS /* Path to configuration file. */ #undef XF86CONFIGFILE /* Path to configuration file. */ #undef XCONFIGFILE /* Name of configuration directory. */ #undef XCONFIGDIR /* Path to loadable modules. */ #undef DEFAULT_MODULE_PATH /* Path to installed libraries. */ #undef DEFAULT_LIBRARY_PATH /* Default log location */ #undef DEFAULT_LOGDIR /* Default logfile prefix */ #undef DEFAULT_LOGPREFIX /* Default XDG_DATA dir under HOME */ #undef DEFAULT_XDG_DATA_HOME /* Default log dir under XDG_DATA_HOME */ #undef DEFAULT_XDG_DATA_HOME_LOGDIR /* Building DRI-capable DDX. */ #undef XF86DRI /* Build DRI2 extension */ #undef DRI2 /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_KD_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VT_H /* Define to 1 if you have the `walkcontext' function (used on Solaris for xorg_backtrace in hw/xfree86/common/xf86Events.c */ #undef HAVE_WALKCONTEXT /* Define to 1 if unsigned long is 64 bits. */ #undef _XSERVER64 /* Building vgahw module */ #undef WITH_VGAHW /* NetBSD PIO alpha IO */ #undef USE_ALPHA_PIO /* BSD AMD64 iopl */ #undef USE_AMD64_IOPL /* BSD /dev/io */ #undef USE_DEV_IO /* BSD i386 iopl */ #undef USE_I386_IOPL /* System is BSD-like */ #undef CSRG_BASED /* System has PC console */ #undef PCCONS_SUPPORT /* System has PCVT console */ #undef PCVT_SUPPORT /* System has syscons console */ #undef SYSCONS_SUPPORT /* System has wscons console */ #undef WSCONS_SUPPORT /* System has /dev/xf86 aperture driver */ #undef HAS_APERTURE_DRV /* Has backtrace support */ #undef HAVE_BACKTRACE /* Name of the period field in struct kbd_repeat */ #undef LNX_KBD_PERIOD_NAME /* Have execinfo.h */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MKDEV_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSMACROS_H /* Path to text files containing PCI IDs */ #undef PCI_TXT_IDS_PATH /* Build with libdrm support */ #undef WITH_LIBDRM /* Use libpciaccess */ #undef XSERVER_LIBPCIACCESS /* Have setugid */ #undef HAVE_ISSETUGID /* Have getresuid */ #undef HAVE_GETRESUID /* Have X server platform bus support */ #undef XSERVER_PLATFORM_BUS /* Define to 1 if you have the `seteuid' function. */ #undef HAVE_SETEUID /* Support APM/ACPI power management in the server */ #undef XF86PM /* Fallback input driver if the assigned driver fails */ #undef FALLBACK_INPUT_DRIVER #endif /* _XORG_CONFIG_H_ */ xorg-server-1.20.8/include/vidmodestr.h0000644000175000017500000001610513640201473014765 00000000000000#ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _VIDMODEPROC_H_ #define _VIDMODEPROC_H_ #include "displaymode.h" typedef enum { VIDMODE_H_DISPLAY, VIDMODE_H_SYNCSTART, VIDMODE_H_SYNCEND, VIDMODE_H_TOTAL, VIDMODE_H_SKEW, VIDMODE_V_DISPLAY, VIDMODE_V_SYNCSTART, VIDMODE_V_SYNCEND, VIDMODE_V_TOTAL, VIDMODE_FLAGS, VIDMODE_CLOCK } VidModeSelectMode; typedef enum { VIDMODE_MON_VENDOR, VIDMODE_MON_MODEL, VIDMODE_MON_NHSYNC, VIDMODE_MON_NVREFRESH, VIDMODE_MON_HSYNC_LO, VIDMODE_MON_HSYNC_HI, VIDMODE_MON_VREFRESH_LO, VIDMODE_MON_VREFRESH_HI } VidModeSelectMonitor; typedef union { const void *ptr; int i; float f; } vidMonitorValue; typedef Bool (*VidModeExtensionInitProcPtr) (ScreenPtr pScreen); typedef vidMonitorValue (*VidModeGetMonitorValueProcPtr) (ScreenPtr pScreen, int valtyp, int indx); typedef Bool (*VidModeGetEnabledProcPtr) (void); typedef Bool (*VidModeGetAllowNonLocalProcPtr) (void); typedef Bool (*VidModeGetCurrentModelineProcPtr) (ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock); typedef Bool (*VidModeGetFirstModelineProcPtr) (ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock); typedef Bool (*VidModeGetNextModelineProcPtr) (ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock); typedef Bool (*VidModeDeleteModelineProcPtr) (ScreenPtr pScreen, DisplayModePtr mode); typedef Bool (*VidModeZoomViewportProcPtr) (ScreenPtr pScreen, int zoom); typedef Bool (*VidModeGetViewPortProcPtr) (ScreenPtr pScreen, int *x, int *y); typedef Bool (*VidModeSetViewPortProcPtr) (ScreenPtr pScreen, int x, int y); typedef Bool (*VidModeSwitchModeProcPtr) (ScreenPtr pScreen, DisplayModePtr mode); typedef Bool (*VidModeLockZoomProcPtr) (ScreenPtr pScreen, Bool lock); typedef int (*VidModeGetNumOfClocksProcPtr) (ScreenPtr pScreen, Bool *progClock); typedef Bool (*VidModeGetClocksProcPtr) (ScreenPtr pScreen, int *Clocks); typedef ModeStatus (*VidModeCheckModeForMonitorProcPtr) (ScreenPtr pScreen, DisplayModePtr mode); typedef ModeStatus (*VidModeCheckModeForDriverProcPtr) (ScreenPtr pScreen, DisplayModePtr mode); typedef void (*VidModeSetCrtcForModeProcPtr) (ScreenPtr pScreen, DisplayModePtr mode); typedef Bool (*VidModeAddModelineProcPtr) (ScreenPtr pScreen, DisplayModePtr mode); typedef int (*VidModeGetDotClockProcPtr) (ScreenPtr pScreen, int Clock); typedef int (*VidModeGetNumOfModesProcPtr) (ScreenPtr pScreen); typedef Bool (*VidModeSetGammaProcPtr) (ScreenPtr pScreen, float red, float green, float blue); typedef Bool (*VidModeGetGammaProcPtr) (ScreenPtr pScreen, float *red, float *green, float *blue); typedef Bool (*VidModeSetGammaRampProcPtr) (ScreenPtr pScreen, int size, CARD16 *red, CARD16 *green, CARD16 *blue); typedef Bool (*VidModeGetGammaRampProcPtr) (ScreenPtr pScreen, int size, CARD16 *red, CARD16 *green, CARD16 *blue); typedef int (*VidModeGetGammaRampSizeProcPtr) (ScreenPtr pScreen); typedef struct { DisplayModePtr First; DisplayModePtr Next; int Flags; VidModeExtensionInitProcPtr ExtensionInit; VidModeGetMonitorValueProcPtr GetMonitorValue; VidModeGetCurrentModelineProcPtr GetCurrentModeline; VidModeGetFirstModelineProcPtr GetFirstModeline; VidModeGetNextModelineProcPtr GetNextModeline; VidModeDeleteModelineProcPtr DeleteModeline; VidModeZoomViewportProcPtr ZoomViewport; VidModeGetViewPortProcPtr GetViewPort; VidModeSetViewPortProcPtr SetViewPort; VidModeSwitchModeProcPtr SwitchMode; VidModeLockZoomProcPtr LockZoom; VidModeGetNumOfClocksProcPtr GetNumOfClocks; VidModeGetClocksProcPtr GetClocks; VidModeCheckModeForMonitorProcPtr CheckModeForMonitor; VidModeCheckModeForDriverProcPtr CheckModeForDriver; VidModeSetCrtcForModeProcPtr SetCrtcForMode; VidModeAddModelineProcPtr AddModeline; VidModeGetDotClockProcPtr GetDotClock; VidModeGetNumOfModesProcPtr GetNumOfModes; VidModeSetGammaProcPtr SetGamma; VidModeGetGammaProcPtr GetGamma; VidModeSetGammaRampProcPtr SetGammaRamp; VidModeGetGammaRampProcPtr GetGammaRamp; VidModeGetGammaRampSizeProcPtr GetGammaRampSize; } VidModeRec, *VidModePtr; #ifdef XF86VIDMODE void VidModeAddExtension(Bool allow_non_local); VidModePtr VidModeGetPtr(ScreenPtr pScreen); VidModePtr VidModeInit(ScreenPtr pScreen); #endif /* XF86VIDMODE */ #endif xorg-server-1.20.8/include/exevents.h0000644000175000017500000002617413640201473014455 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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. ********************************************************/ /******************************************************************** * Interface of 'exevents.c' */ #ifndef EXEVENTS_H #define EXEVENTS_H #include #include "inputstr.h" /*************************************************************** * Interface available to drivers * ***************************************************************/ /** * Scroll flags for ::SetScrollValuator. */ enum ScrollFlags { SCROLL_FLAG_NONE = 0, /** * Do not emulate legacy button events for valuator events on this axis. */ SCROLL_FLAG_DONT_EMULATE = (1 << 1), /** * This axis is the preferred axis for valuator emulation for this axis' * scroll type. */ SCROLL_FLAG_PREFERRED = (1 << 2) }; extern _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr /* dev */ ); extern _X_EXPORT Bool InitValuatorAxisStruct(DeviceIntPtr /* dev */ , int /* axnum */ , Atom /* label */ , int /* minval */ , int /* maxval */ , int /* resolution */ , int /* min_res */ , int /* max_res */ , int /* mode */ ); extern _X_EXPORT Bool SetScrollValuator(DeviceIntPtr /* dev */ , int /* axnum */ , enum ScrollType /* type */ , double /* increment */ , int /* flags */ ); /* Input device properties */ extern _X_EXPORT void XIDeleteAllDeviceProperties(DeviceIntPtr /* device */ ); extern _X_EXPORT int XIDeleteDeviceProperty(DeviceIntPtr /* device */ , Atom /* property */ , Bool /* fromClient */ ); extern _X_EXPORT int XIChangeDeviceProperty(DeviceIntPtr /* dev */ , Atom /* property */ , Atom /* type */ , int /* format */ , int /* mode */ , unsigned long /* len */ , const void * /* value */ , Bool /* sendevent */ ); extern _X_EXPORT int XIGetDeviceProperty(DeviceIntPtr /* dev */ , Atom /* property */ , XIPropertyValuePtr * /* value */ ); extern _X_EXPORT int XISetDevicePropertyDeletable(DeviceIntPtr /* dev */ , Atom /* property */ , Bool /* deletable */ ); extern _X_EXPORT long XIRegisterPropertyHandler(DeviceIntPtr dev, int (*SetProperty) (DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly), int (*GetProperty) (DeviceIntPtr dev, Atom property), int (*DeleteProperty) (DeviceIntPtr dev, Atom property) ); extern _X_EXPORT void XIUnregisterPropertyHandler(DeviceIntPtr dev, long id); extern _X_EXPORT Atom XIGetKnownProperty(const char *name); extern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev); extern _X_EXPORT int XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return); extern _X_EXPORT int XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return); /**************************************************************************** * End of driver interface * ****************************************************************************/ /** * Attached to the devPrivates of each client. Specifies the version number as * supported by the client. */ typedef struct _XIClientRec { int major_version; int minor_version; } XIClientRec, *XIClientPtr; typedef struct _GrabParameters { int grabtype; /* CORE, etc. */ unsigned int ownerEvents; unsigned int this_device_mode; unsigned int other_devices_mode; Window grabWindow; Window confineTo; Cursor cursor; unsigned int modifiers; } GrabParameters; extern int UpdateDeviceState(DeviceIntPtr /* device */ , DeviceEvent * /* xE */ ); extern void ProcessOtherEvent(InternalEvent * /* ev */ , DeviceIntPtr /* other */ ); extern int CheckGrabValues(ClientPtr /* client */ , GrabParameters * /* param */ ); extern int GrabButton(ClientPtr /* client */ , DeviceIntPtr /* dev */ , DeviceIntPtr /* modifier_device */ , int /* button */ , GrabParameters * /* param */ , enum InputLevel /* grabtype */ , GrabMask * /* eventMask */ ); extern int GrabKey(ClientPtr /* client */ , DeviceIntPtr /* dev */ , DeviceIntPtr /* modifier_device */ , int /* key */ , GrabParameters * /* param */ , enum InputLevel /* grabtype */ , GrabMask * /* eventMask */ ); extern int GrabWindow(ClientPtr /* client */ , DeviceIntPtr /* dev */ , int /* type */ , GrabParameters * /* param */ , GrabMask * /* eventMask */ ); extern int GrabTouch(ClientPtr /* client */ , DeviceIntPtr /* dev */ , DeviceIntPtr /* mod_dev */ , GrabParameters * /* param */ , GrabMask * /* eventMask */ ); extern int SelectForWindow(DeviceIntPtr /* dev */ , WindowPtr /* pWin */ , ClientPtr /* client */ , Mask /* mask */ , Mask /* exclusivemasks */ ); extern int AddExtensionClient(WindowPtr /* pWin */ , ClientPtr /* client */ , Mask /* mask */ , int /* mskidx */ ); extern void RecalculateDeviceDeliverableEvents(WindowPtr /* pWin */ ); extern int InputClientGone(WindowPtr /* pWin */ , XID /* id */ ); extern void WindowGone(WindowPtr /* win */ ); extern int SendEvent(ClientPtr /* client */ , DeviceIntPtr /* d */ , Window /* dest */ , Bool /* propagate */ , xEvent * /* ev */ , Mask /* mask */ , int /* count */ ); extern int SetButtonMapping(ClientPtr /* client */ , DeviceIntPtr /* dev */ , int /* nElts */ , BYTE * /* map */ ); extern int ChangeKeyMapping(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned /* len */ , int /* type */ , KeyCode /* firstKeyCode */ , CARD8 /* keyCodes */ , CARD8 /* keySymsPerKeyCode */ , KeySym * /* map */ ); extern void DeleteWindowFromAnyExtEvents(WindowPtr /* pWin */ , Bool /* freeResources */ ); extern int MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * /* pEvents */ , Mask /* mask */ ); extern void CheckDeviceGrabAndHintWindow(WindowPtr /* pWin */ , int /* type */ , deviceKeyButtonPointer * /* xE */ , GrabPtr /* grab */ , ClientPtr /* client */ , Mask /* deliveryMask */ ); extern void MaybeStopDeviceHint(DeviceIntPtr /* dev */ , ClientPtr /* client */ ); extern int DeviceEventSuppressForWindow(WindowPtr /* pWin */ , ClientPtr /* client */ , Mask /* mask */ , int /* maskndx */ ); extern void SendEventToAllWindows(DeviceIntPtr /* dev */ , Mask /* mask */ , xEvent * /* ev */ , int /* count */ ); extern void TouchRejected(DeviceIntPtr /* sourcedev */ , TouchPointInfoPtr /* ti */ , XID /* resource */ , TouchOwnershipEvent * /* ev */ ); extern _X_HIDDEN void XI2EventSwap(xGenericEvent * /* from */ , xGenericEvent * /* to */ ); /* For an event such as MappingNotify which affects client interpretation * of input events sent by device dev, should we notify the client, or * would it merely be irrelevant and confusing? */ extern int XIShouldNotify(ClientPtr client, DeviceIntPtr dev); extern void XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce); extern int XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, unsigned int len, unsigned char *mask); extern int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len); #endif /* EXEVENTS_H */ xorg-server-1.20.8/include/extnsionst.h0000644000175000017500000000774313640201473015033 00000000000000/*********************************************************** 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 EXTENSIONSTRUCT_H #define EXTENSIONSTRUCT_H #include "dix.h" #include "misc.h" #include "screenint.h" #include "extension.h" #include "gc.h" #include "privates.h" typedef struct _ExtensionEntry { int index; void (*CloseDown) ( /* called at server shutdown */ struct _ExtensionEntry * /* extension */ ); const char *name; /* extension name */ int base; /* base request number */ int eventBase; int eventLast; int errorBase; int errorLast; void *extPrivate; unsigned short (*MinorOpcode) ( /* called for errors */ ClientPtr /* client */ ); PrivateRec *devPrivates; } ExtensionEntry; /* * The arguments may be different for extension event swapping functions. * Deal with this by casting when initializing the event's EventSwapVector[] * entries. */ typedef void (*EventSwapPtr) (xEvent *, xEvent *); extern _X_EXPORT EventSwapPtr EventSwapVector[128]; extern _X_EXPORT void NotImplemented( /* FIXME: this may move to another file... */ xEvent *, xEvent *) _X_NORETURN; extern _X_EXPORT ExtensionEntry * AddExtension(const char * /*name */ , int /*NumEvents */ , int /*NumErrors */ , int (* /*MainProc */ )(ClientPtr /*client */ ), int (* /*SwappedMainProc */ )(ClientPtr /*client */ ), void (* /*CloseDownProc */ )(ExtensionEntry * /*extension */ ), unsigned short (* /*MinorOpcodeProc */ )(ClientPtr /*client */ ) ); extern _X_EXPORT ExtensionEntry * CheckExtension(const char *extname); extern _X_EXPORT ExtensionEntry * GetExtensionEntry(int major); #endif /* EXTENSIONSTRUCT_H */ xorg-server-1.20.8/include/dix-config.h.in0000644000175000017500000002616513640201473015250 00000000000000/* dix-config.h.in: not at all generated. -*- c -*- */ #ifndef _DIX_CONFIG_H_ #define _DIX_CONFIG_H_ /* Support BigRequests extension */ #undef BIGREQS /* Builder address */ #undef BUILDERADDR /* Operating System Name */ #undef OSNAME /* Operating System Vendor */ #undef OSVENDOR /* Builder string */ #undef BUILDERSTRING /* Default font path */ #undef COMPILEDDEFAULTFONTPATH /* Miscellaneous server configuration files path */ #undef SERVER_MISC_CONFIG_PATH /* Support Composite Extension */ #undef COMPOSITE /* Support Damage extension */ #undef DAMAGE /* Use OsVendorVErrorF */ #undef DDXOSVERRORF /* Use ddxBeforeReset */ #undef DDXBEFORERESET /* Build DPMS extension */ #undef DPMSExtension /* Build DRI3 extension */ #undef DRI3 /* Build GLX extension */ #undef GLXEXT /* Build GLX DRI loader */ #undef GLX_DRI /* Path to DRI drivers */ #undef DRI_DRIVER_PATH /* Support XDM-AUTH*-1 */ #undef HASXDMAUTH /* Support SHM */ #undef HAS_SHM /* Has backtrace support */ #undef HAVE_BACKTRACE /* Has libunwind support */ #undef HAVE_LIBUNWIND /* Define to 1 if you have the `cbrt' function. */ #undef HAVE_CBRT /* Define to 1 if you have the declaration of `program_invocation_short_name', and to 0 if you don't. */ #undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Have execinfo.h */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE /* Define to 1 if you have the `getifaddrs' function. */ #undef HAVE_GETIFADDRS /* Define to 1 if you have the `getpeereid' function. */ #undef HAVE_GETPEEREID /* Define to 1 if you have the `getpeerucred' function. */ #undef HAVE_GETPEERUCRED /* Define to 1 if you have the `getprogname' function. */ #undef HAVE_GETPROGNAME /* Define to 1 if you have the `getzoneid' function. */ #undef HAVE_GETZONEID /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Have Quartz */ #undef XQUARTZ /* Support application updating through sparkle. */ #undef XQUARTZ_SPARKLE /* Prefix to use for bundle identifiers */ #undef BUNDLE_ID_PREFIX /* Build a standalone xpbproxy */ #undef STANDALONE_XPBPROXY /* Define to 1 if you have the `bsd' library (-lbsd). */ #undef HAVE_LIBBSD /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the libdispatch (GCD) available */ #undef HAVE_LIBDISPATCH /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_AGPGART_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_APM_BIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FB_H /* Define to 1 if you have the `memfd_create' function. */ #undef HAVE_MEMFD_CREATE /* Define to 1 if you have the `mkostemp' function. */ #undef HAVE_MKOSTEMP /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP /* Define to 1 if you have the function pthread_setname_np(const char*) */ #undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID /* Define to 1 if you have the function pthread_setname_np(pthread_t, const char*) */ #undef HAVE_PTHREAD_SETNAME_NP_WITH_TID /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the `reallocarray' function. */ #undef HAVE_REALLOCARRAY /* Define to 1 if you have the `arc4random_buf' function. */ #undef HAVE_ARC4RANDOM_BUF /* Define to use libc SHA1 functions */ #undef HAVE_SHA1_IN_LIBC /* Define to use CommonCrypto SHA1 functions */ #undef HAVE_SHA1_IN_COMMONCRYPTO /* Define to use CryptoAPI SHA1 functions */ #undef HAVE_SHA1_IN_CRYPTOAPI /* Define to use libmd SHA1 functions */ #undef HAVE_SHA1_IN_LIBMD /* Define to use libgcrypt SHA1 functions */ #undef HAVE_SHA1_IN_LIBGCRYPT /* Define to use libnettle SHA1 functions */ #undef HAVE_SHA1_IN_LIBNETTLE /* Define to use libsha1 for SHA1 */ #undef HAVE_SHA1_IN_LIBSHA1 /* Define to 1 if you have the `shmctl64' function. */ #undef HAVE_SHMCTL64 /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if libsystemd-daemon is available */ #undef HAVE_SYSTEMD_DAEMON /* Define to 1 if SYSV IPC is available */ #undef HAVE_SYSV_IPC /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AGPIO_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UTSNAME_H /* Define to 1 if you have the `timingsafe_memcmp' function. */ #undef HAVE_TIMINGSAFE_MEMCMP /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_FNMATCH_H /* Have /dev/urandom */ #undef HAVE_URANDOM /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Support IPv6 for TCP connections */ #undef IPv6 /* Support os-specific local connections */ #undef LOCALCONN /* Support MIT-SHM Extension */ #undef MITSHM /* Enable some debugging code */ #undef DEBUG /* Name of package */ #undef PACKAGE /* Internal define for Xinerama */ #undef PANORAMIX /* Support Present extension */ #undef PRESENT /* Overall prefix */ #undef PROJECTROOT /* Support RANDR extension */ #undef RANDR /* Support Record extension */ #undef XRECORD /* Support RENDER extension */ #undef RENDER /* Support X resource extension */ #undef RES /* Support client ID tracking in X resource extension */ #undef CLIENTIDS /* Support MIT-SCREEN-SAVER extension */ #undef SCREENSAVER /* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */ #undef SECURE_RPC /* Support SHAPE extension */ #undef SHAPE /* Where to install Xorg.bin and Xorg.wrap */ #undef SUID_WRAPPER_DIR /* Define to 1 on systems derived from System V Release 4 */ #undef SVR4 /* sysconfdir */ #undef SYSCONFDIR /* Support TCP socket connections */ #undef TCPCONN /* Support UNIX socket connections */ #undef UNIXCONN /* Build X string registry */ #undef XREGISTRY /* Build X-ACE extension */ #undef XACE /* Build SELinux extension */ #undef XSELINUX /* Support XCMisc extension */ #undef XCMISC /* Build Security extension */ #undef XCSECURITY /* Support Xdmcp */ #undef XDMCP /* Build XFree86 BigFont extension */ #undef XF86BIGFONT /* Support XFree86 Video Mode extension */ #undef XF86VIDMODE /* Support XFixes extension */ #undef XFIXES /* Build XDGA support */ #undef XFreeXDGA /* Support Xinerama extension */ #undef XINERAMA /* Current Xorg version */ #undef XORG_VERSION_CURRENT /* Build Xv Extension */ #undef XvExtension /* Build XvMC Extension */ #undef XvMCExtension /* Support XSync extension */ #undef XSYNC /* Support XTest extension */ #undef XTEST /* Support Xv extension */ #undef XV /* Support DRI extension */ #undef XF86DRI /* Build DRI2 extension */ #undef DRI2 /* Build DBE support */ #undef DBE /* Vendor name */ #undef XVENDORNAME /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Enable GNU and other extensions to the C environment for GLIBC */ #undef _GNU_SOURCE /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if does not define. */ #undef pid_t /* Build Rootless code */ #undef ROOTLESS /* Define to 1 if unsigned long is 64 bits. */ #undef _XSERVER64 /* System is BSD-like */ #undef CSRG_BASED /* Define to 1 if `struct sockaddr_in' has a `sin_len' member */ #undef BSD44SOCKETS /* Support D-Bus */ #undef HAVE_DBUS /* Use libudev for input hotplug */ #undef CONFIG_UDEV /* Use libudev for kms enumeration */ #undef CONFIG_UDEV_KMS /* Use udev_monitor_filter_add_match_tag() */ #undef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG /* Use udev_enumerate_add_match_tag() */ #undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG /* Enable D-Bus core */ #undef NEED_DBUS /* Support HAL for hotplug */ #undef CONFIG_HAL /* Enable systemd-logind integration */ #undef SYSTEMD_LOGIND 1 /* Have a monotonic clock from clock_gettime() */ #undef MONOTONIC_CLOCK /* Define to 1 if the DTrace Xserver provider probes should be built in */ #undef XSERVER_DTRACE /* Define to 1 if typeof works with your compiler. */ #undef HAVE_TYPEOF /* Define to __typeof__ if your compiler spells it that way. */ #undef typeof /* Correctly set _XSERVER64 for OSX fat binaries */ #ifdef __APPLE__ #include "dix-config-apple-verbatim.h" #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Defined if needed to expose struct msghdr.msg_control */ #undef _XOPEN_SOURCE /* Have support for X shared memory fence library (xshmfence) */ #undef HAVE_XSHMFENCE /* Use XTrans FD passing support */ #undef XTRANS_SEND_FDS /* Wrap SIGBUS to catch MIT-SHM faults */ #undef BUSFAULT /* Don't let Xdefs.h define 'pointer' */ #define _XTYPEDEF_POINTER 1 /* Don't let XIproto define 'Pointer' */ #define _XITYPEDEF_POINTER 1 /* Ask fontsproto to make font path element names const */ #define FONT_PATH_ELEMENT_NAME_CONST 1 /* Build GLAMOR */ #undef GLAMOR /* Build glamor's GBM-based EGL support */ #undef GLAMOR_HAS_GBM /* Build glamor/gbm has linear support */ #undef GLAMOR_HAS_GBM_LINEAR /* GBM has modifiers support */ #undef GBM_BO_WITH_MODIFIERS /* Glamor can use eglQueryDmaBuf* functions */ #undef GLAMOR_HAS_EGL_QUERY_DMABUF /* Glamor can use EGL_MESA_query_driver functions */ #undef GLAMOR_HAS_EGL_QUERY_DRIVER /* byte order */ #undef X_BYTE_ORDER /* Listen on TCP socket */ #undef LISTEN_TCP /* Listen on Unix socket */ #undef LISTEN_UNIX /* Listen on local socket */ #undef LISTEN_LOCAL /* Define if no local socket credentials interface exists */ #undef NO_LOCAL_CLIENT_CRED /* Have setitimer support */ #undef HAVE_SETITIMER /* Have posix_fallocate() */ #undef HAVE_POSIX_FALLOCATE /* Use input thread */ #undef INPUTTHREAD /* Have poll() */ #undef HAVE_POLL /* Have epoll_create1() */ #undef HAVE_EPOLL_CREATE1 /* Have isastream */ #undef HAVE_ISASTREAM #endif /* _DIX_CONFIG_H_ */ xorg-server-1.20.8/include/dix.h0000644000175000017500000004534013640201473013374 00000000000000/*********************************************************** 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 DIX_H #define DIX_H #include "callback.h" #include "gc.h" #include "window.h" #include "input.h" #include "cursor.h" #include "geext.h" #include "events.h" #include #define EARLIER -1 #define SAMETIME 0 #define LATER 1 #define NullClient ((ClientPtr) 0) #define REQUEST(type) \ type *stuff = (type *)client->requestBuffer #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) #define REQUEST_SIZE_MATCH(req)\ if ((sizeof(req) >> 2) != client->req_len)\ return(BadLength) #define REQUEST_AT_LEAST_SIZE(req) \ if ((sizeof(req) >> 2) > client->req_len )\ return(BadLength) #define REQUEST_AT_LEAST_EXTRA_SIZE(req, extra) \ if (((sizeof(req) + ((uint64_t) extra)) >> 2) > client->req_len ) \ return(BadLength) #define REQUEST_FIXED_SIZE(req, n)\ if (((sizeof(req) >> 2) > client->req_len) || \ (((n) >> 2) >= client->req_len) || \ ((((uint64_t) sizeof(req) + (n) + 3) >> 2) != (uint64_t) client->req_len)) \ return(BadLength) #define LEGAL_NEW_RESOURCE(id,client)\ if (!LegalNewID(id,client)) \ {\ client->errorValue = id;\ return BadIDChoice;\ } #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\ {\ int tmprc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\ if (tmprc != Success)\ return tmprc;\ tmprc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\ if (tmprc != Success)\ return tmprc;\ if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ return BadMatch;\ }\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); #define WriteReplyToClient(pClient, size, pReply) { \ if ((pClient)->swapped) \ (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ (pClient, (int)(size), pReply); \ else WriteToClient(pClient, (int)(size), (pReply)); } #define WriteSwappedDataToClient(pClient, size, pbuf) \ if ((pClient)->swapped) \ (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ else WriteToClient(pClient, (int)(size), (pbuf)); typedef struct _TimeStamp *TimeStampPtr; #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; /* also in misc.h */ #define _XTYPEDEF_CLIENTPTR #endif typedef struct _WorkQueue *WorkQueuePtr; extern _X_EXPORT ClientPtr clients[MAXCLIENTS]; extern _X_EXPORT ClientPtr serverClient; extern _X_EXPORT int currentMaxClients; extern _X_EXPORT char dispatchExceptionAtReset; typedef int HWEventQueueType; typedef HWEventQueueType *HWEventQueuePtr; extern _X_EXPORT HWEventQueuePtr checkForInput[2]; static inline _X_NOTSAN Bool InputCheckPending(void) { return (*checkForInput[0] != *checkForInput[1]); } typedef struct _TimeStamp { CARD32 months; /* really ~49.7 days */ CARD32 milliseconds; } TimeStamp; /* dispatch.c */ extern _X_EXPORT void SetInputCheck(HWEventQueuePtr /*c0 */ , HWEventQueuePtr /*c1 */ ); extern _X_EXPORT void CloseDownClient(ClientPtr /*client */ ); extern _X_EXPORT void UpdateCurrentTime(void); extern _X_EXPORT void UpdateCurrentTimeIf(void); extern _X_EXPORT int dixDestroyPixmap(void *value, XID pid); extern _X_EXPORT void InitClient(ClientPtr client, int i, void *ospriv); extern _X_EXPORT ClientPtr NextAvailableClient(void *ospriv); extern _X_EXPORT void SendErrorToClient(ClientPtr /*client */ , unsigned int /*majorCode */ , unsigned int /*minorCode */ , XID /*resId */ , int /*errorCode */ ); extern _X_EXPORT void MarkClientException(ClientPtr /*client */ ); extern _X_HIDDEN Bool CreateConnectionBlock(void); /* dixutils.c */ extern _X_EXPORT int CompareISOLatin1Lowered(const unsigned char * /*a */ , int alen, const unsigned char * /*b */ , int blen); extern _X_EXPORT int dixLookupWindow(WindowPtr *result, XID id, ClientPtr client, Mask access_mode); extern _X_EXPORT int dixLookupDrawable(DrawablePtr *result, XID id, ClientPtr client, Mask type_mask, Mask access_mode); extern _X_EXPORT int dixLookupGC(GCPtr *result, XID id, ClientPtr client, Mask access_mode); extern _X_EXPORT int dixLookupFontable(FontPtr *result, XID id, ClientPtr client, Mask access_mode); extern _X_EXPORT int dixLookupClient(ClientPtr *result, XID id, ClientPtr client, Mask access_mode); extern _X_EXPORT void NoopDDA(void); extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ , WindowPtr /*pWin */ , unsigned /*mode */ , Bool /*toRoot */ , Bool /*map */ ); extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ ); extern _X_EXPORT void BlockHandler(void *timeout); extern _X_EXPORT void WakeupHandler(int result); void EnableLimitedSchedulingLatency(void); void DisableLimitedSchedulingLatency(void); typedef void (*ServerBlockHandlerProcPtr) (void *blockData, void *timeout); typedef void (*ServerWakeupHandlerProcPtr) (void *blockData, int result); extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler, ServerWakeupHandlerProcPtr wakeupHandler, void *blockData); extern _X_EXPORT void RemoveBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler, ServerWakeupHandlerProcPtr wakeupHandler, void *blockData); extern _X_EXPORT void InitBlockAndWakeupHandlers(void); extern _X_EXPORT void ClearWorkQueue(void); extern _X_EXPORT void ProcessWorkQueue(void); extern _X_EXPORT void ProcessWorkQueueZombies(void); extern _X_EXPORT Bool QueueWorkProc(Bool (*function)(ClientPtr clientUnused, void *closure), ClientPtr client, void *closure); typedef Bool (*ClientSleepProcPtr) (ClientPtr client, void *closure); extern _X_EXPORT Bool ClientSleep(ClientPtr client, ClientSleepProcPtr function, void *closure); #ifndef ___CLIENTSIGNAL_DEFINED___ #define ___CLIENTSIGNAL_DEFINED___ extern _X_EXPORT Bool ClientSignal(ClientPtr /*client */ ); #endif /* ___CLIENTSIGNAL_DEFINED___ */ #ifndef ___CLIENTSIGNALALL_DEFINED___ #define ___CLIENTSIGNALALL_DEFINED___ #define CLIENT_SIGNAL_ANY ((void *)-1) extern _X_EXPORT int ClientSignalAll(ClientPtr /*client*/, ClientSleepProcPtr /*function*/, void * /*closure*/); #endif /* ___CLIENTSIGNALALL_DEFINED___ */ extern _X_EXPORT void ClientWakeup(ClientPtr /*client */ ); extern _X_EXPORT Bool ClientIsAsleep(ClientPtr /*client */ ); extern _X_EXPORT void SendGraphicsExpose(ClientPtr /*client */ , RegionPtr /*pRgn */ , XID /*drawable */ , int /*major */ , int /*minor */); /* atom.c */ extern _X_EXPORT Atom MakeAtom(const char * /*string */ , unsigned /*len */ , Bool /*makeit */ ); extern _X_EXPORT Bool ValidAtom(Atom /*atom */ ); extern _X_EXPORT const char *NameForAtom(Atom /*atom */ ); extern _X_EXPORT void AtomError(void) _X_NORETURN; extern _X_EXPORT void FreeAllAtoms(void); extern _X_EXPORT void InitAtoms(void); /* main.c */ extern _X_EXPORT void SetVendorRelease(int release); extern _X_EXPORT void SetVendorString(const char *string); int dix_main(int argc, char *argv[], char *envp[]); /* events.c */ extern void SetMaskForEvent(int /* deviceid */ , Mask /* mask */ , int /* event */ ); extern _X_EXPORT void ConfineToShape(DeviceIntPtr /* pDev */ , RegionPtr /* shape */ , int * /* px */ , int * /* py */ ); extern _X_EXPORT Bool IsParent(WindowPtr /* maybeparent */ , WindowPtr /* child */ ); extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev); extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); extern _X_EXPORT void NoticeTime(const DeviceIntPtr dev, TimeStamp time); extern _X_EXPORT void NoticeEventTime(InternalEvent *ev, DeviceIntPtr dev); extern _X_EXPORT TimeStamp LastEventTime(int deviceid); extern _X_EXPORT Bool LastEventTimeWasReset(int deviceid); extern _X_EXPORT void LastEventTimeToggleResetFlag(int deviceid, Bool state); extern _X_EXPORT void LastEventTimeToggleResetAll(Bool state); extern void EnqueueEvent(InternalEvent * /* ev */ , DeviceIntPtr /* device */ ); extern void PlayReleasedEvents(void); extern void ActivatePointerGrab(DeviceIntPtr /* mouse */ , GrabPtr /* grab */ , TimeStamp /* time */ , Bool /* autoGrab */ ); extern void DeactivatePointerGrab(DeviceIntPtr /* mouse */ ); extern void ActivateKeyboardGrab(DeviceIntPtr /* keybd */ , GrabPtr /* grab */ , TimeStamp /* time */ , Bool /* passive */ ); extern void DeactivateKeyboardGrab(DeviceIntPtr /* keybd */ ); extern BOOL ActivateFocusInGrab(DeviceIntPtr /* dev */ , WindowPtr /* old */ , WindowPtr /* win */ ); extern void AllowSome(ClientPtr /* client */ , TimeStamp /* time */ , DeviceIntPtr /* thisDev */ , int /* newState */ ); extern void ReleaseActiveGrabs(ClientPtr client); extern GrabPtr CheckPassiveGrabsOnWindow(WindowPtr /* pWin */ , DeviceIntPtr /* device */ , InternalEvent * /* event */ , BOOL /* checkCore */ , BOOL /* activate */ ); extern _X_EXPORT int DeliverEventsToWindow(DeviceIntPtr /* pWin */ , WindowPtr /* pWin */ , xEventPtr /* pEvents */ , int /* count */ , Mask /* filter */ , GrabPtr /* grab */ ); extern _X_EXPORT void DeliverRawEvent(RawDeviceEvent * /* ev */ , DeviceIntPtr /* dev */ ); extern int DeliverDeviceEvents(WindowPtr /* pWin */ , InternalEvent * /* event */ , GrabPtr /* grab */ , WindowPtr /* stopAt */ , DeviceIntPtr /* dev */ ); extern int DeliverOneGrabbedEvent(InternalEvent * /* event */ , DeviceIntPtr /* dev */ , enum InputLevel /* level */ ); extern void DeliverTouchEvents(DeviceIntPtr /* dev */ , TouchPointInfoPtr /* ti */ , InternalEvent * /* ev */ , XID /* resource */ ); extern void InitializeSprite(DeviceIntPtr /* pDev */ , WindowPtr /* pWin */ ); extern void FreeSprite(DeviceIntPtr pDev); extern void UpdateSpriteForScreen(DeviceIntPtr /* pDev */ , ScreenPtr /* pScreen */ ); extern _X_EXPORT void WindowHasNewCursor(WindowPtr /* pWin */ ); extern Bool CheckDeviceGrabs(DeviceIntPtr /* device */ , DeviceEvent * /* event */ , WindowPtr /* ancestor */ ); extern void DeliverFocusedEvent(DeviceIntPtr /* keybd */ , InternalEvent * /* event */ , WindowPtr /* window */ ); extern int DeliverGrabbedEvent(InternalEvent * /* event */ , DeviceIntPtr /* thisDev */ , Bool /* deactivateGrab */ ); extern void FixKeyState(DeviceEvent * /* event */ , DeviceIntPtr /* keybd */ ); extern void RecalculateDeliverableEvents(WindowPtr /* pWin */ ); extern _X_EXPORT int OtherClientGone(void *value, XID id); extern void DoFocusEvents(DeviceIntPtr /* dev */ , WindowPtr /* fromWin */ , WindowPtr /* toWin */ , int /* mode */ ); extern int SetInputFocus(ClientPtr /* client */ , DeviceIntPtr /* dev */ , Window /* focusID */ , CARD8 /* revertTo */ , Time /* ctime */ , Bool /* followOK */ ); extern int GrabDevice(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned /* this_mode */ , unsigned /* other_mode */ , Window /* grabWindow */ , unsigned /* ownerEvents */ , Time /* ctime */ , GrabMask * /* mask */ , int /* grabtype */ , Cursor /* curs */ , Window /* confineToWin */ , CARD8 * /* status */ ); extern void InitEvents(void); extern void CloseDownEvents(void); extern void DeleteWindowFromAnyEvents(WindowPtr /* pWin */ , Bool /* freeResources */ ); extern Mask EventMaskForClient(WindowPtr /* pWin */ , ClientPtr /* client */ ); extern _X_EXPORT int DeliverEvents(WindowPtr /*pWin */ , xEventPtr /*xE */ , int /*count */ , WindowPtr /*otherParent */ ); extern Bool CheckMotion(DeviceEvent * /* ev */ , DeviceIntPtr /* pDev */ ); extern _X_EXPORT void WriteEventsToClient(ClientPtr /*pClient */ , int /*count */ , xEventPtr /*events */ ); extern _X_EXPORT int TryClientEvents(ClientPtr /*client */ , DeviceIntPtr /* device */ , xEventPtr /*pEvents */ , int /*count */ , Mask /*mask */ , Mask /*filter */ , GrabPtr /*grab */ ); extern _X_EXPORT void WindowsRestructured(void); extern int SetClientPointer(ClientPtr /* client */ , DeviceIntPtr /* device */ ); extern _X_EXPORT DeviceIntPtr PickPointer(ClientPtr /* client */ ); extern _X_EXPORT DeviceIntPtr PickKeyboard(ClientPtr /* client */ ); extern Bool IsInterferingGrab(ClientPtr /* client */ , DeviceIntPtr /* dev */ , xEvent * /* events */ ); #ifdef PANORAMIX extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff); #endif #ifdef RANDR extern _X_EXPORT void ScreenRestructured(ScreenPtr pScreen); #endif /* * ServerGrabCallback stuff */ extern _X_EXPORT CallbackListPtr ServerGrabCallback; typedef enum { SERVER_GRABBED, SERVER_UNGRABBED, CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; typedef struct { ClientPtr client; ServerGrabState grabstate; } ServerGrabInfoRec; /* * EventCallback stuff */ extern _X_EXPORT CallbackListPtr EventCallback; typedef struct { ClientPtr client; xEventPtr events; int count; } EventInfoRec; /* * DeviceEventCallback stuff */ extern _X_EXPORT CallbackListPtr DeviceEventCallback; typedef struct { InternalEvent *event; DeviceIntPtr device; } DeviceEventInfoRec; extern _X_EXPORT CallbackListPtr RootWindowFinalizeCallback; extern int XItoCoreType(int xi_type); extern Bool DevHasCursor(DeviceIntPtr pDev); extern _X_EXPORT Bool IsPointerDevice(DeviceIntPtr dev); extern _X_EXPORT Bool IsKeyboardDevice(DeviceIntPtr dev); extern Bool IsPointerEvent(InternalEvent *event); extern Bool IsTouchEvent(InternalEvent *event); extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev); extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what); extern _X_EXPORT void *lastGLContext; #endif /* DIX_H */ xorg-server-1.20.8/include/rgb.h0000644000175000017500000000455613640201473013366 00000000000000/*********************************************************** 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 RGB_H #define RGB_H typedef struct _RGB { unsigned short red, green, blue; } RGB; #endif /* RGB_H */ xorg-server-1.20.8/include/ptrveloc.h0000644000175000017500000001260213640201473014441 00000000000000/* * * Copyright © 2006-2011 Simon Thum simon dot thum at gmx dot de * * 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. */ #ifndef POINTERVELOCITY_H #define POINTERVELOCITY_H #include /* constants for acceleration profiles */ #define AccelProfileNone -1 #define AccelProfileClassic 0 #define AccelProfileDeviceSpecific 1 #define AccelProfilePolynomial 2 #define AccelProfileSmoothLinear 3 #define AccelProfileSimple 4 #define AccelProfilePower 5 #define AccelProfileLinear 6 #define AccelProfileSmoothLimited 7 #define AccelProfileLAST AccelProfileSmoothLimited /* fwd */ struct _DeviceVelocityRec; /** * profile * returns actual acceleration depending on velocity, acceleration control,... */ typedef double (*PointerAccelerationProfileFunc) (DeviceIntPtr dev, struct _DeviceVelocityRec * vel, double velocity, double threshold, double accelCoeff); /** * a motion history, with just enough information to * calc mean velocity and decide which motion was along * a more or less straight line */ typedef struct _MotionTracker { double dx, dy; /* accumulated delta for each axis */ int time; /* time of creation */ int dir; /* initial direction bitfield */ } MotionTracker, *MotionTrackerPtr; /** * Contains all data needed to implement mouse ballistics */ typedef struct _DeviceVelocityRec { MotionTrackerPtr tracker; int num_tracker; int cur_tracker; /* current index */ double velocity; /* velocity as guessed by algorithm */ double last_velocity; /* previous velocity estimate */ double last_dx; /* last time-difference */ double last_dy; /* phase of last/current estimate */ double corr_mul; /* config: multiply this into velocity */ double const_acceleration; /* config: (recipr.) const deceleration */ double min_acceleration; /* config: minimum acceleration */ short reset_time; /* config: reset non-visible state after # ms */ short use_softening; /* config: use softening of mouse values */ double max_rel_diff; /* config: max. relative difference */ double max_diff; /* config: max. difference */ int initial_range; /* config: max. offset used as initial velocity */ Bool average_accel; /* config: average acceleration over velocity */ PointerAccelerationProfileFunc Profile; PointerAccelerationProfileFunc deviceSpecificProfile; void *profile_private; /* extended data, see SetAccelerationProfile() */ struct { /* to be able to query this information */ int profile_number; } statistics; } DeviceVelocityRec, *DeviceVelocityPtr; /** * contains the run-time data for the predictable scheme, that is, a * DeviceVelocityPtr and the property handlers. */ typedef struct _PredictableAccelSchemeRec { DeviceVelocityPtr vel; long *prop_handlers; int num_prop_handlers; } PredictableAccelSchemeRec, *PredictableAccelSchemePtr; extern _X_EXPORT void InitVelocityData(DeviceVelocityPtr vel); extern _X_EXPORT void InitTrackers(DeviceVelocityPtr vel, int ntracker); extern _X_EXPORT BOOL ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time); extern _X_EXPORT double BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel, double velocity, double threshold, double acc); extern _X_EXPORT void FreeVelocityData(DeviceVelocityPtr vel); extern _X_EXPORT int SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); extern _X_EXPORT DeviceVelocityPtr GetDevicePredictableAccelData(DeviceIntPtr dev); extern _X_EXPORT void SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel, PointerAccelerationProfileFunc profile); extern _X_INTERNAL void AccelerationDefaultCleanup(DeviceIntPtr dev); extern _X_INTERNAL Bool InitPredictableAccelerationScheme(DeviceIntPtr dev, struct _ValuatorAccelerationRec *protoScheme); extern _X_INTERNAL void acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime); extern _X_INTERNAL void acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime); #endif /* POINTERVELOCITY_H */ xorg-server-1.20.8/include/selection.h0000644000175000017500000000652313640201473014575 00000000000000/*********************************************************** 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 SELECTION_H #define SELECTION_H 1 #include "dixstruct.h" #include "privates.h" /* * Selection data structures */ typedef struct _Selection { Atom selection; TimeStamp lastTimeChanged; Window window; WindowPtr pWin; ClientPtr client; struct _Selection *next; PrivateRec *devPrivates; } Selection; /* * Selection API */ extern _X_EXPORT int dixLookupSelection(Selection ** result, Atom name, ClientPtr client, Mask access_mode); extern _X_EXPORT Selection *CurrentSelections; extern _X_EXPORT CallbackListPtr SelectionCallback; typedef enum { SelectionSetOwner, SelectionWindowDestroy, SelectionClientClose } SelectionCallbackKind; typedef struct { struct _Selection *selection; ClientPtr client; SelectionCallbackKind kind; } SelectionInfoRec; /* * Selection server internals */ extern _X_EXPORT void InitSelections(void); extern _X_EXPORT void DeleteWindowFromAnySelections(WindowPtr pWin); extern _X_EXPORT void DeleteClientFromAnySelections(ClientPtr client); #endif /* SELECTION_H */ xorg-server-1.20.8/include/callback.h0000644000175000017500000000673613640201473014352 00000000000000/*********************************************************** 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 CALLBACK_H #define CALLBACK_H #include /* for GContext, Mask */ #include /* for Bool */ #include #include /* * callback manager stuff */ #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef void (*CallbackProcPtr) (CallbackListPtr *, void *, void *); extern _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data); extern _X_EXPORT Bool DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data); extern _X_EXPORT void _CallCallbacks(CallbackListPtr *pcbl, void *call_data); static inline void CallCallbacks(CallbackListPtr *pcbl, void *call_data) { if (!pcbl || !*pcbl) return; _CallCallbacks(pcbl, call_data); } extern _X_EXPORT void DeleteCallbackList(CallbackListPtr *pcbl); extern _X_EXPORT void InitCallbackManager(void); extern _X_EXPORT void DeleteCallbackManager(void); #endif /* CALLBACK_H */ xorg-server-1.20.8/include/privates.h0000644000175000017500000002562313640201473014447 00000000000000/*********************************************************** 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 AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #ifndef PRIVATES_H #define PRIVATES_H 1 #include #include #include #include "misc.h" /***************************************************************** * STUFF FOR PRIVATES *****************************************************************/ typedef struct _Private PrivateRec, *PrivatePtr; typedef enum { /* XSELinux uses the same private keys for numerous objects */ PRIVATE_XSELINUX, /* Otherwise, you get a private in just the requested structure */ /* These can have objects created before all of the keys are registered */ PRIVATE_SCREEN, PRIVATE_EXTENSION, PRIVATE_COLORMAP, PRIVATE_DEVICE, /* These cannot have any objects before all relevant keys are registered */ PRIVATE_CLIENT, PRIVATE_PROPERTY, PRIVATE_SELECTION, PRIVATE_WINDOW, PRIVATE_PIXMAP, PRIVATE_GC, PRIVATE_CURSOR, PRIVATE_CURSOR_BITS, /* extension privates */ PRIVATE_GLYPH, PRIVATE_GLYPHSET, PRIVATE_PICTURE, PRIVATE_SYNC_FENCE, /* last private type */ PRIVATE_LAST, } DevPrivateType; typedef struct _DevPrivateKeyRec { int offset; int size; Bool initialized; Bool allocated; DevPrivateType type; struct _DevPrivateKeyRec *next; } DevPrivateKeyRec, *DevPrivateKey; typedef struct _DevPrivateSetRec { DevPrivateKey key; unsigned offset; int created; int allocated; } DevPrivateSetRec, *DevPrivateSetPtr; typedef struct _DevScreenPrivateKeyRec { DevPrivateKeyRec screenKey; } DevScreenPrivateKeyRec, *DevScreenPrivateKey; /* * Let drivers know how to initialize private keys */ #define HAS_DEVPRIVATEKEYREC 1 #define HAS_DIXREGISTERPRIVATEKEY 1 /* * Register a new private index for the private type. * * This initializes the specified key and optionally requests pre-allocated * private space for your driver/module. If you request no extra space, you * may set and get a single pointer value using this private key. Otherwise, * you can get the address of the extra space and store whatever data you like * there. * * You may call dixRegisterPrivateKey more than once on the same key, but the * size and type must match or the server will abort. * * dixRegisterPrivateKey returns FALSE if it fails to allocate memory * during its operation. */ extern _X_EXPORT Bool dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size); /* * Check whether a private key has been registered */ static inline Bool dixPrivateKeyRegistered(DevPrivateKey key) { return key->initialized; } /* * Get the address of the private storage. * * For keys with pre-defined storage, this gets the base of that storage * Otherwise, it returns the place where the private pointer is stored. */ static inline void * dixGetPrivateAddr(PrivatePtr *privates, const DevPrivateKey key) { assert(key->initialized); return (char *) (*privates) + key->offset; } /* * Fetch a private pointer stored in the object * * Returns the pointer stored with dixSetPrivate. * This must only be used with keys that have * no pre-defined storage */ static inline void * dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key) { assert(key->size == 0); return *(void **) dixGetPrivateAddr(privates, key); } /* * Associate 'val' with 'key' in 'privates' so that later calls to * dixLookupPrivate(privates, key) will return 'val'. */ static inline void dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, void *val) { assert(key->size == 0); *(void **) dixGetPrivateAddr(privates, key) = val; } #include "dix.h" #include "resource.h" /* * Lookup a pointer to the private record. * * For privates with defined storage, return the address of the * storage. For privates without defined storage, return the pointer * contents */ static inline void * dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key) { if (key->size) return dixGetPrivateAddr(privates, key); else return dixGetPrivate(privates, key); } /* * Look up the address of the pointer to the storage * * This returns the place where the private pointer is stored, * which is only valid for privates without predefined storage. */ static inline void ** dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key) { assert(key->size == 0); return (void **) dixGetPrivateAddr(privates, key); } extern _X_EXPORT Bool dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size); extern _X_EXPORT DevPrivateKey _dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen); static inline void * dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) { return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen)); } static inline void * dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) { return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen)); } static inline void dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, void *val) { dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val); } static inline void * dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) { return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen)); } static inline void ** dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) { return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen)); } /* * These functions relate to allocations related to a specific screen; * space will only be available for objects allocated for use on that * screen. As such, only objects which are related directly to a specific * screen are candidates for allocation this way, this includes * windows, pixmaps, gcs, pictures and colormaps. This key is * used just like any other key using dixGetPrivate and friends. * * This is distinctly different from the ScreenPrivateKeys above which * allocate space in global objects like cursor bits for a specific * screen, allowing multiple screen-related chunks of storage in a * single global object. */ #define HAVE_SCREEN_SPECIFIC_PRIVATE_KEYS 1 extern _X_EXPORT Bool dixRegisterScreenSpecificPrivateKey(ScreenPtr pScreen, DevPrivateKey key, DevPrivateType type, unsigned size); /* Clean up screen-specific privates before CloseScreen */ extern void dixFreeScreenSpecificPrivates(ScreenPtr pScreen); /* Initialize screen-specific privates in AddScreen */ extern void dixInitScreenSpecificPrivates(ScreenPtr pScreen); /* is this private created - so hotplug can avoid crashing */ Bool dixPrivatesCreated(DevPrivateType type); extern _X_EXPORT void * _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen, unsigned size, unsigned clear, unsigned offset, DevPrivateType type); #define dixAllocateScreenObjectWithPrivates(s, t, type) _dixAllocateScreenObjectWithPrivates(s, sizeof(t), sizeof(t), offsetof(t, devPrivates), type) extern _X_EXPORT int dixScreenSpecificPrivatesSize(ScreenPtr pScreen, DevPrivateType type); extern _X_EXPORT void _dixInitScreenPrivates(ScreenPtr pScreen, PrivatePtr *privates, void *addr, DevPrivateType type); #define dixInitScreenPrivates(s, o, v, type) _dixInitScreenPrivates(s, &(o)->devPrivates, (v), type); /* * Allocates private data separately from main object. * * For objects created during server initialization, this allows those * privates to be re-allocated as new private keys are registered. * * This includes screens, the serverClient, default colormaps and * extensions entries. */ extern _X_EXPORT Bool dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type); /* * Frees separately allocated private data */ extern _X_EXPORT void dixFreePrivates(PrivatePtr privates, DevPrivateType type); /* * Initialize privates by zeroing them */ extern _X_EXPORT void _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type); #define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), type); /* * Clean up privates */ extern _X_EXPORT void _dixFiniPrivates(PrivatePtr privates, DevPrivateType type); #define dixFiniPrivates(o,t) _dixFiniPrivates((o)->devPrivates,t) /* * Allocates private data at object creation time. Required * for almost all objects, except for the list described * above for dixAllocatePrivates. */ extern _X_EXPORT void *_dixAllocateObjectWithPrivates(unsigned size, unsigned clear, unsigned offset, DevPrivateType type); #define dixAllocateObjectWithPrivates(t, type) (t *) _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, devPrivates), type) extern _X_EXPORT void _dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType type); #define dixFreeObjectWithPrivates(o,t) _dixFreeObjectWithPrivates(o, (o)->devPrivates, t) /* * Return size of privates for the specified type */ extern _X_EXPORT int dixPrivatesSize(DevPrivateType type); /* * Dump out private stats to ErrorF */ extern void dixPrivateUsage(void); /* * Resets the privates subsystem. dixResetPrivates is called from the main loop * before each server generation. This function must only be called by main(). */ extern _X_EXPORT void dixResetPrivates(void); /* * Looks up the offset where the devPrivates field is located. * * Returns -1 if the specified resource has no dev privates. * The position of the devPrivates field varies by structure * and calling code might only know the resource type, not the * structure definition. */ extern _X_EXPORT int dixLookupPrivateOffset(RESTYPE type); /* * Convenience macro for adding an offset to an object pointer * when making a call to one of the devPrivates functions */ #define DEVPRIV_AT(ptr, offset) ((PrivatePtr *)((char *)(ptr) + offset)) #endif /* PRIVATES_H */ xorg-server-1.20.8/include/dixgrabs.h0000644000175000017500000000525613640201473014415 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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 DIXGRABS_H #define DIXGRABS_H 1 struct _GrabParameters; extern void PrintDeviceGrabInfo(DeviceIntPtr dev); extern void UngrabAllDevices(Bool kill_client); extern GrabPtr AllocGrab(const GrabPtr src); extern void FreeGrab(GrabPtr grab); extern Bool CopyGrab(GrabPtr dst, const GrabPtr src); extern GrabPtr CreateGrab(int /* client */ , DeviceIntPtr /* device */ , DeviceIntPtr /* modDevice */ , WindowPtr /* window */ , enum InputLevel /* grabtype */ , GrabMask * /* mask */ , struct _GrabParameters * /* param */ , int /* type */ , KeyCode /* keybut */ , WindowPtr /* confineTo */ , CursorPtr /* cursor */ ); extern _X_EXPORT int DeletePassiveGrab(void *value, XID id); extern _X_EXPORT Bool GrabMatchesSecond(GrabPtr /* pFirstGrab */ , GrabPtr /* pSecondGrab */ , Bool /*ignoreDevice */ ); extern _X_EXPORT int AddPassiveGrabToList(ClientPtr /* client */ , GrabPtr /* pGrab */ ); extern _X_EXPORT Bool DeletePassiveGrabFromList(GrabPtr /* pMinuendGrab */ ); extern Bool GrabIsPointerGrab(GrabPtr grab); extern Bool GrabIsKeyboardGrab(GrabPtr grab); #endif /* DIXGRABS_H */ xorg-server-1.20.8/include/optionstr.h0000644000175000017500000000036413640201473014646 00000000000000#ifndef OPTIONSTR_H_ #define OPTIONSTR_H_ #include "list.h" struct _InputOption { GenericListRec list; char *opt_name; char *opt_val; int opt_used; char *opt_comment; }; #endif /* INPUTSTRUCT_H */ xorg-server-1.20.8/include/dbus-core.h0000644000175000017500000000351013640201473014464 00000000000000/* * Copyright © 2013 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. * * Author: Hans de Goede */ #ifndef DBUS_CORE_H #define DBUS_CORE_H #ifdef NEED_DBUS #include typedef void (*dbus_core_connect_hook) (DBusConnection * connection, void *data); typedef void (*dbus_core_disconnect_hook) (void *data); struct dbus_core_hook { dbus_core_connect_hook connect; dbus_core_disconnect_hook disconnect; void *data; struct dbus_core_hook *next; }; int dbus_core_init(void); void dbus_core_fini(void); int dbus_core_add_hook(struct dbus_core_hook *hook); void dbus_core_remove_hook(struct dbus_core_hook *hook); #else #define dbus_core_init() #define dbus_core_fini() #endif #endif xorg-server-1.20.8/include/xkbrules.h0000644000175000017500000000745413640201473014453 00000000000000#ifndef _XKBRULES_H_ #define _XKBRULES_H_ 1 /************************************************************ Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. 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 Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS 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. ********************************************************/ /***====================================================================***/ typedef struct _XkbRMLVOSet { char *rules; char *model; char *layout; char *variant; char *options; } XkbRMLVOSet; typedef struct _XkbRF_VarDefs { const char *model; const char *layout; const char *variant; const char *options; } XkbRF_VarDefsRec, *XkbRF_VarDefsPtr; typedef struct _XkbRF_Rule { int number; int layout_num; int variant_num; const char *model; const char *layout; const char *variant; const char *option; /* yields */ const char *keycodes; const char *symbols; const char *types; const char *compat; const char *geometry; unsigned flags; } XkbRF_RuleRec, *XkbRF_RulePtr; typedef struct _XkbRF_Group { int number; const char *name; char *words; } XkbRF_GroupRec, *XkbRF_GroupPtr; #define XkbRF_PendingMatch (1L<<1) #define XkbRF_Option (1L<<2) #define XkbRF_Append (1L<<3) #define XkbRF_Normal (1L<<4) #define XkbRF_Invalid (1L<<5) typedef struct _XkbRF_Rules { unsigned short sz_rules; unsigned short num_rules; XkbRF_RulePtr rules; unsigned short sz_groups; unsigned short num_groups; XkbRF_GroupPtr groups; } XkbRF_RulesRec, *XkbRF_RulesPtr; /***====================================================================***/ _XFUNCPROTOBEGIN /* Seems preferable to dragging xkbstr.h in. */ struct _XkbComponentNames; extern _X_EXPORT Bool XkbRF_GetComponents(XkbRF_RulesPtr /* rules */ , XkbRF_VarDefsPtr /* var_defs */ , struct _XkbComponentNames * /* names */ ); extern _X_EXPORT Bool XkbRF_LoadRules(FILE * /* file */ , XkbRF_RulesPtr /* rules */ ); extern _X_EXPORT Bool XkbRF_LoadRulesByName(char * /* base */ , char * /* locale */ , XkbRF_RulesPtr /* rules */ ); /***====================================================================***/ extern _X_EXPORT XkbRF_RulesPtr XkbRF_Create(void); extern _X_EXPORT void XkbRF_Free(XkbRF_RulesPtr /* rules */ , Bool /* freeRules */ ); /***====================================================================***/ #define _XKB_RF_NAMES_PROP_ATOM "_XKB_RULES_NAMES" #define _XKB_RF_NAMES_PROP_MAXLEN 1024 _XFUNCPROTOEND #endif /* _XKBRULES_H_ */ xorg-server-1.20.8/include/protocol-versions.h0000644000175000017500000001061413640201473016313 00000000000000/* * 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 /* DRI3 */ #define SERVER_DRI3_MAJOR_VERSION 1 #define SERVER_DRI3_MINOR_VERSION 2 /* 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 /* Present */ #define SERVER_PRESENT_MAJOR_VERSION 1 #define SERVER_PRESENT_MINOR_VERSION 2 /* RandR */ #define SERVER_RANDR_MAJOR_VERSION 1 #define SERVER_RANDR_MINOR_VERSION 6 /* 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 #if XTRANS_SEND_FDS #define SERVER_SHM_MINOR_VERSION 2 #else #define SERVER_SHM_MINOR_VERSION 1 #endif /* Sync */ #define SERVER_SYNC_MAJOR_VERSION 3 #define SERVER_SYNC_MINOR_VERSION 1 /* Windows DRI */ #define SERVER_WINDOWSDRI_MAJOR_VERSION 1 #define SERVER_WINDOWSDRI_MINOR_VERSION 0 #define SERVER_WINDOWSDRI_PATCH_VERSION 0 /* Windows WM */ #define SERVER_WINDOWSWM_MAJOR_VERSION 1 #define SERVER_WINDOWSWM_MINOR_VERSION 0 #define SERVER_WINDOWSWM_PATCH_VERSION 0 /* 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 5 #define SERVER_XFIXES_MINOR_VERSION 0 /* X Input */ #define SERVER_XI_MAJOR_VERSION 2 #define SERVER_XI_MINOR_VERSION 3 /* 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 2 /* XvMC */ #define SERVER_XVMC_MAJOR_VERSION 1 #define SERVER_XVMC_MINOR_VERSION 1 #endif xorg-server-1.20.8/include/XIstubs.h0000644000175000017500000000345513640201473014212 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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 XI_STUBS_H #define XI_STUBS_H 1 extern _X_EXPORT int SetDeviceMode(ClientPtr /* client */ , DeviceIntPtr /* dev */ , int /* mode */ ); extern _X_EXPORT int SetDeviceValuators(ClientPtr /* client */ , DeviceIntPtr /* dev */ , int * /* valuators */ , int /* first_valuator */ , int /* num_valuators */ ); extern _X_EXPORT int ChangeDeviceControl(ClientPtr /* client */ , DeviceIntPtr /* dev */ , xDeviceCtl * /* control */ ); #endif /* XI_STUBS_H */ xorg-server-1.20.8/include/dixfont.h0000644000175000017500000001041113640201473014252 00000000000000/*********************************************************** 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 DIXFONT_H #define DIXFONT_H 1 #include "dix.h" #include #include "closure.h" #include #include #define NullDIXFontProp ((DIXFontPropPtr)0) typedef struct _DIXFontProp *DIXFontPropPtr; extern _X_EXPORT Bool SetDefaultFont(const char * /*defaultfontname */ ); extern _X_EXPORT int OpenFont(ClientPtr /*client */ , XID /*fid */ , Mask /*flags */ , unsigned /*lenfname */ , const char * /*pfontname */ ); extern _X_EXPORT int CloseFont(void *pfont, XID fid); typedef struct _xQueryFontReply *xQueryFontReplyPtr; extern _X_EXPORT void QueryFont(FontPtr /*pFont */ , xQueryFontReplyPtr /*pReply */ , int /*nProtoCCIStructs */ ); extern _X_EXPORT int ListFonts(ClientPtr /*client */ , unsigned char * /*pattern */ , unsigned int /*length */ , unsigned int /*max_names */ ); extern _X_EXPORT int PolyText(ClientPtr /*client */ , DrawablePtr /*pDraw */ , GCPtr /*pGC */ , unsigned char * /*pElt */ , unsigned char * /*endReq */ , int /*xorg */ , int /*yorg */ , int /*reqType */ , XID /*did */ ); extern _X_EXPORT int ImageText(ClientPtr /*client */ , DrawablePtr /*pDraw */ , GCPtr /*pGC */ , int /*nChars */ , unsigned char * /*data */ , int /*xorg */ , int /*yorg */ , int /*reqType */ , XID /*did */ ); extern _X_EXPORT int SetFontPath(ClientPtr /*client */ , int /*npaths */ , unsigned char * /*paths */ ); extern _X_EXPORT int SetDefaultFontPath(const char * /*path */ ); extern _X_EXPORT int GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result); extern _X_EXPORT void DeleteClientFontStuff(ClientPtr /*client */ ); /* Quartz support on Mac OS X pulls in the QuickDraw framework whose InitFonts function conflicts here. */ #ifdef __APPLE__ #define InitFonts Darwin_X_InitFonts #endif extern _X_EXPORT void InitFonts(void); extern _X_EXPORT void FreeFonts(void); extern _X_EXPORT void GetGlyphs(FontPtr /*font */ , unsigned long /*count */ , unsigned char * /*chars */ , FontEncoding /*fontEncoding */ , unsigned long * /*glyphcount */ , CharInfoPtr * /*glyphs */ ); #endif /* DIXFONT_H */ xorg-server-1.20.8/include/list.h0000644000175000017500000003550213640201473013562 00000000000000/* * Copyright © 2010 Intel Corporation * Copyright © 2010 Francisco Jerez * * 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. * */ #ifndef _XORG_LIST_H_ #define _XORG_LIST_H_ #include /* offsetof() */ /** * @file Classic doubly-link circular list implementation. * For real usage examples of the linked list, see the file test/list.c * * Example: * We need to keep a list of struct foo in the parent struct bar, i.e. what * we want is something like this. * * struct bar { * ... * struct foo *list_of_foos; -----> struct foo {}, struct foo {}, struct foo{} * ... * } * * We need one list head in bar and a list element in all list_of_foos (both are of * data type 'struct xorg_list'). * * struct bar { * ... * struct xorg_list list_of_foos; * ... * } * * struct foo { * ... * struct xorg_list entry; * ... * } * * Now we initialize the list head: * * struct bar bar; * ... * xorg_list_init(&bar.list_of_foos); * * Then we create the first element and add it to this list: * * struct foo *foo = malloc(...); * .... * xorg_list_add(&foo->entry, &bar.list_of_foos); * * Repeat the above for each element you want to add to the list. Deleting * works with the element itself. * xorg_list_del(&foo->entry); * free(foo); * * Note: calling xorg_list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty * list again. * * Looping through the list requires a 'struct foo' as iterator and the * name of the field the subnodes use. * * struct foo *iterator; * xorg_list_for_each_entry(iterator, &bar.list_of_foos, entry) { * if (iterator->something == ...) * ... * } * * Note: You must not call xorg_list_del() on the iterator if you continue the * loop. You need to run the safe for-each loop instead: * * struct foo *iterator, *next; * xorg_list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) { * if (...) * xorg_list_del(&iterator->entry); * } * */ /** * The linkage struct for list nodes. This struct must be part of your * to-be-linked struct. struct xorg_list is required for both the head of the * list and for each list node. * * Position and name of the struct xorg_list field is irrelevant. * There are no requirements that elements of a list are of the same type. * There are no requirements for a list head, any struct xorg_list can be a list * head. */ struct xorg_list { struct xorg_list *next, *prev; }; /** * Initialize the list as an empty list. * * Example: * xorg_list_init(&bar->list_of_foos); * * @param list The list to initialize */ static inline void xorg_list_init(struct xorg_list *list) { list->next = list->prev = list; } static inline void __xorg_list_add(struct xorg_list *entry, struct xorg_list *prev, struct xorg_list *next) { next->prev = entry; entry->next = next; entry->prev = prev; prev->next = entry; } /** * Insert a new element after the given list head. The new element does not * need to be initialised as empty list. * The list changes from: * head → some element → ... * to * head → new element → older element → ... * * Example: * struct foo *newfoo = malloc(...); * xorg_list_add(&newfoo->entry, &bar->list_of_foos); * * @param entry The new element to prepend to the list. * @param head The existing list. */ static inline void xorg_list_add(struct xorg_list *entry, struct xorg_list *head) { __xorg_list_add(entry, head, head->next); } /** * Append a new element to the end of the list given with this list head. * * The list changes from: * head → some element → ... → lastelement * to * head → some element → ... → lastelement → new element * * Example: * struct foo *newfoo = malloc(...); * xorg_list_append(&newfoo->entry, &bar->list_of_foos); * * @param entry The new element to prepend to the list. * @param head The existing list. */ static inline void xorg_list_append(struct xorg_list *entry, struct xorg_list *head) { __xorg_list_add(entry, head->prev, head); } static inline void __xorg_list_del(struct xorg_list *prev, struct xorg_list *next) { next->prev = prev; prev->next = next; } /** * Remove the element from the list it is in. Using this function will reset * the pointers to/from this element so it is removed from the list. It does * NOT free the element itself or manipulate it otherwise. * * Using xorg_list_del on a pure list head (like in the example at the top of * this file) will NOT remove the first element from * the list but rather reset the list as empty list. * * Example: * xorg_list_del(&foo->entry); * * @param entry The element to remove. */ static inline void xorg_list_del(struct xorg_list *entry) { __xorg_list_del(entry->prev, entry->next); xorg_list_init(entry); } /** * Check if the list is empty. * * Example: * xorg_list_is_empty(&bar->list_of_foos); * * @return True if the list is empty or False if the list contains one or more * elements. */ static inline int xorg_list_is_empty(struct xorg_list *head) { return head->next == head; } /** * Returns a pointer to the container of this list element. * * Example: * struct foo* f; * f = container_of(&foo->entry, struct foo, entry); * assert(f == foo); * * @param ptr Pointer to the struct xorg_list. * @param type Data type of the list element. * @param member Member name of the struct xorg_list field in the list element. * @return A pointer to the data struct containing the list head. */ #ifndef container_of #define container_of(ptr, type, member) \ (type *)((char *)(ptr) - offsetof(type, member)) #endif /** * Alias of container_of */ #define xorg_list_entry(ptr, type, member) \ container_of(ptr, type, member) /** * Retrieve the first list entry for the given list pointer. * * Example: * struct foo *first; * first = xorg_list_first_entry(&bar->list_of_foos, struct foo, list_of_foos); * * @param ptr The list head * @param type Data type of the list element to retrieve * @param member Member name of the struct xorg_list field in the list element. * @return A pointer to the first list element. */ #define xorg_list_first_entry(ptr, type, member) \ xorg_list_entry((ptr)->next, type, member) /** * Retrieve the last list entry for the given listpointer. * * Example: * struct foo *first; * first = xorg_list_last_entry(&bar->list_of_foos, struct foo, list_of_foos); * * @param ptr The list head * @param type Data type of the list element to retrieve * @param member Member name of the struct xorg_list field in the list element. * @return A pointer to the last list element. */ #define xorg_list_last_entry(ptr, type, member) \ xorg_list_entry((ptr)->prev, type, member) #ifdef HAVE_TYPEOF #define __container_of(ptr, sample, member) \ container_of(ptr, typeof(*sample), member) #else /* This implementation of __container_of has undefined behavior according * to the C standard, but it works in many cases. If your compiler doesn't * support typeof() and fails with this implementation, please try a newer * compiler. */ #define __container_of(ptr, sample, member) \ (void *)((char *)(ptr) \ - ((char *)&(sample)->member - (char *)(sample))) #endif /** * Loop through the list given by head and set pos to struct in the list. * * Example: * struct foo *iterator; * xorg_list_for_each_entry(iterator, &bar->list_of_foos, entry) { * [modify iterator] * } * * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe * instead. * * @param pos Iterator variable of the type of the list elements. * @param head List head * @param member Member name of the struct xorg_list in the list elements. * */ #define xorg_list_for_each_entry(pos, head, member) \ for (pos = NULL, \ pos = __container_of((head)->next, pos, member); \ &pos->member != (head); \ pos = __container_of(pos->member.next, pos, member)) /** * Loop through the list, keeping a backup pointer to the element. This * macro allows for the deletion of a list element while looping through the * list. * * See xorg_list_for_each_entry for more details. */ #define xorg_list_for_each_entry_safe(pos, tmp, head, member) \ for (pos = NULL, \ pos = __container_of((head)->next, pos, member), \ tmp = __container_of(pos->member.next, pos, member); \ &pos->member != (head); \ pos = tmp, tmp = __container_of(pos->member.next, tmp, member)) /* NULL-Terminated List Interface * * The interface below does _not_ use the struct xorg_list as described above. * It is mainly for legacy structures that cannot easily be switched to * struct xorg_list. * * This interface is for structs like * struct foo { * [...] * struct foo *next; * [...] * }; * * The position and field name of "next" are arbitrary. */ /** * Init the element as null-terminated list. * * Example: * struct foo *list = malloc(); * nt_list_init(list, next); * * @param list The list element that will be the start of the list * @param member Member name of the field pointing to next struct */ #define nt_list_init(_list, _member) \ (_list)->_member = NULL /** * Returns the next element in the list or NULL on termination. * * Example: * struct foo *element = list; * while ((element = nt_list_next(element, next)) { } * * This macro is not safe for node deletion. Use nt_list_for_each_entry_safe * instead. * * @param list The list or current element. * @param member Member name of the field pointing to next struct. */ #define nt_list_next(_list, _member) \ (_list)->_member /** * Iterate through each element in the list. * * Example: * struct foo *iterator; * nt_list_for_each_entry(iterator, list, next) { * [modify iterator] * } * * @param entry Assigned to the current list element * @param list The list to iterate through. * @param member Member name of the field pointing to next struct. */ #define nt_list_for_each_entry(_entry, _list, _member) \ for (_entry = _list; _entry; _entry = (_entry)->_member) /** * Iterate through each element in the list, keeping a backup pointer to the * element. This macro allows for the deletion of a list element while * looping through the list. * * See nt_list_for_each_entry for more details. * * @param entry Assigned to the current list element * @param tmp The pointer to the next element * @param list The list to iterate through. * @param member Member name of the field pointing to next struct. */ #define nt_list_for_each_entry_safe(_entry, _tmp, _list, _member) \ for (_entry = _list, _tmp = (_entry) ? (_entry)->_member : NULL;\ _entry; \ _entry = _tmp, _tmp = (_tmp) ? (_tmp)->_member: NULL) /** * Append the element to the end of the list. This macro may be used to * merge two lists. * * Example: * struct foo *elem = malloc(...); * nt_list_init(elem, next) * nt_list_append(elem, list, struct foo, next); * * Resulting list order: * list_item_0 -> list_item_1 -> ... -> elem_item_0 -> elem_item_1 ... * * @param entry An entry (or list) to append to the list * @param list The list to append to. This list must be a valid list, not * NULL. * @param type The list type * @param member Member name of the field pointing to next struct */ #define nt_list_append(_entry, _list, _type, _member) \ do { \ _type *__iterator = _list; \ while (__iterator->_member) { __iterator = __iterator->_member;}\ __iterator->_member = _entry; \ } while (0) /** * Insert the element at the next position in the list. This macro may be * used to insert a list into a list. * * struct foo *elem = malloc(...); * nt_list_init(elem, next) * nt_list_insert(elem, list, struct foo, next); * * Resulting list order: * list_item_0 -> elem_item_0 -> elem_item_1 ... -> list_item_1 -> ... * * @param entry An entry (or list) to append to the list * @param list The list to insert to. This list must be a valid list, not * NULL. * @param type The list type * @param member Member name of the field pointing to next struct */ #define nt_list_insert(_entry, _list, _type, _member) \ do { \ nt_list_append((_list)->_member, _entry, _type, _member); \ (_list)->_member = _entry; \ } while (0) /** * Delete the entry from the list by iterating through the list and * removing any reference from the list to the entry. * * Example: * struct foo *elem = * nt_list_del(elem, list, struct foo, next); * * @param entry The entry to delete from the list. entry is always * re-initialized as a null-terminated list. * @param list The list containing the entry, set to the new list without * the removed entry. * @param type The list type * @param member Member name of the field pointing to the next entry */ #define nt_list_del(_entry, _list, _type, _member) \ do { \ _type *__e = _entry; \ if (__e == NULL || _list == NULL) break; \ if ((_list) == __e) { \ _list = __e->_member; \ } else { \ _type *__prev = _list; \ while (__prev->_member && __prev->_member != __e) \ __prev = nt_list_next(__prev, _member); \ if (__prev->_member) \ __prev->_member = __e->_member; \ } \ nt_list_init(__e, _member); \ } while(0) /** * DO NOT USE THIS. * This is a remainder of the xfree86 DDX attempt of having a set of generic * list functions. Unfortunately, the xf86OptionRec uses it and we can't * easily get rid of it. Do not use for new code. */ typedef struct generic_list_rec { void *next; } GenericListRec, *GenericListPtr, *glp; #endif xorg-server-1.20.8/include/closestr.h0000644000175000017500000000573213640201473014447 00000000000000/* Copyright 1991, 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. */ #ifndef CLOSESTR_H #define CLOSESTR_H #include #include "closure.h" #include "dix.h" #include "misc.h" #include "gcstruct.h" /* closure structures */ /* OpenFont */ typedef struct _OFclosure { ClientPtr client; short current_fpe; short num_fpes; FontPathElementPtr *fpe_list; Mask flags; /* XXX -- get these from request buffer instead? */ const char *origFontName; int origFontNameLen; XID fontid; char *fontname; int fnamelen; FontPtr non_cachable_font; } OFclosureRec; /* ListFontsWithInfo */ #define XLFDMAXFONTNAMELEN 256 typedef struct _LFWIstate { char pattern[XLFDMAXFONTNAMELEN]; int patlen; int current_fpe; int max_names; Bool list_started; void *private; } LFWIstateRec, *LFWIstatePtr; typedef struct _LFWIclosure { ClientPtr client; int num_fpes; FontPathElementPtr *fpe_list; xListFontsWithInfoReply *reply; int length; LFWIstateRec current; LFWIstateRec saved; int savedNumFonts; Bool haveSaved; char *savedName; } LFWIclosureRec; /* ListFonts */ typedef struct _LFclosure { ClientPtr client; int num_fpes; FontPathElementPtr *fpe_list; FontNamesPtr names; LFWIstateRec current; LFWIstateRec saved; Bool haveSaved; char *savedName; int savedNameLen; } LFclosureRec; /* PolyText */ typedef struct _PTclosure { ClientPtr client; DrawablePtr pDraw; GC *pGC; unsigned char *pElt; unsigned char *endReq; unsigned char *data; int xorg; int yorg; CARD8 reqType; XID did; int err; } PTclosureRec; /* ImageText */ typedef struct _ITclosure { ClientPtr client; DrawablePtr pDraw; GC *pGC; BYTE nChars; unsigned char *data; int xorg; int yorg; CARD8 reqType; XID did; } ITclosureRec; #endif /* CLOSESTR_H */ xorg-server-1.20.8/include/events.h0000644000175000017500000000311313640201473014104 00000000000000/* * 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. * */ #ifndef EVENTS_H #define EVENTS_H typedef struct _DeviceEvent DeviceEvent; typedef struct _DeviceChangedEvent DeviceChangedEvent; typedef struct _TouchOwnershipEvent TouchOwnershipEvent; typedef struct _BarrierEvent BarrierEvent; #ifdef XFreeXDGA typedef struct _DGAEvent DGAEvent; #endif typedef struct _RawDeviceEvent RawDeviceEvent; #ifdef XQUARTZ typedef struct _XQuartzEvent XQuartzEvent; #endif typedef union _InternalEvent InternalEvent; #endif xorg-server-1.20.8/include/inputstr.h0000644000175000017500000006055213640201473014502 00000000000000/************************************************************ 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 INPUTSTRUCT_H #define INPUTSTRUCT_H #include #include #include "input.h" #include "window.h" #include "dixstruct.h" #include "cursorstr.h" #include "geext.h" #include "privates.h" extern _X_EXPORT void AssignTypeAndName(DeviceIntPtr dev, Atom type, const char *name); #define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) extern _X_EXPORT int CountBits(const uint8_t * mask, int len); #define SameClient(obj,client) \ (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) #define EMASKSIZE (MAXDEVICES + 2) /* This is the last XI2 event supported by the server. If you add * events to the protocol, the server will not support these events until * this number here is bumped. */ #define XI2LASTEVENT XI_BarrierLeave #define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */ /** * Scroll types for ::SetScrollValuator and the scroll type in the * ::ScrollInfoPtr. */ enum ScrollType { SCROLL_TYPE_NONE = 0, /**< Not a scrolling valuator */ SCROLL_TYPE_VERTICAL = 8, SCROLL_TYPE_HORIZONTAL = 9, }; /** * This struct stores the core event mask for each client except the client * that created the window. * * Each window that has events selected from other clients has at least one of * these masks. If multiple clients selected for events on the same window, * these masks are in a linked list. * * The event mask for the client that created the window is stored in * win->eventMask instead. * * The resource id is simply a fake client ID to associate this mask with a * client. * * Kludge: OtherClients and InputClients must be compatible, see code. */ typedef struct _OtherClients { OtherClientsPtr next; /**< Pointer to the next mask */ XID resource; /**< id for putting into resource manager */ Mask mask; /**< Core event mask */ } OtherClients; /** * This struct stores the XI event mask for each client. * * Each window that has events selected has at least one of these masks. If * multiple client selected for events on the same window, these masks are in * a linked list. */ typedef struct _InputClients { InputClientsPtr next; /**< Pointer to the next mask */ XID resource; /**< id for putting into resource manager */ Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */ /** XI2 event masks. One per device, each bit is a mask of (1 << type) */ struct _XI2Mask *xi2mask; } InputClients; /** * Combined XI event masks from all devices. * * This is the XI equivalent of the deliverableEvents, eventMask and * dontPropagate mask of the WindowRec (or WindowOptRec). * * A window that has an XI client selecting for events has exactly one * OtherInputMasks struct and exactly one InputClients struct hanging off * inputClients. Each further client appends to the inputClients list. * Each Mask field is per-device, with the device id as the index. * Exception: for non-device events (Presence events), the MAXDEVICES * deviceid is used. */ typedef struct _OtherInputMasks { /** * Bitwise OR of all masks by all clients and the window's parent's masks. */ Mask deliverableEvents[EMASKSIZE]; /** * Bitwise OR of all masks by all clients on this window. */ Mask inputEvents[EMASKSIZE]; /** The do-not-propagate masks for each device. */ Mask dontPropagateMask[EMASKSIZE]; /** The clients that selected for events */ InputClientsPtr inputClients; /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ struct _XI2Mask *xi2mask; } OtherInputMasks; /* * The following structure gets used for both active and passive grabs. For * active grabs some of the fields (e.g. modifiers) are not used. However, * that is not much waste since there aren't many active grabs (one per * keyboard/pointer device) going at once in the server. */ #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible modifier combinations, but only 3 buttons. */ typedef struct _DetailRec { /* Grab details may be bit masks */ unsigned int exact; Mask *pMask; } DetailRec; union _GrabMask { Mask core; Mask xi; struct _XI2Mask *xi2mask; }; /** * Central struct for device grabs. * The same struct is used for both core grabs and device grabs, with * different fields being set. * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask * is a combination of standard event masks (i.e. PointerMotionMask | * ButtonPressMask). * If the grab is a device grab (GrabDevice), then the eventMask is a * combination of event masks for a given XI event type (see SetEventInfo). * * If the grab is a result of a ButtonPress, then eventMask is the core mask * and deviceMask is set to the XI event mask for the grab. */ typedef struct _GrabRec { GrabPtr next; /* for chain of passive grabs */ XID resource; DeviceIntPtr device; WindowPtr window; unsigned ownerEvents:1; unsigned keyboardMode:1; unsigned pointerMode:1; enum InputLevel grabtype; CARD8 type; /* event type for passive grabs, 0 for active grabs */ DetailRec modifiersDetail; DeviceIntPtr modifierDevice; DetailRec detail; /* key or button */ WindowPtr confineTo; /* always NULL for keyboards */ CursorPtr cursor; /* always NULL for keyboards */ Mask eventMask; Mask deviceMask; /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ struct _XI2Mask *xi2mask; } GrabRec; /** * Sprite information for a device. */ typedef struct _SpriteRec { CursorPtr current; BoxRec hotLimits; /* logical constraints of hot spot */ Bool confined; /* confined to screen */ RegionPtr hotShape; /* additional logical shape constraint */ BoxRec physLimits; /* physical constraints of hot spot */ WindowPtr win; /* window of logical position */ HotSpot hot; /* logical pointer position */ HotSpot hotPhys; /* physical pointer position */ #ifdef PANORAMIX ScreenPtr screen; /* all others are in Screen 0 coordinates */ RegionRec Reg1; /* Region 1 for confining motion */ RegionRec Reg2; /* Region 2 for confining virtual motion */ WindowPtr windows[MAXSCREENS]; WindowPtr confineWin; /* confine window */ #endif /* The window trace information is used at dix/events.c to avoid having * to compute all the windows between the root and the current pointer * window each time a button or key goes down. The grabs on each of those * windows must be checked. * spriteTraces should only be used at dix/events.c! */ WindowPtr *spriteTrace; int spriteTraceSize; int spriteTraceGood; /* Due to delays between event generation and event processing, it is * possible that the pointer has crossed screen boundaries between the * time in which it begins generating events and the time when * those events are processed. * * pEnqueueScreen: screen the pointer was on when the event was generated * pDequeueScreen: screen the pointer was on when the event is processed */ ScreenPtr pEnqueueScreen; ScreenPtr pDequeueScreen; } SpriteRec; typedef struct _KeyClassRec { int sourceid; CARD8 down[DOWN_LENGTH]; CARD8 postdown[DOWN_LENGTH]; int modifierKeyCount[8]; struct _XkbSrvInfo *xkbInfo; } KeyClassRec, *KeyClassPtr; typedef struct _ScrollInfo { enum ScrollType type; double increment; int flags; } ScrollInfo, *ScrollInfoPtr; typedef struct _AxisInfo { int resolution; int min_resolution; int max_resolution; int min_value; int max_value; Atom label; CARD8 mode; ScrollInfo scroll; } AxisInfo, *AxisInfoPtr; typedef struct _ValuatorAccelerationRec { int number; PointerAccelSchemeProc AccelSchemeProc; void *accelData; /* at disposal of AccelScheme */ PointerAccelSchemeInitProc AccelInitProc; DeviceCallbackProc AccelCleanupProc; } ValuatorAccelerationRec, *ValuatorAccelerationPtr; typedef struct _ValuatorClassRec { int sourceid; int numMotionEvents; int first_motion; int last_motion; void *motion; /* motion history buffer. Different layout for MDs and SDs! */ WindowPtr motionHintWindow; AxisInfoPtr axes; unsigned short numAxes; double *axisVal; /* always absolute, but device-coord system */ ValuatorAccelerationRec accelScheme; int h_scroll_axis; /* horiz smooth-scrolling axis */ int v_scroll_axis; /* vert smooth-scrolling axis */ } ValuatorClassRec; typedef struct _TouchListener { XID listener; /* grabs/event selection IDs receiving * events for this touch */ int resource_type; /* listener's resource type */ enum TouchListenerType type; enum TouchListenerState state; enum InputLevel level; /* matters only for emulating touches */ WindowPtr window; GrabPtr grab; } TouchListener; typedef struct _TouchPointInfo { uint32_t client_id; /* touch ID as seen in client events */ int sourceid; /* Source device's ID for this touchpoint */ Bool active; /* whether or not the touch is active */ Bool pending_finish; /* true if the touch is physically inactive * but still owned by a grab */ SpriteRec sprite; /* window trace for delivery */ ValuatorMask *valuators; /* last recorded axis values */ TouchListener *listeners; /* set of listeners */ int num_listeners; int num_grabs; /* number of open grabs on this touch * which have not accepted or rejected */ Bool emulate_pointer; DeviceEvent *history; /* History of events on this touchpoint */ size_t history_elements; /* Number of current elements in history */ size_t history_size; /* Size of history in elements */ } TouchPointInfoRec; typedef struct _DDXTouchPointInfo { uint32_t client_id; /* touch ID as seen in client events */ Bool active; /* whether or not the touch is active */ uint32_t ddx_id; /* touch ID given by the DDX */ Bool emulate_pointer; ValuatorMask *valuators; /* last axis values as posted, pre-transform */ } DDXTouchPointInfoRec; typedef struct _TouchClassRec { int sourceid; TouchPointInfoPtr touches; unsigned short num_touches; /* number of allocated touches */ unsigned short max_touches; /* maximum number of touches, may be 0 */ CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */ /* for pointer-emulation */ CARD8 buttonsDown; /* number of buttons down */ unsigned short state; /* logical button state */ Mask motionMask; } TouchClassRec; typedef struct _ButtonClassRec { int sourceid; CARD8 numButtons; CARD8 buttonsDown; /* number of buttons currently down This counts logical buttons, not physical ones, i.e if some buttons are mapped to 0, they're not counted here */ unsigned short state; Mask motionMask; CARD8 down[DOWN_LENGTH]; CARD8 postdown[DOWN_LENGTH]; CARD8 map[MAP_LENGTH]; union _XkbAction *xkb_acts; Atom labels[MAX_BUTTONS]; } ButtonClassRec, *ButtonClassPtr; typedef struct _FocusClassRec { int sourceid; WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */ int revert; TimeStamp time; WindowPtr *trace; int traceSize; int traceGood; } FocusClassRec, *FocusClassPtr; typedef struct _ProximityClassRec { int sourceid; char in_proximity; } ProximityClassRec, *ProximityClassPtr; typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; typedef struct _StringFeedbackClassRec *StringFeedbackPtr; typedef struct _BellFeedbackClassRec *BellFeedbackPtr; typedef struct _LedFeedbackClassRec *LedFeedbackPtr; typedef struct _KbdFeedbackClassRec { BellProcPtr BellProc; KbdCtrlProcPtr CtrlProc; KeybdCtrl ctrl; KbdFeedbackPtr next; struct _XkbSrvLedInfo *xkb_sli; } KbdFeedbackClassRec; typedef struct _PtrFeedbackClassRec { PtrCtrlProcPtr CtrlProc; PtrCtrl ctrl; PtrFeedbackPtr next; } PtrFeedbackClassRec; typedef struct _IntegerFeedbackClassRec { IntegerCtrlProcPtr CtrlProc; IntegerCtrl ctrl; IntegerFeedbackPtr next; } IntegerFeedbackClassRec; typedef struct _StringFeedbackClassRec { StringCtrlProcPtr CtrlProc; StringCtrl ctrl; StringFeedbackPtr next; } StringFeedbackClassRec; typedef struct _BellFeedbackClassRec { BellProcPtr BellProc; BellCtrlProcPtr CtrlProc; BellCtrl ctrl; BellFeedbackPtr next; } BellFeedbackClassRec; typedef struct _LedFeedbackClassRec { LedCtrlProcPtr CtrlProc; LedCtrl ctrl; LedFeedbackPtr next; struct _XkbSrvLedInfo *xkb_sli; } LedFeedbackClassRec; typedef struct _ClassesRec { KeyClassPtr key; ValuatorClassPtr valuator; TouchClassPtr touch; ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; StringFeedbackPtr stringfeed; BellFeedbackPtr bell; LedFeedbackPtr leds; } ClassesRec; /* Device properties */ typedef struct _XIPropertyValue { Atom type; /* ignored by server */ short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ void *data; /* private to client */ } XIPropertyValueRec; typedef struct _XIProperty { struct _XIProperty *next; Atom propertyName; BOOL deletable; /* clients can delete this prop? */ XIPropertyValueRec value; } XIPropertyRec; typedef XIPropertyRec *XIPropertyPtr; typedef XIPropertyValueRec *XIPropertyValuePtr; typedef struct _XIPropertyHandler { struct _XIPropertyHandler *next; long id; int (*SetProperty) (DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly); int (*GetProperty) (DeviceIntPtr dev, Atom property); int (*DeleteProperty) (DeviceIntPtr dev, Atom property); } XIPropertyHandler, *XIPropertyHandlerPtr; /* states for devices */ #define NOT_GRABBED 0 #define THAWED 1 #define THAWED_BOTH 2 /* not a real state */ #define FREEZE_NEXT_EVENT 3 #define FREEZE_BOTH_NEXT_EVENT 4 #define FROZEN 5 /* any state >= has device frozen */ #define FROZEN_NO_EVENT 5 #define FROZEN_WITH_EVENT 6 #define THAW_OTHERS 7 typedef struct _GrabInfoRec { TimeStamp grabTime; Bool fromPassiveGrab; /* true if from passive grab */ Bool implicitGrab; /* implicit from ButtonPress */ GrabPtr unused; /* Kept for ABI stability, remove soon */ GrabPtr grab; CARD8 activatingKey; void (*ActivateGrab) (DeviceIntPtr /*device */ , GrabPtr /*grab */ , TimeStamp /*time */ , Bool /*autoGrab */ ); void (*DeactivateGrab) (DeviceIntPtr /*device */ ); struct { Bool frozen; int state; GrabPtr other; /* if other grab has this frozen */ DeviceEvent *event; /* saved to be replayed */ } sync; } GrabInfoRec, *GrabInfoPtr; typedef struct _SpriteInfoRec { /* sprite must always point to a valid sprite. For devices sharing the * sprite, let sprite point to a paired spriteOwner's sprite. */ SpritePtr sprite; /* sprite information */ Bool spriteOwner; /* True if device owns the sprite */ DeviceIntPtr paired; /* The paired device. Keyboard if spriteOwner is TRUE, otherwise the pointer that owns the sprite. */ /* keep states for animated cursor */ struct { CursorPtr pCursor; ScreenPtr pScreen; int elt; } anim; } SpriteInfoRec, *SpriteInfoPtr; /* device types */ #define MASTER_POINTER 1 #define MASTER_KEYBOARD 2 #define SLAVE 3 /* special types for GetMaster */ #define MASTER_ATTACHED 4 /* Master for this device */ #define KEYBOARD_OR_FLOAT 5 /* Keyboard master for this device or this device if floating */ #define POINTER_OR_FLOAT 6 /* Pointer master for this device or this device if floating */ typedef struct _DeviceIntRec { DeviceRec public; DeviceIntPtr next; Bool startup; /* true if needs to be turned on at server initialization time */ DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is used to initialize, turn on, or turn off the device */ Bool inited; /* TRUE if INIT returns Success */ Bool enabled; /* TRUE if ON returns Success */ Bool coreEvents; /* TRUE if device also sends core */ GrabInfoRec deviceGrab; /* grab on the device */ int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */ Atom xinput_type; char *name; int id; KeyClassPtr key; ValuatorClassPtr valuator; TouchClassPtr touch; ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; StringFeedbackPtr stringfeed; BellFeedbackPtr bell; LedFeedbackPtr leds; struct _XkbInterest *xkb_interest; char *config_info; /* used by the hotplug layer */ ClassesPtr unused_classes; /* for master devices */ int saved_master_id; /* for slaves while grabbed */ PrivateRec *devPrivates; DeviceUnwrapProc unwrapProc; SpriteInfoPtr spriteInfo; DeviceIntPtr master; /* master device */ DeviceIntPtr lastSlave; /* last slave device used */ /* last valuator values recorded, not posted to client; * for slave devices, valuators is in device coordinates, mapped to the * desktop * for master devices, valuators is in desktop coordinates. * see dix/getevents.c * remainder supports acceleration */ struct { double valuators[MAX_VALUATORS]; int numValuators; DeviceIntPtr slave; ValuatorMask *scroll; int num_touches; /* size of the touches array */ DDXTouchPointInfoPtr touches; } last; /* Input device property handling. */ struct { XIPropertyPtr properties; XIPropertyHandlerPtr handlers; /* NULL-terminated */ } properties; /* coordinate transformation matrix for relative movement. Matrix with * the translation component dropped */ struct pixman_f_transform relative_transform; /* scale matrix for absolute devices, this is the combined matrix of [1/scale] . [transform] . [scale]. See DeviceSetTransform */ struct pixman_f_transform scale_and_transform; /* XTest related master device id */ int xtest_master_id; struct _SyncCounter *idle_counter; } DeviceIntRec; typedef struct { int numDevices; /* total number of devices */ DeviceIntPtr devices; /* all devices turned on */ DeviceIntPtr off_devices; /* all devices turned off */ DeviceIntPtr keyboard; /* the main one for the server */ DeviceIntPtr pointer; DeviceIntPtr all_devices; DeviceIntPtr all_master_devices; } InputInfo; extern _X_EXPORT InputInfo inputInfo; /* for keeping the events for devices grabbed synchronously */ typedef struct _QdEvent *QdEventPtr; typedef struct _QdEvent { struct xorg_list next; DeviceIntPtr device; ScreenPtr pScreen; /* what screen the pointer was on */ unsigned long months; /* milliseconds is in the event */ InternalEvent *event; } QdEventRec; /** * syncEvents is the global structure for queued events. * * Devices can be frozen through GrabModeSync pointer grabs. If this is the * case, events from these devices are added to "pending" instead of being * processed normally. When the device is unfrozen, events in "pending" are * replayed and processed as if they would come from the device directly. */ typedef struct _EventSyncInfo { struct xorg_list pending; /** The device to replay events for. Only set in AllowEvents(), in which * case it is set to the device specified in the request. */ DeviceIntPtr replayDev; /* kludgy rock to put flag for */ /** * The window the events are supposed to be replayed on. * This window may be set to the grab's window (but only when * Replay{Pointer|Keyboard} is given in the XAllowEvents() * request. */ WindowPtr replayWin; /* ComputeFreezes */ /** * Flag to indicate whether we're in the process of * replaying events. Only set in ComputeFreezes(). */ Bool playingEvents; TimeStamp time; } EventSyncInfoRec, *EventSyncInfoPtr; extern EventSyncInfoRec syncEvents; /** * Given a sprite, returns the window at the bottom of the trace (i.e. the * furthest window from the root). */ static inline WindowPtr DeepestSpriteWin(SpritePtr sprite) { assert(sprite->spriteTraceGood > 0); return sprite->spriteTrace[sprite->spriteTraceGood - 1]; } struct _XI2Mask { unsigned char **masks; /* event mask in masks[deviceid][event type byte] */ size_t nmasks; /* number of masks */ size_t mask_size; /* size of each mask in bytes */ }; #endif /* INPUTSTRUCT_H */ xorg-server-1.20.8/include/eventconvert.h0000644000175000017500000000325013640201473015324 00000000000000/* * 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. * */ #ifndef _EVENTCONVERT_H_ #include #include #include "input.h" #include "events.h" #include "eventstr.h" _X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count); _X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count); _X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi); _X_INTERNAL int GetCoreType(enum EventType type); _X_INTERNAL int GetXIType(enum EventType type); _X_INTERNAL int GetXI2Type(enum EventType type); #endif /* _EVENTCONVERT_H_ */ xorg-server-1.20.8/include/xserver-properties.h0000644000175000017500000002245313640201473016500 00000000000000/* * Copyright 2008 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 * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * them 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 MERCHANTIBILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS 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. */ /* Properties managed by the server. */ #ifndef _XSERVER_PROPERTIES_H_ #define _XSERVER_PROPERTIES_H_ /* Type for a 4 byte float. Storage format IEEE 754 in client's default * byte-ordering. */ #define XATOM_FLOAT "FLOAT" /* STRING. Seat name of this display */ #define SEAT_ATOM_NAME "Xorg_Seat" /* BOOL. 0 - device disabled, 1 - device enabled */ #define XI_PROP_ENABLED "Device Enabled" /* BOOL. If present, device is a virtual XTEST device */ #define XI_PROP_XTEST_DEVICE "XTEST Device" /* CARD32, 2 values, vendor, product. * This property is set by the driver and may not be available for some * drivers. Read-Only */ #define XI_PROP_PRODUCT_ID "Device Product ID" /* Coordinate transformation matrix for absolute input devices * FLOAT, 9 values in row-major order, coordinates in 0..1 range: * [c0 c1 c2] [x] * [c3 c4 c5] * [y] * [c6 c7 c8] [1] */ #define XI_PROP_TRANSFORM "Coordinate Transformation Matrix" /* STRING. Device node path of device */ #define XI_PROP_DEVICE_NODE "Device Node" /* Pointer acceleration properties */ /* INTEGER of any format */ #define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile" /* FLOAT, format 32 */ #define ACCEL_PROP_CONSTANT_DECELERATION "Device Accel Constant Deceleration" /* FLOAT, format 32 */ #define ACCEL_PROP_ADAPTIVE_DECELERATION "Device Accel Adaptive Deceleration" /* FLOAT, format 32 */ #define ACCEL_PROP_VELOCITY_SCALING "Device Accel Velocity Scaling" /* Axis labels */ #define AXIS_LABEL_PROP "Axis Labels" #define AXIS_LABEL_PROP_REL_X "Rel X" #define AXIS_LABEL_PROP_REL_Y "Rel Y" #define AXIS_LABEL_PROP_REL_Z "Rel Z" #define AXIS_LABEL_PROP_REL_RX "Rel Rotary X" #define AXIS_LABEL_PROP_REL_RY "Rel Rotary Y" #define AXIS_LABEL_PROP_REL_RZ "Rel Rotary Z" #define AXIS_LABEL_PROP_REL_HWHEEL "Rel Horiz Wheel" #define AXIS_LABEL_PROP_REL_DIAL "Rel Dial" #define AXIS_LABEL_PROP_REL_WHEEL "Rel Vert Wheel" #define AXIS_LABEL_PROP_REL_MISC "Rel Misc" #define AXIS_LABEL_PROP_REL_VSCROLL "Rel Vert Scroll" #define AXIS_LABEL_PROP_REL_HSCROLL "Rel Horiz Scroll" /* * Absolute axes */ #define AXIS_LABEL_PROP_ABS_X "Abs X" #define AXIS_LABEL_PROP_ABS_Y "Abs Y" #define AXIS_LABEL_PROP_ABS_Z "Abs Z" #define AXIS_LABEL_PROP_ABS_RX "Abs Rotary X" #define AXIS_LABEL_PROP_ABS_RY "Abs Rotary Y" #define AXIS_LABEL_PROP_ABS_RZ "Abs Rotary Z" #define AXIS_LABEL_PROP_ABS_THROTTLE "Abs Throttle" #define AXIS_LABEL_PROP_ABS_RUDDER "Abs Rudder" #define AXIS_LABEL_PROP_ABS_WHEEL "Abs Wheel" #define AXIS_LABEL_PROP_ABS_GAS "Abs Gas" #define AXIS_LABEL_PROP_ABS_BRAKE "Abs Brake" #define AXIS_LABEL_PROP_ABS_HAT0X "Abs Hat 0 X" #define AXIS_LABEL_PROP_ABS_HAT0Y "Abs Hat 0 Y" #define AXIS_LABEL_PROP_ABS_HAT1X "Abs Hat 1 X" #define AXIS_LABEL_PROP_ABS_HAT1Y "Abs Hat 1 Y" #define AXIS_LABEL_PROP_ABS_HAT2X "Abs Hat 2 X" #define AXIS_LABEL_PROP_ABS_HAT2Y "Abs Hat 2 Y" #define AXIS_LABEL_PROP_ABS_HAT3X "Abs Hat 3 X" #define AXIS_LABEL_PROP_ABS_HAT3Y "Abs Hat 3 Y" #define AXIS_LABEL_PROP_ABS_PRESSURE "Abs Pressure" #define AXIS_LABEL_PROP_ABS_DISTANCE "Abs Distance" #define AXIS_LABEL_PROP_ABS_TILT_X "Abs Tilt X" #define AXIS_LABEL_PROP_ABS_TILT_Y "Abs Tilt Y" #define AXIS_LABEL_PROP_ABS_TOOL_WIDTH "Abs Tool Width" #define AXIS_LABEL_PROP_ABS_VOLUME "Abs Volume" #define AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major" #define AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor" #define AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR "Abs MT Width Major" #define AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR "Abs MT Width Minor" #define AXIS_LABEL_PROP_ABS_MT_ORIENTATION "Abs MT Orientation" #define AXIS_LABEL_PROP_ABS_MT_POSITION_X "Abs MT Position X" #define AXIS_LABEL_PROP_ABS_MT_POSITION_Y "Abs MT Position Y" #define AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE "Abs MT Tool Type" #define AXIS_LABEL_PROP_ABS_MT_BLOB_ID "Abs MT Blob ID" #define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID" #define AXIS_LABEL_PROP_ABS_MT_PRESSURE "Abs MT Pressure" #define AXIS_LABEL_PROP_ABS_MT_DISTANCE "Abs MT Distance" #define AXIS_LABEL_PROP_ABS_MT_TOOL_X "Abs MT Tool X" #define AXIS_LABEL_PROP_ABS_MT_TOOL_Y "Abs MT Tool Y" #define AXIS_LABEL_PROP_ABS_MISC "Abs Misc" /* Button names */ #define BTN_LABEL_PROP "Button Labels" /* Default label */ #define BTN_LABEL_PROP_BTN_UNKNOWN "Button Unknown" /* Wheel buttons */ #define BTN_LABEL_PROP_BTN_WHEEL_UP "Button Wheel Up" #define BTN_LABEL_PROP_BTN_WHEEL_DOWN "Button Wheel Down" #define BTN_LABEL_PROP_BTN_HWHEEL_LEFT "Button Horiz Wheel Left" #define BTN_LABEL_PROP_BTN_HWHEEL_RIGHT "Button Horiz Wheel Right" /* The following are from linux/input.h */ #define BTN_LABEL_PROP_BTN_0 "Button 0" #define BTN_LABEL_PROP_BTN_1 "Button 1" #define BTN_LABEL_PROP_BTN_2 "Button 2" #define BTN_LABEL_PROP_BTN_3 "Button 3" #define BTN_LABEL_PROP_BTN_4 "Button 4" #define BTN_LABEL_PROP_BTN_5 "Button 5" #define BTN_LABEL_PROP_BTN_6 "Button 6" #define BTN_LABEL_PROP_BTN_7 "Button 7" #define BTN_LABEL_PROP_BTN_8 "Button 8" #define BTN_LABEL_PROP_BTN_9 "Button 9" #define BTN_LABEL_PROP_BTN_LEFT "Button Left" #define BTN_LABEL_PROP_BTN_RIGHT "Button Right" #define BTN_LABEL_PROP_BTN_MIDDLE "Button Middle" #define BTN_LABEL_PROP_BTN_SIDE "Button Side" #define BTN_LABEL_PROP_BTN_EXTRA "Button Extra" #define BTN_LABEL_PROP_BTN_FORWARD "Button Forward" #define BTN_LABEL_PROP_BTN_BACK "Button Back" #define BTN_LABEL_PROP_BTN_TASK "Button Task" #define BTN_LABEL_PROP_BTN_TRIGGER "Button Trigger" #define BTN_LABEL_PROP_BTN_THUMB "Button Thumb" #define BTN_LABEL_PROP_BTN_THUMB2 "Button Thumb2" #define BTN_LABEL_PROP_BTN_TOP "Button Top" #define BTN_LABEL_PROP_BTN_TOP2 "Button Top2" #define BTN_LABEL_PROP_BTN_PINKIE "Button Pinkie" #define BTN_LABEL_PROP_BTN_BASE "Button Base" #define BTN_LABEL_PROP_BTN_BASE2 "Button Base2" #define BTN_LABEL_PROP_BTN_BASE3 "Button Base3" #define BTN_LABEL_PROP_BTN_BASE4 "Button Base4" #define BTN_LABEL_PROP_BTN_BASE5 "Button Base5" #define BTN_LABEL_PROP_BTN_BASE6 "Button Base6" #define BTN_LABEL_PROP_BTN_DEAD "Button Dead" #define BTN_LABEL_PROP_BTN_A "Button A" #define BTN_LABEL_PROP_BTN_B "Button B" #define BTN_LABEL_PROP_BTN_C "Button C" #define BTN_LABEL_PROP_BTN_X "Button X" #define BTN_LABEL_PROP_BTN_Y "Button Y" #define BTN_LABEL_PROP_BTN_Z "Button Z" #define BTN_LABEL_PROP_BTN_TL "Button T Left" #define BTN_LABEL_PROP_BTN_TR "Button T Right" #define BTN_LABEL_PROP_BTN_TL2 "Button T Left2" #define BTN_LABEL_PROP_BTN_TR2 "Button T Right2" #define BTN_LABEL_PROP_BTN_SELECT "Button Select" #define BTN_LABEL_PROP_BTN_START "Button Start" #define BTN_LABEL_PROP_BTN_MODE "Button Mode" #define BTN_LABEL_PROP_BTN_THUMBL "Button Thumb Left" #define BTN_LABEL_PROP_BTN_THUMBR "Button Thumb Right" #define BTN_LABEL_PROP_BTN_TOOL_PEN "Button Tool Pen" #define BTN_LABEL_PROP_BTN_TOOL_RUBBER "Button Tool Rubber" #define BTN_LABEL_PROP_BTN_TOOL_BRUSH "Button Tool Brush" #define BTN_LABEL_PROP_BTN_TOOL_PENCIL "Button Tool Pencil" #define BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH "Button Tool Airbrush" #define BTN_LABEL_PROP_BTN_TOOL_FINGER "Button Tool Finger" #define BTN_LABEL_PROP_BTN_TOOL_MOUSE "Button Tool Mouse" #define BTN_LABEL_PROP_BTN_TOOL_LENS "Button Tool Lens" #define BTN_LABEL_PROP_BTN_TOUCH "Button Touch" #define BTN_LABEL_PROP_BTN_STYLUS "Button Stylus" #define BTN_LABEL_PROP_BTN_STYLUS2 "Button Stylus2" #define BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP "Button Tool Doubletap" #define BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP "Button Tool Tripletap" #define BTN_LABEL_PROP_BTN_GEAR_DOWN "Button Gear down" #define BTN_LABEL_PROP_BTN_GEAR_UP "Button Gear up" #endif xorg-server-1.20.8/include/dix-config-apple-verbatim.h0000644000175000017500000000042713640201473017542 00000000000000/* Do not include this file directly. It is included at the end of */ /* Correctly set _XSERVER64 for OSX fat binaries */ #if defined(__LP64__) && !defined(_XSERVER64) #define _XSERVER64 1 #elif !defined(__LP64__) && defined(_XSERVER64) #undef _XSERVER64 #endif xorg-server-1.20.8/include/property.h0000644000175000017500000000714713640201473014477 00000000000000/*********************************************************** 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 PROPERTY_H #define PROPERTY_H #include "window.h" typedef struct _Property *PropertyPtr; typedef struct _PropertyStateRec { WindowPtr win; PropertyPtr prop; int state; } PropertyStateRec; extern CallbackListPtr PropertyStateCallback; extern _X_EXPORT int dixLookupProperty(PropertyPtr * /*result */ , WindowPtr /*pWin */ , Atom /*proprty */ , ClientPtr /*pClient */ , Mask /*access_mode */ ); extern _X_EXPORT int dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent); extern _X_EXPORT int DeleteProperty(ClientPtr /*client */ , WindowPtr /*pWin */ , Atom /*propName */ ); extern _X_EXPORT void DeleteAllWindowProperties(WindowPtr /*pWin */ ); #endif /* PROPERTY_H */ xorg-server-1.20.8/include/version-config.h.in0000644000175000017500000000040213640201473016133 00000000000000/* version-config.h.in: not generated */ #ifndef VERSION_CONFIG_H #define VERSION_CONFIG_H /* Vendor man version */ #undef VENDOR_MAN_VERSION /* Vendor name */ #undef VENDOR_NAME /* Vendor release */ #undef VENDOR_RELEASE #endif /* VERSION_CONFIG_H */ xorg-server-1.20.8/include/xkbfile.h0000644000175000017500000002407113640201473014232 00000000000000/************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. 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 Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS 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 _XKBFILE_H_ #define _XKBFILE_H_ 1 #include "xkbstr.h" /***====================================================================***/ #define XkbXKMFile 0 #define XkbCFile 1 #define XkbXKBFile 2 #define XkbMessage 3 #define XkbMapDefined (1<<0) #define XkbStateDefined (1<<1) typedef void (*XkbFileAddOnFunc) (FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , Bool /* showImplicit */ , int /* fileSection */ , void * /* priv */ ); /***====================================================================***/ #define _XkbSuccess 0 #define _XkbErrMissingNames 1 #define _XkbErrMissingTypes 2 #define _XkbErrMissingReqTypes 3 #define _XkbErrMissingSymbols 4 #define _XkbErrMissingVMods 5 #define _XkbErrMissingIndicators 6 #define _XkbErrMissingCompatMap 7 #define _XkbErrMissingSymInterps 8 #define _XkbErrMissingGeometry 9 #define _XkbErrIllegalDoodad 10 #define _XkbErrIllegalTOCType 11 #define _XkbErrIllegalContents 12 #define _XkbErrEmptyFile 13 #define _XkbErrFileNotFound 14 #define _XkbErrFileCannotOpen 15 #define _XkbErrBadValue 16 #define _XkbErrBadMatch 17 #define _XkbErrBadTypeName 18 #define _XkbErrBadTypeWidth 19 #define _XkbErrBadFileType 20 #define _XkbErrBadFileVersion 21 #define _XkbErrBadFileFormat 22 #define _XkbErrBadAlloc 23 #define _XkbErrBadLength 24 #define _XkbErrXReqFailure 25 #define _XkbErrBadImplementation 26 /***====================================================================***/ _XFUNCPROTOBEGIN extern _X_EXPORT char *XkbIndentText(unsigned /* size */ ); extern _X_EXPORT char *XkbAtomText(Atom /* atm */ , unsigned /* format */ ); extern _X_EXPORT char *XkbKeysymText(KeySym /* sym */ , unsigned /* format */ ); extern _X_EXPORT char *XkbStringText(char * /* str */ , unsigned /* format */ ); extern _X_EXPORT char *XkbKeyNameText(char * /* name */ , unsigned /* format */ ); extern _X_EXPORT char *XkbModIndexText(unsigned /* ndx */ , unsigned /* format */ ); extern _X_EXPORT char *XkbModMaskText(unsigned /* mask */ , unsigned /* format */ ); extern _X_EXPORT char *XkbVModIndexText(XkbDescPtr /* xkb */ , unsigned /* ndx */ , unsigned /* format */ ); extern _X_EXPORT char *XkbVModMaskText(XkbDescPtr /* xkb */ , unsigned /* modMask */ , unsigned /* mask */ , unsigned /* format */ ); extern _X_EXPORT char *XkbConfigText(unsigned /* config */ , unsigned /* format */ ); extern _X_EXPORT const char *XkbSIMatchText(unsigned /* type */ , unsigned /* format */ ); extern _X_EXPORT char *XkbIMWhichStateMaskText(unsigned /* use_which */ , unsigned /* format */ ); extern _X_EXPORT char *XkbControlsMaskText(unsigned /* ctrls */ , unsigned /* format */ ); extern _X_EXPORT char *XkbGeomFPText(int /* val */ , unsigned /* format */ ); extern _X_EXPORT char *XkbDoodadTypeText(unsigned /* type */ , unsigned /* format */ ); extern _X_EXPORT const char *XkbActionTypeText(unsigned /* type */ , unsigned /* format */ ); extern _X_EXPORT char *XkbActionText(XkbDescPtr /* xkb */ , XkbAction * /* action */ , unsigned /* format */ ); extern _X_EXPORT char *XkbBehaviorText(XkbDescPtr /* xkb */ , XkbBehavior * /* behavior */ , unsigned /* format */ ); /***====================================================================***/ #define _XkbKSLower (1<<0) #define _XkbKSUpper (1<<1) #define XkbKSIsLower(k) (_XkbKSCheckCase(k)&_XkbKSLower) #define XkbKSIsUpper(k) (_XkbKSCheckCase(k)&_XkbKSUpper) #define XkbKSIsKeypad(k) (((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal)) #define XkbKSIsDeadKey(k) \ (((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound)) extern _X_EXPORT unsigned _XkbKSCheckCase(KeySym /* sym */ ); extern _X_EXPORT int XkbFindKeycodeByName(XkbDescPtr /* xkb */ , char * /* name */ , Bool /* use_aliases */ ); /***====================================================================***/ extern _X_EXPORT Atom XkbInternAtom(char * /* name */ , Bool /* onlyIfExists */ ); /***====================================================================***/ #ifdef _XKBGEOM_H_ #define XkbDW_Unknown 0 #define XkbDW_Doodad 1 #define XkbDW_Section 2 typedef struct _XkbDrawable { int type; int priority; union { XkbDoodadPtr doodad; XkbSectionPtr section; } u; struct _XkbDrawable *next; } XkbDrawableRec, *XkbDrawablePtr; #endif /***====================================================================***/ extern _X_EXPORT unsigned XkbConvertGetByNameComponents(Bool /* toXkm */ , unsigned /* orig */ ); extern _X_EXPORT Bool XkbNameMatchesPattern(char * /* name */ , char * /* pattern */ ); /***====================================================================***/ extern _X_EXPORT Bool XkbWriteXKBKeycodes(FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , Bool /* showImplicit */ , XkbFileAddOnFunc /* addOn */ , void * /* priv */ ); extern _X_EXPORT Bool XkbWriteXKBKeyTypes(FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , Bool /* showImplicit */ , XkbFileAddOnFunc /* addOn */ , void * /* priv */ ); extern _X_EXPORT Bool XkbWriteXKBCompatMap(FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , Bool /* showImplicit */ , XkbFileAddOnFunc /* addOn */ , void * /* priv */ ); extern _X_EXPORT Bool XkbWriteXKBSymbols(FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , Bool /* showImplicit */ , XkbFileAddOnFunc /* addOn */ , void * /* priv */ ); extern _X_EXPORT Bool XkbWriteXKBGeometry(FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , Bool /* showImplicit */ , XkbFileAddOnFunc /* addOn */ , void * /* priv */ ); extern _X_EXPORT Bool XkbWriteXKBKeymapForNames(FILE * /* file */ , XkbComponentNamesPtr /* names */ , XkbDescPtr /* xkb */ , unsigned /* want */ , unsigned /* need */ ); /***====================================================================***/ extern _X_EXPORT Bool XkmProbe(FILE * /* file */ ); extern _X_EXPORT unsigned XkmReadFile(FILE * /* file */ , unsigned /* need */ , unsigned /* want */ , XkbDescPtr * /* result */ ); _XFUNCPROTOEND #endif /* _XKBFILE_H_ */ xorg-server-1.20.8/include/input.h0000644000175000017500000010062513640201473013745 00000000000000/************************************************************ 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 INPUT_H #define INPUT_H #include "misc.h" #include "screenint.h" #include #include #include #include "window.h" /* for WindowPtr */ #include "xkbrules.h" #include "events.h" #include "list.h" #include "os.h" #include #define DEVICE_INIT 0 #define DEVICE_ON 1 #define DEVICE_OFF 2 #define DEVICE_CLOSE 3 #define DEVICE_ABORT 4 #define POINTER_RELATIVE (1 << 1) #define POINTER_ABSOLUTE (1 << 2) #define POINTER_ACCELERATE (1 << 3) #define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */ #define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */ #define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */ #define POINTER_DESKTOP (1 << 7) /* Data in desktop coordinates */ /* GetTouchEvent flags */ #define TOUCH_ACCEPT (1 << 0) #define TOUCH_REJECT (1 << 1) #define TOUCH_PENDING_END (1 << 2) #define TOUCH_CLIENT_ID (1 << 3) /* touch ID is the client-visible id */ #define TOUCH_REPLAYING (1 << 4) /* event is being replayed */ #define TOUCH_POINTER_EMULATED (1 << 5) /* touch event may be pointer emulated */ #define TOUCH_END (1 << 6) /* really end this touch now */ /*int constants for pointer acceleration schemes*/ #define PtrAccelNoOp 0 #define PtrAccelPredictable 1 #define PtrAccelLightweight 2 #define PtrAccelDefault PtrAccelPredictable #define MAX_VALUATORS 36 /* Maximum number of valuators, divided by six, rounded up, to get number * of events. */ #define MAX_VALUATOR_EVENTS 6 #define MAX_BUTTONS 256 /* completely arbitrarily chosen */ #define NO_AXIS_LIMITS -1 #define MAP_LENGTH MAX_BUTTONS #define DOWN_LENGTH (MAX_BUTTONS/8) /* 256/8 => number of bytes to hold 256 bits */ #define NullGrab ((GrabPtr)NULL) #define PointerRootWin ((WindowPtr)PointerRoot) #define NoneWin ((WindowPtr)None) #define NullDevice ((DevicePtr)NULL) #ifndef FollowKeyboard #define FollowKeyboard 3 #endif #ifndef FollowKeyboardWin #define FollowKeyboardWin ((WindowPtr) FollowKeyboard) #endif #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif enum InputLevel { CORE = 1, XI = 2, XI2 = 3, }; typedef unsigned long Leds; typedef struct _OtherClients *OtherClientsPtr; typedef struct _InputClients *InputClientsPtr; typedef struct _DeviceIntRec *DeviceIntPtr; typedef struct _ValuatorClassRec *ValuatorClassPtr; typedef struct _ClassesRec *ClassesPtr; typedef struct _SpriteRec *SpritePtr; typedef struct _TouchClassRec *TouchClassPtr; typedef struct _TouchPointInfo *TouchPointInfoPtr; typedef struct _DDXTouchPointInfo *DDXTouchPointInfoPtr; typedef union _GrabMask GrabMask; typedef struct _ValuatorMask ValuatorMask; /* The DIX stores incoming input events in this list */ extern InternalEvent *InputEventList; typedef int (*DeviceProc) (DeviceIntPtr /*device */ , int /*what */ ); typedef void (*ProcessInputProc) (InternalEvent * /*event */ , DeviceIntPtr /*device */ ); typedef Bool (*DeviceHandleProc) (DeviceIntPtr /*device */ , void * /*data */ ); typedef void (*DeviceUnwrapProc) (DeviceIntPtr /*device */ , DeviceHandleProc /*proc */ , void * /*data */ ); /* pointer acceleration handling */ typedef void (*PointerAccelSchemeProc) (DeviceIntPtr /*device */ , ValuatorMask * /*valuators */ , CARD32 /*evtime */ ); typedef void (*DeviceCallbackProc) (DeviceIntPtr /*pDev */ ); struct _ValuatorAccelerationRec; typedef Bool (*PointerAccelSchemeInitProc) (DeviceIntPtr /*dev */ , struct _ValuatorAccelerationRec * /*protoScheme */ ); typedef struct _DeviceRec { void *devicePrivate; ProcessInputProc processInputProc; /* current */ ProcessInputProc realInputProc; /* deliver */ ProcessInputProc enqueueInputProc; /* enqueue */ Bool on; /* used by DDX to keep state */ } DeviceRec, *DevicePtr; typedef struct { int click, bell, bell_pitch, bell_duration; Bool autoRepeat; unsigned char autoRepeats[32]; Leds leds; unsigned char id; } KeybdCtrl; typedef struct { KeySym *map; KeyCode minKeyCode, maxKeyCode; int mapWidth; } KeySymsRec, *KeySymsPtr; typedef struct { int num, den, threshold; unsigned char id; } PtrCtrl; typedef struct { int resolution, min_value, max_value; int integer_displayed; unsigned char id; } IntegerCtrl; typedef struct { int max_symbols, num_symbols_supported; int num_symbols_displayed; KeySym *symbols_supported; KeySym *symbols_displayed; unsigned char id; } StringCtrl; typedef struct { int percent, pitch, duration; unsigned char id; } BellCtrl; typedef struct { Leds led_values; Mask led_mask; unsigned char id; } LedCtrl; extern _X_EXPORT KeybdCtrl defaultKeyboardControl; extern _X_EXPORT PtrCtrl defaultPointerControl; typedef struct _InputOption InputOption; typedef struct _XI2Mask XI2Mask; typedef struct _InputAttributes { char *product; char *vendor; char *device; char *pnp_id; char *usb_id; char **tags; /* null-terminated */ uint32_t flags; } InputAttributes; #define ATTR_KEYBOARD (1<<0) #define ATTR_POINTER (1<<1) #define ATTR_JOYSTICK (1<<2) #define ATTR_TABLET (1<<3) #define ATTR_TOUCHPAD (1<<4) #define ATTR_TOUCHSCREEN (1<<5) #define ATTR_KEY (1<<6) #define ATTR_TABLET_PAD (1<<7) /* Key/Button has been run through all input processing and events sent to clients. */ #define KEY_PROCESSED 1 #define BUTTON_PROCESSED 1 /* Key/Button has not been fully processed, no events have been sent. */ #define KEY_POSTED 2 #define BUTTON_POSTED 2 extern _X_EXPORT void set_key_down(DeviceIntPtr pDev, int key_code, int type); extern _X_EXPORT void set_key_up(DeviceIntPtr pDev, int key_code, int type); extern _X_EXPORT int key_is_down(DeviceIntPtr pDev, int key_code, int type); extern _X_EXPORT void set_button_down(DeviceIntPtr pDev, int button, int type); extern _X_EXPORT void set_button_up(DeviceIntPtr pDev, int button, int type); extern _X_EXPORT int button_is_down(DeviceIntPtr pDev, int button, int type); extern void InitCoreDevices(void); extern void InitXTestDevices(void); extern _X_EXPORT DeviceIntPtr AddInputDevice(ClientPtr /*client */ , DeviceProc /*deviceProc */ , Bool /*autoStart */ ); extern _X_EXPORT Bool EnableDevice(DeviceIntPtr /*device */ , BOOL /* sendevent */ ); extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ , BOOL /* sendevent */ ); extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ , BOOL /* sendevent */ ); extern void DisableAllDevices(void); extern int InitAndStartDevices(void); extern void CloseDownDevices(void); extern void AbortDevices(void); extern void UndisplayDevices(void); extern _X_EXPORT int RemoveDevice(DeviceIntPtr /*dev */ , BOOL /* sendevent */ ); extern _X_EXPORT int NumMotionEvents(void); extern _X_EXPORT int dixLookupDevice(DeviceIntPtr * /* dev */ , int /* id */ , ClientPtr /* client */ , Mask /* access_mode */ ); extern _X_EXPORT void QueryMinMaxKeyCodes(KeyCode * /*minCode */ , KeyCode * /*maxCode */ ); extern _X_EXPORT Bool InitButtonClassDeviceStruct(DeviceIntPtr /*device */ , int /*numButtons */ , Atom * /* labels */ , CARD8 * /*map */ ); extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(ValuatorClassPtr src, int numAxes); extern _X_EXPORT Bool InitValuatorClassDeviceStruct(DeviceIntPtr /*device */ , int /*numAxes */ , Atom * /* labels */ , int /*numMotionEvents */ , int /*mode */ ); extern _X_EXPORT Bool InitPointerAccelerationScheme(DeviceIntPtr /*dev */ , int /*scheme */ ); extern _X_EXPORT Bool InitFocusClassDeviceStruct(DeviceIntPtr /*device */ ); extern _X_EXPORT Bool InitTouchClassDeviceStruct(DeviceIntPtr /*device */ , unsigned int /*max_touches */ , unsigned int /*mode */ , unsigned int /*numAxes */ ); typedef void (*BellProcPtr) (int percent, DeviceIntPtr device, void *ctrl, int feedbackClass); typedef void (*KbdCtrlProcPtr) (DeviceIntPtr /*device */ , KeybdCtrl * /*ctrl */ ); typedef void (*PtrCtrlProcPtr) (DeviceIntPtr /*device */ , PtrCtrl * /*ctrl */ ); extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(DeviceIntPtr /*device */ , PtrCtrlProcPtr /*controlProc */ ); typedef void (*StringCtrlProcPtr) (DeviceIntPtr /*device */ , StringCtrl * /*ctrl */ ); extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(DeviceIntPtr /*device */ , StringCtrlProcPtr /*controlProc */ , int /*max_symbols */ , int /*num_symbols_supported */ , KeySym * /*symbols */ ); typedef void (*BellCtrlProcPtr) (DeviceIntPtr /*device */ , BellCtrl * /*ctrl */ ); extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(DeviceIntPtr /*device */ , BellProcPtr /*bellProc */ , BellCtrlProcPtr /*controlProc */ ); typedef void (*LedCtrlProcPtr) (DeviceIntPtr /*device */ , LedCtrl * /*ctrl */ ); extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(DeviceIntPtr /*device */ , LedCtrlProcPtr /*controlProc */ ); typedef void (*IntegerCtrlProcPtr) (DeviceIntPtr /*device */ , IntegerCtrl * /*ctrl */ ); extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr /*device */ , IntegerCtrlProcPtr /*controlProc */ ); extern _X_EXPORT Bool InitPointerDeviceStruct(DevicePtr /*device */ , CARD8 * /*map */ , int /*numButtons */ , Atom * /* btn_labels */ , PtrCtrlProcPtr /*controlProc */ , int /*numMotionEvents */ , int /*numAxes */ , Atom * /* axes_labels */ ); extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ , XkbRMLVOSet * /*rmlvo */ , BellProcPtr /*bellProc */ , KbdCtrlProcPtr /*controlProc */ ); extern _X_EXPORT Bool InitKeyboardDeviceStructFromString(DeviceIntPtr dev, const char *keymap, int keymap_length, BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func); extern int ApplyPointerMapping(DeviceIntPtr /* pDev */ , CARD8 * /* map */ , int /* len */ , ClientPtr /* client */ ); extern Bool BadDeviceMap(BYTE * /*buff */ , int /*length */ , unsigned /*low */ , unsigned /*high */ , XID * /*errval */ ); extern void NoteLedState(DeviceIntPtr /*keybd */ , int /*led */ , Bool /*on */ ); extern void MaybeStopHint(DeviceIntPtr /*device */ , ClientPtr /*client */ ); extern void ProcessPointerEvent(InternalEvent * /* ev */ , DeviceIntPtr /*mouse */ ); extern void ProcessKeyboardEvent(InternalEvent * /*ev */ , DeviceIntPtr /*keybd */ ); extern Bool LegalModifier(unsigned int /*key */ , DeviceIntPtr /*pDev */ ); extern _X_EXPORT void ProcessInputEvents(void); extern _X_EXPORT void InitInput(int /*argc */ , char ** /*argv */ ); extern _X_EXPORT void CloseInput(void); extern _X_EXPORT int GetMaximumEventsNum(void); extern _X_EXPORT InternalEvent *InitEventList(int num_events); extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events); extern void CreateClassesChangedEvent(InternalEvent *event, DeviceIntPtr master, DeviceIntPtr slave, int flags); extern InternalEvent *UpdateFromMaster(InternalEvent *events, DeviceIntPtr pDev, int type, int *num_events); extern _X_EXPORT int GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons, int flags, const ValuatorMask *mask); extern _X_EXPORT void QueuePointerEvents(DeviceIntPtr pDev, int type, int buttons, int flags, const ValuatorMask *mask); extern _X_EXPORT int GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int key_code); extern _X_EXPORT void QueueKeyboardEvents(DeviceIntPtr pDev, int type, int key_code); extern int GetTouchEvents(InternalEvent *events, DeviceIntPtr pDev, uint32_t ddx_touchid, uint16_t type, uint32_t flags, const ValuatorMask *mask); void QueueTouchEvents(DeviceIntPtr device, int type, uint32_t ddx_touchid, int flags, const ValuatorMask *mask); extern int GetTouchOwnershipEvents(InternalEvent *events, DeviceIntPtr pDev, TouchPointInfoPtr ti, uint8_t mode, XID resource, uint32_t flags); extern void GetDixTouchEnd(InternalEvent *ievent, DeviceIntPtr dev, TouchPointInfoPtr ti, uint32_t flags); extern _X_EXPORT int GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask); extern _X_EXPORT void QueueProximityEvents(DeviceIntPtr pDev, int type, const ValuatorMask *mask); #ifdef PANORAMIX _X_EXPORT #endif extern void PostSyntheticMotion(DeviceIntPtr pDev, int x, int y, int screen, unsigned long time); extern _X_EXPORT int GetMotionHistorySize(void); extern _X_EXPORT void AllocateMotionHistory(DeviceIntPtr pDev); extern _X_EXPORT int GetMotionHistory(DeviceIntPtr pDev, xTimecoord ** buff, unsigned long start, unsigned long stop, ScreenPtr pScreen, BOOL core); extern void ReleaseButtonsAndKeys(DeviceIntPtr dev); extern int AttachDevice(ClientPtr client, DeviceIntPtr slave, DeviceIntPtr master); extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); extern _X_EXPORT DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); extern _X_EXPORT int AllocDevicePair(ClientPtr client, const char *name, DeviceIntPtr *ptr, DeviceIntPtr *keybd, DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master); extern void DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to, DeviceChangedEvent *dce); /* Helper functions. */ extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, KeyCode **modkeymap, int *max_keys_per_mod); extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, int max_keys_per_mod); extern int AllocXTestDevice(ClientPtr client, const char *name, DeviceIntPtr *ptr, DeviceIntPtr *keybd, DeviceIntPtr master_ptr, DeviceIntPtr master_keybd); extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master); extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master); extern void SendDevicePresenceEvent(int deviceid, int type); extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes * attrs); extern _X_EXPORT void FreeInputAttributes(InputAttributes * attrs); enum TouchListenerState { LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */ LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */ LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already accepted */ LISTENER_IS_OWNER, /**< Is the current owner, hasn't accepted */ LISTENER_HAS_ACCEPTED, /**< Is the current owner, has accepted */ LISTENER_HAS_END, /**< Has already received the end event */ }; enum TouchListenerType { LISTENER_GRAB, LISTENER_POINTER_GRAB, LISTENER_REGULAR, LISTENER_POINTER_REGULAR, }; extern void TouchInitDDXTouchPoint(DeviceIntPtr dev, DDXTouchPointInfoPtr ddxtouch); extern DDXTouchPointInfoPtr TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id); extern void TouchEndDDXTouch(DeviceIntPtr dev, DDXTouchPointInfoPtr ti); extern DDXTouchPointInfoPtr TouchFindByDDXID(DeviceIntPtr dev, uint32_t ddx_id, Bool create); extern Bool TouchInitTouchPoint(TouchClassPtr touch, ValuatorClassPtr v, int index); extern void TouchFreeTouchPoint(DeviceIntPtr dev, int index); extern TouchPointInfoPtr TouchBeginTouch(DeviceIntPtr dev, int sourceid, uint32_t touchid, Bool emulate_pointer); extern TouchPointInfoPtr TouchFindByClientID(DeviceIntPtr dev, uint32_t client_id); extern void TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti); extern Bool TouchEventHistoryAllocate(TouchPointInfoPtr ti); extern void TouchEventHistoryFree(TouchPointInfoPtr ti); extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev); extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource); extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource); extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, enum InputLevel level, enum TouchListenerType type, enum TouchListenerState state, WindowPtr window, GrabPtr grab); extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource); extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev); extern Bool TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, InternalEvent *ev); extern Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite); extern int TouchConvertToPointerEvent(const InternalEvent *ev, InternalEvent *motion, InternalEvent *button); extern int TouchGetPointerEventType(const InternalEvent *ev); extern void TouchRemovePointerGrab(DeviceIntPtr dev); extern void TouchListenerGone(XID resource); extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener, int mode); extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, Window grab_window, XID *error); extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev); extern void TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti, Time time, XID resource); extern void TouchEmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource); extern void TouchAcceptAndEnd(DeviceIntPtr dev, int touchid); /* misc event helpers */ extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients); extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev); extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type); void FixUpEventFromWindow(SpritePtr pSprite, xEvent *xE, WindowPtr pWin, Window child, Bool calcChild); extern Bool PointInBorderSize(WindowPtr pWin, int x, int y); extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win); extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab, InternalEvent *ev, InternalEvent *real_event); /** * Masks specifying the type of event to deliver for an InternalEvent; used * by EventIsDeliverable. * @defgroup EventIsDeliverable return flags * @{ */ #define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */ #define EVENT_CORE_MASK (1 << 1) /**< Core event */ #define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */ #define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */ /* @} */ enum EventDeliveryState { EVENT_DELIVERED, /**< Event has been delivered to a client */ EVENT_NOT_DELIVERED, /**< Event was not delivered to any client */ EVENT_SKIP, /**< Event can be discarded by the caller */ EVENT_REJECTED, /**< Event was rejected for delivery to the client */ }; /* Implemented by the DDX. */ extern _X_EXPORT int NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, DeviceIntPtr *dev); extern _X_EXPORT void DeleteInputDeviceRequest(DeviceIntPtr dev); extern _X_EXPORT void RemoveInputDeviceTraces(const char *config_info); extern _X_EXPORT void DDXRingBell(int volume, int pitch, int duration); #define VALUATOR_MODE_ALL_AXES -1 extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis); extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); /* Set to TRUE by default - os/utils.c sets it to FALSE on user request, xfixes/cursor.c uses it to determine if the cursor is enabled */ extern Bool EnableCursor; /* Set to FALSE by default - ChangeWindowAttributes sets it to TRUE on * CWCursor, xfixes/cursor.c uses it to determine if the cursor is enabled */ extern Bool CursorVisible; extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask); extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, int first_valuator, int num_valuators, const int *valuators); extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, int valuator, int data); extern _X_EXPORT void valuator_mask_set_double(ValuatorMask *mask, int valuator, double data); extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask); extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask); extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit); extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit); extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask); extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src); extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum); extern _X_EXPORT double valuator_mask_get_double(const ValuatorMask *mask, int valnum); extern _X_EXPORT Bool valuator_mask_fetch(const ValuatorMask *mask, int valnum, int *val); extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask, int valnum, double *val); extern _X_EXPORT Bool valuator_mask_has_unaccelerated(const ValuatorMask *mask); extern _X_EXPORT void valuator_mask_set_unaccelerated(ValuatorMask *mask, int valuator, double accel, double unaccel); extern _X_EXPORT void valuator_mask_set_absolute_unaccelerated(ValuatorMask *mask, int valuator, int absolute, double unaccel); extern _X_EXPORT double valuator_mask_get_accelerated(const ValuatorMask *mask, int valuator); extern _X_EXPORT double valuator_mask_get_unaccelerated(const ValuatorMask *mask, int valuator); extern _X_EXPORT Bool valuator_mask_fetch_unaccelerated(const ValuatorMask *mask, int valuator, double *accel, double *unaccel); extern _X_HIDDEN void valuator_mask_drop_unaccelerated(ValuatorMask *mask); /* InputOption handling interface */ extern _X_EXPORT InputOption *input_option_new(InputOption *list, const char *key, const char *value); extern _X_EXPORT void input_option_free_list(InputOption **opt); extern _X_EXPORT InputOption *input_option_free_element(InputOption *opt, const char *key); extern _X_EXPORT InputOption *input_option_find(InputOption *list, const char *key); extern _X_EXPORT const char *input_option_get_key(const InputOption *opt); extern _X_EXPORT const char *input_option_get_value(const InputOption *opt); extern _X_EXPORT void input_option_set_key(InputOption *opt, const char *key); extern _X_EXPORT void input_option_set_value(InputOption *opt, const char *value); extern _X_HIDDEN Bool point_on_screen(ScreenPtr pScreen, int x, int y); extern _X_HIDDEN void update_desktop_dimensions(void); extern _X_HIDDEN void input_constrain_cursor(DeviceIntPtr pDev, ScreenPtr screen, int current_x, int current_y, int dest_x, int dest_y, int *out_x, int *out_y, int *nevents, InternalEvent* events); extern _X_EXPORT void input_lock(void); extern _X_EXPORT void input_unlock(void); extern _X_EXPORT void input_force_unlock(void); extern _X_EXPORT int in_input_thread(void); extern void InputThreadPreInit(void); extern void InputThreadInit(void); extern void InputThreadFini(void); extern int InputThreadRegisterDev(int fd, NotifyFdProcPtr readInputProc, void *readInputArgs); extern int InputThreadUnregisterDev(int fd); extern _X_EXPORT Bool InputThreadEnable; #endif /* INPUT_H */ xorg-server-1.20.8/include/Xprintf.h0000644000175000017500000000613513640201473014241 00000000000000/* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef XPRINTF_H #define XPRINTF_H #include #include #include #ifndef _X_RESTRICT_KYWD #if defined(restrict) /* assume autoconf set it correctly */ || \ (defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ #define _X_RESTRICT_KYWD restrict #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ #define _X_RESTRICT_KYWD __restrict__ #else #define _X_RESTRICT_KYWD #endif #endif /* * These functions provide a portable implementation of the common (but not * yet universal) asprintf & vasprintf routines to allocate a buffer big * enough to sprintf the arguments to. The XNF variants terminate the server * if the allocation fails. * The buffer allocated is returned in the pointer provided in the first * argument. The return value is the size of the allocated buffer, or -1 * on failure. */ extern _X_EXPORT int Xasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT int Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va) _X_ATTRIBUTE_PRINTF(2, 0); extern _X_EXPORT int XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT int XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va) _X_ATTRIBUTE_PRINTF(2, 0); #if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF) #define asprintf Xasprintf #define vasprintf Xvasprintf #endif /* * These functions provide a portable implementation of the linux kernel * scnprintf & vscnprintf routines that return the number of bytes actually * copied during a snprintf, (excluding the final '\0'). */ extern _X_EXPORT int Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...) _X_ATTRIBUTE_PRINTF(3,4); extern _X_EXPORT int Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va) _X_ATTRIBUTE_PRINTF(3,0); #endif /* XPRINTF_H */ xorg-server-1.20.8/include/Makefile.in0000644000175000017500000007543713640201514014512 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = do-not-use-config.h xorg-server.h dix-config.h \ xorg-config.h xkb-config.h xwin-config.h xwayland-config.h \ version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" "$(DESTDIR)$(sdkdir)" am__sdk_HEADERS_DIST = XIstubs.h Xprintf.h callback.h client.h \ closestr.h closure.h colormap.h colormapst.h hotplug.h \ cursor.h cursorstr.h dix.h dixaccess.h dixevents.h dixfont.h \ dixfontstr.h dixgrabs.h dixstruct.h events.h exevents.h \ extension.h extinit.h extnsionst.h gc.h gcstruct.h globals.h \ glx_extinit.h glxvndabi.h input.h inputstr.h list.h misc.h \ miscstruct.h opaque.h nonsdk_extinit.h optionstr.h os.h \ pixmap.h pixmapstr.h privates.h property.h propertyst.h \ ptrveloc.h region.h regionstr.h registry.h resource.h rgb.h \ screenint.h scrnintstr.h selection.h servermd.h site.h \ validate.h displaymode.h window.h windowstr.h xkbfile.h \ xkbsrv.h xkbstr.h xkbrules.h xserver_poll.h \ xserver-properties.h HEADERS = $(nodist_sdk_HEADERS) $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)do-not-use-config.h.in xorg-server.h.in dix-config.h.in \ xorg-config.h.in xkb-config.h.in xwin-config.h.in \ xwayland-config.h.in version-config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/dix-config.h.in \ $(srcdir)/do-not-use-config.h.in $(srcdir)/version-config.h.in \ $(srcdir)/xkb-config.h.in $(srcdir)/xorg-config.h.in \ $(srcdir)/xorg-server.h.in $(srcdir)/xwayland-config.h.in \ $(srcdir)/xwin-config.h.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @XORG_TRUE@sdk_HEADERS = \ @XORG_TRUE@ XIstubs.h \ @XORG_TRUE@ Xprintf.h \ @XORG_TRUE@ callback.h \ @XORG_TRUE@ client.h \ @XORG_TRUE@ closestr.h \ @XORG_TRUE@ closure.h \ @XORG_TRUE@ colormap.h \ @XORG_TRUE@ colormapst.h \ @XORG_TRUE@ hotplug.h \ @XORG_TRUE@ cursor.h \ @XORG_TRUE@ cursorstr.h \ @XORG_TRUE@ dix.h \ @XORG_TRUE@ dixaccess.h \ @XORG_TRUE@ dixevents.h \ @XORG_TRUE@ dixfont.h \ @XORG_TRUE@ dixfontstr.h \ @XORG_TRUE@ dixgrabs.h \ @XORG_TRUE@ dixstruct.h \ @XORG_TRUE@ events.h \ @XORG_TRUE@ exevents.h \ @XORG_TRUE@ extension.h \ @XORG_TRUE@ extinit.h \ @XORG_TRUE@ extnsionst.h \ @XORG_TRUE@ gc.h \ @XORG_TRUE@ gcstruct.h \ @XORG_TRUE@ globals.h \ @XORG_TRUE@ glx_extinit.h \ @XORG_TRUE@ glxvndabi.h \ @XORG_TRUE@ input.h \ @XORG_TRUE@ inputstr.h \ @XORG_TRUE@ list.h \ @XORG_TRUE@ misc.h \ @XORG_TRUE@ miscstruct.h \ @XORG_TRUE@ opaque.h \ @XORG_TRUE@ nonsdk_extinit.h \ @XORG_TRUE@ optionstr.h \ @XORG_TRUE@ os.h \ @XORG_TRUE@ pixmap.h \ @XORG_TRUE@ pixmapstr.h \ @XORG_TRUE@ privates.h \ @XORG_TRUE@ property.h \ @XORG_TRUE@ propertyst.h \ @XORG_TRUE@ ptrveloc.h \ @XORG_TRUE@ region.h \ @XORG_TRUE@ regionstr.h \ @XORG_TRUE@ registry.h \ @XORG_TRUE@ resource.h \ @XORG_TRUE@ rgb.h \ @XORG_TRUE@ screenint.h \ @XORG_TRUE@ scrnintstr.h \ @XORG_TRUE@ selection.h \ @XORG_TRUE@ servermd.h \ @XORG_TRUE@ site.h \ @XORG_TRUE@ validate.h \ @XORG_TRUE@ displaymode.h \ @XORG_TRUE@ window.h \ @XORG_TRUE@ windowstr.h \ @XORG_TRUE@ xkbfile.h \ @XORG_TRUE@ xkbsrv.h \ @XORG_TRUE@ xkbstr.h \ @XORG_TRUE@ xkbrules.h \ @XORG_TRUE@ xserver_poll.h \ @XORG_TRUE@ xserver-properties.h @XORG_TRUE@nodist_sdk_HEADERS = xorg-server.h AM_CFLAGS = $(DIX_CFLAGS) EXTRA_DIST = \ busfault.h dbus-core.h \ dix-config-apple-verbatim.h \ eventconvert.h eventstr.h inpututils.h \ probes.h \ protocol-versions.h \ swaprep.h \ swapreq.h \ systemd-logind.h \ vidmodestr.h \ xorg-config.h.meson.in \ xorg-server.h.meson.in \ xwayland-config.h.meson.in \ xwin-config.h.meson.in \ xsha1.h all: do-not-use-config.h xorg-server.h dix-config.h xorg-config.h xkb-config.h xwin-config.h xwayland-config.h version-config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): do-not-use-config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/do-not-use-config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/do-not-use-config.h $(srcdir)/do-not-use-config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ xorg-server.h: stamp-h2 @test -f $@ || rm -f stamp-h2 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h2 stamp-h2: $(srcdir)/xorg-server.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status include/xorg-server.h dix-config.h: stamp-h3 @test -f $@ || rm -f stamp-h3 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h3 stamp-h3: $(srcdir)/dix-config.h.in $(top_builddir)/config.status @rm -f stamp-h3 cd $(top_builddir) && $(SHELL) ./config.status include/dix-config.h xorg-config.h: stamp-h4 @test -f $@ || rm -f stamp-h4 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h4 stamp-h4: $(srcdir)/xorg-config.h.in $(top_builddir)/config.status @rm -f stamp-h4 cd $(top_builddir) && $(SHELL) ./config.status include/xorg-config.h xkb-config.h: stamp-h5 @test -f $@ || rm -f stamp-h5 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h5 stamp-h5: $(srcdir)/xkb-config.h.in $(top_builddir)/config.status @rm -f stamp-h5 cd $(top_builddir) && $(SHELL) ./config.status include/xkb-config.h xwin-config.h: stamp-h6 @test -f $@ || rm -f stamp-h6 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h6 stamp-h6: $(srcdir)/xwin-config.h.in $(top_builddir)/config.status @rm -f stamp-h6 cd $(top_builddir) && $(SHELL) ./config.status include/xwin-config.h xwayland-config.h: stamp-h7 @test -f $@ || rm -f stamp-h7 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h7 stamp-h7: $(srcdir)/xwayland-config.h.in $(top_builddir)/config.status @rm -f stamp-h7 cd $(top_builddir) && $(SHELL) ./config.status include/xwayland-config.h version-config.h: stamp-h8 @test -f $@ || rm -f stamp-h8 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h8 stamp-h8: $(srcdir)/version-config.h.in $(top_builddir)/config.status @rm -f stamp-h8 cd $(top_builddir) && $(SHELL) ./config.status include/version-config.h distclean-hdr: -rm -f do-not-use-config.h stamp-h1 xorg-server.h stamp-h2 dix-config.h stamp-h3 xorg-config.h stamp-h4 xkb-config.h stamp-h5 xwin-config.h stamp-h6 xwayland-config.h stamp-h7 version-config.h stamp-h8 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nodist_sdkHEADERS: $(nodist_sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-nodist_sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) do-not-use-config.h xorg-server.h \ dix-config.h xorg-config.h xkb-config.h xwin-config.h \ xwayland-config.h version-config.h installdirs: for dir in "$(DESTDIR)$(sdkdir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nodist_sdkHEADERS install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nodist_sdkHEADERS uninstall-sdkHEADERS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-nodist_sdkHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-nodist_sdkHEADERS uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/include/do-not-use-config.h.in0000644000175000017500000004441613640201510016445 00000000000000/* include/do-not-use-config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Default base font path */ #undef BASE_FONT_PATH /* Support BigRequests extension */ #undef BIGREQS /* Define to 1 if `struct sockaddr_in' has a `sin_len' member */ #undef BSD44SOCKETS /* Builder address */ #undef BUILDERADDR /* Builder string */ #undef BUILDERSTRING /* Prefix to use for bundle identifiers */ #undef BUNDLE_ID_PREFIX /* Include busfault OS API */ #undef BUSFAULT /* Support client ID tracking */ #undef CLIENTIDS /* Default font path */ #undef COMPILEDDEFAULTFONTPATH /* Support Composite Extension */ #undef COMPOSITE /* Use the HAL hotplug API */ #undef CONFIG_HAL /* Use libudev for input hotplug */ #undef CONFIG_UDEV /* Use libudev for kms enumeration */ #undef CONFIG_UDEV_KMS /* Use wscons for input auto configuration */ #undef CONFIG_WSCONS /* System is BSD-like */ #undef CSRG_BASED /* Simple debug messages */ #undef CYGDEBUG /* Debug window manager */ #undef CYGMULTIWINDOW_DEBUG /* Debug messages for window handling */ #undef CYGWINDOWING_DEBUG /* Support Damage extension */ #undef DAMAGE /* Support DBE extension */ #undef DBE /* Use ddxBeforeReset */ #undef DDXBEFORERESET /* Use OsVendorVErrorF */ #undef DDXOSVERRORF /* Enable debugging code */ #undef DEBUG /* Default library install path */ #undef DEFAULT_LIBRARY_PATH /* Default log location */ #undef DEFAULT_LOGDIR /* Default logfile prefix */ #undef DEFAULT_LOGPREFIX /* Default module search path */ #undef DEFAULT_MODULE_PATH /* Default XDG_DATA dir under HOME */ #undef DEFAULT_XDG_DATA_HOME /* Default log dir under XDG_DATA_HOME */ #undef DEFAULT_XDG_DATA_HOME_LOGDIR /* Support DGA extension */ #undef DGA /* Support DPMS extension */ #undef DPMSExtension /* Build DRI2 extension */ #undef DRI2 /* Build DRI3 extension */ #undef DRI3 /* Default DRI driver path */ #undef DRI_DRIVER_PATH /* Fallback input driver */ #undef FALLBACK_INPUT_DRIVER /* Have gbm_bo_create_with_modifiers */ #undef GBM_BO_WITH_MODIFIERS /* Build glamor */ #undef GLAMOR /* Have GLAMOR_HAS_EGL_QUERY_DMABUF */ #undef GLAMOR_HAS_EGL_QUERY_DMABUF /* Have GLAMOR_HAS_EGL_QUERY_DRIVER */ #undef GLAMOR_HAS_EGL_QUERY_DRIVER /* Build glamor with GBM-based EGL support */ #undef GLAMOR_HAS_GBM /* Have GBM_BO_USE_LINEAR */ #undef GLAMOR_HAS_GBM_LINEAR /* Build GLX extension */ #undef GLXEXT /* Support XDM-AUTH*-1 */ #undef HASXDMAUTH /* System has /dev/xf86 aperture driver */ #undef HAS_APERTURE_DRV /* Cygwin has /dev/windows for signaling new win32 messages */ #undef HAS_DEVWINDOWS /* Support SHM */ #undef HAS_SHM /* Use Windows sockets */ #undef HAS_WINSOCK /* Define to 1 if you have the `arc4random_buf' function. */ #undef HAVE_ARC4RANDOM_BUF /* Define to 1 if you have the `authdes_create' function. */ #undef HAVE_AUTHDES_CREATE /* Define to 1 if you have the `authdes_seccreate' function. */ #undef HAVE_AUTHDES_SECCREATE /* Has backtrace support */ #undef HAVE_BACKTRACE /* Define to 1 if you have the `cbrt' function. */ #undef HAVE_CBRT /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Have D-Bus support */ #undef HAVE_DBUS /* Define to 1 if you have the declaration of `program_invocation_short_name', and to 0 if you don't. */ #undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `epoll_create1' function. */ #undef HAVE_EPOLL_CREATE1 /* Have execinfo.h */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FNMATCH_H /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE /* Define to 1 if you have the `geteuid' function. */ #undef HAVE_GETEUID /* Define to 1 if you have the `getifaddrs' function. */ #undef HAVE_GETIFADDRS /* Define to 1 if you have the `getpeereid' function. */ #undef HAVE_GETPEEREID /* Define to 1 if you have the `getpeerucred' function. */ #undef HAVE_GETPEERUCRED /* Define to 1 if you have the `getprogname' function. */ #undef HAVE_GETPROGNAME /* Define to 1 if you have the `getresuid' function. */ #undef HAVE_GETRESUID /* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID /* Define to 1 if you have the `getzoneid' function. */ #undef HAVE_GETZONEID /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isastream' function. */ #undef HAVE_ISASTREAM /* Define to 1 if you have the `issetugid' function. */ #undef HAVE_ISSETUGID /* Define to 1 if you have the `audit' library (-laudit). */ #undef HAVE_LIBAUDIT /* Define to 1 if you have the header file. */ #undef HAVE_LIBAUDIT_H /* Define to 1 if you have the `bsd' library (-lbsd). */ #undef HAVE_LIBBSD /* Define to 1 if you have the libdispatch (GCD) available */ #undef HAVE_LIBDISPATCH /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if libudev is available. */ #undef HAVE_LIBUDEV /* Have libunwind support */ #undef HAVE_LIBUNWIND /* Define to 1 if you have the `ws2_32' library (-lws2_32). */ #undef HAVE_LIBWS2_32 /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_AGPGART_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_APM_BIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FB_H /* Define to 1 if you have the `memfd_create' function. */ #undef HAVE_MEMFD_CREATE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mkostemp' function. */ #undef HAVE_MKOSTEMP /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define to 1 if you have the `posix_fallocate' function. */ #undef HAVE_POSIX_FALLOCATE /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT /* Have function pthread_setname_np(const char*) */ #undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID /* Have function pthread_setname_np(pthread_t, const char*) */ #undef HAVE_PTHREAD_SETNAME_NP_WITH_TID /* Define to 1 if you have the `reallocarray' function. */ #undef HAVE_REALLOCARRAY /* Define to 1 if you have the `seteuid' function. */ #undef HAVE_SETEUID /* Define to 1 if you have the `setitimer' function. */ #undef HAVE_SETITIMER /* Use CommonCrypto SHA1 functions */ #undef HAVE_SHA1_IN_COMMONCRYPTO /* Use CryptoAPI SHA1 functions */ #undef HAVE_SHA1_IN_CRYPTOAPI /* Use libc SHA1 functions */ #undef HAVE_SHA1_IN_LIBC /* Use libgcrypt SHA1 functions */ #undef HAVE_SHA1_IN_LIBGCRYPT /* Use libmd SHA1 functions */ #undef HAVE_SHA1_IN_LIBMD /* Use libnettle SHA1 functions */ #undef HAVE_SHA1_IN_LIBNETTLE /* Use libsha1 for SHA1 */ #undef HAVE_SHA1_IN_LIBSHA1 /* Define to 1 if you have the `shmctl64' function. */ #undef HAVE_SHMCTL64 /* Have sigaction function */ #undef HAVE_SIGACTION /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if libsystemd-daemon is available */ #undef HAVE_SYSTEMD_DAEMON /* Define to 1 if SYSV IPC is available */ #undef HAVE_SYSV_IPC /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AGPGART_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AGPIO_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_KD_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LINKER_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MKDEV_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSMACROS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UTSNAME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VT_H /* Define to 1 if you have the `timingsafe_memcmp' function. */ #undef HAVE_TIMINGSAFE_MEMCMP /* Define to 1 if typeof works with your compiler. */ #undef HAVE_TYPEOF /* Define to 1 if you have the `udev_enumerate_add_match_tag' function. */ #undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG /* Define to 1 if you have the `udev_monitor_filter_add_match_tag' function. */ #undef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `walkcontext' function. */ #undef HAVE_WALKCONTEXT /* Have xshmfence support */ #undef HAVE_XSHMFENCE /* Use a separate input thread */ #undef INPUTTHREAD /* Support IPv6 for TCP connections */ #undef IPv6 /* Listen on local socket */ #undef LISTEN_LOCAL /* Listen on TCP socket */ #undef LISTEN_TCP /* Listen on Unix socket */ #undef LISTEN_UNIX /* Support os-specific local connections */ #undef LOCALCONN /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Support MIT-SHM extension */ #undef MITSHM /* Have monotonic clock from clock_gettime() */ #undef MONOTONIC_CLOCK /* Enable D-Bus core */ #undef NEED_DBUS /* Need XFree86 helper functions */ #undef NEED_XF86_PROTOTYPES /* Need XFree86 typedefs */ #undef NEED_XF86_TYPES /* Define to 1 if no local socket credentials interface exists */ #undef NO_LOCAL_CLIENT_CRED /* Operating System Name */ #undef OSNAME /* Operating System Vendor */ #undef OSVENDOR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Internal define for Xinerama */ #undef PANORAMIX /* System has PC console */ #undef PCCONS_SUPPORT /* Default PCI text file ID path */ #undef PCI_TXT_IDS_PATH /* System has PC console */ #undef PCVT_SUPPORT /* Support Present extension */ #undef PRESENT /* Overall prefix */ #undef PROJECTROOT /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Support RANDR extension */ #undef RANDR /* Make PROJECT_ROOT relative to the xserver location */ #undef RELOCATE_PROJECTROOT /* Support RENDER extension */ #undef RENDER /* Support X resource extension */ #undef RES /* Build Rootless code */ #undef ROOTLESS /* Support MIT-SCREEN-SAVER extension */ #undef SCREENSAVER /* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */ #undef SECURE_RPC /* Server miscellaneous config path */ #undef SERVER_MISC_CONFIG_PATH /* Support SHAPE extension */ #undef SHAPE /* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* Build a standalone xpbproxy */ #undef STANDALONE_XPBPROXY /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Where to install the Xorg binary and Xorg.wrap */ #undef SUID_WRAPPER_DIR /* Define to 1 on systems derived from System V Release 4 */ #undef SVR4 /* sysconfdir */ #undef SYSCONFDIR /* System has syscons console */ #undef SYSCONS_SUPPORT /* Enable systemd-logind integration */ #undef SYSTEMD_LOGIND /* Support TCP socket connections */ #undef TCPCONN /* Support UNIX socket connections */ #undef UNIXCONN /* NetBSD PIO alpha IO */ #undef USE_ALPHA_PIO /* BSD AMD64 iopl */ #undef USE_AMD64_IOPL /* BSD /dev/io */ #undef USE_DEV_IO /* BSD i386 iopl */ #undef USE_I386_IOPL /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Vendor man version */ #undef VENDOR_MAN_VERSION /* Vendor name */ #undef VENDOR_NAME /* Vendor name */ #undef VENDOR_NAME_SHORT /* Vendor release */ #undef VENDOR_RELEASE /* Version number of package */ #undef VERSION /* Building with libdrm support */ #undef WITH_LIBDRM /* Building vgahw module */ #undef WITH_VGAHW /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* System has wscons console */ #undef WSCONS_SUPPORT /* Build X-ACE extension */ #undef XACE /* Support XCMisc extension */ #undef XCMISC /* Name of configuration directory */ #undef XCONFIGDIR /* Name of configuration file */ #undef XCONFIGFILE /* Build Security extension */ #undef XCSECURITY /* Support XDM Control Protocol */ #undef XDMCP /* Support XF86 Big font extension */ #undef XF86BIGFONT /* Name of configuration file */ #undef XF86CONFIGFILE /* Build DRI extension */ #undef XF86DRI /* Support APM/ACPI power management in the server */ #undef XF86PM /* Support XFree86 Video Mode extension */ #undef XF86VIDMODE /* Support XFixes extension */ #undef XFIXES /* Building XFree86 server */ #undef XFree86Server /* Build XDGA support */ #undef XFreeXDGA /* Support Xinerama extension */ #undef XINERAMA /* Support X Input extension */ #undef XINPUT /* Path to XKB data */ #undef XKB_BASE_DIRECTORY /* Path to XKB bin dir */ #undef XKB_BIN_DIRECTORY /* Default XKB layout */ #undef XKB_DFLT_LAYOUT /* Default XKB model */ #undef XKB_DFLT_MODEL /* Default XKB options */ #undef XKB_DFLT_OPTIONS /* Default XKB ruleset */ #undef XKB_DFLT_RULES /* Default XKB variant */ #undef XKB_DFLT_VARIANT /* Path to XKB output dir */ #undef XKM_OUTPUT_DIR /* Building Xorg server */ #undef XORGSERVER /* Vendor man version */ #undef XORG_MAN_VERSION /* Building Xorg server */ #undef XORG_SERVER /* Current Xorg version */ #undef XORG_VERSION_CURRENT /* Have Quartz */ #undef XQUARTZ /* Support application updating through sparkle. */ #undef XQUARTZ_SPARKLE /* Support Record extension */ #undef XRECORD /* Build SELinux extension */ #undef XSELINUX /* Define to 1 if the DTrace Xserver provider probes should be built in. */ #undef XSERVER_DTRACE /* Use libpciaccess for all pci manipulation */ #undef XSERVER_LIBPCIACCESS /* X server supports platform device enumeration */ #undef XSERVER_PLATFORM_BUS /* Support XSync extension */ #undef XSYNC /* Support XTest extension */ #undef XTEST /* Enable xtrans fd passing support */ #undef XTRANS_SEND_FDS /* Support Xv extension */ #undef XV /* Vendor name */ #undef XVENDORNAME /* Short vendor name */ #undef XVENDORNAMESHORT /* Build xwayland with eglstream support */ #undef XWL_HAS_EGLSTREAM /* Build xwayland with glamor support */ #undef XWL_HAS_GLAMOR /* byte order */ #undef X_BYTE_ORDER /* Build Xv extension */ #undef XvExtension /* Build XvMC extension */ #undef XvMCExtension /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Enable GNU and other extensions to the C environment for glibc */ #undef _GNU_SOURCE /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Defined if needed to expose struct msghdr.msg_control */ #undef _XOPEN_SOURCE /* Define to 1 if unsigned long is 64 bits. */ #undef _XSERVER64 /* Vendor web address for support */ #undef __VENDORDWEBSUPPORT__ /* Name of X server */ #undef __XSERVERNAME__ /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if does not define. */ #undef pid_t /* Define to __typeof__ if your compiler spells it that way. */ #undef typeof xorg-server-1.20.8/include/globals.h0000644000175000017500000000232013640201473014222 00000000000000 #ifndef _XSERV_GLOBAL_H_ #define _XSERV_GLOBAL_H_ #include "window.h" /* for WindowPtr */ #include "extinit.h" #ifdef DPMSExtension /* sigh, too many drivers assume this */ #include #endif /* Global X server variables that are visible to mi, dix, os, and ddx */ extern _X_EXPORT CARD32 defaultScreenSaverTime; extern _X_EXPORT CARD32 defaultScreenSaverInterval; extern _X_EXPORT CARD32 ScreenSaverTime; extern _X_EXPORT CARD32 ScreenSaverInterval; #ifdef SCREENSAVER extern _X_EXPORT Bool screenSaverSuspended; #endif extern _X_EXPORT const char *defaultFontPath; extern _X_EXPORT int monitorResolution; extern _X_EXPORT int defaultColorVisualClass; extern _X_EXPORT int GrabInProgress; extern _X_EXPORT Bool noTestExtensions; extern _X_EXPORT char *SeatId; extern _X_EXPORT char *ConnectionInfo; extern _X_EXPORT sig_atomic_t inSignalContext; #ifdef PANORAMIX extern _X_EXPORT Bool PanoramiXExtensionDisabledHack; #endif #ifdef XSELINUX #define SELINUX_MODE_DEFAULT 0 #define SELINUX_MODE_DISABLED 1 #define SELINUX_MODE_PERMISSIVE 2 #define SELINUX_MODE_ENFORCING 3 extern _X_EXPORT int selinuxEnforcingState; #endif #endif /* !_XSERV_GLOBAL_H_ */ xorg-server-1.20.8/include/registry.h0000644000175000017500000000355413640201473014461 00000000000000/*********************************************************** 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 AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #ifndef DIX_REGISTRY_H #define DIX_REGISTRY_H /* * Result returned from any unsuccessful lookup */ #define XREGISTRY_UNKNOWN "" #include "resource.h" #include "extnsionst.h" #if defined(XSELINUX) || defined(RES) #define X_REGISTRY_RESOURCE 1 #endif #if defined(XSELINUX) || defined(XCSECURITY) || defined(XSERVER_DTRACE) #define X_REGISTRY_REQUEST 1 #endif /* Internal string registry - for auditing, debugging, security, etc. */ #ifdef X_REGISTRY_RESOURCE /* Functions used by the X-Resource extension */ extern _X_EXPORT void RegisterResourceName(RESTYPE type, const char *name); extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype); #endif #ifdef X_REGISTRY_REQUEST extern _X_EXPORT void RegisterExtensionNames(ExtensionEntry * ext); /* * Lookup functions. The returned string must not be modified or freed. */ extern _X_EXPORT const char *LookupMajorName(int major); extern _X_EXPORT const char *LookupRequestName(int major, int minor); extern _X_EXPORT const char *LookupEventName(int event); extern _X_EXPORT const char *LookupErrorName(int error); #endif /* * Setup and teardown */ extern _X_EXPORT void dixResetRegistry(void); extern _X_EXPORT void dixFreeRegistry(void); extern _X_EXPORT void dixCloseRegistry(void); #endif /* DIX_REGISTRY_H */ xorg-server-1.20.8/include/regionstr.h0000644000175000017500000002517713640201473014632 00000000000000/*********************************************************** 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 REGIONSTRUCT_H #define REGIONSTRUCT_H typedef struct pixman_region16 RegionRec, *RegionPtr; #include "miscstruct.h" /* Return values from RectIn() */ #define rgnOUT 0 #define rgnIN 1 #define rgnPART 2 #define NullRegion ((RegionPtr)0) /* * clip region */ typedef struct pixman_region16_data RegDataRec, *RegDataPtr; extern _X_EXPORT BoxRec RegionEmptyBox; extern _X_EXPORT RegDataRec RegionEmptyData; extern _X_EXPORT RegDataRec RegionBrokenData; static inline Bool RegionNil(RegionPtr reg) { return ((reg)->data && !(reg)->data->numRects); } /* not a region */ static inline Bool RegionNar(RegionPtr reg) { return ((reg)->data == &RegionBrokenData); } static inline int RegionNumRects(RegionPtr reg) { return ((reg)->data ? (reg)->data->numRects : 1); } static inline int RegionSize(RegionPtr reg) { return ((reg)->data ? (reg)->data->size : 0); } static inline BoxPtr RegionRects(RegionPtr reg) { return ((reg)->data ? (BoxPtr) ((reg)->data + 1) : &(reg)->extents); } static inline BoxPtr RegionBoxptr(RegionPtr reg) { return ((BoxPtr) ((reg)->data + 1)); } static inline BoxPtr RegionBox(RegionPtr reg, int i) { return (&RegionBoxptr(reg)[i]); } static inline BoxPtr RegionTop(RegionPtr reg) { return RegionBox(reg, (reg)->data->numRects); } static inline BoxPtr RegionEnd(RegionPtr reg) { return RegionBox(reg, (reg)->data->numRects - 1); } static inline size_t RegionSizeof(size_t n) { if (n < ((INT_MAX - sizeof(RegDataRec)) / sizeof(BoxRec))) return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); else return 0; } static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) { if ((_rect) != NULL) { (_pReg)->extents = *(_rect); (_pReg)->data = (RegDataPtr) NULL; } else { size_t rgnSize; (_pReg)->extents = RegionEmptyBox; if (((_size) > 1) && ((rgnSize = RegionSizeof(_size)) > 0) && (((_pReg)->data = (RegDataPtr) malloc(rgnSize)) != NULL)) { (_pReg)->data->size = (_size); (_pReg)->data->numRects = 0; } else (_pReg)->data = &RegionEmptyData; } } static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes) { return pixman_region_init_rects(pReg, boxes, nBoxes); } static inline void RegionUninit(RegionPtr _pReg) { if ((_pReg)->data && (_pReg)->data->size) { free((_pReg)->data); (_pReg)->data = NULL; } } static inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox) { (_pReg)->extents = *(_pBox); RegionUninit(_pReg); (_pReg)->data = (RegDataPtr) NULL; } static inline Bool RegionNotEmpty(RegionPtr _pReg) { return !RegionNil(_pReg); } static inline Bool RegionBroken(RegionPtr _pReg) { return RegionNar(_pReg); } static inline void RegionEmpty(RegionPtr _pReg) { RegionUninit(_pReg); (_pReg)->extents.x2 = (_pReg)->extents.x1; (_pReg)->extents.y2 = (_pReg)->extents.y1; (_pReg)->data = &RegionEmptyData; } static inline BoxPtr RegionExtents(RegionPtr _pReg) { return (&(_pReg)->extents); } static inline void RegionNull(RegionPtr _pReg) { (_pReg)->extents = RegionEmptyBox; (_pReg)->data = &RegionEmptyData; } extern _X_EXPORT void InitRegions(void); extern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ , int /*size */ ); extern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ ); extern _X_EXPORT RegionPtr RegionDuplicate(RegionPtr /* pOld */); static inline Bool RegionCopy(RegionPtr dst, RegionPtr src) { return pixman_region_copy(dst, src); } static inline Bool RegionIntersect(RegionPtr newReg, /* destination Region */ RegionPtr reg1, RegionPtr reg2 /* source regions */ ) { return pixman_region_intersect(newReg, reg1, reg2); } static inline Bool RegionUnion(RegionPtr newReg, /* destination Region */ RegionPtr reg1, RegionPtr reg2 /* source regions */ ) { return pixman_region_union(newReg, reg1, reg2); } extern _X_EXPORT Bool RegionAppend(RegionPtr /*dstrgn */ , RegionPtr /*rgn */ ); extern _X_EXPORT Bool RegionValidate(RegionPtr /*badreg */ , Bool * /*pOverlap */ ); extern _X_EXPORT RegionPtr RegionFromRects(int /*nrects */ , xRectanglePtr /*prect */ , int /*ctype */ ); /*- *----------------------------------------------------------------------- * Subtract -- * Subtract regS from regM and leave the result in regD. * S stands for subtrahend, M for minuend and D for difference. * * Results: * TRUE if successful. * * Side Effects: * regD is overwritten. * *----------------------------------------------------------------------- */ static inline Bool RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS) { return pixman_region_subtract(regD, regM, regS); } /*- *----------------------------------------------------------------------- * Inverse -- * Take a region and a box and return a region that is everything * in the box but not in the region. The careful reader will note * that this is the same as subtracting the region from the box... * * Results: * TRUE. * * Side Effects: * newReg is overwritten. * *----------------------------------------------------------------------- */ static inline Bool RegionInverse(RegionPtr newReg, /* Destination region */ RegionPtr reg1, /* Region to invert */ BoxPtr invRect /* Bounding box for inversion */ ) { return pixman_region_inverse(newReg, reg1, invRect); } static inline int RegionContainsRect(RegionPtr region, BoxPtr prect) { return pixman_region_contains_rectangle(region, prect); } /* TranslateRegion(pReg, x, y) translates in place */ static inline void RegionTranslate(RegionPtr pReg, int x, int y) { pixman_region_translate(pReg, x, y); } extern _X_EXPORT Bool RegionBreak(RegionPtr /*pReg */ ); static inline Bool RegionContainsPoint(RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */ ) { return pixman_region_contains_point(pReg, x, y, box); } static inline Bool RegionEqual(RegionPtr reg1, RegionPtr reg2) { return pixman_region_equal(reg1, reg2); } extern _X_EXPORT Bool RegionRectAlloc(RegionPtr /*pRgn */ , int /*n */ ); #ifdef DEBUG extern _X_EXPORT Bool RegionIsValid(RegionPtr /*prgn */ ); #endif extern _X_EXPORT void RegionPrint(RegionPtr /*pReg */ ); #define INCLUDE_LEGACY_REGION_DEFINES #ifdef INCLUDE_LEGACY_REGION_DEFINES #define REGION_NIL RegionNil #define REGION_NAR RegionNar #define REGION_NUM_RECTS RegionNumRects #define REGION_SIZE RegionSize #define REGION_RECTS RegionRects #define REGION_BOXPTR RegionBoxptr #define REGION_BOX RegionBox #define REGION_TOP RegionTop #define REGION_END RegionEnd #define REGION_SZOF RegionSizeof #define BITMAP_TO_REGION BitmapToRegion #define REGION_CREATE(pScreen, r, s) RegionCreate(r,s) #define REGION_COPY(pScreen, d, r) RegionCopy(d, r) #define REGION_DESTROY(pScreen, r) RegionDestroy(r) #define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2) #define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2) #define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2) #define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b) #define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y) #define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b) #define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b) #define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2) #define REGION_APPEND(pScreen, d, r) RegionAppend(d, r) #define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o) #define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c) #define REGION_BREAK(pScreen, r) RegionBreak(r) #define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s) #define REGION_UNINIT(pScreen, r) RegionUninit(r) #define REGION_RESET(pScreen, r, b) RegionReset(r, b) #define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r) #define REGION_BROKEN(pScreen, r) RegionBroken(r) #define REGION_EMPTY(pScreen, r) RegionEmpty(r) #define REGION_EXTENTS(pScreen, r) RegionExtents(r) #define REGION_NULL(pScreen, r) RegionNull(r) #endif /* INCLUDE_LEGACY_REGION_DEFINES */ #endif /* REGIONSTRUCT_H */ xorg-server-1.20.8/include/extension.h0000644000175000017500000001067413640201473014626 00000000000000/*********************************************************** 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. ******************************************************************/ /* * 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). */ #ifndef EXTENSION_H #define EXTENSION_H #include #include "dixstruct.h" typedef void (*InitExtension) (void); typedef struct { InitExtension initFunc; const char *name; Bool *disablePtr; } ExtensionModule; extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client */ ); extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable); extern _X_EXPORT void EnableDisableExtensionError(const char *name, Bool enable); extern _X_EXPORT void InitExtensions(int argc, char **argv); extern _X_EXPORT void CloseDownExtensions(void); extern _X_EXPORT void LoadExtensionList(const ExtensionModule ext[], int listSize, Bool external); #endif /* EXTENSION_H */ xorg-server-1.20.8/include/xorg-server.h.meson.in0000644000175000017500000001120113640201473016605 00000000000000/* xorg-server.h.in -*- c -*- * * This file is the template file for the xorg-server.h file which gets * installed as part of the SDK. The #defines in this file overlap * with those from config.h, but only for those options that we want * to export to external modules. Boilerplate autotool #defines such * as HAVE_STUFF and PACKAGE_NAME is kept in config.h * * It is still possible to update config.h.in using autoheader, since * autoheader only creates a .h.in file for the first * AM_CONFIG_HEADER() line, and thus does not overwrite this file. * * However, it should be kept in sync with this file. */ #ifndef _XORG_SERVER_H_ #define _XORG_SERVER_H_ #ifdef HAVE_XORG_CONFIG_H #error Include xorg-config.h when building the X server #endif /* Support BigRequests extension */ #mesondefine BIGREQS /* Default font path */ #mesondefine COMPILEDDEFAULTFONTPATH /* Support Composite Extension */ #mesondefine COMPOSITE /* Build DPMS extension */ #mesondefine DPMSExtension /* Build DRI3 extension */ #mesondefine DRI3 /* Build GLX extension */ #mesondefine GLXEXT /* Support XDM-AUTH*-1 */ #mesondefine HASXDMAUTH /* Support SHM */ #mesondefine HAS_SHM /* Define to 1 if you have the `reallocarray' function. */ #mesondefine HAVE_REALLOCARRAY /* Define to 1 if you have the `strcasecmp' function. */ #mesondefine HAVE_STRCASECMP /* Define to 1 if you have the `strcasestr' function. */ #mesondefine HAVE_STRCASESTR /* Define to 1 if you have the `strlcat' function. */ #mesondefine HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #mesondefine HAVE_STRLCPY /* Define to 1 if you have the `strncasecmp' function. */ #mesondefine HAVE_STRNCASECMP /* Define to 1 if you have the `strndup' function. */ #mesondefine HAVE_STRNDUP /* Support IPv6 for TCP connections */ #mesondefine IPv6 /* Support MIT-SHM Extension */ #mesondefine MITSHM /* Internal define for Xinerama */ #mesondefine PANORAMIX /* Support Present extension */ #mesondefine PRESENT /* Support RANDR extension */ #mesondefine RANDR /* Support RENDER extension */ #mesondefine RENDER /* Support X resource extension */ #mesondefine RES /* Support MIT-SCREEN-SAVER extension */ #mesondefine SCREENSAVER /* Support SHAPE extension */ #mesondefine SHAPE /* Define to 1 on systems derived from System V Release 4 */ #mesondefine SVR4 /* Support TCP socket connections */ #mesondefine TCPCONN /* Support UNIX socket connections */ #mesondefine UNIXCONN /* Support XCMisc extension */ #mesondefine XCMISC /* Support Xdmcp */ #mesondefine XDMCP /* Build XFree86 BigFont extension */ #mesondefine XF86BIGFONT /* Support XFree86 Video Mode extension */ #mesondefine XF86VIDMODE /* Build XDGA support */ #mesondefine XFreeXDGA /* Support Xinerama extension */ #mesondefine XINERAMA /* Support X Input extension */ #mesondefine XINPUT /* XKB default rules */ #mesondefine XKB_DFLT_RULES /* Build DRI extension */ #mesondefine XF86DRI /* Build DRI2 extension */ #mesondefine DRI2 /* Build Xorg server */ #mesondefine XORGSERVER /* Current Xorg version */ #mesondefine XORG_VERSION_CURRENT /* Build Xv Extension */ #mesondefine XvExtension /* Build XvMC Extension */ #mesondefine XvMCExtension /* Support XSync extension */ #mesondefine XSYNC /* Support XTest extension */ #mesondefine XTEST /* Support Xv Extension */ #mesondefine XV /* Vendor name */ #mesondefine XVENDORNAME /* BSD-compliant source */ #mesondefine _BSD_SOURCE /* POSIX-compliant source */ #mesondefine _POSIX_SOURCE /* X/Open-compliant source */ #mesondefine _XOPEN_SOURCE /* Vendor web address for support */ #mesondefine __VENDORDWEBSUPPORT__ /* Location of configuration file */ #mesondefine XCONFIGFILE /* Name of X server */ #mesondefine __XSERVERNAME__ /* Building vgahw module */ #mesondefine WITH_VGAHW /* System is BSD-like */ #mesondefine CSRG_BASED /* System has PC console */ #mesondefine PCCONS_SUPPORT /* System has PCVT console */ #mesondefine PCVT_SUPPORT /* System has syscons console */ #mesondefine SYSCONS_SUPPORT /* System has wscons console */ #mesondefine WSCONS_SUPPORT /* Loadable XFree86 server awesomeness */ #define XFree86LOADER /* Use libpciaccess */ #mesondefine XSERVER_LIBPCIACCESS /* X Access Control Extension */ #mesondefine XACE /* Have X server platform bus support */ #mesondefine XSERVER_PLATFORM_BUS #ifdef _LP64 #define _XSERVER64 1 #endif /* Have support for X shared memory fence library (xshmfence) */ #mesondefine HAVE_XSHMFENCE /* Use XTrans FD passing support */ #mesondefine XTRANS_SEND_FDS /* Ask fontsproto to make font path element names const */ #define FONT_PATH_ELEMENT_NAME_CONST 1 /* byte order */ #mesondefine X_BYTE_ORDER #endif /* _XORG_SERVER_H_ */ xorg-server-1.20.8/include/xserver_poll.h0000644000175000017500000000337013640201473015331 00000000000000/* * Copyright © 2016 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 _XSERVER_POLL_H_ #define _XSERVER_POLL_H_ #ifndef _DIX_CONFIG_H_ #error must include dix-config.h to use xserver_poll.h #endif #ifdef HAVE_POLL #include #define xserver_poll(fds, nfds, timeout) poll(fds, nfds, timeout) #else #define POLLIN 0x01 #define POLLPRI 0x02 #define POLLOUT 0x04 #define POLLERR 0x08 #define POLLHUP 0x10 #define POLLNVAL 0x20 struct pollfd { int fd; short events; short revents; }; typedef unsigned long nfds_t; int xserver_poll (struct pollfd *pArray, nfds_t n_fds, int timeout); #endif #endif /* _XSERVER_POLL_H_ */ xorg-server-1.20.8/include/xorg-config.h.meson.in0000644000175000017500000000650313640201473016555 00000000000000/* xorg-config.h.in: not at all generated. -*- c -*- * * This file differs from xorg-server.h.in in that -server is installed * with the rest of the SDK for external drivers/modules to use, whereas * -config is for internal use only (i.e. building the DDX). * */ #ifndef _XORG_CONFIG_H_ #define _XORG_CONFIG_H_ #include #include /* Building Xorg server. */ #mesondefine XORGSERVER /* Current X.Org version. */ #mesondefine XORG_VERSION_CURRENT /* Name of X server. */ #mesondefine __XSERVERNAME__ /* URL to go to for support. */ #mesondefine __VENDORDWEBSUPPORT__ /* Built-in output drivers. */ #mesondefine DRIVERS /* Built-in input drivers. */ #mesondefine IDRIVERS /* Path to configuration file. */ #mesondefine XF86CONFIGFILE /* Path to configuration file. */ #mesondefine XCONFIGFILE /* Name of configuration directory. */ #mesondefine XCONFIGDIR /* Path to loadable modules. */ #mesondefine DEFAULT_MODULE_PATH /* Path to installed libraries. */ #mesondefine DEFAULT_LIBRARY_PATH /* Default log location */ #mesondefine DEFAULT_LOGDIR /* Default logfile prefix */ #mesondefine DEFAULT_LOGPREFIX /* Default XDG_DATA dir under HOME */ #mesondefine DEFAULT_XDG_DATA_HOME /* Default log dir under XDG_DATA_HOME */ #mesondefine DEFAULT_XDG_DATA_HOME_LOGDIR /* Building DRI-capable DDX. */ #mesondefine XF86DRI /* Build DRI2 extension */ #mesondefine DRI2 /* Define to 1 if you have the header file. */ #mesondefine HAVE_STROPTS_H /* Define to 1 if you have the header file. */ #mesondefine HAVE_SYS_KD_H /* Define to 1 if you have the header file. */ #mesondefine HAVE_SYS_VT_H /* Define to 1 if you have the `walkcontext' function (used on Solaris for xorg_backtrace in hw/xfree86/common/xf86Events.c */ #mesondefine HAVE_WALKCONTEXT /* Building vgahw module */ #mesondefine WITH_VGAHW /* NetBSD PIO alpha IO */ #mesondefine USE_ALPHA_PIO /* BSD AMD64 iopl */ #mesondefine USE_AMD64_IOPL /* BSD /dev/io */ #mesondefine USE_DEV_IO /* BSD i386 iopl */ #mesondefine USE_I386_IOPL /* System is BSD-like */ #mesondefine CSRG_BASED /* System has PC console */ #mesondefine PCCONS_SUPPORT /* System has PCVT console */ #mesondefine PCVT_SUPPORT /* System has syscons console */ #mesondefine SYSCONS_SUPPORT /* System has wscons console */ #mesondefine WSCONS_SUPPORT /* System has /dev/xf86 aperture driver */ #mesondefine HAS_APERTURE_DRV /* Has backtrace support */ #mesondefine HAVE_BACKTRACE /* Name of the period field in struct kbd_repeat */ #mesondefine LNX_KBD_PERIOD_NAME /* Have execinfo.h */ #mesondefine HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #mesondefine HAVE_SYS_MKDEV_H /* Path to text files containing PCI IDs */ #mesondefine PCI_TXT_IDS_PATH /* Build with libdrm support */ #mesondefine WITH_LIBDRM /* Use libpciaccess */ #mesondefine XSERVER_LIBPCIACCESS /* Have setugid */ #mesondefine HAVE_ISSETUGID /* Have getresuid */ #mesondefine HAVE_GETRESUID /* Have X server platform bus support */ #mesondefine XSERVER_PLATFORM_BUS /* Define to 1 if you have the `seteuid' function. */ #mesondefine HAVE_SETEUID /* Support APM/ACPI power management in the server */ #mesondefine XF86PM /* Fallback input driver if the assigned driver fails */ #mesondefine FALLBACK_INPUT_DRIVER #endif /* _XORG_CONFIG_H_ */ xorg-server-1.20.8/include/xkbstr.h0000644000175000017500000005000013640201473014112 00000000000000/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. 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 Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS 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 _XKBSTR_H_ #define _XKBSTR_H_ #include #define XkbCharToInt(v) ((int) ((v) & 0x80 ? ((v) | (~0xff)) : ((v) & 0x7f))) #define XkbIntTo2Chars(i, h, l) ((h) = (i >> 8) & 0xff, (l) = (i) & 0xff) #if defined(WORD64) && defined(UNSIGNEDBITFIELDS) #define Xkb2CharsToInt(h, l) ((int) ((h) & 0x80 ? \ (((h) << 8) | (l) | (~0xffff)) : \ (((h) << 8) | (l) & 0x7fff)) #else #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) #endif /* * Common data structures and access macros */ typedef struct _XkbStateRec { unsigned char group; /* base + latched + locked */ /* FIXME: Why are base + latched short and not char?? */ unsigned short base_group; /* physically ... down? */ unsigned short latched_group; unsigned char locked_group; unsigned char mods; /* base + latched + locked */ unsigned char base_mods; /* physically down */ unsigned char latched_mods; unsigned char locked_mods; unsigned char compat_state; /* mods + group for core state */ /* grab mods = all depressed and latched mods, _not_ locked mods */ unsigned char grab_mods; /* grab mods minus internal mods */ unsigned char compat_grab_mods; /* grab mods + group for core state, but not locked groups if IgnoreGroupLocks set */ /* effective mods = all mods (depressed, latched, locked) */ unsigned char lookup_mods; /* effective mods minus internal mods */ unsigned char compat_lookup_mods; /* effective mods + group */ unsigned short ptr_buttons; /* core pointer buttons */ } XkbStateRec, *XkbStatePtr; #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) #define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) typedef struct _XkbMods { unsigned char mask; /* effective mods */ unsigned char real_mods; unsigned short vmods; } XkbModsRec, *XkbModsPtr; typedef struct _XkbKTMapEntry { Bool active; unsigned char level; XkbModsRec mods; } XkbKTMapEntryRec, *XkbKTMapEntryPtr; typedef struct _XkbKeyType { XkbModsRec mods; unsigned char num_levels; unsigned char map_count; XkbKTMapEntryPtr map; XkbModsPtr preserve; Atom name; Atom *level_names; } XkbKeyTypeRec, *XkbKeyTypePtr; #define XkbNumGroups(g) ((g)&0x0f) #define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) #define XkbOutOfRangeGroupAction(g) ((g)&0xc0) #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) #define XkbSetGroupInfo(g, w, n) (((w) & 0xc0) | (((n) & 3) << 4) | \ ((g) & 0x0f)) #define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) /* * Structures and access macros used primarily by the server */ typedef struct _XkbBehavior { unsigned char type; unsigned char data; } XkbBehavior; #define XkbAnyActionDataSize 7 typedef struct _XkbAnyAction { unsigned char type; unsigned char data[XkbAnyActionDataSize]; } XkbAnyAction; typedef struct _XkbModAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; /* FIXME: Make this an int. */ unsigned char vmods1; unsigned char vmods2; } XkbModAction; #define XkbModActionVMods(a) ((short) (((a)->vmods1 << 8) | (a)->vmods2)) #define XkbSetModActionVMods(a,v) \ ((a)->vmods1 = (((v) >> 8) & 0xff), \ (a)->vmods2 = (v) & 0xff) typedef struct _XkbGroupAction { unsigned char type; unsigned char flags; /* FIXME: Make this an int. */ char group_XXX; } XkbGroupAction; #define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) #define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) typedef struct _XkbISOAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; /* FIXME: Make this an int. */ char group_XXX; unsigned char affect; unsigned char vmods1; unsigned char vmods2; } XkbISOAction; typedef struct _XkbPtrAction { unsigned char type; unsigned char flags; /* FIXME: Make this an int. */ unsigned char high_XXX; unsigned char low_XXX; unsigned char high_YYY; unsigned char low_YYY; } XkbPtrAction; #define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) #define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) typedef struct _XkbPtrBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; } XkbPtrBtnAction; typedef struct _XkbPtrDfltAction { unsigned char type; unsigned char flags; unsigned char affect; char valueXXX; } XkbPtrDfltAction; #define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) #define XkbSASetPtrDfltValue(a, c) ((a)->valueXXX = (c) & 0xff) typedef struct _XkbSwitchScreenAction { unsigned char type; unsigned char flags; char screenXXX; } XkbSwitchScreenAction; #define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) #define XkbSASetScreen(a, s) ((a)->screenXXX = (s) & 0xff) typedef struct _XkbCtrlsAction { unsigned char type; unsigned char flags; /* FIXME: Make this an int. */ unsigned char ctrls3; unsigned char ctrls2; unsigned char ctrls1; unsigned char ctrls0; } XkbCtrlsAction; #define XkbActionSetCtrls(a, c) ((a)->ctrls3 = ((c) >> 24) & 0xff, \ (a)->ctrls2 = ((c) >> 16) & 0xff, \ (a)->ctrls1 = ((c) >> 8) & 0xff, \ (a)->ctrls0 = (c) & 0xff) #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ (((unsigned int)(a)->ctrls2)<<16)|\ (((unsigned int)(a)->ctrls1)<<8)|\ ((unsigned int) (a)->ctrls0)) typedef struct _XkbMessageAction { unsigned char type; unsigned char flags; unsigned char message[6]; } XkbMessageAction; typedef struct _XkbRedirectKeyAction { unsigned char type; unsigned char new_key; unsigned char mods_mask; unsigned char mods; /* FIXME: Make this an int. */ unsigned char vmods_mask0; unsigned char vmods_mask1; unsigned char vmods0; unsigned char vmods1; } XkbRedirectKeyAction; #define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ ((unsigned int)(a)->vmods0)) /* FIXME: This is blatantly not setting vmods. Yeesh. */ #define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) #define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ ((unsigned int)(a)->vmods_mask0)) #define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) typedef struct _XkbDeviceBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; unsigned char device; } XkbDeviceBtnAction; typedef struct _XkbDeviceValuatorAction { unsigned char type; unsigned char device; unsigned char v1_what; unsigned char v1_ndx; unsigned char v1_value; unsigned char v2_what; unsigned char v2_ndx; unsigned char v2_value; } XkbDeviceValuatorAction; typedef union _XkbAction { XkbAnyAction any; XkbModAction mods; XkbGroupAction group; XkbISOAction iso; XkbPtrAction ptr; XkbPtrBtnAction btn; XkbPtrDfltAction dflt; XkbSwitchScreenAction screen; XkbCtrlsAction ctrls; XkbMessageAction msg; XkbRedirectKeyAction redirect; XkbDeviceBtnAction devbtn; XkbDeviceValuatorAction devval; unsigned char type; } XkbAction; typedef struct _XkbControls { unsigned char mk_dflt_btn; unsigned char num_groups; unsigned char groups_wrap; XkbModsRec internal; XkbModsRec ignore_lock; unsigned int enabled_ctrls; unsigned short repeat_delay; unsigned short repeat_interval; unsigned short slow_keys_delay; unsigned short debounce_delay; unsigned short mk_delay; unsigned short mk_interval; unsigned short mk_time_to_max; unsigned short mk_max_speed; short mk_curve; unsigned short ax_options; unsigned short ax_timeout; unsigned short axt_opts_mask; unsigned short axt_opts_values; unsigned int axt_ctrls_mask; unsigned int axt_ctrls_values; unsigned char per_key_repeat[XkbPerKeyBitArraySize]; } XkbControlsRec, *XkbControlsPtr; #define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) #define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) #define XkbAX_NeedFeedback(c, w) (XkbAX_AnyFeedback((c)) && \ XkbAX_NeedOption((c), (w))) typedef struct _XkbServerMapRec { unsigned short num_acts; unsigned short size_acts; XkbAction *acts; XkbBehavior *behaviors; unsigned short *key_acts; #if defined(__cplusplus) || defined(c_plusplus) /* explicit is a C++ reserved word */ unsigned char *c_explicit; #else unsigned char *explicit; #endif unsigned char vmods[XkbNumVirtualMods]; unsigned short *vmodmap; } XkbServerMapRec, *XkbServerMapPtr; #define XkbSMKeyActionsPtr(m, k) (&(m)->acts[(m)->key_acts[(k)]]) /* * Structures and access macros used primarily by clients */ typedef struct _XkbSymMapRec { unsigned char kt_index[XkbNumKbdGroups]; unsigned char group_info; unsigned char width; unsigned short offset; } XkbSymMapRec, *XkbSymMapPtr; typedef struct _XkbClientMapRec { unsigned char size_types; unsigned char num_types; XkbKeyTypePtr types; unsigned short size_syms; unsigned short num_syms; KeySym *syms; XkbSymMapPtr key_sym_map; unsigned char *modmap; } XkbClientMapRec, *XkbClientMapPtr; #define XkbCMKeyGroupInfo(m, k) ((m)->key_sym_map[(k)].group_info) #define XkbCMKeyNumGroups(m, k) (XkbNumGroups((m)->key_sym_map[(k)].group_info)) #define XkbCMKeyGroupWidth(m, k, g) (XkbCMKeyType((m), (k), (g))->num_levels) #define XkbCMKeyGroupsWidth(m, k) ((m)->key_sym_map[(k)].width) #define XkbCMKeyTypeIndex(m, k, g) ((m)->key_sym_map[(k)].kt_index[(g) & 0x3]) #define XkbCMKeyType(m, k, g) (&(m)->types[XkbCMKeyTypeIndex((m), (k), (g))]) #define XkbCMKeyNumSyms(m, k) (XkbCMKeyGroupsWidth((m), (k)) * \ XkbCMKeyNumGroups((m), (k))) #define XkbCMKeySymsOffset(m, k) ((m)->key_sym_map[(k)].offset) #define XkbCMKeySymsPtr(m, k) (&(m)->syms[XkbCMKeySymsOffset((m), (k))]) /* * Compatibility structures and access macros */ typedef struct _XkbSymInterpretRec { KeySym sym; unsigned char flags; unsigned char match; unsigned char mods; unsigned char virtual_mod; XkbAnyAction act; } XkbSymInterpretRec, *XkbSymInterpretPtr; typedef struct _XkbCompatMapRec { XkbSymInterpretPtr sym_interpret; XkbModsRec groups[XkbNumKbdGroups]; unsigned short num_si; unsigned short size_si; } XkbCompatMapRec, *XkbCompatMapPtr; typedef struct _XkbIndicatorMapRec { unsigned char flags; /* FIXME: For some reason, interepretation of groups is wildly * different between which being base/latched/locked. */ unsigned char which_groups; unsigned char groups; unsigned char which_mods; XkbModsRec mods; unsigned int ctrls; } XkbIndicatorMapRec, *XkbIndicatorMapPtr; #define XkbIM_IsAuto(i) (!((i)->flags & XkbIM_NoAutomatic) && \ (((i)->which_groups&&(i)->groups)||\ ((i)->which_mods&&(i)->mods.mask)||\ (i)->ctrls)) #define XkbIM_InUse(i) ((i)->flags || (i)->which_groups || (i)->which_mods || \ (i)->ctrls) typedef struct _XkbIndicatorRec { unsigned long phys_indicators; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbIndicatorRec, *XkbIndicatorPtr; typedef struct _XkbKeyNameRec { char name[XkbKeyNameLength]; } XkbKeyNameRec, *XkbKeyNamePtr; typedef struct _XkbKeyAliasRec { char real[XkbKeyNameLength]; char alias[XkbKeyNameLength]; } XkbKeyAliasRec, *XkbKeyAliasPtr; /* * Names for everything */ typedef struct _XkbNamesRec { Atom keycodes; Atom geometry; Atom symbols; Atom types; Atom compat; Atom vmods[XkbNumVirtualMods]; Atom indicators[XkbNumIndicators]; Atom groups[XkbNumKbdGroups]; XkbKeyNamePtr keys; XkbKeyAliasPtr key_aliases; Atom *radio_groups; Atom phys_symbols; unsigned char num_keys; unsigned char num_key_aliases; unsigned short num_rg; } XkbNamesRec, *XkbNamesPtr; typedef struct _XkbGeometry *XkbGeometryPtr; /* * Tie it all together into one big keyboard description */ typedef struct _XkbDesc { unsigned int defined; unsigned short flags; unsigned short device_spec; KeyCode min_key_code; KeyCode max_key_code; XkbControlsPtr ctrls; XkbServerMapPtr server; XkbClientMapPtr map; XkbIndicatorPtr indicators; XkbNamesPtr names; XkbCompatMapPtr compat; XkbGeometryPtr geom; } XkbDescRec, *XkbDescPtr; #define XkbKeyKeyTypeIndex(d, k, g) (XkbCMKeyTypeIndex((d)->map, (k), (g))) #define XkbKeyKeyType(d, k, g) (XkbCMKeyType((d)->map, (k), (g))) #define XkbKeyGroupWidth(d, k, g) (XkbCMKeyGroupWidth((d)->map, (k), (g))) #define XkbKeyGroupsWidth(d, k) (XkbCMKeyGroupsWidth((d)->map, (k))) #define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) #define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) #define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) #define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) #define XkbKeySym(d, k, n) (XkbKeySymsPtr((d), (k))[(n)]) #define XkbKeySymEntry(d,k,sl,g) \ (XkbKeySym((d), (k), (XkbKeyGroupsWidth((d), (k)) * (g)) + (sl))) #define XkbKeyAction(d,k,n) \ (XkbKeyHasActions((d), (k)) ? & XkbKeyActionsPtr((d), (k))[(n)] : NULL) #define XkbKeyActionEntry(d,k,sl,g) \ (XkbKeyHasActions((d), (k)) ? \ XkbKeyAction((d), (k), ((XkbKeyGroupsWidth((d), (k)) * (g)) + (sl))) : \ NULL) #define XkbKeyHasActions(d, k) (!!(d)->server->key_acts[(k)]) #define XkbKeyNumActions(d, k) (XkbKeyHasActions((d), (k)) ? \ XkbKeyNumSyms((d), (k)) : 1) #define XkbKeyActionsPtr(d, k) (XkbSMKeyActionsPtr((d)->server, (k))) #define XkbKeycodeInRange(d, k) ((k) >= (d)->min_key_code && \ (k) <= (d)->max_key_code) #define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) /* * The following structures can be used to track changes * to a keyboard device */ typedef struct _XkbMapChanges { unsigned short changed; KeyCode min_key_code; KeyCode max_key_code; unsigned char first_type; unsigned char num_types; KeyCode first_key_sym; unsigned char num_key_syms; KeyCode first_key_act; unsigned char num_key_acts; KeyCode first_key_behavior; unsigned char num_key_behaviors; KeyCode first_key_explicit; unsigned char num_key_explicit; KeyCode first_modmap_key; unsigned char num_modmap_keys; KeyCode first_vmodmap_key; unsigned char num_vmodmap_keys; unsigned char pad; unsigned short vmods; } XkbMapChangesRec, *XkbMapChangesPtr; typedef struct _XkbControlsChanges { unsigned int changed_ctrls; unsigned int enabled_ctrls_changes; Bool num_groups_changed; } XkbControlsChangesRec, *XkbControlsChangesPtr; typedef struct _XkbIndicatorChanges { unsigned int state_changes; unsigned int map_changes; } XkbIndicatorChangesRec, *XkbIndicatorChangesPtr; typedef struct _XkbNameChanges { unsigned int changed; unsigned char first_type; unsigned char num_types; unsigned char first_lvl; unsigned char num_lvls; unsigned char num_aliases; unsigned char num_rg; unsigned char first_key; unsigned char num_keys; unsigned short changed_vmods; unsigned long changed_indicators; unsigned char changed_groups; } XkbNameChangesRec, *XkbNameChangesPtr; typedef struct _XkbCompatChanges { unsigned char changed_groups; unsigned short first_si; unsigned short num_si; } XkbCompatChangesRec, *XkbCompatChangesPtr; typedef struct _XkbChanges { unsigned short device_spec; unsigned short state_changes; XkbMapChangesRec map; XkbControlsChangesRec ctrls; XkbIndicatorChangesRec indicators; XkbNameChangesRec names; XkbCompatChangesRec compat; } XkbChangesRec, *XkbChangesPtr; /* * These data structures are used to construct a keymap from * a set of components or to list components in the server * database. */ typedef struct _XkbComponentNames { char *keycodes; char *types; char *compat; char *symbols; char *geometry; } XkbComponentNamesRec, *XkbComponentNamesPtr; typedef struct _XkbComponentName { unsigned short flags; char *name; } XkbComponentNameRec, *XkbComponentNamePtr; typedef struct _XkbComponentList { int num_keymaps; int num_keycodes; int num_types; int num_compat; int num_symbols; int num_geometry; XkbComponentNamePtr keymaps; XkbComponentNamePtr keycodes; XkbComponentNamePtr types; XkbComponentNamePtr compat; XkbComponentNamePtr symbols; XkbComponentNamePtr geometry; } XkbComponentListRec, *XkbComponentListPtr; /* * The following data structures describe and track changes to a * non-keyboard extension device */ typedef struct _XkbDeviceLedInfo { unsigned short led_class; unsigned short led_id; unsigned int phys_indicators; unsigned int maps_present; unsigned int names_present; unsigned int state; Atom names[XkbNumIndicators]; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbDeviceLedInfoRec, *XkbDeviceLedInfoPtr; typedef struct _XkbDeviceInfo { char *name; Atom type; unsigned short device_spec; Bool has_own_state; unsigned short supported; unsigned short unsupported; unsigned short num_btns; XkbAction *btn_acts; unsigned short sz_leds; unsigned short num_leds; unsigned short dflt_kbd_fb; unsigned short dflt_led_fb; XkbDeviceLedInfoPtr leds; } XkbDeviceInfoRec, *XkbDeviceInfoPtr; #define XkbXI_DevHasBtnActs(d) ((d)->num_btns > 0 && (d)->btn_acts) #define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d) && (b) < (d)->num_btns) #define XkbXI_DevHasLeds(d) ((d)->num_leds > 0 && (d)->leds) typedef struct _XkbDeviceLedChanges { unsigned short led_class; unsigned short led_id; unsigned int defined; /* names or maps changed */ struct _XkbDeviceLedChanges *next; } XkbDeviceLedChangesRec, *XkbDeviceLedChangesPtr; typedef struct _XkbDeviceChanges { unsigned int changed; unsigned short first_btn; unsigned short num_btns; XkbDeviceLedChangesRec leds; } XkbDeviceChangesRec, *XkbDeviceChangesPtr; #endif /* _XKBSTR_H_ */ xorg-server-1.20.8/include/probes.h0000644000175000017500000000305213640201473014074 00000000000000/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef XORG_PROBES_H #define XORG_PROBES_H #ifdef HAVE_DIX_CONFIG_H #include #endif /* definitions needed to include Dtrace probes in a source file */ #if XSERVER_DTRACE #include typedef const char *string; typedef const uint8_t *const_uint8_p; typedef const double *const_double_p; #include "../dix/Xserver-dtrace.h" #endif #endif /* XORG_PROBES_H */ xorg-server-1.20.8/include/eventstr.h0000644000175000017500000002514213640201473014460 00000000000000/* * 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. * */ #ifndef EVENTSTR_H #define EVENTSTR_H #include "inputstr.h" #include /** * @file events.h * This file describes the event structures used internally by the X * server during event generation and event processing. * * When are internal events used? * Events from input devices are stored as internal events in the EQ and * processed as internal events until late in the processing cycle. Only then * do they switch to their respective wire events. */ /** * Event types. Used exclusively internal to the server, not visible on the * protocol. * * Note: Keep KeyPress to Motion aligned with the core events. * Keep ET_Raw* in the same order as KeyPress - Motion */ enum EventType { ET_KeyPress = 2, ET_KeyRelease, ET_ButtonPress, ET_ButtonRelease, ET_Motion, ET_TouchBegin, ET_TouchUpdate, ET_TouchEnd, ET_TouchOwnership, ET_Enter, ET_Leave, ET_FocusIn, ET_FocusOut, ET_ProximityIn, ET_ProximityOut, ET_DeviceChanged, ET_Hierarchy, ET_DGAEvent, ET_RawKeyPress, ET_RawKeyRelease, ET_RawButtonPress, ET_RawButtonRelease, ET_RawMotion, ET_RawTouchBegin, ET_RawTouchUpdate, ET_RawTouchEnd, ET_XQuartz, ET_BarrierHit, ET_BarrierLeave, ET_Internal = 0xFF /* First byte */ }; /** * How a DeviceEvent was provoked */ enum DeviceEventSource { EVENT_SOURCE_NORMAL = 0, /**< Default: from a user action (e.g. key press) */ EVENT_SOURCE_FOCUS, /**< Keys or buttons previously down on focus-in */ }; /** * Used for ALL input device events internal in the server until * copied into the matching protocol event. * * Note: We only use the device id because the DeviceIntPtr may become invalid while * the event is in the EQ. */ struct _DeviceEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< One of EventType */ int length; /**< Length in bytes */ Time time; /**< Time in ms */ int deviceid; /**< Device to post this event for */ int sourceid; /**< The physical source device */ union { uint32_t button; /**< Button number (also used in pointer emulating touch events) */ uint32_t key; /**< Key code */ } detail; uint32_t touchid; /**< Touch ID (client_id) */ int16_t root_x; /**< Pos relative to root window in integral data */ float root_x_frac; /**< Pos relative to root window in frac part */ int16_t root_y; /**< Pos relative to root window in integral part */ float root_y_frac; /**< Pos relative to root window in frac part */ uint8_t buttons[(MAX_BUTTONS + 7) / 8]; /**< Button mask */ struct { uint8_t mask[(MAX_VALUATORS + 7) / 8];/**< Valuator mask */ uint8_t mode[(MAX_VALUATORS + 7) / 8];/**< Valuator mode (Abs or Rel)*/ double data[MAX_VALUATORS]; /**< Valuator data */ } valuators; struct { uint32_t base; /**< XKB base modifiers */ uint32_t latched; /**< XKB latched modifiers */ uint32_t locked; /**< XKB locked modifiers */ uint32_t effective;/**< XKB effective modifiers */ } mods; struct { uint8_t base; /**< XKB base group */ uint8_t latched; /**< XKB latched group */ uint8_t locked; /**< XKB locked group */ uint8_t effective;/**< XKB effective group */ } group; Window root; /**< Root window of the event */ int corestate; /**< Core key/button state BEFORE the event */ int key_repeat; /**< Internally-generated key repeat event */ uint32_t flags; /**< Flags to be copied into the generated event */ uint32_t resource; /**< Touch event resource, only for TOUCH_REPLAYING */ enum DeviceEventSource source_type; /**< How this event was provoked */ }; /** * Generated internally whenever a touch ownership chain changes - an owner * has accepted or rejected a touch, or a grab/event selection in the delivery * chain has been removed. */ struct _TouchOwnershipEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< ET_TouchOwnership */ int length; /**< Length in bytes */ Time time; /**< Time in ms */ int deviceid; /**< Device to post this event for */ int sourceid; /**< The physical source device */ uint32_t touchid; /**< Touch ID (client_id) */ uint8_t reason; /**< ::XIAcceptTouch, ::XIRejectTouch */ uint32_t resource; /**< Provoking grab or event selection */ uint32_t flags; /**< Flags to be copied into the generated event */ }; /* Flags used in DeviceChangedEvent to signal if the slave has changed */ #define DEVCHANGE_SLAVE_SWITCH 0x2 /* Flags used in DeviceChangedEvent to signal whether the event was a * pointer event or a keyboard event */ #define DEVCHANGE_POINTER_EVENT 0x4 #define DEVCHANGE_KEYBOARD_EVENT 0x8 /* device capabilities changed */ #define DEVCHANGE_DEVICE_CHANGE 0x10 /** * Sent whenever a device's capabilities have changed. */ struct _DeviceChangedEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< ET_DeviceChanged */ int length; /**< Length in bytes */ Time time; /**< Time in ms */ int deviceid; /**< Device whose capabilities have changed */ int flags; /**< Mask of ::HAS_NEW_SLAVE, ::POINTER_EVENT, ::KEYBOARD_EVENT */ int masterid; /**< MD when event was generated */ int sourceid; /**< The device that caused the change */ struct { int num_buttons; /**< Number of buttons */ Atom names[MAX_BUTTONS];/**< Button names */ } buttons; int num_valuators; /**< Number of axes */ struct { uint32_t min; /**< Minimum value */ uint32_t max; /**< Maximum value */ double value; /**< Current value */ /* FIXME: frac parts of min/max */ uint32_t resolution; /**< Resolution counts/m */ uint8_t mode; /**< Relative or Absolute */ Atom name; /**< Axis name */ ScrollInfo scroll; /**< Smooth scrolling info */ } valuators[MAX_VALUATORS]; struct { int min_keycode; int max_keycode; } keys; }; #ifdef XFreeXDGA /** * DGAEvent, used by DGA to intercept and emulate input events. */ struct _DGAEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< ET_DGAEvent */ int length; /**< Length in bytes */ Time time; /**< Time in ms */ int subtype; /**< KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify */ int detail; /**< Button number or key code */ int dx; /**< Relative x coordinate */ int dy; /**< Relative y coordinate */ int screen; /**< Screen number this event applies to */ uint16_t state; /**< Core modifier/button state */ }; #endif /** * Raw event, contains the data as posted by the device. */ struct _RawDeviceEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< ET_Raw */ int length; /**< Length in bytes */ Time time; /**< Time in ms */ int deviceid; /**< Device to post this event for */ int sourceid; /**< The physical source device */ union { uint32_t button; /**< Button number */ uint32_t key; /**< Key code */ } detail; struct { uint8_t mask[(MAX_VALUATORS + 7) / 8];/**< Valuator mask */ double data[MAX_VALUATORS]; /**< Valuator data */ double data_raw[MAX_VALUATORS]; /**< Valuator data as posted */ } valuators; uint32_t flags; /**< Flags to be copied into the generated event */ }; struct _BarrierEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< ET_BarrierHit, ET_BarrierLeave */ int length; /**< Length in bytes */ Time time; /**< Time in ms */ int deviceid; /**< Device to post this event for */ int sourceid; /**< The physical source device */ int barrierid; Window window; Window root; double dx; double dy; double root_x; double root_y; int16_t dt; int32_t event_id; uint32_t flags; }; #ifdef XQUARTZ #define XQUARTZ_EVENT_MAXARGS 5 struct _XQuartzEvent { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< Always ET_XQuartz */ int length; /**< Length in bytes */ Time time; /**< Time in ms. */ int subtype; /**< Subtype defined by XQuartz DDX */ uint32_t data[XQUARTZ_EVENT_MAXARGS]; /**< Up to 5 32bit values passed to handler */ }; #endif /** * Event type used inside the X server for input event * processing. */ union _InternalEvent { struct { unsigned char header; /**< Always ET_Internal */ enum EventType type; /**< One of ET_* */ int length; /**< Length in bytes */ Time time; /**< Time in ms. */ } any; DeviceEvent device_event; DeviceChangedEvent changed_event; TouchOwnershipEvent touch_ownership_event; BarrierEvent barrier_event; #ifdef XFreeXDGA DGAEvent dga_event; #endif RawDeviceEvent raw_event; #ifdef XQUARTZ XQuartzEvent xquartz_event; #endif }; #endif xorg-server-1.20.8/include/windowstr.h0000644000175000017500000002133013640201473014641 00000000000000/*********************************************************** 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 WINDOWSTRUCT_H #define WINDOWSTRUCT_H #include "window.h" #include "pixmapstr.h" #include "regionstr.h" #include "cursor.h" #include "property.h" #include "resource.h" /* for ROOT_WINDOW_ID_BASE */ #include "dix.h" #include "privates.h" #include "miscstruct.h" #include #include "opaque.h" #define GuaranteeNothing 0 #define GuaranteeVisBack 1 #define SameBackground(as, a, bs, b) \ ((as) == (bs) && ((as) == None || \ (as) == ParentRelative || \ SamePixUnion(a,b,as == BackgroundPixel))) #define SameBorder(as, a, bs, b) \ EqualPixUnion(as, a, bs, b) /* used as NULL-terminated list */ typedef struct _DevCursorNode { CursorPtr cursor; DeviceIntPtr dev; struct _DevCursorNode *next; } DevCursNodeRec, *DevCursNodePtr, *DevCursorList; typedef struct _WindowOpt { CursorPtr cursor; /* default: window.cursorNone */ VisualID visual; /* default: same as parent */ Colormap colormap; /* default: same as parent */ Mask dontPropagateMask; /* default: window.dontPropagate */ Mask otherEventMasks; /* default: 0 */ struct _OtherClients *otherClients; /* default: NULL */ struct _GrabRec *passiveGrabs; /* default: NULL */ PropertyPtr userProps; /* default: NULL */ CARD32 backingBitPlanes; /* default: ~0L */ CARD32 backingPixel; /* default: 0 */ RegionPtr boundingShape; /* default: NULL */ RegionPtr clipShape; /* default: NULL */ RegionPtr inputShape; /* default: NULL */ struct _OtherInputMasks *inputMasks; /* default: NULL */ DevCursorList deviceCursors; /* default: NULL */ } WindowOptRec, *WindowOptPtr; #define BackgroundPixel 2L #define BackgroundPixmap 3L /* * The redirectDraw field can have one of three values: * * RedirectDrawNone * A normal window; painted into the same pixmap as the parent * and clipping parent and siblings to its geometry. These * windows get a clip list equal to the intersection of their * geometry with the parent geometry, minus the geometry * of overlapping None and Clipped siblings. * RedirectDrawAutomatic * A redirected window which clips parent and sibling drawing. * Contents for these windows are manage inside the server. * These windows get an internal clip list equal to their * geometry. * RedirectDrawManual * A redirected window which does not clip parent and sibling * drawing; the window must be represented within the parent * geometry by the client performing the redirection management. * Contents for these windows are managed outside the server. * These windows get an internal clip list equal to their * geometry. */ #define RedirectDrawNone 0 #define RedirectDrawAutomatic 1 #define RedirectDrawManual 2 typedef struct _Window { DrawableRec drawable; PrivateRec *devPrivates; WindowPtr parent; /* ancestor chain */ WindowPtr nextSib; /* next lower sibling */ WindowPtr prevSib; /* next higher sibling */ WindowPtr firstChild; /* top-most child */ WindowPtr lastChild; /* bottom-most child */ RegionRec clipList; /* clipping rectangle for output */ RegionRec borderClip; /* NotClippedByChildren + border */ union _Validate *valdata; RegionRec winSize; RegionRec borderSize; DDXPointRec origin; /* position relative to parent */ unsigned short borderWidth; unsigned short deliverableEvents; /* all masks from all clients */ Mask eventMask; /* mask from the creating client */ PixUnion background; PixUnion border; WindowOptPtr optional; unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */ unsigned borderIsPixel:1; unsigned cursorIsNone:1; /* else real cursor (might inherit) */ unsigned backingStore:2; unsigned backStorage:1; /* if bs is allocated */ unsigned saveUnder:1; unsigned bitGravity:4; unsigned winGravity:4; unsigned overrideRedirect:1; unsigned visibility:2; unsigned mapped:1; unsigned realized:1; /* ancestors are all mapped */ unsigned viewable:1; /* realized && InputOutput */ unsigned dontPropagate:3; /* index into DontPropagateMasks */ unsigned forcedBS:1; /* system-supplied backingStore */ unsigned redirectDraw:2; /* COMPOSITE rendering redirect */ unsigned forcedBG:1; /* must have an opaque background */ unsigned unhittable:1; /* doesn't hit-test, for rootless */ #ifdef COMPOSITE unsigned damagedDescendants:1; /* some descendants are damaged */ unsigned inhibitBGPaint:1; /* paint the background? */ #endif } WindowRec; /* * Ok, a bunch of macros for accessing the optional record * fields (or filling the appropriate default value) */ extern _X_EXPORT Mask DontPropagateMasks[]; #define wTrackParent(w,field) ((w)->optional ? \ (w)->optional->field \ : FindWindowWithOptional(w)->optional->field) #define wUseDefault(w,field,def) ((w)->optional ? \ (w)->optional->field \ : def) #define wVisual(w) wTrackParent(w, visual) #define wCursor(w) ((w)->cursorIsNone ? None : wTrackParent(w, cursor)) #define wColormap(w) ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap)) #define wDontPropagateMask(w) wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate]) #define wOtherEventMasks(w) wUseDefault(w, otherEventMasks, 0) #define wOtherClients(w) wUseDefault(w, otherClients, NULL) #define wOtherInputMasks(w) wUseDefault(w, inputMasks, NULL) #define wPassiveGrabs(w) wUseDefault(w, passiveGrabs, NULL) #define wUserProps(w) wUseDefault(w, userProps, NULL) #define wBackingBitPlanes(w) wUseDefault(w, backingBitPlanes, ~0L) #define wBackingPixel(w) wUseDefault(w, backingPixel, 0) #define wBoundingShape(w) wUseDefault(w, boundingShape, NULL) #define wClipShape(w) wUseDefault(w, clipShape, NULL) #define wInputShape(w) wUseDefault(w, inputShape, NULL) #define wClient(w) (clients[CLIENT_ID((w)->drawable.id)]) #define wBorderWidth(w) ((int) (w)->borderWidth) /* true when w needs a border drawn. */ #define HasBorder(w) ((w)->borderWidth || wClipShape(w)) typedef struct _ScreenSaverStuff *ScreenSaverStuffPtr; #define SCREEN_IS_BLANKED 0 #define SCREEN_ISNT_SAVED 1 #define SCREEN_IS_TILED 2 #define SCREEN_IS_BLACK 3 #define HasSaverWindow(pScreen) (pScreen->screensaver.pWindow != NullWindow) extern _X_EXPORT int screenIsSaved; #endif /* WINDOWSTRUCT_H */ xorg-server-1.20.8/include/misc.h0000644000175000017500000003246113640201473013543 00000000000000/*********************************************************** 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. Copyright 1992, 1993 Data General Corporation; Copyright 1992, 1993 OMRON 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 neither the name OMRON or DATA GENERAL be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission of the party whose name is to be used. Neither OMRON or DATA GENERAL make any representation about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OMRON OR DATA GENERAL 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 MISC_H #define MISC_H 1 /* * X internal definitions * */ #include #include #include #include #include #include #include #include #ifndef MAXSCREENS #define MAXSCREENS 16 #endif #ifndef MAXGPUSCREENS #define MAXGPUSCREENS 16 #endif #define MAXCLIENTS 2048 #define LIMITCLIENTS 256 /* Must be a power of 2 and <= MAXCLIENTS */ #define MAXEXTENSIONS 128 #define MAXFORMATS 8 #define MAXDEVICES 40 /* input devices */ #define GPU_SCREEN_OFFSET 256 /* 128 event opcodes for core + extension events, excluding GE */ #define MAXEVENTS 128 #define EXTENSION_EVENT_BASE 64 #define EXTENSION_BASE 128 typedef uint32_t ATOM; #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef struct _xReq *xReqPtr; #include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ #include /* for bcopy, bzero, and bcmp */ #define NullBox ((BoxPtr)0) #define MILLI_PER_MIN (1000 * 60) #define MILLI_PER_SECOND (1000) /* this next is used with None and ParentRelative to tell PaintWin() what to use to paint the background. Also used in the macro IS_VALID_PIXMAP */ #define USE_BACKGROUND_PIXEL 3 #define USE_BORDER_PIXEL 3 #undef min #undef max #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) /* abs() is a function, not a macro; include the file declaring * it in case we haven't done that yet. */ #include #define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) /* this assumes b > 0 */ #define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b) /* * return the least significant bit in x which is set * * This works on 1's complement and 2's complement machines. * If you care about the extra instruction on 2's complement * machines, change to ((x) & (-(x))) */ #define lowbit(x) ((x) & (~(x) + 1)) /* XXX Not for modules */ #include #if !defined(MAXSHORT) || !defined(MINSHORT) || \ !defined(MAXINT) || !defined(MININT) /* * Some implementations #define these through , so preclude * #include'ing it later. */ #include #undef MAXSHORT #define MAXSHORT SHRT_MAX #undef MINSHORT #define MINSHORT SHRT_MIN #undef MAXINT #define MAXINT INT_MAX #undef MININT #define MININT INT_MIN #include #include #include /* for fopen, etc... */ #endif #ifndef PATH_MAX #include #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif /** * Calculate the number of bytes needed to hold bits. * @param bits The minimum number of bits needed. * @return The number of bytes needed to hold bits. */ static inline int bits_to_bytes(const int bits) { return ((bits + 7) >> 3); } /** * Calculate the number of 4-byte units needed to hold the given number of * bytes. * @param bytes The minimum number of bytes needed. * @return The number of 4-byte units needed to hold bytes. */ static inline int bytes_to_int32(const int bytes) { return (((bytes) + 3) >> 2); } /** * Calculate the number of bytes (in multiples of 4) needed to hold bytes. * @param bytes The minimum number of bytes needed. * @return The closest multiple of 4 that is equal or higher than bytes. */ static inline int pad_to_int32(const int bytes) { return (((bytes) + 3) & ~3); } /** * Calculate padding needed to bring the number of bytes to an even * multiple of 4. * @param bytes The minimum number of bytes needed. * @return The bytes of padding needed to arrive at the closest multiple of 4 * that is equal or higher than bytes. */ static inline int padding_for_int32(const int bytes) { return ((-bytes) & 3); } extern _X_EXPORT char **xstrtokenize(const char *str, const char *separators); extern void FormatInt64(int64_t num, char *string); extern void FormatUInt64(uint64_t num, char *string); extern void FormatUInt64Hex(uint64_t num, char *string); extern void FormatDouble(double dbl, char *string); /** * Compare the two version numbers comprising of major.minor. * * @return A value less than 0 if a is less than b, 0 if a is equal to b, * or a value greater than 0 */ static inline int version_compare(uint32_t a_major, uint32_t a_minor, uint32_t b_major, uint32_t b_minor) { if (a_major > b_major) return 1; if (a_major < b_major) return -1; if (a_minor > b_minor) return 1; if (a_minor < b_minor) return -1; return 0; } /* some macros to help swap requests, replies, and events */ #define LengthRestB(stuff) \ ((client->req_len << 2) - sizeof(*stuff)) #define LengthRestS(stuff) \ ((client->req_len << 1) - (sizeof(*stuff) >> 1)) #define LengthRestL(stuff) \ (client->req_len - (sizeof(*stuff) >> 2)) #define SwapRestS(stuff) \ SwapShorts((short *)(stuff + 1), LengthRestS(stuff)) #define SwapRestL(stuff) \ SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) void __attribute__ ((error("wrong sized variable passed to swap"))) wrong_size(void); #else static inline void wrong_size(void) { } #endif #if !(defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) static inline int __builtin_constant_p(int x) { return 0; } #endif static inline uint64_t bswap_64(uint64_t x) { return (((x & 0xFF00000000000000ull) >> 56) | ((x & 0x00FF000000000000ull) >> 40) | ((x & 0x0000FF0000000000ull) >> 24) | ((x & 0x000000FF00000000ull) >> 8) | ((x & 0x00000000FF000000ull) << 8) | ((x & 0x0000000000FF0000ull) << 24) | ((x & 0x000000000000FF00ull) << 40) | ((x & 0x00000000000000FFull) << 56)); } #define swapll(x) do { \ if (sizeof(*(x)) != 8) \ wrong_size(); \ *(x) = bswap_64(*(x)); \ } while (0) static inline uint32_t bswap_32(uint32_t x) { return (((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) | ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24)); } static inline Bool checked_int64_add(int64_t *out, int64_t a, int64_t b) { /* Do the potentially overflowing math as uint64_t, as signed * integers in C are undefined on overflow (and the compiler may * optimize out our overflow check below, otherwise) */ int64_t result = (uint64_t)a + (uint64_t)b; /* signed addition overflows if operands have the same sign, and * the sign of the result doesn't match the sign of the inputs. */ Bool overflow = (a < 0) == (b < 0) && (a < 0) != (result < 0); *out = result; return overflow; } static inline Bool checked_int64_subtract(int64_t *out, int64_t a, int64_t b) { int64_t result = (uint64_t)a - (uint64_t)b; Bool overflow = (a < 0) != (b < 0) && (a < 0) != (result < 0); *out = result; return overflow; } #define swapl(x) do { \ if (sizeof(*(x)) != 4) \ wrong_size(); \ *(x) = bswap_32(*(x)); \ } while (0) static inline uint16_t bswap_16(uint16_t x) { return (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)); } #define swaps(x) do { \ if (sizeof(*(x)) != 2) \ wrong_size(); \ *(x) = bswap_16(*(x)); \ } while (0) /* copy 32-bit value from src to dst byteswapping on the way */ #define cpswapl(src, dst) do { \ if (sizeof((src)) != 4 || sizeof((dst)) != 4) \ wrong_size(); \ (dst) = bswap_32((src)); \ } while (0) /* copy short from src to dst byteswapping on the way */ #define cpswaps(src, dst) do { \ if (sizeof((src)) != 2 || sizeof((dst)) != 2) \ wrong_size(); \ (dst) = bswap_16((src)); \ } while (0) extern _X_EXPORT void SwapLongs(CARD32 *list, unsigned long count); extern _X_EXPORT void SwapShorts(short *list, unsigned long count); extern _X_EXPORT void MakePredeclaredAtoms(void); extern _X_EXPORT int Ones(unsigned long /*mask */ ); typedef struct _xPoint *DDXPointPtr; typedef struct pixman_box16 *BoxPtr; typedef struct _xEvent *xEventPtr; typedef struct _xRectangle *xRectanglePtr; typedef struct _GrabRec *GrabPtr; /* typedefs from other places - duplicated here to minimize the amount * of unnecessary junk that one would normally have to include to get * these symbols defined */ #ifndef _XTYPEDEF_CHARINFOPTR typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ #define _XTYPEDEF_CHARINFOPTR #endif extern _X_EXPORT unsigned long globalSerialNumber; extern _X_EXPORT unsigned long serverGeneration; /* Don't use this directly, use BUG_WARN or BUG_WARN_MSG instead */ #define __BUG_WARN_MSG(cond, with_msg, ...) \ do { if (cond) { \ ErrorFSigSafe("BUG: triggered 'if (" #cond ")'\n"); \ ErrorFSigSafe("BUG: %s:%u in %s()\n", \ __FILE__, __LINE__, __func__); \ if (with_msg) ErrorFSigSafe(__VA_ARGS__); \ xorg_backtrace(); \ } } while(0) #define BUG_WARN_MSG(cond, ...) \ __BUG_WARN_MSG(cond, 1, __VA_ARGS__) #define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL) #define BUG_RETURN(cond) \ do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return; } } while(0) #define BUG_RETURN_MSG(cond, ...) \ do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return; } } while(0) #define BUG_RETURN_VAL(cond, val) \ do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return (val); } } while(0) #define BUG_RETURN_VAL_MSG(cond, val, ...) \ do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return (val); } } while(0) #endif /* MISC_H */ xorg-server-1.20.8/include/cursor.h0000644000175000017500000001371413640201473014125 00000000000000/*********************************************************** 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 CURSOR_H #define CURSOR_H #include "misc.h" #include "screenint.h" #include "window.h" #include "privates.h" #define NullCursor ((CursorPtr)NULL) /* Provide support for alpha composited cursors */ #define ARGB_CURSOR struct _DeviceIntRec; typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv; #define CursorScreenKey (&cursorScreenDevPriv) extern _X_EXPORT CursorPtr rootCursor; extern _X_EXPORT int FreeCursor(void *pCurs, XID cid); extern _X_EXPORT CursorPtr RefCursor(CursorPtr /* cursor */); extern _X_EXPORT CursorPtr UnrefCursor(CursorPtr /* cursor */); extern _X_EXPORT int CursorRefCount(const CursorPtr /* cursor */); extern _X_EXPORT int AllocARGBCursor(unsigned char * /*psrcbits */ , unsigned char * /*pmaskbits */ , CARD32 * /*argb */ , CursorMetricPtr /*cm */ , unsigned /*foreRed */ , unsigned /*foreGreen */ , unsigned /*foreBlue */ , unsigned /*backRed */ , unsigned /*backGreen */ , unsigned /*backBlue */ , CursorPtr * /*ppCurs */ , ClientPtr /*client */ , XID /*cid */ ); extern _X_EXPORT int AllocGlyphCursor(Font /*source */ , unsigned int /*sourceChar */ , Font /*mask */ , unsigned int /*maskChar */ , unsigned /*foreRed */ , unsigned /*foreGreen */ , unsigned /*foreBlue */ , unsigned /*backRed */ , unsigned /*backGreen */ , unsigned /*backBlue */ , CursorPtr * /*ppCurs */ , ClientPtr /*client */ , XID /*cid */ ); extern _X_EXPORT CursorPtr CreateRootCursor(char * /*pfilename */ , unsigned int /*glyph */ ); extern _X_EXPORT int ServerBitsFromGlyph(FontPtr /*pfont */ , unsigned int /*ch */ , CursorMetricPtr /*cm */ , unsigned char ** /*ppbits */ ); extern _X_EXPORT Bool CursorMetricsFromGlyph(FontPtr /*pfont */ , unsigned /*ch */ , CursorMetricPtr /*cm */ ); extern _X_EXPORT void CheckCursorConfinement(WindowPtr /*pWin */ ); extern _X_EXPORT void NewCurrentScreen(struct _DeviceIntRec * /*pDev */ , ScreenPtr /*newScreen */ , int /*x */ , int /*y */ ); extern _X_EXPORT Bool PointerConfinedToScreen(struct _DeviceIntRec * /* pDev */ ); extern _X_EXPORT void GetSpritePosition(struct _DeviceIntRec * /* pDev */ , int * /*px */ , int * /*py */ ); #ifdef PANORAMIX extern _X_EXPORT int XineramaGetCursorScreen(struct _DeviceIntRec *pDev); #endif /* PANORAMIX */ #endif /* CURSOR_H */ xorg-server-1.20.8/include/xwin-config.h.in0000644000175000017500000000124213640201473015436 00000000000000/* * xwin-config.h.in * * This file has all defines used in the xwin ddx * */ #include /* Winsock networking */ #undef HAS_WINSOCK /* Cygwin has /dev/windows for signaling new win32 messages */ #undef HAS_DEVWINDOWS /* Switch on debug messages */ #undef CYGDEBUG #undef CYGWINDOWING_DEBUG #undef CYGMULTIWINDOW_DEBUG /* Define to 1 if unsigned long is 64 bits. */ #undef _XSERVER64 /* Short vendor name */ #undef XVENDORNAMESHORT /* Vendor web address for support */ #undef __VENDORDWEBSUPPORT__ /* Default log location */ #undef DEFAULT_LOGDIR /* Whether we should re-locate the root to where the executable lives */ #undef RELOCATE_PROJECTROOT xorg-server-1.20.8/include/dixevents.h0000644000175000017500000000632213640201473014616 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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 DIXEVENTS_H #define DIXEVENTS_H extern _X_EXPORT void SetCriticalEvent(int /* event */ ); extern _X_EXPORT CursorPtr GetSpriteCursor(DeviceIntPtr /*pDev */ ); extern _X_EXPORT int ProcAllowEvents(ClientPtr /* client */ ); extern _X_EXPORT int MaybeDeliverEventsToClient(WindowPtr /* pWin */ , xEvent * /* pEvents */ , int /* count */ , Mask /* filter */ , ClientPtr /* dontClient */ ); extern _X_EXPORT int ProcWarpPointer(ClientPtr /* client */ ); extern _X_EXPORT int EventSelectForWindow(WindowPtr /* pWin */ , ClientPtr /* client */ , Mask /* mask */ ); extern _X_EXPORT int EventSuppressForWindow(WindowPtr /* pWin */ , ClientPtr /* client */ , Mask /* mask */ , Bool * /* checkOptional */ ); extern _X_EXPORT int ProcSetInputFocus(ClientPtr /* client */ ); extern _X_EXPORT int ProcGetInputFocus(ClientPtr /* client */ ); extern _X_EXPORT int ProcGrabPointer(ClientPtr /* client */ ); extern _X_EXPORT int ProcChangeActivePointerGrab(ClientPtr /* client */ ); extern _X_EXPORT int ProcUngrabPointer(ClientPtr /* client */ ); extern _X_EXPORT int ProcGrabKeyboard(ClientPtr /* client */ ); extern _X_EXPORT int ProcUngrabKeyboard(ClientPtr /* client */ ); extern _X_EXPORT int ProcQueryPointer(ClientPtr /* client */ ); extern _X_EXPORT int ProcSendEvent(ClientPtr /* client */ ); extern _X_EXPORT int ProcUngrabKey(ClientPtr /* client */ ); extern _X_EXPORT int ProcGrabKey(ClientPtr /* client */ ); extern _X_EXPORT int ProcGrabButton(ClientPtr /* client */ ); extern _X_EXPORT int ProcUngrabButton(ClientPtr /* client */ ); extern _X_EXPORT int ProcRecolorCursor(ClientPtr /* client */ ); #endif /* DIXEVENTS_H */ xorg-server-1.20.8/include/gcstruct.h0000644000175000017500000002423513640201473014446 00000000000000/*********************************************************** 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 GCSTRUCT_H #define GCSTRUCT_H #include "gc.h" #include "regionstr.h" #include "region.h" #include "pixmap.h" #include "screenint.h" #include "privates.h" #include #define GCAllBits ((1 << (GCLastBit + 1)) - 1) /* * functions which modify the state of the GC */ typedef struct _GCFuncs { void (*ValidateGC) (GCPtr /*pGC */ , unsigned long /*stateChanges */ , DrawablePtr /*pDrawable */ ); void (*ChangeGC) (GCPtr /*pGC */ , unsigned long /*mask */ ); void (*CopyGC) (GCPtr /*pGCSrc */ , unsigned long /*mask */ , GCPtr /*pGCDst */ ); void (*DestroyGC) (GCPtr /*pGC */ ); void (*ChangeClip) (GCPtr pGC, int type, void *pvalue, int nrects); void (*DestroyClip) (GCPtr /*pGC */ ); void (*CopyClip) (GCPtr /*pgcDst */ , GCPtr /*pgcSrc */ ); } GCFuncs; /* * graphics operations invoked through a GC */ typedef struct _GCOps { void (*FillSpans) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*nInit */ , DDXPointPtr /*pptInit */ , int * /*pwidthInit */ , int /*fSorted */ ); void (*SetSpans) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , char * /*psrc */ , DDXPointPtr /*ppt */ , int * /*pwidth */ , int /*nspans */ , int /*fSorted */ ); void (*PutImage) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*depth */ , int /*x */ , int /*y */ , int /*w */ , int /*h */ , int /*leftPad */ , int /*format */ , char * /*pBits */ ); RegionPtr (*CopyArea) (DrawablePtr /*pSrc */ , DrawablePtr /*pDst */ , GCPtr /*pGC */ , int /*srcx */ , int /*srcy */ , int /*w */ , int /*h */ , int /*dstx */ , int /*dsty */ ); RegionPtr (*CopyPlane) (DrawablePtr /*pSrcDrawable */ , DrawablePtr /*pDstDrawable */ , GCPtr /*pGC */ , int /*srcx */ , int /*srcy */ , int /*width */ , int /*height */ , int /*dstx */ , int /*dsty */ , unsigned long /*bitPlane */ ); void (*PolyPoint) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*mode */ , int /*npt */ , DDXPointPtr /*pptInit */ ); void (*Polylines) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*mode */ , int /*npt */ , DDXPointPtr /*pptInit */ ); void (*PolySegment) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*nseg */ , xSegment * /*pSegs */ ); void (*PolyRectangle) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*nrects */ , xRectangle * /*pRects */ ); void (*PolyArc) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*narcs */ , xArc * /*parcs */ ); void (*FillPolygon) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*shape */ , int /*mode */ , int /*count */ , DDXPointPtr /*pPts */ ); void (*PolyFillRect) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*nrectFill */ , xRectangle * /*prectInit */ ); void (*PolyFillArc) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*narcs */ , xArc * /*parcs */ ); int (*PolyText8) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , char * /*chars */ ); int (*PolyText16) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , unsigned short * /*chars */ ); void (*ImageText8) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , char * /*chars */ ); void (*ImageText16) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , int /*x */ , int /*y */ , int /*count */ , unsigned short * /*chars */ ); void (*ImageGlyphBlt) (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase); void (*PolyGlyphBlt) (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase); void (*PushPixels) (GCPtr /*pGC */ , PixmapPtr /*pBitMap */ , DrawablePtr /*pDst */ , int /*w */ , int /*h */ , int /*x */ , int /*y */ ); } GCOps; /* there is padding in the bit fields because the Sun compiler doesn't * force alignment to 32-bit boundaries. losers. */ typedef struct _GC { ScreenPtr pScreen; unsigned char depth; unsigned char alu; unsigned short lineWidth; unsigned short dashOffset; unsigned short numInDashList; unsigned char *dash; unsigned int lineStyle:2; unsigned int capStyle:2; unsigned int joinStyle:2; unsigned int fillStyle:2; unsigned int fillRule:1; unsigned int arcMode:1; unsigned int subWindowMode:1; unsigned int graphicsExposures:1; unsigned int miTranslate:1; /* should mi things translate? */ unsigned int tileIsPixel:1; /* tile is solid pixel */ unsigned int fExpose:1; /* Call exposure handling */ unsigned int freeCompClip:1; /* Free composite clip */ unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */ unsigned int unused:15; /* see comment above */ unsigned int planemask; unsigned int fgPixel; unsigned int bgPixel; /* * alas -- both tile and stipple must be here as they * are independently specifiable */ PixUnion tile; PixmapPtr stipple; DDXPointRec patOrg; /* origin for (tile, stipple) */ DDXPointRec clipOrg; struct _Font *font; RegionPtr clientClip; unsigned int stateChanges; /* masked with GC_ */ unsigned int serialNumber; const GCFuncs *funcs; const GCOps *ops; PrivateRec *devPrivates; RegionPtr pCompositeClip; } GC; #endif /* GCSTRUCT_H */ xorg-server-1.20.8/include/glxvndabi.h0000644000175000017500000002621713640201473014570 00000000000000/* * Copyright (c) 2016, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * unaltered in all copies or substantial portions of the Materials. * Any additions, deletions, or changes to the original source files * must be clearly indicated in accompanying documentation. * * If only executable code is distributed, then the accompanying * documentation must state that "this software is based in part on the * work of the Khronos Group." * * THE MATERIALS ARE 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 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /** * \file * * Defines the interface between the libglvnd server module and a vendor * library. * * Each screen may have one vendor library assigned to it. The GLVND module * will examine each GLX request to determine which screen it goes to, and then * it will forward that request to whichever vendor is assigned to that screen. * * Each vendor library is represented by an opaque __GLXServerVendor handle. * Display drivers are responsible for creating handles for its GLX * implementations, and assigning those handles to each screen. * * The GLVND module keeps a list of callbacks, which are called from * InitExtensions. Drivers should use that callback to assign a vendor * handle to whichever screens they support. * * Additional notes about dispatching: * - If a request has one or more GLXContextTag values, then the dispatch stub * must ensure that all of the tags belong to the vendor that it forwards the * request to. Otherwise, if a vendor library tries to look up the private * data for the tag, it could get the data from another vendor and crash. * - Following from the last point, if a request takes a GLXContextTag value, * then the dispatch stub should use the tag to select a vendor. If the * request takes two or more tags, then the vendor must ensure that they all * map to the same vendor. */ #ifndef GLXVENDORABI_H #define GLXVENDORABI_H #include #include #include /*! * Current version of the ABI. * * This version number contains a major number in the high-order 16 bits, and * a minor version number in the low-order 16 bits. * * The major version number is incremented when an interface change will break * backwards compatibility with existing vendor libraries. The minor version * number is incremented when there's a change but existing vendor libraries * will still work. */ #define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0 #define GLXSERVER_VENDOR_ABI_MINOR_VERSION 1 #if defined(__cplusplus) extern "C" { #endif /** * An opaque pointer representing a vendor library. */ typedef struct GlxServerVendorRec GlxServerVendor; typedef int (* GlxServerDispatchProc) (ClientPtr client); typedef struct GlxServerImportsRec GlxServerImports; /** * Functions exported by libglvnd to the vendor library. */ typedef struct GlxServerExportsRec { int majorVersion; int minorVersion; /** * This callback is called during each server generation when the GLX * extension is initialized. * * Drivers may create a __GLXServerVendor handle at any time, but may only * assign a vendor to a screen from this callback. * * The callback is called with the ExtensionEntry pointer for the GLX * extension. */ CallbackListPtr *extensionInitCallback; /** * Allocates and zeroes a __GLXserverImports structure. * * Future versions of the GLVND interface may add optional members to the * end of the __GLXserverImports struct. Letting the GLVND layer allocate * the __GLXserverImports struct allows backward compatibility with * existing drivers. */ GlxServerImports * (* allocateServerImports) (void); /** * Frees a __GLXserverImports structure that was allocated with * \c allocateServerImports. */ void (* freeServerImports) (GlxServerImports *imports); /** * Creates a new vendor library handle. */ GlxServerVendor * (* createVendor) (const GlxServerImports *imports); /** * Destroys a vendor library handle. * * This function may not be called while the vendor handle is assigned to a * screen, but it may be called from the __GLXserverImports::extensionCloseDown * callback. */ void (* destroyVendor) (GlxServerVendor *vendor); /** * Sets the vendor library to use for a screen. * * This function should be called from the screen's CreateScreenResources * callback. */ Bool (* setScreenVendor) (ScreenPtr screen, GlxServerVendor *vendor); /** * Adds an entry to the XID map. * * This mapping is used to dispatch requests based on an XID. * * Client-generated XID's (contexts, drawables, etc) must be added to the * map by the dispatch stub. * * XID's that are generated in the server should be added by the vendor * library. * * Vendor libraries are responsible for keeping track of any additional * data they need for the XID's. * * Note that adding GLXFBConfig ID's appears to be unnecessary -- every GLX * request I can find that takes a GLXFBConfig also takes a screen number. * * \param id The XID to add to the map. The XID must not already be in the * map. * \param vendor The vendor library to associate with \p id. * \return True on success, or False on failure. */ Bool (* addXIDMap) (XID id, GlxServerVendor *vendor); /** * Returns the vendor and data for an XID, as added with \c addXIDMap. * * If \p id wasn't added with \c addXIDMap (for example, if it's a regular * X window), then libglvnd will try to look it up as a drawable and return * the vendor for whatever screen it's on. * * \param id The XID to look up. * \return The vendor that owns the XID, or \c NULL if no matching vendor * was found. */ GlxServerVendor * (* getXIDMap) (XID id); /** * Removes an entry from the XID map. */ void (* removeXIDMap) (XID id); /** * Looks up a context tag. * * Context tags are created and managed by libglvnd to ensure that they're * unique between vendors. * * \param client The client connection. * \param tag The context tag. * \return The vendor that owns the context tag, or \c NULL if the context * tag is invalid. */ GlxServerVendor * (* getContextTag)(ClientPtr client, GLXContextTag tag); /** * Assigns a pointer to vendor-private data for a context tag. * * Since the tag values are assigned by GLVND, vendors can use this * function to store any private data they need for a context tag. * * \param client The client connection. * \param tag The context tag. * \param data An arbitrary pointer value. */ Bool (* setContextTagPrivate)(ClientPtr client, GLXContextTag tag, void *data); /** * Returns the private data pointer that was assigned from * setContextTagPrivate. * * This function is safe to use in __GLXserverImports::makeCurrent to look * up the old context private pointer. * * However, this function is not safe to use from a ClientStateCallback, * because GLVND may have alraedy deleted the tag by that point. */ void * (* getContextTagPrivate)(ClientPtr client, GLXContextTag tag); GlxServerVendor * (* getVendorForScreen) (ClientPtr client, ScreenPtr screen); /** * Forwards a request to a vendor library. * * \param vendor The vendor to send the request to. * \param client The client. */ int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client); /** * Sets the vendor library to use for a screen for a specific client. * * This function changes which vendor should handle GLX requests for a * screen. Unlike \c setScreenVendor, this function can be called at any * time, and only applies to requests from a single client. * * This function is available in GLXVND version 0.1 or later. */ Bool (* setClientScreenVendor) (ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); } GlxServerExports; extern _X_EXPORT const GlxServerExports glxServer; /** * Functions exported by the vendor library to libglvnd. */ struct GlxServerImportsRec { /** * Called on a server reset. * * This is called from the extension's CloseDown callback. * * Note that this is called after freeing all of GLVND's per-screen data, * so the callback may destroy any vendor handles. * * If the server is exiting, then GLVND will free any remaining vendor * handles after calling the extensionCloseDown callbacks. */ void (* extensionCloseDown) (const ExtensionEntry *extEntry); /** * Handles a GLX request. */ int (* handleRequest) (ClientPtr client); /** * Returns a dispatch function for a request. * * \param minorOpcode The minor opcode of the request. * \param vendorCode The vendor opcode, if \p minorOpcode * is \c X_GLXVendorPrivate or \c X_GLXVendorPrivateWithReply. * \return A dispatch function, or NULL if the vendor doesn't support this * request. */ GlxServerDispatchProc (* getDispatchAddress) (CARD8 minorOpcode, CARD32 vendorCode); /** * Handles a MakeCurrent request. * * This function is called to handle any MakeCurrent request. The vendor * library should deal with changing the current context. After the vendor * returns GLVND will send the reply. * * In addition, GLVND will call this function with any current contexts * when a client disconnects. * * To ensure that context tags are unique, libglvnd will select a context * tag and pass it to the vendor library. * * The vendor can use \c __GLXserverExports::getContextTagPrivate to look * up the private data pointer for \p oldContextTag. * * Likewise, the vendor can use \c __GLXserverExports::setContextTagPrivate * to assign a private data pointer to \p newContextTag. */ int (* makeCurrent) (ClientPtr client, GLXContextTag oldContextTag, XID drawable, XID readdrawable, XID context, GLXContextTag newContextTag); }; #if defined(__cplusplus) } #endif #endif // GLXVENDORABI_H xorg-server-1.20.8/include/xkbsrv.h0000644000175000017500000010450113640201473014122 00000000000000/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. 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 Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS 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 _XKBSRV_H_ #define _XKBSRV_H_ #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey #define XkbCopyKeyTypes SrvXkbCopyKeyTypes #define XkbFreeClientMap SrvXkbFreeClientMap #define XkbFreeServerMap SrvXkbFreeServerMap #define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols #define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey #define XkbResizeKeyActions SrvXkbResizeKeyActions #define XkbResizeKeySyms SrvXkbResizeKeySyms #define XkbResizeKeyType SrvXkbResizeKeyType #define XkbAllocCompatMap SrvXkbAllocCompatMap #define XkbAllocControls SrvXkbAllocControls #define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps #define XkbAllocKeyboard SrvXkbAllocKeyboard #define XkbAllocNames SrvXkbAllocNames #define XkbFreeCompatMap SrvXkbFreeCompatMap #define XkbFreeKeyboard SrvXkbFreeKeyboard #define XkbFreeNames SrvXkbFreeNames #define XkbLatchModifiers SrvXkbLatchModifiers #define XkbLatchGroup SrvXkbLatchGroup #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges #include #include "xkbstr.h" #include "xkbrules.h" #include "inputstr.h" #include "events.h" typedef struct _XkbInterest { DeviceIntPtr dev; ClientPtr client; XID resource; struct _XkbInterest *next; CARD16 extDevNotifyMask; CARD16 stateNotifyMask; CARD16 namesNotifyMask; CARD32 ctrlsNotifyMask; CARD8 compatNotifyMask; BOOL bellNotifyMask; BOOL actionMessageMask; CARD16 accessXNotifyMask; CARD32 iStateNotifyMask; CARD32 iMapNotifyMask; CARD16 altSymsNotifyMask; CARD32 autoCtrls; CARD32 autoCtrlValues; } XkbInterestRec, *XkbInterestPtr; typedef struct _XkbRadioGroup { CARD8 flags; CARD8 nMembers; CARD8 dfltDown; CARD8 currentDown; CARD8 members[XkbRGMaxMembers]; } XkbRadioGroupRec, *XkbRadioGroupPtr; typedef struct _XkbEventCause { CARD8 kc; CARD8 event; CARD8 mjr; CARD8 mnr; ClientPtr client; } XkbEventCauseRec, *XkbEventCausePtr; #define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ (c)->mjr= (c)->mnr= 0; \ (c)->client= NULL; } #define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ (c)->mjr= (j),(c)->mnr= (n);\ (c)->client= (cl); } #define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) #define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) #define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) #define _OFF_TIMER 0 #define _KRG_WARN_TIMER 1 #define _KRG_TIMER 2 #define _SK_TIMEOUT_TIMER 3 #define _ALL_TIMEOUT_TIMER 4 #define _BEEP_NONE 0 #define _BEEP_FEATURE_ON 1 #define _BEEP_FEATURE_OFF 2 #define _BEEP_FEATURE_CHANGE 3 #define _BEEP_SLOW_WARN 4 #define _BEEP_SLOW_PRESS 5 #define _BEEP_SLOW_ACCEPT 6 #define _BEEP_SLOW_REJECT 7 #define _BEEP_SLOW_RELEASE 8 #define _BEEP_STICKY_LATCH 9 #define _BEEP_STICKY_LOCK 10 #define _BEEP_STICKY_UNLOCK 11 #define _BEEP_LED_ON 12 #define _BEEP_LED_OFF 13 #define _BEEP_LED_CHANGE 14 #define _BEEP_BOUNCE_REJECT 15 typedef struct _XkbFilter { CARD16 keycode; CARD8 what; CARD8 active; CARD8 filterOthers; CARD32 priv; XkbAction upAction; int (*filter) (struct _XkbSrvInfo * /* xkbi */ , struct _XkbFilter * /* filter */ , unsigned /* keycode */ , XkbAction * /* action */ ); struct _XkbFilter *next; } XkbFilterRec, *XkbFilterPtr; typedef Bool (*XkbSrvCheckRepeatPtr) (DeviceIntPtr dev, struct _XkbSrvInfo * /* xkbi */ , unsigned /* keycode */); typedef struct _XkbSrvInfo { XkbStateRec prev_state; XkbStateRec state; XkbDescPtr desc; DeviceIntPtr device; KbdCtrlProcPtr kbdProc; XkbRadioGroupPtr radioGroups; CARD8 nRadioGroups; CARD8 clearMods; CARD8 setMods; INT16 groupChange; CARD16 dfltPtrDelta; double mouseKeysCurve; double mouseKeysCurveFactor; INT16 mouseKeysDX; INT16 mouseKeysDY; CARD8 mouseKeysFlags; Bool mouseKeysAccel; CARD8 mouseKeysCounter; CARD8 lockedPtrButtons; CARD8 shiftKeyCount; KeyCode mouseKey; KeyCode inactiveKey; KeyCode slowKey; KeyCode slowKeyEnableKey; KeyCode repeatKey; CARD8 krgTimerActive; CARD8 beepType; CARD8 beepCount; CARD32 flags; CARD32 lastPtrEventTime; CARD32 lastShiftEventTime; OsTimerPtr beepTimer; OsTimerPtr mouseKeyTimer; OsTimerPtr slowKeysTimer; OsTimerPtr bounceKeysTimer; OsTimerPtr repeatKeyTimer; OsTimerPtr krgTimer; int szFilters; XkbFilterPtr filters; XkbSrvCheckRepeatPtr checkRepeat; char overlay_perkey_state[256/8]; /* bitfield */ } XkbSrvInfoRec, *XkbSrvInfoPtr; #define XkbSLI_IsDefault (1L<<0) #define XkbSLI_HasOwnState (1L<<1) typedef struct _XkbSrvLedInfo { CARD16 flags; CARD16 class; CARD16 id; union { KbdFeedbackPtr kf; LedFeedbackPtr lf; } fb; CARD32 physIndicators; CARD32 autoState; CARD32 explicitState; CARD32 effectiveState; CARD32 mapsPresent; CARD32 namesPresent; XkbIndicatorMapPtr maps; Atom *names; CARD32 usesBase; CARD32 usesLatched; CARD32 usesLocked; CARD32 usesEffective; CARD32 usesCompat; CARD32 usesControls; CARD32 usedComponents; } XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; /* * Settings for xkbClientFlags field (used by DIX) * These flags _must_ not overlap with XkbPCF_* */ #define _XkbClientInitialized (1<<7) #define _XkbClientIsAncient (1<<6) #define _XkbWantsDetectableAutoRepeat(c)\ ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) /* * Settings for flags field */ #define _XkbStateNotifyInProgress (1<<0) typedef struct { ProcessInputProc processInputProc; /* If processInputProc is set to something different than realInputProc, * UNWRAP and COND_WRAP will not touch processInputProc and update only * realInputProc. This ensures that * processInputProc == (frozen ? EnqueueEvent : realInputProc) * * WRAP_PROCESS_INPUT_PROC should only be called during initialization, * since it may destroy this invariant. */ ProcessInputProc realInputProc; DeviceUnwrapProc unwrapProc; } xkbDeviceInfoRec, *xkbDeviceInfoPtr; #define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ if (device->public.processInputProc == device->public.realInputProc)\ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \ backupproc = device->public.realInputProc; \ if (device->public.processInputProc == device->public.realInputProc)\ device->public.processInputProc = oldprocs->realInputProc; \ device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec; #define xkbDevicePrivateKey (&xkbDevicePrivateKeyRec) #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, void *); /***====================================================================***/ /***====================================================================***/ #define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) #define XkbAllFilteredEventsMask \ (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) /***====================================================================***/ extern _X_EXPORT int XkbReqCode; extern _X_EXPORT int XkbEventBase; extern _X_EXPORT int XkbKeyboardErrorCode; extern _X_EXPORT const char *XkbBaseDirectory; extern _X_EXPORT const char *XkbBinDirectory; extern _X_EXPORT CARD32 xkbDebugFlags; #define _XkbLibError(c,l,d) /* Epoch fail */ /* "a" is a "unique" numeric identifier that just defines which error * code statement it is. _XkbErrCode2(4, foo) means "this is the 4th error * statement in this function". lovely. */ #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) #define Status int extern _X_EXPORT void XkbUseMsg(void ); extern _X_EXPORT int XkbProcessArguments(int /* argc */ , char ** /* argv */ , int /* i */ ); extern _X_EXPORT Bool XkbInitPrivates(void); extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); extern _X_EXPORT void XkbFreeCompatMap(XkbDescPtr /* xkb */ , unsigned int /* which */ , Bool /* freeMap */ ); extern _X_EXPORT void XkbFreeNames(XkbDescPtr /* xkb */ , unsigned int /* which */ , Bool /* freeMap */ ); extern _X_EXPORT int _XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode, int *xkb_err); extern _X_EXPORT int _XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode, int *xkb_err); extern _X_EXPORT int _XkbLookupBellDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode, int *xkb_err); extern _X_EXPORT int _XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode, int *xkb_err); extern _X_EXPORT int _XkbLookupButtonDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode, int *xkb_err); extern _X_EXPORT XkbDescPtr XkbAllocKeyboard(void ); extern _X_EXPORT Status XkbAllocClientMap(XkbDescPtr /* xkb */ , unsigned int /* which */ , unsigned int /* nTypes */ ); extern _X_EXPORT Status XkbAllocServerMap(XkbDescPtr /* xkb */ , unsigned int /* which */ , unsigned int /* nNewActions */ ); extern _X_EXPORT void XkbFreeClientMap(XkbDescPtr /* xkb */ , unsigned int /* what */ , Bool /* freeMap */ ); extern _X_EXPORT void XkbFreeServerMap(XkbDescPtr /* xkb */ , unsigned int /* what */ , Bool /* freeMap */ ); extern _X_EXPORT Status XkbAllocIndicatorMaps(XkbDescPtr /* xkb */ ); extern _X_EXPORT Status XkbAllocCompatMap(XkbDescPtr /* xkb */ , unsigned int /* which */ , unsigned int /* nInterpret */ ); extern _X_EXPORT Status XkbAllocNames(XkbDescPtr /* xkb */ , unsigned int /* which */ , int /* nTotalRG */ , int /* nTotalAliases */ ); extern _X_EXPORT Status XkbAllocControls(XkbDescPtr /* xkb */ , unsigned int /* which */ ); extern _X_EXPORT Status XkbCopyKeyTypes(XkbKeyTypePtr /* from */ , XkbKeyTypePtr /* into */ , int /* num_types */ ); extern _X_EXPORT Status XkbResizeKeyType(XkbDescPtr /* xkb */ , int /* type_ndx */ , int /* map_count */ , Bool /* want_preserve */ , int /* new_num_lvls */ ); extern _X_EXPORT void XkbFreeKeyboard(XkbDescPtr /* xkb */ , unsigned int /* which */ , Bool /* freeDesc */ ); extern _X_EXPORT void XkbFreeComponentNames(XkbComponentNamesPtr /* names */ , Bool /* freeNames */ ); extern _X_EXPORT void XkbSetActionKeyMods(XkbDescPtr /* xkb */ , XkbAction * /* act */ , unsigned int /* mods */ ); extern _X_EXPORT unsigned int XkbMaskForVMask(XkbDescPtr /* xkb */ , unsigned int /* vmask */ ); extern _X_EXPORT Bool XkbVirtualModsToReal(XkbDescPtr /* xkb */ , unsigned int /* virtua_mask */ , unsigned int * /* mask_rtrn */ ); extern _X_EXPORT unsigned int XkbAdjustGroup(int /* group */ , XkbControlsPtr /* ctrls */ ); extern _X_EXPORT KeySym *XkbResizeKeySyms(XkbDescPtr /* xkb */ , int /* key */ , int /* needed */ ); extern _X_EXPORT XkbAction *XkbResizeKeyActions(XkbDescPtr /* xkb */ , int /* key */ , int /* needed */ ); extern _X_EXPORT void XkbUpdateKeyTypesFromCore(DeviceIntPtr /* pXDev */ , KeySymsPtr /* syms */ , KeyCode /* first */ , CARD8 /* num */ , XkbChangesPtr /* pChanges */ ); extern _X_EXPORT void XkbUpdateDescActions(XkbDescPtr /* xkb */ , KeyCode /* first */ , CARD8 /* num */ , XkbChangesPtr /* changes */ ); extern _X_EXPORT void XkbUpdateActions(DeviceIntPtr /* pXDev */ , KeyCode /* first */ , CARD8 /* num */ , XkbChangesPtr /* pChanges */ , unsigned int * /* needChecksRtrn */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT KeySymsPtr XkbGetCoreMap(DeviceIntPtr /* keybd */ ); extern _X_EXPORT void XkbApplyMappingChange(DeviceIntPtr /* pXDev */ , KeySymsPtr /* map */ , KeyCode /* firstKey */ , CARD8 /* num */ , CARD8 * /* modmap */ , ClientPtr /* client */ ); extern _X_EXPORT void XkbSetIndicators(DeviceIntPtr /* pXDev */ , CARD32 /* affect */ , CARD32 /* values */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbUpdateIndicators(DeviceIntPtr /* keybd */ , CARD32 /* changed */ , Bool /* check_edevs */ , XkbChangesPtr /* pChanges */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbUpdateAllDeviceIndicators(XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo(DeviceIntPtr /* dev */ , KbdFeedbackPtr /* kf */ , LedFeedbackPtr /* lf */ , unsigned int /* needed_parts */ ); extern _X_EXPORT XkbSrvLedInfoPtr XkbCopySrvLedInfo(DeviceIntPtr /* dev */ , XkbSrvLedInfoPtr /* src */ , KbdFeedbackPtr /* kf */ , LedFeedbackPtr /* lf */ ); extern _X_EXPORT XkbSrvLedInfoPtr XkbFindSrvLedInfo(DeviceIntPtr /* dev */ , unsigned int /* class */ , unsigned int /* id */ , unsigned int /* needed_parts */ ); extern _X_EXPORT void XkbApplyLedNameChanges(DeviceIntPtr /* dev */ , XkbSrvLedInfoPtr /* sli */ , unsigned int /* changed_names */ , xkbExtensionDeviceNotify * /* ed */ , XkbChangesPtr /* changes */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbApplyLedMapChanges(DeviceIntPtr /* dev */ , XkbSrvLedInfoPtr /* sli */ , unsigned int /* changed_maps */ , xkbExtensionDeviceNotify * /* ed */ , XkbChangesPtr /* changes */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbApplyLedStateChanges(DeviceIntPtr /* dev */ , XkbSrvLedInfoPtr /* sli */ , unsigned int /* changed_leds */ , xkbExtensionDeviceNotify * /* ed */ , XkbChangesPtr /* changes */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbFlushLedEvents(DeviceIntPtr /* dev */ , DeviceIntPtr /* kbd */ , XkbSrvLedInfoPtr /* sli */ , xkbExtensionDeviceNotify * /* ed */ , XkbChangesPtr /* changes */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT unsigned int XkbIndicatorsToUpdate(DeviceIntPtr /* dev */ , unsigned long /* state_changes */ , Bool /* enabled_ctrl_changes */ ); extern _X_EXPORT void XkbComputeDerivedState(XkbSrvInfoPtr /* xkbi */ ); extern _X_EXPORT void XkbCheckSecondaryEffects(XkbSrvInfoPtr /* xkbi */ , unsigned int /* which */ , XkbChangesPtr /* changes */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbCheckIndicatorMaps(DeviceIntPtr /* dev */ , XkbSrvLedInfoPtr /* sli */ , unsigned int /* which */ ); extern _X_EXPORT unsigned int XkbStateChangedFlags(XkbStatePtr /* old */ , XkbStatePtr /* new */ ); extern _X_EXPORT void XkbSendStateNotify(DeviceIntPtr /* kbd */ , xkbStateNotify * /* pSN */ ); extern _X_EXPORT void XkbSendMapNotify(DeviceIntPtr /* kbd */ , xkbMapNotify * /* ev */ ); extern _X_EXPORT int XkbComputeControlsNotify(DeviceIntPtr /* kbd */ , XkbControlsPtr /* old */ , XkbControlsPtr /* new */ , xkbControlsNotify * /* pCN */ , Bool /* forceCtrlProc */ ); extern _X_EXPORT void XkbSendControlsNotify(DeviceIntPtr /* kbd */ , xkbControlsNotify * /* ev */ ); extern _X_EXPORT void XkbSendCompatMapNotify(DeviceIntPtr /* kbd */ , xkbCompatMapNotify * /* ev */ ); extern _X_EXPORT void XkbHandleBell(BOOL force, BOOL eventOnly, DeviceIntPtr kbd, CARD8 percent, void *ctrl, CARD8 class, Atom name, WindowPtr pWin, ClientPtr pClient ); extern _X_EXPORT void XkbSendAccessXNotify(DeviceIntPtr /* kbd */ , xkbAccessXNotify * /* pEv */ ); extern _X_EXPORT void XkbSendNamesNotify(DeviceIntPtr /* kbd */ , xkbNamesNotify * /* ev */ ); extern _X_EXPORT void XkbSendActionMessage(DeviceIntPtr /* kbd */ , xkbActionMessage * /* ev */ ); extern _X_EXPORT void XkbSendExtensionDeviceNotify(DeviceIntPtr /* kbd */ , ClientPtr /* client */ , xkbExtensionDeviceNotify * /* ev */ ); extern _X_EXPORT void XkbSendNotification(DeviceIntPtr /* kbd */ , XkbChangesPtr /* pChanges */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbProcessKeyboardEvent(DeviceEvent * /* event */ , DeviceIntPtr /* keybd */ ); extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ , DeviceIntPtr /* kbd */ , DeviceEvent * /* event */ ); extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */, int /* evtype */, int /* key */); extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ , unsigned long /* change */ , unsigned long /* newValues */ , XkbChangesPtr /* changes */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void AccessXInit(DeviceIntPtr /* dev */ ); extern _X_EXPORT Bool AccessXFilterPressEvent(DeviceEvent * /* event */ , DeviceIntPtr /* keybd */ ); extern _X_EXPORT Bool AccessXFilterReleaseEvent(DeviceEvent * /* event */ , DeviceIntPtr /* keybd */ ); extern _X_EXPORT void AccessXCancelRepeatKey(XkbSrvInfoPtr /* xkbi */ , KeyCode /* key */ ); extern _X_EXPORT void AccessXComputeCurveFactor(XkbSrvInfoPtr /* xkbi */ , XkbControlsPtr /* ctrls */ ); extern _X_EXPORT XkbInterestPtr XkbFindClientResource(DevicePtr /* inDev */ , ClientPtr /* client */ ); extern _X_EXPORT XkbInterestPtr XkbAddClientResource(DevicePtr /* inDev */ , ClientPtr /* client */ , XID /* id */ ); extern _X_EXPORT int XkbRemoveResourceClient(DevicePtr /* inDev */ , XID /* id */ ); extern _X_EXPORT int XkbDDXAccessXBeep(DeviceIntPtr /* dev */ , unsigned int /* what */ , unsigned int /* which */ ); extern _X_EXPORT int XkbDDXUsesSoftRepeat(DeviceIntPtr /* dev */ ); extern _X_EXPORT void XkbDDXKeybdCtrlProc(DeviceIntPtr /* dev */ , KeybdCtrl * /* ctrl */ ); extern _X_EXPORT void XkbDDXChangeControls(DeviceIntPtr /* dev */ , XkbControlsPtr /* old */ , XkbControlsPtr /* new */ ); extern _X_EXPORT void XkbDDXUpdateDeviceIndicators(DeviceIntPtr /* dev */ , XkbSrvLedInfoPtr /* sli */ , CARD32 /* newState */ ); extern _X_EXPORT int XkbDDXTerminateServer(DeviceIntPtr /* dev */ , KeyCode /* key */ , XkbAction * /* act */ ); extern _X_EXPORT int XkbDDXSwitchScreen(DeviceIntPtr /* dev */ , KeyCode /* key */ , XkbAction * /* act */ ); extern _X_EXPORT int XkbDDXPrivate(DeviceIntPtr /* dev */ , KeyCode /* key */ , XkbAction * /* act */ ); extern _X_EXPORT void XkbDisableComputedAutoRepeats(DeviceIntPtr /* pXDev */ , unsigned int /* key */ ); extern _X_EXPORT void XkbSetRepeatKeys(DeviceIntPtr /* pXDev */ , int /* key */ , int /* onoff */ ); extern _X_EXPORT int XkbLatchModifiers(DeviceIntPtr /* pXDev */ , CARD8 /* mask */ , CARD8 /* latches */ ); extern _X_EXPORT int XkbLatchGroup(DeviceIntPtr /* pXDev */ , int /* group */ ); extern _X_EXPORT void XkbClearAllLatchesAndLocks(DeviceIntPtr /* dev */ , XkbSrvInfoPtr /* xkbi */ , Bool /* genEv */ , XkbEventCausePtr /* cause */ ); extern _X_EXPORT void XkbInitRules(XkbRMLVOSet * /* rmlvo */, const char * /* rules */, const char * /* model */, const char * /* layout */, const char * /* variant */, const char * /* options */ ) ; extern _X_EXPORT void XkbGetRulesDflts(XkbRMLVOSet * /* rmlvo */ ); extern _X_EXPORT void XkbFreeRMLVOSet(XkbRMLVOSet * /* rmlvo */ , Bool /* freeRMLVO */ ); extern _X_EXPORT void XkbSetRulesDflts(XkbRMLVOSet * /* rmlvo */ ); extern _X_EXPORT void XkbDeleteRulesDflts(void ); extern _X_EXPORT void XkbDeleteRulesUsed(void ); extern _X_EXPORT int SProcXkbDispatch(ClientPtr /* client */ ); extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry(DeviceIntPtr /* dev */ , Atom /* name */ , Bool * /* shouldFree */ ); extern _X_EXPORT void XkbConvertCase(KeySym /* sym */ , KeySym * /* lower */ , KeySym * /* upper */ ); extern _X_EXPORT Status XkbChangeKeycodeRange(XkbDescPtr /* xkb */ , int /* minKC */ , int /* maxKC */ , XkbChangesPtr /* changes */ ); extern _X_EXPORT void XkbFreeSrvLedInfo(XkbSrvLedInfoPtr /* sli */ ); extern _X_EXPORT void XkbFreeInfo(XkbSrvInfoPtr /* xkbi */ ); extern _X_EXPORT Status XkbChangeTypesOfKey(XkbDescPtr /* xkb */ , int /* key */ , int /* nGroups */ , unsigned int /* groups */ , int * /* newTypesIn */ , XkbMapChangesPtr /* changes */ ); extern _X_EXPORT int XkbKeyTypesForCoreSymbols(XkbDescPtr /* xkb */ , int /* map_width */ , KeySym * /* core_syms */ , unsigned int /* protected */ , int * /* types_inout */ , KeySym * /* xkb_syms_rtrn */ ); extern _X_EXPORT Bool XkbApplyCompatMapToKey(XkbDescPtr /* xkb */ , KeyCode /* key */ , XkbChangesPtr /* changes */ ); extern _X_EXPORT Bool XkbApplyVirtualModChanges(XkbDescPtr /* xkb */ , unsigned int /* changed */ , XkbChangesPtr /* changes */ ); extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ , xkbNewKeyboardNotify * /* pNKN */ ); extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ , XkbDescPtr /* src */ ); extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */, DeviceIntPtr /* src */); extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ , XkbDescPtr /* src */ ); extern void XkbFilterEvents(ClientPtr /* pClient */ , int /* nEvents */ , xEvent * /* xE */ ); extern int XkbGetEffectiveGroup(XkbSrvInfoPtr /* xkbi */ , XkbStatePtr /* xkbstate */ , CARD8 /* keycode */ ); extern void XkbMergeLockedPtrBtns(DeviceIntPtr /* master */ ); extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ , int /* press */ , int /* button */ ); extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ , XkbDescPtr /* src */ ); #include "xkbfile.h" #include "xkbrules.h" #define _XkbListKeycodes 0 #define _XkbListTypes 1 #define _XkbListCompat 2 #define _XkbListSymbols 3 #define _XkbListGeometry 4 #define _XkbListNumComponents 5 extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(DeviceIntPtr /* keybd */ , XkbComponentNamesPtr /* names */ , unsigned int /* want */ , unsigned int /* need */ , XkbDescPtr * /* finfoRtrn */ , char * /* keymapNameRtrn */ , int /* keymapNameRtrnLen */ ); extern _X_EXPORT Bool XkbDDXNamesFromRules(DeviceIntPtr /* keybd */ , const char * /* rules */ , XkbRF_VarDefsPtr /* defs */ , XkbComponentNamesPtr /* names */ ); extern _X_EXPORT XkbDescPtr XkbCompileKeymap(DeviceIntPtr /* dev */ , XkbRMLVOSet * /* rmlvo */ ); extern _X_EXPORT XkbDescPtr XkbCompileKeymapFromString(DeviceIntPtr dev, const char *keymap, int keymap_length); #endif /* _XKBSRV_H_ */ xorg-server-1.20.8/include/xwayland-config.h.meson.in0000644000175000017500000000035613640201473017425 00000000000000/* xwayland-config.h.meson.in: not at all generated */ #pragma once #include /* Build glamor support for Xwayland */ #mesondefine XWL_HAS_GLAMOR /* Build eglstream support for Xwayland */ #mesondefine XWL_HAS_EGLSTREAM xorg-server-1.20.8/include/site.h0000644000175000017500000001126213640201473013550 00000000000000/************************************************************ 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 SITE_H #define SITE_H /* * The vendor string identifies the vendor responsible for the * server executable. */ #ifndef VENDOR_STRING #define VENDOR_STRING "The X.Org Foundation" #endif /* * The vendor release number identifies, for the purpose of submitting * traceable bug reports, the release number of software produced * by the vendor. */ #ifndef VENDOR_RELEASE #define VENDOR_RELEASE 6600 #endif /* * The following constants are provided solely as a last line of defense. The * normal build ALWAYS overrides them using a special rule given in * server/dix/Imakefile. If you want to change either of these constants, * you should set the DefaultFontPath or DefaultRGBDatabase configuration * parameters. * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE! */ #ifndef COMPILEDDEFAULTFONTPATH #define COMPILEDDEFAULTFONTPATH "/usr/share/fonts/X11/misc/" #endif /* * The following constants contain default values for all of the variables * that can be initialized on the server command line or in the environment. */ #define COMPILEDDEFAULTFONT "fixed" #define COMPILEDCURSORFONT "cursor" #ifndef COMPILEDDISPLAYCLASS #define COMPILEDDISPLAYCLASS "MIT-unspecified" #endif #define DEFAULT_TIMEOUT 60 /* seconds */ #define DEFAULT_KEYBOARD_CLICK 0 #define DEFAULT_BELL 50 #define DEFAULT_BELL_PITCH 400 #define DEFAULT_BELL_DURATION 100 #define DEFAULT_AUTOREPEAT TRUE #define DEFAULT_AUTOREPEATS {\ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} #define DEFAULT_LEDS 0x0 /* all off */ #define DEFAULT_LEDS_MASK 0xffffffff /* 32 */ #define DEFAULT_INT_RESOLUTION 1000 #define DEFAULT_INT_MIN_VALUE 0 #define DEFAULT_INT_MAX_VALUE 100 #define DEFAULT_INT_DISPLAYED 0 #define DEFAULT_PTR_NUMERATOR 2 #define DEFAULT_PTR_DENOMINATOR 1 #define DEFAULT_PTR_THRESHOLD 4 #define DEFAULT_SCREEN_SAVER_TIME (10 * (60 * 1000)) #define DEFAULT_SCREEN_SAVER_INTERVAL (10 * (60 * 1000)) #define DEFAULT_SCREEN_SAVER_BLANKING PreferBlanking #define DEFAULT_SCREEN_SAVER_EXPOSURES AllowExposures #ifndef DEFAULT_ACCESS_CONTROL #define DEFAULT_ACCESS_CONTROL TRUE #endif /* Default logging parameters. */ #ifndef DEFAULT_LOG_VERBOSITY #define DEFAULT_LOG_VERBOSITY 0 #endif #ifndef DEFAULT_LOG_FILE_VERBOSITY #define DEFAULT_LOG_FILE_VERBOSITY 3 #endif #endif /* SITE_H */ xorg-server-1.20.8/include/inpututils.h0000644000175000017500000000604113640201473015023 00000000000000/* * Copyright © 2010 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. * */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #ifndef INPUTUTILS_H #define INPUTUTILS_H #include "input.h" #include "eventstr.h" #include extern Mask event_filters[MAXDEVICES][MAXEVENTS]; struct _ValuatorMask { int8_t last_bit; /* highest bit set in mask */ int8_t has_unaccelerated; uint8_t mask[(MAX_VALUATORS + 7) / 8]; double valuators[MAX_VALUATORS]; /* valuator data */ double unaccelerated[MAX_VALUATORS]; /* valuator data */ }; extern void verify_internal_event(const InternalEvent *ev); extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms, enum DeviceEventSource event_source); extern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd); extern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event); extern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype); extern Mask event_get_filter_from_xi2type(int evtype); FP3232 double_to_fp3232(double in); FP1616 double_to_fp1616(double in); double fp1616_to_double(FP1616 in); double fp3232_to_double(FP3232 in); XI2Mask *xi2mask_new(void); XI2Mask *xi2mask_new_with_size(size_t, size_t); /* don't use it */ void xi2mask_free(XI2Mask **mask); Bool xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type); Bool xi2mask_isset_for_device(XI2Mask *mask, const DeviceIntPtr dev, int event_type); void xi2mask_set(XI2Mask *mask, int deviceid, int event_type); void xi2mask_zero(XI2Mask *mask, int deviceid); void xi2mask_merge(XI2Mask *dest, const XI2Mask *source); size_t xi2mask_num_masks(const XI2Mask *mask); size_t xi2mask_mask_size(const XI2Mask *mask); void xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid, const unsigned char *mask, size_t mask_size); const unsigned char *xi2mask_get_one_mask(const XI2Mask *xi2mask, int deviceid); #endif xorg-server-1.20.8/include/scrnintstr.h0000644000175000017500000006520113640201473015017 00000000000000/*********************************************************** 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 SCREENINTSTRUCT_H #define SCREENINTSTRUCT_H #include "screenint.h" #include "regionstr.h" #include "colormap.h" #include "cursor.h" #include "validate.h" #include #include "dix.h" #include "privates.h" #include typedef struct _PixmapFormat { unsigned char depth; unsigned char bitsPerPixel; unsigned char scanlinePad; } PixmapFormatRec; typedef struct _Visual { VisualID vid; short class; short bitsPerRGBValue; short ColormapEntries; short nplanes; /* = log2 (ColormapEntries). This does not * imply that the screen has this many planes. * it may have more or fewer */ unsigned long redMask, greenMask, blueMask; int offsetRed, offsetGreen, offsetBlue; } VisualRec; typedef struct _Depth { unsigned char depth; short numVids; VisualID *vids; /* block of visual ids for this depth */ } DepthRec; typedef struct _ScreenSaverStuff { WindowPtr pWindow; XID wid; char blanked; Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ , int /*xstate */ , Bool /*force */ ); } ScreenSaverStuffRec; /* * There is a typedef for each screen function pointer so that code that * needs to declare a screen function pointer (e.g. in a screen private * or as a local variable) can easily do so and retain full type checking. */ typedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ ); typedef void (*QueryBestSizeProcPtr) (int /*class */ , unsigned short * /*pwidth */ , unsigned short * /*pheight */ , ScreenPtr /*pScreen */ ); typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ , int /*on */ ); typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ , int /*sx */ , int /*sy */ , int /*w */ , int /*h */ , unsigned int /*format */ , unsigned long /*planeMask */ , char * /*pdstLine */ ); typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ , int /*wMax */ , DDXPointPtr /*ppt */ , int * /*pwidth */ , int /*nspans */ , char * /*pdstStart */ ); typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ , int /*x */ , int /*y */ , int /*width */ , int /*height */ , unsigned int /*subWindowMode */ ); typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ ); typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ ); typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ , int /*x */ , int /*y */ ); typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ , unsigned long /*mask */ ); typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ ); typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ ); typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ , WindowPtr /*pOldNextSib */ ); typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ , WindowPtr /*pChild */ , VTKind /*kind */ ); typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ , WindowPtr /*pChild */ , VTKind /*kind */ ); typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ , RegionPtr /*prgn */); typedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/, RegionPtr /*pRegion*/, int /*what*/); typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ , DDXPointRec /*ptOldOrg */ , RegionPtr /*prgnSrc */ ); typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ , int /*x */ , int /*y */ , int /*w */ , int /*h */ , Bool /*generateExposures */ ); typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ , int /*dx */ , int /*dy */ ); /* pixmap will exist only for the duration of the current rendering operation */ #define CREATE_PIXMAP_USAGE_SCRATCH 1 /* pixmap will be the backing pixmap for a redirected window */ #define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2 /* pixmap will contain a glyph */ #define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3 /* pixmap will be shared */ #define CREATE_PIXMAP_USAGE_SHARED 4 typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ , int /*width */ , int /*height */ , int /*depth */ , unsigned /*usage_hint */ ); typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ ); typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ , FontPtr /*pFont */ ); typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ , FontPtr /*pFont */ ); typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ , ScreenPtr /*pScreen */ , BoxPtr /*pBox */ ); typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , CursorPtr /*pCursor */ , BoxPtr /*pHotBox */ , BoxPtr /*pTopLeftBox */ ); typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , CursorPtr /*pCursor */ ); typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , CursorPtr /*pCursor */ ); typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , CursorPtr /*pCursor */ ); typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , CursorPtr /*pCursor */ , Bool /*displayed */ ); typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , int /*x */ , int /*y */ , Bool /*generateEvent */ ); typedef void (*CursorWarpedToProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , ClientPtr /*pClient */ , WindowPtr /*pWindow */ , SpritePtr /*pSprite */ , int /*x */ , int /*y */ ); typedef void (*CurserConfinedToProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /*pScreen */ , WindowPtr /*pWindow */ ); typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ ); typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ ); typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ ); typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ ); typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ ); typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ , XID * /*pmaps */ ); typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ , int /*ndef */ , xColorItem * /*pdef */ ); typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ , unsigned short * /*pgreen */ , unsigned short * /*pblue */ , VisualPtr /*pVisual */ ); typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ ); typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen, void *timeout); /* result has three possible values: * < 0 - error * = 0 - timeout * > 0 - activity */ typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen, int result); typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ ); typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData); typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ ); typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ , PixmapPtr /*pPix */ ); typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ ); typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ ); typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ ); typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ , WindowPtr /*firstChild */ , WindowPtr * /*pLayerWin */ ); typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ , int /*x */ , int /*y */ , int /*w */ , int /*h */ , int /*bw */ , WindowPtr /*pSib */ ); typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ , int /*x */ , int /*y */ , WindowPtr /*pSib */ , VTKind /*kind */ ); typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ , int /*x */ , int /*y */ , unsigned int /*w */ , unsigned int /*h */ , WindowPtr /*pSib */ ); typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */ ); typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ ); typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ , WindowPtr /*pPriorParent */ ); typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ , int /* kind */ ); typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ , unsigned int /*width */ ); typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ , WindowPtr /*pWin */ , Bool /*fromConfigure */ ); typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScreen */ ); typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ , ScreenPtr /* pScreen */ ); typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int, int *, int *); typedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **); typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *); #define HAS_SYNC_SHARED_PIXMAP 1 /* The SyncSharedPixmap hook has two purposes: * * 1. If the master driver has it, the slave driver can use it to * synchronize the shared pixmap contents with the screen pixmap. * 2. If the slave driver has it, the master driver can expect the slave * driver to call the master screen's SyncSharedPixmap hook, so the master * driver doesn't have to synchronize the shared pixmap contents itself, * e.g. from the BlockHandler. * * A driver must only set the hook if it handles both cases correctly. * * The argument is the slave screen's pixmap_dirty_list entry, the hook is * responsible for finding the corresponding entry in the master screen's * pixmap_dirty_list. */ typedef void (*SyncSharedPixmapProcPtr)(PixmapDirtyUpdatePtr); typedef Bool (*StartPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr, int x, int y, int dst_x, int dst_y, Rotation rotation); typedef Bool (*PresentSharedPixmapProcPtr)(PixmapPtr); typedef Bool (*RequestSharedPixmapNotifyDamageProcPtr)(PixmapPtr); typedef Bool (*StopPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr); typedef Bool (*StopFlippingPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr, PixmapPtr); typedef Bool (*SharedPixmapNotifyDamageProcPtr)(PixmapPtr); typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool); typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen, SpritePtr pSprite, int x, int y); typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32); typedef void (*DPMSProcPtr)(ScreenPtr pScreen, int level); /* Wrapping Screen procedures There are a few modules in the X server which dynamically add and remove themselves from various screen procedure call chains. For example, the BlockHandler is dynamically modified by: * xf86Rotate * miSprite * composite * render (for animated cursors) Correctly manipulating this chain is complicated by the fact that the chain is constructed through a sequence of screen private structures, each holding the next screen->proc pointer. To add a module to a screen->proc chain is fairly simple; just save the current screen->proc value in the module screen private and store the module's function in the screen->proc location. Removing a screen proc is a bit trickier. It seems like all you need to do is set the screen->proc pointer back to the value saved in your screen private. However, if some other module has come along and wrapped on top of you, then the right place to store the previous screen->proc value is actually in the wrapping module's screen private structure(!). Of course, you have no idea what other module may have wrapped on top, nor could you poke inside its screen private in any case. To make this work, we restrict the unwrapping process to happen during the invocation of the screen proc itself, and then we require the screen proc to take some care when manipulating the screen proc functions pointers. The requirements are: 1) The screen proc must set the screen->proc pointer back to the value saved in its screen private before calling outside its module. 2a) If the screen proc wants to be remove itself from the chain, it must not manipulate screen->proc pointer again before returning. 2b) If the screen proc wants to remain in the chain, it must: 2b.1) Re-fetch the screen->proc pointer and store that in its screen private. This ensures that any changes to the chain will be preserved. 2b.2) Set screen->proc back to itself One key requirement here is that these steps must wrap not just any invocation of the nested screen->proc value, but must nest essentially any calls outside the current module. This ensures that other modules can reliably manipulate screen->proc wrapping using these same rules. For example, the animated cursor code in render has two macros, Wrap and Unwrap. #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) Unwrap takes the screen private (as), the screen (s) and the member name (elt), and restores screen->proc to that saved in the screen private. #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) Wrap takes the screen private (as), the screen (s), the member name (elt) and the wrapping function (func). It saves the current screen->proc value in the screen private, and then sets the screen->proc to the local wrapping function. Within each of these functions, there's a pretty simple pattern: Unwrap(as, pScreen, UnrealizeCursor); // Do local stuff, including possibly calling down through // pScreen->UnrealizeCursor Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); The wrapping block handler is a bit different; it does the Unwrap, the local operations and then only re-Wraps if the hook is still required. Unwrap occurrs at the top of each function, just after entry, and Wrap occurrs at the bottom of each function, just before returning. */ typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; short x, y, width, height; short mmWidth, mmHeight; short numDepths; unsigned char rootDepth; DepthPtr allowedDepths; unsigned long rootVisual; unsigned long defColormap; short minInstalledCmaps, maxInstalledCmaps; char backingStoreSupport, saveUnderSupport; unsigned long whitePixel, blackPixel; GCPtr GCperDepth[MAXFORMATS + 1]; /* next field is a stipple to use as default in a GC. we don't build * default tiles of all depths because they are likely to be of a color * different from the default fg pixel, so we don't win anything by * building a standard one. */ PixmapPtr defaultStipple; void *devPrivate; short numVisuals; VisualPtr visuals; WindowPtr root; ScreenSaverStuffRec screensaver; DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST]; /* Random screen procedures */ CloseScreenProcPtr CloseScreen; QueryBestSizeProcPtr QueryBestSize; SaveScreenProcPtr SaveScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; /* Window Procedures */ CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; PositionWindowProcPtr PositionWindow; ChangeWindowAttributesProcPtr ChangeWindowAttributes; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; WindowExposuresProcPtr WindowExposures; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; ClipNotifyProcPtr ClipNotify; RestackWindowProcPtr RestackWindow; PaintWindowProcPtr PaintWindow; /* Pixmap procedures */ CreatePixmapProcPtr CreatePixmap; DestroyPixmapProcPtr DestroyPixmap; /* Font procedures */ RealizeFontProcPtr RealizeFont; UnrealizeFontProcPtr UnrealizeFont; /* Cursor Procedures */ ConstrainCursorProcPtr ConstrainCursor; ConstrainCursorHarderProcPtr ConstrainCursorHarder; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; CursorWarpedToProcPtr CursorWarpedTo; CurserConfinedToProcPtr CursorConfinedTo; /* GC procedures */ CreateGCProcPtr CreateGC; /* Colormap procedures */ CreateColormapProcPtr CreateColormap; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; UninstallColormapProcPtr UninstallColormap; ListInstalledColormapsProcPtr ListInstalledColormaps; StoreColorsProcPtr StoreColors; ResolveColorProcPtr ResolveColor; /* Region procedures */ BitmapToRegionProcPtr BitmapToRegion; /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; ScreenWakeupHandlerProcPtr WakeupHandler; /* anybody can get a piece of this array */ PrivateRec *devPrivates; CreateScreenResourcesProcPtr CreateScreenResources; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; GetWindowPixmapProcPtr GetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap; GetScreenPixmapProcPtr GetScreenPixmap; SetScreenPixmapProcPtr SetScreenPixmap; NameWindowPixmapProcPtr NameWindowPixmap; PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ unsigned int totalPixmapSize; MarkWindowProcPtr MarkWindow; MarkOverlappedWindowsProcPtr MarkOverlappedWindows; ConfigNotifyProcPtr ConfigNotify; MoveWindowProcPtr MoveWindow; ResizeWindowProcPtr ResizeWindow; GetLayerWindowProcPtr GetLayerWindow; HandleExposuresProcPtr HandleExposures; ReparentWindowProcPtr ReparentWindow; SetShapeProcPtr SetShape; ChangeBorderWidthProcPtr ChangeBorderWidth; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; /* Device cursor procedures */ DeviceCursorInitializeProcPtr DeviceCursorInitialize; DeviceCursorCleanupProcPtr DeviceCursorCleanup; /* set it in driver side if X server can copy the framebuffer content. * Meant to be used together with '-background none' option, avoiding * malicious users to steal framebuffer's content if that would be the * default */ Bool canDoBGNoneRoot; Bool isGPU; /* Info on this screen's slaves (if any) */ struct xorg_list slave_list; struct xorg_list slave_head; int output_slaves; /* Info for when this screen is a slave */ ScreenPtr current_master; Bool is_output_slave; Bool is_offload_slave; SharePixmapBackingProcPtr SharePixmapBacking; SetSharedPixmapBackingProcPtr SetSharedPixmapBacking; StartPixmapTrackingProcPtr StartPixmapTracking; StopPixmapTrackingProcPtr StopPixmapTracking; SyncSharedPixmapProcPtr SyncSharedPixmap; SharedPixmapNotifyDamageProcPtr SharedPixmapNotifyDamage; RequestSharedPixmapNotifyDamageProcPtr RequestSharedPixmapNotifyDamage; PresentSharedPixmapProcPtr PresentSharedPixmap; StopFlippingPixmapTrackingProcPtr StopFlippingPixmapTracking; struct xorg_list pixmap_dirty_list; ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap; XYToWindowProcPtr XYToWindow; DPMSProcPtr DPMS; } ScreenRec; static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) { return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */ } typedef struct _ScreenInfo { int imageByteOrder; int bitmapScanlineUnit; int bitmapScanlinePad; int bitmapBitOrder; int numPixmapFormats; PixmapFormatRec formats[MAXFORMATS]; int numScreens; ScreenPtr screens[MAXSCREENS]; int numGPUScreens; ScreenPtr gpuscreens[MAXGPUSCREENS]; int x; /* origin */ int y; /* origin */ int width; /* total width of all screens together */ int height; /* total height of all screens together */ } ScreenInfo; extern _X_EXPORT ScreenInfo screenInfo; extern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ , int /*argc */ , char ** /*argv */ ); #endif /* SCREENINTSTRUCT_H */ xorg-server-1.20.8/include/pixmap.h0000644000175000017500000001203513640201473014101 00000000000000/*********************************************************** 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 PIXMAP_H #define PIXMAP_H #include "misc.h" #include "screenint.h" #include "regionstr.h" #include /* types for Drawable */ #define DRAWABLE_WINDOW 0 #define DRAWABLE_PIXMAP 1 #define UNDRAWABLE_WINDOW 2 /* corresponding type masks for dixLookupDrawable() */ #define M_DRAWABLE_WINDOW (1<<0) #define M_DRAWABLE_PIXMAP (1<<1) #define M_UNDRAWABLE_WINDOW (1<<2) #define M_ANY (-1) #define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW) #define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP) #define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW) /* flags to PaintWindow() */ #define PW_BACKGROUND 0 #define PW_BORDER 1 #define NullPixmap ((PixmapPtr)0) typedef struct _Drawable *DrawablePtr; typedef struct _Pixmap *PixmapPtr; typedef struct _PixmapDirtyUpdate *PixmapDirtyUpdatePtr; typedef union _PixUnion { PixmapPtr pixmap; unsigned long pixel; } PixUnion; #define SamePixUnion(a,b,isPixel)\ ((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap) #define EqualPixUnion(as, a, bs, b) \ ((as) == (bs) && (SamePixUnion (a, b, as))) #define OnScreenDrawable(type) \ (type == DRAWABLE_WINDOW) #define WindowDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW)) extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData); extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ ); extern _X_EXPORT Bool CreateScratchPixmapsForScreen(ScreenPtr /*pScreen */ ); extern _X_EXPORT void FreeScratchPixmapsForScreen(ScreenPtr /*pScreen */ ); extern _X_EXPORT PixmapPtr AllocatePixmap(ScreenPtr /*pScreen */ , int /*pixDataSize */ ); extern _X_EXPORT void FreePixmap(PixmapPtr /*pPixmap */ ); extern _X_EXPORT PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave); extern _X_EXPORT void PixmapUnshareSlavePixmap(PixmapPtr slave_pixmap); #define HAS_DIRTYTRACKING_ROTATION 1 #define HAS_DIRTYTRACKING_DRAWABLE_SRC 1 extern _X_EXPORT Bool PixmapStartDirtyTracking(DrawablePtr src, PixmapPtr slave_dst, int x, int y, int dst_x, int dst_y, Rotation rotation); extern _X_EXPORT Bool PixmapStopDirtyTracking(DrawablePtr src, PixmapPtr slave_dst); /* helper function, drivers can do this themselves if they can do it more efficently */ extern _X_EXPORT Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty); #endif /* PIXMAP_H */ xorg-server-1.20.8/include/glx_extinit.h0000644000175000017500000000370213640201473015142 00000000000000/* * Copyright (C) 1994-2003 The XFree86 Project, 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 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, FIT- * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * XFREE86 PROJECT 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 XFree86 Project 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 XFree86 Project. */ #ifndef GLX_EXT_INIT_H #define GLX_EXT_INIT_H /* this is separate due to sdksyms pulling in extinit.h */ /* XXX this comment no longer makes sense i think */ #ifdef GLXEXT typedef struct __GLXprovider __GLXprovider; typedef struct __GLXscreen __GLXscreen; struct __GLXprovider { __GLXscreen *(*screenProbe) (ScreenPtr pScreen); const char *name; __GLXprovider *next; }; extern __GLXprovider __glXDRISWRastProvider; void GlxPushProvider(__GLXprovider * provider); Bool xorgGlxCreateVendor(void); #else static inline Bool xorgGlxCreateVendor(void) { return TRUE; } #endif #endif xorg-server-1.20.8/include/swaprep.h0000644000175000017500000002453213640201473014271 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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 SWAPREP_H #define SWAPREP_H 1 extern void Swap32Write(ClientPtr /* pClient */ , int /* size */ , CARD32 * /* pbuf */ ); extern void CopySwap32Write(ClientPtr /* pClient */ , int /* size */ , CARD32 * /* pbuf */ ); extern void CopySwap16Write(ClientPtr /* pClient */ , int /* size */ , short * /* pbuf */ ); extern void SGenericReply(ClientPtr /* pClient */ , int /* size */ , xGenericReply * /* pRep */ ); extern void SGetWindowAttributesReply(ClientPtr /* pClient */ , int /* size */ , xGetWindowAttributesReply * /* pRep */ ); extern void SGetGeometryReply(ClientPtr /* pClient */ , int /* size */ , xGetGeometryReply * /* pRep */ ); extern void SQueryTreeReply(ClientPtr /* pClient */ , int /* size */ , xQueryTreeReply * /* pRep */ ); extern void SInternAtomReply(ClientPtr /* pClient */ , int /* size */ , xInternAtomReply * /* pRep */ ); extern void SGetAtomNameReply(ClientPtr /* pClient */ , int /* size */ , xGetAtomNameReply * /* pRep */ ); extern void SGetPropertyReply(ClientPtr /* pClient */ , int /* size */ , xGetPropertyReply * /* pRep */ ); extern void SListPropertiesReply(ClientPtr /* pClient */ , int /* size */ , xListPropertiesReply * /* pRep */ ); extern void SGetSelectionOwnerReply(ClientPtr /* pClient */ , int /* size */ , xGetSelectionOwnerReply * /* pRep */ ); extern void SQueryPointerReply(ClientPtr /* pClient */ , int /* size */ , xQueryPointerReply * /* pRep */ ); extern void SwapTimeCoordWrite(ClientPtr /* pClient */ , int /* size */ , xTimecoord * /* pRep */ ); extern void SGetMotionEventsReply(ClientPtr /* pClient */ , int /* size */ , xGetMotionEventsReply * /* pRep */ ); extern void STranslateCoordsReply(ClientPtr /* pClient */ , int /* size */ , xTranslateCoordsReply * /* pRep */ ); extern void SGetInputFocusReply(ClientPtr /* pClient */ , int /* size */ , xGetInputFocusReply * /* pRep */ ); extern void SQueryKeymapReply(ClientPtr /* pClient */ , int /* size */ , xQueryKeymapReply * /* pRep */ ); extern void SQueryFontReply(ClientPtr /* pClient */ , int /* size */ , xQueryFontReply * /* pRep */ ); extern void SQueryTextExtentsReply(ClientPtr /* pClient */ , int /* size */ , xQueryTextExtentsReply * /* pRep */ ); extern void SListFontsReply(ClientPtr /* pClient */ , int /* size */ , xListFontsReply * /* pRep */ ); extern void SListFontsWithInfoReply(ClientPtr /* pClient */ , int /* size */ , xListFontsWithInfoReply * /* pRep */ ); extern void SGetFontPathReply(ClientPtr /* pClient */ , int /* size */ , xGetFontPathReply * /* pRep */ ); extern void SGetImageReply(ClientPtr /* pClient */ , int /* size */ , xGetImageReply * /* pRep */ ); extern void SListInstalledColormapsReply(ClientPtr /* pClient */ , int /* size */ , xListInstalledColormapsReply * /* pRep */ ); extern void SAllocColorReply(ClientPtr /* pClient */ , int /* size */ , xAllocColorReply * /* pRep */ ); extern void SAllocNamedColorReply(ClientPtr /* pClient */ , int /* size */ , xAllocNamedColorReply * /* pRep */ ); extern void SAllocColorCellsReply(ClientPtr /* pClient */ , int /* size */ , xAllocColorCellsReply * /* pRep */ ); extern void SAllocColorPlanesReply(ClientPtr /* pClient */ , int /* size */ , xAllocColorPlanesReply * /* pRep */ ); extern void SQColorsExtend(ClientPtr /* pClient */ , int /* size */ , xrgb * /* prgb */ ); extern void SQueryColorsReply(ClientPtr /* pClient */ , int /* size */ , xQueryColorsReply * /* pRep */ ); extern void SLookupColorReply(ClientPtr /* pClient */ , int /* size */ , xLookupColorReply * /* pRep */ ); extern void SQueryBestSizeReply(ClientPtr /* pClient */ , int /* size */ , xQueryBestSizeReply * /* pRep */ ); extern void SListExtensionsReply(ClientPtr /* pClient */ , int /* size */ , xListExtensionsReply * /* pRep */ ); extern void SGetKeyboardMappingReply(ClientPtr /* pClient */ , int /* size */ , xGetKeyboardMappingReply * /* pRep */ ); extern void SGetPointerMappingReply(ClientPtr /* pClient */ , int /* size */ , xGetPointerMappingReply * /* pRep */ ); extern void SGetModifierMappingReply(ClientPtr /* pClient */ , int /* size */ , xGetModifierMappingReply * /* pRep */ ); extern void SGetKeyboardControlReply(ClientPtr /* pClient */ , int /* size */ , xGetKeyboardControlReply * /* pRep */ ); extern void SGetPointerControlReply(ClientPtr /* pClient */ , int /* size */ , xGetPointerControlReply * /* pRep */ ); extern void SGetScreenSaverReply(ClientPtr /* pClient */ , int /* size */ , xGetScreenSaverReply * /* pRep */ ); extern void SLHostsExtend(ClientPtr /* pClient */ , int /* size */ , char * /* buf */ ); extern void SListHostsReply(ClientPtr /* pClient */ , int /* size */ , xListHostsReply * /* pRep */ ); extern void SErrorEvent(xError * /* from */ , xError * /* to */ ); extern void SwapConnSetupInfo(char * /* pInfo */ , char * /* pInfoTBase */ ); extern void WriteSConnectionInfo(ClientPtr /* pClient */ , unsigned long /* size */ , char * /* pInfo */ ); extern void SwapConnSetupPrefix(xConnSetupPrefix * /* pcspFrom */ , xConnSetupPrefix * /* pcspTo */ ); extern void WriteSConnSetupPrefix(ClientPtr /* pClient */ , xConnSetupPrefix * /* pcsp */ ); #undef SWAPREP_PROC #define SWAPREP_PROC(func) extern void func(xEvent * /* from */, xEvent * /* to */) SWAPREP_PROC(SCirculateEvent); SWAPREP_PROC(SClientMessageEvent); SWAPREP_PROC(SColormapEvent); SWAPREP_PROC(SConfigureNotifyEvent); SWAPREP_PROC(SConfigureRequestEvent); SWAPREP_PROC(SCreateNotifyEvent); SWAPREP_PROC(SDestroyNotifyEvent); SWAPREP_PROC(SEnterLeaveEvent); SWAPREP_PROC(SExposeEvent); SWAPREP_PROC(SFocusEvent); SWAPREP_PROC(SGraphicsExposureEvent); SWAPREP_PROC(SGravityEvent); SWAPREP_PROC(SKeyButtonPtrEvent); SWAPREP_PROC(SKeymapNotifyEvent); SWAPREP_PROC(SMapNotifyEvent); SWAPREP_PROC(SMapRequestEvent); SWAPREP_PROC(SMappingEvent); SWAPREP_PROC(SNoExposureEvent); SWAPREP_PROC(SPropertyEvent); SWAPREP_PROC(SReparentEvent); SWAPREP_PROC(SResizeRequestEvent); SWAPREP_PROC(SSelectionClearEvent); SWAPREP_PROC(SSelectionNotifyEvent); SWAPREP_PROC(SSelectionRequestEvent); SWAPREP_PROC(SUnmapNotifyEvent); SWAPREP_PROC(SVisibilityEvent); #undef SWAPREP_PROC #endif /* SWAPREP_H */ xorg-server-1.20.8/include/miscstruct.h0000644000175000017500000000507613640201473015012 00000000000000/*********************************************************** 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 MISCSTRUCT_H #define MISCSTRUCT_H 1 #include "misc.h" #include #include typedef xPoint DDXPointRec; typedef struct pixman_box16 BoxRec; typedef union _DevUnion { void *ptr; long val; unsigned long uval; void *(*fptr) (void); } DevUnion; #endif /* MISCSTRUCT_H */ xorg-server-1.20.8/include/xwayland-config.h.in0000644000175000017500000000045113640201473016301 00000000000000/* xwayland-config.h.in: not at all generated. */ #ifndef _XWAYLAND_CONFIG_H_ #define _XWAYLAND_CONFIG_H_ #include /* Build glamor support for Xwayland */ #undef XWL_HAS_GLAMOR /* Build eglstream support for Xwayland */ #undef XWL_HAS_EGLSTREAM #endif /* _XWAYLAND_CONFIG_H_ */ xorg-server-1.20.8/include/region.h0000644000175000017500000000451613640201473014073 00000000000000/*********************************************************** 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 REGION_H #define REGION_H #include "regionstr.h" #endif /* REGION_H */ xorg-server-1.20.8/include/extinit.h0000644000175000017500000001142513640201473014271 00000000000000/************************************************************ Copyright 1996 by Thomas E. Dickey 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 the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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. ********************************************************/ /* * Copyright (C) 1994-2003 The XFree86 Project, 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 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, FIT- * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * XFREE86 PROJECT 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 XFree86 Project 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 XFree86 Project. */ #ifndef EXTINIT_H #define EXTINIT_H #include "extnsionst.h" #ifdef COMPOSITE extern _X_EXPORT Bool noCompositeExtension; extern void CompositeExtensionInit(void); #endif #ifdef DAMAGE extern _X_EXPORT Bool noDamageExtension; extern void DamageExtensionInit(void); #endif #if defined(DBE) extern _X_EXPORT Bool noDbeExtension; extern void DbeExtensionInit(void); #endif #if defined(DPMSExtension) extern _X_EXPORT Bool noDPMSExtension; extern void DPMSExtensionInit(void); #endif extern Bool noGEExtension; extern void GEExtensionInit(void); #ifdef GLXEXT extern _X_EXPORT Bool noGlxExtension; extern void GlxExtensionInit(void); #endif #ifdef PANORAMIX extern _X_EXPORT Bool noPanoramiXExtension; extern void PanoramiXExtensionInit(void); #endif #ifdef RANDR extern _X_EXPORT Bool noRRExtension; extern void RRExtensionInit(void); #endif #if defined(XRECORD) extern void RecordExtensionInit(void); #endif extern _X_EXPORT Bool noRenderExtension; extern void RenderExtensionInit(void); #if defined(RES) extern _X_EXPORT Bool noResExtension; extern void ResExtensionInit(void); #endif #if defined(SCREENSAVER) extern _X_EXPORT Bool noScreenSaverExtension; extern void ScreenSaverExtensionInit(void); #endif extern void ShapeExtensionInit(void); #ifdef MITSHM extern _X_EXPORT Bool noMITShmExtension; extern void ShmExtensionInit(void); #endif extern void SyncExtensionInit(void); extern void XCMiscExtensionInit(void); #ifdef XCSECURITY extern _X_EXPORT Bool noSecurityExtension; extern void SecurityExtensionInit(void); #endif #ifdef XF86BIGFONT extern _X_EXPORT Bool noXFree86BigfontExtension; extern void XFree86BigfontExtensionInit(void); #endif extern void BigReqExtensionInit(void); extern _X_EXPORT Bool noXFixesExtension; extern void XFixesExtensionInit(void); extern void XInputExtensionInit(void); extern void XkbExtensionInit(void); #if defined(XSELINUX) extern _X_EXPORT Bool noSELinuxExtension; extern void SELinuxExtensionInit(void); #endif #ifdef XTEST extern void XTestExtensionInit(void); #endif #if defined(XV) extern _X_EXPORT Bool noXvExtension; extern void XvExtensionInit(void); extern void XvMCExtensionInit(void); #endif #if defined(DRI3) extern void dri3_extension_init(void); #endif #if defined(PRESENT) #include "presentext.h" #endif #endif xorg-server-1.20.8/include/os.h0000644000175000017500000005062413640201473013232 00000000000000/*********************************************************** 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 OS_H #define OS_H #include "misc.h" #include #include #include #ifdef MONOTONIC_CLOCK #include #endif #if defined(HAVE_LIBBSD) && defined(HAVE_REALLOCARRAY) #include /* for reallocarray */ #endif #if defined(HAVE_LIBBSD) && defined(HAVE_STRLCPY) #include /* for strlcpy, strlcat */ #endif #define SCREEN_SAVER_ON 0 #define SCREEN_SAVER_OFF 1 #define SCREEN_SAVER_FORCER 2 #define SCREEN_SAVER_CYCLE 3 #ifndef MAX_REQUEST_SIZE #define MAX_REQUEST_SIZE 65535 #endif #ifndef MAX_BIG_REQUEST_SIZE #define MAX_BIG_REQUEST_SIZE 4194303 #endif typedef struct _FontPathRec *FontPathPtr; typedef struct _NewClientRec *NewClientPtr; #ifndef xnfalloc #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xnfcalloc(_num, _size) XNFcallocarray((_num), (_size)) #define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size)) #define xstrdup(s) Xstrdup(s) #define xnfstrdup(s) XNFstrdup(s) #define xallocarray(num, size) reallocarray(NULL, (num), (size)) #define xnfallocarray(num, size) XNFreallocarray(NULL, (num), (size)) #define xnfreallocarray(ptr, num, size) XNFreallocarray((ptr), (num), (size)) #endif #include #include #ifdef DDXBEFORERESET extern void ddxBeforeReset(void); #endif #ifdef DDXOSVERRORF extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args) _X_ATTRIBUTE_PRINTF(1, 0); #endif extern _X_EXPORT Bool WaitForSomething(Bool clients_are_ready); extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ ); extern _X_EXPORT int ReadFdFromClient(ClientPtr client); extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close); extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ , char * /*data */ , int /*count */ ); extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client */ ); extern _X_EXPORT void FlushAllOutput(void); extern _X_EXPORT void FlushIfCriticalOutputPending(void); extern _X_EXPORT void SetCriticalOutputPending(void); extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ , const void * /*buf */ ); extern _X_EXPORT void ResetOsBuffers(void); extern _X_EXPORT void InitConnectionLimits(void); extern _X_EXPORT void NotifyParentProcess(void); extern _X_EXPORT void CreateWellKnownSockets(void); extern _X_EXPORT void ResetWellKnownSockets(void); extern _X_EXPORT void CloseWellKnownConnections(void); extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client */ ); extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ , unsigned int /*proto_n */ , char * /*auth_proto */ , unsigned int /*string_n */ , char * /*auth_string */ ); extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ ); typedef void (*NotifyFdProcPtr)(int fd, int ready, void *data); #define X_NOTIFY_NONE 0x0 #define X_NOTIFY_READ 0x1 #define X_NOTIFY_WRITE 0x2 #define X_NOTIFY_ERROR 0x4 /* don't need to select for, always reported */ extern _X_EXPORT Bool SetNotifyFd(int fd, NotifyFdProcPtr notify_fd, int mask, void *data); static inline void RemoveNotifyFd(int fd) { (void) SetNotifyFd(fd, NULL, X_NOTIFY_NONE, NULL); } extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client */ ); extern _X_EXPORT void ListenToAllClients(void); extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ ); extern _X_EXPORT void AttendClient(ClientPtr /*client */ ); extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ ); #ifdef MONOTONIC_CLOCK extern void ForceClockId(clockid_t /* forced_clockid */); #endif extern _X_EXPORT CARD32 GetTimeInMillis(void); extern _X_EXPORT CARD64 GetTimeInMicros(void); extern _X_EXPORT void AdjustWaitForDelay(void *waitTime, int newdelay); typedef struct _OsTimerRec *OsTimerPtr; typedef CARD32 (*OsTimerCallback) (OsTimerPtr timer, CARD32 time, void *arg); extern _X_EXPORT void TimerInit(void); extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ ); #define TimerAbsolute (1<<0) #define TimerForceOld (1<<1) extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr timer, int flags, CARD32 millis, OsTimerCallback func, void *arg); extern _X_EXPORT void TimerCheck(void); extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ ); extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ ); extern _X_EXPORT void SetScreenSaverTimer(void); extern _X_EXPORT void FreeScreenSaverTimer(void); extern _X_EXPORT void AutoResetServer(int /*sig */ ); extern _X_EXPORT void GiveUp(int /*sig */ ); extern _X_EXPORT void UseMsg(void); extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []); extern _X_EXPORT int set_font_authorizations(char **authorizations, int *authlen, void *client); /* * This function malloc(3)s buffer, terminating the server if there is not * enough memory. */ extern _X_EXPORT void * XNFalloc(unsigned long /*amount */ ); /* * This function calloc(3)s buffer, terminating the server if there is not * enough memory. */ extern _X_EXPORT void * XNFcalloc(unsigned long /*amount */ ) _X_DEPRECATED; /* * This function calloc(3)s buffer, terminating the server if there is not * enough memory or the arguments overflow when multiplied */ extern _X_EXPORT void * XNFcallocarray(size_t nmemb, size_t size); /* * This function realloc(3)s passed buffer, terminating the server if there is * not enough memory. */ extern _X_EXPORT void * XNFrealloc(void * /*ptr */ , unsigned long /*amount */ ); /* * This function reallocarray(3)s passed buffer, terminating the server if * there is not enough memory or the arguments overflow when multiplied. */ extern _X_EXPORT void * XNFreallocarray(void *ptr, size_t nmemb, size_t size); /* * This function strdup(3)s passed string. The only difference from the library * function that it is safe to pass NULL, as NULL will be returned. */ extern _X_EXPORT char * Xstrdup(const char *s); /* * This function strdup(3)s passed string, terminating the server if there is * not enough memory. If NULL is passed to this function, NULL is returned. */ extern _X_EXPORT char * XNFstrdup(const char *s); /* Include new X*asprintf API */ #include "Xprintf.h" /* Older api deprecated in favor of the asprintf versions */ extern _X_EXPORT char * Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_DEPRECATED; extern _X_EXPORT char * Xvprintf(const char *fmt, va_list va) _X_ATTRIBUTE_PRINTF(1, 0) _X_DEPRECATED; extern _X_EXPORT char * XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_DEPRECATED; extern _X_EXPORT char * XNFvprintf(const char *fmt, va_list va) _X_ATTRIBUTE_PRINTF(1, 0) _X_DEPRECATED; typedef void (*OsSigHandlerPtr) (int /* sig */ ); typedef int (*OsSigWrapperPtr) (int /* sig */ ); extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */ , OsSigHandlerPtr /* handler */ ); extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap); extern _X_EXPORT int auditTrailLevel; extern _X_EXPORT void LockServer(void); extern _X_EXPORT void UnlockServer(void); extern _X_EXPORT int OsLookupColor(int /*screen */ , char * /*name */ , unsigned /*len */ , unsigned short * /*pred */ , unsigned short * /*pgreen */ , unsigned short * /*pblue */ ); extern _X_EXPORT void OsInit(void); extern _X_EXPORT void OsCleanup(Bool); extern _X_EXPORT void OsVendorFatalError(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1, 0); extern _X_EXPORT void OsVendorInit(void); extern _X_EXPORT void OsBlockSignals(void); extern _X_EXPORT void OsReleaseSignals(void); extern void OsResetSignals(void); extern _X_EXPORT void OsAbort(void) _X_NORETURN; #if !defined(WIN32) extern _X_EXPORT int System(const char *); extern _X_EXPORT void * Popen(const char *, const char *); extern _X_EXPORT int Pclose(void *); extern _X_EXPORT void * Fopen(const char *, const char *); extern _X_EXPORT int Fclose(void *); #else extern const char * Win32TempDir(void); extern int System(const char *cmdline); #define Fopen(a,b) fopen(a,b) #define Fclose(a) fclose(a) #endif extern _X_EXPORT Bool PrivsElevated(void); extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp); extern _X_EXPORT void CheckUserAuthorization(void); extern _X_EXPORT int AddHost(ClientPtr /*client */ , int /*family */ , unsigned /*length */ , const void * /*pAddr */ ); extern _X_EXPORT Bool ForEachHostInFamily(int family, Bool (*func)( unsigned char *addr, short len, void *closure), void *closure); extern _X_EXPORT int RemoveHost(ClientPtr client, int family, unsigned length, void *pAddr); extern _X_EXPORT int GetHosts(void ** /*data */ , int * /*pnHosts */ , int * /*pLen */ , BOOL * /*pEnabled */ ); typedef struct sockaddr *sockaddrPtr; extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client); #define LCC_UID_SET (1 << 0) #define LCC_GID_SET (1 << 1) #define LCC_PID_SET (1 << 2) #define LCC_ZID_SET (1 << 3) typedef struct { int fieldsSet; /* Bit mask of fields set */ int euid; /* Effective uid */ int egid; /* Primary effective group id */ int nSuppGids; /* Number of supplementary group ids */ int *pSuppGids; /* Array of supplementary group ids */ int pid; /* Process id */ int zoneid; /* Only set on Solaris 10 & later */ } LocalClientCredRec; extern _X_EXPORT int GetLocalClientCreds(ClientPtr, LocalClientCredRec **); extern _X_EXPORT void FreeLocalClientCreds(LocalClientCredRec *); extern _X_EXPORT int ChangeAccessControl(ClientPtr /*client */ , int /*fEnabled */ ); extern _X_EXPORT int GetClientFd(ClientPtr); extern _X_EXPORT Bool ClientIsLocal(ClientPtr client); extern _X_EXPORT int GetAccessControl(void); extern _X_EXPORT void AddLocalHosts(void); extern _X_EXPORT void ResetHosts(const char *display); extern _X_EXPORT void EnableLocalAccess(void); extern _X_EXPORT void DisableLocalAccess(void); extern _X_EXPORT void EnableLocalHost(void); extern _X_EXPORT void DisableLocalHost(void); #ifndef NO_LOCAL_CLIENT_CRED extern _X_EXPORT void EnableLocalUser(void); extern _X_EXPORT void DisableLocalUser(void); extern _X_EXPORT void LocalAccessScopeUser(void); #endif extern _X_EXPORT void AccessUsingXdmcp(void); extern _X_EXPORT void DefineSelf(int /*fd */ ); #ifdef XDMCP extern _X_EXPORT void AugmentSelf(void *from, int len); extern _X_EXPORT void RegisterAuthorizations(void); #endif extern _X_EXPORT void InitAuthorization(const char * /*filename */ ); /* extern int LoadAuthorization(void); */ extern _X_EXPORT int AuthorizationFromID(XID id, unsigned short *name_lenp, const char **namep, unsigned short *data_lenp, char **datap); extern _X_EXPORT XID CheckAuthorization(unsigned int /*namelength */ , const char * /*name */ , unsigned int /*datalength */ , const char * /*data */ , ClientPtr /*client */ , const char ** /*reason */ ); extern _X_EXPORT void ResetAuthorization(void); extern _X_EXPORT int RemoveAuthorization(unsigned short name_length, const char *name, unsigned short data_length, const char *data); extern _X_EXPORT int AddAuthorization(unsigned int /*name_length */ , const char * /*name */ , unsigned int /*data_length */ , char * /*data */ ); #ifdef XCSECURITY extern _X_EXPORT XID GenerateAuthorization(unsigned int /* name_length */ , const char * /* name */ , unsigned int /* data_length */ , const char * /* data */ , unsigned int * /* data_length_return */ , char ** /* data_return */ ); #endif extern _X_EXPORT int ddxProcessArgument(int /*argc */ , char * /*argv */ [], int /*i */ ); extern _X_EXPORT void ddxUseMsg(void); /* stuff for ReplyCallback */ extern _X_EXPORT CallbackListPtr ReplyCallback; typedef struct { ClientPtr client; const void *replyData; unsigned long dataLenBytes; /* actual bytes from replyData + pad bytes */ unsigned long bytesRemaining; Bool startOfReply; unsigned long padBytes; /* pad bytes from zeroed array */ } ReplyInfoRec; /* stuff for FlushCallback */ extern _X_EXPORT CallbackListPtr FlushCallback; enum ExitCode { EXIT_NO_ERROR = 0, EXIT_ERR_ABORT = 1, EXIT_ERR_CONFIGURE = 2, EXIT_ERR_DRIVERS = 3, }; extern _X_EXPORT void AbortDDX(enum ExitCode error); extern _X_EXPORT void ddxGiveUp(enum ExitCode error); extern _X_EXPORT void ddxInputThreadInit(void); extern _X_EXPORT int TimeSinceLastInputEvent(void); /* Function fallbacks provided by AC_REPLACE_FUNCS in configure.ac */ #ifndef HAVE_REALLOCARRAY #define reallocarray xreallocarray extern _X_EXPORT void * reallocarray(void *optr, size_t nmemb, size_t size); #endif #ifndef HAVE_STRCASECMP #define strcasecmp xstrcasecmp extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2); #endif #ifndef HAVE_STRNCASECMP #define strncasecmp xstrncasecmp extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n); #endif #ifndef HAVE_STRCASESTR #define strcasestr xstrcasestr extern _X_EXPORT char * xstrcasestr(const char *s, const char *find); #endif #ifndef HAVE_STRLCPY extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz); extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz); #endif #ifndef HAVE_STRNDUP extern _X_EXPORT char * strndup(const char *str, size_t n); #endif #ifndef HAVE_TIMINGSAFE_MEMCMP extern _X_EXPORT int timingsafe_memcmp(const void *b1, const void *b2, size_t len); #endif /* Logging. */ typedef enum _LogParameter { XLOG_FLUSH, XLOG_SYNC, XLOG_VERBOSITY, XLOG_FILE_VERBOSITY } LogParameter; /* Flags for log messages. */ typedef enum { X_PROBED, /* Value was probed */ X_CONFIG, /* Value was given in the config file */ X_DEFAULT, /* Value is a default */ X_CMDLINE, /* Value was given on the command line */ X_NOTICE, /* Notice */ X_ERROR, /* Error message */ X_WARNING, /* Warning message */ X_INFO, /* Informational message */ X_NONE, /* No prefix */ X_NOT_IMPLEMENTED, /* Not implemented */ X_DEBUG, /* Debug message */ X_UNKNOWN = -1 /* unknown -- this must always be last */ } MessageType; extern _X_EXPORT const char * LogInit(const char *fname, const char *backup); extern void LogSetDisplay(void); extern _X_EXPORT void LogClose(enum ExitCode error); extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value); extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2, 0); extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) _X_ATTRIBUTE_PRINTF(3, 0); extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(3, 4); extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT void LogMessageVerbSigSafe(MessageType type, int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(3, 4); extern _X_EXPORT void LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list args) _X_ATTRIBUTE_PRINTF(3, 0); extern _X_EXPORT void LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, va_list msg_args, const char *hdr_format, va_list hdr_args) _X_ATTRIBUTE_PRINTF(3, 0) _X_ATTRIBUTE_PRINTF(5, 0); extern _X_EXPORT void LogHdrMessageVerb(MessageType type, int verb, const char *msg_format, va_list msg_args, const char *hdr_format, ...) _X_ATTRIBUTE_PRINTF(3, 0) _X_ATTRIBUTE_PRINTF(5, 6); extern _X_EXPORT void LogHdrMessage(MessageType type, const char *msg_format, va_list msg_args, const char *hdr_format, ...) _X_ATTRIBUTE_PRINTF(2, 0) _X_ATTRIBUTE_PRINTF(4, 5); extern _X_EXPORT void FreeAuditTimer(void); extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1, 0); extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN; #ifdef DEBUG #define DebugF ErrorF #else #define DebugF(...) /* */ #endif extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1, 0); extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern _X_EXPORT void VErrorFSigSafe(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1, 0); extern _X_EXPORT void ErrorFSigSafe(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern _X_EXPORT void LogPrintMarkers(void); extern _X_EXPORT void xorg_backtrace(void); extern _X_EXPORT int os_move_fd(int fd); #include extern _X_EXPORT int xthread_sigmask(int how, const sigset_t *set, sigset_t *oldest); #endif /* OS_H */ xorg-server-1.20.8/include/servermd.h0000644000175000017500000001170413640201473014434 00000000000000/*********************************************************** 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 SERVERMD_H #define SERVERMD_H 1 #if !defined(_DIX_CONFIG_H_) && !defined(_XORG_SERVER_H_) #error Drivers must include xorg-server.h before any other xserver headers #error xserver code must include dix-config.h before any other headers #endif #include /* for X_LITTLE_ENDIAN/X_BIG_ENDIAN */ #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define IMAGE_BYTE_ORDER LSBFirst #define BITMAP_BIT_ORDER LSBFirst #elif X_BYTE_ORDER == X_BIG_ENDIAN #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #else #error "Too weird to live." #endif #ifndef GLYPHPADBYTES #define GLYPHPADBYTES 4 #endif /* size of buffer to use with GetImage, measured in bytes. There's obviously * a trade-off between the amount of heap used and the number of times the * ddx routine has to be called. */ #ifndef IMAGE_BUFSIZE #define IMAGE_BUFSIZE (64*1024) #endif /* pad scanline to a longword */ #ifndef BITMAP_SCANLINE_UNIT #define BITMAP_SCANLINE_UNIT 32 #endif #ifndef BITMAP_SCANLINE_PAD #define BITMAP_SCANLINE_PAD 32 #define LOG2_BITMAP_PAD 5 #define LOG2_BYTES_PER_SCANLINE_PAD 2 #endif #include /* * This returns the number of padding units, for depth d and width w. * For bitmaps this can be calculated with the macros above. * Other depths require either grovelling over the formats field of the * screenInfo or hardwired constants. */ typedef struct _PaddingInfo { int padRoundUp; /* pixels per pad unit - 1 */ int padPixelsLog2; /* log 2 (pixels per pad unit) */ int padBytesLog2; /* log 2 (bytes per pad unit) */ int notPower2; /* bitsPerPixel not a power of 2 */ int bytesPerPixel; /* only set when notPower2 is TRUE */ int bitsPerPixel; /* bits per pixel */ } PaddingInfo; extern _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[]; /* The only portable way to get the bpp from the depth is to look it up */ #define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel) #define PixmapWidthInPadUnits(w, d) \ (PixmapWidthPaddingInfo[d].notPower2 ? \ (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \ PixmapWidthPaddingInfo[d].bytesPerPixel) >> \ PixmapWidthPaddingInfo[d].padBytesLog2) : \ ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \ PixmapWidthPaddingInfo[d].padPixelsLog2)) /* * Return the number of bytes to which a scanline of the given * depth and width will be padded. */ #define PixmapBytePad(w, d) \ (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2) #define BitmapBytePad(w) \ (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD) #endif /* SERVERMD_H */ xorg-server-1.20.8/include/colormapst.h0000644000175000017500000000774113640201473014776 00000000000000/* 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 "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 */ typedef struct _ColormapRec { VisualPtr pVisual; short class; /* PseudoColor or DirectColor */ XID mid; /* client's name for colormap */ 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 */ xorg-server-1.20.8/include/validate.h0000644000175000017500000000275313640201473014402 00000000000000 /* Copyright 1989, 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. */ #ifndef VALIDATE_H #define VALIDATE_H #include "miscstruct.h" #include "regionstr.h" typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap, VTBroken } VTKind; /* union _Validate is now device dependent; see mivalidate.h for an example */ typedef union _Validate *ValidatePtr; #define UnmapValData ((ValidatePtr)1) #endif /* VALIDATE_H */ xorg-server-1.20.8/include/meson.build0000644000175000017500000004111413640201473014574 00000000000000version_split = meson.project_version().split('.') major = version_split[0].to_int() minor = version_split[1].to_int() patch = version_split[2].to_int() if version_split.length() == 4 subpatch = version_split[3].to_int() else subpatch = 0 endif release = major * 10000000 + minor * 100000 + patch * 1000 + subpatch dri_dep = dependency('dri', required: build_dri2 or build_dri3) conf_data = configuration_data() conf_data.set('_DIX_CONFIG_H_', '1') conf_data.set('HAVE_TYPEOF', cc.compiles(''' int foo(int bar) { typeof(bar) baz = 1; return baz; } ''', name: 'typeof()')) conf_data.set('MONOTONIC_CLOCK', cc.compiles(''' #define _POSIX_C_SOURCE 200112L #include #include #ifndef CLOCK_MONOTONIC #error CLOCK_MONOTONIC not defined #endif ''', name: 'CLOCK_MONOTONIC')) #conf_data.set('XSERVER_DTRACE', '1') # XXX if host_machine.endian() == 'little' conf_data.set('X_BYTE_ORDER', 'X_LITTLE_ENDIAN') else conf_data.set('X_BYTE_ORDER', 'X_BIG_ENDIAN') endif glx_align64 = [] if cc.sizeof('unsigned long') == 8 conf_data.set('_XSERVER64', '1') glx_align64 = '-D__GLX_ALIGN64' endif conf_data.set('_GNU_SOURCE', '1') # XXX: NO_LOCAL_CLIENT_CRED # autoconf checks for /dev/xf86 here, but the test should be based on # the target, not the build system. Could we get rid of this and just # ifdef for openbsd? conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 'openbsd') # XXX: USE_ALPHA_PIO and other bsd bits # XXX: FALLBACK_INPUT_DRIVER # XXX: BUNDLE_ID_PREFIX # XXX: HAVE_LIBDISPATCH conf_data.set_quoted('OSNAME', 'Linux') # XXX conf_data.set('HAVE_INPUTTHREAD', '1') # XXX conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', '1') # XXX conf_data.set('HAVE_LIBBSD', libbsd_dep.found()) # XXX: HAVE_SYSTEMD_DAEMON # XXX: HAVE_LIBUDEV conf_data.set('CONFIG_UDEV', build_udev) conf_data.set('CONFIG_UDEV_KMS', build_udev) conf_data.set('HAVE_DBUS', build_dbus) conf_data.set('CONFIG_HAL', build_hal) conf_data.set('SYSTEMD_LOGIND', build_systemd_logind) conf_data.set('NEED_DBUS', build_systemd_logind or build_hal) conf_data.set('CONFIG_WSCONS', host_machine.system() == 'openbsd') conf_data.set('HAVE_XSHMFENCE', xshmfence_dep.found()) conf_data.set('WITH_LIBDRM', libdrm_dep.found()) conf_data.set('GLAMOR_HAS_EGL_QUERY_DMABUF', epoxy_dep.found() and epoxy_dep.version().version_compare('>= 1.4.4')) conf_data.set('GLAMOR_HAS_EGL_QUERY_DRIVER', epoxy_dep.found() and epoxy_dep.version().version_compare('>= 1.5.4')) conf_data.set('GLXEXT', build_glx) conf_data.set('GLAMOR', build_glamor) conf_data.set('GLAMOR_HAS_GBM', gbm_dep.found()) conf_data.set('GLAMOR_HAS_GBM_LINEAR', build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 10.6')) conf_data.set('GBM_BO_WITH_MODIFIERS', build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 17.1')) conf_data.set_quoted('SERVER_MISC_CONFIG_PATH', serverconfigdir) conf_data.set_quoted('PROJECTROOT', get_option('prefix')) conf_data.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) conf_data.set_quoted('SUID_WRAPPER_DIR', join_paths(get_option('prefix'), get_option('libexecdir'))) conf_data.set_quoted('COMPILEDDEFAULTFONTPATH', default_font_path) conf_data.set('XORG_VERSION_CURRENT', release) conf_data.set('HASXDMAUTH', has_xdm_auth) conf_data.set('SECURE_RPC', get_option('secure-rpc')) conf_data.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h')) conf_data.set('HAVE_EXECINFO_H', cc.has_header('execinfo.h')) conf_data.set('HAVE_FCNTL_H', cc.has_header('fcntl.h')) conf_data.set('HAVE_FNMATCH_H', cc.has_header('fnmatch.h')) conf_data.set('HAVE_LINUX_AGPGART_H', cc.has_header('linux/agpgart.h')) conf_data.set('HAVE_STDLIB_H', cc.has_header('stdlib.h')) conf_data.set('HAVE_STRING_H', cc.has_header('string.h')) conf_data.set('HAVE_STRINGS_H', cc.has_header('strings.h')) conf_data.set('HAVE_STROPTS_H', cc.has_header('stropts.h')) conf_data.set('HAVE_SYS_AGPGART_H', cc.has_header('sys/agpgart.h')) conf_data.set('HAVE_SYS_AGPIO_H', cc.has_header('sys/agpio.h')) conf_data.set('HAVE_SYS_UTSNAME_H', cc.has_header('sys/utsname.h')) conf_data.set('HAVE_SYS_SYSMACROS_H', cc.has_header('sys/sysmacros.h')) conf_data.set('HAVE_UNISTD_H', cc.has_header('unistd.h')) conf_data.set('HAVE_ARC4RANDOM_BUF', cc.has_function('arc4random_buf', dependencies: libbsd_dep)) conf_data.set('HAVE_BACKTRACE', cc.has_function('backtrace')) conf_data.set('HAVE_CBRT', cc.has_function('cbrt')) conf_data.set('HAVE_EPOLL_CREATE1', cc.has_function('epoll_create1')) conf_data.set('HAVE_GETUID', cc.has_function('getuid')) conf_data.set('HAVE_GETEUID', cc.has_function('geteuid')) conf_data.set('HAVE_ISASTREAM', cc.has_function('isastream')) conf_data.set('HAVE_ISSETUGID', cc.has_function('issetugid')) conf_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs')) conf_data.set('HAVE_GETPEEREID', cc.has_function('getpeereid')) conf_data.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred')) conf_data.set('HAVE_GETPROGNAME', cc.has_function('getprogname')) conf_data.set('HAVE_GETZONEID', cc.has_function('getzoneid')) conf_data.set('HAVE_MEMFD_CREATE', cc.has_function('memfd_create')) conf_data.set('HAVE_MKOSTEMP', cc.has_function('mkostemp')) conf_data.set('HAVE_MMAP', cc.has_function('mmap')) conf_data.set('HAVE_POLL', cc.has_function('poll')) conf_data.set('HAVE_POLLSET_CREATE', cc.has_function('pollset_create')) conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate')) conf_data.set('HAVE_PORT_CREATE', cc.has_function('port_create')) conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', dependencies: libbsd_dep)) conf_data.set('HAVE_SETEUID', cc.has_function('seteuid')) conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer')) conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64')) conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction')) conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp')) conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr')) conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep)) conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: libbsd_dep)) conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp')) conf_data.set('HAVE_STRNDUP', cc.has_function('strndup')) conf_data.set('HAVE_TIMINGSAFE_MEMCMP', cc.has_function('timingsafe_memcmp')) conf_data.set('HAVE_VASPRINTF', cc.has_function('vasprintf')) conf_data.set('HAVE_VSNPRINTF', cc.has_function('vsnprintf')) conf_data.set('HAVE_WALKCONTEXT', cc.has_function('walkcontext')) conf_data.set('BUSFAULT', conf_data.get('HAVE_SIGACTION')) # Don't let X dependencies typedef 'pointer' conf_data.set('_XTYPEDEF_POINTER', '1') conf_data.set('_XITYPEDEF_POINTER', '1') conf_data.set('LISTEN_TCP', get_option('listen_tcp')) conf_data.set('LISTEN_UNIX', get_option('listen_unix')) conf_data.set('LISTEN_LOCAL', get_option('listen_local')) # XXX: Configurable? conf_data.set('XTRANS_SEND_FDS', '1') conf_data.set('TCPCONN', '1') conf_data.set('UNIXCONN', '1') conf_data.set('IPv6', build_ipv6) conf_data.set('CLIENTIDS', '1') # XXX conf_data.set('BIGREQS', '1') conf_data.set('COMPOSITE', '1') conf_data.set('DAMAGE', '1') conf_data.set('DBE', '1') conf_data.set('DGA', build_dga) conf_data.set('DPMSExtension', build_dpms) conf_data.set('DRI2', build_dri2) conf_data.set('DRI3', build_dri3) conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_pkgconfig_variable('dridriverdir')) conf_data.set('HAS_SHM', build_mitshm) conf_data.set('MITSHM', build_mitshm) conf_data.set('PANORAMIX', build_xinerama) conf_data.set('PRESENT', '1') conf_data.set('RANDR', '1') conf_data.set('RES', build_res) conf_data.set('RENDER', '1') conf_data.set('SCREENSAVER', build_screensaver) conf_data.set('SHAPE', '1') conf_data.set('XACE', build_xace) conf_data.set('XCMISC', '1') conf_data.set('XCSECURITY', build_xsecurity) conf_data.set('XDMCP', xdmcp_dep.found()) conf_data.set('XF86BIGFONT', build_xf86bigfont) conf_data.set('XF86DRI', build_dri1) conf_data.set('XF86VIDMODE', build_xf86vidmode) conf_data.set('XFIXES', '1') conf_data.set('XFreeXDGA', build_dga) conf_data.set('XINERAMA', build_xinerama) conf_data.set('XINPUT', '1') conf_data.set('XRECORD', '1') conf_data.set('XSELINUX', build_xselinux) conf_data.set('XSYNC', '1') conf_data.set('XTEST', '1') conf_data.set('XV', build_xv) conf_data.set('XvExtension', build_xv) conf_data.set('XvMCExtension', build_xvmc) conf_data.set('HAVE_SHA1_IN_LIBNETTLE', '1') # XXX conf_data.set('HAVE_APM', build_apm or build_acpi) conf_data.set('HAVE_ACPI', build_acpi) enable_debugging = get_option('buildtype') == 'debug' conf_data.set('DEBUG', enable_debugging) conf_data.set_quoted('XVENDORNAME', get_option('vendor_name')) conf_data.set_quoted('XVENDORNAMESHORT', get_option('vendor_name_short')) conf_data.set_quoted('__VENDORDWEBSUPPORT__', get_option('vendor_web')) conf_data.set_quoted('OSVENDOR', get_option('os_vendor')) conf_data.set_quoted('BUILDERADDR', get_option('builder_addr')) conf_data.set_quoted('BUILDERSTRING', get_option('builder_string')) # # for xorg-server.h only # defines_svr4 = '''#if !defined(SVR4) && !defined(__svr4__) && !defined(__SVR4) #error "I am not SVR4" #endif ''' # BSD specifics supports_pccons = false supports_pcvt = false supports_syscons = false supports_wscons = false csrg_based = false if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonflybsd' supports_pccons = true supports_pcvt = true supports_syscons = true csrg_based = true endif if host_machine.system() == 'kfreebsd' supports_pccons = true supports_pcvt = true supports_syscons = true endif if host_machine.system() == 'netbsd' supports_pccons = true supports_pcvt = true supports_wscons = true csrg_based = true endif if host_machine.system() == 'openbsd' supports_pcvt = true supports_wscons = true csrg_based = true endif conf_data.set('SVR4', cc.compiles(defines_svr4)) conf_data.set_quoted('XKB_DFLT_RULES', get_option('xkb_default_rules')) conf_data.set('XORGSERVER', build_xorg) conf_data.set_quoted('XCONFIGFILE', 'xorg.conf') conf_data.set_quoted('__XSERVERNAME__', 'Xorg') conf_data.set('WITH_VGAHW', build_vgahw) conf_data.set('CSRG_BASED', csrg_based) conf_data.set('PCCONS_SUPPORT', supports_pccons) conf_data.set('PCVT_SUPPORT', supports_pcvt) conf_data.set('SYSCONS_SUPPORT', supports_syscons) conf_data.set('WSCONS_SUPPORT', supports_wscons) conf_data.set('XSERVER_LIBPCIACCESS', get_option('pciaccess')) conf_data.set('XSERVER_PLATFORM_BUS', build_udev) configure_file(output : 'dix-config.h', configuration : conf_data) configure_file(output : 'xorg-server.h', input : 'xorg-server.h.meson.in', configuration : conf_data, install_dir: xorgsdkdir) version_data = configuration_data() version_data.set('VENDOR_RELEASE', '@0@'.format(release)) version_data.set_quoted('VENDOR_NAME', get_option('vendor_name')) version_data.set_quoted('VENDOR_NAME_SHORT', get_option('vendor_name_short')) version_data.set_quoted('VENDOR_WEB', get_option('vendor_web')) version_data.set_quoted('VENDOR_MAN_VERSION', 'Version @0@.@1@.@2@'.format(major, minor, patch)) configure_file(output : 'version-config.h', configuration : version_data) xkb_data = configuration_data() xkb_data.set_quoted('XKB_BIN_DIRECTORY', xkb_bin_dir) xkb_data.set_quoted('XKB_BASE_DIRECTORY', xkb_dir) xkb_data.set_quoted('XKB_DFLT_RULES', get_option('xkb_default_rules')) xkb_data.set_quoted('XKB_DFLT_MODEL', get_option('xkb_default_model')) xkb_data.set_quoted('XKB_DFLT_LAYOUT', get_option('xkb_default_layout')) xkb_data.set_quoted('XKB_DFLT_VARIANT', get_option('xkb_default_variant')) xkb_data.set_quoted('XKB_DFLT_OPTIONS', get_option('xkb_default_options')) xkb_data.set_quoted('XKM_OUTPUT_DIR', xkb_output_dir) configure_file(output : 'xkb-config.h', configuration : xkb_data) xorg_data = configuration_data() xorg_data.set_quoted('XORG_BIN_DIRECTORY', get_option('bindir')) xorg_data.set('XORG_VERSION_CURRENT', release) xorg_data.set_quoted('XF86CONFIGFILE', 'xorg.conf') xorg_data.set_quoted('XCONFIGFILE', 'xorg.conf') xorg_data.set_quoted('XCONFIGDIR', 'xorg.conf.d') xorg_data.set_quoted('DEFAULT_XDG_DATA_HOME', '.local/share') xorg_data.set_quoted('DEFAULT_XDG_DATA_HOME_LOGDIR', 'xorg') xorg_data.set_quoted('DEFAULT_LOGDIR', log_dir) xorg_data.set_quoted('DEFAULT_LOGPREFIX', 'Xorg.') xorg_data.set_quoted('FALLBACK_INPUT_DRIVER', 'libinput') xorg_data.set_quoted('DEFAULT_MODULE_PATH', join_paths(get_option('prefix'), module_dir)) xorg_data.set_quoted('DEFAULT_LIBRARY_PATH', join_paths(get_option('prefix'), get_option('libdir'))) xorg_data.set_quoted('__XSERVERNAME__', 'Xorg') xorg_data.set('XSERVER_LIBPCIACCESS', get_option('pciaccess')) xorg_data.set_quoted('PCI_TXT_IDS_PATH', '') xorg_data.set('XSERVER_PLATFORM_BUS', build_udev) xorg_data.set('WSCONS_SUPPORT', host_machine.system() == 'netbsd' or host_machine.system() == 'openbsd') xorg_data.set('XF86PM', build_apm or build_acpi) if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonflybsd' if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64' xorg_data.set('USE_DEV_IO', true) endif # XXX: Add link to libio on alpha elif host_machine.system() == 'netbsd' # XXX: USE_ALPHA_PIO # XXX: Add link to libi386 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64' xorg_data.set('USE_I386_IOPL', true) endif elif host_machine.system() == 'openbsd' # XXX: Add link to libi386, libamd64 if host_machine.cpu_family() == 'x86' xorg_data.set('USE_I386_IOPL', true) endif if host_machine.cpu_family() == 'x86_64' xorg_data.set('USE_AMD64_IOPL', true) endif endif configure_file(output : 'xorg-config.h', input : 'xorg-config.h.meson.in', configuration : xorg_data) xwin_data = configuration_data() xwin_data.set_quoted('DEFAULT_LOGDIR', log_dir) xwin_data.set('HAS_WINSOCK', host_machine.system() == 'windows', description: 'Use Windows sockets') xwin_data.set('HAS_DEVWINDOWS', host_machine.system() == 'cygwin', description: 'Has /dev/windows for signaling new win32 messages') xwin_data.set('RELOCATE_PROJECTROOT', host_machine.system() == 'windows', description: 'Make paths relative to the xserver installation location') # XXX: these three are all the same as DEBUG so we should just change to that xwin_data.set10('CYGDEBUG', enable_debugging) xwin_data.set10('CYGWINDOWING_DEBUG',enable_debugging) xwin_data.set10('CYGMULTIWINDOW_DEBUG', enable_debugging) configure_file(output : 'xwin-config.h', input : 'xwin-config.h.meson.in', configuration : xwin_data) xwayland_data = configuration_data() xwayland_data.set('XWL_HAS_GLAMOR', build_glamor and (gbm_dep.found() or build_eglstream)) xwayland_data.set('XWL_HAS_EGLSTREAM', build_eglstream) configure_file(output : 'xwayland-config.h', input : 'xwayland-config.h.meson.in', configuration : xwayland_data) if build_xorg install_data( [ 'XIstubs.h', 'Xprintf.h', 'callback.h', 'client.h', 'closestr.h', 'closure.h', 'colormap.h', 'colormapst.h', 'hotplug.h', 'cursor.h', 'cursorstr.h', 'dix.h', 'dixaccess.h', 'dixevents.h', 'dixfont.h', 'dixfontstr.h', 'dixgrabs.h', 'dixstruct.h', 'events.h', 'exevents.h', 'extension.h', 'extinit.h', 'extnsionst.h', 'gc.h', 'gcstruct.h', 'globals.h', 'glx_extinit.h', 'glxvndabi.h', 'input.h', 'inputstr.h', 'list.h', 'misc.h', 'miscstruct.h', 'opaque.h', 'nonsdk_extinit.h', 'optionstr.h', 'os.h', 'pixmap.h', 'pixmapstr.h', 'privates.h', 'property.h', 'propertyst.h', 'ptrveloc.h', 'region.h', 'regionstr.h', 'registry.h', 'resource.h', 'rgb.h', 'screenint.h', 'scrnintstr.h', 'selection.h', 'servermd.h', 'site.h', 'validate.h', 'displaymode.h', 'window.h', 'windowstr.h', 'xkbfile.h', 'xkbsrv.h', 'xkbstr.h', 'xkbrules.h', 'Xprintf.h', 'xserver_poll.h', 'xserver-properties.h', ], install_dir: xorgsdkdir, ) endif xorg-server-1.20.8/include/cursorstr.h0000644000175000017500000000721613640201473014656 00000000000000/*********************************************************** 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 CURSORSTRUCT_H #define CURSORSTRUCT_H #include "cursor.h" #include "privates.h" /* * device-independent cursor storage */ /* * source and mask point directly to the bits, which are in the server-defined * bitmap format. */ typedef struct _CursorBits { unsigned char *source; /* points to bits */ unsigned char *mask; /* points to bits */ Bool emptyMask; /* all zeros mask */ unsigned short width, height, xhot, yhot; /* metrics */ int refcnt; /* can be shared */ PrivateRec *devPrivates; /* set by pScr->RealizeCursor */ CARD32 *argb; /* full-color alpha blended */ } CursorBits, *CursorBitsPtr; #define CURSOR_BITS_SIZE (sizeof(CursorBits) + dixPrivatesSize(PRIVATE_CURSOR_BITS)) typedef struct _Cursor { CursorBitsPtr bits; unsigned short foreRed, foreGreen, foreBlue; /* device-independent color */ unsigned short backRed, backGreen, backBlue; /* device-independent color */ int refcnt; PrivateRec *devPrivates; /* set by pScr->RealizeCursor */ XID id; CARD32 serialNumber; Atom name; } CursorRec; #define CURSOR_REC_SIZE (sizeof(CursorRec) + dixPrivatesSize(PRIVATE_CURSOR)) typedef struct _CursorMetric { unsigned short width, height, xhot, yhot; } CursorMetricRec; typedef struct { int x, y; ScreenPtr pScreen; } HotSpot; #endif /* CURSORSTRUCT_H */ xorg-server-1.20.8/include/dixfontstr.h0000644000175000017500000000671713640201473015021 00000000000000/*********************************************************** 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 DIXFONTSTRUCT_H #define DIXFONTSTRUCT_H #include "servermd.h" #include "dixfont.h" #include #include #include "closure.h" #include /* for xQueryFontReply */ #define FONTCHARSET(font) (font) #define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field #define FONTMINBOUNDS(font,field) (font)->info.minbounds.field #define TERMINALFONT(font) (font)->info.terminalFont #define FONTASCENT(font) (font)->info.fontAscent #define FONTDESCENT(font) (font)->info.fontDescent #define FONTGLYPHS(font) 0 #define FONTCONSTMETRICS(font) (font)->info.constantMetrics #define FONTCONSTWIDTH(font) (font)->info.constantWidth #define FONTALLEXIST(font) (font)->info.allExist #define FONTFIRSTCOL(font) (font)->info.firstCol #define FONTLASTCOL(font) (font)->info.lastCol #define FONTFIRSTROW(font) (font)->info.firstRow #define FONTLASTROW(font) (font)->info.lastRow #define FONTDEFAULTCH(font) (font)->info.defaultCh #define FONTINKMIN(font) (&((font)->info.ink_minbounds)) #define FONTINKMAX(font) (&((font)->info.ink_maxbounds)) #define FONTPROPS(font) (font)->info.props #define FONTGLYPHBITS(base,pci) ((unsigned char *) (pci)->bits) #define FONTINFONPROPS(font) (font)->info.nprops /* some things haven't changed names, but we'll be careful anyway */ #define FONTREFCNT(font) (font)->refcnt /* * for linear char sets */ #define N1dChars(pfont) (FONTLASTCOL(pfont) - FONTFIRSTCOL(pfont) + 1) /* * for 2D char sets */ #define N2dChars(pfont) (N1dChars(pfont) * \ (FONTLASTROW(pfont) - FONTFIRSTROW(pfont) + 1)) #ifndef GLYPHPADBYTES #define GLYPHPADBYTES -1 #endif #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1 #define GLYPHWIDTHBYTESPADDED(pci) (GLYPHWIDTHBYTES(pci)) #define PADGLYPHWIDTHBYTES(w) (((w)+7)>>3) #endif #if GLYPHPADBYTES == 2 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+1) & ~0x1) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+1) & ~0x1) #endif #if GLYPHPADBYTES == 4 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+3) & ~0x3) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+3) & ~0x3) #endif #if GLYPHPADBYTES == 8 /* for a cray? */ #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+7) & ~0x7) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+7) & ~0x7) #endif #endif /* DIXFONTSTRUCT_H */ xorg-server-1.20.8/include/xorg-server.h.in0000644000175000017500000001040713640201473015474 00000000000000/* xorg-server.h.in -*- c -*- * * This file is the template file for the xorg-server.h file which gets * installed as part of the SDK. The #defines in this file overlap * with those from config.h, but only for those options that we want * to export to external modules. Boilerplate autotool #defines such * as HAVE_STUFF and PACKAGE_NAME is kept in config.h * * It is still possible to update config.h.in using autoheader, since * autoheader only creates a .h.in file for the first * AM_CONFIG_HEADER() line, and thus does not overwrite this file. * * However, it should be kept in sync with this file. */ #ifndef _XORG_SERVER_H_ #define _XORG_SERVER_H_ #ifdef HAVE_XORG_CONFIG_H #error Include xorg-config.h when building the X server #endif /* Support BigRequests extension */ #undef BIGREQS /* Default font path */ #undef COMPILEDDEFAULTFONTPATH /* Support Composite Extension */ #undef COMPOSITE /* Build DPMS extension */ #undef DPMSExtension /* Build DRI3 extension */ #undef DRI3 /* Build GLX extension */ #undef GLXEXT /* Support XDM-AUTH*-1 */ #undef HASXDMAUTH /* Support SHM */ #undef HAS_SHM /* Define to 1 if you have the `reallocarray' function. */ #undef HAVE_REALLOCARRAY /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Support IPv6 for TCP connections */ #undef IPv6 /* Support MIT-SHM Extension */ #undef MITSHM /* Internal define for Xinerama */ #undef PANORAMIX /* Support Present extension */ #undef PRESENT /* Support RANDR extension */ #undef RANDR /* Support RENDER extension */ #undef RENDER /* Support X resource extension */ #undef RES /* Support MIT-SCREEN-SAVER extension */ #undef SCREENSAVER /* Support SHAPE extension */ #undef SHAPE /* Define to 1 on systems derived from System V Release 4 */ #undef SVR4 /* Support TCP socket connections */ #undef TCPCONN /* Support UNIX socket connections */ #undef UNIXCONN /* Support XCMisc extension */ #undef XCMISC /* Support Xdmcp */ #undef XDMCP /* Build XFree86 BigFont extension */ #undef XF86BIGFONT /* Support XFree86 Video Mode extension */ #undef XF86VIDMODE /* Build XDGA support */ #undef XFreeXDGA /* Support Xinerama extension */ #undef XINERAMA /* Support X Input extension */ #undef XINPUT /* XKB default rules */ #undef XKB_DFLT_RULES /* Build DRI extension */ #undef XF86DRI /* Build DRI2 extension */ #undef DRI2 /* Build Xorg server */ #undef XORGSERVER /* Current Xorg version */ #undef XORG_VERSION_CURRENT /* Build Xv Extension */ #undef XvExtension /* Build XvMC Extension */ #undef XvMCExtension /* Support XSync extension */ #undef XSYNC /* Support XTest extension */ #undef XTEST /* Support Xv Extension */ #undef XV /* Vendor name */ #undef XVENDORNAME /* BSD-compliant source */ #undef _BSD_SOURCE /* POSIX-compliant source */ #undef _POSIX_SOURCE /* X/Open-compliant source */ #undef _XOPEN_SOURCE /* Vendor web address for support */ #undef __VENDORDWEBSUPPORT__ /* Location of configuration file */ #undef XCONFIGFILE /* Name of X server */ #undef __XSERVERNAME__ /* Building vgahw module */ #undef WITH_VGAHW /* System is BSD-like */ #undef CSRG_BASED /* System has PC console */ #undef PCCONS_SUPPORT /* System has PCVT console */ #undef PCVT_SUPPORT /* System has syscons console */ #undef SYSCONS_SUPPORT /* System has wscons console */ #undef WSCONS_SUPPORT /* Loadable XFree86 server awesomeness */ #define XFree86LOADER /* Use libpciaccess */ #undef XSERVER_LIBPCIACCESS /* X Access Control Extension */ #undef XACE /* Have X server platform bus support */ #undef XSERVER_PLATFORM_BUS #ifdef _LP64 #define _XSERVER64 1 #endif /* Have support for X shared memory fence library (xshmfence) */ #undef HAVE_XSHMFENCE /* Use XTrans FD passing support */ #undef XTRANS_SEND_FDS /* Ask fontsproto to make font path element names const */ #define FONT_PATH_ELEMENT_NAME_CONST 1 /* byte order */ #undef X_BYTE_ORDER #endif /* _XORG_SERVER_H_ */ xorg-server-1.20.8/include/systemd-logind.h0000644000175000017500000000345713640201473015555 00000000000000/* * Copyright © 2013 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. * * Author: Hans de Goede */ #ifndef SYSTEMD_LOGIND_H #define SYSTEMD_LOGIND_H #ifdef SYSTEMD_LOGIND int systemd_logind_init(void); void systemd_logind_fini(void); int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus); void systemd_logind_release_fd(int major, int minor, int fd); int systemd_logind_controls_session(void); void systemd_logind_vtenter(void); #else #define systemd_logind_init() #define systemd_logind_fini() #define systemd_logind_take_fd(major, minor, path, paus) -1 #define systemd_logind_release_fd(major, minor, fd) close(fd) #define systemd_logind_controls_session() 0 #define systemd_logind_vtenter() #endif #endif xorg-server-1.20.8/include/client.h0000644000175000017500000000500613640201473014061 00000000000000/* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All * rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice 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. */ /* Author: Rami Ylimäki */ #ifndef CLIENT_H #define CLIENT_H #ifdef HAVE_DIX_CONFIG_H #include #endif /* HAVE_DIX_CONFIG_H */ #include #include /* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs * instead of accessing the fields directly. */ typedef struct { pid_t pid; /* process ID, -1 if not available */ const char *cmdname; /* process name, NULL if not available */ const char *cmdargs; /* process arguments, NULL if not available */ } ClientIdRec, *ClientIdPtr; struct _Client; /* Initialize and clean up. */ void ReserveClientIds(struct _Client *client); void ReleaseClientIds(struct _Client *client); /* Determine client IDs for caching. Exported on purpose for * extensions such as SELinux. */ extern _X_EXPORT pid_t DetermineClientPid(struct _Client *client); extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname, const char **cmdargs); /* Query cached client IDs. Exported on purpose for drivers. */ extern _X_EXPORT pid_t GetClientPid(struct _Client *client); extern _X_EXPORT const char *GetClientCmdName(struct _Client *client); extern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client); #endif /* CLIENT_H */ xorg-server-1.20.8/config.guess0000755000175000017500000013706613640201510013333 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2019 Free Software Foundation, Inc. timestamp='2019-09-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; *:OS108:*:*) echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Twizzler:*:*) echo "$UNAME_MACHINE"-unknown-twizzler exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) set_cc_for_build X86_64_ABI= # If there is a compiler, see if it is configured for 32-bit objects. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then X86_64_ABI=x32 fi fi echo "$UNAME_MACHINE"-pc-linux-"$LIBC$X86_64_ABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; *:Unleashed:*:*) echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" exit ;; esac # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xorg-server-1.20.8/xorg-server.pc.in0000644000175000017500000000073713640201473014231 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ moduledir=@moduledir@ sdkdir=@sdkdir@ sysconfigdir=@sysconfigdir@ abi_ansic=@abi_ansic@ abi_videodrv=@abi_videodrv@ abi_xinput=@abi_xinput@ abi_extension=@abi_extension@ Name: xorg-server Description: Modular X.Org X Server Version: @PACKAGE_VERSION@ Requires.private: @SDK_REQUIRED_MODULES@ Cflags: -I${sdkdir} @symbol_visibility@ Libs: -L${libdir} @XORG_DRIVER_LIBS@ xorg-server-1.20.8/hw/0000755000175000017500000000000013640201533011501 500000000000000xorg-server-1.20.8/hw/Makefile.am0000644000175000017500000000117513640201473013464 00000000000000if DMX DMX_SUBDIRS = dmx endif if XORG XORG_SUBDIRS = xfree86 endif if XVFB XVFB_SUBDIRS = vfb endif if XNEST XNEST_SUBDIRS = xnest endif if XWIN XWIN_SUBDIRS = xwin endif if KDRIVE KDRIVE_SUBDIRS = kdrive endif if XQUARTZ XQUARTZ_SUBDIRS = xquartz endif if XWAYLAND XWAYLAND_SUBDIRS = xwayland endif SUBDIRS = \ $(XORG_SUBDIRS) \ $(XWIN_SUBDIRS) \ $(XVFB_SUBDIRS) \ $(XNEST_SUBDIRS) \ $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ $(XQUARTZ_SUBDIRS) \ $(XWAYLAND_SUBDIRS) DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland relink: $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done xorg-server-1.20.8/hw/xwayland/0000755000175000017500000000000013640201535013332 500000000000000xorg-server-1.20.8/hw/xwayland/xwayland-output.c0000644000175000017500000003647513640201473016623 00000000000000/* * Copyright © 2011-2014 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xwayland.h" #include #define DEFAULT_DPI 96 #define ALL_ROTATIONS (RR_Rotate_0 | \ RR_Rotate_90 | \ RR_Rotate_180 | \ RR_Rotate_270 | \ RR_Reflect_X | \ RR_Reflect_Y) static void xwl_output_get_xdg_output(struct xwl_output *xwl_output); static Rotation wl_transform_to_xrandr(enum wl_output_transform transform) { switch (transform) { default: case WL_OUTPUT_TRANSFORM_NORMAL: return RR_Rotate_0; case WL_OUTPUT_TRANSFORM_90: return RR_Rotate_90; case WL_OUTPUT_TRANSFORM_180: return RR_Rotate_180; case WL_OUTPUT_TRANSFORM_270: return RR_Rotate_270; case WL_OUTPUT_TRANSFORM_FLIPPED: return RR_Reflect_X | RR_Rotate_0; case WL_OUTPUT_TRANSFORM_FLIPPED_90: return RR_Reflect_X | RR_Rotate_90; case WL_OUTPUT_TRANSFORM_FLIPPED_180: return RR_Reflect_X | RR_Rotate_180; case WL_OUTPUT_TRANSFORM_FLIPPED_270: return RR_Reflect_X | RR_Rotate_270; } } static int wl_subpixel_to_xrandr(int subpixel) { switch (subpixel) { default: case WL_OUTPUT_SUBPIXEL_UNKNOWN: return SubPixelUnknown; case WL_OUTPUT_SUBPIXEL_NONE: return SubPixelNone; case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: return SubPixelHorizontalRGB; case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: return SubPixelHorizontalBGR; case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: return SubPixelVerticalRGB; case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: return SubPixelVerticalBGR; } } static void output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, int physical_width, int physical_height, int subpixel, const char *make, const char *model, int transform) { struct xwl_output *xwl_output = data; RROutputSetPhysicalSize(xwl_output->randr_output, physical_width, physical_height); RROutputSetSubpixelOrder(xwl_output->randr_output, wl_subpixel_to_xrandr(subpixel)); /* Apply the change from wl_output only if xdg-output is not supported */ if (!xwl_output->xdg_output) { xwl_output->x = x; xwl_output->y = y; } xwl_output->rotation = wl_transform_to_xrandr(transform); } static void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width, int height, int refresh) { struct xwl_output *xwl_output = data; if (!(flags & WL_OUTPUT_MODE_CURRENT)) return; /* Apply the change from wl_output only if xdg-output is not supported */ if (!xwl_output->xdg_output) { xwl_output->width = width; xwl_output->height = height; } xwl_output->refresh = refresh; } static inline void output_get_new_size(struct xwl_output *xwl_output, Bool need_rotate, int *height, int *width) { int output_width, output_height; if (!need_rotate || (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) { output_width = xwl_output->width; output_height = xwl_output->height; } else { output_width = xwl_output->height; output_height = xwl_output->width; } if (*width < xwl_output->x + output_width) *width = xwl_output->x + output_width; if (*height < xwl_output->y + output_height) *height = xwl_output->y + output_height; } /* Approximate some kind of mmpd (m.m. per dot) of the screen given the outputs * associated with it. * * It either calculates the mean mmpd of all the outputs or, if no reasonable * value could be calculated, defaults to the mmpd of a screen with a DPI value * of DEFAULT_DPI. */ static double approximate_mmpd(struct xwl_screen *xwl_screen) { struct xwl_output *it; int total_width_mm = 0; int total_width = 0; xorg_list_for_each_entry(it, &xwl_screen->output_list, link) { if (it->randr_output->mmWidth == 0) continue; total_width_mm += it->randr_output->mmWidth; total_width += it->width; } if (total_width_mm != 0) return (double)total_width_mm / total_width; else return 25.4 / DEFAULT_DPI; } static int xwl_set_pixmap_visit_window(WindowPtr window, void *data) { ScreenPtr screen = window->drawable.pScreen; if (screen->GetWindowPixmap(window) == data) { screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen)); return WT_WALKCHILDREN; } return WT_DONTWALKCHILDREN; } static void update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height) { ScreenPtr pScreen = xwl_screen->screen; WindowPtr pRoot = pScreen->root; PixmapPtr old_pixmap, new_pixmap; old_pixmap = pScreen->GetScreenPixmap(pScreen); new_pixmap = pScreen->CreatePixmap(pScreen, width, height, pScreen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP); pScreen->SetScreenPixmap(new_pixmap); if (old_pixmap) { TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap); pScreen->DestroyPixmap(old_pixmap); } pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); } static void update_screen_size(struct xwl_output *xwl_output, int width, int height) { struct xwl_screen *xwl_screen = xwl_output->xwl_screen; double mmpd; if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL) SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE); if (!xwl_screen->rootless && xwl_screen->screen->root) update_backing_pixmaps (xwl_screen, width, height); xwl_screen->width = width; xwl_screen->height = height; xwl_screen->screen->width = width; xwl_screen->screen->height = height; if (xwl_output->width == width && xwl_output->height == height) { xwl_screen->screen->mmWidth = xwl_output->randr_output->mmWidth; xwl_screen->screen->mmHeight = xwl_output->randr_output->mmHeight; } else { mmpd = approximate_mmpd(xwl_screen); xwl_screen->screen->mmWidth = width * mmpd; xwl_screen->screen->mmHeight = height * mmpd; } SetRootClip(xwl_screen->screen, xwl_screen->root_clip_mode); if (xwl_screen->screen->root) { BoxRec box = { 0, 0, width, height }; xwl_screen->screen->root->drawable.width = width; xwl_screen->screen->root->drawable.height = height; RegionReset(&xwl_screen->screen->root->winSize, &box); RRScreenSizeNotify(xwl_screen->screen); } update_desktop_dimensions(); } static void apply_output_change(struct xwl_output *xwl_output) { struct xwl_screen *xwl_screen = xwl_output->xwl_screen; struct xwl_output *it; int mode_width, mode_height; int width = 0, height = 0, has_this_output = 0; RRModePtr randr_mode; Bool need_rotate; /* Clear out the "done" received flags */ xwl_output->wl_output_done = FALSE; xwl_output->xdg_output_done = FALSE; /* xdg-output sends output size in compositor space. so already rotated */ need_rotate = (xwl_output->xdg_output == NULL); /* We need to rotate back the logical size for the mode */ if (need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) { mode_width = xwl_output->width; mode_height = xwl_output->height; } else { mode_width = xwl_output->height; mode_height = xwl_output->width; } randr_mode = xwayland_cvt(mode_width, mode_height, xwl_output->refresh / 1000.0, 0, 0); RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1); RRCrtcNotify(xwl_output->randr_crtc, randr_mode, xwl_output->x, xwl_output->y, xwl_output->rotation, NULL, 1, &xwl_output->randr_output); xorg_list_for_each_entry(it, &xwl_screen->output_list, link) { /* output done event is sent even when some property * of output is changed. That means that we may already * have this output. If it is true, we must not add it * into the output_list otherwise we'll corrupt it */ if (it == xwl_output) has_this_output = 1; output_get_new_size(it, need_rotate, &height, &width); } if (!has_this_output) { xorg_list_append(&xwl_output->link, &xwl_screen->output_list); /* we did not check this output for new screen size, do it now */ output_get_new_size(xwl_output, need_rotate, &height, &width); --xwl_screen->expecting_event; } update_screen_size(xwl_output, width, height); } static void output_handle_done(void *data, struct wl_output *wl_output) { struct xwl_output *xwl_output = data; xwl_output->wl_output_done = TRUE; /* Apply the changes from wl_output only if both "done" events are received, * or if xdg-output is not supported. */ if (xwl_output->xdg_output_done || !xwl_output->xdg_output) apply_output_change(xwl_output); } static void output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor) { } static const struct wl_output_listener output_listener = { output_handle_geometry, output_handle_mode, output_handle_done, output_handle_scale }; static void xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output, int32_t x, int32_t y) { struct xwl_output *xwl_output = data; xwl_output->x = x; xwl_output->y = y; } static void xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xdg_output, int32_t width, int32_t height) { struct xwl_output *xwl_output = data; xwl_output->width = width; xwl_output->height = height; } static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) { struct xwl_output *xwl_output = data; xwl_output->xdg_output_done = TRUE; if (xwl_output->wl_output_done) apply_output_change(xwl_output); } static const struct zxdg_output_v1_listener xdg_output_listener = { xdg_output_handle_logical_position, xdg_output_handle_logical_size, xdg_output_handle_done, }; struct xwl_output * xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) { struct xwl_output *xwl_output; static int serial; char name[256]; xwl_output = calloc(1, sizeof *xwl_output); if (xwl_output == NULL) { ErrorF("%s ENOMEM\n", __func__); return NULL; } xwl_output->output = wl_registry_bind(xwl_screen->registry, id, &wl_output_interface, 2); if (!xwl_output->output) { ErrorF("Failed binding wl_output\n"); goto err; } xwl_output->server_output_id = id; wl_output_add_listener(xwl_output->output, &output_listener, xwl_output); snprintf(name, sizeof name, "XWAYLAND%d", serial++); xwl_output->xwl_screen = xwl_screen; xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); if (!xwl_output->randr_crtc) { ErrorF("Failed creating RandR CRTC\n"); goto err; } RRCrtcSetRotations (xwl_output->randr_crtc, ALL_ROTATIONS); xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, strlen(name), xwl_output); if (!xwl_output->randr_output) { ErrorF("Failed creating RandR Output\n"); goto err; } RRCrtcGammaSetSize(xwl_output->randr_crtc, 256); RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1); RROutputSetConnection(xwl_output->randr_output, RR_Connected); /* We want the output to be in the list as soon as created so we can * use it when binding to the xdg-output protocol... */ xorg_list_append(&xwl_output->link, &xwl_screen->output_list); --xwl_screen->expecting_event; if (xwl_screen->xdg_output_manager) xwl_output_get_xdg_output(xwl_output); return xwl_output; err: if (xwl_output->randr_crtc) RRCrtcDestroy(xwl_output->randr_crtc); if (xwl_output->output) wl_output_destroy(xwl_output->output); free(xwl_output); return NULL; } void xwl_output_destroy(struct xwl_output *xwl_output) { wl_output_destroy(xwl_output->output); free(xwl_output); } void xwl_output_remove(struct xwl_output *xwl_output) { struct xwl_output *it; struct xwl_screen *xwl_screen = xwl_output->xwl_screen; int width = 0, height = 0; Bool need_rotate = (xwl_output->xdg_output == NULL); xorg_list_del(&xwl_output->link); xorg_list_for_each_entry(it, &xwl_screen->output_list, link) output_get_new_size(it, need_rotate, &height, &width); update_screen_size(xwl_output, width, height); RRCrtcDestroy(xwl_output->randr_crtc); RROutputDestroy(xwl_output->randr_output); xwl_output_destroy(xwl_output); } static Bool xwl_randr_get_info(ScreenPtr pScreen, Rotation * rotations) { *rotations = ALL_ROTATIONS; return TRUE; } static Bool xwl_randr_set_config(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { return FALSE; } Bool xwl_screen_init_output(struct xwl_screen *xwl_screen) { rrScrPrivPtr rp; if (!RRScreenInit(xwl_screen->screen)) return FALSE; RRScreenSetSizeRange(xwl_screen->screen, 16, 16, 32767, 32767); rp = rrGetScrPriv(xwl_screen->screen); rp->rrGetInfo = xwl_randr_get_info; rp->rrSetConfig = xwl_randr_set_config; return TRUE; } static void xwl_output_get_xdg_output(struct xwl_output *xwl_output) { struct xwl_screen *xwl_screen = xwl_output->xwl_screen; xwl_output->xdg_output = zxdg_output_manager_v1_get_xdg_output (xwl_screen->xdg_output_manager, xwl_output->output); zxdg_output_v1_add_listener(xwl_output->xdg_output, &xdg_output_listener, xwl_output); } void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen) { struct xwl_output *it; assert(xwl_screen->xdg_output_manager); xorg_list_for_each_entry(it, &xwl_screen->output_list, link) xwl_output_get_xdg_output(it); } xorg-server-1.20.8/hw/xwayland/xwayland.c0000644000175000017500000011326413640201473015255 00000000000000/* * Copyright © 2011-2014 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. */ #include "xwayland.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef XF86VIDMODE #include extern _X_EXPORT Bool noXFree86VidModeExtension; #endif #ifdef XWL_HAS_GLAMOR #include #endif void ddxGiveUp(enum ExitCode error) { } void AbortDDX(enum ExitCode error) { ddxGiveUp(error); } void OsVendorInit(void) { if (serverGeneration == 1) ForceClockId(CLOCK_MONOTONIC); } void OsVendorFatalError(const char *f, va_list args) { } #if defined(DDXBEFORERESET) void ddxBeforeReset(void) { return; } #endif #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ void ddxInputThreadInit(void) { } #endif _X_NORETURN static void _X_ATTRIBUTE_PRINTF(1, 2) xwl_give_up(const char *f, ...) { va_list args; va_start(args, f); VErrorFSigSafe(f, args); va_end(args); CloseWellKnownConnections(); OsCleanup(TRUE); fflush(stderr); exit(1); } void ddxUseMsg(void) { ErrorF("-rootless run rootless, requires wm support\n"); ErrorF("-wm fd create X client for wm on given fd\n"); ErrorF("-listen fd add give fd as a listen socket\n"); ErrorF("-eglstream use eglstream backend for nvidia GPUs\n"); } int ddxProcessArgument(int argc, char *argv[], int i) { if (strcmp(argv[i], "-rootless") == 0) { return 1; } else if (strcmp(argv[i], "-listen") == 0) { NoListenAll = TRUE; return 2; } else if (strcmp(argv[i], "-wm") == 0) { return 2; } else if (strcmp(argv[i], "-shm") == 0) { return 1; } else if (strcmp(argv[i], "-eglstream") == 0) { return 1; } return 0; } static DevPrivateKeyRec xwl_window_private_key; static DevPrivateKeyRec xwl_screen_private_key; static DevPrivateKeyRec xwl_pixmap_private_key; static DevPrivateKeyRec xwl_damage_private_key; static struct xwl_window * xwl_window_get(WindowPtr window) { return dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); } struct xwl_screen * xwl_screen_get(ScreenPtr screen) { return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key); } static void xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow, const char *debug_msg) { xwl_window->allow_commits = allow; DebugF("xwayland: win %d allow_commits = %d (%s)\n", xwl_window->window->drawable.id, allow, debug_msg); } static void xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window, PropertyPtr prop) { static Bool warned = FALSE; CARD32 *propdata; if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop) FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__); if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) { /* Not properly set, so fall back to safe and glitchy */ xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault"); if (!warned) { LogMessage(X_WARNING, "Window manager is misusing property %s.\n", NameForAtom(prop->propertyName)); warned = TRUE; } return; } propdata = prop->data; xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property"); } static void xwl_window_property_allow_commits(struct xwl_window *xwl_window, PropertyStateRec *propstate) { Bool old_allow_commits = xwl_window->allow_commits; switch (propstate->state) { case PropertyNewValue: xwl_window_set_allow_commits_from_property(xwl_window, propstate->prop); break; case PropertyDelete: xwl_window_set_allow_commits(xwl_window, TRUE, "property deleted"); break; default: break; } /* If allow_commits turned from off to on, discard any frame * callback we might be waiting for so that a new buffer is posted * immediately through block_handler() if there is damage to post. */ if (!old_allow_commits && xwl_window->allow_commits) { if (xwl_window->frame_callback) { wl_callback_destroy(xwl_window->frame_callback); xwl_window->frame_callback = NULL; } } } static void xwl_property_callback(CallbackListPtr *pcbl, void *closure, void *calldata) { ScreenPtr screen = closure; PropertyStateRec *rec = calldata; struct xwl_screen *xwl_screen; struct xwl_window *xwl_window; if (rec->win->drawable.pScreen != screen) return; xwl_window = xwl_window_get(rec->win); if (!xwl_window) return; xwl_screen = xwl_screen_get(screen); if (rec->prop->propertyName == xwl_screen->allow_commits_prop) xwl_window_property_allow_commits(xwl_window, rec); } static Bool xwl_close_screen(ScreenPtr screen) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_output *xwl_output, *next_xwl_output; struct xwl_seat *xwl_seat, *next_xwl_seat; DeleteCallback(&PropertyStateCallback, xwl_property_callback, screen); xorg_list_for_each_entry_safe(xwl_output, next_xwl_output, &xwl_screen->output_list, link) xwl_output_destroy(xwl_output); xorg_list_for_each_entry_safe(xwl_seat, next_xwl_seat, &xwl_screen->seat_list, link) xwl_seat_destroy(xwl_seat); xwl_screen_release_tablet_manager(xwl_screen); RemoveNotifyFd(xwl_screen->wayland_fd); wl_display_disconnect(xwl_screen->display); screen->CloseScreen = xwl_screen->CloseScreen; free(xwl_screen); return screen->CloseScreen(screen); } struct xwl_window * xwl_window_from_window(WindowPtr window) { struct xwl_window *xwl_window; while (window) { xwl_window = xwl_window_get(window); if (xwl_window) return xwl_window; window = window->parent; } return NULL; } static struct xwl_seat * xwl_screen_get_default_seat(struct xwl_screen *xwl_screen) { if (xorg_list_is_empty(&xwl_screen->seat_list)) return NULL; return container_of(xwl_screen->seat_list.prev, struct xwl_seat, link); } static void xwl_cursor_warped_to(DeviceIntPtr device, ScreenPtr screen, ClientPtr client, WindowPtr window, SpritePtr sprite, int x, int y) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_seat *xwl_seat = device->public.devicePrivate; struct xwl_window *xwl_window; WindowPtr focus; if (!xwl_seat) xwl_seat = xwl_screen_get_default_seat(xwl_screen); if (!window) window = XYToWindow(sprite, x, y); xwl_window = xwl_window_from_window(window); if (!xwl_window && xwl_seat->focus_window) { focus = xwl_seat->focus_window->window; /* Warps on non wl_surface backed Windows are only allowed * as long as the pointer stays within the focus window. */ if (x >= focus->drawable.x && y >= focus->drawable.y && x < focus->drawable.x + focus->drawable.width && y < focus->drawable.y + focus->drawable.height) { if (!window) { DebugF("Warp relative to pointer, assuming pointer focus\n"); xwl_window = xwl_seat->focus_window; } else if (window == screen->root) { DebugF("Warp on root window, assuming pointer focus\n"); xwl_window = xwl_seat->focus_window; } } } if (!xwl_window) return; xwl_seat_emulate_pointer_warp(xwl_seat, xwl_window, sprite, x, y); } static void xwl_cursor_confined_to(DeviceIntPtr device, ScreenPtr screen, WindowPtr window) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_seat *xwl_seat = device->public.devicePrivate; struct xwl_window *xwl_window; if (!xwl_seat) xwl_seat = xwl_screen_get_default_seat(xwl_screen); /* xwl_seat hasn't been setup yet, don't do anything just yet */ if (!xwl_seat) return; if (window == screen->root) { xwl_seat_unconfine_pointer(xwl_seat); return; } xwl_window = xwl_window_from_window(window); if (!xwl_window && xwl_seat->focus_window) { /* Allow confining on InputOnly windows, but only if the geometry * is the same than the focus window. */ if (window->drawable.class == InputOnly) { DebugF("Confine on InputOnly window, assuming pointer focus\n"); xwl_window = xwl_seat->focus_window; } } if (!xwl_window) return; xwl_seat_confine_pointer(xwl_seat, xwl_window); } static void damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) { WindowPtr window = data; struct xwl_window *xwl_window = xwl_window_get(window); struct xwl_screen *xwl_screen; if (!xwl_window) return; xwl_screen = xwl_window->xwl_screen; #ifdef GLAMOR_HAS_GBM if (xwl_window->present_flipped) { /* This damage is from a Present flip, which already committed a new * buffer for the surface, so we don't need to do anything in response */ RegionEmpty(DamageRegion(pDamage)); xorg_list_del(&xwl_window->link_damage); xwl_window->present_flipped = FALSE; return; } #endif xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list); } static void damage_destroy(DamagePtr pDamage, void *data) { } static Bool register_damage(WindowPtr window) { DamagePtr damage; damage = DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty, FALSE, window->drawable.pScreen, window); if (damage == NULL) { ErrorF("Failed creating damage\n"); return FALSE; } DamageRegister(&window->drawable, damage); DamageSetReportAfterOp(damage, TRUE); dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, damage); return TRUE; } static void unregister_damage(WindowPtr window) { DamagePtr damage; damage = dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key); if (!damage) return; DamageUnregister(damage); DamageDestroy(damage); dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, NULL); } static DamagePtr window_get_damage(WindowPtr window) { return dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key); } static void shell_surface_ping(void *data, struct wl_shell_surface *shell_surface, uint32_t serial) { wl_shell_surface_pong(shell_surface, serial); } static void shell_surface_configure(void *data, struct wl_shell_surface *wl_shell_surface, uint32_t edges, int32_t width, int32_t height) { } static void shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface) { } static const struct wl_shell_surface_listener shell_surface_listener = { shell_surface_ping, shell_surface_configure, shell_surface_popup_done }; void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap) { dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap); } struct xwl_pixmap * xwl_pixmap_get(PixmapPtr pixmap) { return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key); } static void xwl_window_init_allow_commits(struct xwl_window *xwl_window) { PropertyPtr prop = NULL; int ret; ret = dixLookupProperty(&prop, xwl_window->window, xwl_window->xwl_screen->allow_commits_prop, serverClient, DixReadAccess); if (ret == Success && prop) xwl_window_set_allow_commits_from_property(xwl_window, prop); else xwl_window_set_allow_commits(xwl_window, TRUE, "no property"); } static void send_surface_id_event(struct xwl_window *xwl_window) { static const char atom_name[] = "WL_SURFACE_ID"; static Atom type_atom; DeviceIntPtr dev; xEvent e; if (type_atom == None) type_atom = MakeAtom(atom_name, strlen(atom_name), TRUE); e.u.u.type = ClientMessage; e.u.u.detail = 32; e.u.clientMessage.window = xwl_window->window->drawable.id; e.u.clientMessage.u.l.type = type_atom; e.u.clientMessage.u.l.longs0 = wl_proxy_get_id((struct wl_proxy *) xwl_window->surface); e.u.clientMessage.u.l.longs1 = 0; e.u.clientMessage.u.l.longs2 = 0; e.u.clientMessage.u.l.longs3 = 0; e.u.clientMessage.u.l.longs4 = 0; dev = PickPointer(serverClient); DeliverEventsToWindow(dev, xwl_window->xwl_screen->screen->root, &e, 1, SubstructureRedirectMask, NullGrab); } static Bool ensure_surface_for_window(WindowPtr window) { ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen; struct xwl_window *xwl_window; struct wl_region *region; if (xwl_window_get(window)) return TRUE; xwl_screen = xwl_screen_get(screen); if (xwl_screen->rootless) { if (window->redirectDraw != RedirectDrawManual) return TRUE; } else { if (window->parent) return TRUE; } xwl_window = calloc(1, sizeof *xwl_window); if (xwl_window == NULL) return FALSE; xwl_window->xwl_screen = xwl_screen; xwl_window->window = window; xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor); if (xwl_window->surface == NULL) { ErrorF("wl_display_create_surface failed\n"); goto err; } if (!xwl_screen->rootless) { xwl_window->shell_surface = wl_shell_get_shell_surface(xwl_screen->shell, xwl_window->surface); if (xwl_window->shell_surface == NULL) { ErrorF("Failed creating shell surface\n"); goto err_surf; } wl_shell_surface_add_listener(xwl_window->shell_surface, &shell_surface_listener, xwl_window); wl_shell_surface_set_toplevel(xwl_window->shell_surface); region = wl_compositor_create_region(xwl_screen->compositor); if (region == NULL) { ErrorF("Failed creating region\n"); goto err_surf; } wl_region_add(region, 0, 0, window->drawable.width, window->drawable.height); wl_surface_set_opaque_region(xwl_window->surface, region); wl_region_destroy(region); } wl_display_flush(xwl_screen->display); send_surface_id_event(xwl_window); wl_surface_set_user_data(xwl_window->surface, xwl_window); compRedirectWindow(serverClient, window, CompositeRedirectManual); dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window); xorg_list_init(&xwl_window->link_damage); #ifdef GLAMOR_HAS_GBM xorg_list_init(&xwl_window->frame_callback_list); #endif xwl_window_init_allow_commits(xwl_window); return TRUE; err_surf: if (xwl_window->shell_surface) wl_shell_surface_destroy(xwl_window->shell_surface); wl_surface_destroy(xwl_window->surface); err: free(xwl_window); return FALSE; } static Bool xwl_realize_window(WindowPtr window) { ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen; Bool ret; xwl_screen = xwl_screen_get(screen); screen->RealizeWindow = xwl_screen->RealizeWindow; ret = (*screen->RealizeWindow) (window); xwl_screen->RealizeWindow = screen->RealizeWindow; screen->RealizeWindow = xwl_realize_window; if (!ret) return FALSE; if (xwl_screen->rootless && !window->parent) { BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height }; RegionReset(&window->winSize, &box); RegionNull(&window->clipList); RegionNull(&window->borderClip); } if (xwl_screen->rootless ? (window->drawable.class == InputOutput && window->parent == window->drawable.pScreen->root) : !window->parent) { if (!register_damage(window)) return FALSE; } return ensure_surface_for_window(window); } static Bool xwl_unrealize_window(WindowPtr window) { ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen; struct xwl_window *xwl_window; struct xwl_seat *xwl_seat; Bool ret; xwl_screen = xwl_screen_get(screen); xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) { if (xwl_seat->focus_window && xwl_seat->focus_window->window == window) xwl_seat->focus_window = NULL; if (xwl_seat->tablet_focus_window && xwl_seat->tablet_focus_window->window == window) xwl_seat->tablet_focus_window = NULL; if (xwl_seat->last_xwindow == window) xwl_seat->last_xwindow = NullWindow; if (xwl_seat->cursor_confinement_window && xwl_seat->cursor_confinement_window->window == window) xwl_seat_unconfine_pointer(xwl_seat); if (xwl_seat->pointer_warp_emulator && xwl_seat->pointer_warp_emulator->locked_window && xwl_seat->pointer_warp_emulator->locked_window->window == window) xwl_seat_destroy_pointer_warp_emulator(xwl_seat); xwl_seat_clear_touch(xwl_seat, window); } compUnredirectWindow(serverClient, window, CompositeRedirectManual); screen->UnrealizeWindow = xwl_screen->UnrealizeWindow; ret = (*screen->UnrealizeWindow) (window); xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; screen->UnrealizeWindow = xwl_unrealize_window; xwl_window = xwl_window_get(window); if (!xwl_window) return ret; wl_surface_destroy(xwl_window->surface); xorg_list_del(&xwl_window->link_damage); unregister_damage(window); if (xwl_window->frame_callback) wl_callback_destroy(xwl_window->frame_callback); #ifdef GLAMOR_HAS_GBM if (xwl_screen->present) { struct xwl_present_window *xwl_present_window, *tmp; xorg_list_for_each_entry_safe(xwl_present_window, tmp, &xwl_window->frame_callback_list, frame_callback_list) { xwl_present_unrealize_window(xwl_present_window); } } #endif free(xwl_window); dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); return ret; } static Bool xwl_save_screen(ScreenPtr pScreen, int on) { return TRUE; } static void xwl_set_window_pixmap(WindowPtr window, PixmapPtr pixmap) { ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen; xwl_screen = xwl_screen_get(screen); screen->SetWindowPixmap = xwl_screen->SetWindowPixmap; (*screen->SetWindowPixmap) (window, pixmap); xwl_screen->SetWindowPixmap = screen->SetWindowPixmap; screen->SetWindowPixmap = xwl_set_window_pixmap; if (!RegionNotEmpty(&window->winSize)) return; ensure_surface_for_window(window); } static void frame_callback(void *data, struct wl_callback *callback, uint32_t time) { struct xwl_window *xwl_window = data; wl_callback_destroy (xwl_window->frame_callback); xwl_window->frame_callback = NULL; #ifdef GLAMOR_HAS_GBM if (xwl_window->xwl_screen->present) { struct xwl_present_window *xwl_present_window, *tmp; xorg_list_for_each_entry_safe(xwl_present_window, tmp, &xwl_window->frame_callback_list, frame_callback_list) { xwl_present_frame_callback(xwl_present_window); } } #endif } static const struct wl_callback_listener frame_listener = { frame_callback }; void xwl_window_create_frame_callback(struct xwl_window *xwl_window) { xwl_window->frame_callback = wl_surface_frame(xwl_window->surface); wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window); } static Bool xwl_destroy_window(WindowPtr window) { ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen = xwl_screen_get(screen); Bool ret; #ifdef GLAMOR_HAS_GBM if (xwl_screen->present) xwl_present_cleanup(window); #endif screen->DestroyWindow = xwl_screen->DestroyWindow; if (screen->DestroyWindow) ret = screen->DestroyWindow (window); else ret = TRUE; xwl_screen->DestroyWindow = screen->DestroyWindow; screen->DestroyWindow = xwl_destroy_window; return ret; } static void xwl_window_post_damage(struct xwl_window *xwl_window) { struct xwl_screen *xwl_screen = xwl_window->xwl_screen; RegionPtr region; BoxPtr box; struct wl_buffer *buffer; PixmapPtr pixmap; int i; assert(!xwl_window->frame_callback); region = DamageRegion(window_get_damage(xwl_window->window)); pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window); #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, NULL); else #endif buffer = xwl_shm_pixmap_get_wl_buffer(pixmap); #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) xwl_glamor_post_damage(xwl_window, pixmap, region); #endif wl_surface_attach(xwl_window->surface, buffer, 0, 0); /* Arbitrary limit to try to avoid flooding the Wayland * connection. If we flood it too much anyway, this could * abort in libwayland-client. */ if (RegionNumRects(region) > 256) { box = RegionExtents(region); wl_surface_damage(xwl_window->surface, box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1); } else { box = RegionRects(region); for (i = 0; i < RegionNumRects(region); i++, box++) wl_surface_damage(xwl_window->surface, box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1); } xwl_window_create_frame_callback(xwl_window); DamageEmpty(window_get_damage(xwl_window->window)); } static void xwl_screen_post_damage(struct xwl_screen *xwl_screen) { struct xwl_window *xwl_window, *next_xwl_window; struct xorg_list commit_window_list; xorg_list_init(&commit_window_list); xorg_list_for_each_entry_safe(xwl_window, next_xwl_window, &xwl_screen->damage_window_list, link_damage) { /* If we're waiting on a frame callback from the server, * don't attach a new buffer. */ if (xwl_window->frame_callback) continue; if (!xwl_window->allow_commits) continue; #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor && !xwl_glamor_allow_commits(xwl_window)) continue; #endif xwl_window_post_damage(xwl_window); xorg_list_del(&xwl_window->link_damage); xorg_list_append(&xwl_window->link_damage, &commit_window_list); } if (xorg_list_is_empty(&commit_window_list)) return; #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor && xwl_screen->egl_backend == &xwl_screen->gbm_backend) { glamor_block_handler(xwl_screen->screen); } #endif xorg_list_for_each_entry_safe(xwl_window, next_xwl_window, &commit_window_list, link_damage) { wl_surface_commit(xwl_window->surface); xorg_list_del(&xwl_window->link_damage); } } static void registry_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) { struct xwl_screen *xwl_screen = data; if (strcmp(interface, "wl_compositor") == 0) { xwl_screen->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1); } else if (strcmp(interface, "wl_shm") == 0) { xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); } else if (strcmp(interface, "wl_shell") == 0) { xwl_screen->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1); } else if (strcmp(interface, "wl_output") == 0 && version >= 2) { if (xwl_output_create(xwl_screen, id)) xwl_screen->expecting_event++; } else if (strcmp(interface, "zxdg_output_manager_v1") == 0) { xwl_screen->xdg_output_manager = wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1); xwl_screen_init_xdg_output(xwl_screen); } #ifdef XWL_HAS_GLAMOR else if (xwl_screen->glamor) { xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface, version); } #endif } static void global_remove(void *data, struct wl_registry *registry, uint32_t name) { struct xwl_screen *xwl_screen = data; struct xwl_output *xwl_output, *tmp_xwl_output; xorg_list_for_each_entry_safe(xwl_output, tmp_xwl_output, &xwl_screen->output_list, link) { if (xwl_output->server_output_id == name) { xwl_output_remove(xwl_output); break; } } } static const struct wl_registry_listener registry_listener = { registry_global, global_remove }; static void xwl_read_events (struct xwl_screen *xwl_screen) { int ret; if (xwl_screen->wait_flush) return; ret = wl_display_read_events(xwl_screen->display); if (ret == -1) xwl_give_up("failed to read Wayland events: %s\n", strerror(errno)); xwl_screen->prepare_read = 0; ret = wl_display_dispatch_pending(xwl_screen->display); if (ret == -1) xwl_give_up("failed to dispatch Wayland events: %s\n", strerror(errno)); } static int xwl_display_pollout (struct xwl_screen *xwl_screen, int timeout) { struct pollfd poll_fd; poll_fd.fd = wl_display_get_fd(xwl_screen->display); poll_fd.events = POLLOUT; return xserver_poll(&poll_fd, 1, timeout); } static void xwl_dispatch_events (struct xwl_screen *xwl_screen) { int ret = 0; int ready; if (xwl_screen->wait_flush) goto pollout; while (xwl_screen->prepare_read == 0 && wl_display_prepare_read(xwl_screen->display) == -1) { ret = wl_display_dispatch_pending(xwl_screen->display); if (ret == -1) xwl_give_up("failed to dispatch Wayland events: %s\n", strerror(errno)); } xwl_screen->prepare_read = 1; pollout: ready = xwl_display_pollout(xwl_screen, 5); if (ready == -1 && errno != EINTR) xwl_give_up("error polling on XWayland fd: %s\n", strerror(errno)); if (ready > 0) ret = wl_display_flush(xwl_screen->display); if (ret == -1 && errno != EAGAIN) xwl_give_up("failed to write to XWayland fd: %s\n", strerror(errno)); xwl_screen->wait_flush = (ready == 0 || ready == -1 || ret == -1); } static void socket_handler(int fd, int ready, void *data) { struct xwl_screen *xwl_screen = data; xwl_read_events (xwl_screen); } static void wakeup_handler(void *data, int err) { } static void block_handler(void *data, void *timeout) { struct xwl_screen *xwl_screen = data; xwl_screen_post_damage(xwl_screen); xwl_dispatch_events (xwl_screen); } void xwl_sync_events (struct xwl_screen *xwl_screen) { xwl_dispatch_events (xwl_screen); xwl_read_events (xwl_screen); } static CARD32 add_client_fd(OsTimerPtr timer, CARD32 time, void *arg) { struct xwl_screen *xwl_screen = arg; if (!AddClientOnOpenFD(xwl_screen->wm_fd)) FatalError("Failed to add wm client\n"); TimerFree(timer); return 0; } static void listen_on_fds(struct xwl_screen *xwl_screen) { int i; for (i = 0; i < xwl_screen->listen_fd_count; i++) ListenOnOpenFD(xwl_screen->listen_fds[i], FALSE); } static void wm_selection_callback(CallbackListPtr *p, void *data, void *arg) { SelectionInfoRec *info = arg; struct xwl_screen *xwl_screen = data; static const char atom_name[] = "WM_S0"; static Atom atom_wm_s0; if (atom_wm_s0 == None) atom_wm_s0 = MakeAtom(atom_name, strlen(atom_name), TRUE); if (info->selection->selection != atom_wm_s0 || info->kind != SelectionSetOwner) return; listen_on_fds(xwl_screen); DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen); } static Bool xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) { static const char allow_commits[] = "_XWAYLAND_ALLOW_COMMITS"; struct xwl_screen *xwl_screen; Pixel red_mask, blue_mask, green_mask; int ret, bpc, green_bpc, i; Bool use_eglstreams = FALSE; xwl_screen = calloc(1, sizeof *xwl_screen); if (xwl_screen == NULL) return FALSE; xwl_screen->wm_fd = -1; if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0)) return FALSE; if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0)) return FALSE; if (!dixRegisterPrivateKey(&xwl_damage_private_key, PRIVATE_WINDOW, 0)) return FALSE; dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen); xwl_screen->screen = pScreen; #ifdef XWL_HAS_GLAMOR xwl_screen->glamor = 1; #endif for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-rootless") == 0) { xwl_screen->rootless = 1; } else if (strcmp(argv[i], "-wm") == 0) { xwl_screen->wm_fd = atoi(argv[i + 1]); i++; TimerSet(NULL, 0, 1, add_client_fd, xwl_screen); } else if (strcmp(argv[i], "-listen") == 0) { if (xwl_screen->listen_fd_count == ARRAY_SIZE(xwl_screen->listen_fds)) FatalError("Too many -listen arguments given, max is %zu\n", ARRAY_SIZE(xwl_screen->listen_fds)); xwl_screen->listen_fds[xwl_screen->listen_fd_count++] = atoi(argv[i + 1]); i++; } else if (strcmp(argv[i], "-shm") == 0) { xwl_screen->glamor = 0; } else if (strcmp(argv[i], "-eglstream") == 0) { #ifdef XWL_HAS_EGLSTREAM use_eglstreams = TRUE; #else ErrorF("xwayland glamor: this build does not have EGLStream support\n"); #endif } } #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) xwl_glamor_init_backends(xwl_screen, use_eglstreams); #endif /* In rootless mode, we don't have any screen storage, and the only * rendering should be to redirected mode. */ if (xwl_screen->rootless) xwl_screen->root_clip_mode = ROOT_CLIP_INPUT_ONLY; else xwl_screen->root_clip_mode = ROOT_CLIP_FULL; if (xwl_screen->listen_fd_count > 0) { if (xwl_screen->wm_fd >= 0) AddCallback(&SelectionCallback, wm_selection_callback, xwl_screen); else listen_on_fds(xwl_screen); } xorg_list_init(&xwl_screen->output_list); xorg_list_init(&xwl_screen->seat_list); xorg_list_init(&xwl_screen->damage_window_list); xwl_screen->depth = 24; xwl_screen->display = wl_display_connect(NULL); if (xwl_screen->display == NULL) { ErrorF("could not connect to wayland server\n"); return FALSE; } if (!xwl_screen_init_output(xwl_screen)) return FALSE; xwl_screen->expecting_event = 0; xwl_screen->registry = wl_display_get_registry(xwl_screen->display); wl_registry_add_listener(xwl_screen->registry, ®istry_listener, xwl_screen); ret = wl_display_roundtrip(xwl_screen->display); if (ret == -1) { ErrorF("could not connect to wayland server\n"); return FALSE; } while (xwl_screen->expecting_event > 0) wl_display_roundtrip(xwl_screen->display); bpc = xwl_screen->depth / 3; green_bpc = xwl_screen->depth - 2 * bpc; blue_mask = (1 << bpc) - 1; green_mask = ((1 << green_bpc) - 1) << bpc; red_mask = blue_mask << (green_bpc + bpc); miSetVisualTypesAndMasks(xwl_screen->depth, ((1 << TrueColor) | (1 << DirectColor)), green_bpc, TrueColor, red_mask, green_mask, blue_mask); miSetPixmapDepths(); ret = fbScreenInit(pScreen, NULL, xwl_screen->width, xwl_screen->height, 96, 96, 0, BitsPerPixel(xwl_screen->depth)); if (!ret) return FALSE; fbPictureInit(pScreen, 0, 0); #ifdef HAVE_XSHMFENCE if (!miSyncShmScreenInit(pScreen)) return FALSE; #endif xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display); SetNotifyFd(xwl_screen->wayland_fd, socket_handler, X_NOTIFY_READ, xwl_screen); RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen); pScreen->SaveScreen = xwl_save_screen; pScreen->blackPixel = 0; pScreen->whitePixel = 1; ret = fbCreateDefColormap(pScreen); if (!xwl_screen_init_cursor(xwl_screen)) return FALSE; #ifdef XWL_HAS_GLAMOR if (xwl_screen->glamor) { xwl_glamor_select_backend(xwl_screen, use_eglstreams); if (xwl_screen->egl_backend == NULL || !xwl_glamor_init(xwl_screen)) { ErrorF("Failed to initialize glamor, falling back to sw\n"); xwl_screen->glamor = 0; } } if (xwl_screen->glamor && xwl_screen->rootless) xwl_screen->present = xwl_present_init(pScreen); #endif if (!xwl_screen->glamor) { xwl_screen->CreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = xwl_shm_create_screen_resources; pScreen->CreatePixmap = xwl_shm_create_pixmap; pScreen->DestroyPixmap = xwl_shm_destroy_pixmap; } xwl_screen->RealizeWindow = pScreen->RealizeWindow; pScreen->RealizeWindow = xwl_realize_window; xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow; pScreen->UnrealizeWindow = xwl_unrealize_window; xwl_screen->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = xwl_destroy_window; xwl_screen->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xwl_close_screen; if (xwl_screen->rootless) { xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap; pScreen->SetWindowPixmap = xwl_set_window_pixmap; } pScreen->CursorWarpedTo = xwl_cursor_warped_to; pScreen->CursorConfinedTo = xwl_cursor_confined_to; xwl_screen->allow_commits_prop = MakeAtom(allow_commits, strlen(allow_commits), TRUE); if (xwl_screen->allow_commits_prop == BAD_RESOURCE) return FALSE; AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen); wl_display_roundtrip(xwl_screen->display); while (xwl_screen->expecting_event) wl_display_roundtrip(xwl_screen->display); return ret; } _X_NORETURN static void _X_ATTRIBUTE_PRINTF(1, 0) xwl_log_handler(const char *format, va_list args) { char msg[256]; vsnprintf(msg, sizeof msg, format, args); FatalError("%s", msg); } static const ExtensionModule xwayland_extensions[] = { #ifdef XF86VIDMODE { xwlVidModeExtensionInit, XF86VIDMODENAME, &noXFree86VidModeExtension }, #endif }; void InitOutput(ScreenInfo * screen_info, int argc, char **argv) { int depths[] = { 1, 4, 8, 15, 16, 24, 32 }; int bpp[] = { 1, 8, 8, 16, 16, 32, 32 }; int i; for (i = 0; i < ARRAY_SIZE(depths); i++) { screen_info->formats[i].depth = depths[i]; screen_info->formats[i].bitsPerPixel = bpp[i]; screen_info->formats[i].scanlinePad = BITMAP_SCANLINE_PAD; } screen_info->imageByteOrder = IMAGE_BYTE_ORDER; screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD; screen_info->bitmapBitOrder = BITMAP_BIT_ORDER; screen_info->numPixmapFormats = ARRAY_SIZE(depths); if (serverGeneration == 1) LoadExtensionList(xwayland_extensions, ARRAY_SIZE(xwayland_extensions), FALSE); /* Cast away warning from missing printf annotation for * wl_log_func_t. Wayland 1.5 will have the annotation, so we can * remove the cast and require that when it's released. */ wl_log_set_handler_client((void *) xwl_log_handler); if (AddScreen(xwl_screen_init, argc, argv) == -1) { FatalError("Couldn't add screen\n"); } xorgGlxCreateVendor(); LocalAccessScopeUser(); } xorg-server-1.20.8/hw/xwayland/Makefile.am0000644000175000017500000001222013640201473015304 00000000000000bin_PROGRAMS = Xwayland Xwayland_CFLAGS = \ -I$(top_srcdir)/glamor \ -I$(top_srcdir)/dri3 \ -DHAVE_DIX_CONFIG_H \ $(XWAYLANDMODULES_CFLAGS) \ $(DIX_CFLAGS) \ $(GLAMOR_CFLAGS) \ $(GBM_CFLAGS) Xwayland_SOURCES = \ xwayland.c \ xwayland-input.c \ xwayland-cursor.c \ xwayland-shm.c \ xwayland-output.c \ xwayland-cvt.c \ xwayland-vidmode.c \ xwayland.h \ $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c Xwayland_LDADD = \ $(glamor_lib) \ $(XWAYLAND_LIBS) \ $(top_builddir)/glx/libglxvnd.la \ $(XWAYLAND_SYS_LIBS) \ $(top_builddir)/Xext/libXvidmode.la \ $(XSERVER_SYS_LIBS) Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) Xwayland_built_sources = if GLAMOR_EGL Xwayland_SOURCES += \ xwayland-glamor.c \ xwayland-glamor-gbm.c \ xwayland-present.c if XV Xwayland_SOURCES += \ xwayland-glamor-xv.c endif if XWAYLAND_EGLSTREAM Xwayland_SOURCES += \ xwayland-glamor-eglstream.c endif glamor_built_sources = \ drm-client-protocol.h \ drm-protocol.c Xwayland_built_sources += $(glamor_built_sources) glamor_lib = $(top_builddir)/glamor/libglamor.la Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL Xwayland_DEPENDENCIES = $(glamor_lib) $(XWAYLAND_LIBS) endif Xwayland_built_sources += \ relative-pointer-unstable-v1-client-protocol.h \ relative-pointer-unstable-v1-protocol.c \ pointer-constraints-unstable-v1-client-protocol.h \ pointer-constraints-unstable-v1-protocol.c \ tablet-unstable-v2-client-protocol.h \ tablet-unstable-v2-protocol.c \ xwayland-keyboard-grab-unstable-v1-protocol.c \ xwayland-keyboard-grab-unstable-v1-client-protocol.h \ xdg-output-unstable-v1-protocol.c \ xdg-output-unstable-v1-client-protocol.h \ linux-dmabuf-unstable-v1-client-protocol.h \ linux-dmabuf-unstable-v1-protocol.c if XWAYLAND_EGLSTREAM Xwayland_built_sources += \ wayland-eglstream-client-protocol.h \ wayland-eglstream-protocol.c \ wayland-eglstream-controller-client-protocol.h \ wayland-eglstream-controller-protocol.c endif nodist_Xwayland_SOURCES = $(Xwayland_built_sources) CLEANFILES = $(Xwayland_built_sources) EXTRA_DIST = drm.xml $(Xwayland_SOURCES): $(Xwayland_built_sources) relink: $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT) relative-pointer-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ relative-pointer-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ pointer-constraints-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ pointer-constraints-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ tablet-unstable-v2-protocol.c: $(WAYLAND_PROTOCOLS_DATADIR)/unstable/tablet/tablet-unstable-v2.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ tablet-unstable-v2-client-protocol.h: $(WAYLAND_PROTOCOLS_DATADIR)/unstable/tablet/tablet-unstable-v2.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ xwayland-keyboard-grab-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ xwayland-keyboard-grab-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ xdg-output-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xdg-output/xdg-output-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ xdg-output-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xdg-output/xdg-output-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ linux-dmabuf-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ linux-dmabuf-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ wayland-eglstream-client-protocol.h : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ wayland-eglstream-controller-client-protocol.h : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream-controller.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ wayland-eglstream-protocol.c : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream.xml $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ wayland-eglstream-controller-protocol.c : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream-controller.xml $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ %-protocol.c : %.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ %-client-protocol.h : %.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ xorg-server-1.20.8/hw/xwayland/xwayland-glamor-xv.c0000644000175000017500000003007713640201473017167 00000000000000/* * Copyright (c) 1998-2003 by The XFree86 Project, Inc. * Copyright © 2013 Red Hat * Copyright © 2014 Intel Corporation * Copyright © 2016 Red Hat * * 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. * * Authors: * Olivier Fourdan * * Derived from the glamor_xf86_xv, ephyr_glamor_xv and xf86xv * implementations */ #include "xwayland.h" #include "glamor_priv.h" #include #define NUM_FORMATS 3 #define NUM_PORTS 16 #define ADAPTOR_NAME "glamor textured video" #define ENCODER_NAME "XV_IMAGE" static DevPrivateKeyRec xwlXvScreenPrivateKeyRec; #define xwlXvScreenPrivateKey (&xwlXvScreenPrivateKeyRec) typedef struct { XvAdaptorPtr glxv_adaptor; /* We have only one adaptor, glamor Xv */ glamor_port_private *port_privates; CloseScreenProcPtr CloseScreen; } xwlXvScreenRec, *xwlXvScreenPtr; typedef struct { char depth; short class; } xwlVideoFormatRec, *xwlVideoFormatPtr; static xwlVideoFormatRec Formats[NUM_FORMATS] = { {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; static int xwl_glamor_xv_stop_video(XvPortPtr pPort, DrawablePtr pDraw) { glamor_port_private *gpp = (glamor_port_private *) (pPort->devPriv.ptr); if (pDraw->type != DRAWABLE_WINDOW) return BadAlloc; glamor_xv_stop_video(gpp); return Success; } static int xwl_glamor_xv_set_port_attribute(XvPortPtr pPort, Atom attribute, INT32 value) { glamor_port_private *gpp = (glamor_port_private *) (pPort->devPriv.ptr); return glamor_xv_set_port_attribute(gpp, attribute, value); } static int xwl_glamor_xv_get_port_attribute(XvPortPtr pPort, Atom attribute, INT32 *pValue) { glamor_port_private *gpp = (glamor_port_private *) (pPort->devPriv.ptr); return glamor_xv_get_port_attribute(gpp, attribute, pValue); } static int xwl_glamor_xv_query_best_size(XvPortPtr pPort, CARD8 motion, CARD16 vid_w, CARD16 vid_h, CARD16 drw_w, CARD16 drw_h, unsigned int *p_w, unsigned int *p_h) { *p_w = drw_w; *p_h = drw_h; return Success; } static int xwl_glamor_xv_query_image_attributes(XvPortPtr pPort, XvImagePtr format, CARD16 *width, CARD16 *height, int *pitches, int *offsets) { return glamor_xv_query_image_attributes(format->id, width, height, pitches, offsets); } static int xwl_glamor_xv_put_image(DrawablePtr pDrawable, XvPortPtr pPort, GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, unsigned char *data, Bool sync, CARD16 width, CARD16 height) { glamor_port_private *gpp = (glamor_port_private *) (pPort->devPriv.ptr); RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; if (pDrawable->type != DRAWABLE_WINDOW) return BadWindow; WinBox.x1 = pDrawable->x + drw_x; WinBox.y1 = pDrawable->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; RegionInit(&WinRegion, &WinBox, 1); RegionInit(&ClipRegion, NullBox, 1); RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip); if (RegionNotEmpty(&ClipRegion)) ret = glamor_xv_put_image(gpp, pDrawable, src_x, src_y, pDrawable->x + drw_x, pDrawable->y + drw_y, src_w, src_h, drw_w, drw_h, format->id, data, width, height, sync, &ClipRegion); RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } static Bool xwl_glamor_xv_add_formats(XvAdaptorPtr pa) { ScreenPtr pScreen; XvFormatPtr pFormat, pf; VisualPtr pVisual; int numFormat; int totFormat; int numVisuals; int i; totFormat = NUM_FORMATS; pFormat = xnfcalloc(totFormat, sizeof(XvFormatRec)); pScreen = pa->pScreen; for (pf = pFormat, i = 0, numFormat = 0; i < NUM_FORMATS; i++) { numVisuals = pScreen->numVisuals; pVisual = pScreen->visuals; while (numVisuals--) { if ((pVisual->class == Formats[i].class) && (pVisual->nplanes == Formats[i].depth)) { if (numFormat >= totFormat) { void *moreSpace; totFormat *= 2; moreSpace = xnfreallocarray(pFormat, totFormat, sizeof(XvFormatRec)); pFormat = moreSpace; pf = pFormat + numFormat; } pf->visual = pVisual->vid; pf->depth = Formats[i].depth; pf++; numFormat++; } pVisual++; } } pa->nFormats = numFormat; pa->pFormats = pFormat; return numFormat != 0; } static Bool xwl_glamor_xv_add_ports(XvAdaptorPtr pa) { XvPortPtr pPorts, pp; xwlXvScreenPtr xwlXvScreen; unsigned long PortResource = 0; int nPorts; int i; pPorts = xnfcalloc(NUM_PORTS, sizeof(XvPortRec)); xwlXvScreen = dixLookupPrivate(&(pa->pScreen)->devPrivates, xwlXvScreenPrivateKey); xwlXvScreen->port_privates = xnfcalloc(NUM_PORTS, sizeof(glamor_port_private)); PortResource = XvGetRTPort(); for (pp = pPorts, i = 0, nPorts = 0; i < NUM_PORTS; i++) { if (!(pp->id = FakeClientID(0))) continue; pp->pAdaptor = pa; glamor_xv_init_port(&xwlXvScreen->port_privates[i]); pp->devPriv.ptr = &xwlXvScreen->port_privates[i]; if (AddResource(pp->id, PortResource, pp)) { pp++; nPorts++; } } pa->base_id = pPorts->id; pa->nPorts = nPorts; pa->pPorts = pPorts; return nPorts != 0; } static void xwl_glamor_xv_add_attributes(XvAdaptorPtr pa) { int i; pa->pAttributes = xnfcalloc(glamor_xv_num_attributes, sizeof(XvAttributeRec)); memcpy(pa->pAttributes, glamor_xv_attributes, glamor_xv_num_attributes * sizeof(XvAttributeRec)); for (i = 0; i < glamor_xv_num_attributes; i++) pa->pAttributes[i].name = strdup(glamor_xv_attributes[i].name); pa->nAttributes = glamor_xv_num_attributes; } static void xwl_glamor_xv_add_images(XvAdaptorPtr pa) { pa->pImages = xnfcalloc(glamor_xv_num_images, sizeof(XvImageRec)); memcpy(pa->pImages, glamor_xv_images, glamor_xv_num_images * sizeof(XvImageRec)); pa->nImages = glamor_xv_num_images; } static void xwl_glamor_xv_add_encodings(XvAdaptorPtr pa) { XvEncodingPtr pe; GLint texsize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texsize); pe = xnfcalloc(1, sizeof(XvEncodingRec)); pe->id = 0; pe->pScreen = pa->pScreen; pe->name = strdup(ENCODER_NAME); pe->width = texsize; pe->height = texsize; pe->rate.numerator = 1; pe->rate.denominator = 1; pa->pEncodings = pe; pa->nEncodings = 1; } static Bool xwl_glamor_xv_add_adaptors(ScreenPtr pScreen) { DevPrivateKey XvScreenKey; XvScreenPtr XvScreen; xwlXvScreenPtr xwlXvScreen; XvAdaptorPtr pa; if (XvScreenInit(pScreen) != Success) return FALSE; XvScreenKey = XvGetScreenKey(); XvScreen = dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey); XvScreen->nAdaptors = 0; XvScreen->pAdaptors = NULL; pa = xnfcalloc(1, sizeof(XvAdaptorRec)); pa->pScreen = pScreen; pa->type = (unsigned char) (XvInputMask | XvImageMask); pa->ddStopVideo = xwl_glamor_xv_stop_video; pa->ddPutImage = xwl_glamor_xv_put_image; pa->ddSetPortAttribute = xwl_glamor_xv_set_port_attribute; pa->ddGetPortAttribute = xwl_glamor_xv_get_port_attribute; pa->ddQueryBestSize = xwl_glamor_xv_query_best_size; pa->ddQueryImageAttributes = xwl_glamor_xv_query_image_attributes; pa->name = strdup(ADAPTOR_NAME); xwl_glamor_xv_add_encodings(pa); xwl_glamor_xv_add_images(pa); xwl_glamor_xv_add_attributes(pa); if (!xwl_glamor_xv_add_formats(pa)) goto failed; if (!xwl_glamor_xv_add_ports(pa)) goto failed; /* We're good now with out Xv adaptor */ XvScreen->nAdaptors = 1; XvScreen->pAdaptors = pa; xwlXvScreen = dixLookupPrivate(&(pa->pScreen)->devPrivates, xwlXvScreenPrivateKey); xwlXvScreen->glxv_adaptor = pa; return TRUE; failed: XvFreeAdaptor(pa); free(pa); return FALSE; } static Bool xwl_glamor_xv_close_screen(ScreenPtr pScreen) { xwlXvScreenPtr xwlXvScreen; xwlXvScreen = dixLookupPrivate(&(pScreen)->devPrivates, xwlXvScreenPrivateKey); if (xwlXvScreen->glxv_adaptor) { XvFreeAdaptor(xwlXvScreen->glxv_adaptor); free(xwlXvScreen->glxv_adaptor); } free(xwlXvScreen->port_privates); pScreen->CloseScreen = xwlXvScreen->CloseScreen; return pScreen->CloseScreen(pScreen); } Bool xwl_glamor_xv_init(ScreenPtr pScreen) { xwlXvScreenPtr xwlXvScreen; if (!dixRegisterPrivateKey(xwlXvScreenPrivateKey, PRIVATE_SCREEN, sizeof(xwlXvScreenRec))) return FALSE; xwlXvScreen = dixLookupPrivate(&(pScreen)->devPrivates, xwlXvScreenPrivateKey); xwlXvScreen->port_privates = NULL; xwlXvScreen->glxv_adaptor = NULL; xwlXvScreen->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xwl_glamor_xv_close_screen; glamor_xv_core_init(pScreen); return xwl_glamor_xv_add_adaptors(pScreen); } xorg-server-1.20.8/hw/xwayland/xwayland-glamor.c0000644000175000017500000002067313640201473016535 00000000000000/* * Copyright © 2011-2014 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. */ #include "xwayland.h" #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include #include #include static void glamor_egl_make_current(struct glamor_context *glamor_ctx) { eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_ctx->ctx)) FatalError("Failed to make EGL context current\n"); } void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen) { if (lastGLContext == xwl_screen->glamor_ctx) return; lastGLContext = xwl_screen->glamor_ctx; xwl_screen->glamor_ctx->make_current(xwl_screen->glamor_ctx); } void glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); glamor_enable_dri3(screen); glamor_ctx->ctx = xwl_screen->egl_context; glamor_ctx->display = xwl_screen->egl_display; glamor_ctx->make_current = glamor_egl_make_current; xwl_screen->glamor_ctx = glamor_ctx; } void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) { if (xwl_screen->gbm_backend.is_available && xwl_screen->gbm_backend.init_wl_registry(xwl_screen, registry, id, interface, version)); /* no-op */ else if (xwl_screen->eglstream_backend.is_available && xwl_screen->eglstream_backend.init_wl_registry(xwl_screen, registry, id, interface, version)); /* no-op */ } Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen, struct xwl_egl_backend *xwl_egl_backend) { return xwl_egl_backend->has_wl_interfaces(xwl_screen); } struct wl_buffer * xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap, Bool *created) { struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); if (xwl_screen->egl_backend->get_wl_buffer_for_pixmap) return xwl_screen->egl_backend->get_wl_buffer_for_pixmap(pixmap, created); return NULL; } void xwl_glamor_post_damage(struct xwl_window *xwl_window, PixmapPtr pixmap, RegionPtr region) { struct xwl_screen *xwl_screen = xwl_window->xwl_screen; if (xwl_screen->egl_backend->post_damage) xwl_screen->egl_backend->post_damage(xwl_window, pixmap, region); } Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window) { struct xwl_screen *xwl_screen = xwl_window->xwl_screen; if (xwl_screen->egl_backend->allow_commits) return xwl_screen->egl_backend->allow_commits(xwl_window); else return TRUE; } static Bool xwl_glamor_create_screen_resources(ScreenPtr screen) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); int ret; screen->CreateScreenResources = xwl_screen->CreateScreenResources; ret = (*screen->CreateScreenResources) (screen); xwl_screen->CreateScreenResources = screen->CreateScreenResources; screen->CreateScreenResources = xwl_glamor_create_screen_resources; if (!ret) return ret; if (xwl_screen->rootless) { screen->devPrivate = fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); } else { screen->devPrivate = screen->CreatePixmap( screen, screen->width, screen->height, screen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP); } SetRootClip(screen, xwl_screen->root_clip_mode); return screen->devPrivate != NULL; } int glamor_egl_fd_name_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { return 0; } void xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream) { #ifdef GLAMOR_HAS_GBM xwl_glamor_init_gbm(xwl_screen); if (!xwl_screen->gbm_backend.is_available && !use_eglstream) ErrorF("xwayland glamor: GBM backend (default) is not available\n"); #endif #ifdef XWL_HAS_EGLSTREAM xwl_glamor_init_eglstream(xwl_screen); if (!xwl_screen->eglstream_backend.is_available && use_eglstream) ErrorF("xwayland glamor: EGLStream backend requested but not available\n"); #endif } static Bool xwl_glamor_select_gbm_backend(struct xwl_screen *xwl_screen) { #ifdef GLAMOR_HAS_GBM if (xwl_screen->gbm_backend.is_available && xwl_glamor_has_wl_interfaces(xwl_screen, &xwl_screen->gbm_backend)) { xwl_screen->egl_backend = &xwl_screen->gbm_backend; return TRUE; } else ErrorF("Missing Wayland requirements for glamor GBM backend\n"); #endif return FALSE; } static Bool xwl_glamor_select_eglstream_backend(struct xwl_screen *xwl_screen) { #ifdef XWL_HAS_EGLSTREAM if (xwl_screen->eglstream_backend.is_available && xwl_glamor_has_wl_interfaces(xwl_screen, &xwl_screen->eglstream_backend)) { ErrorF("glamor: Using nvidia's EGLStream interface, direct rendering impossible.\n"); ErrorF("glamor: Performance may be affected. Ask your vendor to support GBM!\n"); xwl_screen->egl_backend = &xwl_screen->eglstream_backend; return TRUE; } else ErrorF("Missing Wayland requirements for glamor EGLStream backend\n"); #endif return FALSE; } void xwl_glamor_select_backend(struct xwl_screen *xwl_screen, Bool use_eglstream) { if (use_eglstream) { if (!xwl_glamor_select_eglstream_backend(xwl_screen)) xwl_glamor_select_gbm_backend(xwl_screen); } else { if (!xwl_glamor_select_gbm_backend(xwl_screen)) xwl_glamor_select_eglstream_backend(xwl_screen); } } Bool xwl_glamor_init(struct xwl_screen *xwl_screen) { ScreenPtr screen = xwl_screen->screen; const char *no_glamor_env; no_glamor_env = getenv("XWAYLAND_NO_GLAMOR"); if (no_glamor_env && *no_glamor_env != '0') { ErrorF("Disabling glamor and dri3 support, XWAYLAND_NO_GLAMOR is set\n"); return FALSE; } if (!xwl_screen->egl_backend->init_egl(xwl_screen)) { ErrorF("EGL setup failed, disabling glamor\n"); return FALSE; } if (!glamor_init(xwl_screen->screen, GLAMOR_USE_EGL_SCREEN)) { ErrorF("Failed to initialize glamor\n"); return FALSE; } if (!xwl_screen->egl_backend->init_screen(xwl_screen)) { ErrorF("EGL backend init_screen() failed, disabling glamor\n"); return FALSE; } xwl_screen->CreateScreenResources = screen->CreateScreenResources; screen->CreateScreenResources = xwl_glamor_create_screen_resources; #ifdef XV if (!xwl_glamor_xv_init(screen)) ErrorF("Failed to initialize glamor Xv extension\n"); #endif return TRUE; } xorg-server-1.20.8/hw/xwayland/xwayland-cursor.c0000644000175000017500000002226713640201473016572 00000000000000/* * Copyright © 2014 Intel Corporation * Copyright © 2011 Kristian Høgsberg * * 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 "xwayland.h" #include static DevPrivateKeyRec xwl_cursor_private_key; static void expand_source_and_mask(CursorPtr cursor, CARD32 *data) { CARD32 *p, d, fg, bg; CursorBitsPtr bits = cursor->bits; int x, y, stride, i, bit; p = data; fg = ((cursor->foreRed & 0xff00) << 8) | (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8); bg = ((cursor->backRed & 0xff00) << 8) | (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8); stride = BitmapBytePad(bits->width); for (y = 0; y < bits->height; y++) for (x = 0; x < bits->width; x++) { i = y * stride + x / 8; bit = 1 << (x & 7); if (bits->source[i] & bit) d = fg; else d = bg; if (bits->mask[i] & bit) d |= 0xff000000; else d = 0x00000000; *p++ = d; } } static Bool xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) { PixmapPtr pixmap; pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width, cursor->bits->height, 32, 0); dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap); return TRUE; } static Bool xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) { PixmapPtr pixmap; struct xwl_screen *xwl_screen; struct xwl_seat *xwl_seat; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); if (!pixmap) return TRUE; dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, NULL); /* When called from FreeCursor(), device is always NULL */ xwl_screen = xwl_screen_get(screen); xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) { if (cursor == xwl_seat->x_cursor) xwl_seat->x_cursor = NULL; } return xwl_shm_destroy_pixmap(pixmap); } static void clear_cursor_frame_callback(struct xwl_cursor *xwl_cursor) { if (xwl_cursor->frame_cb) { wl_callback_destroy (xwl_cursor->frame_cb); xwl_cursor->frame_cb = NULL; } } static void frame_callback(void *data, struct wl_callback *callback, uint32_t time) { struct xwl_cursor *xwl_cursor = data; clear_cursor_frame_callback(xwl_cursor); if (xwl_cursor->needs_update) { xwl_cursor->needs_update = FALSE; xwl_cursor->update_proc(xwl_cursor); } } static const struct wl_callback_listener frame_listener = { frame_callback }; void xwl_seat_set_cursor(struct xwl_seat *xwl_seat) { struct xwl_cursor *xwl_cursor = &xwl_seat->cursor; PixmapPtr pixmap; CursorPtr cursor; int stride; if (!xwl_seat->wl_pointer) return; if (!xwl_seat->x_cursor) { wl_pointer_set_cursor(xwl_seat->wl_pointer, xwl_seat->pointer_enter_serial, NULL, 0, 0); clear_cursor_frame_callback(xwl_cursor); xwl_cursor->needs_update = FALSE; return; } if (xwl_cursor->frame_cb) { xwl_cursor->needs_update = TRUE; return; } cursor = xwl_seat->x_cursor; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); if (!pixmap) return; stride = cursor->bits->width * 4; if (cursor->bits->argb) memcpy(pixmap->devPrivate.ptr, cursor->bits->argb, cursor->bits->height * stride); else expand_source_and_mask(cursor, pixmap->devPrivate.ptr); wl_pointer_set_cursor(xwl_seat->wl_pointer, xwl_seat->pointer_enter_serial, xwl_cursor->surface, xwl_seat->x_cursor->bits->xhot, xwl_seat->x_cursor->bits->yhot); wl_surface_attach(xwl_cursor->surface, xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0); wl_surface_damage(xwl_cursor->surface, 0, 0, xwl_seat->x_cursor->bits->width, xwl_seat->x_cursor->bits->height); xwl_cursor->frame_cb = wl_surface_frame(xwl_cursor->surface); wl_callback_add_listener(xwl_cursor->frame_cb, &frame_listener, xwl_cursor); wl_surface_commit(xwl_cursor->surface); } void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool) { struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; struct xwl_cursor *xwl_cursor = &xwl_tablet_tool->cursor; PixmapPtr pixmap; CursorPtr cursor; int stride; if (!xwl_seat->x_cursor) { zwp_tablet_tool_v2_set_cursor(xwl_tablet_tool->tool, xwl_tablet_tool->proximity_in_serial, NULL, 0, 0); clear_cursor_frame_callback(xwl_cursor); xwl_cursor->needs_update = FALSE; return; } if (xwl_cursor->frame_cb) { xwl_cursor->needs_update = TRUE; return; } cursor = xwl_seat->x_cursor; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); if (!pixmap) return; stride = cursor->bits->width * 4; if (cursor->bits->argb) memcpy(pixmap->devPrivate.ptr, cursor->bits->argb, cursor->bits->height * stride); else expand_source_and_mask(cursor, pixmap->devPrivate.ptr); zwp_tablet_tool_v2_set_cursor(xwl_tablet_tool->tool, xwl_tablet_tool->proximity_in_serial, xwl_cursor->surface, xwl_seat->x_cursor->bits->xhot, xwl_seat->x_cursor->bits->yhot); wl_surface_attach(xwl_cursor->surface, xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0); wl_surface_damage(xwl_cursor->surface, 0, 0, xwl_seat->x_cursor->bits->width, xwl_seat->x_cursor->bits->height); xwl_cursor->frame_cb = wl_surface_frame(xwl_cursor->surface); wl_callback_add_listener(xwl_cursor->frame_cb, &frame_listener, xwl_cursor); wl_surface_commit(xwl_cursor->surface); } static void xwl_set_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor, int x, int y) { struct xwl_seat *xwl_seat; struct xwl_tablet_tool *xwl_tablet_tool; Bool cursor_visibility_changed; xwl_seat = device->public.devicePrivate; if (xwl_seat == NULL) return; cursor_visibility_changed = !!xwl_seat->x_cursor ^ !!cursor; xwl_seat->x_cursor = cursor; if (cursor_visibility_changed) xwl_seat_cursor_visibility_changed(xwl_seat); xwl_seat_set_cursor(xwl_seat); xorg_list_for_each_entry(xwl_tablet_tool, &xwl_seat->tablet_tools, link) { if (xwl_tablet_tool->proximity_in_serial != 0) xwl_tablet_tool_set_cursor(xwl_tablet_tool); } } static void xwl_move_cursor(DeviceIntPtr device, ScreenPtr screen, int x, int y) { } static Bool xwl_device_cursor_initialize(DeviceIntPtr device, ScreenPtr screen) { return TRUE; } static void xwl_device_cursor_cleanup(DeviceIntPtr device, ScreenPtr screen) { } static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = { xwl_realize_cursor, xwl_unrealize_cursor, xwl_set_cursor, xwl_move_cursor, xwl_device_cursor_initialize, xwl_device_cursor_cleanup }; static Bool xwl_cursor_off_screen(ScreenPtr *ppScreen, int *x, int *y) { return FALSE; } static void xwl_cross_screen(ScreenPtr pScreen, Bool entering) { } static void xwl_pointer_warp_cursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { miPointerWarpCursor(pDev, pScreen, x, y); } static miPointerScreenFuncRec xwl_pointer_screen_funcs = { xwl_cursor_off_screen, xwl_cross_screen, xwl_pointer_warp_cursor }; Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen) { if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR_BITS, 0)) return FALSE; return miPointerInitialize(xwl_screen->screen, &xwl_pointer_sprite_funcs, &xwl_pointer_screen_funcs, TRUE); } xorg-server-1.20.8/hw/xwayland/xwayland-vidmode.c0000644000175000017500000002447013640201473016702 00000000000000/* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "os.h" #include "extinit.h" #ifdef XF86VIDMODE #include "xwayland.h" #include "randrstr.h" #include "vidmodestr.h" static DevPrivateKeyRec xwlVidModePrivateKeyRec; #define xwlVidModePrivateKey (&xwlVidModePrivateKeyRec) /* Taken from xrandr, h sync frequency in KHz */ static double mode_hsync(const xRRModeInfo *mode_info) { double rate; if (mode_info->hTotal) rate = (double) mode_info->dotClock / (double) mode_info->hTotal; else rate = 0.0; return rate / 1000.0; } /* Taken from xrandr, v refresh frequency in Hz */ static double mode_refresh(const xRRModeInfo *mode_info) { double rate; double vTotal = mode_info->vTotal; if (mode_info->modeFlags & RR_DoubleScan) vTotal *= 2.0; if (mode_info->modeFlags & RR_Interlace) vTotal /= 2.0; if (mode_info->hTotal > 0.0 && vTotal > 0.0) rate = ((double) mode_info->dotClock / ((double) mode_info->hTotal * (double) vTotal)); else rate = 0.0; return rate; } static Bool xwlVidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock) { DisplayModePtr pMod; RROutputPtr output; RRCrtcPtr crtc; xRRModeInfo rrmode; pMod = dixLookupPrivate(&pScreen->devPrivates, xwlVidModePrivateKey); if (pMod == NULL) return FALSE; output = RRFirstOutput(pScreen); if (output == NULL) return FALSE; crtc = output->crtc; if (crtc == NULL) return FALSE; rrmode = crtc->mode->mode; pMod->next = pMod; pMod->prev = pMod; pMod->name = ""; pMod->VScan = 1; pMod->Private = NULL; pMod->HDisplay = rrmode.width; pMod->HSyncStart = rrmode.hSyncStart; pMod->HSyncEnd = rrmode.hSyncEnd; pMod->HTotal = rrmode.hTotal; pMod->HSkew = rrmode.hSkew; pMod->VDisplay = rrmode.height; pMod->VSyncStart = rrmode.vSyncStart; pMod->VSyncEnd = rrmode.vSyncEnd; pMod->VTotal = rrmode.vTotal; pMod->Flags = rrmode.modeFlags; pMod->Clock = rrmode.dotClock / 1000.0; pMod->VRefresh = mode_refresh(&rrmode); /* Or RRVerticalRefresh() */ pMod->HSync = mode_hsync(&rrmode); *mode = pMod; if (dotClock != NULL) *dotClock = rrmode.dotClock / 1000.0; return TRUE; } static vidMonitorValue xwlVidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx) { vidMonitorValue ret = { NULL, }; DisplayModePtr pMod; if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL)) return ret; switch (valtyp) { case VIDMODE_MON_VENDOR: ret.ptr = XVENDORNAME; break; case VIDMODE_MON_MODEL: ret.ptr = "XWAYLAND"; break; case VIDMODE_MON_NHSYNC: ret.i = 1; break; case VIDMODE_MON_NVREFRESH: ret.i = 1; break; case VIDMODE_MON_HSYNC_LO: case VIDMODE_MON_HSYNC_HI: ret.f = 100.0 * pMod->HSync; break; case VIDMODE_MON_VREFRESH_LO: case VIDMODE_MON_VREFRESH_HI: ret.f = 100.0 * pMod->VRefresh; break; } return ret; } static int xwlVidModeGetDotClock(ScreenPtr pScreen, int Clock) { DisplayModePtr pMod; if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL)) return 0; return pMod->Clock; } static int xwlVidModeGetNumOfClocks(ScreenPtr pScreen, Bool *progClock) { return 1; } static Bool xwlVidModeGetClocks(ScreenPtr pScreen, int *Clocks) { *Clocks = xwlVidModeGetDotClock(pScreen, 0); return TRUE; } static Bool xwlVidModeGetNextModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock) { return FALSE; } static Bool xwlVidModeGetFirstModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock) { return xwlVidModeGetCurrentModeline(pScreen, mode, dotClock); } static Bool xwlVidModeDeleteModeline(ScreenPtr pScreen, DisplayModePtr mode) { /* Unsupported */ return FALSE; } static Bool xwlVidModeZoomViewport(ScreenPtr pScreen, int zoom) { /* Support only no zoom */ return (zoom == 1); } static Bool xwlVidModeSetViewPort(ScreenPtr pScreen, int x, int y) { RROutputPtr output; RRCrtcPtr crtc; output = RRFirstOutput(pScreen); if (output == NULL) return FALSE; crtc = output->crtc; if (crtc == NULL) return FALSE; /* Support only default viewport */ return (x == crtc->x && y == crtc->y); } static Bool xwlVidModeGetViewPort(ScreenPtr pScreen, int *x, int *y) { RROutputPtr output; RRCrtcPtr crtc; output = RRFirstOutput(pScreen); if (output == NULL) return FALSE; crtc = output->crtc; if (crtc == NULL) return FALSE; *x = crtc->x; *y = crtc->y; return TRUE; } static Bool xwlVidModeSwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { /* Unsupported for now */ return FALSE; } static Bool xwlVidModeLockZoom(ScreenPtr pScreen, Bool lock) { /* Unsupported for now, but pretend it works */ return TRUE; } static ModeStatus xwlVidModeCheckModeForMonitor(ScreenPtr pScreen, DisplayModePtr mode) { DisplayModePtr pMod; /* This should not happen */ if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL)) return MODE_ERROR; /* Only support mode with the same HSync/VRefresh as we advertise */ if (mode->HSync == pMod->HSync && mode->VRefresh == pMod->VRefresh) return MODE_OK; /* All the rest is unsupported - If we want to succeed, return MODE_OK instead */ return MODE_ONE_SIZE; } static ModeStatus xwlVidModeCheckModeForDriver(ScreenPtr pScreen, DisplayModePtr mode) { DisplayModePtr pMod; /* This should not happen */ if (!xwlVidModeGetCurrentModeline(pScreen, &pMod, NULL)) return MODE_ERROR; if (mode->HTotal != pMod->HTotal) return MODE_BAD_HVALUE; if (mode->VTotal != pMod->VTotal) return MODE_BAD_VVALUE; /* Unsupported for now, but pretend it works */ return MODE_OK; } static void xwlVidModeSetCrtcForMode(ScreenPtr pScreen, DisplayModePtr mode) { /* Unsupported */ return; } static Bool xwlVidModeAddModeline(ScreenPtr pScreen, DisplayModePtr mode) { /* Unsupported */ return FALSE; } static int xwlVidModeGetNumOfModes(ScreenPtr pScreen) { /* We have only one mode */ return 1; } static Bool xwlVidModeSetGamma(ScreenPtr pScreen, float red, float green, float blue) { /* Unsupported for now, but pretend it works */ return TRUE; } static Bool xwlVidModeGetGamma(ScreenPtr pScreen, float *red, float *green, float *blue) { /* Unsupported for now, but pretend it works */ return TRUE; } static Bool xwlVidModeSetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b) { /* Unsupported for now */ return FALSE; } static Bool xwlVidModeGetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b) { /* Unsupported for now */ return FALSE; } static int xwlVidModeGetGammaRampSize(ScreenPtr pScreen) { /* Unsupported for now */ return 0; } static Bool xwlVidModeInit(ScreenPtr pScreen) { VidModePtr pVidMode = NULL; pVidMode = VidModeInit(pScreen); if (!pVidMode) return FALSE; pVidMode->Flags = 0; pVidMode->Next = NULL; pVidMode->GetMonitorValue = xwlVidModeGetMonitorValue; pVidMode->GetCurrentModeline = xwlVidModeGetCurrentModeline; pVidMode->GetFirstModeline = xwlVidModeGetFirstModeline; pVidMode->GetNextModeline = xwlVidModeGetNextModeline; pVidMode->DeleteModeline = xwlVidModeDeleteModeline; pVidMode->ZoomViewport = xwlVidModeZoomViewport; pVidMode->GetViewPort = xwlVidModeGetViewPort; pVidMode->SetViewPort = xwlVidModeSetViewPort; pVidMode->SwitchMode = xwlVidModeSwitchMode; pVidMode->LockZoom = xwlVidModeLockZoom; pVidMode->GetNumOfClocks = xwlVidModeGetNumOfClocks; pVidMode->GetClocks = xwlVidModeGetClocks; pVidMode->CheckModeForMonitor = xwlVidModeCheckModeForMonitor; pVidMode->CheckModeForDriver = xwlVidModeCheckModeForDriver; pVidMode->SetCrtcForMode = xwlVidModeSetCrtcForMode; pVidMode->AddModeline = xwlVidModeAddModeline; pVidMode->GetDotClock = xwlVidModeGetDotClock; pVidMode->GetNumOfModes = xwlVidModeGetNumOfModes; pVidMode->SetGamma = xwlVidModeSetGamma; pVidMode->GetGamma = xwlVidModeGetGamma; pVidMode->SetGammaRamp = xwlVidModeSetGammaRamp; pVidMode->GetGammaRamp = xwlVidModeGetGammaRamp; pVidMode->GetGammaRampSize = xwlVidModeGetGammaRampSize; return TRUE; } void xwlVidModeExtensionInit(void) { int i; Bool enabled = FALSE; for (i = 0; i < screenInfo.numScreens; i++) { if (xwlVidModeInit (screenInfo.screens[i])) enabled = TRUE; } /* This means that the DDX doesn't want the vidmode extension enabled */ if (!enabled) return; if (!dixRegisterPrivateKey(xwlVidModePrivateKey, PRIVATE_SCREEN, sizeof(DisplayModeRec))) return; VidModeAddExtension(FALSE); } #endif /* XF86VIDMODE */ xorg-server-1.20.8/hw/xwayland/xwayland-shm.c0000644000175000017500000001762113640201473016042 00000000000000/* * Copyright © 2014 Intel Corporation * Copyright © 2012 Collabora, Ltd. * * 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_DIX_CONFIG_H #include #endif #include "os.h" #include "xwayland.h" #include #include #include #include #include #include #include struct xwl_pixmap { struct wl_buffer *buffer; void *data; size_t size; }; #ifndef HAVE_MKOSTEMP static int set_cloexec_or_close(int fd) { long flags; if (fd == -1) return -1; flags = fcntl(fd, F_GETFD); if (flags == -1) goto err; if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) goto err; return fd; err: close(fd); return -1; } #endif static int create_tmpfile_cloexec(char *tmpname) { int fd; #ifdef HAVE_MKOSTEMP fd = mkostemp(tmpname, O_CLOEXEC); if (fd >= 0) unlink(tmpname); #else fd = mkstemp(tmpname); if (fd >= 0) { fd = set_cloexec_or_close(fd); unlink(tmpname); } #endif return os_move_fd(fd); } /* * Create a new, unique, anonymous file of the given size, and * return the file descriptor for it. The file descriptor is set * CLOEXEC. The file is immediately suitable for mmap()'ing * the given size at offset zero. * * The file should not have a permanent backing store like a disk, * but may have if XDG_RUNTIME_DIR is not properly implemented in OS. * * The file name is deleted from the file system. * * The file is suitable for buffer sharing between processes by * transmitting the file descriptor over Unix sockets using the * SCM_RIGHTS methods. * * If the C library implements posix_fallocate(), it is used to * guarantee that disk space is available for the file at the * given size. If disk space is insufficent, errno is set to ENOSPC. * If posix_fallocate() is not supported, program may receive * SIGBUS on accessing mmap()'ed file contents instead. */ static int os_create_anonymous_file(off_t size) { static const char template[] = "/xwayland-shared-XXXXXX"; const char *path; char *name; int fd; int ret; path = getenv("XDG_RUNTIME_DIR"); if (!path) { errno = ENOENT; return -1; } name = malloc(strlen(path) + sizeof(template)); if (!name) return -1; strcpy(name, path); strcat(name, template); fd = create_tmpfile_cloexec(name); free(name); if (fd < 0) return -1; #ifdef HAVE_POSIX_FALLOCATE /* * posix_fallocate does an explicit rollback if it gets EINTR. * Temporarily block signals to allow the call to succeed on * slow systems where the smart scheduler's SIGALRM prevents * large allocation attempts from ever succeeding. */ OsBlockSignals(); do { ret = posix_fallocate(fd, 0, size); } while (ret == EINTR); OsReleaseSignals(); if (ret != 0) { close(fd); errno = ret; return -1; } #else do { ret = ftruncate(fd, size); } while (ret == -1 && errno == EINTR); if (ret < 0) { close(fd); return -1; } #endif return fd; } static uint32_t shm_format_for_depth(int depth) { switch (depth) { case 32: return WL_SHM_FORMAT_ARGB8888; case 24: default: return WL_SHM_FORMAT_XRGB8888; #ifdef WL_SHM_FORMAT_RGB565 case 16: /* XXX: Check run-time protocol version too */ return WL_SHM_FORMAT_RGB565; #endif } } PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height, int depth, unsigned int hint) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_pixmap *xwl_pixmap; struct wl_shm_pool *pool; PixmapPtr pixmap; size_t size, stride; uint32_t format; int fd; if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE || (width == 0 && height == 0) || depth < 15) return fbCreatePixmap(screen, width, height, depth, hint); pixmap = fbCreatePixmap(screen, 0, 0, depth, hint); if (!pixmap) return NULL; xwl_pixmap = malloc(sizeof *xwl_pixmap); if (xwl_pixmap == NULL) goto err_destroy_pixmap; stride = PixmapBytePad(width, depth); size = stride * height; xwl_pixmap->buffer = NULL; xwl_pixmap->size = size; fd = os_create_anonymous_file(size); if (fd < 0) goto err_free_xwl_pixmap; xwl_pixmap->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (xwl_pixmap->data == MAP_FAILED) goto err_close_fd; if (!(*screen->ModifyPixmapHeader) (pixmap, width, height, depth, BitsPerPixel(depth), stride, xwl_pixmap->data)) goto err_munmap; format = shm_format_for_depth(pixmap->drawable.depth); pool = wl_shm_create_pool(xwl_screen->shm, fd, xwl_pixmap->size); xwl_pixmap->buffer = wl_shm_pool_create_buffer(pool, 0, pixmap->drawable.width, pixmap->drawable.height, pixmap->devKind, format); wl_shm_pool_destroy(pool); close(fd); xwl_pixmap_set_private(pixmap, xwl_pixmap); return pixmap; err_munmap: munmap(xwl_pixmap->data, size); err_close_fd: close(fd); err_free_xwl_pixmap: free(xwl_pixmap); err_destroy_pixmap: fbDestroyPixmap(pixmap); return NULL; } Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap) { struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); if (xwl_pixmap && pixmap->refcnt == 1) { if (xwl_pixmap->buffer) wl_buffer_destroy(xwl_pixmap->buffer); munmap(xwl_pixmap->data, xwl_pixmap->size); free(xwl_pixmap); } return fbDestroyPixmap(pixmap); } struct wl_buffer * xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap) { return xwl_pixmap_get(pixmap)->buffer; } Bool xwl_shm_create_screen_resources(ScreenPtr screen) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); int ret; screen->CreateScreenResources = xwl_screen->CreateScreenResources; ret = (*screen->CreateScreenResources) (screen); xwl_screen->CreateScreenResources = screen->CreateScreenResources; screen->CreateScreenResources = xwl_shm_create_screen_resources; if (!ret) return ret; if (xwl_screen->rootless) screen->devPrivate = fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); else screen->devPrivate = xwl_shm_create_pixmap(screen, screen->width, screen->height, screen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP); SetRootClip(screen, xwl_screen->root_clip_mode); return screen->devPrivate != NULL; } xorg-server-1.20.8/hw/xwayland/xwayland.h0000644000175000017500000003502413640201473015257 00000000000000/* * Copyright © 2014 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. */ #ifndef XWAYLAND_H #define XWAYLAND_H #include #include #include #include #include #include #include #include #include #include #include #include "relative-pointer-unstable-v1-client-protocol.h" #include "pointer-constraints-unstable-v1-client-protocol.h" #include "tablet-unstable-v2-client-protocol.h" #include "xwayland-keyboard-grab-unstable-v1-client-protocol.h" #include "xdg-output-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h" struct xwl_format { uint32_t format; int num_modifiers; uint64_t *modifiers; }; struct xwl_pixmap; struct xwl_window; struct xwl_screen; struct xwl_egl_backend { /* Set by the backend if available */ Bool is_available; /* Called once for each interface in the global registry. Backends * should use this to bind to any wayland interfaces they need. */ Bool (*init_wl_registry)(struct xwl_screen *xwl_screen, struct wl_registry *wl_registry, uint32_t id, const char *name, uint32_t version); /* Check that the required Wayland interfaces are available. */ Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen); /* Called before glamor has been initialized. Backends should setup a * valid, glamor compatible EGL context in this hook. */ Bool (*init_egl)(struct xwl_screen *xwl_screen); /* Called after glamor has been initialized, and after all of the * common Xwayland DDX hooks have been connected. Backends should use * this to setup any required wraps around X server callbacks like * CreatePixmap. */ Bool (*init_screen)(struct xwl_screen *xwl_screen); /* Called by Xwayland to retrieve a pointer to a valid wl_buffer for * the given window/pixmap combo so that damage to the pixmap may be * displayed on-screen. Backends should use this to create a new * wl_buffer for a currently buffer-less pixmap, or simply return the * pixmap they've prepared beforehand. */ struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap, Bool *created); /* Called by Xwayland to perform any pre-wl_surface damage routines * that are required by the backend. If your backend is poorly * designed and lacks the ability to render directly to a surface, * you should implement blitting from the glamor pixmap to the wayland * pixmap here. Otherwise, this callback is optional. */ void (*post_damage)(struct xwl_window *xwl_window, PixmapPtr pixmap, RegionPtr region); /* Called by Xwayland to confirm with the egl backend that the given * pixmap is completely setup and ready for display on-screen. This * callback is optional. */ Bool (*allow_commits)(struct xwl_window *xwl_window); }; struct xwl_screen { int width; int height; int depth; ScreenPtr screen; int expecting_event; enum RootClipMode root_clip_mode; int wm_fd; int listen_fds[5]; int listen_fd_count; int rootless; int glamor; int present; CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; DestroyWindowProcPtr DestroyWindow; XYToWindowProcPtr XYToWindow; SetWindowPixmapProcPtr SetWindowPixmap; struct xorg_list output_list; struct xorg_list seat_list; struct xorg_list damage_window_list; int wayland_fd; struct wl_display *display; struct wl_registry *registry; struct wl_registry *input_registry; struct wl_compositor *compositor; struct zwp_tablet_manager_v2 *tablet_manager; struct wl_shm *shm; struct wl_shell *shell; struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; struct zwp_pointer_constraints_v1 *pointer_constraints; struct zwp_xwayland_keyboard_grab_manager_v1 *wp_grab; struct zxdg_output_manager_v1 *xdg_output_manager; uint32_t serial; #define XWL_FORMAT_ARGB8888 (1 << 0) #define XWL_FORMAT_XRGB8888 (1 << 1) #define XWL_FORMAT_RGB565 (1 << 2) int prepare_read; int wait_flush; uint32_t num_formats; struct xwl_format *formats; void *egl_display, *egl_context; struct xwl_egl_backend gbm_backend; struct xwl_egl_backend eglstream_backend; /* pointer to the current backend for creating pixmaps on wayland */ struct xwl_egl_backend *egl_backend; struct glamor_context *glamor_ctx; Atom allow_commits_prop; }; struct xwl_window { struct xwl_screen *xwl_screen; struct wl_surface *surface; struct wl_shell_surface *shell_surface; WindowPtr window; struct xorg_list link_damage; struct wl_callback *frame_callback; Bool allow_commits; #ifdef GLAMOR_HAS_GBM struct xorg_list frame_callback_list; Bool present_flipped; #endif }; #ifdef GLAMOR_HAS_GBM struct xwl_present_window { struct xwl_screen *xwl_screen; struct xwl_present_event *sync_flip; WindowPtr window; struct xorg_list frame_callback_list; uint64_t msc; uint64_t ust; OsTimerPtr frame_timer; struct wl_callback *sync_callback; struct xorg_list event_list; struct xorg_list release_queue; }; struct xwl_present_event { uint64_t event_id; uint64_t target_msc; Bool abort; Bool pending; Bool buffer_released; struct xwl_present_window *xwl_present_window; struct wl_buffer *buffer; struct xorg_list list; }; #endif #define MODIFIER_META 0x01 struct xwl_touch { struct xwl_window *window; int32_t id; int x, y; struct xorg_list link_touch; }; struct xwl_pointer_warp_emulator { struct xwl_seat *xwl_seat; struct xwl_window *locked_window; struct zwp_locked_pointer_v1 *locked_pointer; }; struct xwl_cursor { void (* update_proc) (struct xwl_cursor *); struct wl_surface *surface; struct wl_callback *frame_cb; Bool needs_update; }; struct xwl_seat { DeviceIntPtr pointer; DeviceIntPtr relative_pointer; DeviceIntPtr keyboard; DeviceIntPtr touch; DeviceIntPtr stylus; DeviceIntPtr eraser; DeviceIntPtr puck; struct xwl_screen *xwl_screen; struct wl_seat *seat; struct wl_pointer *wl_pointer; struct zwp_relative_pointer_v1 *wp_relative_pointer; struct wl_keyboard *wl_keyboard; struct wl_touch *wl_touch; struct zwp_tablet_seat_v2 *tablet_seat; struct wl_array keys; struct xwl_window *focus_window; struct xwl_window *tablet_focus_window; uint32_t id; uint32_t pointer_enter_serial; struct xorg_list link; CursorPtr x_cursor; struct xwl_cursor cursor; WindowPtr last_xwindow; struct xorg_list touches; size_t keymap_size; char *keymap; struct wl_surface *keyboard_focus; struct xorg_list axis_discrete_pending; struct xorg_list sync_pending; struct xwl_pointer_warp_emulator *pointer_warp_emulator; struct xwl_window *cursor_confinement_window; struct zwp_confined_pointer_v1 *confined_pointer; struct { Bool has_absolute; wl_fixed_t x; wl_fixed_t y; Bool has_relative; double dx; double dy; double dx_unaccel; double dy_unaccel; } pending_pointer_event; struct xorg_list tablets; struct xorg_list tablet_tools; struct xorg_list tablet_pads; struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab; }; struct xwl_tablet { struct xorg_list link; struct zwp_tablet_v2 *tablet; struct xwl_seat *seat; }; struct xwl_tablet_tool { struct xorg_list link; struct zwp_tablet_tool_v2 *tool; struct xwl_seat *seat; DeviceIntPtr xdevice; uint32_t proximity_in_serial; double x; double y; uint32_t pressure; double tilt_x; double tilt_y; double rotation; double slider; uint32_t buttons_now, buttons_prev; int32_t wheel_clicks; struct xwl_cursor cursor; }; struct xwl_tablet_pad_ring { unsigned int index; struct xorg_list link; struct xwl_tablet_pad_group *group; struct zwp_tablet_pad_ring_v2 *ring; }; struct xwl_tablet_pad_strip { unsigned int index; struct xorg_list link; struct xwl_tablet_pad_group *group; struct zwp_tablet_pad_strip_v2 *strip; }; struct xwl_tablet_pad_group { struct xorg_list link; struct xwl_tablet_pad *pad; struct zwp_tablet_pad_group_v2 *group; struct xorg_list pad_group_ring_list; struct xorg_list pad_group_strip_list; }; struct xwl_tablet_pad { struct xorg_list link; struct zwp_tablet_pad_v2 *pad; struct xwl_seat *seat; DeviceIntPtr xdevice; unsigned int nbuttons; struct xorg_list pad_group_list; }; struct xwl_output { struct xorg_list link; struct wl_output *output; struct zxdg_output_v1 *xdg_output; uint32_t server_output_id; struct xwl_screen *xwl_screen; RROutputPtr randr_output; RRCrtcPtr randr_crtc; int32_t x, y, width, height, refresh; Rotation rotation; Bool wl_output_done; Bool xdg_output_done; }; void xwl_window_create_frame_callback(struct xwl_window *xwl_window); void xwl_sync_events (struct xwl_screen *xwl_screen); Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen); struct xwl_screen *xwl_screen_get(ScreenPtr screen); void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool); void xwl_seat_set_cursor(struct xwl_seat *xwl_seat); void xwl_seat_destroy(struct xwl_seat *xwl_seat); void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window); void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window, SpritePtr sprite, int x, int y); void xwl_seat_destroy_pointer_warp_emulator(struct xwl_seat *xwl_seat); void xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat); void xwl_seat_confine_pointer(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window); void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat); Bool xwl_screen_init_output(struct xwl_screen *xwl_screen); struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id); void xwl_output_destroy(struct xwl_output *xwl_output); void xwl_output_remove(struct xwl_output *xwl_output); RRModePtr xwayland_cvt(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced); void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap); struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap); struct xwl_window *xwl_window_from_window(WindowPtr window); Bool xwl_shm_create_screen_resources(ScreenPtr screen); PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height, int depth, unsigned int hint); Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap); struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap); #ifdef XWL_HAS_GLAMOR void xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream); void xwl_glamor_select_backend(struct xwl_screen *xwl_screen, Bool use_eglstream); Bool xwl_glamor_init(struct xwl_screen *xwl_screen); Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version); Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version); struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap, Bool *created); void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version); Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen, struct xwl_egl_backend *xwl_egl_backend); void xwl_glamor_post_damage(struct xwl_window *xwl_window, PixmapPtr pixmap, RegionPtr region); Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window); void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen); #ifdef GLAMOR_HAS_GBM void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window); Bool xwl_present_init(ScreenPtr screen); void xwl_present_cleanup(WindowPtr window); void xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window); #endif /* GLAMOR_HAS_GBM */ #ifdef XV /* glamor Xv Adaptor */ Bool xwl_glamor_xv_init(ScreenPtr pScreen); #endif /* XV */ #endif /* XWL_HAS_GLAMOR */ void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen); void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen); #ifdef XF86VIDMODE void xwlVidModeExtensionInit(void); #endif #ifdef GLAMOR_HAS_GBM void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen); #else static inline void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen) { } #endif #ifdef XWL_HAS_EGLSTREAM void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen); #else static inline void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen) { } #endif #endif xorg-server-1.20.8/hw/xwayland/xwayland-present.c0000644000175000017500000004211113640201473016723 00000000000000/* * Copyright © 2018 Roman Gilg * * 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 "xwayland.h" #include "glamor.h" #include /* * When not flipping let Present copy with 60fps. * When flipping wait on frame_callback, otherwise * the surface is not visible, in this case update * with long interval. */ #define TIMER_LEN_COPY 17 // ~60fps #define TIMER_LEN_FLIP 1000 // 1fps static DevPrivateKeyRec xwl_present_window_private_key; static struct xwl_present_window * xwl_present_window_priv(WindowPtr window) { return dixGetPrivate(&window->devPrivates, &xwl_present_window_private_key); } static struct xwl_present_window * xwl_present_window_get_priv(WindowPtr window) { struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window); if (xwl_present_window == NULL) { xwl_present_window = calloc (1, sizeof (struct xwl_present_window)); if (!xwl_present_window) return NULL; xwl_present_window->window = window; xwl_present_window->msc = 1; xwl_present_window->ust = GetTimeInMicros(); xorg_list_init(&xwl_present_window->frame_callback_list); xorg_list_init(&xwl_present_window->event_list); xorg_list_init(&xwl_present_window->release_queue); dixSetPrivate(&window->devPrivates, &xwl_present_window_private_key, xwl_present_window); } return xwl_present_window; } static void xwl_present_free_timer(struct xwl_present_window *xwl_present_window) { TimerFree(xwl_present_window->frame_timer); xwl_present_window->frame_timer = NULL; } static CARD32 xwl_present_timer_callback(OsTimerPtr timer, CARD32 time, void *arg); static inline Bool xwl_present_has_events(struct xwl_present_window *xwl_present_window) { return !!xwl_present_window->sync_flip || !xorg_list_is_empty(&xwl_present_window->event_list); } static void xwl_present_reset_timer(struct xwl_present_window *xwl_present_window) { if (xwl_present_has_events(xwl_present_window)) { CARD32 timeout; if (!xorg_list_is_empty(&xwl_present_window->frame_callback_list)) timeout = TIMER_LEN_FLIP; else timeout = TIMER_LEN_COPY; xwl_present_window->frame_timer = TimerSet(xwl_present_window->frame_timer, 0, timeout, &xwl_present_timer_callback, xwl_present_window); } else { xwl_present_free_timer(xwl_present_window); } } void xwl_present_cleanup(WindowPtr window) { struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window); struct xwl_present_event *event, *tmp; if (!xwl_present_window) return; xorg_list_del(&xwl_present_window->frame_callback_list); if (xwl_present_window->sync_callback) { wl_callback_destroy(xwl_present_window->sync_callback); xwl_present_window->sync_callback = NULL; } /* Clear remaining events */ xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) { xorg_list_del(&event->list); free(event); } /* Clear remaining buffer releases and inform Present about free ressources */ event = xwl_present_window->sync_flip; xwl_present_window->sync_flip = NULL; if (event) { if (event->buffer_released) { free(event); } else { event->pending = FALSE; event->abort = TRUE; } } xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list) { xorg_list_del(&event->list); event->abort = TRUE; } /* Clear timer */ xwl_present_free_timer(xwl_present_window); /* Remove from privates so we don't try to access it later */ dixSetPrivate(&window->devPrivates, &xwl_present_window_private_key, NULL); free(xwl_present_window); } static void xwl_present_free_event(struct xwl_present_event *event) { xorg_list_del(&event->list); free(event); } static void xwl_present_buffer_release(void *data, struct wl_buffer *buffer) { struct xwl_present_event *event = data; if (!event) return; wl_buffer_set_user_data(buffer, NULL); event->buffer_released = TRUE; if (event->abort) { if (!event->pending) xwl_present_free_event(event); return; } if (!event->pending) { present_wnmd_event_notify(event->xwl_present_window->window, event->event_id, event->xwl_present_window->ust, event->xwl_present_window->msc); xwl_present_free_event(event); } } static const struct wl_buffer_listener xwl_present_release_listener = { xwl_present_buffer_release }; static void xwl_present_msc_bump(struct xwl_present_window *xwl_present_window) { uint64_t msc = ++xwl_present_window->msc; struct xwl_present_event *event, *tmp; xwl_present_window->ust = GetTimeInMicros(); event = xwl_present_window->sync_flip; xwl_present_window->sync_flip = NULL; if (event) { event->pending = FALSE; present_wnmd_event_notify(xwl_present_window->window, event->event_id, xwl_present_window->ust, msc); if (event->buffer_released) { /* If the buffer was already released, clean up now */ present_wnmd_event_notify(xwl_present_window->window, event->event_id, xwl_present_window->ust, msc); free(event); } else { xorg_list_add(&event->list, &xwl_present_window->release_queue); } } xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) { if (event->target_msc <= msc) { present_wnmd_event_notify(xwl_present_window->window, event->event_id, xwl_present_window->ust, msc); xwl_present_free_event(event); } } } CARD32 xwl_present_timer_callback(OsTimerPtr timer, CARD32 time, void *arg) { struct xwl_present_window *xwl_present_window = arg; /* If we were expecting a frame callback for this window, it didn't arrive * in a second. Stop listening to it to avoid double-bumping the MSC */ xorg_list_del(&xwl_present_window->frame_callback_list); xwl_present_msc_bump(xwl_present_window); xwl_present_reset_timer(xwl_present_window); return 0; } void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window) { xorg_list_del(&xwl_present_window->frame_callback_list); xwl_present_msc_bump(xwl_present_window); /* we do not need the timer anymore for this frame, * reset it for potentially the next one */ xwl_present_reset_timer(xwl_present_window); } static void xwl_present_sync_callback(void *data, struct wl_callback *callback, uint32_t time) { struct xwl_present_event *event = data; struct xwl_present_window *xwl_present_window = event->xwl_present_window; wl_callback_destroy(xwl_present_window->sync_callback); xwl_present_window->sync_callback = NULL; event->pending = FALSE; if (event->abort) { /* Event might have been aborted */ if (event->buffer_released) /* Buffer was already released, cleanup now */ xwl_present_free_event(event); return; } present_wnmd_event_notify(xwl_present_window->window, event->event_id, xwl_present_window->ust, xwl_present_window->msc); if (event->buffer_released) { /* If the buffer was already released, send the event now again */ present_wnmd_event_notify(xwl_present_window->window, event->event_id, xwl_present_window->ust, xwl_present_window->msc); xwl_present_free_event(event); } } static const struct wl_callback_listener xwl_present_sync_listener = { xwl_present_sync_callback }; static RRCrtcPtr xwl_present_get_crtc(WindowPtr present_window) { struct xwl_present_window *xwl_present_window = xwl_present_window_get_priv(present_window); rrScrPrivPtr rr_private; if (xwl_present_window == NULL) return NULL; rr_private = rrGetScrPriv(present_window->drawable.pScreen); if (rr_private->numCrtcs == 0) return NULL; return rr_private->crtcs[0]; } static int xwl_present_get_ust_msc(WindowPtr present_window, uint64_t *ust, uint64_t *msc) { struct xwl_present_window *xwl_present_window = xwl_present_window_get_priv(present_window); if (!xwl_present_window) return BadAlloc; *ust = xwl_present_window->ust; *msc = xwl_present_window->msc; return Success; } /* * Queue an event to report back to the Present extension when the specified * MSC has past */ static int xwl_present_queue_vblank(WindowPtr present_window, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { struct xwl_present_window *xwl_present_window = xwl_present_window_get_priv(present_window); struct xwl_window *xwl_window = xwl_window_from_window(present_window); struct xwl_present_event *event; event = malloc(sizeof *event); if (!event) return BadAlloc; event->event_id = event_id; event->xwl_present_window = xwl_present_window; event->target_msc = msc; xorg_list_append(&event->list, &xwl_present_window->event_list); /* If there's a pending frame callback, use that */ if (xwl_window && xwl_window->frame_callback && xorg_list_is_empty(&xwl_present_window->frame_callback_list)) { xorg_list_add(&xwl_present_window->frame_callback_list, &xwl_window->frame_callback_list); } if ((xwl_window && xwl_window->frame_callback) || !xwl_present_window->frame_timer) xwl_present_reset_timer(xwl_present_window); return Success; } /* * Remove a pending vblank event so that it is not reported * to the extension */ static void xwl_present_abort_vblank(WindowPtr present_window, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { struct xwl_present_window *xwl_present_window = xwl_present_window_priv(present_window); struct xwl_present_event *event, *tmp; if (!xwl_present_window) return; xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) { if (event->event_id == event_id) { xorg_list_del(&event->list); free(event); return; } } xorg_list_for_each_entry(event, &xwl_present_window->release_queue, list) { if (event->event_id == event_id) { event->abort = TRUE; return; } } } static void xwl_present_flush(WindowPtr window) { glamor_block_handler(window->drawable.pScreen); } static Bool xwl_present_check_flip2(RRCrtcPtr crtc, WindowPtr present_window, PixmapPtr pixmap, Bool sync_flip, PresentFlipReason *reason) { struct xwl_window *xwl_window = xwl_window_from_window(present_window); if (!xwl_window) return FALSE; /* * We currently only allow flips of windows, that have the same * dimensions as their xwl_window parent window. For the case of * different sizes subsurfaces are presumably the way forward. */ if (!RegionEqual(&xwl_window->window->winSize, &present_window->winSize)) return FALSE; return TRUE; } static Bool xwl_present_flip(WindowPtr present_window, RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc, PixmapPtr pixmap, Bool sync_flip, RegionPtr damage) { struct xwl_window *xwl_window = xwl_window_from_window(present_window); struct xwl_present_window *xwl_present_window = xwl_present_window_priv(present_window); BoxPtr damage_box; Bool buffer_created; struct wl_buffer *buffer; struct xwl_present_event *event; if (!xwl_window) return FALSE; damage_box = RegionExtents(damage); event = malloc(sizeof *event); if (!event) return FALSE; buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, &buffer_created); event->event_id = event_id; event->xwl_present_window = xwl_present_window; event->buffer = buffer; event->target_msc = target_msc; event->pending = TRUE; event->abort = FALSE; event->buffer_released = FALSE; if (sync_flip) { xorg_list_init(&event->list); xwl_present_window->sync_flip = event; } else { xorg_list_add(&event->list, &xwl_present_window->release_queue); } if (buffer_created) wl_buffer_add_listener(buffer, &xwl_present_release_listener, NULL); wl_buffer_set_user_data(buffer, event); /* We can flip directly to the main surface (full screen window without clips) */ wl_surface_attach(xwl_window->surface, buffer, 0, 0); if (!xwl_window->frame_callback) xwl_window_create_frame_callback(xwl_window); if (xorg_list_is_empty(&xwl_present_window->frame_callback_list)) { xorg_list_add(&xwl_present_window->frame_callback_list, &xwl_window->frame_callback_list); } /* Realign timer */ xwl_present_reset_timer(xwl_present_window); wl_surface_damage(xwl_window->surface, 0, 0, damage_box->x2 - damage_box->x1, damage_box->y2 - damage_box->y1); wl_surface_commit(xwl_window->surface); if (!sync_flip) { xwl_present_window->sync_callback = wl_display_sync(xwl_window->xwl_screen->display); wl_callback_add_listener(xwl_present_window->sync_callback, &xwl_present_sync_listener, event); } wl_display_flush(xwl_window->xwl_screen->display); xwl_window->present_flipped = TRUE; return TRUE; } static void xwl_present_flips_stop(WindowPtr window) { struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window); /* Change back to the fast refresh rate */ xwl_present_reset_timer(xwl_present_window); } void xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window) { /* The pending frame callback may never be called, so drop it and shorten * the frame timer interval. */ xorg_list_del(&xwl_present_window->frame_callback_list); xwl_present_reset_timer(xwl_present_window); } static present_wnmd_info_rec xwl_present_info = { .version = PRESENT_SCREEN_INFO_VERSION, .get_crtc = xwl_present_get_crtc, .get_ust_msc = xwl_present_get_ust_msc, .queue_vblank = xwl_present_queue_vblank, .abort_vblank = xwl_present_abort_vblank, .flush = xwl_present_flush, .capabilities = PresentCapabilityAsync, .check_flip2 = xwl_present_check_flip2, .flip = xwl_present_flip, .flips_stop = xwl_present_flips_stop }; Bool xwl_present_init(ScreenPtr screen) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); /* * doesn't work with the EGLStream backend. */ if (xwl_screen->egl_backend == &xwl_screen->eglstream_backend) return FALSE; if (!dixRegisterPrivateKey(&xwl_present_window_private_key, PRIVATE_WINDOW, 0)) return FALSE; return present_wnmd_screen_init(screen, &xwl_present_info); } xorg-server-1.20.8/hw/xwayland/xwayland-input.c0000644000175000017500000025332413640201473016414 00000000000000/* * Copyright © 2014 Intel Corporation * Copyright © 2008 Kristian Høgsberg * * 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 "xwayland.h" #include #include #include #include #include #include #include #include #include "tablet-unstable-v2-client-protocol.h" struct axis_discrete_pending { struct xorg_list l; uint32_t axis; int32_t discrete; }; struct sync_pending { struct xorg_list l; DeviceIntPtr pending_dev; }; static void xwl_pointer_warp_emulator_handle_motion(struct xwl_pointer_warp_emulator *warp_emulator, double dx, double dy, double dx_unaccel, double dy_unaccel); static void xwl_pointer_warp_emulator_maybe_lock(struct xwl_pointer_warp_emulator *warp_emulator, struct xwl_window *xwl_window, SpritePtr sprite, int x, int y); static void xwl_seat_destroy_confined_pointer(struct xwl_seat *xwl_seat); static void init_tablet_manager_seat(struct xwl_screen *xwl_screen, struct xwl_seat *xwl_seat); static void release_tablet_manager_seat(struct xwl_seat *xwl_seat); static void xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl) { /* Nothing to do, dix handles all settings */ } static Bool init_pointer_buttons(DeviceIntPtr device) { #define NBUTTONS 10 BYTE map[NBUTTONS + 1]; int i = 0; Atom btn_labels[NBUTTONS] = { 0 }; for (i = 1; i <= NBUTTONS; i++) map[i] = i; btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); /* don't know about the rest */ if (!InitButtonClassDeviceStruct(device, NBUTTONS, btn_labels, map)) return FALSE; return TRUE; } static int xwl_pointer_proc(DeviceIntPtr device, int what) { #define NAXES 4 Atom axes_labels[NAXES] = { 0 }; switch (what) { case DEVICE_INIT: device->public.on = FALSE; if (!init_pointer_buttons(device)) return BadValue; axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL); axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL); if (!InitValuatorClassDeviceStruct(device, NAXES, axes_labels, GetMotionHistorySize(), Absolute)) return BadValue; /* Valuators */ InitValuatorAxisStruct(device, 0, axes_labels[0], 0, 0xFFFF, 10000, 0, 10000, Absolute); InitValuatorAxisStruct(device, 1, axes_labels[1], 0, 0xFFFF, 10000, 0, 10000, Absolute); InitValuatorAxisStruct(device, 2, axes_labels[2], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative); InitValuatorAxisStruct(device, 3, axes_labels[3], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative); SetScrollValuator(device, 2, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE); SetScrollValuator(device, 3, SCROLL_TYPE_VERTICAL, 1.0, SCROLL_FLAG_PREFERRED); if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) return BadValue; return Success; case DEVICE_ON: device->public.on = TRUE; return Success; case DEVICE_OFF: case DEVICE_CLOSE: device->public.on = FALSE; return Success; } return BadMatch; #undef NBUTTONS #undef NAXES } static int xwl_pointer_proc_relative(DeviceIntPtr device, int what) { #define NAXES 2 Atom axes_labels[NAXES] = { 0 }; switch (what) { case DEVICE_INIT: device->public.on = FALSE; axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); /* * We'll never send buttons, but XGetPointerMapping might in certain * situations make the client think we have no buttons. */ if (!init_pointer_buttons(device)) return BadValue; if (!InitValuatorClassDeviceStruct(device, NAXES, axes_labels, GetMotionHistorySize(), Relative)) return BadValue; /* Valuators */ InitValuatorAxisStruct(device, 0, axes_labels[0], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 1, 0, 1, Relative); InitValuatorAxisStruct(device, 1, axes_labels[1], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 1, 0, 1, Relative); if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) return BadValue; return Success; case DEVICE_ON: device->public.on = TRUE; return Success; case DEVICE_OFF: case DEVICE_CLOSE: device->public.on = FALSE; return Success; } return BadMatch; #undef NAXES } static void xwl_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl) { } static int xwl_keyboard_proc(DeviceIntPtr device, int what) { struct xwl_seat *xwl_seat = device->public.devicePrivate; int len; switch (what) { case DEVICE_INIT: device->public.on = FALSE; if (xwl_seat->keymap) len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); else len = 0; if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap, len, NULL, xwl_keyboard_control)) return BadValue; return Success; case DEVICE_ON: device->public.on = TRUE; return Success; case DEVICE_OFF: case DEVICE_CLOSE: device->public.on = FALSE; return Success; } return BadMatch; } static int xwl_touch_proc(DeviceIntPtr device, int what) { #define NTOUCHPOINTS 20 #define NBUTTONS 1 #define NAXES 2 Atom btn_labels[NBUTTONS] = { 0 }; Atom axes_labels[NAXES] = { 0 }; BYTE map[NBUTTONS + 1] = { 0 }; switch (what) { case DEVICE_INIT: device->public.on = FALSE; axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y); if (!InitValuatorClassDeviceStruct(device, NAXES, axes_labels, GetMotionHistorySize(), Absolute)) return BadValue; if (!InitButtonClassDeviceStruct(device, NBUTTONS, btn_labels, map)) return BadValue; if (!InitTouchClassDeviceStruct(device, NTOUCHPOINTS, XIDirectTouch, NAXES)) return BadValue; /* Valuators */ InitValuatorAxisStruct(device, 0, axes_labels[0], 0, 0xFFFF, 10000, 0, 10000, Absolute); InitValuatorAxisStruct(device, 1, axes_labels[1], 0, 0xFFFF, 10000, 0, 10000, Absolute); return Success; case DEVICE_ON: device->public.on = TRUE; return Success; case DEVICE_OFF: case DEVICE_CLOSE: device->public.on = FALSE; return Success; } return BadMatch; #undef NAXES #undef NBUTTONS #undef NTOUCHPOINTS } static int xwl_tablet_proc(DeviceIntPtr device, int what) { #define NBUTTONS 9 #define NAXES 6 Atom btn_labels[NBUTTONS] = { 0 }; Atom axes_labels[NAXES] = { 0 }; BYTE map[NBUTTONS + 1] = { 0 }; int i; switch (what) { case DEVICE_INIT: device->public.on = FALSE; for (i = 1; i <= NBUTTONS; i++) map[i] = i; axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE); axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X); axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y); axes_labels[5] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_WHEEL); if (!InitValuatorClassDeviceStruct(device, NAXES, axes_labels, GetMotionHistorySize(), Absolute)) return BadValue; /* Valuators - match the xf86-input-wacom ranges */ InitValuatorAxisStruct(device, 0, axes_labels[0], 0, 262143, 10000, 0, 10000, Absolute); InitValuatorAxisStruct(device, 1, axes_labels[1], 0, 262143, 10000, 0, 10000, Absolute); /* pressure */ InitValuatorAxisStruct(device, 2, axes_labels[2], 0, 65535, 1, 0, 1, Absolute); /* tilt x */ InitValuatorAxisStruct(device, 3, axes_labels[3], -64, 63, 57, 0, 57, Absolute); /* tilt y */ InitValuatorAxisStruct(device, 4, axes_labels[4], -64, 63, 57, 0, 57, Absolute); /* abs wheel (airbrush) or rotation (artpen) */ InitValuatorAxisStruct(device, 5, axes_labels[5], -900, 899, 1, 0, 1, Absolute); if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) return BadValue; if (!InitButtonClassDeviceStruct(device, NBUTTONS, btn_labels, map)) return BadValue; return Success; case DEVICE_ON: device->public.on = TRUE; return Success; case DEVICE_OFF: case DEVICE_CLOSE: device->public.on = FALSE; return Success; } return BadMatch; #undef NAXES #undef NBUTTONS } static void pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w) { struct xwl_seat *xwl_seat = data; DeviceIntPtr dev = xwl_seat->pointer; DeviceIntPtr master; int i; int sx = wl_fixed_to_int(sx_w); int sy = wl_fixed_to_int(sy_w); int dx, dy; ScreenPtr pScreen = xwl_seat->xwl_screen->screen; ValuatorMask mask; /* There's a race here where if we create and then immediately * destroy a surface, we might end up in a state where the Wayland * compositor sends us an event for a surface that doesn't exist. * * Don't process enter events in this case. */ if (surface == NULL) return; xwl_seat->xwl_screen->serial = serial; xwl_seat->pointer_enter_serial = serial; xwl_seat->focus_window = wl_surface_get_user_data(surface); dx = xwl_seat->focus_window->window->drawable.x; dy = xwl_seat->focus_window->window->drawable.y; /* We just entered a new xwindow, forget about the old last xwindow */ xwl_seat->last_xwindow = NullWindow; master = GetMaster(dev, POINTER_OR_FLOAT); (*pScreen->SetCursorPosition) (dev, pScreen, dx + sx, dy + sy, TRUE); miPointerInvalidateSprite(master); CheckMotion(NULL, master); /* Ideally, X clients shouldn't see these button releases. When * the pointer leaves a window with buttons down, it means that * the wayland compositor has grabbed the pointer. The button * release event is consumed by whatever grab in the compositor * and won't be sent to clients (the X server is a client). * However, we need to reset X's idea of which buttons are up and * down, and they're all up (by definition) when the pointer * enters a window. We should figure out a way to swallow these * events, perhaps using an X grab whenever the pointer is not in * any X window, but for now just send the events. */ valuator_mask_zero(&mask); for (i = 0; i < dev->button->numButtons; i++) if (BitIsOn(dev->button->down, i)) QueuePointerEvents(dev, ButtonRelease, i, 0, &mask); /* The last cursor frame we commited before the pointer left one * of our surfaces might not have been shown. In that case we'll * have a cursor surface frame callback pending which we need to * clear so that we can continue submitting new cursor frames. */ if (xwl_seat->cursor.frame_cb) { wl_callback_destroy(xwl_seat->cursor.frame_cb); xwl_seat->cursor.frame_cb = NULL; xwl_seat_set_cursor(xwl_seat); } if (xwl_seat->pointer_warp_emulator) { xwl_pointer_warp_emulator_maybe_lock(xwl_seat->pointer_warp_emulator, xwl_seat->focus_window, NULL, 0, 0); } } static void pointer_handle_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface) { struct xwl_seat *xwl_seat = data; DeviceIntPtr dev = xwl_seat->pointer; xwl_seat->xwl_screen->serial = serial; /* The pointer has left a known xwindow, save it for a possible match * in sprite_check_lost_focus() */ if (xwl_seat->focus_window) { xwl_seat->last_xwindow = xwl_seat->focus_window->window; xwl_seat->focus_window = NULL; CheckMotion(NULL, GetMaster(dev, POINTER_OR_FLOAT)); } } static void dispatch_pointer_motion_event(struct xwl_seat *xwl_seat) { ValuatorMask mask; if (xwl_seat->pointer_warp_emulator && xwl_seat->pending_pointer_event.has_relative) { double dx; double dy; double dx_unaccel; double dy_unaccel; dx = xwl_seat->pending_pointer_event.dx; dy = xwl_seat->pending_pointer_event.dy; dx_unaccel = xwl_seat->pending_pointer_event.dx_unaccel; dy_unaccel = xwl_seat->pending_pointer_event.dy_unaccel; xwl_pointer_warp_emulator_handle_motion(xwl_seat->pointer_warp_emulator, dx, dy, dx_unaccel, dy_unaccel); } else if (xwl_seat->pending_pointer_event.has_absolute || xwl_seat->pending_pointer_event.has_relative) { int x; int y; if (xwl_seat->pending_pointer_event.has_absolute) { int sx = wl_fixed_to_int(xwl_seat->pending_pointer_event.x); int sy = wl_fixed_to_int(xwl_seat->pending_pointer_event.y); int dx = xwl_seat->focus_window->window->drawable.x; int dy = xwl_seat->focus_window->window->drawable.y; x = dx + sx; y = dy + sy; } else { miPointerGetPosition(xwl_seat->pointer, &x, &y); } valuator_mask_zero(&mask); if (xwl_seat->pending_pointer_event.has_relative) { double dx_unaccel; double dy_unaccel; dx_unaccel = xwl_seat->pending_pointer_event.dx_unaccel; dy_unaccel = xwl_seat->pending_pointer_event.dy_unaccel; valuator_mask_set_absolute_unaccelerated(&mask, 0, x, dx_unaccel); valuator_mask_set_absolute_unaccelerated(&mask, 1, y, dy_unaccel); } else { valuator_mask_set(&mask, 0, x); valuator_mask_set(&mask, 1, y); } QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_ABSOLUTE | POINTER_SCREEN, &mask); } xwl_seat->pending_pointer_event.has_absolute = FALSE; xwl_seat->pending_pointer_event.has_relative = FALSE; } static void pointer_handle_motion(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) { struct xwl_seat *xwl_seat = data; if (!xwl_seat->focus_window) return; xwl_seat->pending_pointer_event.has_absolute = TRUE; xwl_seat->pending_pointer_event.x = sx_w; xwl_seat->pending_pointer_event.y = sy_w; if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5) dispatch_pointer_motion_event(xwl_seat); } static void pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { struct xwl_seat *xwl_seat = data; int index; ValuatorMask mask; xwl_seat->xwl_screen->serial = serial; switch (button) { case BTN_LEFT: index = 1; break; case BTN_MIDDLE: index = 2; break; case BTN_RIGHT: index = 3; break; default: /* Skip indexes 4-7: they are used for vertical and horizontal scroll. The rest of the buttons go in order: BTN_SIDE becomes 8, etc. */ index = 8 + button - BTN_SIDE; break; } valuator_mask_zero(&mask); QueuePointerEvents(xwl_seat->pointer, state ? ButtonPress : ButtonRelease, index, 0, &mask); } static void pointer_handle_axis(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value) { struct xwl_seat *xwl_seat = data; int index; const int divisor = 10; ValuatorMask mask; struct axis_discrete_pending *pending = NULL; struct axis_discrete_pending *iter; switch (axis) { case WL_POINTER_AXIS_VERTICAL_SCROLL: index = 3; break; case WL_POINTER_AXIS_HORIZONTAL_SCROLL: index = 2; break; default: return; } xorg_list_for_each_entry(iter, &xwl_seat->axis_discrete_pending, l) { if (iter->axis == axis) { pending = iter; break; } } valuator_mask_zero(&mask); if (pending) { valuator_mask_set(&mask, index, pending->discrete); xorg_list_del(&pending->l); free(pending); } else { valuator_mask_set_double(&mask, index, wl_fixed_to_double(value) / divisor); } QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask); } static void pointer_handle_frame(void *data, struct wl_pointer *wl_pointer) { struct xwl_seat *xwl_seat = data; if (!xwl_seat->focus_window) return; dispatch_pointer_motion_event(xwl_seat); } static void pointer_handle_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source) { } static void pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis) { } static void pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t discrete) { struct xwl_seat *xwl_seat = data; struct axis_discrete_pending *pending = malloc(sizeof *pending); if (!pending) return; pending->axis = axis; pending->discrete = discrete; xorg_list_add(&pending->l, &xwl_seat->axis_discrete_pending); } static const struct wl_pointer_listener pointer_listener = { pointer_handle_enter, pointer_handle_leave, pointer_handle_motion, pointer_handle_button, pointer_handle_axis, pointer_handle_frame, pointer_handle_axis_source, pointer_handle_axis_stop, pointer_handle_axis_discrete, }; static void relative_pointer_handle_relative_motion(void *data, struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1, uint32_t utime_hi, uint32_t utime_lo, wl_fixed_t dxf, wl_fixed_t dyf, wl_fixed_t dx_unaccelf, wl_fixed_t dy_unaccelf) { struct xwl_seat *xwl_seat = data; xwl_seat->pending_pointer_event.has_relative = TRUE; xwl_seat->pending_pointer_event.dx = wl_fixed_to_double(dxf); xwl_seat->pending_pointer_event.dy = wl_fixed_to_double(dyf); xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf); xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf); if (!xwl_seat->focus_window) return; if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5) dispatch_pointer_motion_event(xwl_seat); } static const struct zwp_relative_pointer_v1_listener relative_pointer_listener = { relative_pointer_handle_relative_motion, }; static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { struct xwl_seat *xwl_seat = data; uint32_t *k, *end; xwl_seat->xwl_screen->serial = serial; end = (uint32_t *) ((char *) xwl_seat->keys.data + xwl_seat->keys.size); for (k = xwl_seat->keys.data; k < end; k++) { if (*k == key) *k = *--end; } xwl_seat->keys.size = (char *) end - (char *) xwl_seat->keys.data; if (state) { k = wl_array_add(&xwl_seat->keys, sizeof *k); *k = key; } QueueKeyboardEvents(xwl_seat->keyboard, state ? KeyPress : KeyRelease, key + 8); } static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size) { struct xwl_seat *xwl_seat = data; DeviceIntPtr master; XkbDescPtr xkb; XkbChangesRec changes = { 0 }; if (xwl_seat->keymap) munmap(xwl_seat->keymap, xwl_seat->keymap_size); xwl_seat->keymap_size = size; xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); if (xwl_seat->keymap == MAP_FAILED) { xwl_seat->keymap_size = 0; xwl_seat->keymap = NULL; goto out; } xkb = XkbCompileKeymapFromString(xwl_seat->keyboard, xwl_seat->keymap, strnlen(xwl_seat->keymap, xwl_seat->keymap_size)); if (!xkb) goto out; XkbUpdateDescActions(xkb, xkb->min_key_code, XkbNumKeys(xkb), &changes); if (xwl_seat->keyboard->key) /* Keep the current controls */ XkbCopyControls(xkb, xwl_seat->keyboard->key->xkbInfo->desc); XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb); master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD); if (master) XkbDeviceApplyKeymap(master, xkb); XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE); out: close(fd); } static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { struct xwl_seat *xwl_seat = data; uint32_t *k; xwl_seat->xwl_screen->serial = serial; xwl_seat->keyboard_focus = surface; wl_array_copy(&xwl_seat->keys, keys); wl_array_for_each(k, &xwl_seat->keys) QueueKeyboardEvents(xwl_seat->keyboard, EnterNotify, *k + 8); } static void keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface) { struct xwl_seat *xwl_seat = data; uint32_t *k; xwl_seat->xwl_screen->serial = serial; wl_array_for_each(k, &xwl_seat->keys) QueueKeyboardEvents(xwl_seat->keyboard, LeaveNotify, *k + 8); xwl_seat->keyboard_focus = NULL; } static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { struct xwl_seat *xwl_seat = data; DeviceIntPtr dev; XkbStateRec old_state, *new_state; xkbStateNotify sn; CARD16 changed; mieqProcessInputEvents(); for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev != xwl_seat->keyboard && dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD)) continue; old_state = dev->key->xkbInfo->state; new_state = &dev->key->xkbInfo->state; new_state->locked_group = group & XkbAllGroupsMask; new_state->base_mods = mods_depressed & XkbAllModifiersMask; new_state->locked_mods = mods_locked & XkbAllModifiersMask; XkbLatchModifiers(dev, XkbAllModifiersMask, mods_latched & XkbAllModifiersMask); XkbComputeDerivedState(dev->key->xkbInfo); changed = XkbStateChangedFlags(&old_state, new_state); if (!changed) continue; sn.keycode = 0; sn.eventType = 0; sn.requestMajor = XkbReqCode; sn.requestMinor = X_kbLatchLockState; /* close enough */ sn.changed = changed; XkbSendStateNotify(dev, &sn); } } static void remove_sync_pending(DeviceIntPtr dev) { struct xwl_seat *xwl_seat = dev->public.devicePrivate; struct sync_pending *p, *npd; xorg_list_for_each_entry_safe(p, npd, &xwl_seat->sync_pending, l) { if (p->pending_dev == dev) { xorg_list_del(&xwl_seat->sync_pending); free (p); return; } } } static void sync_callback(void *data, struct wl_callback *callback, uint32_t serial) { DeviceIntPtr dev = (DeviceIntPtr) data; remove_sync_pending(dev); wl_callback_destroy(callback); } static const struct wl_callback_listener sync_listener = { sync_callback }; static Bool keyboard_check_repeat (DeviceIntPtr dev, XkbSrvInfoPtr xkbi, unsigned key) { struct xwl_seat *xwl_seat = dev->public.devicePrivate; struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; struct wl_callback *callback; struct sync_pending *p; /* Make sure we didn't miss a possible reply from the compositor */ xwl_sync_events (xwl_screen); xorg_list_for_each_entry(p, &xwl_seat->sync_pending, l) { if (p->pending_dev == dev) { ErrorF("Key repeat discarded, Wayland compositor doesn't " "seem to be processing events fast enough!\n"); return FALSE; } } p = xnfalloc(sizeof(struct sync_pending)); p->pending_dev = dev; callback = wl_display_sync (xwl_screen->display); xorg_list_add(&p->l, &xwl_seat->sync_pending); wl_callback_add_listener(callback, &sync_listener, dev); return TRUE; } static void keyboard_handle_repeat_info (void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay) { struct xwl_seat *xwl_seat = data; DeviceIntPtr dev; XkbControlsPtr ctrl; if (rate < 0 || delay < 0) { ErrorF("Wrong rate/delay: %d, %d\n", rate, delay); return; } for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev != xwl_seat->keyboard && dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD)) continue; if (rate != 0) { ctrl = dev->key->xkbInfo->desc->ctrls; ctrl->repeat_delay = delay; /* rate is number of keys per second */ ctrl->repeat_interval = 1000 / rate; XkbSetRepeatKeys(dev, -1, AutoRepeatModeOn); } else XkbSetRepeatKeys(dev, -1, AutoRepeatModeOff); } } static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_keymap, keyboard_handle_enter, keyboard_handle_leave, keyboard_handle_key, keyboard_handle_modifiers, keyboard_handle_repeat_info, }; static struct xwl_touch * xwl_seat_lookup_touch(struct xwl_seat *xwl_seat, int32_t id) { struct xwl_touch *xwl_touch, *next_xwl_touch; xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch, &xwl_seat->touches, link_touch) { if (xwl_touch->id == id) return xwl_touch; } return NULL; } static void xwl_touch_send_event(struct xwl_touch *xwl_touch, struct xwl_seat *xwl_seat, int type) { double dx, dy, x, y; ValuatorMask mask; dx = xwl_touch->window->window->drawable.x; dy = xwl_touch->window->window->drawable.y; x = (dx + xwl_touch->x) * 0xFFFF / xwl_seat->xwl_screen->width; y = (dy + xwl_touch->y) * 0xFFFF / xwl_seat->xwl_screen->height; valuator_mask_zero(&mask); valuator_mask_set_double(&mask, 0, x); valuator_mask_set_double(&mask, 1, y); QueueTouchEvents(xwl_seat->touch, type, xwl_touch->id, 0, &mask); } static void touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, struct wl_surface *surface, int32_t id, wl_fixed_t sx_w, wl_fixed_t sy_w) { struct xwl_seat *xwl_seat = data; struct xwl_touch *xwl_touch; if (surface == NULL) return; xwl_touch = calloc(1, sizeof *xwl_touch); if (xwl_touch == NULL) { ErrorF("%s: ENOMEM\n", __func__); return; } xwl_touch->window = wl_surface_get_user_data(surface); xwl_touch->id = id; xwl_touch->x = wl_fixed_to_int(sx_w); xwl_touch->y = wl_fixed_to_int(sy_w); xorg_list_add(&xwl_touch->link_touch, &xwl_seat->touches); xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchBegin); } static void touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, int32_t id) { struct xwl_touch *xwl_touch; struct xwl_seat *xwl_seat = data; xwl_touch = xwl_seat_lookup_touch(xwl_seat, id); if (!xwl_touch) return; xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchEnd); xorg_list_del(&xwl_touch->link_touch); free(xwl_touch); } static void touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time, int32_t id, wl_fixed_t sx_w, wl_fixed_t sy_w) { struct xwl_seat *xwl_seat = data; struct xwl_touch *xwl_touch; xwl_touch = xwl_seat_lookup_touch(xwl_seat, id); if (!xwl_touch) return; xwl_touch->x = wl_fixed_to_int(sx_w); xwl_touch->y = wl_fixed_to_int(sy_w); xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchUpdate); } static void touch_handle_frame(void *data, struct wl_touch *wl_touch) { } static void touch_handle_cancel(void *data, struct wl_touch *wl_touch) { struct xwl_seat *xwl_seat = data; struct xwl_touch *xwl_touch, *next_xwl_touch; xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch, &xwl_seat->touches, link_touch) { /* We can't properly notify of cancellation to the X client * once it thinks it has the ownership, send at least a * TouchEnd event. */ xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchEnd); xorg_list_del(&xwl_touch->link_touch); free(xwl_touch); } } static const struct wl_touch_listener touch_listener = { touch_handle_down, touch_handle_up, touch_handle_motion, touch_handle_frame, touch_handle_cancel }; static struct xwl_seat * find_matching_seat(DeviceIntPtr device) { DeviceIntPtr dev; for (dev = inputInfo.devices; dev; dev = dev->next) if (dev->deviceProc == xwl_keyboard_proc && device == GetMaster(dev, MASTER_KEYBOARD)) return (struct xwl_seat *) dev->public.devicePrivate; return NULL; } static void release_grab(struct xwl_seat *xwl_seat) { if (xwl_seat->keyboard_grab) zwp_xwayland_keyboard_grab_v1_destroy(xwl_seat->keyboard_grab); xwl_seat->keyboard_grab = NULL; } static void set_grab(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window) { struct xwl_screen *xwl_screen; if (!xwl_window) return; /* We already have a grab */ if (xwl_seat->keyboard_grab) release_grab (xwl_seat); xwl_screen = xwl_seat->xwl_screen; xwl_seat->keyboard_grab = zwp_xwayland_keyboard_grab_manager_v1_grab_keyboard(xwl_screen->wp_grab, xwl_window->surface, xwl_seat->seat); } static void xwl_keyboard_activate_grab(DeviceIntPtr device, GrabPtr grab, TimeStamp time, Bool passive) { struct xwl_seat *xwl_seat = device->public.devicePrivate; /* We are not interested in passive grabs */ if (!passive) { /* If the device is the MASTER_KEYBOARD, we don't have an xwl_seat */ if (xwl_seat == NULL) xwl_seat = find_matching_seat(device); if (xwl_seat) set_grab(xwl_seat, xwl_window_from_window(grab->window)); } ActivateKeyboardGrab(device, grab, time, passive); } static void xwl_keyboard_deactivate_grab(DeviceIntPtr device) { struct xwl_seat *xwl_seat = device->public.devicePrivate; /* If the device is the MASTER_KEYBOARD, we don't have an xwl_seat */ if (xwl_seat == NULL) xwl_seat = find_matching_seat(device); if (xwl_seat) release_grab (xwl_seat); DeactivateKeyboardGrab(device); } static void setup_keyboard_grab_handler (DeviceIntPtr device) { device->deviceGrab.ActivateGrab = xwl_keyboard_activate_grab; device->deviceGrab.DeactivateGrab = xwl_keyboard_deactivate_grab; } static DeviceIntPtr add_device(struct xwl_seat *xwl_seat, const char *driver, DeviceProc device_proc) { DeviceIntPtr dev = NULL; static Atom type_atom; char name[32]; dev = AddInputDevice(serverClient, device_proc, TRUE); if (dev == NULL) return NULL; if (type_atom == None) type_atom = MakeAtom(driver, strlen(driver), TRUE); snprintf(name, sizeof name, "%s:%d", driver, xwl_seat->id); AssignTypeAndName(dev, type_atom, name); dev->public.devicePrivate = xwl_seat; dev->type = SLAVE; dev->spriteInfo->spriteOwner = FALSE; return dev; } static void init_pointer(struct xwl_seat *xwl_seat) { xwl_seat->wl_pointer = wl_seat_get_pointer(xwl_seat->seat); wl_pointer_add_listener(xwl_seat->wl_pointer, &pointer_listener, xwl_seat); if (xwl_seat->pointer == NULL) { xwl_seat_set_cursor(xwl_seat); xwl_seat->pointer = add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc); ActivateDevice(xwl_seat->pointer, TRUE); } EnableDevice(xwl_seat->pointer, TRUE); } static void release_pointer(struct xwl_seat *xwl_seat) { wl_pointer_release(xwl_seat->wl_pointer); xwl_seat->wl_pointer = NULL; if (xwl_seat->pointer) DisableDevice(xwl_seat->pointer, TRUE); } static void init_relative_pointer(struct xwl_seat *xwl_seat) { struct zwp_relative_pointer_manager_v1 *relative_pointer_manager = xwl_seat->xwl_screen->relative_pointer_manager; if (relative_pointer_manager) { xwl_seat->wp_relative_pointer = zwp_relative_pointer_manager_v1_get_relative_pointer( relative_pointer_manager, xwl_seat->wl_pointer); zwp_relative_pointer_v1_add_listener(xwl_seat->wp_relative_pointer, &relative_pointer_listener, xwl_seat); } if (xwl_seat->relative_pointer == NULL) { xwl_seat->relative_pointer = add_device(xwl_seat, "xwayland-relative-pointer", xwl_pointer_proc_relative); ActivateDevice(xwl_seat->relative_pointer, TRUE); } EnableDevice(xwl_seat->relative_pointer, TRUE); } static void release_relative_pointer(struct xwl_seat *xwl_seat) { if (xwl_seat->wp_relative_pointer) { zwp_relative_pointer_v1_destroy(xwl_seat->wp_relative_pointer); xwl_seat->wp_relative_pointer = NULL; } if (xwl_seat->relative_pointer) DisableDevice(xwl_seat->relative_pointer, TRUE); } static void init_keyboard(struct xwl_seat *xwl_seat) { DeviceIntPtr master; xwl_seat->wl_keyboard = wl_seat_get_keyboard(xwl_seat->seat); wl_keyboard_add_listener(xwl_seat->wl_keyboard, &keyboard_listener, xwl_seat); if (xwl_seat->keyboard == NULL) { xwl_seat->keyboard = add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc); ActivateDevice(xwl_seat->keyboard, TRUE); } EnableDevice(xwl_seat->keyboard, TRUE); xwl_seat->keyboard->key->xkbInfo->checkRepeat = keyboard_check_repeat; if (xwl_seat->xwl_screen->wp_grab) { /* We have Xwayland grab protocol supported by the compositor */ master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD); if (master) setup_keyboard_grab_handler(master); } } static void release_keyboard(struct xwl_seat *xwl_seat) { release_grab(xwl_seat); wl_keyboard_release(xwl_seat->wl_keyboard); xwl_seat->wl_keyboard = NULL; if (xwl_seat->keyboard) { remove_sync_pending(xwl_seat->keyboard); DisableDevice(xwl_seat->keyboard, TRUE); } } static void init_touch(struct xwl_seat *xwl_seat) { xwl_seat->wl_touch = wl_seat_get_touch(xwl_seat->seat); wl_touch_add_listener(xwl_seat->wl_touch, &touch_listener, xwl_seat); if (xwl_seat->touch == NULL) { xwl_seat->touch = add_device(xwl_seat, "xwayland-touch", xwl_touch_proc); ActivateDevice(xwl_seat->touch, TRUE); } EnableDevice(xwl_seat->touch, TRUE); } static void release_touch(struct xwl_seat *xwl_seat) { wl_touch_release(xwl_seat->wl_touch); xwl_seat->wl_touch = NULL; if (xwl_seat->touch) DisableDevice(xwl_seat->touch, TRUE); } static void seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) { struct xwl_seat *xwl_seat = data; if (caps & WL_SEAT_CAPABILITY_POINTER && xwl_seat->wl_pointer == NULL) { init_pointer(xwl_seat); init_relative_pointer(xwl_seat); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->wl_pointer) { release_pointer(xwl_seat); release_relative_pointer(xwl_seat); } if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->wl_keyboard == NULL) { init_keyboard(xwl_seat); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->wl_keyboard) { release_keyboard(xwl_seat); } if (caps & WL_SEAT_CAPABILITY_TOUCH && xwl_seat->wl_touch == NULL) { init_touch(xwl_seat); } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && xwl_seat->wl_touch) { release_touch(xwl_seat); } xwl_seat->xwl_screen->expecting_event--; } static void seat_handle_name(void *data, struct wl_seat *seat, const char *name) { } static const struct wl_seat_listener seat_listener = { seat_handle_capabilities, seat_handle_name }; static void xwl_cursor_init(struct xwl_cursor *xwl_cursor, struct xwl_screen *xwl_screen, void (* update_proc)(struct xwl_cursor *)) { xwl_cursor->surface = wl_compositor_create_surface(xwl_screen->compositor); xwl_cursor->update_proc = update_proc; xwl_cursor->frame_cb = NULL; xwl_cursor->needs_update = FALSE; } static void xwl_cursor_release(struct xwl_cursor *xwl_cursor) { wl_surface_destroy(xwl_cursor->surface); if (xwl_cursor->frame_cb) wl_callback_destroy(xwl_cursor->frame_cb); } static void xwl_seat_update_cursor(struct xwl_cursor *xwl_cursor) { struct xwl_seat *xwl_seat = wl_container_of(xwl_cursor, xwl_seat, cursor); xwl_seat_set_cursor(xwl_seat); } static void create_input_device(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { struct xwl_seat *xwl_seat; xwl_seat = calloc(1, sizeof *xwl_seat); if (xwl_seat == NULL) { ErrorF("%s: ENOMEM\n", __func__); return; } xwl_seat->xwl_screen = xwl_screen; xorg_list_add(&xwl_seat->link, &xwl_screen->seat_list); xwl_seat->seat = wl_registry_bind(xwl_screen->registry, id, &wl_seat_interface, min(version, 5)); xwl_seat->id = id; xwl_cursor_init(&xwl_seat->cursor, xwl_seat->xwl_screen, xwl_seat_update_cursor); wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat); init_tablet_manager_seat(xwl_screen, xwl_seat); wl_array_init(&xwl_seat->keys); xorg_list_init(&xwl_seat->touches); xorg_list_init(&xwl_seat->axis_discrete_pending); xorg_list_init(&xwl_seat->sync_pending); } void xwl_seat_destroy(struct xwl_seat *xwl_seat) { struct xwl_touch *xwl_touch, *next_xwl_touch; struct sync_pending *p, *npd; struct axis_discrete_pending *ad, *ad_next; xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch, &xwl_seat->touches, link_touch) { xorg_list_del(&xwl_touch->link_touch); free(xwl_touch); } xorg_list_for_each_entry_safe(p, npd, &xwl_seat->sync_pending, l) { xorg_list_del(&xwl_seat->sync_pending); free (p); } xorg_list_for_each_entry_safe(ad, ad_next, &xwl_seat->axis_discrete_pending, l) { xorg_list_del(&ad->l); free(ad); } release_tablet_manager_seat(xwl_seat); release_grab(xwl_seat); wl_seat_destroy(xwl_seat->seat); xwl_cursor_release(&xwl_seat->cursor); wl_array_release(&xwl_seat->keys); free(xwl_seat); } static void tablet_handle_name(void *data, struct zwp_tablet_v2 *tablet, const char *name) { } static void tablet_handle_id(void *data, struct zwp_tablet_v2 *tablet, uint32_t vid, uint32_t pid) { } static void tablet_handle_path(void *data, struct zwp_tablet_v2 *tablet, const char *path) { } static void tablet_handle_done(void *data, struct zwp_tablet_v2 *tablet) { struct xwl_tablet *xwl_tablet = data; struct xwl_seat *xwl_seat = xwl_tablet->seat; if (xwl_seat->stylus == NULL) { xwl_seat->stylus = add_device(xwl_seat, "xwayland-stylus", xwl_tablet_proc); ActivateDevice(xwl_seat->stylus, TRUE); } EnableDevice(xwl_seat->stylus, TRUE); if (xwl_seat->eraser == NULL) { xwl_seat->eraser = add_device(xwl_seat, "xwayland-eraser", xwl_tablet_proc); ActivateDevice(xwl_seat->eraser, TRUE); } EnableDevice(xwl_seat->eraser, TRUE); if (xwl_seat->puck == NULL) { xwl_seat->puck = add_device(xwl_seat, "xwayland-cursor", xwl_tablet_proc); ActivateDevice(xwl_seat->puck, TRUE); } EnableDevice(xwl_seat->puck, TRUE); } static void tablet_handle_removed(void *data, struct zwp_tablet_v2 *tablet) { struct xwl_tablet *xwl_tablet = data; struct xwl_seat *xwl_seat = xwl_tablet->seat; xorg_list_del(&xwl_tablet->link); /* The tablet is merely disabled, not removed. The next tablet will re-use the same X devices */ if (xorg_list_is_empty(&xwl_seat->tablets)) { if (xwl_seat->stylus) DisableDevice(xwl_seat->stylus, TRUE); if (xwl_seat->eraser) DisableDevice(xwl_seat->eraser, TRUE); if (xwl_seat->puck) DisableDevice(xwl_seat->puck, TRUE); /* pads are removed separately */ } zwp_tablet_v2_destroy(tablet); free(xwl_tablet); } static const struct zwp_tablet_v2_listener tablet_listener = { tablet_handle_name, tablet_handle_id, tablet_handle_path, tablet_handle_done, tablet_handle_removed }; static void tablet_tool_receive_type(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t type) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; switch (type) { case ZWP_TABLET_TOOL_V2_TYPE_ERASER: xwl_tablet_tool->xdevice = xwl_seat->eraser; break; case ZWP_TABLET_TOOL_V2_TYPE_MOUSE: case ZWP_TABLET_TOOL_V2_TYPE_LENS: xwl_tablet_tool->xdevice = xwl_seat->puck; break; default: xwl_tablet_tool->xdevice = xwl_seat->stylus; break; } } static void tablet_tool_receive_hardware_serial(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t hi, uint32_t low) { } static void tablet_tool_receive_hardware_id_wacom(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t hi, uint32_t low) { } static void tablet_tool_receive_capability(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t capability) { } static void tablet_tool_receive_done(void *data, struct zwp_tablet_tool_v2 *tool) { } static void tablet_tool_receive_removed(void *data, struct zwp_tablet_tool_v2 *tool) { struct xwl_tablet_tool *xwl_tablet_tool = data; xorg_list_del(&xwl_tablet_tool->link); xwl_cursor_release(&xwl_tablet_tool->cursor); zwp_tablet_tool_v2_destroy(tool); free(xwl_tablet_tool); } static void tablet_tool_proximity_in(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial, struct zwp_tablet_v2 *tablet, struct wl_surface *wl_surface) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; /* There's a race here where if we create and then immediately * destroy a surface, we might end up in a state where the Wayland * compositor sends us an event for a surface that doesn't exist. * * Don't process enter events in this case. * * see pointer_handle_enter() */ if (wl_surface == NULL) return; xwl_tablet_tool->proximity_in_serial = serial; xwl_seat->tablet_focus_window = wl_surface_get_user_data(wl_surface); xwl_tablet_tool_set_cursor(xwl_tablet_tool); } static void tablet_tool_proximity_out(void *data, struct zwp_tablet_tool_v2 *tool) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; xwl_tablet_tool->proximity_in_serial = 0; xwl_seat->tablet_focus_window = NULL; xwl_tablet_tool->pressure = 0; xwl_tablet_tool->tilt_x = 0; xwl_tablet_tool->tilt_y = 0; xwl_tablet_tool->rotation = 0; xwl_tablet_tool->slider = 0; } static void tablet_tool_down(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; ValuatorMask mask; xwl_seat->xwl_screen->serial = serial; valuator_mask_zero(&mask); QueuePointerEvents(xwl_tablet_tool->xdevice, ButtonPress, 1, 0, &mask); } static void tablet_tool_up(void *data, struct zwp_tablet_tool_v2 *tool) { struct xwl_tablet_tool *xwl_tablet_tool = data; ValuatorMask mask; valuator_mask_zero(&mask); QueuePointerEvents(xwl_tablet_tool->xdevice, ButtonRelease, 1, 0, &mask); } static void tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t x, wl_fixed_t y) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; int32_t dx, dy; double sx = wl_fixed_to_double(x); double sy = wl_fixed_to_double(y); if (!xwl_seat->tablet_focus_window) return; dx = xwl_seat->tablet_focus_window->window->drawable.x; dy = xwl_seat->tablet_focus_window->window->drawable.y; xwl_tablet_tool->x = (double) dx + sx; xwl_tablet_tool->y = (double) dy + sy; } static void tablet_tool_pressure(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t pressure) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; if (!xwl_seat->tablet_focus_window) return; /* normalized to 65535 already */ xwl_tablet_tool->pressure = pressure; } static void tablet_tool_distance(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t distance_raw) { } static void tablet_tool_tilt(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t tilt_x, wl_fixed_t tilt_y) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; if (!xwl_seat->tablet_focus_window) return; xwl_tablet_tool->tilt_x = wl_fixed_to_double(tilt_x); xwl_tablet_tool->tilt_y = wl_fixed_to_double(tilt_y); } static void tablet_tool_rotation(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t angle) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; double rotation = wl_fixed_to_double(angle); if (!xwl_seat->tablet_focus_window) return; /* change origin (buttons facing right [libinput +90 degrees]) and * scaling (5 points per degree) to match wacom driver behavior */ rotation = remainderf(rotation + 90.0f, 360.0f); rotation *= 5.0f; xwl_tablet_tool->rotation = rotation; } static void tablet_tool_slider(void *data, struct zwp_tablet_tool_v2 *tool, int32_t position_raw) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; float position = position_raw / 65535.0; if (!xwl_seat->tablet_focus_window) return; xwl_tablet_tool->slider = (position * 1799.0f) - 900.0f; } static void tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t degrees, int32_t clicks) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; if (!xwl_seat->tablet_focus_window) return; xwl_tablet_tool->wheel_clicks = clicks; } static void tablet_tool_button_state(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial, uint32_t button, uint32_t state) { struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; uint32_t *mask = &xwl_tablet_tool->buttons_now; int xbtn = 0; /* BTN_0 .. BTN_9 */ if (button >= 0x100 && button <= 0x109) { xbtn = button - 0x100 + 1; } /* BTN_A .. BTN_Z */ else if (button >= 0x130 && button <= 0x135) { xbtn = button - 0x130 + 10; } /* BTN_BASE .. BTN_BASE6 */ else if (button >= 0x126 && button <= 0x12b) { xbtn = button - 0x126 + 16; } else { switch (button) { case 0x110: /* BTN_LEFT */ case 0x14a: /* BTN_TOUCH */ xbtn = 1; break; case 0x112: /* BTN_MIDDLE */ case 0x14b: /* BTN_STYLUS */ xbtn = 2; break; case 0x111: /* BTN_RIGHT */ case 0x14c: /* BTN_STYLUS2 */ xbtn = 3; break; case 0x113: /* BTN_SIDE */ case 0x116: /* BTN_BACK */ case 0x149: /* BTN_STYLUS3 */ xbtn = 8; break; case 0x114: /* BTN_EXTRA */ case 0x115: /* BTN_FORWARD */ xbtn = 9; break; } } if (!xbtn) { ErrorF("unknown tablet button number %d\n", button); return; } BUG_RETURN(xbtn >= 8 * sizeof(*mask)); if (state) SetBit(mask, xbtn - 1); else ClearBit(mask, xbtn - 1); xwl_seat->xwl_screen->serial = serial; } static void tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t time) { struct xwl_tablet_tool *xwl_tablet_tool = data; ValuatorMask mask; uint32_t released, pressed, diff; int button; valuator_mask_zero(&mask); valuator_mask_set_double(&mask, 0, xwl_tablet_tool->x); valuator_mask_set_double(&mask, 1, xwl_tablet_tool->y); valuator_mask_set(&mask, 2, xwl_tablet_tool->pressure); valuator_mask_set_double(&mask, 3, xwl_tablet_tool->tilt_x); valuator_mask_set_double(&mask, 4, xwl_tablet_tool->tilt_y); valuator_mask_set_double(&mask, 5, xwl_tablet_tool->rotation + xwl_tablet_tool->slider); QueuePointerEvents(xwl_tablet_tool->xdevice, MotionNotify, 0, POINTER_ABSOLUTE | POINTER_DESKTOP, &mask); valuator_mask_zero(&mask); diff = xwl_tablet_tool->buttons_prev ^ xwl_tablet_tool->buttons_now; released = diff & ~xwl_tablet_tool->buttons_now; pressed = diff & xwl_tablet_tool->buttons_now; button = 1; while (released) { if (released & 0x1) QueuePointerEvents(xwl_tablet_tool->xdevice, ButtonRelease, button, 0, &mask); button++; released >>= 1; } button = 1; while (pressed) { if (pressed & 0x1) QueuePointerEvents(xwl_tablet_tool->xdevice, ButtonPress, button, 0, &mask); button++; pressed >>= 1; } xwl_tablet_tool->buttons_prev = xwl_tablet_tool->buttons_now; while (xwl_tablet_tool->wheel_clicks) { if (xwl_tablet_tool->wheel_clicks < 0) { button = 4; xwl_tablet_tool->wheel_clicks++; } else { button = 5; xwl_tablet_tool->wheel_clicks--; } QueuePointerEvents(xwl_tablet_tool->xdevice, ButtonPress, button, 0, &mask); QueuePointerEvents(xwl_tablet_tool->xdevice, ButtonRelease, button, 0, &mask); } } static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = { tablet_tool_receive_type, tablet_tool_receive_hardware_serial, tablet_tool_receive_hardware_id_wacom, tablet_tool_receive_capability, tablet_tool_receive_done, tablet_tool_receive_removed, tablet_tool_proximity_in, tablet_tool_proximity_out, tablet_tool_down, tablet_tool_up, tablet_tool_motion, tablet_tool_pressure, tablet_tool_distance, tablet_tool_tilt, tablet_tool_rotation, tablet_tool_slider, tablet_tool_wheel, tablet_tool_button_state, tablet_tool_frame }; static void tablet_pad_ring_destroy(struct xwl_tablet_pad_ring *ring) { zwp_tablet_pad_ring_v2_destroy(ring->ring); xorg_list_del(&ring->link); free(ring); } static void tablet_pad_ring_source(void *data, struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, uint32_t source) { } static void tablet_pad_ring_angle(void *data, struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, wl_fixed_t degrees) { struct xwl_tablet_pad_ring *ring = data; struct xwl_tablet_pad *pad = ring->group->pad; double deg = wl_fixed_to_double(degrees); ValuatorMask mask; valuator_mask_zero(&mask); valuator_mask_set(&mask, 5 + ring->index, deg/360.0 * 71); QueuePointerEvents(pad->xdevice, MotionNotify, 0, 0, &mask); } static void tablet_pad_ring_stop(void *data, struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2) { } static void tablet_pad_ring_frame(void *data, struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, uint32_t time) { } static const struct zwp_tablet_pad_ring_v2_listener tablet_pad_ring_listener = { tablet_pad_ring_source, tablet_pad_ring_angle, tablet_pad_ring_stop, tablet_pad_ring_frame, }; static void tablet_pad_strip_destroy(struct xwl_tablet_pad_strip *strip) { zwp_tablet_pad_strip_v2_destroy(strip->strip); xorg_list_del(&strip->link); free(strip); } static void tablet_pad_strip_source(void *data, struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, uint32_t source) { } static void tablet_pad_strip_position(void *data, struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, uint32_t position) { struct xwl_tablet_pad_strip *strip = data; struct xwl_tablet_pad *pad = strip->group->pad; ValuatorMask mask; valuator_mask_zero(&mask); valuator_mask_set(&mask, 3 + strip->index, position/65535.0 * 2048); QueuePointerEvents(pad->xdevice, MotionNotify, 0, 0, &mask); } static void tablet_pad_strip_stop(void *data, struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2) { } static void tablet_pad_strip_frame(void *data, struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, uint32_t time) { } static const struct zwp_tablet_pad_strip_v2_listener tablet_pad_strip_listener = { tablet_pad_strip_source, tablet_pad_strip_position, tablet_pad_strip_stop, tablet_pad_strip_frame, }; static void tablet_pad_group_destroy(struct xwl_tablet_pad_group *group) { struct xwl_tablet_pad_ring *r, *tr; struct xwl_tablet_pad_strip *s, *ts; xorg_list_for_each_entry_safe(r, tr, &group->pad_group_ring_list, link) tablet_pad_ring_destroy(r); xorg_list_for_each_entry_safe(s, ts, &group->pad_group_strip_list, link) tablet_pad_strip_destroy(s); zwp_tablet_pad_group_v2_destroy(group->group); xorg_list_del(&group->link); free(group); } static void tablet_pad_group_buttons(void *data, struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, struct wl_array *buttons) { } static void tablet_pad_group_ring(void *data, struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, struct zwp_tablet_pad_ring_v2 *wp_ring) { static unsigned int ring_index = 0; struct xwl_tablet_pad_group *group = data; struct xwl_tablet_pad_ring *ring; ring = calloc(1, sizeof *ring); if (ring == NULL) { ErrorF("%s ENOMEM\n", __func__); return; } ring->index = ring_index++; ring->group = group; ring->ring = wp_ring; xorg_list_add(&ring->link, &group->pad_group_ring_list); zwp_tablet_pad_ring_v2_add_listener(wp_ring, &tablet_pad_ring_listener, ring); } static void tablet_pad_group_strip(void *data, struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, struct zwp_tablet_pad_strip_v2 *wp_strip) { static unsigned int strip_index = 0; struct xwl_tablet_pad_group *group = data; struct xwl_tablet_pad_strip *strip; strip = calloc(1, sizeof *strip); if (strip == NULL) { ErrorF("%s ENOMEM\n", __func__); return; } strip->index = strip_index++; strip->group = group; strip->strip = wp_strip; xorg_list_add(&strip->link, &group->pad_group_strip_list); zwp_tablet_pad_strip_v2_add_listener(wp_strip, &tablet_pad_strip_listener, strip); } static void tablet_pad_group_modes(void *data, struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, uint32_t modes) { } static void tablet_pad_group_done(void *data, struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2) { } static void tablet_pad_group_mode_switch(void *data, struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, uint32_t time, uint32_t serial, uint32_t mode) { } static struct zwp_tablet_pad_group_v2_listener tablet_pad_group_listener = { tablet_pad_group_buttons, tablet_pad_group_ring, tablet_pad_group_strip, tablet_pad_group_modes, tablet_pad_group_done, tablet_pad_group_mode_switch, }; static int xwl_tablet_pad_proc(DeviceIntPtr device, int what) { struct xwl_tablet_pad *pad = device->public.devicePrivate; /* Axis layout mirrors that of xf86-input-wacom to have better compatibility with existing clients */ #define NAXES 7 Atom axes_labels[NAXES] = { 0 }; BYTE map[MAX_BUTTONS + 1]; int i = 0; Atom btn_labels[MAX_BUTTONS] = { 0 }; /* btn labels are meaningless */ int nbuttons; switch (what) { case DEVICE_INIT: device->public.on = FALSE; axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); /* The others have no good mapping */ if (!InitValuatorClassDeviceStruct(device, NAXES, axes_labels, GetMotionHistorySize(), Absolute)) return BadValue; for (i = 1; i <= MAX_BUTTONS; i++) map[i] = i; /* We need at least 7 buttons to allow scrolling */ nbuttons = min(max(pad->nbuttons + 4, 7), MAX_BUTTONS); if (!InitButtonClassDeviceStruct(device, nbuttons, btn_labels, map)) return BadValue; /* Valuators */ InitValuatorAxisStruct(device, 0, axes_labels[0], 0, 100, 1, 0, 1, Absolute); InitValuatorAxisStruct(device, 1, axes_labels[1], 0, 100, 1, 0, 1, Absolute); /* Pressure - unused, for backwards compat only */ InitValuatorAxisStruct(device, 2, axes_labels[2], 0, 2048, 1, 0, 1, Absolute); /* strip x */ InitValuatorAxisStruct(device, 3, axes_labels[3], 0, 2048, 1, 0, 1, Absolute); /* strip y */ InitValuatorAxisStruct(device, 4, axes_labels[4], 0, 2048, 1, 0, 1, Absolute); /* ring */ InitValuatorAxisStruct(device, 5, axes_labels[5], 0, 71, 1, 0, 1, Absolute); /* ring2 */ InitValuatorAxisStruct(device, 6, axes_labels[6], 0, 71, 1, 0, 1, Absolute); if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) return BadValue; return Success; case DEVICE_ON: device->public.on = TRUE; return Success; case DEVICE_OFF: case DEVICE_CLOSE: device->public.on = FALSE; return Success; } return BadMatch; #undef NAXES } static void tablet_pad_group(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, struct zwp_tablet_pad_group_v2 *pad_group) { struct xwl_tablet_pad *pad = data; struct xwl_tablet_pad_group *group; group = calloc(1, sizeof *group); if (pad == NULL) { ErrorF("%s ENOMEM\n", __func__); return; } group->pad = pad; group->group = pad_group; xorg_list_init(&group->pad_group_ring_list); xorg_list_init(&group->pad_group_strip_list); xorg_list_add(&group->link, &pad->pad_group_list); zwp_tablet_pad_group_v2_add_listener(pad_group, &tablet_pad_group_listener, group); } static void tablet_pad_path(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, const char *path) { } static void tablet_pad_buttons(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, uint32_t buttons) { struct xwl_tablet_pad *pad = data; pad->nbuttons = buttons; } static void tablet_pad_done(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2) { struct xwl_tablet_pad *pad = data; pad->xdevice = add_device(pad->seat, "xwayland-pad", xwl_tablet_pad_proc); pad->xdevice->public.devicePrivate = pad; ActivateDevice(pad->xdevice, TRUE); EnableDevice(pad->xdevice, TRUE); } static void tablet_pad_button(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, uint32_t time, uint32_t button, uint32_t state) { struct xwl_tablet_pad *pad = data; ValuatorMask mask; button++; /* wayland index vs X's 1-offset */ /* skip scroll wheel buttons 4-7 */ button = button > 3 ? button + 4 : button; valuator_mask_zero(&mask); QueuePointerEvents(pad->xdevice, state ? ButtonPress : ButtonRelease, button, 0, &mask); } static void tablet_pad_enter(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, uint32_t serial, struct zwp_tablet_v2 *tablet, struct wl_surface *surface) { /* pairs the pad with the tablet but also to set the focus. We * don't care about the pairing and always use X's focus */ } static void tablet_pad_leave(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, uint32_t serial, struct wl_surface *surface) { /* pairs the pad with the tablet but also to set the focus. We * don't care about the pairing and always use X's focus */ } static void tablet_pad_removed(void *data, struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2) { struct xwl_tablet_pad *pad = data; struct xwl_tablet_pad_group *g, *tg; xorg_list_for_each_entry_safe(g, tg, &pad->pad_group_list, link) tablet_pad_group_destroy(g); RemoveDevice(pad->xdevice, TRUE); xorg_list_del(&pad->link); zwp_tablet_pad_v2_destroy(pad->pad); free(pad); } static const struct zwp_tablet_pad_v2_listener tablet_pad_listener = { tablet_pad_group, tablet_pad_path, tablet_pad_buttons, tablet_pad_done, tablet_pad_button, tablet_pad_enter, tablet_pad_leave, tablet_pad_removed, }; static void tablet_seat_handle_add_tablet(void *data, struct zwp_tablet_seat_v2 *tablet_seat, struct zwp_tablet_v2 *tablet) { struct xwl_seat *xwl_seat = data; struct xwl_tablet *xwl_tablet; xwl_tablet = calloc(sizeof *xwl_tablet, 1); if (xwl_tablet == NULL) { ErrorF("%s ENOMEM\n", __func__); return; } xwl_tablet->tablet = tablet; xwl_tablet->seat = xwl_seat; xorg_list_add(&xwl_tablet->link, &xwl_seat->tablets); zwp_tablet_v2_add_listener(tablet, &tablet_listener, xwl_tablet); } static void xwl_tablet_tool_update_cursor(struct xwl_cursor *xwl_cursor) { struct xwl_tablet_tool *xwl_tablet_tool = wl_container_of(xwl_cursor, xwl_tablet_tool, cursor); xwl_tablet_tool_set_cursor(xwl_tablet_tool); } static void tablet_seat_handle_add_tool(void *data, struct zwp_tablet_seat_v2 *tablet_seat, struct zwp_tablet_tool_v2 *tool) { struct xwl_seat *xwl_seat = data; struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; struct xwl_tablet_tool *xwl_tablet_tool; xwl_tablet_tool = calloc(sizeof *xwl_tablet_tool, 1); if (xwl_tablet_tool == NULL) { ErrorF("%s ENOMEM\n", __func__); return; } xwl_tablet_tool->tool = tool; xwl_tablet_tool->seat = xwl_seat; xwl_cursor_init(&xwl_tablet_tool->cursor, xwl_screen, xwl_tablet_tool_update_cursor); xorg_list_add(&xwl_tablet_tool->link, &xwl_seat->tablet_tools); zwp_tablet_tool_v2_add_listener(tool, &tablet_tool_listener, xwl_tablet_tool); } static void tablet_seat_handle_add_pad(void *data, struct zwp_tablet_seat_v2 *tablet_seat, struct zwp_tablet_pad_v2 *pad) { struct xwl_seat *xwl_seat = data; struct xwl_tablet_pad *xwl_tablet_pad; xwl_tablet_pad = calloc(sizeof *xwl_tablet_pad, 1); if (xwl_tablet_pad == NULL) { ErrorF("%s ENOMEM\n", __func__); return; } xwl_tablet_pad->pad = pad; xwl_tablet_pad->seat = xwl_seat; xorg_list_init(&xwl_tablet_pad->pad_group_list); xorg_list_add(&xwl_tablet_pad->link, &xwl_seat->tablet_pads); zwp_tablet_pad_v2_add_listener(pad, &tablet_pad_listener, xwl_tablet_pad); } static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = { tablet_seat_handle_add_tablet, tablet_seat_handle_add_tool, tablet_seat_handle_add_pad }; static void init_tablet_manager_seat(struct xwl_screen *xwl_screen, struct xwl_seat *xwl_seat) { xorg_list_init(&xwl_seat->tablets); xorg_list_init(&xwl_seat->tablet_tools); xorg_list_init(&xwl_seat->tablet_pads); if (!xwl_screen->tablet_manager) return; xwl_seat->tablet_seat = zwp_tablet_manager_v2_get_tablet_seat(xwl_screen->tablet_manager, xwl_seat->seat); zwp_tablet_seat_v2_add_listener(xwl_seat->tablet_seat, &tablet_seat_listener, xwl_seat); } static void release_tablet_manager_seat(struct xwl_seat *xwl_seat) { struct xwl_tablet *xwl_tablet, *next_xwl_tablet; struct xwl_tablet_tool *xwl_tablet_tool, *next_xwl_tablet_tool; struct xwl_tablet_pad *xwl_tablet_pad, *next_xwl_tablet_pad; xorg_list_for_each_entry_safe(xwl_tablet_pad, next_xwl_tablet_pad, &xwl_seat->tablet_pads, link) { xorg_list_del(&xwl_tablet_pad->link); zwp_tablet_pad_v2_destroy(xwl_tablet_pad->pad); free(xwl_tablet_pad); } xorg_list_for_each_entry_safe(xwl_tablet_tool, next_xwl_tablet_tool, &xwl_seat->tablet_tools, link) { xorg_list_del(&xwl_tablet_tool->link); zwp_tablet_tool_v2_destroy(xwl_tablet_tool->tool); free(xwl_tablet_tool); } xorg_list_for_each_entry_safe(xwl_tablet, next_xwl_tablet, &xwl_seat->tablets, link) { xorg_list_del(&xwl_tablet->link); zwp_tablet_v2_destroy(xwl_tablet->tablet); free(xwl_tablet); } if (xwl_seat->tablet_seat) { zwp_tablet_seat_v2_destroy(xwl_seat->tablet_seat); xwl_seat->tablet_seat = NULL; } } static void init_tablet_manager(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { struct xwl_seat *xwl_seat; xwl_screen->tablet_manager = wl_registry_bind(xwl_screen->registry, id, &zwp_tablet_manager_v2_interface, min(version,1)); xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) { init_tablet_manager_seat(xwl_screen, xwl_seat); } } void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen) { if (xwl_screen->tablet_manager) { zwp_tablet_manager_v2_destroy(xwl_screen->tablet_manager); xwl_screen->tablet_manager = NULL; } } static void init_relative_pointer_manager(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { xwl_screen->relative_pointer_manager = wl_registry_bind(xwl_screen->registry, id, &zwp_relative_pointer_manager_v1_interface, 1); } static void init_pointer_constraints(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { xwl_screen->pointer_constraints = wl_registry_bind(xwl_screen->registry, id, &zwp_pointer_constraints_v1_interface, 1); } static void init_keyboard_grab(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { struct xwl_seat *xwl_seat; DeviceIntPtr master; xwl_screen->wp_grab = wl_registry_bind(xwl_screen->registry, id, &zwp_xwayland_keyboard_grab_manager_v1_interface, 1); xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) { if (xwl_seat->keyboard) { master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD); if (master) setup_keyboard_grab_handler(master); } } } static void input_handler(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) { struct xwl_screen *xwl_screen = data; if (strcmp(interface, "wl_seat") == 0 && version >= 3) { create_input_device(xwl_screen, id, version); xwl_screen->expecting_event++; } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) { init_relative_pointer_manager(xwl_screen, id, version); } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { init_pointer_constraints(xwl_screen, id, version); } else if (strcmp(interface, "zwp_tablet_manager_v2") == 0) { init_tablet_manager(xwl_screen, id, version); } else if (strcmp(interface, "zwp_xwayland_keyboard_grab_manager_v1") == 0) { init_keyboard_grab(xwl_screen, id, version); } } static void global_remove(void *data, struct wl_registry *registry, uint32_t name) { } static const struct wl_registry_listener input_listener = { input_handler, global_remove, }; Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) { return TRUE; } void ProcessInputEvents(void) { mieqProcessInputEvents(); } void DDXRingBell(int volume, int pitch, int duration) { } static Bool sprite_check_lost_focus(SpritePtr sprite, WindowPtr window) { DeviceIntPtr device, master; struct xwl_seat *xwl_seat; for (device = inputInfo.devices; device; device = device->next) { /* Ignore non-wayland devices */ if (device->deviceProc == xwl_pointer_proc && device->spriteInfo->sprite == sprite) break; } if (!device) return FALSE; xwl_seat = device->public.devicePrivate; master = GetMaster(device, POINTER_OR_FLOAT); if (!master || !master->lastSlave) return FALSE; /* We do want the last active slave, we only check on slave xwayland * devices so we can find out the xwl_seat, but those don't actually own * their sprite, so the match doesn't mean a lot. */ if (master->lastSlave == xwl_seat->pointer && xwl_seat->focus_window == NULL && xwl_seat->last_xwindow != NullWindow && IsParent(xwl_seat->last_xwindow, window)) return TRUE; return FALSE; } static WindowPtr xwl_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y) { struct xwl_screen *xwl_screen; WindowPtr ret; xwl_screen = xwl_screen_get(screen); screen->XYToWindow = xwl_screen->XYToWindow; ret = screen->XYToWindow(screen, sprite, x, y); xwl_screen->XYToWindow = screen->XYToWindow; screen->XYToWindow = xwl_xy_to_window; /* If the device controlling the sprite has left the Wayland surface but * the DIX still finds the pointer within the X11 window, it means that * the pointer has crossed to another native Wayland window, in this * case, pretend we entered the root window so that a LeaveNotify * event is emitted. */ if (sprite_check_lost_focus(sprite, ret)) { sprite->spriteTraceGood = 1; return sprite->spriteTrace[0]; } return ret; } void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window) { struct xwl_touch *xwl_touch, *next_xwl_touch; xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch, &xwl_seat->touches, link_touch) { if (xwl_touch->window->window == window) { xorg_list_del(&xwl_touch->link_touch); free(xwl_touch); } } } static void xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_emulator, int x, int y) { struct zwp_locked_pointer_v1 *locked_pointer = warp_emulator->locked_pointer; WindowPtr window; int sx, sy; if (!warp_emulator->locked_pointer) return; if (!warp_emulator->xwl_seat->focus_window) return; window = warp_emulator->xwl_seat->focus_window->window; if (x >= window->drawable.x || y >= window->drawable.y || x < (window->drawable.x + window->drawable.width) || y < (window->drawable.y + window->drawable.height)) { sx = x - window->drawable.x; sy = y - window->drawable.y; zwp_locked_pointer_v1_set_cursor_position_hint(locked_pointer, wl_fixed_from_int(sx), wl_fixed_from_int(sy)); wl_surface_commit(warp_emulator->xwl_seat->focus_window->surface); } } static Bool xwl_pointer_warp_emulator_is_locked(struct xwl_pointer_warp_emulator *warp_emulator) { if (warp_emulator->locked_pointer) return TRUE; else return FALSE; } static void xwl_pointer_warp_emulator_lock(struct xwl_pointer_warp_emulator *warp_emulator) { struct xwl_seat *xwl_seat = warp_emulator->xwl_seat; struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; struct zwp_pointer_constraints_v1 *pointer_constraints = xwl_screen->pointer_constraints; struct xwl_window *lock_window = xwl_seat->focus_window; warp_emulator->locked_window = lock_window; warp_emulator->locked_pointer = zwp_pointer_constraints_v1_lock_pointer(pointer_constraints, lock_window->surface, xwl_seat->wl_pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); } static void xwl_pointer_warp_emulator_maybe_lock(struct xwl_pointer_warp_emulator *warp_emulator, struct xwl_window *xwl_window, SpritePtr sprite, int x, int y) { struct xwl_seat *xwl_seat = warp_emulator->xwl_seat; GrabPtr pointer_grab = xwl_seat->pointer->deviceGrab.grab; if (warp_emulator->locked_pointer) return; /* * If there is no grab, and the window doesn't have pointer focus, ignore * the warp, as under Wayland it won't receive input anyway. */ if (!pointer_grab && xwl_seat->focus_window != xwl_window) return; /* * If there is a grab, but it's not an ownerEvents grab and the destination * is not the pointer focus, ignore it, as events wouldn't be delivered * there anyway. */ if (pointer_grab && !pointer_grab->ownerEvents && sprite && XYToWindow(sprite, x, y) != xwl_seat->focus_window->window) return; xwl_pointer_warp_emulator_lock(warp_emulator); } static void xwl_pointer_warp_emulator_warp(struct xwl_pointer_warp_emulator *warp_emulator, struct xwl_window *xwl_window, SpritePtr sprite, int x, int y) { xwl_pointer_warp_emulator_maybe_lock(warp_emulator, xwl_window, sprite, x, y); xwl_pointer_warp_emulator_set_fake_pos(warp_emulator, x, y); } static void xwl_pointer_warp_emulator_handle_motion(struct xwl_pointer_warp_emulator *warp_emulator, double dx, double dy, double dx_unaccel, double dy_unaccel) { struct xwl_seat *xwl_seat = warp_emulator->xwl_seat; ValuatorMask mask; WindowPtr window; int x, y; valuator_mask_zero(&mask); valuator_mask_set_unaccelerated(&mask, 0, dx, dx_unaccel); valuator_mask_set_unaccelerated(&mask, 1, dy, dy_unaccel); QueuePointerEvents(xwl_seat->relative_pointer, MotionNotify, 0, POINTER_RELATIVE, &mask); window = xwl_seat->focus_window->window; miPointerGetPosition(xwl_seat->pointer, &x, &y); if (xwl_pointer_warp_emulator_is_locked(warp_emulator) && xwl_seat->cursor_confinement_window != warp_emulator->locked_window && (x < window->drawable.x || y < window->drawable.y || x >= (window->drawable.x + window->drawable.width) || y >= (window->drawable.y + window->drawable.height))) xwl_seat_destroy_pointer_warp_emulator(xwl_seat); else xwl_pointer_warp_emulator_set_fake_pos(warp_emulator, x, y); } static struct xwl_pointer_warp_emulator * xwl_pointer_warp_emulator_create(struct xwl_seat *xwl_seat) { struct xwl_pointer_warp_emulator *warp_emulator; warp_emulator = calloc(1, sizeof *warp_emulator); if (!warp_emulator) { ErrorF("%s: ENOMEM\n", __func__); return NULL; } warp_emulator->xwl_seat = xwl_seat; return warp_emulator; } static void xwl_pointer_warp_emulator_destroy(struct xwl_pointer_warp_emulator *warp_emulator) { if (warp_emulator->locked_pointer) zwp_locked_pointer_v1_destroy(warp_emulator->locked_pointer); free(warp_emulator); } static void xwl_seat_create_pointer_warp_emulator(struct xwl_seat *xwl_seat) { if (xwl_seat->confined_pointer) xwl_seat_destroy_confined_pointer(xwl_seat); xwl_seat->pointer_warp_emulator = xwl_pointer_warp_emulator_create(xwl_seat); } static Bool xwl_seat_can_emulate_pointer_warp(struct xwl_seat *xwl_seat) { struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; if (!xwl_screen->relative_pointer_manager) return FALSE; if (!xwl_screen->pointer_constraints) return FALSE; return TRUE; } void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window, SpritePtr sprite, int x, int y) { if (!xwl_seat_can_emulate_pointer_warp(xwl_seat)) return; if (xwl_seat->x_cursor != NULL) return; if (!xwl_seat->pointer_warp_emulator) xwl_seat_create_pointer_warp_emulator(xwl_seat); if (!xwl_seat->pointer_warp_emulator) return; xwl_pointer_warp_emulator_warp(xwl_seat->pointer_warp_emulator, xwl_window, sprite, x, y); } static Bool xwl_seat_maybe_lock_on_hidden_cursor(struct xwl_seat *xwl_seat) { /* Some clients use hidden cursor+confineTo+relative motion * to implement infinite panning (eg. 3D views), lock the * pointer for so the relative pointer is used. */ if (xwl_seat->x_cursor || !xwl_seat->cursor_confinement_window) return FALSE; if (!xwl_seat->focus_window) return FALSE; if (xwl_seat->confined_pointer) xwl_seat_destroy_confined_pointer(xwl_seat); xwl_seat_create_pointer_warp_emulator(xwl_seat); xwl_pointer_warp_emulator_lock(xwl_seat->pointer_warp_emulator); return TRUE; } void xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat) { if (xwl_seat->pointer_warp_emulator && xwl_seat->x_cursor != NULL) { xwl_seat_destroy_pointer_warp_emulator(xwl_seat); } else if (!xwl_seat->x_cursor && xwl_seat->cursor_confinement_window) { /* If the cursor goes hidden as is confined, lock it for * relative motion to work. */ xwl_seat_maybe_lock_on_hidden_cursor(xwl_seat); } } void xwl_seat_destroy_pointer_warp_emulator(struct xwl_seat *xwl_seat) { if (!xwl_seat->pointer_warp_emulator) return; xwl_pointer_warp_emulator_destroy(xwl_seat->pointer_warp_emulator); xwl_seat->pointer_warp_emulator = NULL; if (xwl_seat->cursor_confinement_window) { xwl_seat_confine_pointer(xwl_seat, xwl_seat->cursor_confinement_window); } } void xwl_seat_confine_pointer(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window) { struct zwp_pointer_constraints_v1 *pointer_constraints = xwl_seat->xwl_screen->pointer_constraints; if (!pointer_constraints) return; if (xwl_seat->cursor_confinement_window == xwl_window && xwl_seat->confined_pointer) return; xwl_seat_unconfine_pointer(xwl_seat); xwl_seat->cursor_confinement_window = xwl_window; if (xwl_seat->pointer_warp_emulator) return; if (xwl_seat_maybe_lock_on_hidden_cursor(xwl_seat)) return; xwl_seat->confined_pointer = zwp_pointer_constraints_v1_confine_pointer(pointer_constraints, xwl_window->surface, xwl_seat->wl_pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); } static void xwl_seat_destroy_confined_pointer(struct xwl_seat *xwl_seat) { zwp_confined_pointer_v1_destroy(xwl_seat->confined_pointer); xwl_seat->confined_pointer = NULL; } void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat) { xwl_seat->cursor_confinement_window = NULL; if (xwl_seat->confined_pointer) xwl_seat_destroy_confined_pointer(xwl_seat); } void InitInput(int argc, char *argv[]) { ScreenPtr pScreen = screenInfo.screens[0]; struct xwl_screen *xwl_screen = xwl_screen_get(pScreen); mieqInit(); xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display); wl_registry_add_listener(xwl_screen->input_registry, &input_listener, xwl_screen); xwl_screen->XYToWindow = pScreen->XYToWindow; pScreen->XYToWindow = xwl_xy_to_window; wl_display_roundtrip(xwl_screen->display); while (xwl_screen->expecting_event) wl_display_roundtrip(xwl_screen->display); } void CloseInput(void) { mieqFini(); } xorg-server-1.20.8/hw/xwayland/Makefile.in0000644000175000017500000026660213640201514015330 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = Xwayland$(EXEEXT) @GLAMOR_EGL_TRUE@am__append_1 = \ @GLAMOR_EGL_TRUE@ xwayland-glamor.c \ @GLAMOR_EGL_TRUE@ xwayland-glamor-gbm.c \ @GLAMOR_EGL_TRUE@ xwayland-present.c @GLAMOR_EGL_TRUE@@XV_TRUE@am__append_2 = \ @GLAMOR_EGL_TRUE@@XV_TRUE@ xwayland-glamor-xv.c @GLAMOR_EGL_TRUE@@XWAYLAND_EGLSTREAM_TRUE@am__append_3 = \ @GLAMOR_EGL_TRUE@@XWAYLAND_EGLSTREAM_TRUE@ xwayland-glamor-eglstream.c @GLAMOR_EGL_TRUE@am__append_4 = $(glamor_built_sources) @GLAMOR_EGL_TRUE@am__append_5 = $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL @GLAMOR_EGL_FALSE@Xwayland_DEPENDENCIES = $(glamor_lib) \ @GLAMOR_EGL_FALSE@ $(am__DEPENDENCIES_1) \ @GLAMOR_EGL_FALSE@ $(top_builddir)/glx/libglxvnd.la \ @GLAMOR_EGL_FALSE@ $(am__DEPENDENCIES_1) \ @GLAMOR_EGL_FALSE@ $(top_builddir)/Xext/libXvidmode.la \ @GLAMOR_EGL_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) @XWAYLAND_EGLSTREAM_TRUE@am__append_6 = \ @XWAYLAND_EGLSTREAM_TRUE@ wayland-eglstream-client-protocol.h \ @XWAYLAND_EGLSTREAM_TRUE@ wayland-eglstream-protocol.c \ @XWAYLAND_EGLSTREAM_TRUE@ wayland-eglstream-controller-client-protocol.h \ @XWAYLAND_EGLSTREAM_TRUE@ wayland-eglstream-controller-protocol.c subdir = hw/xwayland ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__Xwayland_SOURCES_DIST = xwayland.c xwayland-input.c \ xwayland-cursor.c xwayland-shm.c xwayland-output.c \ xwayland-cvt.c xwayland-vidmode.c xwayland.h \ $(top_srcdir)/Xi/stubs.c $(top_srcdir)/mi/miinitext.c \ xwayland-glamor.c xwayland-glamor-gbm.c xwayland-present.c \ xwayland-glamor-xv.c xwayland-glamor-eglstream.c @GLAMOR_EGL_TRUE@am__objects_1 = Xwayland-xwayland-glamor.$(OBJEXT) \ @GLAMOR_EGL_TRUE@ Xwayland-xwayland-glamor-gbm.$(OBJEXT) \ @GLAMOR_EGL_TRUE@ Xwayland-xwayland-present.$(OBJEXT) @GLAMOR_EGL_TRUE@@XV_TRUE@am__objects_2 = Xwayland-xwayland-glamor-xv.$(OBJEXT) @GLAMOR_EGL_TRUE@@XWAYLAND_EGLSTREAM_TRUE@am__objects_3 = Xwayland-xwayland-glamor-eglstream.$(OBJEXT) am_Xwayland_OBJECTS = Xwayland-xwayland.$(OBJEXT) \ Xwayland-xwayland-input.$(OBJEXT) \ Xwayland-xwayland-cursor.$(OBJEXT) \ Xwayland-xwayland-shm.$(OBJEXT) \ Xwayland-xwayland-output.$(OBJEXT) \ Xwayland-xwayland-cvt.$(OBJEXT) \ Xwayland-xwayland-vidmode.$(OBJEXT) Xwayland-stubs.$(OBJEXT) \ Xwayland-miinitext.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ $(am__objects_3) @GLAMOR_EGL_TRUE@am__objects_4 = Xwayland-drm-protocol.$(OBJEXT) @GLAMOR_EGL_TRUE@am__objects_5 = $(am__objects_4) @XWAYLAND_EGLSTREAM_TRUE@am__objects_6 = Xwayland-wayland-eglstream-protocol.$(OBJEXT) \ @XWAYLAND_EGLSTREAM_TRUE@ Xwayland-wayland-eglstream-controller-protocol.$(OBJEXT) am__objects_7 = $(am__objects_5) \ Xwayland-relative-pointer-unstable-v1-protocol.$(OBJEXT) \ Xwayland-pointer-constraints-unstable-v1-protocol.$(OBJEXT) \ Xwayland-tablet-unstable-v2-protocol.$(OBJEXT) \ Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.$(OBJEXT) \ Xwayland-xdg-output-unstable-v1-protocol.$(OBJEXT) \ Xwayland-linux-dmabuf-unstable-v1-protocol.$(OBJEXT) \ $(am__objects_6) nodist_Xwayland_OBJECTS = $(am__objects_7) Xwayland_OBJECTS = $(am_Xwayland_OBJECTS) $(nodist_Xwayland_OBJECTS) am__DEPENDENCIES_1 = @GLAMOR_EGL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ @GLAMOR_EGL_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = Xwayland_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(Xwayland_CFLAGS) \ $(CFLAGS) $(Xwayland_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/Xwayland-drm-protocol.Po \ ./$(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Po \ ./$(DEPDIR)/Xwayland-miinitext.Po \ ./$(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Po \ ./$(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Po \ ./$(DEPDIR)/Xwayland-stubs.Po \ ./$(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Po \ ./$(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Po \ ./$(DEPDIR)/Xwayland-wayland-eglstream-protocol.Po \ ./$(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Po \ ./$(DEPDIR)/Xwayland-xwayland-cursor.Po \ ./$(DEPDIR)/Xwayland-xwayland-cvt.Po \ ./$(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Po \ ./$(DEPDIR)/Xwayland-xwayland-glamor-gbm.Po \ ./$(DEPDIR)/Xwayland-xwayland-glamor-xv.Po \ ./$(DEPDIR)/Xwayland-xwayland-glamor.Po \ ./$(DEPDIR)/Xwayland-xwayland-input.Po \ ./$(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Po \ ./$(DEPDIR)/Xwayland-xwayland-output.Po \ ./$(DEPDIR)/Xwayland-xwayland-present.Po \ ./$(DEPDIR)/Xwayland-xwayland-shm.Po \ ./$(DEPDIR)/Xwayland-xwayland-vidmode.Po \ ./$(DEPDIR)/Xwayland-xwayland.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(Xwayland_SOURCES) $(nodist_Xwayland_SOURCES) DIST_SOURCES = $(am__Xwayland_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ Xwayland_CFLAGS = \ -I$(top_srcdir)/glamor \ -I$(top_srcdir)/dri3 \ -DHAVE_DIX_CONFIG_H \ $(XWAYLANDMODULES_CFLAGS) \ $(DIX_CFLAGS) \ $(GLAMOR_CFLAGS) \ $(GBM_CFLAGS) Xwayland_SOURCES = xwayland.c xwayland-input.c xwayland-cursor.c \ xwayland-shm.c xwayland-output.c xwayland-cvt.c \ xwayland-vidmode.c xwayland.h $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c $(am__append_1) $(am__append_2) \ $(am__append_3) Xwayland_LDADD = $(glamor_lib) $(XWAYLAND_LIBS) \ $(top_builddir)/glx/libglxvnd.la $(XWAYLAND_SYS_LIBS) \ $(top_builddir)/Xext/libXvidmode.la $(XSERVER_SYS_LIBS) \ $(am__append_5) Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) Xwayland_built_sources = $(am__append_4) \ relative-pointer-unstable-v1-client-protocol.h \ relative-pointer-unstable-v1-protocol.c \ pointer-constraints-unstable-v1-client-protocol.h \ pointer-constraints-unstable-v1-protocol.c \ tablet-unstable-v2-client-protocol.h \ tablet-unstable-v2-protocol.c \ xwayland-keyboard-grab-unstable-v1-protocol.c \ xwayland-keyboard-grab-unstable-v1-client-protocol.h \ xdg-output-unstable-v1-protocol.c \ xdg-output-unstable-v1-client-protocol.h \ linux-dmabuf-unstable-v1-client-protocol.h \ linux-dmabuf-unstable-v1-protocol.c $(am__append_6) @GLAMOR_EGL_TRUE@glamor_built_sources = \ @GLAMOR_EGL_TRUE@ drm-client-protocol.h \ @GLAMOR_EGL_TRUE@ drm-protocol.c @GLAMOR_EGL_TRUE@glamor_lib = $(top_builddir)/glamor/libglamor.la @GLAMOR_EGL_TRUE@Xwayland_DEPENDENCIES = $(glamor_lib) $(XWAYLAND_LIBS) nodist_Xwayland_SOURCES = $(Xwayland_built_sources) CLEANFILES = $(Xwayland_built_sources) EXTRA_DIST = drm.xml all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwayland/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xwayland/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list Xwayland$(EXEEXT): $(Xwayland_OBJECTS) $(Xwayland_DEPENDENCIES) $(EXTRA_Xwayland_DEPENDENCIES) @rm -f Xwayland$(EXEEXT) $(AM_V_CCLD)$(Xwayland_LINK) $(Xwayland_OBJECTS) $(Xwayland_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-drm-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-miinitext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-stubs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-wayland-eglstream-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-cursor.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-cvt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-glamor-gbm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-glamor-xv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-glamor.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-input.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-output.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-present.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-shm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-vidmode.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< Xwayland-xwayland.o: xwayland.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland.Tpo -c -o Xwayland-xwayland.o `test -f 'xwayland.c' || echo '$(srcdir)/'`xwayland.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland.Tpo $(DEPDIR)/Xwayland-xwayland.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland.c' object='Xwayland-xwayland.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland.o `test -f 'xwayland.c' || echo '$(srcdir)/'`xwayland.c Xwayland-xwayland.obj: xwayland.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland.Tpo -c -o Xwayland-xwayland.obj `if test -f 'xwayland.c'; then $(CYGPATH_W) 'xwayland.c'; else $(CYGPATH_W) '$(srcdir)/xwayland.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland.Tpo $(DEPDIR)/Xwayland-xwayland.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland.c' object='Xwayland-xwayland.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland.obj `if test -f 'xwayland.c'; then $(CYGPATH_W) 'xwayland.c'; else $(CYGPATH_W) '$(srcdir)/xwayland.c'; fi` Xwayland-xwayland-input.o: xwayland-input.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-input.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-input.Tpo -c -o Xwayland-xwayland-input.o `test -f 'xwayland-input.c' || echo '$(srcdir)/'`xwayland-input.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-input.Tpo $(DEPDIR)/Xwayland-xwayland-input.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-input.c' object='Xwayland-xwayland-input.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-input.o `test -f 'xwayland-input.c' || echo '$(srcdir)/'`xwayland-input.c Xwayland-xwayland-input.obj: xwayland-input.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-input.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-input.Tpo -c -o Xwayland-xwayland-input.obj `if test -f 'xwayland-input.c'; then $(CYGPATH_W) 'xwayland-input.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-input.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-input.Tpo $(DEPDIR)/Xwayland-xwayland-input.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-input.c' object='Xwayland-xwayland-input.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-input.obj `if test -f 'xwayland-input.c'; then $(CYGPATH_W) 'xwayland-input.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-input.c'; fi` Xwayland-xwayland-cursor.o: xwayland-cursor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cursor.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cursor.Tpo -c -o Xwayland-xwayland-cursor.o `test -f 'xwayland-cursor.c' || echo '$(srcdir)/'`xwayland-cursor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cursor.Tpo $(DEPDIR)/Xwayland-xwayland-cursor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cursor.c' object='Xwayland-xwayland-cursor.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cursor.o `test -f 'xwayland-cursor.c' || echo '$(srcdir)/'`xwayland-cursor.c Xwayland-xwayland-cursor.obj: xwayland-cursor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cursor.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cursor.Tpo -c -o Xwayland-xwayland-cursor.obj `if test -f 'xwayland-cursor.c'; then $(CYGPATH_W) 'xwayland-cursor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cursor.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cursor.Tpo $(DEPDIR)/Xwayland-xwayland-cursor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cursor.c' object='Xwayland-xwayland-cursor.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cursor.obj `if test -f 'xwayland-cursor.c'; then $(CYGPATH_W) 'xwayland-cursor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cursor.c'; fi` Xwayland-xwayland-shm.o: xwayland-shm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-shm.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-shm.Tpo -c -o Xwayland-xwayland-shm.o `test -f 'xwayland-shm.c' || echo '$(srcdir)/'`xwayland-shm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-shm.Tpo $(DEPDIR)/Xwayland-xwayland-shm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-shm.c' object='Xwayland-xwayland-shm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-shm.o `test -f 'xwayland-shm.c' || echo '$(srcdir)/'`xwayland-shm.c Xwayland-xwayland-shm.obj: xwayland-shm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-shm.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-shm.Tpo -c -o Xwayland-xwayland-shm.obj `if test -f 'xwayland-shm.c'; then $(CYGPATH_W) 'xwayland-shm.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-shm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-shm.Tpo $(DEPDIR)/Xwayland-xwayland-shm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-shm.c' object='Xwayland-xwayland-shm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-shm.obj `if test -f 'xwayland-shm.c'; then $(CYGPATH_W) 'xwayland-shm.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-shm.c'; fi` Xwayland-xwayland-output.o: xwayland-output.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-output.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-output.Tpo -c -o Xwayland-xwayland-output.o `test -f 'xwayland-output.c' || echo '$(srcdir)/'`xwayland-output.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-output.Tpo $(DEPDIR)/Xwayland-xwayland-output.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-output.c' object='Xwayland-xwayland-output.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-output.o `test -f 'xwayland-output.c' || echo '$(srcdir)/'`xwayland-output.c Xwayland-xwayland-output.obj: xwayland-output.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-output.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-output.Tpo -c -o Xwayland-xwayland-output.obj `if test -f 'xwayland-output.c'; then $(CYGPATH_W) 'xwayland-output.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-output.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-output.Tpo $(DEPDIR)/Xwayland-xwayland-output.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-output.c' object='Xwayland-xwayland-output.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-output.obj `if test -f 'xwayland-output.c'; then $(CYGPATH_W) 'xwayland-output.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-output.c'; fi` Xwayland-xwayland-cvt.o: xwayland-cvt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cvt.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cvt.Tpo -c -o Xwayland-xwayland-cvt.o `test -f 'xwayland-cvt.c' || echo '$(srcdir)/'`xwayland-cvt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cvt.Tpo $(DEPDIR)/Xwayland-xwayland-cvt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cvt.c' object='Xwayland-xwayland-cvt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cvt.o `test -f 'xwayland-cvt.c' || echo '$(srcdir)/'`xwayland-cvt.c Xwayland-xwayland-cvt.obj: xwayland-cvt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cvt.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cvt.Tpo -c -o Xwayland-xwayland-cvt.obj `if test -f 'xwayland-cvt.c'; then $(CYGPATH_W) 'xwayland-cvt.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cvt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cvt.Tpo $(DEPDIR)/Xwayland-xwayland-cvt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cvt.c' object='Xwayland-xwayland-cvt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cvt.obj `if test -f 'xwayland-cvt.c'; then $(CYGPATH_W) 'xwayland-cvt.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cvt.c'; fi` Xwayland-xwayland-vidmode.o: xwayland-vidmode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-vidmode.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-vidmode.Tpo -c -o Xwayland-xwayland-vidmode.o `test -f 'xwayland-vidmode.c' || echo '$(srcdir)/'`xwayland-vidmode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-vidmode.Tpo $(DEPDIR)/Xwayland-xwayland-vidmode.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-vidmode.c' object='Xwayland-xwayland-vidmode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-vidmode.o `test -f 'xwayland-vidmode.c' || echo '$(srcdir)/'`xwayland-vidmode.c Xwayland-xwayland-vidmode.obj: xwayland-vidmode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-vidmode.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-vidmode.Tpo -c -o Xwayland-xwayland-vidmode.obj `if test -f 'xwayland-vidmode.c'; then $(CYGPATH_W) 'xwayland-vidmode.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-vidmode.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-vidmode.Tpo $(DEPDIR)/Xwayland-xwayland-vidmode.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-vidmode.c' object='Xwayland-xwayland-vidmode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-vidmode.obj `if test -f 'xwayland-vidmode.c'; then $(CYGPATH_W) 'xwayland-vidmode.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-vidmode.c'; fi` Xwayland-stubs.o: $(top_srcdir)/Xi/stubs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-stubs.o -MD -MP -MF $(DEPDIR)/Xwayland-stubs.Tpo -c -o Xwayland-stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-stubs.Tpo $(DEPDIR)/Xwayland-stubs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='Xwayland-stubs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c Xwayland-stubs.obj: $(top_srcdir)/Xi/stubs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-stubs.obj -MD -MP -MF $(DEPDIR)/Xwayland-stubs.Tpo -c -o Xwayland-stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-stubs.Tpo $(DEPDIR)/Xwayland-stubs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='Xwayland-stubs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` Xwayland-miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-miinitext.o -MD -MP -MF $(DEPDIR)/Xwayland-miinitext.Tpo -c -o Xwayland-miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-miinitext.Tpo $(DEPDIR)/Xwayland-miinitext.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='Xwayland-miinitext.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c Xwayland-miinitext.obj: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-miinitext.obj -MD -MP -MF $(DEPDIR)/Xwayland-miinitext.Tpo -c -o Xwayland-miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-miinitext.Tpo $(DEPDIR)/Xwayland-miinitext.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='Xwayland-miinitext.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` Xwayland-xwayland-glamor.o: xwayland-glamor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor.Tpo -c -o Xwayland-xwayland-glamor.o `test -f 'xwayland-glamor.c' || echo '$(srcdir)/'`xwayland-glamor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor.Tpo $(DEPDIR)/Xwayland-xwayland-glamor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor.c' object='Xwayland-xwayland-glamor.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor.o `test -f 'xwayland-glamor.c' || echo '$(srcdir)/'`xwayland-glamor.c Xwayland-xwayland-glamor.obj: xwayland-glamor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor.Tpo -c -o Xwayland-xwayland-glamor.obj `if test -f 'xwayland-glamor.c'; then $(CYGPATH_W) 'xwayland-glamor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor.Tpo $(DEPDIR)/Xwayland-xwayland-glamor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor.c' object='Xwayland-xwayland-glamor.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor.obj `if test -f 'xwayland-glamor.c'; then $(CYGPATH_W) 'xwayland-glamor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor.c'; fi` Xwayland-xwayland-glamor-gbm.o: xwayland-glamor-gbm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor-gbm.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor-gbm.Tpo -c -o Xwayland-xwayland-glamor-gbm.o `test -f 'xwayland-glamor-gbm.c' || echo '$(srcdir)/'`xwayland-glamor-gbm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor-gbm.Tpo $(DEPDIR)/Xwayland-xwayland-glamor-gbm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor-gbm.c' object='Xwayland-xwayland-glamor-gbm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor-gbm.o `test -f 'xwayland-glamor-gbm.c' || echo '$(srcdir)/'`xwayland-glamor-gbm.c Xwayland-xwayland-glamor-gbm.obj: xwayland-glamor-gbm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor-gbm.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor-gbm.Tpo -c -o Xwayland-xwayland-glamor-gbm.obj `if test -f 'xwayland-glamor-gbm.c'; then $(CYGPATH_W) 'xwayland-glamor-gbm.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor-gbm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor-gbm.Tpo $(DEPDIR)/Xwayland-xwayland-glamor-gbm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor-gbm.c' object='Xwayland-xwayland-glamor-gbm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor-gbm.obj `if test -f 'xwayland-glamor-gbm.c'; then $(CYGPATH_W) 'xwayland-glamor-gbm.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor-gbm.c'; fi` Xwayland-xwayland-present.o: xwayland-present.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-present.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-present.Tpo -c -o Xwayland-xwayland-present.o `test -f 'xwayland-present.c' || echo '$(srcdir)/'`xwayland-present.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-present.Tpo $(DEPDIR)/Xwayland-xwayland-present.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-present.c' object='Xwayland-xwayland-present.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-present.o `test -f 'xwayland-present.c' || echo '$(srcdir)/'`xwayland-present.c Xwayland-xwayland-present.obj: xwayland-present.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-present.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-present.Tpo -c -o Xwayland-xwayland-present.obj `if test -f 'xwayland-present.c'; then $(CYGPATH_W) 'xwayland-present.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-present.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-present.Tpo $(DEPDIR)/Xwayland-xwayland-present.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-present.c' object='Xwayland-xwayland-present.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-present.obj `if test -f 'xwayland-present.c'; then $(CYGPATH_W) 'xwayland-present.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-present.c'; fi` Xwayland-xwayland-glamor-xv.o: xwayland-glamor-xv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor-xv.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor-xv.Tpo -c -o Xwayland-xwayland-glamor-xv.o `test -f 'xwayland-glamor-xv.c' || echo '$(srcdir)/'`xwayland-glamor-xv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor-xv.Tpo $(DEPDIR)/Xwayland-xwayland-glamor-xv.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor-xv.c' object='Xwayland-xwayland-glamor-xv.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor-xv.o `test -f 'xwayland-glamor-xv.c' || echo '$(srcdir)/'`xwayland-glamor-xv.c Xwayland-xwayland-glamor-xv.obj: xwayland-glamor-xv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor-xv.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor-xv.Tpo -c -o Xwayland-xwayland-glamor-xv.obj `if test -f 'xwayland-glamor-xv.c'; then $(CYGPATH_W) 'xwayland-glamor-xv.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor-xv.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor-xv.Tpo $(DEPDIR)/Xwayland-xwayland-glamor-xv.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor-xv.c' object='Xwayland-xwayland-glamor-xv.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor-xv.obj `if test -f 'xwayland-glamor-xv.c'; then $(CYGPATH_W) 'xwayland-glamor-xv.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor-xv.c'; fi` Xwayland-xwayland-glamor-eglstream.o: xwayland-glamor-eglstream.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor-eglstream.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Tpo -c -o Xwayland-xwayland-glamor-eglstream.o `test -f 'xwayland-glamor-eglstream.c' || echo '$(srcdir)/'`xwayland-glamor-eglstream.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Tpo $(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor-eglstream.c' object='Xwayland-xwayland-glamor-eglstream.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor-eglstream.o `test -f 'xwayland-glamor-eglstream.c' || echo '$(srcdir)/'`xwayland-glamor-eglstream.c Xwayland-xwayland-glamor-eglstream.obj: xwayland-glamor-eglstream.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor-eglstream.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Tpo -c -o Xwayland-xwayland-glamor-eglstream.obj `if test -f 'xwayland-glamor-eglstream.c'; then $(CYGPATH_W) 'xwayland-glamor-eglstream.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor-eglstream.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Tpo $(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor-eglstream.c' object='Xwayland-xwayland-glamor-eglstream.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor-eglstream.obj `if test -f 'xwayland-glamor-eglstream.c'; then $(CYGPATH_W) 'xwayland-glamor-eglstream.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor-eglstream.c'; fi` Xwayland-drm-protocol.o: drm-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-drm-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-drm-protocol.Tpo -c -o Xwayland-drm-protocol.o `test -f 'drm-protocol.c' || echo '$(srcdir)/'`drm-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-drm-protocol.Tpo $(DEPDIR)/Xwayland-drm-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='drm-protocol.c' object='Xwayland-drm-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-drm-protocol.o `test -f 'drm-protocol.c' || echo '$(srcdir)/'`drm-protocol.c Xwayland-drm-protocol.obj: drm-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-drm-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-drm-protocol.Tpo -c -o Xwayland-drm-protocol.obj `if test -f 'drm-protocol.c'; then $(CYGPATH_W) 'drm-protocol.c'; else $(CYGPATH_W) '$(srcdir)/drm-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-drm-protocol.Tpo $(DEPDIR)/Xwayland-drm-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='drm-protocol.c' object='Xwayland-drm-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-drm-protocol.obj `if test -f 'drm-protocol.c'; then $(CYGPATH_W) 'drm-protocol.c'; else $(CYGPATH_W) '$(srcdir)/drm-protocol.c'; fi` Xwayland-relative-pointer-unstable-v1-protocol.o: relative-pointer-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-relative-pointer-unstable-v1-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Tpo -c -o Xwayland-relative-pointer-unstable-v1-protocol.o `test -f 'relative-pointer-unstable-v1-protocol.c' || echo '$(srcdir)/'`relative-pointer-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relative-pointer-unstable-v1-protocol.c' object='Xwayland-relative-pointer-unstable-v1-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-relative-pointer-unstable-v1-protocol.o `test -f 'relative-pointer-unstable-v1-protocol.c' || echo '$(srcdir)/'`relative-pointer-unstable-v1-protocol.c Xwayland-relative-pointer-unstable-v1-protocol.obj: relative-pointer-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-relative-pointer-unstable-v1-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Tpo -c -o Xwayland-relative-pointer-unstable-v1-protocol.obj `if test -f 'relative-pointer-unstable-v1-protocol.c'; then $(CYGPATH_W) 'relative-pointer-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/relative-pointer-unstable-v1-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relative-pointer-unstable-v1-protocol.c' object='Xwayland-relative-pointer-unstable-v1-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-relative-pointer-unstable-v1-protocol.obj `if test -f 'relative-pointer-unstable-v1-protocol.c'; then $(CYGPATH_W) 'relative-pointer-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/relative-pointer-unstable-v1-protocol.c'; fi` Xwayland-pointer-constraints-unstable-v1-protocol.o: pointer-constraints-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-pointer-constraints-unstable-v1-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Tpo -c -o Xwayland-pointer-constraints-unstable-v1-protocol.o `test -f 'pointer-constraints-unstable-v1-protocol.c' || echo '$(srcdir)/'`pointer-constraints-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pointer-constraints-unstable-v1-protocol.c' object='Xwayland-pointer-constraints-unstable-v1-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-pointer-constraints-unstable-v1-protocol.o `test -f 'pointer-constraints-unstable-v1-protocol.c' || echo '$(srcdir)/'`pointer-constraints-unstable-v1-protocol.c Xwayland-pointer-constraints-unstable-v1-protocol.obj: pointer-constraints-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-pointer-constraints-unstable-v1-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Tpo -c -o Xwayland-pointer-constraints-unstable-v1-protocol.obj `if test -f 'pointer-constraints-unstable-v1-protocol.c'; then $(CYGPATH_W) 'pointer-constraints-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/pointer-constraints-unstable-v1-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pointer-constraints-unstable-v1-protocol.c' object='Xwayland-pointer-constraints-unstable-v1-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-pointer-constraints-unstable-v1-protocol.obj `if test -f 'pointer-constraints-unstable-v1-protocol.c'; then $(CYGPATH_W) 'pointer-constraints-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/pointer-constraints-unstable-v1-protocol.c'; fi` Xwayland-tablet-unstable-v2-protocol.o: tablet-unstable-v2-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-tablet-unstable-v2-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Tpo -c -o Xwayland-tablet-unstable-v2-protocol.o `test -f 'tablet-unstable-v2-protocol.c' || echo '$(srcdir)/'`tablet-unstable-v2-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Tpo $(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tablet-unstable-v2-protocol.c' object='Xwayland-tablet-unstable-v2-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-tablet-unstable-v2-protocol.o `test -f 'tablet-unstable-v2-protocol.c' || echo '$(srcdir)/'`tablet-unstable-v2-protocol.c Xwayland-tablet-unstable-v2-protocol.obj: tablet-unstable-v2-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-tablet-unstable-v2-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Tpo -c -o Xwayland-tablet-unstable-v2-protocol.obj `if test -f 'tablet-unstable-v2-protocol.c'; then $(CYGPATH_W) 'tablet-unstable-v2-protocol.c'; else $(CYGPATH_W) '$(srcdir)/tablet-unstable-v2-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Tpo $(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tablet-unstable-v2-protocol.c' object='Xwayland-tablet-unstable-v2-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-tablet-unstable-v2-protocol.obj `if test -f 'tablet-unstable-v2-protocol.c'; then $(CYGPATH_W) 'tablet-unstable-v2-protocol.c'; else $(CYGPATH_W) '$(srcdir)/tablet-unstable-v2-protocol.c'; fi` Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.o: xwayland-keyboard-grab-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Tpo -c -o Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.o `test -f 'xwayland-keyboard-grab-unstable-v1-protocol.c' || echo '$(srcdir)/'`xwayland-keyboard-grab-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-keyboard-grab-unstable-v1-protocol.c' object='Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.o `test -f 'xwayland-keyboard-grab-unstable-v1-protocol.c' || echo '$(srcdir)/'`xwayland-keyboard-grab-unstable-v1-protocol.c Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.obj: xwayland-keyboard-grab-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Tpo -c -o Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.obj `if test -f 'xwayland-keyboard-grab-unstable-v1-protocol.c'; then $(CYGPATH_W) 'xwayland-keyboard-grab-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-keyboard-grab-unstable-v1-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-keyboard-grab-unstable-v1-protocol.c' object='Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.obj `if test -f 'xwayland-keyboard-grab-unstable-v1-protocol.c'; then $(CYGPATH_W) 'xwayland-keyboard-grab-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-keyboard-grab-unstable-v1-protocol.c'; fi` Xwayland-xdg-output-unstable-v1-protocol.o: xdg-output-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xdg-output-unstable-v1-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Tpo -c -o Xwayland-xdg-output-unstable-v1-protocol.o `test -f 'xdg-output-unstable-v1-protocol.c' || echo '$(srcdir)/'`xdg-output-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xdg-output-unstable-v1-protocol.c' object='Xwayland-xdg-output-unstable-v1-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xdg-output-unstable-v1-protocol.o `test -f 'xdg-output-unstable-v1-protocol.c' || echo '$(srcdir)/'`xdg-output-unstable-v1-protocol.c Xwayland-xdg-output-unstable-v1-protocol.obj: xdg-output-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xdg-output-unstable-v1-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Tpo -c -o Xwayland-xdg-output-unstable-v1-protocol.obj `if test -f 'xdg-output-unstable-v1-protocol.c'; then $(CYGPATH_W) 'xdg-output-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/xdg-output-unstable-v1-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xdg-output-unstable-v1-protocol.c' object='Xwayland-xdg-output-unstable-v1-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xdg-output-unstable-v1-protocol.obj `if test -f 'xdg-output-unstable-v1-protocol.c'; then $(CYGPATH_W) 'xdg-output-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/xdg-output-unstable-v1-protocol.c'; fi` Xwayland-linux-dmabuf-unstable-v1-protocol.o: linux-dmabuf-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-linux-dmabuf-unstable-v1-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Tpo -c -o Xwayland-linux-dmabuf-unstable-v1-protocol.o `test -f 'linux-dmabuf-unstable-v1-protocol.c' || echo '$(srcdir)/'`linux-dmabuf-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='linux-dmabuf-unstable-v1-protocol.c' object='Xwayland-linux-dmabuf-unstable-v1-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-linux-dmabuf-unstable-v1-protocol.o `test -f 'linux-dmabuf-unstable-v1-protocol.c' || echo '$(srcdir)/'`linux-dmabuf-unstable-v1-protocol.c Xwayland-linux-dmabuf-unstable-v1-protocol.obj: linux-dmabuf-unstable-v1-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-linux-dmabuf-unstable-v1-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Tpo -c -o Xwayland-linux-dmabuf-unstable-v1-protocol.obj `if test -f 'linux-dmabuf-unstable-v1-protocol.c'; then $(CYGPATH_W) 'linux-dmabuf-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/linux-dmabuf-unstable-v1-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Tpo $(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='linux-dmabuf-unstable-v1-protocol.c' object='Xwayland-linux-dmabuf-unstable-v1-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-linux-dmabuf-unstable-v1-protocol.obj `if test -f 'linux-dmabuf-unstable-v1-protocol.c'; then $(CYGPATH_W) 'linux-dmabuf-unstable-v1-protocol.c'; else $(CYGPATH_W) '$(srcdir)/linux-dmabuf-unstable-v1-protocol.c'; fi` Xwayland-wayland-eglstream-protocol.o: wayland-eglstream-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-wayland-eglstream-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-wayland-eglstream-protocol.Tpo -c -o Xwayland-wayland-eglstream-protocol.o `test -f 'wayland-eglstream-protocol.c' || echo '$(srcdir)/'`wayland-eglstream-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-wayland-eglstream-protocol.Tpo $(DEPDIR)/Xwayland-wayland-eglstream-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wayland-eglstream-protocol.c' object='Xwayland-wayland-eglstream-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-wayland-eglstream-protocol.o `test -f 'wayland-eglstream-protocol.c' || echo '$(srcdir)/'`wayland-eglstream-protocol.c Xwayland-wayland-eglstream-protocol.obj: wayland-eglstream-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-wayland-eglstream-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-wayland-eglstream-protocol.Tpo -c -o Xwayland-wayland-eglstream-protocol.obj `if test -f 'wayland-eglstream-protocol.c'; then $(CYGPATH_W) 'wayland-eglstream-protocol.c'; else $(CYGPATH_W) '$(srcdir)/wayland-eglstream-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-wayland-eglstream-protocol.Tpo $(DEPDIR)/Xwayland-wayland-eglstream-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wayland-eglstream-protocol.c' object='Xwayland-wayland-eglstream-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-wayland-eglstream-protocol.obj `if test -f 'wayland-eglstream-protocol.c'; then $(CYGPATH_W) 'wayland-eglstream-protocol.c'; else $(CYGPATH_W) '$(srcdir)/wayland-eglstream-protocol.c'; fi` Xwayland-wayland-eglstream-controller-protocol.o: wayland-eglstream-controller-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-wayland-eglstream-controller-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Tpo -c -o Xwayland-wayland-eglstream-controller-protocol.o `test -f 'wayland-eglstream-controller-protocol.c' || echo '$(srcdir)/'`wayland-eglstream-controller-protocol.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Tpo $(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wayland-eglstream-controller-protocol.c' object='Xwayland-wayland-eglstream-controller-protocol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-wayland-eglstream-controller-protocol.o `test -f 'wayland-eglstream-controller-protocol.c' || echo '$(srcdir)/'`wayland-eglstream-controller-protocol.c Xwayland-wayland-eglstream-controller-protocol.obj: wayland-eglstream-controller-protocol.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-wayland-eglstream-controller-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Tpo -c -o Xwayland-wayland-eglstream-controller-protocol.obj `if test -f 'wayland-eglstream-controller-protocol.c'; then $(CYGPATH_W) 'wayland-eglstream-controller-protocol.c'; else $(CYGPATH_W) '$(srcdir)/wayland-eglstream-controller-protocol.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Tpo $(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wayland-eglstream-controller-protocol.c' object='Xwayland-wayland-eglstream-controller-protocol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-wayland-eglstream-controller-protocol.obj `if test -f 'wayland-eglstream-controller-protocol.c'; then $(CYGPATH_W) 'wayland-eglstream-controller-protocol.c'; else $(CYGPATH_W) '$(srcdir)/wayland-eglstream-controller-protocol.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/Xwayland-drm-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-miinitext.Po -rm -f ./$(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-stubs.Po -rm -f ./$(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-wayland-eglstream-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-cursor.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-cvt.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor-gbm.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor-xv.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-input.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-output.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-present.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-shm.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-vidmode.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/Xwayland-drm-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-linux-dmabuf-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-miinitext.Po -rm -f ./$(DEPDIR)/Xwayland-pointer-constraints-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-relative-pointer-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-stubs.Po -rm -f ./$(DEPDIR)/Xwayland-tablet-unstable-v2-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-wayland-eglstream-controller-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-wayland-eglstream-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-xdg-output-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-cursor.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-cvt.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor-eglstream.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor-gbm.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor-xv.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-glamor.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-input.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-keyboard-grab-unstable-v1-protocol.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-output.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-present.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-shm.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland-vidmode.Po -rm -f ./$(DEPDIR)/Xwayland-xwayland.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile $(Xwayland_SOURCES): $(Xwayland_built_sources) relink: $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT) relative-pointer-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ relative-pointer-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ pointer-constraints-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ pointer-constraints-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ tablet-unstable-v2-protocol.c: $(WAYLAND_PROTOCOLS_DATADIR)/unstable/tablet/tablet-unstable-v2.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ tablet-unstable-v2-client-protocol.h: $(WAYLAND_PROTOCOLS_DATADIR)/unstable/tablet/tablet-unstable-v2.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ xwayland-keyboard-grab-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ xwayland-keyboard-grab-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ xdg-output-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xdg-output/xdg-output-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ xdg-output-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/xdg-output/xdg-output-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ linux-dmabuf-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ linux-dmabuf-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ wayland-eglstream-client-protocol.h : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ wayland-eglstream-controller-client-protocol.h : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream-controller.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ wayland-eglstream-protocol.c : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream.xml $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ wayland-eglstream-controller-protocol.c : $(WAYLAND_EGLSTREAM_DATADIR)/wayland-eglstream-controller.xml $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ %-protocol.c : %.xml $(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@ %-client-protocol.h : %.xml $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xwayland/xwayland-cvt.c0000644000175000017500000002477213640201473016054 00000000000000/* Copied from hw/xfree86/modes/xf86cvt.c into xwayland DDX and * changed to generate an RRMode */ /* * Copyright 2005-2006 Luc Verhaegen. * * 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. */ /* * The reason for having this function in a file of its own is * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode * code is shared directly. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "xwayland.h" /* * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh. * * These calculations are stolen from the CVT calculation spreadsheet written * by Graham Loveridge. He seems to be claiming no copyright and there seems to * be no license attached to this. He apparently just wants to see his name * mentioned. * * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls * * Comments and structure corresponds to the comments and structure of the xls. * This should ease importing of future changes to the standard (not very * likely though). * * About margins; i'm sure that they are to be the bit between HDisplay and * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking * outside sync "margin" for some reason. Since we prefer seeing proper * blanking instead of the overscan colour, and since the Crtc* values will * probably get altered after us, we will disable margins altogether. With * these calculations, Margins will plainly expand H/VDisplay, and we don't * want that. -- libv * */ RRModePtr xwayland_cvt(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced) { /* 1) top/bottom margin size (% of height) - default: 1.8 */ #define CVT_MARGIN_PERCENTAGE 1.8 /* 2) character cell horizontal granularity (pixels) - default 8 */ #define CVT_H_GRANULARITY 8 /* 4) Minimum vertical porch (lines) - default 3 */ #define CVT_MIN_V_PORCH 3 /* 4) Minimum number of vertical back porch lines - default 6 */ #define CVT_MIN_V_BPORCH 6 /* Pixel Clock step (kHz) */ #define CVT_CLOCK_STEP 250 Bool Margins = FALSE; float VFieldRate, HPeriod; int HDisplayRnd, HMargin; int VDisplayRnd, VMargin, VSync; float Interlace; /* Please rename this */ char name[128]; xRRModeInfo modeinfo; memset(&modeinfo, 0, sizeof modeinfo); /* CVT default is 60.0Hz */ if (!VRefresh) VRefresh = 60.0; /* 1. Required field rate */ if (Interlaced) VFieldRate = VRefresh * 2; else VFieldRate = VRefresh; /* 2. Horizontal pixels */ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY); /* 3. Determine left and right borders */ if (Margins) { /* right margin is actually exactly the same as left */ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); HMargin -= HMargin % CVT_H_GRANULARITY; } else HMargin = 0; /* 4. Find total active pixels */ modeinfo.width = HDisplayRnd + 2 * HMargin; /* 5. Find number of lines per field */ if (Interlaced) VDisplayRnd = VDisplay / 2; else VDisplayRnd = VDisplay; /* 6. Find top and bottom margins */ /* nope. */ if (Margins) /* top and bottom margins are equal again. */ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); else VMargin = 0; modeinfo.height = VDisplay + 2 * VMargin; /* 7. Interlace */ if (Interlaced) Interlace = 0.5; else Interlace = 0.0; /* Determine VSync Width from aspect ratio */ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) VSync = 4; else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) VSync = 5; else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) VSync = 6; else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) VSync = 7; else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)) VSync = 7; else /* Custom */ VSync = 10; if (!Reduced) { /* simplified GTF calculation */ /* 4) Minimum time of vertical sync + back porch interval (µs) * default 550.0 */ #define CVT_MIN_VSYNC_BP 550.0 /* 3) Nominal HSync width (% of line period) - default 8 */ #define CVT_HSYNC_PERCENTAGE 8 float HBlankPercentage; int VSyncAndBackPorch, VBackPorch; int HBlank; /* 8. Estimated Horizontal period */ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) / (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace); /* 9. Find number of lines in sync + backporch */ if (((int) (CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH)) VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH; else VSyncAndBackPorch = (int) (CVT_MIN_VSYNC_BP / HPeriod) + 1; /* 10. Find number of lines in back porch */ VBackPorch = VSyncAndBackPorch - VSync; (void) VBackPorch; /* 11. Find total number of lines in vertical field */ modeinfo.vTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace + CVT_MIN_V_PORCH; /* 5) Definition of Horizontal blanking time limitation */ /* Gradient (%/kHz) - default 600 */ #define CVT_M_FACTOR 600 /* Offset (%) - default 40 */ #define CVT_C_FACTOR 40 /* Blanking time scaling factor - default 128 */ #define CVT_K_FACTOR 128 /* Scaling factor weighting - default 20 */ #define CVT_J_FACTOR 20 #define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256 #define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \ CVT_J_FACTOR /* 12. Find ideal blanking duty cycle from formula */ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod / 1000.0; /* 13. Blanking time */ if (HBlankPercentage < 20) HBlankPercentage = 20; HBlank = modeinfo.width * HBlankPercentage / (100.0 - HBlankPercentage); HBlank -= HBlank % (2 * CVT_H_GRANULARITY); /* 14. Find total number of pixels in a line. */ modeinfo.hTotal = modeinfo.width + HBlank; /* Fill in HSync values */ modeinfo.hSyncEnd = modeinfo.width + HBlank / 2; modeinfo.hSyncStart = modeinfo.hSyncEnd - (modeinfo.hTotal * CVT_HSYNC_PERCENTAGE) / 100; modeinfo.hSyncStart += CVT_H_GRANULARITY - modeinfo.hSyncStart % CVT_H_GRANULARITY; /* Fill in VSync values */ modeinfo.vSyncStart = modeinfo.height + CVT_MIN_V_PORCH; modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync; } else { /* Reduced blanking */ /* Minimum vertical blanking interval time (µs) - default 460 */ #define CVT_RB_MIN_VBLANK 460.0 /* Fixed number of clocks for horizontal sync */ #define CVT_RB_H_SYNC 32.0 /* Fixed number of clocks for horizontal blanking */ #define CVT_RB_H_BLANK 160.0 /* Fixed number of lines for vertical front porch - default 3 */ #define CVT_RB_VFPORCH 3 int VBILines; /* 8. Estimate Horizontal period. */ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) / (VDisplayRnd + 2 * VMargin); /* 9. Find number of lines in vertical blanking */ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1; /* 10. Check if vertical blanking is sufficient */ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH)) VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH; /* 11. Find total number of lines in vertical field */ modeinfo.vTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines; /* 12. Find total number of pixels in a line */ modeinfo.hTotal = modeinfo.width + CVT_RB_H_BLANK; /* Fill in HSync values */ modeinfo.hSyncEnd = modeinfo.width + CVT_RB_H_BLANK / 2; modeinfo.hSyncStart = modeinfo.hSyncEnd - CVT_RB_H_SYNC; /* Fill in VSync values */ modeinfo.vSyncStart = modeinfo.height + CVT_RB_VFPORCH; modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync; } /* 15/13. Find pixel clock frequency (kHz for xf86) */ modeinfo.dotClock = modeinfo.hTotal * 1000.0 / HPeriod; modeinfo.dotClock -= modeinfo.dotClock % CVT_CLOCK_STEP; modeinfo.dotClock *= 1000.0; #if 0 /* 16/14. Find actual Horizontal Frequency (kHz) */ modeinfo.hSync = ((float) modeinfo.dotClock) / ((float) modeinfo.hTotal); #endif #if 0 /* 17/15. Find actual Field rate */ modeinfo.vRefresh = (1000.0 * ((float) modeinfo.dotClock)) / ((float) (modeinfo.hTotal * modeinfo.vTotal)); #endif /* 18/16. Find actual vertical frame frequency */ /* ignore - just set the mode flag for interlaced */ if (Interlaced) modeinfo.vTotal *= 2; if (Reduced) modeinfo.modeFlags |= RR_HSyncPositive | RR_VSyncNegative; else modeinfo.modeFlags |= RR_HSyncNegative | RR_VSyncPositive; if (Interlaced) modeinfo.modeFlags |= RR_Interlace; /* FWXGA hack adapted from hw/xfree86/modes/xf86EdidModes.c, because you can't say 1366 */ if (HDisplay == 1366 && VDisplay == 768) { modeinfo.width = 1366; modeinfo.hSyncStart--; modeinfo.hSyncEnd--; } snprintf(name, sizeof name, "%dx%d", modeinfo.width, modeinfo.height); modeinfo.nameLength = strlen(name); return RRModeGet(&modeinfo, name); } xorg-server-1.20.8/hw/xwayland/xwayland-glamor-eglstream.c0000644000175000017500000007270313640201473020517 00000000000000/* * Copyright © 2017 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. * * Authors: * Lyude Paul * */ #include "xwayland.h" #include "wayland-eglstream-client-protocol.h" #include "wayland-eglstream-controller-client-protocol.h" #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include #include #include #include #include #include struct xwl_eglstream_pending_stream { PixmapPtr pixmap; WindowPtr window; struct xwl_pixmap *xwl_pixmap; struct wl_callback *cb; Bool is_valid; struct xorg_list link; }; struct xwl_eglstream_private { EGLDeviceEXT egl_device; struct wl_eglstream_display *display; struct wl_eglstream_controller *controller; uint32_t display_caps; EGLConfig config; SetWindowPixmapProcPtr SetWindowPixmap; struct xorg_list pending_streams; Bool have_egl_damage; GLint blit_prog; GLuint blit_vao; GLuint blit_vbo; GLuint blit_is_rgba_pos; }; struct xwl_pixmap { struct wl_buffer *buffer; struct xwl_screen *xwl_screen; /* The stream and associated resources have their own lifetime seperate * from the pixmap's */ int refcount; EGLStreamKHR stream; EGLSurface surface; }; static DevPrivateKeyRec xwl_eglstream_private_key; static DevPrivateKeyRec xwl_eglstream_window_private_key; static inline struct xwl_eglstream_private * xwl_eglstream_get(struct xwl_screen *xwl_screen) { return dixLookupPrivate(&xwl_screen->screen->devPrivates, &xwl_eglstream_private_key); } static inline struct xwl_eglstream_pending_stream * xwl_eglstream_window_get_pending(WindowPtr window) { return dixLookupPrivate(&window->devPrivates, &xwl_eglstream_window_private_key); } static inline void xwl_eglstream_window_set_pending(WindowPtr window, struct xwl_eglstream_pending_stream *stream) { dixSetPrivate(&window->devPrivates, &xwl_eglstream_window_private_key, stream); } static GLint xwl_eglstream_compile_glsl_prog(GLenum type, const char *source) { GLint ok; GLint prog; prog = glCreateShader(type); glShaderSource(prog, 1, (const GLchar **) &source, NULL); glCompileShader(prog); glGetShaderiv(prog, GL_COMPILE_STATUS, &ok); if (!ok) { GLchar *info; GLint size; glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size); info = malloc(size); if (info) { glGetShaderInfoLog(prog, size, NULL, info); ErrorF("Failed to compile %s: %s\n", type == GL_FRAGMENT_SHADER ? "FS" : "VS", info); ErrorF("Program source:\n%s", source); free(info); } else ErrorF("Failed to get shader compilation info.\n"); FatalError("GLSL compile failure\n"); } return prog; } static GLuint xwl_eglstream_build_glsl_prog(GLuint vs, GLuint fs) { GLint ok; GLuint prog; prog = glCreateProgram(); glAttachShader(prog, vs); glAttachShader(prog, fs); glLinkProgram(prog); glGetProgramiv(prog, GL_LINK_STATUS, &ok); if (!ok) { GLchar *info; GLint size; glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); info = malloc(size); glGetProgramInfoLog(prog, size, NULL, info); ErrorF("Failed to link: %s\n", info); FatalError("GLSL link failure\n"); } return prog; } static void xwl_eglstream_cleanup(struct xwl_screen *xwl_screen) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); if (xwl_eglstream->display) wl_eglstream_display_destroy(xwl_eglstream->display); if (xwl_eglstream->controller) wl_eglstream_controller_destroy(xwl_eglstream->controller); if (xwl_eglstream->blit_prog) { glDeleteProgram(xwl_eglstream->blit_prog); glDeleteBuffers(1, &xwl_eglstream->blit_vbo); } free(xwl_eglstream); } static Bool xwl_glamor_egl_supports_device_probing(void) { return epoxy_has_egl_extension(NULL, "EGL_EXT_device_base"); } static void ** xwl_glamor_egl_get_devices(int *num_devices) { EGLDeviceEXT *devices, *tmp; Bool ret; int drm_dev_count = 0; int i; if (!xwl_glamor_egl_supports_device_probing()) return NULL; /* Get the number of devices */ ret = eglQueryDevicesEXT(0, NULL, num_devices); if (!ret || *num_devices < 1) return NULL; devices = calloc(*num_devices, sizeof(EGLDeviceEXT)); if (!devices) return NULL; ret = eglQueryDevicesEXT(*num_devices, devices, num_devices); if (!ret) goto error; /* We're only ever going to care about devices that support * EGL_EXT_device_drm, so filter out the ones that don't */ for (i = 0; i < *num_devices; i++) { const char *extension_str = eglQueryDeviceStringEXT(devices[i], EGL_EXTENSIONS); if (!epoxy_extension_in_string(extension_str, "EGL_EXT_device_drm")) continue; devices[drm_dev_count++] = devices[i]; } if (!drm_dev_count) goto error; *num_devices = drm_dev_count; tmp = realloc(devices, sizeof(EGLDeviceEXT) * drm_dev_count); if (!tmp) goto error; devices = tmp; return devices; error: free(devices); return NULL; } static Bool xwl_glamor_egl_device_has_egl_extensions(void *device, const char **ext_list, size_t size) { EGLDisplay egl_display; int i; Bool has_exts = TRUE; egl_display = glamor_egl_get_display(EGL_PLATFORM_DEVICE_EXT, device); if (!egl_display || !eglInitialize(egl_display, NULL, NULL)) return FALSE; for (i = 0; i < size; i++) { if (!epoxy_has_egl_extension(egl_display, ext_list[i])) { has_exts = FALSE; break; } } eglTerminate(egl_display); return has_exts; } static void xwl_eglstream_unref_pixmap_stream(struct xwl_pixmap *xwl_pixmap) { struct xwl_screen *xwl_screen = xwl_pixmap->xwl_screen; if (--xwl_pixmap->refcount >= 1) return; /* If we're using this stream in the current egl context, unbind it so the * driver doesn't keep it around until the next eglMakeCurrent() * don't have to keep it around until something else changes the surface */ xwl_glamor_egl_make_current(xwl_screen); if (eglGetCurrentSurface(EGL_READ) == xwl_pixmap->surface || eglGetCurrentSurface(EGL_DRAW) == xwl_pixmap->surface) { eglMakeCurrent(xwl_screen->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, xwl_screen->egl_context); } if (xwl_pixmap->surface) eglDestroySurface(xwl_screen->egl_display, xwl_pixmap->surface); eglDestroyStreamKHR(xwl_screen->egl_display, xwl_pixmap->stream); wl_buffer_destroy(xwl_pixmap->buffer); free(xwl_pixmap); } static Bool xwl_glamor_eglstream_destroy_pixmap(PixmapPtr pixmap) { struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); if (xwl_pixmap && pixmap->refcnt == 1) xwl_eglstream_unref_pixmap_stream(xwl_pixmap); return glamor_destroy_pixmap(pixmap); } static struct wl_buffer * xwl_glamor_eglstream_get_wl_buffer_for_pixmap(PixmapPtr pixmap, Bool *created) { /* XXX created? */ return xwl_pixmap_get(pixmap)->buffer; } static void xwl_eglstream_set_window_pixmap(WindowPtr window, PixmapPtr pixmap) { struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen); struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); struct xwl_eglstream_pending_stream *pending; pending = xwl_eglstream_window_get_pending(window); if (pending) { /* The pixmap for this window has changed before the compositor * finished attaching the consumer for the window's pixmap's original * eglstream. A producer can no longer be attached, so the stream's * useless */ pending->is_valid = FALSE; /* The compositor may still be using the stream, so we can't destroy * it yet. We'll only have a guarantee that the stream is safe to * destroy once we receive the pending wl_display_sync() for this * stream */ pending->xwl_pixmap->refcount++; } xwl_screen->screen->SetWindowPixmap = xwl_eglstream->SetWindowPixmap; (*xwl_screen->screen->SetWindowPixmap)(window, pixmap); xwl_eglstream->SetWindowPixmap = xwl_screen->screen->SetWindowPixmap; xwl_screen->screen->SetWindowPixmap = xwl_eglstream_set_window_pixmap; } /* Because we run asynchronously with our wayland compositor, it's possible * that an X client event could cause us to begin creating a stream for a * pixmap/window combo before the stream for the pixmap this window * previously used has been fully initialized. An example: * * - Start processing X client events. * - X window receives resize event, causing us to create a new pixmap and * begin creating the corresponding eglstream. This pixmap is known as * pixmap A. * - X window receives another resize event, and again changes it's current * pixmap causing us to create another corresponding eglstream for the same * window. This pixmap is known as pixmap B. * - Start handling events from the wayland compositor. * * Since both pixmap A and B will have scheduled wl_display_sync events to * indicate when their respective streams are connected, we will receive each * callback in the original order the pixmaps were created. This means the * following would happen: * * - Receive pixmap A's stream callback, attach it's stream to the surface of * the window that just orphaned it. * - Receive pixmap B's stream callback, fall over and fail because the * window's surface now incorrectly has pixmap A's stream attached to it. * * We work around this problem by keeping a queue of pending streams, and * only allowing one queue entry to exist for each window. In the scenario * listed above, this should happen: * * - Begin processing X events... * - A window is resized, causing us to add an eglstream (known as eglstream * A) waiting for it's consumer to finish attachment to be added to the * queue. * - Resize on same window happens. We invalidate the previously pending * stream and add another one to the pending queue (known as eglstream B). * - Begin processing Wayland events... * - Receive invalidated callback from compositor for eglstream A, destroy * stream. * - Receive callback from compositor for eglstream B, create producer. * - Success! */ static void xwl_eglstream_consumer_ready_callback(void *data, struct wl_callback *callback, uint32_t time) { struct xwl_screen *xwl_screen = data; struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); struct xwl_pixmap *xwl_pixmap; struct xwl_eglstream_pending_stream *pending; Bool found = FALSE; wl_callback_destroy(callback); xorg_list_for_each_entry(pending, &xwl_eglstream->pending_streams, link) { if (pending->cb == callback) { found = TRUE; break; } } assert(found); if (!pending->is_valid) { xwl_eglstream_unref_pixmap_stream(pending->xwl_pixmap); goto out; } xwl_glamor_egl_make_current(xwl_screen); xwl_pixmap = pending->xwl_pixmap; xwl_pixmap->surface = eglCreateStreamProducerSurfaceKHR( xwl_screen->egl_display, xwl_eglstream->config, xwl_pixmap->stream, (int[]) { EGL_WIDTH, pending->pixmap->drawable.width, EGL_HEIGHT, pending->pixmap->drawable.height, EGL_NONE }); DebugF("eglstream: win %d completes eglstream for pixmap %p, congrats!\n", pending->window->drawable.id, pending->pixmap); xwl_eglstream_window_set_pending(pending->window, NULL); out: xorg_list_del(&pending->link); free(pending); } static const struct wl_callback_listener consumer_ready_listener = { xwl_eglstream_consumer_ready_callback }; static void xwl_eglstream_queue_pending_stream(struct xwl_screen *xwl_screen, WindowPtr window, PixmapPtr pixmap) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); struct xwl_eglstream_pending_stream *pending_stream; #ifdef DEBUG if (!xwl_eglstream_window_get_pending(window)) DebugF("eglstream: win %d begins new eglstream for pixmap %p\n", window->drawable.id, pixmap); else DebugF("eglstream: win %d interrupts and replaces pending eglstream for pixmap %p\n", window->drawable.id, pixmap); #endif pending_stream = malloc(sizeof(*pending_stream)); pending_stream->window = window; pending_stream->pixmap = pixmap; pending_stream->xwl_pixmap = xwl_pixmap_get(pixmap); pending_stream->is_valid = TRUE; xorg_list_init(&pending_stream->link); xorg_list_add(&pending_stream->link, &xwl_eglstream->pending_streams); xwl_eglstream_window_set_pending(window, pending_stream); pending_stream->cb = wl_display_sync(xwl_screen->display); wl_callback_add_listener(pending_stream->cb, &consumer_ready_listener, xwl_screen); } static void xwl_eglstream_buffer_release_callback(void *data, struct wl_buffer *wl_buffer) { xwl_eglstream_unref_pixmap_stream(data); } static const struct wl_buffer_listener xwl_eglstream_buffer_release_listener = { xwl_eglstream_buffer_release_callback }; static void xwl_eglstream_create_pending_stream(struct xwl_screen *xwl_screen, WindowPtr window, PixmapPtr pixmap) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); struct xwl_pixmap *xwl_pixmap; struct xwl_window *xwl_window = xwl_window_from_window(window); struct wl_array stream_attribs; int stream_fd = -1; xwl_pixmap = calloc(sizeof(*xwl_pixmap), 1); if (!xwl_pixmap) FatalError("Not enough memory to create pixmap\n"); xwl_pixmap_set_private(pixmap, xwl_pixmap); xwl_glamor_egl_make_current(xwl_screen); xwl_pixmap->xwl_screen = xwl_screen; xwl_pixmap->refcount = 1; xwl_pixmap->stream = eglCreateStreamKHR(xwl_screen->egl_display, NULL); stream_fd = eglGetStreamFileDescriptorKHR(xwl_screen->egl_display, xwl_pixmap->stream); wl_array_init(&stream_attribs); xwl_pixmap->buffer = wl_eglstream_display_create_stream(xwl_eglstream->display, pixmap->drawable.width, pixmap->drawable.height, stream_fd, WL_EGLSTREAM_HANDLE_TYPE_FD, &stream_attribs); wl_buffer_add_listener(xwl_pixmap->buffer, &xwl_eglstream_buffer_release_listener, xwl_pixmap); wl_eglstream_controller_attach_eglstream_consumer( xwl_eglstream->controller, xwl_window->surface, xwl_pixmap->buffer); xwl_eglstream_queue_pending_stream(xwl_screen, window, pixmap); close(stream_fd); } static Bool xwl_glamor_eglstream_allow_commits(struct xwl_window *xwl_window) { struct xwl_screen *xwl_screen = xwl_window->xwl_screen; struct xwl_eglstream_pending_stream *pending = xwl_eglstream_window_get_pending(xwl_window->window); PixmapPtr pixmap = (*xwl_screen->screen->GetWindowPixmap)(xwl_window->window); struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); if (xwl_pixmap) { if (pending) { /* Wait for the compositor to finish connecting the consumer for * this eglstream */ if (pending->is_valid) return FALSE; /* The pixmap for this window was changed before the compositor * finished connecting the eglstream for the window's previous * pixmap. Begin creating a new eglstream. */ } else { return TRUE; } } /* Glamor pixmap has no backing stream yet; begin making one and disallow * commits until then */ xwl_eglstream_create_pending_stream(xwl_screen, xwl_window->window, pixmap); return FALSE; } static void xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window, PixmapPtr pixmap, RegionPtr region) { struct xwl_screen *xwl_screen = xwl_window->xwl_screen; struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); BoxPtr box = RegionExtents(region); EGLint egl_damage[] = { box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1 }; GLint saved_vao; /* Unbind the framebuffer BEFORE binding the EGLSurface, otherwise we * won't actually draw to it */ xwl_glamor_egl_make_current(xwl_screen); glBindFramebuffer(GL_FRAMEBUFFER, 0); if (eglGetCurrentSurface(EGL_READ) != xwl_pixmap->surface || eglGetCurrentSurface(EGL_DRAW) != xwl_pixmap->surface) eglMakeCurrent(xwl_screen->egl_display, xwl_pixmap->surface, xwl_pixmap->surface, xwl_screen->egl_context); /* Save current GL state */ glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &saved_vao); /* Setup our GL state */ glUseProgram(xwl_eglstream->blit_prog); glViewport(0, 0, pixmap->drawable.width, pixmap->drawable.height); glActiveTexture(GL_TEXTURE0); glBindVertexArray(xwl_eglstream->blit_vao); glBindTexture(GL_TEXTURE_2D, glamor_get_pixmap_texture(pixmap)); glUniform1i(xwl_eglstream->blit_is_rgba_pos, pixmap->drawable.depth >= 32); /* Blit rendered image into EGLStream surface */ glDrawBuffer(GL_BACK); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); if (xwl_eglstream->have_egl_damage) eglSwapBuffersWithDamageKHR(xwl_screen->egl_display, xwl_pixmap->surface, egl_damage, 1); else eglSwapBuffers(xwl_screen->egl_display, xwl_pixmap->surface); /* Restore previous state */ glBindVertexArray(saved_vao); glBindTexture(GL_TEXTURE_2D, 0); /* After this we will hand off the eglstream's wl_buffer to the * compositor, which will own it until it sends a release() event. */ xwl_pixmap->refcount++; } static void xwl_eglstream_display_handle_caps(void *data, struct wl_eglstream_display *disp, int32_t caps) { xwl_eglstream_get(data)->display_caps = caps; } static void xwl_eglstream_display_handle_swapinterval_override(void *data, struct wl_eglstream_display *disp, int32_t swapinterval, struct wl_buffer *stream) { } const struct wl_eglstream_display_listener eglstream_display_listener = { .caps = xwl_eglstream_display_handle_caps, .swapinterval_override = xwl_eglstream_display_handle_swapinterval_override, }; static Bool xwl_glamor_eglstream_init_wl_registry(struct xwl_screen *xwl_screen, struct wl_registry *wl_registry, uint32_t id, const char *name, uint32_t version) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); if (strcmp(name, "wl_eglstream_display") == 0) { xwl_eglstream->display = wl_registry_bind( wl_registry, id, &wl_eglstream_display_interface, version); wl_eglstream_display_add_listener(xwl_eglstream->display, &eglstream_display_listener, xwl_screen); return TRUE; } else if (strcmp(name, "wl_eglstream_controller") == 0) { xwl_eglstream->controller = wl_registry_bind( wl_registry, id, &wl_eglstream_controller_interface, version); return TRUE; } /* no match */ return FALSE; } static Bool xwl_glamor_eglstream_has_wl_interfaces(struct xwl_screen *xwl_screen) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); if (xwl_eglstream->display == NULL) { ErrorF("glamor: 'wl_eglstream_display' not supported\n"); return FALSE; } if (xwl_eglstream->controller == NULL) { ErrorF("glamor: 'wl_eglstream_controller' not supported\n"); return FALSE; } return TRUE; } static inline void xwl_eglstream_init_shaders(struct xwl_screen *xwl_screen) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); GLint fs, vs, attrib; GLuint vbo; const char *blit_vs_src = "attribute vec2 texcoord;\n" "attribute vec2 position;\n" "varying vec2 t;\n" "void main() {\n" " t = texcoord;\n" " gl_Position = vec4(position, 0, 1);\n" "}"; const char *blit_fs_src = "varying vec2 t;\n" "uniform sampler2D s;\n" "uniform bool is_rgba;\n" "void main() {\n" " if (is_rgba)\n" " gl_FragColor = texture2D(s, t);\n" " else\n" " gl_FragColor = vec4(texture2D(s, t).rgb, 1.0);\n" "}"; static const float position[] = { /* position */ -1, -1, 1, -1, 1, 1, -1, 1, /* texcoord */ 0, 1, 1, 1, 1, 0, 0, 0, }; vs = xwl_eglstream_compile_glsl_prog(GL_VERTEX_SHADER, blit_vs_src); fs = xwl_eglstream_compile_glsl_prog(GL_FRAGMENT_SHADER, blit_fs_src); xwl_eglstream->blit_prog = xwl_eglstream_build_glsl_prog(vs, fs); glDeleteShader(vs); glDeleteShader(fs); /* Create the blitter's vao */ glGenVertexArrays(1, &xwl_eglstream->blit_vao); glBindVertexArray(xwl_eglstream->blit_vao); /* Set the data for both position and texcoord in the vbo */ glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(position), position, GL_STATIC_DRAW); xwl_eglstream->blit_vbo = vbo; /* Define each shader attribute's data location in our vbo */ attrib = glGetAttribLocation(xwl_eglstream->blit_prog, "position"); glVertexAttribPointer(attrib, 2, GL_FLOAT, TRUE, 0, NULL); glEnableVertexAttribArray(attrib); attrib = glGetAttribLocation(xwl_eglstream->blit_prog, "texcoord"); glVertexAttribPointer(attrib, 2, GL_FLOAT, TRUE, 0, (void*)(sizeof(float) * 8)); glEnableVertexAttribArray(attrib); /* Save the location of uniforms we'll set later */ xwl_eglstream->blit_is_rgba_pos = glGetUniformLocation(xwl_eglstream->blit_prog, "is_rgba"); } static Bool xwl_glamor_eglstream_init_egl(struct xwl_screen *xwl_screen) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); EGLConfig config; const EGLint attrib_list[] = { EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, EGL_CONTEXT_MAJOR_VERSION_KHR, GLAMOR_GL_CORE_VER_MAJOR, EGL_CONTEXT_MINOR_VERSION_KHR, GLAMOR_GL_CORE_VER_MINOR, EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, EGL_NONE }; const EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_STREAM_BIT_KHR, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_NONE, }; int n; xwl_screen->egl_display = glamor_egl_get_display( EGL_PLATFORM_DEVICE_EXT, xwl_eglstream->egl_device); if (!xwl_screen->egl_display) goto error; if (!eglInitialize(xwl_screen->egl_display, NULL, NULL)) { xwl_screen->egl_display = NULL; goto error; } if (!epoxy_has_egl_extension(xwl_screen->egl_display, "EGL_IMG_context_priority")) { ErrorF("EGL_IMG_context_priority not available\n"); goto error; } eglChooseConfig(xwl_screen->egl_display, config_attribs, &config, 1, &n); if (!n) { ErrorF("No acceptable EGL configs found\n"); goto error; } xwl_eglstream->config = config; #if 0 xwl_screen->formats = XWL_FORMAT_RGB565 | XWL_FORMAT_XRGB8888 | XWL_FORMAT_ARGB8888; #endif eglBindAPI(EGL_OPENGL_API); xwl_screen->egl_context = eglCreateContext( xwl_screen->egl_display, config, EGL_NO_CONTEXT, attrib_list); if (xwl_screen->egl_context == EGL_NO_CONTEXT) { ErrorF("Failed to create main EGL context: 0x%x\n", eglGetError()); goto error; } if (!eglMakeCurrent(xwl_screen->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, xwl_screen->egl_context)) { ErrorF("Failed to make EGL context current\n"); goto error; } xwl_eglstream->have_egl_damage = epoxy_has_egl_extension(xwl_screen->egl_display, "EGL_KHR_swap_buffers_with_damage"); if (!xwl_eglstream->have_egl_damage) ErrorF("Driver lacks EGL_KHR_swap_buffers_with_damage, performance " "will be affected\n"); xwl_eglstream_init_shaders(xwl_screen); return TRUE; error: xwl_eglstream_cleanup(xwl_screen); return FALSE; } static Bool xwl_glamor_eglstream_init_screen(struct xwl_screen *xwl_screen) { struct xwl_eglstream_private *xwl_eglstream = xwl_eglstream_get(xwl_screen); ScreenPtr screen = xwl_screen->screen; /* We can just let glamor handle CreatePixmap */ screen->DestroyPixmap = xwl_glamor_eglstream_destroy_pixmap; xwl_eglstream->SetWindowPixmap = screen->SetWindowPixmap; screen->SetWindowPixmap = xwl_eglstream_set_window_pixmap; if (!dixRegisterPrivateKey(&xwl_eglstream_window_private_key, PRIVATE_WINDOW, 0)) return FALSE; return TRUE; } static EGLDeviceEXT xwl_eglstream_get_device(struct xwl_screen *xwl_screen) { void **devices = NULL; const char *exts[] = { "EGL_KHR_stream", "EGL_KHR_stream_producer_eglsurface", }; int num_devices, i; EGLDeviceEXT device = EGL_NO_DEVICE_EXT; /* No device specified by the user, so find one ourselves */ devices = xwl_glamor_egl_get_devices(&num_devices); if (!devices) goto out; for (i = 0; i < num_devices; i++) { if (xwl_glamor_egl_device_has_egl_extensions(devices[i], exts, ARRAY_SIZE(exts))) { device = devices[i]; break; } } free(devices); out: if (!device) ErrorF("glamor: No eglstream capable devices found\n"); return device; } void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen) { struct xwl_eglstream_private *xwl_eglstream; EGLDeviceEXT egl_device; xwl_screen->eglstream_backend.is_available = FALSE; egl_device = xwl_eglstream_get_device(xwl_screen); if (egl_device == EGL_NO_DEVICE_EXT) return; if (!dixRegisterPrivateKey(&xwl_eglstream_private_key, PRIVATE_SCREEN, 0)) return; xwl_eglstream = calloc(sizeof(*xwl_eglstream), 1); if (!xwl_eglstream) { ErrorF("Failed to allocate memory required to init EGLStream support\n"); return; } dixSetPrivate(&xwl_screen->screen->devPrivates, &xwl_eglstream_private_key, xwl_eglstream); xwl_eglstream->egl_device = egl_device; xorg_list_init(&xwl_eglstream->pending_streams); xwl_screen->eglstream_backend.init_egl = xwl_glamor_eglstream_init_egl; xwl_screen->eglstream_backend.init_wl_registry = xwl_glamor_eglstream_init_wl_registry; xwl_screen->eglstream_backend.has_wl_interfaces = xwl_glamor_eglstream_has_wl_interfaces; xwl_screen->eglstream_backend.init_screen = xwl_glamor_eglstream_init_screen; xwl_screen->eglstream_backend.get_wl_buffer_for_pixmap = xwl_glamor_eglstream_get_wl_buffer_for_pixmap; xwl_screen->eglstream_backend.post_damage = xwl_glamor_eglstream_post_damage; xwl_screen->eglstream_backend.allow_commits = xwl_glamor_eglstream_allow_commits; xwl_screen->eglstream_backend.is_available = TRUE; } xorg-server-1.20.8/hw/xwayland/xwayland-glamor-gbm.c0000644000175000017500000007423413640201473017302 00000000000000/* * Copyright © 2011-2014 Intel Corporation * Copyright © 2017 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. * * Authors: * Lyude Paul * */ #include "xwayland.h" #include #include #include #include #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include #include #include #include #include #include "drm-client-protocol.h" struct xwl_gbm_private { char *device_name; struct gbm_device *gbm; struct wl_drm *drm; struct zwp_linux_dmabuf_v1 *dmabuf; int drm_fd; int fd_render_node; Bool drm_authenticated; uint32_t capabilities; int dmabuf_capable; }; struct xwl_pixmap { struct wl_buffer *buffer; EGLImage image; unsigned int texture; struct gbm_bo *bo; }; static DevPrivateKeyRec xwl_gbm_private_key; static DevPrivateKeyRec xwl_auth_state_private_key; static inline struct xwl_gbm_private * xwl_gbm_get(struct xwl_screen *xwl_screen) { return dixLookupPrivate(&xwl_screen->screen->devPrivates, &xwl_gbm_private_key); } static uint32_t gbm_format_for_depth(int depth) { switch (depth) { case 16: return GBM_FORMAT_RGB565; case 24: return GBM_FORMAT_XRGB8888; case 30: return GBM_FORMAT_ARGB2101010; default: ErrorF("unexpected depth: %d\n", depth); case 32: return GBM_FORMAT_ARGB8888; } } static uint32_t wl_drm_format_for_depth(int depth) { switch (depth) { case 15: return WL_DRM_FORMAT_XRGB1555; case 16: return WL_DRM_FORMAT_RGB565; case 24: return WL_DRM_FORMAT_XRGB8888; case 30: return WL_DRM_FORMAT_ARGB2101010; default: ErrorF("unexpected depth: %d\n", depth); case 32: return WL_DRM_FORMAT_ARGB8888; } } static char is_fd_render_node(int fd) { struct stat render; if (fstat(fd, &render)) return 0; if (!S_ISCHR(render.st_mode)) return 0; if (render.st_rdev & 0x80) return 1; return 0; } static char is_device_path_render_node (const char *device_path) { char is_render_node; int fd; fd = open(device_path, O_RDWR | O_CLOEXEC); if (fd < 0) return 0; is_render_node = is_fd_render_node(fd); close(fd); return is_render_node; } static PixmapPtr xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, int depth) { PixmapPtr pixmap; struct xwl_pixmap *xwl_pixmap; struct xwl_screen *xwl_screen = xwl_screen_get(screen); xwl_pixmap = malloc(sizeof *xwl_pixmap); if (xwl_pixmap == NULL) return NULL; pixmap = glamor_create_pixmap(screen, gbm_bo_get_width(bo), gbm_bo_get_height(bo), depth, GLAMOR_CREATE_PIXMAP_NO_TEXTURE); if (!pixmap) { free(xwl_pixmap); return NULL; } xwl_glamor_egl_make_current(xwl_screen); xwl_pixmap->bo = bo; xwl_pixmap->buffer = NULL; xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display, xwl_screen->egl_context, EGL_NATIVE_PIXMAP_KHR, xwl_pixmap->bo, NULL); if (xwl_pixmap->image == EGL_NO_IMAGE_KHR) goto error; glGenTextures(1, &xwl_pixmap->texture); glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image); if (eglGetError() != EGL_SUCCESS) goto error; glBindTexture(GL_TEXTURE_2D, 0); glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture); /* `set_pixmap_texture()` may fail silently if the FBO creation failed, * so we check again the texture to be sure it worked. */ if (!glamor_get_pixmap_texture(pixmap)) goto error; glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); xwl_pixmap_set_private(pixmap, xwl_pixmap); return pixmap; error: if (xwl_pixmap->image != EGL_NO_IMAGE_KHR) eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image); if (pixmap) glamor_destroy_pixmap(pixmap); free(xwl_pixmap); return NULL; } static PixmapPtr xwl_glamor_gbm_create_pixmap(ScreenPtr screen, int width, int height, int depth, unsigned int hint) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); struct gbm_bo *bo; PixmapPtr pixmap = NULL; if (width > 0 && height > 0 && depth >= 15 && (hint == 0 || hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || hint == CREATE_PIXMAP_USAGE_SHARED)) { uint32_t format = gbm_format_for_depth(depth); #ifdef GBM_BO_WITH_MODIFIERS if (xwl_gbm->dmabuf_capable) { uint32_t num_modifiers; uint64_t *modifiers = NULL; glamor_get_modifiers(screen, format, &num_modifiers, &modifiers); bo = gbm_bo_create_with_modifiers(xwl_gbm->gbm, width, height, format, modifiers, num_modifiers); free(modifiers); } else #endif { bo = gbm_bo_create(xwl_gbm->gbm, width, height, format, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); } if (bo) { pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth); if (!pixmap) { gbm_bo_destroy(bo); } else if (xwl_screen->rootless && hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP) { glamor_clear_pixmap(pixmap); } } } if (!pixmap) pixmap = glamor_create_pixmap(screen, width, height, depth, hint); return pixmap; } static Bool xwl_glamor_gbm_destroy_pixmap(PixmapPtr pixmap) { struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); if (xwl_pixmap && pixmap->refcnt == 1) { if (xwl_pixmap->buffer) wl_buffer_destroy(xwl_pixmap->buffer); eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image); if (xwl_pixmap->bo) gbm_bo_destroy(xwl_pixmap->bo); free(xwl_pixmap); } return glamor_destroy_pixmap(pixmap); } static struct wl_buffer * xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap, Bool *created) { struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); unsigned short width = pixmap->drawable.width; unsigned short height = pixmap->drawable.height; int prime_fd; int num_planes; uint32_t strides[4]; uint32_t offsets[4]; uint64_t modifier; int i; if (xwl_pixmap == NULL) return NULL; if (xwl_pixmap->buffer) { /* Buffer already exists. Return it and inform caller if interested. */ if (created) *created = FALSE; return xwl_pixmap->buffer; } /* Buffer does not exist yet. Create now and inform caller if interested. */ if (created) *created = TRUE; if (!xwl_pixmap->bo) return NULL; prime_fd = gbm_bo_get_fd(xwl_pixmap->bo); if (prime_fd == -1) return NULL; #ifdef GBM_BO_WITH_MODIFIERS num_planes = gbm_bo_get_plane_count(xwl_pixmap->bo); modifier = gbm_bo_get_modifier(xwl_pixmap->bo); for (i = 0; i < num_planes; i++) { strides[i] = gbm_bo_get_stride_for_plane(xwl_pixmap->bo, i); offsets[i] = gbm_bo_get_offset(xwl_pixmap->bo, i); } #else num_planes = 1; modifier = DRM_FORMAT_MOD_INVALID; strides[0] = gbm_bo_get_stride(xwl_pixmap->bo); offsets[0] = 0; #endif if (xwl_gbm->dmabuf && modifier != DRM_FORMAT_MOD_INVALID) { struct zwp_linux_buffer_params_v1 *params; params = zwp_linux_dmabuf_v1_create_params(xwl_gbm->dmabuf); for (i = 0; i < num_planes; i++) { zwp_linux_buffer_params_v1_add(params, prime_fd, i, offsets[i], strides[i], modifier >> 32, modifier & 0xffffffff); } xwl_pixmap->buffer = zwp_linux_buffer_params_v1_create_immed(params, width, height, wl_drm_format_for_depth(pixmap->drawable.depth), 0); zwp_linux_buffer_params_v1_destroy(params); } else if (num_planes == 1) { xwl_pixmap->buffer = wl_drm_create_prime_buffer(xwl_gbm->drm, prime_fd, width, height, wl_drm_format_for_depth(pixmap->drawable.depth), 0, gbm_bo_get_stride(xwl_pixmap->bo), 0, 0, 0, 0); } close(prime_fd); return xwl_pixmap->buffer; } static void xwl_glamor_gbm_cleanup(struct xwl_screen *xwl_screen) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); if (xwl_gbm->device_name) free(xwl_gbm->device_name); if (xwl_gbm->drm_fd) close(xwl_gbm->drm_fd); if (xwl_gbm->drm) wl_drm_destroy(xwl_gbm->drm); if (xwl_gbm->gbm) gbm_device_destroy(xwl_gbm->gbm); free(xwl_gbm); } struct xwl_auth_state { int fd; ClientPtr client; struct wl_callback *callback; }; static void free_xwl_auth_state(ClientPtr pClient, struct xwl_auth_state *state) { dixSetPrivate(&pClient->devPrivates, &xwl_auth_state_private_key, NULL); if (state) { wl_callback_destroy(state->callback); free(state); } } static void xwl_auth_state_client_callback(CallbackListPtr *pcbl, void *unused, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; struct xwl_auth_state *state; switch (pClient->clientState) { case ClientStateGone: case ClientStateRetained: state = dixLookupPrivate(&pClient->devPrivates, &xwl_auth_state_private_key); free_xwl_auth_state(pClient, state); break; default: break; } } static void sync_callback(void *data, struct wl_callback *callback, uint32_t serial) { struct xwl_auth_state *state = data; ClientPtr client = state->client; /* if the client is gone, the callback is cancelled so it's safe to * assume the client is still in ClientStateRunning at this point... */ dri3_send_open_reply(client, state->fd); AttendClient(client); free_xwl_auth_state(client, state); } static const struct wl_callback_listener sync_listener = { sync_callback }; static int xwl_dri3_open_client(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *pfd) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); struct xwl_auth_state *state; drm_magic_t magic; int fd; fd = open(xwl_gbm->device_name, O_RDWR | O_CLOEXEC); if (fd < 0) return BadAlloc; if (xwl_gbm->fd_render_node) { *pfd = fd; return Success; } state = malloc(sizeof *state); if (state == NULL) { close(fd); return BadAlloc; } state->client = client; state->fd = fd; if (drmGetMagic(state->fd, &magic) < 0) { close(state->fd); free(state); return BadMatch; } wl_drm_authenticate(xwl_gbm->drm, magic); state->callback = wl_display_sync(xwl_screen->display); wl_callback_add_listener(state->callback, &sync_listener, state); dixSetPrivate(&client->devPrivates, &xwl_auth_state_private_key, state); IgnoreClient(client); return Success; } _X_EXPORT PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds, CARD16 width, CARD16 height, const CARD32 *strides, const CARD32 *offsets, CARD8 depth, CARD8 bpp, uint64_t modifier) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); struct gbm_bo *bo = NULL; PixmapPtr pixmap; int i; if (width == 0 || height == 0 || num_fds == 0 || depth < 15 || bpp != BitsPerPixel(depth) || strides[0] < width * bpp / 8) goto error; if (xwl_gbm->dmabuf_capable && modifier != DRM_FORMAT_MOD_INVALID) { #ifdef GBM_BO_WITH_MODIFIERS struct gbm_import_fd_modifier_data data; data.width = width; data.height = height; data.num_fds = num_fds; data.format = gbm_format_for_depth(depth); data.modifier = modifier; for (i = 0; i < num_fds; i++) { data.fds[i] = fds[i]; data.strides[i] = strides[i]; data.offsets[i] = offsets[i]; } bo = gbm_bo_import(xwl_gbm->gbm, GBM_BO_IMPORT_FD_MODIFIER, &data, 0); #endif } else if (num_fds == 1) { struct gbm_import_fd_data data; data.fd = fds[0]; data.width = width; data.height = height; data.stride = strides[0]; data.format = gbm_format_for_depth(depth); bo = gbm_bo_import(xwl_gbm->gbm, GBM_BO_IMPORT_FD, &data, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); } else { goto error; } if (bo == NULL) goto error; pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth); if (pixmap == NULL) { gbm_bo_destroy(bo); goto error; } return pixmap; error: return NULL; } _X_EXPORT int glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier) { struct xwl_pixmap *xwl_pixmap; #ifdef GBM_BO_WITH_MODIFIERS uint32_t num_fds; int i; #endif xwl_pixmap = xwl_pixmap_get(pixmap); if (xwl_pixmap == NULL) return 0; if (!xwl_pixmap->bo) return 0; #ifdef GBM_BO_WITH_MODIFIERS num_fds = gbm_bo_get_plane_count(xwl_pixmap->bo); *modifier = gbm_bo_get_modifier(xwl_pixmap->bo); for (i = 0; i < num_fds; i++) { fds[i] = gbm_bo_get_fd(xwl_pixmap->bo); strides[i] = gbm_bo_get_stride_for_plane(xwl_pixmap->bo, i); offsets[i] = gbm_bo_get_offset(xwl_pixmap->bo, i); } return num_fds; #else *modifier = DRM_FORMAT_MOD_INVALID; fds[0] = gbm_bo_get_fd(xwl_pixmap->bo); strides[0] = gbm_bo_get_stride(xwl_pixmap->bo); offsets[0] = 0; return 1; #endif } /* Not actually used, just defined here so there's something for * _glamor_egl_fds_from_pixmap() to link against */ _X_EXPORT int glamor_egl_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { return -1; } _X_EXPORT Bool glamor_get_formats(ScreenPtr screen, CARD32 *num_formats, CARD32 **formats) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); int i; /* Explicitly zero the count as the caller may ignore the return value */ *num_formats = 0; if (!xwl_gbm->dmabuf_capable || !xwl_gbm->dmabuf) return FALSE; if (xwl_screen->num_formats == 0) return TRUE; *formats = calloc(xwl_screen->num_formats, sizeof(CARD32)); if (*formats == NULL) return FALSE; for (i = 0; i < xwl_screen->num_formats; i++) (*formats)[i] = xwl_screen->formats[i].format; *num_formats = xwl_screen->num_formats; return TRUE; } _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); struct xwl_format *xwl_format = NULL; int i; /* Explicitly zero the count as the caller may ignore the return value */ *num_modifiers = 0; if (!xwl_gbm->dmabuf_capable || !xwl_gbm->dmabuf) return FALSE; if (xwl_screen->num_formats == 0) return TRUE; for (i = 0; i < xwl_screen->num_formats; i++) { if (xwl_screen->formats[i].format == format) { xwl_format = &xwl_screen->formats[i]; break; } } if (!xwl_format) return FALSE; *modifiers = calloc(xwl_format->num_modifiers, sizeof(uint64_t)); if (*modifiers == NULL) return FALSE; for (i = 0; i < xwl_format->num_modifiers; i++) (*modifiers)[i] = xwl_format->modifiers[i]; *num_modifiers = xwl_format->num_modifiers; return TRUE; } static const dri3_screen_info_rec xwl_dri3_info = { .version = 2, .open = NULL, .pixmap_from_fds = glamor_pixmap_from_fds, .fds_from_pixmap = glamor_fds_from_pixmap, .open_client = xwl_dri3_open_client, .get_formats = glamor_get_formats, .get_modifiers = glamor_get_modifiers, .get_drawable_modifiers = glamor_get_drawable_modifiers, }; static const char * get_render_node_path_for_device(const drmDevicePtr drm_device, const char *device_path) { char *render_node_path = NULL; char device_found = 0; int i; for (i = 0; i < DRM_NODE_MAX; i++) { if ((drm_device->available_nodes & (1 << i)) == 0) continue; if (!strcmp (device_path, drm_device->nodes[i])) device_found = 1; if (is_device_path_render_node(drm_device->nodes[i])) render_node_path = drm_device->nodes[i]; if (device_found && render_node_path) return render_node_path; } return NULL; } static char * get_render_node_path(const char *device_path) { drmDevicePtr *devices = NULL; char *render_node_path = NULL; int i, n_devices, max_devices; max_devices = drmGetDevices2(0, NULL, 0); if (max_devices <= 0) goto out; devices = calloc(max_devices, sizeof(drmDevicePtr)); if (!devices) goto out; n_devices = drmGetDevices2(0, devices, max_devices); if (n_devices < 0) goto out; for (i = 0; i < n_devices; i++) { const char *node_path = get_render_node_path_for_device(devices[i], device_path); if (node_path) { render_node_path = strdup(node_path); break; } } out: free(devices); return render_node_path; } static void xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device) { struct xwl_screen *xwl_screen = data; struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); drm_magic_t magic; char *render_node_path = NULL; if (!is_device_path_render_node(device)) render_node_path = get_render_node_path(device); if (render_node_path) xwl_gbm->device_name = render_node_path; else xwl_gbm->device_name = strdup(device); if (!xwl_gbm->device_name) { xwl_glamor_gbm_cleanup(xwl_screen); return; } xwl_gbm->drm_fd = open(xwl_gbm->device_name, O_RDWR | O_CLOEXEC); if (xwl_gbm->drm_fd == -1) { ErrorF("wayland-egl: could not open %s (%s)\n", xwl_gbm->device_name, strerror(errno)); xwl_glamor_gbm_cleanup(xwl_screen); return; } if (is_fd_render_node(xwl_gbm->drm_fd)) { xwl_gbm->fd_render_node = 1; xwl_screen->expecting_event--; } else { drmGetMagic(xwl_gbm->drm_fd, &magic); wl_drm_authenticate(xwl_gbm->drm, magic); } } static void xwl_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format) { } static void xwl_drm_handle_authenticated(void *data, struct wl_drm *drm) { struct xwl_screen *xwl_screen = data; struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); xwl_gbm->drm_authenticated = TRUE; xwl_screen->expecting_event--; } static void xwl_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value) { xwl_gbm_get(data)->capabilities = value; } static const struct wl_drm_listener xwl_drm_listener = { xwl_drm_handle_device, xwl_drm_handle_format, xwl_drm_handle_authenticated, xwl_drm_handle_capabilities }; static void xwl_dmabuf_handle_format(void *data, struct zwp_linux_dmabuf_v1 *dmabuf, uint32_t format) { } static void xwl_dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf, uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo) { struct xwl_screen *xwl_screen = data; struct xwl_format *xwl_format = NULL; int i; if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) && modifier_lo == (DRM_FORMAT_MOD_INVALID & 0xffffffff)) return; for (i = 0; i < xwl_screen->num_formats; i++) { if (xwl_screen->formats[i].format == format) { xwl_format = &xwl_screen->formats[i]; break; } } if (xwl_format == NULL) { xwl_screen->num_formats++; xwl_screen->formats = realloc(xwl_screen->formats, xwl_screen->num_formats * sizeof(*xwl_format)); if (!xwl_screen->formats) return; xwl_format = &xwl_screen->formats[xwl_screen->num_formats - 1]; xwl_format->format = format; xwl_format->num_modifiers = 0; xwl_format->modifiers = NULL; } xwl_format->num_modifiers++; xwl_format->modifiers = realloc(xwl_format->modifiers, xwl_format->num_modifiers * sizeof(uint64_t)); if (!xwl_format->modifiers) return; xwl_format->modifiers[xwl_format->num_modifiers - 1] = (uint64_t) modifier_lo; xwl_format->modifiers[xwl_format->num_modifiers - 1] |= (uint64_t) modifier_hi << 32; } static const struct zwp_linux_dmabuf_v1_listener xwl_dmabuf_listener = { .format = xwl_dmabuf_handle_format, .modifier = xwl_dmabuf_handle_modifier }; Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); if (version < 2) return FALSE; xwl_gbm->drm = wl_registry_bind(xwl_screen->registry, id, &wl_drm_interface, 2); wl_drm_add_listener(xwl_gbm->drm, &xwl_drm_listener, xwl_screen); xwl_screen->expecting_event++; return TRUE; } Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); if (version < 3) return FALSE; xwl_gbm->dmabuf = wl_registry_bind(xwl_screen->registry, id, &zwp_linux_dmabuf_v1_interface, 3); zwp_linux_dmabuf_v1_add_listener(xwl_gbm->dmabuf, &xwl_dmabuf_listener, xwl_screen); return TRUE; } static Bool xwl_glamor_gbm_init_wl_registry(struct xwl_screen *xwl_screen, struct wl_registry *wl_registry, uint32_t id, const char *name, uint32_t version) { if (strcmp(name, "wl_drm") == 0) { xwl_screen_set_drm_interface(xwl_screen, id, version); return TRUE; } else if (strcmp(name, "zwp_linux_dmabuf_v1") == 0) { xwl_screen_set_dmabuf_interface(xwl_screen, id, version); return TRUE; } /* no match */ return FALSE; } static Bool xwl_glamor_gbm_has_egl_extension(void) { return (epoxy_has_egl_extension(NULL, "EGL_MESA_platform_gbm") || epoxy_has_egl_extension(NULL, "EGL_KHR_platform_gbm")); } static Bool xwl_glamor_gbm_has_wl_interfaces(struct xwl_screen *xwl_screen) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); if (xwl_gbm->drm == NULL) { ErrorF("glamor: 'wl_drm' not supported\n"); return FALSE; } return TRUE; } static Bool xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); EGLint major, minor; Bool egl_initialized = FALSE; static const EGLint config_attribs_core[] = { EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, EGL_CONTEXT_MAJOR_VERSION_KHR, GLAMOR_GL_CORE_VER_MAJOR, EGL_CONTEXT_MINOR_VERSION_KHR, GLAMOR_GL_CORE_VER_MINOR, EGL_NONE }; const GLubyte *renderer; if (!xwl_gbm->fd_render_node && !xwl_gbm->drm_authenticated) { ErrorF("Failed to get wl_drm, disabling Glamor and DRI3\n"); return FALSE; } xwl_gbm->gbm = gbm_create_device(xwl_gbm->drm_fd); if (!xwl_gbm->gbm) { ErrorF("couldn't create gbm device\n"); goto error; } xwl_screen->egl_display = glamor_egl_get_display(EGL_PLATFORM_GBM_MESA, xwl_gbm->gbm); if (xwl_screen->egl_display == EGL_NO_DISPLAY) { ErrorF("glamor_egl_get_display() failed\n"); goto error; } egl_initialized = eglInitialize(xwl_screen->egl_display, &major, &minor); if (!egl_initialized) { ErrorF("eglInitialize() failed\n"); goto error; } eglBindAPI(EGL_OPENGL_API); xwl_screen->egl_context = eglCreateContext( xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, config_attribs_core); if (xwl_screen->egl_context == EGL_NO_CONTEXT) { xwl_screen->egl_context = eglCreateContext( xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, NULL); } if (xwl_screen->egl_context == EGL_NO_CONTEXT) { ErrorF("Failed to create EGL context\n"); goto error; } if (!eglMakeCurrent(xwl_screen->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, xwl_screen->egl_context)) { ErrorF("Failed to make EGL context current\n"); goto error; } renderer = glGetString(GL_RENDERER); if (!renderer) { ErrorF("glGetString() returned NULL, your GL is broken\n"); goto error; } if (strstr((const char *)renderer, "llvmpipe")) { ErrorF("Refusing to try glamor on llvmpipe\n"); goto error; } if (!epoxy_has_gl_extension("GL_OES_EGL_image")) { ErrorF("GL_OES_EGL_image not available\n"); goto error; } if (epoxy_has_egl_extension(xwl_screen->egl_display, "EXT_image_dma_buf_import") && epoxy_has_egl_extension(xwl_screen->egl_display, "EXT_image_dma_buf_import_modifiers")) xwl_gbm->dmabuf_capable = TRUE; return TRUE; error: if (xwl_screen->egl_context != EGL_NO_CONTEXT) { eglDestroyContext(xwl_screen->egl_display, xwl_screen->egl_context); xwl_screen->egl_context = EGL_NO_CONTEXT; } if (xwl_screen->egl_display != EGL_NO_DISPLAY) { eglTerminate(xwl_screen->egl_display); xwl_screen->egl_display = EGL_NO_DISPLAY; } xwl_glamor_gbm_cleanup(xwl_screen); return FALSE; } static Bool xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); if (!dri3_screen_init(xwl_screen->screen, &xwl_dri3_info)) { ErrorF("Failed to initialize dri3\n"); goto error; } if (xwl_gbm->fd_render_node) goto skip_drm_auth; if (!dixRegisterPrivateKey(&xwl_auth_state_private_key, PRIVATE_CLIENT, 0)) { ErrorF("Failed to register private key\n"); goto error; } if (!AddCallback(&ClientStateCallback, xwl_auth_state_client_callback, NULL)) { ErrorF("Failed to add client state callback\n"); goto error; } skip_drm_auth: xwl_screen->screen->CreatePixmap = xwl_glamor_gbm_create_pixmap; xwl_screen->screen->DestroyPixmap = xwl_glamor_gbm_destroy_pixmap; return TRUE; error: xwl_glamor_gbm_cleanup(xwl_screen); return FALSE; } void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen) { struct xwl_gbm_private *xwl_gbm; xwl_screen->gbm_backend.is_available = FALSE; if (!xwl_glamor_gbm_has_egl_extension()) return; if (!dixRegisterPrivateKey(&xwl_gbm_private_key, PRIVATE_SCREEN, 0)) return; xwl_gbm = calloc(sizeof(*xwl_gbm), 1); if (!xwl_gbm) { ErrorF("glamor: Not enough memory to setup GBM, disabling\n"); return; } dixSetPrivate(&xwl_screen->screen->devPrivates, &xwl_gbm_private_key, xwl_gbm); xwl_screen->gbm_backend.init_wl_registry = xwl_glamor_gbm_init_wl_registry; xwl_screen->gbm_backend.has_wl_interfaces = xwl_glamor_gbm_has_wl_interfaces; xwl_screen->gbm_backend.init_egl = xwl_glamor_gbm_init_egl; xwl_screen->gbm_backend.init_screen = xwl_glamor_gbm_init_screen; xwl_screen->gbm_backend.get_wl_buffer_for_pixmap = xwl_glamor_gbm_get_wl_buffer_for_pixmap; xwl_screen->gbm_backend.is_available = TRUE; } xorg-server-1.20.8/hw/xwayland/drm.xml0000644000175000017500000001710213640201473014560 00000000000000 Copyright © 2008-2011 Kristian Høgsberg Copyright © 2010-2011 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\n 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. Bitmask of capabilities. xorg-server-1.20.8/hw/xwayland/meson.build0000644000175000017500000000635313640201473015424 00000000000000srcs = [ 'xwayland.c', 'xwayland-input.c', 'xwayland-cursor.c', 'xwayland-shm.c', 'xwayland-output.c', 'xwayland-cvt.c', 'xwayland-vidmode.c', '../../mi/miinitext.c', ] scanner_dep = dependency('wayland-scanner', native: true) scanner = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner')) protocols_dep = dependency('wayland-protocols', version: '>= 1.8') protodir = protocols_dep.get_pkgconfig_variable('pkgdatadir') pointer_xml = join_paths(protodir, 'unstable', 'pointer-constraints', 'pointer-constraints-unstable-v1.xml') relative_xml = join_paths(protodir, 'unstable', 'relative-pointer', 'relative-pointer-unstable-v1.xml') tablet_xml = join_paths(protodir, 'unstable', 'tablet', 'tablet-unstable-v2.xml') kbgrab_xml = join_paths(protodir, 'unstable', 'xwayland-keyboard-grab', 'xwayland-keyboard-grab-unstable-v1.xml') xdg_output_xml = join_paths(protodir, 'unstable', 'xdg-output', 'xdg-output-unstable-v1.xml') dmabuf_xml = join_paths(protodir, 'unstable', 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml') client_header = generator(scanner, output : '@BASENAME@-client-protocol.h', arguments : ['client-header', '@INPUT@', '@OUTPUT@'] ) if scanner_dep.version().version_compare('>= 1.14.91') scanner_argument = 'private-code' else scanner_argument = 'code' endif code = generator(scanner, output : '@BASENAME@-protocol.c', arguments : [scanner_argument, '@INPUT@', '@OUTPUT@'] ) srcs += client_header.process(relative_xml) srcs += client_header.process(pointer_xml) srcs += client_header.process(tablet_xml) srcs += client_header.process(kbgrab_xml) srcs += client_header.process(xdg_output_xml) srcs += client_header.process(dmabuf_xml) srcs += code.process(relative_xml) srcs += code.process(pointer_xml) srcs += code.process(tablet_xml) srcs += code.process(kbgrab_xml) srcs += code.process(xdg_output_xml) srcs += code.process(dmabuf_xml) xwayland_glamor = [] eglstream_srcs = [] if build_glamor srcs += 'xwayland-glamor.c' if gbm_dep.found() srcs += 'xwayland-glamor-gbm.c' endif if build_eglstream eglstream_protodir = eglstream_dep.get_pkgconfig_variable('pkgdatadir') eglstream_xml = join_paths(eglstream_protodir, 'wayland-eglstream.xml') eglstream_controller_xml = join_paths(eglstream_protodir, 'wayland-eglstream-controller.xml') srcs += client_header.process(eglstream_xml) srcs += client_header.process(eglstream_controller_xml) srcs += code.process(eglstream_xml) srcs += code.process(eglstream_controller_xml) srcs += 'xwayland-glamor-eglstream.c' endif srcs += 'xwayland-present.c' if build_xv srcs += 'xwayland-glamor-xv.c' endif srcs += client_header.process('drm.xml') srcs += code.process('drm.xml') xwayland_dep += gbm_dep xwayland_glamor += glamor endif executable( 'Xwayland', srcs, include_directories: inc, dependencies: [ common_dep, xwayland_dep, ], link_with: [ libxserver_main, xwayland_glamor, libxserver_fb, libxserver, libxserver_xext_vidmode, libxserver_xkb_stubs, libxserver_xi_stubs, libxserver_glx, libglxvnd, ], install: true, ) xorg-server-1.20.8/hw/vfb/0000755000175000017500000000000013640201534012257 500000000000000xorg-server-1.20.8/hw/vfb/Makefile.am0000644000175000017500000000101513640201473014232 00000000000000SUBDIRS = man bin_PROGRAMS = Xvfb AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ $(XVFBMODULES_CFLAGS) \ $(DIX_CFLAGS) SRCS = InitInput.c \ InitOutput.c \ $(top_srcdir)/mi/miinitext.c Xvfb_SOURCES = $(SRCS) XVFB_LIBS = \ @XVFB_LIBS@ \ $(MAIN_LIB) \ $(XSERVER_LIBS) \ $(top_builddir)/Xi/libXistubs.la Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) Xvfb_DEPENDENCIES = $(XVFB_LIBS) Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) relink: $(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT) xorg-server-1.20.8/hw/vfb/InitOutput.c0000644000175000017500000007013313640201473014475 00000000000000/* Copyright 1993, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #if defined(WIN32) #include #endif #include #include #include #include #include "scrnintstr.h" #include "servermd.h" #define PSZ 8 #include "fb.h" #include "colormapst.h" #include "gcstruct.h" #include "input.h" #include "mipointer.h" #include "micmap.h" #include #ifdef HAVE_MMAP #include #ifndef MAP_FILE #define MAP_FILE 0 #endif #endif /* HAVE_MMAP */ #include #include #ifndef WIN32 #include #endif #include #ifdef HAS_SHM #include #include #endif /* HAS_SHM */ #include "dix.h" #include "miline.h" #include "glx_extinit.h" #include "randrstr.h" #define VFB_DEFAULT_WIDTH 1280 #define VFB_DEFAULT_HEIGHT 1024 #define VFB_DEFAULT_DEPTH 24 #define VFB_DEFAULT_WHITEPIXEL 1 #define VFB_DEFAULT_BLACKPIXEL 0 #define VFB_DEFAULT_LINEBIAS 0 #define XWD_WINDOW_NAME_LEN 60 typedef struct { int width; int paddedBytesWidth; int paddedWidth; int height; int depth; int bitsPerPixel; int sizeInBytes; int ncolors; char *pfbMemory; XWDColor *pXWDCmap; XWDFileHeader *pXWDHeader; Pixel blackPixel; Pixel whitePixel; unsigned int lineBias; CloseScreenProcPtr closeScreen; #ifdef HAVE_MMAP int mmap_fd; char mmap_file[MAXPATHLEN]; #endif #ifdef HAS_SHM int shmid; #endif } vfbScreenInfo, *vfbScreenInfoPtr; static int vfbNumScreens; static vfbScreenInfo *vfbScreens; static vfbScreenInfo defaultScreenInfo = { .width = VFB_DEFAULT_WIDTH, .height = VFB_DEFAULT_HEIGHT, .depth = VFB_DEFAULT_DEPTH, .blackPixel = VFB_DEFAULT_BLACKPIXEL, .whitePixel = VFB_DEFAULT_WHITEPIXEL, .lineBias = VFB_DEFAULT_LINEBIAS, }; static Bool vfbPixmapDepths[33]; #ifdef HAVE_MMAP static char *pfbdir = NULL; #endif typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType; static fbMemType fbmemtype = NORMAL_MEMORY_FB; static char needswap = 0; static Bool Render = TRUE; #define swapcopy16(_dst, _src) \ if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \ else _dst = _src; #define swapcopy32(_dst, _src) \ if (needswap) { CARD32 _s = _src; cpswapl(_s, _dst); } \ else _dst = _src; static void vfbInitializePixmapDepths(void) { int i; vfbPixmapDepths[1] = TRUE; /* always need bitmaps */ for (i = 2; i <= 32; i++) vfbPixmapDepths[i] = FALSE; } static int vfbBitsPerPixel(int depth) { if (depth == 1) return 1; else if (depth <= 8) return 8; else if (depth <= 16) return 16; else return 32; } void ddxGiveUp(enum ExitCode error) { int i; /* clean up the framebuffers */ switch (fbmemtype) { #ifdef HAVE_MMAP case MMAPPED_FILE_FB: for (i = 0; i < vfbNumScreens; i++) { if (-1 == unlink(vfbScreens[i].mmap_file)) { perror("unlink"); ErrorF("unlink %s failed, %s", vfbScreens[i].mmap_file, strerror(errno)); } } break; #else /* HAVE_MMAP */ case MMAPPED_FILE_FB: break; #endif /* HAVE_MMAP */ #ifdef HAS_SHM case SHARED_MEMORY_FB: for (i = 0; i < vfbNumScreens; i++) { if (-1 == shmdt((char *) vfbScreens[i].pXWDHeader)) { perror("shmdt"); ErrorF("shmdt failed, %s", strerror(errno)); } } break; #else /* HAS_SHM */ case SHARED_MEMORY_FB: break; #endif /* HAS_SHM */ case NORMAL_MEMORY_FB: for (i = 0; i < vfbNumScreens; i++) { free(vfbScreens[i].pXWDHeader); } break; } } void AbortDDX(enum ExitCode error) { ddxGiveUp(error); } #ifdef __APPLE__ void DarwinHandleGUI(int argc, char *argv[]) { } #endif void OsVendorInit(void) { } void OsVendorFatalError(const char *f, va_list args) { } #if defined(DDXBEFORERESET) void ddxBeforeReset(void) { return; } #endif #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ void ddxInputThreadInit(void) { } #endif void ddxUseMsg(void) { ErrorF("-screen scrn WxHxD set screen's width, height, depth\n"); ErrorF("-pixdepths list-of-int support given pixmap depths\n"); ErrorF("+/-render turn on/off RENDER extension support" "(default on)\n"); ErrorF("-linebias n adjust thin line pixelization\n"); ErrorF("-blackpixel n pixel value for black\n"); ErrorF("-whitepixel n pixel value for white\n"); #ifdef HAVE_MMAP ErrorF ("-fbdir directory put framebuffers in mmap'ed files in directory\n"); #endif #ifdef HAS_SHM ErrorF("-shmem put framebuffers in shared memory\n"); #endif } int ddxProcessArgument(int argc, char *argv[], int i) { static Bool firstTime = TRUE; static int lastScreen = -1; vfbScreenInfo *currentScreen; if (firstTime) { vfbInitializePixmapDepths(); firstTime = FALSE; } if (lastScreen == -1) currentScreen = &defaultScreenInfo; else currentScreen = &vfbScreens[lastScreen]; #define CHECK_FOR_REQUIRED_ARGUMENTS(num) \ if (((i + num) >= argc) || (!argv[i + num])) { \ ErrorF("Required argument to %s not specified\n", argv[i]); \ UseMsg(); \ FatalError("Required argument to %s not specified\n", argv[i]); \ } if (strcmp(argv[i], "-screen") == 0) { /* -screen n WxHxD */ int screenNum; CHECK_FOR_REQUIRED_ARGUMENTS(2); screenNum = atoi(argv[i + 1]); /* The protocol only has a CARD8 for number of screens in the connection setup block, so don't allow more than that. */ if ((screenNum < 0) || (screenNum >= 255)) { ErrorF("Invalid screen number %d\n", screenNum); UseMsg(); FatalError("Invalid screen number %d passed to -screen\n", screenNum); } if (vfbNumScreens <= screenNum) { vfbScreens = reallocarray(vfbScreens, screenNum + 1, sizeof(*vfbScreens)); if (!vfbScreens) FatalError("Not enough memory for screen %d\n", screenNum); for (; vfbNumScreens <= screenNum; ++vfbNumScreens) vfbScreens[vfbNumScreens] = defaultScreenInfo; } if (3 != sscanf(argv[i + 2], "%dx%dx%d", &vfbScreens[screenNum].width, &vfbScreens[screenNum].height, &vfbScreens[screenNum].depth)) { ErrorF("Invalid screen configuration %s\n", argv[i + 2]); UseMsg(); FatalError("Invalid screen configuration %s for -screen %d\n", argv[i + 2], screenNum); } lastScreen = screenNum; return 3; } if (strcmp(argv[i], "-pixdepths") == 0) { /* -pixdepths list-of-depth */ int depth, ret = 1; CHECK_FOR_REQUIRED_ARGUMENTS(1); while ((++i < argc) && (depth = atoi(argv[i])) != 0) { if (depth < 0 || depth > 32) { ErrorF("Invalid pixmap depth %d\n", depth); UseMsg(); FatalError("Invalid pixmap depth %d passed to -pixdepths\n", depth); } vfbPixmapDepths[depth] = TRUE; ret++; } return ret; } if (strcmp(argv[i], "+render") == 0) { /* +render */ Render = TRUE; return 1; } if (strcmp(argv[i], "-render") == 0) { /* -render */ Render = FALSE; #ifdef COMPOSITE noCompositeExtension = TRUE; #endif return 1; } if (strcmp(argv[i], "-blackpixel") == 0) { /* -blackpixel n */ CHECK_FOR_REQUIRED_ARGUMENTS(1); currentScreen->blackPixel = atoi(argv[++i]); return 2; } if (strcmp(argv[i], "-whitepixel") == 0) { /* -whitepixel n */ CHECK_FOR_REQUIRED_ARGUMENTS(1); currentScreen->whitePixel = atoi(argv[++i]); return 2; } if (strcmp(argv[i], "-linebias") == 0) { /* -linebias n */ CHECK_FOR_REQUIRED_ARGUMENTS(1); currentScreen->lineBias = atoi(argv[++i]); return 2; } #ifdef HAVE_MMAP if (strcmp(argv[i], "-fbdir") == 0) { /* -fbdir directory */ CHECK_FOR_REQUIRED_ARGUMENTS(1); pfbdir = argv[++i]; fbmemtype = MMAPPED_FILE_FB; return 2; } #endif /* HAVE_MMAP */ #ifdef HAS_SHM if (strcmp(argv[i], "-shmem") == 0) { /* -shmem */ fbmemtype = SHARED_MEMORY_FB; return 1; } #endif return 0; } static void vfbInstallColormap(ColormapPtr pmap) { ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen); if (pmap != oldpmap) { int entries; XWDFileHeader *pXWDHeader; VisualPtr pVisual; Pixel *ppix; xrgb *prgb; xColorItem *defs; int i; miInstallColormap(pmap); entries = pmap->pVisual->ColormapEntries; pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader; pVisual = pmap->pVisual; swapcopy32(pXWDHeader->visual_class, pVisual->class); swapcopy32(pXWDHeader->red_mask, pVisual->redMask); swapcopy32(pXWDHeader->green_mask, pVisual->greenMask); swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask); swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue); swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries); ppix = xallocarray(entries, sizeof(Pixel)); prgb = xallocarray(entries, sizeof(xrgb)); defs = xallocarray(entries, sizeof(xColorItem)); for (i = 0; i < entries; i++) ppix[i] = i; /* XXX truecolor */ QueryColors(pmap, entries, ppix, prgb, serverClient); for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */ defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */ defs[i].red = prgb[i].red; defs[i].green = prgb[i].green; defs[i].blue = prgb[i].blue; defs[i].flags = DoRed | DoGreen | DoBlue; } (*pmap->pScreen->StoreColors) (pmap, entries, defs); free(ppix); free(prgb); free(defs); } } static void vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs) { XWDColor *pXWDCmap; int i; if (pmap != GetInstalledmiColormap(pmap->pScreen)) { return; } pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap; if ((pmap->pVisual->class | DynamicClass) == DirectColor) { return; } for (i = 0; i < ndef; i++) { if (pdefs[i].flags & DoRed) { swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red); } if (pdefs[i].flags & DoGreen) { swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green); } if (pdefs[i].flags & DoBlue) { swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue); } } } static Bool vfbSaveScreen(ScreenPtr pScreen, int on) { return TRUE; } #ifdef HAVE_MMAP /* this flushes any changes to the screens out to the mmapped file */ static void vfbBlockHandler(void *blockData, void *timeout) { int i; for (i = 0; i < vfbNumScreens; i++) { #ifdef MS_ASYNC if (-1 == msync((caddr_t) vfbScreens[i].pXWDHeader, (size_t) vfbScreens[i].sizeInBytes, MS_ASYNC)) #else /* silly NetBSD and who else? */ if (-1 == msync((caddr_t) vfbScreens[i].pXWDHeader, (size_t) vfbScreens[i].sizeInBytes)) #endif { perror("msync"); ErrorF("msync failed, %s", strerror(errno)); } } } static void vfbWakeupHandler(void *blockData, int result) { } static void vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb) { #define DUMMY_BUFFER_SIZE 65536 char dummyBuffer[DUMMY_BUFFER_SIZE]; int currentFileSize, writeThisTime; snprintf(pvfb->mmap_file, sizeof(pvfb->mmap_file), "%s/Xvfb_screen%d", pfbdir, (int) (pvfb - vfbScreens)); if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT | O_RDWR, 0666))) { perror("open"); ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno)); return; } /* Extend the file to be the proper size */ memset(dummyBuffer, 0, DUMMY_BUFFER_SIZE); for (currentFileSize = 0; currentFileSize < pvfb->sizeInBytes; currentFileSize += writeThisTime) { writeThisTime = min(DUMMY_BUFFER_SIZE, pvfb->sizeInBytes - currentFileSize); if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime)) { perror("write"); ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno)); return; } } /* try to mmap the file */ pvfb->pXWDHeader = (XWDFileHeader *) mmap((caddr_t) NULL, pvfb->sizeInBytes, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, pvfb->mmap_fd, 0); if (-1 == (long) pvfb->pXWDHeader) { perror("mmap"); ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno)); pvfb->pXWDHeader = NULL; return; } if (!RegisterBlockAndWakeupHandlers(vfbBlockHandler, vfbWakeupHandler, NULL)) { pvfb->pXWDHeader = NULL; } } #endif /* HAVE_MMAP */ #ifdef HAS_SHM static void vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb) { /* create the shared memory segment */ pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT | 0777); if (pvfb->shmid < 0) { perror("shmget"); ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes, strerror(errno)); return; } /* try to attach it */ pvfb->pXWDHeader = (XWDFileHeader *) shmat(pvfb->shmid, 0, 0); if (-1 == (long) pvfb->pXWDHeader) { perror("shmat"); ErrorF("shmat failed, %s", strerror(errno)); pvfb->pXWDHeader = NULL; return; } ErrorF("screen %d shmid %d\n", (int) (pvfb - vfbScreens), pvfb->shmid); } #endif /* HAS_SHM */ static char * vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb) { if (pvfb->pfbMemory) return pvfb->pfbMemory; /* already done */ pvfb->sizeInBytes = pvfb->paddedBytesWidth * pvfb->height; /* Calculate how many entries in colormap. This is rather bogus, because * the visuals haven't even been set up yet, but we need to know because we * have to allocate space in the file for the colormap. The number 10 * below comes from the MAX_PSEUDO_DEPTH define in cfbcmap.c. */ if (pvfb->depth <= 10) { /* single index colormaps */ pvfb->ncolors = 1 << pvfb->depth; } else { /* decomposed colormaps */ int nplanes_per_color_component = pvfb->depth / 3; if (pvfb->depth % 3) nplanes_per_color_component++; pvfb->ncolors = 1 << nplanes_per_color_component; } /* add extra bytes for XWDFileHeader, window name, and colormap */ pvfb->sizeInBytes += SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN + pvfb->ncolors * SIZEOF(XWDColor); pvfb->pXWDHeader = NULL; switch (fbmemtype) { #ifdef HAVE_MMAP case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break; #else case MMAPPED_FILE_FB: break; #endif #ifdef HAS_SHM case SHARED_MEMORY_FB: vfbAllocateSharedMemoryFramebuffer(pvfb); break; #else case SHARED_MEMORY_FB: break; #endif case NORMAL_MEMORY_FB: pvfb->pXWDHeader = (XWDFileHeader *) malloc(pvfb->sizeInBytes); break; } if (pvfb->pXWDHeader) { pvfb->pXWDCmap = (XWDColor *) ((char *) pvfb->pXWDHeader + SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN); pvfb->pfbMemory = (char *) (pvfb->pXWDCmap + pvfb->ncolors); return pvfb->pfbMemory; } else return NULL; } static void vfbWriteXWDFileHeader(ScreenPtr pScreen) { vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; XWDFileHeader *pXWDHeader = pvfb->pXWDHeader; char hostname[XWD_WINDOW_NAME_LEN]; unsigned long swaptest = 1; int i; needswap = *(char *) &swaptest; pXWDHeader->header_size = (char *) pvfb->pXWDCmap - (char *) pvfb->pXWDHeader; pXWDHeader->file_version = XWD_FILE_VERSION; pXWDHeader->pixmap_format = ZPixmap; pXWDHeader->pixmap_depth = pvfb->depth; pXWDHeader->pixmap_height = pXWDHeader->window_height = pvfb->height; pXWDHeader->xoffset = 0; pXWDHeader->byte_order = IMAGE_BYTE_ORDER; pXWDHeader->bitmap_bit_order = BITMAP_BIT_ORDER; #ifndef INTERNAL_VS_EXTERNAL_PADDING pXWDHeader->pixmap_width = pXWDHeader->window_width = pvfb->width; pXWDHeader->bitmap_unit = BITMAP_SCANLINE_UNIT; pXWDHeader->bitmap_pad = BITMAP_SCANLINE_PAD; #else pXWDHeader->pixmap_width = pXWDHeader->window_width = pvfb->paddedWidth; pXWDHeader->bitmap_unit = BITMAP_SCANLINE_UNIT_PROTO; pXWDHeader->bitmap_pad = BITMAP_SCANLINE_PAD_PROTO; #endif pXWDHeader->bits_per_pixel = pvfb->bitsPerPixel; pXWDHeader->bytes_per_line = pvfb->paddedBytesWidth; pXWDHeader->ncolors = pvfb->ncolors; /* visual related fields are written when colormap is installed */ pXWDHeader->window_x = pXWDHeader->window_y = 0; pXWDHeader->window_bdrwidth = 0; /* write xwd "window" name: Xvfb hostname:server.screen */ if (-1 == gethostname(hostname, sizeof(hostname))) hostname[0] = 0; else hostname[XWD_WINDOW_NAME_LEN - 1] = 0; sprintf((char *) (pXWDHeader + 1), "Xvfb %s:%s.%d", hostname, display, pScreen->myNum); /* write colormap pixel slot values */ for (i = 0; i < pvfb->ncolors; i++) { pvfb->pXWDCmap[i].pixel = i; } /* byte swap to most significant byte first */ if (needswap) { SwapLongs((CARD32 *) pXWDHeader, SIZEOF(XWDheader) / 4); for (i = 0; i < pvfb->ncolors; i++) { swapl(&pvfb->pXWDCmap[i].pixel); } } } static Bool vfbCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) { return FALSE; } static void vfbCrossScreen(ScreenPtr pScreen, Bool entering) { } static miPointerScreenFuncRec vfbPointerCursorFuncs = { vfbCursorOffScreen, vfbCrossScreen, miPointerWarpCursor }; static Bool vfbCloseScreen(ScreenPtr pScreen) { vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; pScreen->CloseScreen = pvfb->closeScreen; /* * fb overwrites miCloseScreen, so do this here */ if (pScreen->devPrivate) (*pScreen->DestroyPixmap) (pScreen->devPrivate); pScreen->devPrivate = NULL; return pScreen->CloseScreen(pScreen); } static Bool vfbRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output, RRModePtr mode) { rrScrPriv(pScreen); if (pScrPriv->minWidth <= mode->mode.width && pScrPriv->maxWidth >= mode->mode.width && pScrPriv->minHeight <= mode->mode.height && pScrPriv->maxHeight >= mode->mode.height) return TRUE; else return FALSE; } static Bool vfbRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { // Prevent screen updates while we change things around SetRootClip(pScreen, ROOT_CLIP_NONE); pScreen->width = width; pScreen->height = height; pScreen->mmWidth = mmWidth; pScreen->mmHeight = mmHeight; // Restore the ability to update screen, now with new dimensions SetRootClip(pScreen, ROOT_CLIP_FULL); RRScreenSizeNotify (pScreen); RRTellChanged(pScreen); return TRUE; } static Bool vfbRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, int numOutput, RROutputPtr *outputs) { return RRCrtcNotify(crtc, mode, x, y, rotation, NULL, numOutput, outputs); } static Bool vfbRRGetInfo(ScreenPtr pScreen, Rotation *rotations) { return TRUE; } static Bool vfbRandRInit(ScreenPtr pScreen) { rrScrPrivPtr pScrPriv; #if RANDR_12_INTERFACE RRModePtr mode; RRCrtcPtr crtc; RROutputPtr output; xRRModeInfo modeInfo; char name[64]; #endif if (!RRScreenInit (pScreen)) return FALSE; pScrPriv = rrGetScrPriv(pScreen); pScrPriv->rrGetInfo = vfbRRGetInfo; #if RANDR_12_INTERFACE pScrPriv->rrCrtcSet = vfbRRCrtcSet; pScrPriv->rrScreenSetSize = vfbRRScreenSetSize; pScrPriv->rrOutputSetProperty = NULL; #if RANDR_13_INTERFACE pScrPriv->rrOutputGetProperty = NULL; #endif pScrPriv->rrOutputValidateMode = vfbRROutputValidateMode; pScrPriv->rrModeDestroy = NULL; RRScreenSetSizeRange (pScreen, 1, 1, pScreen->width, pScreen->height); sprintf (name, "%dx%d", pScreen->width, pScreen->height); memset (&modeInfo, '\0', sizeof (modeInfo)); modeInfo.width = pScreen->width; modeInfo.height = pScreen->height; modeInfo.nameLength = strlen (name); mode = RRModeGet (&modeInfo, name); if (!mode) return FALSE; crtc = RRCrtcCreate (pScreen, NULL); if (!crtc) return FALSE; output = RROutputCreate (pScreen, "screen", 6, NULL); if (!output) return FALSE; if (!RROutputSetClones (output, NULL, 0)) return FALSE; if (!RROutputSetModes (output, &mode, 1, 0)) return FALSE; if (!RROutputSetCrtcs (output, &crtc, 1)) return FALSE; if (!RROutputSetConnection (output, RR_Connected)) return FALSE; RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, NULL, 1, &output); #endif return TRUE; } static Bool vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) { vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; int dpix = monitorResolution, dpiy = monitorResolution; int ret; char *pbits; if (dpix == 0) dpix = 100; if (dpiy == 0) dpiy = 100; pvfb->paddedBytesWidth = PixmapBytePad(pvfb->width, pvfb->depth); pvfb->bitsPerPixel = vfbBitsPerPixel(pvfb->depth); if (pvfb->bitsPerPixel >= 8) pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8); else pvfb->paddedWidth = pvfb->paddedBytesWidth * 8; pbits = vfbAllocateFramebufferMemory(pvfb); if (!pbits) return FALSE; switch (pvfb->depth) { case 8: miSetVisualTypesAndMasks(8, ((1 << StaticGray) | (1 << GrayScale) | (1 << StaticColor) | (1 << PseudoColor) | (1 << TrueColor) | (1 << DirectColor)), 8, PseudoColor, 0, 0, 0); break; case 15: miSetVisualTypesAndMasks(15, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0x7c00, 0x03e0, 0x001f); break; case 16: miSetVisualTypesAndMasks(16, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0xf800, 0x07e0, 0x001f); break; case 24: miSetVisualTypesAndMasks(24, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff); break; case 30: miSetVisualTypesAndMasks(30, ((1 << TrueColor) | (1 << DirectColor)), 10, TrueColor, 0x3ff00000, 0x000ffc00, 0x000003ff); break; default: return FALSE; } miSetPixmapDepths(); ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height, dpix, dpiy, pvfb->paddedWidth, pvfb->bitsPerPixel); if (ret && Render) fbPictureInit(pScreen, 0, 0); if (!ret) return FALSE; if (!vfbRandRInit(pScreen)) return FALSE; pScreen->InstallColormap = vfbInstallColormap; pScreen->SaveScreen = vfbSaveScreen; pScreen->StoreColors = vfbStoreColors; miDCInitialize(pScreen, &vfbPointerCursorFuncs); vfbWriteXWDFileHeader(pScreen); pScreen->blackPixel = pvfb->blackPixel; pScreen->whitePixel = pvfb->whitePixel; ret = fbCreateDefColormap(pScreen); miSetZeroLineBias(pScreen, pvfb->lineBias); pvfb->closeScreen = pScreen->CloseScreen; pScreen->CloseScreen = vfbCloseScreen; return ret; } /* end vfbScreenInit */ void InitOutput(ScreenInfo * screen_info, int argc, char **argv) { int i; int NumFormats = 0; /* initialize pixmap formats */ /* must have a pixmap depth to match every screen depth */ for (i = 0; i < vfbNumScreens; i++) { vfbPixmapDepths[vfbScreens[i].depth] = TRUE; } /* RENDER needs a good set of pixmaps. */ if (Render) { vfbPixmapDepths[1] = TRUE; vfbPixmapDepths[4] = TRUE; vfbPixmapDepths[8] = TRUE; #if 0 vfbPixmapDepths[12] = TRUE; #endif /* vfbPixmapDepths[15] = TRUE; */ vfbPixmapDepths[16] = TRUE; vfbPixmapDepths[24] = TRUE; #if 0 vfbPixmapDepths[30] = TRUE; #endif vfbPixmapDepths[32] = TRUE; } xorgGlxCreateVendor(); for (i = 1; i <= 32; i++) { if (vfbPixmapDepths[i]) { if (NumFormats >= MAXFORMATS) FatalError("MAXFORMATS is too small for this server\n"); screen_info->formats[NumFormats].depth = i; screen_info->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i); screen_info->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; NumFormats++; } } screen_info->imageByteOrder = IMAGE_BYTE_ORDER; screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD; screen_info->bitmapBitOrder = BITMAP_BIT_ORDER; screen_info->numPixmapFormats = NumFormats; /* initialize screens */ if (vfbNumScreens < 1) { vfbScreens = &defaultScreenInfo; vfbNumScreens = 1; } for (i = 0; i < vfbNumScreens; i++) { if (-1 == AddScreen(vfbScreenInit, argc, argv)) { FatalError("Couldn't add screen %d", i); } } } /* end InitOutput */ xorg-server-1.20.8/hw/vfb/Makefile.in0000644000175000017500000010522313640201512014243 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = Xvfb$(EXEEXT) subdir = hw/vfb ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \ miinitext.$(OBJEXT) am_Xvfb_OBJECTS = $(am__objects_1) Xvfb_OBJECTS = $(am_Xvfb_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(top_builddir)/Xi/libXistubs.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = Xvfb_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(Xvfb_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/InitInput.Po \ ./$(DEPDIR)/InitOutput.Po ./$(DEPDIR)/miinitext.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(Xvfb_SOURCES) DIST_SOURCES = $(Xvfb_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = \ @XVFB_LIBS@ \ $(MAIN_LIB) \ $(XSERVER_LIBS) \ $(top_builddir)/Xi/libXistubs.la XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ $(XVFBMODULES_CFLAGS) \ $(DIX_CFLAGS) SRCS = InitInput.c \ InitOutput.c \ $(top_srcdir)/mi/miinitext.c Xvfb_SOURCES = $(SRCS) Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) Xvfb_DEPENDENCIES = $(XVFB_LIBS) Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/vfb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/vfb/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list Xvfb$(EXEEXT): $(Xvfb_OBJECTS) $(Xvfb_DEPENDENCIES) $(EXTRA_Xvfb_DEPENDENCIES) @rm -f Xvfb$(EXEEXT) $(AM_V_CCLD)$(Xvfb_LINK) $(Xvfb_OBJECTS) $(Xvfb_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c miinitext.obj: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/InitInput.Po -rm -f ./$(DEPDIR)/InitOutput.Po -rm -f ./$(DEPDIR)/miinitext.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/InitInput.Po -rm -f ./$(DEPDIR)/InitOutput.Po -rm -f ./$(DEPDIR)/miinitext.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS .PRECIOUS: Makefile relink: $(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/vfb/man/0000755000175000017500000000000013640201534013032 500000000000000xorg-server-1.20.8/hw/vfb/man/Makefile.am0000644000175000017500000000007013640201473015005 00000000000000include $(top_srcdir)/manpages.am appman_PRE = Xvfb.man xorg-server-1.20.8/hw/vfb/man/Xvfb.man0000644000175000017500000001257213640201473014365 00000000000000.\" $XdotOrg: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.3 2005/03/23 20:49:52 gisburn Exp $ .\" $Xorg: Xvfb.man,v 1.4 2001/02/09 02:04:45 xorgcvs Exp $ .\" Copyright 1993, 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. .\" .\" $XFree86: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.9 2001/12/14 19:59:45 dawes Exp $ .\" .TH XVFB 1 @xorgversion@ .SH NAME Xvfb \- virtual framebuffer X server for X Version 11 .SH SYNOPSIS .B Xvfb [ option ] ... .SH DESCRIPTION .I Xvfb is an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory. .PP The primary use of this server was intended to be server testing. The fb code for any depth can be exercised with this server without the need for real hardware that supports the desired depths. The X community has found many other novel uses for \fIXvfb\fP, including testing clients against unusual depths and screen configurations, doing batch processing with \fIXvfb\fP as a background rendering engine, load testing, as an aid to porting the X server to a new platform, and providing an unobtrusive way to run applications that don't really need an X server but insist on having one anyway. .SH OPTIONS .PP In addition to the normal server options described in the \fIXserver(1)\fP manual page, \fIXvfb\fP accepts the following command line switches: .TP 4 .B "\-screen \fIscreennum\fP \fIWxHxD\fP" This option creates screen \fIscreennum\fP and sets its width, height, and depth to W, H, and D respectively. By default, only screen 0 exists and has the dimensions 1280x1024x24. .TP 4 .B "\-pixdepths \fIlist-of-depths\fP" This option specifies a list of pixmap depths that the server should support in addition to the depths implied by the supported screens. \fIlist-of-depths\fP is a space-separated list of integers that can have values from 1 to 32. .TP 4 .B "\-fbdir \fIframebuffer-directory\fP" This option specifies the directory in which the memory mapped files containing the framebuffer memory should be created. See FILES. This option only exists on machines that have the mmap and msync system calls. .TP 4 .B "\-shmem" This option specifies that the framebuffer should be put in shared memory. The shared memory ID for each screen will be printed by the server. The shared memory is in xwd format. This option only exists on machines that support the System V shared memory interface. .PP If neither \fB\-shmem\fP nor \fB\-fbdir\fP is specified, the framebuffer memory will be allocated with malloc(). .TP 4 .B "\-linebias \fIn\fP" This option specifies how to adjust the pixelization of thin lines. The value \fIn\fP is a bitmask of octants in which to prefer an axial step when the Bresenham error term is exactly zero. See the file Xserver/mi/miline.h for more information. This option is probably only useful to server developers to experiment with the range of line pixelization possible with the fb code. .TP 4 .B "\-blackpixel \fIpixel-value\fP, \-whitepixel \fIpixel-value\fP" These options specify the black and white pixel values the server should use. .SH FILES The following files are created if the \-fbdir option is given. .TP 4 \fIframebuffer-directory\fP/Xvfb_screen Memory mapped file containing screen n's framebuffer memory, one file per screen. The file is in xwd format. Thus, taking a full-screen snapshot can be done with a file copy command, and the resulting snapshot will even contain the cursor image. .SH EXAMPLES .TP 8 Xvfb :1 -screen 0 1600x1200x24 The server will listen for connections as server number 1, and screen 0 will be depth 24 1600x1200. .TP 8 Xvfb :1 -screen 1 1600x1200x16 The server will listen for connections as server number 1, screen 0 will have the default screen configuration (1280x1024x24), and screen 1 will be depth 16 1600x1200. .TP 8 Xvfb -pixdepths 3 27 -fbdir /var/tmp The server will listen for connections as server number 0, will have the default screen configuration (one screen, 1280x1024x24), will also support pixmap depths of 3 and 27, and will use memory mapped files in /var/tmp for the framebuffer. .TP 8 xwud -in /var/tmp/Xvfb_screen0 Displays screen 0 of the server started by the preceding example. .SH "SEE ALSO" .PP X(@miscmansuffix@), Xserver(1), xwd(1), xwud(1), XWDFile.h .SH AUTHORS David P. Wiggins, The Open Group, Inc. xorg-server-1.20.8/hw/vfb/man/Makefile.in0000644000175000017500000006556113640201512015030 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/vfb/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man appman_PRE = Xvfb.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/vfb/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/vfb/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/vfb/meson.build0000644000175000017500000000100613640201473014340 00000000000000srcs = [ 'InitInput.c', 'InitOutput.c', '../../mi/miinitext.c', ] xvfb_server = executable( 'Xvfb', srcs, include_directories: inc, dependencies: common_dep, link_with: [ libxserver_main, libxserver_fb, libxserver, libxserver_xkb_stubs, libxserver_xi_stubs, libxserver_glx, libglxvnd, ], install: true, ) install_man(configure_file( input: 'man/Xvfb.man', output: 'Xvfb.1', configuration: manpage_config, )) xorg-server-1.20.8/hw/vfb/InitInput.c0000644000175000017500000000725613640201473014302 00000000000000/* Copyright 1993, 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. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "mi.h" #include #include "scrnintstr.h" #include "inputstr.h" #include #include "mipointer.h" #include "xkbsrv.h" #include #include "xserver-properties.h" #include "exevents.h" #include "extinit.h" Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) { return TRUE; } void ProcessInputEvents(void) { mieqProcessInputEvents(); } void DDXRingBell(int volume, int pitch, int duration) { } #define VFB_MIN_KEY 8 #define VFB_MAX_KEY 255 static int vfbKeybdProc(DeviceIntPtr pDevice, int onoff) { DevicePtr pDev = (DevicePtr) pDevice; switch (onoff) { case DEVICE_INIT: InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL); break; case DEVICE_ON: pDev->on = TRUE; break; case DEVICE_OFF: pDev->on = FALSE; break; case DEVICE_CLOSE: break; } return Success; } static int vfbMouseProc(DeviceIntPtr pDevice, int onoff) { #define NBUTTONS 3 #define NAXES 2 BYTE map[NBUTTONS + 1]; DevicePtr pDev = (DevicePtr) pDevice; Atom btn_labels[NBUTTONS] = { 0 }; Atom axes_labels[NAXES] = { 0 }; switch (onoff) { case DEVICE_INIT: map[1] = 1; map[2] = 2; map[3] = 3; btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels, (PtrCtrlProcPtr) NoopDDA, GetMotionHistorySize(), NAXES, axes_labels); break; case DEVICE_ON: pDev->on = TRUE; break; case DEVICE_OFF: pDev->on = FALSE; break; case DEVICE_CLOSE: break; } return Success; #undef NBUTTONS #undef NAXES } void InitInput(int argc, char *argv[]) { DeviceIntPtr p, k; Atom xiclass; p = AddInputDevice(serverClient, vfbMouseProc, TRUE); k = AddInputDevice(serverClient, vfbKeybdProc, TRUE); xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE); AssignTypeAndName(p, xiclass, "Xvfb mouse"); xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE); AssignTypeAndName(k, xiclass, "Xvfb keyboard"); (void) mieqInit(); } void CloseInput(void) { mieqFini(); } xorg-server-1.20.8/hw/xwin/0000755000175000017500000000000013640201535012470 500000000000000xorg-server-1.20.8/hw/xwin/windisplay.c0000644000175000017500000000425513640201473014746 00000000000000/* * File: windisplay.c * Purpose: Retrieve server display name * * Copyright (C) Jon TURNEY 2009 * * 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_XWIN_CONFIG_H #include #endif #include // for display #include "windisplay.h" #include "winmsg.h" #define XSERV_t #define TRANS_SERVER #include /* Generate a display name string referring to the display of this server, using a transport we know is enabled */ void winGetDisplayName(char *szDisplay, unsigned int screen) { if (_XSERVTransIsListening("local")) { snprintf(szDisplay, 512, ":%s.%d", display, screen); } else if (_XSERVTransIsListening("inet")) { snprintf(szDisplay, 512, "127.0.0.1:%s.%d", display, screen); } else if (_XSERVTransIsListening("inet6")) { snprintf(szDisplay, 512, "::1:%s.%d", display, screen); } else { // this can't happen! ErrorF("winGetDisplay: Don't know what to use for DISPLAY\n"); snprintf(szDisplay, 512, "localhost:%s.%d", display, screen); } winDebug("winGetDisplay: DISPLAY=%s\n", szDisplay); } xorg-server-1.20.8/hw/xwin/winwin32rootlesswindow.c0000644000175000017500000003224513640201473017266 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winprefs.h" #if 0 /* * winMWExtWMReorderWindows */ void winMWExtWMReorderWindows(ScreenPtr pScreen) { winScreenPriv(pScreen); HWND hwnd = NULL; win32RootlessWindowPtr pRLWin = NULL; win32RootlessWindowPtr pRLWinSib = NULL; DWORD dwCurrentProcessID = GetCurrentProcessId(); DWORD dwWindowProcessID = 0; XID vlist[2]; #if CYGMULTIWINDOW_DEBUG && FALSE winDebug("winMWExtWMReorderWindows\n"); #endif pScreenPriv->fRestacking = TRUE; if (pScreenPriv->fWindowOrderChanged) { #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMReorderWindows - Need to restack\n"); #endif hwnd = GetTopWindow(NULL); while (hwnd) { GetWindowThreadProcessId(hwnd, &dwWindowProcessID); if ((dwWindowProcessID == dwCurrentProcessID) && GetProp(hwnd, WIN_WINDOW_PROP)) { pRLWinSib = pRLWin; pRLWin = (win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP); if (pRLWinSib) { vlist[0] = pRLWinSib->pFrame->win->drawable.id; vlist[1] = Below; ConfigureWindow(pRLWin->pFrame->win, CWSibling | CWStackMode, vlist, wClient(pRLWin->pFrame->win)); } else { /* 1st window - raise to the top */ vlist[0] = Above; ConfigureWindow(pRLWin->pFrame->win, CWStackMode, vlist, wClient(pRLWin->pFrame->win)); } } hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); } } pScreenPriv->fRestacking = FALSE; pScreenPriv->fWindowOrderChanged = FALSE; } #endif /* * winMWExtWMMoveXWindow */ void winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y) { CARD32 *vlist = malloc(sizeof(CARD32) * 2); vlist[0] = x; vlist[1] = y; ConfigureWindow(pWin, CWX | CWY, vlist, wClient(pWin)); free(vlist); } /* * winMWExtWMResizeXWindow */ void winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h) { CARD32 *vlist = malloc(sizeof(CARD32) * 2); vlist[0] = w; vlist[1] = h; ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin)); free(vlist); } /* * winMWExtWMMoveResizeXWindow */ void winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h) { CARD32 *vlist = malloc(sizeof(long) * 4); vlist[0] = x; vlist[1] = y; vlist[2] = w; vlist[3] = h; ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin)); free(vlist); } /* * winMWExtWMDecorateWindow - Update window style. Called by EnumWindows. */ wBOOL CALLBACK winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam) { win32RootlessWindowPtr pRLWinPriv = NULL; ScreenPtr pScreen = NULL; winPrivScreenPtr pScreenPriv = NULL; winScreenInfo *pScreenInfo = NULL; /* Check if the Windows window property for our X window pointer is valid */ if ((pRLWinPriv = (win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) { if (pRLWinPriv != NULL && pRLWinPriv->pFrame != NULL && pRLWinPriv->pFrame->win != NULL) pScreen = pRLWinPriv->pFrame->win->drawable.pScreen; if (pScreen) pScreenPriv = winGetScreenPriv(pScreen); if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo; if (pRLWinPriv && pScreenInfo) winMWExtWMUpdateWindowDecoration(pRLWinPriv, pScreenInfo); } return TRUE; } /* * winMWExtWMUpdateWindowDecoration - Update window style. */ void winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv, winScreenInfoPtr pScreenInfo) { Bool fDecorate = FALSE; DWORD dwExStyle = 0; WINDOWPLACEMENT wndPlace; UINT showCmd = 0; wndPlace.length = sizeof(WINDOWPLACEMENT); /* Get current window placement */ GetWindowPlacement(pRLWinPriv->hWnd, &wndPlace); #if 0 if (wndPlace.showCmd == SW_HIDE) return; //showCmd = SWP_HIDEWINDOW; else showCmd = SWP_SHOWWINDOW; #else if (wndPlace.showCmd == SW_HIDE) return; if (IsWindowVisible(pRLWinPriv->hWnd)) showCmd = SWP_SHOWWINDOW; #endif showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER; winDebug("winMWExtWMUpdateWindowDecoration %p %s\n", pRLWinPriv, fDecorate ? "Decorate" : "Bare"); /* Get the extended window style information */ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE); if (fDecorate) { RECT rcNew; int iDx, iDy; winWMMessageRec wmMsg; winScreenPriv(pScreenInfo->pScreen); /* */ if (!(dwExStyle & WS_EX_APPWINDOW)) { winDebug("\tBare=>Decorate\n"); /* Setup a rectangle with the X window position and size */ SetRect(&rcNew, pRLWinPriv->pFrame->x, pRLWinPriv->pFrame->y, pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width, pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); #endif /* */ AdjustWindowRectEx(&rcNew, WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); #endif /* Calculate position deltas */ iDx = pRLWinPriv->pFrame->x - rcNew.left; iDy = pRLWinPriv->pFrame->y - rcNew.top; /* Calculate new rectangle */ rcNew.left += iDx; rcNew.right += iDx; rcNew.top += iDy; rcNew.bottom += iDy; /* Set the window extended style flags */ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW); /* Set the window standard style flags */ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tWindowStyle: %08x %08x\n", WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW, WS_EX_APPWINDOW); #endif /* Position the Windows window */ #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); #endif SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, showCmd); wmMsg.hwndWindow = pRLWinPriv->hWnd; wmMsg.iWindow = (Window) pRLWinPriv->pFrame->win->drawable.id; wmMsg.msg = WM_WM_NAME_EVENT; winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); winMWExtWMReshapeFrame((RootlessFrameID) pRLWinPriv, wBoundingShape(pRLWinPriv->pFrame->win)); } } else { RECT rcNew; /* */ if (dwExStyle & WS_EX_APPWINDOW) { winDebug("\tDecorate=>Bare\n"); /* Setup a rectangle with the X window position and size */ SetRect(&rcNew, pRLWinPriv->pFrame->x, pRLWinPriv->pFrame->y, pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width, pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height); #if 0 /* */ AdjustWindowRectEx(&rcNew, WS_POPUP | WS_CLIPCHILDREN, FALSE, WS_EX_TOOLWINDOW); /* Calculate position deltas */ iDx = pRLWinPriv->pFrame->x - rcNew.left; iDy = pRLWinPriv->pFrame->y - rcNew.top; /* Calculate new rectangle */ rcNew.left += iDx; rcNew.right += iDx; rcNew.top += iDy; rcNew.bottom += iDy; #endif /* Hide window temporary to remove from taskbar. */ ShowWindow(pRLWinPriv->hWnd, SW_HIDE); /* Set the window extended style flags */ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW); /* Set the window standard style flags */ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN); /* Position the Windows window */ SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, showCmd); winMWExtWMReshapeFrame((RootlessFrameID) pRLWinPriv, wBoundingShape(pRLWinPriv->pFrame->win)); } } } /* * winMWExtWMRestackWindows */ void winMWExtWMRestackWindows(ScreenPtr pScreen) { winScreenPriv(pScreen); WindowPtr pRoot = pScreen->root; WindowPtr pWin = NULL; WindowPtr pWinPrev = NULL; win32RootlessWindowPtr pRLWin = NULL; win32RootlessWindowPtr pRLWinPrev = NULL; int nWindow = 0; HDWP hWinPosInfo = NULL; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackWindows\n"); #endif pScreenPriv->fRestacking = TRUE; if (pRoot != NULL) { for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) nWindow++; hWinPosInfo = BeginDeferWindowPos(nWindow); for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { if (pWin->realized) { UINT uFlags; pRLWin = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); if (pRLWin == NULL) continue; if (pWinPrev) pRLWinPrev = (win32RootlessWindowPtr) RootlessFrameForWindow(pWinPrev, FALSE); uFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW; if (pRLWinPrev != NULL) uFlags |= SWP_NOACTIVATE; #if CYGMULTIWINDOW_DEBUG winDebug ("winMWExtWMRestackWindows - DeferWindowPos (%p, %p)\n", pRLWin->hWnd, pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP); #endif hWinPosInfo = DeferWindowPos(hWinPosInfo, pRLWin->hWnd, pRLWinPrev ? pRLWinPrev-> hWnd : HWND_TOP, 0, 0, 0, 0, uFlags); if (hWinPosInfo == NULL) { ErrorF ("winMWExtWMRestackWindows - DeferWindowPos () failed: %d\n", (int) GetLastError()); return; } pWinPrev = pWin; } } if (!EndDeferWindowPos(hWinPosInfo)) { ErrorF ("winMWExtWMRestackWindows - EndDeferWindowPos () failed: %d\n", (int) GetLastError()); return; } } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackWindows - done\n"); #endif pScreenPriv->fRestacking = FALSE; } xorg-server-1.20.8/hw/xwin/winwindowswm.c0000644000175000017500000004130513640201473015334 00000000000000/* WindowsWM extension is based on AppleWM extension */ /************************************************************************** Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. Copyright (c) 2003 Torrey T. Lyons. 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "servermd.h" #include "swaprep.h" #define _WINDOWSWM_SERVER_ #include #include "protocol-versions.h" static int WMErrorBase; static unsigned char WMReqCode = 0; static int WMEventBase = 0; static RESTYPE ClientType, eventResourceType; /* resource types for event masks */ static XID eventResource; /* Currently selected events */ static unsigned int eventMask = 0; static int WMFreeClient(void *data, XID id); static int WMFreeEvents(void *data, XID id); static void SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to); typedef struct _WMEvent *WMEventPtr; typedef struct _WMEvent { WMEventPtr next; ClientPtr client; XID clientResource; unsigned int mask; } WMEventRec; static int ProcWindowsWMQueryVersion(ClientPtr client) { xWindowsWMQueryVersionReply rep; REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION; rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION; rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), &rep); return Success; } /* events */ static inline void updateEventMask(WMEventPtr * pHead) { WMEventPtr pCur; eventMask = 0; for (pCur = *pHead; pCur != NULL; pCur = pCur->next) eventMask |= pCur->mask; } /*ARGSUSED*/ static int WMFreeClient(void *data, XID id) { WMEventPtr pEvent; WMEventPtr *pHead, pCur, pPrev; pEvent = (WMEventPtr) data; dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType, NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next) pPrev = pCur; if (pCur) { if (pPrev) pPrev->next = pEvent->next; else *pHead = pEvent->next; } updateEventMask(pHead); } free((void *) pEvent); return 1; } /*ARGSUSED*/ static int WMFreeEvents(void *data, XID id) { WMEventPtr *pHead, pCur, pNext; pHead = (WMEventPtr *) data; for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, ClientType); free((void *) pCur); } free((void *) pHead); eventMask = 0; return 1; } static int ProcWindowsWMSelectInput(ClientPtr client) { REQUEST(xWindowsWMSelectInputReq); WMEventPtr pEvent, pNewEvent, *pHead; XID clientResource; REQUEST_SIZE_MATCH(xWindowsWMSelectInputReq); dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType, client, DixWriteAccess); if (stuff->mask != 0) { if (pHead) { /* check for existing entry. */ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { if (pEvent->client == client) { pEvent->mask = stuff->mask; updateEventMask(pHead); return Success; } } } /* build the entry */ pNewEvent = malloc(sizeof(WMEventRec)); if (!pNewEvent) return BadAlloc; pNewEvent->next = 0; pNewEvent->client = client; pNewEvent->mask = stuff->mask; /* * add a resource that will be deleted when * the client goes away */ clientResource = FakeClientID(client->index); pNewEvent->clientResource = clientResource; if (!AddResource(clientResource, ClientType, (void *) pNewEvent)) 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 = malloc(sizeof(WMEventPtr)); if (!pHead || !AddResource(eventResource, eventResourceType, (void *) pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; } *pHead = 0; } pNewEvent->next = *pHead; *pHead = pNewEvent; updateEventMask(pHead); } else if (stuff->mask == 0) { /* delete the interest */ if (pHead) { pNewEvent = 0; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { if (pEvent->client == client) break; pNewEvent = pEvent; } if (pEvent) { FreeResource(pEvent->clientResource, ClientType); if (pNewEvent) pNewEvent->next = pEvent->next; else *pHead = pEvent->next; free(pEvent); updateEventMask(pHead); } } } else { client->errorValue = stuff->mask; return BadValue; } return Success; } /* * deliver the event */ void winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg, Window window, int x, int y, int w, int h) { WMEventPtr *pHead, pEvent; ClientPtr client; xWindowsWMNotifyEvent se; #if CYGMULTIWINDOW_DEBUG ErrorF("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n", type, mask, which, arg, x, y, w, h); #endif dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType, NullClient, DixUnknownAccess); if (!pHead) return; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { client = pEvent->client; #if CYGMULTIWINDOW_DEBUG ErrorF("winWindowsWMSendEvent - %p\n", client); #endif if ((pEvent->mask & mask) == 0) { continue; } #if CYGMULTIWINDOW_DEBUG ErrorF("winWindowsWMSendEvent - send\n"); #endif se.type = type + WMEventBase; se.kind = which; se.window = window; se.arg = arg; se.x = x; se.y = y; se.w = w; se.h = h; se.time = currentTime.milliseconds; WriteEventsToClient(client, 1, (xEvent *) &se); } } /* general utility functions */ static int ProcWindowsWMDisableUpdate(ClientPtr client) { REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq); //winDisableUpdate(); return Success; } static int ProcWindowsWMReenableUpdate(ClientPtr client) { REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq); //winEnableUpdate(); return Success; } /* window functions */ static int ProcWindowsWMSetFrontProcess(ClientPtr client) { REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq); //QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0); return Success; } /* frame functions */ static int ProcWindowsWMFrameGetRect(ClientPtr client) { xWindowsWMFrameGetRectReply rep; RECT rcNew; REQUEST(xWindowsWMFrameGetRectReq); #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameGetRect %zu %d\n", (sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len); #endif REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (stuff->frame_rect != 0) { ErrorF("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n"); return BadValue; } /* Store the origin, height, and width in a rectangle structure */ SetRect(&rcNew, stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih); #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameGetRect - %d %d %d %d\n", stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih); #endif /* * Calculate the required size of the Windows window rectangle, * given the size of the Windows window client area. */ AdjustWindowRectEx(&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex); rep.x = rcNew.left; rep.y = rcNew.top; rep.w = rcNew.right - rcNew.left; rep.h = rcNew.bottom - rcNew.top; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameGetRect - %d %d %d %d\n", rep.x, rep.y, rep.w, rep.h); #endif WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), &rep); return Success; } static int ProcWindowsWMFrameDraw(ClientPtr client) { REQUEST(xWindowsWMFrameDrawReq); WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; RECT rcNew; int nCmdShow, rc; RegionRec newShape; REQUEST_SIZE_MATCH(xWindowsWMFrameDrawReq); #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameDraw\n"); #endif rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); if (rc != Success) return rc; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameDraw - Window found\n"); #endif pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, TRUE); if (pRLWinPriv == 0) return BadWindow; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameDraw - HWND %p 0x%08x 0x%08x\n", pRLWinPriv->hWnd, (int) stuff->frame_style, (int) stuff->frame_style_ex); ErrorF("ProcWindowsWMFrameDraw - %d %d %d %d\n", stuff->ix, stuff->iy, stuff->iw, stuff->ih); #endif /* Store the origin, height, and width in a rectangle structure */ SetRect(&rcNew, stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih); /* * Calculate the required size of the Windows window rectangle, * given the size of the Windows window client area. */ AdjustWindowRectEx(&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex); /* Set the window extended style flags */ if (!SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, stuff->frame_style_ex)) { return BadValue; } /* Set the window standard style flags */ if (!SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, stuff->frame_style)) { return BadValue; } /* Flush the window style */ if (!SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE)) { return BadValue; } if (!IsWindowVisible(pRLWinPriv->hWnd)) nCmdShow = SW_HIDE; else nCmdShow = SW_SHOWNA; ShowWindow(pRLWinPriv->hWnd, nCmdShow); if (wBoundingShape(pWin) != NULL) { /* wBoundingShape is relative to *inner* origin of window. Translate by borderWidth to get the outside-relative position. */ RegionNull(&newShape); RegionCopy(&newShape, wBoundingShape(pWin)); RegionTranslate(&newShape, pWin->borderWidth, pWin->borderWidth); winMWExtWMReshapeFrame(pRLWinPriv, &newShape); RegionUninit(&newShape); } #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameDraw - done\n"); #endif return Success; } static int ProcWindowsWMFrameSetTitle(ClientPtr client) { unsigned int title_length, title_max; char *title_bytes; REQUEST(xWindowsWMFrameSetTitleReq); WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; int rc; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle\n"); #endif REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); if (rc != Success) return rc; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle - Window found\n"); #endif title_length = stuff->title_length; title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq); if (title_max < title_length) return BadValue; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle - length is valid\n"); #endif title_bytes = malloc(title_length + 1); strncpy(title_bytes, (char *) &stuff[1], title_length); title_bytes[title_length] = '\0'; pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); if (pRLWinPriv == 0) { free(title_bytes); return BadWindow; } /* Flush the window style */ SetWindowText(pRLWinPriv->hWnd, title_bytes); free(title_bytes); #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle - done\n"); #endif return Success; } /* dispatch */ static int ProcWindowsWMDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_WindowsWMQueryVersion: return ProcWindowsWMQueryVersion(client); } if (!client->local) return WMErrorBase + WindowsWMClientNotLocal; switch (stuff->data) { case X_WindowsWMSelectInput: return ProcWindowsWMSelectInput(client); case X_WindowsWMDisableUpdate: return ProcWindowsWMDisableUpdate(client); case X_WindowsWMReenableUpdate: return ProcWindowsWMReenableUpdate(client); case X_WindowsWMSetFrontProcess: return ProcWindowsWMSetFrontProcess(client); case X_WindowsWMFrameGetRect: return ProcWindowsWMFrameGetRect(client); case X_WindowsWMFrameDraw: return ProcWindowsWMFrameDraw(client); case X_WindowsWMFrameSetTitle: return ProcWindowsWMFrameSetTitle(client); default: return BadRequest; } } static void SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to) { to->type = from->type; to->kind = from->kind; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->window, to->window); cpswapl(from->time, to->time); cpswapl(from->arg, to->arg); } static int SProcWindowsWMQueryVersion(ClientPtr client) { REQUEST(xWindowsWMQueryVersionReq); swaps(&stuff->length); return ProcWindowsWMQueryVersion(client); } static int SProcWindowsWMDispatch(ClientPtr client) { REQUEST(xReq); /* It is bound to be non-local when there is byte swapping */ if (!client->local) return WMErrorBase + WindowsWMClientNotLocal; /* only local clients are allowed WM access */ switch (stuff->data) { case X_WindowsWMQueryVersion: return SProcWindowsWMQueryVersion(client); default: return BadRequest; } } void winWindowsWMExtensionInit(void) { ExtensionEntry *extEntry; ClientType = CreateNewResourceType(WMFreeClient, "WMClient"); eventResourceType = CreateNewResourceType(WMFreeEvents, "WMEvent"); eventResource = FakeClientID(0); if (ClientType && eventResourceType && (extEntry = AddExtension(WINDOWSWMNAME, WindowsWMNumberEvents, WindowsWMNumberErrors, ProcWindowsWMDispatch, SProcWindowsWMDispatch, NULL, StandardMinorOpcode))) { size_t i; WMReqCode = (unsigned char) extEntry->base; WMErrorBase = extEntry->errorBase; WMEventBase = extEntry->eventBase; for (i = 0; i < WindowsWMNumberEvents; i++) EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent; } } xorg-server-1.20.8/hw/xwin/winos.c0000644000175000017500000000463213640201473013721 00000000000000/* * Copyright (c) 2010-2014 Colin Harrison All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(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(s) of the above copyright * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. * * Author: Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL); static const char* IsWow64(void) { #ifdef __x86_64__ return " (64-bit)"; #else WINBOOL bIsWow64; LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); if (NULL != fnIsWow64Process) { if (fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) return bIsWow64 ? " (WoW64)" : " (32-bit)"; } /* OS doesn't support IsWow64Process() */ return ""; #endif } /* * Report the OS version */ void winOS(void) { OSVERSIONINFOEX osvi = {0}; /* Get operating system version information */ osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx((LPOSVERSIONINFO)&osvi); ErrorF("OS: Windows NT %d.%d build %d%s\n", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion, (int)osvi.dwBuildNumber, IsWow64()); } xorg-server-1.20.8/hw/xwin/winprefsyacc.h0000644000175000017500000000647613640201535015273 00000000000000/* A Bison parser, made by GNU Bison 3.1. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_YY_WINPREFSYACC_H_INCLUDED # define YY_YY_WINPREFSYACC_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { NEWLINE = 258, MENU = 259, LB = 260, RB = 261, ICONDIRECTORY = 262, DEFAULTICON = 263, ICONS = 264, STYLES = 265, TOPMOST = 266, MAXIMIZE = 267, MINIMIZE = 268, BOTTOM = 269, NOTITLE = 270, OUTLINE = 271, NOFRAME = 272, DEFAULTSYSMENU = 273, SYSMENU = 274, ROOTMENU = 275, SEPARATOR = 276, ATSTART = 277, ATEND = 278, EXEC = 279, ALWAYSONTOP = 280, DEBUGOUTPUT = 281, RELOAD = 282, TRAYICON = 283, FORCEEXIT = 284, SILENTEXIT = 285, STRING = 286 }; #endif /* Tokens. */ #define NEWLINE 258 #define MENU 259 #define LB 260 #define RB 261 #define ICONDIRECTORY 262 #define DEFAULTICON 263 #define ICONS 264 #define STYLES 265 #define TOPMOST 266 #define MAXIMIZE 267 #define MINIMIZE 268 #define BOTTOM 269 #define NOTITLE 270 #define OUTLINE 271 #define NOFRAME 272 #define DEFAULTSYSMENU 273 #define SYSMENU 274 #define ROOTMENU 275 #define SEPARATOR 276 #define ATSTART 277 #define ATEND 278 #define EXEC 279 #define ALWAYSONTOP 280 #define DEBUGOUTPUT 281 #define RELOAD 282 #define TRAYICON 283 #define FORCEEXIT 284 #define SILENTEXIT 285 #define STRING 286 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 90 "winprefsyacc.y" /* yacc.c:1913 */ char *sVal; unsigned long uVal; int iVal; #line 122 "winprefsyacc.h" /* yacc.c:1913 */ }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_WINPREFSYACC_H_INCLUDED */ xorg-server-1.20.8/hw/xwin/winmultiwindowicons.c0000644000175000017500000005476113640201473016726 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Earle F. Philhower, III */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #ifndef WINVER #define WINVER 0x0500 #endif #include #include #include #include #include #include #include #include "winresource.h" #include "winprefs.h" #include "winmsg.h" #include "winmultiwindowicons.h" #include "winglobals.h" /* * global variables */ extern HINSTANCE g_hInstance; /* * Scale an X icon ZPixmap into a Windoze icon bitmap */ static void winScaleXImageToWindowsIcon(int iconSize, int effBPP, int stride, xcb_image_t* pixmap, unsigned char *image) { int row, column, effXBPP, effXDepth; unsigned char *outPtr; unsigned char *iconData = 0; int xStride; float factX, factY; int posX, posY; unsigned char *ptr; unsigned int zero; unsigned int color; effXBPP = pixmap->bpp; if (pixmap->bpp == 15) effXBPP = 16; effXDepth = pixmap->depth; if (pixmap->depth == 15) effXDepth = 16; xStride = pixmap->stride; if (stride == 0 || xStride == 0) { ErrorF("winScaleXBitmapToWindows - stride or xStride is zero. " "Bailing.\n"); return; } /* Get icon data */ iconData = (unsigned char *) pixmap->data; /* Keep aspect ratio */ factX = ((float) pixmap->width) / ((float) iconSize); factY = ((float) pixmap->height) / ((float) iconSize); if (factX > factY) factY = factX; else factX = factY; /* Out-of-bounds, fill icon with zero */ zero = 0; for (row = 0; row < iconSize; row++) { outPtr = image + stride * row; for (column = 0; column < iconSize; column++) { posX = factX * column; posY = factY * row; ptr = (unsigned char *) iconData + posY * xStride; if (effXBPP == 1) { ptr += posX / 8; /* Out of X icon bounds, leave space blank */ if (posX >= pixmap->width || posY >= pixmap->height) ptr = (unsigned char *) &zero; if ((*ptr) & (1 << (posX & 7))) switch (effBPP) { case 32: *(outPtr++) = 0; case 24: *(outPtr++) = 0; case 16: *(outPtr++) = 0; case 8: *(outPtr++) = 0; break; case 1: outPtr[column / 8] &= ~(1 << (7 - (column & 7))); break; } else switch (effBPP) { case 32: *(outPtr++) = 255; *(outPtr++) = 255; *(outPtr++) = 255; *(outPtr++) = 0; break; case 24: *(outPtr++) = 255; case 16: *(outPtr++) = 255; case 8: *(outPtr++) = 255; break; case 1: outPtr[column / 8] |= (1 << (7 - (column & 7))); break; } } else if (effXDepth == 24 || effXDepth == 32) { ptr += posX * (effXBPP / 8); /* Out of X icon bounds, leave space blank */ if (posX >= pixmap->width || posY >= pixmap->height) ptr = (unsigned char *) &zero; color = (((*ptr) << 16) + ((*(ptr + 1)) << 8) + ((*(ptr + 2)) << 0)); switch (effBPP) { case 32: *(outPtr++) = *(ptr++); /* b */ *(outPtr++) = *(ptr++); /* g */ *(outPtr++) = *(ptr++); /* r */ *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; /* alpha */ break; case 24: *(outPtr++) = *(ptr++); *(outPtr++) = *(ptr++); *(outPtr++) = *(ptr++); break; case 16: color = ((((*ptr) >> 2) << 10) + (((*(ptr + 1)) >> 2) << 5) + (((*(ptr + 2)) >> 2))); *(outPtr++) = (color >> 8); *(outPtr++) = (color & 255); break; case 8: color = (((*ptr))) + (((*(ptr + 1)))) + (((*(ptr + 2)))); color /= 3; *(outPtr++) = color; break; case 1: if (color) outPtr[column / 8] |= (1 << (7 - (column & 7))); else outPtr[column / 8] &= ~(1 << (7 - (column & 7))); } } else if (effXDepth == 16) { ptr += posX * (effXBPP / 8); /* Out of X icon bounds, leave space blank */ if (posX >= pixmap->width || posY >= pixmap->height) ptr = (unsigned char *) &zero; color = ((*ptr) << 8) + (*(ptr + 1)); switch (effBPP) { case 32: *(outPtr++) = (color & 31) << 2; *(outPtr++) = ((color >> 5) & 31) << 2; *(outPtr++) = ((color >> 10) & 31) << 2; *(outPtr++) = 0; /* resvd */ break; case 24: *(outPtr++) = (color & 31) << 2; *(outPtr++) = ((color >> 5) & 31) << 2; *(outPtr++) = ((color >> 10) & 31) << 2; break; case 16: *(outPtr++) = *(ptr++); *(outPtr++) = *(ptr++); break; case 8: *(outPtr++) = (((color & 31) + ((color >> 5) & 31) + ((color >> 10) & 31)) / 3) << 2; break; case 1: if (color) outPtr[column / 8] |= (1 << (7 - (column & 7))); else outPtr[column / 8] &= ~(1 << (7 - (column & 7))); break; } /* end switch(effbpp) */ } /* end if effxbpp==16) */ } /* end for column */ } /* end for row */ } static HICON NetWMToWinIconAlpha(uint32_t * icon) { int width = icon[0]; int height = icon[1]; uint32_t *pixels = &icon[2]; HICON result; HDC hdc = GetDC(NULL); uint32_t *DIB_pixels; ICONINFO ii; BITMAPV4HEADER bmh = { sizeof(bmh) }; /* Define an ARGB pixel format used for Color+Alpha icons */ bmh.bV4Width = width; bmh.bV4Height = -height; /* Invert the image */ bmh.bV4Planes = 1; bmh.bV4BitCount = 32; bmh.bV4V4Compression = BI_BITFIELDS; bmh.bV4AlphaMask = 0xFF000000; bmh.bV4RedMask = 0x00FF0000; bmh.bV4GreenMask = 0x0000FF00; bmh.bV4BlueMask = 0x000000FF; ii.fIcon = TRUE; ii.xHotspot = 0; /* ignored */ ii.yHotspot = 0; /* ignored */ ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) &bmh, DIB_RGB_COLORS, (void **) &DIB_pixels, NULL, 0); ReleaseDC(NULL, hdc); if (!ii.hbmColor) return NULL; ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL); memcpy(DIB_pixels, pixels, height * width * 4); /* CreateIconIndirect() traditionally required DDBitmaps */ /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */ /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */ result = CreateIconIndirect(&ii); DeleteObject(ii.hbmColor); DeleteObject(ii.hbmMask); winDebug("NetWMToWinIconAlpha - %d x %d = %p\n", icon[0], icon[1], result); return result; } static HICON NetWMToWinIconThreshold(uint32_t * icon) { int width = icon[0]; int height = icon[1]; uint32_t *pixels = &icon[2]; int row, col; HICON result; ICONINFO ii; HDC hdc = GetDC(NULL); HDC xorDC = CreateCompatibleDC(hdc); HDC andDC = CreateCompatibleDC(hdc); ii.fIcon = TRUE; ii.xHotspot = 0; /* ignored */ ii.yHotspot = 0; /* ignored */ ii.hbmColor = CreateCompatibleBitmap(hdc, width, height); ii.hbmMask = CreateCompatibleBitmap(hdc, width, height); ReleaseDC(NULL, hdc); SelectObject(xorDC, ii.hbmColor); SelectObject(andDC, ii.hbmMask); for (row = 0; row < height; row++) { for (col = 0; col < width; col++) { if ((*pixels & 0xFF000000) > 31 << 24) { /* 31 alpha threshold, i.e. opaque above, transparent below */ SetPixelV(xorDC, col, row, RGB(((char *) pixels)[2], ((char *) pixels)[1], ((char *) pixels)[0])); SetPixelV(andDC, col, row, RGB(0, 0, 0)); /* black mask */ } else { SetPixelV(xorDC, col, row, RGB(0, 0, 0)); SetPixelV(andDC, col, row, RGB(255, 255, 255)); /* white mask */ } pixels++; } } DeleteDC(xorDC); DeleteDC(andDC); result = CreateIconIndirect(&ii); DeleteObject(ii.hbmColor); DeleteObject(ii.hbmMask); winDebug("NetWMToWinIconThreshold - %d x %d = %p\n", icon[0], icon[1], result); return result; } static HICON NetWMToWinIcon(int bpp, uint32_t * icon) { static bool hasIconAlphaChannel = FALSE; static bool versionChecked = FALSE; if (!versionChecked) { OSVERSIONINFOEX osvi = { 0 }; ULONGLONG dwlConditionMask = 0; osvi.dwOSVersionInfoSize = sizeof(osvi); osvi.dwMajorVersion = 5; osvi.dwMinorVersion = 1; /* Windows versions later than XP have icon alpha channel suport, 2000 does not */ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); hasIconAlphaChannel = VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask); versionChecked = TRUE; ErrorF("OS has icon alpha channel support: %s\n", hasIconAlphaChannel ? "yes" : "no"); } if (hasIconAlphaChannel && (bpp == 32)) return NetWMToWinIconAlpha(icon); else return NetWMToWinIconThreshold(icon); } /* * Attempt to create a custom icon from the WM_HINTS bitmaps */ static HICON winXIconToHICON(xcb_connection_t *conn, xcb_window_t id, int iconSize) { unsigned char *mask, *image = NULL, *imageMask; unsigned char *dst, *src; int planes, bpp, i; unsigned int biggest_size = 0; HDC hDC; ICONINFO ii; xcb_icccm_wm_hints_t hints; HICON hIcon = NULL; uint32_t *biggest_icon = NULL; static xcb_atom_t _XA_NET_WM_ICON; static int generation; uint32_t *icon, *icon_data = NULL; unsigned long int size; hDC = GetDC(GetDesktopWindow()); planes = GetDeviceCaps(hDC, PLANES); bpp = GetDeviceCaps(hDC, BITSPIXEL); ReleaseDC(GetDesktopWindow(), hDC); /* Always prefer _NET_WM_ICON icons */ if (generation != serverGeneration) { xcb_intern_atom_reply_t *atom_reply; xcb_intern_atom_cookie_t atom_cookie; const char *atomName = "_NET_WM_ICON"; generation = serverGeneration; _XA_NET_WM_ICON = XCB_NONE; atom_cookie = xcb_intern_atom(conn, 0, strlen(atomName), atomName); atom_reply = xcb_intern_atom_reply(conn, atom_cookie, NULL); if (atom_reply) { _XA_NET_WM_ICON = atom_reply->atom; free(atom_reply); } } { xcb_get_property_cookie_t cookie = xcb_get_property(conn, FALSE, id, _XA_NET_WM_ICON, XCB_ATOM_CARDINAL, 0L, INT_MAX); xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, cookie, NULL); if (reply && ((icon_data = xcb_get_property_value(reply)) != NULL)) { size = xcb_get_property_value_length(reply)/sizeof(uint32_t); for (icon = icon_data; icon < &icon_data[size] && *icon; icon = &icon[icon[0] * icon[1] + 2]) { winDebug("winXIconToHICON: %u x %u NetIcon\n", icon[0], icon[1]); /* Icon data size will overflow an int and thus is bigger than the property can possibly be */ if ((INT_MAX/icon[0]) < icon[1]) { winDebug("winXIconToHICON: _NET_WM_ICON icon data size overflow\n"); break; } /* Icon data size is bigger than amount of data remaining */ if (&icon[icon[0] * icon[1] + 2] > &icon_data[size]) { winDebug("winXIconToHICON: _NET_WM_ICON data is malformed\n"); break; } /* Found an exact match to the size we require... */ if (icon[0] == iconSize && icon[1] == iconSize) { winDebug("winXIconToHICON: selected %d x %d NetIcon\n", iconSize, iconSize); hIcon = NetWMToWinIcon(bpp, icon); break; } /* Otherwise, find the biggest icon and let Windows scale the size */ else if (biggest_size < icon[0]) { biggest_icon = icon; biggest_size = icon[0]; } } if (!hIcon && biggest_icon) { winDebug ("winXIconToHICON: selected %u x %u NetIcon for scaling to %d x %d\n", biggest_icon[0], biggest_icon[1], iconSize, iconSize); hIcon = NetWMToWinIcon(bpp, biggest_icon); } free(reply); } } if (!hIcon) { xcb_get_property_cookie_t wm_hints_cookie; winDebug("winXIconToHICON: no suitable NetIcon\n"); wm_hints_cookie = xcb_icccm_get_wm_hints(conn, id); if (xcb_icccm_get_wm_hints_reply(conn, wm_hints_cookie, &hints, NULL)) { winDebug("winXIconToHICON: id 0x%x icon_pixmap hint 0x%x\n", (unsigned int)id, (unsigned int)hints.icon_pixmap); if (hints.icon_pixmap) { unsigned int width, height; xcb_image_t *xImageIcon; xcb_image_t *xImageMask = NULL; xcb_get_geometry_cookie_t geom_cookie = xcb_get_geometry(conn, hints.icon_pixmap); xcb_get_geometry_reply_t *geom_reply = xcb_get_geometry_reply(conn, geom_cookie, NULL); if (geom_reply) { width = geom_reply->width; height = geom_reply->height; xImageIcon = xcb_image_get(conn, hints.icon_pixmap, 0, 0, width, height, 0xFFFFFF, XCB_IMAGE_FORMAT_Z_PIXMAP); winDebug("winXIconToHICON: id 0x%x icon Ximage 0x%p\n", (unsigned int)id, xImageIcon); if (hints.icon_mask) xImageMask = xcb_image_get(conn, hints.icon_mask, 0, 0, width, height, 0xFFFFFFFF, XCB_IMAGE_FORMAT_Z_PIXMAP); if (xImageIcon) { int effBPP, stride, maskStride; /* 15 BPP is really 16BPP as far as we care */ if (bpp == 15) effBPP = 16; else effBPP = bpp; /* Need 16-bit aligned rows for DDBitmaps */ stride = ((iconSize * effBPP + 15) & (~15)) / 8; /* Mask is 1-bit deep */ maskStride = ((iconSize * 1 + 15) & (~15)) / 8; image = malloc(stride * iconSize); imageMask = malloc(stride * iconSize); mask = malloc(maskStride * iconSize); /* Default to a completely black mask */ memset(imageMask, 0, stride * iconSize); memset(mask, 0, maskStride * iconSize); winScaleXImageToWindowsIcon(iconSize, effBPP, stride, xImageIcon, image); if (xImageMask) { winScaleXImageToWindowsIcon(iconSize, 1, maskStride, xImageMask, mask); winScaleXImageToWindowsIcon(iconSize, effBPP, stride, xImageMask, imageMask); } /* Now we need to set all bits of the icon which are not masked */ /* on to 0 because Color is really an XOR, not an OR function */ dst = image; src = imageMask; for (i = 0; i < (stride * iconSize); i++) if ((*(src++))) *(dst++) = 0; else dst++; ii.fIcon = TRUE; ii.xHotspot = 0; /* ignored */ ii.yHotspot = 0; /* ignored */ /* Create Win32 mask from pixmap shape */ ii.hbmMask = CreateBitmap(iconSize, iconSize, planes, 1, mask); /* Create Win32 bitmap from pixmap */ ii.hbmColor = CreateBitmap(iconSize, iconSize, planes, bpp, image); /* Merge Win32 mask and bitmap into icon */ hIcon = CreateIconIndirect(&ii); /* Release Win32 mask and bitmap */ DeleteObject(ii.hbmMask); DeleteObject(ii.hbmColor); /* Free X mask and bitmap */ free(mask); free(image); free(imageMask); if (xImageMask) xcb_image_destroy(xImageMask); xcb_image_destroy(xImageIcon); } } } } } return hIcon; } /* * Change the Windows window icon */ void winUpdateIcon(HWND hWnd, xcb_connection_t *conn, Window id, HICON hIconNew) { HICON hIcon, hIconSmall = NULL, hIconOld; if (hIconNew) { /* Start with the icon from preferences, if any */ hIcon = hIconNew; hIconSmall = hIconNew; } else { /* If we still need an icon, try and get the icon from WM_HINTS */ hIcon = winXIconToHICON(conn, id, GetSystemMetrics(SM_CXICON)); hIconSmall = winXIconToHICON(conn, id, GetSystemMetrics(SM_CXSMICON)); } /* If we got the small, but not the large one swap them */ if (!hIcon && hIconSmall) { hIcon = hIconSmall; hIconSmall = NULL; } /* Set the large icon */ hIconOld = (HICON) SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); /* Delete the old icon if its not the default */ winDestroyIcon(hIconOld); /* Same for the small icon */ hIconOld = (HICON) SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); winDestroyIcon(hIconOld); } void winInitGlobalIcons(void) { int sm_cx = GetSystemMetrics(SM_CXICON); int sm_cxsm = GetSystemMetrics(SM_CXSMICON); /* Load default X icon in case it's not ready yet */ if (!g_hIconX) { g_hIconX = winOverrideDefaultIcon(sm_cx); g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm); } if (!g_hIconX) { g_hIconX = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); g_hSmallIconX = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); } } void winSelectIcons(HICON * pIcon, HICON * pSmallIcon) { HICON hIcon, hSmallIcon; winInitGlobalIcons(); /* Use default X icon */ hIcon = g_hIconX; hSmallIcon = g_hSmallIconX; if (pIcon) *pIcon = hIcon; if (pSmallIcon) *pSmallIcon = hSmallIcon; } void winDestroyIcon(HICON hIcon) { /* Delete the icon if its not one of the application defaults or an override */ if (hIcon && hIcon != g_hIconX && hIcon != g_hSmallIconX && !winIconIsOverride(hIcon)) DestroyIcon(hIcon); } xorg-server-1.20.8/hw/xwin/winshadgdi.c0000644000175000017500000010473113640201473014704 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * Local function prototypes */ static wBOOL CALLBACK winRedrawAllProcShadowGDI(HWND hwnd, LPARAM lParam); static wBOOL CALLBACK winRedrawDamagedWindowShadowGDI(HWND hwnd, LPARAM lParam); static Bool winAllocateFBShadowGDI(ScreenPtr pScreen); static void winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf); static Bool winCloseScreenShadowGDI(ScreenPtr pScreen); static Bool winInitVisualsShadowGDI(ScreenPtr pScreen); static Bool winAdjustVideoModeShadowGDI(ScreenPtr pScreen); static Bool winBltExposedRegionsShadowGDI(ScreenPtr pScreen); static Bool winActivateAppShadowGDI(ScreenPtr pScreen); static Bool winRedrawScreenShadowGDI(ScreenPtr pScreen); static Bool winRealizeInstalledPaletteShadowGDI(ScreenPtr pScreen); static Bool winInstallColormapShadowGDI(ColormapPtr pColormap); static Bool winStoreColorsShadowGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs); static Bool winCreateColormapShadowGDI(ColormapPtr pColormap); static Bool winDestroyColormapShadowGDI(ColormapPtr pColormap); /* * Internal function to get the DIB format that is compatible with the screen */ static Bool winQueryScreenDIBFormat(ScreenPtr pScreen, BITMAPINFOHEADER * pbmih) { winScreenPriv(pScreen); HBITMAP hbmp; #if CYGDEBUG LPDWORD pdw = NULL; #endif /* Create a memory bitmap compatible with the screen */ hbmp = CreateCompatibleBitmap(pScreenPriv->hdcScreen, 1, 1); if (hbmp == NULL) { ErrorF("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n"); return FALSE; } /* Initialize our bitmap info header */ ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); pbmih->biSize = sizeof(BITMAPINFOHEADER); /* Get the biBitCount */ if (!GetDIBits(pScreenPriv->hdcScreen, hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) { ErrorF("winQueryScreenDIBFormat - First call to GetDIBits failed\n"); DeleteObject(hbmp); return FALSE; } #if CYGDEBUG /* Get a pointer to bitfields */ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER)); winDebug("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n", (unsigned int)pdw[0], (unsigned int)pdw[1], (unsigned int)pdw[2]); #endif /* Get optimal color table, or the optimal bitfields */ if (!GetDIBits(pScreenPriv->hdcScreen, hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) { ErrorF("winQueryScreenDIBFormat - Second call to GetDIBits " "failed\n"); DeleteObject(hbmp); return FALSE; } /* Free memory */ DeleteObject(hbmp); return TRUE; } /* * Internal function to determine the GDI bits per rgb and bit masks */ static Bool winQueryRGBBitsAndMasks(ScreenPtr pScreen) { winScreenPriv(pScreen); BITMAPINFOHEADER *pbmih = NULL; Bool fReturn = TRUE; LPDWORD pdw = NULL; DWORD dwRedBits, dwGreenBits, dwBlueBits; /* Color masks for 8 bpp are standardized */ if (GetDeviceCaps(pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) { /* * RGB BPP for 8 bit palletes is always 8 * and the color masks are always 0. */ pScreenPriv->dwBitsPerRGB = 8; pScreenPriv->dwRedMask = 0x0L; pScreenPriv->dwGreenMask = 0x0L; pScreenPriv->dwBlueMask = 0x0L; return TRUE; } /* Color masks for 24 bpp are standardized */ if (GetDeviceCaps(pScreenPriv->hdcScreen, PLANES) * GetDeviceCaps(pScreenPriv->hdcScreen, BITSPIXEL) == 24) { ErrorF("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) " "returned 24 for the screen. Using default 24bpp masks.\n"); /* 8 bits per primary color */ pScreenPriv->dwBitsPerRGB = 8; /* Set screen privates masks */ pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED; pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN; pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE; return TRUE; } /* Allocate a bitmap header and color table */ pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pbmih == NULL) { ErrorF("winQueryRGBBitsAndMasks - malloc failed\n"); return FALSE; } /* Get screen description */ if (winQueryScreenDIBFormat(pScreen, pbmih)) { /* Get a pointer to bitfields */ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER)); #if CYGDEBUG winDebug("%s - Masks: %08x %08x %08x\n", __FUNCTION__, (unsigned int)pdw[0], (unsigned int)pdw[1], (unsigned int)pdw[2]); winDebug("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__, (int)pbmih->biWidth, (int)pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes); winDebug("%s - Compression: %u %s\n", __FUNCTION__, (unsigned int)pbmih->biCompression, (pbmih->biCompression == BI_RGB ? "(BI_RGB)" : (pbmih->biCompression == BI_RLE8 ? "(BI_RLE8)" : (pbmih-> biCompression == BI_RLE4 ? "(BI_RLE4)" : (pbmih-> biCompression == BI_BITFIELDS ? "(BI_BITFIELDS)" : ""))))); #endif /* Handle BI_RGB case, which is returned by Wine */ if (pbmih->biCompression == BI_RGB) { dwRedBits = 5; dwGreenBits = 5; dwBlueBits = 5; pScreenPriv->dwBitsPerRGB = 5; /* Set screen privates masks */ pScreenPriv->dwRedMask = 0x7c00; pScreenPriv->dwGreenMask = 0x03e0; pScreenPriv->dwBlueMask = 0x001f; } else { /* Count the number of bits in each mask */ dwRedBits = winCountBits(pdw[0]); dwGreenBits = winCountBits(pdw[1]); dwBlueBits = winCountBits(pdw[2]); /* Find maximum bits per red, green, blue */ if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) pScreenPriv->dwBitsPerRGB = dwRedBits; else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) pScreenPriv->dwBitsPerRGB = dwGreenBits; else pScreenPriv->dwBitsPerRGB = dwBlueBits; /* Set screen privates masks */ pScreenPriv->dwRedMask = pdw[0]; pScreenPriv->dwGreenMask = pdw[1]; pScreenPriv->dwBlueMask = pdw[2]; } } else { ErrorF("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n"); fReturn = FALSE; } /* Free memory */ free(pbmih); return fReturn; } /* * Redraw all ---? */ static wBOOL CALLBACK winRedrawAllProcShadowGDI(HWND hwnd, LPARAM lParam) { if (hwnd == (HWND) lParam) return TRUE; InvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd); return TRUE; } static wBOOL CALLBACK winRedrawDamagedWindowShadowGDI(HWND hwnd, LPARAM lParam) { BoxPtr pDamage = (BoxPtr) lParam; RECT rcClient, rcDamage, rcRedraw; POINT topLeft, bottomRight; if (IsIconic(hwnd)) return TRUE; /* Don't care minimized windows */ /* Convert the damaged area from Screen coords to Client coords */ topLeft.x = pDamage->x1; topLeft.y = pDamage->y1; bottomRight.x = pDamage->x2; bottomRight.y = pDamage->y2; topLeft.x += GetSystemMetrics(SM_XVIRTUALSCREEN); bottomRight.x += GetSystemMetrics(SM_XVIRTUALSCREEN); topLeft.y += GetSystemMetrics(SM_YVIRTUALSCREEN); bottomRight.y += GetSystemMetrics(SM_YVIRTUALSCREEN); ScreenToClient(hwnd, &topLeft); ScreenToClient(hwnd, &bottomRight); SetRect(&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); GetClientRect(hwnd, &rcClient); if (IntersectRect(&rcRedraw, &rcClient, &rcDamage)) { InvalidateRect(hwnd, &rcRedraw, FALSE); UpdateWindow(hwnd); } return TRUE; } /* * Allocate a DIB for the shadow framebuffer GDI server */ static Bool winAllocateFBShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; DIBSECTION dibsection; Bool fReturn = TRUE; /* Describe shadow bitmap to be created */ pScreenPriv->pbmih->biWidth = pScreenInfo->dwWidth; pScreenPriv->pbmih->biHeight = -pScreenInfo->dwHeight; ErrorF("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d " "depth: %d\n", (int) pScreenPriv->pbmih->biWidth, (int) -pScreenPriv->pbmih->biHeight, pScreenPriv->pbmih->biBitCount); /* Create a DI shadow bitmap with a bit pointer */ pScreenPriv->hbmpShadow = CreateDIBSection(pScreenPriv->hdcScreen, (BITMAPINFO *) pScreenPriv-> pbmih, DIB_RGB_COLORS, (VOID **) &pScreenInfo->pfb, NULL, 0); if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) { winW32Error(2, "winAllocateFBShadowGDI - CreateDIBSection failed:"); return FALSE; } else { #if CYGDEBUG winDebug("winAllocateFBShadowGDI - Shadow buffer allocated\n"); #endif } /* Get information about the bitmap that was allocated */ GetObject(pScreenPriv->hbmpShadow, sizeof(dibsection), &dibsection); #if CYGDEBUG || YES /* Print information about bitmap allocated */ winDebug("winAllocateFBShadowGDI - Dibsection width: %d height: %d " "depth: %d size image: %d\n", (int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight, dibsection.dsBmih.biBitCount, (int) dibsection.dsBmih.biSizeImage); #endif /* Select the shadow bitmap into the shadow DC */ SelectObject(pScreenPriv->hdcShadow, pScreenPriv->hbmpShadow); #if CYGDEBUG winDebug("winAllocateFBShadowGDI - Attempting a shadow blit\n"); #endif /* Do a test blit from the shadow to the screen, I think */ fReturn = BitBlt(pScreenPriv->hdcScreen, 0, 0, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenPriv->hdcShadow, 0, 0, SRCCOPY); if (fReturn) { #if CYGDEBUG winDebug("winAllocateFBShadowGDI - Shadow blit success\n"); #endif } else { winW32Error(2, "winAllocateFBShadowGDI - Shadow blit failure\n"); #if 0 return FALSE; #else /* ago: ignore this error. The blit fails with wine, but does not * cause any problems later. */ fReturn = TRUE; #endif } /* Look for height weirdness */ if (dibsection.dsBmih.biHeight < 0) { dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight; } /* Set screeninfo stride */ pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage / dibsection.dsBmih.biHeight) * 8) / pScreenInfo->dwBPP; #if CYGDEBUG || YES winDebug("winAllocateFBShadowGDI - Created shadow stride: %d\n", (int) pScreenInfo->dwStride); #endif /* Redraw all windows */ if (pScreenInfo->fMultiWindow) EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); return fReturn; } static void winFreeFBShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Free the shadow bitmap */ DeleteObject(pScreenPriv->hbmpShadow); /* Invalidate the ScreenInfo's fb pointer */ pScreenInfo->pfb = NULL; } /* * Blit the damaged regions of the shadow fb to the screen */ static void winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; RegionPtr damage = DamageRegion(pBuf->pDamage); DWORD dwBox = RegionNumRects(damage); BoxPtr pBox = RegionRects(damage); int x, y, w, h; HRGN hrgnCombined = NULL; #ifdef XWIN_UPDATESTATS static DWORD s_dwNonUnitRegions = 0; static DWORD s_dwTotalUpdates = 0; static DWORD s_dwTotalBoxes = 0; #endif BoxPtr pBoxExtents = RegionExtents(damage); /* * Return immediately if the app is not active * and we are fullscreen, or if we have a bad display depth */ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) || pScreenPriv->fBadDepth) return; #ifdef XWIN_UPDATESTATS ++s_dwTotalUpdates; s_dwTotalBoxes += dwBox; if (dwBox != 1) { ++s_dwNonUnitRegions; ErrorF("winShadowUpdatGDI - dwBox: %d\n", dwBox); } if ((s_dwTotalUpdates % 100) == 0) ErrorF("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d " "nu: %d tu: %d\n", (s_dwNonUnitRegions * 100) / s_dwTotalUpdates, s_dwTotalBoxes / s_dwTotalUpdates, s_dwNonUnitRegions, s_dwTotalUpdates); #endif /* XWIN_UPDATESTATS */ /* * Handle small regions with multiple blits, * handle large regions by creating a clipping region and * doing a single blit constrained to that clipping region. */ if (!pScreenInfo->fMultiWindow && (pScreenInfo->dwClipUpdatesNBoxes == 0 || dwBox < pScreenInfo->dwClipUpdatesNBoxes)) { /* Loop through all boxes in the damaged region */ while (dwBox--) { /* * Calculate x offset, y offset, width, and height for * current damage box */ x = pBox->x1; y = pBox->y1; w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; BitBlt(pScreenPriv->hdcScreen, x, y, w, h, pScreenPriv->hdcShadow, x, y, SRCCOPY); /* Get a pointer to the next box */ ++pBox; } } else if (!pScreenInfo->fMultiWindow) { /* Compute a GDI region from the damaged region */ hrgnCombined = CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, pBoxExtents->y2); /* Install the GDI region as a clipping region */ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined); DeleteObject(hrgnCombined); hrgnCombined = NULL; /* * Blit the shadow buffer to the screen, * constrained to the clipping region. */ BitBlt(pScreenPriv->hdcScreen, pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2 - pBoxExtents->x1, pBoxExtents->y2 - pBoxExtents->y1, pScreenPriv->hdcShadow, pBoxExtents->x1, pBoxExtents->y1, SRCCOPY); /* Reset the clip region */ SelectClipRgn(pScreenPriv->hdcScreen, NULL); } /* Redraw all multiwindow windows */ if (pScreenInfo->fMultiWindow) EnumThreadWindows(g_dwCurrentThreadID, winRedrawDamagedWindowShadowGDI, (LPARAM) pBoxExtents); } static Bool winInitScreenShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); /* Get device contexts for the screen and shadow bitmap */ pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen); pScreenPriv->hdcShadow = CreateCompatibleDC(pScreenPriv->hdcScreen); /* Allocate bitmap info header */ pScreenPriv->pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pScreenPriv->pbmih == NULL) { ErrorF("winInitScreenShadowGDI - malloc () failed\n"); return FALSE; } /* Query the screen format */ if (!winQueryScreenDIBFormat(pScreen, pScreenPriv->pbmih)) { ErrorF("winInitScreenShadowGDI - winQueryScreenDIBFormat failed\n"); return FALSE; } /* Determine our color masks */ if (!winQueryRGBBitsAndMasks(pScreen)) { ErrorF("winInitScreenShadowGDI - winQueryRGBBitsAndMasks failed\n"); return FALSE; } return winAllocateFBShadowGDI(pScreen); } /* See Porting Layer Definition - p. 33 */ /* * We wrap whatever CloseScreen procedure was specified by fb; * a pointer to said procedure is stored in our privates. */ static Bool winCloseScreenShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn = TRUE; #if CYGDEBUG winDebug("winCloseScreenShadowGDI - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; pScreenPriv->fActive = FALSE; /* Call the wrapped CloseScreen procedure */ WIN_UNWRAP(CloseScreen); if (pScreen->CloseScreen) fReturn = (*pScreen->CloseScreen) (pScreen); /* Delete the window property */ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP); /* Free the shadow DC; which allows the bitmap to be freed */ DeleteDC(pScreenPriv->hdcShadow); winFreeFBShadowGDI(pScreen); /* Free the screen DC */ ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); /* Delete tray icon, if we have one */ if (!pScreenInfo->fNoTrayIcon) winDeleteNotifyIcon(pScreenPriv); /* Free the exit confirmation dialog box, if it exists */ if (g_hDlgExit != NULL) { DestroyWindow(g_hDlgExit); g_hDlgExit = NULL; } /* Kill our window */ if (pScreenPriv->hwndScreen) { DestroyWindow(pScreenPriv->hwndScreen); pScreenPriv->hwndScreen = NULL; } /* Destroy the thread startup mutex */ pthread_mutex_destroy(&pScreenPriv->pmServerStarted); /* Invalidate our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ free((void *) pScreenPriv); return fReturn; } /* * Tell mi what sort of visuals we need. * * Generally we only need one visual, as our screen can only * handle one format at a time, I believe. You may want * to verify that last sentence. */ static Bool winInitVisualsShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Display debugging information */ ErrorF("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d " "bpp %d\n", (unsigned int) pScreenPriv->dwRedMask, (unsigned int) pScreenPriv->dwGreenMask, (unsigned int) pScreenPriv->dwBlueMask, (int) pScreenPriv->dwBitsPerRGB, (int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { case 24: case 16: case 15: /* Setup the real visual */ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth, TrueColorMask, pScreenPriv->dwBitsPerRGB, -1, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { ErrorF("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " "failed\n"); return FALSE; } #ifdef XWIN_EMULATEPSEUDO if (!pScreenInfo->fEmulatePseudo) break; /* Setup a pseudocolor visual */ if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) { ErrorF("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " "failed for PseudoColor\n"); return FALSE; } #endif break; case 8: if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth, PseudoColorMask, pScreenPriv->dwBitsPerRGB, PseudoColor, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { ErrorF("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " "failed\n"); return FALSE; } break; default: ErrorF("winInitVisualsShadowGDI - Unknown screen depth\n"); return FALSE; } #if CYGDEBUG winDebug("winInitVisualsShadowGDI - Returning\n"); #endif return TRUE; } /* * Adjust the proposed video mode */ static Bool winAdjustVideoModeShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc; DWORD dwBPP; hdc = GetDC(NULL); /* We're in serious trouble if we can't get a DC */ if (hdc == NULL) { ErrorF("winAdjustVideoModeShadowGDI - GetDC () failed\n"); return FALSE; } /* Query GDI for current display depth */ dwBPP = GetDeviceCaps(hdc, BITSPIXEL); /* GDI cannot change the screen depth, so always use GDI's depth */ pScreenInfo->dwBPP = dwBPP; /* Release our DC */ ReleaseDC(NULL, hdc); hdc = NULL; return TRUE; } /* * Blt exposed regions to the screen */ static Bool winBltExposedRegionsShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; winPrivCmapPtr pCmapPriv = NULL; HDC hdcUpdate; PAINTSTRUCT ps; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps); /* Realize the palette, if we have one */ if (pScreenPriv->pcmapInstalled != NULL) { pCmapPriv = winGetCmapPriv(pScreenPriv->pcmapInstalled); SelectPalette(hdcUpdate, pCmapPriv->hPalette, FALSE); RealizePalette(hdcUpdate); } /* Our BitBlt will be clipped to the invalidated region */ BitBlt(hdcUpdate, 0, 0, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenPriv->hdcShadow, 0, 0, SRCCOPY); /* EndPaint frees the DC */ EndPaint(pScreenPriv->hwndScreen, &ps); /* Redraw all windows */ if (pScreenInfo->fMultiWindow) EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, (LPARAM) pScreenPriv->hwndScreen); return TRUE; } /* * Do any engine-specific appliation-activation processing */ static Bool winActivateAppShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* * 2004/04/12 - Harold - We perform the restoring or minimizing * manually for ShadowGDI in fullscreen modes so that this engine * will perform just like ShadowDD and ShadowDDNL in fullscreen mode; * if we do not do this then our fullscreen window will appear in the * z-order when it is deactivated and it can be uncovered by resizing * or minimizing another window that is on top of it, which is not how * the DirectDraw engines work. Therefore we keep this code here to * make sure that all engines work the same in fullscreen mode. */ /* * Are we active? * Are we fullscreen? */ if (pScreenPriv->fActive && pScreenInfo->fFullScreen) { /* * Activating, attempt to bring our window * to the top of the display */ ShowWindow(pScreenPriv->hwndScreen, SW_RESTORE); } else if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) { /* * Deactivating, stuff our window onto the * task bar. */ ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE); } return TRUE; } /* * Reblit the shadow framebuffer to the screen. */ static Bool winRedrawScreenShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Redraw the whole window, to take account for the new colors */ BitBlt(pScreenPriv->hdcScreen, 0, 0, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenPriv->hdcShadow, 0, 0, SRCCOPY); /* Redraw all windows */ if (pScreenInfo->fMultiWindow) EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); return TRUE; } /* * Realize the currently installed colormap */ static Bool winRealizeInstalledPaletteShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winPrivCmapPtr pCmapPriv = NULL; #if CYGDEBUG winDebug("winRealizeInstalledPaletteShadowGDI\n"); #endif /* Don't do anything if there is not a colormap */ if (pScreenPriv->pcmapInstalled == NULL) { #if CYGDEBUG winDebug("winRealizeInstalledPaletteShadowGDI - No colormap " "installed\n"); #endif return TRUE; } pCmapPriv = winGetCmapPriv(pScreenPriv->pcmapInstalled); /* Realize our palette for the screen */ if (RealizePalette(pScreenPriv->hdcScreen) == GDI_ERROR) { ErrorF("winRealizeInstalledPaletteShadowGDI - RealizePalette () " "failed\n"); return FALSE; } /* Set the DIB color table */ if (SetDIBColorTable(pScreenPriv->hdcShadow, 0, WIN_NUM_PALETTE_ENTRIES, pCmapPriv->rgbColors) == 0) { ErrorF("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () " "failed\n"); return FALSE; } return TRUE; } /* * Install the specified colormap */ static Bool winInstallColormapShadowGDI(ColormapPtr pColormap) { ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; winCmapPriv(pColormap); /* * Tell Windows to install the new colormap */ if (SelectPalette(pScreenPriv->hdcScreen, pCmapPriv->hPalette, FALSE) == NULL) { ErrorF("winInstallColormapShadowGDI - SelectPalette () failed\n"); return FALSE; } /* Realize the palette */ if (GDI_ERROR == RealizePalette(pScreenPriv->hdcScreen)) { ErrorF("winInstallColormapShadowGDI - RealizePalette () failed\n"); return FALSE; } /* Set the DIB color table */ if (SetDIBColorTable(pScreenPriv->hdcShadow, 0, WIN_NUM_PALETTE_ENTRIES, pCmapPriv->rgbColors) == 0) { ErrorF("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); return FALSE; } /* Redraw the whole window, to take account for the new colors */ BitBlt(pScreenPriv->hdcScreen, 0, 0, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenPriv->hdcShadow, 0, 0, SRCCOPY); /* Save a pointer to the newly installed colormap */ pScreenPriv->pcmapInstalled = pColormap; /* Redraw all windows */ if (pScreenInfo->fMultiWindow) EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); return TRUE; } /* * Store the specified colors in the specified colormap */ static Bool winStoreColorsShadowGDI(ColormapPtr pColormap, int ndef, xColorItem * pdefs) { ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winCmapPriv(pColormap); ColormapPtr curpmap = pScreenPriv->pcmapInstalled; /* Put the X colormap entries into the Windows logical palette */ if (SetPaletteEntries(pCmapPriv->hPalette, pdefs[0].pixel, ndef, pCmapPriv->peColors + pdefs[0].pixel) == 0) { ErrorF("winStoreColorsShadowGDI - SetPaletteEntries () failed\n"); return FALSE; } /* Don't install the Windows palette if the colormap is not installed */ if (pColormap != curpmap) { return TRUE; } /* Try to install the newly modified colormap */ if (!winInstallColormapShadowGDI(pColormap)) { ErrorF("winInstallColormapShadowGDI - winInstallColormapShadowGDI " "failed\n"); return FALSE; } #if 0 /* Tell Windows that the palette has changed */ RealizePalette(pScreenPriv->hdcScreen); /* Set the DIB color table */ if (SetDIBColorTable(pScreenPriv->hdcShadow, pdefs[0].pixel, ndef, pCmapPriv->rgbColors + pdefs[0].pixel) == 0) { ErrorF("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); return FALSE; } /* Save a pointer to the newly installed colormap */ pScreenPriv->pcmapInstalled = pColormap; #endif return TRUE; } /* * Colormap initialization procedure */ static Bool winCreateColormapShadowGDI(ColormapPtr pColormap) { LPLOGPALETTE lpPaletteNew = NULL; DWORD dwEntriesMax; VisualPtr pVisual; HPALETTE hpalNew = NULL; winCmapPriv(pColormap); /* Get a pointer to the visual that the colormap belongs to */ pVisual = pColormap->pVisual; /* Get the maximum number of palette entries for this visual */ dwEntriesMax = pVisual->ColormapEntries; /* Allocate a Windows logical color palette with max entries */ lpPaletteNew = malloc(sizeof(LOGPALETTE) + (dwEntriesMax - 1) * sizeof(PALETTEENTRY)); if (lpPaletteNew == NULL) { ErrorF("winCreateColormapShadowGDI - Couldn't allocate palette " "with %d entries\n", (int) dwEntriesMax); return FALSE; } /* Zero out the colormap */ ZeroMemory(lpPaletteNew, sizeof(LOGPALETTE) + (dwEntriesMax - 1) * sizeof(PALETTEENTRY)); /* Set the logical palette structure */ lpPaletteNew->palVersion = 0x0300; lpPaletteNew->palNumEntries = dwEntriesMax; /* Tell Windows to create the palette */ hpalNew = CreatePalette(lpPaletteNew); if (hpalNew == NULL) { ErrorF("winCreateColormapShadowGDI - CreatePalette () failed\n"); free(lpPaletteNew); return FALSE; } /* Save the Windows logical palette handle in the X colormaps' privates */ pCmapPriv->hPalette = hpalNew; /* Free the palette initialization memory */ free(lpPaletteNew); return TRUE; } /* * Colormap destruction procedure */ static Bool winDestroyColormapShadowGDI(ColormapPtr pColormap) { winScreenPriv(pColormap->pScreen); winCmapPriv(pColormap); /* * Is colormap to be destroyed the default? * * Non-default colormaps should have had winUninstallColormap * called on them before we get here. The default colormap * will not have had winUninstallColormap called on it. Thus, * we need to handle the default colormap in a special way. */ if (pColormap->flags & IsDefault) { #if CYGDEBUG winDebug("winDestroyColormapShadowGDI - Destroying default " "colormap\n"); #endif /* * FIXME: Walk the list of all screens, popping the default * palette out of each screen device context. */ /* Pop the palette out of the device context */ SelectPalette(pScreenPriv->hdcScreen, GetStockObject(DEFAULT_PALETTE), FALSE); /* Clear our private installed colormap pointer */ pScreenPriv->pcmapInstalled = NULL; } /* Try to delete the logical palette */ if (DeleteObject(pCmapPriv->hPalette) == 0) { ErrorF("winDestroyColormap - DeleteObject () failed\n"); return FALSE; } /* Invalidate the colormap privates */ pCmapPriv->hPalette = NULL; return TRUE; } /* * Set engine specific funtions */ Bool winSetEngineFunctionsShadowGDI(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; pScreenPriv->pwinFreeFB = winFreeFBShadowGDI; pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; pScreenPriv->pwinInitScreen = winInitScreenShadowGDI; pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; if (pScreenInfo->fFullScreen) pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; else pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI; pScreenPriv->pwinActivateApp = winActivateAppShadowGDI; pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI; pScreenPriv->pwinRealizeInstalledPalette = winRealizeInstalledPaletteShadowGDI; pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI; pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI; pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI; pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI; pScreenPriv->pwinCreatePrimarySurface = NULL; pScreenPriv->pwinReleasePrimarySurface = NULL; return TRUE; } xorg-server-1.20.8/hw/xwin/winmonitors.c0000644000175000017500000000446213640201473015153 00000000000000/* Copyright 1993, 1998 The Open Group Copyright (C) Colin Harrison 2005-2008 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. */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmonitors.h" /* * getMonitorInfo - callback function used to return information from the enumeration of monitors attached */ static wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) { struct GetMonitorInfoData *data = (struct GetMonitorInfoData *) _data; // only get data for monitor number specified in data->monitorNum++; if (data->monitorNum == data->requestedMonitor) { data->bMonitorSpecifiedExists = TRUE; data->monitorOffsetX = rect->left; data->monitorOffsetY = rect->top; data->monitorHeight = rect->bottom - rect->top; data->monitorWidth = rect->right - rect->left; data->monitorHandle = hMonitor; return FALSE; } return TRUE; } Bool QueryMonitor(int i, struct GetMonitorInfoData *data) { /* prepare data */ if (data == NULL) return FALSE; memset(data, 0, sizeof(*data)); data->requestedMonitor = i; /* query information */ EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); return TRUE; } xorg-server-1.20.8/hw/xwin/system.XWinrc0000644000175000017500000000721013640201473015071 00000000000000# XWin Server Resource File - EXAMPLE # Earle F. Philhower, III # Place in ~/.XWinrc or in /etc/X11/system.XWinrc # Keywords are case insensitive, comments legal pretty much anywhere # you can have an end-of-line # Comments begin with "#" or "//" and go to the end-of-line # Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc) # Paths to icons are **WINDOWS** based (i.e. c:\windows\icons) # Menus are defined as... # MENU { # EXEC # ^^ This command will have any "%display%" # string replaced with the proper display # variable (i.e. 127.0.0.1:.0) # (This should only rarely be needed as # the DISPLAY environment variable is also # set correctly) # or MENU # or ALWAYSONTOP # ^^ Sets the window to display above all others # or RELOAD # ^^ Causes ~/.XWinrc or the system.XWinrc file # to be reloaded and icons and menus regenerated # or SEPARATOR # ... # } # Set the taskmar menu with # ROOTMENU # If you want a menu to be applied to all popup window's system menu # DEFAULTSYSMENU # To choose a specific menu for a specific WM_CLASS or WM_NAME use ... # SYSMENU { # # ... # } # When specifying an ICONFILE in the following commands several different # formats are allowed: # 1. Name of a regular Windows .ico format file # (ex: "cygwin.ico", "apple.ico") # 2. Name and index into a Windows .DLL # (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon # "c:\windows\system32\shell32.dll,5" gives the floppy drive icon) # 3. Index into XWin.EXE internal ICON resource # (ex: ",101" is the 1st icon inside XWin.exe) # To define where ICO files live (** Windows path**) # ICONDIRECTORY # NOTE: If you specify a fully qualified path to an ICON below # (i.e. "c:\xxx" or "d:\xxxx") # this ICONDIRECTORY will not be prepended # To change the taskbar icon use... # TRAYICON # To define a replacement for the standard X icon for apps w/o specified icons # DEFAULTICON # To define substitute icons on a per-window basis use... # ICONS { # # ... # } # In the case where multiple matches occur, the first listed in the ICONS # section will be chosen. # To disable exit confirmation dialog add the line containing SilentExit # DEBUG prints out the string to the XWin.log file // Below are just some silly menus to demonstrate writing your // own configuration file. // Make some menus... menu apps { xterm exec "xterm" "Emacs" exec "emacs" notepad exec notepad xload exec "xload -display %display%" # Comment } menu root { // Comments fit here, too... "Reload .XWinrc" RELOAD "Applications" menu apps SEParATOR } menu aot { Separator "Always on Top" alwaysontop } menu xtermspecial { "Emacs" exec "emacs" "Always on Top" alwaysontop SepArAtor } RootMenu root DefaultSysMenu aot atend SysMenu { "xterm" xtermspecial atstart } # IconDirectory "c:\winnt\" # DefaultIcon "reinstall.ico" # Icons { # "xterm" "uninstall.ico" # } SilentExit DEBUG "Done parsing the configuration file..." xorg-server-1.20.8/hw/xwin/win.h0000644000175000017500000006101213640201473013357 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II * Kensuke Matsuzaki */ #ifndef _WIN_H_ #define _WIN_H_ #ifndef NO #define NO 0 #endif #ifndef YES #define YES 1 #endif /* We can handle WM_MOUSEHWHEEL even though _WIN32_WINNT < 0x0600 */ #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif /* Turn debug messages on or off */ #ifndef CYGDEBUG #define CYGDEBUG NO #endif #define WIN_DEFAULT_BPP 0 #define WIN_DEFAULT_WHITEPIXEL 255 #define WIN_DEFAULT_BLACKPIXEL 0 #define WIN_DEFAULT_LINEBIAS 0 #define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ #define WIN_DEFAULT_DPI 96 #define WIN_DEFAULT_REFRESH 0 #define WIN_DEFAULT_WIN_KILL TRUE #define WIN_DEFAULT_UNIX_KILL FALSE #define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0 #ifdef XWIN_EMULATEPSEUDO #define WIN_DEFAULT_EMULATE_PSEUDO FALSE #endif #define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE /* * Windows only supports 256 color palettes */ #define WIN_NUM_PALETTE_ENTRIES 256 /* * Number of times to call Restore in an attempt to restore the primary surface */ #define WIN_REGAIN_SURFACE_RETRIES 1 /* * Build a supported display depths mask by shifting one to the left * by the number of bits in the supported depth. */ #define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \ | (1 << (16 - 1)) | (1 << (15 - 1)) \ | (1 << ( 8 - 1))) #define WIN_CHECK_DEPTH YES /* * Timer IDs for WM_TIMER */ #define WIN_E3B_TIMER_ID 1 #define WIN_POLLING_MOUSE_TIMER_ID 2 #define MOUSE_POLLING_INTERVAL 50 #define WIN_E3B_OFF -1 #define WIN_E3B_DEFAULT 0 #define WIN_FD_INVALID -1 #define WIN_SERVER_NONE 0x0L /* 0 */ #define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ #define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ #define AltMapIndex Mod1MapIndex #define NumLockMapIndex Mod2MapIndex #define AltLangMapIndex Mod3MapIndex #define KanaMapIndex Mod4MapIndex #define ScrollLockMapIndex Mod5MapIndex #define WIN_MOD_LALT 0x00000001 #define WIN_MOD_RALT 0x00000002 #define WIN_MOD_LCONTROL 0x00000004 #define WIN_MOD_RCONTROL 0x00000008 #define WIN_24BPP_MASK_RED 0x00FF0000 #define WIN_24BPP_MASK_GREEN 0x0000FF00 #define WIN_24BPP_MASK_BLUE 0x000000FF #define WIN_MAX_KEYS_PER_KEY 4 #define NONAMELESSUNION #include #include #include #include #define HANDLE void * #include #undef HANDLE #ifdef HAVE_MMAP #include #ifndef MAP_FILE #define MAP_FILE 0 #endif /* MAP_FILE */ #endif /* HAVE_MMAP */ #include #include #include #include #include "scrnintstr.h" #include "pixmapstr.h" #include "pixmap.h" #include "region.h" #include "gcstruct.h" #include "colormap.h" #include "colormapst.h" #include "miscstruct.h" #include "servermd.h" #include "windowstr.h" #include "mi.h" #include "micmap.h" #include "mifillarc.h" #include "mifpoly.h" #include "input.h" #include "mipointer.h" #include "X11/keysym.h" #include "micoord.h" #include "miline.h" #include "shadow.h" #include "fb.h" #ifdef XWIN_MULTIWINDOWEXTWM #include "rootless.h" #endif #include "mipict.h" #include "picturestr.h" #ifdef RANDR #include "randrstr.h" #endif /* * Windows headers */ #include "winms.h" #include "winresource.h" /* * Define Windows constants */ #define WM_TRAYICON (WM_USER + 1000) #define WM_INIT_SYS_MENU (WM_USER + 1001) #define WM_GIVEUP (WM_USER + 1002) /* Local includes */ #include "winwindow.h" #include "winmsg.h" /* * Debugging macros */ #if CYGDEBUG #define DEBUG_MSG(str,...) \ if (fDebugProcMsg) \ { \ char *pszTemp; \ int iLength; \ if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \ MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ free (pszTemp); \ } \ } #else #define DEBUG_MSG(str,...) #endif #if CYGDEBUG #define DEBUG_FN_NAME(str) PTSTR szFunctionName = str #else #define DEBUG_FN_NAME(str) #endif #if CYGDEBUG || YES #define DEBUGVARS BOOL fDebugProcMsg = FALSE #else #define DEBUGVARS #endif #if CYGDEBUG || YES #define DEBUGPROC_MSG fDebugProcMsg = TRUE #else #define DEBUGPROC_MSG #endif #define PROFILEPOINT(point,thresh)\ {\ static unsigned int PROFPT##point = 0;\ if (++PROFPT##point % thresh == 0)\ ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\ } #define DEFINE_ATOM_HELPER(func,atom_name) \ static Atom func (void) { \ static int generation; \ static Atom atom; \ if (generation != serverGeneration) { \ generation = serverGeneration; \ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ } \ return atom; \ } /* * Typedefs for engine dependent function pointers */ typedef Bool (*winAllocateFBProcPtr) (ScreenPtr); typedef void (*winFreeFBProcPtr) (ScreenPtr); typedef void (*winShadowUpdateProcPtr) (ScreenPtr, shadowBufPtr); typedef Bool (*winInitScreenProcPtr) (ScreenPtr); typedef Bool (*winCloseScreenProcPtr) (ScreenPtr); typedef Bool (*winInitVisualsProcPtr) (ScreenPtr); typedef Bool (*winAdjustVideoModeProcPtr) (ScreenPtr); typedef Bool (*winCreateBoundingWindowProcPtr) (ScreenPtr); typedef Bool (*winFinishScreenInitProcPtr) (int, ScreenPtr, int, char **); typedef Bool (*winBltExposedRegionsProcPtr) (ScreenPtr); typedef Bool (*winActivateAppProcPtr) (ScreenPtr); typedef Bool (*winRedrawScreenProcPtr) (ScreenPtr pScreen); typedef Bool (*winRealizeInstalledPaletteProcPtr) (ScreenPtr pScreen); typedef Bool (*winInstallColormapProcPtr) (ColormapPtr pColormap); typedef Bool (*winStoreColorsProcPtr) (ColormapPtr pmap, int ndef, xColorItem * pdefs); typedef Bool (*winCreateColormapProcPtr) (ColormapPtr pColormap); typedef Bool (*winDestroyColormapProcPtr) (ColormapPtr pColormap); typedef Bool (*winCreatePrimarySurfaceProcPtr) (ScreenPtr); typedef Bool (*winReleasePrimarySurfaceProcPtr) (ScreenPtr); typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr); /* * Pixmap privates */ typedef struct { HDC hdcSelected; HBITMAP hBitmap; BYTE *pbBits; DWORD dwScanlineBytes; BITMAPINFOHEADER *pbmih; } winPrivPixmapRec, *winPrivPixmapPtr; /* * Colormap privates */ typedef struct { HPALETTE hPalette; LPDIRECTDRAWPALETTE lpDDPalette; RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES]; } winPrivCmapRec, *winPrivCmapPtr; /* * Windows Cursor handling. */ typedef struct { /* from GetSystemMetrics */ int sm_cx; int sm_cy; BOOL visible; HCURSOR handle; QueryBestSizeProcPtr QueryBestSize; miPointerSpriteFuncPtr spriteFuncs; } winCursorRec; /* * Resize modes */ typedef enum { resizeDefault = -1, resizeNotAllowed, resizeWithScrollbars, resizeWithRandr } winResizeMode; /* * Screen information structure that we need before privates are available * in the server startup sequence. */ typedef struct { ScreenPtr pScreen; /* Did the user specify a height and width? */ Bool fUserGaveHeightAndWidth; DWORD dwScreen; int iMonitor; HMONITOR hMonitor; DWORD dwUserWidth; DWORD dwUserHeight; DWORD dwWidth; DWORD dwHeight; DWORD dwPaddedWidth; /* Did the user specify a screen position? */ Bool fUserGavePosition; DWORD dwInitialX; DWORD dwInitialY; /* * dwStride is the number of whole pixels that occupy a scanline, * including those pixels that are not displayed. This is basically * a rounding up of the width. */ DWORD dwStride; /* Offset of the screen in the window when using scrollbars */ DWORD dwXOffset; DWORD dwYOffset; DWORD dwBPP; DWORD dwDepth; DWORD dwRefreshRate; char *pfb; DWORD dwEngine; DWORD dwEnginePreferred; DWORD dwClipUpdatesNBoxes; #ifdef XWIN_EMULATEPSEUDO Bool fEmulatePseudo; #endif Bool fFullScreen; Bool fDecoration; #ifdef XWIN_MULTIWINDOWEXTWM Bool fMWExtWM; #endif Bool fRootless; Bool fMultiWindow; Bool fMultiMonitorOverride; Bool fMultipleMonitors; Bool fLessPointer; winResizeMode iResizeMode; Bool fNoTrayIcon; int iE3BTimeout; /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ Bool fUseWinKillKey; Bool fUseUnixKillKey; Bool fIgnoreInput; /* Did the user explicitly set this screen? */ Bool fExplicitScreen; } winScreenInfo, *winScreenInfoPtr; /* * Screen privates */ typedef struct _winPrivScreenRec { winScreenInfoPtr pScreenInfo; Bool fEnabled; Bool fClosed; Bool fActive; Bool fBadDepth; int iDeltaZ; int iDeltaV; int iConnectedClients; CloseScreenProcPtr CloseScreen; DWORD dwRedMask; DWORD dwGreenMask; DWORD dwBlueMask; DWORD dwBitsPerRGB; DWORD dwModeKeyStates; /* Handle to icons that must be freed */ HICON hiconNotifyIcon; /* Palette management */ ColormapPtr pcmapInstalled; /* Pointer to the root visual so we only have to look it up once */ VisualPtr pRootVisual; /* 3 button emulation variables */ int iE3BCachedPress; Bool fE3BFakeButton2Sent; /* Privates used by shadow fb GDI engine */ HBITMAP hbmpShadow; HDC hdcScreen; HDC hdcShadow; HWND hwndScreen; BITMAPINFOHEADER *pbmih; /* Privates used by shadow fb DirectDraw Nonlocking engine */ LPDIRECTDRAW pdd; LPDIRECTDRAW4 pdd4; LPDIRECTDRAWSURFACE4 pddsShadow4; LPDIRECTDRAWSURFACE4 pddsPrimary4; LPDIRECTDRAWCLIPPER pddcPrimary; BOOL fRetryCreateSurface; #ifdef XWIN_MULTIWINDOWEXTWM /* Privates used by multi-window external window manager */ RootlessFrameID widTop; Bool fRestacking; #endif /* Privates used by multi-window */ pthread_t ptWMProc; pthread_t ptXMsgProc; void *pWMInfo; /* Privates used by both multi-window and rootless */ Bool fRootWindowShown; /* Privates used for any module running in a seperate thread */ pthread_mutex_t pmServerStarted; Bool fServerStarted; /* Engine specific functions */ winAllocateFBProcPtr pwinAllocateFB; winFreeFBProcPtr pwinFreeFB; winShadowUpdateProcPtr pwinShadowUpdate; winInitScreenProcPtr pwinInitScreen; winCloseScreenProcPtr pwinCloseScreen; winInitVisualsProcPtr pwinInitVisuals; winAdjustVideoModeProcPtr pwinAdjustVideoMode; winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; winFinishScreenInitProcPtr pwinFinishScreenInit; winBltExposedRegionsProcPtr pwinBltExposedRegions; winActivateAppProcPtr pwinActivateApp; winRedrawScreenProcPtr pwinRedrawScreen; winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette; winInstallColormapProcPtr pwinInstallColormap; winStoreColorsProcPtr pwinStoreColors; winCreateColormapProcPtr pwinCreateColormap; winDestroyColormapProcPtr pwinDestroyColormap; winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; winCreateScreenResourcesProc pwinCreateScreenResources; /* Window Procedures for Rootless mode */ CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; PositionWindowProcPtr PositionWindow; ChangeWindowAttributesProcPtr ChangeWindowAttributes; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; ClipNotifyProcPtr ClipNotify; RestackWindowProcPtr RestackWindow; ReparentWindowProcPtr ReparentWindow; ResizeWindowProcPtr ResizeWindow; MoveWindowProcPtr MoveWindow; SetShapeProcPtr SetShape; winCursorRec cursor; Bool fNativeGlActive; } winPrivScreenRec; #ifdef XWIN_MULTIWINDOWEXTWM typedef struct { RootlessWindowPtr pFrame; HWND hWnd; int dwWidthBytes; BITMAPINFOHEADER *pbmihShadow; HBITMAP hbmpShadow; HDC hdcShadow; HDC hdcScreen; BOOL fResized; BOOL fRestackingNow; BOOL fClose; BOOL fMovingOrSizing; BOOL fDestroyed; //for debug char *pfb; } win32RootlessWindowRec, *win32RootlessWindowPtr; #endif typedef struct { void *value; XID id; } WindowIDPairRec, *WindowIDPairPtr; /* * Extern declares for general global variables */ #include "winglobals.h" extern winScreenInfo *g_ScreenInfo; extern miPointerScreenFuncRec g_winPointerCursorFuncs; extern DWORD g_dwEvents; #ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; #endif extern DevPrivateKeyRec g_iScreenPrivateKeyRec; #define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec) extern DevPrivateKeyRec g_iCmapPrivateKeyRec; #define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec) extern DevPrivateKeyRec g_iGCPrivateKeyRec; #define g_iGCPrivateKey (&g_iGCPrivateKeyRec) extern DevPrivateKeyRec g_iPixmapPrivateKeyRec; #define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec) extern DevPrivateKeyRec g_iWindowPrivateKeyRec; #define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec) extern unsigned long g_ulServerGeneration; extern DWORD g_dwEnginesSupported; extern HINSTANCE g_hInstance; extern int g_copyROP[]; extern int g_patternROP[]; extern const char *g_pszQueryHost; extern DeviceIntPtr g_pwinPointer; extern DeviceIntPtr g_pwinKeyboard; /* * Extern declares for dynamically loaded library function pointers */ extern FARPROC g_fpDirectDrawCreate; extern FARPROC g_fpDirectDrawCreateClipper; /* * Screen privates macros */ #define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey)) #define winSetScreenPriv(pScreen,v) \ dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v) #define winScreenPriv(pScreen) \ winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) /* * Colormap privates macros */ #define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \ dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey)) #define winSetCmapPriv(pCmap,v) \ dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v) #define winCmapPriv(pCmap) \ winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap) /* * GC privates macros */ #define winGetGCPriv(pGC) ((winPrivGCPtr) \ dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey)) #define winSetGCPriv(pGC,v) \ dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v) #define winGCPriv(pGC) \ winPrivGCPtr pGCPriv = winGetGCPriv(pGC) /* * Pixmap privates macros */ #define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey)) #define winSetPixmapPriv(pPixmap,v) \ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v) #define winPixmapPriv(pPixmap) \ winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap) /* * Window privates macros */ #define winGetWindowPriv(pWin) ((winPrivWinPtr) \ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey)) #define winSetWindowPriv(pWin,v) \ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v) #define winWindowPriv(pWin) \ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin) /* * wrapper macros */ #define _WIN_WRAP(priv, real, mem, func) {\ priv->mem = real->mem; \ real->mem = func; \ } #define _WIN_UNWRAP(priv, real, mem) {\ real->mem = priv->mem; \ } #define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func) #define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem) /* * BEGIN DDX and DIX Function Prototypes */ /* * winallpriv.c */ Bool winAllocatePrivates(ScreenPtr pScreen); Bool winInitCmapPrivates(ColormapPtr pCmap, int i); Bool winAllocateCmapPrivates(ColormapPtr pCmap); /* * winauth.c */ Bool winGenerateAuthorization(void); void winSetAuthorization(void); /* * winblock.c */ void winBlockHandler(ScreenPtr pScreen, void *pTimeout); /* * winclipboardinit.c */ Bool winInitClipboard(void); void winClipboardShutdown(void); /* * wincmap.c */ void winSetColormapFunctions(ScreenPtr pScreen); Bool winCreateDefColormap(ScreenPtr pScreen); /* * wincreatewnd.c */ Bool winCreateBoundingWindowFullScreen(ScreenPtr pScreen); Bool winCreateBoundingWindowWindowed(ScreenPtr pScreen); /* * windialogs.c */ void winDisplayExitDialog(winPrivScreenPtr pScreenPriv); void winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv); void winDisplayAboutDialog(winPrivScreenPtr pScreenPriv); /* * winengine.c */ void winDetectSupportedEngines(void); Bool winSetEngine(ScreenPtr pScreen); Bool winGetDDProcAddresses(void); void winReleaseDDProcAddresses(void); /* * winerror.c */ #ifdef DDXOSVERRORF void OsVendorVErrorF(const char *pszFormat, va_list va_args) _X_ATTRIBUTE_PRINTF(1, 0); #endif void winMessageBoxF(const char *pszError, UINT uType, ...) _X_ATTRIBUTE_PRINTF(1, 3); /* * winglobals.c */ void winInitializeGlobals(void); /* * winkeybd.c */ int winTranslateKey(WPARAM wParam, LPARAM lParam); int winKeybdProc(DeviceIntPtr pDeviceInt, int iState); void winInitializeModeKeyStates(void); void winRestoreModeKeyStates(void); Bool winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam); void winKeybdReleaseKeys(void); void winSendKeyEvent(DWORD dwKey, Bool fDown); BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam); void winFixShiftKeys(int iScanCode); /* * winkeyhook.c */ Bool winInstallKeyboardHookLL(void); void winRemoveKeyboardHookLL(void); /* * winmisc.c */ CARD8 winCountBits(DWORD dw); Bool winUpdateFBPointer(ScreenPtr pScreen, void *pbits); /* * winmouse.c */ int winMouseProc(DeviceIntPtr pDeviceInt, int iState); int winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown); void winMouseButtonsSendEvent(int iEventType, int iButton); int winMouseButtonsHandle(ScreenPtr pScreen, int iEventType, int iButton, WPARAM wParam); void winEnqueueMotion(int x, int y); /* * winscrinit.c */ Bool winScreenInit(ScreenPtr pScreen, int argc, char **argv); Bool winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv); /* * winshadddnl.c */ Bool winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen); /* * winshadgdi.c */ Bool winSetEngineFunctionsShadowGDI(ScreenPtr pScreen); /* * winwakeup.c */ void winWakeupHandler(ScreenPtr pScreen, int iResult); /* * winwindow.c */ Bool winCreateWindowRootless(WindowPtr pWindow); Bool winDestroyWindowRootless(WindowPtr pWindow); Bool winPositionWindowRootless(WindowPtr pWindow, int x, int y); Bool winChangeWindowAttributesRootless(WindowPtr pWindow, unsigned long mask); Bool winUnmapWindowRootless(WindowPtr pWindow); Bool winMapWindowRootless(WindowPtr pWindow); void winSetShapeRootless(WindowPtr pWindow, int kind); /* * winmultiwindowshape.c */ void winReshapeMultiWindow(WindowPtr pWin); void winSetShapeMultiWindow(WindowPtr pWindow, int kind); void winUpdateRgnMultiWindow(WindowPtr pWindow); /* * winmultiwindowwindow.c */ Bool winCreateWindowMultiWindow(WindowPtr pWindow); Bool winDestroyWindowMultiWindow(WindowPtr pWindow); Bool winPositionWindowMultiWindow(WindowPtr pWindow, int x, int y); Bool winChangeWindowAttributesMultiWindow(WindowPtr pWindow, unsigned long mask); Bool winUnmapWindowMultiWindow(WindowPtr pWindow); Bool winMapWindowMultiWindow(WindowPtr pWindow); void winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent); void winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib); void winReorderWindowsMultiWindow(void); void winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib); void winMoveWindowMultiWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind); void winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion); XID winGetWindowID(WindowPtr pWin); int winAdjustXWindow(WindowPtr pWin, HWND hwnd); /* * winmultiwindowwndproc.c */ LRESULT CALLBACK winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* * wintrayicon.c */ void winInitNotifyIcon(winPrivScreenPtr pScreenPriv); void winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv); LRESULT winHandleIconMessage(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, winPrivScreenPtr pScreenPriv); /* * winwndproc.c */ LRESULT CALLBACK winWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); #ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootless.c */ Bool winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY, RegionPtr pShape); void winMWExtWMDestroyFrame(RootlessFrameID wid); void winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); void winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY, unsigned int newW, unsigned int newH, unsigned int gravity); void winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid); void winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape); void winMWExtWMUnmapFrame(RootlessFrameID wid); void winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow); void winMWExtWMStopDrawing(RootlessFrameID wid, Bool flush); void winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage); void winMWExtWMDamageRects(RootlessFrameID wid, int count, const BoxRec * rects, int shift_x, int shift_y); void winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin); void winMWExtWMCopyBytes(unsigned int width, unsigned int height, const void *src, unsigned int srcRowBytes, void *dst, unsigned int dstRowBytes); void winMWExtWMCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec * dstRects, int dx, int dy); #endif #ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootlesswindow.c */ void winMWExtWMReorderWindows(ScreenPtr pScreen); void winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y); void winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h); void winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h); void winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv, winScreenInfoPtr pScreenInfo); wBOOL CALLBACK winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam); void winMWExtWMRestackWindows(ScreenPtr pScreen); #endif #ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootlesswndproc.c */ LRESULT CALLBACK winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); #endif /* * winwindowswm.c */ void winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg, Window window, int x, int y, int w, int h); void winWindowsWMExtensionInit(void); /* * wincursor.c */ Bool winInitCursor(ScreenPtr pScreen); /* * winprocarg.c */ void winInitializeScreens(int maxscreens); /* * winrandr.c */ Bool winRandRInit(ScreenPtr pScreen); void winDoRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight); /* * winmsgwindow.c */ Bool winCreateMsgWindowThread(void); /* * winos.c */ void winOS(void); /* * END DDX and DIX Function Prototypes */ #endif /* _WIN_H_ */ xorg-server-1.20.8/hw/xwin/Makefile.am0000644000175000017500000000705713640201473014456 00000000000000bin_PROGRAMS = XWin SRCS_CLIPBOARD = \ winclipboardinit.c \ winclipboardwrappers.c CLIPBOARD_LIBS = $(top_builddir)/hw/xwin/winclipboard/libXWinclipboard.la if XWIN_GLX_WINDOWS GLX_DIR = DEFS_GLX_WINDOWS = XWIN_GLX_LIBS = if XWIN_WINDOWS_DRI GLX_DIR += dri DEFS_GLX_WINDOWS += -DXWIN_WINDOWS_DRI XWIN_GLX_LIBS += $(top_builddir)/hw/xwin/dri/libWindowsDRI.la endif GLX_DIR += glx DEFS_GLX_WINDOWS += -DXWIN_GLX_WINDOWS XWIN_GLX_LIBS += $(top_builddir)/hw/xwin/glx/libXwinGLX.la XWIN_GLX_SYS_LIBS = -lopengl32 endif SRCS_MULTIWINDOW = \ winmultiwindowshape.c \ winmultiwindowwindow.c \ winmultiwindowwm.c \ winmultiwindowwndproc.c \ propertystore.h \ winSetAppUserModelID.c MULTIWINDOW_SYS_LIBS = -lshlwapi -lole32 if XWIN_MULTIWINDOWEXTWM SRCS_MULTIWINDOWEXTWM = \ winwin32rootless.c \ winwin32rootlesswindow.c \ winwin32rootlesswndproc.c \ winwindowswm.c DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la MULTIWINDOWEXTWM_CFLAGS = -I$(top_srcdir)/miext/rootless endif SRCS_RANDR = \ winrandr.c SRCS = InitInput.c \ InitOutput.c \ winallpriv.c \ winauth.c \ winblock.c \ wincmap.c \ winconfig.c \ wincreatewnd.c \ wincursor.c \ windialogs.c \ winengine.c \ winerror.c \ winglobals.c \ winkeybd.c \ winkeyhook.c \ winmisc.c \ winmonitors.c \ winmouse.c \ winmsg.c \ winmsgwindow.c \ winmultiwindowclass.c \ winmultiwindowicons.c \ winos.c \ winprefs.c \ winprefsyacc.y \ winprefslex.l \ winprocarg.c \ winscrinit.c \ winshadddnl.c \ winshadgdi.c \ wintaskbar.c \ wintrayicon.c \ winvalargs.c \ winwakeup.c \ winwindow.c \ winwndproc.c \ ddraw.h \ winconfig.h \ win.h \ winglobals.h \ winkeybd.h \ winkeynames.h \ winlayouts.h \ winmessages.h \ winmonitors.h \ winmsg.h \ winms.h \ winmultiwindowclass.h \ winmultiwindowicons.h \ winprefs.h \ winresource.h \ winwindow.h \ windisplay.c \ windisplay.h \ XWin.rc \ $(top_srcdir)/mi/miinitext.c \ $(SRCS_CLIPBOARD) \ $(SRCS_MULTIWINDOW) \ $(SRCS_MULTIWINDOWEXTWM) \ $(SRCS_RANDR) DEFS = \ $(DEFS_GLX_WINDOWS) \ $(DEFS_MULTIWINDOWEXTWM) XWin_SOURCES = $(SRCS) XWIN_SYS_LIBS += -ldxguid XWIN_LIBS += \ $(top_builddir)/pseudoramiX/libPseudoramiX.la \ $(top_builddir)/Xi/libXistubs.la XWin_DEPENDENCIES = \ $(MULTIWINDOWEXTWM_LIBS) \ $(XWIN_GLX_LIBS) \ $(XWIN_LIBS) \ $(CLIPBOARD_LIBS) \ $(XSERVER_LIBS) XWin_LDADD = \ $(MULTIWINDOWEXTWM_LIBS) \ $(XWIN_GLX_LIBS) \ $(XWIN_LIBS) \ $(CLIPBOARD_LIBS) \ $(XSERVER_LIBS) \ $(XWIN_GLX_SYS_LIBS) \ $(XSERVER_SYS_LIBS) \ $(XWIN_SYS_LIBS) \ $(MULTIWINDOW_SYS_LIBS) XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG) .rc.o: $(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include XWin.o: XWin.rc XWin.exe.manifest X.ico winprefsyacc.h: winprefsyacc.c winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c CLEANFILES = $(BUILT_SOURCES) AM_YFLAGS = -d AM_LFLAGS = -i AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) \ -I$(top_srcdir) \ $(MULTIWINDOWEXTWM_CFLAGS) \ -Wno-bad-function-cast xwinconfigdir = $(sysconfdir)/X11 xwinconfig_DATA = system.XWinrc install-exec-hook: (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) XWin$(EXEEXT) X) EXTRA_DIST = \ $(xwinconfig_DATA) \ X.ico \ XWin.rc \ XWin.exe.manifest relink: $(AM_V_at)rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT) SUBDIRS = man $(GLX_DIR) winclipboard . DIST_SUBDIRS = man dri glx winclipboard . xorg-server-1.20.8/hw/xwin/winmsgwindow.c0000644000175000017500000001360313640201473015314 00000000000000/* * Copyright (C) Jon TURNEY 2011 * * 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_XWIN_CONFIG_H #include #endif #include "win.h" /* * This is the messaging window, a hidden top-level window. We never do anything * with it, but other programs may send messages to it. */ /* * winMsgWindowProc - Window procedure for msg window */ static LRESULT CALLBACK winMsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { #if CYGDEBUG winDebugWin32Message("winMsgWindowProc", hwnd, message, wParam, lParam); #endif switch (message) { case WM_ENDSESSION: if (!wParam) return 0; /* shutdown is being cancelled */ /* Send a WM_GIVEUP message to the X server thread so it wakes up if blocked in select(), performs GiveUp(), and then notices that GiveUp() has set the DE_TERMINATE flag so exits the msg dispatch loop. */ { ScreenPtr pScreen = screenInfo.screens[0]; winScreenPriv(pScreen); PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); } /* This process will be terminated by the system almost immediately after the last thread with a message queue returns from processing WM_ENDSESSION, so we cannot rely on any code executing after this message is processed and need to wait here until ddxGiveUp() is called and releases the termination mutex to guarantee that the lock file and unix domain sockets have been removed ofc, Microsoft doesn't document this under WM_ENDSESSION, you are supposed to read the source of CRSS to find out how it works :-) http://blogs.msdn.com/b/michen/archive/2008/04/04/application-termination-when-user-logs-off.aspx */ { int iReturn = pthread_mutex_lock(&g_pmTerminating); if (iReturn != 0) { ErrorF("winMsgWindowProc - pthread_mutex_lock () failed: %d\n", iReturn); } winDebug ("winMsgWindowProc - WM_ENDSESSION termination lock acquired\n"); } return 0; } return DefWindowProc(hwnd, message, wParam, lParam); } static HWND winCreateMsgWindow(void) { HWND hwndMsg; // register window class { WNDCLASSEX wcx; wcx.cbSize = sizeof(WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = winMsgWindowProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = g_hInstance; wcx.hIcon = NULL; wcx.hCursor = 0; wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wcx.lpszMenuName = NULL; wcx.lpszClassName = WINDOW_CLASS_X_MSG; wcx.hIconSm = NULL; RegisterClassEx(&wcx); } // Create the msg window. hwndMsg = CreateWindowEx(0, // no extended styles WINDOW_CLASS_X_MSG, // class name "XWin Msg Window", // window name WS_OVERLAPPEDWINDOW, // overlapped window CW_USEDEFAULT, // default horizontal position CW_USEDEFAULT, // default vertical position CW_USEDEFAULT, // default width CW_USEDEFAULT, // default height (HWND) NULL, // no parent or owner window (HMENU) NULL, // class menu used GetModuleHandle(NULL), // instance handle NULL); // no window creation data if (!hwndMsg) { ErrorF("winCreateMsgWindow - Create msg window failed\n"); return NULL; } winDebug("winCreateMsgWindow - Created msg window hwnd 0x%p\n", hwndMsg); return hwndMsg; } static void * winMsgWindowThreadProc(void *arg) { HWND hwndMsg; winDebug("winMsgWindowThreadProc - Hello\n"); hwndMsg = winCreateMsgWindow(); if (hwndMsg) { MSG msg; /* Pump the msg window message queue */ while (GetMessage(&msg, hwndMsg, 0, 0) > 0) { #if CYGDEBUG winDebugWin32Message("winMsgWindowThread", msg.hwnd, msg.message, msg.wParam, msg.lParam); #endif DispatchMessage(&msg); } } winDebug("winMsgWindowThreadProc - Exit\n"); return NULL; } Bool winCreateMsgWindowThread(void) { pthread_t ptMsgWindowThreadProc; /* Spawn a thread for the msg window */ if (pthread_create(&ptMsgWindowThreadProc, NULL, winMsgWindowThreadProc, NULL)) { /* Bail if thread creation failed */ ErrorF("winCreateMsgWindow - pthread_create failed.\n"); return FALSE; } return TRUE; } xorg-server-1.20.8/hw/xwin/winshadddnl.c0000644000175000017500000012006513640201473015060 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #define FAIL_MSG_MAX_BLT 10 /* * Local prototypes */ static Bool winAllocateFBShadowDDNL(ScreenPtr pScreen); static void winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf); static Bool winCloseScreenShadowDDNL(ScreenPtr pScreen); static Bool winInitVisualsShadowDDNL(ScreenPtr pScreen); static Bool winAdjustVideoModeShadowDDNL(ScreenPtr pScreen); static Bool winBltExposedRegionsShadowDDNL(ScreenPtr pScreen); static Bool winActivateAppShadowDDNL(ScreenPtr pScreen); static Bool winRedrawScreenShadowDDNL(ScreenPtr pScreen); static Bool winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen); static Bool winInstallColormapShadowDDNL(ColormapPtr pColormap); static Bool winStoreColorsShadowDDNL(ColormapPtr pmap, int ndef, xColorItem * pdefs); static Bool winCreateColormapShadowDDNL(ColormapPtr pColormap); static Bool winDestroyColormapShadowDDNL(ColormapPtr pColormap); static Bool winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen); static Bool winReleasePrimarySurfaceShadowDDNL(ScreenPtr pScreen); /* * Create the primary surface and attach the clipper. * Used for both the initial surface creation and during * WM_DISPLAYCHANGE messages. */ static Bool winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); HRESULT ddrval = DD_OK; DDSURFACEDESC2 ddsd; winDebug("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n"); /* Describe the primary surface */ ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; /* Create the primary surface */ ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4, &ddsd, &pScreenPriv->pddsPrimary4, NULL); pScreenPriv->fRetryCreateSurface = FALSE; if (FAILED(ddrval)) { if (ddrval == DDERR_NOEXCLUSIVEMODE) { /* Recreating the surface failed. Mark screen to retry later */ pScreenPriv->fRetryCreateSurface = TRUE; winDebug("winCreatePrimarySurfaceShadowDDNL - Could not create " "primary surface: DDERR_NOEXCLUSIVEMODE\n"); } else { ErrorF("winCreatePrimarySurfaceShadowDDNL - Could not create " "primary surface: %08x\n", (unsigned int) ddrval); } return FALSE; } #if 1 winDebug("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n"); #endif /* Attach our clipper to our primary surface handle */ ddrval = IDirectDrawSurface4_SetClipper(pScreenPriv->pddsPrimary4, pScreenPriv->pddcPrimary); if (FAILED(ddrval)) { ErrorF("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper " "failed: %08x\n", (unsigned int) ddrval); return FALSE; } #if 1 winDebug("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary " "surface\n"); #endif /* Everything was correct */ return TRUE; } /* * Detach the clipper and release the primary surface. * Called from WM_DISPLAYCHANGE. */ static Bool winReleasePrimarySurfaceShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winDebug("winReleasePrimarySurfaceShadowDDNL - Hello\n"); /* Release the primary surface and clipper, if they exist */ if (pScreenPriv->pddsPrimary4) { /* * Detach the clipper from the primary surface. * NOTE: We do this explicity for clarity. The Clipper is not released. */ IDirectDrawSurface4_SetClipper(pScreenPriv->pddsPrimary4, NULL); winDebug("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n"); /* Release the primary surface */ IDirectDrawSurface4_Release(pScreenPriv->pddsPrimary4); pScreenPriv->pddsPrimary4 = NULL; } winDebug("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n"); return TRUE; } /* * Create a DirectDraw surface for the shadow framebuffer; also create * a primary surface object so we can blit to the display. * * Install a DirectDraw clipper on our primary surface object * that clips our blits to the unobscured client area of our display window. */ Bool winAllocateFBShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HRESULT ddrval = DD_OK; DDSURFACEDESC2 ddsdShadow; char *lpSurface = NULL; DDPIXELFORMAT ddpfPrimary; #if CYGDEBUG winDebug("winAllocateFBShadowDDNL - w %u h %u d %u\n", (unsigned int)pScreenInfo->dwWidth, (unsigned int)pScreenInfo->dwHeight, (unsigned int)pScreenInfo->dwDepth); #endif /* Set the padded screen width */ pScreenInfo->dwPaddedWidth = PixmapBytePad(pScreenInfo->dwWidth, pScreenInfo->dwBPP); /* Allocate memory for our shadow surface */ lpSurface = malloc(pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); if (lpSurface == NULL) { ErrorF("winAllocateFBShadowDDNL - Could not allocate bits\n"); return FALSE; } /* * Initialize the framebuffer memory so we don't get a * strange display at startup */ ZeroMemory(lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); /* Create a clipper */ ddrval = (*g_fpDirectDrawCreateClipper) (0, &pScreenPriv->pddcPrimary, NULL); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n", (unsigned int) ddrval); return FALSE; } #if CYGDEBUG winDebug("winAllocateFBShadowDDNL - Created a clipper\n"); #endif /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd(pScreenPriv->pddcPrimary, 0, pScreenPriv->hwndScreen); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Clipper not attached " "to window: %08x\n", (unsigned int) ddrval); return FALSE; } #if CYGDEBUG winDebug("winAllocateFBShadowDDNL - Attached clipper to window\n"); #endif /* Create a DirectDraw object, store the address at lpdd */ ddrval = (*g_fpDirectDrawCreate) (NULL, (LPDIRECTDRAW *) &pScreenPriv->pdd, NULL); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not start " "DirectDraw: %08x\n", (unsigned int) ddrval); return FALSE; } #if CYGDEBUG winDebug("winAllocateFBShadowDDNL - Created and initialized DD\n"); #endif /* Get a DirectDraw4 interface pointer */ ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd, &IID_IDirectDraw4, (LPVOID *) &pScreenPriv->pdd4); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n", (unsigned int) ddrval); return FALSE; } /* Are we full screen? */ if (pScreenInfo->fFullScreen) { DDSURFACEDESC2 ddsdCurrent; DWORD dwRefreshRateCurrent = 0; HDC hdc = NULL; /* Set the cooperative level to full screen */ ddrval = IDirectDraw4_SetCooperativeLevel(pScreenPriv->pdd4, pScreenPriv->hwndScreen, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not set " "cooperative level: %08x\n", (unsigned int) ddrval); return FALSE; } /* * We only need to get the current refresh rate for comparison * if a refresh rate has been passed on the command line. */ if (pScreenInfo->dwRefreshRate != 0) { ZeroMemory(&ddsdCurrent, sizeof(ddsdCurrent)); ddsdCurrent.dwSize = sizeof(ddsdCurrent); /* Get information about current display settings */ ddrval = IDirectDraw4_GetDisplayMode(pScreenPriv->pdd4, &ddsdCurrent); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not get current " "refresh rate: %08x. Continuing.\n", (unsigned int) ddrval); dwRefreshRateCurrent = 0; } else { /* Grab the current refresh rate */ dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; } } /* Clean up the refresh rate */ if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) { /* * Refresh rate is non-specified or equal to current. */ pScreenInfo->dwRefreshRate = 0; } /* Grab a device context for the screen */ hdc = GetDC(NULL); if (hdc == NULL) { ErrorF("winAllocateFBShadowDDNL - GetDC () failed\n"); return FALSE; } /* Only change the video mode when different than current mode */ if (!pScreenInfo->fMultipleMonitors && (pScreenInfo->dwWidth != GetSystemMetrics(SM_CXSCREEN) || pScreenInfo->dwHeight != GetSystemMetrics(SM_CYSCREEN) || pScreenInfo->dwBPP != GetDeviceCaps(hdc, BITSPIXEL) || pScreenInfo->dwRefreshRate != 0)) { winDebug("winAllocateFBShadowDDNL - Changing video mode\n"); /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ ddrval = IDirectDraw4_SetDisplayMode(pScreenPriv->pdd4, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwBPP, pScreenInfo->dwRefreshRate, 0); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not set " "full screen display mode: %08x\n", (unsigned int) ddrval); ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n"); ddrval = IDirectDraw4_SetDisplayMode(pScreenPriv->pdd4, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwBPP, 0, 0); if (FAILED(ddrval)) { ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate " "full screen display mode: %08x\n", (unsigned int) ddrval); return FALSE; } } } else { winDebug("winAllocateFBShadowDDNL - Not changing video mode\n"); } /* Release our DC */ ReleaseDC(NULL, hdc); hdc = NULL; } else { /* Set the cooperative level for windowed mode */ ddrval = IDirectDraw4_SetCooperativeLevel(pScreenPriv->pdd4, pScreenPriv->hwndScreen, DDSCL_NORMAL); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not set " "cooperative level: %08x\n", (unsigned int) ddrval); return FALSE; } } /* Create the primary surface */ if (!winCreatePrimarySurfaceShadowDDNL(pScreen)) { ErrorF("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL " "failed\n"); return FALSE; } /* Get primary surface's pixel format */ ZeroMemory(&ddpfPrimary, sizeof(ddpfPrimary)); ddpfPrimary.dwSize = sizeof(ddpfPrimary); ddrval = IDirectDrawSurface4_GetPixelFormat(pScreenPriv->pddsPrimary4, &ddpfPrimary); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not get primary " "pixformat: %08x\n", (unsigned int) ddrval); return FALSE; } #if CYGDEBUG winDebug("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x " "dwRGBBitCount: %u\n", (unsigned int)ddpfPrimary.u2.dwRBitMask, (unsigned int)ddpfPrimary.u3.dwGBitMask, (unsigned int)ddpfPrimary.u4.dwBBitMask, (unsigned int)ddpfPrimary.u1.dwRGBBitCount); #endif /* Describe the shadow surface to be created */ /* * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, * as drawing, locking, and unlocking take forever * with video memory surfaces. In addition, * video memory is a somewhat scarce resource, * so you shouldn't be allocating video memory when * you have the option of using system memory instead. */ ZeroMemory(&ddsdShadow, sizeof(ddsdShadow)); ddsdShadow.dwSize = sizeof(ddsdShadow); ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT; ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; ddsdShadow.dwHeight = pScreenInfo->dwHeight; ddsdShadow.dwWidth = pScreenInfo->dwWidth; ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth; ddsdShadow.lpSurface = lpSurface; ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary; winDebug("winAllocateFBShadowDDNL - lPitch: %d\n", (int) pScreenInfo->dwPaddedWidth); /* Create the shadow surface */ ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4, &ddsdShadow, &pScreenPriv->pddsShadow4, NULL); if (FAILED(ddrval)) { ErrorF("winAllocateFBShadowDDNL - Could not create shadow " "surface: %08x\n", (unsigned int) ddrval); return FALSE; } #if CYGDEBUG || YES winDebug("winAllocateFBShadowDDNL - Created shadow pitch: %d\n", (int) ddsdShadow.u1.lPitch); #endif /* Grab the pitch from the surface desc */ pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8) / pScreenInfo->dwBPP; #if CYGDEBUG || YES winDebug("winAllocateFBShadowDDNL - Created shadow stride: %d\n", (int) pScreenInfo->dwStride); #endif /* Save the pointer to our surface memory */ pScreenInfo->pfb = lpSurface; /* Grab the masks from the surface description */ pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask; pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask; #if CYGDEBUG winDebug("winAllocateFBShadowDDNL - Returning\n"); #endif return TRUE; } static void winFreeFBShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Free the shadow surface, if there is one */ if (pScreenPriv->pddsShadow4) { IDirectDrawSurface4_Release(pScreenPriv->pddsShadow4); free(pScreenInfo->pfb); pScreenInfo->pfb = NULL; pScreenPriv->pddsShadow4 = NULL; } /* Detach the clipper from the primary surface and release the primary surface, if there is one */ winReleasePrimarySurfaceShadowDDNL(pScreen); /* Release the clipper object */ if (pScreenPriv->pddcPrimary) { IDirectDrawClipper_Release(pScreenPriv->pddcPrimary); pScreenPriv->pddcPrimary = NULL; } /* Free the DirectDraw4 object, if there is one */ if (pScreenPriv->pdd4) { IDirectDraw4_RestoreDisplayMode(pScreenPriv->pdd4); IDirectDraw4_Release(pScreenPriv->pdd4); pScreenPriv->pdd4 = NULL; } /* Free the DirectDraw object, if there is one */ if (pScreenPriv->pdd) { IDirectDraw_Release(pScreenPriv->pdd); pScreenPriv->pdd = NULL; } /* Invalidate the ScreenInfo's fb pointer */ pScreenInfo->pfb = NULL; } /* * Transfer the damaged regions of the shadow framebuffer to the display. */ static void winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; RegionPtr damage = DamageRegion(pBuf->pDamage); HRESULT ddrval = DD_OK; RECT rcDest, rcSrc; POINT ptOrigin; DWORD dwBox = RegionNumRects(damage); BoxPtr pBox = RegionRects(damage); HRGN hrgnCombined = NULL; /* * Return immediately if the app is not active * and we are fullscreen, or if we have a bad display depth */ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) || pScreenPriv->fBadDepth) return; /* Return immediately if we didn't get needed surfaces */ if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4) return; /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints(pScreenPriv->hwndScreen, HWND_DESKTOP, (LPPOINT) &ptOrigin, 1); /* * Handle small regions with multiple blits, * handle large regions by creating a clipping region and * doing a single blit constrained to that clipping region. */ if (pScreenInfo->dwClipUpdatesNBoxes == 0 || dwBox < pScreenInfo->dwClipUpdatesNBoxes) { /* Loop through all boxes in the damaged region */ while (dwBox--) { /* Assign damage box to source rectangle */ rcSrc.left = pBox->x1; rcSrc.top = pBox->y1; rcSrc.right = pBox->x2; rcSrc.bottom = pBox->y2; /* Calculate destination rectangle */ rcDest.left = ptOrigin.x + rcSrc.left; rcDest.top = ptOrigin.y + rcSrc.top; rcDest.right = ptOrigin.x + rcSrc.right; rcDest.bottom = ptOrigin.y + rcSrc.bottom; /* Blit the damaged areas */ ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4, &rcDest, pScreenPriv->pddsShadow4, &rcSrc, DDBLT_WAIT, NULL); if (FAILED(ddrval)) { static int s_iFailCount = 0; if (s_iFailCount < FAIL_MSG_MAX_BLT) { ErrorF("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () " "failed: %08x\n", (unsigned int) ddrval); ++s_iFailCount; if (s_iFailCount == FAIL_MSG_MAX_BLT) { ErrorF("winShadowUpdateDDNL - IDirectDrawSurface4_Blt " "failure message maximum (%d) reached. No " "more failure messages will be printed.\n", FAIL_MSG_MAX_BLT); } } } /* Get a pointer to the next box */ ++pBox; } } else { BoxPtr pBoxExtents = RegionExtents(damage); /* Compute a GDI region from the damaged region */ hrgnCombined = CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, pBoxExtents->y2); /* Install the GDI region as a clipping region */ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined); DeleteObject(hrgnCombined); hrgnCombined = NULL; #if CYGDEBUG winDebug("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n", pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, pBoxExtents->y2); #endif /* Calculating a bounding box for the source is easy */ rcSrc.left = pBoxExtents->x1; rcSrc.top = pBoxExtents->y1; rcSrc.right = pBoxExtents->x2; rcSrc.bottom = pBoxExtents->y2; /* Calculating a bounding box for the destination is trickier */ rcDest.left = ptOrigin.x + rcSrc.left; rcDest.top = ptOrigin.y + rcSrc.top; rcDest.right = ptOrigin.x + rcSrc.right; rcDest.bottom = ptOrigin.y + rcSrc.bottom; /* Our Blt should be clipped to the invalidated region */ ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4, &rcDest, pScreenPriv->pddsShadow4, &rcSrc, DDBLT_WAIT, NULL); /* Reset the clip region */ SelectClipRgn(pScreenPriv->hdcScreen, NULL); } } static Bool winInitScreenShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); /* Get a device context for the screen */ pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen); return winAllocateFBShadowDDNL(pScreen); } /* * Call the wrapped CloseScreen function. * * Free our resources and private structures. */ static Bool winCloseScreenShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn = TRUE; #if CYGDEBUG winDebug("winCloseScreenShadowDDNL - Freeing screen resources\n"); #endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; pScreenPriv->fActive = FALSE; /* Call the wrapped CloseScreen procedure */ WIN_UNWRAP(CloseScreen); if (pScreen->CloseScreen) fReturn = (*pScreen->CloseScreen) (pScreen); winFreeFBShadowDDNL(pScreen); /* Free the screen DC */ ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); /* Delete the window property */ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP); /* Delete tray icon, if we have one */ if (!pScreenInfo->fNoTrayIcon) winDeleteNotifyIcon(pScreenPriv); /* Free the exit confirmation dialog box, if it exists */ if (g_hDlgExit != NULL) { DestroyWindow(g_hDlgExit); g_hDlgExit = NULL; } /* Kill our window */ if (pScreenPriv->hwndScreen) { DestroyWindow(pScreenPriv->hwndScreen); pScreenPriv->hwndScreen = NULL; } /* Destroy the thread startup mutex */ pthread_mutex_destroy(&pScreenPriv->pmServerStarted); /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ free((void *) pScreenPriv); return fReturn; } /* * Tell mi what sort of visuals we need. * * Generally we only need one visual, as our screen can only * handle one format at a time, I believe. You may want * to verify that last sentence. */ static Bool winInitVisualsShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; DWORD dwRedBits, dwGreenBits, dwBlueBits; /* Count the number of ones in each color mask */ dwRedBits = winCountBits(pScreenPriv->dwRedMask); dwGreenBits = winCountBits(pScreenPriv->dwGreenMask); dwBlueBits = winCountBits(pScreenPriv->dwBlueMask); /* Store the maximum number of ones in a color mask as the bitsPerRGB */ if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) pScreenPriv->dwBitsPerRGB = 8; else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) pScreenPriv->dwBitsPerRGB = dwRedBits; else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) pScreenPriv->dwBitsPerRGB = dwGreenBits; else pScreenPriv->dwBitsPerRGB = dwBlueBits; winDebug("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d " "bpp %d\n", (unsigned int) pScreenPriv->dwRedMask, (unsigned int) pScreenPriv->dwGreenMask, (unsigned int) pScreenPriv->dwBlueMask, (int) pScreenPriv->dwBitsPerRGB, (int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP); /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) { case 24: case 16: case 15: /* Setup the real visual */ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth, TrueColorMask, pScreenPriv->dwBitsPerRGB, -1, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " "failed for TrueColor\n"); return FALSE; } #ifdef XWIN_EMULATEPSEUDO if (!pScreenInfo->fEmulatePseudo) break; /* Setup a pseudocolor visual */ if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) { ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " "failed for PseudoColor\n"); return FALSE; } #endif break; case 8: if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth, pScreenInfo->fFullScreen ? PseudoColorMask : StaticColorMask, pScreenPriv->dwBitsPerRGB, pScreenInfo->fFullScreen ? PseudoColor : StaticColor, pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " "failed\n"); return FALSE; } break; default: ErrorF("winInitVisualsShadowDDNL - Unknown screen depth\n"); return FALSE; } #if CYGDEBUG winDebug("winInitVisualsShadowDDNL - Returning\n"); #endif return TRUE; } /* * Adjust the user proposed video mode */ static Bool winAdjustVideoModeShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc = NULL; DWORD dwBPP; /* We're in serious trouble if we can't get a DC */ hdc = GetDC(NULL); if (hdc == NULL) { ErrorF("winAdjustVideoModeShadowDDNL - GetDC () failed\n"); return FALSE; } /* Query GDI for current display depth */ dwBPP = GetDeviceCaps(hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) { /* Otherwise, We'll use GDI's depth */ pScreenInfo->dwBPP = dwBPP; } /* Release our DC */ ReleaseDC(NULL, hdc); return TRUE; } /* * Blt exposed regions to the screen */ static Bool winBltExposedRegionsShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; RECT rcSrc, rcDest; POINT ptOrigin; HDC hdcUpdate; PAINTSTRUCT ps; HRESULT ddrval = DD_OK; Bool fReturn = TRUE; int i; /* Quite common case. The primary surface was lost (maybe because of depth * change). Try to create a new primary surface. Bail out if this fails */ if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface && !winCreatePrimarySurfaceShadowDDNL(pScreen)) { Sleep(100); return FALSE; } if (pScreenPriv->pddsPrimary4 == NULL) return FALSE; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps); if (hdcUpdate == NULL) { fReturn = FALSE; ErrorF("winBltExposedRegionsShadowDDNL - BeginPaint () returned " "a NULL device context handle. Aborting blit attempt.\n"); goto winBltExposedRegionsShadowDDNL_Exit; } /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints(pScreenPriv->hwndScreen, HWND_DESKTOP, (LPPOINT) &ptOrigin, 1); rcDest.left = ptOrigin.x; rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; rcDest.top = ptOrigin.y; rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; /* Source can be entire shadow surface, as Blt should clip for us */ rcSrc.left = 0; rcSrc.top = 0; rcSrc.right = pScreenInfo->dwWidth; rcSrc.bottom = pScreenInfo->dwHeight; /* Try to regain the primary surface and blit again if we've lost it */ for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) { /* Our Blt should be clipped to the invalidated region */ ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4, &rcDest, pScreenPriv->pddsShadow4, &rcSrc, DDBLT_WAIT, NULL); if (ddrval == DDERR_SURFACELOST) { /* Surface was lost */ winErrorFVerb(1, "winBltExposedRegionsShadowDDNL - " "IDirectDrawSurface4_Blt reported that the primary " "surface was lost, trying to restore, retry: %d\n", i + 1); /* Try to restore the surface, once */ ddrval = IDirectDrawSurface4_Restore(pScreenPriv->pddsPrimary4); winDebug("winBltExposedRegionsShadowDDNL - " "IDirectDrawSurface4_Restore returned: "); if (ddrval == DD_OK) winDebug("DD_OK\n"); else if (ddrval == DDERR_WRONGMODE) winDebug("DDERR_WRONGMODE\n"); else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) winDebug("DDERR_INCOMPATIBLEPRIMARY\n"); else if (ddrval == DDERR_UNSUPPORTED) winDebug("DDERR_UNSUPPORTED\n"); else if (ddrval == DDERR_INVALIDPARAMS) winDebug("DDERR_INVALIDPARAMS\n"); else if (ddrval == DDERR_INVALIDOBJECT) winDebug("DDERR_INVALIDOBJECT\n"); else winDebug("unknown error: %08x\n", (unsigned int) ddrval); /* Loop around to try the blit one more time */ continue; } else if (FAILED(ddrval)) { fReturn = FALSE; winErrorFVerb(1, "winBltExposedRegionsShadowDDNL - " "IDirectDrawSurface4_Blt failed, but surface not " "lost: %08x %d\n", (unsigned int) ddrval, (int) ddrval); goto winBltExposedRegionsShadowDDNL_Exit; } else { /* Success, stop looping */ break; } } winBltExposedRegionsShadowDDNL_Exit: /* EndPaint frees the DC */ if (hdcUpdate != NULL) EndPaint(pScreenPriv->hwndScreen, &ps); return fReturn; } /* * Do any engine-specific application-activation processing */ static Bool winActivateAppShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); /* * Do we have a surface? * Are we active? * Are we full screen? */ if (pScreenPriv != NULL && pScreenPriv->pddsPrimary4 != NULL && pScreenPriv->fActive) { /* Primary surface was lost, restore it */ IDirectDrawSurface4_Restore(pScreenPriv->pddsPrimary4); } return TRUE; } /* * Reblit the shadow framebuffer to the screen. */ static Bool winRedrawScreenShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HRESULT ddrval = DD_OK; RECT rcSrc, rcDest; POINT ptOrigin; /* Return immediately if we didn't get needed surfaces */ if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4) return FALSE; /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; MapWindowPoints(pScreenPriv->hwndScreen, HWND_DESKTOP, (LPPOINT) &ptOrigin, 1); rcDest.left = ptOrigin.x; rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; rcDest.top = ptOrigin.y; rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; /* Source can be entire shadow surface, as Blt should clip for us */ rcSrc.left = 0; rcSrc.top = 0; rcSrc.right = pScreenInfo->dwWidth; rcSrc.bottom = pScreenInfo->dwHeight; /* Redraw the whole window, to take account for the new colors */ ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4, &rcDest, pScreenPriv->pddsShadow4, &rcSrc, DDBLT_WAIT, NULL); if (FAILED(ddrval)) { ErrorF("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () " "failed: %08x\n", (unsigned int) ddrval); } return TRUE; } /* * Realize the currently installed colormap */ static Bool winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen) { return TRUE; } /* * Install the specified colormap */ static Bool winInstallColormapShadowDDNL(ColormapPtr pColormap) { ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winCmapPriv(pColormap); HRESULT ddrval = DD_OK; /* Install the DirectDraw palette on the primary surface */ ddrval = IDirectDrawSurface4_SetPalette(pScreenPriv->pddsPrimary4, pCmapPriv->lpDDPalette); if (FAILED(ddrval)) { ErrorF("winInstallColormapShadowDDNL - Failed installing the " "DirectDraw palette.\n"); return FALSE; } /* Save a pointer to the newly installed colormap */ pScreenPriv->pcmapInstalled = pColormap; return TRUE; } /* * Store the specified colors in the specified colormap */ static Bool winStoreColorsShadowDDNL(ColormapPtr pColormap, int ndef, xColorItem * pdefs) { ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winCmapPriv(pColormap); ColormapPtr curpmap = pScreenPriv->pcmapInstalled; HRESULT ddrval = DD_OK; /* Put the X colormap entries into the Windows logical palette */ ddrval = IDirectDrawPalette_SetEntries(pCmapPriv->lpDDPalette, 0, pdefs[0].pixel, ndef, pCmapPriv->peColors + pdefs[0].pixel); if (FAILED(ddrval)) { ErrorF("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (unsigned int) ddrval); return FALSE; } /* Don't install the DirectDraw palette if the colormap is not installed */ if (pColormap != curpmap) { return TRUE; } if (!winInstallColormapShadowDDNL(pColormap)) { ErrorF("winStoreColorsShadowDDNL - Failed installing colormap\n"); return FALSE; } return TRUE; } /* * Colormap initialization procedure */ static Bool winCreateColormapShadowDDNL(ColormapPtr pColormap) { HRESULT ddrval = DD_OK; ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); winCmapPriv(pColormap); /* Create a DirectDraw palette */ ddrval = IDirectDraw4_CreatePalette(pScreenPriv->pdd4, DDPCAPS_8BIT | DDPCAPS_ALLOW256, pCmapPriv->peColors, &pCmapPriv->lpDDPalette, NULL); if (FAILED(ddrval)) { ErrorF("winCreateColormapShadowDDNL - CreatePalette failed\n"); return FALSE; } return TRUE; } /* * Colormap destruction procedure */ static Bool winDestroyColormapShadowDDNL(ColormapPtr pColormap) { winScreenPriv(pColormap->pScreen); winCmapPriv(pColormap); HRESULT ddrval = DD_OK; /* * Is colormap to be destroyed the default? * * Non-default colormaps should have had winUninstallColormap * called on them before we get here. The default colormap * will not have had winUninstallColormap called on it. Thus, * we need to handle the default colormap in a special way. */ if (pColormap->flags & IsDefault) { #if CYGDEBUG winDebug ("winDestroyColormapShadowDDNL - Destroying default colormap\n"); #endif /* * FIXME: Walk the list of all screens, popping the default * palette out of each screen device context. */ /* Pop the palette out of the primary surface */ ddrval = IDirectDrawSurface4_SetPalette(pScreenPriv->pddsPrimary4, NULL); if (FAILED(ddrval)) { ErrorF("winDestroyColormapShadowDDNL - Failed freeing the " "default colormap DirectDraw palette.\n"); return FALSE; } /* Clear our private installed colormap pointer */ pScreenPriv->pcmapInstalled = NULL; } /* Release the palette */ IDirectDrawPalette_Release(pCmapPriv->lpDDPalette); /* Invalidate the colormap privates */ pCmapPriv->lpDDPalette = NULL; return TRUE; } /* * Set pointers to our engine specific functions */ Bool winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL; pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; if (pScreenInfo->fFullScreen) pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; else pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL; pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL; pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL; pScreenPriv->pwinRealizeInstalledPalette = winRealizeInstalledPaletteShadowDDNL; pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL; pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL; pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL; pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL; pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL; pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL; return TRUE; } xorg-server-1.20.8/hw/xwin/winwindow.h0000644000175000017500000001102613640201473014607 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. *Copyright (C) Colin Harrison 2005-2009 * *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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Colin Harrison */ #if !defined(_WINWINDOW_H_) #define _WINWINDOW_H_ #ifndef NO #define NO 0 #endif #ifndef YES #define YES 1 #endif /* Constant strings */ #ifndef PROJECT_NAME #define PROJECT_NAME "Cygwin/X" #endif #define EXECUTABLE_NAME "XWin" #define WINDOW_CLASS "cygwin/x" #define WINDOW_TITLE PROJECT_NAME ":%s.%d" #define WINDOW_TITLE_XDMCP "%s:%s.%d" #define WIN_SCR_PROP "cyg_screen_prop rl" #define WINDOW_CLASS_X "cygwin/x X rl" #define WINDOW_CLASS_X_MSG "cygwin/x X msg" #define WINDOW_TITLE_X PROJECT_NAME " X" #define WIN_WINDOW_PROP "cyg_window_prop_rl" #ifdef HAS_DEVWINDOWS #define WIN_MSG_QUEUE_FNAME "/dev/windows" #endif #define WIN_WID_PROP "cyg_wid_prop_rl" #define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl" #ifndef CYGMULTIWINDOW_DEBUG #define CYGMULTIWINDOW_DEBUG NO #endif #ifndef CYGWINDOWING_DEBUG #define CYGWINDOWING_DEBUG NO #endif #define XMING_SIGNATURE 0x12345678L typedef struct _winPrivScreenRec *winPrivScreenPtr; /* * Window privates */ typedef struct { DWORD dwDummy; HRGN hRgn; HWND hWnd; winPrivScreenPtr pScreenPriv; Bool fXKilled; HDWP hDwp; #ifdef XWIN_GLX_WINDOWS Bool fWglUsed; #endif } winPrivWinRec, *winPrivWinPtr; typedef struct _winWMMessageRec { DWORD dwID; DWORD msg; int iWindow; HWND hwndWindow; int iX, iY; int iWidth, iHeight; } winWMMessageRec, *winWMMessagePtr; /* * winmultiwindowwm.c */ #define WM_WM_MOVE (WM_USER + 1) #define WM_WM_SIZE (WM_USER + 2) #define WM_WM_RAISE (WM_USER + 3) #define WM_WM_LOWER (WM_USER + 4) #define WM_WM_UNMAP (WM_USER + 6) #define WM_WM_KILL (WM_USER + 7) #define WM_WM_ACTIVATE (WM_USER + 8) #define WM_WM_NAME_EVENT (WM_USER + 9) #define WM_WM_ICON_EVENT (WM_USER + 10) #define WM_WM_CHANGE_STATE (WM_USER + 11) #define WM_WM_MAP2 (WM_USER + 12) #define WM_WM_MAP3 (WM_USER + 13) #define WM_WM_HINTS_EVENT (WM_USER + 14) #define MwmHintsDecorations (1L << 1) #define MwmDecorAll (1L << 0) #define MwmDecorBorder (1L << 1) #define MwmDecorHandle (1L << 2) #define MwmDecorTitle (1L << 3) #define MwmDecorMenu (1L << 4) #define MwmDecorMinimize (1L << 5) #define MwmDecorMaximize (1L << 6) /* This structure only contains 3 elements. The Motif 2.0 structure contains 5, but we only need the first 3, so that is all we will define This structure represents xcb_get_property()'s view of the property as a sequence of ints, rather than XGetWindowProperty()'s view of the property as a sequence of arch-dependent longs. */ typedef struct MwmHints { unsigned int flags, functions, decorations; } MwmHints; #define PropMwmHintsElements 3 void winSendMessageToWM(void *pWMInfo, winWMMessagePtr msg); Bool winInitWM(void **ppWMInfo, pthread_t * ptWMProc, pthread_t * ptXMsgProc, pthread_mutex_t * ppmServerStarted, int dwScreen, HWND hwndScreen); void winDeinitMultiWindowWM(void); void winPropertyStoreInit(void); void winPropertyStoreDestroy(void); void winSetAppUserModelID(HWND hWnd, const char *AppID); void winShowWindowOnTaskbar(HWND hWnd, Bool show); #endif xorg-server-1.20.8/hw/xwin/winprefs.h0000644000175000017500000001434713640201473014430 00000000000000/* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * Copyright (C) Colin Harrison 2005-2008 * * 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. * * Authors: Earle F. Philhower, III * Colin Harrison */ #if !defined(WINPREFS_H) #define WINPREFS_H /* Need Bool */ #include /* Need TRUE */ #include "misc.h" /* Need to know how long paths can be... */ #include /* Xwindows redefines PATH_MAX to at least 1024 */ #include #include "winwindow.h" #ifndef NAME_MAX #define NAME_MAX PATH_MAX #endif #define MENU_MAX 128 /* Maximum string length of a menu name or item */ #define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */ /* Supported commands in a MENU {} statement */ typedef enum MENUCOMMANDTYPE { CMD_EXEC, /* /bin/sh -c the parameter */ CMD_MENU, /* Display a popup menu named param */ CMD_SEPARATOR, /* Menu separator */ CMD_ALWAYSONTOP, /* Toggle always-on-top mode */ CMD_RELOAD /* Reparse the .XWINRC file */ } MENUCOMMANDTYPE; #define STYLE_NONE (0L) /* Dummy the first entry */ #define STYLE_NOTITLE (1L) /* Force window style no titlebar */ #define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */ #define STYLE_NOFRAME (1L<<2) /* Force window style no frame */ #define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */ #define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */ #define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */ #define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */ /* Where to place a system menu */ typedef enum MENUPOSITION { AT_START, /* Place menu at the top of the system menu */ AT_END /* Put it at the bottom of the menu (default) */ } MENUPOSITION; /* Menu item definitions */ typedef struct MENUITEM { char text[MENU_MAX + 1]; /* To be displayed in menu */ MENUCOMMANDTYPE cmd; /* What should it do? */ char param[PARAM_MAX + 1]; /* Any parameters? */ unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */ } MENUITEM; /* A completely read in menu... */ typedef struct MENUPARSED { char menuName[MENU_MAX + 1]; /* What's it called in the text? */ MENUITEM *menuItem; /* Array of items */ int menuItems; /* How big's the array? */ } MENUPARSED; /* To map between a window and a system menu to add for it */ typedef struct SYSMENUITEM { char match[MENU_MAX + 1]; /* String to look for to apply this sysmenu */ char menuName[MENU_MAX + 1]; /* Which menu to show? Used to set *menu */ MENUPOSITION menuPos; /* Where to place it (ignored in root) */ } SYSMENUITEM; /* To redefine icons for certain window types */ typedef struct ICONITEM { char match[MENU_MAX + 1]; /* What string to search for? */ char iconFile[PATH_MAX + NAME_MAX + 2]; /* Icon location, WIN32 path */ HICON hicon; /* LoadImage() result */ } ICONITEM; /* To redefine styles for certain window types */ typedef struct STYLEITEM { char match[MENU_MAX + 1]; /* What string to search for? */ unsigned long type; /* What should it do? */ } STYLEITEM; typedef struct WINPREFS { /* Menu information */ MENUPARSED *menu; /* Array of created menus */ int menuItems; /* How big? */ /* Taskbar menu settings */ char rootMenuName[MENU_MAX + 1]; /* Menu for taskbar icon */ /* System menu addition menus */ SYSMENUITEM *sysMenu; int sysMenuItems; /* Which menu to add to unmatched windows? */ char defaultSysMenuName[MENU_MAX + 1]; MENUPOSITION defaultSysMenuPos; /* Where to place it */ /* Icon information */ char iconDirectory[PATH_MAX + 1]; /* Where do the .icos lie? (Win32 path) */ char defaultIconName[NAME_MAX + 1]; /* Replacement for x.ico */ char trayIconName[NAME_MAX + 1]; /* Replacement for tray icon */ ICONITEM *icon; int iconItems; STYLEITEM *style; int styleItems; /* Force exit flag */ Bool fForceExit; /* Silent exit flag */ Bool fSilentExit; } WINPREFS; /* The global pref settings structure loaded by the winprefyacc.y parser */ extern WINPREFS pref; /* Functions */ void LoadPreferences(void); void SetupRootMenu(HMENU root); void SetupSysMenu(HWND hwnd); void HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu); Bool HandleCustomWM_COMMAND(HWND hwnd, WORD command, winPrivScreenPtr pScreenPriv); int winIconIsOverride(HICON hicon); HICON winOverrideIcon(char *res_name, char *res_class, char *wmName); unsigned long winOverrideStyle(char *res_name, char *res_class, char *wmName); HICON winTaskbarIcon(void); HICON winOverrideDefaultIcon(int size); #endif xorg-server-1.20.8/hw/xwin/propertystore.h0000644000175000017500000000605513640201473015531 00000000000000/* * Copyright (C) 2011 Tobias Häußler * * 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. */ #ifndef PROPERTYSTORE_H #define PROPERTYSTORE_H #include #ifdef __MINGW64_VERSION_MAJOR /* If we are using headers from mingw-w64 project, it provides the PSDK headers this needs ... */ #include #include #else /* !__MINGW64_VERSION_MAJOR */ /* ... otherwise, we need to define all this stuff ourselves */ typedef struct _tagpropertykey { GUID fmtid; DWORD pid; } PROPERTYKEY; #define REFPROPERTYKEY const PROPERTYKEY * #define REFPROPVARIANT const PROPVARIANT * WINOLEAPI PropVariantClear(PROPVARIANT *pvar); #ifdef INTERFACE #undef INTERFACE #endif #define INTERFACE IPropertyStore DECLARE_INTERFACE_(IPropertyStore, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(GetCount) (THIS_ DWORD) PURE; STDMETHOD(GetAt) (THIS_ DWORD, PROPERTYKEY) PURE; STDMETHOD(GetValue) (THIS_ REFPROPERTYKEY, PROPVARIANT) PURE; STDMETHOD(SetValue) (THIS_ REFPROPERTYKEY, REFPROPVARIANT) PURE; STDMETHOD(Commit) (THIS) PURE; }; #undef INTERFACE typedef IPropertyStore *LPPROPERTYSTORE; DEFINE_GUID(IID_IPropertyStore, 0x886d8eeb, 0x8cf2, 0x4446, 0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99); #ifdef INITGUID #define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } #else #define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY name #endif DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5); #endif /* !__MINGW64_VERSION_MAJOR */ typedef HRESULT(__stdcall * SHGETPROPERTYSTOREFORWINDOWPROC) (HWND, REFIID, void **); #endif xorg-server-1.20.8/hw/xwin/winmsg.c0000644000175000017500000001037313640201473014065 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Alexander Gottwald */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" #if CYGDEBUG #include "winmessages.h" #endif #include #ifdef XWIN_XF86CONFIG void winDrvMsg(int scrnIndex, MessageType type, const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(type, 0, format, ap); va_end(ap); } void winDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(type, verb, format, ap); va_end(ap); } #endif void winErrorFVerb(int verb, const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(X_NONE, verb, format, ap); va_end(ap); } void winDebug(const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(X_NONE, 3, format, ap); va_end(ap); } void winTrace(const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(X_NONE, 10, format, ap); va_end(ap); } void winW32Error(int verb, const char *msg) { winW32ErrorEx(verb, msg, GetLastError()); } void winW32ErrorEx(int verb, const char *msg, DWORD errorcode) { LPVOID buffer; if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buffer, 0, NULL)) { winErrorFVerb(verb, "Unknown error in FormatMessage!\n"); } else { winErrorFVerb(verb, "%s %s", msg, (char *) buffer); LocalFree(buffer); } } #if CYGDEBUG void winDebugWin32Message(const char *function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static int force = 0; if (message >= WM_USER) { if (force || getenv("WIN_DEBUG_MESSAGES") || getenv("WIN_DEBUG_WM_USER")) { winDebug("%s - Message WM_USER + %d\n", function, message - WM_USER); winDebug("\thwnd 0x%p wParam 0x%x lParam 0x%x\n", hwnd, (int)wParam, (int)lParam); } } else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message]) { const char *msgname = MESSAGE_NAMES[message]; char buffer[64]; snprintf(buffer, sizeof(buffer), "WIN_DEBUG_%s", msgname); buffer[63] = 0; if (force || getenv("WIN_DEBUG_MESSAGES") || getenv(buffer)) { winDebug("%s - Message %s\n", function, MESSAGE_NAMES[message]); winDebug("\thwnd 0x%p wParam 0x%x lParam 0x%x\n", hwnd, (int)wParam, (int)lParam); } } } #else void winDebugWin32Message(const char *function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { } #endif xorg-server-1.20.8/hw/xwin/winclipboard/0000755000175000017500000000000013640201535015145 500000000000000xorg-server-1.20.8/hw/xwin/winclipboard/Makefile.am0000644000175000017500000000104013640201473017115 00000000000000noinst_LTLIBRARIES = libXWinclipboard.la libXWinclipboard_la_SOURCES = \ winclipboard.h \ textconv.c \ thread.c \ wndproc.c \ xevents.c libXWinclipboard_la_CFLAGS = -DHAVE_XWIN_CONFIG_H \ $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) libXWinclipboard_la_LDFLAGS = -static -no-undefined bin_PROGRAMS = xwinclip xwinclip_SOURCES = xwinclip.c debug.c xwinclip_CFLAGS = $(XWINMODULES_CFLAGS) xwinclip_LDADD = libXWinclipboard.la $(XWINMODULES_LIBS) -lgdi32 -lpthread include $(top_srcdir)/manpages.am appman_PRE = xwinclip.man xorg-server-1.20.8/hw/xwin/winclipboard/Makefile.in0000644000175000017500000013223313640201514017133 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = xwinclip$(EXEEXT) subdir = hw/xwin/winclipboard ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" \ "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)" PROGRAMS = $(bin_PROGRAMS) LTLIBRARIES = $(noinst_LTLIBRARIES) libXWinclipboard_la_LIBADD = am_libXWinclipboard_la_OBJECTS = libXWinclipboard_la-textconv.lo \ libXWinclipboard_la-thread.lo libXWinclipboard_la-wndproc.lo \ libXWinclipboard_la-xevents.lo libXWinclipboard_la_OBJECTS = $(am_libXWinclipboard_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libXWinclipboard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libXWinclipboard_la_CFLAGS) $(CFLAGS) \ $(libXWinclipboard_la_LDFLAGS) $(LDFLAGS) -o $@ am_xwinclip_OBJECTS = xwinclip-xwinclip.$(OBJEXT) \ xwinclip-debug.$(OBJEXT) xwinclip_OBJECTS = $(am_xwinclip_OBJECTS) am__DEPENDENCIES_1 = xwinclip_DEPENDENCIES = libXWinclipboard.la $(am__DEPENDENCIES_1) xwinclip_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(xwinclip_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/libXWinclipboard_la-textconv.Plo \ ./$(DEPDIR)/libXWinclipboard_la-thread.Plo \ ./$(DEPDIR)/libXWinclipboard_la-wndproc.Plo \ ./$(DEPDIR)/libXWinclipboard_la-xevents.Plo \ ./$(DEPDIR)/xwinclip-debug.Po ./$(DEPDIR)/xwinclip-xwinclip.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libXWinclipboard_la_SOURCES) $(xwinclip_SOURCES) DIST_SOURCES = $(libXWinclipboard_la_SOURCES) $(xwinclip_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libXWinclipboard.la libXWinclipboard_la_SOURCES = \ winclipboard.h \ textconv.c \ thread.c \ wndproc.c \ xevents.c libXWinclipboard_la_CFLAGS = -DHAVE_XWIN_CONFIG_H \ $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) libXWinclipboard_la_LDFLAGS = -static -no-undefined xwinclip_SOURCES = xwinclip.c debug.c xwinclip_CFLAGS = $(XWINMODULES_CFLAGS) xwinclip_LDADD = libXWinclipboard.la $(XWINMODULES_LIBS) -lgdi32 -lpthread appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man appman_PRE = xwinclip.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwin/winclipboard/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xwin/winclipboard/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libXWinclipboard.la: $(libXWinclipboard_la_OBJECTS) $(libXWinclipboard_la_DEPENDENCIES) $(EXTRA_libXWinclipboard_la_DEPENDENCIES) $(AM_V_CCLD)$(libXWinclipboard_la_LINK) $(libXWinclipboard_la_OBJECTS) $(libXWinclipboard_la_LIBADD) $(LIBS) xwinclip$(EXEEXT): $(xwinclip_OBJECTS) $(xwinclip_DEPENDENCIES) $(EXTRA_xwinclip_DEPENDENCIES) @rm -f xwinclip$(EXEEXT) $(AM_V_CCLD)$(xwinclip_LINK) $(xwinclip_OBJECTS) $(xwinclip_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXWinclipboard_la-textconv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXWinclipboard_la-thread.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXWinclipboard_la-wndproc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXWinclipboard_la-xevents.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xwinclip-debug.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xwinclip-xwinclip.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libXWinclipboard_la-textconv.lo: textconv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -MT libXWinclipboard_la-textconv.lo -MD -MP -MF $(DEPDIR)/libXWinclipboard_la-textconv.Tpo -c -o libXWinclipboard_la-textconv.lo `test -f 'textconv.c' || echo '$(srcdir)/'`textconv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libXWinclipboard_la-textconv.Tpo $(DEPDIR)/libXWinclipboard_la-textconv.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='textconv.c' object='libXWinclipboard_la-textconv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -c -o libXWinclipboard_la-textconv.lo `test -f 'textconv.c' || echo '$(srcdir)/'`textconv.c libXWinclipboard_la-thread.lo: thread.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -MT libXWinclipboard_la-thread.lo -MD -MP -MF $(DEPDIR)/libXWinclipboard_la-thread.Tpo -c -o libXWinclipboard_la-thread.lo `test -f 'thread.c' || echo '$(srcdir)/'`thread.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libXWinclipboard_la-thread.Tpo $(DEPDIR)/libXWinclipboard_la-thread.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='thread.c' object='libXWinclipboard_la-thread.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -c -o libXWinclipboard_la-thread.lo `test -f 'thread.c' || echo '$(srcdir)/'`thread.c libXWinclipboard_la-wndproc.lo: wndproc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -MT libXWinclipboard_la-wndproc.lo -MD -MP -MF $(DEPDIR)/libXWinclipboard_la-wndproc.Tpo -c -o libXWinclipboard_la-wndproc.lo `test -f 'wndproc.c' || echo '$(srcdir)/'`wndproc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libXWinclipboard_la-wndproc.Tpo $(DEPDIR)/libXWinclipboard_la-wndproc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wndproc.c' object='libXWinclipboard_la-wndproc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -c -o libXWinclipboard_la-wndproc.lo `test -f 'wndproc.c' || echo '$(srcdir)/'`wndproc.c libXWinclipboard_la-xevents.lo: xevents.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -MT libXWinclipboard_la-xevents.lo -MD -MP -MF $(DEPDIR)/libXWinclipboard_la-xevents.Tpo -c -o libXWinclipboard_la-xevents.lo `test -f 'xevents.c' || echo '$(srcdir)/'`xevents.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libXWinclipboard_la-xevents.Tpo $(DEPDIR)/libXWinclipboard_la-xevents.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xevents.c' object='libXWinclipboard_la-xevents.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libXWinclipboard_la_CFLAGS) $(CFLAGS) -c -o libXWinclipboard_la-xevents.lo `test -f 'xevents.c' || echo '$(srcdir)/'`xevents.c xwinclip-xwinclip.o: xwinclip.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -MT xwinclip-xwinclip.o -MD -MP -MF $(DEPDIR)/xwinclip-xwinclip.Tpo -c -o xwinclip-xwinclip.o `test -f 'xwinclip.c' || echo '$(srcdir)/'`xwinclip.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xwinclip-xwinclip.Tpo $(DEPDIR)/xwinclip-xwinclip.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwinclip.c' object='xwinclip-xwinclip.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -c -o xwinclip-xwinclip.o `test -f 'xwinclip.c' || echo '$(srcdir)/'`xwinclip.c xwinclip-xwinclip.obj: xwinclip.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -MT xwinclip-xwinclip.obj -MD -MP -MF $(DEPDIR)/xwinclip-xwinclip.Tpo -c -o xwinclip-xwinclip.obj `if test -f 'xwinclip.c'; then $(CYGPATH_W) 'xwinclip.c'; else $(CYGPATH_W) '$(srcdir)/xwinclip.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xwinclip-xwinclip.Tpo $(DEPDIR)/xwinclip-xwinclip.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwinclip.c' object='xwinclip-xwinclip.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -c -o xwinclip-xwinclip.obj `if test -f 'xwinclip.c'; then $(CYGPATH_W) 'xwinclip.c'; else $(CYGPATH_W) '$(srcdir)/xwinclip.c'; fi` xwinclip-debug.o: debug.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -MT xwinclip-debug.o -MD -MP -MF $(DEPDIR)/xwinclip-debug.Tpo -c -o xwinclip-debug.o `test -f 'debug.c' || echo '$(srcdir)/'`debug.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xwinclip-debug.Tpo $(DEPDIR)/xwinclip-debug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='debug.c' object='xwinclip-debug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -c -o xwinclip-debug.o `test -f 'debug.c' || echo '$(srcdir)/'`debug.c xwinclip-debug.obj: debug.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -MT xwinclip-debug.obj -MD -MP -MF $(DEPDIR)/xwinclip-debug.Tpo -c -o xwinclip-debug.obj `if test -f 'debug.c'; then $(CYGPATH_W) 'debug.c'; else $(CYGPATH_W) '$(srcdir)/debug.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xwinclip-debug.Tpo $(DEPDIR)/xwinclip-debug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='debug.c' object='xwinclip-debug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xwinclip_CFLAGS) $(CFLAGS) -c -o xwinclip-debug.obj `if test -f 'debug.c'; then $(CYGPATH_W) 'debug.c'; else $(CYGPATH_W) '$(srcdir)/debug.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/libXWinclipboard_la-textconv.Plo -rm -f ./$(DEPDIR)/libXWinclipboard_la-thread.Plo -rm -f ./$(DEPDIR)/libXWinclipboard_la-wndproc.Plo -rm -f ./$(DEPDIR)/libXWinclipboard_la-xevents.Plo -rm -f ./$(DEPDIR)/xwinclip-debug.Po -rm -f ./$(DEPDIR)/xwinclip-xwinclip.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libXWinclipboard_la-textconv.Plo -rm -f ./$(DEPDIR)/libXWinclipboard_la-thread.Plo -rm -f ./$(DEPDIR)/libXWinclipboard_la-wndproc.Plo -rm -f ./$(DEPDIR)/libXWinclipboard_la-xevents.Plo -rm -f ./$(DEPDIR)/xwinclip-debug.Po -rm -f ./$(DEPDIR)/xwinclip-xwinclip.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS \ uninstall-drivermanDATA uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-binPROGRAMS \ install-data install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-appmanDATA \ uninstall-binPROGRAMS uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xwin/winclipboard/thread.c0000644000175000017500000003767113640201473016517 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 HAROLD L HUNT II 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: Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #else #define HAS_WINSOCK 1 #endif /* * Including any server header might define the macro _XSERVER64 on 64 bit machines. * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. * So let's undef that macro if necessary. */ #ifdef _XSERVER64 #undef _XSERVER64 #endif #include #include #include #include #include #include // for MAX() macro #ifdef HAS_WINSOCK #include #else #include #endif #include #include #include "winclipboard.h" #include "internal.h" #define WIN_CONNECT_RETRIES 40 #define WIN_CONNECT_DELAY 4 #define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip" #define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip" #ifdef HAS_DEVWINDOWS #define WIN_MSG_QUEUE_FNAME "/dev/windows" #endif /* * Global variables */ static HWND g_hwndClipboard = NULL; static jmp_buf g_jmpEntry; static XIOErrorHandler g_winClipboardOldIOErrorHandler; static pthread_t g_winClipboardProcThread; int xfixes_event_base; int xfixes_error_base; Bool g_fHasModernClipboardApi = FALSE; ADDCLIPBOARDFORMATLISTENERPROC g_fpAddClipboardFormatListener; REMOVECLIPBOARDFORMATLISTENERPROC g_fpRemoveClipboardFormatListener; /* * Local function prototypes */ static HWND winClipboardCreateMessagingWindow(Display *pDisplay, Window iWindow, ClipboardAtoms *atoms); static int winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr); static int winClipboardIOErrorHandler(Display * pDisplay); /* * Create X11 and Win32 messaging windows, and run message processing loop * * returns TRUE if shutdown was signalled to loop, FALSE if some error occurred */ Bool winClipboardProc(Bool fUseUnicode, char *szDisplay) { ClipboardAtoms atoms; int iReturn; HWND hwnd = NULL; int iConnectionNumber = 0; #ifdef HAS_DEVWINDOWS int fdMessageQueue = 0; #else struct timeval tvTimeout; #endif fd_set fdsRead; int iMaxDescriptor; Display *pDisplay = NULL; Window iWindow = None; int iSelectError; Bool fShutdown = FALSE; static Bool fErrorHandlerSet = FALSE; ClipboardConversionData data; winDebug("winClipboardProc - Hello\n"); /* Allow multiple threads to access Xlib */ if (XInitThreads() == 0) { ErrorF("winClipboardProc - XInitThreads failed.\n"); goto winClipboardProc_Exit; } /* See if X supports the current locale */ if (XSupportsLocale() == False) { ErrorF("winClipboardProc - Warning: Locale not supported by X.\n"); } g_fpAddClipboardFormatListener = (ADDCLIPBOARDFORMATLISTENERPROC)GetProcAddress(GetModuleHandle("user32"),"AddClipboardFormatListener"); g_fpRemoveClipboardFormatListener = (REMOVECLIPBOARDFORMATLISTENERPROC)GetProcAddress(GetModuleHandle("user32"),"RemoveClipboardFormatListener"); g_fHasModernClipboardApi = g_fpAddClipboardFormatListener && g_fpRemoveClipboardFormatListener; ErrorF("OS maintains clipboard viewer chain: %s\n", g_fHasModernClipboardApi ? "yes" : "no"); g_winClipboardProcThread = pthread_self(); /* Set error handler */ if (!fErrorHandlerSet) { XSetErrorHandler(winClipboardErrorHandler); g_winClipboardOldIOErrorHandler = XSetIOErrorHandler(winClipboardIOErrorHandler); fErrorHandlerSet = TRUE; } /* Set jump point for Error exits */ if (setjmp(g_jmpEntry)) { ErrorF("winClipboardProc - setjmp returned for IO Error Handler.\n"); goto winClipboardProc_Done; } /* Make sure that the display opened */ pDisplay = XOpenDisplay(szDisplay); if (pDisplay == NULL) { ErrorF("winClipboardProc - Failed opening the display, giving up\n"); goto winClipboardProc_Done; } ErrorF("winClipboardProc - XOpenDisplay () returned and " "successfully opened the display.\n"); /* Get our connection number */ iConnectionNumber = ConnectionNumber(pDisplay); #ifdef HAS_DEVWINDOWS /* Open a file descriptor for the windows message queue */ fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY); if (fdMessageQueue == -1) { ErrorF("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); goto winClipboardProc_Done; } /* Find max of our file descriptors */ iMaxDescriptor = MAX(fdMessageQueue, iConnectionNumber) + 1; #else iMaxDescriptor = iConnectionNumber + 1; #endif if (!XFixesQueryExtension(pDisplay, &xfixes_event_base, &xfixes_error_base)) ErrorF ("winClipboardProc - XFixes extension not present\n"); /* Create atoms */ atoms.atomClipboard = XInternAtom(pDisplay, "CLIPBOARD", False); atoms.atomLocalProperty = XInternAtom (pDisplay, "CYGX_CUT_BUFFER", False); atoms.atomUTF8String = XInternAtom (pDisplay, "UTF8_STRING", False); atoms.atomCompoundText = XInternAtom (pDisplay, "COMPOUND_TEXT", False); atoms.atomTargets = XInternAtom (pDisplay, "TARGETS", False); /* Create a messaging window */ iWindow = XCreateSimpleWindow(pDisplay, DefaultRootWindow(pDisplay), 1, 1, 500, 500, 0, BlackPixel(pDisplay, 0), BlackPixel(pDisplay, 0)); if (iWindow == 0) { ErrorF("winClipboardProc - Could not create an X window.\n"); goto winClipboardProc_Done; } XStoreName(pDisplay, iWindow, "xwinclip"); /* Select event types to watch */ if (XSelectInput(pDisplay, iWindow, PropertyChangeMask) == BadWindow) ErrorF("winClipboardProc - XSelectInput generated BadWindow " "on messaging window\n"); XFixesSelectSelectionInput (pDisplay, iWindow, XA_PRIMARY, XFixesSetSelectionOwnerNotifyMask | XFixesSelectionWindowDestroyNotifyMask | XFixesSelectionClientCloseNotifyMask); XFixesSelectSelectionInput (pDisplay, iWindow, atoms.atomClipboard, XFixesSetSelectionOwnerNotifyMask | XFixesSelectionWindowDestroyNotifyMask | XFixesSelectionClientCloseNotifyMask); /* Initialize monitored selection state */ winClipboardInitMonitoredSelections(); /* Create Windows messaging window */ hwnd = winClipboardCreateMessagingWindow(pDisplay, iWindow, &atoms); /* Save copy of HWND */ g_hwndClipboard = hwnd; /* Assert ownership of selections if Win32 clipboard is owned */ if (NULL != GetClipboardOwner()) { /* PRIMARY */ iReturn = XSetSelectionOwner(pDisplay, XA_PRIMARY, iWindow, CurrentTime); if (iReturn == BadAtom || iReturn == BadWindow || XGetSelectionOwner(pDisplay, XA_PRIMARY) != iWindow) { ErrorF("winClipboardProc - Could not set PRIMARY owner\n"); goto winClipboardProc_Done; } /* CLIPBOARD */ iReturn = XSetSelectionOwner(pDisplay, atoms.atomClipboard, iWindow, CurrentTime); if (iReturn == BadAtom || iReturn == BadWindow || XGetSelectionOwner(pDisplay, atoms.atomClipboard) != iWindow) { ErrorF("winClipboardProc - Could not set CLIPBOARD owner\n"); goto winClipboardProc_Done; } } data.fUseUnicode = fUseUnicode; /* Loop for events */ while (1) { /* Process X events */ winClipboardFlushXEvents(hwnd, iWindow, pDisplay, &data, &atoms); /* Process Windows messages */ if (!winClipboardFlushWindowsMessageQueue(hwnd)) { ErrorF("winClipboardProc - winClipboardFlushWindowsMessageQueue trapped " "WM_QUIT message, exiting main loop.\n"); break; } /* We need to ensure that all pending requests are sent */ XFlush(pDisplay); /* Setup the file descriptor set */ /* * NOTE: You have to do this before every call to select * because select modifies the mask to indicate * which descriptors are ready. */ FD_ZERO(&fdsRead); FD_SET(iConnectionNumber, &fdsRead); #ifdef HAS_DEVWINDOWS FD_SET(fdMessageQueue, &fdsRead); #else tvTimeout.tv_sec = 0; tvTimeout.tv_usec = 100; #endif /* Wait for a Windows event or an X event */ iReturn = select(iMaxDescriptor, /* Highest fds number */ &fdsRead, /* Read mask */ NULL, /* No write mask */ NULL, /* No exception mask */ #ifdef HAS_DEVWINDOWS NULL /* No timeout */ #else &tvTimeout /* Set timeout */ #endif ); #ifndef HAS_WINSOCK iSelectError = errno; #else iSelectError = WSAGetLastError(); #endif if (iReturn < 0) { #ifndef HAS_WINSOCK if (iSelectError == EINTR) #else if (iSelectError == WSAEINTR) #endif continue; ErrorF("winClipboardProc - Call to select () failed: %d. " "Bailing.\n", iReturn); break; } if (FD_ISSET(iConnectionNumber, &fdsRead)) { winDebug ("winClipboardProc - X connection ready, pumping X event queue\n"); } #ifdef HAS_DEVWINDOWS /* Check for Windows event ready */ if (FD_ISSET(fdMessageQueue, &fdsRead)) #else if (1) #endif { winDebug ("winClipboardProc - /dev/windows ready, pumping Windows message queue\n"); } #ifdef HAS_DEVWINDOWS if (!(FD_ISSET(iConnectionNumber, &fdsRead)) && !(FD_ISSET(fdMessageQueue, &fdsRead))) { winDebug("winClipboardProc - Spurious wake, select() returned %d\n", iReturn); } #endif } winClipboardProc_Exit: /* broke out of while loop on a shutdown message */ fShutdown = TRUE; winClipboardProc_Done: /* Close our Windows window */ if (g_hwndClipboard) { DestroyWindow(g_hwndClipboard); } /* Close our X window */ if (pDisplay && iWindow) { iReturn = XDestroyWindow(pDisplay, iWindow); if (iReturn == BadWindow) ErrorF("winClipboardProc - XDestroyWindow returned BadWindow.\n"); else ErrorF("winClipboardProc - XDestroyWindow succeeded.\n"); } #ifdef HAS_DEVWINDOWS /* Close our Win32 message handle */ if (fdMessageQueue) close(fdMessageQueue); #endif #if 0 /* * FIXME: XCloseDisplay hangs if we call it * * XCloseDisplay() calls XSync(), so any outstanding errors are reported. * If we are built into the server, this can deadlock if the server is * in the process of exiting and waiting for this thread to exit. */ /* Discard any remaining events */ XSync(pDisplay, TRUE); /* Select event types to watch */ XSelectInput(pDisplay, DefaultRootWindow(pDisplay), None); /* Close our X display */ if (pDisplay) { XCloseDisplay(pDisplay); } #endif /* global clipboard variable reset */ g_hwndClipboard = NULL; return fShutdown; } /* * Create the Windows window that we use to receive Windows messages */ static HWND winClipboardCreateMessagingWindow(Display *pDisplay, Window iWindow, ClipboardAtoms *atoms) { WNDCLASSEX wc; ClipboardWindowCreationParams cwcp; HWND hwnd; /* Setup our window class */ wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winClipboardWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = GetModuleHandle(NULL); wc.hIcon = 0; wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS; wc.hIconSm = 0; RegisterClassEx(&wc); /* Information to be passed to WM_CREATE */ cwcp.pClipboardDisplay = pDisplay; cwcp.iClipboardWindow = iWindow; cwcp.atoms = atoms; /* Create the window */ hwnd = CreateWindowExA(0, /* Extended styles */ WIN_CLIPBOARD_WINDOW_CLASS, /* Class name */ WIN_CLIPBOARD_WINDOW_TITLE, /* Window name */ WS_OVERLAPPED, /* Not visible anyway */ CW_USEDEFAULT, /* Horizontal position */ CW_USEDEFAULT, /* Vertical position */ CW_USEDEFAULT, /* Right edge */ CW_USEDEFAULT, /* Bottom edge */ (HWND) NULL, /* No parent or owner window */ (HMENU) NULL, /* No menu */ GetModuleHandle(NULL), /* Instance handle */ &cwcp); /* Creation data */ assert(hwnd != NULL); /* I'm not sure, but we may need to call this to start message processing */ ShowWindow(hwnd, SW_HIDE); /* Similarly, we may need a call to this even though we don't paint */ UpdateWindow(hwnd); return hwnd; } /* * winClipboardErrorHandler - Our application specific error handler */ static int winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr) { char pszErrorMsg[100]; XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg)); ErrorF("winClipboardErrorHandler - ERROR: \n\t%s\n" "\tSerial: %lu, Request Code: %d, Minor Code: %d\n", pszErrorMsg, pErr->serial, pErr->request_code, pErr->minor_code); return 0; } /* * winClipboardIOErrorHandler - Our application specific IO error handler */ static int winClipboardIOErrorHandler(Display * pDisplay) { ErrorF("winClipboardIOErrorHandler!\n"); if (pthread_equal(pthread_self(), g_winClipboardProcThread)) { /* Restart at the main entry point */ longjmp(g_jmpEntry, 2); } if (g_winClipboardOldIOErrorHandler) g_winClipboardOldIOErrorHandler(pDisplay); return 0; } void winClipboardWindowDestroy(void) { if (g_hwndClipboard) { SendMessage(g_hwndClipboard, WM_WM_QUIT, 0, 0); } } void winFixClipboardChain(void) { if (g_hwndClipboard) { PostMessage(g_hwndClipboard, WM_WM_REINIT, 0, 0); } } xorg-server-1.20.8/hw/xwin/winclipboard/xwinclip.man0000644000175000017500000000507613640201473017430 00000000000000.TH xwinclip 1 @xorgversion@ .SH NAME xwinclip - An X11 and Windows clipboard integration tool .SH SYNOPSIS .B xwinclip [OPTION]... .SH DESCRIPTION \fIxwinclip\fP is a tool for copying and pasting text between the Windows and X11 clipboard systems. \fIxwinclip\fP watches for updates to either clipboard and copies data between them when either one is updated. \fIxwinclip\fP monitors the X PRIMARY and CLIBPOARD selections for changes in ownership, and makes the contents of the most recent one to change available to paste from the Windows clipboard. It also monitors the contents of the Windows clipboard for changes, taking ownership of the PRIMARY and CLIPBOARD selections, and making the contents of the Windows clipboard available in them. .B Note well: The \fIXWin(1)\fP X server has internal clipboard integration that is enabled by default. Do \fINOT\fP run \fIxwinclip\fP unless \fIXWin(1)\fP has been started with the -noclipboard option. .SH OPTIONS \fIxwinclip\fP accepts the following optional command line switches: .TP 8 .B \-display [display] Specifies the X server display to connect to. .TP 8 .B \-nounicodeclipboard Do not use unicode text on the clipboard. .TP 8 .B \-noprimary Do not monitor the PRIMARY selection. .SH "SEE ALSO" XWin(1) .SH BUGS Only text clipboard contents are supported. The INCR (Incrememntal transfer) clipboard protocol for clipboard contents larger than the maximum size of an X request is not supported. Some X clients, notably ones written in Tcl/Tk, do not re-assert ownership of the PRIMARY selection or update it's timestamp when it's contents change, which currently prevents \fIxwinclip\fP from correctly noticing that the PRIMARY selection's contents have changed. Windows clipboard rendering is synchronous in the WM_RENDER*FORMAT message (that is, we must have placed the contents onto the clipboard by the time we return from processing this message), but we must wait for the X client which owns the selection to convert the selection to our requested format. This is currently achieved using a fixed timeout of one second. The XWin(1) server should indicate somehow (by placing an atom on the root window?) that it is running with it's internal clipboard integration enabled, and xwinclip should notice this and exit with an appropriate error. Probably many other bugs. .SH "CONFORMING TO" ICCCM (Inter-Client Communication Conventions Manual) 2.0 .SH AUTHORS Contributors to xwinclip include Benjamin Riefenstahl, Roland Cassard, Brian Genisio, Colin Harrison, Harold L Hunt II, Matsuzaki Kensuke, Jon Turney, Chris Twiner and Jeremy Wilkins. xorg-server-1.20.8/hw/xwin/winclipboard/xevents.c0000644000175000017500000010057313640201473016734 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 HAROLD L HUNT II 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: Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif /* * Including any server header might define the macro _XSERVER64 on 64 bit machines. * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. * So let's undef that macro if necessary. */ #ifdef _XSERVER64 #undef _XSERVER64 #endif #include #include #include #include #include #include "winclipboard.h" #include "internal.h" /* * Constants */ #define CLIP_NUM_SELECTIONS 2 #define CLIP_OWN_NONE -1 #define CLIP_OWN_PRIMARY 0 #define CLIP_OWN_CLIPBOARD 1 /* * Global variables */ extern int xfixes_event_base; Bool fPrimarySelection = TRUE; /* * Local variables */ static Window s_iOwners[CLIP_NUM_SELECTIONS] = { None, None }; static const char *szSelectionNames[CLIP_NUM_SELECTIONS] = { "PRIMARY", "CLIPBOARD" }; static unsigned int lastOwnedSelectionIndex = CLIP_OWN_NONE; static void MonitorSelection(XFixesSelectionNotifyEvent * e, unsigned int i) { /* Look for owned -> not owned transition */ if (None == e->owner && None != s_iOwners[i]) { unsigned int other_index; winDebug("MonitorSelection - %s - Going from owned to not owned.\n", szSelectionNames[i]); /* If this selection is not owned, the other monitored selection must be the most recently owned, if it is owned at all */ if (i == CLIP_OWN_PRIMARY) other_index = CLIP_OWN_CLIPBOARD; if (i == CLIP_OWN_CLIPBOARD) other_index = CLIP_OWN_PRIMARY; if (None != s_iOwners[other_index]) lastOwnedSelectionIndex = other_index; else lastOwnedSelectionIndex = CLIP_OWN_NONE; } /* Save last owned selection */ if (None != e->owner) { lastOwnedSelectionIndex = i; } /* Save new selection owner or None */ s_iOwners[i] = e->owner; winDebug("MonitorSelection - %s - Now owned by XID %lx\n", szSelectionNames[i], e->owner); } Atom winClipboardGetLastOwnedSelectionAtom(ClipboardAtoms *atoms) { if (lastOwnedSelectionIndex == CLIP_OWN_NONE) return None; if (lastOwnedSelectionIndex == CLIP_OWN_PRIMARY) return XA_PRIMARY; if (lastOwnedSelectionIndex == CLIP_OWN_CLIPBOARD) return atoms->atomClipboard; return None; } void winClipboardInitMonitoredSelections(void) { /* Initialize static variables */ int i; for (i = 0; i < CLIP_NUM_SELECTIONS; ++i) s_iOwners[i] = None; lastOwnedSelectionIndex = CLIP_OWN_NONE; } static int winClipboardSelectionNotifyTargets(HWND hwnd, Window iWindow, Display *pDisplay, ClipboardConversionData *data, ClipboardAtoms *atoms) { Atom type; int format; unsigned long nitems; unsigned long after; Atom *prop; /* Retrieve the selection data and delete the property */ int iReturn = XGetWindowProperty(pDisplay, iWindow, atoms->atomLocalProperty, 0, INT_MAX, True, AnyPropertyType, &type, &format, &nitems, &after, (unsigned char **)&prop); if (iReturn != Success) { ErrorF("winClipboardFlushXEvents - SelectionNotify - " "XGetWindowProperty () failed, aborting: %d\n", iReturn); } else { int i; data->targetList = malloc((nitems+1)*sizeof(Atom)); for (i = 0; i < nitems; i++) { Atom atom = prop[i]; char *pszAtomName = XGetAtomName(pDisplay, atom); data->targetList[i] = atom; winDebug("winClipboardFlushXEvents - SelectionNotify - target[%d] %ld = %s\n", i, atom, pszAtomName); XFree(pszAtomName); } data->targetList[nitems] = 0; XFree(prop); } return WIN_XEVENTS_NOTIFY_TARGETS; } /* * Process any pending X events */ int winClipboardFlushXEvents(HWND hwnd, Window iWindow, Display * pDisplay, ClipboardConversionData *data, ClipboardAtoms *atoms) { Atom atomClipboard = atoms->atomClipboard; Atom atomLocalProperty = atoms->atomLocalProperty; Atom atomUTF8String = atoms->atomUTF8String; Atom atomCompoundText = atoms->atomCompoundText; Atom atomTargets = atoms->atomTargets; /* Process all pending events */ while (XPending(pDisplay)) { XTextProperty xtpText = { 0 }; XEvent event; XSelectionEvent eventSelection; unsigned long ulReturnBytesLeft; char *pszReturnData = NULL; char *pszGlobalData = NULL; int iReturn; HGLOBAL hGlobal = NULL; XICCEncodingStyle xiccesStyle; char *pszConvertData = NULL; char *pszTextList[2] = { NULL }; int iCount; char **ppszTextList = NULL; wchar_t *pwszUnicodeStr = NULL; Bool fAbort = FALSE; Bool fCloseClipboard = FALSE; Bool fSetClipboardData = TRUE; /* Get the next event - will not block because one is ready */ XNextEvent(pDisplay, &event); /* Branch on the event type */ switch (event.type) { /* * SelectionRequest */ case SelectionRequest: { char *pszAtomName = NULL; winDebug("SelectionRequest - target %ld\n", event.xselectionrequest.target); pszAtomName = XGetAtomName(pDisplay, event.xselectionrequest.target); winDebug("SelectionRequest - Target atom name %s\n", pszAtomName); XFree(pszAtomName); pszAtomName = NULL; } /* Abort if invalid target type */ if (event.xselectionrequest.target != XA_STRING && event.xselectionrequest.target != atomUTF8String && event.xselectionrequest.target != atomCompoundText && event.xselectionrequest.target != atomTargets) { /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } /* Handle targets type of request */ if (event.xselectionrequest.target == atomTargets) { Atom atomTargetArr[] = { atomTargets, atomCompoundText, atomUTF8String, XA_STRING }; /* Try to change the property */ iReturn = XChangeProperty(pDisplay, event.xselectionrequest.requestor, event.xselectionrequest.property, XA_ATOM, 32, PropModeReplace, (unsigned char *) atomTargetArr, ARRAY_SIZE(atomTargetArr)); if (iReturn == BadAlloc || iReturn == BadAtom || iReturn == BadMatch || iReturn == BadValue || iReturn == BadWindow) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "XChangeProperty failed: %d\n", iReturn); } /* Setup selection notify xevent */ eventSelection.type = SelectionNotify; eventSelection.send_event = True; eventSelection.display = pDisplay; eventSelection.requestor = event.xselectionrequest.requestor; eventSelection.selection = event.xselectionrequest.selection; eventSelection.target = event.xselectionrequest.target; eventSelection.property = event.xselectionrequest.property; eventSelection.time = event.xselectionrequest.time; /* * Notify the requesting window that * the operation has completed */ iReturn = XSendEvent(pDisplay, eventSelection.requestor, False, 0L, (XEvent *) &eventSelection); if (iReturn == BadValue || iReturn == BadWindow) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "XSendEvent () failed\n"); } break; } /* Close clipboard if we have it open already */ if (GetOpenClipboardWindow() == hwnd) { CloseClipboard(); } /* Access the clipboard */ if (!OpenClipboard(hwnd)) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "OpenClipboard () failed: %08x\n", (unsigned int)GetLastError()); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } /* Indicate that clipboard was opened */ fCloseClipboard = TRUE; /* Check that clipboard format is available */ if (data->fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) { static int count; /* Hack to stop acroread spamming the log */ static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */ if (hwnd != lasthwnd) count = 0; count++; if (count < 6) ErrorF("winClipboardFlushXEvents - CF_UNICODETEXT is not " "available from Win32 clipboard. Aborting %d.\n", count); lasthwnd = hwnd; /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } else if (!data->fUseUnicode && !IsClipboardFormatAvailable(CF_TEXT)) { ErrorF("winClipboardFlushXEvents - CF_TEXT is not " "available from Win32 clipboard. Aborting.\n"); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } /* Setup the string style */ if (event.xselectionrequest.target == XA_STRING) xiccesStyle = XStringStyle; #ifdef X_HAVE_UTF8_STRING else if (event.xselectionrequest.target == atomUTF8String) xiccesStyle = XUTF8StringStyle; #endif else if (event.xselectionrequest.target == atomCompoundText) xiccesStyle = XCompoundTextStyle; else xiccesStyle = XStringStyle; /* Get a pointer to the clipboard text, in desired format */ if (data->fUseUnicode) { /* Retrieve clipboard data */ hGlobal = GetClipboardData(CF_UNICODETEXT); } else { /* Retrieve clipboard data */ hGlobal = GetClipboardData(CF_TEXT); } if (!hGlobal) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "GetClipboardData () failed: %08x\n", (unsigned int)GetLastError()); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } pszGlobalData = (char *) GlobalLock(hGlobal); /* Convert the Unicode string to UTF8 (MBCS) */ if (data->fUseUnicode) { int iConvertDataLen = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) pszGlobalData, -1, NULL, 0, NULL, NULL); /* NOTE: iConvertDataLen includes space for null terminator */ pszConvertData = malloc(iConvertDataLen); WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) pszGlobalData, -1, pszConvertData, iConvertDataLen, NULL, NULL); } else { pszConvertData = strdup(pszGlobalData); } /* Convert DOS string to UNIX string */ winClipboardDOStoUNIX(pszConvertData, strlen(pszConvertData)); /* Setup our text list */ pszTextList[0] = pszConvertData; pszTextList[1] = NULL; /* Initialize the text property */ xtpText.value = NULL; xtpText.nitems = 0; /* Create the text property from the text list */ if (data->fUseUnicode) { #ifdef X_HAVE_UTF8_STRING iReturn = Xutf8TextListToTextProperty(pDisplay, pszTextList, 1, xiccesStyle, &xtpText); #endif } else { iReturn = XmbTextListToTextProperty(pDisplay, pszTextList, 1, xiccesStyle, &xtpText); } if (iReturn == XNoMemory || iReturn == XLocaleNotSupported) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "X*TextListToTextProperty failed: %d\n", iReturn); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } /* Free the converted string */ free(pszConvertData); pszConvertData = NULL; /* Copy the clipboard text to the requesting window */ iReturn = XChangeProperty(pDisplay, event.xselectionrequest.requestor, event.xselectionrequest.property, event.xselectionrequest.target, 8, PropModeReplace, xtpText.value, xtpText.nitems); if (iReturn == BadAlloc || iReturn == BadAtom || iReturn == BadMatch || iReturn == BadValue || iReturn == BadWindow) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "XChangeProperty failed: %d\n", iReturn); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } /* Release the clipboard data */ GlobalUnlock(hGlobal); pszGlobalData = NULL; fCloseClipboard = FALSE; CloseClipboard(); /* Clean up */ XFree(xtpText.value); xtpText.value = NULL; xtpText.nitems = 0; /* Setup selection notify event */ eventSelection.type = SelectionNotify; eventSelection.send_event = True; eventSelection.display = pDisplay; eventSelection.requestor = event.xselectionrequest.requestor; eventSelection.selection = event.xselectionrequest.selection; eventSelection.target = event.xselectionrequest.target; eventSelection.property = event.xselectionrequest.property; eventSelection.time = event.xselectionrequest.time; /* Notify the requesting window that the operation has completed */ iReturn = XSendEvent(pDisplay, eventSelection.requestor, False, 0L, (XEvent *) &eventSelection); if (iReturn == BadValue || iReturn == BadWindow) { ErrorF("winClipboardFlushXEvents - SelectionRequest - " "XSendEvent () failed\n"); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionRequest_Done; } winClipboardFlushXEvents_SelectionRequest_Done: /* Free allocated resources */ if (xtpText.value) { XFree(xtpText.value); xtpText.value = NULL; xtpText.nitems = 0; } free(pszConvertData); if (hGlobal && pszGlobalData) GlobalUnlock(hGlobal); /* * Send a SelectionNotify event to the requesting * client when we abort. */ if (fAbort) { /* Setup selection notify event */ eventSelection.type = SelectionNotify; eventSelection.send_event = True; eventSelection.display = pDisplay; eventSelection.requestor = event.xselectionrequest.requestor; eventSelection.selection = event.xselectionrequest.selection; eventSelection.target = event.xselectionrequest.target; eventSelection.property = None; eventSelection.time = event.xselectionrequest.time; /* Notify the requesting window that the operation is complete */ iReturn = XSendEvent(pDisplay, eventSelection.requestor, False, 0L, (XEvent *) &eventSelection); if (iReturn == BadValue || iReturn == BadWindow) { /* * Should not be a problem if XSendEvent fails because * the client may simply have exited. */ ErrorF("winClipboardFlushXEvents - SelectionRequest - " "XSendEvent () failed for abort event.\n"); } } /* Close clipboard if it was opened */ if (fCloseClipboard) { fCloseClipboard = FALSE; CloseClipboard(); } break; /* * SelectionNotify */ case SelectionNotify: winDebug("winClipboardFlushXEvents - SelectionNotify\n"); { char *pszAtomName; pszAtomName = XGetAtomName(pDisplay, event.xselection.selection); winDebug ("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n", pszAtomName); XFree(pszAtomName); } /* SelectionNotify with property of None indicates either: (i) Generated by the X server if no owner for the specified selection exists (perhaps it's disappeared on us mid-transaction), or (ii) Sent by the selection owner when the requested selection conversion could not be performed or server errors prevented the conversion data being returned */ if (event.xselection.property == None) { ErrorF("winClipboardFlushXEvents - SelectionNotify - " "Conversion to format %ld refused.\n", event.xselection.target); return WIN_XEVENTS_FAILED; } if (event.xselection.target == atomTargets) { return winClipboardSelectionNotifyTargets(hwnd, iWindow, pDisplay, data, atoms); } /* Retrieve the selection data and delete the property */ iReturn = XGetWindowProperty(pDisplay, iWindow, atomLocalProperty, 0, INT_MAX, True, AnyPropertyType, &xtpText.encoding, &xtpText.format, &xtpText.nitems, &ulReturnBytesLeft, &xtpText.value); if (iReturn != Success) { ErrorF("winClipboardFlushXEvents - SelectionNotify - " "XGetWindowProperty () failed, aborting: %d\n", iReturn); goto winClipboardFlushXEvents_SelectionNotify_Done; } { char *pszAtomName = NULL; winDebug("SelectionNotify - returned data %lu left %lu\n", xtpText.nitems, ulReturnBytesLeft); pszAtomName = XGetAtomName(pDisplay, xtpText.encoding); winDebug("Notify atom name %s\n", pszAtomName); XFree(pszAtomName); pszAtomName = NULL; } if (data->fUseUnicode) { #ifdef X_HAVE_UTF8_STRING /* Convert the text property to a text list */ iReturn = Xutf8TextPropertyToTextList(pDisplay, &xtpText, &ppszTextList, &iCount); #endif } else { iReturn = XmbTextPropertyToTextList(pDisplay, &xtpText, &ppszTextList, &iCount); } if (iReturn == Success || iReturn > 0) { /* Conversion succeeded or some unconvertible characters */ if (ppszTextList != NULL) { int i; int iReturnDataLen = 0; for (i = 0; i < iCount; i++) { iReturnDataLen += strlen(ppszTextList[i]); } pszReturnData = malloc(iReturnDataLen + 1); pszReturnData[0] = '\0'; for (i = 0; i < iCount; i++) { strcat(pszReturnData, ppszTextList[i]); } } else { ErrorF("winClipboardFlushXEvents - SelectionNotify - " "X*TextPropertyToTextList list_return is NULL.\n"); pszReturnData = malloc(1); pszReturnData[0] = '\0'; } } else { ErrorF("winClipboardFlushXEvents - SelectionNotify - " "X*TextPropertyToTextList returned: "); switch (iReturn) { case XNoMemory: ErrorF("XNoMemory\n"); break; case XLocaleNotSupported: ErrorF("XLocaleNotSupported\n"); break; case XConverterNotFound: ErrorF("XConverterNotFound\n"); break; default: ErrorF("%d\n", iReturn); break; } pszReturnData = malloc(1); pszReturnData[0] = '\0'; } /* Free the data returned from XGetWindowProperty */ if (ppszTextList) XFreeStringList(ppszTextList); ppszTextList = NULL; XFree(xtpText.value); xtpText.value = NULL; xtpText.nitems = 0; /* Convert the X clipboard string to DOS format */ winClipboardUNIXtoDOS(&pszReturnData, strlen(pszReturnData)); if (data->fUseUnicode) { /* Find out how much space needed to convert MBCS to Unicode */ int iUnicodeLen = MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, NULL, 0); /* NOTE: iUnicodeLen includes space for null terminator */ pwszUnicodeStr = malloc(sizeof(wchar_t) * iUnicodeLen); if (!pwszUnicodeStr) { ErrorF("winClipboardFlushXEvents - SelectionNotify " "malloc failed for pwszUnicodeStr, aborting.\n"); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionNotify_Done; } /* Do the actual conversion */ MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, pwszUnicodeStr, iUnicodeLen); /* Allocate global memory for the X clipboard data */ hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * iUnicodeLen); } else { int iConvertDataLen = 0; pszConvertData = strdup(pszReturnData); iConvertDataLen = strlen(pszConvertData) + 1; /* Allocate global memory for the X clipboard data */ hGlobal = GlobalAlloc(GMEM_MOVEABLE, iConvertDataLen); } free(pszReturnData); /* Check that global memory was allocated */ if (!hGlobal) { ErrorF("winClipboardFlushXEvents - SelectionNotify " "GlobalAlloc failed, aborting: %08x\n", (unsigned int)GetLastError()); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionNotify_Done; } /* Obtain a pointer to the global memory */ pszGlobalData = GlobalLock(hGlobal); if (pszGlobalData == NULL) { ErrorF("winClipboardFlushXEvents - Could not lock global " "memory for clipboard transfer\n"); /* Abort */ fAbort = TRUE; goto winClipboardFlushXEvents_SelectionNotify_Done; } /* Copy the returned string into the global memory */ if (data->fUseUnicode) { wcscpy((wchar_t *)pszGlobalData, pwszUnicodeStr); free(pwszUnicodeStr); pwszUnicodeStr = NULL; } else { strcpy(pszGlobalData, pszConvertData); free(pszConvertData); pszConvertData = NULL; } /* Release the pointer to the global memory */ GlobalUnlock(hGlobal); pszGlobalData = NULL; /* Push the selection data to the Windows clipboard */ if (data->fUseUnicode) SetClipboardData(CF_UNICODETEXT, hGlobal); else SetClipboardData(CF_TEXT, hGlobal); /* Flag that SetClipboardData has been called */ fSetClipboardData = FALSE; /* * NOTE: Do not try to free pszGlobalData, it is owned by * Windows after the call to SetClipboardData (). */ winClipboardFlushXEvents_SelectionNotify_Done: /* Free allocated resources */ if (ppszTextList) XFreeStringList(ppszTextList); if (xtpText.value) { XFree(xtpText.value); xtpText.value = NULL; xtpText.nitems = 0; } free(pszConvertData); free(pwszUnicodeStr); if (hGlobal && pszGlobalData) GlobalUnlock(hGlobal); if (fSetClipboardData) { SetClipboardData(CF_UNICODETEXT, NULL); SetClipboardData(CF_TEXT, NULL); } return WIN_XEVENTS_NOTIFY_DATA; case SelectionClear: winDebug("SelectionClear - doing nothing\n"); break; case PropertyNotify: break; case MappingNotify: break; default: if (event.type == XFixesSetSelectionOwnerNotify + xfixes_event_base) { XFixesSelectionNotifyEvent *e = (XFixesSelectionNotifyEvent *) & event; winDebug("winClipboardFlushXEvents - XFixesSetSelectionOwnerNotify\n"); /* Save selection owners for monitored selections, ignore other selections */ if ((e->selection == XA_PRIMARY) && fPrimarySelection) { MonitorSelection(e, CLIP_OWN_PRIMARY); } else if (e->selection == atomClipboard) { MonitorSelection(e, CLIP_OWN_CLIPBOARD); } else break; /* Selection is being disowned */ if (e->owner == None) { winDebug ("winClipboardFlushXEvents - No window, returning.\n"); break; } /* XXX: there are all kinds of wacky edge cases we might need here: - we own windows clipboard, but neither PRIMARY nor CLIPBOARD have an owner, so we should disown it? - root window is taking ownership? */ /* If we are the owner of the most recently owned selection, don't go all recursive :) */ if ((lastOwnedSelectionIndex != CLIP_OWN_NONE) && (s_iOwners[lastOwnedSelectionIndex] == iWindow)) { winDebug("winClipboardFlushXEvents - Ownership changed to us, aborting.\n"); break; } /* Close clipboard if we have it open already (possible? correct??) */ if (GetOpenClipboardWindow() == hwnd) { CloseClipboard(); } /* Access the Windows clipboard */ if (!OpenClipboard(hwnd)) { ErrorF("winClipboardFlushXEvents - OpenClipboard () failed: %08x\n", (int) GetLastError()); break; } /* Take ownership of the Windows clipboard */ if (!EmptyClipboard()) { ErrorF("winClipboardFlushXEvents - EmptyClipboard () failed: %08x\n", (int) GetLastError()); break; } /* Advertise regular text and unicode */ SetClipboardData(CF_UNICODETEXT, NULL); SetClipboardData(CF_TEXT, NULL); /* Release the clipboard */ if (!CloseClipboard()) { ErrorF("winClipboardFlushXEvents - CloseClipboard () failed: %08x\n", (int) GetLastError()); break; } } /* XFixesSelectionWindowDestroyNotifyMask */ /* XFixesSelectionClientCloseNotifyMask */ else { ErrorF("winClipboardFlushXEvents - unexpected event type %d\n", event.type); } break; } } return WIN_XEVENTS_SUCCESS; } xorg-server-1.20.8/hw/xwin/winclipboard/debug.c0000644000175000017500000000310613640201473016320 00000000000000// // Copyright © Jon TURNEY 2013 // // This file is part of xwinclip. // // 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. // #include #include #if 1 int winDebug(const char *format, ...) { int count; va_list ap; va_start(ap, format); count = fprintf(stderr, "xwinclip: "); count += vfprintf(stderr, format, ap); va_end(ap); return count; } #endif int ErrorF(const char *format, ...) { int count; va_list ap; va_start(ap, format); count = vfprintf(stderr, format, ap); va_end(ap); return count; } xorg-server-1.20.8/hw/xwin/winclipboard/wndproc.c0000644000175000017500000005407213640201473016716 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 HAROLD L HUNT II 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: Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif /* * Including any server header might define the macro _XSERVER64 on 64 bit machines. * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. * So let's undef that macro if necessary. */ #ifdef _XSERVER64 #undef _XSERVER64 #endif #include #include #include #include #include "internal.h" #include "winclipboard.h" /* * Constants */ #define WIN_POLL_TIMEOUT 1 #ifndef WM_CLIPBOARDUPDATE #define WM_CLIPBOARDUPDATE 0x031D #endif /* * Process X events up to specified timeout */ static int winProcessXEventsTimeout(HWND hwnd, Window iWindow, Display * pDisplay, ClipboardConversionData *data, ClipboardAtoms *atoms, int iTimeoutSec) { int iConnNumber; struct timeval tv; int iReturn; DWORD dwStopTime = GetTickCount() + iTimeoutSec * 1000; winDebug("winProcessXEventsTimeout () - pumping X events for %d seconds\n", iTimeoutSec); /* Get our connection number */ iConnNumber = ConnectionNumber(pDisplay); /* Loop for X events */ while (1) { fd_set fdsRead; long remainingTime; /* Process X events */ iReturn = winClipboardFlushXEvents(hwnd, iWindow, pDisplay, data, atoms); winDebug("winProcessXEventsTimeout () - winClipboardFlushXEvents returned %d\n", iReturn); if ((WIN_XEVENTS_NOTIFY_DATA == iReturn) || (WIN_XEVENTS_NOTIFY_TARGETS == iReturn) || (WIN_XEVENTS_FAILED == iReturn)) { /* Bail out */ return iReturn; } /* We need to ensure that all pending requests are sent */ XFlush(pDisplay); /* Setup the file descriptor set */ FD_ZERO(&fdsRead); FD_SET(iConnNumber, &fdsRead); /* Adjust timeout */ remainingTime = dwStopTime - GetTickCount(); tv.tv_sec = remainingTime / 1000; tv.tv_usec = (remainingTime % 1000) * 1000; winDebug("winProcessXEventsTimeout () - %ld milliseconds left\n", remainingTime); /* Break out if no time left */ if (remainingTime <= 0) return WIN_XEVENTS_SUCCESS; /* Wait for an X event */ iReturn = select(iConnNumber + 1, /* Highest fds number */ &fdsRead, /* Read mask */ NULL, /* No write mask */ NULL, /* No exception mask */ &tv); /* Timeout */ if (iReturn < 0) { ErrorF("winProcessXEventsTimeout - Call to select () failed: %d. " "Bailing.\n", iReturn); break; } if (!FD_ISSET(iConnNumber, &fdsRead)) { winDebug("winProcessXEventsTimeout - Spurious wake, select() returned %d\n", iReturn); } } return WIN_XEVENTS_SUCCESS; } /* * Process a given Windows message */ LRESULT CALLBACK winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HWND s_hwndNextViewer; static Bool s_fCBCInitialized; static Display *pDisplay; static Window iWindow; static ClipboardAtoms *atoms; static Bool fRunning; /* Branch on message type */ switch (message) { case WM_DESTROY: { winDebug("winClipboardWindowProc - WM_DESTROY\n"); if (g_fHasModernClipboardApi) { /* Remove clipboard listener */ g_fpRemoveClipboardFormatListener(hwnd); } else { /* Remove ourselves from the clipboard chain */ ChangeClipboardChain(hwnd, s_hwndNextViewer); } s_hwndNextViewer = NULL; } return 0; case WM_WM_QUIT: { winDebug("winClipboardWindowProc - WM_WM_QUIT\n"); fRunning = FALSE; PostQuitMessage(0); } return 0; case WM_CREATE: { ClipboardWindowCreationParams *cwcp = (ClipboardWindowCreationParams *)((CREATESTRUCT *)lParam)->lpCreateParams; winDebug("winClipboardWindowProc - WM_CREATE\n"); pDisplay = cwcp->pClipboardDisplay; iWindow = cwcp->iClipboardWindow; atoms = cwcp->atoms; fRunning = TRUE; if (g_fHasModernClipboardApi) { g_fpAddClipboardFormatListener(hwnd); } else { HWND first, next; DWORD error_code = 0; first = GetClipboardViewer(); /* Get handle to first viewer in chain. */ if (first == hwnd) return 0; /* Make sure it's not us! */ /* Add ourselves to the clipboard viewer chain */ next = SetClipboardViewer(hwnd); error_code = GetLastError(); if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */ s_hwndNextViewer = next; /* it returned must have been the first window in the chain */ else s_fCBCInitialized = FALSE; } } return 0; case WM_CHANGECBCHAIN: { winDebug("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%p) " "lParam(%p) s_hwndNextViewer(%p)\n", (HWND)wParam, (HWND)lParam, s_hwndNextViewer); if ((HWND) wParam == s_hwndNextViewer) { s_hwndNextViewer = (HWND) lParam; if (s_hwndNextViewer == hwnd) { s_hwndNextViewer = NULL; ErrorF("winClipboardWindowProc - WM_CHANGECBCHAIN: " "attempted to set next window to ourselves."); } } else if (s_hwndNextViewer) SendMessage(s_hwndNextViewer, message, wParam, lParam); } winDebug("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n"); return 0; case WM_WM_REINIT: { /* Ensure that we're in the clipboard chain. Some apps, * WinXP's remote desktop for one, don't play nice with the * chain. This message is called whenever we receive a * WM_ACTIVATEAPP message to ensure that we continue to * receive clipboard messages. * * It might be possible to detect if we're still in the chain * by calling SendMessage (GetClipboardViewer(), * WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the * WM_DRAWCLIPBOARD message. That, however, might be more * expensive than just putting ourselves back into the chain. */ HWND first, next; DWORD error_code = 0; winDebug("winClipboardWindowProc - WM_WM_REINIT: Enter\n"); if (g_fHasModernClipboardApi) { return 0; } first = GetClipboardViewer(); /* Get handle to first viewer in chain. */ if (first == hwnd) return 0; /* Make sure it's not us! */ winDebug(" WM_WM_REINIT: Replacing us(%p) with %p at head " "of chain\n", hwnd, s_hwndNextViewer); s_fCBCInitialized = FALSE; ChangeClipboardChain(hwnd, s_hwndNextViewer); s_hwndNextViewer = NULL; s_fCBCInitialized = FALSE; winDebug(" WM_WM_REINIT: Putting us back at head of chain.\n"); first = GetClipboardViewer(); /* Get handle to first viewer in chain. */ if (first == hwnd) return 0; /* Make sure it's not us! */ next = SetClipboardViewer(hwnd); error_code = GetLastError(); if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */ s_hwndNextViewer = next; /* it returned must have been the first window in the chain */ else s_fCBCInitialized = FALSE; } winDebug("winClipboardWindowProc - WM_WM_REINIT: Exit\n"); return 0; case WM_DRAWCLIPBOARD: case WM_CLIPBOARDUPDATE: { static Bool s_fProcessingDrawClipboard = FALSE; int iReturn; if (message == WM_DRAWCLIPBOARD) winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n"); else winDebug("winClipboardWindowProc - WM_CLIPBOARDUPDATE: Enter\n"); if (!g_fHasModernClipboardApi) { /* * We've occasionally seen a loop in the clipboard chain. * Try and fix it on the first hint of recursion. */ if (!s_fProcessingDrawClipboard) { s_fProcessingDrawClipboard = TRUE; } else { /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */ s_fCBCInitialized = FALSE; ChangeClipboardChain(hwnd, s_hwndNextViewer); winFixClipboardChain(); ErrorF("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Nested calls detected. Re-initing.\n"); winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); s_fProcessingDrawClipboard = FALSE; return 0; } /* Bail on first message */ if (!s_fCBCInitialized) { s_fCBCInitialized = TRUE; s_fProcessingDrawClipboard = FALSE; winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); return 0; } } /* * NOTE: We cannot bail out when NULL == GetClipboardOwner () * because some applications deal with the clipboard in a manner * that causes the clipboard owner to be NULL when they are in * fact taking ownership. One example of this is the Win32 * native compile of emacs. */ /* Bail when we still own the clipboard */ if (hwnd == GetClipboardOwner()) { winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "We own the clipboard, returning.\n"); winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); s_fProcessingDrawClipboard = FALSE; if (s_hwndNextViewer) SendMessage(s_hwndNextViewer, message, wParam, lParam); return 0; } /* Bail when shutting down */ if (!fRunning) return 0; /* * Do not take ownership of the X11 selections when something * other than CF_TEXT or CF_UNICODETEXT has been copied * into the Win32 clipboard. */ if (!IsClipboardFormatAvailable(CF_TEXT) && !IsClipboardFormatAvailable(CF_UNICODETEXT)) { winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Clipboard does not contain CF_TEXT nor " "CF_UNICODETEXT.\n"); /* * We need to make sure that the X Server has processed * previous XSetSelectionOwner messages. */ XSync(pDisplay, FALSE); winDebug("winClipboardWindowProc - XSync done.\n"); /* Release PRIMARY selection if owned */ iReturn = XGetSelectionOwner(pDisplay, XA_PRIMARY); if (iReturn == iWindow) { winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "PRIMARY selection is owned by us.\n"); XSetSelectionOwner(pDisplay, XA_PRIMARY, None, CurrentTime); } else if (BadWindow == iReturn || BadAtom == iReturn) ErrorF("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "XGetSelectionOwner failed for PRIMARY: %d\n", iReturn); /* Release CLIPBOARD selection if owned */ iReturn = XGetSelectionOwner(pDisplay, atoms->atomClipboard); if (iReturn == iWindow) { winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "CLIPBOARD selection is owned by us, releasing\n"); XSetSelectionOwner(pDisplay, atoms->atomClipboard, None, CurrentTime); } else if (BadWindow == iReturn || BadAtom == iReturn) ErrorF("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "XGetSelectionOwner failed for CLIPBOARD: %d\n", iReturn); winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); s_fProcessingDrawClipboard = FALSE; if (s_hwndNextViewer) SendMessage(s_hwndNextViewer, message, wParam, lParam); return 0; } /* Reassert ownership of PRIMARY */ iReturn = XSetSelectionOwner(pDisplay, XA_PRIMARY, iWindow, CurrentTime); if (iReturn == BadAtom || iReturn == BadWindow || XGetSelectionOwner(pDisplay, XA_PRIMARY) != iWindow) { ErrorF("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Could not reassert ownership of PRIMARY\n"); } else { winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Reasserted ownership of PRIMARY\n"); } /* Reassert ownership of the CLIPBOARD */ iReturn = XSetSelectionOwner(pDisplay, atoms->atomClipboard, iWindow, CurrentTime); if (iReturn == BadAtom || iReturn == BadWindow || XGetSelectionOwner(pDisplay, atoms->atomClipboard) != iWindow) { ErrorF("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Could not reassert ownership of CLIPBOARD\n"); } else { winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - " "Reasserted ownership of CLIPBOARD\n"); } /* Flush the pending SetSelectionOwner event now */ XFlush(pDisplay); s_fProcessingDrawClipboard = FALSE; } winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); /* Pass the message on the next window in the clipboard viewer chain */ if (s_hwndNextViewer) SendMessage(s_hwndNextViewer, message, wParam, lParam); return 0; case WM_DESTROYCLIPBOARD: /* * NOTE: Intentionally do nothing. * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD * above. We only process this message to conform to the specs * for delayed clipboard rendering in Win32. You might think * that we need to release ownership of the X11 selections, but * we do not, because a WM_DRAWCLIPBOARD message will closely * follow this message and reassert ownership of the X11 * selections, handling the issue for us. */ winDebug("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n"); return 0; case WM_RENDERALLFORMATS: winDebug("winClipboardWindowProc - WM_RENDERALLFORMATS - Hello.\n"); /* WM_RENDERALLFORMATS is sent as we are shutting down, to render the clipboard so it's contents remains available to other applications. Unfortunately, this can't work without major changes. The server is already waiting for us to stop, so we can't ask for the rendering of clipboard text now. */ return 0; case WM_RENDERFORMAT: { int iReturn; Bool fConvertToUnicode; Bool pasted = FALSE; Atom selection; ClipboardConversionData data; int best_target = 0; winDebug("winClipboardWindowProc - WM_RENDERFORMAT %d - Hello.\n", (int)wParam); /* Flag whether to convert to Unicode or not */ fConvertToUnicode = (CF_UNICODETEXT == wParam); selection = winClipboardGetLastOwnedSelectionAtom(atoms); if (selection == None) { ErrorF("winClipboardWindowProc - no monitored selection is owned\n"); goto fake_paste; } winDebug("winClipboardWindowProc - requesting targets for selection from owner\n"); /* Request the selection's supported conversion targets */ XConvertSelection(pDisplay, selection, atoms->atomTargets, atoms->atomLocalProperty, iWindow, CurrentTime); /* Process X events */ data.fUseUnicode = fConvertToUnicode; iReturn = winProcessXEventsTimeout(hwnd, iWindow, pDisplay, &data, atoms, WIN_POLL_TIMEOUT); if (WIN_XEVENTS_NOTIFY_TARGETS != iReturn) { ErrorF ("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY_TARGETS\n"); goto fake_paste; } /* Choose the most preferred target */ { struct target_priority { Atom target; unsigned int priority; }; struct target_priority target_priority_table[] = { { atoms->atomCompoundText, 0 }, #ifdef X_HAVE_UTF8_STRING { atoms->atomUTF8String, 1 }, #endif { XA_STRING, 2 }, }; int best_priority = INT_MAX; int i,j; for (i = 0 ; data.targetList[i] != 0; i++) { for (j = 0; j < ARRAY_SIZE(target_priority_table); j ++) { if ((data.targetList[i] == target_priority_table[j].target) && (target_priority_table[j].priority < best_priority)) { best_target = target_priority_table[j].target; best_priority = target_priority_table[j].priority; } } } } free(data.targetList); data.targetList = 0; winDebug("winClipboardWindowProc - best target is %d\n", best_target); /* No useful targets found */ if (best_target == 0) goto fake_paste; winDebug("winClipboardWindowProc - requesting selection from owner\n"); /* Request the selection contents */ XConvertSelection(pDisplay, selection, best_target, atoms->atomLocalProperty, iWindow, CurrentTime); /* Process X events */ iReturn = winProcessXEventsTimeout(hwnd, iWindow, pDisplay, &data, atoms, WIN_POLL_TIMEOUT); /* * winProcessXEventsTimeout had better have seen a notify event, * or else we are dealing with a buggy or old X11 app. */ if (WIN_XEVENTS_NOTIFY_DATA != iReturn) { ErrorF ("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY_DATA\n"); } else { pasted = TRUE; } /* * If we couldn't get the data from the X clipboard, we * have to paste some fake data to the Win32 clipboard to * satisfy the requirement that we write something to it. */ fake_paste: if (!pasted) { /* Paste no data, to satisfy required call to SetClipboardData */ SetClipboardData(CF_UNICODETEXT, NULL); SetClipboardData(CF_TEXT, NULL); } winDebug("winClipboardWindowProc - WM_RENDERFORMAT - Returning.\n"); return 0; } } /* Let Windows perform default processing for unhandled messages */ return DefWindowProc(hwnd, message, wParam, lParam); } /* * Process any pending Windows messages */ Bool winClipboardFlushWindowsMessageQueue(HWND hwnd) { MSG msg; /* Flush the messaging window queue */ /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage, * as this will filter out many non-window-specific messages that * are sent to our thread, such as WM_QUIT. */ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { /* Dispatch the message if not WM_QUIT */ if (msg.message == WM_QUIT) return FALSE; else DispatchMessage(&msg); } return TRUE; } xorg-server-1.20.8/hw/xwin/winclipboard/textconv.c0000644000175000017500000001045213640201473017106 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif /* * Including any server header might define the macro _XSERVER64 on 64 bit machines. * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. * So let's undef that macro if necessary. */ #ifdef _XSERVER64 #undef _XSERVER64 #endif #include #include "internal.h" /* * Convert \r\n to \n * * NOTE: This was heavily inspired by, Cygwin's * winsup/cygwin/fhandler.cc/fhandler_base::read () */ void winClipboardDOStoUNIX(char *pszSrc, int iLength) { char *pszDest = pszSrc; char *pszEnd = pszSrc + iLength; /* Loop until the last character */ while (pszSrc < pszEnd) { /* Copy the current source character to current destination character */ *pszDest = *pszSrc; /* Advance to the next source character */ pszSrc++; /* Don't advance the destination character if we need to drop an \r */ if (*pszDest != '\r' || *pszSrc != '\n') pszDest++; } /* Move the terminating null */ *pszDest = '\0'; } /* * Convert \n to \r\n */ void winClipboardUNIXtoDOS(char **ppszData, int iLength) { int iNewlineCount = 0; char *pszSrc = *ppszData; char *pszEnd = pszSrc + iLength; char *pszDest = NULL, *pszDestBegin = NULL; winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData); /* Count \n characters without leading \r */ while (pszSrc < pszEnd) { /* Skip ahead two character if found set of \r\n */ if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') { pszSrc += 2; continue; } /* Increment the count if found naked \n */ if (*pszSrc == '\n') { iNewlineCount++; } pszSrc++; } /* Return if no naked \n's */ if (iNewlineCount == 0) return; /* Allocate a new string */ pszDestBegin = pszDest = malloc(iLength + iNewlineCount + 1); /* Set source pointer to beginning of data string */ pszSrc = *ppszData; /* Loop through all characters in source string */ while (pszSrc < pszEnd) { /* Copy line endings that are already valid */ if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') { *pszDest = *pszSrc; *(pszDest + 1) = *(pszSrc + 1); pszDest += 2; pszSrc += 2; continue; } /* Add \r to naked \n's */ if (*pszSrc == '\n') { *pszDest = '\r'; *(pszDest + 1) = *pszSrc; pszDest += 2; pszSrc += 1; continue; } /* Copy normal characters */ *pszDest = *pszSrc; pszSrc++; pszDest++; } /* Put terminating null at end of new string */ *pszDest = '\0'; /* Swap string pointers */ free(*ppszData); *ppszData = pszDestBegin; winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin); } xorg-server-1.20.8/hw/xwin/winclipboard/xwinclip.c0000644000175000017500000000716013640201473017073 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice shall be *included in all copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * *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: Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif /* * Including any server header might define the macro _XSERVER64 on 64 bit machines. * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. * So let's undef that macro if necessary. */ #ifdef _XSERVER64 #undef _XSERVER64 #endif #include #include #include /* X headers */ #include #ifdef X_LOCALE #include #else /* X_LOCALE */ #include #endif /* X_LOCALE */ #include "winclipboard.h" /* * Main function */ int main (int argc, char *argv[]) { int i; char *pszDisplay = NULL; int fUnicodeClipboard = 1; /* Parse command-line parameters */ for (i = 1; i < argc; ++i) { /* Look for -display "display_name" or --display "display_name" */ if (i < argc - 1 && (!strcmp (argv[i], "-display") || !strcmp (argv[i], "--display"))) { /* Grab a pointer to the display parameter */ pszDisplay = argv[i + 1]; /* Skip the display argument */ i++; continue; } /* Look for -nounicodeclipboard */ if (!strcmp (argv[i], "-nounicodeclipboard")) { fUnicodeClipboard = 0; continue; } /* Look for -noprimary */ if (!strcmp (argv[i], "-noprimary")) { fPrimarySelection = False; continue; } /* Yack when we find a parameter that we don't know about */ printf ("Unknown parameter: %s\nExiting.\n", argv[i]); exit (1); } /* Do we have Unicode support? */ if (fUnicodeClipboard) { printf ("Unicode clipboard I/O\n"); } else { printf ("Non Unicode clipboard I/O\n"); } /* Apply locale specified in the LANG environment variable */ if (!setlocale (LC_ALL, "")) { printf ("setlocale() error\n"); exit (1); } /* See if X supports the current locale */ if (XSupportsLocale () == False) { printf ("Locale not supported by X, falling back to 'C' locale.\n"); setlocale(LC_ALL, "C"); } winClipboardProc(fUnicodeClipboard, pszDisplay); return 0; } xorg-server-1.20.8/hw/xwin/winclipboard/meson.build0000644000175000017500000000134013640201473017226 00000000000000srcs_windows_clipboard = [ 'winclipboard.h', 'textconv.c', 'thread.c', 'wndproc.c', 'xevents.c', ] xwin_clipboard = static_library( 'XWinclipboard', srcs_windows_clipboard, include_directories: inc, c_args: '-DHAVE_XWIN_CONFIG_H', dependencies: [ dependency('x11'), dependency('xfixes'), ], ) srcs_xwinclip = [ 'xwinclip.c', 'debug.c', ] executable( 'xwinclip', srcs_xwinclip, link_with: xwin_clipboard, link_args: ['-lgdi32', '-lpthread'], dependencies: [dependency('x11')], install: true, ) xwinclip_man = configure_file( input: 'xwinclip.man', output: 'xwinclip.1', configuration: manpage_config, ) install_man(xwinclip_man) xorg-server-1.20.8/hw/xwin/winclipboard/winclipboard.h0000644000175000017500000000264713640201473017725 00000000000000// // Copyright © Jon TURNEY 2013 // // 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. // // File: winclipboard.h // Purpose: public interface to winclipboard library // #ifndef WINCLIPBOARD_H #define WINCLIPBOARD_H Bool winClipboardProc(Bool fUseUnicode, char *szDisplay); void winFixClipboardChain(void); void winClipboardWindowDestroy(void); extern Bool fPrimarySelection; #endif xorg-server-1.20.8/hw/xwin/winerror.c0000644000175000017500000001041313640201473014423 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include <../xfree86/common/xorgVersion.h> #include "win.h" #ifdef DDXOSVERRORF void OsVendorVErrorF(const char *pszFormat, va_list va_args) { /* make sure the clipboard and multiwindow threads do not interfere the * main thread */ static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER; /* Lock the printing mutex */ pthread_mutex_lock(&s_pmPrinting); /* Print the error message to a log file, could be stderr */ LogVWrite(0, pszFormat, va_args); /* Unlock the printing mutex */ pthread_mutex_unlock(&s_pmPrinting); } #endif /* * os/log.c:FatalError () calls our vendor ErrorF, so the message * from a FatalError will be logged. * * Attempt to do last-ditch, safe, important cleanup here. */ void OsVendorFatalError(const char *f, va_list args) { char errormsg[1024] = ""; /* Don't give duplicate warning if UseMsg was called */ if (g_fSilentFatalError) return; if (!g_fLogInited) { g_fLogInited = TRUE; g_pszLogFile = LogInit(g_pszLogFile, ".old"); } LogClose(EXIT_ERR_ABORT); /* Format the error message */ vsnprintf(errormsg, sizeof(errormsg), f, args); /* Sometimes the error message needs a bit of cosmetic cleaning up for use in a dialog box... */ { char *s; while ((s = strstr(errormsg, "\n\t")) != NULL) { s[0] = ' '; s[1] = '\n'; } } winMessageBoxF("A fatal error has occurred and " PROJECT_NAME " will now exit.\n\n" "%s\n\n" "Please open %s for more information.\n", MB_ICONERROR, errormsg, (g_pszLogFile ? g_pszLogFile : "the logfile")); } /* * winMessageBoxF - Print a formatted error message in a useful * message box. */ void winMessageBoxF(const char *pszError, UINT uType, ...) { char *pszErrorF = NULL; char *pszMsgBox = NULL; va_list args; int size; va_start(args, uType); size = vasprintf(&pszErrorF, pszError, args); va_end(args); if (size == -1) { pszErrorF = NULL; goto winMessageBoxF_Cleanup; } #define MESSAGEBOXF \ "%s\n" \ "Vendor: %s\n" \ "Release: %d.%d.%d.%d\n" \ "Contact: %s\n" \ "%s\n\n" \ "XWin was started with the following command-line:\n\n" \ "%s\n" size = asprintf(&pszMsgBox, MESSAGEBOXF, pszErrorF, XVENDORNAME, XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, BUILDERADDR, BUILDERSTRING, g_pszCommandLine); if (size == -1) { pszMsgBox = NULL; goto winMessageBoxF_Cleanup; } /* Display the message box string */ MessageBox(NULL, pszMsgBox, PROJECT_NAME, MB_OK | uType); winMessageBoxF_Cleanup: free(pszErrorF); free(pszMsgBox); #undef MESSAGEBOXF } xorg-server-1.20.8/hw/xwin/winmultiwindowwindow.c0000644000175000017500000006702213640201473017114 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "dixevents.h" #include "winmultiwindowclass.h" #include "winmultiwindowicons.h" /* * Prototypes for local functions */ void winCreateWindowsWindow(WindowPtr pWin); static void winDestroyWindowsWindow(WindowPtr pWin); static void winUpdateWindowsWindow(WindowPtr pWin); static void winFindWindow(void *value, XID id, void *cdata); static void winInitMultiWindowClass(void) { static wATOM atomXWinClass = 0; WNDCLASSEX wcx; if (atomXWinClass == 0) { HICON hIcon, hIconSmall; /* Load the default icons */ winSelectIcons(&hIcon, &hIconSmall); /* Setup our window class */ wcx.cbSize = sizeof(WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0); wcx.lpfnWndProc = winTopLevelWindowProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = g_hInstance; wcx.hIcon = hIcon; wcx.hCursor = 0; wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wcx.lpszMenuName = NULL; wcx.lpszClassName = WINDOW_CLASS_X; wcx.hIconSm = hIconSmall; #if CYGMULTIWINDOW_DEBUG ErrorF("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X); #endif atomXWinClass = RegisterClassEx(&wcx); } } /* * CreateWindow - See Porting Layer Definition - p. 37 */ Bool winCreateWindowMultiWindow(WindowPtr pWin) { Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG winTrace("winCreateWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(CreateWindow); fResult = (*pScreen->CreateWindow) (pWin); WIN_WRAP(CreateWindow, winCreateWindowMultiWindow); /* Initialize some privates values */ pWinPriv->hRgn = NULL; pWinPriv->hWnd = NULL; pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen); pWinPriv->fXKilled = FALSE; #ifdef XWIN_GLX_WINDOWS pWinPriv->fWglUsed = FALSE; #endif return fResult; } /* * DestroyWindow - See Porting Layer Definition - p. 37 */ Bool winDestroyWindowMultiWindow(WindowPtr pWin) { Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG ErrorF("winDestroyWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(DestroyWindow); fResult = (*pScreen->DestroyWindow) (pWin); WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow); /* Flag that the window has been destroyed */ pWinPriv->fXKilled = TRUE; /* Kill the MS Windows window associated with this window */ winDestroyWindowsWindow(pWin); return fResult; } /* * PositionWindow - See Porting Layer Definition - p. 37 * * This function adjusts the position and size of Windows window * with respect to the underlying X window. This is the inverse * of winAdjustXWindow, which adjusts X window to Windows window. */ Bool winPositionWindowMultiWindow(WindowPtr pWin, int x, int y) { Bool fResult = TRUE; int iX, iY, iWidth, iHeight; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); HWND hWnd = pWinPriv->hWnd; RECT rcNew; RECT rcOld; #if CYGMULTIWINDOW_DEBUG RECT rcClient; RECT *lpRc; #endif DWORD dwExStyle; DWORD dwStyle; #if CYGMULTIWINDOW_DEBUG winTrace("winPositionWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(PositionWindow); fResult = (*pScreen->PositionWindow) (pWin, x, y); WIN_WRAP(PositionWindow, winPositionWindowMultiWindow); #if CYGWINDOWING_DEBUG ErrorF("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", x, y); #endif /* Bail out if the Windows window handle is bad */ if (!hWnd) { #if CYGWINDOWING_DEBUG ErrorF("\timmediately return since hWnd is NULL\n"); #endif return fResult; } /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE); dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE); /* Get the X and Y location of the X window */ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN); iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN); /* Get the height and width of the X window */ iWidth = pWin->drawable.width; iHeight = pWin->drawable.height; /* Store the origin, height, and width in a rectangle structure */ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight); #if CYGMULTIWINDOW_DEBUG lpRc = &rcNew; ErrorF("winPositionWindowMultiWindow - drawable (%d, %d)-(%d, %d)\n", (int)lpRc->left, (int)lpRc->top, (int)lpRc->right, (int)lpRc->bottom); #endif /* * Calculate the required size of the Windows window rectangle, * given the size of the Windows window client area. */ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle); /* Get a rectangle describing the old Windows window */ GetWindowRect(hWnd, &rcOld); #if CYGMULTIWINDOW_DEBUG /* Get a rectangle describing the Windows window client area */ GetClientRect(hWnd, &rcClient); lpRc = &rcNew; ErrorF("winPositionWindowMultiWindow - rcNew (%d, %d)-(%d, %d)\n", (int)lpRc->left, (int)lpRc->top, (int)lpRc->right, (int)lpRc->bottom); lpRc = &rcOld; ErrorF("winPositionWindowMultiWindow - rcOld (%d, %d)-(%d, %d)\n", (int)lpRc->left, (int)lpRc->top, (int)lpRc->right, (int)lpRc->bottom); lpRc = &rcClient; ErrorF("rcClient (%d, %d)-(%d, %d)\n", (int)lpRc->left, (int)lpRc->top, (int)lpRc->right, (int)lpRc->bottom); #endif /* Check if the old rectangle and new rectangle are the same */ if (!EqualRect(&rcNew, &rcOld)) { #if CYGMULTIWINDOW_DEBUG ErrorF("winPositionWindowMultiWindow - Need to move\n"); #endif #if CYGWINDOWING_DEBUG ErrorF("\tMoveWindow to (%d, %d) - %dx%d\n", (int)rcNew.left, (int)rcNew.top, (int)(rcNew.right - rcNew.left), (int)(rcNew.bottom - rcNew.top)); #endif /* Change the position and dimensions of the Windows window */ MoveWindow(hWnd, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, TRUE); } else { #if CYGMULTIWINDOW_DEBUG ErrorF("winPositionWindowMultiWindow - Not need to move\n"); #endif } return fResult; } /* * ChangeWindowAttributes - See Porting Layer Definition - p. 37 */ Bool winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask) { Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG ErrorF("winChangeWindowAttributesMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(ChangeWindowAttributes); fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask); WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow); /* * NOTE: We do not currently need to do anything here. */ return fResult; } /* * UnmapWindow - See Porting Layer Definition - p. 37 * Also referred to as UnrealizeWindow */ Bool winUnmapWindowMultiWindow(WindowPtr pWin) { Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG ErrorF("winUnmapWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(UnrealizeWindow); fResult = (*pScreen->UnrealizeWindow) (pWin); WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow); /* Flag that the window has been killed */ pWinPriv->fXKilled = TRUE; /* Destroy the Windows window associated with this X window */ winDestroyWindowsWindow(pWin); return fResult; } /* * MapWindow - See Porting Layer Definition - p. 37 * Also referred to as RealizeWindow */ Bool winMapWindowMultiWindow(WindowPtr pWin) { Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG ErrorF("winMapWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(RealizeWindow); fResult = (*pScreen->RealizeWindow) (pWin); WIN_WRAP(RealizeWindow, winMapWindowMultiWindow); /* Flag that this window has not been destroyed */ pWinPriv->fXKilled = FALSE; /* Refresh/redisplay the Windows window associated with this X window */ winUpdateWindowsWindow(pWin); /* Update the Windows window's shape */ winReshapeMultiWindow(pWin); winUpdateRgnMultiWindow(pWin); return fResult; } /* * ReparentWindow - See Porting Layer Definition - p. 42 */ void winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent) { ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); winDebug ("winReparentMultiWindow - pWin:%p XID:0x%x, reparent from pWin:%p XID:0x%x to pWin:%p XID:0x%x\n", pWin, (unsigned int)pWin->drawable.id, pPriorParent, (unsigned int)pPriorParent->drawable.id, pWin->parent, (unsigned int)pWin->parent->drawable.id); WIN_UNWRAP(ReparentWindow); if (pScreen->ReparentWindow) (*pScreen->ReparentWindow) (pWin, pPriorParent); WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow); /* Update the Windows window associated with this X window */ winUpdateWindowsWindow(pWin); } /* * RestackWindow - Shuffle the z-order of a window */ void winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib) { #if 0 WindowPtr pPrevWin; UINT uFlags; HWND hInsertAfter; HWND hWnd = NULL; #endif ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG winTrace("winRestackMultiWindow - %p\n", pWin); #endif WIN_UNWRAP(RestackWindow); if (pScreen->RestackWindow) (*pScreen->RestackWindow) (pWin, pOldNextSib); WIN_WRAP(RestackWindow, winRestackWindowMultiWindow); #if 1 /* * Calling winReorderWindowsMultiWindow here means our window manager * (i.e. Windows Explorer) has initiative to determine Z order. */ if (pWin->nextSib != pOldNextSib) winReorderWindowsMultiWindow(); #else /* Bail out if no window privates or window handle is invalid */ if (!pWinPriv || !pWinPriv->hWnd) return; /* Get a pointer to our previous sibling window */ pPrevWin = pWin->prevSib; /* * Look for a sibling window with * valid privates and window handle */ while (pPrevWin && !winGetWindowPriv(pPrevWin) && !winGetWindowPriv(pPrevWin)->hWnd) pPrevWin = pPrevWin->prevSib; /* Check if we found a valid sibling */ if (pPrevWin) { /* Valid sibling - get handle to insert window after */ hInsertAfter = winGetWindowPriv(pPrevWin)->hWnd; uFlags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; hWnd = GetNextWindow(pWinPriv->hWnd, GW_HWNDPREV); do { if (GetProp(hWnd, WIN_WINDOW_PROP)) { if (hWnd == winGetWindowPriv(pPrevWin)->hWnd) { uFlags |= SWP_NOZORDER; } break; } hWnd = GetNextWindow(hWnd, GW_HWNDPREV); } while (hWnd); } else { /* No valid sibling - make this window the top window */ hInsertAfter = HWND_TOP; uFlags = SWP_NOMOVE | SWP_NOSIZE; } /* Perform the restacking operation in Windows */ SetWindowPos(pWinPriv->hWnd, hInsertAfter, 0, 0, 0, 0, uFlags); #endif } /* * winCreateWindowsWindow - Create a Windows window associated with an X window */ void winCreateWindowsWindow(WindowPtr pWin) { int iX, iY; int iWidth; int iHeight; HWND hWnd; HWND hFore = NULL; winWindowPriv(pWin); WinXSizeHints hints; Window daddyId; DWORD dwStyle, dwExStyle; RECT rc; winInitMultiWindowClass(); winDebug("winCreateWindowsTopLevelWindow - pWin:%p XID:0x%x \n", pWin, (unsigned int)pWin->drawable.id); iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN); iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN); iWidth = pWin->drawable.width; iHeight = pWin->drawable.height; /* If it's an InputOutput window, and so is going to end up being made visible, make sure the window actually ends up somewhere where it will be visible To handle arrangements of monitors which form a non-rectangular virtual desktop, check if the window will end up with it's top-left corner on any monitor */ if (pWin->drawable.class != InputOnly) { POINT pt = { iX, iY }; if (MonitorFromPoint(pt, MONITOR_DEFAULTTONULL) == NULL) { iX = CW_USEDEFAULT; iY = CW_USEDEFAULT; } } winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); if (winMultiWindowGetTransientFor(pWin, &daddyId)) { if (daddyId) { WindowPtr pParent; int res = dixLookupWindow(&pParent, daddyId, serverClient, DixReadAccess); if (res == Success) { winPrivWinPtr pParentPriv = winGetWindowPriv(pParent); hFore = pParentPriv->hWnd; } } } else { /* Default positions if none specified */ if (!winMultiWindowGetWMNormalHints(pWin, &hints)) hints.flags = 0; if (!(hints.flags & (USPosition | PPosition)) && !pWin->overrideRedirect) { iX = CW_USEDEFAULT; iY = CW_USEDEFAULT; } } /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */ /* CW_USEDEFAULT, change back to popup after creation */ dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; dwExStyle = WS_EX_TOOLWINDOW; /* Calculate the window coordinates containing the requested client area, being careful to preseve CW_USEDEFAULT */ rc.top = (iY != CW_USEDEFAULT) ? iY : 0; rc.left = (iX != CW_USEDEFAULT) ? iX : 0; rc.bottom = rc.top + iHeight; rc.right = rc.left + iWidth; AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle); if (iY != CW_USEDEFAULT) iY = rc.top; if (iX != CW_USEDEFAULT) iX = rc.left; iHeight = rc.bottom - rc.top; iWidth = rc.right - rc.left; winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); /* Create the window */ hWnd = CreateWindowExA(dwExStyle, /* Extended styles */ WINDOW_CLASS_X, /* Class name */ WINDOW_TITLE_X, /* Window name */ dwStyle, /* Styles */ iX, /* Horizontal position */ iY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ hFore, /* Null or Parent window if transient */ (HMENU) NULL, /* No menu */ GetModuleHandle(NULL), /* Instance handle */ pWin); /* ScreenPrivates */ if (hWnd == NULL) { ErrorF("winCreateWindowsWindow - CreateWindowExA () failed: %d\n", (int) GetLastError()); } pWinPriv->hWnd = hWnd; /* Change style back to popup, already placed... */ SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); /* Adjust the X window to match the window placement we actually got... */ winAdjustXWindow(pWin, hWnd); /* Make sure it gets the proper system menu for a WS_POPUP, too */ GetSystemMenu(hWnd, TRUE); /* Cause any .XWinrc menus to be added in main WNDPROC */ PostMessage(hWnd, WM_INIT_SYS_MENU, 0, 0); SetProp(hWnd, WIN_WID_PROP, (HANDLE) (INT_PTR) winGetWindowID(pWin)); /* Flag that this Windows window handles its own activation */ SetProp(hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0); } Bool winInDestroyWindowsWindow = FALSE; /* * winDestroyWindowsWindow - Destroy a Windows window associated * with an X window */ static void winDestroyWindowsWindow(WindowPtr pWin) { MSG msg; winWindowPriv(pWin); BOOL oldstate = winInDestroyWindowsWindow; HICON hIcon; HICON hIconSm; winDebug("winDestroyWindowsWindow - pWin:%p XID:0x%x \n", pWin, (unsigned int)pWin->drawable.id); /* Bail out if the Windows window handle is invalid */ if (pWinPriv->hWnd == NULL) return; winInDestroyWindowsWindow = TRUE; /* Store the info we need to destroy after this window is gone */ hIcon = (HICON) SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0); hIconSm = (HICON) SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0); /* Destroy the Windows window */ DestroyWindow(pWinPriv->hWnd); /* Null our handle to the Window so referencing it will cause an error */ pWinPriv->hWnd = NULL; /* Destroy any icons we created for this window */ winDestroyIcon(hIcon); winDestroyIcon(hIconSm); #ifdef XWIN_GLX_WINDOWS /* No longer note WGL used on this window */ pWinPriv->fWglUsed = FALSE; #endif /* Process all messages on our queue */ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (g_hDlgDepthChange == 0 || !IsDialogMessage(g_hDlgDepthChange, &msg)) { DispatchMessage(&msg); } } winInDestroyWindowsWindow = oldstate; winDebug("winDestroyWindowsWindow - done\n"); } /* * winUpdateWindowsWindow - Redisplay/redraw a Windows window * associated with an X window */ static void winUpdateWindowsWindow(WindowPtr pWin) { winWindowPriv(pWin); HWND hWnd = pWinPriv->hWnd; #if CYGMULTIWINDOW_DEBUG ErrorF("winUpdateWindowsWindow\n"); #endif /* Check if the Windows window's parents have been destroyed */ if (pWin->parent != NULL && pWin->parent->parent == NULL && pWin->mapped) { /* Create the Windows window if it has been destroyed */ if (hWnd == NULL) { winCreateWindowsWindow(pWin); assert(pWinPriv->hWnd != NULL); } /* Display the window without activating it */ if (pWin->drawable.class != InputOnly) ShowWindow(pWinPriv->hWnd, SW_SHOWNOACTIVATE); /* Send first paint message */ UpdateWindow(pWinPriv->hWnd); } else if (hWnd != NULL) { /* Destroy the Windows window if its parents are destroyed */ winDestroyWindowsWindow(pWin); assert(pWinPriv->hWnd == NULL); } #if CYGMULTIWINDOW_DEBUG ErrorF("-winUpdateWindowsWindow\n"); #endif } /* * winGetWindowID - */ XID winGetWindowID(WindowPtr pWin) { WindowIDPairRec wi = { pWin, 0 }; ClientPtr c = wClient(pWin); /* */ FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi); #if CYGMULTIWINDOW_DEBUG ErrorF("winGetWindowID - Window ID: %u\n", (unsigned int)wi.id); #endif return wi.id; } /* * winFindWindow - */ static void winFindWindow(void *value, XID id, void *cdata) { WindowIDPairPtr wi = (WindowIDPairPtr) cdata; if (value == wi->value) { wi->id = id; } } /* * winReorderWindowsMultiWindow - */ void winReorderWindowsMultiWindow(void) { HWND hwnd = NULL; WindowPtr pWin = NULL; WindowPtr pWinSib = NULL; XID vlist[2]; static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */ DWORD dwCurrentProcessID = GetCurrentProcessId(); DWORD dwWindowProcessID = 0; #if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG winTrace("winReorderWindowsMultiWindow\n"); #endif if (fRestacking) { /* It is a recusive call so immediately exit */ #if CYGWINDOWING_DEBUG ErrorF("winReorderWindowsMultiWindow - " "exit because fRestacking == TRUE\n"); #endif return; } fRestacking = TRUE; /* Loop through top level Window windows, descending in Z order */ for (hwnd = GetTopWindow(NULL); hwnd; hwnd = GetNextWindow(hwnd, GW_HWNDNEXT)) { /* Don't take care of other Cygwin/X process's windows */ GetWindowThreadProcessId(hwnd, &dwWindowProcessID); if (GetProp(hwnd, WIN_WINDOW_PROP) && (dwWindowProcessID == dwCurrentProcessID) && !IsIconic(hwnd)) { /* ignore minimized windows */ pWinSib = pWin; pWin = GetProp(hwnd, WIN_WINDOW_PROP); if (!pWinSib) { /* 1st window - raise to the top */ vlist[0] = Above; ConfigureWindow(pWin, CWStackMode, vlist, wClient(pWin)); } else { /* 2nd or deeper windows - just below the previous one */ vlist[0] = winGetWindowID(pWinSib); vlist[1] = Below; ConfigureWindow(pWin, CWSibling | CWStackMode, vlist, wClient(pWin)); } } } fRestacking = FALSE; } /* * CopyWindow - See Porting Layer Definition - p. 39 */ void winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion) { ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGWINDOWING_DEBUG ErrorF("CopyWindowMultiWindow\n"); #endif WIN_UNWRAP(CopyWindow); (*pScreen->CopyWindow) (pWin, oldpt, oldRegion); WIN_WRAP(CopyWindow, winCopyWindowMultiWindow); } /* * MoveWindow - See Porting Layer Definition - p. 42 */ void winMoveWindowMultiWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) { ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGWINDOWING_DEBUG ErrorF("MoveWindowMultiWindow to (%d, %d)\n", x, y); #endif WIN_UNWRAP(MoveWindow); (*pScreen->MoveWindow) (pWin, x, y, pSib, kind); WIN_WRAP(MoveWindow, winMoveWindowMultiWindow); } /* * ResizeWindow - See Porting Layer Definition - p. 42 */ void winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib) { ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGWINDOWING_DEBUG ErrorF("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h); #endif WIN_UNWRAP(ResizeWindow); (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib); WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow); } /* * winAdjustXWindow * * Move and resize X window with respect to corresponding Windows window. * This is called from WM_MOVE/WM_SIZE handlers when the user performs * any windowing operation (move, resize, minimize, maximize, restore). * * The functionality is the inverse of winPositionWindowMultiWindow, which * adjusts Windows window with respect to X window. */ int winAdjustXWindow(WindowPtr pWin, HWND hwnd) { RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */ RECT rcWin; /* The source: WindowRect from hwnd */ DrawablePtr pDraw; XID vlist[4]; LONG dX, dY, dW, dH, x, y; DWORD dwStyle, dwExStyle; #define WIDTH(rc) (rc.right - rc.left) #define HEIGHT(rc) (rc.bottom - rc.top) #if CYGWINDOWING_DEBUG ErrorF("winAdjustXWindow\n"); #endif if (IsIconic(hwnd)) { #if CYGWINDOWING_DEBUG ErrorF("\timmediately return because the window is iconized\n"); #endif /* * If the Windows window is minimized, its WindowRect has * meaningless values so we don't adjust X window to it. */ vlist[0] = 0; vlist[1] = 0; return ConfigureWindow(pWin, CWX | CWY, vlist, wClient(pWin)); } pDraw = &pWin->drawable; /* Calculate the window rect from the drawable */ x = pDraw->x + GetSystemMetrics(SM_XVIRTUALSCREEN); y = pDraw->y + GetSystemMetrics(SM_YVIRTUALSCREEN); SetRect(&rcDraw, x, y, x + pDraw->width, y + pDraw->height); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n", (int)rcDraw.left, (int)rcDraw.top, (int)rcDraw.right, (int)rcDraw.bottom, (int)(rcDraw.right - rcDraw.left), (int)(rcDraw.bottom - rcDraw.top)); #endif dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE); dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tWindowStyle: %08x %08x\n", (unsigned int)dwStyle, (unsigned int)dwExStyle); #endif AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle); /* The source of adjust */ GetWindowRect(hwnd, &rcWin); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n", (int)rcWin.left, (int)rcWin.top, (int)rcWin.right, (int)rcWin.bottom, (int)(rcWin.right - rcWin.left), (int)(rcWin.bottom - rcWin.top)); winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n", (int)rcDraw.left, (int)rcDraw.top, (int)rcDraw.right, (int)rcDraw.bottom, (int)(rcDraw.right - rcDraw.left), (int)(rcDraw.bottom - rcDraw.top)); #endif if (EqualRect(&rcDraw, &rcWin)) { /* Bail if no adjust is needed */ #if CYGWINDOWING_DEBUG ErrorF("\treturn because already adjusted\n"); #endif return 0; } /* Calculate delta values */ dX = rcWin.left - rcDraw.left; dY = rcWin.top - rcDraw.top; dW = WIDTH(rcWin) - WIDTH(rcDraw); dH = HEIGHT(rcWin) - HEIGHT(rcDraw); /* * Adjust. * We may only need to move (vlist[0] and [1]), or only resize * ([2] and [3]) but currently we set all the parameters and leave * the decision to ConfigureWindow. The reason is code simplicity. */ vlist[0] = pDraw->x + dX - wBorderWidth(pWin); vlist[1] = pDraw->y + dY - wBorderWidth(pWin); vlist[2] = pDraw->width + dW; vlist[3] = pDraw->height + dH; #if CYGWINDOWING_DEBUG ErrorF("\tConfigureWindow to (%u, %u) - %ux%u\n", (unsigned int)vlist[0], (unsigned int)vlist[1], (unsigned int)vlist[2], (unsigned int)vlist[3]); #endif return ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin)); #undef WIDTH #undef HEIGHT } xorg-server-1.20.8/hw/xwin/winscrinit.c0000644000175000017500000004472313640201473014760 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II * Kensuke Matsuzaki */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" #ifdef XWIN_MULTIWINDOWEXTWM static RootlessFrameProcsRec winMWExtWMProcs = { winMWExtWMCreateFrame, winMWExtWMDestroyFrame, winMWExtWMMoveFrame, winMWExtWMResizeFrame, winMWExtWMRestackFrame, winMWExtWMReshapeFrame, winMWExtWMUnmapFrame, winMWExtWMStartDrawing, winMWExtWMStopDrawing, winMWExtWMUpdateRegion, winMWExtWMDamageRects, winMWExtWMRootlessSwitchWindow, NULL, //winMWExtWMDoReorderWindow, NULL, //winMWExtWMHideWindow, NULL, //winMWExtWMUpdateColorMap, NULL, //winMWExtWMCopyBytes, winMWExtWMCopyWindow }; #endif /* * Prototypes */ /* * Local functions */ static Bool winSaveScreen(ScreenPtr pScreen, int on); /* * Determine what type of screen we are initializing * and call the appropriate procedure to intiailize * that type of screen. */ Bool winScreenInit(ScreenPtr pScreen, int argc, char **argv) { winScreenInfoPtr pScreenInfo = &g_ScreenInfo[pScreen->myNum]; winPrivScreenPtr pScreenPriv; HDC hdc; DWORD dwInitialBPP; #if CYGDEBUG || YES winDebug("winScreenInit - dwWidth: %u dwHeight: %u\n", (unsigned int)pScreenInfo->dwWidth, (unsigned int)pScreenInfo->dwHeight); #endif /* Allocate privates for this screen */ if (!winAllocatePrivates(pScreen)) { ErrorF("winScreenInit - Couldn't allocate screen privates\n"); return FALSE; } /* Get a pointer to the privates structure that was allocated */ pScreenPriv = winGetScreenPriv(pScreen); /* Save a pointer to this screen in the screen info structure */ pScreenInfo->pScreen = pScreen; /* Save a pointer to the screen info in the screen privates structure */ /* This allows us to get back to the screen info from a screen pointer */ pScreenPriv->pScreenInfo = pScreenInfo; /* * Determine which engine to use. * * NOTE: This is done once per screen because each screen possibly has * a preferred engine specified on the command line. */ if (!winSetEngine(pScreen)) { ErrorF("winScreenInit - winSetEngine () failed\n"); return FALSE; } /* Horribly misnamed function: Allow engine to adjust BPP for screen */ dwInitialBPP = pScreenInfo->dwBPP; if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) { ErrorF("winScreenInit - winAdjustVideoMode () failed\n"); return FALSE; } if (dwInitialBPP == WIN_DEFAULT_BPP) { /* No -depth parameter was passed, let the user know the depth being used */ ErrorF ("winScreenInit - Using Windows display depth of %d bits per pixel\n", (int) pScreenInfo->dwBPP); } else if (dwInitialBPP != pScreenInfo->dwBPP) { /* Warn user if engine forced a depth different to -depth parameter */ ErrorF ("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n", (int) dwInitialBPP, (int) pScreenInfo->dwBPP); } else { ErrorF("winScreenInit - Using command line depth of %d bpp\n", (int) pScreenInfo->dwBPP); } /* Check for supported display depth */ if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) { ErrorF("winScreenInit - Unsupported display depth: %d\n" "Change your Windows display depth to 15, 16, 24, or 32 bits " "per pixel.\n", (int) pScreenInfo->dwBPP); ErrorF("winScreenInit - Supported depths: %08x\n", WIN_SUPPORTED_BPPS); #if WIN_CHECK_DEPTH return FALSE; #endif } /* * Check that all monitors have the same display depth if we are using * multiple monitors */ if (pScreenInfo->fMultipleMonitors && !GetSystemMetrics(SM_SAMEDISPLAYFORMAT)) { ErrorF("winScreenInit - Monitors do not all have same pixel format / " "display depth.\n"); if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) { ErrorF ("winScreenInit - Performance may suffer off primary display.\n"); } else { ErrorF("winScreenInit - Using primary display only.\n"); pScreenInfo->fMultipleMonitors = FALSE; } } /* Create display window */ if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) { ErrorF("winScreenInit - pwinCreateBoundingWindow () " "failed\n"); return FALSE; } /* Get a device context */ hdc = GetDC(pScreenPriv->hwndScreen); /* Are we using multiple monitors? */ if (pScreenInfo->fMultipleMonitors) { /* * In this case, some of the defaults set in * winInitializeScreenDefaults() are not correct ... */ if (!pScreenInfo->fUserGaveHeightAndWidth) { pScreenInfo->dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); pScreenInfo->dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); } } /* Release the device context */ ReleaseDC(pScreenPriv->hwndScreen, hdc); /* Clear the visuals list */ miClearVisualTypes(); /* Call the engine dependent screen initialization procedure */ if (!((*pScreenPriv->pwinFinishScreenInit) (pScreen->myNum, pScreen, argc, argv))) { ErrorF("winScreenInit - winFinishScreenInit () failed\n"); /* call the engine dependent screen close procedure to clean up from a failure */ pScreenPriv->pwinCloseScreen(pScreen); return FALSE; } if (!g_fSoftwareCursor) winInitCursor(pScreen); else winErrorFVerb(2, "winScreenInit - Using software cursor\n"); if (!noPanoramiXExtension) { /* Note the screen origin in a normalized coordinate space where (0,0) is at the top left of the native virtual desktop area */ pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n", pScreen->myNum, pScreen->x, pScreen->y); } #if CYGDEBUG || YES winDebug("winScreenInit - returning\n"); #endif return TRUE; } static Bool winCreateScreenResources(ScreenPtr pScreen) { winScreenPriv(pScreen); Bool result; result = pScreenPriv->pwinCreateScreenResources(pScreen); /* Now the screen bitmap has been wrapped in a pixmap, add that to the Shadow framebuffer */ if (!shadowAdd(pScreen, pScreen->devPrivate, pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) { ErrorF("winCreateScreenResources - shadowAdd () failed\n"); return FALSE; } return result; } /* See Porting Layer Definition - p. 20 */ Bool winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; VisualPtr pVisual = NULL; int iReturn; /* Create framebuffer */ if (!(*pScreenPriv->pwinInitScreen) (pScreen)) { ErrorF("winFinishScreenInitFB - Could not allocate framebuffer\n"); return FALSE; } /* * Calculate the number of bits that are used to represent color in each pixel, * the color depth for the screen */ if (pScreenInfo->dwBPP == 8) pScreenInfo->dwDepth = 8; else pScreenInfo->dwDepth = winCountBits(pScreenPriv->dwRedMask) + winCountBits(pScreenPriv->dwGreenMask) + winCountBits(pScreenPriv->dwBlueMask); winErrorFVerb(2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n", (unsigned int) pScreenPriv->dwRedMask, (unsigned int) pScreenPriv->dwGreenMask, (unsigned int) pScreenPriv->dwBlueMask); /* Init visuals */ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { ErrorF("winFinishScreenInitFB - winInitVisuals failed\n"); return FALSE; } /* Apparently we need this for the render extension */ miSetPixmapDepths(); /* Start fb initialization */ if (!fbSetupScreen(pScreen, pScreenInfo->pfb, pScreenInfo->dwWidth, pScreenInfo->dwHeight, monitorResolution, monitorResolution, pScreenInfo->dwStride, pScreenInfo->dwBPP)) { ErrorF("winFinishScreenInitFB - fbSetupScreen failed\n"); return FALSE; } /* Override default colormap routines if visual class is dynamic */ if (pScreenInfo->dwDepth == 8 && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL && pScreenInfo->fFullScreen))) { winSetColormapFunctions(pScreen); /* * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its * own colormap, as it cannot allocate 7 planes in the default * colormap. Setting whitePixel to 1 allows Magic to get 7 * planes in the default colormap, so it doesn't create its * own colormap. This latter situation is highly desireable, * as it keeps the Magic window viewable when switching to * other X clients that use the default colormap. */ pScreen->blackPixel = 0; pScreen->whitePixel = 1; } /* Place our save screen function */ pScreen->SaveScreen = winSaveScreen; /* Finish fb initialization */ if (!fbFinishScreenInit(pScreen, pScreenInfo->pfb, pScreenInfo->dwWidth, pScreenInfo->dwHeight, monitorResolution, monitorResolution, pScreenInfo->dwStride, pScreenInfo->dwBPP)) { ErrorF("winFinishScreenInitFB - fbFinishScreenInit failed\n"); return FALSE; } /* Save a pointer to the root visual */ for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++); pScreenPriv->pRootVisual = pVisual; /* * Setup points to the block and wakeup handlers. Pass a pointer * to the current screen as pWakeupdata. */ pScreen->BlockHandler = winBlockHandler; pScreen->WakeupHandler = winWakeupHandler; /* Render extension initialization, calls miPictureInit */ if (!fbPictureInit(pScreen, NULL, 0)) { ErrorF("winFinishScreenInitFB - fbPictureInit () failed\n"); return FALSE; } #ifdef RANDR /* Initialize resize and rotate support */ if (!winRandRInit(pScreen)) { ErrorF("winFinishScreenInitFB - winRandRInit () failed\n"); return FALSE; } #endif /* Setup the cursor routines */ #if CYGDEBUG winDebug("winFinishScreenInitFB - Calling miDCInitialize ()\n"); #endif miDCInitialize(pScreen, &g_winPointerCursorFuncs); /* KDrive does winCreateDefColormap right after miDCInitialize */ /* Create a default colormap */ #if CYGDEBUG winDebug("winFinishScreenInitFB - Calling winCreateDefColormap ()\n"); #endif if (!winCreateDefColormap(pScreen)) { ErrorF("winFinishScreenInitFB - Could not create colormap\n"); return FALSE; } /* Initialize the shadow framebuffer layer */ if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM #endif ) { #if CYGDEBUG winDebug("winFinishScreenInitFB - Calling shadowSetup ()\n"); #endif if (!shadowSetup(pScreen)) { ErrorF("winFinishScreenInitFB - shadowSetup () failed\n"); return FALSE; } /* Wrap CreateScreenResources so we can add the screen pixmap to the Shadow framebuffer after it's been created */ pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = winCreateScreenResources; } #ifdef XWIN_MULTIWINDOWEXTWM /* Handle multi-window external window manager mode */ if (pScreenInfo->fMWExtWM) { winDebug("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n"); RootlessInit(pScreen, &winMWExtWMProcs); winDebug("winScreenInit - MultiWindowExtWM - RootlessInit returned\n"); rootless_CopyBytes_threshold = 0; /* FIXME: How many? Profiling needed? */ rootless_CopyWindow_threshold = 1; winWindowsWMExtensionInit(); } #endif /* Handle rootless mode */ if (pScreenInfo->fRootless) { /* Define the WRAP macro temporarily for local use */ #define WRAP(a) \ if (pScreen->a) { \ pScreenPriv->a = pScreen->a; \ } else { \ winDebug("winScreenInit - null screen fn " #a "\n"); \ pScreenPriv->a = NULL; \ } /* Save a pointer to each lower-level window procedure */ WRAP(CreateWindow); WRAP(DestroyWindow); WRAP(RealizeWindow); WRAP(UnrealizeWindow); WRAP(PositionWindow); WRAP(ChangeWindowAttributes); WRAP(SetShape); /* Assign rootless window procedures to be top level procedures */ pScreen->CreateWindow = winCreateWindowRootless; pScreen->DestroyWindow = winDestroyWindowRootless; pScreen->PositionWindow = winPositionWindowRootless; /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless; */ pScreen->RealizeWindow = winMapWindowRootless; pScreen->UnrealizeWindow = winUnmapWindowRootless; pScreen->SetShape = winSetShapeRootless; /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP } /* Handle multi window mode */ else if (pScreenInfo->fMultiWindow) { /* Define the WRAP macro temporarily for local use */ #define WRAP(a) \ if (pScreen->a) { \ pScreenPriv->a = pScreen->a; \ } else { \ winDebug("null screen fn " #a "\n"); \ pScreenPriv->a = NULL; \ } /* Save a pointer to each lower-level window procedure */ WRAP(CreateWindow); WRAP(DestroyWindow); WRAP(RealizeWindow); WRAP(UnrealizeWindow); WRAP(PositionWindow); WRAP(ChangeWindowAttributes); WRAP(ReparentWindow); WRAP(RestackWindow); WRAP(ResizeWindow); WRAP(MoveWindow); WRAP(CopyWindow); WRAP(SetShape); /* Assign multi-window window procedures to be top level procedures */ pScreen->CreateWindow = winCreateWindowMultiWindow; pScreen->DestroyWindow = winDestroyWindowMultiWindow; pScreen->PositionWindow = winPositionWindowMultiWindow; /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow; */ pScreen->RealizeWindow = winMapWindowMultiWindow; pScreen->UnrealizeWindow = winUnmapWindowMultiWindow; pScreen->ReparentWindow = winReparentWindowMultiWindow; pScreen->RestackWindow = winRestackWindowMultiWindow; pScreen->ResizeWindow = winResizeWindowMultiWindow; pScreen->MoveWindow = winMoveWindowMultiWindow; pScreen->CopyWindow = winCopyWindowMultiWindow; pScreen->SetShape = winSetShapeMultiWindow; /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP } /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; /* Create a mutex for modules in separate threads to wait for */ iReturn = pthread_mutex_init(&pScreenPriv->pmServerStarted, NULL); if (iReturn != 0) { ErrorF("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n", iReturn); return FALSE; } /* Own the mutex for modules in separate threads */ iReturn = pthread_mutex_lock(&pScreenPriv->pmServerStarted); if (iReturn != 0) { ErrorF("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n", iReturn); return FALSE; } /* Set the ServerStarted flag to false */ pScreenPriv->fServerStarted = FALSE; #ifdef XWIN_MULTIWINDOWEXTWM pScreenPriv->fRestacking = FALSE; #endif if (pScreenInfo->fMultiWindow) { #if CYGDEBUG || YES winDebug("winFinishScreenInitFB - Calling winInitWM.\n"); #endif /* Initialize multi window mode */ if (!winInitWM(&pScreenPriv->pWMInfo, &pScreenPriv->ptWMProc, &pScreenPriv->ptXMsgProc, &pScreenPriv->pmServerStarted, pScreenInfo->dwScreen, (HWND) &pScreenPriv->hwndScreen)) { ErrorF("winFinishScreenInitFB - winInitWM () failed.\n"); return FALSE; } } /* Tell the server that we are enabled */ pScreenPriv->fEnabled = TRUE; /* Tell the server that we have a valid depth */ pScreenPriv->fBadDepth = FALSE; #if CYGDEBUG || YES winDebug("winFinishScreenInitFB - returning\n"); #endif return TRUE; } /* See Porting Layer Definition - p. 33 */ static Bool winSaveScreen(ScreenPtr pScreen, int on) { return TRUE; } xorg-server-1.20.8/hw/xwin/XWin.rc0000644000175000017500000000730513640201473013631 00000000000000/* *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) 2008 Yaakov Selkowitz All Rights Reserved * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 names of the authors *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 authors. * * Authors: Harold L Hunt II, Yaakov Selkowitz */ #include #include "winresource.h" #include "xwin-config.h" #include "version-config.h" /* * Dialogs */ /* About */ ABOUT_BOX DIALOGEX 32, 32, 260, 105 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE CAPTION "About " XVENDORNAMESHORT FONT 8, "MS Shell Dlg 2" BEGIN CONTROL IDI_XWIN, IDC_STATIC, "Static", SS_ICON, 8, 8, 32, 32 LTEXT XVENDORNAMESHORT " X Server ", IDC_STATIC, 36, 8, 220, 8 LTEXT VENDOR_MAN_VERSION, IDC_STATIC, 36, 18, 220, 8 LTEXT BUILDERSTRING, IDC_STATIC, 36, 28, 220, 8 LTEXT "This software is licensed under the terms of the MIT/X11 License.", IDC_STATIC, 36, 48, 220, 20 CONTROL __VENDORDWEBSUPPORT__, ID_ABOUT_WEBSITE, "Button", BS_OWNERDRAW | WS_TABSTOP, 36, 68, 220, 8 DEFPUSHBUTTON "&OK", IDOK, 105, 85, 50, 15 END /* Depth change */ DEPTH_CHANGE_BOX DIALOGEX 32, 32, 180, 100 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTERMOUSE FONT 8, "MS Shell Dlg 2" CAPTION XVENDORNAMESHORT BEGIN DEFPUSHBUTTON "Dismiss", IDOK, 66, 80, 50, 14 CTEXT XVENDORNAMESHORT, IDC_STATIC, 40, 12, 100, 8 CTEXT "Disruptive screen configuration change.", IDC_STATIC, 7, 40, 166, 8 CTEXT "Restore previous resolution to use " XVENDORNAMESHORT ".", IDC_STATIC, 7, 52, 166, 8 END /* Exit */ EXIT_DIALOG DIALOGEX 32, 32, 180, 78 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE FONT 8, "MS Shell Dlg 2" CAPTION "Exit " XVENDORNAMESHORT "?" BEGIN PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14 DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14 CTEXT "E&xiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8 CTEXT "No information about connected clients available.", IDC_CLIENTS_CONNECTED, 7, 24, 166, 8 CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 36, 166, 8 END /* * Menus */ IDM_TRAYICON_MENU MENU BEGIN POPUP "TRAYICON_MENU" BEGIN MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT MENUITEM "Clipboard may use &PRIMARY selection", ID_APP_MONITOR_PRIMARY MENUITEM "&About...", ID_APP_ABOUT MENUITEM SEPARATOR MENUITEM "E&xit...", ID_APP_EXIT END END /* * Icons */ IDI_XWIN ICON "X.ico" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "XWin.exe.manifest" xorg-server-1.20.8/hw/xwin/winmonitors.h0000644000175000017500000000301713640201473015153 00000000000000/* Copyright 1993, 1998 The Open Group Copyright (C) Colin Harrison 2005-2008 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. */ /* data returned for monitor information */ struct GetMonitorInfoData { int requestedMonitor; int monitorNum; Bool bUserSpecifiedMonitor; Bool bMonitorSpecifiedExists; int monitorOffsetX; int monitorOffsetY; int monitorHeight; int monitorWidth; HMONITOR monitorHandle; }; Bool QueryMonitor(int i, struct GetMonitorInfoData *data); xorg-server-1.20.8/hw/xwin/winmultiwindowwm.c0000644000175000017500000017224113640201473016230 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. *Copyright (C) Colin Harrison 2005-2009 * *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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Colin Harrison */ /* X headers */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include #include #ifdef __CYGWIN__ #include #endif #include #include #define HANDLE void * #include #undef HANDLE #include #include #include #include #include /* Local headers */ #include "X11/Xdefs.h" // for Bool type #include "winwindow.h" #include "winprefs.h" #include "window.h" #include "pixmapstr.h" #include "windowstr.h" #include "winglobals.h" #include "windisplay.h" #include "winmultiwindowicons.h" /* We need the native HWND atom for intWM, so for consistency use the same name as extWM does */ #define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND" #ifndef HOST_NAME_MAX #define HOST_NAME_MAX 255 #endif extern void winDebug(const char *format, ...); extern void winReshapeMultiWindow(WindowPtr pWin); extern void winUpdateRgnMultiWindow(WindowPtr pWin); extern xcb_auth_info_t *winGetXcbAuthInfo(void); #ifndef CYGDEBUG #define CYGDEBUG NO #endif /* * Constant defines */ #define WIN_CONNECT_RETRIES 5 #define WIN_CONNECT_DELAY 5 #ifdef HAS_DEVWINDOWS #define WIN_MSG_QUEUE_FNAME "/dev/windows" #endif /* * Local structures */ typedef struct _WMMsgNodeRec { winWMMessageRec msg; struct _WMMsgNodeRec *pNext; } WMMsgNodeRec, *WMMsgNodePtr; typedef struct _WMMsgQueueRec { struct _WMMsgNodeRec *pHead; struct _WMMsgNodeRec *pTail; pthread_mutex_t pmMutex; pthread_cond_t pcNotEmpty; } WMMsgQueueRec, *WMMsgQueuePtr; typedef struct _WMInfo { xcb_connection_t *conn; WMMsgQueueRec wmMsgQueue; xcb_atom_t atmWmProtos; xcb_atom_t atmWmDelete; xcb_atom_t atmWmTakeFocus; xcb_atom_t atmPrivMap; xcb_atom_t atmUtf8String; xcb_atom_t atmNetWmName; xcb_ewmh_connection_t ewmh; } WMInfoRec, *WMInfoPtr; typedef struct _WMProcArgRec { DWORD dwScreen; WMInfoPtr pWMInfo; pthread_mutex_t *ppmServerStarted; } WMProcArgRec, *WMProcArgPtr; typedef struct _XMsgProcArgRec { xcb_connection_t *conn; DWORD dwScreen; WMInfoPtr pWMInfo; pthread_mutex_t *ppmServerStarted; HWND hwndScreen; } XMsgProcArgRec, *XMsgProcArgPtr; /* * Prototypes for local functions */ static void PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode); static WMMsgNodePtr PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo); static Bool InitQueue(WMMsgQueuePtr pQueue); static void GetWindowName(WMInfoPtr pWMInfo, xcb_window_t iWin, char **ppWindowName); static void SendXMessage(xcb_connection_t *conn, xcb_window_t iWin, xcb_atom_t atmType, long nData); static void UpdateName(WMInfoPtr pWMInfo, xcb_window_t iWindow); static void *winMultiWindowWMProc(void *pArg); static void *winMultiWindowXMsgProc(void *pArg); static void winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg); #if 0 static void PreserveWin32Stack(WMInfoPtr pWMInfo, xcb_window_t iWindow, UINT direction); #endif static Bool CheckAnotherWindowManager(xcb_connection_t *conn, DWORD dwScreen); static void winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle); void winUpdateWindowPosition(HWND hWnd, HWND * zstyle); /* * Local globals */ static Bool g_shutdown = FALSE; /* * Translate msg id to text, for debug purposes */ #if CYGMULTIWINDOW_DEBUG static const char * MessageName(winWMMessagePtr msg) { switch (msg->msg) { case WM_WM_MOVE: return "WM_WM_MOVE"; break; case WM_WM_SIZE: return "WM_WM_SIZE"; break; case WM_WM_RAISE: return "WM_WM_RAISE"; break; case WM_WM_LOWER: return "WM_WM_LOWER"; break; case WM_WM_UNMAP: return "WM_WM_UNMAP"; break; case WM_WM_KILL: return "WM_WM_KILL"; break; case WM_WM_ACTIVATE: return "WM_WM_ACTIVATE"; break; case WM_WM_NAME_EVENT: return "WM_WM_NAME_EVENT"; break; case WM_WM_ICON_EVENT: return "WM_WM_ICON_EVENT"; break; case WM_WM_CHANGE_STATE: return "WM_WM_CHANGE_STATE"; break; case WM_WM_MAP2: return "WM_WM_MAP2"; break; case WM_WM_MAP3: return "WM_WM_MAP3"; break; case WM_WM_HINTS_EVENT: return "WM_WM_HINTS_EVENT"; break; default: return "Unknown Message"; break; } } #endif /* * PushMessage - Push a message onto the queue */ static void PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode) { /* Lock the queue mutex */ pthread_mutex_lock(&pQueue->pmMutex); pNode->pNext = NULL; if (pQueue->pTail != NULL) { pQueue->pTail->pNext = pNode; } pQueue->pTail = pNode; if (pQueue->pHead == NULL) { pQueue->pHead = pNode; } /* Release the queue mutex */ pthread_mutex_unlock(&pQueue->pmMutex); /* Signal that the queue is not empty */ pthread_cond_signal(&pQueue->pcNotEmpty); } /* * PopMessage - Pop a message from the queue */ static WMMsgNodePtr PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo) { WMMsgNodePtr pNode; /* Lock the queue mutex */ pthread_mutex_lock(&pQueue->pmMutex); /* Wait for --- */ while (pQueue->pHead == NULL) { pthread_cond_wait(&pQueue->pcNotEmpty, &pQueue->pmMutex); } pNode = pQueue->pHead; if (pQueue->pHead != NULL) { pQueue->pHead = pQueue->pHead->pNext; } if (pQueue->pTail == pNode) { pQueue->pTail = NULL; } /* Release the queue mutex */ pthread_mutex_unlock(&pQueue->pmMutex); return pNode; } #if 0 /* * HaveMessage - */ static Bool HaveMessage(WMMsgQueuePtr pQueue, UINT msg, xcb_window_t iWindow) { WMMsgNodePtr pNode; for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext) { if (pNode->msg.msg == msg && pNode->msg.iWindow == iWindow) return True; } return False; } #endif /* * InitQueue - Initialize the Window Manager message queue */ static Bool InitQueue(WMMsgQueuePtr pQueue) { /* Check if the pQueue pointer is NULL */ if (pQueue == NULL) { ErrorF("InitQueue - pQueue is NULL. Exiting.\n"); return FALSE; } /* Set the head and tail to NULL */ pQueue->pHead = NULL; pQueue->pTail = NULL; winDebug("InitQueue - Calling pthread_mutex_init\n"); /* Create synchronization objects */ pthread_mutex_init(&pQueue->pmMutex, NULL); winDebug("InitQueue - pthread_mutex_init returned\n"); winDebug("InitQueue - Calling pthread_cond_init\n"); pthread_cond_init(&pQueue->pcNotEmpty, NULL); winDebug("InitQueue - pthread_cond_init returned\n"); return TRUE; } static char * Xutf8TextPropertyToString(WMInfoPtr pWMInfo, xcb_icccm_get_text_property_reply_t *xtp) { char *pszReturnData; if ((xtp->encoding == XCB_ATOM_STRING) || // Latin1 ISO 8859-1 (xtp->encoding == pWMInfo->atmUtf8String)) { // UTF-8 ISO 10646 pszReturnData = strndup(xtp->name, xtp->name_len); } else { // Converting from COMPOUND_TEXT to UTF-8 properly is complex to // implement, and not very much use unless you have an old // application which isn't UTF-8 aware. ErrorF("Xutf8TextPropertyToString: text encoding %d is not implemented\n", xtp->encoding); pszReturnData = strdup(""); } return pszReturnData; } /* * GetWindowName - Retrieve the title of an X Window */ static void GetWindowName(WMInfoPtr pWMInfo, xcb_window_t iWin, char **ppWindowName) { xcb_connection_t *conn = pWMInfo->conn; char *pszWindowName = NULL; #if CYGMULTIWINDOW_DEBUG ErrorF("GetWindowName\n"); #endif /* Try to get window name from _NET_WM_NAME */ { xcb_get_property_cookie_t cookie; xcb_get_property_reply_t *reply; cookie = xcb_get_property(pWMInfo->conn, FALSE, iWin, pWMInfo->atmNetWmName, XCB_GET_PROPERTY_TYPE_ANY, 0, INT_MAX); reply = xcb_get_property_reply(pWMInfo->conn, cookie, NULL); if (reply && (reply->type != XCB_NONE)) { pszWindowName = strndup(xcb_get_property_value(reply), xcb_get_property_value_length(reply)); free(reply); } } /* Otherwise, try to get window name from WM_NAME */ if (!pszWindowName) { xcb_get_property_cookie_t cookie; xcb_icccm_get_text_property_reply_t reply; cookie = xcb_icccm_get_wm_name(conn, iWin); if (!xcb_icccm_get_wm_name_reply(conn, cookie, &reply, NULL)) { ErrorF("GetWindowName - xcb_icccm_get_wm_name_reply failed. No name.\n"); *ppWindowName = NULL; return; } pszWindowName = Xutf8TextPropertyToString(pWMInfo, &reply); xcb_icccm_get_text_property_reply_wipe(&reply); } /* return the window name, unless... */ *ppWindowName = pszWindowName; if (g_fHostInTitle) { xcb_get_property_cookie_t cookie; xcb_icccm_get_text_property_reply_t reply; /* Try to get client machine name */ cookie = xcb_icccm_get_wm_client_machine(conn, iWin); if (xcb_icccm_get_wm_client_machine_reply(conn, cookie, &reply, NULL)) { char *pszClientMachine; char *pszClientHostname; char *dot; char hostname[HOST_NAME_MAX + 1]; pszClientMachine = Xutf8TextPropertyToString(pWMInfo, &reply); xcb_icccm_get_text_property_reply_wipe(&reply); /* If client machine name looks like a FQDN, find the hostname */ pszClientHostname = strdup(pszClientMachine); dot = strchr(pszClientHostname, '.'); if (dot) *dot = '\0'; /* If we have a client machine hostname and it's not the local hostname and it's not already in the window title... */ if (strlen(pszClientHostname) && !gethostname(hostname, HOST_NAME_MAX + 1) && strcmp(hostname, pszClientHostname) && (strstr(pszWindowName, pszClientHostname) == 0)) { /* ... add '@' to end of window name */ *ppWindowName = malloc(strlen(pszWindowName) + strlen(pszClientMachine) + 2); strcpy(*ppWindowName, pszWindowName); strcat(*ppWindowName, "@"); strcat(*ppWindowName, pszClientMachine); free(pszWindowName); } free(pszClientMachine); free(pszClientHostname); } } } /* * Does the client support the specified WM_PROTOCOLS protocol? */ static Bool IsWmProtocolAvailable(WMInfoPtr pWMInfo, xcb_window_t iWindow, xcb_atom_t atmProtocol) { int i, found = 0; xcb_get_property_cookie_t cookie; xcb_icccm_get_wm_protocols_reply_t reply; xcb_connection_t *conn = pWMInfo->conn; cookie = xcb_icccm_get_wm_protocols(conn, iWindow, pWMInfo->ewmh.WM_PROTOCOLS); if (xcb_icccm_get_wm_protocols_reply(conn, cookie, &reply, NULL)) { for (i = 0; i < reply.atoms_len; ++i) if (reply.atoms[i] == atmProtocol) { ++found; break; } xcb_icccm_get_wm_protocols_reply_wipe(&reply); } return found > 0; } /* * Send a message to the X server from the WM thread */ static void SendXMessage(xcb_connection_t *conn, xcb_window_t iWin, xcb_atom_t atmType, long nData) { xcb_client_message_event_t e; /* Prepare the X event structure */ memset(&e, 0, sizeof(e)); e.response_type = XCB_CLIENT_MESSAGE; e.window = iWin; e.type = atmType; e.format = 32; e.data.data32[0] = nData; e.data.data32[1] = XCB_CURRENT_TIME; /* Send the event to X */ xcb_send_event(conn, FALSE, iWin, XCB_EVENT_MASK_NO_EVENT, (const char *)&e); } /* * See if we can get the stored HWND for this window... */ static HWND getHwnd(WMInfoPtr pWMInfo, xcb_window_t iWindow) { HWND hWnd = NULL; xcb_get_property_cookie_t cookie; xcb_get_property_reply_t *reply; cookie = xcb_get_property(pWMInfo->conn, FALSE, iWindow, pWMInfo->atmPrivMap, XCB_ATOM_INTEGER, 0L, sizeof(HWND)/4L); reply = xcb_get_property_reply(pWMInfo->conn, cookie, NULL); if (reply) { int length = xcb_get_property_value_length(reply); HWND *value = xcb_get_property_value(reply); if (value && (length == sizeof(HWND))) { hWnd = *value; } free(reply); } /* Some sanity checks */ if (!hWnd) return NULL; if (!IsWindow(hWnd)) return NULL; return hWnd; } /* * Helper function to check for override-redirect */ static Bool IsOverrideRedirect(xcb_connection_t *conn, xcb_window_t iWin) { Bool result = FALSE; xcb_get_window_attributes_reply_t *reply; xcb_get_window_attributes_cookie_t cookie; cookie = xcb_get_window_attributes(conn, iWin); reply = xcb_get_window_attributes_reply(conn, cookie, NULL); if (reply) { result = (reply->override_redirect != 0); free(reply); } else { ErrorF("IsOverrideRedirect: Failed to get window attributes\n"); } return result; } /* * Helper function to get class and window names */ static void GetClassNames(WMInfoPtr pWMInfo, xcb_window_t iWindow, char **res_name, char **res_class, char **window_name) { xcb_get_property_cookie_t cookie1; xcb_icccm_get_wm_class_reply_t reply1; xcb_get_property_cookie_t cookie2; xcb_icccm_get_text_property_reply_t reply2; cookie1 = xcb_icccm_get_wm_class(pWMInfo->conn, iWindow); if (xcb_icccm_get_wm_class_reply(pWMInfo->conn, cookie1, &reply1, NULL)) { *res_name = strdup(reply1.instance_name); *res_class = strdup(reply1.class_name); xcb_icccm_get_wm_class_reply_wipe(&reply1); } else { *res_name = strdup(""); *res_class = strdup(""); } cookie2 = xcb_icccm_get_wm_name(pWMInfo->conn, iWindow); if (xcb_icccm_get_wm_name_reply(pWMInfo->conn, cookie2, &reply2, NULL)) { *window_name = strndup(reply2.name, reply2.name_len); xcb_icccm_get_text_property_reply_wipe(&reply2); } else { *window_name = strdup(""); } } /* * Updates the name of a HWND according to its X WM_NAME property */ static void UpdateName(WMInfoPtr pWMInfo, xcb_window_t iWindow) { HWND hWnd; hWnd = getHwnd(pWMInfo, iWindow); if (!hWnd) return; /* If window isn't override-redirect */ if (!IsOverrideRedirect(pWMInfo->conn, iWindow)) { char *pszWindowName; /* Get the X windows window name */ GetWindowName(pWMInfo, iWindow, &pszWindowName); if (pszWindowName) { /* Convert from UTF-8 to wide char */ int iLen = MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, NULL, 0); wchar_t *pwszWideWindowName = malloc(sizeof(wchar_t)*(iLen + 1)); MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, pwszWideWindowName, iLen); /* Set the Windows window name */ SetWindowTextW(hWnd, pwszWideWindowName); free(pwszWideWindowName); free(pszWindowName); } } } /* * Updates the icon of a HWND according to its X icon properties */ static void UpdateIcon(WMInfoPtr pWMInfo, xcb_window_t iWindow) { HWND hWnd; HICON hIconNew = NULL; hWnd = getHwnd(pWMInfo, iWindow); if (!hWnd) return; /* If window isn't override-redirect */ if (!IsOverrideRedirect(pWMInfo->conn, iWindow)) { char *window_name = 0; char *res_name = 0; char *res_class = 0; GetClassNames(pWMInfo, iWindow, &res_name, &res_class, &window_name); hIconNew = winOverrideIcon(res_name, res_class, window_name); free(res_name); free(res_class); free(window_name); winUpdateIcon(hWnd, pWMInfo->conn, iWindow, hIconNew); } } /* * Updates the style of a HWND according to its X style properties */ static void UpdateStyle(WMInfoPtr pWMInfo, xcb_window_t iWindow) { HWND hWnd; HWND zstyle = HWND_NOTOPMOST; UINT flags; hWnd = getHwnd(pWMInfo, iWindow); if (!hWnd) return; /* Determine the Window style, which determines borders and clipping region... */ winApplyHints(pWMInfo, iWindow, hWnd, &zstyle); winUpdateWindowPosition(hWnd, &zstyle); /* Apply the updated window style, without changing it's show or activation state */ flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; if (zstyle == HWND_NOTOPMOST) flags |= SWP_NOZORDER | SWP_NOOWNERZORDER; SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags); /* Use the WS_EX_TOOLWINDOW style to remove window from Alt-Tab window switcher According to MSDN, this is supposed to remove the window from the taskbar as well, if we SW_HIDE before changing the style followed by SW_SHOW afterwards. But that doesn't seem to work reliably, and causes the window to flicker, so use the iTaskbarList interface to tell the taskbar to show or hide this window. */ winShowWindowOnTaskbar(hWnd, (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_APPWINDOW) ? TRUE : FALSE); } /* * Updates the state of a HWND * (only minimization supported at the moment) */ static void UpdateState(WMInfoPtr pWMInfo, xcb_window_t iWindow) { HWND hWnd; winDebug("UpdateState: iWindow 0x%08x\n", (int)iWindow); hWnd = getHwnd(pWMInfo, iWindow); if (!hWnd) return; ShowWindow(hWnd, SW_MINIMIZE); } #if 0 /* * Fix up any differences between the X11 and Win32 window stacks * starting at the window passed in */ static void PreserveWin32Stack(WMInfoPtr pWMInfo, xcb_window_t iWindow, UINT direction) { HWND hWnd; DWORD myWinProcID, winProcID; xcb_window_t xWindow; WINDOWPLACEMENT wndPlace; hWnd = getHwnd(pWMInfo, iWindow); if (!hWnd) return; GetWindowThreadProcessId(hWnd, &myWinProcID); hWnd = GetNextWindow(hWnd, direction); while (hWnd) { GetWindowThreadProcessId(hWnd, &winProcID); if (winProcID == myWinProcID) { wndPlace.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hWnd, &wndPlace); if (!(wndPlace.showCmd == SW_HIDE || wndPlace.showCmd == SW_MINIMIZE)) { xWindow = (Window) GetProp(hWnd, WIN_WID_PROP); if (xWindow) { if (direction == GW_HWNDPREV) XRaiseWindow(pWMInfo->pDisplay, xWindow); else XLowerWindow(pWMInfo->pDisplay, xWindow); } } } hWnd = GetNextWindow(hWnd, direction); } } #endif /* PreserveWin32Stack */ /* * winMultiWindowWMProc */ static void * winMultiWindowWMProc(void *pArg) { WMProcArgPtr pProcArg = (WMProcArgPtr) pArg; WMInfoPtr pWMInfo = pProcArg->pWMInfo; /* Initialize the Window Manager */ winInitMultiWindowWM(pWMInfo, pProcArg); #if CYGMULTIWINDOW_DEBUG ErrorF("winMultiWindowWMProc ()\n"); #endif /* Loop until we explicitly break out */ for (;;) { WMMsgNodePtr pNode; /* Pop a message off of our queue */ pNode = PopMessage(&pWMInfo->wmMsgQueue, pWMInfo); if (pNode == NULL) { /* Bail if PopMessage returns without a message */ /* NOTE: Remember that PopMessage is a blocking function. */ ErrorF("winMultiWindowWMProc - Queue is Empty? Exiting.\n"); pthread_exit(NULL); } #if CYGMULTIWINDOW_DEBUG ErrorF("winMultiWindowWMProc - MSG: %s (%d) ID: %d\n", MessageName(&(pNode->msg)), (int)pNode->msg.msg, (int)pNode->msg.dwID); #endif /* Branch on the message type */ switch (pNode->msg.msg) { #if 0 case WM_WM_MOVE: break; case WM_WM_SIZE: break; #endif case WM_WM_RAISE: /* Raise the window */ { const static uint32_t values[] = { XCB_STACK_MODE_ABOVE }; xcb_configure_window(pWMInfo->conn, pNode->msg.iWindow, XCB_CONFIG_WINDOW_STACK_MODE, values); } #if 0 PreserveWin32Stack(pWMInfo, pNode->msg.iWindow, GW_HWNDPREV); #endif break; case WM_WM_LOWER: /* Lower the window */ { const static uint32_t values[] = { XCB_STACK_MODE_BELOW }; xcb_configure_window(pWMInfo->conn, pNode->msg.iWindow, XCB_CONFIG_WINDOW_STACK_MODE, values); } break; case WM_WM_MAP2: /* Put a note as to the HWND associated with this Window */ xcb_change_property(pWMInfo->conn, XCB_PROP_MODE_REPLACE, pNode->msg.iWindow, pWMInfo->atmPrivMap, XCB_ATOM_INTEGER, 32, sizeof(HWND)/4, &(pNode->msg.hwndWindow)); break; case WM_WM_MAP3: /* Put a note as to the HWND associated with this Window */ xcb_change_property(pWMInfo->conn, XCB_PROP_MODE_REPLACE, pNode->msg.iWindow, pWMInfo->atmPrivMap, XCB_ATOM_INTEGER, 32, sizeof(HWND)/4, &(pNode->msg.hwndWindow)); UpdateName(pWMInfo, pNode->msg.iWindow); UpdateIcon(pWMInfo, pNode->msg.iWindow); UpdateStyle(pWMInfo, pNode->msg.iWindow); /* Reshape */ { WindowPtr pWin = GetProp(pNode->msg.hwndWindow, WIN_WINDOW_PROP); if (pWin) { winReshapeMultiWindow(pWin); winUpdateRgnMultiWindow(pWin); } } break; case WM_WM_UNMAP: /* Unmap the window */ xcb_unmap_window(pWMInfo->conn, pNode->msg.iWindow); break; case WM_WM_KILL: { /* --- */ if (IsWmProtocolAvailable(pWMInfo, pNode->msg.iWindow, pWMInfo->atmWmDelete)) SendXMessage(pWMInfo->conn, pNode->msg.iWindow, pWMInfo->atmWmProtos, pWMInfo->atmWmDelete); else xcb_kill_client(pWMInfo->conn, pNode->msg.iWindow); } break; case WM_WM_ACTIVATE: /* Set the input focus */ /* ICCCM 4.1.7 is pretty opaque, but it appears that the rules are actually quite simple: -- the WM_HINTS input field determines whether the WM should call XSetInputFocus() -- independently, the WM_TAKE_FOCUS protocol determines whether the WM should send a WM_TAKE_FOCUS ClientMessage. */ { Bool neverFocus = FALSE; xcb_get_property_cookie_t cookie; xcb_icccm_wm_hints_t hints; cookie = xcb_icccm_get_wm_hints(pWMInfo->conn, pNode->msg.iWindow); if (xcb_icccm_get_wm_hints_reply(pWMInfo->conn, cookie, &hints, NULL)) { if (hints.flags & XCB_ICCCM_WM_HINT_INPUT) neverFocus = !hints.input; } if (!neverFocus) xcb_set_input_focus(pWMInfo->conn, XCB_INPUT_FOCUS_POINTER_ROOT, pNode->msg.iWindow, XCB_CURRENT_TIME); if (IsWmProtocolAvailable(pWMInfo, pNode->msg.iWindow, pWMInfo->atmWmTakeFocus)) SendXMessage(pWMInfo->conn, pNode->msg.iWindow, pWMInfo->atmWmProtos, pWMInfo->atmWmTakeFocus); } break; case WM_WM_NAME_EVENT: UpdateName(pWMInfo, pNode->msg.iWindow); break; case WM_WM_ICON_EVENT: UpdateIcon(pWMInfo, pNode->msg.iWindow); break; case WM_WM_HINTS_EVENT: { /* Don't do anything if this is an override-redirect window */ if (IsOverrideRedirect(pWMInfo->conn, pNode->msg.iWindow)) break; UpdateStyle(pWMInfo, pNode->msg.iWindow); } break; case WM_WM_CHANGE_STATE: UpdateState(pWMInfo, pNode->msg.iWindow); break; default: ErrorF("winMultiWindowWMProc - Unknown Message. Exiting.\n"); pthread_exit(NULL); break; } /* Free the retrieved message */ free(pNode); /* Flush any pending events on our display */ xcb_flush(pWMInfo->conn); /* This is just laziness rather than making sure we used _checked everywhere */ { xcb_generic_event_t *event = xcb_poll_for_event(pWMInfo->conn); if (event) { if ((event->response_type & ~0x80) == 0) { xcb_generic_error_t *err = (xcb_generic_error_t *)event; ErrorF("winMultiWindowWMProc - Error code: %i, ID: 0x%08x, " "Major opcode: %i, Minor opcode: %i\n", err->error_code, err->resource_id, err->major_code, err->minor_code); } } } /* I/O errors etc. */ { int e = xcb_connection_has_error(pWMInfo->conn); if (e) { ErrorF("winMultiWindowWMProc - Fatal error %d on xcb connection\n", e); break; } } } /* Free the condition variable */ pthread_cond_destroy(&pWMInfo->wmMsgQueue.pcNotEmpty); /* Free the mutex variable */ pthread_mutex_destroy(&pWMInfo->wmMsgQueue.pmMutex); /* Free the passed-in argument */ free(pProcArg); #if CYGMULTIWINDOW_DEBUG ErrorF("-winMultiWindowWMProc ()\n"); #endif return NULL; } static xcb_atom_t intern_atom(xcb_connection_t *conn, const char *atomName) { xcb_intern_atom_reply_t *atom_reply; xcb_intern_atom_cookie_t atom_cookie; xcb_atom_t atom = XCB_ATOM_NONE; atom_cookie = xcb_intern_atom(conn, 0, strlen(atomName), atomName); atom_reply = xcb_intern_atom_reply(conn, atom_cookie, NULL); if (atom_reply) { atom = atom_reply->atom; free(atom_reply); } return atom; } /* * X message procedure */ static void * winMultiWindowXMsgProc(void *pArg) { winWMMessageRec msg; XMsgProcArgPtr pProcArg = (XMsgProcArgPtr) pArg; char pszDisplay[512]; int iRetries; xcb_atom_t atmWmName; xcb_atom_t atmNetWmName; xcb_atom_t atmWmHints; xcb_atom_t atmWmChange; xcb_atom_t atmNetWmIcon; xcb_atom_t atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints; int iReturn; xcb_auth_info_t *auth_info; winDebug("winMultiWindowXMsgProc - Hello\n"); /* Check that argument pointer is not invalid */ if (pProcArg == NULL) { ErrorF("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n"); pthread_exit(NULL); } winDebug("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n"); /* Grab the server started mutex - pause until we get it */ iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted); if (iReturn != 0) { ErrorF("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. " "Exiting.\n", iReturn); pthread_exit(NULL); } winDebug("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n"); /* Release the server started mutex */ pthread_mutex_unlock(pProcArg->ppmServerStarted); winDebug("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n"); /* Setup the display connection string x */ winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen); /* Print the display connection string */ ErrorF("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay); /* Use our generated cookie for authentication */ auth_info = winGetXcbAuthInfo(); /* Initialize retry count */ iRetries = 0; /* Open the X display */ do { /* Try to open the display */ pProcArg->conn = xcb_connect_to_display_with_auth_info(pszDisplay, auth_info, NULL); if (xcb_connection_has_error(pProcArg->conn)) { ErrorF("winMultiWindowXMsgProc - Could not open display, try: %d, " "sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY); ++iRetries; sleep(WIN_CONNECT_DELAY); continue; } else break; } while (xcb_connection_has_error(pProcArg->conn) && iRetries < WIN_CONNECT_RETRIES); /* Make sure that the display opened */ if (xcb_connection_has_error(pProcArg->conn)) { ErrorF("winMultiWindowXMsgProc - Failed opening the display. " "Exiting.\n"); pthread_exit(NULL); } ErrorF("winMultiWindowXMsgProc - xcb_connect() returned and " "successfully opened the display.\n"); /* Check if another window manager is already running */ if (CheckAnotherWindowManager(pProcArg->conn, pProcArg->dwScreen)) { ErrorF("winMultiWindowXMsgProc - " "another window manager is running. Exiting.\n"); pthread_exit(NULL); } { /* Get root window id */ xcb_screen_t *root_screen = xcb_aux_get_screen(pProcArg->conn, pProcArg->dwScreen); xcb_window_t root_window_id = root_screen->root; /* Set WM_ICON_SIZE property indicating desired icon sizes */ typedef struct { uint32_t min_width, min_height; uint32_t max_width, max_height; int32_t width_inc, height_inc; } xcb_wm_icon_size_hints_hints_t; xcb_wm_icon_size_hints_hints_t xis; xis.min_width = xis.min_height = 16; xis.max_width = xis.max_height = 48; xis.width_inc = xis.height_inc = 16; xcb_change_property(pProcArg->conn, XCB_PROP_MODE_REPLACE, root_window_id, XCB_ATOM_WM_ICON_SIZE, XCB_ATOM_WM_ICON_SIZE, 32, sizeof(xis)/4, &xis); } atmWmName = intern_atom(pProcArg->conn, "WM_NAME"); atmNetWmName = intern_atom(pProcArg->conn, "_NET_WM_NAME"); atmWmHints = intern_atom(pProcArg->conn, "WM_HINTS"); atmWmChange = intern_atom(pProcArg->conn, "WM_CHANGE_STATE"); atmNetWmIcon = intern_atom(pProcArg->conn, "_NET_WM_ICON"); atmWindowState = intern_atom(pProcArg->conn, "_NET_WM_STATE"); atmMotifWmHints = intern_atom(pProcArg->conn, "_MOTIF_WM_HINTS"); atmWindowType = intern_atom(pProcArg->conn, "_NET_WM_WINDOW_TYPE"); atmNormalHints = intern_atom(pProcArg->conn, "WM_NORMAL_HINTS"); /* iiimxcf had a bug until 2009-04-27, assuming that the WM_STATE atom exists, causing clients to fail with a BadAtom X error if it doesn't. Since this is on in the default Solaris 10 install, workaround this by making sure it does exist... */ intern_atom(pProcArg->conn, "WM_STATE"); /* Loop until we explicitly break out */ while (1) { xcb_generic_event_t *event; uint8_t type; Bool send_event; if (g_shutdown) break; /* Fetch next event */ event = xcb_wait_for_event(pProcArg->conn); if (!event) { // returns NULL on I/O error int e = xcb_connection_has_error(pProcArg->conn); ErrorF("winMultiWindowXMsgProc - Fatal error %d on xcb connection\n", e); break; } type = event->response_type & ~0x80; send_event = event->response_type & 0x80; winDebug("winMultiWindowXMsgProc - event %d\n", type); /* Branch on event type */ if (type == 0) { xcb_generic_error_t *err = (xcb_generic_error_t *)event; ErrorF("winMultiWindowXMsgProc - Error code: %i, ID: 0x%08x, " "Major opcode: %i, Minor opcode: %i\n", err->error_code, err->resource_id, err->major_code, err->minor_code); } else if (type == XCB_CREATE_NOTIFY) { xcb_create_notify_event_t *notify = (xcb_create_notify_event_t *)event; /* Request property change events */ const static uint32_t mask_value[] = { XCB_EVENT_MASK_PROPERTY_CHANGE }; xcb_change_window_attributes (pProcArg->conn, notify->window, XCB_CW_EVENT_MASK, mask_value); /* If it's not override-redirect, set the border-width to 0 */ if (!IsOverrideRedirect(pProcArg->conn, notify->window)) { const static uint32_t width_value[] = { 0 }; xcb_configure_window(pProcArg->conn, notify->window, XCB_CONFIG_WINDOW_BORDER_WIDTH, width_value); } } else if (type == XCB_MAP_NOTIFY) { /* Fake a reparentNotify event as SWT/Motif expects a Window Manager to reparent a top-level window when it is mapped and waits until they do. We don't actually need to reparent, as the frame is a native window, not an X window We do this on MapNotify, not MapRequest like a real Window Manager would, so we don't have do get involved in actually mapping the window via it's (non-existent) parent... See sourceware bugzilla #9848 */ xcb_map_notify_event_t *notify = (xcb_map_notify_event_t *)event; xcb_get_geometry_cookie_t cookie; xcb_get_geometry_reply_t *reply; xcb_query_tree_cookie_t cookie_qt; xcb_query_tree_reply_t *reply_qt; cookie = xcb_get_geometry(pProcArg->conn, notify->window); cookie_qt = xcb_query_tree(pProcArg->conn, notify->window); reply = xcb_get_geometry_reply(pProcArg->conn, cookie, NULL); reply_qt = xcb_query_tree_reply(pProcArg->conn, cookie_qt, NULL); if (reply && reply_qt) { /* It's a top-level window if the parent window is a root window Only non-override_redirect windows can get reparented */ if ((reply->root == reply_qt->parent) && !notify->override_redirect) { xcb_reparent_notify_event_t event_send; event_send.response_type = ReparentNotify; event_send.event = notify->window; event_send.window = notify->window; event_send.parent = reply_qt->parent; event_send.x = reply->x; event_send.y = reply->y; xcb_send_event (pProcArg->conn, TRUE, notify->window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&event_send); free(reply_qt); free(reply); } } } else if (type == XCB_CONFIGURE_NOTIFY) { if (!send_event) { /* Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT doesn't explicitly know about (See sun bug #6434227) XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic ConfigureNotify events to update window location if it's identified the WM as a non-reparenting WM it knows about (compiz or lookingglass) Rather than tell all sorts of lies to get XWM to recognize us as one of those, simply send a synthetic ConfigureNotify for every non-synthetic one */ xcb_configure_notify_event_t *notify = (xcb_configure_notify_event_t *)event; xcb_configure_notify_event_t event_send = *notify; event_send.event = notify->window; xcb_send_event(pProcArg->conn, TRUE, notify->window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&event_send); } } else if (type == XCB_PROPERTY_NOTIFY) { xcb_property_notify_event_t *notify = (xcb_property_notify_event_t *)event; if ((notify->atom == atmWmName) || (notify->atom == atmNetWmName)) { memset(&msg, 0, sizeof(msg)); msg.msg = WM_WM_NAME_EVENT; msg.iWindow = notify->window; /* Other fields ignored */ winSendMessageToWM(pProcArg->pWMInfo, &msg); } else { /* Several properties are considered for WM hints, check if this property change affects any of them... (this list needs to be kept in sync with winApplyHints()) */ if ((notify->atom == atmWmHints) || (notify->atom == atmWindowState) || (notify->atom == atmMotifWmHints) || (notify->atom == atmWindowType) || (notify->atom == atmNormalHints)) { memset(&msg, 0, sizeof(msg)); msg.msg = WM_WM_HINTS_EVENT; msg.iWindow = notify->window; /* Other fields ignored */ winSendMessageToWM(pProcArg->pWMInfo, &msg); } /* Not an else as WM_HINTS affects both style and icon */ if ((notify->atom == atmWmHints) || (notify->atom == atmNetWmIcon)) { memset(&msg, 0, sizeof(msg)); msg.msg = WM_WM_ICON_EVENT; msg.iWindow = notify->window; /* Other fields ignored */ winSendMessageToWM(pProcArg->pWMInfo, &msg); } } } else if (type == XCB_CLIENT_MESSAGE) { xcb_client_message_event_t *client_msg = (xcb_client_message_event_t *)event; if (client_msg->type == atmWmChange && client_msg->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC) { ErrorF("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n"); memset(&msg, 0, sizeof(msg)); msg.msg = WM_WM_CHANGE_STATE; msg.iWindow = client_msg->window; winSendMessageToWM(pProcArg->pWMInfo, &msg); } } /* Free the event */ free(event); } xcb_disconnect(pProcArg->conn); pthread_exit(NULL); return NULL; } /* * winInitWM - Entry point for the X server to spawn * the Window Manager thread. Called from * winscrinit.c/winFinishScreenInitFB (). */ Bool winInitWM(void **ppWMInfo, pthread_t * ptWMProc, pthread_t * ptXMsgProc, pthread_mutex_t * ppmServerStarted, int dwScreen, HWND hwndScreen) { WMProcArgPtr pArg = malloc(sizeof(WMProcArgRec)); WMInfoPtr pWMInfo = malloc(sizeof(WMInfoRec)); XMsgProcArgPtr pXMsgArg = malloc(sizeof(XMsgProcArgRec)); /* Bail if the input parameters are bad */ if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) { ErrorF("winInitWM - malloc failed.\n"); free(pArg); free(pWMInfo); free(pXMsgArg); return FALSE; } /* Zero the allocated memory */ ZeroMemory(pArg, sizeof(WMProcArgRec)); ZeroMemory(pWMInfo, sizeof(WMInfoRec)); ZeroMemory(pXMsgArg, sizeof(XMsgProcArgRec)); /* Set a return pointer to the Window Manager info structure */ *ppWMInfo = pWMInfo; /* Setup the argument structure for the thread function */ pArg->dwScreen = dwScreen; pArg->pWMInfo = pWMInfo; pArg->ppmServerStarted = ppmServerStarted; /* Intialize the message queue */ if (!InitQueue(&pWMInfo->wmMsgQueue)) { ErrorF("winInitWM - InitQueue () failed.\n"); return FALSE; } /* Spawn a thread for the Window Manager */ if (pthread_create(ptWMProc, NULL, winMultiWindowWMProc, pArg)) { /* Bail if thread creation failed */ ErrorF("winInitWM - pthread_create failed for Window Manager.\n"); return FALSE; } /* Spawn the XNextEvent thread, will send messages to WM */ pXMsgArg->dwScreen = dwScreen; pXMsgArg->pWMInfo = pWMInfo; pXMsgArg->ppmServerStarted = ppmServerStarted; pXMsgArg->hwndScreen = hwndScreen; if (pthread_create(ptXMsgProc, NULL, winMultiWindowXMsgProc, pXMsgArg)) { /* Bail if thread creation failed */ ErrorF("winInitWM - pthread_create failed on XMSG.\n"); return FALSE; } #if CYGDEBUG || YES winDebug("winInitWM - Returning.\n"); #endif return TRUE; } /* * Window manager thread - setup */ static void winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) { int iRetries = 0; char pszDisplay[512]; int iReturn; xcb_auth_info_t *auth_info; winDebug("winInitMultiWindowWM - Hello\n"); /* Check that argument pointer is not invalid */ if (pProcArg == NULL) { ErrorF("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n"); pthread_exit(NULL); } winDebug("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n"); /* Grab our garbage mutex to satisfy pthread_cond_wait */ iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted); if (iReturn != 0) { ErrorF("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. " "Exiting.\n", iReturn); pthread_exit(NULL); } winDebug("winInitMultiWindowWM - pthread_mutex_lock () returned.\n"); /* Release the server started mutex */ pthread_mutex_unlock(pProcArg->ppmServerStarted); winDebug("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n"); /* Setup the display connection string x */ winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen); /* Print the display connection string */ ErrorF("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); /* Use our generated cookie for authentication */ auth_info = winGetXcbAuthInfo(); /* Open the X display */ do { /* Try to open the display */ pWMInfo->conn = xcb_connect_to_display_with_auth_info(pszDisplay, auth_info, NULL); if (xcb_connection_has_error(pWMInfo->conn)) { ErrorF("winInitMultiWindowWM - Could not open display, try: %d, " "sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY); ++iRetries; sleep(WIN_CONNECT_DELAY); continue; } else break; } while (xcb_connection_has_error(pWMInfo->conn) && iRetries < WIN_CONNECT_RETRIES); /* Make sure that the display opened */ if (xcb_connection_has_error(pWMInfo->conn)) { ErrorF("winInitMultiWindowWM - Failed opening the display. " "Exiting.\n"); pthread_exit(NULL); } ErrorF("winInitMultiWindowWM - xcb_connect () returned and " "successfully opened the display.\n"); /* Create some atoms */ pWMInfo->atmWmProtos = intern_atom(pWMInfo->conn, "WM_PROTOCOLS"); pWMInfo->atmWmDelete = intern_atom(pWMInfo->conn, "WM_DELETE_WINDOW"); pWMInfo->atmWmTakeFocus = intern_atom(pWMInfo->conn, "WM_TAKE_FOCUS"); pWMInfo->atmPrivMap = intern_atom(pWMInfo->conn, WINDOWSWM_NATIVE_HWND); pWMInfo->atmUtf8String = intern_atom(pWMInfo->conn, "UTF8_STRING"); pWMInfo->atmNetWmName = intern_atom(pWMInfo->conn, "_NET_WM_NAME"); /* Initialization for the xcb_ewmh and EWMH atoms */ { xcb_intern_atom_cookie_t *atoms_cookie; atoms_cookie = xcb_ewmh_init_atoms(pWMInfo->conn, &pWMInfo->ewmh); if (xcb_ewmh_init_atoms_replies(&pWMInfo->ewmh, atoms_cookie, NULL)) { /* Set the _NET_SUPPORTED atom for this context. TODO: Audit to ensure we implement everything defined as MUSTs for window managers in the EWMH standard.*/ xcb_atom_t supported[] = { pWMInfo->ewmh.WM_PROTOCOLS, pWMInfo->ewmh._NET_SUPPORTED, pWMInfo->ewmh._NET_SUPPORTING_WM_CHECK, pWMInfo->ewmh._NET_CLOSE_WINDOW, pWMInfo->ewmh._NET_WM_WINDOW_TYPE, pWMInfo->ewmh._NET_WM_WINDOW_TYPE_DOCK, pWMInfo->ewmh._NET_WM_WINDOW_TYPE_SPLASH, pWMInfo->ewmh._NET_WM_STATE, pWMInfo->ewmh._NET_WM_STATE_HIDDEN, pWMInfo->ewmh._NET_WM_STATE_ABOVE, pWMInfo->ewmh._NET_WM_STATE_BELOW, pWMInfo->ewmh._NET_WM_STATE_SKIP_TASKBAR, }; xcb_ewmh_set_supported(&pWMInfo->ewmh, pProcArg->dwScreen, ARRAY_SIZE(supported), supported); } else { ErrorF("winInitMultiWindowWM - xcb_ewmh_init_atoms() failed\n"); } } /* Set the root window cursor to left_ptr (this controls the cursor an application gets over it's windows when it doesn't set one) */ { #define XC_left_ptr 68 xcb_cursor_t cursor = xcb_generate_id(pWMInfo->conn); xcb_font_t font = xcb_generate_id(pWMInfo->conn); xcb_font_t *mask_font = &font; /* An alias to clarify */ int shape = XC_left_ptr; uint32_t mask = XCB_CW_CURSOR; uint32_t value_list = cursor; xcb_screen_t *root_screen = xcb_aux_get_screen(pWMInfo->conn, pProcArg->dwScreen); xcb_window_t window = root_screen->root; static const uint16_t fgred = 0, fggreen = 0, fgblue = 0; static const uint16_t bgred = 0xFFFF, bggreen = 0xFFFF, bgblue = 0xFFFF; xcb_open_font(pWMInfo->conn, font, sizeof("cursor"), "cursor"); xcb_create_glyph_cursor(pWMInfo->conn, cursor, font, *mask_font, shape, shape + 1, fgred, fggreen, fgblue, bgred, bggreen, bgblue); xcb_change_window_attributes(pWMInfo->conn, window, mask, &value_list); xcb_free_cursor(pWMInfo->conn, cursor); xcb_close_font(pWMInfo->conn, font); } } /* * winSendMessageToWM - Send a message from the X thread to the WM thread */ void winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg) { WMMsgNodePtr pNode; #if CYGMULTIWINDOW_DEBUG ErrorF("winSendMessageToWM %s\n", MessageName(pMsg)); #endif pNode = malloc(sizeof(WMMsgNodeRec)); if (pNode != NULL) { memcpy(&pNode->msg, pMsg, sizeof(winWMMessageRec)); PushMessage(&((WMInfoPtr) pWMInfo)->wmMsgQueue, pNode); } } /* * Check if another window manager is running */ static Bool CheckAnotherWindowManager(xcb_connection_t *conn, DWORD dwScreen) { Bool redirectError = FALSE; /* Get root window id */ xcb_screen_t *root_screen = xcb_aux_get_screen(conn, dwScreen); xcb_window_t root_window_id = root_screen->root; /* Try to select the events which only one client at a time is allowed to select. If this causes an error, another window manager is already running... */ const static uint32_t test_mask[] = { XCB_EVENT_MASK_RESIZE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_BUTTON_PRESS }; xcb_void_cookie_t cookie = xcb_change_window_attributes_checked(conn, root_window_id, XCB_CW_EVENT_MASK, test_mask); xcb_generic_error_t *error; if ((error = xcb_request_check(conn, cookie))) { redirectError = TRUE; free(error); } /* Side effect: select the events we are actually interested in... Other WMs are not allowed, also select one of the events which only one client at a time is allowed to select, so other window managers won't start... */ { const uint32_t mask[] = { XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_BUTTON_PRESS }; xcb_change_window_attributes(conn, root_window_id, XCB_CW_EVENT_MASK, mask); } return redirectError; } /* * Notify the MWM thread we're exiting and not to reconnect */ void winDeinitMultiWindowWM(void) { ErrorF("winDeinitMultiWindowWM - Noting shutdown in progress\n"); g_shutdown = TRUE; } /* Windows window styles */ #define HINT_NOFRAME (1L<<0) #define HINT_BORDER (1L<<1) #define HINT_SIZEBOX (1L<<2) #define HINT_CAPTION (1L<<3) #define HINT_NOMAXIMIZE (1L<<4) #define HINT_NOMINIMIZE (1L<<5) #define HINT_NOSYSMENU (1L<<6) #define HINT_SKIPTASKBAR (1L<<7) /* These two are used on their own */ #define HINT_MAX (1L<<0) #define HINT_MIN (1L<<1) static void winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle) { xcb_connection_t *conn = pWMInfo->conn; static xcb_atom_t windowState, motif_wm_hints; static xcb_atom_t hiddenState, fullscreenState, belowState, aboveState, skiptaskbarState; static xcb_atom_t splashType; static int generation; unsigned long hint = 0, maxmin = 0; unsigned long style, exStyle; if (!hWnd) return; if (!IsWindow(hWnd)) return; if (generation != serverGeneration) { generation = serverGeneration; windowState = intern_atom(conn, "_NET_WM_STATE"); motif_wm_hints = intern_atom(conn, "_MOTIF_WM_HINTS"); hiddenState = intern_atom(conn, "_NET_WM_STATE_HIDDEN"); fullscreenState = intern_atom(conn, "_NET_WM_STATE_FULLSCREEN"); belowState = intern_atom(conn, "_NET_WM_STATE_BELOW"); aboveState = intern_atom(conn, "_NET_WM_STATE_ABOVE"); skiptaskbarState = intern_atom(conn, "_NET_WM_STATE_SKIP_TASKBAR"); splashType = intern_atom(conn, "_NET_WM_WINDOW_TYPE_SPLASHSCREEN"); } { xcb_get_property_cookie_t cookie_wm_state = xcb_get_property(conn, FALSE, iWindow, windowState, XCB_ATOM_ATOM, 0L, INT_MAX); xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, cookie_wm_state, NULL); if (reply) { int i; int nitems = xcb_get_property_value_length(reply)/sizeof(xcb_atom_t); xcb_atom_t *pAtom = xcb_get_property_value(reply); for (i = 0; i < nitems; i++) { if (pAtom[i] == skiptaskbarState) hint |= HINT_SKIPTASKBAR; if (pAtom[i] == hiddenState) maxmin |= HINT_MIN; else if (pAtom[i] == fullscreenState) maxmin |= HINT_MAX; if (pAtom[i] == belowState) *zstyle = HWND_BOTTOM; else if (pAtom[i] == aboveState) *zstyle = HWND_TOPMOST; } free(reply); } } { xcb_get_property_cookie_t cookie_mwm_hint = xcb_get_property(conn, FALSE, iWindow, motif_wm_hints, motif_wm_hints, 0L, sizeof(MwmHints)); xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, cookie_mwm_hint, NULL); if (reply) { int nitems = xcb_get_property_value_length(reply)/4; MwmHints *mwm_hint = xcb_get_property_value(reply); if (mwm_hint && (nitems >= PropMwmHintsElements) && (mwm_hint->flags & MwmHintsDecorations)) { if (!mwm_hint->decorations) hint |= (HINT_NOFRAME | HINT_NOSYSMENU | HINT_NOMINIMIZE | HINT_NOMAXIMIZE); else if (!(mwm_hint->decorations & MwmDecorAll)) { if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER; if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX; if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION; if (!(mwm_hint->decorations & MwmDecorMenu)) hint |= HINT_NOSYSMENU; if (!(mwm_hint->decorations & MwmDecorMinimize)) hint |= HINT_NOMINIMIZE; if (!(mwm_hint->decorations & MwmDecorMaximize)) hint |= HINT_NOMAXIMIZE; } else { /* MwmDecorAll means all decorations *except* those specified by other flag bits that are set. Not yet implemented. */ } } free(reply); } } { int i; xcb_ewmh_get_atoms_reply_t type; xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_window_type(&pWMInfo->ewmh, iWindow); if (xcb_ewmh_get_wm_window_type_reply(&pWMInfo->ewmh, cookie, &type, NULL)) { for (i = 0; i < type.atoms_len; i++) { if (type.atoms[i] == pWMInfo->ewmh._NET_WM_WINDOW_TYPE_DOCK) { hint = (hint & ~HINT_NOFRAME) | HINT_SKIPTASKBAR | HINT_SIZEBOX; *zstyle = HWND_TOPMOST; } else if ((type.atoms[i] == pWMInfo->ewmh._NET_WM_WINDOW_TYPE_SPLASH) || (type.atoms[i] == splashType)) { hint |= (HINT_SKIPTASKBAR | HINT_NOSYSMENU | HINT_NOMINIMIZE | HINT_NOMAXIMIZE); *zstyle = HWND_TOPMOST; } } } } { xcb_size_hints_t size_hints; xcb_get_property_cookie_t cookie; cookie = xcb_icccm_get_wm_normal_hints(conn, iWindow); if (xcb_icccm_get_wm_normal_hints_reply(conn, cookie, &size_hints, NULL)) { if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) { /* Not maximizable if a maximum size is specified, and that size is smaller (in either dimension) than the screen size */ if ((size_hints.max_width < GetSystemMetrics(SM_CXVIRTUALSCREEN)) || (size_hints.max_height < GetSystemMetrics(SM_CYVIRTUALSCREEN))) hint |= HINT_NOMAXIMIZE; if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) { /* If both minimum size and maximum size are specified and are the same, don't bother with a resizing frame */ if ((size_hints.min_width == size_hints.max_width) && (size_hints.min_height == size_hints.max_height)) hint = (hint & ~HINT_SIZEBOX); } } } } /* Override hint settings from above with settings from config file and set application id for grouping. */ { char *application_id = 0; char *window_name = 0; char *res_name = 0; char *res_class = 0; GetClassNames(pWMInfo, iWindow, &res_name, &res_class, &window_name); style = STYLE_NONE; style = winOverrideStyle(res_name, res_class, window_name); #define APPLICATION_ID_FORMAT "%s.xwin.%s" #define APPLICATION_ID_UNKNOWN "unknown" if (res_class) { asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, res_class); } else { asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN); } winSetAppUserModelID(hWnd, application_id); free(application_id); free(res_name); free(res_class); free(window_name); } if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST; else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX; else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN; else if (style & STYLE_BOTTOM) *zstyle = HWND_BOTTOM; if (maxmin & HINT_MAX) SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); else if (maxmin & HINT_MIN) SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); if (style & STYLE_NOTITLE) hint = (hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) | HINT_SIZEBOX; else if (style & STYLE_OUTLINE) hint = (hint & ~HINT_NOFRAME & ~HINT_SIZEBOX & ~HINT_CAPTION) | HINT_BORDER; else if (style & STYLE_NOFRAME) hint = (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME; /* Now apply styles to window */ style = GetWindowLongPtr(hWnd, GWL_STYLE); if (!style) return; /* GetWindowLongPointer returns 0 on failure, we hope this isn't a valid style */ style &= ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ if (!(hint & ~HINT_SKIPTASKBAR)) /* No hints, default */ style = style | WS_CAPTION | WS_SIZEBOX; else if (hint & HINT_NOFRAME) /* No frame, no decorations */ style = style & ~WS_CAPTION & ~WS_SIZEBOX; else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) | ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) | ((hint & HINT_CAPTION) ? WS_CAPTION : 0); if (hint & HINT_NOMAXIMIZE) style = style & ~WS_MAXIMIZEBOX; if (hint & HINT_NOMINIMIZE) style = style & ~WS_MINIMIZEBOX; if (hint & HINT_NOSYSMENU) style = style & ~WS_SYSMENU; if (hint & HINT_SKIPTASKBAR) style = style & ~WS_MINIMIZEBOX; /* window will become lost if minimized */ SetWindowLongPtr(hWnd, GWL_STYLE, style); exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE); if (hint & HINT_SKIPTASKBAR) exStyle = (exStyle & ~WS_EX_APPWINDOW) | WS_EX_TOOLWINDOW; else exStyle = (exStyle & ~WS_EX_TOOLWINDOW) | WS_EX_APPWINDOW; SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle); winDebug ("winApplyHints: iWindow 0x%08x hints 0x%08x style 0x%08x exstyle 0x%08x\n", iWindow, hint, style, exStyle); } void winUpdateWindowPosition(HWND hWnd, HWND * zstyle) { int iX, iY, iWidth, iHeight; int iDx, iDy; RECT rcNew; WindowPtr pWin = GetProp(hWnd, WIN_WINDOW_PROP); DrawablePtr pDraw = NULL; if (!pWin) return; pDraw = &pWin->drawable; if (!pDraw) return; /* Get the X and Y location of the X window */ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN); iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN); /* Get the height and width of the X window */ iWidth = pWin->drawable.width; iHeight = pWin->drawable.height; /* Setup a rectangle with the X window position and size */ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight); winDebug("winUpdateWindowPosition - drawable extent (%d, %d)-(%d, %d)\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom); AdjustWindowRectEx(&rcNew, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, GetWindowLongPtr(hWnd, GWL_EXSTYLE)); /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */ if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) { iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left; rcNew.left += iDx; rcNew.right += iDx; } if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) { iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top; rcNew.top += iDy; rcNew.bottom += iDy; } winDebug("winUpdateWindowPosition - Window extent (%d, %d)-(%d, %d)\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom); /* Position the Windows window */ SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0); } xorg-server-1.20.8/hw/xwin/winprefs.c0000644000175000017500000005375613640201473014432 00000000000000/* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * Copyright (C) Colin Harrison 2005-2008 * * 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. * * Authors: Earle F. Philhower, III * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include #ifdef __CYGWIN__ #include #endif #include "win.h" #include #include #include "winprefs.h" #include "windisplay.h" #include "winmultiwindowclass.h" #include "winmultiwindowicons.h" /* Where will the custom menu commands start counting from? */ #define STARTMENUID WM_USER extern const char *winGetBaseDir(void); /* From winprefslex.l, the real parser */ extern int parse_file(FILE * fp); /* Currently in use command ID, incremented each new menu item created */ static int g_cmdid = STARTMENUID; /* Local function to handle comma-ified icon names */ static HICON LoadImageComma(char *fname, int sx, int sy, int flags); /* * Creates or appends a menu from a MENUPARSED structure */ static HMENU MakeMenu(char *name, HMENU editMenu, int editItem) { int i; int item; MENUPARSED *m; HMENU hmenu, hsub; for (i = 0; i < pref.menuItems; i++) { if (!strcmp(name, pref.menu[i].menuName)) break; } /* Didn't find a match, bummer */ if (i == pref.menuItems) { ErrorF("MakeMenu: Can't find menu %s\n", name); return NULL; } m = &(pref.menu[i]); if (editMenu) { hmenu = editMenu; item = editItem; } else { hmenu = CreatePopupMenu(); if (!hmenu) { ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name); return NULL; } item = 0; } /* Add the menu items */ for (i = 0; i < m->menuItems; i++) { /* Only assign IDs one time... */ if (m->menuItem[i].commandID == 0) m->menuItem[i].commandID = g_cmdid++; switch (m->menuItem[i].cmd) { case CMD_EXEC: case CMD_ALWAYSONTOP: case CMD_RELOAD: InsertMenu(hmenu, item, MF_BYPOSITION | MF_ENABLED | MF_STRING, m->menuItem[i].commandID, m->menuItem[i].text); break; case CMD_SEPARATOR: InsertMenu(hmenu, item, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); break; case CMD_MENU: /* Recursive! */ hsub = MakeMenu(m->menuItem[i].param, 0, 0); if (hsub) InsertMenu(hmenu, item, MF_BYPOSITION | MF_POPUP | MF_ENABLED | MF_STRING, (UINT_PTR) hsub, m->menuItem[i].text); break; } /* If item==-1 (means to add at end of menu) don't increment) */ if (item >= 0) item++; } return hmenu; } /* * Callback routine that is executed once per window class. * Removes or creates custom window settings depending on LPARAM */ static wBOOL CALLBACK ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam) { HICON hicon; if (!hwnd) { ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n"); return FALSE; } /* It's our baby, either clean or dirty it */ if (lParam == FALSE) { /* Reset the window's icon to undefined. */ hicon = (HICON) SendMessage(hwnd, WM_SETICON, ICON_BIG, 0); /* If the old icon is generated on-the-fly, get rid of it, will regen */ winDestroyIcon(hicon); /* Same for the small icon */ hicon = (HICON) SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0); winDestroyIcon(hicon); /* Remove any menu additions; bRevert=TRUE destroys any modified menus */ GetSystemMenu(hwnd, TRUE); /* This window is now clean of our taint (but with undefined icons) */ } else { /* Send a message to WM thread telling it re-evaluate the icon for this window */ { winWMMessageRec wmMsg; WindowPtr pWin = GetProp(hwnd, WIN_WINDOW_PROP); if (pWin) { winPrivWinPtr pWinPriv = winGetWindowPriv(pWin); winPrivScreenPtr s_pScreenPriv = pWinPriv->pScreenPriv; wmMsg.msg = WM_WM_ICON_EVENT; wmMsg.hwndWindow = hwnd; wmMsg.iWindow = (Window) (INT_PTR) GetProp(hwnd, WIN_WID_PROP); winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); } } /* Update the system menu for this window */ SetupSysMenu(hwnd); /* That was easy... */ } return TRUE; } /* * Removes any custom icons in classes, custom menus, etc. * Frees all members in pref structure. * Reloads the preferences file. * Set custom icons and menus again. */ static void ReloadPrefs(winPrivScreenPtr pScreenPriv) { int i; winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* First, iterate over all windows, deleting their icons and custom menus. * This is really only needed because winDestroyIcon() will try to * destroy the old global icons, which will have changed. * It is probably better to set a windows USER_DATA to flag locally defined * icons, and use that to accurately know when to destroy old icons. */ if (pScreenInfo->fMultiWindow) EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE); /* Now, free/clear all info from our prefs structure */ for (i = 0; i < pref.menuItems; i++) free(pref.menu[i].menuItem); free(pref.menu); pref.menu = NULL; pref.menuItems = 0; pref.rootMenuName[0] = 0; free(pref.sysMenu); pref.sysMenuItems = 0; pref.defaultSysMenuName[0] = 0; pref.defaultSysMenuPos = 0; pref.iconDirectory[0] = 0; pref.defaultIconName[0] = 0; pref.trayIconName[0] = 0; for (i = 0; i < pref.iconItems; i++) if (pref.icon[i].hicon) DestroyIcon((HICON) pref.icon[i].hicon); free(pref.icon); pref.icon = NULL; pref.iconItems = 0; /* Free global default X icon */ if (g_hIconX) DestroyIcon(g_hIconX); if (g_hSmallIconX) DestroyIcon(g_hSmallIconX); /* Reset the custom command IDs */ g_cmdid = STARTMENUID; /* Load the updated resource file */ LoadPreferences(); g_hIconX = NULL; g_hSmallIconX = NULL; if (pScreenInfo->fMultiWindow) { winInitGlobalIcons(); /* Rebuild the icons and menus */ EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE); } /* Whew, done */ } /* * Check/uncheck the ALWAYSONTOP items in this menu */ void HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu) { DWORD dwExStyle; int i, j; if (!hwnd || !hmenu) return; if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) dwExStyle = MF_BYCOMMAND | MF_CHECKED; else dwExStyle = MF_BYCOMMAND | MF_UNCHECKED; for (i = 0; i < pref.menuItems; i++) for (j = 0; j < pref.menu[i].menuItems; j++) if (pref.menu[i].menuItem[j].cmd == CMD_ALWAYSONTOP) CheckMenuItem(hmenu, pref.menu[i].menuItem[j].commandID, dwExStyle); } /* * Searches for the custom WM_COMMAND command ID and performs action. * Return TRUE if command is proccessed, FALSE otherwise. */ Bool HandleCustomWM_COMMAND(HWND hwnd, WORD command, winPrivScreenPtr pScreenPriv) { int i, j; MENUPARSED *m; DWORD dwExStyle; if (!command) return FALSE; for (i = 0; i < pref.menuItems; i++) { m = &(pref.menu[i]); for (j = 0; j < m->menuItems; j++) { if (command == m->menuItem[j].commandID) { /* Match! */ switch (m->menuItem[j].cmd) { #ifdef __CYGWIN__ case CMD_EXEC: if (fork() == 0) { struct rlimit rl; int fd; /* Close any open descriptors except for STD* */ getrlimit(RLIMIT_NOFILE, &rl); for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++) close(fd); /* Disassociate any TTYs */ setsid(); execl("/bin/sh", "/bin/sh", "-c", m->menuItem[j].param, NULL); exit(0); } else return TRUE; break; #else case CMD_EXEC: { /* Start process without console window */ STARTUPINFO start; PROCESS_INFORMATION child; memset(&start, 0, sizeof(start)); start.cb = sizeof(start); start.dwFlags = STARTF_USESHOWWINDOW; start.wShowWindow = SW_HIDE; memset(&child, 0, sizeof(child)); if (CreateProcess (NULL, m->menuItem[j].param, NULL, NULL, FALSE, 0, NULL, NULL, &start, &child)) { CloseHandle(child.hThread); CloseHandle(child.hProcess); } else MessageBox(NULL, m->menuItem[j].param, "Mingrc Exec Command Error!", MB_OK | MB_ICONEXCLAMATION); } return TRUE; #endif case CMD_ALWAYSONTOP: if (!hwnd) return FALSE; /* Get extended window style */ dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE); /* Handle topmost windows */ if (dwExStyle & WS_EX_TOPMOST) SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); else SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); { winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; if (pScreenInfo->fMultiWindow) /* Reflect the changed Z order */ winReorderWindowsMultiWindow(); } return TRUE; case CMD_RELOAD: ReloadPrefs(pScreenPriv); return TRUE; default: return FALSE; } } /* match */ } /* for j */ } /* for i */ return FALSE; } /* * Add the default or a custom menu depending on the class match */ void SetupSysMenu(HWND hwnd) { HMENU sys; int i; WindowPtr pWin; char *res_name, *res_class; if (!hwnd) return; pWin = GetProp(hwnd, WIN_WINDOW_PROP); sys = GetSystemMenu(hwnd, FALSE); if (!sys) return; if (pWin) { /* First see if there's a class match... */ if (winMultiWindowGetClassHint(pWin, &res_name, &res_class)) { for (i = 0; i < pref.sysMenuItems; i++) { if (!strcmp(pref.sysMenu[i].match, res_name) || !strcmp(pref.sysMenu[i].match, res_class)) { free(res_name); free(res_class); MakeMenu(pref.sysMenu[i].menuName, sys, pref.sysMenu[i].menuPos == AT_START ? 0 : -1); return; } } /* No match, just free alloc'd strings */ free(res_name); free(res_class); } /* Found wm_class */ } /* if pwin */ /* Fallback to system default */ if (pref.defaultSysMenuName[0]) { if (pref.defaultSysMenuPos == AT_START) MakeMenu(pref.defaultSysMenuName, sys, 0); else MakeMenu(pref.defaultSysMenuName, sys, -1); } } /* * Possibly add a menu to the toolbar icon */ void SetupRootMenu(HMENU root) { if (!root) return; if (pref.rootMenuName[0]) { MakeMenu(pref.rootMenuName, root, 0); } } /* * Check for and return an overridden default ICON specified in the prefs */ HICON winOverrideDefaultIcon(int size) { HICON hicon; if (pref.defaultIconName[0]) { hicon = LoadImageComma(pref.defaultIconName, size, size, 0); if (hicon == NULL) ErrorF("winOverrideDefaultIcon: LoadImageComma(%s) failed\n", pref.defaultIconName); return hicon; } return 0; } /* * Return the HICON to use in the taskbar notification area */ HICON winTaskbarIcon(void) { HICON hicon; hicon = 0; /* First try and load an overridden, if success then return it */ if (pref.trayIconName[0]) { hicon = LoadImageComma(pref.trayIconName, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); } /* Otherwise return the default */ if (!hicon) hicon = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); return hicon; } /* * Parse a filename to extract an icon: * If fname is exactly ",nnn" then extract icon from our resource * else if it is "file,nnn" then extract icon nnn from that file * else try to load it as an .ico file and if that fails return NULL */ static HICON LoadImageComma(char *fname, int sx, int sy, int flags) { HICON hicon; int i; char file[PATH_MAX + NAME_MAX + 2]; /* Some input error checking */ if (!fname || !fname[0]) return NULL; i = 0; hicon = NULL; if (fname[0] == ',') { /* It's the XWIN.EXE resource they want */ i = atoi(fname + 1); hicon = LoadImage(g_hInstance, MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags); } else { file[0] = 0; /* Prepend path if not given a "X:\" filename */ if (!(fname[0] && fname[1] == ':' && fname[2] == '\\')) { strcpy(file, pref.iconDirectory); if (pref.iconDirectory[0]) if (fname[strlen(fname) - 1] != '\\') strcat(file, "\\"); } strcat(file, fname); if (strrchr(file, ',')) { /* Specified as , */ *(strrchr(file, ',')) = 0; /* End string at comma */ i = atoi(strrchr(fname, ',') + 1); hicon = ExtractIcon(g_hInstance, file, i); } else { /* Just an .ico file... */ hicon = (HICON) LoadImage(NULL, file, IMAGE_ICON, sx, sy, LR_LOADFROMFILE | flags); } } return hicon; } /* * Check for a match of the window class to one specified in the * ICONS{} section in the prefs file, and load the icon from a file */ HICON winOverrideIcon(char *res_name, char *res_class, char *wmName) { int i; HICON hicon; for (i = 0; i < pref.iconItems; i++) { if ((res_name && !strcmp(pref.icon[i].match, res_name)) || (res_class && !strcmp(pref.icon[i].match, res_class)) || (wmName && strstr(wmName, pref.icon[i].match))) { if (pref.icon[i].hicon) return pref.icon[i].hicon; hicon = LoadImageComma(pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE); if (hicon == NULL) ErrorF("winOverrideIcon: LoadImageComma(%s) failed\n", pref.icon[i].iconFile); pref.icon[i].hicon = hicon; return hicon; } } /* Didn't find the icon, fail gracefully */ return 0; } /* * Should we free this icon or leave it in memory (is it part of our * ICONS{} overrides)? */ int winIconIsOverride(HICON hicon) { int i; if (!hicon) return 0; for (i = 0; i < pref.iconItems; i++) if ((HICON) pref.icon[i].hicon == hicon) return 1; return 0; } /* * Open and parse the XWinrc config file @path. * If @path is NULL, use the built-in default. */ static int winPrefsLoadPreferences(const char *path) { FILE *prefFile = NULL; if (path) prefFile = fopen(path, "r"); #ifdef __CYGWIN__ else { char defaultPrefs[] = "MENU rmenu {\n" " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n" " \"Launch xterm\" EXEC xterm\n" " \"Load .XWinrc\" RELOAD\n" " SEPARATOR\n" "}\n" "\n" "ROOTMENU rmenu\n"; path = "built-in default"; prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r"); } #endif if (!prefFile) { ErrorF("LoadPreferences: %s not found\n", path); return FALSE; } ErrorF("LoadPreferences: Loading %s\n", path); if ((parse_file(prefFile)) != 0) { ErrorF("LoadPreferences: %s is badly formed!\n", path); fclose(prefFile); return FALSE; } fclose(prefFile); return TRUE; } /* * Try and open ~/.XWinrc and system.XWinrc * Load it into prefs structure for use by other functions */ void LoadPreferences(void) { char *home; char fname[PATH_MAX + NAME_MAX + 2]; char szDisplay[512]; char *szEnvDisplay; int i, j; char param[PARAM_MAX + 1]; char *srcParam, *dstParam; int parsed = FALSE; /* First, clear all preference settings */ memset(&pref, 0, sizeof(pref)); /* Now try and find a ~/.xwinrc file */ home = getenv("HOME"); if (home) { strcpy(fname, home); if (fname[strlen(fname) - 1] != '/') strcat(fname, "/"); strcat(fname, ".XWinrc"); parsed = winPrefsLoadPreferences(fname); } /* No home file found, check system default */ if (!parsed) { char buffer[MAX_PATH]; #ifdef RELOCATE_PROJECTROOT snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir()); #else strncpy(buffer, SYSCONFDIR "/X11/system.XWinrc", sizeof(buffer)); #endif buffer[sizeof(buffer) - 1] = 0; parsed = winPrefsLoadPreferences(buffer); } /* Neither user nor system configuration found, or were badly formed */ if (!parsed) { ErrorF ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n"); parsed = winPrefsLoadPreferences(NULL); } /* Setup a DISPLAY environment variable, need to allocate on heap */ /* because putenv doesn't copy the argument... */ winGetDisplayName(szDisplay, 0); szEnvDisplay = (char *) (malloc(strlen(szDisplay) + strlen("DISPLAY=") + 1)); if (szEnvDisplay) { snprintf(szEnvDisplay, 512, "DISPLAY=%s", szDisplay); putenv(szEnvDisplay); } /* Replace any "%display%" in menu commands with display string */ for (i = 0; i < pref.menuItems; i++) { for (j = 0; j < pref.menu[i].menuItems; j++) { if (pref.menu[i].menuItem[j].cmd == CMD_EXEC) { srcParam = pref.menu[i].menuItem[j].param; dstParam = param; while (*srcParam) { if (!strncmp(srcParam, "%display%", 9)) { memcpy(dstParam, szDisplay, strlen(szDisplay)); dstParam += strlen(szDisplay); srcParam += 9; } else { *dstParam = *srcParam; dstParam++; srcParam++; } } *dstParam = 0; strcpy(pref.menu[i].menuItem[j].param, param); } /* cmd==cmd_exec */ } /* for all menuitems */ } /* for all menus */ } /* * Check for a match of the window class to one specified in the * STYLES{} section in the prefs file, and return the style type */ unsigned long winOverrideStyle(char *res_name, char *res_class, char *wmName) { int i; for (i = 0; i < pref.styleItems; i++) { if ((res_name && !strcmp(pref.style[i].match, res_name)) || (res_class && !strcmp(pref.style[i].match, res_class)) || (wmName && strstr(wmName, pref.style[i].match))) { if (pref.style[i].type) return pref.style[i].type; } } /* Didn't find the style, fail gracefully */ return STYLE_NONE; } xorg-server-1.20.8/hw/xwin/winmisc.c0000644000175000017500000000516313640201473014233 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * Count the number of one bits in a color mask. */ CARD8 winCountBits(DWORD dw) { DWORD dwBits = 0; while (dw) { dwBits += (dw & 1); dw >>= 1; } return dwBits; } /* * Modify the screen pixmap to point to the new framebuffer address */ Bool winUpdateFBPointer(ScreenPtr pScreen, void *pbits) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Location of shadow framebuffer has changed */ pScreenInfo->pfb = pbits; /* Update the screen pixmap */ if (!(*pScreen->ModifyPixmapHeader) (pScreen->devPrivate, pScreen->width, pScreen->height, pScreen->rootDepth, BitsPerPixel(pScreen->rootDepth), PixmapBytePad(pScreenInfo->dwStride, pScreenInfo->dwBPP), pScreenInfo->pfb)) { FatalError("winUpdateFramebufferPointer - Failed modifying " "screen pixmap\n"); } return TRUE; } xorg-server-1.20.8/hw/xwin/winkeynames.h0000644000175000017500000002620313640201473015117 00000000000000#ifndef _WINKEYNAMES_H #define _WINKEYNAMES_H /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * 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 Thomas Roell not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Thomas Roell makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THOMAS ROELL 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. * */ #define GLYPHS_PER_KEY 4 #define NUM_KEYCODES 248 #define MIN_KEYCODE 8 #define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) #define AltMask Mod1Mask #define NumLockMask Mod2Mask #define AltLangMask Mod3Mask #define KanaMask Mod4Mask #define ScrollLockMask Mod5Mask #define ModifierDown(k) ((keyc->state & (k)) == (k)) /* * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) * sets of scancodes. Set3 can only be generated by a MF keyboard. * Set2 sends a makecode for keypress, and the same code prefixed by a * F0 for keyrelease. This is a little bit ugly to handle. Thus we use * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. * Bit 7 ist set if the key is released. The code E0 switches to a * different meaning to add the new MF cursorkeys, while not breaking old * applications. E1 is another special prefix. Since I assume that there * will be further versions of PC/XT scancode compatible keyboards, we * may be in trouble one day. * * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. * 2) Use the keyboards native set and translate it to common keysyms. */ /* * definition of the AT84/MF101/MF102 Keyboard: * ============================================================ * Defined Key Cap Glyphs Pressed value * Key Name Main Also (hex) (dec) * ---------------- ---------- ------- ------ ------ */ #define KEY_Escape /* Escape 0x01 */ 1 #define KEY_1 /* 1 ! 0x02 */ 2 #define KEY_2 /* 2 @ 0x03 */ 3 #define KEY_3 /* 3 # 0x04 */ 4 #define KEY_4 /* 4 $ 0x05 */ 5 #define KEY_5 /* 5 % 0x06 */ 6 #define KEY_6 /* 6 ^ 0x07 */ 7 #define KEY_7 /* 7 & 0x08 */ 8 #define KEY_8 /* 8 * 0x09 */ 9 #define KEY_9 /* 9 ( 0x0a */ 10 #define KEY_0 /* 0 ) 0x0b */ 11 #define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 #define KEY_Equal /* = (Equal) + 0x0d */ 13 #define KEY_BackSpace /* Back Space 0x0e */ 14 #define KEY_Tab /* Tab 0x0f */ 15 #define KEY_Q /* Q 0x10 */ 16 #define KEY_W /* W 0x11 */ 17 #define KEY_E /* E 0x12 */ 18 #define KEY_R /* R 0x13 */ 19 #define KEY_T /* T 0x14 */ 20 #define KEY_Y /* Y 0x15 */ 21 #define KEY_U /* U 0x16 */ 22 #define KEY_I /* I 0x17 */ 23 #define KEY_O /* O 0x18 */ 24 #define KEY_P /* P 0x19 */ 25 #define KEY_LBrace /* [ { 0x1a */ 26 #define KEY_RBrace /* ] } 0x1b */ 27 #define KEY_Enter /* Enter 0x1c */ 28 #define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 #define KEY_A /* A 0x1e */ 30 #define KEY_S /* S 0x1f */ 31 #define KEY_D /* D 0x20 */ 32 #define KEY_F /* F 0x21 */ 33 #define KEY_G /* G 0x22 */ 34 #define KEY_H /* H 0x23 */ 35 #define KEY_J /* J 0x24 */ 36 #define KEY_K /* K 0x25 */ 37 #define KEY_L /* L 0x26 */ 38 #define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 #define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 #define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 #define KEY_ShiftL /* Shift(left) 0x2a */ 42 #define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 #define KEY_Z /* Z 0x2c */ 44 #define KEY_X /* X 0x2d */ 45 #define KEY_C /* C 0x2e */ 46 #define KEY_V /* V 0x2f */ 47 #define KEY_B /* B 0x30 */ 48 #define KEY_N /* N 0x31 */ 49 #define KEY_M /* M 0x32 */ 50 #define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 #define KEY_Period /* . (Period) >(Greater)0x34 */ 52 #define KEY_Slash /* / (Slash) ? 0x35 */ 53 #define KEY_ShiftR /* Shift(right) 0x36 */ 54 #define KEY_KP_Multiply /* * 0x37 */ 55 #define KEY_Alt /* Alt(left) 0x38 */ 56 #define KEY_Space /* (SpaceBar) 0x39 */ 57 #define KEY_CapsLock /* CapsLock 0x3a */ 58 #define KEY_F1 /* F1 0x3b */ 59 #define KEY_F2 /* F2 0x3c */ 60 #define KEY_F3 /* F3 0x3d */ 61 #define KEY_F4 /* F4 0x3e */ 62 #define KEY_F5 /* F5 0x3f */ 63 #define KEY_F6 /* F6 0x40 */ 64 #define KEY_F7 /* F7 0x41 */ 65 #define KEY_F8 /* F8 0x42 */ 66 #define KEY_F9 /* F9 0x43 */ 67 #define KEY_F10 /* F10 0x44 */ 68 #define KEY_NumLock /* NumLock 0x45 */ 69 #define KEY_ScrollLock /* ScrollLock 0x46 */ 70 #define KEY_KP_7 /* 7 Home 0x47 */ 71 #define KEY_KP_8 /* 8 Up 0x48 */ 72 #define KEY_KP_9 /* 9 PgUp 0x49 */ 73 #define KEY_KP_Minus /* - (Minus) 0x4a */ 74 #define KEY_KP_4 /* 4 Left 0x4b */ 75 #define KEY_KP_5 /* 5 0x4c */ 76 #define KEY_KP_6 /* 6 Right 0x4d */ 77 #define KEY_KP_Plus /* + (Plus) 0x4e */ 78 #define KEY_KP_1 /* 1 End 0x4f */ 79 #define KEY_KP_2 /* 2 Down 0x50 */ 80 #define KEY_KP_3 /* 3 PgDown 0x51 */ 81 #define KEY_KP_0 /* 0 Insert 0x52 */ 82 #define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 #define KEY_SysReqest /* SysReqest 0x54 */ 84 #define KEY_Fn /* Fn 0x55 */ 85 #define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 #define KEY_F11 /* F11 0x57 */ 87 #define KEY_F12 /* F12 0x58 */ 88 #define KEY_Prefix0 /* special 0x60 */ 96 #define KEY_Prefix1 /* specail 0x61 */ 97 /* * The 'scancodes' below are generated by the server, because the MF101/102 * keyboard sends them as sequence of other scancodes */ #define KEY_Home /* Home 0x59 */ 89 #define KEY_Up /* Up 0x5a */ 90 #define KEY_PgUp /* PgUp 0x5b */ 91 #define KEY_Left /* Left 0x5c */ 92 #define KEY_Begin /* Begin 0x5d */ 93 #define KEY_Right /* Right 0x5e */ 94 #define KEY_End /* End 0x5f */ 95 #define KEY_Down /* Down 0x60 */ 96 #define KEY_PgDown /* PgDown 0x61 */ 97 #define KEY_Insert /* Insert 0x62 */ 98 #define KEY_Delete /* Delete 0x63 */ 99 #define KEY_KP_Enter /* Enter 0x64 */ 100 #define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 #define KEY_Pause /* Pause 0x66 */ 102 #define KEY_Print /* Print 0x67 */ 103 #define KEY_KP_Divide /* Divide 0x68 */ 104 #define KEY_AltLang /* AtlLang(right) 0x69 */ 105 #define KEY_Break /* Break 0x6a */ 106 #define KEY_LMeta /* Left Meta 0x6b */ 107 #define KEY_RMeta /* Right Meta 0x6c */ 108 #define KEY_Menu /* Menu 0x6d */ 109 #define KEY_F13 /* F13 0x6e */ 110 #define KEY_F14 /* F14 0x6f */ 111 #define KEY_F15 /* F15 0x70 */ 112 #define KEY_F16 /* F16 0x71 */ 113 #define KEY_F17 /* F17 0x72 */ 114 #define KEY_KP_DEC /* KP_DEC 0x73 */ 115 #define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 #define KEY_XFER /* Kanji Transfer 0x79 */ 121 #define KEY_NFER /* No Kanji Transfer 0x7b */ 123 #define KEY_Yen /* Yen 0x7d */ 125 #define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200 #define KEY_BSlash2 /* \ _ 0xcb */ 203 #define KEY_Mute /* Audio Mute */ 152 #define KEY_AudioLower /* Audio Lower */ 168 #define KEY_AudioRaise /* Audio Raise */ 166 #define KEY_NEXTSONG /* Media next */ 145 #define KEY_PLAYPAUSE /* Media play/pause toggle */ 154 #define KEY_PREVIOUSSONG /* Media previous */ 136 #define KEY_STOPCD /* Media stop */ 156 /* These are for "notused" and "unknown" entries in translation maps. */ #define KEY_NOTUSED 0 #define KEY_UNKNOWN 255 #endif /* _WINKEYNAMES_H */ xorg-server-1.20.8/hw/xwin/glx/0000755000175000017500000000000013640201535013262 500000000000000xorg-server-1.20.8/hw/xwin/glx/indirect.c0000644000175000017500000023256413640201473015164 00000000000000/* * File: indirect.c * Purpose: A GLX implementation that uses Windows OpenGL library * * Authors: Alexander Gottwald * Jon TURNEY * * Copyright (c) Jon TURNEY 2009 * Copyright (c) Alexander Gottwald 2004 * * Portions of this file are copied from GL/apple/indirect.c, * which contains the following copyright: * * Copyright (c) 2007, 2008, 2009 Apple Inc. * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. * Copyright (c) 2002 Greg Parker. All Rights Reserved. * * Portions of this file are copied from Mesa's xf86glx.c, * which contains the following copyright: * * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. * * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ /* TODO: - hook up remaining unimplemented extensions - research what guarantees glXWaitX, glXWaitGL are supposed to offer, and implement then using GdiFlush and/or glFinish - pbuffer clobbering: we don't get async notification, but can we arrange to emit the event when we notice it's been clobbered? at the very least, check if it's been clobbered before using it? - XGetImage() doesn't work on pixmaps; need to do more work to make the format and location of the native pixmap compatible - implement GLX_EXT_texture_from_pixmap in terms of WGL_ARB_render_texture (not quite straightforward as we will have to create a pbuffer and copy the pixmap texture into it) */ /* Assumptions: - the __GLXConfig * we get handed back ones we are made (so we can extend the structure with privates) and never get created inside the GLX core */ /* MSDN clarifications: It says SetPixelFormat()'s PIXELFORMATDESCRIPTOR pointer argument has no effect except on metafiles, this seems to mean that as it's ok to supply NULL if the DC is not for a metafile wglMakeCurrent ignores the hdc if hglrc is NULL, so wglMakeCurrent(NULL, NULL) is used to make no context current */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "glwindows.h" #include #include #include #include #include #include #include /* Not yet in w32api */ #ifndef PFD_SUPPORT_DIRECTDRAW #define PFD_SUPPORT_DIRECTDRAW 0x00002000 #endif #ifndef PFD_DIRECT3D_ACCELERATED #define PFD_DIRECT3D_ACCELERATED 0x00004000 #endif #ifndef PFD_SUPPORT_COMPOSITION #define PFD_SUPPORT_COMPOSITION 0x00008000 #endif /* ---------------------------------------------------------------------- */ /* * Various debug helpers */ #define GLWIN_DEBUG_HWND(hwnd) \ if (glxWinDebugSettings.dumpHWND) { \ char buffer[1024]; \ if (GetWindowText(hwnd, buffer, sizeof(buffer))==0) *buffer=0; \ GLWIN_DEBUG_MSG("Got HWND %p for window '%s'", hwnd, buffer); \ } glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0 }; static void glxWinInitDebugSettings(void) { char *envptr; envptr = getenv("GLWIN_ENABLE_DEBUG"); if (envptr != NULL) glxWinDebugSettings.enableDebug = (atoi(envptr) == 1); envptr = getenv("GLWIN_ENABLE_TRACE"); if (envptr != NULL) glxWinDebugSettings.enableTrace = (atoi(envptr) == 1); envptr = getenv("GLWIN_DUMP_PFD"); if (envptr != NULL) glxWinDebugSettings.dumpPFD = (atoi(envptr) == 1); envptr = getenv("GLWIN_DUMP_HWND"); if (envptr != NULL) glxWinDebugSettings.dumpHWND = (atoi(envptr) == 1); envptr = getenv("GLWIN_DUMP_DC"); if (envptr != NULL) glxWinDebugSettings.dumpDC = (atoi(envptr) == 1); envptr = getenv("GLWIN_ENABLE_GLCALL_TRACE"); if (envptr != NULL) glxWinDebugSettings.enableGLcallTrace = (atoi(envptr) == 1); envptr = getenv("GLWIN_ENABLE_WGLCALL_TRACE"); if (envptr != NULL) glxWinDebugSettings.enableWGLcallTrace = (atoi(envptr) == 1); envptr = getenv("GLWIN_DEBUG_ALL"); if (envptr != NULL) { glxWinDebugSettings.enableDebug = 1; glxWinDebugSettings.enableTrace = 1; glxWinDebugSettings.dumpPFD = 1; glxWinDebugSettings.dumpHWND = 1; glxWinDebugSettings.dumpDC = 1; glxWinDebugSettings.enableGLcallTrace = 1; glxWinDebugSettings.enableWGLcallTrace = 1; } } static const char * glxWinErrorMessage(void) { static char errorbuffer[1024]; unsigned int last_error = GetLastError(); if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, last_error, 0, (LPTSTR) &errorbuffer, sizeof(errorbuffer), NULL)) { snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error"); } if ((errorbuffer[strlen(errorbuffer) - 1] == '\n') || (errorbuffer[strlen(errorbuffer) - 1] == '\r')) errorbuffer[strlen(errorbuffer) - 1] = 0; sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error); return errorbuffer; } static void pfdOut(const PIXELFORMATDESCRIPTOR * pfd); #define DUMP_PFD_FLAG(flag) \ if (pfd->dwFlags & flag) { \ ErrorF("%s%s", pipesym, #flag); \ pipesym = " | "; \ } static void pfdOut(const PIXELFORMATDESCRIPTOR * pfd) { const char *pipesym = ""; /* will be set after first flag dump */ ErrorF("PIXELFORMATDESCRIPTOR:\n"); ErrorF("nSize = %u\n", pfd->nSize); ErrorF("nVersion = %u\n", pfd->nVersion); ErrorF("dwFlags = %u = {", (unsigned int)pfd->dwFlags); DUMP_PFD_FLAG(PFD_DOUBLEBUFFER); DUMP_PFD_FLAG(PFD_STEREO); DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW); DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP); DUMP_PFD_FLAG(PFD_SUPPORT_GDI); DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL); DUMP_PFD_FLAG(PFD_GENERIC_FORMAT); DUMP_PFD_FLAG(PFD_NEED_PALETTE); DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE); DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE); DUMP_PFD_FLAG(PFD_SWAP_COPY); DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS); DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED); DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW); DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED); DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION); DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE); DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE); DUMP_PFD_FLAG(PFD_STEREO_DONTCARE); ErrorF("}\n"); ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType, (pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX")); ErrorF("cColorBits = %hhu\n", pfd->cColorBits); ErrorF("cRedBits = %hhu\n", pfd->cRedBits); ErrorF("cRedShift = %hhu\n", pfd->cRedShift); ErrorF("cGreenBits = %hhu\n", pfd->cGreenBits); ErrorF("cGreenShift = %hhu\n", pfd->cGreenShift); ErrorF("cBlueBits = %hhu\n", pfd->cBlueBits); ErrorF("cBlueShift = %hhu\n", pfd->cBlueShift); ErrorF("cAlphaBits = %hhu\n", pfd->cAlphaBits); ErrorF("cAlphaShift = %hhu\n", pfd->cAlphaShift); ErrorF("cAccumBits = %hhu\n", pfd->cAccumBits); ErrorF("cAccumRedBits = %hhu\n", pfd->cAccumRedBits); ErrorF("cAccumGreenBits = %hhu\n", pfd->cAccumGreenBits); ErrorF("cAccumBlueBits = %hhu\n", pfd->cAccumBlueBits); ErrorF("cAccumAlphaBits = %hhu\n", pfd->cAccumAlphaBits); ErrorF("cDepthBits = %hhu\n", pfd->cDepthBits); ErrorF("cStencilBits = %hhu\n", pfd->cStencilBits); ErrorF("cAuxBuffers = %hhu\n", pfd->cAuxBuffers); ErrorF("iLayerType = %hhu\n", pfd->iLayerType); ErrorF("bReserved = %hhu\n", pfd->bReserved); ErrorF("dwLayerMask = %u\n", (unsigned int)pfd->dwLayerMask); ErrorF("dwVisibleMask = %u\n", (unsigned int)pfd->dwVisibleMask); ErrorF("dwDamageMask = %u\n", (unsigned int)pfd->dwDamageMask); ErrorF("\n"); } static const char * visual_class_name(int cls) { switch (cls) { case GLX_STATIC_COLOR: return "StaticColor"; case GLX_PSEUDO_COLOR: return "PseudoColor"; case GLX_STATIC_GRAY: return "StaticGray"; case GLX_GRAY_SCALE: return "GrayScale"; case GLX_TRUE_COLOR: return "TrueColor"; case GLX_DIRECT_COLOR: return "DirectColor"; default: return "-none-"; } } static const char * swap_method_name(int mthd) { switch (mthd) { case GLX_SWAP_EXCHANGE_OML: return "xchg"; case GLX_SWAP_COPY_OML: return "copy"; case GLX_SWAP_UNDEFINED_OML: return " "; default: return "????"; } } static void fbConfigsDump(unsigned int n, __GLXconfig * c) { LogMessage(X_INFO, "%d fbConfigs\n", n); if (g_iLogVerbose < 3) return; ErrorF("%d fbConfigs\n", n); ErrorF ("pxf vis fb render Ste aux accum MS drawable Group/\n"); ErrorF ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n"); ErrorF ("-----------------------------------------------------------------------------------------------------------------------------\n"); while (c != NULL) { unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex; ErrorF("%3d %3x %3x " "%-11s" " %3d %3d %s %s %s %s %s " "%2d %2d %2d %2d " "%2d %2d " "%2d " "%2d %2d %2d %2d" " %2d %2d" " %s %s %s " " %s " " %s " " %d %s" "\n", i, c->visualID, c->fbconfigID, visual_class_name(c->visualType), c->rgbBits ? c->rgbBits : c->indexBits, c->level, (c->renderType & GLX_RGBA_BIT) ? "y" : ".", (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".", c->doubleBufferMode ? "y" : ".", swap_method_name(c->swapMethod), c->stereoMode ? "y" : ".", c->redBits, c->greenBits, c->blueBits, c->alphaBits, c->depthBits, c->stencilBits, c->numAuxBuffers, c->accumRedBits, c->accumGreenBits, c->accumBlueBits, c->accumAlphaBits, c->sampleBuffers, c->samples, (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".", (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".", (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", (c->renderType & (GLX_RGBA_FLOAT_BIT_ARB | GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".", (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".", c->visualSelectGroup, (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " "); c = c->next; } } /* ---------------------------------------------------------------------- */ /* * Forward declarations */ static __GLXscreen *glxWinScreenProbe(ScreenPtr pScreen); static __GLXcontext *glxWinCreateContext(__GLXscreen * screen, __GLXconfig * modes, __GLXcontext * baseShareContext, unsigned num_attribs, const uint32_t * attribs, int *error); static __GLXdrawable *glxWinCreateDrawable(ClientPtr client, __GLXscreen * screen, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig * conf); static Bool glxWinRealizeWindow(WindowPtr pWin); static Bool glxWinUnrealizeWindow(WindowPtr pWin); static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); static Bool glxWinSetPixelFormat(HDC hdc, int bppOverride, int drawableTypeOverride, __GLXscreen *screen, __GLXconfig *config); static HDC glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw, HDC * hdc, HWND * hwnd); static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw); static void glxWinCreateConfigs(HDC dc, glxWinScreen * screen); static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen); static int fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret, int drawableTypeOverride); static int fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode, int drawableTypeOverride, glxWinScreen * winScreen); /* ---------------------------------------------------------------------- */ /* * The GLX provider */ __GLXprovider __glXWGLProvider = { glxWinScreenProbe, "Win32 native WGL", NULL }; void glxWinPushNativeProvider(void) { GlxPushProvider(&__glXWGLProvider); } /* ---------------------------------------------------------------------- */ /* * Screen functions */ static void glxWinScreenDestroy(__GLXscreen * screen) { GLWIN_DEBUG_MSG("glxWinScreenDestroy(%p)", screen); __glXScreenDestroy(screen); free(screen); } static int glxWinScreenSwapInterval(__GLXdrawable * drawable, int interval) { BOOL ret = wglSwapIntervalEXTWrapper(interval); if (!ret) { ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval, glxWinErrorMessage()); } return ret; } /* Report the extensions split and formatted to avoid overflowing a line */ static void glxLogExtensions(const char *prefix, const char *extensions) { int length = 0; const char *strl; char *str = strdup(extensions); if (str == NULL) { ErrorF("glxLogExtensions: xalloc error\n"); return; } strl = strtok(str, " "); if (strl == NULL) strl = ""; ErrorF("%s%s", prefix, strl); length = strlen(prefix) + strlen(strl); while (1) { strl = strtok(NULL, " "); if (strl == NULL) break; if (length + strlen(strl) + 1 > 120) { ErrorF("\n"); ErrorF("%s", prefix); length = strlen(prefix); } else { ErrorF(" "); length++; } ErrorF("%s", strl); length = length + strlen(strl); } ErrorF("\n"); free(str); } /* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */ static __GLXscreen * glxWinScreenProbe(ScreenPtr pScreen) { glxWinScreen *screen; const char *gl_extensions; const char *gl_renderer; const char *wgl_extensions; HWND hwnd; HDC hdc; HGLRC hglrc; GLWIN_DEBUG_MSG("glxWinScreenProbe"); glxWinInitDebugSettings(); if (pScreen == NULL) return NULL; if (!winCheckScreenAiglxIsSupported(pScreen)) { LogMessage(X_ERROR, "AIGLX: No native OpenGL in modes with a root window\n"); return NULL; } screen = calloc(1, sizeof(glxWinScreen)); if (NULL == screen) return NULL; // Select the native GL implementation (WGL) if (glWinSelectImplementation(1)) return NULL; // create window class #define WIN_GL_TEST_WINDOW_CLASS "XWinGLTest" { static wATOM glTestWndClass = 0; if (glTestWndClass == 0) { WNDCLASSEX wc; wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = DefWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = GetModuleHandle(NULL); wc.hIcon = 0; wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS; wc.hIconSm = 0; RegisterClassEx(&wc); } } // create an invisible window for a scratch DC hwnd = CreateWindowExA(0, WIN_GL_TEST_WINDOW_CLASS, "XWin GL Renderer Capabilities Test Window", 0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); if (hwnd == NULL) LogMessage(X_ERROR, "AIGLX: Couldn't create a window for render capabilities testing\n"); hdc = GetDC(hwnd); // we must set a pixel format before we can create a context, just use the first one... SetPixelFormat(hdc, 1, NULL); hglrc = wglCreateContext(hdc); wglMakeCurrent(hdc, hglrc); // initialize wgl extension proc pointers (don't call them before here...) // (but we need to have a current context for them to be resolvable) wglResolveExtensionProcs(); /* Dump out some useful information about the native renderer */ ErrorF("GL_VERSION: %s\n", glGetString(GL_VERSION)); ErrorF("GL_VENDOR: %s\n", glGetString(GL_VENDOR)); gl_renderer = (const char *) glGetString(GL_RENDERER); ErrorF("GL_RENDERER: %s\n", gl_renderer); gl_extensions = (const char *) glGetString(GL_EXTENSIONS); wgl_extensions = wglGetExtensionsStringARBWrapper(hdc); if (!wgl_extensions) wgl_extensions = ""; if (g_iLogVerbose >= 3) { glxLogExtensions("GL_EXTENSIONS: ", gl_extensions); glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions); } if (strcasecmp(gl_renderer, "GDI Generic") == 0) { free(screen); LogMessage(X_ERROR, "AIGLX: Won't use generic native renderer as it is not accelerated\n"); goto error; } // Can you see the problem here? The extensions string is DC specific // Different DCs for windows on a multimonitor system driven by multiple cards // might have completely different capabilities. Of course, good luck getting // those screens to be accelerated in XP and earlier... { // // Based on the WGL extensions available, enable various GLX extensions // XXX: make this table-driven ? // __glXInitExtensionEnableBits(screen->base.glx_enable_bits); if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) screen->has_WGL_ARB_make_current_read = TRUE; else LogMessage(X_WARNING, "AIGLX: missing WGL_ARB_make_current_read\n"); if (strstr(gl_extensions, "GL_WIN_swap_hint")) { __glXEnableExtension(screen->base.glx_enable_bits, "GLX_MESA_copy_sub_buffer"); LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n"); } if (strstr(wgl_extensions, "WGL_EXT_swap_control")) { __glXEnableExtension(screen->base.glx_enable_bits, "GLX_SGI_swap_control"); LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control\n"); } /* // Hmm? screen->texOffset */ /* if (strstr(wgl_extensions, "WGL_ARB_render_texture")) */ /* { */ /* __glXEnableExtension(screen->base.glx_enable_bits, "GLX_EXT_texture_from_pixmap"); */ /* LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); */ /* screen->has_WGL_ARB_render_texture = TRUE; */ /* } */ if (strstr(wgl_extensions, "WGL_ARB_pbuffer")) screen->has_WGL_ARB_pbuffer = TRUE; else LogMessage(X_WARNING, "AIGLX: missing WGL_ARB_pbuffer\n"); if (strstr(wgl_extensions, "WGL_ARB_multisample")) screen->has_WGL_ARB_multisample = TRUE; else LogMessage(X_WARNING, "AIGLX: missing WGL_ARB_multisample\n"); screen->base.destroy = glxWinScreenDestroy; screen->base.createContext = glxWinCreateContext; screen->base.createDrawable = glxWinCreateDrawable; screen->base.swapInterval = glxWinScreenSwapInterval; screen->base.pScreen = pScreen; // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs if (strstr(wgl_extensions, "WGL_ARB_pixel_format")) { glxWinCreateConfigsExt(hdc, screen); /* Some graphics drivers appear to advertise WGL_ARB_pixel_format, but it doesn't work usefully, so we have to be prepared for it to fail and fall back to using DescribePixelFormat() */ if (screen->base.numFBConfigs > 0) { screen->has_WGL_ARB_pixel_format = TRUE; } } if (screen->base.numFBConfigs <= 0) { glxWinCreateConfigs(hdc, screen); screen->has_WGL_ARB_pixel_format = FALSE; } /* If we still didn't get any fbConfigs, we can't provide GLX for this screen */ if (screen->base.numFBConfigs <= 0) { free(screen); LogMessage(X_ERROR, "AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n"); goto error; } /* These will be set by __glXScreenInit */ screen->base.visuals = NULL; screen->base.numVisuals = 0; __glXScreenInit(&screen->base, pScreen); } wglMakeCurrent(NULL, NULL); wglDeleteContext(hglrc); ReleaseDC(hwnd, hdc); DestroyWindow(hwnd); // dump out fbConfigs now fbConfigIds and visualIDs have been assigned fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs); /* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */ screen->RealizeWindow = pScreen->RealizeWindow; pScreen->RealizeWindow = glxWinRealizeWindow; screen->UnrealizeWindow = pScreen->UnrealizeWindow; pScreen->UnrealizeWindow = glxWinUnrealizeWindow; screen->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = glxWinCopyWindow; // Note that WGL is active on this screen winSetScreenAiglxIsActive(pScreen); return &screen->base; error: // Something went wrong and we can't use the native GL implementation // so make sure the mesa GL implementation is selected instead glWinSelectImplementation(0); return NULL; } /* ---------------------------------------------------------------------- */ /* * Window functions */ static Bool glxWinRealizeWindow(WindowPtr pWin) { Bool result; ScreenPtr pScreen = pWin->drawable.pScreen; glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen); GLWIN_DEBUG_MSG("glxWinRealizeWindow"); /* Allow the window to be created (RootlessRealizeWindow is inside our wrap) */ pScreen->RealizeWindow = screenPriv->RealizeWindow; result = pScreen->RealizeWindow(pWin); pScreen->RealizeWindow = glxWinRealizeWindow; return result; } static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { __GLXWinDrawable *pGlxDraw; ScreenPtr pScreen = pWindow->drawable.pScreen; glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen); GLWIN_TRACE_MSG("glxWinCopyWindow pWindow %p", pWindow); dixLookupResourceByType((void *) &pGlxDraw, pWindow->drawable.id, __glXDrawableRes, NullClient, DixUnknownAccess); /* Discard any CopyWindow requests if a GL drawing context is pointing at the window For regions which are being drawn by GL, the shadow framebuffer doesn't have the correct bits, so we wish to avoid shadow framebuffer damage occuring, which will cause those incorrect bits to be transferred to the display.... */ if (pGlxDraw && pGlxDraw->drawContext) { GLWIN_DEBUG_MSG("glxWinCopyWindow: discarding"); return; } GLWIN_DEBUG_MSG("glxWinCopyWindow - passing to hw layer"); pScreen->CopyWindow = screenPriv->CopyWindow; pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); pScreen->CopyWindow = glxWinCopyWindow; } static Bool glxWinUnrealizeWindow(WindowPtr pWin) { Bool result; ScreenPtr pScreen = pWin->drawable.pScreen; glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen); GLWIN_DEBUG_MSG("glxWinUnrealizeWindow"); pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow; result = pScreen->UnrealizeWindow(pWin); pScreen->UnrealizeWindow = glxWinUnrealizeWindow; return result; } /* ---------------------------------------------------------------------- */ /* * Drawable functions */ static GLboolean glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base) { HDC dc; HWND hwnd; BOOL ret; __GLXWinDrawable *draw = (__GLXWinDrawable *) base; /* Swap buffers on the last active context for drawing on the drawable */ if (draw->drawContext == NULL) { GLWIN_TRACE_MSG("glxWinSwapBuffers - no context for drawable"); return GL_FALSE; } GLWIN_TRACE_MSG ("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)", base, draw->drawContext, draw->drawContext->ctx); dc = glxWinMakeDC(draw->drawContext, draw, &dc, &hwnd); if (dc == NULL) return GL_FALSE; ret = wglSwapLayerBuffers(dc, WGL_SWAP_MAIN_PLANE); glxWinReleaseDC(hwnd, dc, draw); if (!ret) { ErrorF("wglSwapBuffers failed: %s\n", glxWinErrorMessage()); return GL_FALSE; } return GL_TRUE; } static void glxWinDrawableCopySubBuffer(__GLXdrawable * drawable, int x, int y, int w, int h) { glAddSwapHintRectWINWrapper(x, y, w, h); glxWinDrawableSwapBuffers(NULL, drawable); } static void glxWinDrawableDestroy(__GLXdrawable * base) { __GLXWinDrawable *glxPriv = (__GLXWinDrawable *) base; if (glxPriv->hPbuffer) if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer)) { ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage()); } if (glxPriv->dibDC) { // restore the default DIB SelectObject(glxPriv->dibDC, glxPriv->hOldDIB); if (!DeleteDC(glxPriv->dibDC)) { ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage()); } } if (glxPriv->hDIB) { if (!CloseHandle(glxPriv->hSection)) { ErrorF("CloseHandle failed: %s\n", glxWinErrorMessage()); } if (!DeleteObject(glxPriv->hDIB)) { ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage()); } ((PixmapPtr) glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits; } GLWIN_DEBUG_MSG("glxWinDestroyDrawable"); free(glxPriv); } static __GLXdrawable * glxWinCreateDrawable(ClientPtr client, __GLXscreen * screen, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig * conf) { __GLXWinDrawable *glxPriv; glxPriv = malloc(sizeof *glxPriv); if (glxPriv == NULL) return NULL; memset(glxPriv, 0, sizeof *glxPriv); if (!__glXDrawableInit (&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) { free(glxPriv); return NULL; } glxPriv->base.destroy = glxWinDrawableDestroy; glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers; glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer; // glxPriv->base.waitX what are these for? // glxPriv->base.waitGL GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv); return &glxPriv->base; } void glxWinDeferredCreateDrawable(__GLXWinDrawable *draw, __GLXconfig *config) { switch (draw->base.type) { case GLX_DRAWABLE_WINDOW: { WindowPtr pWin = (WindowPtr) draw->base.pDraw; if (!(config->drawableType & GLX_WINDOW_BIT)) { ErrorF ("glxWinDeferredCreateDrawable: tried to create a GLX_DRAWABLE_WINDOW drawable with a fbConfig which doesn't have drawableType GLX_WINDOW_BIT\n"); } if (pWin == NULL) { GLWIN_DEBUG_MSG("Deferring until X window is created"); return; } GLWIN_DEBUG_MSG("glxWinDeferredCreateDrawable: pWin %p", pWin); if (winGetWindowInfo(pWin) == NULL) { GLWIN_DEBUG_MSG("Deferring until native window is created"); return; } } break; case GLX_DRAWABLE_PBUFFER: { if (draw->hPbuffer == NULL) { __GLXscreen *screen; glxWinScreen *winScreen; int pixelFormat; // XXX: which DC are we supposed to use??? HDC screenDC = GetDC(NULL); if (!(config->drawableType & GLX_PBUFFER_BIT)) { ErrorF ("glxWinDeferredCreateDrawable: tried to create a GLX_DRAWABLE_PBUFFER drawable with a fbConfig which doesn't have drawableType GLX_PBUFFER_BIT\n"); } screen = glxGetScreen(screenInfo.screens[draw->base.pDraw->pScreen->myNum]); winScreen = (glxWinScreen *) screen; pixelFormat = fbConfigToPixelFormatIndex(screenDC, config, GLX_PBUFFER_BIT, winScreen); if (pixelFormat == 0) { return; } draw->hPbuffer = wglCreatePbufferARBWrapper(screenDC, pixelFormat, draw->base.pDraw->width, draw->base.pDraw->height, NULL); ReleaseDC(NULL, screenDC); if (draw->hPbuffer == NULL) { ErrorF("wglCreatePbufferARBWrapper error: %s\n", glxWinErrorMessage()); return; } GLWIN_DEBUG_MSG ("glxWinDeferredCreateDrawable: pBuffer %p created for drawable %p", draw->hPbuffer, draw); } } break; case GLX_DRAWABLE_PIXMAP: { if (draw->dibDC == NULL) { BITMAPINFOHEADER bmpHeader; void *pBits; __GLXscreen *screen; DWORD size; char name[MAX_PATH]; memset(&bmpHeader, 0, sizeof(BITMAPINFOHEADER)); bmpHeader.biSize = sizeof(BITMAPINFOHEADER); bmpHeader.biWidth = draw->base.pDraw->width; bmpHeader.biHeight = draw->base.pDraw->height; bmpHeader.biPlanes = 1; bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel; bmpHeader.biCompression = BI_RGB; if (!(config->drawableType & GLX_PIXMAP_BIT)) { ErrorF ("glxWinDeferredCreateDrawable: tried to create a GLX_DRAWABLE_PIXMAP drawable with a fbConfig which doesn't have drawableType GLX_PIXMAP_BIT\n"); } draw->dibDC = CreateCompatibleDC(NULL); if (draw->dibDC == NULL) { ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage()); return; } #define RASTERWIDTHBYTES(bmi) (((((bmi)->biWidth*(bmi)->biBitCount)+31)&~31)>>3) size = bmpHeader.biHeight * RASTERWIDTHBYTES(&bmpHeader); GLWIN_DEBUG_MSG("shared memory region size %zu + %u\n", sizeof(BITMAPINFOHEADER), (unsigned int)size); // Create unique name for mapping based on XID // // XXX: not quite unique as potentially this name could be used in // another server instance. Not sure how to deal with that. snprintf(name, sizeof(name), "Local\\CYGWINX_WINDOWSDRI_%08x", (unsigned int)draw->base.pDraw->id); GLWIN_DEBUG_MSG("shared memory region name %s\n", name); // Create a file mapping backed by the pagefile draw->hSection = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(BITMAPINFOHEADER) + size, name); if (draw->hSection == NULL) { ErrorF("CreateFileMapping error: %s\n", glxWinErrorMessage()); return; } draw->hDIB = CreateDIBSection(draw->dibDC, (BITMAPINFO *) &bmpHeader, DIB_RGB_COLORS, &pBits, draw->hSection, sizeof(BITMAPINFOHEADER)); if (draw->dibDC == NULL) { ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage()); return; } // Store a copy of the BITMAPINFOHEADER at the start of the shared // memory for the information of the receiving process { LPVOID pData = MapViewOfFile(draw->hSection, FILE_MAP_WRITE, 0, 0, 0); memcpy(pData, (void *)&bmpHeader, sizeof(BITMAPINFOHEADER)); UnmapViewOfFile(pData); } // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are // even compatible ... draw->pOldBits = ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr; ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr = pBits; // Select the DIB into the DC draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB); if (!draw->hOldDIB) { ErrorF("SelectObject error: %s\n", glxWinErrorMessage()); } screen = glxGetScreen(screenInfo.screens[draw->base.pDraw->pScreen->myNum]); // Set the pixel format of the bitmap glxWinSetPixelFormat(draw->dibDC, draw->base.pDraw->bitsPerPixel, GLX_PIXMAP_BIT, screen, config); GLWIN_DEBUG_MSG ("glxWinDeferredCreateDrawable: DIB bitmap %p created for drawable %p", draw->hDIB, draw); } } break; default: { ErrorF ("glxWinDeferredCreateDrawable: tried to attach unhandled drawable type %d\n", draw->base.type); return; } } } /* ---------------------------------------------------------------------- */ /* * Texture functions */ static int glxWinBindTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * pixmap) { ErrorF("glxWinBindTexImage: not implemented\n"); return FALSE; } static int glxWinReleaseTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * pixmap) { ErrorF(" glxWinReleaseTexImage: not implemented\n"); return FALSE; } /* ---------------------------------------------------------------------- */ /* * Lazy update context implementation * * WGL contexts are created for a specific HDC, so we cannot create the WGL * context in glxWinCreateContext(), we must defer creation until the context * is actually used on a specifc drawable which is connected to a native window, * pbuffer or DIB * * The WGL context may be used on other, compatible HDCs, so we don't need to * recreate it for every new native window * * XXX: I wonder why we can't create the WGL context on the screen HDC ? * Basically we assume all HDCs are compatible at the moment: if they are not * we are in a muddle, there was some code in the old implementation to attempt * to transparently migrate a context to a new DC by copying state and sharing * lists with the old one... */ static Bool glxWinSetPixelFormat(HDC hdc, int bppOverride, int drawableTypeOverride, __GLXscreen *screen, __GLXconfig *config) { glxWinScreen *winScreen = (glxWinScreen *) screen; GLXWinConfig *winConfig = (GLXWinConfig *) config; GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d", winConfig->pixelFormatIndex); /* Normally, we can just use the the pixelFormatIndex corresponding to the fbconfig which has been specified by the client */ if (! ((bppOverride && (bppOverride != (config->redBits + config->greenBits + config->blueBits))) || ((config->drawableType & drawableTypeOverride) == 0))) { if (!SetPixelFormat(hdc, winConfig->pixelFormatIndex, NULL)) { ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); return FALSE; } return TRUE; } /* However, in certain special cases this pixel format will be incompatible with the use we are going to put it to, so we need to re-evaluate the pixel format to use: 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with the cColorBits we asked for, so we need to ensure it matches the bpp of the bitmap 2) Applications may assume that visuals selected with glXChooseVisual() work with pixmap drawables (there is no attribute to explicitly query for pixmap drawable support as there is for glXChooseFBConfig()) (it's arguable this is an error in the application, but we try to make it work) pixmap rendering is always slow for us, so we don't want to choose those visuals by default, but if the actual drawable type we're trying to select the context on (drawableTypeOverride) isn't supported by the selected fbConfig, reconsider and see if we can find a suitable one... */ ErrorF ("glxWinSetPixelFormat: having second thoughts: cColorbits %d, bppOveride %d; config->drawableType %d, drawableTypeOverride %d\n", (config->redBits + config->greenBits + config->blueBits), bppOverride, config->drawableType, drawableTypeOverride); if (!winScreen->has_WGL_ARB_pixel_format) { PIXELFORMATDESCRIPTOR pfd; int pixelFormat; /* convert fbConfig to PFD */ if (fbConfigToPixelFormat(config, &pfd, drawableTypeOverride)) { ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n"); return FALSE; } if (glxWinDebugSettings.dumpPFD) pfdOut(&pfd); if (bppOverride) { GLWIN_DEBUG_MSG("glxWinSetPixelFormat: Forcing bpp from %d to %d\n", pfd.cColorBits, bppOverride); pfd.cColorBits = bppOverride; } pixelFormat = ChoosePixelFormat(hdc, &pfd); if (pixelFormat == 0) { ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage()); return FALSE; } GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat); ErrorF ("ChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n", pixelFormat, winConfig->pixelFormatIndex); if (!SetPixelFormat(hdc, pixelFormat, &pfd)) { ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); return FALSE; } } else { int pixelFormat = fbConfigToPixelFormatIndex(hdc, config, drawableTypeOverride, winScreen); if (pixelFormat == 0) { return FALSE; } GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat); ErrorF ("wglChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n", pixelFormat, winConfig->pixelFormatIndex); if (!SetPixelFormat(hdc, pixelFormat, NULL)) { ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); return FALSE; } } return TRUE; } static HDC glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw, HDC * hdc, HWND * hwnd) { *hdc = NULL; *hwnd = NULL; if (draw == NULL) { GLWIN_TRACE_MSG("No drawable for context %p (native ctx %p)", gc, gc->ctx); return NULL; } switch (draw->base.type) { case GLX_DRAWABLE_WINDOW: { WindowPtr pWin; pWin = (WindowPtr) draw->base.pDraw; if (pWin == NULL) { GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin); return NULL; } *hwnd = winGetWindowInfo(pWin); if (*hwnd == NULL) { ErrorF("No HWND error: %s\n", glxWinErrorMessage()); return NULL; } *hdc = GetDC(*hwnd); if (*hdc == NULL) ErrorF("GetDC error: %s\n", glxWinErrorMessage()); /* Check if the hwnd has changed... */ if (*hwnd != gc->hwnd) { if (glxWinDebugSettings.enableTrace) GLWIN_DEBUG_HWND(*hwnd); GLWIN_TRACE_MSG ("for context %p (native ctx %p), hWnd changed from %p to %p", gc, gc->ctx, gc->hwnd, *hwnd); gc->hwnd = *hwnd; /* We must select a pixelformat, but SetPixelFormat can only be called once for a window... */ if (!glxWinSetPixelFormat(*hdc, 0, GLX_WINDOW_BIT, gc->base.pGlxScreen, gc->base.config)) { ErrorF("glxWinSetPixelFormat error: %s\n", glxWinErrorMessage()); ReleaseDC(*hwnd, *hdc); *hdc = NULL; return NULL; } } } break; case GLX_DRAWABLE_PBUFFER: { *hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer); if (*hdc == NULL) ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage()); } break; case GLX_DRAWABLE_PIXMAP: { *hdc = draw->dibDC; } break; default: { ErrorF("glxWinMakeDC: tried to makeDC for unhandled drawable type %d\n", draw->base.type); } } if (glxWinDebugSettings.dumpDC) GLWIN_DEBUG_MSG("Got HDC %p", *hdc); return *hdc; } static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw) { switch (draw->base.type) { case GLX_DRAWABLE_WINDOW: { ReleaseDC(hwnd, hdc); } break; case GLX_DRAWABLE_PBUFFER: { if (!wglReleasePbufferDCARBWrapper(draw->hPbuffer, hdc)) { ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage()); } } break; case GLX_DRAWABLE_PIXMAP: { // don't release DC, the memory DC lives as long as the bitmap // We must ensure that all GDI drawing into the bitmap has completed // in case we subsequently access the bits from it GdiFlush(); } break; default: { ErrorF ("glxWinReleaseDC: tried to releaseDC for unhandled drawable type %d\n", draw->base.type); } } } static void glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw) { HDC dc; HWND hwnd; GLWIN_DEBUG_MSG ("glxWinDeferredCreateContext: attach context %p to drawable %p", gc, draw); glxWinDeferredCreateDrawable(draw, gc->base.config); dc = glxWinMakeDC(gc, draw, &dc, &hwnd); gc->ctx = wglCreateContext(dc); glxWinReleaseDC(hwnd, dc, draw); if (gc->ctx == NULL) { ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage()); return; } GLWIN_DEBUG_MSG ("glxWinDeferredCreateContext: attached context %p to native context %p drawable %p", gc, gc->ctx, draw); // if the native context was created successfully, shareLists if needed if (gc->ctx && gc->shareContext) { GLWIN_DEBUG_MSG ("glxWinCreateContextReal shareLists with context %p (native ctx %p)", gc->shareContext, gc->shareContext->ctx); if (!wglShareLists(gc->shareContext->ctx, gc->ctx)) { ErrorF("wglShareLists error: %s\n", glxWinErrorMessage()); } } } /* ---------------------------------------------------------------------- */ /* * Context functions */ /* Context manipulation routines should return TRUE on success, FALSE on failure */ static int glxWinContextMakeCurrent(__GLXcontext * base) { __GLXWinContext *gc = (__GLXWinContext *) base; glxWinScreen *scr = (glxWinScreen *)base->pGlxScreen; BOOL ret; HDC drawDC; HDC readDC = NULL; __GLXdrawable *drawPriv; __GLXdrawable *readPriv = NULL; HWND hDrawWnd; HWND hReadWnd; GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc, gc->ctx); /* Keep a note of the last active context in the drawable */ drawPriv = gc->base.drawPriv; ((__GLXWinDrawable *) drawPriv)->drawContext = gc; if (gc->ctx == NULL) { glxWinDeferredCreateContext(gc, (__GLXWinDrawable *) drawPriv); } if (gc->ctx == NULL) { ErrorF("glxWinContextMakeCurrent: Native context is NULL\n"); return FALSE; } drawDC = glxWinMakeDC(gc, (__GLXWinDrawable *) drawPriv, &drawDC, &hDrawWnd); if (drawDC == NULL) { ErrorF("glxWinMakeDC failed for drawDC\n"); return FALSE; } if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv)) { /* * We enable GLX_SGI_make_current_read unconditionally, but the * renderer might not support it. It's fairly rare to use this * feature so just error out if it can't work. */ if (!scr->has_WGL_ARB_make_current_read) return FALSE; /* If there is a separate read drawable, create a separate read DC, and use the wglMakeContextCurrent extension to make the context current drawing to one DC and reading from the other */ readPriv = gc->base.readPriv; readDC = glxWinMakeDC(gc, (__GLXWinDrawable *) readPriv, &readDC, &hReadWnd); if (readDC == NULL) { ErrorF("glxWinMakeDC failed for readDC\n"); glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *) drawPriv); return FALSE; } ret = wglMakeContextCurrentARBWrapper(drawDC, readDC, gc->ctx); if (!ret) { ErrorF("wglMakeContextCurrentARBWrapper error: %s\n", glxWinErrorMessage()); } } else { /* Otherwise, just use wglMakeCurrent */ ret = wglMakeCurrent(drawDC, gc->ctx); if (!ret) { ErrorF("wglMakeCurrent error: %s\n", glxWinErrorMessage()); } } // apparently make current could fail if the context is current in a different thread, // but that shouldn't be able to happen in the current server... glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *) drawPriv); if (readDC) glxWinReleaseDC(hReadWnd, readDC, (__GLXWinDrawable *) readPriv); return ret; } static int glxWinContextLoseCurrent(__GLXcontext * base) { BOOL ret; __GLXWinContext *gc = (__GLXWinContext *) base; GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc, gc->ctx); /* An error seems to be reported if we try to make no context current if there is already no current context, so avoid doing that... */ if (wglGetCurrentContext() != NULL) { ret = wglMakeCurrent(NULL, NULL); /* We don't need a DC when setting no current context */ if (!ret) ErrorF("glxWinContextLoseCurrent error: %s\n", glxWinErrorMessage()); } return TRUE; } static int glxWinContextCopy(__GLXcontext * dst_base, __GLXcontext * src_base, unsigned long mask) { __GLXWinContext *dst = (__GLXWinContext *) dst_base; __GLXWinContext *src = (__GLXWinContext *) src_base; BOOL ret; GLWIN_DEBUG_MSG("glxWinContextCopy"); ret = wglCopyContext(src->ctx, dst->ctx, mask); if (!ret) { ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage()); } return ret; } static void glxWinContextDestroy(__GLXcontext * base) { __GLXWinContext *gc = (__GLXWinContext *) base; if (gc != NULL) { GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base, gc->ctx); if (gc->ctx) { /* It's bad style to delete the context while it's still current */ if (wglGetCurrentContext() == gc->ctx) { wglMakeCurrent(NULL, NULL); } { BOOL ret = wglDeleteContext(gc->ctx); if (!ret) ErrorF("wglDeleteContext error: %s\n", glxWinErrorMessage()); } gc->ctx = NULL; } free(gc); } } static __GLXcontext * glxWinCreateContext(__GLXscreen * screen, __GLXconfig * modes, __GLXcontext * baseShareContext, unsigned num_attribs, const uint32_t * attribs, int *error) { __GLXWinContext *context; __GLXWinContext *shareContext = (__GLXWinContext *) baseShareContext; context = calloc(1, sizeof(__GLXWinContext)); if (!context) return NULL; memset(context, 0, sizeof *context); context->base.destroy = glxWinContextDestroy; context->base.makeCurrent = glxWinContextMakeCurrent; context->base.loseCurrent = glxWinContextLoseCurrent; context->base.copy = glxWinContextCopy; context->base.bindTexImage = glxWinBindTexImage; context->base.releaseTexImage = glxWinReleaseTexImage; context->base.config = modes; context->base.pGlxScreen = screen; // actual native GL context creation is deferred until attach() context->ctx = NULL; context->shareContext = shareContext; GLWIN_DEBUG_MSG("GLXcontext %p created", context); return &(context->base); } /* ---------------------------------------------------------------------- */ /* * Utility functions */ static int GetShift(int mask) { int shift = 0; while ((mask &1) == 0) { shift++; mask >>=1; } return shift; } static int fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret, int drawableTypeOverride) { PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */ 1, /* version number */ PFD_SUPPORT_OPENGL, /* support OpenGL */ PFD_TYPE_RGBA, /* RGBA type */ 24, /* 24-bit color depth */ 0, 0, 0, 0, 0, 0, /* color bits ignored */ 0, /* no alpha buffer */ 0, /* shift bit ignored */ 0, /* no accumulation buffer */ 0, 0, 0, 0, /* accum bits ignored */ 32, /* 32-bit z-buffer */ 0, /* no stencil buffer */ 0, /* no auxiliary buffer */ PFD_MAIN_PLANE, /* main layer */ 0, /* reserved */ 0, 0, 0 /* layer masks ignored */ }; if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT) pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */ if ((mode->drawableType | drawableTypeOverride) & GLX_PIXMAP_BIT) pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */ if (mode->stereoMode) { pfd.dwFlags |= PFD_STEREO; } if (mode->doubleBufferMode) { pfd.dwFlags |= PFD_DOUBLEBUFFER; } pfd.cColorBits = mode->redBits + mode->greenBits + mode->blueBits; pfd.cRedBits = mode->redBits; pfd.cRedShift = GetShift(mode->redMask); pfd.cGreenBits = mode->greenBits; pfd.cGreenShift = GetShift(mode->greenMask); pfd.cBlueBits = mode->blueBits; pfd.cBlueShift = GetShift(mode->blueMask); pfd.cAlphaBits = mode->alphaBits; pfd.cAlphaShift = GetShift(mode->alphaMask); if (mode->visualType == GLX_TRUE_COLOR) { pfd.iPixelType = PFD_TYPE_RGBA; pfd.dwVisibleMask = (pfd.cRedBits << pfd.cRedShift) | (pfd.cGreenBits << pfd.cGreenShift) | (pfd.cBlueBits << pfd.cBlueShift) | (pfd.cAlphaBits << pfd.cAlphaShift); } else { pfd.iPixelType = PFD_TYPE_COLORINDEX; pfd.dwVisibleMask = mode->transparentIndex; } pfd.cAccumBits = mode->accumRedBits + mode->accumGreenBits + mode->accumBlueBits + mode->accumAlphaBits; pfd.cAccumRedBits = mode->accumRedBits; pfd.cAccumGreenBits = mode->accumGreenBits; pfd.cAccumBlueBits = mode->accumBlueBits; pfd.cAccumAlphaBits = mode->accumAlphaBits; pfd.cDepthBits = mode->depthBits; pfd.cStencilBits = mode->stencilBits; pfd.cAuxBuffers = mode->numAuxBuffers; /* mode->level ? */ *pfdret = pfd; return 0; } #define SET_ATTR_VALUE(attr, value) { attribList[i++] = attr; attribList[i++] = value; assert(i < ARRAY_SIZE(attribList)); } static int fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode, int drawableTypeOverride, glxWinScreen * winScreen) { UINT numFormats; unsigned int i = 0; /* convert fbConfig to attr-value list */ int attribList[60]; SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE); SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, (mode->visualType == GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB : WGL_TYPE_COLORINDEX_ARB); SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, (mode->visualType == GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits); SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits); SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits); SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits); SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits); SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits); SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits); SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits); SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits); SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits); SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits); SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers); if (mode->doubleBufferMode) SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE); if (mode->stereoMode) SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE); // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft.. if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML) SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB); if (mode->swapMethod == GLX_SWAP_COPY_OML) SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_COPY_ARB); // XXX: this should probably be the other way around, but that messes up drawableTypeOverride if (mode->visualRating == GLX_SLOW_VISUAL_EXT) SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB); // must support all the drawable types the mode supports if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT) SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, TRUE); // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride) if (drawableTypeOverride == GLX_WINDOW_BIT) { if (mode->drawableType & GLX_PIXMAP_BIT) SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE); if (mode->drawableType & GLX_PBUFFER_BIT) if (winScreen->has_WGL_ARB_pbuffer) SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE); } else { if (drawableTypeOverride & GLX_PIXMAP_BIT) SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE); if (drawableTypeOverride & GLX_PBUFFER_BIT) if (winScreen->has_WGL_ARB_pbuffer) SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE); } SET_ATTR_VALUE(0, 0); // terminator /* choose the first match */ { int pixelFormatIndex; if (!wglChoosePixelFormatARBWrapper (hdc, attribList, NULL, 1, &pixelFormatIndex, &numFormats)) { ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage()); } else { if (numFormats > 0) { GLWIN_DEBUG_MSG ("wglChoosePixelFormat: chose pixelFormatIndex %d)", pixelFormatIndex); return pixelFormatIndex; } else ErrorF("wglChoosePixelFormat couldn't decide\n"); } } return 0; } /* ---------------------------------------------------------------------- */ #define BITS_AND_SHIFT_TO_MASK(bits,mask) (((1<<(bits))-1) << (mask)) // // Create the GLXconfigs using DescribePixelFormat() // static void glxWinCreateConfigs(HDC hdc, glxWinScreen * screen) { GLXWinConfig *first = NULL, *prev = NULL; int numConfigs = 0; int i = 0; int n = 0; PIXELFORMATDESCRIPTOR pfd; GLWIN_DEBUG_MSG("glxWinCreateConfigs"); screen->base.numFBConfigs = 0; screen->base.fbconfigs = NULL; // get the number of pixelformats numConfigs = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL); LogMessage(X_INFO, "%d pixel formats reported by DescribePixelFormat\n", numConfigs); n = 0; /* fill in configs */ for (i = 0; i < numConfigs; i++) { int rc; GLXWinConfig temp; GLXWinConfig *c = &temp; GLXWinConfig *work; memset(c, 0, sizeof(GLXWinConfig)); c->pixelFormatIndex = i + 1; rc = DescribePixelFormat(hdc, i + 1, sizeof(PIXELFORMATDESCRIPTOR), &pfd); if (!rc) { ErrorF("DescribePixelFormat failed for index %d, error %s\n", i + 1, glxWinErrorMessage()); break; } if (glxWinDebugSettings.dumpPFD) pfdOut(&pfd); if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) || !(pfd.dwFlags & PFD_SUPPORT_OPENGL)) { GLWIN_DEBUG_MSG ("pixelFormat %d has unsuitable flags 0x%08x, skipping", i + 1, (unsigned int)pfd.dwFlags); continue; } c->base.doubleBufferMode = (pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE; c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE; c->base.redBits = pfd.cRedBits; c->base.greenBits = pfd.cGreenBits; c->base.blueBits = pfd.cBlueBits; c->base.alphaBits = pfd.cAlphaBits; c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift); c->base.greenMask = BITS_AND_SHIFT_TO_MASK(pfd.cGreenBits, pfd.cGreenShift); c->base.blueMask = BITS_AND_SHIFT_TO_MASK(pfd.cBlueBits, pfd.cBlueShift); c->base.alphaMask = BITS_AND_SHIFT_TO_MASK(pfd.cAlphaBits, pfd.cAlphaShift); c->base.rgbBits = pfd.cColorBits; if (pfd.iPixelType == PFD_TYPE_COLORINDEX) { c->base.indexBits = pfd.cColorBits; } else { c->base.indexBits = 0; } c->base.accumRedBits = pfd.cAccumRedBits; c->base.accumGreenBits = pfd.cAccumGreenBits; c->base.accumBlueBits = pfd.cAccumBlueBits; c->base.accumAlphaBits = pfd.cAccumAlphaBits; // pfd.cAccumBits; c->base.depthBits = pfd.cDepthBits; c->base.stencilBits = pfd.cStencilBits; c->base.numAuxBuffers = pfd.cAuxBuffers; // pfd.iLayerType; // ignored c->base.level = 0; // pfd.dwLayerMask; // ignored // pfd.dwDamageMask; // ignored c->base.visualID = -1; // will be set by __glXScreenInit() /* EXT_visual_rating / GLX 1.2 */ if (pfd.dwFlags & PFD_GENERIC_FORMAT) { c->base.visualRating = GLX_SLOW_VISUAL_EXT; } else { // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated... c->base.visualRating = GLX_NONE_EXT; } /* EXT_visual_info / GLX 1.2 */ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) { c->base.visualType = GLX_STATIC_COLOR; c->base.transparentRed = GLX_NONE; c->base.transparentGreen = GLX_NONE; c->base.transparentBlue = GLX_NONE; c->base.transparentAlpha = GLX_NONE; c->base.transparentIndex = pfd.dwVisibleMask; c->base.transparentPixel = GLX_TRANSPARENT_INDEX; } else { c->base.visualType = GLX_TRUE_COLOR; c->base.transparentRed = (pfd.dwVisibleMask & c->base.redMask) >> pfd.cRedShift; c->base.transparentGreen = (pfd.dwVisibleMask & c->base.greenMask) >> pfd.cGreenShift; c->base.transparentBlue = (pfd.dwVisibleMask & c->base.blueMask) >> pfd.cBlueShift; c->base.transparentAlpha = (pfd.dwVisibleMask & c->base.alphaMask) >> pfd.cAlphaShift; c->base.transparentIndex = GLX_NONE; c->base.transparentPixel = GLX_TRANSPARENT_RGB; } /* ARB_multisample / SGIS_multisample */ c->base.sampleBuffers = 0; c->base.samples = 0; /* SGIX_fbconfig / GLX 1.3 */ c->base.drawableType = (((pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? GLX_WINDOW_BIT : 0) | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0)); if (pfd.iPixelType == PFD_TYPE_COLORINDEX) { c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT; } else { c->base.renderType = GLX_RGBA_BIT; } c->base.fbconfigID = -1; // will be set by __glXScreenInit() /* SGIX_pbuffer / GLX 1.3 */ // XXX: How can we find these values out ??? c->base.maxPbufferWidth = -1; c->base.maxPbufferHeight = -1; c->base.maxPbufferPixels = -1; c->base.optimalPbufferWidth = 0; // there is no optimal value c->base.optimalPbufferHeight = 0; /* SGIX_visual_select_group */ // arrange for visuals with the best acceleration to be preferred in selection switch (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) { case 0: c->base.visualSelectGroup = 2; break; case PFD_GENERIC_ACCELERATED: c->base.visualSelectGroup = 1; break; case PFD_GENERIC_FORMAT: c->base.visualSelectGroup = 0; break; default: ; // "can't happen" } /* OML_swap_method */ if (pfd.dwFlags & PFD_SWAP_EXCHANGE) c->base.swapMethod = GLX_SWAP_EXCHANGE_OML; else if (pfd.dwFlags & PFD_SWAP_COPY) c->base.swapMethod = GLX_SWAP_COPY_OML; else c->base.swapMethod = GLX_SWAP_UNDEFINED_OML; /* EXT_texture_from_pixmap */ c->base.bindToTextureRgb = -1; c->base.bindToTextureRgba = -1; c->base.bindToMipmapTexture = -1; c->base.bindToTextureTargets = -1; c->base.yInverted = -1; c->base.sRGBCapable = 0; n++; // allocate and save work = malloc(sizeof(GLXWinConfig)); if (NULL == work) { ErrorF("Failed to allocate GLXWinConfig\n"); break; } *work = temp; // note the first config if (!first) first = work; // update previous config to point to this config if (prev) prev->base.next = &(work->base); prev = work; } GLWIN_DEBUG_MSG ("found %d pixelFormats suitable for conversion to fbConfigs", n); screen->base.numFBConfigs = n; screen->base.fbconfigs = first ? &(first->base) : NULL; } // helper function to access an attribute value from an attribute value array by attribute static int getAttrValue(const int attrs[], int values[], unsigned int num, int attr, int fallback) { unsigned int i; for (i = 0; i < num; i++) { if (attrs[i] == attr) { GLWIN_TRACE_MSG("getAttrValue attr 0x%x, value %d", attr, values[i]); return values[i]; } } ErrorF("getAttrValue failed to find attr 0x%x, using default value %d\n", attr, fallback); return fallback; } // // Create the GLXconfigs using wglGetPixelFormatAttribfvARB() extension // static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) { GLXWinConfig *first = NULL, *prev = NULL; int i = 0; int n = 0; const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB; int numConfigs; int attrs[50]; unsigned int num_attrs = 0; GLWIN_DEBUG_MSG("glxWinCreateConfigsExt"); screen->base.numFBConfigs = 0; screen->base.fbconfigs = NULL; if (!wglGetPixelFormatAttribivARBWrapper(hdc, 0, 0, 1, &attr, &numConfigs)) { ErrorF ("wglGetPixelFormatAttribivARB failed for WGL_NUMBER_PIXEL_FORMATS_ARB: %s\n", glxWinErrorMessage()); return; } LogMessage(X_INFO, "%d pixel formats reported by wglGetPixelFormatAttribivARB\n", numConfigs); n = 0; #define ADD_ATTR(a) { attrs[num_attrs++] = a; assert(num_attrs < ARRAY_SIZE(attrs)); } ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB); ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB); ADD_ATTR(WGL_ACCELERATION_ARB); ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB); ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB); ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB); ADD_ATTR(WGL_TRANSPARENT_ARB); ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB); ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB); ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB); ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB); ADD_ATTR(WGL_SUPPORT_OPENGL_ARB); ADD_ATTR(WGL_DOUBLE_BUFFER_ARB); ADD_ATTR(WGL_STEREO_ARB); ADD_ATTR(WGL_PIXEL_TYPE_ARB); ADD_ATTR(WGL_COLOR_BITS_ARB); ADD_ATTR(WGL_RED_BITS_ARB); ADD_ATTR(WGL_RED_SHIFT_ARB); ADD_ATTR(WGL_GREEN_BITS_ARB); ADD_ATTR(WGL_GREEN_SHIFT_ARB); ADD_ATTR(WGL_BLUE_BITS_ARB); ADD_ATTR(WGL_BLUE_SHIFT_ARB); ADD_ATTR(WGL_ALPHA_BITS_ARB); ADD_ATTR(WGL_ALPHA_SHIFT_ARB); ADD_ATTR(WGL_ACCUM_RED_BITS_ARB); ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB); ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB); ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB); ADD_ATTR(WGL_DEPTH_BITS_ARB); ADD_ATTR(WGL_STENCIL_BITS_ARB); ADD_ATTR(WGL_AUX_BUFFERS_ARB); ADD_ATTR(WGL_SWAP_METHOD_ARB); if (screen->has_WGL_ARB_multisample) { // we may not query these attrs if WGL_ARB_multisample is not offered ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB); ADD_ATTR(WGL_SAMPLES_ARB); } if (screen->has_WGL_ARB_render_texture) { // we may not query these attrs if WGL_ARB_render_texture is not offered ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB); ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB); } if (screen->has_WGL_ARB_pbuffer) { // we may not query these attrs if WGL_ARB_pbuffer is not offered ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB); ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB); ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB); ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB); } /* fill in configs */ for (i = 0; i < numConfigs; i++) { int values[num_attrs]; GLXWinConfig temp; GLXWinConfig *c = &temp; GLXWinConfig *work; memset(c, 0, sizeof(GLXWinConfig)); c->pixelFormatIndex = i + 1; if (!wglGetPixelFormatAttribivARBWrapper (hdc, i + 1, 0, num_attrs, attrs, values)) { ErrorF ("wglGetPixelFormatAttribivARB failed for index %d, error %s\n", i + 1, glxWinErrorMessage()); break; } #define ATTR_VALUE(a, d) getAttrValue(attrs, values, num_attrs, (a), (d)) if (!ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, 0)) { GLWIN_DEBUG_MSG ("pixelFormat %d isn't WGL_SUPPORT_OPENGL_ARB, skipping", i + 1); continue; } c->base.doubleBufferMode = ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, 0) ? GL_TRUE : GL_FALSE; c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE; c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0); c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0); c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0); c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0); c->base.redMask = BITS_AND_SHIFT_TO_MASK(c->base.redBits, ATTR_VALUE(WGL_RED_SHIFT_ARB, 0)); c->base.greenMask = BITS_AND_SHIFT_TO_MASK(c->base.greenBits, ATTR_VALUE(WGL_GREEN_SHIFT_ARB, 0)); c->base.blueMask = BITS_AND_SHIFT_TO_MASK(c->base.blueBits, ATTR_VALUE(WGL_BLUE_SHIFT_ARB, 0)); c->base.alphaMask = BITS_AND_SHIFT_TO_MASK(c->base.alphaBits, ATTR_VALUE(WGL_ALPHA_SHIFT_ARB, 0)); switch (ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0)) { case WGL_TYPE_COLORINDEX_ARB: c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); c->base.rgbBits = 0; c->base.visualType = GLX_STATIC_COLOR; break; case WGL_TYPE_RGBA_FLOAT_ARB: GLWIN_DEBUG_MSG ("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i + 1); continue; case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT: GLWIN_DEBUG_MSG ("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping", i + 1); continue; case WGL_TYPE_RGBA_ARB: c->base.indexBits = 0; c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); c->base.visualType = GLX_TRUE_COLOR; break; default: ErrorF ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_PIXEL_TYPE_ARB\n", ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0)); continue; } c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0); c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0); c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0); c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0); c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0); c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0); c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0); { int layers = ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB, 0) + ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0); if (layers > 0) { ErrorF ("pixelFormat %d: has %d overlay, %d underlays which aren't currently handled", i, ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB, 0), ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0)); // XXX: need to iterate over layers? } } c->base.level = 0; c->base.visualID = -1; // will be set by __glXScreenInit() /* EXT_visual_rating / GLX 1.2 */ switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) { default: ErrorF ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_ACCELERATION_ARB\n", ATTR_VALUE(WGL_ACCELERATION_ARB, 0)); case WGL_NO_ACCELERATION_ARB: c->base.visualRating = GLX_SLOW_VISUAL_EXT; break; case WGL_GENERIC_ACCELERATION_ARB: case WGL_FULL_ACCELERATION_ARB: c->base.visualRating = GLX_NONE_EXT; break; } /* EXT_visual_info / GLX 1.2 */ // c->base.visualType is set above if (ATTR_VALUE(WGL_TRANSPARENT_ARB, 0)) { c->base.transparentPixel = (c->base.visualType == GLX_TRUE_COLOR) ? GLX_TRANSPARENT_RGB_EXT : GLX_TRANSPARENT_INDEX_EXT; c->base.transparentRed = ATTR_VALUE(WGL_TRANSPARENT_RED_VALUE_ARB, 0); c->base.transparentGreen = ATTR_VALUE(WGL_TRANSPARENT_GREEN_VALUE_ARB, 0); c->base.transparentBlue = ATTR_VALUE(WGL_TRANSPARENT_BLUE_VALUE_ARB, 0); c->base.transparentAlpha = ATTR_VALUE(WGL_TRANSPARENT_ALPHA_VALUE_ARB, 0); c->base.transparentIndex = ATTR_VALUE(WGL_TRANSPARENT_INDEX_VALUE_ARB, 0); } else { c->base.transparentPixel = GLX_NONE_EXT; c->base.transparentRed = GLX_NONE; c->base.transparentGreen = GLX_NONE; c->base.transparentBlue = GLX_NONE; c->base.transparentAlpha = GLX_NONE; c->base.transparentIndex = GLX_NONE; } /* ARB_multisample / SGIS_multisample */ if (screen->has_WGL_ARB_multisample) { c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0); c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0); } else { c->base.sampleBuffers = 0; c->base.samples = 0; } /* SGIX_fbconfig / GLX 1.3 */ c->base.drawableType = ((ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, 0) ? GLX_WINDOW_BIT : 0) | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0) | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0)); /* Assume OpenGL RGBA rendering is available on all visuals (it is specified to render to red component in single-channel visuals, if supported, but there doesn't seem to be any mechanism to check if it is supported) Color index rendering is only supported on single-channel visuals */ if (c->base.visualType == GLX_STATIC_COLOR) { c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT; } else { c->base.renderType = GLX_RGBA_BIT; } c->base.fbconfigID = -1; // will be set by __glXScreenInit() /* SGIX_pbuffer / GLX 1.3 */ if (screen->has_WGL_ARB_pbuffer) { c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1); c->base.maxPbufferHeight = ATTR_VALUE(WGL_MAX_PBUFFER_HEIGHT_ARB, -1); c->base.maxPbufferPixels = ATTR_VALUE(WGL_MAX_PBUFFER_PIXELS_ARB, -1); } else { c->base.maxPbufferWidth = -1; c->base.maxPbufferHeight = -1; c->base.maxPbufferPixels = -1; } c->base.optimalPbufferWidth = 0; // there is no optimal value c->base.optimalPbufferHeight = 0; /* SGIX_visual_select_group */ // arrange for visuals with the best acceleration to be preferred in selection switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) { case WGL_FULL_ACCELERATION_ARB: c->base.visualSelectGroup = 2; break; case WGL_GENERIC_ACCELERATION_ARB: c->base.visualSelectGroup = 1; break; default: case WGL_NO_ACCELERATION_ARB: c->base.visualSelectGroup = 0; break; } /* OML_swap_method */ switch (ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0)) { case WGL_SWAP_EXCHANGE_ARB: c->base.swapMethod = GLX_SWAP_EXCHANGE_OML; break; case WGL_SWAP_COPY_ARB: c->base.swapMethod = GLX_SWAP_COPY_OML; break; default: ErrorF ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_SWAP_METHOD_ARB\n", ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0)); case WGL_SWAP_UNDEFINED_ARB: c->base.swapMethod = GLX_SWAP_UNDEFINED_OML; } /* EXT_texture_from_pixmap */ /* Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use, so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea... */ if (screen->has_WGL_ARB_render_texture) { c->base.bindToTextureRgb = ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGB_ARB, -1); c->base.bindToTextureRgba = ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGBA_ARB, -1); } else { c->base.bindToTextureRgb = -1; c->base.bindToTextureRgba = -1; } c->base.bindToMipmapTexture = -1; c->base.bindToTextureTargets = GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT | GLX_TEXTURE_RECTANGLE_BIT_EXT; c->base.yInverted = -1; c->base.sRGBCapable = 0; n++; // allocate and save work = malloc(sizeof(GLXWinConfig)); if (NULL == work) { ErrorF("Failed to allocate GLXWinConfig\n"); break; } *work = temp; // note the first config if (!first) first = work; // update previous config to point to this config if (prev) prev->base.next = &(work->base); prev = work; } screen->base.numFBConfigs = n; screen->base.fbconfigs = first ? &(first->base) : NULL; } xorg-server-1.20.8/hw/xwin/glx/Makefile.am0000644000175000017500000000456513640201473015251 00000000000000noinst_LTLIBRARIES = libXwinGLX.la lib_LTLIBRARIES = libnativeGLthunk.la libXwinGLX_la_SOURCES = \ winpriv.c \ winpriv.h \ glwindows.h \ glshim.c \ indirect.c \ indirect.h \ wgl_ext_api.c \ wgl_ext_api.h if XWIN_WINDOWS_DRI libXwinGLX_la_SOURCES += \ dri_helpers.c \ dri_helpers.h endif libnativeGLthunk_la_SOURCES = \ glthunk.c if XWIN_MULTIWINDOWEXTWM DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM endif if XWIN_GLX_WINDOWS DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS endif DEFS = \ $(DEFS_MULTIWINDOWEXTWM) \ $(DEFS_GLX_WINDOWS) AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/hw/xwin/ libnativeGLthunk_la_CFLAGS = $(AM_CFLAGS) -Wno-unused-function -Wno-missing-prototypes -Wno-missing-declarations libnativeGLthunk_la_LDFLAGS = -shared -no-undefined -avoid-version -lopengl32 -export-symbols generated_gl_thunks.def EXTRA_libnativeGLthunk_la_DEPENDENCIES = generated_gl_thunks.def if XWIN_GLX_WINDOWS if DEBUG GENGLWRAPPERSOPTS="" else GENGLWRAPPERSOPTS="-nodebug" endif generated_wgl_wrappers.ic: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wgl.xml $(KHRONOS_SPEC_DIR)/reg.py $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/wgl.xml -prefix wgl -wrapper -preresolve $(GENGLWRAPPERSOPTS) -outfile $@ generated_gl_shim.ic: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -shim $(GENGLWRAPPERSOPTS) -outfile $@ generated_gl_thunks.ic: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -thunk $(GENGLWRAPPERSOPTS) -outfile $@ generated_gl_thunks.def: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -thunkdefs $(GENGLWRAPPERSOPTS) -outfile $@ BUILT_SOURCES = generated_gl_shim.ic generated_gl_thunks.ic generated_gl_thunks.def generated_wgl_wrappers.ic CLEANFILES = $(BUILT_SOURCES) endif EXTRA_DIST = gen_gl_wrappers.py xorg-server-1.20.8/hw/xwin/glx/glwindows.h0000644000175000017500000000426613640201473015401 00000000000000/* * File: glwindows.h * Purpose: Header for GLX implementation using native Windows OpenGL library * * Authors: Alexander Gottwald * Jon TURNEY * * Copyright (c) Jon TURNEY 2009 * Copyright (c) Alexander Gottwald 2004 * * * 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ #ifndef GLWINDOWS_H #define GLWINDOWS_H #include typedef struct { unsigned int enableDebug:1; unsigned int enableTrace:1; unsigned int dumpPFD:1; unsigned int dumpHWND:1; unsigned int dumpDC:1; unsigned int enableGLcallTrace:1; unsigned int enableWGLcallTrace:1; } glxWinDebugSettingsRec; extern glxWinDebugSettingsRec glxWinDebugSettings; void glxWinPushNativeProvider(void); void glAddSwapHintRectWINWrapper(GLint x, GLint y, GLsizei width, GLsizei height); int glWinSelectImplementation(int native); #if 1 #define GLWIN_TRACE_MSG(msg, args...) if (glxWinDebugSettings.enableTrace) ErrorF(msg " [%s:%d]\n" , ##args , __FUNCTION__, __LINE__ ) #define GLWIN_DEBUG_MSG(msg, args...) if (glxWinDebugSettings.enableDebug) ErrorF(msg " [%s:%d]\n" , ##args , __FUNCTION__, __LINE__ ) #else #define GLWIN_TRACE_MSG(a, ...) #define GLWIN_DEBUG_MSG(a, ...) #endif #endif xorg-server-1.20.8/hw/xwin/glx/dri_helpers.h0000644000175000017500000000267113640201473015662 00000000000000/* * Copyright © 2014 Jon Turney * * 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. */ #ifndef dri_helpers_h #define dri_helpers_h #include "dixstruct.h" int glxWinQueryDrawable(ClientPtr client, XID drawId, unsigned int *type, unsigned int *handle); int glxWinFBConfigIDToPixelFormatIndex(int scr, int fbConfigID); Bool glxWinGetScreenAiglxIsActive(ScreenPtr pScreen); #endif /* dri_helpers_h */ xorg-server-1.20.8/hw/xwin/glx/glthunk.c0000644000175000017500000000530713640201473015030 00000000000000/* * File: glthunk.c * Purpose: cdecl thunk wrapper library for Win32 stdcall OpenGL library * * Copyright (c) Jon TURNEY 2009,2013 * * 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ // define USE_OPENGL32 makes gl.h declare gl*() function prototypes with stdcall linkage, // so our generated wrappers will correctly link with the functions in opengl32.dll #define USE_OPENGL32 #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #define GL_GLEXT_LEGACY #include #undef GL_ARB_imaging #undef GL_VERSION_1_3 #include static PROC glWinResolveHelper(PROC * cache, const char *symbol) { PROC proc = NULL; /* If not yet cached, call wglGetProcAddress */ if ((*cache) == NULL) { proc = wglGetProcAddress(symbol); if (proc == NULL) { (*cache) = (PROC) - 1; } else { (*cache) = proc; } } /* Cached wglGetProcAddress failure */ else if ((*cache) == (PROC) - 1) { proc = 0; } /* Cached wglGetProcAddress result */ else { proc = (*cache); } return proc; } #define RESOLVE_RET(proctype, symbol, retval) \ static PROC cache = NULL; \ __stdcall proctype proc = (proctype)glWinResolveHelper(&cache, symbol); \ if (proc == NULL) { \ return retval; \ } #define RESOLVE(proctype, symbol) RESOLVE_RET(proctype, symbol,) #define RESOLVED_PROC(proctype) proc /* Include generated cdecl wrappers for stdcall gl*() functions in opengl32.dll OpenGL 1.2 and upward is treated as extensions, function address must found using wglGetProcAddress(), but also stdcall so still need wrappers... */ #include "generated_gl_thunks.ic" xorg-server-1.20.8/hw/xwin/glx/gen_gl_wrappers.py0000755000175000017500000004144213640201473016743 00000000000000#!/usr/bin/python3 # # python script to generate cdecl to stdcall wrappers for GL functions # adapted from genheaders.py # # Copyright (c) 2013 The Khronos Group Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and/or associated documentation files (the # "Materials"), to deal in the Materials without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Materials, and to # permit persons to whom the Materials are 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 Materials. # # THE MATERIALS ARE 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 # MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. import sys, time, pdb, string, cProfile from reg import * # Default input / log files errFilename = None diagFilename = 'diag.txt' regFilename = 'gl.xml' outFilename = 'gen_gl_wrappers.c' protect=True prefix="gl" preresolve=False wrapper=False shim=False thunk=False thunkdefs=False staticwrappers=False nodebug=False # list of WGL extension functions we use used_wgl_ext_fns = {key: 1 for key in [ "wglSwapIntervalEXT", "wglGetExtensionsStringARB", "wglDestroyPbufferARB", "wglGetPbufferDCARB", "wglReleasePbufferDCARB", "wglCreatePbufferARB", "wglMakeContextCurrentARB", "wglChoosePixelFormatARB", "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivARB" ]} if __name__ == '__main__': i = 1 while (i < len(sys.argv)): arg = sys.argv[i] i = i + 1 if (arg == '-noprotect'): print('Disabling inclusion protection in output headers', file=sys.stderr) protect = False elif (arg == '-registry'): regFilename = sys.argv[i] i = i+1 print('Using registry', regFilename, file=sys.stderr) elif (arg == '-outfile'): outFilename = sys.argv[i] i = i+1 elif (arg == '-preresolve'): preresolve=True elif (arg == '-wrapper'): wrapper=True elif (arg == '-shim'): shim=True elif (arg == '-thunk'): thunk=True elif (arg == '-thunkdefs'): thunkdefs=True elif (arg == '-staticwrappers'): staticwrappers=True elif (arg == '-prefix'): prefix = sys.argv[i] i = i+1 elif (arg == '-nodebug'): nodebug = True elif (arg[0:1] == '-'): print('Unrecognized argument:', arg, file=sys.stderr) exit(1) print('Generating', outFilename, file=sys.stderr) # Load & parse registry reg = Registry() tree = etree.parse(regFilename) reg.loadElementTree(tree) if shim: versions = '1\.[012]' else: versions = '.*' genOpts = CGeneratorOptions( apiname = prefix, profile = 'compatibility', versions = versions, emitversions = versions, defaultExtensions = prefix, # Default extensions for GL protectFile = protect, protectFeature = protect, protectProto = protect, ) # create error/warning & diagnostic files if (errFilename): errWarn = open(errFilename,'w') else: errWarn = sys.stderr diag = open(diagFilename, 'w') def ParseCmdRettype(cmd): proto=noneStr(cmd.elem.find('proto')) rettype=noneStr(proto.text) if rettype.lower()!="void ": plist = ([t for t in proto.itertext()]) rettype = ''.join(plist[:-1]) rettype=rettype.strip() return rettype def ParseCmdParams(cmd): params = cmd.elem.findall('param') plist=[] for param in params: # construct the formal parameter definition from ptype and name # elements, also using any text found around these in the # param element, in the order it appears in the document paramtype = '' # also extract the formal parameter name from the name element paramname = '' for t in param.iter(): if t.tag == 'ptype' or t.tag == 'param': paramtype = paramtype + noneStr(t.text) if t.tag == 'name': paramname = t.text + '_' paramtype = paramtype + ' ' + paramname if t.tail is not None: paramtype = paramtype + t.tail.strip() plist.append((paramtype, paramname)) return plist class PreResolveOutputGenerator(OutputGenerator): def __init__(self, errFile = sys.stderr, warnFile = sys.stderr, diagFile = sys.stdout): OutputGenerator.__init__(self, errFile, warnFile, diagFile) self.wrappers={} def beginFile(self, genOpts): self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename) def endFile(self): self.outFile.write('\nvoid ' + prefix + 'ResolveExtensionProcs(void)\n{\n') for funcname in self.wrappers.keys(): self.outFile.write( ' PRERESOLVE(PFN' + funcname.upper() + 'PROC, "' + funcname + '");\n') self.outFile.write('}\n\n') def beginFeature(self, interface, emit): OutputGenerator.beginFeature(self, interface, emit) def endFeature(self): OutputGenerator.endFeature(self) def genType(self, typeinfo, name): OutputGenerator.genType(self, typeinfo, name) def genEnum(self, enuminfo, name): OutputGenerator.genEnum(self, enuminfo, name) def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) if prefix == 'wgl' and not name in used_wgl_ext_fns: return self.outFile.write('RESOLVE_DECL(PFN' + name.upper() + 'PROC);\n') self.wrappers[name]=1 class WrapperOutputGenerator(OutputGenerator): def __init__(self, errFile = sys.stderr, warnFile = sys.stderr, diagFile = sys.stdout): OutputGenerator.__init__(self, errFile, warnFile, diagFile) def beginFile(self, genOpts): self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename) def endFile(self): pass def beginFeature(self, interface, emit): OutputGenerator.beginFeature(self, interface, emit) self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1') def endFeature(self): OutputGenerator.endFeature(self) def genType(self, typeinfo, name): OutputGenerator.genType(self, typeinfo, name) def genEnum(self, enuminfo, name): OutputGenerator.genEnum(self, enuminfo, name) def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) if prefix == 'wgl' and not name in used_wgl_ext_fns: return rettype=ParseCmdRettype(cmd) if staticwrappers: self.outFile.write("static ") self.outFile.write("%s %sWrapper("%(rettype, name)) plist=ParseCmdParams(cmd) Comma="" if len(plist): for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, ptype)) Comma=", " else: self.outFile.write("void") self.outFile.write(")\n{\n") # for GL 1.0 and 1.1 functions, generate stdcall wrappers which call the function directly if self.OldVersion: if not nodebug: self.outFile.write(' if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name)) self.outFile.write(" glWinDirectProcCalls++;\n") self.outFile.write("\n") if rettype.lower()=="void": self.outFile.write(" %s( "%(name)) else: self.outFile.write(" return %s( "%(name)) Comma="" for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, pname)) Comma=", " # for GL 1.2+ functions, generate stdcall wrappers which use wglGetProcAddress() else: if rettype.lower()=="void": self.outFile.write(' RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name)) if not nodebug: self.outFile.write("\n") self.outFile.write(' if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name)) self.outFile.write("\n") self.outFile.write(" RESOLVED_PROC(PFN%sPROC)( """%(name.upper())) else: self.outFile.write(' RESOLVE_RET(PFN%sPROC, "%s", FALSE);\n'%(name.upper(), name)) if not nodebug: self.outFile.write("\n") self.outFile.write(' if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name)) self.outFile.write("\n") self.outFile.write(" return RESOLVED_PROC(PFN%sPROC)("%(name.upper())) Comma="" for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, pname)) Comma=", " self.outFile.write(" );\n}\n\n") class ThunkOutputGenerator(OutputGenerator): def __init__(self, errFile = sys.stderr, warnFile = sys.stderr, diagFile = sys.stdout): OutputGenerator.__init__(self, errFile, warnFile, diagFile) def beginFile(self, genOpts): self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename) def endFile(self): pass def beginFeature(self, interface, emit): OutputGenerator.beginFeature(self, interface, emit) self.OldVersion = (self.featureName in ['GL_VERSION_1_0', 'GL_VERSION_1_1']) def endFeature(self): OutputGenerator.endFeature(self) def genType(self, typeinfo, name): OutputGenerator.genType(self, typeinfo, name) def genEnum(self, enuminfo, name): OutputGenerator.genEnum(self, enuminfo, name) def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) rettype=ParseCmdRettype(cmd) self.outFile.write("%s %sWrapper("%(rettype, name)) plist=ParseCmdParams(cmd) Comma="" if len(plist): for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, ptype)) Comma=", " else: self.outFile.write("void") self.outFile.write(")\n{\n") # for GL 1.0 and 1.1 functions, generate stdcall thunk wrappers which call the function directly if self.OldVersion: if rettype.lower()=="void": self.outFile.write(" %s( "%(name)) else: self.outFile.write(" return %s( "%(name)) Comma="" for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, pname)) Comma=", " # for GL 1.2+ functions, generate wrappers which use wglGetProcAddress() else: if rettype.lower()=="void": self.outFile.write(' RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name)) self.outFile.write(" RESOLVED_PROC(PFN%sPROC)( """%(name.upper())) else: self.outFile.write(' RESOLVE_RET(PFN%sPROC, "%s", FALSE);\n'%(name.upper(), name)) self.outFile.write(" return RESOLVED_PROC(PFN%sPROC)("%(name.upper())) Comma="" for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, pname)) Comma=", " self.outFile.write(" );\n}\n\n") class ThunkDefsOutputGenerator(OutputGenerator): def __init__(self, errFile = sys.stderr, warnFile = sys.stderr, diagFile = sys.stdout): OutputGenerator.__init__(self, errFile, warnFile, diagFile) def beginFile(self, genOpts): self.outFile.write("EXPORTS\n"); # this must be the first line for libtool to realize this is a .def file self.outFile.write('; Automatically generated from %s - DO NOT EDIT\n\n'%regFilename) def endFile(self): pass def beginFeature(self, interface, emit): OutputGenerator.beginFeature(self, interface, emit) def endFeature(self): OutputGenerator.endFeature(self) def genType(self, typeinfo, name): OutputGenerator.genType(self, typeinfo, name) def genEnum(self, enuminfo, name): OutputGenerator.genEnum(self, enuminfo, name) def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) # export the wrapper function with the name of the function it wraps self.outFile.write("%s = %sWrapper\n"%(name, name)) class ShimOutputGenerator(OutputGenerator): def __init__(self, errFile = sys.stderr, warnFile = sys.stderr, diagFile = sys.stdout): OutputGenerator.__init__(self, errFile, warnFile, diagFile) def beginFile(self, genOpts): self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename) def endFile(self): pass def beginFeature(self, interface, emit): OutputGenerator.beginFeature(self, interface, emit) self.OldVersion = (self.featureName in ['GL_VERSION_1_0', 'GL_VERSION_1_1', 'GL_VERSION_1_2', 'GL_ARB_imaging', 'GL_ARB_multitexture', 'GL_ARB_texture_compression']) def endFeature(self): OutputGenerator.endFeature(self) def genType(self, typeinfo, name): OutputGenerator.genType(self, typeinfo, name) def genEnum(self, enuminfo, name): OutputGenerator.genEnum(self, enuminfo, name) def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) if not self.OldVersion: return # for GL functions which are in the ABI, generate a shim which calls the function via GetProcAddress rettype=ParseCmdRettype(cmd) self.outFile.write("%s %s("%(rettype, name)) plist=ParseCmdParams(cmd) Comma="" if len(plist): for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, ptype)) Comma=", " else: self.outFile.write("void") self.outFile.write(")\n{\n") self.outFile.write(' typedef %s (* PFN%sPROC)(' % (rettype, name.upper())) if len(plist): Comma="" for ptype, pname in plist: self.outFile.write("%s %s"%(Comma, ptype)) Comma=", " else: self.outFile.write("void") self.outFile.write(');\n') if rettype.lower()=="void": self.outFile.write(' RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name)) self.outFile.write(' RESOLVED_PROC(') else: self.outFile.write(' RESOLVE_RET(PFN%sPROC, "%s", 0);\n'%(name.upper(), name)) self.outFile.write(' return RESOLVED_PROC(') Comma="" for ptype, pname in plist: self.outFile.write("%s%s"%(Comma, pname)) Comma=", " self.outFile.write(" );\n}\n\n") def genHeaders(): outFile = open(outFilename,"w") if preresolve: gen = PreResolveOutputGenerator(errFile=errWarn, warnFile=errWarn, diagFile=diag) gen.outFile=outFile reg.setGenerator(gen) reg.apiGen(genOpts) if wrapper: gen = WrapperOutputGenerator(errFile=errWarn, warnFile=errWarn, diagFile=diag) gen.outFile=outFile reg.setGenerator(gen) reg.apiGen(genOpts) if shim: gen = ShimOutputGenerator(errFile=errWarn, warnFile=errWarn, diagFile=diag) gen.outFile=outFile reg.setGenerator(gen) reg.apiGen(genOpts) if thunk: gen = ThunkOutputGenerator(errFile=errWarn, warnFile=errWarn, diagFile=diag) gen.outFile=outFile reg.setGenerator(gen) reg.apiGen(genOpts) if thunkdefs: gen = ThunkDefsOutputGenerator(errFile=errWarn, warnFile=errWarn, diagFile=diag) gen.outFile=outFile reg.setGenerator(gen) reg.apiGen(genOpts) outFile.close() genHeaders() xorg-server-1.20.8/hw/xwin/glx/Makefile.in0000644000175000017500000010443113640201514015247 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @XWIN_WINDOWS_DRI_TRUE@am__append_1 = \ @XWIN_WINDOWS_DRI_TRUE@ dri_helpers.c \ @XWIN_WINDOWS_DRI_TRUE@ dri_helpers.h subdir = hw/xwin/glx ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libXwinGLX_la_LIBADD = am__libXwinGLX_la_SOURCES_DIST = winpriv.c winpriv.h glwindows.h \ glshim.c indirect.c indirect.h wgl_ext_api.c wgl_ext_api.h \ dri_helpers.c dri_helpers.h @XWIN_WINDOWS_DRI_TRUE@am__objects_1 = dri_helpers.lo am_libXwinGLX_la_OBJECTS = winpriv.lo glshim.lo indirect.lo \ wgl_ext_api.lo $(am__objects_1) libXwinGLX_la_OBJECTS = $(am_libXwinGLX_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libnativeGLthunk_la_LIBADD = am_libnativeGLthunk_la_OBJECTS = libnativeGLthunk_la-glthunk.lo libnativeGLthunk_la_OBJECTS = $(am_libnativeGLthunk_la_OBJECTS) libnativeGLthunk_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libnativeGLthunk_la_CFLAGS) $(CFLAGS) \ $(libnativeGLthunk_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dri_helpers.Plo \ ./$(DEPDIR)/glshim.Plo ./$(DEPDIR)/indirect.Plo \ ./$(DEPDIR)/libnativeGLthunk_la-glthunk.Plo \ ./$(DEPDIR)/wgl_ext_api.Plo ./$(DEPDIR)/winpriv.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libXwinGLX_la_SOURCES) $(libnativeGLthunk_la_SOURCES) DIST_SOURCES = $(am__libXwinGLX_la_SOURCES_DIST) \ $(libnativeGLthunk_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = \ $(DEFS_MULTIWINDOWEXTWM) \ $(DEFS_GLX_WINDOWS) DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libXwinGLX.la lib_LTLIBRARIES = libnativeGLthunk.la libXwinGLX_la_SOURCES = winpriv.c winpriv.h glwindows.h glshim.c \ indirect.c indirect.h wgl_ext_api.c wgl_ext_api.h \ $(am__append_1) libnativeGLthunk_la_SOURCES = \ glthunk.c @XWIN_MULTIWINDOWEXTWM_TRUE@DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM @XWIN_GLX_WINDOWS_TRUE@DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/hw/xwin/ libnativeGLthunk_la_CFLAGS = $(AM_CFLAGS) -Wno-unused-function -Wno-missing-prototypes -Wno-missing-declarations libnativeGLthunk_la_LDFLAGS = -shared -no-undefined -avoid-version -lopengl32 -export-symbols generated_gl_thunks.def EXTRA_libnativeGLthunk_la_DEPENDENCIES = generated_gl_thunks.def @DEBUG_FALSE@@XWIN_GLX_WINDOWS_TRUE@GENGLWRAPPERSOPTS = "-nodebug" @DEBUG_TRUE@@XWIN_GLX_WINDOWS_TRUE@GENGLWRAPPERSOPTS = "" @XWIN_GLX_WINDOWS_TRUE@BUILT_SOURCES = generated_gl_shim.ic generated_gl_thunks.ic generated_gl_thunks.def generated_wgl_wrappers.ic @XWIN_GLX_WINDOWS_TRUE@CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = gen_gl_wrappers.py all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwin/glx/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xwin/glx/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libXwinGLX.la: $(libXwinGLX_la_OBJECTS) $(libXwinGLX_la_DEPENDENCIES) $(EXTRA_libXwinGLX_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libXwinGLX_la_OBJECTS) $(libXwinGLX_la_LIBADD) $(LIBS) libnativeGLthunk.la: $(libnativeGLthunk_la_OBJECTS) $(libnativeGLthunk_la_DEPENDENCIES) $(EXTRA_libnativeGLthunk_la_DEPENDENCIES) $(AM_V_CCLD)$(libnativeGLthunk_la_LINK) -rpath $(libdir) $(libnativeGLthunk_la_OBJECTS) $(libnativeGLthunk_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri_helpers.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glshim.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnativeGLthunk_la-glthunk.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wgl_ext_api.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpriv.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libnativeGLthunk_la-glthunk.lo: glthunk.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnativeGLthunk_la_CFLAGS) $(CFLAGS) -MT libnativeGLthunk_la-glthunk.lo -MD -MP -MF $(DEPDIR)/libnativeGLthunk_la-glthunk.Tpo -c -o libnativeGLthunk_la-glthunk.lo `test -f 'glthunk.c' || echo '$(srcdir)/'`glthunk.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnativeGLthunk_la-glthunk.Tpo $(DEPDIR)/libnativeGLthunk_la-glthunk.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='glthunk.c' object='libnativeGLthunk_la-glthunk.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnativeGLthunk_la_CFLAGS) $(CFLAGS) -c -o libnativeGLthunk_la-glthunk.lo `test -f 'glthunk.c' || echo '$(srcdir)/'`glthunk.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/dri_helpers.Plo -rm -f ./$(DEPDIR)/glshim.Plo -rm -f ./$(DEPDIR)/indirect.Plo -rm -f ./$(DEPDIR)/libnativeGLthunk_la-glthunk.Plo -rm -f ./$(DEPDIR)/wgl_ext_api.Plo -rm -f ./$(DEPDIR)/winpriv.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/dri_helpers.Plo -rm -f ./$(DEPDIR)/glshim.Plo -rm -f ./$(DEPDIR)/indirect.Plo -rm -f ./$(DEPDIR)/libnativeGLthunk_la-glthunk.Plo -rm -f ./$(DEPDIR)/wgl_ext_api.Plo -rm -f ./$(DEPDIR)/winpriv.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES .PRECIOUS: Makefile @XWIN_GLX_WINDOWS_TRUE@generated_wgl_wrappers.ic: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wgl.xml $(KHRONOS_SPEC_DIR)/reg.py @XWIN_GLX_WINDOWS_TRUE@ $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/wgl.xml -prefix wgl -wrapper -preresolve $(GENGLWRAPPERSOPTS) -outfile $@ @XWIN_GLX_WINDOWS_TRUE@generated_gl_shim.ic: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py @XWIN_GLX_WINDOWS_TRUE@ $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -shim $(GENGLWRAPPERSOPTS) -outfile $@ @XWIN_GLX_WINDOWS_TRUE@generated_gl_thunks.ic: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py @XWIN_GLX_WINDOWS_TRUE@ $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -thunk $(GENGLWRAPPERSOPTS) -outfile $@ @XWIN_GLX_WINDOWS_TRUE@generated_gl_thunks.def: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py @XWIN_GLX_WINDOWS_TRUE@ $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -thunkdefs $(GENGLWRAPPERSOPTS) -outfile $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xwin/glx/glshim.c0000644000175000017500000000756013640201473014642 00000000000000/* * File: glshim.c * Purpose: GL shim which redirects to a specified DLL * * Copyright (c) Jon TURNEY 2013 * * 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ /* A GL shim which redirects to a specified DLL XWin is statically linked with this, rather than the system libGL, so that GL calls can be directed to mesa cygGL-1.dll, or cygnativeGLthunk.dll (which contains cdecl-to-stdcall thunks to the native openGL32.dll) */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #define GL_GLEXT_LEGACY #define GL_GLEXT_PROTOTYPES #include #undef GL_ARB_imaging #undef GL_VERSION_1_3 #include #include #include #include "glwindows.h" #include extern void *glXGetProcAddressARB(const char *); static HMODULE hMod = NULL; /* Implement the __glGetProcAddress function by just using GetProcAddress() on the selected DLL */ void *glXGetProcAddressARB(const char *symbol) { void *proc; /* Default to the mesa GL implementation if one hasn't been selected yet */ if (!hMod) glWinSelectImplementation(0); proc = GetProcAddress(hMod, symbol); if (glxWinDebugSettings.enableGLcallTrace) ErrorF("glXGetProcAddressARB: Resolved '%s' in %p to %p\n", symbol, hMod, proc); return proc; } /* Select a GL implementation DLL */ int glWinSelectImplementation(int native) { const char *dllname; if (native) { dllname = "cygnativeGLthunk.dll"; } else { dllname = "cygGL-1.dll"; } hMod = LoadLibraryEx(dllname, NULL, 0); if (hMod == NULL) { ErrorF("glWinSelectGLimplementation: Could not load '%s'\n", dllname); return -1; } ErrorF("glWinSelectGLimplementation: Loaded '%s'\n", dllname); /* Connect __glGetProcAddress() to our implementation of glXGetProcAddressARB() above */ __glXsetGetProcAddress((glx_gpa_proc)glXGetProcAddressARB); return 0; } #define RESOLVE_RET(proctype, symbol, retval) \ proctype proc = (proctype)glXGetProcAddressARB(symbol); \ if (proc == NULL) return retval; #define RESOLVE(proctype, symbol) RESOLVE_RET(proctype, symbol,) #define RESOLVED_PROC proc /* Include generated shims for direct linkage to GL functions which are in the ABI */ #include "generated_gl_shim.ic" /* Special wrapper for glAddSwapHintRectWIN for copySubBuffers Only used with native GL if the GL_WIN_swap_hint extension is present, so we enable GLX_MESA_copy_sub_buffer */ typedef void (__stdcall * PFNGLADDSWAPHINTRECTWIN) (GLint x, GLint y, GLsizei width, GLsizei height); void glAddSwapHintRectWINWrapper(GLint x, GLint y, GLsizei width, GLsizei height) { RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN"); RESOLVED_PROC(x, y, width, height); } xorg-server-1.20.8/hw/xwin/glx/winpriv.c0000644000175000017500000000626313640201473015054 00000000000000/* * Export window information for the Windows-OpenGL GLX implementation. * * Authors: Alexander Gottwald */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winpriv.h" #include "winwindow.h" void winCreateWindowsWindow(WindowPtr pWin); /** * Return size and handles of a window. * If pWin is NULL, then the information for the root window is requested. */ HWND winGetWindowInfo(WindowPtr pWin) { winTrace("%s: pWin %p XID 0x%x\n", __FUNCTION__, pWin, (unsigned int)pWin->drawable.id); /* a real window was requested */ if (pWin != NULL) { /* Get the window and screen privates */ ScreenPtr pScreen = pWin->drawable.pScreen; winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); winScreenInfoPtr pScreenInfo = NULL; HWND hwnd = NULL; if (pWinScreen == NULL) { ErrorF("winGetWindowInfo: screen has no privates\n"); return NULL; } hwnd = pWinScreen->hwndScreen; pScreenInfo = pWinScreen->pScreenInfo; /* check for multiwindow mode */ if (pScreenInfo->fMultiWindow) { winWindowPriv(pWin); if (pWinPriv == NULL) { ErrorF("winGetWindowInfo: window has no privates\n"); return hwnd; } if (pWinPriv->hWnd == NULL) { winCreateWindowsWindow(pWin); winDebug("winGetWindowInfo: forcing window to exist\n"); } if (pWinPriv->hWnd != NULL) { /* copy window handle */ hwnd = pWinPriv->hWnd; /* mark GLX active on that hwnd */ pWinPriv->fWglUsed = TRUE; } return hwnd; } #ifdef XWIN_MULTIWINDOWEXTWM /* check for multiwindow external wm mode */ if (pScreenInfo->fMWExtWM) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); if (pRLWinPriv == NULL) { ErrorF("winGetWindowInfo: window has no privates\n"); return hwnd; } if (pRLWinPriv->hWnd != NULL) { /* copy window handle */ hwnd = pRLWinPriv->hWnd; } return hwnd; } #endif } else { ScreenPtr pScreen = g_ScreenInfo[0].pScreen; winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); if (pWinScreen == NULL) { ErrorF("winGetWindowInfo: screen has no privates\n"); return NULL; } ErrorF("winGetWindowInfo: returning root window\n"); return pWinScreen->hwndScreen; } return NULL; } Bool winCheckScreenAiglxIsSupported(ScreenPtr pScreen) { winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo; if (pScreenInfo->fMultiWindow) return TRUE; #ifdef XWIN_MULTIWINDOWEXTWM if (pScreenInfo->fMWExtWM) return TRUE; #endif return FALSE; } void winSetScreenAiglxIsActive(ScreenPtr pScreen) { winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); pWinScreen->fNativeGlActive = TRUE; } xorg-server-1.20.8/hw/xwin/glx/wgl_ext_api.h0000644000175000017500000000635213640201473015664 00000000000000/* * File: wgl_ext_api.h * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions * * Authors: Jon TURNEY * * Copyright (c) Jon TURNEY 2009 * * * 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ #ifndef wgl_ext_api_h #define wgl_ext_api_h #include void wglResolveExtensionProcs(void); /* Prototypes for wrapper functions we actually use XXX: should be automatically generated as well */ const char *wglGetExtensionsStringARBWrapper(HDC hdc); BOOL wglMakeContextCurrentARBWrapper(HDC hDrawDC, HDC hReadDC, HGLRC hglrc); HDC wglGetCurrentReadDCARBWrapper(VOID); BOOL wglGetPixelFormatAttribivARBWrapper(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); BOOL wglGetPixelFormatAttribfvARBWrapper(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT * pfValues); BOOL wglChoosePixelFormatARBWrapper(HDC hdc, const int *piAttribIList, const FLOAT * pfAttribFList, UINT nMaxFormats, int *piFormats, UINT * nNumFormats); HPBUFFERARB wglCreatePbufferARBWrapper(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); HDC wglGetPbufferDCARBWrapper(HPBUFFERARB hPbuffer); int wglReleasePbufferDCARBWrapper(HPBUFFERARB hPbuffer, HDC hDC); BOOL wglDestroyPbufferARBWrapper(HPBUFFERARB hPbuffer); BOOL wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer, int iAttribute, int *piValue); BOOL wglSwapIntervalEXTWrapper(int interval); int wglGetSwapIntervalEXTWrapper(void); #endif /* wgl_ext_api_h */ xorg-server-1.20.8/hw/xwin/glx/wgl_ext_api.c0000644000175000017500000000462513640201473015660 00000000000000/* * File: wgl_ext_api.c * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions * * Authors: Jon TURNEY * * Copyright (c) Jon TURNEY 2009 * * * 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "glwindows.h" #define RESOLVE_DECL(type) \ static type type##proc = NULL; #define PRERESOLVE(type, symbol) \ type##proc = (type)wglGetProcAddress(symbol); #define RESOLVE_RET(type, symbol, retval) \ if (type##proc == NULL) { \ ErrorF("wglwrap: Can't resolve \"%s\"\n", symbol); \ __glXErrorCallBack(0); \ return retval; \ } #define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,) #define RESOLVED_PROC(type) type##proc /* * Include generated cdecl wrappers for stdcall WGL functions * * There are extensions to the wgl*() API as well; again we call * these functions by using wglGetProcAddress() to get a pointer * to the function, and wrapping it for cdecl/stdcall conversion * * We arrange to resolve the functions up front, as they need a * context to work, as we like to use them to be able to select * a context. Again, this assumption fails badly on multimontor * systems... */ #include "generated_wgl_wrappers.ic" xorg-server-1.20.8/hw/xwin/glx/dri_helpers.c0000644000175000017500000001011013640201473015640 00000000000000/* * Copyright © 2014 Jon Turney * * 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_XWIN_CONFIG_H #include #endif #include #include #include #include "indirect.h" #include "winpriv.h" #include "dri_helpers.h" #include "win.h" int glxWinQueryDrawable(ClientPtr client, XID drawId, unsigned int *type, unsigned int *handle) { __GLXWinDrawable *pDrawable; int err; if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, DixReadAccess, (__GLXdrawable **)&pDrawable, &err)) { switch (pDrawable->base.type) { case GLX_DRAWABLE_WINDOW: { HWND h = winGetWindowInfo((WindowPtr)(pDrawable->base.pDraw)); *handle = (uintptr_t)h; *type = WindowsDRIDrawableWindow; } break; case GLX_DRAWABLE_PIXMAP: glxWinDeferredCreateDrawable(pDrawable, pDrawable->base.config); *handle = pDrawable->base.pDraw->id; // The XID is used to create a unique name for a file mapping // shared with the requesting process // // XXX: Alternatively, we could use an anonymous file mapping // and use DuplicateHandle to make pDrawable->hSection available // to the requesting process... ? *type = WindowsDRIDrawablePixmap; break; case GLX_DRAWABLE_PBUFFER: glxWinDeferredCreateDrawable(pDrawable, pDrawable->base.config); *handle = (uintptr_t)(pDrawable->hPbuffer); *type = WindowsDRIDrawablePbuffer; break; default: assert(FALSE); *handle = 0; } } else { HWND h; /* The drawId XID doesn't identify a GLX drawable. The only other valid alternative is that it is the XID of a window drawable that is being used by the pre-GLX 1.3 interface */ DrawablePtr pDraw; int rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); if (rc != Success || pDraw->type != DRAWABLE_WINDOW) { return err; } h = winGetWindowInfo((WindowPtr)(pDraw)); *handle = (uintptr_t)h; *type = WindowsDRIDrawableWindow; } winDebug("glxWinQueryDrawable: type %d, handle %p\n", *type, (void *)(uintptr_t)*handle); return Success; } int glxWinFBConfigIDToPixelFormatIndex(int scr, int fbConfigID) { __GLXscreen *screen = glxGetScreen(screenInfo.screens[scr]); __GLXconfig *c; for (c = screen->fbconfigs; c != NULL; c = c->next) { if (c->fbconfigID == fbConfigID) return ((GLXWinConfig *)c)->pixelFormatIndex; } return 0; } Bool glxWinGetScreenAiglxIsActive(ScreenPtr pScreen) { winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen); return pWinScreen->fNativeGlActive; } xorg-server-1.20.8/hw/xwin/glx/meson.build0000644000175000017500000000535113640201473015351 00000000000000python3 = import('python3') # XWin requires OpenGL spec files in order to generate wrapper code for native GL functions py3 = python3.find_python() if run_command(py3, '-c', 'import lxml;').returncode() != 0 error('python3 lxml module not found') endif khronos_spec_dir = dependency('khronos-opengl-registry').get_pkgconfig_variable('specdir') gen_gl_wrappers_opts= ['-nodebug'] gen_gl_wrappers_cmd = ['env', 'PYTHONPATH=' + khronos_spec_dir, py3, files('./gen_gl_wrappers.py'), gen_gl_wrappers_opts] wgl_wrappers = custom_target( 'gen_wgl_wrappers', command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-prefix', 'wgl', '-wrapper', '-preresolve', '-outfile', '@OUTPUT@'], input: join_paths(khronos_spec_dir, 'wgl.xml'), output: 'generated_wgl_wrappers.ic', depend_files: join_paths(khronos_spec_dir, 'reg.py'), ) gl_shim = custom_target( 'gen_gl_shim', command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-shim', '-outfile', '@OUTPUT@'], input: join_paths(khronos_spec_dir, 'gl.xml'), output: 'generated_gl_shim.ic', depend_files: join_paths(khronos_spec_dir, 'reg.py'), ) gl_thunks = custom_target( 'gen_gl_thunks', command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunk', '-outfile', '@OUTPUT@'], input: join_paths(khronos_spec_dir, 'gl.xml'), output: 'generated_gl_thunks.ic', depend_files: join_paths(khronos_spec_dir, 'reg.py'), ) gl_thunks_def = custom_target( 'gen_gl_thunks_def', command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunkdefs', '-outfile', '@OUTPUT@'], input: join_paths(khronos_spec_dir, 'gl.xml'), output: 'generated_gl_thunks.def', depend_files: join_paths(khronos_spec_dir, 'reg.py'), ) srcs_windows_glx = [ 'winpriv.c', 'winpriv.h', 'glwindows.h', 'glshim.c', gl_shim, 'indirect.c', 'indirect.h', 'wgl_ext_api.c', wgl_wrappers, 'wgl_ext_api.h', ] if build_windowsdri srcs_windows_glx += [ 'dri_helpers.c', 'dri_helpers.h', ] endif xwin_glx_c_args = [] xwin_glx_c_args += '-DHAVE_XWIN_CONFIG_H' xwin_glx_c_args += '-DXWIN_GLX_WINDOWS' xwin_glx = static_library( 'XwinGLX', srcs_windows_glx, include_directories: [ inc, top_srcdir_inc, include_directories('../'), ], dependencies: common_dep, c_args: xwin_glx_c_args, ) srcs_wgl_thunk = [ 'glthunk.c', gl_thunks, ] WGLthunk = shared_library( 'nativeGLthunk', srcs_wgl_thunk, include_directories: [ inc, top_srcdir_inc, ], c_args: xwin_glx_c_args + [ '-Wno-unused-function', '-Wno-missing-prototypes', '-Wno-missing-declarations', ], link_args: ['-lopengl32'], vs_module_defs: gl_thunks_def, install: true, ) xorg-server-1.20.8/hw/xwin/glx/winpriv.h0000644000175000017500000000046613640201473015060 00000000000000/* * Export window information for the Windows-OpenGL GLX implementation. * * Authors: Alexander Gottwald */ #include #include HWND winGetWindowInfo(WindowPtr pWin); Bool winCheckScreenAiglxIsSupported(ScreenPtr pScreen); void winSetScreenAiglxIsActive(ScreenPtr pScreen); xorg-server-1.20.8/hw/xwin/glx/indirect.h0000644000175000017500000000570513640201473015164 00000000000000/* * Copyright © 2014 Jon TURNEY * * 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. */ #ifndef indirect_h #define indirect_h #include #include #include /* ---------------------------------------------------------------------- */ /* * structure definitions */ typedef struct __GLXWinContext __GLXWinContext; typedef struct __GLXWinDrawable __GLXWinDrawable; typedef struct __GLXWinScreen glxWinScreen; typedef struct __GLXWinConfig GLXWinConfig; struct __GLXWinContext { __GLXcontext base; HGLRC ctx; /* Windows GL Context */ __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */ HWND hwnd; /* For detecting when HWND has changed */ }; struct __GLXWinDrawable { __GLXdrawable base; __GLXWinContext *drawContext; __GLXWinContext *readContext; /* If this drawable is GLX_DRAWABLE_PBUFFER */ HPBUFFERARB hPbuffer; /* If this drawable is GLX_DRAWABLE_PIXMAP */ HDC dibDC; HANDLE hSection; /* file mapping handle */ HBITMAP hDIB; HBITMAP hOldDIB; /* original DIB for DC */ void *pOldBits; /* original pBits for this drawable's pixmap */ }; struct __GLXWinScreen { __GLXscreen base; Bool has_WGL_ARB_multisample; Bool has_WGL_ARB_pixel_format; Bool has_WGL_ARB_pbuffer; Bool has_WGL_ARB_render_texture; Bool has_WGL_ARB_make_current_read; /* wrapped screen functions */ RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; CopyWindowProcPtr CopyWindow; }; struct __GLXWinConfig { __GLXconfig base; int pixelFormatIndex; }; /* ---------------------------------------------------------------------- */ /* * function prototypes */ void glxWinDeferredCreateDrawable(__GLXWinDrawable *draw, __GLXconfig *config); #endif /* indirect_h */ xorg-server-1.20.8/hw/xwin/winallpriv.c0000644000175000017500000001245213640201473014750 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Keith Packard, MIT X Consortium * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* See Porting Layer Definition - p. 58 */ /* * Allocate indexes for the privates that we use. * Allocate memory directly for the screen privates. * Reserve space in GCs and Pixmaps for our privates. * Colormap privates are handled in winAllocateCmapPrivates () */ Bool winAllocatePrivates(ScreenPtr pScreen) { winPrivScreenPtr pScreenPriv; #if CYGDEBUG winDebug("winAllocateScreenPrivates - g_ulServerGeneration: %lu " "serverGeneration: %lu\n", g_ulServerGeneration, serverGeneration); #endif /* We need a new slot for our privates if the screen gen has changed */ if (g_ulServerGeneration != serverGeneration) { g_ulServerGeneration = serverGeneration; } /* Allocate memory for the screen private structure */ pScreenPriv = malloc(sizeof(winPrivScreenRec)); if (!pScreenPriv) { ErrorF("winAllocateScreenPrivates - malloc () failed\n"); return FALSE; } /* Initialize the memory of the private structure */ ZeroMemory(pScreenPriv, sizeof(winPrivScreenRec)); /* Intialize private structure members */ pScreenPriv->fActive = TRUE; /* Register our screen private */ if (!dixRegisterPrivateKey(g_iScreenPrivateKey, PRIVATE_SCREEN, 0)) { ErrorF("winAllocatePrivates - AllocateScreenPrivate () failed\n"); return FALSE; } /* Save the screen private pointer */ winSetScreenPriv(pScreen, pScreenPriv); /* Reserve Pixmap memory for our privates */ if (!dixRegisterPrivateKey (g_iPixmapPrivateKey, PRIVATE_PIXMAP, sizeof(winPrivPixmapRec))) { ErrorF("winAllocatePrivates - AllocatePixmapPrivates () failed\n"); return FALSE; } /* Reserve Window memory for our privates */ if (!dixRegisterPrivateKey (g_iWindowPrivateKey, PRIVATE_WINDOW, sizeof(winPrivWinRec))) { ErrorF("winAllocatePrivates () - AllocateWindowPrivates () failed\n"); return FALSE; } return TRUE; } /* * Colormap privates may be allocated after the default colormap has * already been created for some screens. This initialization procedure * is called for each default colormap that is found. */ Bool winInitCmapPrivates(ColormapPtr pcmap, int i) { #if CYGDEBUG winDebug("winInitCmapPrivates\n"); #endif /* * I see no way that this function can do anything useful * with only a ColormapPtr. We don't have the index for * our dev privates yet, so we can't really initialize * anything. Perhaps I am misunderstanding the purpose * of this function. */ /* That's definitely true. * I therefore changed the API and added the index as argument. */ return TRUE; } /* * Allocate memory for our colormap privates */ Bool winAllocateCmapPrivates(ColormapPtr pCmap) { winPrivCmapPtr pCmapPriv; static unsigned long s_ulPrivateGeneration = 0; #if CYGDEBUG winDebug("winAllocateCmapPrivates\n"); #endif /* Get a new privates index when the server generation changes */ if (s_ulPrivateGeneration != serverGeneration) { /* Save the new server generation */ s_ulPrivateGeneration = serverGeneration; } /* Allocate memory for our private structure */ pCmapPriv = malloc(sizeof(winPrivCmapRec)); if (!pCmapPriv) { ErrorF("winAllocateCmapPrivates - malloc () failed\n"); return FALSE; } /* Initialize the memory of the private structure */ ZeroMemory(pCmapPriv, sizeof(winPrivCmapRec)); /* Register our colourmap private */ if (!dixRegisterPrivateKey(g_iCmapPrivateKey, PRIVATE_COLORMAP, 0)) { ErrorF("winAllocateCmapPrivates - AllocateCmapPrivate () failed\n"); return FALSE; } /* Save the cmap private pointer */ winSetCmapPriv(pCmap, pCmapPriv); #if CYGDEBUG winDebug("winAllocateCmapPrivates - Returning\n"); #endif return TRUE; } xorg-server-1.20.8/hw/xwin/winwindow.c0000644000175000017500000002247413640201473014613 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Harold L Hunt II * Kensuke Matsuzaki */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * Prototypes for local functions */ static int winAddRgn(WindowPtr pWindow, void *data); static void winUpdateRgnRootless(WindowPtr pWindow); static void winReshapeRootless(WindowPtr pWin); /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbCreateWindow() */ Bool winCreateWindowRootless(WindowPtr pWin) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG winTrace("winCreateWindowRootless (%p)\n", pWin); #endif WIN_UNWRAP(CreateWindow); fResult = (*pScreen->CreateWindow) (pWin); WIN_WRAP(CreateWindow, winCreateWindowRootless); pWinPriv->hRgn = NULL; return fResult; } /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbDestroyWindow() */ Bool winDestroyWindowRootless(WindowPtr pWin) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG winTrace("winDestroyWindowRootless (%p)\n", pWin); #endif WIN_UNWRAP(DestroyWindow); fResult = (*pScreen->DestroyWindow) (pWin); WIN_WRAP(DestroyWindow, winDestroyWindowRootless); if (pWinPriv->hRgn != NULL) { DeleteObject(pWinPriv->hRgn); pWinPriv->hRgn = NULL; } winUpdateRgnRootless(pWin); return fResult; } /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbPositionWindow() */ Bool winPositionWindowRootless(WindowPtr pWin, int x, int y) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGDEBUG winTrace("winPositionWindowRootless (%p)\n", pWin); #endif WIN_UNWRAP(PositionWindow); fResult = (*pScreen->PositionWindow) (pWin, x, y); WIN_WRAP(PositionWindow, winPositionWindowRootless); winUpdateRgnRootless(pWin); return fResult; } /* See Porting Layer Definition - p. 37 */ /* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ Bool winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGDEBUG winTrace("winChangeWindowAttributesRootless (%p)\n", pWin); #endif WIN_UNWRAP(ChangeWindowAttributes); fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask); WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless); winUpdateRgnRootless(pWin); return fResult; } /* See Porting Layer Definition - p. 37 * Also referred to as UnrealizeWindow */ Bool winUnmapWindowRootless(WindowPtr pWin) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); #if CYGDEBUG winTrace("winUnmapWindowRootless (%p)\n", pWin); #endif WIN_UNWRAP(UnrealizeWindow); fResult = (*pScreen->UnrealizeWindow) (pWin); WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless); if (pWinPriv->hRgn != NULL) { DeleteObject(pWinPriv->hRgn); pWinPriv->hRgn = NULL; } winUpdateRgnRootless(pWin); return fResult; } /* See Porting Layer Definition - p. 37 * Also referred to as RealizeWindow */ Bool winMapWindowRootless(WindowPtr pWin) { Bool fResult = FALSE; ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGDEBUG winTrace("winMapWindowRootless (%p)\n", pWin); #endif WIN_UNWRAP(RealizeWindow); fResult = (*pScreen->RealizeWindow) (pWin); WIN_WRAP(RealizeWindow, winMapWindowRootless); winReshapeRootless(pWin); winUpdateRgnRootless(pWin); return fResult; } void winSetShapeRootless(WindowPtr pWin, int kind) { ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGDEBUG winTrace("winSetShapeRootless (%p, %i)\n", pWin, kind); #endif WIN_UNWRAP(SetShape); (*pScreen->SetShape) (pWin, kind); WIN_WRAP(SetShape, winSetShapeRootless); winReshapeRootless(pWin); winUpdateRgnRootless(pWin); return; } /* * Local function for adding a region to the Windows window region */ static int winAddRgn(WindowPtr pWin, void *data) { int iX, iY, iWidth, iHeight, iBorder; HRGN hRgn = *(HRGN *) data; HRGN hRgnWin; winWindowPriv(pWin); /* If pWin is not Root */ if (pWin->parent != NULL) { #if CYGDEBUG winDebug("winAddRgn ()\n"); #endif if (pWin->mapped) { iBorder = wBorderWidth(pWin); iX = pWin->drawable.x - iBorder; iY = pWin->drawable.y - iBorder; iWidth = pWin->drawable.width + iBorder * 2; iHeight = pWin->drawable.height + iBorder * 2; hRgnWin = CreateRectRgn(0, 0, iWidth, iHeight); if (hRgnWin == NULL) { ErrorF("winAddRgn - CreateRectRgn () failed\n"); ErrorF(" Rect %d %d %d %d\n", iX, iY, iX + iWidth, iY + iHeight); } if (pWinPriv->hRgn) { if (CombineRgn(hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND) == ERROR) { ErrorF("winAddRgn - CombineRgn () failed\n"); } } OffsetRgn(hRgnWin, iX, iY); if (CombineRgn(hRgn, hRgn, hRgnWin, RGN_OR) == ERROR) { ErrorF("winAddRgn - CombineRgn () failed\n"); } DeleteObject(hRgnWin); } return WT_DONTWALKCHILDREN; } else { return WT_WALKCHILDREN; } } /* * Local function to update the Windows window's region */ static void winUpdateRgnRootless(WindowPtr pWin) { HRGN hRgn = CreateRectRgn(0, 0, 0, 0); if (hRgn != NULL) { WalkTree(pWin->drawable.pScreen, winAddRgn, &hRgn); SetWindowRgn(winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen, hRgn, TRUE); } else { ErrorF("winUpdateRgnRootless - CreateRectRgn failed.\n"); } } static void winReshapeRootless(WindowPtr pWin) { int nRects; RegionRec rrNewShape; BoxPtr pShape, pRects, pEnd; HRGN hRgn, hRgnRect; winWindowPriv(pWin); #if CYGDEBUG winDebug("winReshapeRootless ()\n"); #endif /* Bail if the window is the root window */ if (pWin->parent == NULL) return; /* Bail if the window is not top level */ if (pWin->parent->parent != NULL) return; /* Free any existing window region stored in the window privates */ if (pWinPriv->hRgn != NULL) { DeleteObject(pWinPriv->hRgn); pWinPriv->hRgn = NULL; } /* Bail if the window has no bounding region defined */ if (!wBoundingShape(pWin)) return; RegionNull(&rrNewShape); RegionCopy(&rrNewShape, wBoundingShape(pWin)); RegionTranslate(&rrNewShape, pWin->borderWidth, pWin->borderWidth); nRects = RegionNumRects(&rrNewShape); pShape = RegionRects(&rrNewShape); if (nRects > 0) { /* Create initial empty Windows region */ hRgn = CreateRectRgn(0, 0, 0, 0); /* Loop through all rectangles in the X region */ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) { /* Create a Windows region for the X rectangle */ hRgnRect = CreateRectRgn(pRects->x1, pRects->y1, pRects->x2, pRects->y2); if (hRgnRect == NULL) { ErrorF("winReshapeRootless - CreateRectRgn() failed\n"); } /* Merge the Windows region with the accumulated region */ if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) { ErrorF("winReshapeRootless - CombineRgn() failed\n"); } /* Delete the temporary Windows region */ DeleteObject(hRgnRect); } /* Save a handle to the composite region in the window privates */ pWinPriv->hRgn = hRgn; } RegionUninit(&rrNewShape); return; } xorg-server-1.20.8/hw/xwin/wintaskbar.c0000644000175000017500000000612213640201473014723 00000000000000/* 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_XWIN_CONFIG_H #include #endif #include "win.h" #include "winwindow.h" const GUID CLSID_TaskbarList = {0x56fdf344,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}}; const GUID IID_ITaskbarList = {0x56fdf342,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}}; #ifdef INTERFACE #undef INTERFACE #endif #define INTERFACE ITaskbarList DECLARE_INTERFACE_(ITaskbarList, IUnknown) { /* IUnknown methods */ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; /* ITaskbarList methods */ STDMETHOD(HrInit) (THIS) PURE; STDMETHOD(AddTab) (THIS_ HWND hWnd) PURE; STDMETHOD(DeleteTab) (THIS_ HWND hWnd) PURE; STDMETHOD(ActivateTab) (THIS_ HWND hWnd) PURE; STDMETHOD(SetActiveAlt) (THIS_ HWND hWnd) PURE; }; #undef INTERFACE /* The stuff above needs to be in win32api headers, not defined here, or at least generated from the MIDL :-) */ /* This is unnecessarily heavyweight, we could just call CoInitialize() once at startup and CoUninitialize() once at shutdown */ /* The documentation for ITaskbarList::AddTab says that we are responsible for deleting the tab ourselves when the window is deleted, but that doesn't actually seem to be the case */ void winShowWindowOnTaskbar(HWND hWnd, Bool show) { ITaskbarList* pTaskbarList = NULL; if (SUCCEEDED(CoInitialize(NULL))) { if (SUCCEEDED(CoCreateInstance((const CLSID *)&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, (const IID *)&IID_ITaskbarList, (void**)&pTaskbarList))) { if (SUCCEEDED(pTaskbarList->lpVtbl->HrInit(pTaskbarList))) { if (show) { pTaskbarList->lpVtbl->AddTab(pTaskbarList,hWnd); } else { pTaskbarList->lpVtbl->DeleteTab(pTaskbarList,hWnd); } } pTaskbarList->lpVtbl->Release(pTaskbarList); } CoUninitialize(); } } xorg-server-1.20.8/hw/xwin/winprefsyacc.c0000644000175000017500000017567713640201535015300 00000000000000/* A Bison parser, made by GNU Bison 3.1. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Copy the first part of user declarations. */ #line 1 "winprefsyacc.y" /* yacc.c:339 */ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * Copyright (C) Colin Harrison 2005-2008 * * 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. * * Authors: Earle F. Philhower, III * Colin Harrison */ /* $XFree86: $ */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include #define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */ #include #include "winprefs.h" /* The following give better error messages in bison at the cost of a few KB */ #define YYERROR_VERBOSE 1 /* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ #define YYLTYPE_IS_TRIVIAL 1 #define YYENABLE_NLS 0 /* The global pref settings */ WINPREFS pref; /* The working menu */ static MENUPARSED menu; /* Functions for parsing the tokens into out structure */ /* Defined at the end section of this file */ static void SetIconDirectory (char *path); static void SetDefaultIcon (char *fname); static void SetRootMenu (char *menu); static void SetDefaultSysMenu (char *menu, int pos); static void SetTrayIcon (char *fname); static void OpenMenu(char *menuname); static void AddMenuLine(const char *name, MENUCOMMANDTYPE cmd, const char *param); static void CloseMenu(void); static void OpenIcons(void); static void AddIconLine(char *matchstr, char *iconfile); static void CloseIcons(void); static void OpenStyles(void); static void AddStyleLine(char *matchstr, unsigned long style); static void CloseStyles(void); static void OpenSysMenu(void); static void AddSysMenuLine(char *matchstr, char *menuname, int pos); static void CloseSysMenu(void); static int yyerror (const char *s); extern char *yytext; extern int yylineno; extern int yylex(void); #line 155 "winprefsyacc.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "y.tab.h". */ #ifndef YY_YY_WINPREFSYACC_H_INCLUDED # define YY_YY_WINPREFSYACC_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { NEWLINE = 258, MENU = 259, LB = 260, RB = 261, ICONDIRECTORY = 262, DEFAULTICON = 263, ICONS = 264, STYLES = 265, TOPMOST = 266, MAXIMIZE = 267, MINIMIZE = 268, BOTTOM = 269, NOTITLE = 270, OUTLINE = 271, NOFRAME = 272, DEFAULTSYSMENU = 273, SYSMENU = 274, ROOTMENU = 275, SEPARATOR = 276, ATSTART = 277, ATEND = 278, EXEC = 279, ALWAYSONTOP = 280, DEBUGOUTPUT = 281, RELOAD = 282, TRAYICON = 283, FORCEEXIT = 284, SILENTEXIT = 285, STRING = 286 }; #endif /* Tokens. */ #define NEWLINE 258 #define MENU 259 #define LB 260 #define RB 261 #define ICONDIRECTORY 262 #define DEFAULTICON 263 #define ICONS 264 #define STYLES 265 #define TOPMOST 266 #define MAXIMIZE 267 #define MINIMIZE 268 #define BOTTOM 269 #define NOTITLE 270 #define OUTLINE 271 #define NOFRAME 272 #define DEFAULTSYSMENU 273 #define SYSMENU 274 #define ROOTMENU 275 #define SEPARATOR 276 #define ATSTART 277 #define ATEND 278 #define EXEC 279 #define ALWAYSONTOP 280 #define DEBUGOUTPUT 281 #define RELOAD 282 #define TRAYICON 283 #define FORCEEXIT 284 #define SILENTEXIT 285 #define STRING 286 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 90 "winprefsyacc.y" /* yacc.c:355 */ char *sVal; unsigned long uVal; int iVal; #line 263 "winprefsyacc.c" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_WINPREFSYACC_H_INCLUDED */ /* Copy the second part of user declarations. */ #line 280 "winprefsyacc.c" /* yacc.c:358 */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 98 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 32 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 33 /* YYNRULES -- Number of rules. */ #define YYNRULES 65 /* YYNSTATES -- Number of states. */ #define YYNSTATES 121 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 286 #define YYTRANSLATE(YYX) \ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 133, 133, 134, 137, 138, 142, 143, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 160, 163, 166, 169, 172, 175, 176, 177, 178, 179, 182, 183, 186, 186, 189, 192, 193, 196, 196, 199, 200, 201, 202, 205, 206, 207, 210, 211, 212, 213, 216, 219, 220, 223, 223, 226, 227, 228, 231, 234, 235, 238, 238, 241, 244, 247 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NEWLINE", "MENU", "LB", "RB", "ICONDIRECTORY", "DEFAULTICON", "ICONS", "STYLES", "TOPMOST", "MAXIMIZE", "MINIMIZE", "BOTTOM", "NOTITLE", "OUTLINE", "NOFRAME", "DEFAULTSYSMENU", "SYSMENU", "ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", "ALWAYSONTOP", "\"DEBUG\"", "RELOAD", "TRAYICON", "FORCEEXIT", "SILENTEXIT", "STRING", "$accept", "input", "line", "newline_or_nada", "command", "trayicon", "rootmenu", "defaultsysmenu", "defaulticon", "icondirectory", "menuline", "menulist", "menu", "$@1", "iconline", "iconlist", "icons", "$@2", "group1", "group2", "stylecombo", "styleline", "stylelist", "styles", "$@3", "atspot", "sysmenuline", "sysmenulist", "sysmenu", "$@4", "forceexit", "silentexit", "debug", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286 }; # endif #define YYPACT_NINF -47 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-47))) #define YYTABLE_NINF -1 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int8 yypact[] = { -47, 7, -47, -47, -1, 0, 1, 18, 29, 15, 42, 17, 19, 20, 46, 50, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, 49, 53, 54, -47, -47, 6, 55, 56, 57, 58, -47, -47, -47, -47, -47, 61, 61, -47, -47, 62, -47, -47, -47, -47, 61, 61, 35, 38, -47, 61, -19, -47, 39, 35, 66, 27, 38, 67, 43, 72, -3, -19, 70, 74, -47, -47, -47, -47, -47, -47, -47, -47, -47, 3, -8, 75, -47, -47, 48, 43, 76, 61, 52, 59, 77, 78, -47, -47, 61, -47, -47, 61, 6, -47, -47, -47, 81, 82, 61, 61, -47, -47, 83, 61, 61, -47, -47, 61, -47, -47, -47 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 17, 14, 15, 8, 9, 10, 11, 12, 13, 18, 19, 16, 0, 0, 0, 37, 53, 55, 0, 0, 0, 0, 63, 64, 32, 24, 23, 6, 6, 56, 57, 0, 61, 21, 65, 20, 6, 6, 0, 0, 22, 6, 0, 7, 0, 35, 0, 0, 51, 0, 0, 0, 0, 30, 0, 0, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 52, 54, 0, 59, 0, 6, 0, 0, 0, 0, 31, 33, 6, 48, 49, 6, 55, 60, 62, 25, 0, 0, 6, 6, 34, 50, 0, 6, 6, 26, 29, 6, 28, 27, 58 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -47, -47, -47, -46, -47, -47, -47, -47, -47, -47, -47, 16, -47, -47, -47, 25, -47, -47, 5, 8, -47, -47, 26, -47, -47, -9, -47, 9, -47, -47, -47, -47, -47 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 16, 56, 17, 18, 19, 20, 21, 22, 71, 72, 23, 54, 63, 64, 24, 45, 83, 84, 85, 66, 67, 25, 46, 49, 89, 90, 26, 59, 27, 28, 29 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 57, 92, 69, 76, 77, 78, 79, 2, 60, 61, 3, 4, 70, 68, 5, 6, 7, 8, 80, 81, 82, 93, 94, 33, 95, 9, 10, 11, 47, 48, 30, 31, 32, 12, 34, 13, 14, 15, 76, 77, 78, 79, 80, 81, 82, 105, 35, 36, 37, 40, 38, 39, 110, 41, 42, 111, 43, 44, 50, 51, 52, 53, 115, 116, 55, 58, 62, 118, 119, 65, 73, 120, 75, 87, 88, 91, 97, 98, 101, 102, 108, 109, 104, 106, 113, 114, 117, 96, 74, 100, 107, 99, 86, 112, 0, 0, 0, 0, 103 }; static const yytype_int8 yycheck[] = { 46, 4, 21, 11, 12, 13, 14, 0, 54, 55, 3, 4, 31, 59, 7, 8, 9, 10, 15, 16, 17, 24, 25, 5, 27, 18, 19, 20, 22, 23, 31, 31, 31, 26, 5, 28, 29, 30, 11, 12, 13, 14, 15, 16, 17, 91, 31, 5, 31, 3, 31, 31, 98, 3, 5, 101, 3, 3, 3, 3, 3, 3, 108, 109, 3, 3, 31, 113, 114, 31, 31, 117, 6, 6, 31, 3, 6, 3, 3, 31, 3, 3, 6, 31, 3, 3, 3, 71, 63, 84, 31, 83, 66, 102, -1, -1, -1, -1, 89 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 33, 0, 3, 4, 7, 8, 9, 10, 18, 19, 20, 26, 28, 29, 30, 34, 36, 37, 38, 39, 40, 41, 44, 48, 55, 60, 62, 63, 64, 31, 31, 31, 5, 5, 31, 5, 31, 31, 31, 3, 3, 5, 3, 3, 49, 56, 22, 23, 57, 3, 3, 3, 3, 45, 3, 35, 35, 3, 61, 35, 35, 31, 46, 47, 31, 53, 54, 35, 21, 31, 42, 43, 31, 47, 6, 11, 12, 13, 14, 15, 16, 17, 50, 51, 52, 54, 6, 31, 58, 59, 3, 4, 24, 25, 27, 43, 6, 3, 51, 50, 3, 31, 59, 6, 35, 31, 31, 3, 3, 35, 35, 57, 3, 3, 35, 35, 3, 35, 35, 35 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 38, 39, 40, 41, 42, 42, 42, 42, 42, 43, 43, 45, 44, 46, 47, 47, 49, 48, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 54, 54, 56, 55, 57, 57, 57, 58, 59, 59, 61, 60, 62, 63, 64 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 3, 3, 3, 4, 5, 5, 4, 1, 2, 0, 7, 4, 1, 2, 0, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4, 1, 2, 0, 6, 0, 1, 1, 5, 1, 2, 0, 7, 2, 2, 3 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { FILE *yyo = yyoutput; YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 20: #line 160 "winprefsyacc.y" /* yacc.c:1651 */ { SetTrayIcon((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } #line 1439 "winprefsyacc.c" /* yacc.c:1651 */ break; case 21: #line 163 "winprefsyacc.y" /* yacc.c:1651 */ { SetRootMenu((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } #line 1445 "winprefsyacc.c" /* yacc.c:1651 */ break; case 22: #line 166 "winprefsyacc.y" /* yacc.c:1651 */ { SetDefaultSysMenu((yyvsp[-2].sVal), (yyvsp[-1].iVal)); free((yyvsp[-2].sVal)); } #line 1451 "winprefsyacc.c" /* yacc.c:1651 */ break; case 23: #line 169 "winprefsyacc.y" /* yacc.c:1651 */ { SetDefaultIcon((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } #line 1457 "winprefsyacc.c" /* yacc.c:1651 */ break; case 24: #line 172 "winprefsyacc.y" /* yacc.c:1651 */ { SetIconDirectory((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } #line 1463 "winprefsyacc.c" /* yacc.c:1651 */ break; case 25: #line 175 "winprefsyacc.y" /* yacc.c:1651 */ { AddMenuLine("-", CMD_SEPARATOR, ""); } #line 1469 "winprefsyacc.c" /* yacc.c:1651 */ break; case 26: #line 176 "winprefsyacc.y" /* yacc.c:1651 */ { AddMenuLine((yyvsp[-3].sVal), CMD_ALWAYSONTOP, ""); free((yyvsp[-3].sVal)); } #line 1475 "winprefsyacc.c" /* yacc.c:1651 */ break; case 27: #line 177 "winprefsyacc.y" /* yacc.c:1651 */ { AddMenuLine((yyvsp[-4].sVal), CMD_EXEC, (yyvsp[-2].sVal)); free((yyvsp[-4].sVal)); free((yyvsp[-2].sVal)); } #line 1481 "winprefsyacc.c" /* yacc.c:1651 */ break; case 28: #line 178 "winprefsyacc.y" /* yacc.c:1651 */ { AddMenuLine((yyvsp[-4].sVal), CMD_MENU, (yyvsp[-2].sVal)); free((yyvsp[-4].sVal)); free((yyvsp[-2].sVal)); } #line 1487 "winprefsyacc.c" /* yacc.c:1651 */ break; case 29: #line 179 "winprefsyacc.y" /* yacc.c:1651 */ { AddMenuLine((yyvsp[-3].sVal), CMD_RELOAD, ""); free((yyvsp[-3].sVal)); } #line 1493 "winprefsyacc.c" /* yacc.c:1651 */ break; case 32: #line 186 "winprefsyacc.y" /* yacc.c:1651 */ { OpenMenu((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } #line 1499 "winprefsyacc.c" /* yacc.c:1651 */ break; case 33: #line 186 "winprefsyacc.y" /* yacc.c:1651 */ {CloseMenu();} #line 1505 "winprefsyacc.c" /* yacc.c:1651 */ break; case 34: #line 189 "winprefsyacc.y" /* yacc.c:1651 */ { AddIconLine((yyvsp[-3].sVal), (yyvsp[-2].sVal)); free((yyvsp[-3].sVal)); free((yyvsp[-2].sVal)); } #line 1511 "winprefsyacc.c" /* yacc.c:1651 */ break; case 37: #line 196 "winprefsyacc.y" /* yacc.c:1651 */ {OpenIcons();} #line 1517 "winprefsyacc.c" /* yacc.c:1651 */ break; case 38: #line 196 "winprefsyacc.y" /* yacc.c:1651 */ {CloseIcons();} #line 1523 "winprefsyacc.c" /* yacc.c:1651 */ break; case 39: #line 199 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_TOPMOST; } #line 1529 "winprefsyacc.c" /* yacc.c:1651 */ break; case 40: #line 200 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_MAXIMIZE; } #line 1535 "winprefsyacc.c" /* yacc.c:1651 */ break; case 41: #line 201 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_MINIMIZE; } #line 1541 "winprefsyacc.c" /* yacc.c:1651 */ break; case 42: #line 202 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_BOTTOM; } #line 1547 "winprefsyacc.c" /* yacc.c:1651 */ break; case 43: #line 205 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_NOTITLE; } #line 1553 "winprefsyacc.c" /* yacc.c:1651 */ break; case 44: #line 206 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_OUTLINE; } #line 1559 "winprefsyacc.c" /* yacc.c:1651 */ break; case 45: #line 207 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=STYLE_NOFRAME; } #line 1565 "winprefsyacc.c" /* yacc.c:1651 */ break; case 46: #line 210 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=(yyvsp[0].uVal); } #line 1571 "winprefsyacc.c" /* yacc.c:1651 */ break; case 47: #line 211 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=(yyvsp[0].uVal); } #line 1577 "winprefsyacc.c" /* yacc.c:1651 */ break; case 48: #line 212 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=(yyvsp[-1].uVal)|(yyvsp[0].uVal); } #line 1583 "winprefsyacc.c" /* yacc.c:1651 */ break; case 49: #line 213 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.uVal)=(yyvsp[-1].uVal)|(yyvsp[0].uVal); } #line 1589 "winprefsyacc.c" /* yacc.c:1651 */ break; case 50: #line 216 "winprefsyacc.y" /* yacc.c:1651 */ { AddStyleLine((yyvsp[-3].sVal), (yyvsp[-2].uVal)); free((yyvsp[-3].sVal)); } #line 1595 "winprefsyacc.c" /* yacc.c:1651 */ break; case 53: #line 223 "winprefsyacc.y" /* yacc.c:1651 */ {OpenStyles();} #line 1601 "winprefsyacc.c" /* yacc.c:1651 */ break; case 54: #line 223 "winprefsyacc.y" /* yacc.c:1651 */ {CloseStyles();} #line 1607 "winprefsyacc.c" /* yacc.c:1651 */ break; case 55: #line 226 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.iVal)=AT_END; } #line 1613 "winprefsyacc.c" /* yacc.c:1651 */ break; case 56: #line 227 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.iVal)=AT_START; } #line 1619 "winprefsyacc.c" /* yacc.c:1651 */ break; case 57: #line 228 "winprefsyacc.y" /* yacc.c:1651 */ { (yyval.iVal)=AT_END; } #line 1625 "winprefsyacc.c" /* yacc.c:1651 */ break; case 58: #line 231 "winprefsyacc.y" /* yacc.c:1651 */ { AddSysMenuLine((yyvsp[-4].sVal), (yyvsp[-3].sVal), (yyvsp[-2].iVal)); free((yyvsp[-4].sVal)); free((yyvsp[-3].sVal)); } #line 1631 "winprefsyacc.c" /* yacc.c:1651 */ break; case 61: #line 238 "winprefsyacc.y" /* yacc.c:1651 */ {OpenSysMenu();} #line 1637 "winprefsyacc.c" /* yacc.c:1651 */ break; case 62: #line 238 "winprefsyacc.y" /* yacc.c:1651 */ {CloseSysMenu();} #line 1643 "winprefsyacc.c" /* yacc.c:1651 */ break; case 63: #line 241 "winprefsyacc.y" /* yacc.c:1651 */ { pref.fForceExit = TRUE; } #line 1649 "winprefsyacc.c" /* yacc.c:1651 */ break; case 64: #line 244 "winprefsyacc.y" /* yacc.c:1651 */ { pref.fSilentExit = TRUE; } #line 1655 "winprefsyacc.c" /* yacc.c:1651 */ break; case 65: #line 247 "winprefsyacc.y" /* yacc.c:1651 */ { ErrorF("LoadPreferences: %s\n", (yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } #line 1661 "winprefsyacc.c" /* yacc.c:1651 */ break; #line 1665 "winprefsyacc.c" /* yacc.c:1651 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } #line 251 "winprefsyacc.y" /* yacc.c:1910 */ /* * Errors in parsing abort and print log messages */ static int yyerror (const char *s) { ErrorF("LoadPreferences: %s line %d\n", s, yylineno); return 1; } /* Miscellaneous functions to store TOKENs into the structure */ static void SetIconDirectory (char *path) { strncpy (pref.iconDirectory, path, PATH_MAX); pref.iconDirectory[PATH_MAX] = 0; } static void SetDefaultIcon (char *fname) { strncpy (pref.defaultIconName, fname, NAME_MAX); pref.defaultIconName[NAME_MAX] = 0; } static void SetTrayIcon (char *fname) { strncpy (pref.trayIconName, fname, NAME_MAX); pref.trayIconName[NAME_MAX] = 0; } static void SetRootMenu (char *menuname) { strncpy (pref.rootMenuName, menuname, MENU_MAX); pref.rootMenuName[MENU_MAX] = 0; } static void SetDefaultSysMenu (char *menuname, int pos) { strncpy (pref.defaultSysMenuName, menuname, MENU_MAX); pref.defaultSysMenuName[MENU_MAX] = 0; pref.defaultSysMenuPos = pos; } static void OpenMenu (char *menuname) { if (menu.menuItem) free(menu.menuItem); menu.menuItem = NULL; strncpy(menu.menuName, menuname, MENU_MAX); menu.menuName[MENU_MAX] = 0; menu.menuItems = 0; } static void AddMenuLine (const char *text, MENUCOMMANDTYPE cmd, const char *param) { if (menu.menuItem==NULL) menu.menuItem = malloc(sizeof(MENUITEM)); else menu.menuItem = realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX); menu.menuItem[menu.menuItems].text[MENU_MAX] = 0; menu.menuItem[menu.menuItems].cmd = cmd; strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX); menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0; menu.menuItem[menu.menuItems].commandID = 0; menu.menuItems++; } static void CloseMenu (void) { if (menu.menuItem==NULL || menu.menuItems==0) { ErrorF("LoadPreferences: Empty menu detected\n"); return; } if (pref.menuItems) pref.menu = realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); else pref.menu = malloc (sizeof(MENUPARSED)); memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED)); pref.menuItems++; memset (&menu, 0, sizeof(MENUPARSED)); } static void OpenIcons (void) { if (pref.icon != NULL) { ErrorF("LoadPreferences: Redefining icon mappings\n"); free(pref.icon); pref.icon = NULL; } pref.iconItems = 0; } static void AddIconLine (char *matchstr, char *iconfile) { if (pref.icon==NULL) pref.icon = malloc(sizeof(ICONITEM)); else pref.icon = realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX); pref.icon[pref.iconItems].match[MENU_MAX] = 0; strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1); pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0; pref.icon[pref.iconItems].hicon = 0; pref.iconItems++; } static void CloseIcons (void) { } static void OpenStyles (void) { if (pref.style != NULL) { ErrorF("LoadPreferences: Redefining window style\n"); free(pref.style); pref.style = NULL; } pref.styleItems = 0; } static void AddStyleLine (char *matchstr, unsigned long style) { if (pref.style==NULL) pref.style = malloc(sizeof(STYLEITEM)); else pref.style = realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); pref.style[pref.styleItems].match[MENU_MAX] = 0; pref.style[pref.styleItems].type = style; pref.styleItems++; } static void CloseStyles (void) { } static void OpenSysMenu (void) { if (pref.sysMenu != NULL) { ErrorF("LoadPreferences: Redefining system menu\n"); free(pref.sysMenu); pref.sysMenu = NULL; } pref.sysMenuItems = 0; } static void AddSysMenuLine (char *matchstr, char *menuname, int pos) { if (pref.sysMenu==NULL) pref.sysMenu = malloc(sizeof(SYSMENUITEM)); else pref.sysMenu = realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX); pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0; strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX); pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0; pref.sysMenu[pref.sysMenuItems].menuPos = pos; pref.sysMenuItems++; } static void CloseSysMenu (void) { } xorg-server-1.20.8/hw/xwin/winblock.c0000644000175000017500000000611613640201473014371 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" /* See Porting Layer Definition - p. 6 */ void winBlockHandler(ScreenPtr pScreen, void *pTimeout) { winScreenPriv(pScreen); #ifndef HAS_DEVWINDOWS struct timeval **tvp = pTimeout; if (*tvp != NULL) { if (GetQueueStatus(QS_ALLINPUT | QS_ALLPOSTMESSAGE) != 0) { /* If there are still messages to process on the Windows message queue, make sure select() just polls rather than blocking. */ (*tvp)->tv_sec = 0; (*tvp)->tv_usec = 0; } else { /* Otherwise, lacking /dev/windows, we must wake up again in a reasonable time to check the Windows message queue. without noticeable delay. */ (*tvp)->tv_sec = 0; (*tvp)->tv_usec = 100; } } #endif /* Signal threaded modules to begin */ if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) { int iReturn; winDebug("winBlockHandler - pthread_mutex_unlock()\n"); /* Flag that modules are to be started */ pScreenPriv->fServerStarted = TRUE; /* Unlock the mutex for threaded modules */ iReturn = pthread_mutex_unlock(&pScreenPriv->pmServerStarted); if (iReturn != 0) { ErrorF("winBlockHandler - pthread_mutex_unlock () failed: %d\n", iReturn); } else { winDebug("winBlockHandler - pthread_mutex_unlock () returned\n"); } } /* At least one X client has asked to suspend the screensaver, so reset Windows' display idle timer */ #ifdef SCREENSAVER if (screenSaverSuspended) SetThreadExecutionState(ES_DISPLAY_REQUIRED); #endif } xorg-server-1.20.8/hw/xwin/winms.h0000644000175000017500000000341213640201473013717 00000000000000#ifndef _WINMS_H_ #define _WINMS_H_ /* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #define DIRECTDRAW_VERSION 0x0300 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #ifndef WINVER #define WINVER 0x0500 #endif #include #include #pragma push_macro("Status") #undef Status #define Status wStatus #include "ddraw.h" #pragma pop_macro("Status") #undef CreateWindow #endif /* _WINMS_H_ */ xorg-server-1.20.8/hw/xwin/winglobals.h0000644000175000017500000000467213640201473014734 00000000000000/* File: winglobals.h Purpose: declarations for global variables 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. */ #ifndef WINGLOBALS_H #define WINGLOBALS_H #ifdef HAVE_XWIN_CONFIG_H #include #endif #include /* * References to external symbols */ extern int g_iNumScreens; extern int g_iLastScreen; extern char *g_pszCommandLine; extern Bool g_fSilentFatalError; extern const char *g_pszLogFile; #ifdef RELOCATE_PROJECTROOT extern Bool g_fLogFileChanged; #endif extern int g_iLogVerbose; extern Bool g_fLogInited; extern Bool g_fAuthEnabled; extern Bool g_fXdmcpEnabled; extern Bool g_fNoHelpMessageBox; extern Bool g_fNativeGl; extern Bool g_fHostInTitle; extern HWND g_hDlgDepthChange; extern HWND g_hDlgExit; extern HWND g_hDlgAbout; extern Bool g_fSoftwareCursor; extern Bool g_fCursor; /* Typedef for DIX wrapper functions */ typedef int (*winDispatchProcPtr) (ClientPtr); /* * Wrapped DIX functions */ extern winDispatchProcPtr winProcEstablishConnectionOrig; extern Bool g_fUnicodeClipboard; extern Bool g_fClipboard; extern Bool g_fClipboardStarted; /* The global X default icons */ extern HICON g_hIconX; extern HICON g_hSmallIconX; extern DWORD g_dwCurrentThreadID; extern Bool g_fKeyboardHookLL; extern Bool g_fButton[3]; #ifdef XWIN_MULTIWINDOWEXTWM extern Bool g_fNoConfigureWindow; #endif extern pthread_mutex_t g_pmTerminating; #endif /* WINGLOBALS_H */ xorg-server-1.20.8/hw/xwin/winwndproc.c0000644000175000017500000012175413640201473014761 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II * MATSUZAKI Kensuke */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include #include "winprefs.h" #include "winconfig.h" #include "winmsg.h" #include "winmonitors.h" #include "inputstr.h" #include "winclipboard/winclipboard.h" /* * Global variables */ Bool g_fCursor = TRUE; Bool g_fButton[3] = { FALSE, FALSE, FALSE }; /* * Called by winWakeupHandler * Processes current Windows message */ LRESULT CALLBACK winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static winPrivScreenPtr s_pScreenPriv = NULL; static winScreenInfo *s_pScreenInfo = NULL; static ScreenPtr s_pScreen = NULL; static HWND s_hwndLastPrivates = NULL; static Bool s_fTracking = FALSE; static unsigned long s_ulServerGeneration = 0; static UINT s_uTaskbarRestart = 0; int iScanCode; int i; #if CYGDEBUG winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam); #endif /* Watch for server regeneration */ if (g_ulServerGeneration != s_ulServerGeneration) { /* Store new server generation */ s_ulServerGeneration = g_ulServerGeneration; } /* Only retrieve new privates pointers if window handle is null or changed */ if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates) && (s_pScreenPriv = GetProp(hwnd, WIN_SCR_PROP)) != NULL) { #if CYGDEBUG winDebug("winWindowProc - Setting privates handle\n"); #endif s_pScreenInfo = s_pScreenPriv->pScreenInfo; s_pScreen = s_pScreenInfo->pScreen; s_hwndLastPrivates = hwnd; } else if (s_pScreenPriv == NULL) { /* For safety, handle case that should never happen */ s_pScreenInfo = NULL; s_pScreen = NULL; s_hwndLastPrivates = NULL; } /* Branch on message type */ switch (message) { case WM_TRAYICON: return winHandleIconMessage(hwnd, message, wParam, lParam, s_pScreenPriv); case WM_CREATE: #if CYGDEBUG winDebug("winWindowProc - WM_CREATE\n"); #endif /* * Add a property to our display window that references * this screens' privates. * * This allows the window procedure to refer to the * appropriate window DC and shadow DC for the window that * it is processing. We use this to repaint exposed * areas of our display window. */ s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams; s_pScreenInfo = s_pScreenPriv->pScreenInfo; s_pScreen = s_pScreenInfo->pScreen; s_hwndLastPrivates = hwnd; s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); SetProp(hwnd, WIN_SCR_PROP, s_pScreenPriv); /* Setup tray icon */ if (!s_pScreenInfo->fNoTrayIcon) { /* * NOTE: The WM_CREATE message is processed before CreateWindowEx * returns, so s_pScreenPriv->hwndScreen is invalid at this point. * We go ahead and copy our hwnd parameter over top of the screen * privates hwndScreen so that we have a valid value for * that member. Otherwise, the tray icon will disappear * the first time you move the mouse over top of it. */ s_pScreenPriv->hwndScreen = hwnd; winInitNotifyIcon(s_pScreenPriv); } return 0; case WM_DISPLAYCHANGE: /* WM_DISPLAYCHANGE seems to be sent when the monitor layout or any monitor's resolution or depth changes, but it's lParam and wParam always indicate the resolution and bpp for the primary monitor (so ignore that as we could be on any monitor...) */ /* We cannot handle a display mode change during initialization */ if (s_pScreenInfo == NULL) FatalError("winWindowProc - WM_DISPLAYCHANGE - The display " "mode changed while we were intializing. This is " "very bad and unexpected. Exiting.\n"); /* * We do not care about display changes with * fullscreen DirectDraw engines, because those engines set * their own mode when they become active. */ if (s_pScreenInfo->fFullScreen && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) { break; } ErrorF("winWindowProc - WM_DISPLAYCHANGE - new width: %d " "new height: %d new bpp: %d\n", LOWORD(lParam), HIWORD(lParam), (int)wParam); /* 0 bpp has no defined meaning, ignore this message */ if (wParam == 0) break; /* * Check for a disruptive change in depth. * We can only display a message for a disruptive depth change, * we cannot do anything to correct the situation. */ /* XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT) has changed as well... */ if (s_pScreenInfo->dwBPP != GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) { if (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) { /* Cannot display the visual until the depth is restored */ ErrorF("winWindowProc - Disruptive change in depth\n"); /* Display depth change dialog */ winDisplayDepthChangeDialog(s_pScreenPriv); /* Flag that we have an invalid screen depth */ s_pScreenPriv->fBadDepth = TRUE; /* Minimize the display window */ ShowWindow(hwnd, SW_MINIMIZE); } else { /* For GDI, performance may suffer until original depth is restored */ ErrorF ("winWindowProc - Performance may be non-optimal after change in depth\n"); } } else { /* Flag that we have a valid screen depth */ s_pScreenPriv->fBadDepth = FALSE; } /* If we could cheaply check if this WM_DISPLAYCHANGE change affects the monitor(s) which this X screen is displayed on then we should do so here. For the moment, assume it does. (this is probably usually the case so that might be an overoptimization) */ { /* In rootless modes which are monitor or virtual desktop size use RandR to resize the X screen */ if ((!s_pScreenInfo->fUserGaveHeightAndWidth) && (s_pScreenInfo->iResizeMode == resizeWithRandr) && (FALSE #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo-> fMWExtWM #endif || s_pScreenInfo-> fRootless || s_pScreenInfo-> fMultiWindow )) { DWORD dwWidth = 0, dwHeight = 0; if (s_pScreenInfo->fMultipleMonitors) { /* resize to new virtual desktop size */ dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); } else { /* resize to new size of specified monitor */ struct GetMonitorInfoData data; if (QueryMonitor(s_pScreenInfo->iMonitor, &data)) { if (data.bMonitorSpecifiedExists == TRUE) { dwWidth = data.monitorWidth; dwHeight = data.monitorHeight; /* XXX: monitor may have changed position, so we might need to update xinerama data */ } else { ErrorF("Monitor number %d no longer exists!\n", s_pScreenInfo->iMonitor); } } } /* XXX: probably a small bug here: we don't compute the work area and allow for task bar XXX: generally, we don't allow for the task bar being moved after the server is started */ /* Set screen size to match new size, if it is different to current */ if (((dwWidth != 0) && (dwHeight != 0)) && ((s_pScreenInfo->dwWidth != dwWidth) || (s_pScreenInfo->dwHeight != dwHeight))) { winDoRandRScreenSetSize(s_pScreen, dwWidth, dwHeight, (dwWidth * 25.4) / monitorResolution, (dwHeight * 25.4) / monitorResolution); } } else { /* * We can simply recreate the same-sized primary surface when * the display dimensions change. */ winDebug ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n"); /* Release the old primary surface */ if (*s_pScreenPriv->pwinReleasePrimarySurface) (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); /* Create the new primary surface */ if (*s_pScreenPriv->pwinCreatePrimarySurface) (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); } } break; case WM_SIZE: { SCROLLINFO si; RECT rcWindow; int iWidth, iHeight; #if CYGDEBUG winDebug("winWindowProc - WM_SIZE\n"); #endif /* Break if we do not allow resizing */ if ((s_pScreenInfo->iResizeMode == resizeNotAllowed) || !s_pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif || s_pScreenInfo->fRootless || s_pScreenInfo->fMultiWindow || s_pScreenInfo->fFullScreen) break; /* No need to resize if we get minimized */ if (wParam == SIZE_MINIMIZED) return 0; ErrorF("winWindowProc - WM_SIZE - new client area w: %d h: %d\n", LOWORD(lParam), HIWORD(lParam)); if (s_pScreenInfo->iResizeMode == resizeWithRandr) { /* Actual resizing is done on WM_EXITSIZEMOVE */ return 0; } /* Otherwise iResizeMode == resizeWithScrollbars */ /* * Get the size of the whole window, including client area, * scrollbars, and non-client area decorations (caption, borders). * We do this because we need to check if the client area * without scrollbars is large enough to display the whole visual. * The new client area size passed by lParam already subtracts * the size of the scrollbars if they are currently displayed. * So checking is LOWORD(lParam) == visual_width and * HIWORD(lParam) == visual_height will never tell us to hide * the scrollbars because the client area would always be too small. * GetClientRect returns the same sizes given by lParam, so we * cannot use GetClientRect either. */ GetWindowRect(hwnd, &rcWindow); iWidth = rcWindow.right - rcWindow.left; iHeight = rcWindow.bottom - rcWindow.top; /* Subtract the frame size from the window size. */ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME); iHeight -= (2 * GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION)); /* * Update scrollbar page sizes. * NOTE: If page size == range, then the scrollbar is * automatically hidden. */ /* Is the naked client area large enough to show the whole visual? */ if (iWidth < s_pScreenInfo->dwWidth || iHeight < s_pScreenInfo->dwHeight) { /* Client area too small to display visual, use scrollbars */ iWidth -= GetSystemMetrics(SM_CXVSCROLL); iHeight -= GetSystemMetrics(SM_CYHSCROLL); } /* Set the horizontal scrollbar page size */ si.cbSize = sizeof(si); si.fMask = SIF_PAGE | SIF_RANGE; si.nMin = 0; si.nMax = s_pScreenInfo->dwWidth - 1; si.nPage = iWidth; SetScrollInfo(hwnd, SB_HORZ, &si, TRUE); /* Set the vertical scrollbar page size */ si.cbSize = sizeof(si); si.fMask = SIF_PAGE | SIF_RANGE; si.nMin = 0; si.nMax = s_pScreenInfo->dwHeight - 1; si.nPage = iHeight; SetScrollInfo(hwnd, SB_VERT, &si, TRUE); /* * NOTE: Scrollbars may have moved if they were at the * far right/bottom, so we query their current position. */ /* Get the horizontal scrollbar position and set the offset */ si.cbSize = sizeof(si); si.fMask = SIF_POS; GetScrollInfo(hwnd, SB_HORZ, &si); s_pScreenInfo->dwXOffset = -si.nPos; /* Get the vertical scrollbar position and set the offset */ si.cbSize = sizeof(si); si.fMask = SIF_POS; GetScrollInfo(hwnd, SB_VERT, &si); s_pScreenInfo->dwYOffset = -si.nPos; } return 0; case WM_SYSCOMMAND: if (s_pScreenInfo->iResizeMode == resizeWithRandr && ((wParam & 0xfff0) == SC_MAXIMIZE || (wParam & 0xfff0) == SC_RESTORE)) PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0); break; case WM_ENTERSIZEMOVE: ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n"); break; case WM_EXITSIZEMOVE: ErrorF("winWindowProc - WM_EXITSIZEMOVE\n"); if (s_pScreenInfo->iResizeMode == resizeWithRandr) { /* Set screen size to match new client area, if it is different to current */ RECT rcClient; DWORD dwWidth, dwHeight; GetClientRect(hwnd, &rcClient); dwWidth = rcClient.right - rcClient.left; dwHeight = rcClient.bottom - rcClient.top; if ((s_pScreenInfo->dwWidth != dwWidth) || (s_pScreenInfo->dwHeight != dwHeight)) { /* mm = dots * (25.4 mm / inch) / (dots / inch) */ winDoRandRScreenSetSize(s_pScreen, dwWidth, dwHeight, (dwWidth * 25.4) / monitorResolution, (dwHeight * 25.4) / monitorResolution); } } break; case WM_VSCROLL: { SCROLLINFO si; int iVertPos; #if CYGDEBUG winDebug("winWindowProc - WM_VSCROLL\n"); #endif /* Get vertical scroll bar info */ si.cbSize = sizeof(si); si.fMask = SIF_ALL; GetScrollInfo(hwnd, SB_VERT, &si); /* Save the vertical position for comparison later */ iVertPos = si.nPos; /* * Don't forget: * moving the scrollbar to the DOWN, scroll the content UP */ switch (LOWORD(wParam)) { case SB_TOP: si.nPos = si.nMin; break; case SB_BOTTOM: si.nPos = si.nMax - si.nPage + 1; break; case SB_LINEUP: si.nPos -= 1; break; case SB_LINEDOWN: si.nPos += 1; break; case SB_PAGEUP: si.nPos -= si.nPage; break; case SB_PAGEDOWN: si.nPos += si.nPage; break; case SB_THUMBTRACK: si.nPos = si.nTrackPos; break; default: break; } /* * We retrieve the position after setting it, * because Windows may adjust it. */ si.fMask = SIF_POS; SetScrollInfo(hwnd, SB_VERT, &si, TRUE); GetScrollInfo(hwnd, SB_VERT, &si); /* Scroll the window if the position has changed */ if (si.nPos != iVertPos) { /* Save the new offset for bit block transfers, etc. */ s_pScreenInfo->dwYOffset = -si.nPos; /* Change displayed region in the window */ ScrollWindowEx(hwnd, 0, iVertPos - si.nPos, NULL, NULL, NULL, NULL, SW_INVALIDATE); /* Redraw the window contents */ UpdateWindow(hwnd); } } return 0; case WM_HSCROLL: { SCROLLINFO si; int iHorzPos; #if CYGDEBUG winDebug("winWindowProc - WM_HSCROLL\n"); #endif /* Get horizontal scroll bar info */ si.cbSize = sizeof(si); si.fMask = SIF_ALL; GetScrollInfo(hwnd, SB_HORZ, &si); /* Save the horizontal position for comparison later */ iHorzPos = si.nPos; /* * Don't forget: * moving the scrollbar to the RIGHT, scroll the content LEFT */ switch (LOWORD(wParam)) { case SB_LEFT: si.nPos = si.nMin; break; case SB_RIGHT: si.nPos = si.nMax - si.nPage + 1; break; case SB_LINELEFT: si.nPos -= 1; break; case SB_LINERIGHT: si.nPos += 1; break; case SB_PAGELEFT: si.nPos -= si.nPage; break; case SB_PAGERIGHT: si.nPos += si.nPage; break; case SB_THUMBTRACK: si.nPos = si.nTrackPos; break; default: break; } /* * We retrieve the position after setting it, * because Windows may adjust it. */ si.fMask = SIF_POS; SetScrollInfo(hwnd, SB_HORZ, &si, TRUE); GetScrollInfo(hwnd, SB_HORZ, &si); /* Scroll the window if the position has changed */ if (si.nPos != iHorzPos) { /* Save the new offset for bit block transfers, etc. */ s_pScreenInfo->dwXOffset = -si.nPos; /* Change displayed region in the window */ ScrollWindowEx(hwnd, iHorzPos - si.nPos, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE); /* Redraw the window contents */ UpdateWindow(hwnd); } } return 0; case WM_GETMINMAXINFO: { MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam; int iCaptionHeight; int iBorderHeight, iBorderWidth; #if CYGDEBUG winDebug("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %p\n", s_pScreenInfo); #endif /* Can't do anything without screen info */ if (s_pScreenInfo == NULL || (s_pScreenInfo->iResizeMode != resizeWithScrollbars) || s_pScreenInfo->fFullScreen || !s_pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif || s_pScreenInfo->fRootless || s_pScreenInfo->fMultiWindow ) break; /* * Here we can override the maximum tracking size, which * is the largest size that can be assigned to our window * via the sizing border. */ /* * FIXME: Do we only need to do this once, since our visual size * does not change? Does Windows store this value statically * once we have set it once? */ /* Get the border and caption sizes */ iCaptionHeight = GetSystemMetrics(SM_CYCAPTION); iBorderWidth = 2 * GetSystemMetrics(SM_CXSIZEFRAME); iBorderHeight = 2 * GetSystemMetrics(SM_CYSIZEFRAME); /* Allow the full visual to be displayed */ pMinMaxInfo->ptMaxTrackSize.x = s_pScreenInfo->dwWidth + iBorderWidth; pMinMaxInfo->ptMaxTrackSize.y = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight; } return 0; case WM_ERASEBKGND: #if CYGDEBUG winDebug("winWindowProc - WM_ERASEBKGND\n"); #endif /* * Pretend that we did erase the background but we don't care, * the application uses the full window estate. This avoids some * flickering when resizing. */ return TRUE; case WM_PAINT: #if CYGDEBUG winDebug("winWindowProc - WM_PAINT\n"); #endif /* Only paint if we have privates and the server is enabled */ if (s_pScreenPriv == NULL || !s_pScreenPriv->fEnabled || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive) || s_pScreenPriv->fBadDepth) { /* We don't want to paint */ break; } /* Break out here if we don't have a valid paint routine */ if (s_pScreenPriv->pwinBltExposedRegions == NULL) break; /* Call the engine dependent repainter */ (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen); return 0; case WM_PALETTECHANGED: { #if CYGDEBUG winDebug("winWindowProc - WM_PALETTECHANGED\n"); #endif /* * Don't process if we don't have privates or a colormap, * or if we have an invalid depth. */ if (s_pScreenPriv == NULL || s_pScreenPriv->pcmapInstalled == NULL || s_pScreenPriv->fBadDepth) break; /* Return if we caused the palette to change */ if ((HWND) wParam == hwnd) { /* Redraw the screen */ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); return 0; } /* Reinstall the windows palette */ (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen); /* Redraw the screen */ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); return 0; } case WM_MOUSEMOVE: /* We can't do anything without privates */ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* We can't do anything without g_pwinPointer */ if (g_pwinPointer == NULL) break; /* Has the mouse pointer crossed screens? */ if (s_pScreen != miPointerGetScreen(g_pwinPointer)) miPointerSetScreen(g_pwinPointer, s_pScreenInfo->dwScreen, GET_X_LPARAM(lParam) - s_pScreenInfo->dwXOffset, GET_Y_LPARAM(lParam) - s_pScreenInfo->dwYOffset); /* Are we tracking yet? */ if (!s_fTracking) { TRACKMOUSEEVENT tme; /* Setup data structure */ ZeroMemory(&tme, sizeof(tme)); tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = hwnd; /* Call the tracking function */ if (!TrackMouseEvent(&tme)) ErrorF("winWindowProc - TrackMouseEvent failed\n"); /* Flag that we are tracking now */ s_fTracking = TRUE; } /* Hide or show the Windows mouse cursor */ if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer)) { /* Hide Windows cursor */ g_fCursor = FALSE; ShowCursor(FALSE); } else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive && !s_pScreenInfo->fLessPointer) { /* Show Windows cursor */ g_fCursor = TRUE; ShowCursor(TRUE); } /* Deliver absolute cursor position to X Server */ winEnqueueMotion(GET_X_LPARAM(lParam) - s_pScreenInfo->dwXOffset, GET_Y_LPARAM(lParam) - s_pScreenInfo->dwYOffset); return 0; case WM_NCMOUSEMOVE: /* * We break instead of returning 0 since we need to call * DefWindowProc to get the mouse cursor changes * and min/max/close button highlighting in Windows XP. * The Platform SDK says that you should return 0 if you * process this message, but it fails to mention that you * will give up any default functionality if you do return 0. */ /* We can't do anything without privates */ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Non-client mouse movement, show Windows cursor */ if (g_fSoftwareCursor && !g_fCursor) { g_fCursor = TRUE; ShowCursor(TRUE); } break; case WM_MOUSELEAVE: /* Mouse has left our client area */ /* Flag that we are no longer tracking */ s_fTracking = FALSE; /* Show the mouse cursor, if necessary */ if (g_fSoftwareCursor && !g_fCursor) { g_fCursor = TRUE; ShowCursor(TRUE); } return 0; case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) ReleaseCapture(); return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) ReleaseCapture(); return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button2, wParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) ReleaseCapture(); return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button3, wParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 7, wParam); case WM_XBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; if (s_pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM #endif ) ReleaseCapture(); return winMouseButtonsHandle(s_pScreen, ButtonRelease, HIWORD(wParam) + 7, wParam); case WM_TIMER: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Branch on the timer id */ switch (wParam) { case WIN_E3B_TIMER_ID: /* Send delayed button press */ winMouseButtonsSendEvent(ButtonPress, s_pScreenPriv->iE3BCachedPress); /* Kill this timer */ KillTimer(s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); /* Clear screen privates flags */ s_pScreenPriv->iE3BCachedPress = 0; break; case WIN_POLLING_MOUSE_TIMER_ID: { static POINT last_point; POINT point; WPARAM wL, wM, wR, wShift, wCtrl; LPARAM lPos; /* Get the current position of the mouse cursor */ GetCursorPos(&point); /* Map from screen (-X, -Y) to root (0, 0) */ point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN); point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN); /* If the mouse pointer has moved, deliver absolute cursor position to X Server */ if (last_point.x != point.x || last_point.y != point.y) { winEnqueueMotion(point.x, point.y); last_point.x = point.x; last_point.y = point.y; } /* Check if a button was released but we didn't see it */ GetCursorPos(&point); wL = (GetKeyState(VK_LBUTTON) & 0x8000) ? MK_LBUTTON : 0; wM = (GetKeyState(VK_MBUTTON) & 0x8000) ? MK_MBUTTON : 0; wR = (GetKeyState(VK_RBUTTON) & 0x8000) ? MK_RBUTTON : 0; wShift = (GetKeyState(VK_SHIFT) & 0x8000) ? MK_SHIFT : 0; wCtrl = (GetKeyState(VK_CONTROL) & 0x8000) ? MK_CONTROL : 0; lPos = MAKELPARAM(point.x, point.y); if (g_fButton[0] && !wL) PostMessage(hwnd, WM_LBUTTONUP, wCtrl | wM | wR | wShift, lPos); if (g_fButton[1] && !wM) PostMessage(hwnd, WM_MBUTTONUP, wCtrl | wL | wR | wShift, lPos); if (g_fButton[2] && !wR) PostMessage(hwnd, WM_RBUTTONUP, wCtrl | wL | wM | wShift, lPos); } } return 0; case WM_CTLCOLORSCROLLBAR: FatalError("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not " "supposed to get this message. Exiting.\n"); return 0; case WM_MOUSEWHEEL: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; #if CYGDEBUG winDebug("winWindowProc - WM_MOUSEWHEEL\n"); #endif /* Button4 = WheelUp */ /* Button5 = WheelDown */ winMouseWheel(&(s_pScreenPriv->iDeltaZ), GET_WHEEL_DELTA_WPARAM(wParam), Button4, Button5); break; case WM_MOUSEHWHEEL: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; #if CYGDEBUG winDebug("winWindowProc - WM_MOUSEHWHEEL\n"); #endif /* Button7 = TiltRight */ /* Button6 = TiltLeft */ winMouseWheel(&(s_pScreenPriv->iDeltaV), GET_WHEEL_DELTA_WPARAM(wParam), 7, 6); break; case WM_SETFOCUS: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Restore the state of all mode keys */ winRestoreModeKeyStates(); /* Add the keyboard hook if possible */ if (g_fKeyboardHookLL) g_fKeyboardHookLL = winInstallKeyboardHookLL(); return 0; case WM_KILLFOCUS: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Release any pressed keys */ winKeybdReleaseKeys(); /* Remove our keyboard hook if it is installed */ winRemoveKeyboardHookLL(); return 0; case WM_SYSKEYDOWN: case WM_KEYDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* * FIXME: Catching Alt-F4 like this is really terrible. This should * be generalized to handle other Windows keyboard signals. Actually, * the list keys to catch and the actions to perform when caught should * be configurable; that way user's can customize the keys that they * need to have passed through to their window manager or apps, or they * can remap certain actions to new key codes that do not conflict * with the X apps that they are using. Yeah, that'll take awhile. */ if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4 && (GetKeyState(VK_MENU) & 0x8000)) || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK && (GetKeyState(VK_MENU) & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000))) { /* * Better leave this message here, just in case some unsuspecting * user enters Alt + F4 and is surprised when the application * quits. */ ErrorF("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n"); /* Display Exit dialog */ winDisplayExitDialog(s_pScreenPriv); return 0; } /* * Don't do anything for the Windows keys, as focus will soon * be returned to Windows. We may be able to trap the Windows keys, * but we should determine if that is desirable before doing so. */ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) break; /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */ if (winIsFakeCtrl_L(message, wParam, lParam)) return 0; /* * Discard presses generated from Windows auto-repeat */ if (lParam & (1 << 30)) { switch (wParam) { /* ago: Pressing LControl while RControl is pressed is * Indicated as repeat. Fix this! */ case VK_CONTROL: case VK_SHIFT: if (winCheckKeyPressed(wParam, lParam)) return 0; break; default: return 0; } } /* Translate Windows key code to X scan code */ iScanCode = winTranslateKey(wParam, lParam); /* Ignore repeats for CapsLock */ if (wParam == VK_CAPITAL) lParam = 1; /* Send the key event(s) */ for (i = 0; i < LOWORD(lParam); ++i) winSendKeyEvent(iScanCode, TRUE); return 0; case WM_SYSKEYUP: case WM_KEYUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* * Don't do anything for the Windows keys, as focus will soon * be returned to Windows. We may be able to trap the Windows keys, * but we should determine if that is desirable before doing so. */ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) break; /* Ignore the fake Ctrl_L that follows an AltGr release */ if (winIsFakeCtrl_L(message, wParam, lParam)) return 0; /* Enqueue a keyup event */ iScanCode = winTranslateKey(wParam, lParam); winSendKeyEvent(iScanCode, FALSE); /* Release all pressed shift keys */ if (wParam == VK_SHIFT) winFixShiftKeys(iScanCode); return 0; case WM_ACTIVATE: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* TODO: Override display of window when we have a bad depth */ if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) { ErrorF("winWindowProc - WM_ACTIVATE - Bad depth, trying " "to override window activation\n"); /* Minimize the window */ ShowWindow(hwnd, SW_MINIMIZE); /* Display dialog box */ if (g_hDlgDepthChange != NULL) { /* Make the existing dialog box active */ SetActiveWindow(g_hDlgDepthChange); } else { /* TODO: Recreate the dialog box and bring to the top */ ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT); } /* Don't do any other processing of this message */ return 0; } #if CYGDEBUG winDebug("winWindowProc - WM_ACTIVATE\n"); #endif /* * Focus is being changed to another window. * The other window may or may not belong to * our process. */ /* Clear any lingering wheel delta */ s_pScreenPriv->iDeltaZ = 0; s_pScreenPriv->iDeltaV = 0; /* Reshow the Windows mouse cursor if we are being deactivated */ if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE && !g_fCursor) { /* Show Windows cursor */ g_fCursor = TRUE; ShowCursor(TRUE); } return 0; case WM_ACTIVATEAPP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; #if CYGDEBUG || TRUE winDebug("winWindowProc - WM_ACTIVATEAPP\n"); #endif /* Activate or deactivate */ s_pScreenPriv->fActive = wParam; /* Reshow the Windows mouse cursor if we are being deactivated */ if (g_fSoftwareCursor && !s_pScreenPriv->fActive && !g_fCursor) { /* Show Windows cursor */ g_fCursor = TRUE; ShowCursor(TRUE); } /* Make sure the clipboard chain is ok. */ winFixClipboardChain(); /* Call engine specific screen activation/deactivation function */ (*s_pScreenPriv->pwinActivateApp) (s_pScreen); #ifdef XWIN_MULTIWINDOWEXTWM if (s_pScreenPriv->fActive) { /* Restack all window unless using built-in wm. */ if (s_pScreenInfo->fMWExtWM) winMWExtWMRestackWindows(s_pScreen); } #endif return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_APP_EXIT: /* Display Exit dialog */ winDisplayExitDialog(s_pScreenPriv); return 0; case ID_APP_HIDE_ROOT: if (s_pScreenPriv->fRootWindowShown) ShowWindow(s_pScreenPriv->hwndScreen, SW_HIDE); else ShowWindow(s_pScreenPriv->hwndScreen, SW_SHOW); s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown; return 0; case ID_APP_MONITOR_PRIMARY: fPrimarySelection = !fPrimarySelection; return 0; case ID_APP_ABOUT: /* Display the About box */ winDisplayAboutDialog(s_pScreenPriv); return 0; default: /* It's probably one of the custom menus... */ if (HandleCustomWM_COMMAND(0, LOWORD(wParam), s_pScreenPriv)) return 0; } break; case WM_GIVEUP: /* Tell X that we are giving up */ if (s_pScreenInfo->fMultiWindow) winDeinitMultiWindowWM(); GiveUp(0); return 0; case WM_CLOSE: /* Display Exit dialog */ winDisplayExitDialog(s_pScreenPriv); return 0; case WM_SETCURSOR: if (LOWORD(lParam) == HTCLIENT) { if (!g_fSoftwareCursor) SetCursor(s_pScreenPriv->cursor.handle); return TRUE; } break; default: if (message == s_uTaskbarRestart) { winInitNotifyIcon(s_pScreenPriv); } break; } return DefWindowProc(hwnd, message, wParam, lParam); } xorg-server-1.20.8/hw/xwin/winprefslex.l0000644000175000017500000000763213640201473015144 00000000000000%{ # -*- C -*- /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * Copyright (C) Colin Harrison 2005-2008 * * 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. * * Authors: Earle F. Philhower, III * Colin Harrison */ /* $XFree86: $ */ #include #include #include #include "winprefsyacc.h" extern void ErrorF (const char* /*f*/, ...); /* Copy the parsed string, must be free()d in yacc parser */ static char *makestr(char *str) { char *ptr; ptr = malloc(strlen(str)+1); if (!ptr) { ErrorF ("winMultiWindowLex:makestr() out of memory\n"); exit (-1); } strcpy(ptr, str); return ptr; } %} %option yylineno %option nounput %option noinput %option never-interactive %% \#.*[\r\n] { /* comment */ return NEWLINE; } \/\/.*[\r\n] { /* comment */ return NEWLINE; } [\r\n] { return NEWLINE; } [ \t]+ { /* ignore whitespace */ } MENU { return MENU; } ICONDIRECTORY { return ICONDIRECTORY; } DEFAULTICON { return DEFAULTICON; } ICONS { return ICONS; } STYLES { return STYLES; } TOPMOST { return TOPMOST; } MAXIMIZE { return MAXIMIZE; } MINIMIZE { return MINIMIZE; } BOTTOM { return BOTTOM; } NOTITLE { return NOTITLE; } OUTLINE { return OUTLINE; } NOFRAME { return NOFRAME; } ROOTMENU { return ROOTMENU; } DEFAULTSYSMENU { return DEFAULTSYSMENU; } SYSMENU { return SYSMENU; } SEPARATOR { return SEPARATOR; } ATSTART { return ATSTART; } ATEND { return ATEND; } EXEC { return EXEC; } ALWAYSONTOP { return ALWAYSONTOP; } DEBUG { return DEBUGOUTPUT; } RELOAD { return RELOAD; } TRAYICON { return TRAYICON; } FORCEEXIT { return FORCEEXIT; } SILENTEXIT { return SILENTEXIT; } "{" { return LB; } "}" { return RB; } "\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \ yylval.sVal[strlen(yylval.sVal)-1] = 0; \ return STRING; } [^ \t\r\n]+ { yylval.sVal = makestr(yytext); \ return STRING; } %% /* * Run-of-the mill requirement for yacc */ int yywrap (void) { return 1; } /* * Run a file through the yacc parser */ int parse_file (FILE *file) { int ret; if (!file) return 1; yylineno = 1; yyin = file; ret = yyparse (); yylex_destroy (); return ret; } xorg-server-1.20.8/hw/xwin/wintrayicon.c0000644000175000017500000001450013640201473015123 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Early Ehlinger * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include #include "winprefs.h" #include "winclipboard/winclipboard.h" /* * Initialize the tray icon */ void winInitNotifyIcon(winPrivScreenPtr pScreenPriv) { winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; NOTIFYICONDATA nid = { 0 }; nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = pScreenPriv->hwndScreen; nid.uID = pScreenInfo->dwScreen; nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage = WM_TRAYICON; nid.hIcon = winTaskbarIcon(); /* Save handle to the icon so it can be freed later */ pScreenPriv->hiconNotifyIcon = nid.hIcon; /* Set display and screen-specific tooltip text */ snprintf(nid.szTip, sizeof(nid.szTip), PROJECT_NAME " Server:%s.%d", display, (int) pScreenInfo->dwScreen); /* Add the tray icon */ if (!Shell_NotifyIcon(NIM_ADD, &nid)) ErrorF("winInitNotifyIcon - Shell_NotifyIcon Failed\n"); } /* * Delete the tray icon */ void winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv) { winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; NOTIFYICONDATA nid = { 0 }; #if 0 ErrorF("winDeleteNotifyIcon\n"); #endif nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = pScreenPriv->hwndScreen; nid.uID = pScreenInfo->dwScreen; /* Delete the tray icon */ if (!Shell_NotifyIcon(NIM_DELETE, &nid)) { ErrorF("winDeleteNotifyIcon - Shell_NotifyIcon failed\n"); return; } /* Free the icon that was loaded */ if (pScreenPriv->hiconNotifyIcon != NULL && DestroyIcon(pScreenPriv->hiconNotifyIcon) == 0) { ErrorF("winDeleteNotifyIcon - DestroyIcon failed\n"); } pScreenPriv->hiconNotifyIcon = NULL; } /* * Process messages intended for the tray icon */ LRESULT winHandleIconMessage(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, winPrivScreenPtr pScreenPriv) { winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; switch (lParam) { case WM_LBUTTONUP: /* Restack and bring all windows to top */ SetForegroundWindow (pScreenPriv->hwndScreen); #ifdef XWIN_MULTIWINDOWEXTWM if (pScreenInfo->fMWExtWM) winMWExtWMRestackWindows(pScreenInfo->pScreen); #endif break; case WM_LBUTTONDBLCLK: /* Display Exit dialog box */ winDisplayExitDialog(pScreenPriv); break; case WM_RBUTTONUP: { POINT ptCursor; HMENU hmenuPopup; HMENU hmenuTray; /* Get cursor position */ GetCursorPos(&ptCursor); /* Load tray icon menu resource */ hmenuPopup = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDM_TRAYICON_MENU)); if (!hmenuPopup) ErrorF("winHandleIconMessage - LoadMenu failed\n"); /* Get actual tray icon menu */ hmenuTray = GetSubMenu(hmenuPopup, 0); /* Check for MultiWindow mode */ if (pScreenInfo->fMultiWindow) { MENUITEMINFO mii = { 0 }; /* Root is shown, remove the check box */ /* Setup menu item info structure */ mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_STATE; mii.fState = MFS_CHECKED; /* Unheck box if root is shown */ if (pScreenPriv->fRootWindowShown) mii.fState = MFS_UNCHECKED; /* Set menu state */ SetMenuItemInfo(hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii); } else { /* Remove Hide Root Window button */ RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND); } if (g_fClipboard) { /* Set menu state to indicate if 'Monitor Primary' is enabled or not */ MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_STATE; mii.fState = fPrimarySelection ? MFS_CHECKED : MFS_UNCHECKED; SetMenuItemInfo(hmenuTray, ID_APP_MONITOR_PRIMARY, FALSE, &mii); } else { /* Remove 'Monitor Primary' menu item */ RemoveMenu(hmenuTray, ID_APP_MONITOR_PRIMARY, MF_BYCOMMAND); } SetupRootMenu(hmenuTray); /* * NOTE: This three-step procedure is required for * proper popup menu operation. Without the * call to SetForegroundWindow the * popup menu will often not disappear when you click * outside of it. Without the PostMessage the second * time you display the popup menu it might immediately * disappear. */ SetForegroundWindow(hwnd); TrackPopupMenuEx(hmenuTray, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON, ptCursor.x, ptCursor.y, hwnd, NULL); PostMessage(hwnd, WM_NULL, 0, 0); /* Free menu */ DestroyMenu(hmenuPopup); } break; } return 0; } xorg-server-1.20.8/hw/xwin/winprocarg.c0000644000175000017500000010440213640201473014731 00000000000000/* Copyright 1993, 1998 The Open Group Copyright (C) Colin Harrison 2005-2008 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. */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #ifdef HAVE_SYS_UTSNAME_H #include #endif #include <../xfree86/common/xorgVersion.h> #include "win.h" #include "winconfig.h" #include "winmsg.h" #include "winmonitors.h" #include "winclipboard/winclipboard.h" /* * Function prototypes */ void winLogCommandLine(int argc, char *argv[]); void winLogVersionInfo(void); /* * Process arguments on the command line */ static int iLastScreen = -1; static winScreenInfo defaultScreenInfo; static void winInitializeScreenDefaults(void) { DWORD dwWidth, dwHeight; static Bool fInitializedScreenDefaults = FALSE; /* Bail out early if default screen has already been initialized */ if (fInitializedScreenDefaults) return; /* Zero the memory used for storing the screen info */ memset(&defaultScreenInfo, 0, sizeof(winScreenInfo)); /* Get default width and height */ /* * NOTE: These defaults will cause the window to cover only * the primary monitor in the case that we have multiple monitors. */ dwWidth = GetSystemMetrics(SM_CXSCREEN); dwHeight = GetSystemMetrics(SM_CYSCREEN); winErrorFVerb(2, "winInitializeScreenDefaults - primary monitor w %d h %d\n", (int) dwWidth, (int) dwHeight); /* Set a default DPI, if no '-dpi' option was used */ if (monitorResolution == 0) { HDC hdc = GetDC(NULL); if (hdc) { int dpiX = GetDeviceCaps(hdc, LOGPIXELSX); int dpiY = GetDeviceCaps(hdc, LOGPIXELSY); winErrorFVerb(2, "winInitializeScreenDefaults - native DPI x %d y %d\n", dpiX, dpiY); monitorResolution = dpiY; ReleaseDC(NULL, hdc); } else { winErrorFVerb(1, "winInitializeScreenDefaults - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI); monitorResolution = WIN_DEFAULT_DPI; } } defaultScreenInfo.iMonitor = 1; defaultScreenInfo.hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); defaultScreenInfo.dwWidth = dwWidth; defaultScreenInfo.dwHeight = dwHeight; defaultScreenInfo.dwUserWidth = dwWidth; defaultScreenInfo.dwUserHeight = dwHeight; defaultScreenInfo.fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH; defaultScreenInfo.fUserGavePosition = FALSE; defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP; defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES; #ifdef XWIN_EMULATEPSEUDO defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO; #endif defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH; defaultScreenInfo.pfb = NULL; defaultScreenInfo.fFullScreen = FALSE; defaultScreenInfo.fDecoration = TRUE; #ifdef XWIN_MULTIWINDOWEXTWM defaultScreenInfo.fMWExtWM = FALSE; #endif defaultScreenInfo.fRootless = FALSE; defaultScreenInfo.fMultiWindow = FALSE; defaultScreenInfo.fMultiMonitorOverride = FALSE; defaultScreenInfo.fMultipleMonitors = FALSE; defaultScreenInfo.fLessPointer = FALSE; defaultScreenInfo.iResizeMode = resizeDefault; defaultScreenInfo.fNoTrayIcon = FALSE; defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT; defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL; defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; defaultScreenInfo.fIgnoreInput = FALSE; defaultScreenInfo.fExplicitScreen = FALSE; /* Note that the default screen has been initialized */ fInitializedScreenDefaults = TRUE; } static void winInitializeScreen(int i) { winErrorFVerb(3, "winInitializeScreen - %d\n", i); /* Initialize default screen values, if needed */ winInitializeScreenDefaults(); /* Copy the default screen info */ g_ScreenInfo[i] = defaultScreenInfo; /* Set the screen number */ g_ScreenInfo[i].dwScreen = i; } void winInitializeScreens(int maxscreens) { int i; winErrorFVerb(3, "winInitializeScreens - %i\n", maxscreens); if (maxscreens > g_iNumScreens) { /* Reallocate the memory for DDX-specific screen info */ g_ScreenInfo = realloc(g_ScreenInfo, maxscreens * sizeof(winScreenInfo)); /* Set default values for any new screens */ for (i = g_iNumScreens; i < maxscreens; i++) winInitializeScreen(i); /* Keep a count of the number of screens */ g_iNumScreens = maxscreens; } } /* See Porting Layer Definition - p. 57 */ /* * INPUT * argv: pointer to an array of null-terminated strings, one for * each token in the X Server command line; the first token * is 'XWin.exe', or similar. * argc: a count of the number of tokens stored in argv. * i: a zero-based index into argv indicating the current token being * processed. * * OUTPUT * return: return the number of tokens processed correctly. * * NOTE * When looking for n tokens, check that i + n is less than argc. Or, * you may check if i is greater than or equal to argc, in which case * you should display the UseMsg () and return 0. */ /* Check if enough arguments are given for the option */ #define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; } /* Compare the current option with the string. */ #define IS_OPTION(name) (strcmp (argv[i], name) == 0) int ddxProcessArgument(int argc, char *argv[], int i) { static Bool s_fBeenHere = FALSE; winScreenInfo *screenInfoPtr = NULL; /* Initialize once */ if (!s_fBeenHere) { #ifdef DDXOSVERRORF /* * This initialises our hook into VErrorF () for catching log messages * that are generated before OsInit () is called. */ OsVendorVErrorFProc = OsVendorVErrorF; #endif s_fBeenHere = TRUE; /* Initialize only if option is not -help */ if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") && !IS_OPTION("-version") && !IS_OPTION("--version")) { /* Log the version information */ winLogVersionInfo(); /* Log the command line */ winLogCommandLine(argc, argv); /* * Initialize default screen settings. We have to do this before * OsVendorInit () gets called, otherwise we will overwrite * settings changed by parameters such as -fullscreen, etc. */ winErrorFVerb(3, "ddxProcessArgument - Initializing default " "screens\n"); winInitializeScreenDefaults(); } } #if CYGDEBUG winDebug("ddxProcessArgument - arg: %s\n", argv[i]); #endif /* * Look for the '-help' and similar options */ if (IS_OPTION("-help") || IS_OPTION("-h") || IS_OPTION("--help")) { /* Reset logfile. We don't need that helpmessage in the logfile */ g_pszLogFile = NULL; g_fNoHelpMessageBox = TRUE; UseMsg(); exit(0); return 1; } if (IS_OPTION("-version") || IS_OPTION("--version")) { /* Reset logfile. We don't need that versioninfo in the logfile */ g_pszLogFile = NULL; winLogVersionInfo(); exit(0); return 1; } /* * Look for the '-screen scr_num [width height]' argument */ if (IS_OPTION("-screen")) { int iArgsProcessed = 1; int nScreenNum; int iWidth, iHeight, iX, iY; int iMonitor; #if CYGDEBUG winDebug("ddxProcessArgument - screen - argc: %d i: %d\n", argc, i); #endif /* Display the usage message if the argument is malformed */ if (i + 1 >= argc) { return 0; } /* Grab screen number */ nScreenNum = atoi(argv[i + 1]); /* Validate the specified screen number */ if (nScreenNum < 0) { ErrorF("ddxProcessArgument - screen - Invalid screen number %d\n", nScreenNum); UseMsg(); return 0; } /* Initialize default values for any new screens Note that default values can't change after a -screen option is seen, so it's safe to do this for each screen as it is introduced */ winInitializeScreens(nScreenNum + 1); /* look for @m where m is monitor number */ if (i + 2 < argc && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) { struct GetMonitorInfoData data; if (!QueryMonitor(iMonitor, &data)) { ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); iArgsProcessed = 3; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].iMonitor = iMonitor; g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle; g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth; g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight; g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth; g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight; g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; } else { /* monitor does not exist, error out */ ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", iMonitor); UseMsg(); exit(0); return 0; } } /* Look for 'WxD' or 'W D' */ else if (i + 2 < argc && 2 == sscanf(argv[i + 2], "%dx%d", (int *) &iWidth, (int *) &iHeight)) { winErrorFVerb(2, "ddxProcessArgument - screen - Found ``WxD'' arg\n"); iArgsProcessed = 3; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; g_ScreenInfo[nScreenNum].dwWidth = iWidth; g_ScreenInfo[nScreenNum].dwHeight = iHeight; g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; /* Look for WxD+X+Y */ if (2 == sscanf(argv[i + 2], "%*dx%*d+%d+%d", (int *) &iX, (int *) &iY)) { winErrorFVerb(2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n"); g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].dwInitialX = iX; g_ScreenInfo[nScreenNum].dwInitialY = iY; /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */ if (1 == sscanf(argv[i + 2], "%*dx%*d+%*d+%*d@%d", (int *) &iMonitor)) { struct GetMonitorInfoData data; if (!QueryMonitor(iMonitor, &data)) { ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { g_ScreenInfo[nScreenNum].iMonitor = iMonitor; g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle; g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX; g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY; } else { /* monitor does not exist, error out */ ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", iMonitor); UseMsg(); exit(0); return 0; } } } /* look for WxD@m where m is monitor number */ else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", (int *) &iMonitor)) { struct GetMonitorInfoData data; if (!QueryMonitor(iMonitor, &data)) { ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].iMonitor = iMonitor; g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle; g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; } else { /* monitor does not exist, error out */ ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", iMonitor); UseMsg(); exit(0); return 0; } } } else if (i + 3 < argc && 1 == sscanf(argv[i + 2], "%d", (int *) &iWidth) && 1 == sscanf(argv[i + 3], "%d", (int *) &iHeight)) { winErrorFVerb(2, "ddxProcessArgument - screen - Found ``W D'' arg\n"); iArgsProcessed = 4; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; g_ScreenInfo[nScreenNum].dwWidth = iWidth; g_ScreenInfo[nScreenNum].dwHeight = iHeight; g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; if (i + 5 < argc && 1 == sscanf(argv[i + 4], "%d", (int *) &iX) && 1 == sscanf(argv[i + 5], "%d", (int *) &iY)) { winErrorFVerb(2, "ddxProcessArgument - screen - Found ``X Y'' arg\n"); iArgsProcessed = 6; g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; g_ScreenInfo[nScreenNum].dwInitialX = iX; g_ScreenInfo[nScreenNum].dwInitialY = iY; } } else { winErrorFVerb(2, "ddxProcessArgument - screen - Did not find size arg. " "dwWidth: %d dwHeight: %d\n", (int) g_ScreenInfo[nScreenNum].dwWidth, (int) g_ScreenInfo[nScreenNum].dwHeight); iArgsProcessed = 2; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; } /* Flag that this screen was explicity specified by the user */ g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE; /* * Keep track of the last screen number seen, as parameters seen * before a screen number apply to all screens, whereas parameters * seen after a screen number apply to that screen number only. */ iLastScreen = nScreenNum; return iArgsProcessed; } /* * Is this parameter attached to a screen or global? * * If the parameter is for all screens (appears before * any -screen option), store it in the default screen * info * * If the parameter is for a single screen (appears * after a -screen option), store it in the screen info * for that screen * */ if (iLastScreen == -1) { screenInfoPtr = &defaultScreenInfo; } else { screenInfoPtr = &(g_ScreenInfo[iLastScreen]); } /* * Look for the '-engine n' argument */ if (IS_OPTION("-engine")) { DWORD dwEngine = 0; CARD8 c8OnBits = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) { UseMsg(); return 0; } /* Grab the argument */ dwEngine = atoi(argv[i]); /* Count the one bits in the engine argument */ c8OnBits = winCountBits(dwEngine); /* Argument should only have a single bit on */ if (c8OnBits != 1) { UseMsg(); return 0; } screenInfoPtr->dwEnginePreferred = dwEngine; /* Indicate that we have processed the argument */ return 2; } /* * Look for the '-fullscreen' argument */ if (IS_OPTION("-fullscreen")) { if (!screenInfoPtr->fMultiMonitorOverride) screenInfoPtr->fMultipleMonitors = FALSE; screenInfoPtr->fFullScreen = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-lesspointer' argument */ if (IS_OPTION("-lesspointer")) { screenInfoPtr->fLessPointer = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-nodecoration' argument */ if (IS_OPTION("-nodecoration")) { if (!screenInfoPtr->fMultiMonitorOverride) screenInfoPtr->fMultipleMonitors = FALSE; screenInfoPtr->fDecoration = FALSE; /* Indicate that we have processed this argument */ return 1; } #ifdef XWIN_MULTIWINDOWEXTWM /* * Look for the '-mwextwm' argument */ if (IS_OPTION("-mwextwm")) { if (!screenInfoPtr->fMultiMonitorOverride) screenInfoPtr->fMultipleMonitors = TRUE; screenInfoPtr->fMWExtWM = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-internalwm' argument */ if (IS_OPTION("-internalwm")) { ErrorF("Ignoring obsolete -internalwm option\n"); /* Ignored, but we still accept the arg for backwards compatibility */ /* Indicate that we have processed this argument */ return 1; } #endif /* * Look for the '-rootless' argument */ if (IS_OPTION("-rootless")) { if (!screenInfoPtr->fMultiMonitorOverride) screenInfoPtr->fMultipleMonitors = FALSE; screenInfoPtr->fRootless = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-multiwindow' argument */ if (IS_OPTION("-multiwindow")) { if (!screenInfoPtr->fMultiMonitorOverride) screenInfoPtr->fMultipleMonitors = TRUE; screenInfoPtr->fMultiWindow = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-multiplemonitors' argument */ if (IS_OPTION("-multiplemonitors") || IS_OPTION("-multimonitors")) { screenInfoPtr->fMultiMonitorOverride = TRUE; screenInfoPtr->fMultipleMonitors = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-nomultiplemonitors' argument */ if (IS_OPTION("-nomultiplemonitors") || IS_OPTION("-nomultimonitors")) { screenInfoPtr->fMultiMonitorOverride = TRUE; screenInfoPtr->fMultipleMonitors = FALSE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-scrollbars' argument */ if (IS_OPTION("-scrollbars")) { screenInfoPtr->iResizeMode = resizeWithScrollbars; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-resize' argument */ if (IS_OPTION("-resize") || IS_OPTION("-noresize") || (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0)) { winResizeMode mode; if (IS_OPTION("-resize")) mode = resizeWithRandr; else if (IS_OPTION("-noresize")) mode = resizeNotAllowed; else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) { char *option = argv[i] + strlen("-resize="); if (strcmp(option, "randr") == 0) mode = resizeWithRandr; else if (strcmp(option, "scrollbars") == 0) mode = resizeWithScrollbars; else if (strcmp(option, "none") == 0) mode = resizeNotAllowed; else { ErrorF("ddxProcessArgument - resize - Invalid resize mode %s\n", option); return 0; } } else { ErrorF("ddxProcessArgument - resize - Invalid resize option %s\n", argv[i]); return 0; } screenInfoPtr->iResizeMode = mode; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-clipboard' argument */ if (IS_OPTION("-clipboard")) { /* Now the default, we still accept the arg for backwards compatibility */ g_fClipboard = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-noclipboard' argument */ if (IS_OPTION("-noclipboard")) { g_fClipboard = FALSE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-primary' argument */ if (IS_OPTION("-primary")) { fPrimarySelection = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-noprimary' argument */ if (IS_OPTION("-noprimary")) { fPrimarySelection = FALSE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-ignoreinput' argument */ if (IS_OPTION("-ignoreinput")) { screenInfoPtr->fIgnoreInput = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-emulate3buttons' argument */ if (IS_OPTION("-emulate3buttons")) { int iArgsProcessed = 1; int iE3BTimeout = WIN_DEFAULT_E3B_TIME; /* Grab the optional timeout value */ if (i + 1 < argc && 1 == sscanf(argv[i + 1], "%d", &iE3BTimeout)) { /* Indicate that we have processed the next argument */ iArgsProcessed++; } else { /* * sscanf () won't modify iE3BTimeout if it doesn't find * the specified format; however, I want to be explicit * about setting the default timeout in such cases to * prevent some programs (me) from getting confused. */ iE3BTimeout = WIN_DEFAULT_E3B_TIME; } screenInfoPtr->iE3BTimeout = iE3BTimeout; /* Indicate that we have processed this argument */ return iArgsProcessed; } /* * Look for the '-noemulate3buttons' argument */ if (IS_OPTION("-noemulate3buttons")) { screenInfoPtr->iE3BTimeout = WIN_E3B_OFF; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-depth n' argument */ if (IS_OPTION("-depth")) { DWORD dwBPP = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) { UseMsg(); return 0; } /* Grab the argument */ dwBPP = atoi(argv[i]); screenInfoPtr->dwBPP = dwBPP; /* Indicate that we have processed the argument */ return 2; } /* * Look for the '-refresh n' argument */ if (IS_OPTION("-refresh")) { DWORD dwRefreshRate = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) { UseMsg(); return 0; } /* Grab the argument */ dwRefreshRate = atoi(argv[i]); screenInfoPtr->dwRefreshRate = dwRefreshRate; /* Indicate that we have processed the argument */ return 2; } /* * Look for the '-clipupdates num_boxes' argument */ if (IS_OPTION("-clipupdates")) { DWORD dwNumBoxes = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) { UseMsg(); return 0; } /* Grab the argument */ dwNumBoxes = atoi(argv[i]); screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes; /* Indicate that we have processed the argument */ return 2; } #ifdef XWIN_EMULATEPSEUDO /* * Look for the '-emulatepseudo' argument */ if (IS_OPTION("-emulatepseudo")) { screenInfoPtr->fEmulatePseudo = TRUE; /* Indicate that we have processed this argument */ return 1; } #endif /* * Look for the '-nowinkill' argument */ if (IS_OPTION("-nowinkill")) { screenInfoPtr->fUseWinKillKey = FALSE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-winkill' argument */ if (IS_OPTION("-winkill")) { screenInfoPtr->fUseWinKillKey = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-nounixkill' argument */ if (IS_OPTION("-nounixkill")) { screenInfoPtr->fUseUnixKillKey = FALSE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-unixkill' argument */ if (IS_OPTION("-unixkill")) { screenInfoPtr->fUseUnixKillKey = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-notrayicon' argument */ if (IS_OPTION("-notrayicon")) { screenInfoPtr->fNoTrayIcon = TRUE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-trayicon' argument */ if (IS_OPTION("-trayicon")) { screenInfoPtr->fNoTrayIcon = FALSE; /* Indicate that we have processed this argument */ return 1; } /* * Look for the '-fp' argument */ if (IS_OPTION("-fp")) { CHECK_ARGS(1); g_cmdline.fontPath = argv[++i]; return 0; /* Let DIX parse this again */ } /* * Look for the '-query' argument */ if (IS_OPTION("-query")) { CHECK_ARGS(1); g_fXdmcpEnabled = TRUE; g_pszQueryHost = argv[++i]; return 0; /* Let DIX parse this again */ } /* * Look for the '-auth' argument */ if (IS_OPTION("-auth")) { g_fAuthEnabled = TRUE; return 0; /* Let DIX parse this again */ } /* * Look for the '-indirect' or '-broadcast' arguments */ if (IS_OPTION("-indirect") || IS_OPTION("-broadcast")) { g_fXdmcpEnabled = TRUE; return 0; /* Let DIX parse this again */ } /* * Look for the '-config' argument */ if (IS_OPTION("-config") || IS_OPTION("-xf86config")) { CHECK_ARGS(1); #ifdef XWIN_XF86CONFIG g_cmdline.configFile = argv[++i]; #else winMessageBoxF("The %s option is not supported in this " "release.\n" "Ignoring this option and continuing.\n", MB_ICONINFORMATION, argv[i]); #endif return 2; } /* * Look for the '-configdir' argument */ if (IS_OPTION("-configdir")) { CHECK_ARGS(1); #ifdef XWIN_XF86CONFIG g_cmdline.configDir = argv[++i]; #else winMessageBoxF("The %s option is not supported in this " "release.\n" "Ignoring this option and continuing.\n", MB_ICONINFORMATION, argv[i]); #endif return 2; } /* * Look for the '-keyboard' argument */ if (IS_OPTION("-keyboard")) { #ifdef XWIN_XF86CONFIG CHECK_ARGS(1); g_cmdline.keyboard = argv[++i]; #else winMessageBoxF("The -keyboard option is not supported in this " "release.\n" "Ignoring this option and continuing.\n", MB_ICONINFORMATION); #endif return 2; } /* * Look for the '-logfile' argument */ if (IS_OPTION("-logfile")) { CHECK_ARGS(1); g_pszLogFile = argv[++i]; #ifdef RELOCATE_PROJECTROOT g_fLogFileChanged = TRUE; #endif return 2; } /* * Look for the '-logverbose' argument */ if (IS_OPTION("-logverbose")) { CHECK_ARGS(1); g_iLogVerbose = atoi(argv[++i]); return 2; } /* * Look for the '-nounicodeclipboard' argument */ if (IS_OPTION("-nounicodeclipboard")) { g_fUnicodeClipboard = FALSE; /* Indicate that we have processed the argument */ return 1; } if (IS_OPTION("-xkbrules")) { CHECK_ARGS(1); g_cmdline.xkbRules = argv[++i]; return 2; } if (IS_OPTION("-xkbmodel")) { CHECK_ARGS(1); g_cmdline.xkbModel = argv[++i]; return 2; } if (IS_OPTION("-xkblayout")) { CHECK_ARGS(1); g_cmdline.xkbLayout = argv[++i]; return 2; } if (IS_OPTION("-xkbvariant")) { CHECK_ARGS(1); g_cmdline.xkbVariant = argv[++i]; return 2; } if (IS_OPTION("-xkboptions")) { CHECK_ARGS(1); g_cmdline.xkbOptions = argv[++i]; return 2; } if (IS_OPTION("-keyhook")) { g_fKeyboardHookLL = TRUE; return 1; } if (IS_OPTION("-nokeyhook")) { g_fKeyboardHookLL = FALSE; return 1; } if (IS_OPTION("-swcursor")) { g_fSoftwareCursor = TRUE; return 1; } if (IS_OPTION("-wgl")) { g_fNativeGl = TRUE; return 1; } if (IS_OPTION("-nowgl")) { g_fNativeGl = FALSE; return 1; } if (IS_OPTION("-hostintitle")) { g_fHostInTitle = TRUE; return 1; } if (IS_OPTION("-nohostintitle")) { g_fHostInTitle = FALSE; return 1; } return 0; } /* * winLogCommandLine - Write entire command line to the log file */ void winLogCommandLine(int argc, char *argv[]) { int i; int iSize = 0; int iCurrLen = 0; #define CHARS_PER_LINE 60 /* Bail if command line has already been logged */ if (g_pszCommandLine) return; /* Count how much memory is needed for concatenated command line */ for (i = 0, iCurrLen = 0; i < argc; ++i) if (argv[i]) { /* Adds two characters for lines that overflow */ if ((strlen(argv[i]) < CHARS_PER_LINE && iCurrLen + strlen(argv[i]) > CHARS_PER_LINE) || strlen(argv[i]) > CHARS_PER_LINE) { iCurrLen = 0; iSize += 2; } /* Add space for item and trailing space */ iSize += strlen(argv[i]) + 1; /* Update current line length */ iCurrLen += strlen(argv[i]); } /* Allocate memory for concatenated command line */ g_pszCommandLine = malloc(iSize + 1); if (!g_pszCommandLine) FatalError("winLogCommandLine - Could not allocate memory for " "command line string. Exiting.\n"); /* Set first character to concatenated command line to null */ g_pszCommandLine[0] = '\0'; /* Loop through all args */ for (i = 0, iCurrLen = 0; i < argc; ++i) { /* Add a character for lines that overflow */ if ((strlen(argv[i]) < CHARS_PER_LINE && iCurrLen + strlen(argv[i]) > CHARS_PER_LINE) || strlen(argv[i]) > CHARS_PER_LINE) { iCurrLen = 0; /* Add line break if it fits */ strncat(g_pszCommandLine, "\n ", iSize - strlen(g_pszCommandLine)); } strncat(g_pszCommandLine, argv[i], iSize - strlen(g_pszCommandLine)); strncat(g_pszCommandLine, " ", iSize - strlen(g_pszCommandLine)); /* Save new line length */ iCurrLen += strlen(argv[i]); } ErrorF("XWin was started with the following command line:\n\n" "%s\n\n", g_pszCommandLine); } /* * winLogVersionInfo - Log version information */ void winLogVersionInfo(void) { static Bool s_fBeenHere = FALSE; if (s_fBeenHere) return; s_fBeenHere = TRUE; ErrorF("Welcome to the XWin X Server\n"); ErrorF("Vendor: %s\n", XVENDORNAME); ErrorF("Release: %d.%d.%d.%d\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP); #ifdef HAVE_SYS_UTSNAME_H { struct utsname name; if (uname(&name) >= 0) { ErrorF("OS: %s %s %s %s %s\n", name.sysname, name.nodename, name.release, name.version, name.machine); } } #endif winOS(); if (strlen(BUILDERSTRING)) ErrorF("%s\n", BUILDERSTRING); ErrorF("Contact: %s\n", BUILDERADDR); ErrorF("\n"); } xorg-server-1.20.8/hw/xwin/windisplay.h0000644000175000017500000000252613640201473014752 00000000000000/* * File: windisplay.h * Purpose: Interface to retrieve server display name * * Copyright (C) Jon TURNEY 2009 * * 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. * */ #ifndef WINDISPLAY_H #define WINDISPLAY_H void winGetDisplayName(char *szDisplay, unsigned int screen); #endif /* !WINDISPLAY_H */ xorg-server-1.20.8/hw/xwin/InitOutput.c0000644000175000017500000007546313640201473014720 00000000000000 /* Copyright 1993, 1998 The Open Group Copyright (C) Colin Harrison 2005-2008 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. */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" #include "winconfig.h" #include "winprefs.h" #include "X11/Xlocale.h" #ifdef DPMSExtension #include "dpmsproc.h" #endif #ifdef __CYGWIN__ #include #endif #if defined(WIN32) #include "xkbsrv.h" #endif #ifdef RELOCATE_PROJECTROOT #pragma push_macro("Status") #undef Status #define Status wStatus #include #pragma pop_macro("Status") typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPTSTR pszPath); #endif #include "winmonitors.h" #include "nonsdk_extinit.h" #include "pseudoramiX/pseudoramiX.h" #include "glx_extinit.h" #ifdef XWIN_GLX_WINDOWS #include "glx/glwindows.h" #include "dri/windowsdri.h" #endif /* * References to external symbols */ /* * Function prototypes */ void winLogCommandLine(int argc, char *argv[]); void winLogVersionInfo(void); Bool winValidateArgs(void); #ifdef RELOCATE_PROJECTROOT const char *winGetBaseDir(void); #endif /* * For the depth 24 pixmap we default to 32 bits per pixel, but * we change this pixmap format later if we detect that the display * is going to be running at 24 bits per pixel. * * FIXME: On second thought, don't DIBs only support 32 bits per pixel? * DIBs are the underlying bitmap used for DirectDraw surfaces, so it * seems that all pixmap formats with depth 24 would be 32 bits per pixel. * Confirm whether depth 24 DIBs can have 24 bits per pixel, then remove/keep * the bits per pixel adjustment and update this comment to reflect the * situation. Harold Hunt - 2002/07/02 */ static PixmapFormatRec g_PixmapFormats[] = { {1, 1, BITMAP_SCANLINE_PAD}, {4, 8, BITMAP_SCANLINE_PAD}, {8, 8, BITMAP_SCANLINE_PAD}, {15, 16, BITMAP_SCANLINE_PAD}, {16, 16, BITMAP_SCANLINE_PAD}, {24, 32, BITMAP_SCANLINE_PAD}, {32, 32, BITMAP_SCANLINE_PAD} }; static const ExtensionModule xwinExtensions[] = { #ifdef GLXEXT #ifdef XWIN_WINDOWS_DRI { WindowsDRIExtensionInit, "Windows-DRI", &noDriExtension }, #endif #endif }; /* * XwinExtensionInit * Initialises Xwin-specific extensions. */ static void XwinExtensionInit(void) { #ifdef XWIN_GLX_WINDOWS if (g_fNativeGl) { /* install the native GL provider */ glxWinPushNativeProvider(); } #endif LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE); } #if defined(DDXBEFORERESET) /* * Called right before KillAllClients when the server is going to reset, * allows us to shutdown our seperate threads cleanly. */ void ddxBeforeReset(void) { winDebug("ddxBeforeReset - Hello\n"); winClipboardShutdown(); } #endif #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ void ddxInputThreadInit(void) { } #endif int main(int argc, char *argv[], char *envp[]) { int iReturn; /* Create & acquire the termination mutex */ iReturn = pthread_mutex_init(&g_pmTerminating, NULL); if (iReturn != 0) { ErrorF("ddxMain - pthread_mutex_init () failed: %d\n", iReturn); } iReturn = pthread_mutex_lock(&g_pmTerminating); if (iReturn != 0) { ErrorF("ddxMain - pthread_mutex_lock () failed: %d\n", iReturn); } return dix_main(argc, argv, envp); } /* See Porting Layer Definition - p. 57 */ void ddxGiveUp(enum ExitCode error) { int i; #if CYGDEBUG winDebug("ddxGiveUp\n"); #endif /* Perform per-screen deinitialization */ for (i = 0; i < g_iNumScreens; ++i) { /* Delete the tray icon */ if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen) winDeleteNotifyIcon(winGetScreenPriv(g_ScreenInfo[i].pScreen)); } /* Unload libraries for taskbar grouping */ winPropertyStoreDestroy(); /* Notify the worker threads we're exiting */ winDeinitMultiWindowWM(); #ifdef HAS_DEVWINDOWS /* Close our handle to our message queue */ if (g_fdMessageQueue != WIN_FD_INVALID) { /* Close /dev/windows */ close(g_fdMessageQueue); /* Set the file handle to invalid */ g_fdMessageQueue = WIN_FD_INVALID; } #endif if (!g_fLogInited) { g_pszLogFile = LogInit(g_pszLogFile, ".old"); g_fLogInited = TRUE; } LogClose(error); /* * At this point we aren't creating any new screens, so * we are guaranteed to not need the DirectDraw functions. */ winReleaseDDProcAddresses(); /* Free concatenated command line */ free(g_pszCommandLine); g_pszCommandLine = NULL; /* Remove our keyboard hook if it is installed */ winRemoveKeyboardHookLL(); /* Tell Windows that we want to end the app */ PostQuitMessage(0); { int iReturn = pthread_mutex_unlock(&g_pmTerminating); winDebug("ddxGiveUp - Releasing termination mutex\n"); if (iReturn != 0) { ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n", iReturn); } } winDebug("ddxGiveUp - End\n"); } /* See Porting Layer Definition - p. 57 */ void AbortDDX(enum ExitCode error) { #if CYGDEBUG winDebug("AbortDDX\n"); #endif ddxGiveUp(error); } #ifdef __CYGWIN__ /* hasmntopt is currently not implemented for cygwin */ static const char * winCheckMntOpt(const struct mntent *mnt, const char *opt) { const char *s; size_t len; if (mnt == NULL) return NULL; if (opt == NULL) return NULL; if (mnt->mnt_opts == NULL) return NULL; len = strlen(opt); s = strstr(mnt->mnt_opts, opt); if (s == NULL) return NULL; if ((s == mnt->mnt_opts || *(s - 1) == ',') && (s[len] == 0 || s[len] == ',')) return (char *) opt; return NULL; } static void winCheckMount(void) { FILE *mnt; struct mntent *ent; enum { none = 0, sys_root, user_root, sys_tmp, user_tmp } level = none, curlevel; BOOL binary = TRUE; mnt = setmntent("/etc/mtab", "r"); if (mnt == NULL) { ErrorF("setmntent failed"); return; } while ((ent = getmntent(mnt)) != NULL) { BOOL sys = (winCheckMntOpt(ent, "user") != NULL); BOOL root = (strcmp(ent->mnt_dir, "/") == 0); BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); if (sys) { if (root) curlevel = sys_root; else if (tmp) curlevel = sys_tmp; else continue; } else { if (root) curlevel = user_root; else if (tmp) curlevel = user_tmp; else continue; } if (curlevel <= level) continue; level = curlevel; if ((winCheckMntOpt(ent, "binary") == NULL) && (winCheckMntOpt(ent, "binmode") == NULL)) binary = FALSE; else binary = TRUE; } if (endmntent(mnt) != 1) { ErrorF("endmntent failed"); return; } if (!binary) winMsg(X_WARNING, "/tmp mounted in textmode\n"); } #else static void winCheckMount(void) { } #endif #ifdef RELOCATE_PROJECTROOT const char * winGetBaseDir(void) { static BOOL inited = FALSE; static char buffer[MAX_PATH]; if (!inited) { char *fendptr; HMODULE module = GetModuleHandle(NULL); DWORD size = GetModuleFileName(module, buffer, sizeof(buffer)); if (sizeof(buffer) > 0) buffer[sizeof(buffer) - 1] = 0; fendptr = buffer + size; while (fendptr > buffer) { if (*fendptr == '\\' || *fendptr == '/') { *fendptr = 0; break; } fendptr--; } inited = TRUE; } return buffer; } #endif static void winFixupPaths(void) { BOOL changed_fontpath = FALSE; MessageType font_from = X_DEFAULT; #ifdef RELOCATE_PROJECTROOT const char *basedir = winGetBaseDir(); size_t basedirlen = strlen(basedir); #endif #ifdef READ_FONTDIRS { /* Open fontpath configuration file */ FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); if (fontdirs != NULL) { char buffer[256]; int needs_sep = TRUE; int comment_block = FALSE; /* get default fontpath */ char *fontpath = strdup(defaultFontPath); size_t size = strlen(fontpath); /* read all lines */ while (!feof(fontdirs)) { size_t blen; char *hashchar; char *str; int has_eol = FALSE; /* read one line */ str = fgets(buffer, sizeof(buffer), fontdirs); if (str == NULL) /* stop on error or eof */ break; if (strchr(str, '\n') != NULL) has_eol = TRUE; /* check if block is continued comment */ if (comment_block) { /* ignore all input */ *str = 0; blen = 0; if (has_eol) /* check if line ended in this block */ comment_block = FALSE; } else { /* find comment character. ignore all trailing input */ hashchar = strchr(str, '#'); if (hashchar != NULL) { *hashchar = 0; if (!has_eol) /* mark next block as continued comment */ comment_block = TRUE; } } /* strip whitespaces from beginning */ while (*str == ' ' || *str == '\t') str++; /* get size, strip whitespaces from end */ blen = strlen(str); while (blen > 0 && (str[blen - 1] == ' ' || str[blen - 1] == '\t' || str[blen - 1] == '\n')) { str[--blen] = 0; } /* still something left to add? */ if (blen > 0) { size_t newsize = size + blen; /* reserve one character more for ',' */ if (needs_sep) newsize++; /* allocate memory */ if (fontpath == NULL) fontpath = malloc(newsize + 1); else fontpath = realloc(fontpath, newsize + 1); /* add separator */ if (needs_sep) { fontpath[size] = ','; size++; needs_sep = FALSE; } /* mark next line as new entry */ if (has_eol) needs_sep = TRUE; /* add block */ strncpy(fontpath + size, str, blen); fontpath[newsize] = 0; size = newsize; } } /* cleanup */ fclose(fontdirs); defaultFontPath = strdup(fontpath); free(fontpath); changed_fontpath = TRUE; font_from = X_CONFIG; } } #endif /* READ_FONTDIRS */ #ifdef RELOCATE_PROJECTROOT { const char *libx11dir = PROJECTROOT "/lib/X11"; size_t libx11dir_len = strlen(libx11dir); char *newfp = NULL; size_t newfp_len = 0; const char *endptr, *ptr, *oldptr = defaultFontPath; endptr = oldptr + strlen(oldptr); ptr = strchr(oldptr, ','); if (ptr == NULL) ptr = endptr; while (ptr != NULL) { size_t oldfp_len = (ptr - oldptr); size_t newsize = oldfp_len; char *newpath = malloc(newsize + 1); strncpy(newpath, oldptr, newsize); newpath[newsize] = 0; if (strncmp(libx11dir, newpath, libx11dir_len) == 0) { char *compose; newsize = newsize - libx11dir_len + basedirlen; compose = malloc(newsize + 1); strcpy(compose, basedir); strncat(compose, newpath + libx11dir_len, newsize - basedirlen); compose[newsize] = 0; free(newpath); newpath = compose; } oldfp_len = newfp_len; if (oldfp_len > 0) newfp_len++; /* space for separator */ newfp_len += newsize; if (newfp == NULL) newfp = malloc(newfp_len + 1); else newfp = realloc(newfp, newfp_len + 1); if (oldfp_len > 0) { strcpy(newfp + oldfp_len, ","); oldfp_len++; } strcpy(newfp + oldfp_len, newpath); free(newpath); if (*ptr == 0) { oldptr = ptr; ptr = NULL; } else { oldptr = ptr + 1; ptr = strchr(oldptr, ','); if (ptr == NULL) ptr = endptr; } } defaultFontPath = strdup(newfp); free(newfp); changed_fontpath = TRUE; } #endif /* RELOCATE_PROJECTROOT */ if (changed_fontpath) winMsg(font_from, "FontPath set to \"%s\"\n", defaultFontPath); #ifdef RELOCATE_PROJECTROOT if (getenv("XKEYSYMDB") == NULL) { char buffer[MAX_PATH]; snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB", basedir); buffer[sizeof(buffer) - 1] = 0; putenv(buffer); } if (getenv("XERRORDB") == NULL) { char buffer[MAX_PATH]; snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB", basedir); buffer[sizeof(buffer) - 1] = 0; putenv(buffer); } if (getenv("XLOCALEDIR") == NULL) { char buffer[MAX_PATH]; snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale", basedir); buffer[sizeof(buffer) - 1] = 0; putenv(buffer); } if (getenv("HOME") == NULL) { char buffer[MAX_PATH + 5]; strncpy(buffer, "HOME=", 5); /* query appdata directory */ if (SHGetFolderPathA (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, buffer + 5) == 0) { putenv(buffer); } else { winMsg(X_ERROR, "Can not determine HOME directory\n"); } } if (!g_fLogFileChanged) { static char buffer[MAX_PATH]; DWORD size = GetTempPath(sizeof(buffer), buffer); if (size && size < sizeof(buffer)) { snprintf(buffer + size, sizeof(buffer) - size, "XWin.%s.log", display); buffer[sizeof(buffer) - 1] = 0; g_pszLogFile = buffer; winMsg(X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile); } } { static char xkbbasedir[MAX_PATH]; snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir); if (sizeof(xkbbasedir) > 0) xkbbasedir[sizeof(xkbbasedir) - 1] = 0; XkbBaseDirectory = xkbbasedir; XkbBinDirectory = basedir; } #endif /* RELOCATE_PROJECTROOT */ } void OsVendorInit(void) { /* Re-initialize global variables on server reset */ winInitializeGlobals(); winFixupPaths(); #ifdef DDXOSVERRORF if (!OsVendorVErrorFProc) OsVendorVErrorFProc = OsVendorVErrorF; #endif if (!g_fLogInited) { /* keep this order. If LogInit fails it calls Abort which then calls * ddxGiveUp where LogInit is called again and creates an infinite * recursion. If we set g_fLogInited to TRUE before the init we * avoid the second call */ g_fLogInited = TRUE; g_pszLogFile = LogInit(g_pszLogFile, ".old"); } LogSetParameter(XLOG_FLUSH, 1); LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose); LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose); /* Log the version information */ if (serverGeneration == 1) winLogVersionInfo(); winCheckMount(); /* Add a default screen if no screens were specified */ if (g_iNumScreens == 0) { winDebug("OsVendorInit - Creating default screen 0\n"); /* * We need to initialize the default screen 0 if no -screen * arguments were processed. * * Add a screen 0 using the defaults set by winInitializeDefaultScreens() * and any additional default screen parameters given */ winInitializeScreens(1); /* We have to flag this as an explicit screen, even though it isn't */ g_ScreenInfo[0].fExplicitScreen = TRUE; } /* Work out what the default emulate3buttons setting should be, and apply it if nothing was explicitly specified */ { int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); int j; for (j = 0; j < g_iNumScreens; j++) { if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT) { if (mouseButtons < 3) { static Bool reportOnce = TRUE; g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME; if (reportOnce) { reportOnce = FALSE; winMsg(X_PROBED, "Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n", mouseButtons); } } else { g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF; } } } } /* Work out what the default resize setting should be, and apply it if it was not explicitly specified */ { int j; for (j = 0; j < g_iNumScreens; j++) { if (g_ScreenInfo[j].iResizeMode == resizeDefault) { if (g_ScreenInfo[j].fFullScreen) g_ScreenInfo[j].iResizeMode = resizeNotAllowed; else g_ScreenInfo[j].iResizeMode = resizeWithRandr; } } } } static void winUseMsg(void) { ErrorF("\n"); ErrorF("\n"); ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n"); ErrorF("\n"); ErrorF("-[no]clipboard\n" "\tEnable [disable] the clipboard integration. Default is enabled.\n"); ErrorF("-clipupdates num_boxes\n" "\tUse a clipping region to constrain shadow update blits to\n" "\tthe updated region when num_boxes, or more, are in the\n" "\tupdated region.\n"); #ifdef XWIN_XF86CONFIG ErrorF("-config\n" "\tSpecify a configuration file.\n"); ErrorF("-configdir\n" "\tSpecify a configuration directory.\n"); #endif ErrorF("-depth bits_per_pixel\n" "\tSpecify an optional bitdepth to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); ErrorF("-[no]emulate3buttons [timeout]\n" "\tEmulate 3 button mouse with an optional timeout in\n" "\tmilliseconds.\n"); #ifdef XWIN_EMULATEPSEUDO ErrorF("-emulatepseudo\n" "\tCreate a depth 8 PseudoColor visual when running in\n" "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n" "\tdepths. The PseudoColor visual does not have correct colors,\n" "\tand it may crash, but it at least allows you to run your\n" "\tapplication in TrueColor modes.\n"); #endif ErrorF("-engine engine_type_id\n" "\tOverride the server's automatically selected engine type:\n" "\t\t1 - Shadow GDI\n" "\t\t4 - Shadow DirectDraw4 Non-Locking\n" ); ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n"); ErrorF("-[no]hostintitle\n" "\tIn multiwindow mode, add remote host names to window titles.\n"); ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n"); #ifdef XWIN_XF86CONFIG ErrorF("-keyboard\n" "\tSpecify a keyboard device from the configuration file.\n"); #endif ErrorF("-[no]keyhook\n" "\tGrab special Windows keypresses like Alt-Tab or the Menu " "key.\n"); ErrorF("-lesspointer\n" "\tHide the windows mouse pointer when it is over any\n" "\t" EXECUTABLE_NAME " window. This prevents ghost cursors appearing when\n" "\tthe Windows cursor is drawn on top of the X cursor\n"); ErrorF("-logfile filename\n" "\tWrite log messages to .\n"); ErrorF("-logverbose verbosity\n" "\tSet the verbosity of log messages. [NOTE: Only a few messages\n" "\trespect the settings yet]\n" "\t\t0 - only print fatal error.\n" "\t\t1 - print additional configuration information.\n" "\t\t2 - print additional runtime information [default].\n" "\t\t3 - print debugging and tracing information.\n"); ErrorF("-[no]multimonitors or -[no]multiplemonitors\n" "\tUse the entire virtual screen if multiple\n" "\tmonitors are present.\n"); ErrorF("-multiwindow\n" "\tRun the server in multi-window mode.\n"); #ifdef XWIN_MULTIWINDOWEXTWM ErrorF("-mwextwm\n" "\tRun the server in multi-window external window manager mode.\n"); #endif ErrorF("-nodecoration\n" "\tDo not draw a window border, title bar, etc. Windowed\n" "\tmode only.\n"); ErrorF("-nounicodeclipboard\n" "\tDo not use Unicode clipboard even if on a NT-based platform.\n"); ErrorF("-[no]primary\n" "\tWhen clipboard integration is enabled, map the X11 PRIMARY selection\n" "\tto the Windows clipboard. Default is enabled.\n"); ErrorF("-refresh rate_in_Hz\n" "\tSpecify an optional refresh rate to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); ErrorF("-resize=none|scrollbars|randr" "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n" "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n" "\textension to resize the X screen. 'randr' is the default.\n"); ErrorF("-rootless\n" "\tRun the server in rootless mode.\n"); ErrorF("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n" "\tEnable screen scr_num and optionally specify a width and\n" "\theight and initial position for that screen. Additionally\n" "\ta monitor number can be specified to start the server on,\n" "\tat which point, all coordinates become relative to that\n" "\tmonitor. Examples:\n" "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n" "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); ErrorF("-swcursor\n" "\tDisable the usage of the Windows cursor and use the X11 software\n" "\tcursor instead.\n"); ErrorF("-[no]trayicon\n" "\tDo not create a tray icon. Default is to create one\n" "\ticon per screen. You can globally disable tray icons with\n" "\t-notrayicon, then enable it for specific screens with\n" "\t-trayicon for those screens.\n"); ErrorF("-[no]unixkill\n" "\tCtrl+Alt+Backspace exits the X Server.\n"); #ifdef XWIN_GLX_WINDOWS ErrorF("-[no]wgl\n" "\tEnable the GLX extension to use the native Windows WGL interface for hardware-accelerated OpenGL\n"); #endif ErrorF("-[no]winkill\n" "\tAlt+F4 exits the X Server.\n"); ErrorF("-xkblayout XKBLayout\n" "\tEquivalent to XKBLayout in XF86Config files.\n" "\tFor example: -xkblayout de\n"); ErrorF("-xkbmodel XKBModel\n" "\tEquivalent to XKBModel in XF86Config files.\n"); ErrorF("-xkboptions XKBOptions\n" "\tEquivalent to XKBOptions in XF86Config files.\n"); ErrorF("-xkbrules XKBRules\n" "\tEquivalent to XKBRules in XF86Config files.\n"); ErrorF("-xkbvariant XKBVariant\n" "\tEquivalent to XKBVariant in XF86Config files.\n" "\tFor example: -xkbvariant nodeadkeys\n"); } /* See Porting Layer Definition - p. 57 */ void ddxUseMsg(void) { /* Set a flag so that FatalError won't give duplicate warning message */ g_fSilentFatalError = TRUE; winUseMsg(); /* Log file will not be opened for UseMsg unless we open it now */ if (!g_fLogInited) { g_pszLogFile = LogInit(g_pszLogFile, ".old"); g_fLogInited = TRUE; } LogClose(EXIT_NO_ERROR); /* Notify user where UseMsg text can be found. */ if (!g_fNoHelpMessageBox) winMessageBoxF("The " PROJECT_NAME " help text has been printed to " "%s.\n" "Please open %s to read the help text.\n", MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile); } /* See Porting Layer Definition - p. 20 */ /* * Do any global initialization, then initialize each screen. * * NOTE: We use ddxProcessArgument, so we don't need to touch argc and argv */ void InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) { int i; if (serverGeneration == 1) XwinExtensionInit(); /* Log the command line */ winLogCommandLine(argc, argv); #if CYGDEBUG winDebug("InitOutput\n"); #endif /* Validate command-line arguments */ if (serverGeneration == 1 && !winValidateArgs()) { FatalError("InitOutput - Invalid command-line arguments found. " "Exiting.\n"); } #ifdef XWIN_XF86CONFIG /* Try to read the xorg.conf-style configuration file */ if (!winReadConfigfile()) winErrorFVerb(1, "InitOutput - Error reading config file\n"); #else winMsg(X_INFO, "xorg.conf is not supported\n"); winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " "for more information\n"); winConfigFiles(); #endif /* Load preferences from XWinrc file */ LoadPreferences(); /* Setup global screen info parameters */ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; pScreenInfo->numPixmapFormats = ARRAY_SIZE(g_PixmapFormats); /* Describe how we want common pixmap formats padded */ for (i = 0; i < ARRAY_SIZE(g_PixmapFormats); i++) { pScreenInfo->formats[i] = g_PixmapFormats[i]; } /* Load pointers to DirectDraw functions */ winGetDDProcAddresses(); /* Detect supported engines */ winDetectSupportedEngines(); /* Load libraries for taskbar grouping */ winPropertyStoreInit(); /* Store the instance handle */ g_hInstance = GetModuleHandle(NULL); /* Create the messaging window */ if (serverGeneration == 1) winCreateMsgWindowThread(); /* Initialize each screen */ for (i = 0; i < g_iNumScreens; ++i) { /* Initialize the screen */ if (-1 == AddScreen(winScreenInit, argc, argv)) { FatalError("InitOutput - Couldn't add screen %d", i); } } /* Unless full xinerama has been explicitly enabled, register all native screens with pseudoramiX */ if (!noPanoramiXExtension) noPseudoramiXExtension = TRUE; if ((g_ScreenInfo[0].fMultipleMonitors) && !noPseudoramiXExtension) { int pass; PseudoramiXExtensionInit(); /* Add primary monitor on pass 0, other monitors on pass 1, to ensure the primary monitor is first in XINERAMA list */ for (pass = 0; pass < 2; pass++) { int iMonitor; for (iMonitor = 1; ; iMonitor++) { struct GetMonitorInfoData data; QueryMonitor(iMonitor, &data); if (data.bMonitorSpecifiedExists) { MONITORINFO mi; mi.cbSize = sizeof(MONITORINFO); if (GetMonitorInfo(data.monitorHandle, &mi)) { /* pass == 1 XOR primary monitor flags is set */ if ((!(pass == 1)) != (!(mi.dwFlags & MONITORINFOF_PRIMARY))) { /* Note the screen origin in a normalized coordinate space where (0,0) is at the top left of the native virtual desktop area */ data.monitorOffsetX = data.monitorOffsetX - GetSystemMetrics(SM_XVIRTUALSCREEN); data.monitorOffsetY = data.monitorOffsetY - GetSystemMetrics(SM_YVIRTUALSCREEN); winDebug ("InitOutput - screen %d added at virtual desktop coordinate (%d,%d) (pseudoramiX) \n", iMonitor-1, data.monitorOffsetX, data.monitorOffsetY); PseudoramiXAddScreen(data.monitorOffsetX, data.monitorOffsetY, data.monitorWidth, data.monitorHeight); } } } else break; } } } xorgGlxCreateVendor(); /* Generate a cookie used by internal clients for authorization */ if (g_fXdmcpEnabled || g_fAuthEnabled) winGenerateAuthorization(); /* Perform some one time initialization */ if (1 == serverGeneration) { /* * setlocale applies to all threads in the current process. * Apply locale specified in LANG environment variable. */ setlocale(LC_ALL, ""); } #if CYGDEBUG || YES winDebug("InitOutput - Returning.\n"); #endif } xorg-server-1.20.8/hw/xwin/dri/0000755000175000017500000000000013640201535013246 500000000000000xorg-server-1.20.8/hw/xwin/dri/Makefile.am0000644000175000017500000000027313640201473015225 00000000000000noinst_LTLIBRARIES = libWindowsDRI.la libWindowsDRI_la_SOURCES = \ windowsdri.c \ windowsdri.h AM_CFLAGS = $(DIX_CFLAGS) \ @WINDOWSDRI_CFLAGS@ \ -I$(top_srcdir)/hw/xwin/ xorg-server-1.20.8/hw/xwin/dri/Makefile.in0000644000175000017500000006356413640201514015246 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xwin/dri ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libWindowsDRI_la_LIBADD = am_libWindowsDRI_la_OBJECTS = windowsdri.lo libWindowsDRI_la_OBJECTS = $(am_libWindowsDRI_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/windowsdri.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libWindowsDRI_la_SOURCES) DIST_SOURCES = $(libWindowsDRI_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libWindowsDRI.la libWindowsDRI_la_SOURCES = \ windowsdri.c \ windowsdri.h AM_CFLAGS = $(DIX_CFLAGS) \ @WINDOWSDRI_CFLAGS@ \ -I$(top_srcdir)/hw/xwin/ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwin/dri/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xwin/dri/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libWindowsDRI.la: $(libWindowsDRI_la_OBJECTS) $(libWindowsDRI_la_DEPENDENCIES) $(EXTRA_libWindowsDRI_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libWindowsDRI_la_OBJECTS) $(libWindowsDRI_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowsdri.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/windowsdri.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/windowsdri.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xwin/dri/windowsdri.c0000644000175000017500000001704113640201473015527 00000000000000/* * Copyright © 2014 Jon Turney * * 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 #endif #include #include #include #include "dixstruct.h" #include "extnsionst.h" #include "scrnintstr.h" #include "swaprep.h" #include "protocol-versions.h" #include "windowsdri.h" #include "glx/dri_helpers.h" static int WindowsDRIErrorBase = 0; static unsigned char WindowsDRIReqCode = 0; static int WindowsDRIEventBase = 0; static void WindowsDRIResetProc(ExtensionEntry* extEntry) { } static int ProcWindowsDRIQueryVersion(ClientPtr client) { xWindowsDRIQueryVersionReply rep; REQUEST_SIZE_MATCH(xWindowsDRIQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_WINDOWSDRI_MAJOR_VERSION; rep.minorVersion = SERVER_WINDOWSDRI_MINOR_VERSION; rep.patchVersion = SERVER_WINDOWSDRI_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); swapl(&rep.patchVersion); } WriteToClient(client, sizeof(xWindowsDRIQueryVersionReply), &rep); return Success; } static int ProcWindowsDRIQueryDirectRenderingCapable(ClientPtr client) { xWindowsDRIQueryDirectRenderingCapableReply rep; REQUEST(xWindowsDRIQueryDirectRenderingCapableReq); REQUEST_SIZE_MATCH(xWindowsDRIQueryDirectRenderingCapableReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (!client->local) rep.isCapable = 0; else rep.isCapable = glxWinGetScreenAiglxIsActive(screenInfo.screens[stuff->screen]); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xWindowsDRIQueryDirectRenderingCapableReply), &rep); return Success; } static int ProcWindowsDRIQueryDrawable(ClientPtr client) { xWindowsDRIQueryDrawableReply rep; int rc; REQUEST(xWindowsDRIQueryDrawableReq); REQUEST_SIZE_MATCH(xWindowsDRIQueryDrawableReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rc = glxWinQueryDrawable(client, stuff->drawable, &(rep.drawable_type), &(rep.handle)); if (rc) return rc; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.handle); swapl(&rep.drawable_type); } WriteToClient(client, sizeof(xWindowsDRIQueryDrawableReply), &rep); return Success; } static int ProcWindowsDRIFBConfigToPixelFormat(ClientPtr client) { xWindowsDRIFBConfigToPixelFormatReply rep; REQUEST(xWindowsDRIFBConfigToPixelFormatReq); REQUEST_SIZE_MATCH(xWindowsDRIFBConfigToPixelFormatReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.pixelFormatIndex = glxWinFBConfigIDToPixelFormatIndex(stuff->screen, stuff->fbConfigID); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.pixelFormatIndex); } WriteToClient(client, sizeof(xWindowsDRIFBConfigToPixelFormatReply), &rep); return Success; } /* dispatch */ static int ProcWindowsDRIDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_WindowsDRIQueryVersion: return ProcWindowsDRIQueryVersion(client); case X_WindowsDRIQueryDirectRenderingCapable: return ProcWindowsDRIQueryDirectRenderingCapable(client); } if (!client->local) return WindowsDRIErrorBase + WindowsDRIClientNotLocal; switch (stuff->data) { case X_WindowsDRIQueryDrawable: return ProcWindowsDRIQueryDrawable(client); case X_WindowsDRIFBConfigToPixelFormat: return ProcWindowsDRIFBConfigToPixelFormat(client); default: return BadRequest; } } static void SNotifyEvent(xWindowsDRINotifyEvent *from, xWindowsDRINotifyEvent *to) { to->type = from->type; to->kind = from->kind; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->time, to->time); } static int SProcWindowsDRIQueryVersion(ClientPtr client) { REQUEST(xWindowsDRIQueryVersionReq); swaps(&stuff->length); return ProcWindowsDRIQueryVersion(client); } static int SProcWindowsDRIQueryDirectRenderingCapable(ClientPtr client) { REQUEST(xWindowsDRIQueryDirectRenderingCapableReq); swaps(&stuff->length); swapl(&stuff->screen); return ProcWindowsDRIQueryDirectRenderingCapable(client); } static int SProcWindowsDRIQueryDrawable(ClientPtr client) { REQUEST(xWindowsDRIQueryDrawableReq); swaps(&stuff->length); swapl(&stuff->screen); swapl(&stuff->drawable); return ProcWindowsDRIQueryDrawable(client); } static int SProcWindowsDRIFBConfigToPixelFormat(ClientPtr client) { REQUEST(xWindowsDRIFBConfigToPixelFormatReq); swaps(&stuff->length); swapl(&stuff->screen); swapl(&stuff->fbConfigID); return ProcWindowsDRIFBConfigToPixelFormat(client); } static int SProcWindowsDRIDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_WindowsDRIQueryVersion: return SProcWindowsDRIQueryVersion(client); case X_WindowsDRIQueryDirectRenderingCapable: return SProcWindowsDRIQueryDirectRenderingCapable(client); } if (!client->local) return WindowsDRIErrorBase + WindowsDRIClientNotLocal; switch (stuff->data) { case X_WindowsDRIQueryDrawable: return SProcWindowsDRIQueryDrawable(client); case X_WindowsDRIFBConfigToPixelFormat: return SProcWindowsDRIFBConfigToPixelFormat(client); default: return BadRequest; } } void WindowsDRIExtensionInit(void) { ExtensionEntry* extEntry; if ((extEntry = AddExtension(WINDOWSDRINAME, WindowsDRINumberEvents, WindowsDRINumberErrors, ProcWindowsDRIDispatch, SProcWindowsDRIDispatch, WindowsDRIResetProc, StandardMinorOpcode))) { size_t i; WindowsDRIReqCode = (unsigned char)extEntry->base; WindowsDRIErrorBase = extEntry->errorBase; WindowsDRIEventBase = extEntry->eventBase; for (i = 0; i < WindowsDRINumberEvents; i++) EventSwapVector[WindowsDRIEventBase + i] = (EventSwapPtr)SNotifyEvent; } } xorg-server-1.20.8/hw/xwin/dri/windowsdri.h0000644000175000017500000000237513640201473015540 00000000000000/* * Copyright © 2014 Jon Turney * * 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. */ #ifndef windowsdri_h #define windowsdri_h void WindowsDRIExtensionInit(void); Bool noDriExtension; #endif /* windowsdri_h */ xorg-server-1.20.8/hw/xwin/dri/meson.build0000644000175000017500000000042113640201473015326 00000000000000srcs_windows_dri = [ 'windowsdri.c', 'windowsdri.h', ] xwin_windowsdri = static_library( 'WindowsDRI', srcs_windows_dri, include_directories: [ inc, include_directories('../') ], dependencies: [ windowsdri_dep, pixman_dep, ], ) xorg-server-1.20.8/hw/xwin/winauth.c0000644000175000017500000001106513640201473014237 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* Includes for authorization */ #include "securitysrv.h" #include "os/osdep.h" #include /* Need to get this from Xlib.h */ extern void XSetAuthorization( const char * /* name */, int /* namelen */, const char * /* data */, int /* datalen */ ); /* * Constants */ #define AUTH_NAME "MIT-MAGIC-COOKIE-1" /* * Locals */ static XID g_authId = 0; static unsigned int g_uiAuthDataLen = 0; static char *g_pAuthData = NULL; static xcb_auth_info_t auth_info; /* * Code to generate a MIT-MAGIC-COOKIE-1, copied from under XCSECURITY */ #ifndef XCSECURITY static XID GenerateAuthorization(unsigned name_length, const char *name, unsigned data_length, const char *data, unsigned *data_length_return, char **data_return) { return MitGenerateCookie(data_length, data, FakeClientID(0), data_length_return, data_return); } #endif /* * Generate authorization cookie for internal server clients */ Bool winGenerateAuthorization(void) { SecurityAuthorizationPtr pAuth = NULL; /* Call OS layer to generate authorization key */ g_authId = GenerateAuthorization(strlen(AUTH_NAME), AUTH_NAME, 0, NULL, &g_uiAuthDataLen, &g_pAuthData); if ((XID) ~0L == g_authId) { ErrorF("winGenerateAuthorization - GenerateAuthorization failed\n"); return FALSE; } else { winDebug("winGenerateAuthorization - GenerateAuthorization success!\n" "AuthDataLen: %d AuthData: %s\n", g_uiAuthDataLen, g_pAuthData); } auth_info.name = AUTH_NAME; auth_info.namelen = strlen(AUTH_NAME); auth_info.data = g_pAuthData; auth_info.datalen = g_uiAuthDataLen; #ifdef XCSECURITY /* Allocate structure for additional auth information */ pAuth = (SecurityAuthorizationPtr) malloc(sizeof(SecurityAuthorizationRec)); if (!(pAuth)) { ErrorF("winGenerateAuthorization - Failed allocating " "SecurityAuthorizationPtr.\n"); return FALSE; } /* Fill in the auth fields */ pAuth->id = g_authId; pAuth->timeout = 0; /* live for x seconds after refcnt == 0 */ pAuth->group = None; pAuth->trustLevel = XSecurityClientTrusted; pAuth->refcnt = 1; /* this auth must stick around */ pAuth->secondsRemaining = 0; pAuth->timer = NULL; pAuth->eventClients = NULL; /* Add the authorization to the server's auth list */ if (!AddResource(g_authId, SecurityAuthorizationResType, pAuth)) { ErrorF("winGenerateAuthorization - AddResource failed for auth.\n"); return FALSE; } #endif return TRUE; } /* Use our generated cookie for authentication */ void winSetAuthorization(void) { XSetAuthorization(AUTH_NAME, strlen(AUTH_NAME), g_pAuthData, g_uiAuthDataLen); } xcb_auth_info_t * winGetXcbAuthInfo(void) { if (g_pAuthData) return &auth_info; return NULL; } xorg-server-1.20.8/hw/xwin/winSetAppUserModelID.c0000644000175000017500000000663213640201473016533 00000000000000/* * Copyright (C) 2011 Tobias Häußler * * 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_XWIN_CONFIG_H #include #endif #include #include #include #include #include "winwindow.h" #include "os.h" #include "winmsg.h" #include #define INITGUID #include "initguid.h" #include "propertystore.h" #undef INITGUID static HMODULE g_hmodShell32Dll = NULL; static SHGETPROPERTYSTOREFORWINDOWPROC g_pSHGetPropertyStoreForWindow = NULL; void winPropertyStoreInit(void) { /* Load library and get function pointer to SHGetPropertyStoreForWindow() SHGetPropertyStoreForWindow is only supported since Windows 7. On previous versions the pointer will be NULL and taskbar grouping is not supported. winSetAppUserModelID() will do nothing in this case. */ g_hmodShell32Dll = LoadLibrary("shell32.dll"); if (g_hmodShell32Dll == NULL) { ErrorF("winPropertyStoreInit - Could not load shell32.dll\n"); return; } g_pSHGetPropertyStoreForWindow = (SHGETPROPERTYSTOREFORWINDOWPROC) GetProcAddress(g_hmodShell32Dll, "SHGetPropertyStoreForWindow"); if (g_pSHGetPropertyStoreForWindow == NULL) { ErrorF ("winPropertyStoreInit - Could not get SHGetPropertyStoreForWindow address\n"); return; } } void winPropertyStoreDestroy(void) { if (g_hmodShell32Dll != NULL) { FreeLibrary(g_hmodShell32Dll); g_hmodShell32Dll = NULL; g_pSHGetPropertyStoreForWindow = NULL; } } void winSetAppUserModelID(HWND hWnd, const char *AppID) { PROPVARIANT pv; IPropertyStore *pps = NULL; HRESULT hr; if (g_pSHGetPropertyStoreForWindow == NULL) { return; } winDebug("winSetAppUserMOdelID - hwnd 0x%p appid '%s'\n", hWnd, AppID); hr = g_pSHGetPropertyStoreForWindow(hWnd, &IID_IPropertyStore, (void **) &pps); if (SUCCEEDED(hr) && pps) { memset(&pv, 0, sizeof(PROPVARIANT)); if (AppID) { pv.vt = VT_LPWSTR; hr = SHStrDupA(AppID, &pv.pwszVal); } if (SUCCEEDED(hr)) { pps->lpVtbl->SetValue(pps, &PKEY_AppUserModel_ID, &pv); PropVariantClear(&pv); } pps->lpVtbl->Release(pps); } } xorg-server-1.20.8/hw/xwin/Makefile.in0000644000175000017500000015224513640201514014463 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = XWin$(EXEEXT) @XWIN_GLX_WINDOWS_TRUE@@XWIN_WINDOWS_DRI_TRUE@am__append_1 = dri @XWIN_GLX_WINDOWS_TRUE@@XWIN_WINDOWS_DRI_TRUE@am__append_2 = -DXWIN_WINDOWS_DRI @XWIN_GLX_WINDOWS_TRUE@@XWIN_WINDOWS_DRI_TRUE@am__append_3 = $(top_builddir)/hw/xwin/dri/libWindowsDRI.la subdir = hw/xwin ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(xwinconfigdir)" PROGRAMS = $(bin_PROGRAMS) am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \ winauth.c winblock.c wincmap.c winconfig.c wincreatewnd.c \ wincursor.c windialogs.c winengine.c winerror.c winglobals.c \ winkeybd.c winkeyhook.c winmisc.c winmonitors.c winmouse.c \ winmsg.c winmsgwindow.c winmultiwindowclass.c \ winmultiwindowicons.c winos.c winprefs.c winprefsyacc.y \ winprefslex.l winprocarg.c winscrinit.c winshadddnl.c \ winshadgdi.c wintaskbar.c wintrayicon.c winvalargs.c \ winwakeup.c winwindow.c winwndproc.c ddraw.h winconfig.h win.h \ winglobals.h winkeybd.h winkeynames.h winlayouts.h \ winmessages.h winmonitors.h winmsg.h winms.h \ winmultiwindowclass.h winmultiwindowicons.h winprefs.h \ winresource.h winwindow.h windisplay.c windisplay.h XWin.rc \ $(top_srcdir)/mi/miinitext.c winclipboardinit.c \ winclipboardwrappers.c winmultiwindowshape.c \ winmultiwindowwindow.c winmultiwindowwm.c \ winmultiwindowwndproc.c propertystore.h winSetAppUserModelID.c \ winwin32rootless.c winwin32rootlesswindow.c \ winwin32rootlesswndproc.c winwindowswm.c winrandr.c am__objects_1 = winclipboardinit.$(OBJEXT) \ winclipboardwrappers.$(OBJEXT) am__objects_2 = winmultiwindowshape.$(OBJEXT) \ winmultiwindowwindow.$(OBJEXT) winmultiwindowwm.$(OBJEXT) \ winmultiwindowwndproc.$(OBJEXT) winSetAppUserModelID.$(OBJEXT) @XWIN_MULTIWINDOWEXTWM_TRUE@am__objects_3 = \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootless.$(OBJEXT) \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswindow.$(OBJEXT) \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswndproc.$(OBJEXT) \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwindowswm.$(OBJEXT) am__objects_4 = winrandr.$(OBJEXT) am__objects_5 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \ winallpriv.$(OBJEXT) winauth.$(OBJEXT) winblock.$(OBJEXT) \ wincmap.$(OBJEXT) winconfig.$(OBJEXT) wincreatewnd.$(OBJEXT) \ wincursor.$(OBJEXT) windialogs.$(OBJEXT) winengine.$(OBJEXT) \ winerror.$(OBJEXT) winglobals.$(OBJEXT) winkeybd.$(OBJEXT) \ winkeyhook.$(OBJEXT) winmisc.$(OBJEXT) winmonitors.$(OBJEXT) \ winmouse.$(OBJEXT) winmsg.$(OBJEXT) winmsgwindow.$(OBJEXT) \ winmultiwindowclass.$(OBJEXT) winmultiwindowicons.$(OBJEXT) \ winos.$(OBJEXT) winprefs.$(OBJEXT) winprefsyacc.$(OBJEXT) \ winprefslex.$(OBJEXT) winprocarg.$(OBJEXT) \ winscrinit.$(OBJEXT) winshadddnl.$(OBJEXT) \ winshadgdi.$(OBJEXT) wintaskbar.$(OBJEXT) \ wintrayicon.$(OBJEXT) winvalargs.$(OBJEXT) winwakeup.$(OBJEXT) \ winwindow.$(OBJEXT) winwndproc.$(OBJEXT) windisplay.$(OBJEXT) \ XWin.$(OBJEXT) miinitext.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) am_XWin_OBJECTS = $(am__objects_5) XWin_OBJECTS = $(am_XWin_OBJECTS) am__DEPENDENCIES_1 = $(top_builddir)/pseudoramiX/libPseudoramiX.la \ $(top_builddir)/Xi/libXistubs.la am__DEPENDENCIES_2 = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = XWin_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(XWin_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/InitInput.Po \ ./$(DEPDIR)/InitOutput.Po ./$(DEPDIR)/miinitext.Po \ ./$(DEPDIR)/winSetAppUserModelID.Po ./$(DEPDIR)/winallpriv.Po \ ./$(DEPDIR)/winauth.Po ./$(DEPDIR)/winblock.Po \ ./$(DEPDIR)/winclipboardinit.Po \ ./$(DEPDIR)/winclipboardwrappers.Po ./$(DEPDIR)/wincmap.Po \ ./$(DEPDIR)/winconfig.Po ./$(DEPDIR)/wincreatewnd.Po \ ./$(DEPDIR)/wincursor.Po ./$(DEPDIR)/windialogs.Po \ ./$(DEPDIR)/windisplay.Po ./$(DEPDIR)/winengine.Po \ ./$(DEPDIR)/winerror.Po ./$(DEPDIR)/winglobals.Po \ ./$(DEPDIR)/winkeybd.Po ./$(DEPDIR)/winkeyhook.Po \ ./$(DEPDIR)/winmisc.Po ./$(DEPDIR)/winmonitors.Po \ ./$(DEPDIR)/winmouse.Po ./$(DEPDIR)/winmsg.Po \ ./$(DEPDIR)/winmsgwindow.Po ./$(DEPDIR)/winmultiwindowclass.Po \ ./$(DEPDIR)/winmultiwindowicons.Po \ ./$(DEPDIR)/winmultiwindowshape.Po \ ./$(DEPDIR)/winmultiwindowwindow.Po \ ./$(DEPDIR)/winmultiwindowwm.Po \ ./$(DEPDIR)/winmultiwindowwndproc.Po ./$(DEPDIR)/winos.Po \ ./$(DEPDIR)/winprefs.Po ./$(DEPDIR)/winprefslex.Po \ ./$(DEPDIR)/winprefsyacc.Po ./$(DEPDIR)/winprocarg.Po \ ./$(DEPDIR)/winrandr.Po ./$(DEPDIR)/winscrinit.Po \ ./$(DEPDIR)/winshadddnl.Po ./$(DEPDIR)/winshadgdi.Po \ ./$(DEPDIR)/wintaskbar.Po ./$(DEPDIR)/wintrayicon.Po \ ./$(DEPDIR)/winvalargs.Po ./$(DEPDIR)/winwakeup.Po \ ./$(DEPDIR)/winwin32rootless.Po \ ./$(DEPDIR)/winwin32rootlesswindow.Po \ ./$(DEPDIR)/winwin32rootlesswndproc.Po \ ./$(DEPDIR)/winwindow.Po ./$(DEPDIR)/winwindowswm.Po \ ./$(DEPDIR)/winwndproc.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/ylwrap am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ -e s/c++$$/h++/ -e s/c$$/h/ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) AM_V_YACC = $(am__v_YACC_@AM_V@) am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) am__v_YACC_0 = @echo " YACC " $@; am__v_YACC_1 = SOURCES = $(XWin_SOURCES) DIST_SOURCES = $(am__XWin_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } DATA = $(xwinconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/ylwrap winprefslex.c winprefsyacc.c \ winprefsyacc.h DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = \ $(DEFS_GLX_WINDOWS) \ $(DEFS_MULTIWINDOWEXTWM) DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ $(top_builddir)/pseudoramiX/libPseudoramiX.la \ $(top_builddir)/Xi/libXistubs.la XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ -ldxguid YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SRCS_CLIPBOARD = \ winclipboardinit.c \ winclipboardwrappers.c CLIPBOARD_LIBS = $(top_builddir)/hw/xwin/winclipboard/libXWinclipboard.la @XWIN_GLX_WINDOWS_TRUE@GLX_DIR = $(am__append_1) glx @XWIN_GLX_WINDOWS_TRUE@DEFS_GLX_WINDOWS = $(am__append_2) \ @XWIN_GLX_WINDOWS_TRUE@ -DXWIN_GLX_WINDOWS @XWIN_GLX_WINDOWS_TRUE@XWIN_GLX_LIBS = $(am__append_3) \ @XWIN_GLX_WINDOWS_TRUE@ $(top_builddir)/hw/xwin/glx/libXwinGLX.la @XWIN_GLX_WINDOWS_TRUE@XWIN_GLX_SYS_LIBS = -lopengl32 SRCS_MULTIWINDOW = \ winmultiwindowshape.c \ winmultiwindowwindow.c \ winmultiwindowwm.c \ winmultiwindowwndproc.c \ propertystore.h \ winSetAppUserModelID.c MULTIWINDOW_SYS_LIBS = -lshlwapi -lole32 @XWIN_MULTIWINDOWEXTWM_TRUE@SRCS_MULTIWINDOWEXTWM = \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootless.c \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswindow.c \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswndproc.c \ @XWIN_MULTIWINDOWEXTWM_TRUE@ winwindowswm.c @XWIN_MULTIWINDOWEXTWM_TRUE@DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM @XWIN_MULTIWINDOWEXTWM_TRUE@MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la @XWIN_MULTIWINDOWEXTWM_TRUE@MULTIWINDOWEXTWM_CFLAGS = -I$(top_srcdir)/miext/rootless SRCS_RANDR = \ winrandr.c SRCS = InitInput.c \ InitOutput.c \ winallpriv.c \ winauth.c \ winblock.c \ wincmap.c \ winconfig.c \ wincreatewnd.c \ wincursor.c \ windialogs.c \ winengine.c \ winerror.c \ winglobals.c \ winkeybd.c \ winkeyhook.c \ winmisc.c \ winmonitors.c \ winmouse.c \ winmsg.c \ winmsgwindow.c \ winmultiwindowclass.c \ winmultiwindowicons.c \ winos.c \ winprefs.c \ winprefsyacc.y \ winprefslex.l \ winprocarg.c \ winscrinit.c \ winshadddnl.c \ winshadgdi.c \ wintaskbar.c \ wintrayicon.c \ winvalargs.c \ winwakeup.c \ winwindow.c \ winwndproc.c \ ddraw.h \ winconfig.h \ win.h \ winglobals.h \ winkeybd.h \ winkeynames.h \ winlayouts.h \ winmessages.h \ winmonitors.h \ winmsg.h \ winms.h \ winmultiwindowclass.h \ winmultiwindowicons.h \ winprefs.h \ winresource.h \ winwindow.h \ windisplay.c \ windisplay.h \ XWin.rc \ $(top_srcdir)/mi/miinitext.c \ $(SRCS_CLIPBOARD) \ $(SRCS_MULTIWINDOW) \ $(SRCS_MULTIWINDOWEXTWM) \ $(SRCS_RANDR) XWin_SOURCES = $(SRCS) XWin_DEPENDENCIES = \ $(MULTIWINDOWEXTWM_LIBS) \ $(XWIN_GLX_LIBS) \ $(XWIN_LIBS) \ $(CLIPBOARD_LIBS) \ $(XSERVER_LIBS) XWin_LDADD = \ $(MULTIWINDOWEXTWM_LIBS) \ $(XWIN_GLX_LIBS) \ $(XWIN_LIBS) \ $(CLIPBOARD_LIBS) \ $(XSERVER_LIBS) \ $(XWIN_GLX_SYS_LIBS) \ $(XSERVER_SYS_LIBS) \ $(XWIN_SYS_LIBS) \ $(MULTIWINDOW_SYS_LIBS) XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG) BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c CLEANFILES = $(BUILT_SOURCES) AM_YFLAGS = -d AM_LFLAGS = -i AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) \ -I$(top_srcdir) \ $(MULTIWINDOWEXTWM_CFLAGS) \ -Wno-bad-function-cast xwinconfigdir = $(sysconfdir)/X11 xwinconfig_DATA = system.XWinrc EXTRA_DIST = \ $(xwinconfig_DATA) \ X.ico \ XWin.rc \ XWin.exe.manifest SUBDIRS = man $(GLX_DIR) winclipboard . DIST_SUBDIRS = man dri glx winclipboard . all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .l .lo .o .obj .rc .y $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwin/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xwin/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list XWin$(EXEEXT): $(XWin_OBJECTS) $(XWin_DEPENDENCIES) $(EXTRA_XWin_DEPENDENCIES) @rm -f XWin$(EXEEXT) $(AM_V_CCLD)$(XWin_LINK) $(XWin_OBJECTS) $(XWin_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winSetAppUserModelID.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winallpriv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winauth.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winblock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardwrappers.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wincmap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winconfig.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wincreatewnd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wincursor.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windialogs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windisplay.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winengine.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winerror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winglobals.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winkeybd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winkeyhook.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmisc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmonitors.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmouse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmsgwindow.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowclass.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowicons.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowshape.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowwindow.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowwm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowwndproc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winos.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefslex.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefsyacc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprocarg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winrandr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winscrinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winshadddnl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winshadgdi.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wintaskbar.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wintrayicon.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winvalargs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwakeup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwin32rootless.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwin32rootlesswindow.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwin32rootlesswndproc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwindow.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwindowswm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwndproc.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c miinitext.obj: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-xwinconfigDATA: $(xwinconfig_DATA) @$(NORMAL_INSTALL) @list='$(xwinconfig_DATA)'; test -n "$(xwinconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(xwinconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(xwinconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(xwinconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(xwinconfigdir)" || exit $$?; \ done uninstall-xwinconfigDATA: @$(NORMAL_UNINSTALL) @list='$(xwinconfig_DATA)'; test -n "$(xwinconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(xwinconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(xwinconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f winprefslex.c -rm -f winprefsyacc.c -rm -f winprefsyacc.h -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/InitInput.Po -rm -f ./$(DEPDIR)/InitOutput.Po -rm -f ./$(DEPDIR)/miinitext.Po -rm -f ./$(DEPDIR)/winSetAppUserModelID.Po -rm -f ./$(DEPDIR)/winallpriv.Po -rm -f ./$(DEPDIR)/winauth.Po -rm -f ./$(DEPDIR)/winblock.Po -rm -f ./$(DEPDIR)/winclipboardinit.Po -rm -f ./$(DEPDIR)/winclipboardwrappers.Po -rm -f ./$(DEPDIR)/wincmap.Po -rm -f ./$(DEPDIR)/winconfig.Po -rm -f ./$(DEPDIR)/wincreatewnd.Po -rm -f ./$(DEPDIR)/wincursor.Po -rm -f ./$(DEPDIR)/windialogs.Po -rm -f ./$(DEPDIR)/windisplay.Po -rm -f ./$(DEPDIR)/winengine.Po -rm -f ./$(DEPDIR)/winerror.Po -rm -f ./$(DEPDIR)/winglobals.Po -rm -f ./$(DEPDIR)/winkeybd.Po -rm -f ./$(DEPDIR)/winkeyhook.Po -rm -f ./$(DEPDIR)/winmisc.Po -rm -f ./$(DEPDIR)/winmonitors.Po -rm -f ./$(DEPDIR)/winmouse.Po -rm -f ./$(DEPDIR)/winmsg.Po -rm -f ./$(DEPDIR)/winmsgwindow.Po -rm -f ./$(DEPDIR)/winmultiwindowclass.Po -rm -f ./$(DEPDIR)/winmultiwindowicons.Po -rm -f ./$(DEPDIR)/winmultiwindowshape.Po -rm -f ./$(DEPDIR)/winmultiwindowwindow.Po -rm -f ./$(DEPDIR)/winmultiwindowwm.Po -rm -f ./$(DEPDIR)/winmultiwindowwndproc.Po -rm -f ./$(DEPDIR)/winos.Po -rm -f ./$(DEPDIR)/winprefs.Po -rm -f ./$(DEPDIR)/winprefslex.Po -rm -f ./$(DEPDIR)/winprefsyacc.Po -rm -f ./$(DEPDIR)/winprocarg.Po -rm -f ./$(DEPDIR)/winrandr.Po -rm -f ./$(DEPDIR)/winscrinit.Po -rm -f ./$(DEPDIR)/winshadddnl.Po -rm -f ./$(DEPDIR)/winshadgdi.Po -rm -f ./$(DEPDIR)/wintaskbar.Po -rm -f ./$(DEPDIR)/wintrayicon.Po -rm -f ./$(DEPDIR)/winvalargs.Po -rm -f ./$(DEPDIR)/winwakeup.Po -rm -f ./$(DEPDIR)/winwin32rootless.Po -rm -f ./$(DEPDIR)/winwin32rootlesswindow.Po -rm -f ./$(DEPDIR)/winwin32rootlesswndproc.Po -rm -f ./$(DEPDIR)/winwindow.Po -rm -f ./$(DEPDIR)/winwindowswm.Po -rm -f ./$(DEPDIR)/winwndproc.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-xwinconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/InitInput.Po -rm -f ./$(DEPDIR)/InitOutput.Po -rm -f ./$(DEPDIR)/miinitext.Po -rm -f ./$(DEPDIR)/winSetAppUserModelID.Po -rm -f ./$(DEPDIR)/winallpriv.Po -rm -f ./$(DEPDIR)/winauth.Po -rm -f ./$(DEPDIR)/winblock.Po -rm -f ./$(DEPDIR)/winclipboardinit.Po -rm -f ./$(DEPDIR)/winclipboardwrappers.Po -rm -f ./$(DEPDIR)/wincmap.Po -rm -f ./$(DEPDIR)/winconfig.Po -rm -f ./$(DEPDIR)/wincreatewnd.Po -rm -f ./$(DEPDIR)/wincursor.Po -rm -f ./$(DEPDIR)/windialogs.Po -rm -f ./$(DEPDIR)/windisplay.Po -rm -f ./$(DEPDIR)/winengine.Po -rm -f ./$(DEPDIR)/winerror.Po -rm -f ./$(DEPDIR)/winglobals.Po -rm -f ./$(DEPDIR)/winkeybd.Po -rm -f ./$(DEPDIR)/winkeyhook.Po -rm -f ./$(DEPDIR)/winmisc.Po -rm -f ./$(DEPDIR)/winmonitors.Po -rm -f ./$(DEPDIR)/winmouse.Po -rm -f ./$(DEPDIR)/winmsg.Po -rm -f ./$(DEPDIR)/winmsgwindow.Po -rm -f ./$(DEPDIR)/winmultiwindowclass.Po -rm -f ./$(DEPDIR)/winmultiwindowicons.Po -rm -f ./$(DEPDIR)/winmultiwindowshape.Po -rm -f ./$(DEPDIR)/winmultiwindowwindow.Po -rm -f ./$(DEPDIR)/winmultiwindowwm.Po -rm -f ./$(DEPDIR)/winmultiwindowwndproc.Po -rm -f ./$(DEPDIR)/winos.Po -rm -f ./$(DEPDIR)/winprefs.Po -rm -f ./$(DEPDIR)/winprefslex.Po -rm -f ./$(DEPDIR)/winprefsyacc.Po -rm -f ./$(DEPDIR)/winprocarg.Po -rm -f ./$(DEPDIR)/winrandr.Po -rm -f ./$(DEPDIR)/winscrinit.Po -rm -f ./$(DEPDIR)/winshadddnl.Po -rm -f ./$(DEPDIR)/winshadgdi.Po -rm -f ./$(DEPDIR)/wintaskbar.Po -rm -f ./$(DEPDIR)/wintrayicon.Po -rm -f ./$(DEPDIR)/winvalargs.Po -rm -f ./$(DEPDIR)/winwakeup.Po -rm -f ./$(DEPDIR)/winwin32rootless.Po -rm -f ./$(DEPDIR)/winwin32rootlesswindow.Po -rm -f ./$(DEPDIR)/winwin32rootlesswndproc.Po -rm -f ./$(DEPDIR)/winwindow.Po -rm -f ./$(DEPDIR)/winwindowswm.Po -rm -f ./$(DEPDIR)/winwndproc.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-xwinconfigDATA .MAKE: $(am__recursive_targets) all check install install-am \ install-exec-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-hook install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip install-xwinconfigDATA installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-xwinconfigDATA .PRECIOUS: Makefile .rc.o: $(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include XWin.o: XWin.rc XWin.exe.manifest X.ico winprefsyacc.h: winprefsyacc.c winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h install-exec-hook: (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) XWin$(EXEEXT) X) relink: $(AM_V_at)rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xwin/winkeybd.c0000644000175000017500000004026113640201473014374 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winkeybd.h" #include "winconfig.h" #include "winmsg.h" #include "xkbsrv.h" /* C does not have a logical XOR operator, so we use a macro instead */ #define LOGICAL_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) static Bool g_winKeyState[NUM_KEYCODES]; /* * Local prototypes */ static void winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass); static void winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl); /* * Translate a Windows WM_[SYS]KEY(UP/DOWN) message * into an ASCII scan code. * * We do this ourselves, rather than letting Windows handle it, * because Windows tends to munge the handling of special keys, * like AltGr on European keyboards. */ int winTranslateKey(WPARAM wParam, LPARAM lParam) { int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1]; int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2]; int iParam = HIWORD(lParam); int iParamScanCode = LOBYTE(iParam); int iScanCode; winDebug("winTranslateKey: wParam %08x lParam %08x\n", (int)wParam, (int)lParam); /* WM_ key messages faked by Vista speech recognition (WSR) don't have a * scan code. * * Vocola 3 (Rick Mohr's supplement to WSR) uses * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a * scan code of 1 */ if (iParamScanCode <= 1) { if (VK_PRIOR <= wParam && wParam <= VK_DOWN) /* Trigger special case table to translate to extended * keycode, otherwise if num_lock is on, we can get keypad * numbers instead of navigation keys. */ iParam |= KF_EXTENDED; else iParamScanCode = MapVirtualKeyEx(wParam, /*MAPVK_VK_TO_VSC */ 0, GetKeyboardLayout(0)); } /* Branch on special extended, special non-extended, or normal key */ if ((iParam & KF_EXTENDED) && iKeyFixupEx) iScanCode = iKeyFixupEx; else if (iKeyFixup) iScanCode = iKeyFixup; else if (wParam == 0 && iParamScanCode == 0x70) iScanCode = KEY_HKTG; else switch (iParamScanCode) { case 0x70: iScanCode = KEY_HKTG; break; case 0x73: iScanCode = KEY_BSlash2; break; default: iScanCode = iParamScanCode; break; } return iScanCode; } /* Ring the keyboard bell (system speaker on PCs) */ static void winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass) { /* * We can't use Beep () here because it uses the PC speaker * on NT/2000. MessageBeep (MB_OK) will play the default system * sound on systems with a sound card or it will beep the PC speaker * on systems that do not have a sound card. */ if (iPercent > 0) MessageBeep(MB_OK); } /* Change some keyboard configuration parameters */ static void winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl) { } /* * See Porting Layer Definition - p. 18 * winKeybdProc is known as a DeviceProc. */ int winKeybdProc(DeviceIntPtr pDeviceInt, int iState) { DevicePtr pDevice = (DevicePtr) pDeviceInt; XkbSrvInfoPtr xkbi; XkbControlsPtr ctrl; switch (iState) { case DEVICE_INIT: winConfigKeyboard(pDeviceInt); /* FIXME: Maybe we should use winGetKbdLeds () here? */ defaultKeyboardControl.leds = g_winInfo.keyboard.leds; winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\"" " Variant = \"%s\" Options = \"%s\"\n", g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none", g_winInfo.xkb.model ? g_winInfo.xkb.model : "none", g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none", g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none", g_winInfo.xkb.options ? g_winInfo.xkb.options : "none"); InitKeyboardDeviceStruct(pDeviceInt, &g_winInfo.xkb, winKeybdBell, winKeybdCtrl); xkbi = pDeviceInt->key->xkbInfo; if ((xkbi != NULL) && (xkbi->desc != NULL)) { ctrl = xkbi->desc->ctrls; ctrl->repeat_delay = g_winInfo.keyboard.delay; ctrl->repeat_interval = 1000 / g_winInfo.keyboard.rate; } else { winErrorFVerb(1, "winKeybdProc - Error initializing keyboard AutoRepeat\n"); } break; case DEVICE_ON: pDevice->on = TRUE; // immediately copy the state of this keyboard device to the VCK // (which otherwise happens lazily after the first keypress) CopyKeyClass(pDeviceInt, inputInfo.keyboard); break; case DEVICE_CLOSE: case DEVICE_OFF: pDevice->on = FALSE; break; } return Success; } /* * Detect current mode key states upon server startup. * * Simulate a press and release of any key that is currently * toggled. */ void winInitializeModeKeyStates(void) { /* Restore NumLock */ if (GetKeyState(VK_NUMLOCK) & 0x0001) { winSendKeyEvent(KEY_NumLock, TRUE); winSendKeyEvent(KEY_NumLock, FALSE); } /* Restore CapsLock */ if (GetKeyState(VK_CAPITAL) & 0x0001) { winSendKeyEvent(KEY_CapsLock, TRUE); winSendKeyEvent(KEY_CapsLock, FALSE); } /* Restore ScrollLock */ if (GetKeyState(VK_SCROLL) & 0x0001) { winSendKeyEvent(KEY_ScrollLock, TRUE); winSendKeyEvent(KEY_ScrollLock, FALSE); } /* Restore KanaLock */ if (GetKeyState(VK_KANA) & 0x0001) { winSendKeyEvent(KEY_HKTG, TRUE); winSendKeyEvent(KEY_HKTG, FALSE); } } /* * Upon regaining the keyboard focus we must * resynchronize our internal mode key states * with the actual state of the keys. */ void winRestoreModeKeyStates(void) { DWORD dwKeyState; BOOL processEvents = TRUE; unsigned short internalKeyStates; /* X server is being initialized */ if (!inputInfo.keyboard || !inputInfo.keyboard->key) return; /* Only process events if the rootwindow is mapped. The keyboard events * will cause segfaults otherwise */ if (screenInfo.screens[0]->root && screenInfo.screens[0]->root->mapped == FALSE) processEvents = FALSE; /* Force to process all pending events in the mi event queue */ if (processEvents) mieqProcessInputEvents(); /* Read the mode key states of our X server */ /* (stored in the virtual core keyboard) */ internalKeyStates = XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state); winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates); /* Check if modifier keys are pressed, and if so, fake a press */ { BOOL lctrl = (GetAsyncKeyState(VK_LCONTROL) < 0); BOOL rctrl = (GetAsyncKeyState(VK_RCONTROL) < 0); BOOL lshift = (GetAsyncKeyState(VK_LSHIFT) < 0); BOOL rshift = (GetAsyncKeyState(VK_RSHIFT) < 0); BOOL alt = (GetAsyncKeyState(VK_LMENU) < 0); BOOL altgr = (GetAsyncKeyState(VK_RMENU) < 0); /* If AltGr and CtrlL appear to be pressed, assume the CtrL is a fake one */ if (lctrl && altgr) lctrl = FALSE; if (lctrl) winSendKeyEvent(KEY_LCtrl, TRUE); if (rctrl) winSendKeyEvent(KEY_RCtrl, TRUE); if (lshift) winSendKeyEvent(KEY_ShiftL, TRUE); if (rshift) winSendKeyEvent(KEY_ShiftL, TRUE); if (alt) winSendKeyEvent(KEY_Alt, TRUE); if (altgr) winSendKeyEvent(KEY_AltLang, TRUE); } /* Check if latching modifier key states have changed, and if so, fake a press and a release to toggle the modifier to the correct state */ dwKeyState = GetKeyState(VK_NUMLOCK) & 0x0001; if (LOGICAL_XOR(internalKeyStates & NumLockMask, dwKeyState)) { winSendKeyEvent(KEY_NumLock, TRUE); winSendKeyEvent(KEY_NumLock, FALSE); } dwKeyState = GetKeyState(VK_CAPITAL) & 0x0001; if (LOGICAL_XOR(internalKeyStates & LockMask, dwKeyState)) { winSendKeyEvent(KEY_CapsLock, TRUE); winSendKeyEvent(KEY_CapsLock, FALSE); } dwKeyState = GetKeyState(VK_SCROLL) & 0x0001; if (LOGICAL_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) { winSendKeyEvent(KEY_ScrollLock, TRUE); winSendKeyEvent(KEY_ScrollLock, FALSE); } dwKeyState = GetKeyState(VK_KANA) & 0x0001; if (LOGICAL_XOR(internalKeyStates & KanaMask, dwKeyState)) { winSendKeyEvent(KEY_HKTG, TRUE); winSendKeyEvent(KEY_HKTG, FALSE); } /* For strict correctness, we should also press any non-modifier keys which are already down when we gain focus, but nobody has complained yet :-) */ } /* * Look for the lovely fake Control_L press/release generated by Windows * when AltGr is pressed/released on a non-U.S. keyboard. */ Bool winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam) { MSG msgNext; LONG lTime; Bool fReturn; static Bool lastWasControlL = FALSE; static LONG lastTime; /* * Fake Ctrl_L presses will be followed by an Alt_R press * with the same timestamp as the Ctrl_L press. */ if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN) && wParam == VK_CONTROL && (HIWORD(lParam) & KF_EXTENDED) == 0) { /* Got a Ctrl_L press */ /* Get time of current message */ lTime = GetMessageTime(); /* Look for next press message */ fReturn = PeekMessage(&msgNext, NULL, WM_KEYDOWN, WM_SYSKEYDOWN, PM_NOREMOVE); if (fReturn && msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN) fReturn = 0; if (!fReturn) { lastWasControlL = TRUE; lastTime = lTime; } else { lastWasControlL = FALSE; } /* Is next press an Alt_R with the same timestamp? */ if (fReturn && msgNext.wParam == VK_MENU && msgNext.time == lTime && (HIWORD(msgNext.lParam) & KF_EXTENDED)) { /* * Next key press is Alt_R with same timestamp as current * Ctrl_L message. Therefore, this Ctrl_L press is a fake * event, so discard it. */ return TRUE; } } /* * Sometimes, the Alt_R press message is not yet posted when the * fake Ctrl_L press message arrives (even though it has the * same timestamp), so check for an Alt_R press message that has * arrived since the last Ctrl_L message. */ else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN) && wParam == VK_MENU && (HIWORD(lParam) & KF_EXTENDED)) { /* Got a Alt_R press */ if (lastWasControlL) { lTime = GetMessageTime(); if (lastTime == lTime) { /* Undo the fake Ctrl_L press by sending a fake Ctrl_L release */ winSendKeyEvent(KEY_LCtrl, FALSE); } lastWasControlL = FALSE; } } /* * Fake Ctrl_L releases will be followed by an Alt_R release * with the same timestamp as the Ctrl_L release. */ else if ((message == WM_KEYUP || message == WM_SYSKEYUP) && wParam == VK_CONTROL && (HIWORD(lParam) & KF_EXTENDED) == 0) { /* Got a Ctrl_L release */ /* Get time of current message */ lTime = GetMessageTime(); /* Look for next release message */ fReturn = PeekMessage(&msgNext, NULL, WM_KEYUP, WM_SYSKEYUP, PM_NOREMOVE); if (fReturn && msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP) fReturn = 0; lastWasControlL = FALSE; /* Is next press an Alt_R with the same timestamp? */ if (fReturn && (msgNext.message == WM_KEYUP || msgNext.message == WM_SYSKEYUP) && msgNext.wParam == VK_MENU && msgNext.time == lTime && (HIWORD(msgNext.lParam) & KF_EXTENDED)) { /* * Next key release is Alt_R with same timestamp as current * Ctrl_L message. Therefore, this Ctrl_L release is a fake * event, so discard it. */ return TRUE; } } else { /* On any other press or release message, we don't have a potentially fake Ctrl_L to worry about anymore... */ lastWasControlL = FALSE; } /* Not a fake control left press/release */ return FALSE; } /* * Lift any modifier keys that are pressed */ void winKeybdReleaseKeys(void) { int i; #ifdef HAS_DEVWINDOWS /* Verify that the mi input system has been initialized */ if (g_fdMessageQueue == WIN_FD_INVALID) return; #endif /* Loop through all keys */ for (i = 0; i < NUM_KEYCODES; ++i) { /* Pop key if pressed */ if (g_winKeyState[i]) winSendKeyEvent(i, FALSE); /* Reset pressed flag for keys */ g_winKeyState[i] = FALSE; } } /* * Take a raw X key code and send an up or down event for it. * * Thanks to VNC for inspiration, though it is a simple function. */ void winSendKeyEvent(DWORD dwKey, Bool fDown) { /* * When alt-tabing between screens we can get phantom key up messages * Here we only pass them through it we think we should! */ if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return; /* Update the keyState map */ g_winKeyState[dwKey] = fDown; QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE); winDebug("winSendKeyEvent: dwKey: %u, fDown: %u\n", (unsigned int)dwKey, fDown); } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) { switch (wParam) { case VK_CONTROL: if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl]) return TRUE; if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl]) return TRUE; break; case VK_SHIFT: if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR]) return TRUE; if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL]) return TRUE; break; default: return TRUE; } return FALSE; } /* Only one shift release message is sent even if both are pressed. * Fix this here */ void winFixShiftKeys(int iScanCode) { if (GetKeyState(VK_SHIFT) & 0x8000) return; if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR]) winSendKeyEvent(KEY_ShiftR, FALSE); if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL]) winSendKeyEvent(KEY_ShiftL, FALSE); } xorg-server-1.20.8/hw/xwin/winmsg.h0000644000175000017500000000437313640201473014075 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Alexander Gottwald */ #ifndef __WIN_MSG_H__ #define __WIN_MSG_H__ #include #include /* * Function prototypes */ #ifdef XWIN_XF86CONFIG void winDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(4, 5); void winDrvMsg(int scrnIndex, MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(3, 4); #endif #define winMsg LogMessage void winDebug(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2); void winTrace(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2); void winErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2, 3); void winW32Error(int verb, const char *message); void winW32ErrorEx(int verb, const char *message, DWORD errorcode); void winDebugWin32Message(const char *function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); #endif xorg-server-1.20.8/hw/xwin/winwin32rootless.c0000644000175000017500000007615213640201473016043 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II */ /* * Look at hw/darwin/quartz/xpr/xprFrame.c and hw/darwin/quartz/cr/crFrame.c */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include #define _WINDOWSWM_SERVER_ #include #include "winmultiwindowclass.h" #include "winmultiwindowicons.h" #include /* * Constant defines */ #ifndef ULW_COLORKEY #define ULW_COLORKEY 0x00000001 #endif #ifndef ULW_ALPHA #define ULW_ALPHA 0x00000002 #endif #ifndef ULW_OPAQUE #define ULW_OPAQUE 0x00000004 #endif #define AC_SRC_ALPHA 0x01 /* * Local function */ DEFINE_ATOM_HELPER(AtmWindowsWmNativeHwnd, WINDOWSWM_NATIVE_HWND) static void winMWExtWMSetNativeProperty(RootlessWindowPtr pFrame); /* * Global variables */ Bool g_fNoConfigureWindow = FALSE; /* * Internal function to get the DIB format that is compatible with the screen * Fixme: Share code with winshadgdi.c */ static Bool winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER * pbmih) { HBITMAP hbmp; #if CYGMULTIWINDOW_DEBUG LPDWORD pdw = NULL; #endif /* Create a memory bitmap compatible with the screen */ hbmp = CreateCompatibleBitmap(pRLWinPriv->hdcScreen, 1, 1); if (hbmp == NULL) { ErrorF("winMWExtWMQueryDIBFormat - CreateCompatibleBitmap failed\n"); return FALSE; } /* Initialize our bitmap info header */ ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); pbmih->biSize = sizeof(BITMAPINFOHEADER); /* Get the biBitCount */ if (!GetDIBits(pRLWinPriv->hdcScreen, hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) { ErrorF("winMWExtWMQueryDIBFormat - First call to GetDIBits failed\n"); DeleteObject(hbmp); return FALSE; } #if CYGMULTIWINDOW_DEBUG /* Get a pointer to bitfields */ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER)); winDebug("winMWExtWMQueryDIBFormat - First call masks: %08x %08x %08x\n", (unsigned int) pdw[0], (unsigned int) pdw[1], (unsigned int) pdw[2]); #endif /* Get optimal color table, or the optimal bitfields */ if (!GetDIBits(pRLWinPriv->hdcScreen, hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) { ErrorF("winMWExtWMQueryDIBFormat - Second call to GetDIBits " "failed\n"); DeleteObject(hbmp); return FALSE; } /* Free memory */ DeleteObject(hbmp); return TRUE; } static HRGN winMWExtWMCreateRgnFromRegion(RegionPtr pShape) { int nRects; BoxPtr pRects, pEnd; HRGN hRgn, hRgnRect; if (pShape == NULL) return NULL; nRects = RegionNumRects(pShape); pRects = RegionRects(pShape); hRgn = CreateRectRgn(0, 0, 0, 0); if (hRgn == NULL) { ErrorF("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) " "failed: %d\n", 0, 0, 0, 0, (int) GetLastError()); } /* Loop through all rectangles in the X region */ for (pEnd = pRects + nRects; pRects < pEnd; pRects++) { /* Create a Windows region for the X rectangle */ hRgnRect = CreateRectRgn(pRects->x1, pRects->y1, pRects->x2, pRects->y2); if (hRgnRect == NULL) { ErrorF("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) " "failed: %d\n", pRects->x1, pRects->y1, pRects->x2, pRects->y2, (int) GetLastError()); } /* Merge the Windows region with the accumulated region */ if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) { ErrorF("winReshape - CombineRgn () failed: %d\n", (int) GetLastError()); } /* Delete the temporary Windows region */ DeleteObject(hRgnRect); } return hRgn; } static void InitWin32RootlessEngine(win32RootlessWindowPtr pRLWinPriv) { pRLWinPriv->hdcScreen = GetDC(pRLWinPriv->hWnd); pRLWinPriv->hdcShadow = CreateCompatibleDC(pRLWinPriv->hdcScreen); pRLWinPriv->hbmpShadow = NULL; /* Allocate bitmap info header */ pRLWinPriv->pbmihShadow = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pRLWinPriv->pbmihShadow == NULL) { ErrorF("InitWin32RootlessEngine - malloc () failed\n"); return; } /* Query the screen format */ winMWExtWMQueryDIBFormat(pRLWinPriv, pRLWinPriv->pbmihShadow); } Bool winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY, RegionPtr pShape) { #define CLASS_NAME_LENGTH 512 Bool fResult = TRUE; win32RootlessWindowPtr pRLWinPriv; WNDCLASSEX wc; char pszClass[CLASS_NAME_LENGTH], pszWindowID[12]; HICON hIcon; HICON hIconSmall; char *res_name, *res_class, *res_role; static int s_iWindowID = 0; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame %d %d - %d %d\n", newX, newY, pFrame->width, pFrame->height); #endif pRLWinPriv = malloc(sizeof(win32RootlessWindowRec)); pRLWinPriv->pFrame = pFrame; pRLWinPriv->pfb = NULL; pRLWinPriv->hbmpShadow = NULL; pRLWinPriv->hdcShadow = NULL; pRLWinPriv->hdcScreen = NULL; pRLWinPriv->pbmihShadow = NULL; pRLWinPriv->fResized = TRUE; pRLWinPriv->fClose = FALSE; pRLWinPriv->fRestackingNow = FALSE; pRLWinPriv->fDestroyed = FALSE; pRLWinPriv->fMovingOrSizing = FALSE; // Store the implementation private frame ID pFrame->wid = (RootlessFrameID) pRLWinPriv; winSelectIcons(&hIcon, &hIconSmall); /* Set standard class name prefix so we can identify window easily */ strncpy(pszClass, WINDOW_CLASS_X, sizeof(pszClass)); if (winMultiWindowGetClassHint(pFrame->win, &res_name, &res_class)) { strncat(pszClass, "-", 1); strncat(pszClass, res_name, CLASS_NAME_LENGTH - strlen(pszClass)); strncat(pszClass, "-", 1); strncat(pszClass, res_class, CLASS_NAME_LENGTH - strlen(pszClass)); /* Check if a window class is provided by the WM_WINDOW_ROLE property, * if not use the WM_CLASS information. * For further information see: * http://tronche.com/gui/x/icccm/sec-5.html */ if (winMultiWindowGetWindowRole(pFrame->win, &res_role)) { strcat(pszClass, "-"); strcat(pszClass, res_role); free(res_role); } free(res_name); free(res_class); } /* Add incrementing window ID to make unique class name */ snprintf(pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++); pszWindowID[sizeof(pszWindowID) - 1] = 0; strcat(pszClass, pszWindowID); #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - Creating class: %s\n", pszClass); #endif /* Setup our window class */ wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winMWExtWMWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = hIcon; wc.hIconSm = hIconSmall; wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = pszClass; RegisterClassEx(&wc); /* Create the window */ g_fNoConfigureWindow = TRUE; pRLWinPriv->hWnd = CreateWindowExA(WS_EX_TOOLWINDOW, /* Extended styles */ pszClass, /* Class name */ WINDOW_TITLE_X, /* Window name */ WS_POPUP | WS_CLIPCHILDREN, newX, /* Horizontal position */ newY, /* Vertical position */ pFrame->width, /* Right edge */ pFrame->height, /* Bottom edge */ (HWND) NULL, /* No parent or owner window */ (HMENU) NULL, /* No menu */ GetModuleHandle(NULL), /* Instance handle */ pRLWinPriv); /* ScreenPrivates */ if (pRLWinPriv->hWnd == NULL) { ErrorF("winMWExtWMCreateFrame - CreateWindowExA () failed: %d\n", (int) GetLastError()); fResult = FALSE; } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - ShowWindow\n"); #endif //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); g_fNoConfigureWindow = FALSE; if (pShape != NULL) { winMWExtWMReshapeFrame(pFrame->wid, pShape); } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - (%p) %p\n", pFrame->wid, pRLWinPriv->hWnd); #if 0 { WindowPtr pWin2 = NULL; win32RootlessWindowPtr pRLWinPriv2 = NULL; /* Check if the Windows window property for our X window pointer is valid */ if ((pWin2 = (WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) { pRLWinPriv2 = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE); } winDebug("winMWExtWMCreateFrame2 (%08x) %08x\n", pRLWinPriv2, pRLWinPriv2->hWnd); if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) { winDebug("Error param missmatch\n"); } } #endif #endif winMWExtWMSetNativeProperty(pFrame); return fResult; } void winMWExtWMDestroyFrame(RootlessFrameID wid) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; HICON hIcon; HICON hIconSm; HMODULE hInstance; int iReturn; char pszClass[CLASS_NAME_LENGTH]; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame (%p) %p\n", pRLWinPriv, pRLWinPriv->hWnd); #if 0 { WindowPtr pWin2 = NULL; win32RootlessWindowPtr pRLWinPriv2 = NULL; /* Check if the Windows window property for our X window pointer is valid */ if ((pWin2 = (WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) { pRLWinPriv2 = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE); } winDebug("winMWExtWMDestroyFrame2 (%08x) %08x\n", pRLWinPriv2, pRLWinPriv2->hWnd); if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) { winDebug("Error param missmatch\n"); *(int *) 0 = 1; //raise exseption } } #endif #endif /* Store the info we need to destroy after this window is gone */ hInstance = (HINSTANCE) GetClassLongPtr(pRLWinPriv->hWnd, GCLP_HMODULE); hIcon = (HICON) SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0); hIconSm = (HICON) SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0); iReturn = GetClassName(pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH); pRLWinPriv->fClose = TRUE; pRLWinPriv->fDestroyed = TRUE; /* Destroy the Windows window */ DestroyWindow(pRLWinPriv->hWnd); /* Only if we were able to get the name */ if (iReturn) { #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass); #endif iReturn = UnregisterClass(pszClass, hInstance); } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFramew - Deleting Icon\n"); #endif winDestroyIcon(hIcon); winDestroyIcon(hIconSm); #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame - done\n"); #endif } void winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNewY) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; RECT rcNew; DWORD dwExStyle; DWORD dwStyle; int iX, iY, iWidth, iHeight; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMMoveFrame (%p) (%d %d)\n", pRLWinPriv, iNewX, iNewY); #endif /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE); dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE); /* Get the X and Y location of the X window */ iX = iNewX + GetSystemMetrics(SM_XVIRTUALSCREEN); iY = iNewY + GetSystemMetrics(SM_YVIRTUALSCREEN); /* Get the height and width of the X window */ iWidth = pRLWinPriv->pFrame->width; iHeight = pRLWinPriv->pFrame->height; /* Store the origin, height, and width in a rectangle structure */ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); #endif /* * Calculate the required size of the Windows window rectangle, * given the size of the Windows window client area. */ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle); #ifdef CYGMULTIWINDOW_DEBUG winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); #endif g_fNoConfigureWindow = TRUE; SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); g_fNoConfigureWindow = FALSE; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMMoveFrame (%p) done\n", pRLWinPriv); #endif } void winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNewY, unsigned int uiNewWidth, unsigned int uiNewHeight, unsigned int uiGravity) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; RECT rcNew; RECT rcOld; DWORD dwExStyle; DWORD dwStyle; int iX, iY; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMResizeFrame (%p) (%d %d)-(%d %d)\n", pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight); #endif pRLWinPriv->fResized = TRUE; /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE); dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE); /* Get the X and Y location of the X window */ iX = iNewX + GetSystemMetrics(SM_XVIRTUALSCREEN); iY = iNewY + GetSystemMetrics(SM_YVIRTUALSCREEN); /* Store the origin, height, and width in a rectangle structure */ SetRect(&rcNew, iX, iY, iX + uiNewWidth, iY + uiNewHeight); /* * Calculate the required size of the Windows window rectangle, * given the size of the Windows window client area. */ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle); /* Get a rectangle describing the old Windows window */ GetWindowRect(pRLWinPriv->hWnd, &rcOld); /* Check if the old rectangle and new rectangle are the same */ if (!EqualRect(&rcNew, &rcOld)) { g_fNoConfigureWindow = TRUE; MoveWindow(pRLWinPriv->hWnd, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, TRUE); g_fNoConfigureWindow = FALSE; } } void winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; win32RootlessWindowPtr pRLNextWinPriv = (win32RootlessWindowPtr) nextWid; winScreenPriv(pRLWinPriv->pFrame->win->drawable.pScreen); #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackFrame (%p)\n", pRLWinPriv); #endif if (pScreenPriv && pScreenPriv->fRestacking) return; pRLWinPriv->fRestackingNow = TRUE; /* Show window */ if (!IsWindowVisible(pRLWinPriv->hWnd)) ShowWindow(pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); if (pRLNextWinPriv == NULL) { #if CYGMULTIWINDOW_DEBUG winDebug("Win %p is top\n", pRLWinPriv); #endif pScreenPriv->widTop = wid; SetWindowPos(pRLWinPriv->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } else { /* using general wm like twm, wmaker etc. Interleave X window and Windows window will cause problem. */ SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackFrame - done (%p)\n", pRLWinPriv); #endif pRLWinPriv->fRestackingNow = FALSE; } void winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; HRGN hRgn, hRgnWindow, hRgnClient; RECT rcWindow, rcClient; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMReshapeFrame (%p)\n", pRLWinPriv); #endif hRgn = winMWExtWMCreateRgnFromRegion(pShape); /* Create region for non-client area */ GetWindowRect(pRLWinPriv->hWnd, &rcWindow); GetClientRect(pRLWinPriv->hWnd, &rcClient); MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2); OffsetRgn(hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top); OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top); OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top); hRgnWindow = CreateRectRgnIndirect(&rcWindow); hRgnClient = CreateRectRgnIndirect(&rcClient); CombineRgn(hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF); CombineRgn(hRgn, hRgnWindow, hRgn, RGN_OR); SetWindowRgn(pRLWinPriv->hWnd, hRgn, TRUE); DeleteObject(hRgnWindow); DeleteObject(hRgnClient); } void winMWExtWMUnmapFrame(RootlessFrameID wid) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMUnmapFrame (%p)\n", pRLWinPriv); #endif g_fNoConfigureWindow = TRUE; //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE); ShowWindow(pRLWinPriv->hWnd, SW_HIDE); g_fNoConfigureWindow = FALSE; } /* * Fixme: Code sharing with winshadgdi.c and other engine support */ void winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; winPrivScreenPtr pScreenPriv = NULL; winScreenInfo *pScreenInfo = NULL; ScreenPtr pScreen = NULL; DIBSECTION dibsection; Bool fReturn = TRUE; HDC hdcNew; HBITMAP hbmpNew; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing (%p) %08x\n", pRLWinPriv, pRLWinPriv->fDestroyed); #endif if (!pRLWinPriv->fDestroyed) { pScreen = pRLWinPriv->pFrame->win->drawable.pScreen; if (pScreen) pScreenPriv = winGetScreenPriv(pScreen); if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo; #if CYGMULTIWINDOW_DEBUG winDebug("\tpScreenPriv %p\n", pScreenPriv); winDebug("\tpScreenInfo %p\n", pScreenInfo); winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width, (int) pRLWinPriv->pFrame->height); #endif if (pRLWinPriv->hdcScreen == NULL) { InitWin32RootlessEngine(pRLWinPriv); } if (pRLWinPriv->fResized) { /* width * bpp must be multiple of 4 to match 32bit alignment */ int stridesize; int misalignment; pRLWinPriv->pbmihShadow->biWidth = pRLWinPriv->pFrame->width; pRLWinPriv->pbmihShadow->biHeight = -pRLWinPriv->pFrame->height; stridesize = pRLWinPriv->pFrame->width * (pScreenInfo->dwBPP >> 3); misalignment = stridesize & 3; if (misalignment != 0) { stridesize += 4 - misalignment; pRLWinPriv->pbmihShadow->biWidth = stridesize / (pScreenInfo->dwBPP >> 3); winDebug("\tresizing to %d (was %d)\n", pRLWinPriv->pbmihShadow->biWidth, pRLWinPriv->pFrame->width); } hdcNew = CreateCompatibleDC(pRLWinPriv->hdcScreen); /* Create a DI shadow bitmap with a bit pointer */ hbmpNew = CreateDIBSection(pRLWinPriv->hdcScreen, (BITMAPINFO *) pRLWinPriv->pbmihShadow, DIB_RGB_COLORS, (VOID **) &pRLWinPriv->pfb, NULL, 0); if (hbmpNew == NULL || pRLWinPriv->pfb == NULL) { ErrorF("winMWExtWMStartDrawing - CreateDIBSection failed\n"); //return FALSE; } else { #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - Shadow buffer allocated\n"); #endif } /* Get information about the bitmap that was allocated */ GetObject(hbmpNew, sizeof(dibsection), &dibsection); #if CYGMULTIWINDOW_DEBUG /* Print information about bitmap allocated */ winDebug("winMWExtWMStartDrawing - Dibsection width: %d height: %d " "depth: %d size image: %d\n", (unsigned int) dibsection.dsBmih.biWidth, (unsigned int) dibsection.dsBmih.biHeight, (unsigned int) dibsection.dsBmih.biBitCount, (unsigned int) dibsection.dsBmih.biSizeImage); #endif /* Select the shadow bitmap into the shadow DC */ SelectObject(hdcNew, hbmpNew); #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - Attempting a shadow blit\n"); #endif /* Blit from the old shadow to the new shadow */ fReturn = BitBlt(hdcNew, 0, 0, pRLWinPriv->pFrame->width, pRLWinPriv->pFrame->height, pRLWinPriv->hdcShadow, 0, 0, SRCCOPY); if (fReturn) { #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - Shadow blit success\n"); #endif } else { ErrorF("winMWExtWMStartDrawing - Shadow blit failure\n"); } /* Look for height weirdness */ if (dibsection.dsBmih.biHeight < 0) { /* FIXME: Figure out why biHeight is sometimes negative */ ErrorF("winMWExtWMStartDrawing - WEIRDNESS - " "biHeight still negative: %d\n", (int) dibsection.dsBmih.biHeight); ErrorF("winMWExtWMStartDrawing - WEIRDNESS - " "Flipping biHeight sign\n"); dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight; } pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - bytesPerRow: %d\n", (unsigned int) dibsection.dsBm.bmWidthBytes); #endif /* Free the old shadow bitmap */ DeleteObject(pRLWinPriv->hdcShadow); DeleteObject(pRLWinPriv->hbmpShadow); pRLWinPriv->hdcShadow = hdcNew; pRLWinPriv->hbmpShadow = hbmpNew; pRLWinPriv->fResized = FALSE; #if CYGMULTIWINDOW_DEBUG && FALSE winDebug("winMWExtWMStartDrawing - 0x%08x %d\n", (unsigned int) pRLWinPriv->pfb, (unsigned int) dibsection.dsBm.bmWidthBytes); #endif } } else { ErrorF("winMWExtWMStartDrawing - Already window was destroyed \n"); } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - done (%p) %p %d\n", pRLWinPriv, pRLWinPriv->pfb, (unsigned int) pRLWinPriv->dwWidthBytes); #endif *pixelData = pRLWinPriv->pfb; *bytesPerRow = pRLWinPriv->dwWidthBytes; } void winMWExtWMStopDrawing(RootlessFrameID wid, Bool fFlush) { #if 0 win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; BLENDFUNCTION bfBlend; SIZE szWin; POINT ptSrc; #if CYGMULTIWINDOW_DEBUG || TRUE winDebug("winMWExtWMStopDrawing (%08x)\n", pRLWinPriv); #endif szWin.cx = pRLWinPriv->dwWidth; szWin.cy = pRLWinPriv->dwHeight; ptSrc.x = 0; ptSrc.y = 0; bfBlend.BlendOp = AC_SRC_OVER; bfBlend.BlendFlags = 0; bfBlend.SourceConstantAlpha = 255; bfBlend.AlphaFormat = AC_SRC_ALPHA; if (!UpdateLayeredWindow(pRLWinPriv->hWnd, NULL, NULL, &szWin, pRLWinPriv->hdcShadow, &ptSrc, 0, &bfBlend, ULW_ALPHA)) { ErrorF("winMWExtWMStopDrawing - UpdateLayeredWindow failed\n"); } #endif } void winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; #if 0 BLENDFUNCTION bfBlend; SIZE szWin; POINT ptSrc; #endif #if CYGMULTIWINDOW_DEBUG && 0 winDebug("winMWExtWMUpdateRegion (%08x)\n", pRLWinPriv); #endif #if 0 szWin.cx = pRLWinPriv->dwWidth; szWin.cy = pRLWinPriv->dwHeight; ptSrc.x = 0; ptSrc.y = 0; bfBlend.BlendOp = AC_SRC_OVER; bfBlend.BlendFlags = 0; bfBlend.SourceConstantAlpha = 255; bfBlend.AlphaFormat = AC_SRC_ALPHA; if (!UpdateLayeredWindow(pRLWinPriv->hWnd, NULL, NULL, &szWin, pRLWinPriv->hdcShadow, &ptSrc, 0, &bfBlend, ULW_ALPHA)) { LPVOID lpMsgBuf; /* Display a fancy error message */ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); ErrorF("winMWExtWMUpdateRegion - UpdateLayeredWindow failed: %s\n", (LPSTR) lpMsgBuf); LocalFree(lpMsgBuf); } #endif if (!g_fNoConfigureWindow) UpdateWindow(pRLWinPriv->hWnd); } void winMWExtWMDamageRects(RootlessFrameID wid, int nCount, const BoxRec * pRects, int shift_x, int shift_y) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; const BoxRec *pEnd; #if CYGMULTIWINDOW_DEBUG && 0 winDebug("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n", pRLWinPriv, nCount, pRects, shift_x, shift_y); #endif for (pEnd = pRects + nCount; pRects < pEnd; pRects++) { RECT rcDmg; rcDmg.left = pRects->x1 + shift_x; rcDmg.top = pRects->y1 + shift_y; rcDmg.right = pRects->x2 + shift_x; rcDmg.bottom = pRects->y2 + shift_y; InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE); } } void winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRootlessSwitchWindow (%p) %p\n", pRLWinPriv, pRLWinPriv->hWnd); #endif pRLWinPriv->pFrame = pFrame; pRLWinPriv->fResized = TRUE; /* Set the window extended style flags */ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW); /* Set the window standard style flags */ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN); DeleteProperty(serverClient, oldWin, AtmWindowsWmNativeHwnd()); winMWExtWMSetNativeProperty(pFrame); #if CYGMULTIWINDOW_DEBUG #if 0 { WindowPtr pWin2 = NULL; win32RootlessWindowPtr pRLWinPriv2 = NULL; /* Check if the Windows window property for our X window pointer is valid */ if ((pWin2 = (WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) { pRLWinPriv2 = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE); } winDebug("winMWExtWMSwitchFrame2 (%08x) %08x\n", pRLWinPriv2, pRLWinPriv2->hWnd); if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) { winDebug("Error param missmatch\n"); } } #endif #endif } void winMWExtWMCopyBytes(unsigned int width, unsigned int height, const void *src, unsigned int srcRowBytes, void *dst, unsigned int dstRowBytes) { #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyBytes - Not implemented\n"); #endif } void winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects, const BoxRec * pDstRects, int nDx, int nDy) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; const BoxRec *pEnd; RECT rcDmg; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow (%p, %d, %p, %d, %d)\n", pRLWinPriv, nDstRects, pDstRects, nDx, nDy); #endif for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++) { #if CYGMULTIWINDOW_DEBUG winDebug("BitBlt (%d, %d, %d, %d) (%d, %d)\n", pDstRects->x1, pDstRects->y1, pDstRects->x2 - pDstRects->x1, pDstRects->y2 - pDstRects->y1, pDstRects->x1 + nDx, pDstRects->y1 + nDy); #endif if (!BitBlt(pRLWinPriv->hdcShadow, pDstRects->x1, pDstRects->y1, pDstRects->x2 - pDstRects->x1, pDstRects->y2 - pDstRects->y1, pRLWinPriv->hdcShadow, pDstRects->x1 + nDx, pDstRects->y1 + nDy, SRCCOPY)) { ErrorF("winMWExtWMCopyWindow - BitBlt failed.\n"); } rcDmg.left = pDstRects->x1; rcDmg.top = pDstRects->y1; rcDmg.right = pDstRects->x2; rcDmg.bottom = pDstRects->y2; InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE); } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow - done\n"); #endif } /* * winMWExtWMSetNativeProperty */ static void winMWExtWMSetNativeProperty(RootlessWindowPtr pFrame) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid; long lData; /* FIXME: move this to WindowsWM extension */ lData = (long) pRLWinPriv->hWnd; dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(), XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE); } xorg-server-1.20.8/hw/xwin/winrandr.c0000644000175000017500000002071613640201473014407 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) 2009-2010 Jon TURNEY * *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 HAROLD L HUNT II 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 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 author(s) * * Authors: Harold L Hunt II * Jon TURNEY */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * Answer queries about the RandR features supported. */ static Bool winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations) { rrScrPrivPtr pRRScrPriv; RROutputPtr output; pRRScrPriv = rrGetScrPriv(pScreen); output = pRRScrPriv->outputs[0]; winDebug("winRandRGetInfo ()\n"); /* Don't support rotations */ *pRotations = RR_Rotate_0; /* Delete previous mode */ if (output->modes[0]) { RRModeDestroy(output->modes[0]); RRModeDestroy(output->crtc->mode); } /* Register current mode */ { xRRModeInfo modeInfo; RRModePtr mode; char name[100]; memset(&modeInfo, '\0', sizeof(modeInfo)); snprintf(name, sizeof(name), "%dx%d", pScreen->width, pScreen->height); modeInfo.width = pScreen->width; modeInfo.height = pScreen->height; modeInfo.hTotal = pScreen->width; modeInfo.vTotal = pScreen->height; modeInfo.dotClock = 0; modeInfo.nameLength = strlen(name); mode = RRModeGet(&modeInfo, name); output->modes[0] = mode; output->numModes = 1; mode = RRModeGet(&modeInfo, name); output->crtc->mode = mode; } return TRUE; } /* */ void winDoRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; WindowPtr pRoot = pScreen->root; /* Ignore changes which do nothing */ if ((pScreen->width == width) && (pScreen->height == height) && (pScreen->mmWidth == mmWidth) && (pScreen->mmHeight == mmHeight)) return; // Prevent screen updates while we change things around SetRootClip(pScreen, ROOT_CLIP_NONE); /* Update the screen size as requested */ pScreenInfo->dwWidth = width; pScreenInfo->dwHeight = height; /* Reallocate the framebuffer used by the drawing engine */ (*pScreenPriv->pwinFreeFB) (pScreen); if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) { ErrorF("winDoRandRScreenSetSize - Could not reallocate framebuffer\n"); } pScreen->width = width; pScreen->height = height; pScreen->mmWidth = mmWidth; pScreen->mmHeight = mmHeight; /* Update the screen pixmap to point to the new framebuffer */ winUpdateFBPointer(pScreen, pScreenInfo->pfb); // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ? // resize the root window //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); // does this emit a ConfigureNotify?? // Restore the ability to update screen, now with new dimensions SetRootClip(pScreen, ROOT_CLIP_FULL); // and arrange for it to be repainted pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); /* Indicate that a screen size change took place */ RRScreenSizeNotify(pScreen); } /* * Respond to resize request */ static Bool winRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; winDebug("winRandRScreenSetSize ()\n"); /* It doesn't currently make sense to allow resize in fullscreen mode (we'd actually have to list the supported resolutions) */ if (pScreenInfo->fFullScreen) { ErrorF ("winRandRScreenSetSize - resize not supported in fullscreen mode\n"); return FALSE; } /* Client resize requests aren't allowed in rootless modes, even if the X screen is monitor or virtual desktop size, we'd need to resize the native display size */ if (FALSE #ifdef XWIN_MULTIWINDOWEXTWM || pScreenInfo->fMWExtWM #endif || pScreenInfo->fRootless || pScreenInfo->fMultiWindow ) { ErrorF ("winRandRScreenSetSize - resize not supported in rootless modes\n"); return FALSE; } winDoRandRScreenSetSize(pScreen, width, height, mmWidth, mmHeight); /* Cause the native window for the screen to resize itself */ { DWORD dwStyle, dwExStyle; RECT rcClient; rcClient.left = 0; rcClient.top = 0; rcClient.right = width; rcClient.bottom = height; ErrorF("winRandRScreenSetSize new client area w: %d h: %d\n", width, height); /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_EXSTYLE); dwStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_STYLE); /* * Calculate the window size needed for the given client area * adjusting for any decorations it will have */ AdjustWindowRectEx(&rcClient, dwStyle, FALSE, dwExStyle); ErrorF("winRandRScreenSetSize new window area w: %d h: %d\n", (int)(rcClient.right - rcClient.left), (int)(rcClient.bottom - rcClient.top)); SetWindowPos(pScreenPriv->hwndScreen, NULL, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_NOZORDER | SWP_NOMOVE); } return TRUE; } /* * Initialize the RandR layer. */ Bool winRandRInit(ScreenPtr pScreen) { rrScrPrivPtr pRRScrPriv; winDebug("winRandRInit ()\n"); if (!RRScreenInit(pScreen)) { ErrorF("winRandRInit () - RRScreenInit () failed\n"); return FALSE; } /* Set some RandR function pointers */ pRRScrPriv = rrGetScrPriv(pScreen); pRRScrPriv->rrGetInfo = winRandRGetInfo; pRRScrPriv->rrSetConfig = NULL; pRRScrPriv->rrScreenSetSize = winRandRScreenSetSize; pRRScrPriv->rrCrtcSet = NULL; pRRScrPriv->rrCrtcSetGamma = NULL; /* Create a CRTC and an output for the screen, and hook them together */ { RRCrtcPtr crtc; RROutputPtr output; crtc = RRCrtcCreate(pScreen, NULL); if (!crtc) return FALSE; crtc->rotations = RR_Rotate_0; output = RROutputCreate(pScreen, "default", 7, NULL); if (!output) return FALSE; RROutputSetCrtcs(output, &crtc, 1); RROutputSetConnection(output, RR_Connected); RROutputSetSubpixelOrder(output, PictureGetSubpixelOrder(pScreen)); output->crtc = crtc; /* Set crtc outputs (should use RRCrtcNotify?) */ crtc->outputs = malloc(sizeof(RROutputPtr)); crtc->outputs[0] = output; crtc->numOutputs = 1; pRRScrPriv->primaryOutput = output; /* Ensure we have space for exactly one mode */ output->modes = malloc(sizeof(RRModePtr)); output->modes[0] = NULL; } /* The screen doesn't have to be limited to the actual monitor size (we can have scrollbars :-), so set the upper limit to the maximum coordinates X11 can use. */ RRScreenSetSizeRange(pScreen, 0, 0, 32768, 32768); return TRUE; } xorg-server-1.20.8/hw/xwin/winkeyhook.c0000644000175000017500000001132213640201473014743 00000000000000/* *Copyright (C) 2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" static HHOOK g_hhookKeyboardLL = NULL; /* * Function prototypes */ static LRESULT CALLBACK winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam); #ifndef LLKHF_EXTENDED #define LLKHF_EXTENDED 0x00000001 #endif #ifndef LLKHF_UP #define LLKHF_UP 0x00000080 #endif /* * KeyboardMessageHook */ static LRESULT CALLBACK winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam) { BOOL fPassKeystroke = FALSE; BOOL fPassAltTab = TRUE; PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam; HWND hwnd = GetActiveWindow(); WindowPtr pWin = NULL; winPrivWinPtr pWinPriv = NULL; winPrivScreenPtr pScreenPriv = NULL; winScreenInfo *pScreenInfo = NULL; /* Check if the Windows window property for our X window pointer is valid */ if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) { /* Get a pointer to our window privates */ pWinPriv = winGetWindowPriv(pWin); /* Get pointers to our screen privates and screen info */ pScreenPriv = pWinPriv->pScreenPriv; pScreenInfo = pScreenPriv->pScreenInfo; if (pScreenInfo->fMultiWindow) fPassAltTab = FALSE; } /* Pass keystrokes on to our main message loop */ if (iCode == HC_ACTION) { winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n", (unsigned int)p->vkCode, (unsigned int)p->scanCode); switch (wParam) { case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_KEYUP: case WM_SYSKEYUP: fPassKeystroke = (fPassAltTab && (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) || (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN); break; } } /* * Pass message on to our main message loop. * We process this immediately with SendMessage so that the keystroke * appears in, hopefully, the correct order. */ if (fPassKeystroke) { LPARAM lParamKey = 0x0; /* Construct the lParam from KBDLLHOOKSTRUCT */ lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */ lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16)); lParamKey = lParamKey | (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23)); lParamKey = lParamKey | (0x20000000 & ((p->flags & LLKHF_ALTDOWN) << 24)); lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24)); /* Send message to our main window that has the keyboard focus */ PostMessage(hwnd, (UINT) wParam, (WPARAM) p->vkCode, lParamKey); return 1; } /* Call next hook */ return CallNextHookEx(NULL, iCode, wParam, lParam); } /* * Attempt to install the keyboard hook, return FALSE if it was not installed */ Bool winInstallKeyboardHookLL(void) { /* Install the hook only once */ if (!g_hhookKeyboardLL) g_hhookKeyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL, winKeyboardMessageHookLL, g_hInstance, 0); return TRUE; } /* * Remove the keyboard hook if it is installed */ void winRemoveKeyboardHookLL(void) { if (g_hhookKeyboardLL) UnhookWindowsHookEx(g_hhookKeyboardLL); g_hhookKeyboardLL = NULL; } xorg-server-1.20.8/hw/xwin/winlayouts.h0000644000175000017500000001154413640201473015005 00000000000000/* * Copyright (c) 2005 Alexander Gottwald * * 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 ABOVE LISTED COPYRIGHT HOLDER(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(s) of the above copyright * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ /* Definitions for various keyboard layouts from windows and their * XKB settings. */ typedef struct { unsigned int winlayout; int winkbtype; const char *xkbmodel; const char *xkblayout; const char *xkbvariant; const char *xkboptions; const char *layoutname; } WinKBLayoutRec, *WinKBLayoutPtr; /* This table is sorted by low byte of winlayout, then by next byte, etc. */ WinKBLayoutRec winKBLayouts[] = { {0x00000404, -1, "pc105", "cn", NULL, NULL, "Chinese (Traditional)"}, {0x00000804, -1, "pc105", "cn", NULL, NULL, "Chinese (Simplified)"}, {0x00000405, -1, "pc105", "cz", NULL, NULL, "Czech"}, {0x00010405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"}, {0x00000406, -1, "pc105", "dk", NULL, NULL, "Danish"}, {0x00000407, -1, "pc105", "de", NULL, NULL, "German (Germany)"}, {0x00010407, -1, "pc105", "de", NULL, NULL, "German (Germany,IBM)"}, {0x00000807, -1, "pc105", "ch", "de", NULL, "German (Switzerland)"}, {0x00000409, -1, "pc105", "us", NULL, NULL, "English (USA)"}, {0x00010409, -1, "pc105", "dvorak", NULL, NULL, "English (USA,Dvorak)"}, {0x00020409, -1, "pc105", "us_intl", NULL, NULL, "English (USA,International)"}, {0x00000809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"}, {0x00001009, -1, "pc105", "ca", "fr", NULL, "French (Canada)"}, {0x00011009, -1, "pc105", "ca", "multix", NULL, "Canadian Multilingual Standard"}, {0x00001809, -1, "pc105", "ie", NULL, NULL, "Irish"}, {0x0000040a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain,Traditional Sort)"}, {0x0000080a, -1, "pc105", "latam", NULL, NULL, "Latin American"}, {0x0000040b, -1, "pc105", "fi", NULL, NULL, "Finnish"}, {0x0000040c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"}, {0x0000080c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"}, {0x00000c0c, -1, "pc105", "ca", "fr-legacy", NULL, "French (Canada, Legacy)"}, {0x0000100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"}, {0x0000040d, -1, "pc105", "il", NULL, NULL, "Hebrew"}, {0x0000040e, -1, "pc105", "hu", NULL, NULL, "Hungarian"}, {0x0000040f, -1, "pc105", "is", NULL, NULL, "Icelandic"}, {0x00000410, -1, "pc105", "it", NULL, NULL, "Italian"}, {0x00010410, -1, "pc105", "it", NULL, NULL, "Italian (142)"}, {0x00000411, 7, "jp106", "jp", NULL, NULL, "Japanese"}, {0x00000412, -1, "kr106", "kr", NULL, NULL, "Korean"}, {0x00000413, -1, "pc105", "nl", NULL, NULL, "Dutch"}, {0x00000813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"}, {0x00000414, -1, "pc105", "no", NULL, NULL, "Norwegian"}, {0x00000415, -1, "pc105", "pl", NULL, NULL, "Polish (Programmers)"}, {0x00000416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil,ABNT)"}, {0x00010416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil,ABNT2)"}, {0x00000816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"}, {0x0000041a, -1, "pc105", "hr", NULL, NULL, "Croatian"}, {0x0000041d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"}, {0x0000041f, -1, "pc105", "tr", NULL, NULL, "Turkish (Q)"}, {0x0001041f, -1, "pc105", "tr", "f", NULL, "Turkish (F)"}, {0x00000424, -1, "pc105", "si", NULL, NULL, "Slovenian"}, {0x00000425, -1, "pc105", "ee", NULL, NULL, "Estonian"}, {0x00000452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"}, {-1, -1, NULL, NULL, NULL, NULL, NULL} }; /* See http://technet.microsoft.com/en-us/library/cc766503%28WS.10%29.aspx for a listing of input locale (keyboard layout) codes */ xorg-server-1.20.8/hw/xwin/winmultiwindowclass.h0000644000175000017500000001223113640201473016707 00000000000000#if !defined(WINMULTIWINDOWCLASS_H) #define WINMULTIWINDOWCLASS_H /* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Earle F. Philhower, III */ /* * The next block of definitions are for window manager properties that * clients and applications use for communication. */ /* * Structures */ /* * WM_HINTS structure * * NOTE: this structure represents the internal format stored in the property * after it is marshalled by libX11, converting the flags field from an * arch-dependent long to a 32-bit int. */ typedef struct { int flags; /* marks which fields in this structure are defined */ Bool input; /* does this application rely on the window manager to get keyboard input? */ int initial_state; /* see below */ Pixmap icon_pixmap; /* pixmap to be used as icon */ Window icon_window; /* window to be used as icon */ int icon_x, icon_y; /* initial position of icon */ Pixmap icon_mask; /* icon mask bitmap */ XID window_group; /* id of related window group */ /* this structure may be extended in the future */ } WinXWMHints; /* Window manager hints mask bits */ #define InputHint (1L << 0) #define StateHint (1L << 1) #define IconPixmapHint (1L << 2) #define IconWindowHint (1L << 3) #define IconPositionHint (1L << 4) #define IconMaskHint (1L << 5) #define WindowGroupHint (1L << 6) #define UrgencyHint (1L << 8) #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint|IconPositionHint|IconMaskHint|WindowGroupHint) /* * ICCCM 1.0 version containing base_width, base_height, and win_gravity fields; * used with WM_NORMAL_HINTS. * * NOTE: this structure represents the internal format stored in the property * after it is marshalled by libX11, converting the flags field from an * arch-dependent long to a 32-bit int. */ typedef struct { int flags; /* marks which fields in this structure are defined */ int x, y; /* obsolete for new window mgrs, but clients */ int width, height; /* should set so old wm's don't mess up */ int min_width, min_height; int max_width, max_height; int width_inc, height_inc; struct { int x; /* numerator */ int y; /* denominator */ } min_aspect, max_aspect; int base_width, base_height; /* added by ICCCM version 1 */ int win_gravity; /* added by ICCCM version 1 */ } WinXSizeHints; /* flags argument in size hints */ #define USPosition (1L << 0) /* user specified x, y */ #define USSize (1L << 1) /* user specified width, height */ #define PPosition (1L << 2) /* program specified position */ #define PSize (1L << 3) /* program specified size */ #define PMinSize (1L << 4) /* program specified minimum size */ #define PMaxSize (1L << 5) /* program specified maximum size */ #define PResizeInc (1L << 6) /* program specified resize increments */ #define PAspect (1L << 7) /* program specified min and max aspect ratios */ #define PBaseSize (1L << 8) /* program specified base for incrementing */ #define PWinGravity (1L << 9) /* program specified window gravity */ /* obsolete */ #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) /* * Function prototypes */ int winMultiWindowGetWMHints(WindowPtr pWin, WinXWMHints * hints); int winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class); int winMultiWindowGetWindowRole(WindowPtr pWin, char **res_role); int winMultiWindowGetWMNormalHints(WindowPtr pWin, WinXSizeHints * hints); int winMultiWindowGetWMName(WindowPtr pWin, char **wmName); int winMultiWindowGetTransientFor(WindowPtr pWin, Window *ppDaddy); #endif xorg-server-1.20.8/hw/xwin/winmultiwindowwndproc.c0000644000175000017500000011305713640201473017261 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "dixevents.h" #include "winmultiwindowclass.h" #include "winprefs.h" #include "winmsg.h" #include "inputstr.h" extern void winUpdateWindowPosition(HWND hWnd, HWND * zstyle); /* * Local globals */ static UINT_PTR g_uipMousePollingTimerID = 0; /* * Constant defines */ #define WIN_MULTIWINDOW_SHAPE YES /* * ConstrainSize - Taken from TWM sources - Respects hints for sizing */ #define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) ) static void ConstrainSize(WinXSizeHints hints, int *widthp, int *heightp) { int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta; int baseWidth, baseHeight; int dwidth = *widthp, dheight = *heightp; if (hints.flags & PMinSize) { minWidth = hints.min_width; minHeight = hints.min_height; } else if (hints.flags & PBaseSize) { minWidth = hints.base_width; minHeight = hints.base_height; } else minWidth = minHeight = 1; if (hints.flags & PBaseSize) { baseWidth = hints.base_width; baseHeight = hints.base_height; } else if (hints.flags & PMinSize) { baseWidth = hints.min_width; baseHeight = hints.min_height; } else baseWidth = baseHeight = 0; if (hints.flags & PMaxSize) { maxWidth = hints.max_width; maxHeight = hints.max_height; } else { maxWidth = MAXINT; maxHeight = MAXINT; } if (hints.flags & PResizeInc) { xinc = hints.width_inc; yinc = hints.height_inc; } else xinc = yinc = 1; /* * First, clamp to min and max values */ if (dwidth < minWidth) dwidth = minWidth; if (dheight < minHeight) dheight = minHeight; if (dwidth > maxWidth) dwidth = maxWidth; if (dheight > maxHeight) dheight = maxHeight; /* * Second, fit to base + N * inc */ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth; dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight; /* * Third, adjust for aspect ratio */ /* * The math looks like this: * * minAspectX dwidth maxAspectX * ---------- <= ------- <= ---------- * minAspectY dheight maxAspectY * * If that is multiplied out, then the width and height are * invalid in the following situations: * * minAspectX * dheight > minAspectY * dwidth * maxAspectX * dheight < maxAspectY * dwidth * */ if (hints.flags & PAspect) { if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth) { delta = makemult(hints.min_aspect.x * dheight / hints.min_aspect.y - dwidth, xinc); if (dwidth + delta <= maxWidth) dwidth += delta; else { delta = makemult(dheight - dwidth * hints.min_aspect.y / hints.min_aspect.x, yinc); if (dheight - delta >= minHeight) dheight -= delta; } } if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth) { delta = makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x - dheight, yinc); if (dheight + delta <= maxHeight) dheight += delta; else { delta = makemult(dwidth - hints.max_aspect.x * dheight / hints.max_aspect.y, xinc); if (dwidth - delta >= minWidth) dwidth -= delta; } } } /* Return computed values */ *widthp = dwidth; *heightp = dheight; } #undef makemult /* * ValidateSizing - Ensures size request respects hints */ static int ValidateSizing(HWND hwnd, WindowPtr pWin, WPARAM wParam, LPARAM lParam) { WinXSizeHints sizeHints; RECT *rect; int iWidth, iHeight; RECT rcClient, rcWindow; int iBorderWidthX, iBorderWidthY; /* Invalid input checking */ if (pWin == NULL || lParam == 0) return FALSE; /* No size hints, no checking */ if (!winMultiWindowGetWMNormalHints(pWin, &sizeHints)) return FALSE; /* Avoid divide-by-zero */ if (sizeHints.flags & PResizeInc) { if (sizeHints.width_inc == 0) sizeHints.width_inc = 1; if (sizeHints.height_inc == 0) sizeHints.height_inc = 1; } rect = (RECT *) lParam; iWidth = rect->right - rect->left; iHeight = rect->bottom - rect->top; /* Now remove size of any borders and title bar */ GetClientRect(hwnd, &rcClient); GetWindowRect(hwnd, &rcWindow); iBorderWidthX = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left); iBorderWidthY = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top); iWidth -= iBorderWidthX; iHeight -= iBorderWidthY; /* Constrain the size to legal values */ ConstrainSize(sizeHints, &iWidth, &iHeight); /* Add back the size of borders and title bar */ iWidth += iBorderWidthX; iHeight += iBorderWidthY; /* Adjust size according to where we're dragging from */ switch (wParam) { case WMSZ_TOP: case WMSZ_TOPRIGHT: case WMSZ_BOTTOM: case WMSZ_BOTTOMRIGHT: case WMSZ_RIGHT: rect->right = rect->left + iWidth; break; default: rect->left = rect->right - iWidth; break; } switch (wParam) { case WMSZ_BOTTOM: case WMSZ_BOTTOMRIGHT: case WMSZ_BOTTOMLEFT: case WMSZ_RIGHT: case WMSZ_LEFT: rect->bottom = rect->top + iHeight; break; default: rect->top = rect->bottom - iHeight; break; } return TRUE; } extern Bool winInDestroyWindowsWindow; static Bool winInRaiseWindow = FALSE; static void winRaiseWindow(WindowPtr pWin) { if (!winInDestroyWindowsWindow && !winInRaiseWindow) { BOOL oldstate = winInRaiseWindow; XID vlist[1] = { 0 }; winInRaiseWindow = TRUE; /* Call configure window directly to make sure it gets processed * in time */ ConfigureWindow(pWin, CWStackMode, vlist, serverClient); winInRaiseWindow = oldstate; } } static void winStartMousePolling(winPrivScreenPtr s_pScreenPriv) { /* * Timer to poll mouse position. This is needed to make * programs like xeyes follow the mouse properly when the * mouse pointer is outside of any X window. */ if (g_uipMousePollingTimerID == 0) g_uipMousePollingTimerID = SetTimer(s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID, MOUSE_POLLING_INTERVAL, NULL); } /* * winTopLevelWindowProc - Window procedure for all top-level Windows windows. */ LRESULT CALLBACK winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { POINT ptMouse; HDC hdcUpdate; PAINTSTRUCT ps; WindowPtr pWin = NULL; winPrivWinPtr pWinPriv = NULL; ScreenPtr s_pScreen = NULL; winPrivScreenPtr s_pScreenPriv = NULL; winScreenInfo *s_pScreenInfo = NULL; HWND hwndScreen = NULL; DrawablePtr pDraw = NULL; winWMMessageRec wmMsg; Bool fWMMsgInitialized = FALSE; static Bool s_fTracking = FALSE; Bool needRestack = FALSE; LRESULT ret; static Bool hasEnteredSizeMove = FALSE; #if CYGDEBUG winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam); #endif /* Check if the Windows window property for our X window pointer is valid */ if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) { /* Our X window pointer is valid */ /* Get pointers to the drawable and the screen */ pDraw = &pWin->drawable; s_pScreen = pWin->drawable.pScreen; /* Get a pointer to our window privates */ pWinPriv = winGetWindowPriv(pWin); /* Get pointers to our screen privates and screen info */ s_pScreenPriv = pWinPriv->pScreenPriv; s_pScreenInfo = s_pScreenPriv->pScreenInfo; /* Get the handle for our screen-sized window */ hwndScreen = s_pScreenPriv->hwndScreen; /* */ wmMsg.msg = 0; wmMsg.hwndWindow = hwnd; wmMsg.iWindow = (Window) (INT_PTR) GetProp(hwnd, WIN_WID_PROP); wmMsg.iX = pDraw->x; wmMsg.iY = pDraw->y; wmMsg.iWidth = pDraw->width; wmMsg.iHeight = pDraw->height; fWMMsgInitialized = TRUE; #if 0 /* * Print some debugging information */ ErrorF("hWnd %08X\n", hwnd); ErrorF("pWin %08X\n", pWin); ErrorF("pDraw %08X\n", pDraw); ErrorF("\ttype %08X\n", pWin->drawable.type); ErrorF("\tclass %08X\n", pWin->drawable.class); ErrorF("\tdepth %08X\n", pWin->drawable.depth); ErrorF("\tbitsPerPixel %08X\n", pWin->drawable.bitsPerPixel); ErrorF("\tid %08X\n", pWin->drawable.id); ErrorF("\tx %08X\n", pWin->drawable.x); ErrorF("\ty %08X\n", pWin->drawable.y); ErrorF("\twidth %08X\n", pWin->drawable.width); ErrorF("\thenght %08X\n", pWin->drawable.height); ErrorF("\tpScreen %08X\n", pWin->drawable.pScreen); ErrorF("\tserialNumber %08X\n", pWin->drawable.serialNumber); ErrorF("g_iWindowPrivateKey %p\n", g_iWindowPrivateKey); ErrorF("pWinPriv %08X\n", pWinPriv); ErrorF("s_pScreenPriv %08X\n", s_pScreenPriv); ErrorF("s_pScreenInfo %08X\n", s_pScreenInfo); ErrorF("hwndScreen %08X\n", hwndScreen); #endif } /* Branch on message type */ switch (message) { case WM_CREATE: /* */ SetProp(hwnd, WIN_WINDOW_PROP, (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams); /* */ SetProp(hwnd, WIN_WID_PROP, (HANDLE) (INT_PTR) winGetWindowID(((LPCREATESTRUCT) lParam)-> lpCreateParams)); /* * Make X windows' Z orders sync with Windows windows because * there can be AlwaysOnTop windows overlapped on the window * currently being created. */ winReorderWindowsMultiWindow(); /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */ { RECT rWindow; HRGN hRgnWindow; GetWindowRect(hwnd, &rWindow); hRgnWindow = CreateRectRgnIndirect(&rWindow); SetWindowRgn(hwnd, hRgnWindow, TRUE); DeleteObject(hRgnWindow); } SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) XMING_SIGNATURE); return 0; case WM_INIT_SYS_MENU: /* * Add whatever the setup file wants to for this window */ SetupSysMenu(hwnd); return 0; case WM_SYSCOMMAND: /* * Any window menu items go through here */ if (HandleCustomWM_COMMAND(hwnd, LOWORD(wParam), s_pScreenPriv)) { /* Don't pass customized menus to DefWindowProc */ return 0; } if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE) { WINDOWPLACEMENT wndpl; wndpl.length = sizeof(wndpl); if (GetWindowPlacement(hwnd, &wndpl) && wndpl.showCmd == SW_SHOWMINIMIZED) needRestack = TRUE; } break; case WM_INITMENU: /* Checks/Unchecks any menu items before they are displayed */ HandleCustomWM_INITMENU(hwnd, (HMENU)wParam); break; case WM_ERASEBKGND: /* * Pretend that we did erase the background but we don't care, * since we repaint the entire region anyhow * This avoids some flickering when resizing. */ return TRUE; case WM_PAINT: /* Only paint if our window handle is valid */ if (hwndScreen == NULL) break; /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint(hwnd, &ps); /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */ if (ps.rcPaint.right == 0 && ps.rcPaint.bottom == 0 && ps.rcPaint.left == 0 && ps.rcPaint.top == 0) { EndPaint(hwnd, &ps); return 0; } #ifdef XWIN_GLX_WINDOWS if (pWinPriv->fWglUsed) { /* For regions which are being drawn by GL, the shadow framebuffer doesn't have the correct bits, so don't bitblt from the shadow framebuffer XXX: For now, just leave it alone, but ideally we want to send an expose event to the window so it really redraws the affected region... */ ValidateRect(hwnd, &(ps.rcPaint)); } else #endif /* Try to copy from the shadow buffer */ if (!BitBlt(hdcUpdate, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, s_pScreenPriv->hdcShadow, ps.rcPaint.left + pWin->drawable.x, ps.rcPaint.top + pWin->drawable.y, SRCCOPY)) { LPVOID lpMsgBuf; /* Display a fancy error message */ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); ErrorF("winTopLevelWindowProc - BitBlt failed: %s\n", (LPSTR) lpMsgBuf); LocalFree(lpMsgBuf); } /* EndPaint frees the DC */ EndPaint(hwnd, &ps); return 0; case WM_MOUSEMOVE: /* Unpack the client area mouse coordinates */ ptMouse.x = GET_X_LPARAM(lParam); ptMouse.y = GET_Y_LPARAM(lParam); /* Translate the client area mouse coordinates to screen coordinates */ ClientToScreen(hwnd, &ptMouse); /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */ ptMouse.x -= GetSystemMetrics(SM_XVIRTUALSCREEN); ptMouse.y -= GetSystemMetrics(SM_YVIRTUALSCREEN); /* We can't do anything without privates */ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Has the mouse pointer crossed screens? */ if (s_pScreen != miPointerGetScreen(g_pwinPointer)) miPointerSetScreen(g_pwinPointer, s_pScreenInfo->dwScreen, ptMouse.x - s_pScreenInfo->dwXOffset, ptMouse.y - s_pScreenInfo->dwYOffset); /* Are we tracking yet? */ if (!s_fTracking) { TRACKMOUSEEVENT tme; /* Setup data structure */ ZeroMemory(&tme, sizeof(tme)); tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = hwnd; /* Call the tracking function */ if (!TrackMouseEvent(&tme)) ErrorF("winTopLevelWindowProc - TrackMouseEvent failed\n"); /* Flag that we are tracking now */ s_fTracking = TRUE; } /* Hide or show the Windows mouse cursor */ if (g_fSoftwareCursor && g_fCursor) { /* Hide Windows cursor */ g_fCursor = FALSE; ShowCursor(FALSE); } /* Kill the timer used to poll mouse events */ if (g_uipMousePollingTimerID != 0) { KillTimer(s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID); g_uipMousePollingTimerID = 0; } /* Deliver absolute cursor position to X Server */ winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset, ptMouse.y - s_pScreenInfo->dwYOffset); return 0; case WM_NCMOUSEMOVE: /* * We break instead of returning 0 since we need to call * DefWindowProc to get the mouse cursor changes * and min/max/close button highlighting in Windows XP. * The Platform SDK says that you should return 0 if you * process this message, but it fails to mention that you * will give up any default functionality if you do return 0. */ /* We can't do anything without privates */ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; /* Non-client mouse movement, show Windows cursor */ if (g_fSoftwareCursor && !g_fCursor) { g_fCursor = TRUE; ShowCursor(TRUE); } winStartMousePolling(s_pScreenPriv); break; case WM_MOUSELEAVE: /* Mouse has left our client area */ /* Flag that we are no longer tracking */ s_fTracking = FALSE; /* Show the mouse cursor, if necessary */ if (g_fSoftwareCursor && !g_fCursor) { g_fCursor = TRUE; ShowCursor(TRUE); } winStartMousePolling(s_pScreenPriv); return 0; case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[0] = TRUE; SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[0] = FALSE; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[1] = TRUE; SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[1] = FALSE; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button2, wParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[2] = TRUE; SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; g_fButton[2] = FALSE; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button3, wParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; SetCapture(hwnd); return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 7, wParam); case WM_XBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); return winMouseButtonsHandle(s_pScreen, ButtonRelease, HIWORD(wParam) + 7, wParam); case WM_MOUSEWHEEL: if (SendMessage (hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT) { /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; } else break; case WM_MOUSEHWHEEL: if (SendMessage (hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT) { /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; } else break; case WM_SETFOCUS: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; { /* Get the parent window for transient handling */ HWND hParent = GetParent(hwnd); if (hParent && IsIconic(hParent)) ShowWindow(hParent, SW_RESTORE); } winRestoreModeKeyStates(); /* Add the keyboard hook if possible */ if (g_fKeyboardHookLL) g_fKeyboardHookLL = winInstallKeyboardHookLL(); return 0; case WM_KILLFOCUS: /* Pop any pressed keys since we are losing keyboard focus */ winKeybdReleaseKeys(); /* Remove our keyboard hook if it is installed */ winRemoveKeyboardHookLL(); /* Revert the X focus as well, but only if the Windows focus is going to another window */ if (!wParam && pWin) DeleteWindowFromAnyEvents(pWin, FALSE); return 0; case WM_SYSDEADCHAR: case WM_DEADCHAR: /* * NOTE: We do nothing with WM_*CHAR messages, * nor does the root window, so we can just toss these messages. */ return 0; case WM_SYSKEYDOWN: case WM_KEYDOWN: /* * Don't pass Alt-F4 key combo to root window, * let Windows translate to WM_CLOSE and close this top-level window. * * NOTE: We purposely don't check the fUseWinKillKey setting because * it should only apply to the key handling for the root window, * not for top-level window-manager windows. * * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window * because that is a key combo that no X app should be expecting to * receive, since it has historically been used to shutdown the X server. * Passing Ctrl-Alt-Backspace to the root window preserves that * behavior, assuming that -unixkill has been passed as a parameter. */ if (wParam == VK_F4 && (GetKeyState(VK_MENU) & 0x8000)) break; #if CYGWINDOWING_DEBUG if (wParam == VK_ESCAPE) { /* Place for debug: put any tests and dumps here */ WINDOWPLACEMENT windPlace; RECT rc; LPRECT pRect; windPlace.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hwnd, &windPlace); pRect = &windPlace.rcNormalPosition; ErrorF("\nCYGWINDOWING Dump:\n" "\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x, pDraw->y, pDraw->width, pDraw->height); ErrorF("\twindPlace: (%d, %d) - %dx%d\n", (int)pRect->left, (int)pRect->top, (int)(pRect->right - pRect->left), (int)(pRect->bottom - pRect->top)); if (GetClientRect(hwnd, &rc)) { pRect = &rc; ErrorF("\tClientRect: (%d, %d) - %dx%d\n", (int)pRect->left, (int)pRect->top, (int)(pRect->right - pRect->left), (int)(pRect->bottom - pRect->top)); } if (GetWindowRect(hwnd, &rc)) { pRect = &rc; ErrorF("\tWindowRect: (%d, %d) - %dx%d\n", (int)pRect->left, (int)pRect->top, (int)(pRect->right - pRect->left), (int)(pRect->bottom - pRect->top)); } ErrorF("\n"); } #endif /* Pass the message to the root window */ return winWindowProc(hwndScreen, message, wParam, lParam); case WM_SYSKEYUP: case WM_KEYUP: /* Pass the message to the root window */ return winWindowProc(hwndScreen, message, wParam, lParam); case WM_HOTKEY: /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; case WM_ACTIVATE: /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); if (LOWORD(wParam) != WA_INACTIVE) { /* Raise the window to the top in Z order */ /* ago: Activate does not mean putting it to front! */ /* wmMsg.msg = WM_WM_RAISE; if (fWMMsgInitialized) winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg); */ /* Tell our Window Manager thread to activate the window */ wmMsg.msg = WM_WM_ACTIVATE; if (fWMMsgInitialized) if (!pWin || !pWin->overrideRedirect) /* for OOo menus */ winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); } /* Prevent the mouse wheel from stalling when another window is minimized */ if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE && (HWND) lParam != NULL && (HWND) lParam != GetParent(hwnd)) SetFocus(hwnd); return 0; case WM_ACTIVATEAPP: /* * This message is also sent to the root window * so we do nothing for individual multiwindow windows */ break; case WM_CLOSE: /* Remove AppUserModelID property */ winSetAppUserModelID(hwnd, NULL); /* Branch on if the window was killed in X already */ if (pWinPriv->fXKilled) { /* Window was killed, go ahead and destroy the window */ DestroyWindow(hwnd); } else { /* Tell our Window Manager thread to kill the window */ wmMsg.msg = WM_WM_KILL; if (fWMMsgInitialized) winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); } return 0; case WM_DESTROY: /* Branch on if the window was killed in X already */ if (pWinPriv && !pWinPriv->fXKilled) { ErrorF("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n"); /* Tell our Window Manager thread to kill the window */ wmMsg.msg = WM_WM_KILL; if (fWMMsgInitialized) winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); } RemoveProp(hwnd, WIN_WINDOW_PROP); RemoveProp(hwnd, WIN_WID_PROP); RemoveProp(hwnd, WIN_NEEDMANAGE_PROP); break; case WM_MOVE: /* Adjust the X Window to the moved Windows window */ if (!hasEnteredSizeMove) winAdjustXWindow(pWin, hwnd); /* else: Wait for WM_EXITSIZEMOVE */ return 0; case WM_SHOWWINDOW: /* Bail out if the window is being hidden */ if (!wParam) return 0; /* */ if (!pWin->overrideRedirect) { HWND zstyle = HWND_NOTOPMOST; /* Flag that this window needs to be made active when clicked */ SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); /* Set the transient style flags */ if (GetParent(hwnd)) SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); /* Set the window standard style flags */ else SetWindowLongPtr(hwnd, GWL_STYLE, (WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) & ~WS_CAPTION & ~WS_SIZEBOX); winUpdateWindowPosition(hwnd, &zstyle); { WinXWMHints hints; if (winMultiWindowGetWMHints(pWin, &hints)) { /* Give the window focus, unless it has an InputHint which is FALSE (this is used by e.g. glean to avoid every test window grabbing the focus) */ if (!((hints.flags & InputHint) && (!hints.input))) { SetForegroundWindow(hwnd); } } } wmMsg.msg = WM_WM_MAP3; } else { /* It is an overridden window so make it top of Z stack */ HWND forHwnd = GetForegroundWindow(); #if CYGWINDOWING_DEBUG ErrorF("overridden window is shown\n"); #endif if (forHwnd != NULL) { if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR) XMING_SIGNATURE) { if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); else SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } } wmMsg.msg = WM_WM_MAP2; } /* Tell our Window Manager thread to map the window */ if (fWMMsgInitialized) winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); winStartMousePolling(s_pScreenPriv); return 0; case WM_SIZING: /* Need to legalize the size according to WM_NORMAL_HINTS */ /* for applications like xterm */ return ValidateSizing(hwnd, pWin, wParam, lParam); case WM_WINDOWPOSCHANGED: { LPWINDOWPOS pWinPos = (LPWINDOWPOS) lParam; if (!(pWinPos->flags & SWP_NOZORDER)) { #if CYGWINDOWING_DEBUG winDebug("\twindow z order was changed\n"); #endif if (pWinPos->hwndInsertAfter == HWND_TOP || pWinPos->hwndInsertAfter == HWND_TOPMOST || pWinPos->hwndInsertAfter == HWND_NOTOPMOST) { #if CYGWINDOWING_DEBUG winDebug("\traise to top\n"); #endif /* Raise the window to the top in Z order */ winRaiseWindow(pWin); } else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) { } else { /* Check if this window is top of X windows. */ HWND hWndAbove = NULL; DWORD dwCurrentProcessID = GetCurrentProcessId(); DWORD dwWindowProcessID = 0; for (hWndAbove = pWinPos->hwndInsertAfter; hWndAbove != NULL; hWndAbove = GetNextWindow(hWndAbove, GW_HWNDPREV)) { /* Ignore other XWin process's window */ GetWindowThreadProcessId(hWndAbove, &dwWindowProcessID); if ((dwWindowProcessID == dwCurrentProcessID) && GetProp(hWndAbove, WIN_WINDOW_PROP) && !IsWindowVisible(hWndAbove) && !IsIconic(hWndAbove)) /* ignore minimized windows */ break; } /* If this is top of X windows in Windows stack, raise it in X stack. */ if (hWndAbove == NULL) { #if CYGWINDOWING_DEBUG winDebug("\traise to top\n"); #endif winRaiseWindow(pWin); } } } } /* * Pass the message to DefWindowProc to let the function * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE. */ break; case WM_ENTERSIZEMOVE: hasEnteredSizeMove = TRUE; return 0; case WM_EXITSIZEMOVE: /* Adjust the X Window to the moved Windows window */ hasEnteredSizeMove = FALSE; winAdjustXWindow(pWin, hwnd); return 0; case WM_SIZE: /* see dix/window.c */ #if CYGWINDOWING_DEBUG { char buf[64]; switch (wParam) { case SIZE_MINIMIZED: strcpy(buf, "SIZE_MINIMIZED"); break; case SIZE_MAXIMIZED: strcpy(buf, "SIZE_MAXIMIZED"); break; case SIZE_RESTORED: strcpy(buf, "SIZE_RESTORED"); break; default: strcpy(buf, "UNKNOWN_FLAG"); } ErrorF("winTopLevelWindowProc - WM_SIZE to %dx%d (%s)\n", (int) LOWORD(lParam), (int) HIWORD(lParam), buf); } #endif if (!hasEnteredSizeMove) { /* Adjust the X Window to the moved Windows window */ winAdjustXWindow(pWin, hwnd); } /* else: wait for WM_EXITSIZEMOVE */ return 0; /* end of WM_SIZE handler */ case WM_STYLECHANGING: /* When the style changes, adjust the Windows window size so the client area remains the same size, and adjust the Windows window position so that the client area remains in the same place. */ { RECT newWinRect; DWORD dwExStyle; DWORD dwStyle; DWORD newStyle = ((STYLESTRUCT *) lParam)->styleNew; WINDOWINFO wi; dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE); dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); winDebug("winTopLevelWindowProc - WM_STYLECHANGING from %08x %08x\n", (unsigned int)dwStyle, (unsigned int)dwExStyle); if (wParam == GWL_EXSTYLE) dwExStyle = newStyle; if (wParam == GWL_STYLE) dwStyle = newStyle; winDebug("winTopLevelWindowProc - WM_STYLECHANGING to %08x %08x\n", (unsigned int)dwStyle, (unsigned int)dwExStyle); /* Get client rect in screen coordinates */ wi.cbSize = sizeof(WINDOWINFO); GetWindowInfo(hwnd, &wi); winDebug ("winTopLevelWindowProc - WM_STYLECHANGING client area {%d, %d, %d, %d}, {%d x %d}\n", (int)wi.rcClient.left, (int)wi.rcClient.top, (int)wi.rcClient.right, (int)wi.rcClient.bottom, (int)(wi.rcClient.right - wi.rcClient.left), (int)(wi.rcClient.bottom - wi.rcClient.top)); newWinRect = wi.rcClient; if (!AdjustWindowRectEx(&newWinRect, dwStyle, FALSE, dwExStyle)) winDebug ("winTopLevelWindowProc - WM_STYLECHANGING AdjustWindowRectEx failed\n"); winDebug ("winTopLevelWindowProc - WM_STYLECHANGING window area should be {%d, %d, %d, %d}, {%d x %d}\n", (int)newWinRect.left, (int)newWinRect.top, (int)newWinRect.right, (int)newWinRect.bottom, (int)(newWinRect.right - newWinRect.left), (int)(newWinRect.bottom - newWinRect.top)); /* Style change hasn't happened yet, so we can't adjust the window size yet, as the winAdjustXWindow() which WM_SIZE does will use the current (unchanged) style. Instead make a note to change it when WM_STYLECHANGED is received... */ pWinPriv->hDwp = BeginDeferWindowPos(1); pWinPriv->hDwp = DeferWindowPos(pWinPriv->hDwp, hwnd, NULL, newWinRect.left, newWinRect.top, newWinRect.right - newWinRect.left, newWinRect.bottom - newWinRect.top, SWP_NOACTIVATE | SWP_NOZORDER); } return 0; case WM_STYLECHANGED: { if (pWinPriv->hDwp) { EndDeferWindowPos(pWinPriv->hDwp); pWinPriv->hDwp = NULL; } winDebug("winTopLevelWindowProc - WM_STYLECHANGED done\n"); } return 0; case WM_MOUSEACTIVATE: /* Check if this window needs to be made active when clicked */ if (!GetProp(pWinPriv->hWnd, WIN_NEEDMANAGE_PROP)) { #if CYGMULTIWINDOW_DEBUG ErrorF("winTopLevelWindowProc - WM_MOUSEACTIVATE - " "MA_NOACTIVATE\n"); #endif /* */ return MA_NOACTIVATE; } break; case WM_SETCURSOR: if (LOWORD(lParam) == HTCLIENT) { if (!g_fSoftwareCursor) SetCursor(s_pScreenPriv->cursor.handle); return TRUE; } break; default: break; } ret = DefWindowProc(hwnd, message, wParam, lParam); /* * If the window was minized we get the stack change before the window is restored * and so it gets lost. Ensure there stacking order is correct. */ if (needRestack) winReorderWindowsMultiWindow(); return ret; } xorg-server-1.20.8/hw/xwin/wincursor.c0000644000175000017500000004633413640201473014622 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" #include #include #include #include "misc.h" #define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114) #if 0 #define WIN_DEBUG_MSG winDebug #else #define WIN_DEBUG_MSG(...) #endif /* * Local function prototypes */ static void winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static Bool winCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y); static void winCrossScreen(ScreenPtr pScreen, Bool fEntering); miPointerScreenFuncRec g_winPointerCursorFuncs = { winCursorOffScreen, winCrossScreen, winPointerWarpCursor }; static void winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { winScreenPriv(pScreen); RECT rcClient; static Bool s_fInitialWarp = TRUE; /* Discard first warp call */ if (s_fInitialWarp) { /* First warp moves mouse to center of window, just ignore it */ /* Don't ignore subsequent warps */ s_fInitialWarp = FALSE; winErrorFVerb(2, "winPointerWarpCursor - Discarding first warp: %d %d\n", x, y); return; } /* Only update the Windows cursor position if root window is active, or we are in a rootless mode */ if ((pScreenPriv->hwndScreen == GetForegroundWindow()) || pScreenPriv->pScreenInfo->fRootless || pScreenPriv->pScreenInfo->fMultiWindow ) { /* Get the client area coordinates */ GetClientRect(pScreenPriv->hwndScreen, &rcClient); /* Translate the client area coords to screen coords */ MapWindowPoints(pScreenPriv->hwndScreen, HWND_DESKTOP, (LPPOINT) &rcClient, 2); /* * Update the Windows cursor position so that we don't * immediately warp back to the current position. */ SetCursorPos(rcClient.left + x, rcClient.top + y); } /* Call the mi warp procedure to do the actual warping in X. */ miPointerWarpCursor(pDev, pScreen, x, y); } static Bool winCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) { return FALSE; } static void winCrossScreen(ScreenPtr pScreen, Bool fEntering) { } static unsigned char reverse(unsigned char c) { int i; unsigned char ret = 0; for (i = 0; i < 8; ++i) { ret |= ((c >> i) & 1) << (7 - i); } return ret; } /* * Convert X cursor to Windows cursor * FIXME: Perhaps there are more smart code */ static HCURSOR winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) { winScreenPriv(pScreen); HCURSOR hCursor = NULL; unsigned char *pAnd; unsigned char *pXor; int nCX, nCY; int nBytes; double dForeY, dBackY; BOOL fReverse; HBITMAP hAnd, hXor; ICONINFO ii; unsigned char *pCur; unsigned char bit; HDC hDC; BITMAPV4HEADER bi; BITMAPINFO *pbmi; uint32_t *lpBits; WIN_DEBUG_MSG("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n", pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, pCursor->bits->width, pCursor->bits->height, pCursor->bits->xhot, pCursor->bits->yhot); /* We can use only White and Black, so calc brightness of color * Also check if the cursor is inverted */ dForeY = BRIGHTNESS(pCursor->fore); dBackY = BRIGHTNESS(pCursor->back); fReverse = dForeY < dBackY; /* Check wether the X11 cursor is bigger than the win32 cursor */ if (pScreenPriv->cursor.sm_cx < pCursor->bits->width || pScreenPriv->cursor.sm_cy < pCursor->bits->height) { winErrorFVerb(3, "winLoadCursor - Windows requires %dx%d cursor but X requires %dx%d\n", pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, pCursor->bits->width, pCursor->bits->height); } /* Get the number of bytes required to store the whole cursor image * This is roughly (sm_cx * sm_cy) / 8 * round up to 8 pixel boundary so we can convert whole bytes */ nBytes = bits_to_bytes(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy; /* Get the effective width and height */ nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width); nCY = min(pScreenPriv->cursor.sm_cy, pCursor->bits->height); /* Allocate memory for the bitmaps */ pAnd = malloc(nBytes); memset(pAnd, 0xFF, nBytes); pXor = calloc(1, nBytes); /* Convert the X11 bitmap to a win32 bitmap * The first is for an empty mask */ if (pCursor->bits->emptyMask) { int x, y, xmax = bits_to_bytes(nCX); for (y = 0; y < nCY; ++y) for (x = 0; x < xmax; ++x) { int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x; int nXPix = BitmapBytePad(pCursor->bits->width) * y + x; pAnd[nWinPix] = 0; if (fReverse) pXor[nWinPix] = reverse(~pCursor->bits->source[nXPix]); else pXor[nWinPix] = reverse(pCursor->bits->source[nXPix]); } } else { int x, y, xmax = bits_to_bytes(nCX); for (y = 0; y < nCY; ++y) for (x = 0; x < xmax; ++x) { int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x; int nXPix = BitmapBytePad(pCursor->bits->width) * y + x; unsigned char mask = pCursor->bits->mask[nXPix]; pAnd[nWinPix] = reverse(~mask); if (fReverse) pXor[nWinPix] = reverse(~pCursor->bits->source[nXPix] & mask); else pXor[nWinPix] = reverse(pCursor->bits->source[nXPix] & mask); } } /* prepare the pointers */ hCursor = NULL; lpBits = NULL; /* We have a truecolor alpha-blended cursor and can use it! */ if (pCursor->bits->argb) { WIN_DEBUG_MSG("winLoadCursor: Trying truecolor alphablended cursor\n"); memset(&bi, 0, sizeof(BITMAPV4HEADER)); bi.bV4Size = sizeof(BITMAPV4HEADER); bi.bV4Width = pScreenPriv->cursor.sm_cx; bi.bV4Height = -(pScreenPriv->cursor.sm_cy); /* right-side up */ bi.bV4Planes = 1; bi.bV4BitCount = 32; bi.bV4V4Compression = BI_BITFIELDS; bi.bV4RedMask = 0x00FF0000; bi.bV4GreenMask = 0x0000FF00; bi.bV4BlueMask = 0x000000FF; bi.bV4AlphaMask = 0xFF000000; lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, sizeof(uint32_t)); if (lpBits) { int y; for (y = 0; y < nCY; y++) { void *src, *dst; src = &(pCursor->bits->argb[y * pCursor->bits->width]); dst = &(lpBits[y * pScreenPriv->cursor.sm_cx]); memcpy(dst, src, 4 * nCX); } } } /* End if-truecolor-icon */ if (!lpBits) { RGBQUAD *pbmiColors; /* Bicolor, use a palettized DIB */ WIN_DEBUG_MSG("winLoadCursor: Trying two color cursor\n"); pbmi = (BITMAPINFO *) &bi; pbmiColors = &(pbmi->bmiColors[0]); memset(pbmi, 0, sizeof(BITMAPINFOHEADER)); pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx; pbmi->bmiHeader.biHeight = -abs(pScreenPriv->cursor.sm_cy); /* right-side up */ pbmi->bmiHeader.biPlanes = 1; pbmi->bmiHeader.biBitCount = 8; pbmi->bmiHeader.biCompression = BI_RGB; pbmi->bmiHeader.biSizeImage = 0; pbmi->bmiHeader.biClrUsed = 3; pbmi->bmiHeader.biClrImportant = 3; pbmiColors[0].rgbRed = 0; /* Empty */ pbmiColors[0].rgbGreen = 0; pbmiColors[0].rgbBlue = 0; pbmiColors[0].rgbReserved = 0; pbmiColors[1].rgbRed = pCursor->backRed >> 8; /* Background */ pbmiColors[1].rgbGreen = pCursor->backGreen >> 8; pbmiColors[1].rgbBlue = pCursor->backBlue >> 8; pbmiColors[1].rgbReserved = 0; pbmiColors[2].rgbRed = pCursor->foreRed >> 8; /* Foreground */ pbmiColors[2].rgbGreen = pCursor->foreGreen >> 8; pbmiColors[2].rgbBlue = pCursor->foreBlue >> 8; pbmiColors[2].rgbReserved = 0; lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, 1); pCur = (unsigned char *) lpBits; if (lpBits) { int x, y; for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) { for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) { if (x >= nCX || y >= nCY) /* Outside of X11 icon bounds */ (*pCur++) = 0; else { /* Within X11 icon bounds */ int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + (x / 8); bit = pAnd[nWinPix]; bit = bit & (1 << (7 - (x & 7))); if (!bit) { /* Within the cursor mask? */ int nXPix = BitmapBytePad(pCursor->bits->width) * y + (x / 8); bit = ~reverse(~pCursor->bits-> source[nXPix] & pCursor->bits-> mask[nXPix]); bit = bit & (1 << (7 - (x & 7))); if (bit) /* Draw foreground */ (*pCur++) = 2; else /* Draw background */ (*pCur++) = 1; } else /* Outside the cursor mask */ (*pCur++) = 0; } } /* end for (x) */ } /* end for (y) */ } /* end if (lpbits) */ } /* If one of the previous two methods gave us the bitmap we need, make a cursor */ if (lpBits) { WIN_DEBUG_MSG("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n", pCursor->bits->xhot, pCursor->bits->yhot); hAnd = NULL; hXor = NULL; hAnd = CreateBitmap(pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, 1, 1, pAnd); hDC = GetDC(NULL); if (hDC) { hXor = CreateCompatibleBitmap(hDC, pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy); SetDIBits(hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits, (BITMAPINFO *) &bi, DIB_RGB_COLORS); ReleaseDC(NULL, hDC); } free(lpBits); if (hAnd && hXor) { ii.fIcon = FALSE; ii.xHotspot = pCursor->bits->xhot; ii.yHotspot = pCursor->bits->yhot; ii.hbmMask = hAnd; ii.hbmColor = hXor; hCursor = (HCURSOR) CreateIconIndirect(&ii); if (hCursor == NULL) winW32Error(2, "winLoadCursor - CreateIconIndirect failed:"); else { if (GetIconInfo(hCursor, &ii)) { if (ii.fIcon) { WIN_DEBUG_MSG ("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n"); DestroyCursor(hCursor); ii.fIcon = FALSE; ii.xHotspot = pCursor->bits->xhot; ii.yHotspot = pCursor->bits->yhot; hCursor = (HCURSOR) CreateIconIndirect(&ii); if (hCursor == NULL) winW32Error(2, "winLoadCursor - CreateIconIndirect failed:"); } /* GetIconInfo creates new bitmaps. Destroy them again */ if (ii.hbmMask) DeleteObject(ii.hbmMask); if (ii.hbmColor) DeleteObject(ii.hbmColor); } } } if (hAnd) DeleteObject(hAnd); if (hXor) DeleteObject(hXor); } if (!hCursor) { /* We couldn't make a color cursor for this screen, use black and white instead */ hCursor = CreateCursor(g_hInstance, pCursor->bits->xhot, pCursor->bits->yhot, pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, pAnd, pXor); if (hCursor == NULL) winW32Error(2, "winLoadCursor - CreateCursor failed:"); } free(pAnd); free(pXor); return hCursor; } /* =========================================================================== Pointer sprite functions =========================================================================== */ /* * winRealizeCursor * Convert the X cursor representation to native format if possible. */ static Bool winRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { if (pCursor == NULL || pCursor->bits == NULL) return FALSE; /* FIXME: cache ARGB8888 representation? */ return TRUE; } /* * winUnrealizeCursor * Free the storage space associated with a realized cursor. */ static Bool winUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } /* * winSetCursor * Set the cursor sprite and position. */ static void winSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { POINT ptCurPos, ptTemp; HWND hwnd; RECT rcClient; BOOL bInhibit; winScreenPriv(pScreen); WIN_DEBUG_MSG("winSetCursor: cursor=%p\n", pCursor); /* Inhibit changing the cursor if the mouse is not in a client area */ bInhibit = FALSE; if (GetCursorPos(&ptCurPos)) { hwnd = WindowFromPoint(ptCurPos); if (hwnd) { if (GetClientRect(hwnd, &rcClient)) { ptTemp.x = rcClient.left; ptTemp.y = rcClient.top; if (ClientToScreen(hwnd, &ptTemp)) { rcClient.left = ptTemp.x; rcClient.top = ptTemp.y; ptTemp.x = rcClient.right; ptTemp.y = rcClient.bottom; if (ClientToScreen(hwnd, &ptTemp)) { rcClient.right = ptTemp.x; rcClient.bottom = ptTemp.y; if (!PtInRect(&rcClient, ptCurPos)) bInhibit = TRUE; } } } } } if (pCursor == NULL) { if (pScreenPriv->cursor.visible) { if (!bInhibit && g_fSoftwareCursor) ShowCursor(FALSE); pScreenPriv->cursor.visible = FALSE; } } else { if (pScreenPriv->cursor.handle) { if (!bInhibit) SetCursor(NULL); DestroyCursor(pScreenPriv->cursor.handle); pScreenPriv->cursor.handle = NULL; } pScreenPriv->cursor.handle = winLoadCursor(pScreen, pCursor, pScreen->myNum); WIN_DEBUG_MSG("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle); if (!bInhibit) SetCursor(pScreenPriv->cursor.handle); if (!pScreenPriv->cursor.visible) { if (!bInhibit && g_fSoftwareCursor) ShowCursor(TRUE); pScreenPriv->cursor.visible = TRUE; } } } /* * winMoveCursor * Move the cursor. This is a noop for us. */ static void winMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { } static Bool winDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr) { winScreenPriv(pScr); return pScreenPriv->cursor.spriteFuncs->DeviceCursorInitialize(pDev, pScr); } static void winDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr) { winScreenPriv(pScr); pScreenPriv->cursor.spriteFuncs->DeviceCursorCleanup(pDev, pScr); } static miPointerSpriteFuncRec winSpriteFuncsRec = { winRealizeCursor, winUnrealizeCursor, winSetCursor, winMoveCursor, winDeviceCursorInitialize, winDeviceCursorCleanup }; /* =========================================================================== Other screen functions =========================================================================== */ /* * winCursorQueryBestSize * Handle queries for best cursor size */ static void winCursorQueryBestSize(int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen) { winScreenPriv(pScreen); if (class == CursorShape) { *width = pScreenPriv->cursor.sm_cx; *height = pScreenPriv->cursor.sm_cy; } else { if (pScreenPriv->cursor.QueryBestSize) (*pScreenPriv->cursor.QueryBestSize) (class, width, height, pScreen); } } /* * winInitCursor * Initialize cursor support */ Bool winInitCursor(ScreenPtr pScreen) { winScreenPriv(pScreen); miPointerScreenPtr pPointPriv; /* override some screen procedures */ pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize; pScreen->QueryBestSize = winCursorQueryBestSize; pPointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs; pPointPriv->spriteFuncs = &winSpriteFuncsRec; pScreenPriv->cursor.handle = NULL; pScreenPriv->cursor.visible = FALSE; pScreenPriv->cursor.sm_cx = GetSystemMetrics(SM_CXCURSOR); pScreenPriv->cursor.sm_cy = GetSystemMetrics(SM_CYCURSOR); return TRUE; } xorg-server-1.20.8/hw/xwin/winmultiwindowicons.h0000644000175000017500000000304113640201473016714 00000000000000/* * File: winmultiwindowicons.h * Purpose: interface for multiwindow mode icon functions * * Copyright (c) Jon TURNEY 2012 * * * 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 ABOVE LISTED COPYRIGHT HOLDER(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. */ #ifndef WINMULTIWINDOWICONS_H #define WINMULTIWINDOWICONS_H #include void winUpdateIcon(HWND hWnd, xcb_connection_t *conn, Window id, HICON hIconNew); void winInitGlobalIcons(void); void winDestroyIcon(HICON hIcon); void winSelectIcons(HICON * pIcon, HICON * pSmallIcon); #endif /* WINMULTIWINDOWICONS_H */ xorg-server-1.20.8/hw/xwin/winglobals.c0000644000175000017500000000610413640201473014717 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * General global variables */ int g_iNumScreens = 0; winScreenInfo *g_ScreenInfo = 0; #ifdef HAS_DEVWINDOWS int g_fdMessageQueue = WIN_FD_INVALID; #endif DevPrivateKeyRec g_iScreenPrivateKeyRec; DevPrivateKeyRec g_iCmapPrivateKeyRec; DevPrivateKeyRec g_iGCPrivateKeyRec; DevPrivateKeyRec g_iPixmapPrivateKeyRec; DevPrivateKeyRec g_iWindowPrivateKeyRec; unsigned long g_ulServerGeneration = 0; DWORD g_dwEnginesSupported = 0; HINSTANCE g_hInstance = 0; HWND g_hDlgDepthChange = NULL; HWND g_hDlgExit = NULL; HWND g_hDlgAbout = NULL; const char *g_pszQueryHost = NULL; Bool g_fXdmcpEnabled = FALSE; Bool g_fAuthEnabled = FALSE; HICON g_hIconX = NULL; HICON g_hSmallIconX = NULL; #ifndef RELOCATE_PROJECTROOT const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log"; #else const char *g_pszLogFile = "XWin.log"; Bool g_fLogFileChanged = FALSE; #endif int g_iLogVerbose = 2; Bool g_fLogInited = FALSE; char *g_pszCommandLine = NULL; Bool g_fSilentFatalError = FALSE; DWORD g_dwCurrentThreadID = 0; Bool g_fKeyboardHookLL = FALSE; Bool g_fNoHelpMessageBox = FALSE; Bool g_fSoftwareCursor = FALSE; Bool g_fNativeGl = TRUE; Bool g_fHostInTitle = TRUE; pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER; /* * Wrapped DIX functions */ winDispatchProcPtr winProcEstablishConnectionOrig = NULL; /* * Clipboard variables */ Bool g_fUnicodeClipboard = TRUE; Bool g_fClipboard = TRUE; Bool g_fClipboardStarted = FALSE; /* * Re-initialize global variables that are invalidated * by a server reset. */ void winInitializeGlobals(void) { g_dwCurrentThreadID = GetCurrentThreadId(); } xorg-server-1.20.8/hw/xwin/winwakeup.c0000644000175000017500000000400413640201473014565 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* See Porting Layer Definition - p. 7 */ void winWakeupHandler(ScreenPtr pScreen, int iResult) { MSG msg; /* Process one message from our queue */ if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if ((g_hDlgDepthChange == 0 || !IsDialogMessage(g_hDlgDepthChange, &msg)) && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg)) && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) { DispatchMessage(&msg); } } } xorg-server-1.20.8/hw/xwin/winmultiwindowclass.c0000644000175000017500000001741413640201473016712 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Earle F. Philhower, III */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include "propertyst.h" #include "windowstr.h" #include "winmultiwindowclass.h" #include "win.h" /* * Local function */ DEFINE_ATOM_HELPER(AtmWmWindowRole, "WM_WINDOW_ROLE") int winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class) { struct _Window *pwin; struct _Property *prop; int len_name, len_class; if (!pWin || !res_name || !res_class) { ErrorF("winMultiWindowGetClassHint - pWin, res_name, or res_class was " "NULL\n"); return 0; } pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; *res_name = *res_class = NULL; while (prop) { if (prop->propertyName == XA_WM_CLASS && prop->type == XA_STRING && prop->format == 8 && prop->data) { /* WM_CLASS property should consist of 2 null terminated strings, but we must handle the cases when one or both is absent or not null terminated */ len_name = strlen((char *) prop->data); if (len_name > prop->size) len_name = prop->size; (*res_name) = malloc(len_name + 1); if (!*res_name) { ErrorF("winMultiWindowGetClassHint - *res_name was NULL\n"); return 0; } /* Copy name and ensure null terminated */ strncpy((*res_name), prop->data, len_name); (*res_name)[len_name] = '\0'; /* Compute length of class name, it could be that it is absent or not null terminated */ len_class = (len_name >= prop->size) ? 0 : (strlen(((char *) prop->data) + 1 + len_name)); if (len_class > prop->size - 1 - len_name) len_class = prop->size - 1 - len_name; (*res_class) = malloc(len_class + 1); if (!*res_class) { ErrorF("winMultiWindowGetClassHint - *res_class was NULL\n"); /* Free the previously allocated res_name */ free(*res_name); return 0; } /* Copy class name and ensure null terminated */ strncpy((*res_class), ((char *) prop->data) + 1 + len_name, len_class); (*res_class)[len_class] = '\0'; return 1; } else prop = prop->next; } return 0; } int winMultiWindowGetWMHints(WindowPtr pWin, WinXWMHints * hints) { struct _Window *pwin; struct _Property *prop; if (!pWin || !hints) { ErrorF("winMultiWindowGetWMHints - pWin or hints was NULL\n"); return 0; } pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; memset(hints, 0, sizeof(WinXWMHints)); while (prop) { if (prop->propertyName == XA_WM_HINTS && prop->data) { memcpy(hints, prop->data, sizeof(WinXWMHints)); return 1; } else prop = prop->next; } return 0; } int winMultiWindowGetWindowRole(WindowPtr pWin, char **res_role) { struct _Window *pwin; struct _Property *prop; int len_role; if (!pWin || !res_role) return 0; pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; *res_role = NULL; while (prop) { if (prop->propertyName == AtmWmWindowRole() && prop->type == XA_STRING && prop->format == 8 && prop->data) { len_role = prop->size; (*res_role) = malloc(len_role + 1); if (!*res_role) { ErrorF("winMultiWindowGetWindowRole - *res_role was NULL\n"); return 0; } strncpy((*res_role), prop->data, len_role); (*res_role)[len_role] = 0; return 1; } else prop = prop->next; } return 0; } int winMultiWindowGetWMNormalHints(WindowPtr pWin, WinXSizeHints * hints) { struct _Window *pwin; struct _Property *prop; if (!pWin || !hints) { ErrorF("winMultiWindowGetWMNormalHints - pWin or hints was NULL\n"); return 0; } pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; memset(hints, 0, sizeof(WinXSizeHints)); while (prop) { if (prop->propertyName == XA_WM_NORMAL_HINTS && prop->data) { memcpy(hints, prop->data, sizeof(WinXSizeHints)); return 1; } else prop = prop->next; } return 0; } int winMultiWindowGetTransientFor(WindowPtr pWin, Window *pDaddyId) { struct _Window *pwin; struct _Property *prop; if (!pWin) { ErrorF("winMultiWindowGetTransientFor - pWin was NULL\n"); return 0; } pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; if (pDaddyId) *pDaddyId = 0; while (prop) { if (prop->propertyName == XA_WM_TRANSIENT_FOR) { if (pDaddyId) memcpy(pDaddyId, prop->data, sizeof(Window)); return 1; } else prop = prop->next; } return 0; } int winMultiWindowGetWMName(WindowPtr pWin, char **wmName) { struct _Window *pwin; struct _Property *prop; int len_name; if (!pWin || !wmName) { ErrorF("winMultiWindowGetClassHint - pWin, res_name, or res_class was " "NULL\n"); return 0; } pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; *wmName = NULL; while (prop) { if (prop->propertyName == XA_WM_NAME && prop->type == XA_STRING && prop->data) { len_name = prop->size; (*wmName) = malloc(len_name + 1); if (!*wmName) { ErrorF("winMultiWindowGetWMName - *wmName was NULL\n"); return 0; } strncpy((*wmName), prop->data, len_name); (*wmName)[len_name] = 0; return 1; } else prop = prop->next; } return 0; } xorg-server-1.20.8/hw/xwin/winprefsyacc.y0000644000175000017500000002474213640201473015311 00000000000000%{ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * Copyright (C) Colin Harrison 2005-2008 * * 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. * * Authors: Earle F. Philhower, III * Colin Harrison */ /* $XFree86: $ */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include #define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */ #include #include "winprefs.h" /* The following give better error messages in bison at the cost of a few KB */ #define YYERROR_VERBOSE 1 /* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ #define YYLTYPE_IS_TRIVIAL 1 #define YYENABLE_NLS 0 /* The global pref settings */ WINPREFS pref; /* The working menu */ static MENUPARSED menu; /* Functions for parsing the tokens into out structure */ /* Defined at the end section of this file */ static void SetIconDirectory (char *path); static void SetDefaultIcon (char *fname); static void SetRootMenu (char *menu); static void SetDefaultSysMenu (char *menu, int pos); static void SetTrayIcon (char *fname); static void OpenMenu(char *menuname); static void AddMenuLine(const char *name, MENUCOMMANDTYPE cmd, const char *param); static void CloseMenu(void); static void OpenIcons(void); static void AddIconLine(char *matchstr, char *iconfile); static void CloseIcons(void); static void OpenStyles(void); static void AddStyleLine(char *matchstr, unsigned long style); static void CloseStyles(void); static void OpenSysMenu(void); static void AddSysMenuLine(char *matchstr, char *menuname, int pos); static void CloseSysMenu(void); static int yyerror (const char *s); extern char *yytext; extern int yylineno; extern int yylex(void); %} %union { char *sVal; unsigned long uVal; int iVal; } %token NEWLINE %token MENU %token LB %token RB %token ICONDIRECTORY %token DEFAULTICON %token ICONS %token STYLES %token TOPMOST %token MAXIMIZE %token MINIMIZE %token BOTTOM %token NOTITLE %token OUTLINE %token NOFRAME %token DEFAULTSYSMENU %token SYSMENU %token ROOTMENU %token SEPARATOR %token ATSTART %token ATEND %token EXEC %token ALWAYSONTOP %token DEBUGOUTPUT "DEBUG" %token RELOAD %token TRAYICON %token FORCEEXIT %token SILENTEXIT %token STRING %type group1 %type group2 %type stylecombo %type atspot %% input: /* empty */ | input line ; line: NEWLINE | command ; newline_or_nada: | NEWLINE newline_or_nada ; command: defaulticon | icondirectory | menu | icons | styles | sysmenu | rootmenu | defaultsysmenu | debug | trayicon | forceexit | silentexit ; trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); } ; rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); } ; defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); } ; defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); } ; icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); } ; menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); } | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); } | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); } | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); } | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); } ; menulist: menuline | menuline menulist ; menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();} ; iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); } ; iconlist: iconline | iconline iconlist ; icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();} ; group1: TOPMOST { $$=STYLE_TOPMOST; } | MAXIMIZE { $$=STYLE_MAXIMIZE; } | MINIMIZE { $$=STYLE_MINIMIZE; } | BOTTOM { $$=STYLE_BOTTOM; } ; group2: NOTITLE { $$=STYLE_NOTITLE; } | OUTLINE { $$=STYLE_OUTLINE; } | NOFRAME { $$=STYLE_NOFRAME; } ; stylecombo: group1 { $$=$1; } | group2 { $$=$1; } | group1 group2 { $$=$1|$2; } | group2 group1 { $$=$1|$2; } ; styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); } ; stylelist: styleline | styleline stylelist ; styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();} ; atspot: { $$=AT_END; } | ATSTART { $$=AT_START; } | ATEND { $$=AT_END; } ; sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); } ; sysmenulist: sysmenuline | sysmenuline sysmenulist ; sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();} ; forceexit: FORCEEXIT NEWLINE { pref.fForceExit = TRUE; } ; silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; } ; debug: DEBUGOUTPUT STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); } ; %% /* * Errors in parsing abort and print log messages */ static int yyerror (const char *s) { ErrorF("LoadPreferences: %s line %d\n", s, yylineno); return 1; } /* Miscellaneous functions to store TOKENs into the structure */ static void SetIconDirectory (char *path) { strncpy (pref.iconDirectory, path, PATH_MAX); pref.iconDirectory[PATH_MAX] = 0; } static void SetDefaultIcon (char *fname) { strncpy (pref.defaultIconName, fname, NAME_MAX); pref.defaultIconName[NAME_MAX] = 0; } static void SetTrayIcon (char *fname) { strncpy (pref.trayIconName, fname, NAME_MAX); pref.trayIconName[NAME_MAX] = 0; } static void SetRootMenu (char *menuname) { strncpy (pref.rootMenuName, menuname, MENU_MAX); pref.rootMenuName[MENU_MAX] = 0; } static void SetDefaultSysMenu (char *menuname, int pos) { strncpy (pref.defaultSysMenuName, menuname, MENU_MAX); pref.defaultSysMenuName[MENU_MAX] = 0; pref.defaultSysMenuPos = pos; } static void OpenMenu (char *menuname) { if (menu.menuItem) free(menu.menuItem); menu.menuItem = NULL; strncpy(menu.menuName, menuname, MENU_MAX); menu.menuName[MENU_MAX] = 0; menu.menuItems = 0; } static void AddMenuLine (const char *text, MENUCOMMANDTYPE cmd, const char *param) { if (menu.menuItem==NULL) menu.menuItem = malloc(sizeof(MENUITEM)); else menu.menuItem = realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX); menu.menuItem[menu.menuItems].text[MENU_MAX] = 0; menu.menuItem[menu.menuItems].cmd = cmd; strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX); menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0; menu.menuItem[menu.menuItems].commandID = 0; menu.menuItems++; } static void CloseMenu (void) { if (menu.menuItem==NULL || menu.menuItems==0) { ErrorF("LoadPreferences: Empty menu detected\n"); return; } if (pref.menuItems) pref.menu = realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); else pref.menu = malloc (sizeof(MENUPARSED)); memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED)); pref.menuItems++; memset (&menu, 0, sizeof(MENUPARSED)); } static void OpenIcons (void) { if (pref.icon != NULL) { ErrorF("LoadPreferences: Redefining icon mappings\n"); free(pref.icon); pref.icon = NULL; } pref.iconItems = 0; } static void AddIconLine (char *matchstr, char *iconfile) { if (pref.icon==NULL) pref.icon = malloc(sizeof(ICONITEM)); else pref.icon = realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX); pref.icon[pref.iconItems].match[MENU_MAX] = 0; strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1); pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0; pref.icon[pref.iconItems].hicon = 0; pref.iconItems++; } static void CloseIcons (void) { } static void OpenStyles (void) { if (pref.style != NULL) { ErrorF("LoadPreferences: Redefining window style\n"); free(pref.style); pref.style = NULL; } pref.styleItems = 0; } static void AddStyleLine (char *matchstr, unsigned long style) { if (pref.style==NULL) pref.style = malloc(sizeof(STYLEITEM)); else pref.style = realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); pref.style[pref.styleItems].match[MENU_MAX] = 0; pref.style[pref.styleItems].type = style; pref.styleItems++; } static void CloseStyles (void) { } static void OpenSysMenu (void) { if (pref.sysMenu != NULL) { ErrorF("LoadPreferences: Redefining system menu\n"); free(pref.sysMenu); pref.sysMenu = NULL; } pref.sysMenuItems = 0; } static void AddSysMenuLine (char *matchstr, char *menuname, int pos) { if (pref.sysMenu==NULL) pref.sysMenu = malloc(sizeof(SYSMENUITEM)); else pref.sysMenu = realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX); pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0; strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX); pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0; pref.sysMenu[pref.sysMenuItems].menuPos = pos; pref.sysMenuItems++; } static void CloseSysMenu (void) { } xorg-server-1.20.8/hw/xwin/winmessages.h0000644000175000017500000003212013640201473015105 00000000000000#ifndef __WINMESSAGES_H__ #define __WINMESSAGES_H__ static const unsigned MESSAGE_NAMES_LEN = 1024; static const char *MESSAGE_NAMES[1024] = { "WM_NULL", "WM_CREATE", "WM_DESTROY", "WM_MOVE", "4", "WM_SIZE", "WM_ACTIVATE", "WM_SETFOCUS", "WM_KILLFOCUS", "9", "WM_ENABLE", "WM_SETREDRAW", "WM_SETTEXT", "WM_GETTEXT", "WM_GETTEXTLENGTH", "WM_PAINT", "WM_CLOSE", "WM_QUERYENDSESSION", "WM_QUIT", "WM_QUERYOPEN", "WM_ERASEBKGND", "WM_SYSCOLORCHANGE", "WM_ENDSESSION", "23", "WM_SHOWWINDOW", "25", "WM_WININICHANGE", "WM_DEVMODECHANGE", "WM_ACTIVATEAPP", "WM_FONTCHANGE", "WM_TIMECHANGE", "WM_CANCELMODE", NULL /* WM_SETCURSOR */ , "WM_MOUSEACTIVATE", "WM_CHILDACTIVATE", "WM_QUEUESYNC", "WM_GETMINMAXINFO", "37", "WM_PAINTICON", "WM_ICONERASEBKGND", "WM_NEXTDLGCTL", "41", "WM_SPOOLERSTATUS", "WM_DRAWITEM", "WM_MEASUREITEM", "WM_DELETEITEM", "WM_VKEYTOITEM", "WM_CHARTOITEM", "WM_SETFONT", "WM_GETFONT", "WM_SETHOTKEY", "WM_GETHOTKEY", "52", "53", "54", "WM_QUERYDRAGICON", "56", "WM_COMPAREITEM", "58", "59", "60", "61", "62", "63", "64", "WM_COMPACTING", "66", "67", "WM_COMMNOTIFY", "69", "WM_WINDOWPOSCHANGING", "WM_WINDOWPOSCHANGED", "WM_POWER", "73", "WM_COPYDATA", "WM_CANCELJOURNAL", "76", "77", "WM_NOTIFY", "79", "WM_INPUTLANGCHANGEREQUEST", "WM_INPUTLANGCHANGE", "WM_TCARD", "WM_HELP", "WM_USERCHANGED", "WM_NOTIFYFORMAT", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122", "WM_CONTEXTMENU", "WM_STYLECHANGING", "WM_STYLECHANGED", "WM_DISPLAYCHANGE", "WM_GETICON", "WM_SETICON", "WM_NCCREATE", "WM_NCDESTROY", "WM_NCCALCSIZE", NULL /* WM_NCHITTEST */ , "WM_NCPAINT", "WM_NCACTIVATE", "WM_GETDLGCODE", "WM_SYNCPAINT", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151", "152", "153", "154", "155", "156", "157", "158", "159", NULL /* WM_NCMOUSEMOVE */ , "WM_NCLBUTTONDOWN", "WM_NCLBUTTONUP", "WM_NCLBUTTONDBLCLK", "WM_NCRBUTTONDOWN", "WM_NCRBUTTONUP", "WM_NCRBUTTONDBLCLK", "WM_NCMBUTTONDOWN", "WM_NCMBUTTONUP", "WM_NCMBUTTONDBLCLK", "170", "171", "172", "173", "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186", "187", "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198", "199", "200", "201", "202", "203", "204", "205", "206", "207", "208", "209", "210", "211", "212", "213", "214", "215", "216", "217", "218", "219", "220", "221", "222", "223", "224", "225", "226", "227", "228", "229", "230", "231", "232", "233", "234", "235", "236", "237", "238", "239", "240", "241", "242", "243", "244", "245", "246", "247", "248", "249", "250", "251", "252", "253", "254", "255", "WM_KEYDOWN", "WM_KEYUP", "WM_CHAR", "WM_DEADCHAR", "WM_SYSKEYDOWN", "WM_SYSKEYUP", "WM_SYSCHAR", "WM_SYSDEADCHAR", "WM_CONVERTREQUESTEX", "265", "266", "267", "268", "WM_IME_STARTCOMPOSITION", "WM_IME_ENDCOMPOSITION", "WM_IME_KEYLAST", "WM_INITDIALOG", "WM_COMMAND", "WM_SYSCOMMAND", NULL /* WM_TIMER */ , "WM_HSCROLL", "WM_VSCROLL", "WM_INITMENU", "WM_INITMENUPOPUP", "280", "281", "282", "283", "284", "285", "286", "WM_MENUSELECT", "WM_MENUCHAR", "WM_ENTERIDLE", "290", "291", "292", "293", "294", "295", "296", "297", "298", "299", "300", "301", "302", "303", "304", "305", "WM_CTLCOLORMSGBOX", "WM_CTLCOLOREDIT", "WM_CTLCOLORLISTBOX", "WM_CTLCOLORBTN", "WM_CTLCOLORDLG", "WM_CTLCOLORSCROLLBAR", "WM_CTLCOLORSTATIC", "313", "314", "315", "316", "317", "318", "319", "320", "321", "322", "323", "324", "325", "326", "327", "328", "329", "330", "331", "332", "333", "334", "335", "336", "337", "338", "339", "340", "341", "342", "343", "344", "345", "346", "347", "348", "349", "350", "351", "352", "353", "354", "355", "356", "357", "358", "359", "360", "361", "362", "363", "364", "365", "366", "367", "368", "369", "370", "371", "372", "373", "374", "375", "376", "377", "378", "379", "380", "381", "382", "383", "384", "385", "386", "387", "388", "389", "390", "391", "392", "393", "394", "395", "396", "397", "398", "399", "400", "401", "402", "403", "404", "405", "406", "407", "408", "409", "410", "411", "412", "413", "414", "415", "416", "417", "418", "419", "420", "421", "422", "423", "424", "425", "426", "427", "428", "429", "430", "431", "432", "433", "434", "435", "436", "437", "438", "439", "440", "441", "442", "443", "444", "445", "446", "447", "448", "449", "450", "451", "452", "453", "454", "455", "456", "457", "458", "459", "460", "461", "462", "463", "464", "465", "466", "467", "468", "469", "470", "471", "472", "473", "474", "475", "476", "477", "478", "479", "480", "481", "482", "483", "484", "485", "486", "487", "488", "489", "490", "491", "492", "493", "494", "495", "496", "497", "498", "499", "500", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", "511", NULL /* WM_MOUSEMOVE */ , "WM_LBUTTONDOWN", "WM_LBUTTONUP", "WM_LBUTTONDBLCLK", "WM_RBUTTONDOWN", "WM_RBUTTONUP", "WM_RBUTTONDBLCLK", "WM_MBUTTONDOWN", "WM_MBUTTONUP", "WM_MBUTTONDBLCLK", "WM_MOUSEWHEEL", "WM_XBUTTONDOWN", "WM_XBUTTONUP", "WM_XBUTTONDBLCLK", "WM_MOUSEHWHEEL", "527", "WM_PARENTNOTIFY", "WM_ENTERMENULOOP", "WM_EXITMENULOOP", "WM_NEXTMENU", "WM_SIZING", "WM_CAPTURECHANGED", "WM_MOVING", "535", "WM_POWERBROADCAST", "WM_DEVICECHANGE", "538", "539", "540", "541", "542", "543", "WM_MDICREATE", "WM_MDIDESTROY", "WM_MDIACTIVATE", "WM_MDIRESTORE", "WM_MDINEXT", "WM_MDIMAXIMIZE", "WM_MDITILE", "WM_MDICASCADE", "WM_MDIICONARRANGE", "WM_MDIGETACTIVE", "554", "555", "556", "557", "558", "559", "WM_MDISETMENU", "WM_ENTERSIZEMOVE", "WM_EXITSIZEMOVE", "WM_DROPFILES", "WM_MDIREFRESHMENU", "565", "566", "567", "568", "569", "570", "571", "572", "573", "574", "575", "576", "577", "578", "579", "580", "581", "582", "583", "584", "585", "586", "587", "588", "589", "590", "591", "592", "593", "594", "595", "596", "597", "598", "599", "600", "601", "602", "603", "604", "605", "606", "607", "608", "609", "610", "611", "612", "613", "614", "615", "616", "617", "618", "619", "620", "621", "622", "623", "624", "625", "626", "627", "628", "629", "630", "631", "632", "633", "634", "635", "636", "637", "638", "639", "640", "WM_IME_SETCONTEXT", "WM_IME_NOTIFY", "WM_IME_CONTROL", "WM_IME_COMPOSITIONFULL", "WM_IME_SELECT", "WM_IME_CHAR", "647", "648", "649", "650", "651", "652", "653", "654", "655", "WM_IME_KEYDOWN", "WM_IME_KEYUP", "658", "659", "660", "661", "662", "663", "664", "665", "666", "667", "668", "669", "670", "671", "672", "WM_MOUSEHOVER", "674", "WM_MOUSELEAVE", "676", "677", "678", "679", "680", "681", "682", "683", "684", "685", "686", "687", "688", "689", "690", "691", "692", "693", "694", "695", "696", "697", "698", "699", "700", "701", "702", "703", "704", "705", "706", "707", "708", "709", "710", "711", "712", "713", "714", "715", "716", "717", "718", "719", "720", "721", "722", "723", "724", "725", "726", "727", "728", "729", "730", "731", "732", "733", "734", "735", "736", "737", "738", "739", "740", "741", "742", "743", "744", "745", "746", "747", "748", "749", "750", "751", "752", "753", "754", "755", "756", "757", "758", "759", "760", "761", "762", "763", "764", "765", "766", "767", "WM_CUT", "WM_COPY", "WM_PASTE", "WM_CLEAR", "WM_UNDO", "WM_RENDERFORMAT", "WM_RENDERALLFORMATS", "WM_DESTROYCLIPBOARD", "WM_DRAWCLIPBOARD", "WM_PAINTCLIPBOARD", "WM_VSCROLLCLIPBOARD", "WM_SIZECLIPBOARD", "WM_ASKCBFORMATNAME", "WM_CHANGECBCHAIN", "WM_HSCROLLCLIPBOARD", "WM_QUERYNEWPALETTE", "WM_PALETTEISCHANGING", "WM_PALETTECHANGED", "WM_HOTKEY", "787", "788", "789", "790", "WM_PRINT", "WM_PRINTCLIENT", "793", "794", "795", "796", "797", "798", "799", "800", "801", "802", "803", "804", "805", "806", "807", "808", "809", "810", "811", "812", "813", "814", "815", "816", "817", "818", "819", "820", "821", "822", "823", "824", "825", "826", "827", "828", "829", "830", "831", "832", "833", "834", "835", "836", "837", "838", "839", "840", "841", "842", "843", "844", "845", "846", "847", "848", "849", "850", "851", "852", "853", "854", "855", "856", "857", "858", "859", "860", "861", "862", "863", "864", "865", "866", "867", "868", "869", "870", "871", "872", "873", "874", "875", "876", "877", "878", "879", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889", "890", "891", "892", "893", "894", "895", "896", "897", "898", "899", "900", "901", "902", "903", "904", "905", "906", "907", "908", "909", "910", "911", "912", "913", "914", "915", "916", "917", "918", "919", "920", "921", "922", "923", "924", "925", "926", "927", "928", "929", "930", "931", "932", "933", "934", "935", "936", "937", "938", "939", "940", "941", "942", "943", "944", "945", "946", "947", "948", "949", "950", "951", "952", "953", "954", "955", "956", "957", "958", "959", "960", "961", "962", "963", "964", "965", "966", "967", "968", "969", "970", "971", "972", "973", "974", "975", "976", "977", "978", "979", "980", "981", "982", "983", "984", "985", "986", "987", "988", "989", "990", "991", "992", "993", "994", "995", "996", "997", "998", "999", "1000", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1014", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022", "1023" }; #endif xorg-server-1.20.8/hw/xwin/wincmap.c0000644000175000017500000004430213640201473014216 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * Local prototypes */ static int winListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps); static void winStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs); static void winInstallColormap(ColormapPtr pmap); static void winUninstallColormap(ColormapPtr pmap); static void winResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual); static Bool winCreateColormap(ColormapPtr pmap); static void winDestroyColormap(ColormapPtr pmap); static Bool winGetPaletteDIB(ScreenPtr pScreen, ColormapPtr pcmap); static Bool winGetPaletteDD(ScreenPtr pScreen, ColormapPtr pcmap); /* * Set screen functions for colormaps */ void winSetColormapFunctions(ScreenPtr pScreen) { pScreen->CreateColormap = winCreateColormap; pScreen->DestroyColormap = winDestroyColormap; pScreen->InstallColormap = winInstallColormap; pScreen->UninstallColormap = winUninstallColormap; pScreen->ListInstalledColormaps = winListInstalledColormaps; pScreen->StoreColors = winStoreColors; pScreen->ResolveColor = winResolveColor; } /* See Porting Layer Definition - p. 30 */ /* * Walk the list of installed colormaps, filling the pmaps list * with the resource ids of the installed maps, and return * a count of the total number of installed maps. */ static int winListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps) { winScreenPriv(pScreen); /* * There will only be one installed colormap, so we only need * to return one id, and the count of installed maps will always * be one. */ *pmaps = pScreenPriv->pcmapInstalled->mid; return 1; } /* See Porting Layer Definition - p. 30 */ /* See Programming Windows - p. 663 */ static void winInstallColormap(ColormapPtr pColormap) { ScreenPtr pScreen = pColormap->pScreen; winScreenPriv(pScreen); ColormapPtr oldpmap = pScreenPriv->pcmapInstalled; #if CYGDEBUG winDebug("winInstallColormap\n"); #endif /* Did the colormap actually change? */ if (pColormap != oldpmap) { #if CYGDEBUG winDebug("winInstallColormap - Colormap has changed, attempt " "to install.\n"); #endif /* Was there a previous colormap? */ if (oldpmap != (ColormapPtr) None) { /* There was a previous colormap; tell clients it is gone */ WalkTree(pColormap->pScreen, TellLostMap, (char *) &oldpmap->mid); } /* Install new colormap */ pScreenPriv->pcmapInstalled = pColormap; WalkTree(pColormap->pScreen, TellGainedMap, (char *) &pColormap->mid); /* Call the engine specific colormap install procedure */ if (!((*pScreenPriv->pwinInstallColormap) (pColormap))) { winErrorFVerb(2, "winInstallColormap - Screen specific colormap install " "procedure failed. Continuing, but colors may be " "messed up from now on.\n"); } } /* Save a pointer to the newly installed colormap */ pScreenPriv->pcmapInstalled = pColormap; } /* See Porting Layer Definition - p. 30 */ static void winUninstallColormap(ColormapPtr pmap) { winScreenPriv(pmap->pScreen); ColormapPtr curpmap = pScreenPriv->pcmapInstalled; #if CYGDEBUG winDebug("winUninstallColormap\n"); #endif /* Is the colormap currently installed? */ if (pmap != curpmap) { /* Colormap not installed, nothing to do */ return; } /* Clear the installed colormap flag */ pScreenPriv->pcmapInstalled = NULL; /* * NOTE: The default colormap does not get "uninstalled" before * it is destroyed. */ /* Install the default cmap in place of the cmap to be uninstalled */ if (pmap->mid != pmap->pScreen->defColormap) { dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap, RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap) (curpmap); } } /* See Porting Layer Definition - p. 30 */ static void winStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs) { ScreenPtr pScreen = pmap->pScreen; winScreenPriv(pScreen); winCmapPriv(pmap); int i; unsigned short nRed, nGreen, nBlue; #if CYGDEBUG if (ndef != 1) winDebug("winStoreColors - ndef: %d\n", ndef); #endif /* Save the new colors in the colormap privates */ for (i = 0; i < ndef; ++i) { /* Adjust the colors from the X color spec to the Windows color spec */ nRed = pdefs[i].red >> 8; nGreen = pdefs[i].green >> 8; nBlue = pdefs[i].blue >> 8; /* Copy the colors to a palette entry table */ pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed; pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen; pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue; /* Copy the colors to a RGBQUAD table */ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed; pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen; pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue; #if CYGDEBUG winDebug("winStoreColors - nRed %d nGreen %d nBlue %d\n", nRed, nGreen, nBlue); #endif } /* Call the engine specific store colors procedure */ if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs))) { winErrorFVerb(2, "winStoreColors - Engine cpecific color storage procedure " "failed. Continuing, but colors may be messed up from now " "on.\n"); } } /* See Porting Layer Definition - p. 30 */ static void winResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual) { #if CYGDEBUG winDebug("winResolveColor ()\n"); #endif miResolveColor(pred, pgreen, pblue, pVisual); } /* See Porting Layer Definition - p. 29 */ static Bool winCreateColormap(ColormapPtr pmap) { winPrivCmapPtr pCmapPriv = NULL; ScreenPtr pScreen = pmap->pScreen; winScreenPriv(pScreen); #if CYGDEBUG winDebug("winCreateColormap\n"); #endif /* Allocate colormap privates */ if (!winAllocateCmapPrivates(pmap)) { ErrorF("winCreateColorma - Couldn't allocate cmap privates\n"); return FALSE; } /* Get a pointer to the newly allocated privates */ pCmapPriv = winGetCmapPriv(pmap); /* * FIXME: This is some evil hackery to help in handling some X clients * that expect the top pixel to be white. This "help" only lasts until * some client overwrites the top colormap entry. * * We don't want to actually allocate the top entry, as that causes * problems with X clients that need 7 planes (128 colors) in the default * colormap, such as Magic 7.1. */ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255; pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255; pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255; pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255; pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255; pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255; /* Call the engine specific colormap initialization procedure */ if (!((*pScreenPriv->pwinCreateColormap) (pmap))) { ErrorF("winCreateColormap - Engine specific colormap creation " "procedure failed. Aborting.\n"); return FALSE; } return TRUE; } /* See Porting Layer Definition - p. 29, 30 */ static void winDestroyColormap(ColormapPtr pColormap) { winScreenPriv(pColormap->pScreen); winCmapPriv(pColormap); /* Call the engine specific colormap destruction procedure */ if (!((*pScreenPriv->pwinDestroyColormap) (pColormap))) { winErrorFVerb(2, "winDestroyColormap - Engine specific colormap destruction " "procedure failed. Continuing, but it is possible that memory " "was leaked, or that colors will be messed up from now on.\n"); } /* Free the colormap privates */ free(pCmapPriv); winSetCmapPriv(pColormap, NULL); #if CYGDEBUG winDebug("winDestroyColormap - Returning\n"); #endif } /* * Internal function to load the palette used by the Shadow DIB */ static Bool winGetPaletteDIB(ScreenPtr pScreen, ColormapPtr pcmap) { winScreenPriv(pScreen); int i; Pixel pixel; /* Pixel == CARD32 */ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */ UINT uiColorsRetrieved = 0; RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; /* Get the color table for the screen */ uiColorsRetrieved = GetDIBColorTable(pScreenPriv->hdcScreen, 0, WIN_NUM_PALETTE_ENTRIES, rgbColors); if (uiColorsRetrieved == 0) { ErrorF("winGetPaletteDIB - Could not retrieve screen color table\n"); return FALSE; } #if CYGDEBUG winDebug("winGetPaletteDIB - Retrieved %d colors from DIB\n", uiColorsRetrieved); #endif /* Set the DIB color table to the default screen palette */ if (SetDIBColorTable(pScreenPriv->hdcShadow, 0, uiColorsRetrieved, rgbColors) == 0) { ErrorF("winGetPaletteDIB - SetDIBColorTable () failed\n"); return FALSE; } /* Alloc each color in the DIB color table */ for (i = 0; i < uiColorsRetrieved; ++i) { pixel = i; /* Extract the color values for current palette entry */ nRed = rgbColors[i].rgbRed << 8; nGreen = rgbColors[i].rgbGreen << 8; nBlue = rgbColors[i].rgbBlue << 8; #if CYGDEBUG winDebug("winGetPaletteDIB - Allocating a color: %u; " "%d %d %d\n", (unsigned int)pixel, nRed, nGreen, nBlue); #endif /* Allocate a entry in the X colormap */ if (AllocColor(pcmap, &nRed, &nGreen, &nBlue, &pixel, 0) != Success) { ErrorF("winGetPaletteDIB - AllocColor () failed, pixel %d\n", i); return FALSE; } if (i != pixel || nRed != rgbColors[i].rgbRed || nGreen != rgbColors[i].rgbGreen || nBlue != rgbColors[i].rgbBlue) { winDebug("winGetPaletteDIB - Got: %d; " "%d %d %d\n", (int) pixel, nRed, nGreen, nBlue); } /* FIXME: Not sure that this bit is needed at all */ pcmap->red[i].co.local.red = nRed; pcmap->red[i].co.local.green = nGreen; pcmap->red[i].co.local.blue = nBlue; } /* System is using a colormap */ /* Set the black and white pixel indices */ pScreen->whitePixel = uiColorsRetrieved - 1; pScreen->blackPixel = 0; return TRUE; } /* * Internal function to load the standard system palette being used by DD */ static Bool winGetPaletteDD(ScreenPtr pScreen, ColormapPtr pcmap) { int i; Pixel pixel; /* Pixel == CARD32 */ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */ UINT uiSystemPaletteEntries; LPPALETTEENTRY ppeColors = NULL; HDC hdc = NULL; /* Get a DC to obtain the default palette */ hdc = GetDC(NULL); if (hdc == NULL) { ErrorF("winGetPaletteDD - Couldn't get a DC\n"); return FALSE; } /* Get the number of entries in the system palette */ uiSystemPaletteEntries = GetSystemPaletteEntries(hdc, 0, 0, NULL); if (uiSystemPaletteEntries == 0) { ErrorF("winGetPaletteDD - Unable to determine number of " "system palette entries\n"); return FALSE; } #if CYGDEBUG winDebug("winGetPaletteDD - uiSystemPaletteEntries %d\n", uiSystemPaletteEntries); #endif /* Allocate palette entries structure */ ppeColors = malloc(uiSystemPaletteEntries * sizeof(PALETTEENTRY)); if (ppeColors == NULL) { ErrorF("winGetPaletteDD - malloc () for colormap failed\n"); return FALSE; } /* Get system palette entries */ GetSystemPaletteEntries(hdc, 0, uiSystemPaletteEntries, ppeColors); /* Allocate an X colormap entry for every system palette entry */ for (i = 0; i < uiSystemPaletteEntries; ++i) { pixel = i; /* Extract the color values for current palette entry */ nRed = ppeColors[i].peRed << 8; nGreen = ppeColors[i].peGreen << 8; nBlue = ppeColors[i].peBlue << 8; #if CYGDEBUG winDebug("winGetPaletteDD - Allocating a color: %u; " "%d %d %d\n", (unsigned int)pixel, nRed, nGreen, nBlue); #endif if (AllocColor(pcmap, &nRed, &nGreen, &nBlue, &pixel, 0) != Success) { ErrorF("winGetPaletteDD - AllocColor () failed, pixel %d\n", i); free(ppeColors); ppeColors = NULL; return FALSE; } pcmap->red[i].co.local.red = nRed; pcmap->red[i].co.local.green = nGreen; pcmap->red[i].co.local.blue = nBlue; } /* System is using a colormap */ /* Set the black and white pixel indices */ pScreen->whitePixel = uiSystemPaletteEntries - 1; pScreen->blackPixel = 0; /* Free colormap */ free(ppeColors); ppeColors = NULL; /* Free the DC */ if (hdc != NULL) { ReleaseDC(NULL, hdc); hdc = NULL; } return TRUE; } /* * Install the standard fb colormap, or the GDI colormap, * depending on the current screen depth. */ Bool winCreateDefColormap(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; unsigned short zero = 0, ones = 0xFFFF; VisualPtr pVisual = pScreenPriv->pRootVisual; ColormapPtr pcmap = NULL; Pixel wp, bp; #if CYGDEBUG winDebug("winCreateDefColormap\n"); #endif /* Use standard fb colormaps for non palettized color modes */ if (pScreenInfo->dwBPP > 8) { winDebug("winCreateDefColormap - Deferring to " "fbCreateDefColormap ()\n"); return fbCreateDefColormap(pScreen); } /* * AllocAll for non-Dynamic visual classes, * AllocNone for Dynamic visual classes. */ /* * Dynamic visual classes allow the colors of the color map * to be changed by clients. */ #if CYGDEBUG winDebug("winCreateDefColormap - defColormap: %lu\n", pScreen->defColormap); #endif /* Allocate an X colormap, owned by client 0 */ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pcmap, (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0) != Success) { ErrorF("winCreateDefColormap - CreateColormap failed\n"); return FALSE; } if (pcmap == NULL) { ErrorF("winCreateDefColormap - Colormap could not be created\n"); return FALSE; } #if CYGDEBUG winDebug("winCreateDefColormap - Created a colormap\n"); #endif /* Branch on the visual class */ if (!(pVisual->class & DynamicClass)) { /* Branch on engine type */ if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) { /* Load the colors being used by the Shadow DIB */ if (!winGetPaletteDIB(pScreen, pcmap)) { ErrorF("winCreateDefColormap - Couldn't get DIB colors\n"); return FALSE; } } else { /* Load the colors from the default system palette */ if (!winGetPaletteDD(pScreen, pcmap)) { ErrorF("winCreateDefColormap - Couldn't get colors " "for DD\n"); return FALSE; } } } else { wp = pScreen->whitePixel; bp = pScreen->blackPixel; /* Allocate a black and white pixel */ if ((AllocColor(pcmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(pcmap, &zero, &zero, &zero, &bp, 0) != Success)) { ErrorF("winCreateDefColormap - Couldn't allocate bp or wp\n"); return FALSE; } pScreen->whitePixel = wp; pScreen->blackPixel = bp; #if 0 /* Have to reserve first 10 and last ten pixels in DirectDraw windowed */ if (pScreenInfo->dwEngine != WIN_SERVER_SHADOW_GDI) { int k; Pixel p; for (k = 1; k < 10; ++k) { p = k; if (AllocColor(pcmap, &ones, &ones, &ones, &p, 0) != Success) FatalError("Foo!\n"); } for (k = 245; k < 255; ++k) { p = k; if (AllocColor(pcmap, &zero, &zero, &zero, &p, 0) != Success) FatalError("Baz!\n"); } } #endif } /* Install the created colormap */ (*pScreen->InstallColormap) (pcmap); #if CYGDEBUG winDebug("winCreateDefColormap - Returning\n"); #endif return TRUE; } xorg-server-1.20.8/hw/xwin/man/0000755000175000017500000000000013640201535013243 500000000000000xorg-server-1.20.8/hw/xwin/man/XWin.man0000644000175000017500000003563413640201473014561 00000000000000.TH XWIN 1 @vendorversion@ .SH NAME XWin \- X Server for the Cygwin environment on Microsoft Windows .SH SYNOPSIS .B XWin [ options ] ... .SH DESCRIPTION \fIXWin\fP is an X Server for the X Window System on the Cygwin environment running on Microsoft Windows. .SH MODES \fIXWin\fP can operate in 3 different modes: .br * \fISingle Window\fP: This is the default mode. Each X screen appears as a single \fIWindows\fP window and all X windows are contained within this window. (In X terminology, the \fIWindows\fP window contains the root window for the screen) .br * \fIMulti-Window\fP: In this mode \fIXWin\fP uses its own integrated window manager in order to handle the top-level X windows, in such a way that they appear as normal \fIWindows\fP windows. .br * \fIRootless\fP: In this mode the X server works in a window containing the whole screen but this root window (traditionally covered with an X hatch pattern) is hidden from view, so only top-level X windows are seen. .SH OPTIONS In addition to the normal server options described in the \fIXserver(1)\fP manual page, \fIXWin\fP accepts the following command line switches, \fIall\fP of which are optional: .SH OPTIONS CONTROLLING WINDOWING MODE Only one of these options may be specified. .TP 8 .B (default) Windowed or rooted mode. Each X screen appears as a single \fIWindows\fP window and all X windows are contained within those windows. .TP 8 .B \-multiwindow Each top-level X window appears in its own \fIWindows\fP window. Also start the integrated \fIWindows\fP-based window manager. .TP 8 .B \-rootless Run the server in rootless mode. The X server works on a window covering the whole screen but the root window is hidden from view. .TP 8 .B \-mwextwm Experimental. The mode combines \fB\-rootless\fP mode drawing with native \fIWindows\fP window frames managed by the experimental external window manager \fIxwinwm\fP. .PP \fBNOTE:\fP \fI-multiwindow\fP mode uses its own internal window manager. All other modes require an external window manager in order to move, resize, and perform other operations on the individual X windows. .SH OPTIONS FOR SPECIFYING X SCREENS An X display may be composed of multiple screens. The default behaviour is to create a single screen 0 that is roughly the size of useful area of the primary monitor (allowing for any window decorations and the task-bar). Screen specific parameters can be applied as a default to all screens by placing those screen specific parameters before any \fB\-screen\fP parameter. Screen specific parameters placed after the first \fB\-screen\fP parameter will apply only to the immediately preceeding \fB\-screen\fP parameter. .TP 8 .B \-[no]multimonitors or \-[no]multiplemonitors Create a screen 0 that covers all monitors [the primary monitor] on a system with multiple monitors. Fake XINERAMA data is created describing the individual monitors, (This is similar to the 'merged framebuffer' or 'pseudo-xinerama' mode provided by some drivers for the xorg X server). This option is currently enabled by default in \fB\-multiwindow\fP mode. .TP 8 .B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] " Create screen number .I screen_number and optionally specify it's .I height, .I width and .I initial position. Additionally a .I monitor number (which count from 1) can be specified to place the screen on, at which point, all coordinates become relative to that monitor. Screen numbers must be contiguous starting from zero and cannot be duplicated. Examples: .I " -screen 0 @1 ; on 1st monitor using its full resolution (the default)" .I " -screen 0 800x600+100+100@2 ; on 2nd monitor offset 100,100 size 800x600" .I " -screen 0 1024x768@3 ; on 3rd monitor size 1024x768" .SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS These parameters only apply to windowed mode screens i.e. not in \fB-multiwindow\fP or \fB-rootless\fP mode. .TP 8 .B "\-fullscreen" The X server window takes the full screen, covering completely the \fIWindows\fP desktop. Currently \fB\-fullscreen\fP may only be applied to one X screen. .TP 8 .B \-nodecoration Do not give the Cygwin/X window a \fIWindows\fP window border, title bar, etc. This parameter is ignored when the \fB\-fullscreen\fP parameter is specified. .TP 8 .B \-scrollbars Alternative name for \fB\-resize=scrollbars\fP. .SH OPTIONS CONTROLLING RESIZE BEHAVIOUR .TP 8 .B \-resize[=none|scrollbars|randr] Select the resize mode of an X screen. The default is \fBnone\fP if \fB\-fullscreen\fP is used, \fBrandr\fP otherwise. .RS .IP \fB\-resize=none\fP 8 The screen is not resizable. In windowed mode, if the window has decorations, a fixed frame is used. Alternative name is \fB\-noresize\fP. .IP \fB\-resize=scrollbars\fP 8 The screen window is resizeable, but the screen is not resizable. In windowed mode, if the window has decorations, a resizing frame is used. Scrollbars are drawn when needed to allow the entire X screen to viewed by adjusting them. This also permits screens bigger than the \fIWindows\fP virtual desktop to be used. This parameter is ignored in \fB-multiwindow\fP or \fB-rootless\fP mode. Alternative name is \fB\-scrollbars\fP. .IP \fB\-resize=randr\fP 8 The screen is resizable and the screen window is resizeable. In windowed mode, if the window has decorations, a resizing frame is used. Resizing the \fIWindows\fP window will use the RANDR extension to change the size of the X screen. Likewise, changing the size of the X screen using the RANDR extension will cause the size of the \fIWindows\fP window containing the X screen to be changed. In \fB-multiwindow\fP or \fB-rootless\fP mode, if the X screen is of the same dimensions as a Windows monitor or the virtual desktop, the X server will respond to the WM_DISPLAYCHANGED sent when those dimensions change by resizing the X screen. Changing the size of the X screen using the RANDR extension is not permitted. The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop. .IP \fB\-resize\fP 8 on its own is equivalent to \fB\-resize=randr\fP .RE .SH OPTIONS FOR MULTIWINDOW MODE .TP 8 .B \-[no]hostintitle Add the host name to the window title for X applications which are running on remote hosts, when that information is available and it's useful to do so. The default is enabled. .SH OPTIONS CONTROLLING WINDOWS INTEGRATION .TP 8 .B \-[no]clipboard Enables [disables] the integration between the X11 clipboard and \fIWindows\fP clipboard. The default is enabled. .TP 8 .B "\-emulate3buttons [\fItimeout\fP]" Emulate a three button mouse; pressing both buttons within .I timeout milliseconds causes an emulated middle button press. The default .I timeout is 50 milliseconds. Note that most mice with scroll wheel have middle button functionality, usually you will need this option only if you have a two button mouse without scroll wheel. Default is to enable this option if \fIWindows\fP reports a two button mouse, disabled otherwise. .TP 8 .B \-[no]keyhook Enable [disable] a low-level keyboard hook for catching special keypresses like Menu and Alt+Tab and passing them to the X Server instead of letting \fIWindows\fP handle them. .TP 8 .B \-lesspointer Normally the \fIWindows\fP mouse cursor is hidden when the mouse is over an active Cygwin/X window. This option causes the mouse cursor also to be hidden when it is over an inactive Cygwin/X window. This prevents the \fIWindows\fP mouse cursor from being drawn on top of the X cursor. This parameter has no effect unless \fB-swcursor\fP is also specified. .TP 8 .B \-[no]primary Clipboard integration may [will not] use the PRIMARY selection. The default is enabled. .TP 8 .B \-swcursor Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead. .TP 8 .B \-[no]trayicon Do not create a tray icon. Default is to create one icon per screen. You can globally disable tray icons with \fB\-notrayicon\fP, then enable it for specific screens with \fB\-trayicon\fP for those screens. .TP 8 .B \-nounicodeclipboard Do not use Unicode clipboard even if on a NT-based platform. .TP 8 .B \-[no]unixkill Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a signal to exit the X Server. The \fICtrl-Alt-Backspace\fP key combination is disabled by default. .TP 8 .B \-[no]wgl Enable [disable] the GLX extension to use the native Windows WGL interface for hardware accelerated OpenGL (AIGLX). The default is enabled. .TP 8 .B \-[no]winkill Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the X Server. The \fIAlt-F4\fP key combination is enabled by default. .SH DRAWING ENGINE OPTIONS .TP 8 .B "\-clipupdates \fInum_boxes\fP" Specify an optional threshold, above which the regions in a shadow update operation will be collected into a GDI clipping region. The clipping region is then used to do a single bit block transfer that is constrained to the updated area by the clipping region. There is some overhead involved in creating, installing, destroying, and removing the clipping region, thus there may not be much benefit for a small number of boxes (less than 10). It is even possible that this functionality does not provide a benefit at any number of boxes; we can only determine the usefulness of this feature through testing. This option probably has limited effect on current \fIWindows\fP versions as they already perform GDI batching. .TP 8 .B "\-engine \fIengine_type_id\fP" This option, which is intended for Cygwin/X developers, overrides the server's automatically selected drawing engine type. This parameter will be ignored if the specified drawing engine type is not supported on the current system. Default behavior is to select the drawing engine with optimum performance that supports the specified depth and window configuration. The engine type ids are: .RS .IP 1 4 Shadow GDI .IP 4 4 Shadow DirectDraw Non-Locking .RE .SH FULLSCREEN OPTIONS .TP 8 .B "\-depth \fIdepth\fP" Specify the color depth, in bits per pixel, to use when running in fullscreen with a DirectDraw engine. This parameter is ignored if \fB\-fullscreen\fP is not specified. .TP 8 .B "\-refresh \fIrate_in_Hz\fP" Specify an optional refresh rate to use when running in fullscreen with a DirectDraw engine. This parameter is ignored if \fB\-fullscreen\fP is not specified. .SH MISCELLANEOUS OPTIONS See also the normal server options described in the \fIXserver(1)\fP manual page .TP 8 .B \-help Write a help text listing supported command line options and their description to the console. .TP 8 .B \-ignoreinput Ignore keyboard and mouse input. This is usually only used for testing and debugging purposes. .TP 8 .B "\-logfile \fIfilename\fP" Change the server log file from the default of \fI @logdir@/XWin.n.log\fP, where \fIn\fP is the display number of the XWin server, to \fIfilename\fP. .TP 8 .B "\-logverbose \fIlevel\fP" Control the degree of verbosity of the log messages with the integer parameter \fIlevel\fP. For \fIlevel\fP=0 only fatal errors are reported, for \fIlevel\fP=1 simple information about configuration is also given, for \fIlevel\fP=2 (default) additional runtime information is recorded and for \fIlevel\fP=3 detailed log information (including trace and debug output) is produced. Bigger values will yield a still more detailed debug output. .TP 8 .B "\-xkblayout \fIlayout\fP" .TP 8 .B "\-xkbmodel \fImodel\fP" .TP 8 .B "\-xkboptions \fIoption\fP" .TP 8 .B "\-xkbrules \fIrule\fP" .TP 8 .B "\-xkbvariant \fIvariant\fp" These options configure the xkeyboard extension to load a particular keyboard map as the X server starts. The behavior is similar to the \fIsetxkbmap\fP(1) program. See the \fIxkeyboard-config\fP(@miscmansuffix@) manual page for a list of keyboard configurations. The keyboard layout data is located at \fI@datadir@/X11/xkb/\fP. Additional information can be found in the README files there and in the \fIsetxkbmap\fP(1) manual page. For example, in order to load a German layout for a pc105 keyboard, use the options: .br .I " \-xkblayout de \-xkbmodel pc105" Alternatively, you can use the \fIsetxkbmap\fP(1) program after \fIXWin\fP is running. The default is to select a keyboard configuration matching your current layout as reported by \fIWindows\fP, if known, or the default X server configuration if no matching keyboard configuration was found. .SH UNDOCUMENTED OPTIONS These options are undocumented. Do not use them. .TP 8 .B \-emulatepseudo Create a depth 8 PseudoColor visual when running in depths 15, 16, 24, or 32, collectively known as TrueColor depths. Color map manipulation is not supported, so the PseudoColor visual will not have the correct colors. This option is intended to allow applications which only work with a depth 8 visual to operate in TrueColor modes. .SH LOG FILE As it runs \fIXWin\fP writes messages indicating the most relevant events to the console from which it was called and to a log file that by default is located at \fI @logdir@/XWin.0.log\fP. This file is mainly for debugging purposes. .SH PREFERENCES FILE On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if the previous file does not exist, \fI @sysconfdir@/X11/system.XWinrc\fP. \fI.XWinrc\fP allows setting preferences for the following: .br * To include items into the menu associated with the \fIXWin\fP icon which is in the \fIWindows\fP system tray. This functions in all modes that have a tray icon. .br * To include items in the system menu which is associated with the \fIWindows\fP window that \fIXWin -multiwindow\fP produces for each top-level X window, in both the generic case and for particular programs. .br * To change the icon that is associated to the \fIWindows\fP window that \fIXWin -multiwindow\fP produces for each top-level X-window. .br * To change the style that is associated to the \fIWindows\fP window that \fXWin I-multiwindow\fP produces for each top-level X window. .PP The format of the \fI.XWinrc\fP file is given in the XWinrc(5) manual page. .SH EXAMPLES Need some examples .SH "SEE ALSO" X(@miscmansuffix@), Xserver(1), xdm(1), xinit(1), XWinrc(@filemansuffix@), setxkbmap(1), xkeyboard-config(@miscmansuffix@). .SH BUGS .I XWin and this manual page still have many limitations. The \fIXWin\fP software is continuously developing; it is therefore possible that this manual page is not up to date. It is always prudent to look also at the output of \fIXWin -help\fP in order to check the options that are operative. .SH AUTHORS This list is by no means complete, but direct contributors to the Cygwin/X project include (in alphabetical order by last name): Stuart Adamson, Michael Bax, Jehan Bing, Lev Bishop, Dr. Peter Busch, Biju G C, Robert Collins, Nick Crabtree, Early Ehlinger, Christopher Faylor, John Fortin, Brian Genisio, Fabrizio Gennari, Alexander Gottwald, Ralf Habacker, Colin Harrison, Matthieu Herrb, Alan Hourihane, Pierre A Humblet, Harold L Hunt II, Dakshinamurthy Karra, Joe Krahn, Paul Loewenstein, Kensuke Matsuzaki, Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Yaakov Selkowitz, Suhaib Siddiqi, Jack Tanner, Jon Turney and Nicholas Wourms. xorg-server-1.20.8/hw/xwin/man/Makefile.am0000644000175000017500000000012113640201473015212 00000000000000include $(top_srcdir)/manpages.am appman_PRE = XWin.man fileman_PRE = XWinrc.man xorg-server-1.20.8/hw/xwin/man/Makefile.in0000644000175000017500000006561513640201514015242 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xwin/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man appman_PRE = XWin.man fileman_PRE = XWinrc.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwin/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xwin/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xwin/man/XWinrc.man0000644000175000017500000001562013640201473015077 00000000000000.TH XWIN @filemansuffix@ @vendorversion@ .SH NAME XWinrc\- XWin Server Resource Configuration File. .SH DESCRIPTION The X Server for the X Window System on the Cygwin/X environment running on Microsoft Windows, \fIXWin\fP can be optionally configured with the \fIXWinrc\fP file. A system-wide configuration file should be placed in \fI @sysconfdir@/X11/system.XWinrc\fP, a per-user file should be put at \fI$HOME/.XWinrc\fP. The \fIsystem.XWinrc\fP file is read only if no \fI$HOME/.XWinrc\fP exist. .PP With the \fI.XWinrc\fP configuration file it is possible to do the following: .PP 1- To include items into the menu associated with the \fIXWin\fP icon which is in the \fIWindows\fP system tray. This feature functions in all XWin modes that have such tray icon. .PP 2- To include items into the menu which is associated with the \fIWindows\fP window that \fIXWin -multiwindow\fP produces for each top-level X-window. That can be done both for the generic case and for particular programs. .PP 3- To change the icon that is associated to the \fIWindows\fP window that \fIXWin -multiwindow\fP produces for each top-level X-window. Again, that can be done both for the generic case and for particular programs. The new icons associated should be \fIWindows\fP format icons \fI.ico\fP. .PP 4- To change the style that is associated to the \fIWindows\fP window that \fI-multiwindow\fP produces for each top-level X window. Again, that can be done both for the generic case and for particular programs. .SH FILE FORMAT .B Keywords are case insensitive, but in this document they will be written completely capitalized. .PP .B Comments are legal pretty much anywhere you can have an end-of-line; they begin with "#" or "//" and go to the end-of-line. .PP Quote marks in strings are optional unless the string has included spaces, or could be parsed, ambiguously, as a misplaced keyword. .PP There are four kinds of instructions: miscellaneous, menu, icon and style. .SH Miscellaneous instruction .TP 8 .B DEBUG \fIString\fP The \fIString\fP is printed to the XWin log file. .TP 8 .B TRAYICON \fIicon-specifier\fB The \fBTRAYICON\fP keyword changes the icon \fIXWin\fP displays in the system tray area. .TP 8 .B SILENTEXIT The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the exit confirmation dialog if no clients are connected. .TP 8 .B FORCEEXIT The \fBFORCEEXIT\fP keyword, which takes no parameters, disables the exit confirmation dialog always. Unsaved client work may be lost but this may be useful if you want no dialogs. .SH Menu instructions .TP 8 .B MENU \fIMenu_Name\fP { .br .B \fIMenu_Item_Line\fP .br .B \fIMenu_Item_Line\fP .br .B \fI...\fP .br .B } .br This instruction defines a menu and asigns a \fIMenu_Name\fP to it. \fIMenu_Item_Line\fP are lines of any of the following types: .TP 8 .B SEPARATOR .TP 8 .B \fIItem_Label\fP EXEC \fICommand\fP .TP 8 .B \fIItem_Label\fP MENU \fIpreviously-defined-menu-name\fP .TP 8 .B \fIItem_Label\fP ALWAYSONTOP .TP 8 .B \fIItem_Label\fP RELOAD .br The \fIItem_Label\fP is the string that is written in the menu item. .br \fICommand\fP is a string with the command that will be executed by /bin/sh. Here paths should be \fICYGWIN\fP style (e.g. /usr/local/bin/myprogram). A string "%display%" appearing in the \fICommand\fP will be replaced with the proper display variable (i.e. 127.0.0.1:.0). .br \fBALWAYSONTOP\fP sets the window to which the menu is associated to display above all others. .br \fBRELOAD\fP causes the XWinrc file to be reloaded and icons and menus regenerated. .TP 8 .B ROOTMENU \fIpreviously-defined-menu-name\fP Includes the items in the indicated menu into the menu associated with \fIXWin\fP that appears in the system tray. .TP 8 .B DEFAULTSYSMENU \fIpreviously-defined-menu-name\fP ATSTART|ATEND Includes the items in the indicated menu into the menu associated with generic top-level X-Windows in the \fIXWin\fP \fImultiwindow\fP mode. The keywords \fBATSTART\fP and \fBATEND\fP indicate if such items should be included at the start or at the end of the menu. .TP 8 .B SYSMENU { \fIclass-or-name-of-window\fP \fIdefined-menu-name\fP \fBATSTART|ATEND\fP .br \fI...\fP .br \fB}\fP .br Associates a specific menu to a specified window class or name in \fI-multiwindow\fP mode. The keywords ATSTART or ATEND indicate if such items should be included at the start or at the end of the menu. .SH Icon Instructions When specifying an \fIicon-file\fP in the following commands several different formats are allowed: .br \fB"NAME.ICO"\fP\fI of an .ico format file\fP .br \t \t ("cygwin.ico", "apple.ico") .br \fB"NAME.DLL,nn"\fP\fI of a .DLL and icon index\fP .br \t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon) .br \fB",nnn"\fP\fI index into XWin.EXE internal ICON resources\fP .br \t \t (",101" is the 1st icon inside \fIXWin.EXE\fP) .TP 8 .B ICONDIRECTORY \fIWindows-path-to-icon-directory\fP Defines the default directory to search for \ficon-file\fP files. It should be a \fIWindows\fP style path (e.g. C:\\cygwin\\usr\\local\\icons). .TP 8 .B DEFAULTICON \fIicon-file\fP Defines a replacement for the standard X icon for applications without specified icons. .TP 8 .B ICONS { .br \fIclass-or-name-of-window\fP \fIicon-file\fP .br \fI...\fP .br \fB}\fP .br Defines icon replacements windows matching the specified window class or names. If multiple name or class matches occur for a window, only the first one will be used. .SH Style Instructions .TP 8 .B STYLES { \fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP .br \fI...\fP .br \fB}\fP Associates specific styles to a specified window class or name in \fI-multiwindow\fP mode. If multiple class or name matches occur, for a window, only the first one will be used. The style keywords indicate the following: \fIstyle-keyword-1\fP \fBTOPMOST\fP .br Open the class or name above all NOTOPMOST Microsoft Windows .br \fBMAXIMIZE\fP .br Start the class or name fullscreen. .br \fBMINIMIZE\fP .br Start the class or name iconic. .br \fBBOTTOM\fP .br Open the class or name below all Windows windows. .br \fIstyle-keyword-2\fP \fBNOTITLE\fP .br No Windows title bar, for the class or name. .br \fBOUTLINE\fP .br No Windows title bar and just a thin-line border, for the class or name. .br \fBNOFRAME\fP .br No Windows title bar or border, for the class or name. One keyword in \fIstyle-keyword-1\fP can be used with one keyword in \fIstyle-keyword-2\fP, or any keyword can be used singly. .SH EXAMPLE .TP 8 This example adds an Xterm menu item to the system tray icon \fBMENU systray { .br \t xterm EXEC "xterm -display %display% -sb -sl 999" .br \t SEPARATOR .br } .br ROOTMENU systray \fP .TP 8 This example makes an oclock window frameless in \fI-multiwindow\fP mode \fBSTYLES { .br \t oclock NOFRAME .br } .SH "SEE ALSO" XWin(1) .SH AUTHOR The XWinrc feature of XWin was written primarily by Earle F. Philhower III. Extended for style configuration by Colin Harrison. xorg-server-1.20.8/hw/xwin/winkeybd.h0000644000175000017500000002051313640201473014377 00000000000000#if !defined(WINKEYBD_H) #define WINKEYBD_H /* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Harold L Hunt II */ /* * We need symbols for the scan codes of keys. */ #include "winkeynames.h" #define VK_FN 0xFF #define WIN_KEYMAP_COLS 3 /* Rows 160 through 165 correspond to software-generated codes, which * may not be associated with the appropriate scan code. */ const int g_iKeyMap[] = { /* count Windows VK, ASCII, ASCII when extended VK */ /* 0 */ 0, 0, 0, /* 1 */ 0, 0, 0, /* 2 */ 0, 0, 0, /* 3 */ VK_CANCEL, 0, KEY_Break, /* 4 */ 0, 0, 0, /* 5 */ 0, 0, 0, /* 6 */ 0, 0, 0, /* 7 */ 0, 0, 0, /* 8 */ 0, 0, 0, /* 9 */ 0, 0, 0, /* 10 */ 0, 0, 0, /* 11 */ 0, 0, 0, /* 12 */ 0, 0, 0, /* 13 */ VK_RETURN, 0, KEY_KP_Enter, /* 14 */ 0, 0, 0, /* 15 */ 0, 0, 0, /* 16 */ VK_SHIFT, 0, 0, /* 17 */ VK_CONTROL, 0, KEY_RCtrl, /* 18 */ VK_MENU, 0, KEY_AltLang, /* 19 */ VK_PAUSE, KEY_Pause, 0, /* 20 */ 0, 0, 0, /* 21 */ 0, 0, 0, /* 22 */ 0, 0, 0, /* 23 */ 0, 0, 0, /* 24 */ 0, 0, 0, /* 25 */ 0, 0, 0, /* 26 */ 0, 0, 0, /* 27 */ 0, 0, 0, /* 28 */ 0, 0, 0, /* 29 */ 0, 0, 0, /* 30 */ 0, 0, 0, /* 31 */ 0, 0, 0, /* 32 */ 0, 0, 0, /* 33 */ VK_PRIOR, 0, KEY_PgUp, /* 34 */ VK_NEXT, 0, KEY_PgDown, /* 35 */ VK_END, 0, KEY_End, /* 36 */ VK_HOME, 0, KEY_Home, /* 37 */ VK_LEFT, 0, KEY_Left, /* 38 */ VK_UP, 0, KEY_Up, /* 39 */ VK_RIGHT, 0, KEY_Right, /* 40 */ VK_DOWN, 0, KEY_Down, /* 41 */ 0, 0, 0, /* 42 */ 0, 0, 0, /* 43 */ 0, 0, 0, /* 44 */ VK_SNAPSHOT, 0, KEY_Print, /* 45 */ VK_INSERT, 0, KEY_Insert, /* 46 */ VK_DELETE, 0, KEY_Delete, /* 47 */ 0, 0, 0, /* 48 */ 0, 0, 0, /* 49 */ 0, 0, 0, /* 50 */ 0, 0, 0, /* 51 */ 0, 0, 0, /* 52 */ 0, 0, 0, /* 53 */ 0, 0, 0, /* 54 */ 0, 0, 0, /* 55 */ 0, 0, 0, /* 56 */ 0, 0, 0, /* 57 */ 0, 0, 0, /* 58 */ 0, 0, 0, /* 59 */ 0, 0, 0, /* 60 */ 0, 0, 0, /* 61 */ 0, 0, 0, /* 62 */ 0, 0, 0, /* 63 */ 0, 0, 0, /* 64 */ 0, 0, 0, /* 65 */ 0, 0, 0, /* 66 */ 0, 0, 0, /* 67 */ 0, 0, 0, /* 68 */ 0, 0, 0, /* 69 */ 0, 0, 0, /* 70 */ 0, 0, 0, /* 71 */ 0, 0, 0, /* 72 */ 0, 0, 0, /* 73 */ 0, 0, 0, /* 74 */ 0, 0, 0, /* 75 */ 0, 0, 0, /* 76 */ 0, 0, 0, /* 77 */ 0, 0, 0, /* 78 */ 0, 0, 0, /* 79 */ 0, 0, 0, /* 80 */ 0, 0, 0, /* 81 */ 0, 0, 0, /* 82 */ 0, 0, 0, /* 83 */ 0, 0, 0, /* 84 */ 0, 0, 0, /* 85 */ 0, 0, 0, /* 86 */ 0, 0, 0, /* 87 */ 0, 0, 0, /* 88 */ 0, 0, 0, /* 89 */ 0, 0, 0, /* 90 */ 0, 0, 0, /* 91 */ VK_LWIN, KEY_LMeta, 0, /* 92 */ VK_RWIN, KEY_RMeta, 0, /* 93 */ VK_APPS, KEY_Menu, 0, /* 94 */ 0, 0, 0, /* 95 */ 0, 0, 0, /* 96 */ 0, 0, 0, /* 97 */ 0, 0, 0, /* 98 */ 0, 0, 0, /* 99 */ 0, 0, 0, /* 100 */ 0, 0, 0, /* 101 */ 0, 0, 0, /* 102 */ 0, 0, 0, /* 103 */ 0, 0, 0, /* 104 */ 0, 0, 0, /* 105 */ 0, 0, 0, /* 106 */ 0, 0, 0, /* 107 */ 0, 0, 0, /* 108 */ 0, 0, 0, /* 109 */ 0, 0, 0, /* 110 */ 0, 0, 0, /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide, /* 112 */ 0, 0, 0, /* 113 */ 0, 0, 0, /* 114 */ 0, 0, 0, /* 115 */ 0, 0, 0, /* 116 */ 0, 0, 0, /* 117 */ 0, 0, 0, /* 118 */ 0, 0, 0, /* 119 */ 0, 0, 0, /* 120 */ 0, 0, 0, /* 121 */ 0, 0, 0, /* 122 */ 0, 0, 0, /* 123 */ 0, 0, 0, /* 124 */ 0, 0, 0, /* 125 */ 0, 0, 0, /* 126 */ 0, 0, 0, /* 127 */ 0, 0, 0, /* 128 */ 0, 0, 0, /* 129 */ 0, 0, 0, /* 130 */ 0, 0, 0, /* 131 */ 0, 0, 0, /* 132 */ 0, 0, 0, /* 133 */ 0, 0, 0, /* 134 */ 0, 0, 0, /* 135 */ 0, 0, 0, /* 136 */ 0, 0, 0, /* 137 */ 0, 0, 0, /* 138 */ 0, 0, 0, /* 139 */ 0, 0, 0, /* 140 */ 0, 0, 0, /* 141 */ 0, 0, 0, /* 142 */ 0, 0, 0, /* 143 */ 0, 0, 0, /* 144 */ 0, 0, 0, /* 145 */ 0, 0, 0, /* 146 */ 0, 0, 0, /* 147 */ 0, 0, 0, /* 148 */ 0, 0, 0, /* 149 */ 0, 0, 0, /* 150 */ 0, 0, 0, /* 151 */ 0, 0, 0, /* 152 */ 0, 0, 0, /* 153 */ 0, 0, 0, /* 154 */ 0, 0, 0, /* 155 */ 0, 0, 0, /* 156 */ 0, 0, 0, /* 157 */ 0, 0, 0, /* 158 */ 0, 0, 0, /* 159 */ 0, 0, 0, /* 160 */ VK_LSHIFT, KEY_ShiftL, 0, /* 161 */ VK_RSHIFT, KEY_ShiftR, 0, /* 162 */ VK_LCONTROL, KEY_LCtrl, 0, /* 163 */ VK_RCONTROL, KEY_RCtrl, 0, /* 164 */ VK_LMENU, KEY_Alt, 0, /* 165 */ VK_RMENU, KEY_AltLang, 0, /* 166 */ 0, 0, 0, /* 167 */ 0, 0, 0, /* 168 */ 0, 0, 0, /* 169 */ 0, 0, 0, /* 170 */ 0, 0, 0, /* 171 */ 0, 0, 0, /* 172 */ 0, 0, 0, /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute, /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower, /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise, /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG, /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG, /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD, /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE, /* 180 */ 0, 0, 0, /* 181 */ 0, 0, 0, /* 182 */ 0, 0, 0, /* 183 */ 0, 0, 0, /* 184 */ 0, 0, 0, /* 185 */ 0, 0, 0, /* 186 */ 0, 0, 0, /* 187 */ 0, 0, 0, /* 188 */ 0, 0, 0, /* 189 */ 0, 0, 0, /* 190 */ 0, 0, 0, /* 191 */ 0, 0, 0, /* 192 */ 0, 0, 0, /* 193 */ 0, 0, 0, /* 194 */ 0, 0, 0, /* 195 */ 0, 0, 0, /* 196 */ 0, 0, 0, /* 197 */ 0, 0, 0, /* 198 */ 0, 0, 0, /* 199 */ 0, 0, 0, /* 200 */ 0, 0, 0, /* 201 */ 0, 0, 0, /* 202 */ 0, 0, 0, /* 203 */ 0, 0, 0, /* 204 */ 0, 0, 0, /* 205 */ 0, 0, 0, /* 206 */ 0, 0, 0, /* 207 */ 0, 0, 0, /* 208 */ 0, 0, 0, /* 209 */ 0, 0, 0, /* 210 */ 0, 0, 0, /* 211 */ 0, 0, 0, /* 212 */ 0, 0, 0, /* 213 */ 0, 0, 0, /* 214 */ 0, 0, 0, /* 215 */ 0, 0, 0, /* 216 */ 0, 0, 0, /* 217 */ 0, 0, 0, /* 218 */ 0, 0, 0, /* 219 */ 0, 0, 0, /* 220 */ 0, 0, 0, /* 221 */ 0, 0, 0, /* 222 */ 0, 0, 0, /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Canadian Multilingual Standard layout */ /* 224 */ 0, 0, 0, /* 225 */ 0, 0, 0, /* 226 */ 0, 0, 0, /* 227 */ 0, 0, 0, /* 228 */ 0, 0, 0, /* 229 */ 0, 0, 0, /* 230 */ 0, 0, 0, /* 231 */ 0, 0, 0, /* 232 */ 0, 0, 0, /* 233 */ 0, 0, 0, /* 234 */ 0, 0, 0, /* 235 */ 0, 0, 0, /* 236 */ 0, 0, 0, /* 237 */ 0, 0, 0, /* 238 */ 0, 0, 0, /* 239 */ 0, 0, 0, /* 240 */ 0, 0, 0, /* 241 */ 0, 0, 0, /* 242 */ 0, 0, 0, /* 243 */ 0, 0, 0, /* 244 */ 0, 0, 0, /* 245 */ 0, 0, 0, /* 246 */ 0, 0, 0, /* 247 */ 0, 0, 0, /* 248 */ 0, 0, 0, /* 249 */ 0, 0, 0, /* 250 */ 0, 0, 0, /* 251 */ 0, 0, 0, /* 252 */ 0, 0, 0, /* 253 */ 0, 0, 0, /* 254 */ 0, 0, 0, /* 255 */ VK_FN, 0, KEY_Fn /* Most keyboards don't generate a scancode for Fn, but a few do... */ }; #endif /* WINKEYBD_H */ xorg-server-1.20.8/hw/xwin/winmouse.c0000644000175000017500000002502513640201473014427 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Dakshinamurthy Karra * Suhaib M Siddiqi * Peter Busch * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "inputstr.h" #include "exevents.h" /* for button/axes labels */ #include "xserver-properties.h" #include "inpututils.h" /* Peek the internal button mapping */ static CARD8 const *g_winMouseButtonMap = NULL; /* * Local prototypes */ static void winMouseCtrl(DeviceIntPtr pDevice, PtrCtrl * pCtrl); static void winMouseCtrl(DeviceIntPtr pDevice, PtrCtrl * pCtrl) { } /* * See Porting Layer Definition - p. 18 * This is known as a DeviceProc */ int winMouseProc(DeviceIntPtr pDeviceInt, int iState) { int lngMouseButtons, i; int lngWheelEvents = 4; CARD8 *map; DevicePtr pDevice = (DevicePtr) pDeviceInt; Atom btn_labels[9]; Atom axes_labels[2]; switch (iState) { case DEVICE_INIT: /* Get number of mouse buttons */ lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons); /* Mapping of windows events to X events: * LEFT:1 MIDDLE:2 RIGHT:3 * SCROLL_UP:4 SCROLL_DOWN:5 * TILT_LEFT:6 TILT_RIGHT:7 * XBUTTON 1:8 XBUTTON 2:9 (most commonly 'back' and 'forward') * ... * * The current Windows API only defines 2 extra buttons, so we don't * expect more than 5 buttons to be reported, but more than that * should be handled correctly */ /* * To map scroll wheel correctly we need at least the 3 normal buttons */ if (lngMouseButtons < 3) lngMouseButtons = 3; /* allocate memory: * number of buttons + 4 x mouse wheel event + 1 extra (offset for map) */ map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1)); /* initalize button map */ map[0] = 0; for (i = 1; i <= lngMouseButtons + lngWheelEvents; i++) map[i] = i; btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); btn_labels[7] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK); btn_labels[8] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_FORWARD); axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); InitPointerDeviceStruct(pDevice, map, lngMouseButtons + lngWheelEvents, btn_labels, winMouseCtrl, GetMotionHistorySize(), 2, axes_labels); free(map); g_winMouseButtonMap = pDeviceInt->button->map; break; case DEVICE_ON: pDevice->on = TRUE; break; case DEVICE_CLOSE: g_winMouseButtonMap = NULL; case DEVICE_OFF: pDevice->on = FALSE; break; } return Success; } /* Handle the mouse wheel */ int winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown) { int button; /* Do we have any previous delta stored? */ if ((*iTotalDeltaZ > 0 && iDeltaZ > 0) || (*iTotalDeltaZ < 0 && iDeltaZ < 0)) { /* Previous delta and of same sign as current delta */ iDeltaZ += *iTotalDeltaZ; *iTotalDeltaZ = 0; } else { /* * Previous delta of different sign, or zero. * We will set it to zero for either case, * as blindly setting takes just as much time * as checking, then setting if necessary :) */ *iTotalDeltaZ = 0; } /* * Only process this message if the wheel has moved further than * WHEEL_DELTA */ if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) { *iTotalDeltaZ = 0; /* Figure out how many whole deltas of the wheel we have */ iDeltaZ /= WHEEL_DELTA; } else { /* * Wheel has not moved past WHEEL_DELTA threshold; * we will store the wheel delta until the threshold * has been reached. */ *iTotalDeltaZ = iDeltaZ; return 0; } /* Set the button to indicate up or down wheel delta */ if (iDeltaZ > 0) { button = iButtonUp; } else { button = iButtonDown; } /* * Flip iDeltaZ to positive, if negative, * because always need to generate a *positive* number of * button clicks for the Z axis. */ if (iDeltaZ < 0) { iDeltaZ *= -1; } /* Generate X input messages for each wheel delta we have seen */ while (iDeltaZ--) { /* Push the wheel button */ winMouseButtonsSendEvent(ButtonPress, button); /* Release the wheel button */ winMouseButtonsSendEvent(ButtonRelease, button); } return 0; } /* * Enqueue a mouse button event */ void winMouseButtonsSendEvent(int iEventType, int iButton) { ValuatorMask mask; if (g_winMouseButtonMap) iButton = g_winMouseButtonMap[iButton]; valuator_mask_zero(&mask); QueuePointerEvents(g_pwinPointer, iEventType, iButton, POINTER_RELATIVE, &mask); #if CYGDEBUG ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d\n", iEventType, iButton); #endif } /* * Decide what to do with a Windows mouse message */ int winMouseButtonsHandle(ScreenPtr pScreen, int iEventType, int iButton, WPARAM wParam) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; /* Send button events right away if emulate 3 buttons is off */ if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF) { /* Emulate 3 buttons is off, send the button event */ winMouseButtonsSendEvent(iEventType, iButton); return 0; } /* Emulate 3 buttons is on, let the fun begin */ if (iEventType == ButtonPress && pScreenPriv->iE3BCachedPress == 0 && !pScreenPriv->fE3BFakeButton2Sent) { /* * Button was pressed, no press is cached, * and there is no fake button 2 release pending. */ /* Store button press type */ pScreenPriv->iE3BCachedPress = iButton; /* * Set a timer to send this button press if the other button * is not pressed within the timeout time. */ SetTimer(pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID, pScreenInfo->iE3BTimeout, NULL); } else if (iEventType == ButtonPress && pScreenPriv->iE3BCachedPress != 0 && pScreenPriv->iE3BCachedPress != iButton && !pScreenPriv->fE3BFakeButton2Sent) { /* * Button press is cached, other button was pressed, * and there is no fake button 2 release pending. */ /* Mouse button was cached and other button was pressed */ KillTimer(pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); pScreenPriv->iE3BCachedPress = 0; /* Send fake middle button */ winMouseButtonsSendEvent(ButtonPress, Button2); /* Indicate that a fake middle button event was sent */ pScreenPriv->fE3BFakeButton2Sent = TRUE; } else if (iEventType == ButtonRelease && pScreenPriv->iE3BCachedPress == iButton) { /* * Cached button was released before timer ran out, * and before the other mouse button was pressed. */ KillTimer(pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); pScreenPriv->iE3BCachedPress = 0; /* Send cached press, then send release */ winMouseButtonsSendEvent(ButtonPress, iButton); winMouseButtonsSendEvent(ButtonRelease, iButton); } else if (iEventType == ButtonRelease && pScreenPriv->fE3BFakeButton2Sent && !(wParam & MK_LBUTTON) && !(wParam & MK_RBUTTON)) { /* * Fake button 2 was sent and both mouse buttons have now been released */ pScreenPriv->fE3BFakeButton2Sent = FALSE; /* Send middle mouse button release */ winMouseButtonsSendEvent(ButtonRelease, Button2); } else if (iEventType == ButtonRelease && pScreenPriv->iE3BCachedPress == 0 && !pScreenPriv->fE3BFakeButton2Sent) { /* * Button was release, no button is cached, * and there is no fake button 2 release is pending. */ winMouseButtonsSendEvent(ButtonRelease, iButton); } return 0; } /** * Enqueue a motion event. * */ void winEnqueueMotion(int x, int y) { int valuators[2]; ValuatorMask mask; valuators[0] = x; valuators[1] = y; valuator_mask_set_range(&mask, 0, 2, valuators); QueuePointerEvents(g_pwinPointer, MotionNotify, 0, POINTER_ABSOLUTE | POINTER_SCREEN, &mask); } xorg-server-1.20.8/hw/xwin/winresource.h0000644000175000017500000000334313640201473015132 00000000000000#if !defined(WINRESOURCE_H) #define WINRESOURCE_H /* *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ /* * Local defines */ #define IDC_STATIC -1 #define IDI_XWIN 101 #define IDM_TRAYICON_MENU 103 #define IDC_CLIENTS_CONNECTED 104 #define ID_APP_EXIT 200 #define ID_APP_HIDE_ROOT 201 #define ID_APP_ALWAYS_ON_TOP 202 #define ID_APP_ABOUT 203 #define ID_APP_MONITOR_PRIMARY 204 #define ID_ABOUT_WEBSITE 303 #endif xorg-server-1.20.8/hw/xwin/winmultiwindowshape.c0000644000175000017500000001462013640201473016701 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" /* * winSetShapeMultiWindow - See Porting Layer Definition - p. 42 */ void winSetShapeMultiWindow(WindowPtr pWin, int kind) { ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG ErrorF("winSetShapeMultiWindow - pWin: %p kind: %i\n", pWin, kind); #endif WIN_UNWRAP(SetShape); (*pScreen->SetShape) (pWin, kind); WIN_WRAP(SetShape, winSetShapeMultiWindow); /* Update the Windows window's shape */ winReshapeMultiWindow(pWin); winUpdateRgnMultiWindow(pWin); return; } /* * winUpdateRgnMultiWindow - Local function to update a Windows window region */ void winUpdateRgnMultiWindow(WindowPtr pWin) { SetWindowRgn(winGetWindowPriv(pWin)->hWnd, winGetWindowPriv(pWin)->hRgn, TRUE); /* The system now owns the region specified by the region handle and will delete it when it is no longer needed. */ winGetWindowPriv(pWin)->hRgn = NULL; } /* * winReshapeMultiWindow - Computes the composite clipping region for a window */ void winReshapeMultiWindow(WindowPtr pWin) { int nRects; RegionRec rrNewShape; BoxPtr pShape, pRects, pEnd; HRGN hRgn, hRgnRect; winWindowPriv(pWin); #if CYGDEBUG winDebug("winReshape ()\n"); #endif /* Bail if the window is the root window */ if (pWin->parent == NULL) return; /* Bail if the window is not top level */ if (pWin->parent->parent != NULL) return; /* Bail if Windows window handle is invalid */ if (pWinPriv->hWnd == NULL) return; /* Free any existing window region stored in the window privates */ if (pWinPriv->hRgn != NULL) { DeleteObject(pWinPriv->hRgn); pWinPriv->hRgn = NULL; } /* Bail if the window has no bounding region defined */ if (!wBoundingShape(pWin)) return; RegionNull(&rrNewShape); RegionCopy(&rrNewShape, wBoundingShape(pWin)); RegionTranslate(&rrNewShape, pWin->borderWidth, pWin->borderWidth); nRects = RegionNumRects(&rrNewShape); pShape = RegionRects(&rrNewShape); /* Don't do anything if there are no rectangles in the region */ if (nRects > 0) { RECT rcClient; RECT rcWindow; int iOffsetX, iOffsetY; /* Get client rectangle */ if (!GetClientRect(pWinPriv->hWnd, &rcClient)) { ErrorF("winReshape - GetClientRect failed, bailing: %d\n", (int) GetLastError()); return; } /* Translate client rectangle coords to screen coords */ /* NOTE: Only transforms top and left members */ ClientToScreen(pWinPriv->hWnd, (LPPOINT) &rcClient); /* Get window rectangle */ if (!GetWindowRect(pWinPriv->hWnd, &rcWindow)) { ErrorF("winReshape - GetWindowRect failed, bailing: %d\n", (int) GetLastError()); return; } /* Calculate offset from window upper-left to client upper-left */ iOffsetX = rcClient.left - rcWindow.left; iOffsetY = rcClient.top - rcWindow.top; /* Create initial Windows region for title bar */ /* FIXME: Mean, nasty, ugly hack!!! */ hRgn = CreateRectRgn(0, 0, rcWindow.right, iOffsetY); if (hRgn == NULL) { ErrorF("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) " "failed: %d\n", 0, 0, (int) rcWindow.right, iOffsetY, (int) GetLastError()); } /* Loop through all rectangles in the X region */ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) { /* Create a Windows region for the X rectangle */ hRgnRect = CreateRectRgn(pRects->x1 + iOffsetX, pRects->y1 + iOffsetY, pRects->x2 + iOffsetX, pRects->y2 + iOffsetY); if (hRgnRect == NULL) { ErrorF("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) " "failed: %d\n" "\tx1: %d x2: %d xOff: %d y1: %d y2: %d yOff: %d\n", pRects->x1 + iOffsetX, pRects->y1 + iOffsetY, pRects->x2 + iOffsetX, pRects->y2 + iOffsetY, (int) GetLastError(), pRects->x1, pRects->x2, iOffsetX, pRects->y1, pRects->y2, iOffsetY); } /* Merge the Windows region with the accumulated region */ if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) { ErrorF("winReshape - CombineRgn () failed: %d\n", (int) GetLastError()); } /* Delete the temporary Windows region */ DeleteObject(hRgnRect); } /* Save a handle to the composite region in the window privates */ pWinPriv->hRgn = hRgn; } RegionUninit(&rrNewShape); return; } xorg-server-1.20.8/hw/xwin/winprefslex.c0000644000175000017500000016416013640201535015132 00000000000000 #line 2 "winprefslex.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* begin standard C++ headers. */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an * integer in range [0..255] for use as an array index. */ #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ int yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) #define YY_LINENO_REWIND_TO(dst) \ do {\ const char *p;\ for ( p = yy_cp-1; p >= (dst); --p)\ if ( *p == '\n' )\ --yylineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); void yy_delete_buffer ( YY_BUFFER_STATE b ); void yy_flush_buffer ( YY_BUFFER_STATE b ); void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); void yypop_buffer_state ( void ); static void yyensure_buffer_stack ( void ); static void yy_load_buffer_state ( void ); static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); void *yyalloc ( yy_size_t ); void *yyrealloc ( void *, yy_size_t ); void yyfree ( void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef flex_uint8_t YY_CHAR; FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr yytext static yy_state_type yy_get_previous_state ( void ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); static int yy_get_next_buffer ( void ); static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 34 #define YY_END_OF_BUFFER 35 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static const flex_int16_t yy_accept[195] = { 0, 0, 0, 35, 33, 4, 3, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 30, 31, 33, 4, 33, 0, 33, 0, 1, 1, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 32, 32, 33, 0, 2, 2, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 23, 33, 33, 33, 5, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 22, 33, 33, 25, 33, 33, 33, 8, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 13, 33, 33, 33, 33, 33, 33, 33, 33, 26, 33, 33, 33, 9, 33, 33, 33, 33, 21, 33, 33, 33, 33, 33, 16, 14, 15, 33, 33, 33, 19, 10, 33, 33, 33, 33, 33, 33, 11, 12, 17, 33, 33, 27, 33, 33, 33, 28, 33, 20, 33, 33, 33, 33, 33, 29, 24, 7, 33, 33, 33, 33, 33, 6, 18, 0 } ; static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 9, 10, 11, 12, 13, 14, 1, 15, 1, 1, 16, 17, 18, 19, 20, 1, 21, 22, 23, 24, 1, 25, 26, 27, 28, 1, 1, 1, 1, 1, 1, 29, 30, 31, 32, 33, 34, 35, 1, 36, 1, 1, 37, 38, 39, 40, 41, 1, 42, 43, 44, 45, 1, 46, 47, 48, 49, 50, 1, 51, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static const YY_CHAR yy_meta[52] = { 0, 1, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static const flex_int16_t yy_base[202] = { 0, 0, 0, 384, 0, 381, 415, 50, 54, 375, 37, 35, 47, 35, 43, 53, 56, 46, 42, 57, 86, 51, 0, 0, 0, 377, 94, 373, 75, 91, 415, 99, 102, 42, 88, 84, 99, 99, 93, 96, 90, 99, 100, 127, 97, 107, 105, 105, 110, 100, 120, 123, 141, 0, 415, 149, 151, 415, 153, 150, 141, 137, 139, 141, 158, 157, 158, 151, 157, 149, 159, 154, 161, 161, 159, 159, 176, 173, 175, 175, 183, 174, 175, 193, 199, 189, 195, 186, 0, 199, 204, 197, 0, 199, 209, 195, 204, 212, 207, 206, 215, 222, 230, 224, 229, 224, 0, 228, 233, 0, 235, 240, 238, 0, 241, 242, 241, 243, 242, 250, 250, 258, 245, 247, 257, 254, 274, 266, 263, 0, 265, 265, 271, 265, 266, 283, 286, 287, 0, 282, 278, 290, 0, 279, 281, 289, 292, 0, 296, 302, 314, 315, 316, 0, 0, 0, 306, 314, 308, 0, 0, 317, 313, 327, 313, 318, 332, 0, 0, 0, 322, 329, 0, 326, 327, 328, 0, 329, 0, 330, 339, 342, 351, 350, 0, 0, 0, 358, 351, 357, 349, 353, 0, 0, 415, 72, 398, 400, 403, 405, 408, 411 } ; static const flex_int16_t yy_def[202] = { 0, 194, 1, 194, 195, 194, 194, 196, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 194, 196, 198, 197, 199, 194, 199, 200, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 194, 200, 201, 194, 201, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 0, 194, 194, 194, 194, 194, 194, 194 } ; static const flex_int16_t yy_nxt[467] = { 0, 4, 5, 6, 6, 7, 8, 9, 10, 11, 4, 12, 13, 14, 4, 15, 4, 16, 17, 18, 4, 19, 20, 21, 4, 4, 4, 4, 4, 10, 11, 4, 12, 13, 14, 4, 15, 4, 16, 17, 18, 4, 19, 20, 21, 4, 4, 4, 4, 4, 22, 23, 27, 33, 35, 24, 29, 30, 31, 36, 34, 37, 38, 39, 40, 43, 44, 59, 41, 45, 51, 42, 52, 24, 33, 35, 46, 29, 30, 31, 36, 34, 37, 38, 39, 40, 43, 44, 59, 41, 45, 51, 42, 52, 30, 31, 27, 46, 47, 53, 60, 48, 30, 31, 56, 57, 58, 62, 63, 49, 61, 65, 64, 50, 66, 67, 68, 69, 70, 47, 73, 60, 48, 74, 75, 76, 77, 78, 62, 63, 49, 61, 65, 64, 50, 66, 67, 68, 69, 70, 71, 73, 79, 80, 74, 75, 76, 77, 78, 81, 72, 56, 57, 58, 57, 58, 57, 58, 82, 83, 84, 71, 85, 79, 80, 86, 87, 88, 89, 90, 81, 72, 91, 92, 93, 94, 95, 96, 97, 82, 83, 84, 98, 85, 99, 100, 86, 87, 88, 89, 90, 101, 102, 91, 92, 93, 94, 95, 96, 97, 103, 104, 105, 98, 106, 99, 100, 107, 108, 109, 110, 111, 101, 102, 114, 112, 115, 116, 117, 118, 119, 103, 104, 105, 120, 106, 113, 121, 107, 108, 109, 110, 111, 122, 123, 114, 112, 115, 116, 117, 118, 119, 124, 125, 126, 120, 127, 113, 121, 128, 129, 130, 131, 132, 122, 123, 133, 134, 135, 136, 137, 138, 139, 124, 125, 126, 140, 127, 141, 142, 128, 129, 130, 131, 132, 143, 144, 133, 134, 135, 136, 137, 138, 139, 145, 146, 147, 140, 148, 141, 142, 149, 150, 151, 152, 153, 143, 144, 154, 155, 156, 157, 158, 159, 160, 145, 146, 147, 161, 148, 162, 163, 149, 150, 151, 152, 153, 165, 164, 154, 155, 156, 157, 158, 159, 160, 166, 167, 168, 161, 169, 162, 163, 170, 171, 172, 173, 174, 165, 164, 175, 176, 177, 178, 179, 180, 181, 166, 167, 168, 182, 169, 183, 184, 170, 171, 172, 173, 174, 185, 186, 175, 176, 177, 178, 179, 180, 181, 187, 188, 189, 182, 190, 183, 184, 191, 192, 193, 54, 25, 185, 186, 32, 25, 194, 194, 194, 194, 194, 187, 188, 189, 194, 190, 194, 194, 191, 192, 193, 26, 26, 28, 28, 28, 27, 27, 29, 29, 29, 55, 55, 55, 56, 56, 56, 3, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194 } ; static const flex_int16_t yy_chk[467] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 10, 11, 7, 8, 8, 8, 12, 10, 13, 14, 15, 16, 17, 18, 33, 16, 19, 21, 16, 21, 195, 10, 11, 19, 28, 28, 28, 12, 10, 13, 14, 15, 16, 17, 18, 33, 16, 19, 21, 16, 21, 29, 29, 26, 19, 20, 26, 34, 20, 31, 31, 32, 32, 32, 35, 36, 20, 34, 37, 36, 20, 38, 39, 40, 41, 42, 20, 44, 34, 20, 45, 46, 47, 48, 49, 35, 36, 20, 34, 37, 36, 20, 38, 39, 40, 41, 42, 43, 44, 50, 51, 45, 46, 47, 48, 49, 52, 43, 55, 55, 55, 56, 56, 58, 58, 59, 60, 61, 43, 62, 50, 51, 63, 64, 65, 66, 67, 52, 43, 68, 69, 70, 71, 72, 73, 74, 59, 60, 61, 75, 62, 76, 77, 63, 64, 65, 66, 67, 78, 79, 68, 69, 70, 71, 72, 73, 74, 80, 81, 82, 75, 83, 76, 77, 84, 85, 86, 87, 89, 78, 79, 91, 90, 93, 94, 95, 96, 97, 80, 81, 82, 98, 83, 90, 99, 84, 85, 86, 87, 89, 100, 101, 91, 90, 93, 94, 95, 96, 97, 102, 103, 104, 98, 105, 90, 99, 107, 108, 110, 111, 112, 100, 101, 114, 115, 116, 117, 118, 119, 120, 102, 103, 104, 121, 105, 122, 123, 107, 108, 110, 111, 112, 124, 125, 114, 115, 116, 117, 118, 119, 120, 126, 127, 128, 121, 130, 122, 123, 131, 132, 133, 134, 135, 124, 125, 136, 137, 139, 140, 141, 143, 144, 126, 127, 128, 145, 130, 146, 148, 131, 132, 133, 134, 135, 149, 148, 136, 137, 139, 140, 141, 143, 144, 150, 151, 152, 145, 156, 146, 148, 157, 158, 161, 162, 163, 149, 148, 164, 165, 166, 170, 171, 173, 174, 150, 151, 152, 175, 156, 177, 179, 157, 158, 161, 162, 163, 180, 181, 164, 165, 166, 170, 171, 173, 174, 182, 183, 187, 175, 188, 177, 179, 189, 190, 191, 27, 25, 180, 181, 9, 5, 3, 0, 0, 0, 0, 182, 183, 187, 0, 188, 0, 0, 189, 190, 191, 196, 196, 197, 197, 197, 198, 198, 199, 199, 199, 200, 200, 200, 201, 201, 201, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194 } ; /* Table of booleans, true if rule could match eol. */ static const flex_int32_t yy_rule_can_match_eol[35] = { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "winprefslex.l" #line 2 "winprefslex.l" /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * Copyright (C) Colin Harrison 2005-2008 * * 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. * * Authors: Earle F. Philhower, III * Colin Harrison */ /* $XFree86: $ */ #include #include #include #include "winprefsyacc.h" extern void ErrorF (const char* /*f*/, ...); /* Copy the parsed string, must be free()d in yacc parser */ static char *makestr(char *str) { char *ptr; ptr = malloc(strlen(str)+1); if (!ptr) { ErrorF ("winMultiWindowLex:makestr() out of memory\n"); exit (-1); } strcpy(ptr, str); return ptr; } #line 690 "winprefslex.c" #define YY_NO_INPUT 1 #line 692 "winprefslex.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy ( void ); int yyget_debug ( void ); void yyset_debug ( int debug_flag ); YY_EXTRA_TYPE yyget_extra ( void ); void yyset_extra ( YY_EXTRA_TYPE user_defined ); FILE *yyget_in ( void ); void yyset_in ( FILE * _in_str ); FILE *yyget_out ( void ); void yyset_out ( FILE * _out_str ); int yyget_leng ( void ); char *yyget_text ( void ); int yyget_lineno ( void ); void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap ( void ); #else extern int yywrap ( void ); #endif #endif #ifndef YY_NO_UNPUT #endif #ifndef yytext_ptr static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput ( void ); #else static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_load_buffer_state( ); } { #line 63 "winprefslex.l" #line 909 "winprefslex.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 195 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 194 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { int yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) yylineno++; ; } do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 64 "winprefslex.l" { /* comment */ return NEWLINE; } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP #line 65 "winprefslex.l" { /* comment */ return NEWLINE; } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP #line 66 "winprefslex.l" { return NEWLINE; } YY_BREAK case 4: YY_RULE_SETUP #line 67 "winprefslex.l" { /* ignore whitespace */ } YY_BREAK case 5: YY_RULE_SETUP #line 68 "winprefslex.l" { return MENU; } YY_BREAK case 6: YY_RULE_SETUP #line 69 "winprefslex.l" { return ICONDIRECTORY; } YY_BREAK case 7: YY_RULE_SETUP #line 70 "winprefslex.l" { return DEFAULTICON; } YY_BREAK case 8: YY_RULE_SETUP #line 71 "winprefslex.l" { return ICONS; } YY_BREAK case 9: YY_RULE_SETUP #line 72 "winprefslex.l" { return STYLES; } YY_BREAK case 10: YY_RULE_SETUP #line 73 "winprefslex.l" { return TOPMOST; } YY_BREAK case 11: YY_RULE_SETUP #line 74 "winprefslex.l" { return MAXIMIZE; } YY_BREAK case 12: YY_RULE_SETUP #line 75 "winprefslex.l" { return MINIMIZE; } YY_BREAK case 13: YY_RULE_SETUP #line 76 "winprefslex.l" { return BOTTOM; } YY_BREAK case 14: YY_RULE_SETUP #line 77 "winprefslex.l" { return NOTITLE; } YY_BREAK case 15: YY_RULE_SETUP #line 78 "winprefslex.l" { return OUTLINE; } YY_BREAK case 16: YY_RULE_SETUP #line 79 "winprefslex.l" { return NOFRAME; } YY_BREAK case 17: YY_RULE_SETUP #line 80 "winprefslex.l" { return ROOTMENU; } YY_BREAK case 18: YY_RULE_SETUP #line 81 "winprefslex.l" { return DEFAULTSYSMENU; } YY_BREAK case 19: YY_RULE_SETUP #line 82 "winprefslex.l" { return SYSMENU; } YY_BREAK case 20: YY_RULE_SETUP #line 83 "winprefslex.l" { return SEPARATOR; } YY_BREAK case 21: YY_RULE_SETUP #line 84 "winprefslex.l" { return ATSTART; } YY_BREAK case 22: YY_RULE_SETUP #line 85 "winprefslex.l" { return ATEND; } YY_BREAK case 23: YY_RULE_SETUP #line 86 "winprefslex.l" { return EXEC; } YY_BREAK case 24: YY_RULE_SETUP #line 87 "winprefslex.l" { return ALWAYSONTOP; } YY_BREAK case 25: YY_RULE_SETUP #line 88 "winprefslex.l" { return DEBUGOUTPUT; } YY_BREAK case 26: YY_RULE_SETUP #line 89 "winprefslex.l" { return RELOAD; } YY_BREAK case 27: YY_RULE_SETUP #line 90 "winprefslex.l" { return TRAYICON; } YY_BREAK case 28: YY_RULE_SETUP #line 91 "winprefslex.l" { return FORCEEXIT; } YY_BREAK case 29: YY_RULE_SETUP #line 92 "winprefslex.l" { return SILENTEXIT; } YY_BREAK case 30: YY_RULE_SETUP #line 93 "winprefslex.l" { return LB; } YY_BREAK case 31: YY_RULE_SETUP #line 94 "winprefslex.l" { return RB; } YY_BREAK case 32: YY_RULE_SETUP #line 95 "winprefslex.l" { yylval.sVal = makestr(yytext+1); \ yylval.sVal[strlen(yylval.sVal)-1] = 0; \ return STRING; } YY_BREAK case 33: YY_RULE_SETUP #line 98 "winprefslex.l" { yylval.sVal = makestr(yytext); \ return STRING; } YY_BREAK case 34: YY_RULE_SETUP #line 100 "winprefslex.l" ECHO; YY_BREAK #line 1148 "winprefslex.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc( (void *) b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); /* "- 2" to take care of EOB's */ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 195 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 195 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 194); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) yylineno++; ; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_init_buffer( YY_CURRENT_BUFFER, input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree( (void *) b->yy_ch_buf ); yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return NULL; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (const char * yystr ) { return yy_scan_bytes( yystr, (int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yynoreturn yy_fatal_error (const char* msg ) { fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param _line_number line number * */ void yyset_lineno (int _line_number ) { yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str ) { yyin = _in_str ; } void yyset_out (FILE * _out_str ) { yyout = _out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int _bdebug ) { yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ /* We do not touch yylineno unless the option is enabled. */ yylineno = 1; (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = NULL; yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return realloc(ptr, size); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 100 "winprefslex.l" /* * Run-of-the mill requirement for yacc */ int yywrap (void) { return 1; } /* * Run a file through the yacc parser */ int parse_file (FILE *file) { int ret; if (!file) return 1; yylineno = 1; yyin = file; ret = yyparse (); yylex_destroy (); return ret; } xorg-server-1.20.8/hw/xwin/winclipboardinit.c0000644000175000017500000001002713640201473016116 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include #include #include "win.h" #include "winclipboard/winclipboard.h" #include "windisplay.h" #define WIN_CLIPBOARD_RETRIES 40 #define WIN_CLIPBOARD_DELAY 1 /* * Local variables */ static pthread_t g_ptClipboardProc; /* * */ static void * winClipboardThreadProc(void *arg) { char szDisplay[512]; int clipboardRestarts = 0; while (1) { Bool fShutdown; ++clipboardRestarts; /* Use our generated cookie for authentication */ winSetAuthorization(); /* Setup the display connection string */ /* * NOTE: Always connect to screen 0 since we require that screen * numbers start at 0 and increase without gaps. We only need * to connect to one screen on the display to get events * for all screens on the display. That is why there is only * one clipboard client thread. */ winGetDisplayName(szDisplay, 0); /* Print the display connection string */ ErrorF("winClipboardThreadProc - DISPLAY=%s\n", szDisplay); /* Flag that clipboard client has been launched */ g_fClipboardStarted = TRUE; fShutdown = winClipboardProc(g_fUnicodeClipboard, szDisplay); /* Flag that clipboard client has stopped */ g_fClipboardStarted = FALSE; if (fShutdown) break; /* checking if we need to restart */ if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES) { /* terminates clipboard thread but the main server still lives */ ErrorF("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n", clipboardRestarts); g_fClipboard = FALSE; break; } sleep(WIN_CLIPBOARD_DELAY); ErrorF("winClipboardProc - trying to restart clipboard thread \n"); } return NULL; } /* * Intialize the Clipboard module */ Bool winInitClipboard(void) { winDebug("winInitClipboard ()\n"); /* Spawn a thread for the Clipboard module */ if (pthread_create(&g_ptClipboardProc, NULL, winClipboardThreadProc, NULL)) { /* Bail if thread creation failed */ ErrorF("winInitClipboard - pthread_create failed.\n"); return FALSE; } return TRUE; } void winClipboardShutdown(void) { /* Close down clipboard resources */ if (g_fClipboard && g_fClipboardStarted) { /* Synchronously destroy the clipboard window */ winClipboardWindowDestroy(); /* Wait for the clipboard thread to exit */ pthread_join(g_ptClipboardProc, NULL); g_fClipboardStarted = FALSE; winDebug("winClipboardShutdown - Clipboard thread has exited.\n"); } } xorg-server-1.20.8/hw/xwin/winclipboardwrappers.c0000644000175000017500000001150213640201473017015 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *Copyright (C) Colin Harrison 2005-2008 * *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 HAROLD L HUNT II 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: Harold L Hunt II * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "dixstruct.h" /* * Local function prototypes */ DISPATCH_PROC(winProcEstablishConnection); /* * Wrapper for internal EstablishConnection function. * Initializes internal clients that must not be started until * an external client has connected. */ int winProcEstablishConnection(ClientPtr client) { int iReturn; static int s_iCallCount = 0; static unsigned long s_ulServerGeneration = 0; if (s_iCallCount == 0) winDebug("winProcEstablishConnection - Hello\n"); /* Do nothing if clipboard is not enabled */ if (!g_fClipboard) { ErrorF("winProcEstablishConnection - Clipboard is not enabled, " "returning.\n"); /* Unwrap the original function, call it, and return */ InitialVector[2] = winProcEstablishConnectionOrig; iReturn = (*winProcEstablishConnectionOrig) (client); winProcEstablishConnectionOrig = NULL; return iReturn; } /* Watch for server reset */ if (s_ulServerGeneration != serverGeneration) { /* Save new generation number */ s_ulServerGeneration = serverGeneration; /* Reset call count */ s_iCallCount = 0; } /* Increment call count */ ++s_iCallCount; /* * This procedure is only used for initialization. * We can unwrap the original procedure at this point * so that this function is no longer called until the * server resets and the function is wrapped again. */ InitialVector[2] = winProcEstablishConnectionOrig; /* * Call original function and bail if it fails. * NOTE: We must do this first, since we need XdmcpOpenDisplay * to be called before we initialize our clipboard client. */ iReturn = (*winProcEstablishConnectionOrig) (client); if (iReturn != 0) { ErrorF("winProcEstablishConnection - ProcEstablishConnection " "failed, bailing.\n"); return iReturn; } /* Clear original function pointer */ winProcEstablishConnectionOrig = NULL; /* Startup the clipboard client if clipboard mode is being used */ if (g_fClipboard) { /* * NOTE: The clipboard client is started here for a reason: * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%) * 2) If the clipboard client attaches during X Server startup, * then it becomes the "magic client" that causes the X Server * to reset if it exits. * 3) XDMCP calls KillAllClients when it starts up. * 4) The clipboard client is a client, so it is killed. * 5) The clipboard client is the "magic client", so the X Server * resets itself. * 6) This repeats ad infinitum. * 7) We avoid this by waiting until at least one client (could * be XDM, could be another client) connects, which makes it * almost certain that the clipboard client will not connect * until after XDM when using XDMCP. */ /* Create the clipboard client thread */ if (!winInitClipboard()) { ErrorF("winProcEstablishConnection - winClipboardInit " "failed.\n"); return iReturn; } ErrorF("winProcEstablishConnection - winInitClipboard returned.\n"); } return iReturn; } xorg-server-1.20.8/hw/xwin/winengine.c0000644000175000017500000002037113640201473014543 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" /* * Global variables for function pointers into * dynamically loaded libraries */ FARPROC g_fpDirectDrawCreate = NULL; FARPROC g_fpDirectDrawCreateClipper = NULL; /* module handle for dynamically loaded directdraw library */ static HMODULE g_hmodDirectDraw = NULL; /* * Detect engines supported by current Windows version * DirectDraw version and hardware */ void winDetectSupportedEngines(void) { /* Initialize the engine support flags */ g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI; /* Do we have DirectDraw? */ if (g_hmodDirectDraw != NULL) { LPDIRECTDRAW lpdd = NULL; LPDIRECTDRAW4 lpdd4 = NULL; HRESULT ddrval; /* Was the DirectDrawCreate function found? */ if (g_fpDirectDrawCreate == NULL) { /* No DirectDraw support */ return; } /* DirectDrawCreate exists, try to call it */ /* Create a DirectDraw object, store the address at lpdd */ ddrval = (*g_fpDirectDrawCreate) (NULL, (void **) &lpdd, NULL); if (FAILED(ddrval)) { /* No DirectDraw support */ winErrorFVerb(2, "winDetectSupportedEngines - DirectDraw not installed\n"); return; } /* Try to query for DirectDraw4 interface */ ddrval = IDirectDraw_QueryInterface(lpdd, &IID_IDirectDraw4, (LPVOID *) &lpdd4); if (SUCCEEDED(ddrval)) { /* We have DirectDraw4 */ winErrorFVerb(2, "winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL\n"); g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL; } /* Cleanup DirectDraw interfaces */ if (lpdd4 != NULL) IDirectDraw_Release(lpdd4); if (lpdd != NULL) IDirectDraw_Release(lpdd); } winErrorFVerb(2, "winDetectSupportedEngines - Returning, supported engines %08x\n", (unsigned int) g_dwEnginesSupported); } /* * Set the engine type, depending on the engines * supported for this screen, and whether the user * suggested an engine type */ Bool winSetEngine(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; HDC hdc; DWORD dwBPP; /* Get a DC */ hdc = GetDC(NULL); if (hdc == NULL) { ErrorF("winSetEngine - Couldn't get an HDC\n"); return FALSE; } /* * pScreenInfo->dwBPP may be 0 to indicate that the current screen * depth is to be used. Thus, we must query for the current display * depth here. */ dwBPP = GetDeviceCaps(hdc, BITSPIXEL); /* Release the DC */ ReleaseDC(NULL, hdc); hdc = NULL; /* ShadowGDI is the only engine that supports windowed PseudoColor */ if (dwBPP == 8 && !pScreenInfo->fFullScreen) { winErrorFVerb(2, "winSetEngine - Windowed && PseudoColor => ShadowGDI\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; /* Set engine function pointers */ winSetEngineFunctionsShadowGDI(pScreen); return TRUE; } /* ShadowGDI is the only engine that supports Multi Window Mode */ if (FALSE #ifdef XWIN_MULTIWINDOWEXTWM || pScreenInfo->fMWExtWM #endif || pScreenInfo->fMultiWindow ) { winErrorFVerb(2, "winSetEngine - Multi Window or Rootless => ShadowGDI\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; /* Set engine function pointers */ winSetEngineFunctionsShadowGDI(pScreen); return TRUE; } /* If the user's choice is supported, we'll use that */ if (g_dwEnginesSupported & pScreenInfo->dwEnginePreferred) { winErrorFVerb(2, "winSetEngine - Using user's preference: %d\n", (int) pScreenInfo->dwEnginePreferred); pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred; /* Setup engine function pointers */ switch (pScreenInfo->dwEngine) { case WIN_SERVER_SHADOW_GDI: winSetEngineFunctionsShadowGDI(pScreen); break; case WIN_SERVER_SHADOW_DDNL: winSetEngineFunctionsShadowDDNL(pScreen); break; default: FatalError("winSetEngine - Invalid engine type\n"); } return TRUE; } /* ShadowDDNL has good performance, so why not */ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) { winErrorFVerb(2, "winSetEngine - Using Shadow DirectDraw NonLocking\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL; /* Set engine function pointers */ winSetEngineFunctionsShadowDDNL(pScreen); return TRUE; } /* ShadowGDI is next in line */ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI) { winErrorFVerb(2, "winSetEngine - Using Shadow GDI DIB\n"); pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; /* Set engine function pointers */ winSetEngineFunctionsShadowGDI(pScreen); return TRUE; } return FALSE; } /* * Get procedure addresses for DirectDrawCreate and DirectDrawCreateClipper */ Bool winGetDDProcAddresses(void) { Bool fReturn = TRUE; /* Load the DirectDraw library */ g_hmodDirectDraw = LoadLibraryEx("ddraw.dll", NULL, 0); if (g_hmodDirectDraw == NULL) { ErrorF("winGetDDProcAddresses - Could not load ddraw.dll\n"); fReturn = TRUE; goto winGetDDProcAddresses_Exit; } /* Try to get the DirectDrawCreate address */ g_fpDirectDrawCreate = GetProcAddress(g_hmodDirectDraw, "DirectDrawCreate"); if (g_fpDirectDrawCreate == NULL) { ErrorF("winGetDDProcAddresses - Could not get DirectDrawCreate " "address\n"); fReturn = TRUE; goto winGetDDProcAddresses_Exit; } /* Try to get the DirectDrawCreateClipper address */ g_fpDirectDrawCreateClipper = GetProcAddress(g_hmodDirectDraw, "DirectDrawCreateClipper"); if (g_fpDirectDrawCreateClipper == NULL) { ErrorF("winGetDDProcAddresses - Could not get " "DirectDrawCreateClipper address\n"); fReturn = FALSE; goto winGetDDProcAddresses_Exit; } /* * Note: Do not unload ddraw.dll here. Do it in GiveUp */ winGetDDProcAddresses_Exit: /* Unload the DirectDraw library if we failed to initialize */ if (!fReturn && g_hmodDirectDraw != NULL) { FreeLibrary(g_hmodDirectDraw); g_hmodDirectDraw = NULL; } return fReturn; } void winReleaseDDProcAddresses(void) { if (g_hmodDirectDraw != NULL) { FreeLibrary(g_hmodDirectDraw); g_hmodDirectDraw = NULL; g_fpDirectDrawCreate = NULL; g_fpDirectDrawCreateClipper = NULL; } } xorg-server-1.20.8/hw/xwin/ddraw.h0000644000175000017500000040316313640201473013672 00000000000000#ifdef __MINGW64_VERSION_MAJOR #include_next #define __XWIN_DDRAW_H #endif #ifndef __XWIN_DDRAW_H #define __XWIN_DDRAW_H #include #include #include #if defined(NONAMELESSUNION) && !defined(DUMMYUNIONNAME1) #define DUMMYUNIONNAME1 u1 #endif #define ICOM_CALL_( xfn, p, args) (p)->lpVtbl->xfn args #ifdef UNICODE #define WINELIB_NAME_AW(func) func##W #else #define WINELIB_NAME_AW(func) func##A #endif /* UNICODE */ #define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ #ifndef DIRECTDRAW_VERSION #define DIRECTDRAW_VERSION 0x0700 #endif /* DIRECTDRAW_VERSION */ /***************************************************************************** * Predeclare the interfaces */ DEFINE_GUID(CLSID_DirectDraw, 0xD7B70EE0, 0x4340, 0x11CF, 0xB0, 0x63, 0x00, 0x20, 0xAF, 0xC2, 0xCD, 0x35); DEFINE_GUID(CLSID_DirectDraw7, 0x3C305196, 0x50DB, 0x11D3, 0x9C, 0xFE, 0x00, 0xC0, 0x4F, 0xD9, 0x30, 0xC5); DEFINE_GUID(CLSID_DirectDrawClipper, 0x593817A0, 0x7DB3, 0x11CF, 0xA2, 0xDE, 0x00, 0xAA, 0x00, 0xb9, 0x33, 0x56); DEFINE_GUID(IID_IDirectDraw, 0x6C14DB80, 0xA733, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); DEFINE_GUID(IID_IDirectDraw2, 0xB3A6F3E0, 0x2B43, 0x11CF, 0xA2, 0xDE, 0x00, 0xAA, 0x00, 0xB9, 0x33, 0x56); DEFINE_GUID(IID_IDirectDraw4, 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00, 0xc0, 0x4f, 0xd9, 0x30, 0xc5); DEFINE_GUID(IID_IDirectDraw7, 0x15e65ec0, 0x3b9c, 0x11d2, 0xb9, 0x2f, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b); DEFINE_GUID(IID_IDirectDrawSurface, 0x6C14DB81, 0xA733, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); DEFINE_GUID(IID_IDirectDrawSurface2, 0x57805885, 0x6eec, 0x11cf, 0x94, 0x41, 0xa8, 0x23, 0x03, 0xc1, 0x0e, 0x27); DEFINE_GUID(IID_IDirectDrawSurface3, 0xDA044E00, 0x69B2, 0x11D0, 0xA1, 0xD5, 0x00, 0xAA, 0x00, 0xB8, 0xDF, 0xBB); DEFINE_GUID(IID_IDirectDrawSurface4, 0x0B2B8630, 0xAD35, 0x11D0, 0x8E, 0xA6, 0x00, 0x60, 0x97, 0x97, 0xEA, 0x5B); DEFINE_GUID(IID_IDirectDrawSurface7, 0x06675a80, 0x3b9b, 0x11d2, 0xb9, 0x2f, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b); DEFINE_GUID(IID_IDirectDrawPalette, 0x6C14DB84, 0xA733, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); DEFINE_GUID(IID_IDirectDrawClipper, 0x6C14DB85, 0xA733, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); DEFINE_GUID(IID_IDirectDrawColorControl, 0x4B9F0EE0, 0x0D7E, 0x11D0, 0x9B, 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8); DEFINE_GUID(IID_IDirectDrawGammaControl, 0x69C11C3E, 0xB46B, 0x11D1, 0xAD, 0x7A, 0x00, 0xC0, 0x4F, 0xC2, 0x9B, 0x4E); typedef struct IDirectDraw *LPDIRECTDRAW; typedef struct IDirectDraw2 *LPDIRECTDRAW2; typedef struct IDirectDraw4 *LPDIRECTDRAW4; typedef struct IDirectDraw7 *LPDIRECTDRAW7; typedef struct IDirectDrawClipper *LPDIRECTDRAWCLIPPER; typedef struct IDirectDrawPalette *LPDIRECTDRAWPALETTE; typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE; typedef struct IDirectDrawSurface2 *LPDIRECTDRAWSURFACE2; typedef struct IDirectDrawSurface3 *LPDIRECTDRAWSURFACE3; typedef struct IDirectDrawSurface4 *LPDIRECTDRAWSURFACE4; typedef struct IDirectDrawSurface7 *LPDIRECTDRAWSURFACE7; typedef struct IDirectDrawColorControl *LPDIRECTDRAWCOLORCONTROL; typedef struct IDirectDrawGammaControl *LPDIRECTDRAWGAMMACONTROL; #define DDENUMRET_CANCEL 0 #define DDENUMRET_OK 1 #define DD_OK 0 #define _FACDD 0x876 #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) #define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) #define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) #define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) #define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) #define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) #define DDERR_GENERIC E_FAIL #define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) #define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) #define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) #define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) #define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) #define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) #define DDERR_INVALIDPARAMS E_INVALIDARG #define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) #define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) #define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) #define DDERR_NO3D MAKE_DDHRESULT( 170 ) #define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) #define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 ) #define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 ) #define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) #define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) #define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) #define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) #define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) #define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) #define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) #define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) #define DDERR_NOGDI MAKE_DDHRESULT( 240 ) #define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) #define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) #define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) #define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 ) #define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) #define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) #define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) #define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) #define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) #define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) #define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) #define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) #define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) #define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) #define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) #define DDERR_OUTOFMEMORY E_OUTOFMEMORY #define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) #define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) #define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) #define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) #define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) #define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) #define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) #define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) #define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) #define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) #define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) #define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) #define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) #define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) #define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) #define DDERR_UNSUPPORTED E_NOTIMPL #define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) #define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) #define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 ) #define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) #define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) #define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 ) #define DDERR_XALIGN MAKE_DDHRESULT( 560 ) #define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) #define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) #define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) #define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) #define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) #define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) #define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) #define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) #define DDERR_NOHWND MAKE_DDHRESULT( 569 ) #define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) #define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) #define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) #define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) #define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) #define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) #define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) #define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) #define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) #define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) #define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) #define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) #define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) #define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) #define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) #define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) #define DDERR_NODC MAKE_DDHRESULT( 586 ) #define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) #define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) #define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) #define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) #define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) #define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) #define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) #define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) #define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) #define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 ) #define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) #define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 ) #define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) #define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) #define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) #define DDERR_MOREDATA MAKE_DDHRESULT( 690 ) #define DDERR_EXPIRED MAKE_DDHRESULT( 691 ) #define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 ) #define DDERR_NEWMODE MAKE_DDHRESULT( 693 ) #define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 ) #define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) #define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 ) #define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 ) #define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) #define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED /* dwFlags for Blt* */ #define DDBLT_ALPHADEST 0x00000001 #define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002 #define DDBLT_ALPHADESTNEG 0x00000004 #define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008 #define DDBLT_ALPHAEDGEBLEND 0x00000010 #define DDBLT_ALPHASRC 0x00000020 #define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040 #define DDBLT_ALPHASRCNEG 0x00000080 #define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100 #define DDBLT_ASYNC 0x00000200 #define DDBLT_COLORFILL 0x00000400 #define DDBLT_DDFX 0x00000800 #define DDBLT_DDROPS 0x00001000 #define DDBLT_KEYDEST 0x00002000 #define DDBLT_KEYDESTOVERRIDE 0x00004000 #define DDBLT_KEYSRC 0x00008000 #define DDBLT_KEYSRCOVERRIDE 0x00010000 #define DDBLT_ROP 0x00020000 #define DDBLT_ROTATIONANGLE 0x00040000 #define DDBLT_ZBUFFER 0x00080000 #define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000 #define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000 #define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000 #define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000 #define DDBLT_WAIT 0x01000000 #define DDBLT_DEPTHFILL 0x02000000 #define DDBLT_DONOTWAIT 0x08000000 /* dwTrans for BltFast */ #define DDBLTFAST_NOCOLORKEY 0x00000000 #define DDBLTFAST_SRCCOLORKEY 0x00000001 #define DDBLTFAST_DESTCOLORKEY 0x00000002 #define DDBLTFAST_WAIT 0x00000010 #define DDBLTFAST_DONOTWAIT 0x00000020 /* dwFlags for Flip */ #define DDFLIP_WAIT 0x00000001 #define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ #define DDFLIP_ODD 0x00000004 /* only valid for overlay */ #define DDFLIP_NOVSYNC 0x00000008 #define DDFLIP_STEREO 0x00000010 #define DDFLIP_DONOTWAIT 0x00000020 /* dwFlags for GetBltStatus */ #define DDGBS_CANBLT 0x00000001 #define DDGBS_ISBLTDONE 0x00000002 /* dwFlags for IDirectDrawSurface7::GetFlipStatus */ #define DDGFS_CANFLIP 1L #define DDGFS_ISFLIPDONE 2L /* dwFlags for IDirectDrawSurface7::SetPrivateData */ #define DDSPD_IUNKNOWNPTR 1L #define DDSPD_VOLATILE 2L /* DDSCAPS.dwCaps */ /* reserved1, was 3d capable */ #define DDSCAPS_RESERVED1 0x00000001 /* surface contains alpha information */ #define DDSCAPS_ALPHA 0x00000002 /* this surface is a backbuffer */ #define DDSCAPS_BACKBUFFER 0x00000004 /* complex surface structure */ #define DDSCAPS_COMPLEX 0x00000008 /* part of surface flipping structure */ #define DDSCAPS_FLIP 0x00000010 /* this surface is the frontbuffer surface */ #define DDSCAPS_FRONTBUFFER 0x00000020 /* this is a plain offscreen surface */ #define DDSCAPS_OFFSCREENPLAIN 0x00000040 /* overlay */ #define DDSCAPS_OVERLAY 0x00000080 /* palette objects can be created and attached to us */ #define DDSCAPS_PALETTE 0x00000100 /* primary surface (the one the user looks at currently)(right eye)*/ #define DDSCAPS_PRIMARYSURFACE 0x00000200 /* primary surface for left eye */ #define DDSCAPS_PRIMARYSURFACELEFT 0x00000400 /* surface exists in systemmemory */ #define DDSCAPS_SYSTEMMEMORY 0x00000800 /* surface can be used as a texture */ #define DDSCAPS_TEXTURE 0x00001000 /* surface may be destination for 3d rendering */ #define DDSCAPS_3DDEVICE 0x00002000 /* surface exists in videomemory */ #define DDSCAPS_VIDEOMEMORY 0x00004000 /* surface changes immediately visible */ #define DDSCAPS_VISIBLE 0x00008000 /* write only surface */ #define DDSCAPS_WRITEONLY 0x00010000 /* zbuffer surface */ #define DDSCAPS_ZBUFFER 0x00020000 /* has its own DC */ #define DDSCAPS_OWNDC 0x00040000 /* surface should be able to receive live video */ #define DDSCAPS_LIVEVIDEO 0x00080000 /* should be able to have a hw codec decompress stuff into it */ #define DDSCAPS_HWCODEC 0x00100000 /* mode X (320x200 or 320x240) surface */ #define DDSCAPS_MODEX 0x00200000 /* one mipmap surface (1 level) */ #define DDSCAPS_MIPMAP 0x00400000 #define DDSCAPS_RESERVED2 0x00800000 /* memory allocation delayed until Load() */ #define DDSCAPS_ALLOCONLOAD 0x04000000 /* Indicates that the surface will receive data from a video port */ #define DDSCAPS_VIDEOPORT 0x08000000 /* surface is in local videomemory */ #define DDSCAPS_LOCALVIDMEM 0x10000000 /* surface is in nonlocal videomemory */ #define DDSCAPS_NONLOCALVIDMEM 0x20000000 /* surface is a standard VGA mode surface (NOT ModeX) */ #define DDSCAPS_STANDARDVGAMODE 0x40000000 /* optimized? surface */ #define DDSCAPS_OPTIMIZED 0x80000000 typedef struct _DDSCAPS { DWORD dwCaps; /* capabilities of surface wanted */ } DDSCAPS, *LPDDSCAPS; /* DDSCAPS2.dwCaps2 */ /* indicates the surface will receive data from a video port using deinterlacing hardware. */ #define DDSCAPS2_HARDWAREDEINTERLACE 0x00000002 /* indicates the surface will be locked very frequently. */ #define DDSCAPS2_HINTDYNAMIC 0x00000004 /* indicates surface can be re-ordered or retiled on load() */ #define DDSCAPS2_HINTSTATIC 0x00000008 /* indicates surface to be managed by directdraw/direct3D */ #define DDSCAPS2_TEXTUREMANAGE 0x00000010 /* reserved bits */ #define DDSCAPS2_RESERVED1 0x00000020 #define DDSCAPS2_RESERVED2 0x00000040 /* indicates surface will never be locked again */ #define DDSCAPS2_OPAQUE 0x00000080 /* set at CreateSurface() time to indicate antialising will be used */ #define DDSCAPS2_HINTANTIALIASING 0x00000100 /* set at CreateSurface() time to indicate cubic environment map */ #define DDSCAPS2_CUBEMAP 0x00000200 /* face flags for cube maps */ #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 /* specifies all faces of a cube for CreateSurface() */ #define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\ DDSCAPS2_CUBEMAP_NEGATIVEX |\ DDSCAPS2_CUBEMAP_POSITIVEY |\ DDSCAPS2_CUBEMAP_NEGATIVEY |\ DDSCAPS2_CUBEMAP_POSITIVEZ |\ DDSCAPS2_CUBEMAP_NEGATIVEZ ) /* set for mipmap sublevels on DirectX7 and later. ignored by CreateSurface() */ #define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000 /* indicates texture surface to be managed by Direct3D *only* */ #define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000 /* indicates managed surface that can safely be lost */ #define DDSCAPS2_DONOTPERSIST 0x00040000 /* indicates surface is part of a stereo flipping chain */ #define DDSCAPS2_STEREOSURFACELEFT 0x00080000 typedef struct _DDSCAPS2 { DWORD dwCaps; /* capabilities of surface wanted */ DWORD dwCaps2; /* additional capabilities */ DWORD dwCaps3; /* reserved capabilities */ DWORD dwCaps4; /* more reserved capabilities */ } DDSCAPS2, *LPDDSCAPS2; #define DD_ROP_SPACE (256/32) /* space required to store ROP array */ typedef struct _DDCAPS_DX7 { /* DirectX 7 version of caps struct */ DWORD dwSize; /* size of the DDDRIVERCAPS structure */ DWORD dwCaps; /* driver specific capabilities */ DWORD dwCaps2; /* more driver specific capabilites */ DWORD dwCKeyCaps; /* color key capabilities of the surface */ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ DWORD dwPalCaps; /* palette capabilities */ DWORD dwSVCaps; /* stereo vision capabilities */ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ DWORD dwVidMemTotal; /* total amount of video memory */ DWORD dwVidMemFree; /* amount of free video memory */ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ DWORD dwNumFourCCCodes; /* number of four cc codes */ DWORD dwAlignBoundarySrc; /* source rectangle alignment */ DWORD dwAlignSizeSrc; /* source rectangle byte size */ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ DWORD dwAlignSizeDest; /* dest rectangle byte size */ DWORD dwAlignStrideAlign; /* stride alignment */ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwReserved1; DWORD dwReserved2; DWORD dwReserved3; DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ DWORD dwSVBRops[DD_ROP_SPACE]; /* ROPS supported for System->Vmem blts */ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ DWORD dwVSBRops[DD_ROP_SPACE]; /* ROPS supported for Vmem->System blts */ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ DWORD dwSSBRops[DD_ROP_SPACE]; /* ROPS supported for System->System blts */ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ DWORD dwCurrVideoPorts; /* current number of video ports used */ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ DDSCAPS2 ddsCaps; /* surface capabilities */ } DDCAPS_DX7, *LPDDCAPS_DX7; typedef struct _DDCAPS_DX6 { /* DirectX 6 version of caps struct */ DWORD dwSize; /* size of the DDDRIVERCAPS structure */ DWORD dwCaps; /* driver specific capabilities */ DWORD dwCaps2; /* more driver specific capabilites */ DWORD dwCKeyCaps; /* color key capabilities of the surface */ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ DWORD dwPalCaps; /* palette capabilities */ DWORD dwSVCaps; /* stereo vision capabilities */ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ DWORD dwVidMemTotal; /* total amount of video memory */ DWORD dwVidMemFree; /* amount of free video memory */ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ DWORD dwNumFourCCCodes; /* number of four cc codes */ DWORD dwAlignBoundarySrc; /* source rectangle alignment */ DWORD dwAlignSizeSrc; /* source rectangle byte size */ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ DWORD dwAlignSizeDest; /* dest rectangle byte size */ DWORD dwAlignStrideAlign; /* stride alignment */ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwReserved1; DWORD dwReserved2; DWORD dwReserved3; DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ DWORD dwSVBRops[DD_ROP_SPACE]; /* ROPS supported for System->Vmem blts */ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ DWORD dwVSBRops[DD_ROP_SPACE]; /* ROPS supported for Vmem->System blts */ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ DWORD dwSSBRops[DD_ROP_SPACE]; /* ROPS supported for System->System blts */ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ DWORD dwCurrVideoPorts; /* current number of video ports used */ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ /* and one new member for DirectX 6 */ DDSCAPS2 ddsCaps; /* surface capabilities */ } DDCAPS_DX6, *LPDDCAPS_DX6; typedef struct _DDCAPS_DX5 { /* DirectX5 version of caps struct */ DWORD dwSize; /* size of the DDDRIVERCAPS structure */ DWORD dwCaps; /* driver specific capabilities */ DWORD dwCaps2; /* more driver specific capabilites */ DWORD dwCKeyCaps; /* color key capabilities of the surface */ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ DWORD dwPalCaps; /* palette capabilities */ DWORD dwSVCaps; /* stereo vision capabilities */ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ DWORD dwVidMemTotal; /* total amount of video memory */ DWORD dwVidMemFree; /* amount of free video memory */ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ DWORD dwNumFourCCCodes; /* number of four cc codes */ DWORD dwAlignBoundarySrc; /* source rectangle alignment */ DWORD dwAlignSizeSrc; /* source rectangle byte size */ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ DWORD dwAlignSizeDest; /* dest rectangle byte size */ DWORD dwAlignStrideAlign; /* stride alignment */ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwReserved1; DWORD dwReserved2; DWORD dwReserved3; DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ DWORD dwSVBRops[DD_ROP_SPACE]; /* ROPS supported for System->Vmem blts */ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ DWORD dwVSBRops[DD_ROP_SPACE]; /* ROPS supported for Vmem->System blts */ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ DWORD dwSSBRops[DD_ROP_SPACE]; /* ROPS supported for System->System blts */ /* the following are the new DirectX 5 members */ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ DWORD dwCurrVideoPorts; /* current number of video ports used */ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ } DDCAPS_DX5, *LPDDCAPS_DX5; typedef struct _DDCAPS_DX3 { /* DirectX3 version of caps struct */ DWORD dwSize; /* size of the DDDRIVERCAPS structure */ DWORD dwCaps; /* driver specific capabilities */ DWORD dwCaps2; /* more driver specific capabilites */ DWORD dwCKeyCaps; /* color key capabilities of the surface */ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ DWORD dwPalCaps; /* palette capabilities */ DWORD dwSVCaps; /* stereo vision capabilities */ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ DWORD dwVidMemTotal; /* total amount of video memory */ DWORD dwVidMemFree; /* amount of free video memory */ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ DWORD dwNumFourCCCodes; /* number of four cc codes */ DWORD dwAlignBoundarySrc; /* source rectangle alignment */ DWORD dwAlignSizeSrc; /* source rectangle byte size */ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ DWORD dwAlignSizeDest; /* dest rectangle byte size */ DWORD dwAlignStrideAlign; /* stride alignment */ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ DWORD dwReserved1; DWORD dwReserved2; DWORD dwReserved3; DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ DWORD dwSVBRops[DD_ROP_SPACE]; /* ROPS supported for System->Vmem blts */ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ DWORD dwVSBRops[DD_ROP_SPACE]; /* ROPS supported for Vmem->System blts */ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ DWORD dwSSBRops[DD_ROP_SPACE]; /* ROPS supported for System->System blts */ DWORD dwReserved4; DWORD dwReserved5; DWORD dwReserved6; } DDCAPS_DX3, *LPDDCAPS_DX3; /* set caps struct according to DIRECTDRAW_VERSION */ #if DIRECTDRAW_VERSION <= 0x300 typedef DDCAPS_DX3 DDCAPS; #elif DIRECTDRAW_VERSION <= 0x500 typedef DDCAPS_DX5 DDCAPS; #elif DIRECTDRAW_VERSION <= 0x600 typedef DDCAPS_DX6 DDCAPS; #else typedef DDCAPS_DX7 DDCAPS; #endif typedef DDCAPS *LPDDCAPS; /* DDCAPS.dwCaps */ #define DDCAPS_3D 0x00000001 #define DDCAPS_ALIGNBOUNDARYDEST 0x00000002 #define DDCAPS_ALIGNSIZEDEST 0x00000004 #define DDCAPS_ALIGNBOUNDARYSRC 0x00000008 #define DDCAPS_ALIGNSIZESRC 0x00000010 #define DDCAPS_ALIGNSTRIDE 0x00000020 #define DDCAPS_BLT 0x00000040 #define DDCAPS_BLTQUEUE 0x00000080 #define DDCAPS_BLTFOURCC 0x00000100 #define DDCAPS_BLTSTRETCH 0x00000200 #define DDCAPS_GDI 0x00000400 #define DDCAPS_OVERLAY 0x00000800 #define DDCAPS_OVERLAYCANTCLIP 0x00001000 #define DDCAPS_OVERLAYFOURCC 0x00002000 #define DDCAPS_OVERLAYSTRETCH 0x00004000 #define DDCAPS_PALETTE 0x00008000 #define DDCAPS_PALETTEVSYNC 0x00010000 #define DDCAPS_READSCANLINE 0x00020000 #define DDCAPS_STEREOVIEW 0x00040000 #define DDCAPS_VBI 0x00080000 #define DDCAPS_ZBLTS 0x00100000 #define DDCAPS_ZOVERLAYS 0x00200000 #define DDCAPS_COLORKEY 0x00400000 #define DDCAPS_ALPHA 0x00800000 #define DDCAPS_COLORKEYHWASSIST 0x01000000 #define DDCAPS_NOHARDWARE 0x02000000 #define DDCAPS_BLTCOLORFILL 0x04000000 #define DDCAPS_BANKSWITCHED 0x08000000 #define DDCAPS_BLTDEPTHFILL 0x10000000 #define DDCAPS_CANCLIP 0x20000000 #define DDCAPS_CANCLIPSTRETCHED 0x40000000 #define DDCAPS_CANBLTSYSMEM 0x80000000 /* DDCAPS.dwCaps2 */ #define DDCAPS2_CERTIFIED 0x00000001 #define DDCAPS2_NO2DDURING3DSCENE 0x00000002 #define DDCAPS2_VIDEOPORT 0x00000004 #define DDCAPS2_AUTOFLIPOVERLAY 0x00000008 #define DDCAPS2_CANBOBINTERLEAVED 0x00000010 #define DDCAPS2_CANBOBNONINTERLEAVED 0x00000020 #define DDCAPS2_COLORCONTROLOVERLAY 0x00000040 #define DDCAPS2_COLORCONTROLPRIMARY 0x00000080 #define DDCAPS2_CANDROPZ16BIT 0x00000100 #define DDCAPS2_NONLOCALVIDMEM 0x00000200 #define DDCAPS2_NONLOCALVIDMEMCAPS 0x00000400 #define DDCAPS2_NOPAGELOCKREQUIRED 0x00000800 #define DDCAPS2_WIDESURFACES 0x00001000 #define DDCAPS2_CANFLIPODDEVEN 0x00002000 #define DDCAPS2_CANBOBHARDWARE 0x00004000 #define DDCAPS2_COPYFOURCC 0x00008000 #define DDCAPS2_PRIMARYGAMMA 0x00020000 #define DDCAPS2_CANRENDERWINDOWED 0x00080000 #define DDCAPS2_CANCALIBRATEGAMMA 0x00100000 #define DDCAPS2_FLIPINTERVAL 0x00200000 #define DDCAPS2_FLIPNOVSYNC 0x00400000 #define DDCAPS2_CANMANAGETEXTURE 0x00800000 #define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000 #define DDCAPS2_STEREO 0x02000000 #define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000 /* Set/Get Colour Key Flags */ #define DDCKEY_COLORSPACE 0x00000001 /* Struct is single colour space */ #define DDCKEY_DESTBLT 0x00000002 /* To be used as dest for blt */ #define DDCKEY_DESTOVERLAY 0x00000004 /* To be used as dest for CK overlays */ #define DDCKEY_SRCBLT 0x00000008 /* To be used as src for blt */ #define DDCKEY_SRCOVERLAY 0x00000010 /* To be used as src for CK overlays */ typedef struct _DDCOLORKEY { DWORD dwColorSpaceLowValue; /* low boundary of color space that is to * be treated as Color Key, inclusive */ DWORD dwColorSpaceHighValue; /* high boundary of color space that is * to be treated as Color Key, inclusive */ } DDCOLORKEY, *LPDDCOLORKEY; /* ddCKEYCAPS bits */ #define DDCKEYCAPS_DESTBLT 0x00000001 #define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002 #define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004 #define DDCKEYCAPS_DESTBLTYUV 0x00000008 #define DDCKEYCAPS_DESTOVERLAY 0x00000010 #define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020 #define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040 #define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080 #define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100 #define DDCKEYCAPS_SRCBLT 0x00000200 #define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400 #define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800 #define DDCKEYCAPS_SRCBLTYUV 0x00001000 #define DDCKEYCAPS_SRCOVERLAY 0x00002000 #define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000 #define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000 #define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000 #define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000 #define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000 typedef struct _DDPIXELFORMAT { DWORD dwSize; /* 0: size of structure */ DWORD dwFlags; /* 4: pixel format flags */ DWORD dwFourCC; /* 8: (FOURCC code) */ union { DWORD dwRGBBitCount; /* C: how many bits per pixel */ DWORD dwYUVBitCount; /* C: how many bits per pixel */ DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */ DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels */ DWORD dwLuminanceBitCount; DWORD dwBumpBitCount; } DUMMYUNIONNAME1; union { DWORD dwRBitMask; /* 10: mask for red bit */ DWORD dwYBitMask; /* 10: mask for Y bits */ DWORD dwStencilBitDepth; DWORD dwLuminanceBitMask; DWORD dwBumpDuBitMask; } DUMMYUNIONNAME2; union { DWORD dwGBitMask; /* 14: mask for green bits */ DWORD dwUBitMask; /* 14: mask for U bits */ DWORD dwZBitMask; DWORD dwBumpDvBitMask; } DUMMYUNIONNAME3; union { DWORD dwBBitMask; /* 18: mask for blue bits */ DWORD dwVBitMask; /* 18: mask for V bits */ DWORD dwStencilBitMask; DWORD dwBumpLuminanceBitMask; } DUMMYUNIONNAME4; union { DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */ DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */ DWORD dwLuminanceAlphaBitMask; DWORD dwRGBZBitMask; /* 1C: mask for Z channel */ DWORD dwYUVZBitMask; /* 1C: mask for Z channel */ } DUMMYUNIONNAME5; /* 20: next structure */ } DDPIXELFORMAT, *LPDDPIXELFORMAT; /* DDCAPS.dwFXCaps */ #define DDFXCAPS_BLTALPHA 0x00000001 #define DDFXCAPS_OVERLAYALPHA 0x00000004 #define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010 #define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 #define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040 #define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080 #define DDFXCAPS_BLTROTATION 0x00000100 #define DDFXCAPS_BLTROTATION90 0x00000200 #define DDFXCAPS_BLTSHRINKX 0x00000400 #define DDFXCAPS_BLTSHRINKXN 0x00000800 #define DDFXCAPS_BLTSHRINKY 0x00001000 #define DDFXCAPS_BLTSHRINKYN 0x00002000 #define DDFXCAPS_BLTSTRETCHX 0x00004000 #define DDFXCAPS_BLTSTRETCHXN 0x00008000 #define DDFXCAPS_BLTSTRETCHY 0x00010000 #define DDFXCAPS_BLTSTRETCHYN 0x00020000 #define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000 #define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008 #define DDFXCAPS_OVERLAYSHRINKX 0x00080000 #define DDFXCAPS_OVERLAYSHRINKXN 0x00100000 #define DDFXCAPS_OVERLAYSHRINKY 0x00200000 #define DDFXCAPS_OVERLAYSHRINKYN 0x00400000 #define DDFXCAPS_OVERLAYSTRETCHX 0x00800000 #define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000 #define DDFXCAPS_OVERLAYSTRETCHY 0x02000000 #define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000 #define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000 #define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000 #define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY /* DDCAPS.dwFXAlphaCaps */ #define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001 #define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002 #define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004 #define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008 #define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010 #define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020 #define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040 #define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080 #define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100 #define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200 /* DDCAPS.dwPalCaps */ #define DDPCAPS_4BIT 0x00000001 #define DDPCAPS_8BITENTRIES 0x00000002 #define DDPCAPS_8BIT 0x00000004 #define DDPCAPS_INITIALIZE 0x00000008 #define DDPCAPS_PRIMARYSURFACE 0x00000010 #define DDPCAPS_PRIMARYSURFACELEFT 0x00000020 #define DDPCAPS_ALLOW256 0x00000040 #define DDPCAPS_VSYNC 0x00000080 #define DDPCAPS_1BIT 0x00000100 #define DDPCAPS_2BIT 0x00000200 #define DDPCAPS_ALPHA 0x00000400 /* DDCAPS.dwSVCaps */ /* the first 4 of these are now obsolete */ #if DIRECTDRAW_VERSION >= 0x700 /* FIXME: I'm not sure when this switch occured */ #define DDSVCAPS_RESERVED1 0x00000001 #define DDSVCAPS_RESERVED2 0x00000002 #define DDSVCAPS_RESERVED3 0x00000004 #define DDSVCAPS_RESERVED4 0x00000008 #else #define DDSVCAPS_ENIGMA 0x00000001 #define DDSVCAPS_FLICKER 0x00000002 #define DDSVCAPS_REDBLUE 0x00000004 #define DDSVCAPS_SPLIT 0x00000008 #endif #define DDSVCAPS_STEREOSEQUENTIAL 0x00000010 /* BitDepths */ #define DDBD_1 0x00004000 #define DDBD_2 0x00002000 #define DDBD_4 0x00001000 #define DDBD_8 0x00000800 #define DDBD_16 0x00000400 #define DDBD_24 0x00000200 #define DDBD_32 0x00000100 /* DDOVERLAYFX.dwDDFX */ #define DDOVERFX_ARITHSTRETCHY 0x00000001 #define DDOVERFX_MIRRORLEFTRIGHT 0x00000002 #define DDOVERFX_MIRRORUPDOWN 0x00000004 /* UpdateOverlay flags */ #define DDOVER_ALPHADEST 0x00000001 #define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002 #define DDOVER_ALPHADESTNEG 0x00000004 #define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008 #define DDOVER_ALPHAEDGEBLEND 0x00000010 #define DDOVER_ALPHASRC 0x00000020 #define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040 #define DDOVER_ALPHASRCNEG 0x00000080 #define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100 #define DDOVER_HIDE 0x00000200 #define DDOVER_KEYDEST 0x00000400 #define DDOVER_KEYDESTOVERRIDE 0x00000800 #define DDOVER_KEYSRC 0x00001000 #define DDOVER_KEYSRCOVERRIDE 0x00002000 #define DDOVER_SHOW 0x00004000 #define DDOVER_ADDDIRTYRECT 0x00008000 #define DDOVER_REFRESHDIRTYRECTS 0x00010000 #define DDOVER_REFRESHALL 0x00020000 #define DDOVER_DDFX 0x00080000 #define DDOVER_AUTOFLIP 0x00100000 #define DDOVER_BOB 0x00200000 #define DDOVER_OVERRIDEBOBWEAVE 0x00400000 #define DDOVER_INTERLEAVED 0x00800000 /* DDCOLORKEY.dwFlags */ #define DDPF_ALPHAPIXELS 0x00000001 #define DDPF_ALPHA 0x00000002 #define DDPF_FOURCC 0x00000004 #define DDPF_PALETTEINDEXED4 0x00000008 #define DDPF_PALETTEINDEXEDTO8 0x00000010 #define DDPF_PALETTEINDEXED8 0x00000020 #define DDPF_RGB 0x00000040 #define DDPF_COMPRESSED 0x00000080 #define DDPF_RGBTOYUV 0x00000100 #define DDPF_YUV 0x00000200 #define DDPF_ZBUFFER 0x00000400 #define DDPF_PALETTEINDEXED1 0x00000800 #define DDPF_PALETTEINDEXED2 0x00001000 #define DDPF_ZPIXELS 0x00002000 #define DDPF_STENCILBUFFER 0x00004000 #define DDPF_ALPHAPREMULT 0x00008000 #define DDPF_LUMINANCE 0x00020000 #define DDPF_BUMPLUMINANCE 0x00040000 #define DDPF_BUMPDUDV 0x00080000 /* SetCooperativeLevel dwFlags */ #define DDSCL_FULLSCREEN 0x00000001 #define DDSCL_ALLOWREBOOT 0x00000002 #define DDSCL_NOWINDOWCHANGES 0x00000004 #define DDSCL_NORMAL 0x00000008 #define DDSCL_EXCLUSIVE 0x00000010 #define DDSCL_ALLOWMODEX 0x00000040 #define DDSCL_SETFOCUSWINDOW 0x00000080 #define DDSCL_SETDEVICEWINDOW 0x00000100 #define DDSCL_CREATEDEVICEWINDOW 0x00000200 #define DDSCL_MULTITHREADED 0x00000400 #define DDSCL_FPUSETUP 0x00000800 #define DDSCL_FPUPRESERVE 0x00001000 /* DDSURFACEDESC.dwFlags */ #define DDSD_CAPS 0x00000001 #define DDSD_HEIGHT 0x00000002 #define DDSD_WIDTH 0x00000004 #define DDSD_PITCH 0x00000008 #define DDSD_BACKBUFFERCOUNT 0x00000020 #define DDSD_ZBUFFERBITDEPTH 0x00000040 #define DDSD_ALPHABITDEPTH 0x00000080 #define DDSD_LPSURFACE 0x00000800 #define DDSD_PIXELFORMAT 0x00001000 #define DDSD_CKDESTOVERLAY 0x00002000 #define DDSD_CKDESTBLT 0x00004000 #define DDSD_CKSRCOVERLAY 0x00008000 #define DDSD_CKSRCBLT 0x00010000 #define DDSD_MIPMAPCOUNT 0x00020000 #define DDSD_REFRESHRATE 0x00040000 #define DDSD_LINEARSIZE 0x00080000 #define DDSD_TEXTURESTAGE 0x00100000 #define DDSD_FVF 0x00200000 #define DDSD_SRCVBHANDLE 0x00400000 #define DDSD_ALL 0x007ff9ee /* EnumSurfaces flags */ #define DDENUMSURFACES_ALL 0x00000001 #define DDENUMSURFACES_MATCH 0x00000002 #define DDENUMSURFACES_NOMATCH 0x00000004 #define DDENUMSURFACES_CANBECREATED 0x00000008 #define DDENUMSURFACES_DOESEXIST 0x00000010 /* SetDisplayMode flags */ #define DDSDM_STANDARDVGAMODE 0x00000001 /* EnumDisplayModes flags */ #define DDEDM_REFRESHRATES 0x00000001 #define DDEDM_STANDARDVGAMODES 0x00000002 /* WaitForVerticalDisplay flags */ #define DDWAITVB_BLOCKBEGIN 0x00000001 #define DDWAITVB_BLOCKBEGINEVENT 0x00000002 #define DDWAITVB_BLOCKEND 0x00000004 typedef struct _DDSURFACEDESC { DWORD dwSize; /* 0: size of the DDSURFACEDESC structure */ DWORD dwFlags; /* 4: determines what fields are valid */ DWORD dwHeight; /* 8: height of surface to be created */ DWORD dwWidth; /* C: width of input surface */ union { LONG lPitch; /* 10: distance to start of next line (return value only) */ DWORD dwLinearSize; } DUMMYUNIONNAME1; DWORD dwBackBufferCount; /* 14: number of back buffers requested */ union { DWORD dwMipMapCount; /* 18:number of mip-map levels requested */ DWORD dwZBufferBitDepth; /*18: depth of Z buffer requested */ DWORD dwRefreshRate; /* 18:refresh rate (used when display mode is described) */ } DUMMYUNIONNAME2; DWORD dwAlphaBitDepth; /* 1C:depth of alpha buffer requested */ DWORD dwReserved; /* 20:reserved */ LPVOID lpSurface; /* 24:pointer to the associated surface memory */ DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use */ DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use */ DDCOLORKEY ddckCKSrcOverlay; /* 38: CK for source overlay use */ DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use */ DDPIXELFORMAT ddpfPixelFormat; /* 48: pixel format description of the surface */ DDSCAPS ddsCaps; /* 68: direct draw surface caps */ } DDSURFACEDESC, *LPDDSURFACEDESC; typedef struct _DDSURFACEDESC2 { DWORD dwSize; /* 0: size of the DDSURFACEDESC structure */ DWORD dwFlags; /* 4: determines what fields are valid */ DWORD dwHeight; /* 8: height of surface to be created */ DWORD dwWidth; /* C: width of input surface */ union { LONG lPitch; /*10: distance to start of next line (return value only) */ DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */ } DUMMYUNIONNAME1; DWORD dwBackBufferCount; /* 14: number of back buffers requested */ union { DWORD dwMipMapCount; /* 18:number of mip-map levels requested */ DWORD dwRefreshRate; /* 18:refresh rate (used when display mode is described) */ DWORD dwSrcVBHandle; /* 18:source used in VB::Optimize */ } DUMMYUNIONNAME2; DWORD dwAlphaBitDepth; /* 1C:depth of alpha buffer requested */ DWORD dwReserved; /* 20:reserved */ LPVOID lpSurface; /* 24:pointer to the associated surface memory */ union { DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use */ DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */ } DUMMYUNIONNAME3; DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use */ DDCOLORKEY ddckCKSrcOverlay; /* 38: CK for source overlay use */ DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use */ union { DDPIXELFORMAT ddpfPixelFormat; /* 48: pixel format description of the surface */ DWORD dwFVF; /* 48: vertex format description of vertex buffers */ } DUMMYUNIONNAME4; DDSCAPS2 ddsCaps; /* 68: DDraw surface caps */ DWORD dwTextureStage; /* 78: stage in multitexture cascade */ } DDSURFACEDESC2, *LPDDSURFACEDESC2; /* DDCOLORCONTROL.dwFlags */ #define DDCOLOR_BRIGHTNESS 0x00000001 #define DDCOLOR_CONTRAST 0x00000002 #define DDCOLOR_HUE 0x00000004 #define DDCOLOR_SATURATION 0x00000008 #define DDCOLOR_SHARPNESS 0x00000010 #define DDCOLOR_GAMMA 0x00000020 #define DDCOLOR_COLORENABLE 0x00000040 typedef struct { DWORD dwSize; DWORD dwFlags; LONG lBrightness; LONG lContrast; LONG lHue; LONG lSaturation; LONG lSharpness; LONG lGamma; LONG lColorEnable; DWORD dwReserved1; } DDCOLORCONTROL, *LPDDCOLORCONTROL; typedef struct { WORD red[256]; WORD green[256]; WORD blue[256]; } DDGAMMARAMP, *LPDDGAMMARAMP; typedef BOOL CALLBACK(*LPDDENUMCALLBACKA) (GUID *, LPSTR, LPSTR, LPVOID); typedef BOOL CALLBACK(*LPDDENUMCALLBACKW) (GUID *, LPWSTR, LPWSTR, LPVOID); DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACK) typedef HRESULT CALLBACK(*LPDDENUMMODESCALLBACK) (LPDDSURFACEDESC, LPVOID); typedef HRESULT CALLBACK(*LPDDENUMMODESCALLBACK2) (LPDDSURFACEDESC2, LPVOID); typedef HRESULT CALLBACK(*LPDDENUMSURFACESCALLBACK) (LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); typedef HRESULT CALLBACK(*LPDDENUMSURFACESCALLBACK2) (LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); typedef HRESULT CALLBACK(*LPDDENUMSURFACESCALLBACK7) (LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); typedef BOOL CALLBACK(*LPDDENUMCALLBACKEXA) (GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); typedef BOOL CALLBACK(*LPDDENUMCALLBACKEXW) (GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACKEX) HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); HRESULT WINAPI DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); #define DirectDrawEnumerateEx WINELIB_NAME_AW(DirectDrawEnumerateEx) /* flags for DirectDrawEnumerateEx */ #define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001 #define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002 #define DDENUM_NONDISPLAYDEVICES 0x00000004 /* flags for DirectDrawCreate or IDirectDraw::Initialize */ #define DDCREATE_HARDWAREONLY 1L #define DDCREATE_EMULATIONONLY 2L typedef struct _DDBLTFX { DWORD dwSize; /* size of structure */ DWORD dwDDFX; /* FX operations */ DWORD dwROP; /* Win32 raster operations */ DWORD dwDDROP; /* Raster operations new for DirectDraw */ DWORD dwRotationAngle; /* Rotation angle for blt */ DWORD dwZBufferOpCode; /* ZBuffer compares */ DWORD dwZBufferLow; /* Low limit of Z buffer */ DWORD dwZBufferHigh; /* High limit of Z buffer */ DWORD dwZBufferBaseDest; /* Destination base value */ DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */ union { DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ } DUMMYUNIONNAME1; DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ union { DWORD dwZSrcConst; /* Constant to use as Z buffer for src */ LPDIRECTDRAWSURFACE lpDDSZBufferSrc; /* Surface to use as Z buffer for src */ } DUMMYUNIONNAME2; DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ DWORD dwReserved; DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ union { DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as Alpha Channel */ } DUMMYUNIONNAME3; DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ union { DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */ LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as Alpha Channel */ } DUMMYUNIONNAME4; union { DWORD dwFillColor; /* color in RGB or Palettized */ DWORD dwFillDepth; /* depth value for z-buffer */ DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */ } DUMMYUNIONNAME5; DDCOLORKEY ddckDestColorkey; /* DestColorkey override */ DDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ } DDBLTFX, *LPDDBLTFX; /* dwDDFX */ /* arithmetic stretching along y axis */ #define DDBLTFX_ARITHSTRETCHY 0x00000001 /* mirror on y axis */ #define DDBLTFX_MIRRORLEFTRIGHT 0x00000002 /* mirror on x axis */ #define DDBLTFX_MIRRORUPDOWN 0x00000004 /* do not tear */ #define DDBLTFX_NOTEARING 0x00000008 /* 180 degrees clockwise rotation */ #define DDBLTFX_ROTATE180 0x00000010 /* 270 degrees clockwise rotation */ #define DDBLTFX_ROTATE270 0x00000020 /* 90 degrees clockwise rotation */ #define DDBLTFX_ROTATE90 0x00000040 /* dwZBufferLow and dwZBufferHigh specify limits to the copied Z values */ #define DDBLTFX_ZBUFFERRANGE 0x00000080 /* add dwZBufferBaseDest to every source z value before compare */ #define DDBLTFX_ZBUFFERBASEDEST 0x00000100 typedef struct _DDOVERLAYFX { DWORD dwSize; /* size of structure */ DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ DWORD dwAlphaEdgeBlend; /* Constant to use as alpha for edge blend */ DWORD dwReserved; DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ union { DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ } DUMMYUNIONNAME1; DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ union { DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ } DUMMYUNIONNAME2; DDCOLORKEY dckDestColorkey; /* DestColorkey override */ DDCOLORKEY dckSrcColorkey; /* DestColorkey override */ DWORD dwDDFX; /* Overlay FX */ DWORD dwFlags; /* flags */ } DDOVERLAYFX, *LPDDOVERLAYFX; typedef struct _DDBLTBATCH { LPRECT lprDest; LPDIRECTDRAWSURFACE lpDDSSrc; LPRECT lprSrc; DWORD dwFlags; LPDDBLTFX lpDDBltFx; } DDBLTBATCH, *LPDDBLTBATCH; #define MAX_DDDEVICEID_STRING 512 typedef struct tagDDDEVICEIDENTIFIER { char szDriver[MAX_DDDEVICEID_STRING]; char szDescription[MAX_DDDEVICEID_STRING]; LARGE_INTEGER liDriverVersion; DWORD dwVendorId; DWORD dwDeviceId; DWORD dwSubSysId; DWORD dwRevision; GUID guidDeviceIdentifier; } DDDEVICEIDENTIFIER, *LPDDDEVICEIDENTIFIER; typedef struct tagDDDEVICEIDENTIFIER2 { char szDriver[MAX_DDDEVICEID_STRING]; /* user readable driver name */ char szDescription[MAX_DDDEVICEID_STRING]; /* user readable description */ LARGE_INTEGER liDriverVersion; /* driver version */ DWORD dwVendorId; /* vendor ID, zero if unknown */ DWORD dwDeviceId; /* chipset ID, zero if unknown */ DWORD dwSubSysId; /* board ID, zero if unknown */ DWORD dwRevision; /* chipset version, zero if unknown */ GUID guidDeviceIdentifier; /* unique ID for this driver/chipset combination */ DWORD dwWHQLLevel; /* Windows Hardware Quality Lab certification level */ } DDDEVICEIDENTIFIER2, *LPDDDEVICEIDENTIFIER2; /***************************************************************************** * IDirectDrawPalette interface */ #undef INTERFACE #define INTERFACE IDirectDrawPalette DECLARE_INTERFACE_(IDirectDrawPalette, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ LPDWORD lpdwCaps) PURE; STDMETHOD(GetEntries) (THIS_ DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) PURE; STDMETHOD(SetEntries) (THIS_ DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawPalette_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawPalette_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawPalette_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawPalette methods ***/ #define IDirectDrawPalette_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) #define IDirectDrawPalette_GetEntries(p,a,b,c,d) ICOM_CALL_(GetEntries,p,(p,a,b,c,d)) #define IDirectDrawPalette_Initialize(p,a,b,c) ICOM_CALL_(Initialize,p,(p,a,b,c)) #define IDirectDrawPalette_SetEntries(p,a,b,c,d) ICOM_CALL_(SetEntries,p,(p,a,b,c,d)) /***************************************************************************** * IDirectDrawClipper interface */ #undef INTERFACE #define INTERFACE IDirectDrawClipper DECLARE_INTERFACE_(IDirectDrawClipper, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(GetClipList) (THIS_ LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize) PURE; STDMETHOD(GetHWnd) (THIS_ HWND * lphWnd) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags) PURE; STDMETHOD(IsClipListChanged) (THIS_ BOOL * lpbChanged) PURE; STDMETHOD(SetClipList) (THIS_ LPRGNDATA lpClipList, DWORD dwFlags) PURE; STDMETHOD(SetHWnd) (THIS_ DWORD dwFlags, HWND hWnd) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawClipper_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawClipper_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawClipper_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawClipper methods ***/ #define IDirectDrawClipper_GetClipList(p,a,b,c) ICOM_CALL_(GetClipList,p,(p,a,b,c)) #define IDirectDrawClipper_GetHWnd(p,a) ICOM_CALL_(GetHWnd,p,(p,a)) #define IDirectDrawClipper_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) #define IDirectDrawClipper_IsClipListChanged(p,a) ICOM_CALL_(IsClipListChanged,p,(p,a)) #define IDirectDrawClipper_SetClipList(p,a,b) ICOM_CALL_(SetClipList,p,(p,a,b)) #define IDirectDrawClipper_SetHWnd(p,a,b) ICOM_CALL_(SetHWnd,p,(p,a,b)) /***************************************************************************** * IDirectDraw interface */ #undef INTERFACE #define INTERFACE IDirectDraw DECLARE_INTERFACE_(IDirectDraw, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(Compact) (THIS) PURE; STDMETHOD(CreateClipper) (THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER * lplpDDClipper, IUnknown * pUnkOuter) PURE; STDMETHOD(CreatePalette) (THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE * lplpDDPalette, IUnknown * pUnkOuter) PURE; STDMETHOD(CreateSurface) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE * lplpDDSurface, IUnknown * pUnkOuter) PURE; STDMETHOD(DuplicateSurface) (THIS_ LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE * lplpDupDDSurface) PURE; STDMETHOD(EnumDisplayModes) (THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE; STDMETHOD(EnumSurfaces) (THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; STDMETHOD(FlipToGDISurface) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; STDMETHOD(GetDisplayMode) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(GetFourCCCodes) (THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; STDMETHOD(GetGDISurface) (THIS_ LPDIRECTDRAWSURFACE * lplpGDIDDSurface) PURE; STDMETHOD(GetMonitorFrequency) (THIS_ LPDWORD lpdwFrequency) PURE; STDMETHOD(GetScanLine) (THIS_ LPDWORD lpdwScanLine) PURE; STDMETHOD(GetVerticalBlankStatus) (THIS_ BOOL * lpbIsInVB) PURE; STDMETHOD(Initialize) (THIS_ GUID * lpGUID) PURE; STDMETHOD(RestoreDisplayMode) (THIS) PURE; STDMETHOD(SetCooperativeLevel) (THIS_ HWND hWnd, DWORD dwFlags) PURE; STDMETHOD(SetDisplayMode) (THIS_ DWORD, DWORD, DWORD) PURE; STDMETHOD(WaitForVerticalBlank) (THIS_ DWORD dwFlags, HANDLE hEvent) PURE; }; /*** IUnknown methods ***/ #define IDirectDraw_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDraw_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDraw_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDraw methods ***/ #define IDirectDraw_Compact(p) ICOM_CALL_(Compact,p,(p)) #define IDirectDraw_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) #define IDirectDraw_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) #define IDirectDraw_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) #define IDirectDraw_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) #define IDirectDraw_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) #define IDirectDraw_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) #define IDirectDraw_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) #define IDirectDraw_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) #define IDirectDraw_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) #define IDirectDraw_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) #define IDirectDraw_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) #define IDirectDraw_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) #define IDirectDraw_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) #define IDirectDraw_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) #define IDirectDraw_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) #define IDirectDraw_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) #define IDirectDraw_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) #define IDirectDraw_SetDisplayMode(p,a,b,c) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c)) #define IDirectDraw_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) /* flags for Lock() */ #define DDLOCK_SURFACEMEMORYPTR 0x00000000 #define DDLOCK_WAIT 0x00000001 #define DDLOCK_EVENT 0x00000002 #define DDLOCK_READONLY 0x00000010 #define DDLOCK_WRITEONLY 0x00000020 #define DDLOCK_NOSYSLOCK 0x00000800 /***************************************************************************** * IDirectDraw2 interface */ /* Note: IDirectDraw2 cannot derive from IDirectDraw because the number of * arguments of SetDisplayMode has changed ! */ #undef INTERFACE #define INTERFACE IDirectDraw2 DECLARE_INTERFACE_(IDirectDraw2, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(Compact) (THIS) PURE; STDMETHOD(CreateClipper) (THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER * lplpDDClipper, IUnknown * pUnkOuter) PURE; STDMETHOD(CreatePalette) (THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE * lplpDDPalette, IUnknown * pUnkOuter) PURE; STDMETHOD(CreateSurface) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE2 * lplpDDSurface, IUnknown * pUnkOuter) PURE; STDMETHOD(DuplicateSurface) (THIS_ LPDIRECTDRAWSURFACE2 lpDDSurface, LPDIRECTDRAWSURFACE2 * lplpDupDDSurface) PURE; STDMETHOD(EnumDisplayModes) (THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE; STDMETHOD(EnumSurfaces) (THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; STDMETHOD(FlipToGDISurface) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; STDMETHOD(GetDisplayMode) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(GetFourCCCodes) (THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; STDMETHOD(GetGDISurface) (THIS_ LPDIRECTDRAWSURFACE2 * lplpGDIDDSurface) PURE; STDMETHOD(GetMonitorFrequency) (THIS_ LPDWORD lpdwFrequency) PURE; STDMETHOD(GetScanLine) (THIS_ LPDWORD lpdwScanLine) PURE; STDMETHOD(GetVerticalBlankStatus) (THIS_ BOOL * lpbIsInVB) PURE; STDMETHOD(Initialize) (THIS_ GUID * lpGUID) PURE; STDMETHOD(RestoreDisplayMode) (THIS) PURE; STDMETHOD(SetCooperativeLevel) (THIS_ HWND hWnd, DWORD dwFlags) PURE; STDMETHOD(SetDisplayMode) (THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; STDMETHOD(WaitForVerticalBlank) (THIS_ DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(GetAvailableVidMem) (THIS_ LPDDSCAPS lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; }; /*** IUnknown methods ***/ #define IDirectDraw2_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDraw2_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDraw2_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDraw methods ***/ #define IDirectDraw2_Compact(p) ICOM_CALL_(Compact,p,(p)) #define IDirectDraw2_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) #define IDirectDraw2_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) #define IDirectDraw2_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) #define IDirectDraw2_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) #define IDirectDraw2_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) #define IDirectDraw2_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) #define IDirectDraw2_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) #define IDirectDraw2_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) #define IDirectDraw2_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) #define IDirectDraw2_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) #define IDirectDraw2_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) #define IDirectDraw2_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) #define IDirectDraw2_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) #define IDirectDraw2_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) #define IDirectDraw2_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) #define IDirectDraw2_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) #define IDirectDraw2_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) #define IDirectDraw2_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e)) #define IDirectDraw2_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) /*** IDirectDraw2 methods ***/ #define IDirectDraw2_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c)) /***************************************************************************** * IDirectDraw4 interface */ #undef INTERFACE #define INTERFACE IDirectDraw4 DECLARE_INTERFACE_(IDirectDraw4, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(Compact) (THIS) PURE; STDMETHOD(CreateClipper) (THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER * lplpDDClipper, IUnknown * pUnkOuter) PURE; STDMETHOD(CreatePalette) (THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE * lplpDDPalette, IUnknown * pUnkOuter) PURE; STDMETHOD(CreateSurface) (THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE4 * lplpDDSurface, IUnknown * pUnkOuter) PURE; STDMETHOD(DuplicateSurface) (THIS_ LPDIRECTDRAWSURFACE4 lpDDSurface, LPDIRECTDRAWSURFACE4 * lplpDupDDSurface) PURE; STDMETHOD(EnumDisplayModes) (THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback) PURE; STDMETHOD(EnumSurfaces) (THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpEnumSurfacesCallback) PURE; STDMETHOD(FlipToGDISurface) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; STDMETHOD(GetDisplayMode) (THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; STDMETHOD(GetFourCCCodes) (THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; STDMETHOD(GetGDISurface) (THIS_ LPDIRECTDRAWSURFACE4 * lplpGDIDDSurface) PURE; STDMETHOD(GetMonitorFrequency) (THIS_ LPDWORD lpdwFrequency) PURE; STDMETHOD(GetScanLine) (THIS_ LPDWORD lpdwScanLine) PURE; STDMETHOD(GetVerticalBlankStatus) (THIS_ BOOL * lpbIsInVB) PURE; STDMETHOD(Initialize) (THIS_ GUID * lpGUID) PURE; STDMETHOD(RestoreDisplayMode) (THIS) PURE; STDMETHOD(SetCooperativeLevel) (THIS_ HWND hWnd, DWORD dwFlags) PURE; STDMETHOD(SetDisplayMode) (THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; STDMETHOD(WaitForVerticalBlank) (THIS_ DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(GetAvailableVidMem) (THIS_ LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, LPDIRECTDRAWSURFACE4 *) PURE; STDMETHOD(RestoreAllSurfaces) (THIS) PURE; STDMETHOD(TestCooperativeLevel) (THIS) PURE; STDMETHOD(GetDeviceIdentifier) (THIS_ LPDDDEVICEIDENTIFIER, DWORD) PURE; }; /*** IUnknown methods ***/ #define IDirectDraw4_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDraw4_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDraw4_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDraw methods ***/ #define IDirectDraw4_Compact(p) ICOM_CALL_(Compact,p,(p)) #define IDirectDraw4_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) #define IDirectDraw4_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) #define IDirectDraw4_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) #define IDirectDraw4_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) #define IDirectDraw4_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) #define IDirectDraw4_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) #define IDirectDraw4_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) #define IDirectDraw4_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) #define IDirectDraw4_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) #define IDirectDraw4_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) #define IDirectDraw4_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) #define IDirectDraw4_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) #define IDirectDraw4_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) #define IDirectDraw4_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) #define IDirectDraw4_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) #define IDirectDraw4_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) #define IDirectDraw4_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) #define IDirectDraw4_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e)) #define IDirectDraw4_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) /*** IDirectDraw2 methods ***/ #define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c)) /*** IDirectDraw4 methods ***/ #define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b)) #define IDirectDraw4_RestoreAllSurfaces(p) ICOM_CALL_(RestoreAllSurfaces,p,(p)) #define IDirectDraw4_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p)) #define IDirectDraw4_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b)) /***************************************************************************** * IDirectDraw7 interface */ /* Note: IDirectDraw7 cannot derive from IDirectDraw4; it is even documented * as not interchangeable with earlier DirectDraw interfaces. */ #undef INTERFACE #define INTERFACE IDirectDraw7 DECLARE_INTERFACE_(IDirectDraw7, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(Compact) (THIS) PURE; STDMETHOD(CreateClipper) (THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER * lplpDDClipper, IUnknown * pUnkOuter) PURE; STDMETHOD(CreatePalette) (THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE * lplpDDPalette, IUnknown * pUnkOuter) PURE; STDMETHOD(CreateSurface) (THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7 * lplpDDSurface, IUnknown * pUnkOuter) PURE; STDMETHOD(DuplicateSurface) (THIS_ LPDIRECTDRAWSURFACE7 lpDDSurface, LPDIRECTDRAWSURFACE7 * lplpDupDDSurface) PURE; STDMETHOD(EnumDisplayModes) (THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback) PURE; STDMETHOD(EnumSurfaces) (THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback) PURE; STDMETHOD(FlipToGDISurface) (THIS) PURE; STDMETHOD(GetCaps) (THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE; STDMETHOD(GetDisplayMode) (THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; STDMETHOD(GetFourCCCodes) (THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE; STDMETHOD(GetGDISurface) (THIS_ LPDIRECTDRAWSURFACE7 * lplpGDIDDSurface) PURE; STDMETHOD(GetMonitorFrequency) (THIS_ LPDWORD lpdwFrequency) PURE; STDMETHOD(GetScanLine) (THIS_ LPDWORD lpdwScanLine) PURE; STDMETHOD(GetVerticalBlankStatus) (THIS_ BOOL * lpbIsInVB) PURE; STDMETHOD(Initialize) (THIS_ GUID * lpGUID) PURE; STDMETHOD(RestoreDisplayMode) (THIS) PURE; STDMETHOD(SetCooperativeLevel) (THIS_ HWND hWnd, DWORD dwFlags) PURE; STDMETHOD(SetDisplayMode) (THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE; STDMETHOD(WaitForVerticalBlank) (THIS_ DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(GetAvailableVidMem) (THIS_ LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE; STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, LPDIRECTDRAWSURFACE7 *) PURE; STDMETHOD(RestoreAllSurfaces) (THIS) PURE; STDMETHOD(TestCooperativeLevel) (THIS) PURE; STDMETHOD(GetDeviceIdentifier) (THIS_ LPDDDEVICEIDENTIFIER2, DWORD) PURE; STDMETHOD(StartModeTest) (THIS_ LPSIZE, DWORD, DWORD) PURE; STDMETHOD(EvaluateMode) (THIS_ DWORD, DWORD *) PURE; }; /*** IUnknown methods ***/ #define IDirectDraw7_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDraw7_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDraw7_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDraw methods ***/ #define IDirectDraw7_Compact(p) ICOM_CALL_(Compact,p,(p)) #define IDirectDraw7_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c)) #define IDirectDraw7_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d)) #define IDirectDraw7_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c)) #define IDirectDraw7_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b)) #define IDirectDraw7_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d)) #define IDirectDraw7_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d)) #define IDirectDraw7_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p)) #define IDirectDraw7_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b)) #define IDirectDraw7_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a)) #define IDirectDraw7_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b)) #define IDirectDraw7_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a)) #define IDirectDraw7_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a)) #define IDirectDraw7_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a)) #define IDirectDraw7_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a)) #define IDirectDraw7_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a)) #define IDirectDraw7_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p)) #define IDirectDraw7_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b)) #define IDirectDraw7_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e)) #define IDirectDraw7_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b)) /*** added in IDirectDraw2 ***/ #define IDirectDraw7_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c)) /*** added in IDirectDraw4 ***/ #define IDirectDraw7_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b)) #define IDirectDraw7_RestoreAllSurfaces(p) ICOM_CALL_(RestoreAllSurfaces,p,(p)) #define IDirectDraw7_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p)) #define IDirectDraw7_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b)) /*** added in IDirectDraw 7 ***/ #define IDirectDraw7_StartModeTest(p,a,b,c) ICOM_CALL_(StartModeTest,p,(p,a,b,c)) #define IDirectDraw7_EvaluateMode(p,a,b) ICOM_CALL_(EvaluateMode,p,(p,a,b)) /***************************************************************************** * IDirectDrawSurface interface */ #undef INTERFACE #define INTERFACE IDirectDrawSurface DECLARE_INTERFACE_(IDirectDrawSurface, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(AddAttachedSurface) (THIS_ LPDIRECTDRAWSURFACE lpDDSAttachedSurface) PURE; STDMETHOD(AddOverlayDirtyRect) (THIS_ LPRECT lpRect) PURE; STDMETHOD(Blt) (THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; STDMETHOD(BltBatch) (THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; STDMETHOD(BltFast) (THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; STDMETHOD(DeleteAttachedSurface) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface) PURE; STDMETHOD(EnumAttachedSurfaces) (THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; STDMETHOD(EnumOverlayZOrders) (THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; STDMETHOD(Flip) (THIS_ LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; STDMETHOD(GetAttachedSurface) (THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE * lplpDDAttachedSurface) PURE; STDMETHOD(GetBltStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetCaps) (THIS_ LPDDSCAPS lpDDSCaps) PURE; STDMETHOD(GetClipper) (THIS_ LPDIRECTDRAWCLIPPER * lplpDDClipper) PURE; STDMETHOD(GetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(GetDC) (THIS_ HDC * lphDC) PURE; STDMETHOD(GetFlipStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetOverlayPosition) (THIS_ LPLONG lplX, LPLONG lplY) PURE; STDMETHOD(GetPalette) (THIS_ LPDIRECTDRAWPALETTE * lplpDDPalette) PURE; STDMETHOD(GetPixelFormat) (THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(IsLost) (THIS) PURE; STDMETHOD(Lock) (THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC) (THIS_ HDC hDC) PURE; STDMETHOD(Restore) (THIS) PURE; STDMETHOD(SetClipper) (THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; STDMETHOD(SetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(SetOverlayPosition) (THIS_ LONG lX, LONG lY) PURE; STDMETHOD(SetPalette) (THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; STDMETHOD(Unlock) (THIS_ LPVOID lpSurfaceData) PURE; STDMETHOD(UpdateOverlay) (THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; STDMETHOD(UpdateOverlayDisplay) (THIS_ DWORD dwFlags) PURE; STDMETHOD(UpdateOverlayZOrder) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSReference) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawSurface_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawSurface_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawSurface_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawSurface methods ***/ #define IDirectDrawSurface_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) #define IDirectDrawSurface_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) #define IDirectDrawSurface_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) #define IDirectDrawSurface_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) #define IDirectDrawSurface_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) #define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) #define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) #define IDirectDrawSurface_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) #define IDirectDrawSurface_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) #define IDirectDrawSurface_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) #define IDirectDrawSurface_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) #define IDirectDrawSurface_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) #define IDirectDrawSurface_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) #define IDirectDrawSurface_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) #define IDirectDrawSurface_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) #define IDirectDrawSurface_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) #define IDirectDrawSurface_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) #define IDirectDrawSurface_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) #define IDirectDrawSurface_IsLost(p) ICOM_CALL_(IsLost,p,(p)) #define IDirectDrawSurface_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) #define IDirectDrawSurface_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) #define IDirectDrawSurface_Restore(p) ICOM_CALL_(Restore,p,(p)) #define IDirectDrawSurface_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) #define IDirectDrawSurface_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) #define IDirectDrawSurface_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) #define IDirectDrawSurface_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) #define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) #define IDirectDrawSurface_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) #define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) /***************************************************************************** * IDirectDrawSurface2 interface */ /* Cannot inherit from IDirectDrawSurface because the LPDIRECTDRAWSURFACE parameters * have been converted to LPDIRECTDRAWSURFACE2. */ #undef INTERFACE #define INTERFACE IDirectDrawSurface2 DECLARE_INTERFACE_(IDirectDrawSurface2, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(AddAttachedSurface) (THIS_ LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface) PURE; STDMETHOD(AddOverlayDirtyRect) (THIS_ LPRECT lpRect) PURE; STDMETHOD(Blt) (THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; STDMETHOD(BltBatch) (THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; STDMETHOD(BltFast) (THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; STDMETHOD(DeleteAttachedSurface) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface) PURE; STDMETHOD(EnumAttachedSurfaces) (THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; STDMETHOD(EnumOverlayZOrders) (THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; STDMETHOD(Flip) (THIS_ LPDIRECTDRAWSURFACE2 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; STDMETHOD(GetAttachedSurface) (THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE2 * lplpDDAttachedSurface) PURE; STDMETHOD(GetBltStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetCaps) (THIS_ LPDDSCAPS lpDDSCaps) PURE; STDMETHOD(GetClipper) (THIS_ LPDIRECTDRAWCLIPPER * lplpDDClipper) PURE; STDMETHOD(GetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(GetDC) (THIS_ HDC * lphDC) PURE; STDMETHOD(GetFlipStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetOverlayPosition) (THIS_ LPLONG lplX, LPLONG lplY) PURE; STDMETHOD(GetPalette) (THIS_ LPDIRECTDRAWPALETTE * lplpDDPalette) PURE; STDMETHOD(GetPixelFormat) (THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(IsLost) (THIS) PURE; STDMETHOD(Lock) (THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC) (THIS_ HDC hDC) PURE; STDMETHOD(Restore) (THIS) PURE; STDMETHOD(SetClipper) (THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; STDMETHOD(SetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(SetOverlayPosition) (THIS_ LONG lX, LONG lY) PURE; STDMETHOD(SetPalette) (THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; STDMETHOD(Unlock) (THIS_ LPVOID lpSurfaceData) PURE; STDMETHOD(UpdateOverlay) (THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE2 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; STDMETHOD(UpdateOverlayDisplay) (THIS_ DWORD dwFlags) PURE; STDMETHOD(UpdateOverlayZOrder) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSReference) PURE; /* added in v2 */ STDMETHOD(GetDDInterface) (THIS_ LPVOID * lplpDD) PURE; STDMETHOD(PageLock) (THIS_ DWORD dwFlags) PURE; STDMETHOD(PageUnlock) (THIS_ DWORD dwFlags) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawSurface2_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawSurface2_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawSurface2_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawSurface methods (almost) ***/ #define IDirectDrawSurface2_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) #define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) #define IDirectDrawSurface2_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) #define IDirectDrawSurface2_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) #define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) #define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) #define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) #define IDirectDrawSurface2_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) #define IDirectDrawSurface2_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface2_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) #define IDirectDrawSurface2_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) #define IDirectDrawSurface2_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) #define IDirectDrawSurface2_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) #define IDirectDrawSurface2_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) #define IDirectDrawSurface2_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) #define IDirectDrawSurface2_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface2_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) #define IDirectDrawSurface2_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) #define IDirectDrawSurface2_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) #define IDirectDrawSurface2_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) #define IDirectDrawSurface2_IsLost(p) ICOM_CALL_(IsLost,p,(p)) #define IDirectDrawSurface2_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) #define IDirectDrawSurface2_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) #define IDirectDrawSurface2_Restore(p) ICOM_CALL_(Restore,p,(p)) #define IDirectDrawSurface2_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) #define IDirectDrawSurface2_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) #define IDirectDrawSurface2_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface2_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) #define IDirectDrawSurface2_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) #define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) #define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) #define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) /*** IDirectDrawSurface2 methods ***/ #define IDirectDrawSurface2_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) #define IDirectDrawSurface2_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) #define IDirectDrawSurface2_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) /***************************************************************************** * IDirectDrawSurface3 interface */ /* Cannot inherit from IDirectDrawSurface2 because the LPDIRECTDRAWSURFACE2 parameters * have been converted to LPDIRECTDRAWSURFACE3. */ #undef INTERFACE #define INTERFACE IDirectDrawSurface3 DECLARE_INTERFACE_(IDirectDrawSurface3, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(AddAttachedSurface) (THIS_ LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface) PURE; STDMETHOD(AddOverlayDirtyRect) (THIS_ LPRECT lpRect) PURE; STDMETHOD(Blt) (THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; STDMETHOD(BltBatch) (THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; STDMETHOD(BltFast) (THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; STDMETHOD(DeleteAttachedSurface) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface) PURE; STDMETHOD(EnumAttachedSurfaces) (THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; STDMETHOD(EnumOverlayZOrders) (THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; STDMETHOD(Flip) (THIS_ LPDIRECTDRAWSURFACE3 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; STDMETHOD(GetAttachedSurface) (THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE3 * lplpDDAttachedSurface) PURE; STDMETHOD(GetBltStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetCaps) (THIS_ LPDDSCAPS lpDDSCaps) PURE; STDMETHOD(GetClipper) (THIS_ LPDIRECTDRAWCLIPPER * lplpDDClipper) PURE; STDMETHOD(GetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(GetDC) (THIS_ HDC * lphDC) PURE; STDMETHOD(GetFlipStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetOverlayPosition) (THIS_ LPLONG lplX, LPLONG lplY) PURE; STDMETHOD(GetPalette) (THIS_ LPDIRECTDRAWPALETTE * lplpDDPalette) PURE; STDMETHOD(GetPixelFormat) (THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(IsLost) (THIS) PURE; STDMETHOD(Lock) (THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC) (THIS_ HDC hDC) PURE; STDMETHOD(Restore) (THIS) PURE; STDMETHOD(SetClipper) (THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; STDMETHOD(SetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(SetOverlayPosition) (THIS_ LONG lX, LONG lY) PURE; STDMETHOD(SetPalette) (THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; STDMETHOD(Unlock) (THIS_ LPVOID lpSurfaceData) PURE; STDMETHOD(UpdateOverlay) (THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE3 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; STDMETHOD(UpdateOverlayDisplay) (THIS_ DWORD dwFlags) PURE; STDMETHOD(UpdateOverlayZOrder) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSReference) PURE; /* added in v2 */ STDMETHOD(GetDDInterface) (THIS_ LPVOID * lplpDD) PURE; STDMETHOD(PageLock) (THIS_ DWORD dwFlags) PURE; STDMETHOD(PageUnlock) (THIS_ DWORD dwFlags) PURE; /* added in v3 */ STDMETHOD(SetSurfaceDesc) (THIS_ LPDDSURFACEDESC lpDDSD, DWORD dwFlags) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawSurface3_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawSurface3_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawSurface3_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawSurface methods (almost) ***/ #define IDirectDrawSurface3_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) #define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) #define IDirectDrawSurface3_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) #define IDirectDrawSurface3_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) #define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) #define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) #define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) #define IDirectDrawSurface3_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) #define IDirectDrawSurface3_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface3_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) #define IDirectDrawSurface3_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) #define IDirectDrawSurface3_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) #define IDirectDrawSurface3_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) #define IDirectDrawSurface3_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) #define IDirectDrawSurface3_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) #define IDirectDrawSurface3_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface3_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) #define IDirectDrawSurface3_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) #define IDirectDrawSurface3_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) #define IDirectDrawSurface3_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) #define IDirectDrawSurface3_IsLost(p) ICOM_CALL_(IsLost,p,(p)) #define IDirectDrawSurface3_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) #define IDirectDrawSurface3_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) #define IDirectDrawSurface3_Restore(p) ICOM_CALL_(Restore,p,(p)) #define IDirectDrawSurface3_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) #define IDirectDrawSurface3_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) #define IDirectDrawSurface3_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface3_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) #define IDirectDrawSurface3_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) #define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) #define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) #define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) /*** IDirectDrawSurface2 methods ***/ #define IDirectDrawSurface3_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) #define IDirectDrawSurface3_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) #define IDirectDrawSurface3_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) /*** IDirectDrawSurface3 methods ***/ #define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b)) /***************************************************************************** * IDirectDrawSurface4 interface */ /* Cannot inherit from IDirectDrawSurface2 because DDSCAPS changed to DDSCAPS2. */ #undef INTERFACE #define INTERFACE IDirectDrawSurface4 DECLARE_INTERFACE_(IDirectDrawSurface4, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(AddAttachedSurface) (THIS_ LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface) PURE; STDMETHOD(AddOverlayDirtyRect) (THIS_ LPRECT lpRect) PURE; STDMETHOD(Blt) (THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; STDMETHOD(BltBatch) (THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; STDMETHOD(BltFast) (THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; STDMETHOD(DeleteAttachedSurface) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface) PURE; STDMETHOD(EnumAttachedSurfaces) (THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE; STDMETHOD(EnumOverlayZOrders) (THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE; STDMETHOD(Flip) (THIS_ LPDIRECTDRAWSURFACE4 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; STDMETHOD(GetAttachedSurface) (THIS_ LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE4 * lplpDDAttachedSurface) PURE; STDMETHOD(GetBltStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetCaps) (THIS_ LPDDSCAPS2 lpDDSCaps) PURE; STDMETHOD(GetClipper) (THIS_ LPDIRECTDRAWCLIPPER * lplpDDClipper) PURE; STDMETHOD(GetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(GetDC) (THIS_ HDC * lphDC) PURE; STDMETHOD(GetFlipStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetOverlayPosition) (THIS_ LPLONG lplX, LPLONG lplY) PURE; STDMETHOD(GetPalette) (THIS_ LPDIRECTDRAWPALETTE * lplpDDPalette) PURE; STDMETHOD(GetPixelFormat) (THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc) (THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; STDMETHOD(IsLost) (THIS) PURE; STDMETHOD(Lock) (THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC) (THIS_ HDC hDC) PURE; STDMETHOD(Restore) (THIS) PURE; STDMETHOD(SetClipper) (THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; STDMETHOD(SetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(SetOverlayPosition) (THIS_ LONG lX, LONG lY) PURE; STDMETHOD(SetPalette) (THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; STDMETHOD(Unlock) (THIS_ LPRECT lpSurfaceData) PURE; STDMETHOD(UpdateOverlay) (THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE4 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; STDMETHOD(UpdateOverlayDisplay) (THIS_ DWORD dwFlags) PURE; STDMETHOD(UpdateOverlayZOrder) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSReference) PURE; /* added in v2 */ STDMETHOD(GetDDInterface) (THIS_ LPVOID * lplpDD) PURE; STDMETHOD(PageLock) (THIS_ DWORD dwFlags) PURE; STDMETHOD(PageUnlock) (THIS_ DWORD dwFlags) PURE; /* added in v3 */ STDMETHOD(SetSurfaceDesc) (THIS_ LPDDSURFACEDESC lpDDSD, DWORD dwFlags) PURE; /* added in v4 */ STDMETHOD(SetPrivateData) (THIS_ REFGUID, LPVOID, DWORD, DWORD) PURE; STDMETHOD(GetPrivateData) (THIS_ REFGUID, LPVOID, LPDWORD) PURE; STDMETHOD(FreePrivateData) (THIS_ REFGUID) PURE; STDMETHOD(GetUniquenessValue) (THIS_ LPDWORD) PURE; STDMETHOD(ChangeUniquenessValue) (THIS) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawSurface4_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawSurface4_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawSurface4_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawSurface (almost) methods ***/ #define IDirectDrawSurface4_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) #define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) #define IDirectDrawSurface4_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) #define IDirectDrawSurface4_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) #define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) #define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) #define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) #define IDirectDrawSurface4_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) #define IDirectDrawSurface4_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface4_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) #define IDirectDrawSurface4_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) #define IDirectDrawSurface4_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) #define IDirectDrawSurface4_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) #define IDirectDrawSurface4_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) #define IDirectDrawSurface4_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) #define IDirectDrawSurface4_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface4_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) #define IDirectDrawSurface4_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) #define IDirectDrawSurface4_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) #define IDirectDrawSurface4_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) #define IDirectDrawSurface4_IsLost(p) ICOM_CALL_(IsLost,p,(p)) #define IDirectDrawSurface4_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) #define IDirectDrawSurface4_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) #define IDirectDrawSurface4_Restore(p) ICOM_CALL_(Restore,p,(p)) #define IDirectDrawSurface4_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) #define IDirectDrawSurface4_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) #define IDirectDrawSurface4_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface4_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) #define IDirectDrawSurface4_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) #define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) #define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) #define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) /*** IDirectDrawSurface2 methods ***/ #define IDirectDrawSurface4_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) #define IDirectDrawSurface4_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) #define IDirectDrawSurface4_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) /*** IDirectDrawSurface3 methods ***/ #define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b)) /*** IDirectDrawSurface4 methods ***/ #define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) ICOM_CALL_(SetPrivateData,p,(p,a,b,c,d)) #define IDirectDrawSurface4_GetPrivateData(p,a,b,c) ICOM_CALL_(GetPrivateData,p,(p,a,b,c)) #define IDirectDrawSurface4_FreePrivateData(p,a) ICOM_CALL_(FreePrivateData,p,(p,a)) #define IDirectDrawSurface4_GetUniquenessValue(p,a) ICOM_CALL_(GetUniquenessValue,p,(p,a)) #define IDirectDrawSurface4_ChangeUniquenessValue(p) ICOM_CALL_(ChangeUniquenessValue,p,(p)) /***************************************************************************** * IDirectDrawSurface7 interface */ #undef INTERFACE #define INTERFACE IDirectDrawSurface7 DECLARE_INTERFACE_(IDirectDrawSurface7, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(AddAttachedSurface) (THIS_ LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface) PURE; STDMETHOD(AddOverlayDirtyRect) (THIS_ LPRECT lpRect) PURE; STDMETHOD(Blt) (THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE; STDMETHOD(BltBatch) (THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE; STDMETHOD(BltFast) (THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE; STDMETHOD(DeleteAttachedSurface) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface) PURE; STDMETHOD(EnumAttachedSurfaces) (THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback) PURE; STDMETHOD(EnumOverlayZOrders) (THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback) PURE; STDMETHOD(Flip) (THIS_ LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE; STDMETHOD(GetAttachedSurface) (THIS_ LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE7 * lplpDDAttachedSurface) PURE; STDMETHOD(GetBltStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetCaps) (THIS_ LPDDSCAPS2 lpDDSCaps) PURE; STDMETHOD(GetClipper) (THIS_ LPDIRECTDRAWCLIPPER * lplpDDClipper) PURE; STDMETHOD(GetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(GetDC) (THIS_ HDC * lphDC) PURE; STDMETHOD(GetFlipStatus) (THIS_ DWORD dwFlags) PURE; STDMETHOD(GetOverlayPosition) (THIS_ LPLONG lplX, LPLONG lplY) PURE; STDMETHOD(GetPalette) (THIS_ LPDIRECTDRAWPALETTE * lplpDDPalette) PURE; STDMETHOD(GetPixelFormat) (THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc) (THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; STDMETHOD(Initialize) (THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; STDMETHOD(IsLost) (THIS) PURE; STDMETHOD(Lock) (THIS_ LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC) (THIS_ HDC hDC) PURE; STDMETHOD(Restore) (THIS) PURE; STDMETHOD(SetClipper) (THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE; STDMETHOD(SetColorKey) (THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE; STDMETHOD(SetOverlayPosition) (THIS_ LONG lX, LONG lY) PURE; STDMETHOD(SetPalette) (THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE; STDMETHOD(Unlock) (THIS_ LPRECT lpSurfaceData) PURE; STDMETHOD(UpdateOverlay) (THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE7 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE; STDMETHOD(UpdateOverlayDisplay) (THIS_ DWORD dwFlags) PURE; STDMETHOD(UpdateOverlayZOrder) (THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSReference) PURE; /* added in v2 */ STDMETHOD(GetDDInterface) (THIS_ LPVOID * lplpDD) PURE; STDMETHOD(PageLock) (THIS_ DWORD dwFlags) PURE; STDMETHOD(PageUnlock) (THIS_ DWORD dwFlags) PURE; /* added in v3 */ STDMETHOD(SetSurfaceDesc) (THIS_ LPDDSURFACEDESC2 lpDDSD, DWORD dwFlags) PURE; /* added in v4 */ STDMETHOD(SetPrivateData) (THIS_ REFGUID, LPVOID, DWORD, DWORD) PURE; STDMETHOD(GetPrivateData) (THIS_ REFGUID, LPVOID, LPDWORD) PURE; STDMETHOD(FreePrivateData) (THIS_ REFGUID) PURE; STDMETHOD(GetUniquenessValue) (THIS_ LPDWORD) PURE; STDMETHOD(ChangeUniquenessValue) (THIS) PURE; /* added in v7 */ STDMETHOD(SetPriority) (THIS_ DWORD prio) PURE; STDMETHOD(GetPriority) (THIS_ LPDWORD prio) PURE; STDMETHOD(SetLOD) (THIS_ DWORD lod) PURE; STDMETHOD(GetLOD) (THIS_ LPDWORD lod) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawSurface7_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawSurface7_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawSurface7_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawSurface (almost) methods ***/ #define IDirectDrawSurface7_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a)) #define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a)) #define IDirectDrawSurface7_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e)) #define IDirectDrawSurface7_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c)) #define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e)) #define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b)) #define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c)) #define IDirectDrawSurface7_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b)) #define IDirectDrawSurface7_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b)) #define IDirectDrawSurface7_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a)) #define IDirectDrawSurface7_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a)) #define IDirectDrawSurface7_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a)) #define IDirectDrawSurface7_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b)) #define IDirectDrawSurface7_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a)) #define IDirectDrawSurface7_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a)) #define IDirectDrawSurface7_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface7_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a)) #define IDirectDrawSurface7_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a)) #define IDirectDrawSurface7_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a)) #define IDirectDrawSurface7_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b)) #define IDirectDrawSurface7_IsLost(p) ICOM_CALL_(IsLost,p,(p)) #define IDirectDrawSurface7_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d)) #define IDirectDrawSurface7_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a)) #define IDirectDrawSurface7_Restore(p) ICOM_CALL_(Restore,p,(p)) #define IDirectDrawSurface7_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a)) #define IDirectDrawSurface7_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b)) #define IDirectDrawSurface7_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b)) #define IDirectDrawSurface7_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a)) #define IDirectDrawSurface7_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a)) #define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e)) #define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a)) #define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b)) /*** IDirectDrawSurface2 methods ***/ #define IDirectDrawSurface7_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a)) #define IDirectDrawSurface7_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a)) #define IDirectDrawSurface7_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a)) /*** IDirectDrawSurface3 methods ***/ #define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b)) /*** IDirectDrawSurface4 methods ***/ #define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) ICOM_CALL_(SetPrivateData,p,(p,a,b,c,d)) #define IDirectDrawSurface7_GetPrivateData(p,a,b,c) ICOM_CALL_(GetPrivateData,p,(p,a,b,c)) #define IDirectDrawSurface7_FreePrivateData(p,a) ICOM_CALL_(FreePrivateData,p,(p,a)) #define IDirectDrawSurface7_GetUniquenessValue(p,a) ICOM_CALL_(GetUniquenessValue,p,(p,a)) #define IDirectDrawSurface7_ChangeUniquenessValue(p) ICOM_CALL_(ChangeUniquenessValue,p,(p)) /*** IDirectDrawSurface7 methods ***/ #define IDirectDrawSurface7_SetPriority(p,a) ICOM_CALL_(SetPriority,p,(p,a)) #define IDirectDrawSurface7_GetPriority(p,a) ICOM_CALL_(GetPriority,p,(p,a)) #define IDirectDrawSurface7_SetLOD(p,a) ICOM_CALL_(SetLOD,p,(p,a)) #define IDirectDrawSurface7_GetLOD(p,a) ICOM_CALL_(GetLOD,p,(p,a)) /***************************************************************************** * IDirectDrawColorControl interface */ #undef INTERFACE #define INTERFACE IDirectDrawColorControl DECLARE_INTERFACE_(IDirectDrawColorControl, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(GetColorControls) (THIS_ LPDDCOLORCONTROL lpColorControl) PURE; STDMETHOD(SetColorControls) (THIS_ LPDDCOLORCONTROL lpColorControl) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawColorControl_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawColorControl_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawColorControl_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawColorControl methods ***/ #define IDirectDrawColorControl_GetColorControls(p,a) ICOM_CALL_(GetColorControls,p,(p,a)) #define IDirectDrawColorControl_SetColorControls(p,a) ICOM_CALL_(SetColorControls,p,(p,a)) /***************************************************************************** * IDirectDrawGammaControl interface */ #undef INTERFACE #define INTERFACE IDirectDrawGammaControl DECLARE_INTERFACE_(IDirectDrawGammaControl, IUnknown) { STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; STDMETHOD(GetGammaRamp) (THIS_ DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) PURE; STDMETHOD(SetGammaRamp) (THIS_ DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) PURE; }; /*** IUnknown methods ***/ #define IDirectDrawGammaControl_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b)) #define IDirectDrawGammaControl_AddRef(p) ICOM_CALL_(AddRef,p,(p)) #define IDirectDrawGammaControl_Release(p) ICOM_CALL_(Release,p,(p)) /*** IDirectDrawGammaControl methods ***/ #define IDirectDrawGammaControl_GetGammaRamp(p,a,b) ICOM_CALL_(GetGammaRamp,p,(p,a,b)) #define IDirectDrawGammaControl_SetGammaRamp(p,a,b) ICOM_CALL_(SetGammaRamp,p,(p,a,b)) HRESULT WINAPI DirectDrawCreate(LPGUID, LPDIRECTDRAW *, LPUNKNOWN); HRESULT WINAPI DirectDrawCreateEx(LPGUID, LPVOID *, REFIID, LPUNKNOWN); HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA, LPVOID); HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW, LPVOID); #define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate) HRESULT WINAPI DirectDrawCreateClipper(DWORD, LPDIRECTDRAWCLIPPER *, LPUNKNOWN); #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */ #endif /* __XWIN_DDRAW_H */ xorg-server-1.20.8/hw/xwin/XWin.exe.manifest0000755000175000017500000000256313640201473015617 00000000000000 The XWin X Windows server true xorg-server-1.20.8/hw/xwin/winconfig.c0000644000175000017500000007251113640201473014546 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Alexander Gottwald */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winconfig.h" #include "winmsg.h" #include "globals.h" #include "xkbsrv.h" #ifdef XWIN_XF86CONFIG #ifndef CONFIGPATH #define CONFIGPATH "%A," "%R," \ "/etc/X11/%R," "%P/etc/X11/%R," \ "%E," "%F," \ "/etc/X11/%F," "%P/etc/X11/%F," \ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ "%P/etc/X11/%X," \ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif #ifndef CONFIGDIRPATH #define CONFIGDIRPATH "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ "%P/etc/X11/%X," \ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif XF86ConfigPtr g_xf86configptr = NULL; #endif WinCmdlineRec g_cmdline = { #ifdef XWIN_XF86CONFIG NULL, /* configFile */ NULL, /* configDir */ #endif NULL, /* fontPath */ #ifdef XWIN_XF86CONFIG NULL, /* keyboard */ #endif NULL, /* xkbRules */ NULL, /* xkbModel */ NULL, /* xkbLayout */ NULL, /* xkbVariant */ NULL, /* xkbOptions */ NULL, /* screenname */ NULL, /* mousename */ FALSE, /* emulate3Buttons */ 0 /* emulate3Timeout */ }; winInfoRec g_winInfo = { { /* keyboard */ 0, /* leds */ 500, /* delay */ 30 /* rate */ } , { /* xkb */ NULL, /* rules */ NULL, /* model */ NULL, /* layout */ NULL, /* variant */ NULL, /* options */ } , { FALSE, 50} }; #define NULL_IF_EMPTY(x) (winNameCompare(x,"")?x:NULL) #ifdef XWIN_XF86CONFIG serverLayoutRec g_winConfigLayout; static Bool ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p); static Bool configLayout(serverLayoutPtr, XF86ConfLayoutPtr, char *); static Bool configImpliedLayout(serverLayoutPtr, XF86ConfScreenPtr); static Bool GetBoolValue(OptionInfoPtr p, const char *s); Bool winReadConfigfile() { Bool retval = TRUE; char *filename, *dirname; MessageType filefrom = X_DEFAULT; MessageType dirfrom = X_DEFAULT; char *xf86ConfigFile = NULL; char *xf86ConfigDir = NULL; if (g_cmdline.configFile) { filefrom = X_CMDLINE; xf86ConfigFile = g_cmdline.configFile; } if (g_cmdline.configDir) { dirfrom = X_CMDLINE; xf86ConfigDir = g_cmdline.configDir; } /* Parse config file into data structure */ xf86initConfigFiles(); dirname = xf86openConfigDirFiles(CONFIGDIRPATH, xf86ConfigDir, PROJECTROOT); filename = xf86openConfigFile(CONFIGPATH, xf86ConfigFile, PROJECTROOT); /* Hack for backward compatibility */ if (!filename && from == X_DEFAULT) filename = xf86openConfigFile(CONFIGPATH, "XF86Config", PROJECTROOT); if (filename) { winMsg(from, "Using config file: \"%s\"\n", filename); } else { winMsg(X_ERROR, "Unable to locate/open config file"); if (xf86ConfigFile) ErrorF(": \"%s\"", xf86ConfigFile); ErrorF("\n"); } if (dirname) { winMsg(from, "Using config directory: \"%s\"\n", dirname); } else { winMsg(X_ERROR, "Unable to locate/open config directory"); if (xf86ConfigDir) ErrorF(": \"%s\"", xf86ConfigDir); ErrorF("\n"); } if (!filename && !dirname) { return FALSE; } free(filename); free(dirname); if ((g_xf86configptr = xf86readConfigFile()) == NULL) { winMsg(X_ERROR, "Problem parsing the config file\n"); return FALSE; } xf86closeConfigFile(); LogPrintMarkers(); /* set options from data structure */ if (g_xf86configptr->conf_layout_lst == NULL || g_cmdline.screenname != NULL) { if (g_cmdline.screenname == NULL) { winMsg(X_WARNING, "No Layout section. Using the first Screen section.\n"); } if (!configImpliedLayout(&g_winConfigLayout, g_xf86configptr->conf_screen_lst)) { winMsg(X_ERROR, "Unable to determine the screen layout\n"); return FALSE; } } else { /* Check if layout is given in the config file */ if (g_xf86configptr->conf_flags != NULL) { char *dfltlayout = NULL; void *optlist = g_xf86configptr->conf_flags->flg_option_lst; if (optlist && winFindOption(optlist, "defaultserverlayout")) dfltlayout = winSetStrOption(optlist, "defaultserverlayout", NULL); if (!configLayout(&g_winConfigLayout, g_xf86configptr->conf_layout_lst, dfltlayout)) { winMsg(X_ERROR, "Unable to determine the screen layout\n"); return FALSE; } } else { if (!configLayout(&g_winConfigLayout, g_xf86configptr->conf_layout_lst, NULL)) { winMsg(X_ERROR, "Unable to determine the screen layout\n"); return FALSE; } } } /* setup special config files */ winConfigFiles(); return retval; } #endif /* load layout definitions */ #include "winlayouts.h" /* Set the keyboard configuration */ Bool winConfigKeyboard(DeviceIntPtr pDevice) { char layoutName[KL_NAMELENGTH]; unsigned char layoutFriendlyName[256]; unsigned int layoutNum = 0; unsigned int deviceIdentifier = 0; int keyboardType; #ifdef XWIN_XF86CONFIG XF86ConfInputPtr kbd = NULL; XF86ConfInputPtr input_list = NULL; MessageType kbdfrom = X_CONFIG; #endif MessageType from = X_DEFAULT; char *s = NULL; /* Setup defaults */ XkbGetRulesDflts(&g_winInfo.xkb); /* * Query the windows autorepeat settings and change the xserver defaults. */ { int kbd_delay; DWORD kbd_speed; if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &kbd_delay, 0) && SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &kbd_speed, 0)) { switch (kbd_delay) { case 0: g_winInfo.keyboard.delay = 250; break; case 1: g_winInfo.keyboard.delay = 500; break; case 2: g_winInfo.keyboard.delay = 750; break; default: case 3: g_winInfo.keyboard.delay = 1000; break; } g_winInfo.keyboard.rate = (kbd_speed > 0) ? kbd_speed : 1; winMsg(X_PROBED, "Setting autorepeat to delay=%ld, rate=%ld\n", g_winInfo.keyboard.delay, g_winInfo.keyboard.rate); } } keyboardType = GetKeyboardType(0); if (keyboardType > 0 && GetKeyboardLayoutName(layoutName)) { WinKBLayoutPtr pLayout; Bool bfound = FALSE; int pass; layoutNum = strtoul(layoutName, (char **) NULL, 16); if ((layoutNum & 0xffff) == 0x411) { if (keyboardType == 7) { /* Japanese layouts have problems with key event messages such as the lack of WM_KEYUP for Caps Lock key. Loading US layout fixes this problem. */ if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL) winMsg(X_INFO, "Loading US keyboard layout.\n"); else winMsg(X_ERROR, "LoadKeyboardLayout failed.\n"); } } /* Discover the friendly name of the current layout */ { HKEY regkey = NULL; const char regtempl[] = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"; char *regpath; DWORD namesize = sizeof(layoutFriendlyName); regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1); strcpy(regpath, regtempl); strcat(regpath, layoutName); if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, ®key)) RegQueryValueEx(regkey, "Layout Text", 0, NULL, layoutFriendlyName, &namesize); /* Close registry key */ if (regkey) RegCloseKey(regkey); free(regpath); } winMsg(X_PROBED, "Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n", layoutName, layoutNum, layoutFriendlyName, keyboardType); deviceIdentifier = layoutNum >> 16; for (pass = 0; pass < 2; pass++) { /* If we didn't find an exact match for the input locale identifer, try to find an match on the language identifier part only */ if (pass == 1) layoutNum = (layoutNum & 0xffff); for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) { if (pLayout->winlayout != layoutNum) continue; if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType) continue; bfound = TRUE; winMsg(X_PROBED, "Found matching XKB configuration \"%s\"\n", pLayout->layoutname); winMsg(X_PROBED, "Model = \"%s\" Layout = \"%s\"" " Variant = \"%s\" Options = \"%s\"\n", pLayout->xkbmodel ? pLayout->xkbmodel : "none", pLayout->xkblayout ? pLayout->xkblayout : "none", pLayout->xkbvariant ? pLayout->xkbvariant : "none", pLayout->xkboptions ? pLayout->xkboptions : "none"); g_winInfo.xkb.model = pLayout->xkbmodel; g_winInfo.xkb.layout = pLayout->xkblayout; g_winInfo.xkb.variant = pLayout->xkbvariant; g_winInfo.xkb.options = pLayout->xkboptions; if (deviceIdentifier == 0xa000) { winMsg(X_PROBED, "Windows keyboard layout device identifier indicates Macintosh, setting Model = \"macintosh\""); g_winInfo.xkb.model = "macintosh"; } break; } if (bfound) break; } if (!bfound) { winMsg(X_ERROR, "Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName); } } /* parse the configuration */ #ifdef XWIN_XF86CONFIG if (g_cmdline.keyboard) kbdfrom = X_CMDLINE; /* * Until the layout code is finished, I search for the keyboard * device and configure the server with it. */ if (g_xf86configptr != NULL) input_list = g_xf86configptr->conf_input_lst; while (input_list != NULL) { if (winNameCompare(input_list->inp_driver, "keyboard") == 0) { /* Check if device name matches requested name */ if (g_cmdline.keyboard && winNameCompare(input_list->inp_identifier, g_cmdline.keyboard)) continue; kbd = input_list; } input_list = input_list->list.next; } if (kbd != NULL) { if (kbd->inp_identifier) winMsg(kbdfrom, "Using keyboard \"%s\" as primary keyboard\n", kbd->inp_identifier); if ((s = winSetStrOption(kbd->inp_option_lst, "AutoRepeat", NULL))) { if ((sscanf(s, "%ld %ld", &g_winInfo.keyboard.delay, &g_winInfo.keyboard.rate) != 2) || (g_winInfo.keyboard.delay < 1) || (g_winInfo.keyboard.rate == 0) || (1000 / g_winInfo.keyboard.rate) < 1) { winErrorFVerb(2, "\"%s\" is not a valid AutoRepeat value", s); free(s); return FALSE; } free(s); winMsg(X_CONFIG, "AutoRepeat: %ld %ld\n", g_winInfo.keyboard.delay, g_winInfo.keyboard.rate); } #endif s = NULL; if (g_cmdline.xkbRules) { s = g_cmdline.xkbRules; from = X_CMDLINE; } #ifdef XWIN_XF86CONFIG else { s = winSetStrOption(kbd->inp_option_lst, "XkbRules", NULL); from = X_CONFIG; } #endif if (s) { g_winInfo.xkb.rules = NULL_IF_EMPTY(s); winMsg(from, "XKB: rules: \"%s\"\n", s); } s = NULL; if (g_cmdline.xkbModel) { s = g_cmdline.xkbModel; from = X_CMDLINE; } #ifdef XWIN_XF86CONFIG else { s = winSetStrOption(kbd->inp_option_lst, "XkbModel", NULL); from = X_CONFIG; } #endif if (s) { g_winInfo.xkb.model = NULL_IF_EMPTY(s); winMsg(from, "XKB: model: \"%s\"\n", s); } s = NULL; if (g_cmdline.xkbLayout) { s = g_cmdline.xkbLayout; from = X_CMDLINE; } #ifdef XWIN_XF86CONFIG else { s = winSetStrOption(kbd->inp_option_lst, "XkbLayout", NULL); from = X_CONFIG; } #endif if (s) { g_winInfo.xkb.layout = NULL_IF_EMPTY(s); winMsg(from, "XKB: layout: \"%s\"\n", s); } s = NULL; if (g_cmdline.xkbVariant) { s = g_cmdline.xkbVariant; from = X_CMDLINE; } #ifdef XWIN_XF86CONFIG else { s = winSetStrOption(kbd->inp_option_lst, "XkbVariant", NULL); from = X_CONFIG; } #endif if (s) { g_winInfo.xkb.variant = NULL_IF_EMPTY(s); winMsg(from, "XKB: variant: \"%s\"\n", s); } s = NULL; if (g_cmdline.xkbOptions) { s = g_cmdline.xkbOptions; from = X_CMDLINE; } #ifdef XWIN_XF86CONFIG else { s = winSetStrOption(kbd->inp_option_lst, "XkbOptions", NULL); from = X_CONFIG; } #endif if (s) { g_winInfo.xkb.options = NULL_IF_EMPTY(s); winMsg(from, "XKB: options: \"%s\"\n", s); } #ifdef XWIN_XF86CONFIG } #endif return TRUE; } #ifdef XWIN_XF86CONFIG Bool winConfigMouse(DeviceIntPtr pDevice) { MessageType mousefrom = X_CONFIG; XF86ConfInputPtr mouse = NULL; XF86ConfInputPtr input_list = NULL; if (g_cmdline.mouse) mousefrom = X_CMDLINE; if (g_xf86configptr != NULL) input_list = g_xf86configptr->conf_input_lst; while (input_list != NULL) { if (winNameCompare(input_list->inp_driver, "mouse") == 0) { /* Check if device name matches requested name */ if (g_cmdline.mouse && winNameCompare(input_list->inp_identifier, g_cmdline.mouse)) continue; mouse = input_list; } input_list = input_list->list.next; } if (mouse != NULL) { if (mouse->inp_identifier) winMsg(mousefrom, "Using pointer \"%s\" as primary pointer\n", mouse->inp_identifier); g_winInfo.pointer.emulate3Buttons = winSetBoolOption(mouse->inp_option_lst, "Emulate3Buttons", FALSE); if (g_cmdline.emulate3buttons) g_winInfo.pointer.emulate3Buttons = g_cmdline.emulate3buttons; g_winInfo.pointer.emulate3Timeout = winSetIntOption(mouse->inp_option_lst, "Emulate3Timeout", 50); if (g_cmdline.emulate3timeout) g_winInfo.pointer.emulate3Timeout = g_cmdline.emulate3timeout; } else { winMsg(X_ERROR, "No primary pointer configured\n"); winMsg(X_DEFAULT, "Using compiletime defaults for pointer\n"); } return TRUE; } Bool winConfigFiles() { MessageType from; XF86ConfFilesPtr filesptr = NULL; /* set some shortcuts */ if (g_xf86configptr != NULL) { filesptr = g_xf86configptr->conf_files; } /* Fontpath */ from = X_DEFAULT; if (g_cmdline.fontPath) { from = X_CMDLINE; defaultFontPath = g_cmdline.fontPath; } else if (filesptr != NULL && filesptr->file_fontpath) { from = X_CONFIG; defaultFontPath = strdup(filesptr->file_fontpath); } winMsg(from, "FontPath set to \"%s\"\n", defaultFontPath); return TRUE; } #else Bool winConfigFiles(void) { /* Fontpath */ if (g_cmdline.fontPath) { defaultFontPath = g_cmdline.fontPath; winMsg(X_CMDLINE, "FontPath set to \"%s\"\n", defaultFontPath); } return TRUE; } #endif Bool winConfigOptions(void) { return TRUE; } Bool winConfigScreens(void) { return TRUE; } #ifdef XWIN_XF86CONFIG char * winSetStrOption(void *optlist, const char *name, char *deflt) { OptionInfoRec o; o.name = name; o.type = OPTV_STRING; if (ParseOptionValue(-1, optlist, &o)) deflt = o.value.str; if (deflt) return strdup(deflt); else return NULL; } int winSetBoolOption(void *optlist, const char *name, int deflt) { OptionInfoRec o; o.name = name; o.type = OPTV_BOOLEAN; if (ParseOptionValue(-1, optlist, &o)) deflt = o.value.bool; return deflt; } int winSetIntOption(void *optlist, const char *name, int deflt) { OptionInfoRec o; o.name = name; o.type = OPTV_INTEGER; if (ParseOptionValue(-1, optlist, &o)) deflt = o.value.num; return deflt; } double winSetRealOption(void *optlist, const char *name, double deflt) { OptionInfoRec o; o.name = name; o.type = OPTV_REAL; if (ParseOptionValue(-1, optlist, &o)) deflt = o.value.realnum; return deflt; } double winSetPercentOption(void *optlist, const char *name, double deflt) { OptionInfoRec o; o.name = name; o.type = OPTV_PERCENT; if (ParseOptionValue(-1, optlist, &o)) deflt = o.value.realnum; return deflt; } #endif /* * Compare two strings for equality. This is caseinsensitive and * The characters '_', ' ' (space) and '\t' (tab) are treated as * not existing. */ int winNameCompare(const char *s1, const char *s2) { char c1, c2; if (!s1 || *s1 == 0) { if (!s2 || *s2 == 0) return 0; else return 1; } while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') s1++; while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') s2++; c1 = (isupper((int) *s1) ? tolower((int) *s1) : *s1); c2 = (isupper((int) *s2) ? tolower((int) *s2) : *s2); while (c1 == c2) { if (c1 == 0) return 0; s1++; s2++; while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') s1++; while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') s2++; c1 = (isupper((int) *s1) ? tolower((int) *s1) : *s1); c2 = (isupper((int) *s2) ? tolower((int) *s2) : *s2); } return c1 - c2; } #ifdef XWIN_XF86CONFIG /* * Find the named option in the list. * @return the pointer to the option record, or NULL if not found. */ XF86OptionPtr winFindOption(XF86OptionPtr list, const char *name) { while (list) { if (winNameCompare(list->opt_name, name) == 0) return list; list = list->list.next; } return NULL; } /* * Find the Value of an named option. * @return The option value or NULL if not found. */ char * winFindOptionValue(XF86OptionPtr list, const char *name) { list = winFindOption(list, name); if (list) { if (list->opt_val) return list->opt_val; else return ""; } return NULL; } /* * Parse the option. */ static Bool ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p) { char *s, *end; if ((s = winFindOptionValue(options, p->name)) != NULL) { switch (p->type) { case OPTV_INTEGER: if (*s == '\0') { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires an integer value\n", p->name); p->found = FALSE; } else { p->value.num = strtoul(s, &end, 0); if (*end == '\0') { p->found = TRUE; } else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires an integer value\n", p->name); p->found = FALSE; } } break; case OPTV_STRING: if (*s == '\0') { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a string value\n", p->name); p->found = FALSE; } else { p->value.str = s; p->found = TRUE; } break; case OPTV_ANYSTR: p->value.str = s; p->found = TRUE; break; case OPTV_REAL: if (*s == '\0') { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a floating point value\n", p->name); p->found = FALSE; } else { p->value.realnum = strtod(s, &end); if (*end == '\0') { p->found = TRUE; } else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a floating point value\n", p->name); p->found = FALSE; } } break; case OPTV_BOOLEAN: if (GetBoolValue(p, s)) { p->found = TRUE; } else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a boolean value\n", p->name); p->found = FALSE; } break; case OPTV_PERCENT: if (*s == '\0') { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a percent value\n", p->name); p->found = FALSE; } else { double percent = strtod(s, &end); if (end != s && winNameCompare(end, "%")) { p->found = TRUE; p->value.realnum = percent; } else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); p->found = FALSE; } } case OPTV_FREQ: if (*s == '\0') { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); p->found = FALSE; } else { double freq = strtod(s, &end); int units = 0; if (end != s) { p->found = TRUE; if (!winNameCompare(end, "Hz")) units = 1; else if (!winNameCompare(end, "kHz") || !winNameCompare(end, "k")) units = 1000; else if (!winNameCompare(end, "MHz") || !winNameCompare(end, "M")) units = 1000000; else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); p->found = FALSE; } if (p->found) freq *= (double) units; } else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); p->found = FALSE; } if (p->found) { p->value.freq.freq = freq; p->value.freq.units = units; } } break; case OPTV_NONE: /* Should never get here */ p->found = FALSE; break; } if (p->found) { winDrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", p->name); if (!(p->type == OPTV_BOOLEAN && *s == 0)) { winErrorFVerb(2, " \"%s\"", s); } winErrorFVerb(2, "\n"); } } else if (p->type == OPTV_BOOLEAN) { /* Look for matches with options with or without a "No" prefix. */ char *n, *newn; OptionInfoRec opt; n = winNormalizeName(p->name); if (!n) { p->found = FALSE; return FALSE; } if (strncmp(n, "no", 2) == 0) { newn = n + 2; } else { free(n); n = malloc(strlen(p->name) + 2 + 1); if (!n) { p->found = FALSE; return FALSE; } strcpy(n, "No"); strcat(n, p->name); newn = n; } if ((s = winFindOptionValue(options, newn)) != NULL) { if (GetBoolValue(&opt, s)) { p->value.bool = !opt.value.bool; p->found = TRUE; } else { winDrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a boolean value\n", newn); p->found = FALSE; } } else { p->found = FALSE; } if (p->found) { winDrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn); if (*s != 0) { winErrorFVerb(2, " \"%s\"", s); } winErrorFVerb(2, "\n"); } free(n); } else { p->found = FALSE; } return p->found; } static Bool configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, char *default_layout) { #if 0 #pragma warn UNIMPLEMENTED #endif return TRUE; } static Bool configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) { #if 0 #pragma warn UNIMPLEMENTED #endif return TRUE; } static Bool GetBoolValue(OptionInfoPtr p, const char *s) { if (*s == 0) { p->value.bool = TRUE; } else { if (winNameCompare(s, "1") == 0) p->value.bool = TRUE; else if (winNameCompare(s, "on") == 0) p->value.bool = TRUE; else if (winNameCompare(s, "true") == 0) p->value.bool = TRUE; else if (winNameCompare(s, "yes") == 0) p->value.bool = TRUE; else if (winNameCompare(s, "0") == 0) p->value.bool = FALSE; else if (winNameCompare(s, "off") == 0) p->value.bool = FALSE; else if (winNameCompare(s, "false") == 0) p->value.bool = FALSE; else if (winNameCompare(s, "no") == 0) p->value.bool = FALSE; } return TRUE; } #endif char * winNormalizeName(const char *s) { char *ret, *q; const char *p; if (s == NULL) return NULL; ret = malloc(strlen(s) + 1); for (p = s, q = ret; *p != 0; p++) { switch (*p) { case '_': case ' ': case '\t': continue; default: if (isupper((int) *p)) *q++ = tolower((int) *p); else *q++ = *p; } } *q = '\0'; return ret; } xorg-server-1.20.8/hw/xwin/winwin32rootlesswndproc.c0000644000175000017500000010675013640201473017436 00000000000000/* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Kensuke Matsuzaki * Earle F. Philhower, III * Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include #define _WINDOWSWM_SERVER_ #include #include "dixevents.h" #include "propertyst.h" #include #include "winmultiwindowclass.h" #include "winmsg.h" #include "inputstr.h" /* * Constant defines */ #define MOUSE_ACTIVATE_DEFAULT TRUE #define RAISE_ON_CLICK_DEFAULT FALSE /* * Local globals */ static UINT_PTR g_uipMousePollingTimerID = 0; /* * Local function */ DEFINE_ATOM_HELPER(AtmWindowsWMMouseActivate, WINDOWSWM_MOUSE_ACTIVATE) /* DEFINE_ATOM_HELPER(AtmWindowsWMClientWindow, WINDOWSWM_CLIENT_WINDOW) */ /* * ConstrainSize - Taken from TWM sources - Respects hints for sizing */ #define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) ) static void ConstrainSize(WinXSizeHints hints, int *widthp, int *heightp) { int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta; int baseWidth, baseHeight; int dwidth = *widthp, dheight = *heightp; if (hints.flags & PMinSize) { minWidth = hints.min_width; minHeight = hints.min_height; } else if (hints.flags & PBaseSize) { minWidth = hints.base_width; minHeight = hints.base_height; } else minWidth = minHeight = 1; if (hints.flags & PBaseSize) { baseWidth = hints.base_width; baseHeight = hints.base_height; } else if (hints.flags & PMinSize) { baseWidth = hints.min_width; baseHeight = hints.min_height; } else baseWidth = baseHeight = 0; if (hints.flags & PMaxSize) { maxWidth = hints.max_width; maxHeight = hints.max_height; } else { maxWidth = MAXINT; maxHeight = MAXINT; } if (hints.flags & PResizeInc) { xinc = hints.width_inc; yinc = hints.height_inc; } else xinc = yinc = 1; /* * First, clamp to min and max values */ if (dwidth < minWidth) dwidth = minWidth; if (dheight < minHeight) dheight = minHeight; if (dwidth > maxWidth) dwidth = maxWidth; if (dheight > maxHeight) dheight = maxHeight; /* * Second, fit to base + N * inc */ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth; dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight; /* * Third, adjust for aspect ratio */ /* * The math looks like this: * * minAspectX dwidth maxAspectX * ---------- <= ------- <= ---------- * minAspectY dheight maxAspectY * * If that is multiplied out, then the width and height are * invalid in the following situations: * * minAspectX * dheight > minAspectY * dwidth * maxAspectX * dheight < maxAspectY * dwidth * */ if (hints.flags & PAspect) { if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth) { delta = makemult(hints.min_aspect.x * dheight / hints.min_aspect.y - dwidth, xinc); if (dwidth + delta <= maxWidth) dwidth += delta; else { delta = makemult(dheight - dwidth * hints.min_aspect.y / hints.min_aspect.x, yinc); if (dheight - delta >= minHeight) dheight -= delta; } } if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth) { delta = makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x - dheight, yinc); if (dheight + delta <= maxHeight) dheight += delta; else { delta = makemult(dwidth - hints.max_aspect.x * dheight / hints.max_aspect.y, xinc); if (dwidth - delta >= minWidth) dwidth -= delta; } } } /* Return computed values */ *widthp = dwidth; *heightp = dheight; } #undef makemult /* * ValidateSizing - Ensures size request respects hints */ static int ValidateSizing(HWND hwnd, WindowPtr pWin, WPARAM wParam, LPARAM lParam) { WinXSizeHints sizeHints; RECT *rect; int iWidth, iHeight, iTopBorder; POINT pt; /* Invalid input checking */ if (pWin == NULL || lParam == 0) { ErrorF("Invalid input checking\n"); return FALSE; } /* No size hints, no checking */ if (!winMultiWindowGetWMNormalHints(pWin, &sizeHints)) { ErrorF("No size hints, no checking\n"); return FALSE; } /* Avoid divide-by-zero */ if (sizeHints.flags & PResizeInc) { if (sizeHints.width_inc == 0) sizeHints.width_inc = 1; if (sizeHints.height_inc == 0) sizeHints.height_inc = 1; } rect = (RECT *) lParam; iWidth = rect->right - rect->left; iHeight = rect->bottom - rect->top; /* Get title bar height, there must be an easier way?! */ pt.x = pt.y = 0; ClientToScreen(hwnd, &pt); iTopBorder = pt.y - rect->top; /* Now remove size of any borders */ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME); iHeight -= GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder; /* Constrain the size to legal values */ ConstrainSize(sizeHints, &iWidth, &iHeight); /* Add back the borders */ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); iHeight += GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder; /* Adjust size according to where we're dragging from */ switch (wParam) { case WMSZ_TOP: case WMSZ_TOPRIGHT: case WMSZ_BOTTOM: case WMSZ_BOTTOMRIGHT: case WMSZ_RIGHT: rect->right = rect->left + iWidth; break; default: rect->left = rect->right - iWidth; break; } switch (wParam) { case WMSZ_BOTTOM: case WMSZ_BOTTOMRIGHT: case WMSZ_BOTTOMLEFT: case WMSZ_RIGHT: case WMSZ_LEFT: rect->bottom = rect->top + iHeight; break; default: rect->top = rect->bottom - iHeight; break; } return TRUE; } /* * IsMouseActive */ static Bool IsMouseActive(WindowPtr pWin) { struct _Window *pwin; struct _Property *prop; /* XXX We're getting inputInfo.poniter here, but this might be really wrong. * Which pointer's current window do we want? */ WindowPtr pRoot = GetCurrentRootWindow(inputInfo.pointer); if (!pWin) { ErrorF("IsMouseActive - pWin was NULL use default value:%d\n", MOUSE_ACTIVATE_DEFAULT); return MOUSE_ACTIVATE_DEFAULT; } pwin = (struct _Window *) pWin; if (pwin->optional) prop = (struct _Property *) pwin->optional->userProps; else prop = NULL; while (prop) { if (prop->propertyName == AtmWindowsWMMouseActivate() && prop->type == XA_INTEGER && prop->format == 32) { return *(int *) prop->data; } else prop = prop->next; } if (pWin != pRoot) { return IsMouseActive(pRoot); } else { #if CYGMULTIWINDOW_DEBUG winDebug("IsMouseActive - no prop use default value:%d\n", MOUSE_ACTIVATE_DEFAULT); #endif return MOUSE_ACTIVATE_DEFAULT; } } /* * winMWExtWMWindowProc - Window procedure */ LRESULT CALLBACK winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { WindowPtr pWin = NULL; win32RootlessWindowPtr pRLWinPriv = NULL; ScreenPtr pScreen = NULL; winPrivScreenPtr pScreenPriv = NULL; winScreenInfo *pScreenInfo = NULL; HWND hwndScreen = NULL; POINT ptMouse; static Bool s_fTracking = FALSE; HDC hdcUpdate; PAINTSTRUCT ps; LPWINDOWPOS pWinPos = NULL; RECT rcClient; /* Check if the Windows window property for our X window pointer is valid */ if ((pRLWinPriv = (win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) { pWin = pRLWinPriv->pFrame->win; pScreen = pWin->drawable.pScreen; if (pScreen) pScreenPriv = winGetScreenPriv(pScreen); if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo; if (pScreenPriv) hwndScreen = pScreenPriv->hwndScreen; #if CYGDEBUG winDebugWin32Message("winMWExtWMWindowProc", hwnd, message, wParam, lParam); winDebug("\thWnd %p\n", hwnd); winDebug("\tpScreenPriv %p\n", pScreenPriv); winDebug("\tpScreenInfo %p\n", pScreenInfo); winDebug("\thwndScreen %p\n", hwndScreen); winDebug("winMWExtWMWindowProc (%p) %08x %08x %08x\n", pRLWinPriv, message, (int)wParam, (int)lParam); #endif } /* Branch on message type */ switch (message) { case WM_CREATE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_CREATE\n"); #endif /* */ SetProp(hwnd, WIN_WINDOW_PROP, (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams); return 0; case WM_CLOSE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_CLOSE %d\n", pRLWinPriv->fClose); #endif /* Tell window-manager to close window */ if (pRLWinPriv->fClose) { DestroyWindow(hwnd); } else { winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMCloseWindow, pWin->drawable.id, 0, 0, 0, 0); } return 0; case WM_DESTROY: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_DESTROY\n"); #endif /* Free the shaodw DC; which allows the bitmap to be freed */ DeleteDC(pRLWinPriv->hdcShadow); pRLWinPriv->hdcShadow = NULL; /* Free the shadow bitmap */ DeleteObject(pRLWinPriv->hbmpShadow); pRLWinPriv->hbmpShadow = NULL; /* Free the screen DC */ ReleaseDC(pRLWinPriv->hWnd, pRLWinPriv->hdcScreen); pRLWinPriv->hdcScreen = NULL; /* Free shadow buffer info header */ free(pRLWinPriv->pbmihShadow); pRLWinPriv->pbmihShadow = NULL; pRLWinPriv->fResized = FALSE; pRLWinPriv->pfb = NULL; free(pRLWinPriv); RemoveProp(hwnd, WIN_WINDOW_PROP); break; case WM_MOUSEMOVE: #if CYGMULTIWINDOW_DEBUG && 0 winDebug("winMWExtWMWindowProc - WM_MOUSEMOVE\n"); #endif /* Unpack the client area mouse coordinates */ ptMouse.x = GET_X_LPARAM(lParam); ptMouse.y = GET_Y_LPARAM(lParam); /* Translate the client area mouse coordinates to screen coordinates */ ClientToScreen(hwnd, &ptMouse); /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */ ptMouse.x -= GetSystemMetrics(SM_XVIRTUALSCREEN); ptMouse.y -= GetSystemMetrics(SM_YVIRTUALSCREEN); /* We can't do anything without privates */ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; /* Has the mouse pointer crossed screens? */ if (pScreen != miPointerGetScreen(inputInfo.pointer)) miPointerSetScreen(inputInfo.pointer, pScreenInfo->dwScreen, ptMouse.x - pScreenInfo->dwXOffset, ptMouse.y - pScreenInfo->dwYOffset); /* Are we tracking yet? */ if (!s_fTracking) { TRACKMOUSEEVENT tme; /* Setup data structure */ ZeroMemory(&tme, sizeof(tme)); tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = hwnd; /* Call the tracking function */ if (!TrackMouseEvent(&tme)) ErrorF("winMWExtWMWindowProc - TrackMouseEvent failed\n"); /* Flag that we are tracking now */ s_fTracking = TRUE; } /* Kill the timer used to poll mouse events */ if (g_uipMousePollingTimerID != 0) { KillTimer(pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID); g_uipMousePollingTimerID = 0; } /* Deliver absolute cursor position to X Server */ winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset, ptMouse.y - pScreenInfo->dwYOffset); return 0; case WM_NCMOUSEMOVE: #if CYGMULTIWINDOW_DEBUG && 0 winDebug("winMWExtWMWindowProc - WM_NCMOUSEMOVE\n"); #endif /* * We break instead of returning 0 since we need to call * DefWindowProc to get the mouse cursor changes * and min/max/close button highlighting in Windows XP. * The Platform SDK says that you should return 0 if you * process this message, but it fails to mention that you * will give up any default functionality if you do return 0. */ /* We can't do anything without privates */ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; /* * Timer to poll mouse events. This is needed to make * programs like xeyes follow the mouse properly. */ if (g_uipMousePollingTimerID == 0) g_uipMousePollingTimerID = SetTimer(pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID, MOUSE_POLLING_INTERVAL, NULL); break; case WM_MOUSELEAVE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MOUSELEAVE\n"); #endif /* Mouse has left our client area */ /* Flag that we are no longer tracking */ s_fTracking = FALSE; /* * Timer to poll mouse events. This is needed to make * programs like xeyes follow the mouse properly. */ if (g_uipMousePollingTimerID == 0) g_uipMousePollingTimerID = SetTimer(pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID, MOUSE_POLLING_INTERVAL, NULL); return 0; case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_LBUTTONDBLCLK\n"); #endif if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture(hwnd); return winMouseButtonsHandle(pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_LBUTTONUP\n"); #endif if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture(); return winMouseButtonsHandle(pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MBUTTONDBLCLK\n"); #endif if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture(hwnd); return winMouseButtonsHandle(pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MBUTTONUP\n"); #endif if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture(); return winMouseButtonsHandle(pScreen, ButtonRelease, Button2, wParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_RBUTTONDBLCLK\n"); #endif if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture(hwnd); return winMouseButtonsHandle(pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_RBUTTONUP\n"); #endif if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture(); return winMouseButtonsHandle(pScreen, ButtonRelease, Button3, wParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture(hwnd); return winMouseButtonsHandle(pScreen, ButtonPress, HIWORD(wParam) + 7, wParam); case WM_XBUTTONUP: if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture(); return winMouseButtonsHandle(pScreen, ButtonRelease, HIWORD(wParam) + 7, wParam); case WM_MOUSEWHEEL: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MOUSEWHEEL\n"); #endif /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; case WM_MOUSEHWHEEL: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MOUSEHWHEEL\n"); #endif /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; case WM_MOUSEACTIVATE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n"); #endif if (!IsMouseActive(pWin)) return MA_NOACTIVATE; break; case WM_KILLFOCUS: /* Pop any pressed keys since we are losing keyboard focus */ winKeybdReleaseKeys(); return 0; case WM_SYSDEADCHAR: case WM_DEADCHAR: /* * NOTE: We do nothing with WM_*CHAR messages, * nor does the root window, so we can just toss these messages. */ return 0; case WM_SYSKEYDOWN: case WM_KEYDOWN: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_*KEYDOWN\n"); #endif /* * Don't pass Alt-F4 key combo to root window, * let Windows translate to WM_CLOSE and close this top-level window. * * NOTE: We purposely don't check the fUseWinKillKey setting because * it should only apply to the key handling for the root window, * not for top-level window-manager windows. * * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window * because that is a key combo that no X app should be expecting to * receive, since it has historically been used to shutdown the X server. * Passing Ctrl-Alt-Backspace to the root window preserves that * behavior, assuming that -unixkill has been passed as a parameter. */ if (wParam == VK_F4 && (GetKeyState(VK_MENU) & 0x8000)) break; /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; case WM_SYSKEYUP: case WM_KEYUP: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_*KEYUP\n"); #endif /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; case WM_HOTKEY: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_HOTKEY\n"); #endif /* Pass the message to the root window */ SendMessage(hwndScreen, message, wParam, lParam); return 0; case WM_ERASEBKGND: #if CYGDEBUG winDebug("winMWExtWMWindowProc - WM_ERASEBKGND\n"); #endif /* * Pretend that we did erase the background but we don't care, * since we repaint the entire region anyhow * This avoids some flickering when resizing. */ return TRUE; case WM_PAINT: /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint(hwnd, &ps); /* Try to copy from the shadow buffer */ if (!BitBlt(hdcUpdate, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, pRLWinPriv->hdcShadow, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY)) { LPVOID lpMsgBuf; /* Display a fancy error message */ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); ErrorF("winMWExtWMWindowProc - BitBlt failed: %s\n", (LPSTR) lpMsgBuf); LocalFree(lpMsgBuf); } /* EndPaint frees the DC */ EndPaint(hwnd, &ps); break; case WM_ACTIVATE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_ACTIVATE\n"); #endif if (LOWORD(wParam) != WA_INACTIVE) { winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMActivateWindow, pWin->drawable.id, 0, 0, 0, 0); } return 0; #if 1 case WM_WINDOWPOSCHANGING: pWinPos = (LPWINDOWPOS) lParam; if (!(pWinPos->flags & SWP_NOZORDER)) { if (pRLWinPriv->fRestackingNow || pScreenPriv->fRestacking) { #if CYGMULTIWINDOW_DEBUG winDebug("Win %p is now restacking.\n", pRLWinPriv); #endif break; } #if CYGMULTIWINDOW_DEBUG winDebug("Win %p forbid to change z order (%p).\n", pRLWinPriv, pWinPos->hwndInsertAfter); #endif pWinPos->flags |= SWP_NOZORDER; } break; #endif case WM_MOVE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MOVE\n"); #endif if (g_fNoConfigureWindow) break; #if 0 /* Bail if Windows window is not actually moving */ if (pRLWinPriv->dwX == (short) LOWORD(lParam) && pRLWinPriv->dwY == (short) HIWORD(lParam)) break; /* Also bail if we're maximizing, we'll do the whole thing in WM_SIZE */ { WINDOWPLACEMENT windPlace; windPlace.length = sizeof(WINDOWPLACEMENT); /* Get current window placement */ GetWindowPlacement(hwnd, &windPlace); /* Bail if maximizing */ if (windPlace.showCmd == SW_MAXIMIZE || windPlace.showCmd == SW_SHOWMAXIMIZED) break; } #endif #if CYGMULTIWINDOW_DEBUG winDebug("\t(%d, %d)\n", (short) LOWORD(lParam), (short) HIWORD(lParam)); #endif if (!pRLWinPriv->fMovingOrSizing) { winMWExtWMMoveXWindow(pWin, (LOWORD(lParam) - wBorderWidth(pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN)), (HIWORD(lParam) - wBorderWidth(pWin) - GetSystemMetrics(SM_YVIRTUALSCREEN))); } return 0; case WM_SHOWWINDOW: #if CYGMULTIWINDOW_DEBUG || TRUE winDebug("winMWExtWMWindowProc - WM_SHOWWINDOW\n"); #endif /* Bail out if the window is being hidden */ if (!wParam) return 0; winMWExtWMUpdateWindowDecoration(pRLWinPriv, pScreenInfo); break; case WM_SIZING: /* Need to legalize the size according to WM_NORMAL_HINTS */ /* for applications like xterm */ return ValidateSizing(hwnd, pWin, wParam, lParam); case WM_WINDOWPOSCHANGED: { pWinPos = (LPWINDOWPOS) lParam; #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED\n"); winDebug("\tflags: %s%s%s%s%s%s%s%s%s%s%s%s\n", (pWinPos->flags & SWP_DRAWFRAME) ? "SWP_DRAWFRAME " : "", (pWinPos->flags & SWP_FRAMECHANGED) ? "SWP_FRAMECHANGED " : "", (pWinPos->flags & SWP_HIDEWINDOW) ? "SWP_HIDEWINDOW " : "", (pWinPos->flags & SWP_NOACTIVATE) ? "SWP_NOACTIVATE " : "", (pWinPos->flags & SWP_NOCOPYBITS) ? "SWP_NOCOPYBITS " : "", (pWinPos->flags & SWP_NOMOVE) ? "SWP_NOMOVE " : "", (pWinPos-> flags & SWP_NOOWNERZORDER) ? "SWP_NOOWNERZORDER " : "", (pWinPos->flags & SWP_NOSIZE) ? "SWP_NOSIZE " : "", (pWinPos->flags & SWP_NOREDRAW) ? "SWP_NOREDRAW " : "", (pWinPos-> flags & SWP_NOSENDCHANGING) ? "SWP_NOSENDCHANGING " : "", (pWinPos->flags & SWP_NOZORDER) ? "SWP_NOZORDER " : "", (pWinPos->flags & SWP_SHOWWINDOW) ? "SWP_SHOWWINDOW " : ""); winDebug("\tno_configure: %s\n", (g_fNoConfigureWindow ? "Yes" : "No")); winDebug("\textend: (%d, %d, %d, %d)\n", pWinPos->x, pWinPos->y, pWinPos->cx, pWinPos->cy); #endif if (pWinPos->flags & SWP_HIDEWINDOW) break; if (!(pWinPos->flags & SWP_NOSIZE)) { if (IsIconic(hwnd)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tIconic -> MINIMIZED\n"); #endif winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMMinimizeWindow, pWin->drawable.id, 0, 0, 0, 0); } else if (IsZoomed(hwnd)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tZoomed -> MAXIMIZED\n"); #endif winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMMaximizeWindow, pWin->drawable.id, 0, 0, 0, 0); } else { #if CYGMULTIWINDOW_DEBUG winDebug("\tnone -> RESTORED\n"); #endif winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMRestoreWindow, pWin->drawable.id, 0, 0, 0, 0); } } if (!g_fNoConfigureWindow) { if (!pRLWinPriv->fMovingOrSizing /*&& (pWinPos->flags & SWP_SHOWWINDOW) */ ) { GetClientRect(hwnd, &rcClient); MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2); if (!(pWinPos->flags & SWP_NOMOVE) && !(pWinPos->flags & SWP_NOSIZE)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tmove & resize\n"); #endif winMWExtWMMoveResizeXWindow(pWin, rcClient.left - wBorderWidth(pWin) - GetSystemMetrics (SM_XVIRTUALSCREEN), rcClient.top - wBorderWidth(pWin) - GetSystemMetrics (SM_YVIRTUALSCREEN), rcClient.right - rcClient.left - wBorderWidth(pWin) * 2, rcClient.bottom - rcClient.top - wBorderWidth(pWin) * 2); } else if (!(pWinPos->flags & SWP_NOMOVE)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tmove\n"); #endif winMWExtWMMoveResizeXWindow(pWin, rcClient.left - wBorderWidth(pWin) - GetSystemMetrics (SM_XVIRTUALSCREEN), rcClient.top - wBorderWidth(pWin) - GetSystemMetrics (SM_YVIRTUALSCREEN), rcClient.right - rcClient.left - wBorderWidth(pWin) * 2, rcClient.bottom - rcClient.top - wBorderWidth(pWin) * 2); } else if (!(pWinPos->flags & SWP_NOMOVE)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tmove\n"); #endif winMWExtWMMoveXWindow(pWin, rcClient.left - wBorderWidth(pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN), rcClient.top - wBorderWidth(pWin) - GetSystemMetrics(SM_YVIRTUALSCREEN)); } else if (!(pWinPos->flags & SWP_NOSIZE)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tresize\n"); #endif winMWExtWMResizeXWindow(pWin, rcClient.right - rcClient.left - wBorderWidth(pWin) * 2, rcClient.bottom - rcClient.top - wBorderWidth(pWin) * 2); } } } } #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED - done.\n"); #endif return 0; case WM_SIZE: /* see dix/window.c */ /* FIXME: Maximize/Restore? */ #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_SIZE\n"); #endif #if CYGMULTIWINDOW_DEBUG winDebug("\t(%d, %d) %d\n", (short) LOWORD(lParam), (short) HIWORD(lParam), g_fNoConfigureWindow); #endif if (g_fNoConfigureWindow) break; /* Branch on type of resizing occurring */ switch (wParam) { case SIZE_MINIMIZED: #if CYGMULTIWINDOW_DEBUG winDebug("\tSIZE_MINIMIZED\n"); #endif winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMMinimizeWindow, pWin->drawable.id, 0, 0, LOWORD(lParam), HIWORD(lParam)); break; case SIZE_RESTORED: #if CYGMULTIWINDOW_DEBUG winDebug("\tSIZE_RESTORED\n"); #endif winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMRestoreWindow, pWin->drawable.id, 0, 0, LOWORD(lParam), HIWORD(lParam)); break; case SIZE_MAXIMIZED: #if CYGMULTIWINDOW_DEBUG winDebug("\tSIZE_MAXIMIZED\n"); #endif winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, WindowsWMMaximizeWindow, pWin->drawable.id, 0, 0, LOWORD(lParam), HIWORD(lParam)); break; } /* Perform the resize and notify the X client */ if (!pRLWinPriv->fMovingOrSizing) { winMWExtWMResizeXWindow(pWin, (short) LOWORD(lParam) - wBorderWidth(pWin) * 2, (short) HIWORD(lParam) - wBorderWidth(pWin) * 2); } break; case WM_ACTIVATEAPP: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_ACTIVATEAPP\n"); #endif if (wParam) { winWindowsWMSendEvent(WindowsWMActivationNotify, WindowsWMActivationNotifyMask, 1, WindowsWMIsActive, pWin->drawable.id, 0, 0, 0, 0); } else { winWindowsWMSendEvent(WindowsWMActivationNotify, WindowsWMActivationNotifyMask, 1, WindowsWMIsInactive, pWin->drawable.id, 0, 0, 0, 0); } break; case WM_SETCURSOR: if (LOWORD(lParam) == HTCLIENT) { if (!g_fSoftwareCursor) SetCursor(pScreenPriv->cursor.handle); return TRUE; } break; case WM_ENTERSIZEMOVE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_ENTERSIZEMOVE\n"); #endif pRLWinPriv->fMovingOrSizing = TRUE; break; case WM_EXITSIZEMOVE: #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_EXITSIZEMOVE\n"); #endif pRLWinPriv->fMovingOrSizing = FALSE; GetClientRect(hwnd, &rcClient); MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2); winMWExtWMMoveResizeXWindow(pWin, rcClient.left - wBorderWidth(pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN), rcClient.top - wBorderWidth(pWin) - GetSystemMetrics(SM_YVIRTUALSCREEN), rcClient.right - rcClient.left - wBorderWidth(pWin) * 2, rcClient.bottom - rcClient.top - wBorderWidth(pWin) * 2); break; default: break; } return DefWindowProc(hwnd, message, wParam, lParam); } xorg-server-1.20.8/hw/xwin/wincreatewnd.c0000644000175000017500000005257213640201473015262 00000000000000/* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "shellapi.h" /* * Local function prototypes */ static Bool winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo); static Bool winAdjustForAutoHide(RECT * prcWorkArea, winScreenInfo * pScreenInfo); /* * Create a full screen window */ Bool winCreateBoundingWindowFullScreen(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; int iX = pScreenInfo->dwInitialX; int iY = pScreenInfo->dwInitialY; int iWidth = pScreenInfo->dwWidth; int iHeight = pScreenInfo->dwHeight; HWND *phwnd = &pScreenPriv->hwndScreen; WNDCLASSEX wc; char szTitle[256]; #if CYGDEBUG winDebug("winCreateBoundingWindowFullScreen\n"); #endif /* Setup our window class */ wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); wc.hCursor = 0; wc.hbrBackground = 0; wc.lpszMenuName = NULL; wc.lpszClassName = WINDOW_CLASS; wc.hIconSm = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); RegisterClassEx(&wc); /* Set display and screen-specific tooltip text */ if (g_pszQueryHost != NULL) snprintf(szTitle, sizeof(szTitle), WINDOW_TITLE_XDMCP, g_pszQueryHost, display, (int) pScreenInfo->dwScreen); else snprintf(szTitle, sizeof(szTitle), WINDOW_TITLE, display, (int) pScreenInfo->dwScreen); /* Create the window */ *phwnd = CreateWindowExA(0, /* Extended styles */ WINDOW_CLASS, /* Class name */ szTitle, /* Window name */ WS_POPUP, iX, /* Horizontal position */ iY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ (HWND) NULL, /* No parent or owner window */ (HMENU) NULL, /* No menu */ GetModuleHandle(NULL), /* Instance handle */ pScreenPriv); /* ScreenPrivates */ /* Hide the window */ ShowWindow(*phwnd, SW_SHOWNORMAL); /* Send first paint message */ UpdateWindow(*phwnd); /* Attempt to bring our window to the top of the display */ BringWindowToTop(*phwnd); return TRUE; } /* * Create our primary Windows display window */ Bool winCreateBoundingWindowWindowed(ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; int iWidth = pScreenInfo->dwUserWidth; int iHeight = pScreenInfo->dwUserHeight; int iPosX; int iPosY; HWND *phwnd = &pScreenPriv->hwndScreen; WNDCLASSEX wc; RECT rcClient, rcWorkArea; DWORD dwWindowStyle; BOOL fForceShowWindow = FALSE; char szTitle[256]; winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d\n", (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight); winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d\n", (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight); /* Set the common window style flags */ dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; /* Decorated or undecorated window */ if (pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM #endif && !pScreenInfo->fRootless && !pScreenInfo->fMultiWindow ) { /* Try to handle startup via run.exe. run.exe instructs Windows to * hide all created windows. Detect this case and make sure the * window is shown nevertheless */ STARTUPINFO startupInfo; GetStartupInfo(&startupInfo); if (startupInfo.dwFlags & STARTF_USESHOWWINDOW && startupInfo.wShowWindow == SW_HIDE) { fForceShowWindow = TRUE; } dwWindowStyle |= WS_CAPTION; if (pScreenInfo->iResizeMode != resizeNotAllowed) dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX; } else dwWindowStyle |= WS_POPUP; /* Setup our window class */ wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = winWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = WINDOW_CLASS; wc.hIconSm = (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); RegisterClassEx(&wc); /* Get size of work area */ winGetWorkArea(&rcWorkArea, pScreenInfo); /* Adjust for auto-hide taskbars */ winAdjustForAutoHide(&rcWorkArea, pScreenInfo); /* Did the user specify a position? */ if (pScreenInfo->fUserGavePosition) { iPosX = pScreenInfo->dwInitialX; iPosY = pScreenInfo->dwInitialY; } else { iPosX = rcWorkArea.left; iPosY = rcWorkArea.top; } /* Clean up the scrollbars flag, if necessary */ if ((!pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM || pScreenInfo->fMWExtWM #endif || pScreenInfo->fRootless || pScreenInfo->fMultiWindow ) && (pScreenInfo->iResizeMode == resizeWithScrollbars)) { /* We cannot have scrollbars if we do not have a window border */ pScreenInfo->iResizeMode = resizeNotAllowed; } /* Did the user specify a height and width? */ if (pScreenInfo->fUserGaveHeightAndWidth) { /* User gave a desired height and width, try to accomodate */ #if CYGDEBUG winDebug("winCreateBoundingWindowWindowed - User gave height " "and width\n"); #endif /* Adjust the window width and height for borders and title bar */ if (pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM #endif && !pScreenInfo->fRootless && !pScreenInfo->fMultiWindow ) { #if CYGDEBUG winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n"); #endif /* Are we resizable */ if (pScreenInfo->iResizeMode != resizeNotAllowed) { #if CYGDEBUG winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n"); #endif iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION); } else { #if CYGDEBUG winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n"); #endif iWidth += 2 * GetSystemMetrics(SM_CXFIXEDFRAME); iHeight += 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION); } } } else { /* By default, we are creating a window that is as large as possible */ #if CYGDEBUG winDebug("winCreateBoundingWindowWindowed - User did not give " "height and width\n"); #endif /* Defaults are wrong if we have multiple monitors */ if (pScreenInfo->fMultipleMonitors) { iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); } } /* Make sure window is no bigger than work area */ if (TRUE #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM #endif && !pScreenInfo->fMultiWindow ) { /* Trim window width to fit work area */ if (iWidth > (rcWorkArea.right - rcWorkArea.left)) iWidth = rcWorkArea.right - rcWorkArea.left; /* Trim window height to fit work area */ if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) iHeight = rcWorkArea.bottom - rcWorkArea.top; #if CYGDEBUG winDebug("winCreateBoundingWindowWindowed - Adjusted width: %d " "height: %d\n", iWidth, iHeight); #endif } /* Set display and screen-specific tooltip text */ if (g_pszQueryHost != NULL) snprintf(szTitle, sizeof(szTitle), WINDOW_TITLE_XDMCP, g_pszQueryHost, display, (int) pScreenInfo->dwScreen); else snprintf(szTitle, sizeof(szTitle), WINDOW_TITLE, display, (int) pScreenInfo->dwScreen); /* Create the window */ *phwnd = CreateWindowExA(0, /* Extended styles */ WINDOW_CLASS, /* Class name */ szTitle, /* Window name */ dwWindowStyle, iPosX, /* Horizontal position */ iPosY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ (HWND) NULL, /* No parent or owner window */ (HMENU) NULL, /* No menu */ GetModuleHandle(NULL), /* Instance handle */ pScreenPriv); /* ScreenPrivates */ if (*phwnd == NULL) { ErrorF("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n"); return FALSE; } #if CYGDEBUG winDebug("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n"); #endif if (fForceShowWindow) { ErrorF ("winCreateBoundingWindowWindowed - Setting normal windowstyle\n"); ShowWindow(*phwnd, SW_SHOW); } /* Get the client area coordinates */ if (!GetClientRect(*phwnd, &rcClient)) { ErrorF("winCreateBoundingWindowWindowed - GetClientRect () " "failed\n"); return FALSE; } winDebug("winCreateBoundingWindowWindowed - WindowClient " "w %d h %d r %d l %d b %d t %d\n", (int)(rcClient.right - rcClient.left), (int)(rcClient.bottom - rcClient.top), (int)rcClient.right, (int)rcClient.left, (int)rcClient.bottom, (int)rcClient.top); /* We adjust the visual size if the user did not specify it */ if (! ((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth)) { /* * User did not give a height and width with scrollbars enabled, * so we will resize the underlying visual to be as large as * the initial view port (page size). This way scrollbars will * not appear until the user shrinks the window, if they ever do. * * NOTE: We have to store the viewport size here because * the user may have an autohide taskbar, which would * cause the viewport size to be one less in one dimension * than the viewport size that we calculated by subtracting * the size of the borders and caption. */ pScreenInfo->dwWidth = rcClient.right - rcClient.left; pScreenInfo->dwHeight = rcClient.bottom - rcClient.top; } #if 0 /* * NOTE: For the uninitiated, the page size is the number of pixels * that we can display in the x or y direction at a time and the * range is the total number of pixels in the x or y direction that we * have available to display. In other words, the page size is the * size of the window area minus the space the caption, borders, and * scrollbars (if any) occupy, and the range is the size of the * underlying X visual. Notice that, contrary to what some of the * MSDN Library arcticles lead you to believe, the windows * ``client area'' size does not include the scrollbars. In other words, * the whole client area size that is reported to you is drawable by * you; you do not have to subtract the size of the scrollbars from * the client area size, and if you did it would result in the size * of the scrollbars being double counted. */ /* Setup scrollbar page and range, if scrollbars are enabled */ if (pScreenInfo->fScrollbars) { SCROLLINFO si; /* Initialize the scrollbar info structure */ si.cbSize = sizeof(si); si.fMask = SIF_RANGE | SIF_PAGE; si.nMin = 0; /* Setup the width range and page size */ si.nMax = pScreenInfo->dwWidth - 1; si.nPage = rcClient.right - rcClient.left; winDebug("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n", si.nMax, si.nPage); SetScrollInfo(*phwnd, SB_HORZ, &si, TRUE); /* Setup the height range and page size */ si.nMax = pScreenInfo->dwHeight - 1; si.nPage = rcClient.bottom - rcClient.top; winDebug("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n", si.nMax, si.nPage); SetScrollInfo(*phwnd, SB_VERT, &si, TRUE); } #endif /* Show the window */ if (FALSE #ifdef XWIN_MULTIWINDOWEXTWM || pScreenInfo->fMWExtWM #endif || pScreenInfo->fMultiWindow ) { pScreenPriv->fRootWindowShown = FALSE; ShowWindow(*phwnd, SW_HIDE); } else ShowWindow(*phwnd, SW_SHOWNORMAL); if (!UpdateWindow(*phwnd)) { ErrorF("winCreateBoundingWindowWindowed - UpdateWindow () failed\n"); return FALSE; } /* Attempt to bring our window to the top of the display */ if (TRUE #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM #endif && !pScreenInfo->fRootless && !pScreenInfo->fMultiWindow ) { if (!BringWindowToTop(*phwnd)) { ErrorF("winCreateBoundingWindowWindowed - BringWindowToTop () " "failed\n"); return FALSE; } } winDebug("winCreateBoundingWindowWindowed - Returning\n"); return TRUE; } /* * Find the work area of all attached monitors */ static Bool winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo) { int iPrimaryWidth, iPrimaryHeight; int iWidth, iHeight; int iLeft, iTop; int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight; /* Use GetMonitorInfo to get work area for monitor */ if (!pScreenInfo->fMultipleMonitors) { MONITORINFO mi; mi.cbSize = sizeof(MONITORINFO); if (GetMonitorInfo(pScreenInfo->hMonitor, &mi)) { *prcWorkArea = mi.rcWork; winDebug("winGetWorkArea - Monitor %d WorkArea: %d %d %d %d\n", pScreenInfo->iMonitor, (int) prcWorkArea->top, (int) prcWorkArea->left, (int) prcWorkArea->bottom, (int) prcWorkArea->right); } else { ErrorF("winGetWorkArea - GetMonitorInfo() failed for monitor %d\n", pScreenInfo->iMonitor); } /* Bail out here if we aren't using multiple monitors */ return TRUE; } /* SPI_GETWORKAREA only gets the work area of the primary screen. */ SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0); winDebug("winGetWorkArea - Primary Monitor WorkArea: %d %d %d %d\n", (int) prcWorkArea->top, (int) prcWorkArea->left, (int) prcWorkArea->bottom, (int) prcWorkArea->right); /* Get size of full virtual screen */ iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); winDebug("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight); /* Get origin of full virtual screen */ iLeft = GetSystemMetrics(SM_XVIRTUALSCREEN); iTop = GetSystemMetrics(SM_YVIRTUALSCREEN); winDebug("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop); /* Get size of primary screen */ iPrimaryWidth = GetSystemMetrics(SM_CXSCREEN); iPrimaryHeight = GetSystemMetrics(SM_CYSCREEN); winDebug("winGetWorkArea - Primary screen is %d x %d\n", iPrimaryWidth, iPrimaryHeight); /* Work out how much of the primary screen we aren't using */ iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right - prcWorkArea->left); iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom - prcWorkArea->top); /* Update the rectangle to include all monitors */ if (iLeft < 0) { prcWorkArea->left = iLeft; } if (iTop < 0) { prcWorkArea->top = iTop; } prcWorkArea->right = prcWorkArea->left + iWidth - iPrimaryNonWorkAreaWidth; prcWorkArea->bottom = prcWorkArea->top + iHeight - iPrimaryNonWorkAreaHeight; winDebug("winGetWorkArea - Adjusted WorkArea for multiple " "monitors: %d %d %d %d\n", (int) prcWorkArea->top, (int) prcWorkArea->left, (int) prcWorkArea->bottom, (int) prcWorkArea->right); return TRUE; } static Bool winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo * pScreenInfo) { APPBARDATA abd; HWND hwndAutoHide; ZeroMemory(&abd, sizeof(abd)); abd.cbSize = sizeof(abd); abd.uEdge = uEdge; hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd); if (hwndAutoHide != NULL) { /* Found an autohide taskbar on that edge, but is it on the same monitor as the screen window? */ if (pScreenInfo->fMultipleMonitors || (MonitorFromWindow(hwndAutoHide, MONITOR_DEFAULTTONULL) == pScreenInfo->hMonitor)) return TRUE; } return FALSE; } /* * Adjust the client area so that any auto-hide toolbars * will work correctly. */ static Bool winAdjustForAutoHide(RECT * prcWorkArea, winScreenInfo * pScreenInfo) { APPBARDATA abd; winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n", (int) prcWorkArea->top, (int) prcWorkArea->left, (int) prcWorkArea->bottom, (int) prcWorkArea->right); /* Find out if the Windows taskbar is set to auto-hide */ ZeroMemory(&abd, sizeof(abd)); abd.cbSize = sizeof(abd); if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE) winDebug("winAdjustForAutoHide - Taskbar is auto hide\n"); /* Despite the forgoing, we are checking for any AppBar hiding along a monitor edge, not just the Windows TaskBar. */ /* Look for a TOP auto-hide taskbar */ if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo)) { winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n"); prcWorkArea->top += 1; } /* Look for a LEFT auto-hide taskbar */ if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo)) { winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n"); prcWorkArea->left += 1; } /* Look for a BOTTOM auto-hide taskbar */ if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo)) { winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n"); prcWorkArea->bottom -= 1; } /* Look for a RIGHT auto-hide taskbar */ if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo)) { winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n"); prcWorkArea->right -= 1; } winDebug("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n", (int) prcWorkArea->top, (int) prcWorkArea->left, (int) prcWorkArea->bottom, (int) prcWorkArea->right); return TRUE; } xorg-server-1.20.8/hw/xwin/winconfig.h0000644000175000017500000001407513640201473014554 00000000000000#ifndef __WIN_CONFIG_H__ #define __WIN_CONFIG_H__ /* *Copyright (C) 1994-2000 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project *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 XFree86 Project. * * Authors: Alexander Gottwald */ #include "win.h" #ifdef XWIN_XF86CONFIG #include "../xfree86/parser/xf86Parser.h" #endif /* These are taken from hw/xfree86/common/xf86str.h */ typedef struct { CARD32 red, green, blue; } rgb; typedef struct { float red, green, blue; } Gamma; typedef struct { char *identifier; char *vendor; char *board; char *chipset; char *ramdac; char *driver; struct _confscreenrec *myScreenSection; Bool claimed; Bool active; Bool inUse; int videoRam; void *options; int screen; /* For multi-CRTC cards */ } GDevRec, *GDevPtr; typedef struct { char *identifier; char *driver; void *commonOptions; void *extraOptions; } IDevRec, *IDevPtr; typedef struct { int frameX0; int frameY0; int virtualX; int virtualY; int depth; int fbbpp; rgb weight; rgb blackColour; rgb whiteColour; int defaultVisual; char **modes; void *options; } DispRec, *DispPtr; typedef struct _confxvportrec { char *identifier; void *options; } confXvPortRec, *confXvPortPtr; typedef struct _confxvadaptrec { char *identifier; int numports; confXvPortPtr ports; void *options; } confXvAdaptorRec, *confXvAdaptorPtr; typedef struct _confscreenrec { char *id; int screennum; int defaultdepth; int defaultbpp; int defaultfbbpp; GDevPtr device; int numdisplays; DispPtr displays; int numxvadaptors; confXvAdaptorPtr xvadaptors; void *options; } confScreenRec, *confScreenPtr; typedef enum { PosObsolete = -1, PosAbsolute = 0, PosRightOf, PosLeftOf, PosAbove, PosBelow, PosRelative } PositionType; typedef struct _screenlayoutrec { confScreenPtr screen; char *topname; confScreenPtr top; char *bottomname; confScreenPtr bottom; char *leftname; confScreenPtr left; char *rightname; confScreenPtr right; PositionType where; int x; int y; char *refname; confScreenPtr refscreen; } screenLayoutRec, *screenLayoutPtr; typedef struct _serverlayoutrec { char *id; screenLayoutPtr screens; GDevPtr inactives; IDevPtr inputs; void *options; } serverLayoutRec, *serverLayoutPtr; /* * winconfig.c */ typedef struct { /* Files */ #ifdef XWIN_XF86CONFIG char *configFile; char *configDir; #endif char *fontPath; /* input devices - keyboard */ #ifdef XWIN_XF86CONFIG char *keyboard; #endif char *xkbRules; char *xkbModel; char *xkbLayout; char *xkbVariant; char *xkbOptions; /* layout */ char *screenname; /* mouse settings */ char *mouse; Bool emulate3buttons; long emulate3timeout; } WinCmdlineRec, *WinCmdlinePtr; extern WinCmdlineRec g_cmdline; #ifdef XWIN_XF86CONFIG extern XF86ConfigPtr g_xf86configptr; #endif extern serverLayoutRec g_winConfigLayout; /* * Function prototypes */ Bool winReadConfigfile(void); Bool winConfigFiles(void); Bool winConfigOptions(void); Bool winConfigScreens(void); Bool winConfigKeyboard(DeviceIntPtr pDevice); Bool winConfigMouse(DeviceIntPtr pDevice); typedef struct { double freq; int units; } OptFrequency; typedef union { unsigned long num; char *str; double realnum; Bool bool; OptFrequency freq; } ValueUnion; typedef enum { OPTV_NONE = 0, OPTV_INTEGER, OPTV_STRING, /* a non-empty string */ OPTV_ANYSTR, /* Any string, including an empty one */ OPTV_REAL, OPTV_BOOLEAN, OPTV_PERCENT, OPTV_FREQ } OptionValueType; typedef enum { OPTUNITS_HZ = 1, OPTUNITS_KHZ, OPTUNITS_MHZ } OptFreqUnits; typedef struct { int token; const char *name; OptionValueType type; ValueUnion value; Bool found; } OptionInfoRec, *OptionInfoPtr; /* * Function prototypes */ char *winSetStrOption(void *optlist, const char *name, char *deflt); int winSetBoolOption(void *optlist, const char *name, int deflt); int winSetIntOption(void *optlist, const char *name, int deflt); double winSetRealOption(void *optlist, const char *name, double deflt); double winSetPercentOption(void *optlist, const char *name, double deflt); #ifdef XWIN_XF86CONFIG XF86OptionPtr winFindOption(XF86OptionPtr list, const char *name); char *winFindOptionValue(XF86OptionPtr list, const char *name); #endif int winNameCompare(const char *s1, const char *s2); char *winNormalizeName(const char *s); typedef struct { struct { long leds; long delay; long rate; } keyboard; XkbRMLVOSet xkb; struct { Bool emulate3Buttons; long emulate3Timeout; } pointer; } winInfoRec, *winInfoPtr; extern winInfoRec g_winInfo; #endif xorg-server-1.20.8/hw/xwin/windialogs.c0000644000175000017500000004444113640201473014724 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II * Earle F. Philhower III */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include #include "winprefs.h" /* * Local function prototypes */ static INT_PTR CALLBACK winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK winChangeDepthDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK winAboutDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam); static void winDrawURLWindow(LPARAM lParam); static LRESULT CALLBACK winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static void winOverrideURLButton(HWND hdlg, int id); static void winUnoverrideURLButton(HWND hdlg, int id); /* * Owner-draw a button as a URL */ static void winDrawURLWindow(LPARAM lParam) { DRAWITEMSTRUCT *draw; char str[256]; RECT rect; HFONT font; COLORREF crText; draw = (DRAWITEMSTRUCT *) lParam; GetWindowText(draw->hwndItem, str, sizeof(str)); str[255] = 0; GetClientRect(draw->hwndItem, &rect); /* Color the button depending upon its state */ if (draw->itemState & ODS_SELECTED) crText = RGB(128 + 64, 0, 0); else if (draw->itemState & ODS_FOCUS) crText = RGB(0, 128 + 64, 0); else crText = RGB(0, 0, 128 + 64); SetTextColor(draw->hDC, crText); /* Create font 8 high, standard dialog font */ font = CreateFont(-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, 0, 0, 0, 0, 0, "MS Sans Serif"); if (!font) { ErrorF("winDrawURLWindow: Unable to create URL font, bailing.\n"); return; } /* Draw it */ SetBkMode(draw->hDC, OPAQUE); SelectObject(draw->hDC, font); DrawText(draw->hDC, str, strlen(str), &rect, DT_LEFT | DT_VCENTER); /* Delete the created font, replace it with stock font */ DeleteObject(SelectObject(draw->hDC, GetStockObject(ANSI_VAR_FONT))); } /* * WndProc for overridden buttons */ static LRESULT CALLBACK winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { WNDPROC origCB = NULL; HCURSOR cursor; /* If it's a SetCursor message, tell it to the hand */ if (msg == WM_SETCURSOR) { cursor = LoadCursor(NULL, IDC_HAND); if (cursor) SetCursor(cursor); return TRUE; } origCB = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_USERDATA); /* Otherwise fall through to original WndProc */ if (origCB) return CallWindowProc(origCB, hwnd, msg, wParam, lParam); else return FALSE; } /* * Register and unregister the custom WndProc */ static void winOverrideURLButton(HWND hwnd, int id) { WNDPROC origCB; origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_WNDPROC, (LONG_PTR) winURLWndProc); SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, (LONG_PTR) origCB); } static void winUnoverrideURLButton(HWND hwnd, int id) { WNDPROC origCB; origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, 0); if (origCB) SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_WNDPROC, (LONG_PTR) origCB); } /* * Center a dialog window in the desktop window * and set small and large icons to X icons. */ static void winInitDialog(HWND hwndDlg) { HWND hwndDesk; RECT rc, rcDlg, rcDesk; HICON hIcon, hIconSmall; hwndDesk = GetParent(hwndDlg); if (!hwndDesk || IsIconic(hwndDesk)) hwndDesk = GetDesktopWindow(); /* Remove minimize and maximize buttons */ SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); /* Set Window not to show in the task bar */ SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW); /* Center dialog window in the screen. Not done for multi-monitor systems, where * it is likely to end up split across the screens. In that case, it appears * near the Tray icon. */ if (GetSystemMetrics(SM_CMONITORS) > 1) { /* Still need to refresh the frame change. */ SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } else { GetWindowRect(hwndDesk, &rcDesk); GetWindowRect(hwndDlg, &rcDlg); CopyRect(&rc, &rcDesk); OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); OffsetRect(&rc, -rc.left, -rc.top); OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); SetWindowPos(hwndDlg, HWND_TOPMOST, rcDesk.left + (rc.right / 2), rcDesk.top + (rc.bottom / 2), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED); } if (g_hIconX) hIcon = g_hIconX; else hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); if (g_hSmallIconX) hIconSmall = g_hSmallIconX; else hIconSmall = LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); PostMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); PostMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); } /* * Display the Exit dialog box */ void winDisplayExitDialog(winPrivScreenPtr pScreenPriv) { int i; int liveClients = 0; /* Count up running clients (clients[0] is serverClient) */ for (i = 1; i < currentMaxClients; i++) if (clients[i] != NullClient) liveClients++; /* Count down server internal clients */ if (pScreenPriv->pScreenInfo->fMultiWindow) liveClients -= 2; /* multiwindow window manager & XMsgProc */ if (g_fClipboardStarted) liveClients--; /* clipboard manager */ /* A user reported that this sometimes drops below zero. just eye-candy. */ if (liveClients < 0) liveClients = 0; /* Don't show the exit confirmation dialog if SilentExit & no clients, or ForceExit, is enabled */ if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) { if (g_hDlgExit != NULL) { DestroyWindow(g_hDlgExit); g_hDlgExit = NULL; } PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); return; } pScreenPriv->iConnectedClients = liveClients; /* Check if dialog already exists */ if (g_hDlgExit != NULL) { /* Dialog box already exists, display it */ ShowWindow(g_hDlgExit, SW_SHOWDEFAULT); /* User has lost the dialog. Show them where it is. */ SetForegroundWindow(g_hDlgExit); return; } /* Create dialog box */ g_hDlgExit = CreateDialogParam(g_hInstance, "EXIT_DIALOG", pScreenPriv->hwndScreen, winExitDlgProc, (LPARAM) pScreenPriv); /* Show the dialog box */ ShowWindow(g_hDlgExit, SW_SHOW); /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */ SetForegroundWindow(g_hDlgExit); /* Set focus to the Cancel button */ PostMessage(g_hDlgExit, WM_NEXTDLGCTL, (WPARAM) GetDlgItem(g_hDlgExit, IDCANCEL), TRUE); } #define CONNECTED_CLIENTS_FORMAT "There %s currently %d client%s connected." /* * Exit dialog window procedure */ static INT_PTR CALLBACK winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam) { static winPrivScreenPtr s_pScreenPriv = NULL; /* Branch on message type */ switch (message) { case WM_INITDIALOG: { char *pszConnectedClients; /* Store pointers to private structures for future use */ s_pScreenPriv = (winPrivScreenPtr) lParam; winInitDialog(hDialog); /* Format the connected clients string */ if (asprintf(&pszConnectedClients, CONNECTED_CLIENTS_FORMAT, (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are", s_pScreenPriv->iConnectedClients, (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1) return TRUE; /* Set the number of connected clients */ SetWindowText(GetDlgItem(hDialog, IDC_CLIENTS_CONNECTED), pszConnectedClients); free(pszConnectedClients); } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: /* Send message to call the GiveUp function */ PostMessage(s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); DestroyWindow(g_hDlgExit); g_hDlgExit = NULL; /* Fix to make sure keyboard focus isn't trapped */ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); return TRUE; case IDCANCEL: DestroyWindow(g_hDlgExit); g_hDlgExit = NULL; /* Fix to make sure keyboard focus isn't trapped */ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); return TRUE; } break; case WM_MOUSEMOVE: case WM_NCMOUSEMOVE: /* Show the cursor if it is hidden */ if (g_fSoftwareCursor && !g_fCursor) { g_fCursor = TRUE; ShowCursor(TRUE); } return TRUE; case WM_CLOSE: DestroyWindow(g_hDlgExit); g_hDlgExit = NULL; /* Fix to make sure keyboard focus isn't trapped */ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); return TRUE; } return FALSE; } /* * Display the Depth Change dialog box */ void winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv) { /* Check if dialog already exists */ if (g_hDlgDepthChange != NULL) { /* Dialog box already exists, display it */ ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT); /* User has lost the dialog. Show them where it is. */ SetForegroundWindow(g_hDlgDepthChange); return; } /* * Display a notification to the user that the visual * will not be displayed until the Windows display depth * is restored to the original value. */ g_hDlgDepthChange = CreateDialogParam(g_hInstance, "DEPTH_CHANGE_BOX", pScreenPriv->hwndScreen, winChangeDepthDlgProc, (LPARAM) pScreenPriv); /* Show the dialog box */ ShowWindow(g_hDlgDepthChange, SW_SHOW); if (!g_hDlgDepthChange) ErrorF("winDisplayDepthChangeDialog - GetLastError: %d\n", (int) GetLastError()); /* Minimize the display window */ ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE); } /* * Process messages for the dialog that is displayed for * disruptive screen depth changes. */ static INT_PTR CALLBACK winChangeDepthDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) { static winPrivScreenPtr s_pScreenPriv = NULL; static winScreenInfo *s_pScreenInfo = NULL; #if CYGDEBUG winDebug("winChangeDepthDlgProc\n"); #endif /* Branch on message type */ switch (message) { case WM_INITDIALOG: #if CYGDEBUG winDebug("winChangeDepthDlgProc - WM_INITDIALOG\n"); #endif /* Store pointers to private structures for future use */ s_pScreenPriv = (winPrivScreenPtr) lParam; s_pScreenInfo = s_pScreenPriv->pScreenInfo; #if CYGDEBUG winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %p, " "s_pScreenInfo: %p\n", s_pScreenPriv, s_pScreenInfo); #endif #if CYGDEBUG winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %u, " "current bpp: %d\n", (unsigned int)s_pScreenInfo->dwBPP, GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)); #endif winInitDialog(hwndDialog); return TRUE; case WM_DISPLAYCHANGE: #if CYGDEBUG winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %u, " "new bpp: %d\n", (unsigned int)s_pScreenInfo->dwBPP, GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)); #endif /* Dismiss the dialog if the display returns to the original depth */ if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) == s_pScreenInfo->dwBPP) { ErrorF("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n"); /* Depth has been restored, dismiss dialog */ DestroyWindow(g_hDlgDepthChange); g_hDlgDepthChange = NULL; /* Flag that we have a valid screen depth */ s_pScreenPriv->fBadDepth = FALSE; } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: winDebug("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); /* * User dismissed the dialog, hide it until the * display mode is restored. */ ShowWindow(g_hDlgDepthChange, SW_HIDE); return TRUE; } break; case WM_CLOSE: winDebug("winChangeDepthDlgProc - WM_CLOSE\n"); DestroyWindow(g_hDlgAbout); g_hDlgAbout = NULL; /* Fix to make sure keyboard focus isn't trapped */ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); return TRUE; } return FALSE; } /* * Display the About dialog box */ void winDisplayAboutDialog(winPrivScreenPtr pScreenPriv) { /* Check if dialog already exists */ if (g_hDlgAbout != NULL) { /* Dialog box already exists, display it */ ShowWindow(g_hDlgAbout, SW_SHOWDEFAULT); /* User has lost the dialog. Show them where it is. */ SetForegroundWindow(g_hDlgAbout); return; } /* * Display the about box */ g_hDlgAbout = CreateDialogParam(g_hInstance, "ABOUT_BOX", pScreenPriv->hwndScreen, winAboutDlgProc, (LPARAM) pScreenPriv); /* Show the dialog box */ ShowWindow(g_hDlgAbout, SW_SHOW); /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */ SetForegroundWindow(g_hDlgAbout); /* Set focus to the OK button */ PostMessage(g_hDlgAbout, WM_NEXTDLGCTL, (WPARAM) GetDlgItem(g_hDlgAbout, IDOK), TRUE); } /* * Process messages for the about dialog. */ static INT_PTR CALLBACK winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) { static winPrivScreenPtr s_pScreenPriv = NULL; #if CYGDEBUG winDebug("winAboutDlgProc\n"); #endif /* Branch on message type */ switch (message) { case WM_INITDIALOG: #if CYGDEBUG winDebug("winAboutDlgProc - WM_INITDIALOG\n"); #endif /* Store pointer to private structure for future use */ s_pScreenPriv = (winPrivScreenPtr) lParam; winInitDialog(hwndDialog); /* Override the URL buttons */ winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); return TRUE; case WM_DRAWITEM: /* Draw the URL buttons as needed */ winDrawURLWindow(lParam); return TRUE; case WM_MOUSEMOVE: case WM_NCMOUSEMOVE: /* Show the cursor if it is hidden */ if (g_fSoftwareCursor && !g_fCursor) { g_fCursor = TRUE; ShowCursor(TRUE); } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: winDebug("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); DestroyWindow(g_hDlgAbout); g_hDlgAbout = NULL; /* Fix to make sure keyboard focus isn't trapped */ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); /* Restore window procedures for URL buttons */ winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); return TRUE; case ID_ABOUT_WEBSITE: { const char *pszPath = __VENDORDWEBSUPPORT__; INT_PTR iReturn; iReturn = (INT_PTR) ShellExecute(NULL, "open", pszPath, NULL, NULL, SW_MAXIMIZE); if (iReturn < 32) { ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - " "ShellExecute failed: %d\n", (int)iReturn); } } return TRUE; } break; case WM_CLOSE: winDebug("winAboutDlgProc - WM_CLOSE\n"); DestroyWindow(g_hDlgAbout); g_hDlgAbout = NULL; /* Fix to make sure keyboard focus isn't trapped */ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); /* Restore window procedures for URL buttons */ winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); return TRUE; } return FALSE; } xorg-server-1.20.8/hw/xwin/meson.build0000644000175000017500000000733513640201473014563 00000000000000windows = import('windows') windowsdri_dep = dependency('windowsdriproto', required: false) build_windowsdri = windowsdri_dep.found() xwin_sys_libs = [] xwin_sys_libs += '-ldxguid' if host_machine.system() == 'cygwin' server_name = 'XWin' else server_name = 'Xming' xwin_sys_libs += ['-lpthread', '-lws2_32'] endif xwin_c_args = [] xwin_c_args += '-DHAVE_XWIN_CONFIG_H' xwin_c_args += '-Wno-bad-function-cast' srcs_windows = [ 'winclipboardinit.c', 'winclipboardwrappers.c', ] subdir('winclipboard') if build_glx if build_windowsdri xwin_c_args += '-DXWIN_WINDOWS_DRI' subdir('dri') endif xwin_c_args += '-DXWIN_GLX_WINDOWS' xwin_sys_libs += '-lopengl32' subdir('glx') endif srcs_windows += [ 'winmultiwindowshape.c', 'winmultiwindowwindow.c', 'winmultiwindowwm.c', 'winmultiwindowwndproc.c', 'propertystore.h', 'winSetAppUserModelID.c', ] xwin_sys_libs += ['-lshlwapi', '-lole32'] srcs_windows += [ 'winrandr.c', ] srcs_windows += [ 'InitInput.c', 'InitOutput.c', 'winallpriv.c', 'winauth.c', 'winblock.c', 'wincmap.c', 'winconfig.c', 'wincreatewnd.c', 'wincursor.c', 'windialogs.c', 'winengine.c', 'winerror.c', 'winglobals.c', 'winkeybd.c', 'winkeyhook.c', 'winmisc.c', 'winmonitors.c', 'winmouse.c', 'winmsg.c', 'winmsgwindow.c', 'winmultiwindowclass.c', 'winmultiwindowicons.c', 'winos.c', 'winprefs.c', 'winprocarg.c', 'winscrinit.c', 'winshadddnl.c', 'winshadgdi.c', 'wintaskbar.c', 'wintrayicon.c', 'winvalargs.c', 'winwakeup.c', 'winwindow.c', 'winwndproc.c', 'ddraw.h', 'winconfig.h', 'win.h', 'winglobals.h', 'winkeybd.h', 'winkeynames.h', 'winlayouts.h', 'winmessages.h', 'winmonitors.h', 'winmsg.h', 'winms.h', 'winmultiwindowclass.h', 'winmultiwindowicons.h', 'winprefs.h', 'winresource.h', 'winwindow.h', 'windisplay.c', 'windisplay.h', '../../mi/miinitext.c', ] rsrc = windows.compile_resources('XWin.rc', include_directories: include_directories('../../include/')) srcs_windows += rsrc flex = find_program('flex') bison = find_program('bison') lgen = generator( flex, output : '@PLAINNAME@.yy.c', arguments : ['-i', '-o', '@OUTPUT@', '@INPUT@'] ) lfiles = lgen.process('winprefslex.l') srcs_windows += lfiles pgen = generator( bison, output : ['@BASENAME@.c', '@BASENAME@.h'], arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'] ) pfiles = pgen.process('winprefsyacc.y') srcs_windows += pfiles xwin_dep = [ common_dep, dependency('x11-xcb'), dependency('xcb-aux'), dependency('xcb-image'), dependency('xcb-ewmh'), dependency('xcb-icccm'), ] executable( server_name, srcs_windows, include_directories: [inc, top_srcdir_inc], dependencies: xwin_dep, link_with: [ xwin_windowsdri, xwin_glx, xwin_clipboard, libxserver_fb, libxserver, libxserver_glx, libglxvnd, libxserver_xkb_stubs, libxserver_miext_shadow, libxserver_pseudoramix, libxserver_xi_stubs, ], link_args: ['-Wl,--disable-stdcall-fixup', '-Wl,--export-all-symbols'] + xwin_sys_libs, c_args: xwin_c_args, gui_app: true, install: true, ) install_data( 'system.XWinrc', install_dir: join_paths(get_option('sysconfdir'), 'X11') ) xwin_man = configure_file( input: 'man/XWin.man', output: 'XWin.1', configuration: manpage_config, ) install_man(xwin_man) xwinrc_man = configure_file( input: 'man/XWinrc.man', output: 'XWinrc.5', configuration: manpage_config, ) install_man(xwinrc_man) xorg-server-1.20.8/hw/xwin/InitInput.c0000644000175000017500000000757113640201473014512 00000000000000/* Copyright 1993, 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. */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "dixstruct.h" #include "inputstr.h" /* * Local function prototypes */ int winProcEstablishConnection(ClientPtr /* client */ ); /* * Local global declarations */ DeviceIntPtr g_pwinPointer; DeviceIntPtr g_pwinKeyboard; /* Called from dix/devices.c */ /* * All of our keys generate up and down transition notifications, * so all of our keys can be used as modifiers. * * An example of a modifier is mapping the A key to the Control key. * A has to be a legal modifier. I think. */ Bool LegalModifier(unsigned int uiKey, DeviceIntPtr pDevice) { return TRUE; } /* Called from dix/dispatch.c */ /* * Run through the Windows message queue(s) one more time. * Tell mi to dequeue the events that we have sent it. */ void ProcessInputEvents(void) { #if 0 ErrorF("ProcessInputEvents\n"); #endif mieqProcessInputEvents(); #if 0 ErrorF("ProcessInputEvents - returning\n"); #endif } void DDXRingBell(int volume, int pitch, int duration) { /* winKeybdBell is used instead */ return; } #ifdef HAS_DEVWINDOWS static void xwinDevWindowsHandlerNotify(int fd, int ready, void *data) { /* This should process Windows messages, but instead all of that is delayed * until the wakeup handler is called. */ ; } #endif /* See Porting Layer Definition - p. 17 */ void InitInput(int argc, char *argv[]) { #if CYGDEBUG winDebug("InitInput\n"); #endif /* * Wrap some functions at every generation of the server. */ if (InitialVector[2] != winProcEstablishConnection) { winProcEstablishConnectionOrig = InitialVector[2]; InitialVector[2] = winProcEstablishConnection; } if (AllocDevicePair(serverClient, "Windows", &g_pwinPointer, &g_pwinKeyboard, winMouseProc, winKeybdProc, FALSE) != Success) FatalError("InitInput - Failed to allocate slave devices.\n"); mieqInit(); /* Initialize the mode key states */ winInitializeModeKeyStates(); #ifdef HAS_DEVWINDOWS /* Only open the windows message queue device once */ if (g_fdMessageQueue == WIN_FD_INVALID) { /* Open a file descriptor for the Windows message queue */ g_fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY); if (g_fdMessageQueue == -1) { FatalError("InitInput - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); } /* Add the message queue as a device to wait for in WaitForSomething */ SetNotifyFd(g_fdMessageQueue, xwinDevWindowsHandlerNotify, X_NOTIFY_READ, NULL); } #endif #if CYGDEBUG winDebug("InitInput - returning\n"); #endif } void CloseInput(void) { mieqFini(); } xorg-server-1.20.8/hw/xwin/X.ico0000644000175000017500000006117613640201473013327 00000000000000 00h ( 00 h^"00 %'  nM h^(0`ppp@w0333x30s3;{y;3p3993ppyp p 0pp 9p 9 p w pp pxyppp 9 9xxp30xpp377ppppp??8?@~<?||8@~?<1@??( @pp 03q;{yx p pppw9p pp  7pp;17ppp?À???( 7w7s7xx p0w pwppwÃ8 (0` ppp(((000@@@HHH``` 8(hx x@(p@H p8p@x`xppx(@`8pXxHHxPp`p(XHX@xphPh(HHH P0((0 p0XHXh``(XHP Ph0X@H@x880X`pX H(HxxxhHPPPX(H(P hX(PPhP X`@XXX`X8X8`PP(Xh XXpH H8hxP PX `0h@`(`(hpP0`` hhhh0p(h phhxHp `(p0p(xPHx`(x0x88x8Px(@Hx@00x8P @HHhH8(x00(@`(HX8xP``8XhpP8880@X`PppPHXX`H8`pPH@8@H@HP@Hp(08`XPX``@@8888 Y pz\\pm[,Ӻ׹\\ݬMcp4öŷLcqpķ}im7 TKRm m| mXu }mhYgGG iGG p}uuG |}E?@ABC23456) d9:) ,. 01  "#%K%'( Qp R    Y     p??8?@~<?||8@~?<1@??( @&&&RRR ttt888zzz:::(P@<Dt,bN.6>*DP6`J~r~ ~~JNBdd`.8@xz.XJN(X$$$lxhf$DHJ&\ fXNL P222^^^nJHN$RBBB`fJJ`n*R:xB42@N^j*\r:V`X"6B FPFBFJRTTHFdL?@ABCDE3456789:;*+,-./012 !"#$%&'()  ?À???( @kkkccc]]]777+++VVVZZZ-./ %M Wqy%5S!!"H*KKLUUTmN"S%%%320i"OOooo&&&k!QU;l{{{b Z'`555^6iW>:5gm)p/tX"FVJ]"3gDMA>[Y+\s& -%!;;;{ 1 ll G  e r Per G ,/xyz{  1{UGC~CD6D!D<!DDKۭ׫ ۪ V UUU_*p5gZ]VWY\bdfE@=/!!!F OyV`KODA@C@=?AGLIGGGLVGHv+6; T )p׶Q=:8665DXfkoeQrwruVLY[`I>ar1󓟱H?(,~75,Fe캃瘟D no, ,L[;}Vdfg9[m d ! "Yd~A34~4~1:U2vOLKK $DMLXUlʘ\8Eg*o-x0x9={;W}Qo`8n霜(AL{S[{e8flu:Jq'c/s0q2s/yU+%g H `OK{z4dpYwj35pb+n*j%rl u555"3cmlR{ta~0`6`j~1ca&e+g'j!frss;oooKNXP@l CmEgσ!^&^)`(h(hpߙ"111a۽'|t\Ud8Dl=k#U![^'b'c2j]bE .n uPVS6Q PuV$YX!_'dr~B]tkfEEEX\>eE MR&U#XV>lٙ|||/򐐐mkiyQhe,NQ"PRS#Y"ZXw+Y)VKKKtCz{BOiWbTzq|||bbbg|idn|&LV:Snm0ZҘFJLVGzYJxb]^III887G'sip*Xab@JU9i'^pCv1/YMY Dywn ׉ĆJ,,,T&!*)))Gy*pz,zGCQgG```ꝝHHHv :&(iX fAAA. 777gB3 .UUU{hsss,,,333111111111111---  $$$ [[[n(+??8?@~<?||8@~?<1@??( @  rvi^UW^c;;;ITTTj,pzgYNPWZ|}}:{ wKgO[UYagwUFo= 'Ia>FQGCGJSUTHGeL=p$+%u+R;xC42@N_kW##$*\s;WaY"7C R  GG\hh264Pusg`Z~zv>JK`nۨve}coyg)h!i*r'n5\K")]WYRg_b3baOFvT|T#e)i"iV f^T >)CQ!j`Z#s._6e!\$a)h cGGGVVV~!*jh Znp~Y)X!Z!_*efGvvv~k5Wjda ~Q!VX4gE]999WFKVcX@.Sߡ PS#ZPut+\i%C111UnajQZ-[OP![LxBFt?pS;;;|#\]!ILO!V@q9:m8ibbbQQQ aD=paLJQDiX8c>e'''1ngkBdnOJ߶IN%RC>CCC iV^`fQ P Q6NM Q:R!(K:_233^^^ ^yn~P/\$DkIK'\LT7MU7|i::: n(Q@<{DzuP Bbv{{{LYM YM`$9RRRa 888^'''#uuuFf l'''2RRR Z ŧF8ت?À???(  @fffCZZZZZZZZZEEE\\\)*"{+DDD !!!"3gDMA>[βY+\sm%)p/tX\kkk"FVJ]hn*]6iWBgm|e"MJ Z'`|rrr444DDD[^oA!QU;l`BBB```GGG]cOb"OO,^MVVV1dfDk%F%N"SCUUU bivZ"LGFH*]A^^^DDDrmRg<IGfW{1Wqy%5S+222tttxm1kkk%M:fIBi 5$DDDb### 222ZZZGGGZZZZZZZZZ1eeeAxorg-server-1.20.8/hw/xwin/winvalargs.c0000644000175000017500000001430013640201473014730 00000000000000/* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to *permit persons to whom the Software is furnished to do so, subject to *the following conditions: * *The above copyright notice and this permission notice 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 HAROLD L HUNT II 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 Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization *from Harold L Hunt II. * * Authors: Harold L Hunt II */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" #include "winmsg.h" /* * Verify all screens have been explicitly specified */ static BOOL isEveryScreenExplicit(void) { int i; for (i = 0; i < g_iNumScreens; i++) if (!g_ScreenInfo[i].fExplicitScreen) return FALSE; return TRUE; } /* * winValidateArgs - Look for invalid argument combinations */ Bool winValidateArgs(void) { int i; BOOL fHasNormalScreen0 = FALSE; /* * Check for a malformed set of -screen parameters. * Examples of malformed parameters: * XWin -screen 1 * XWin -screen 0 -screen 2 * XWin -screen 1 -screen 2 */ if (!isEveryScreenExplicit()) { ErrorF("winValidateArgs - Malformed set of screen parameter(s). " "Screens must be specified consecutively starting with " "screen 0. That is, you cannot have only a screen 1, nor " "could you have screen 0 and screen 2. You instead must " "have screen 0, or screen 0 and screen 1, respectively. " "You can specify as many screens as you want.\n"); return FALSE; } /* Loop through all screens */ for (i = 0; i < g_iNumScreens; ++i) { /* * Check for any combination of * -multiwindow, -mwextwm, and -rootless. */ { int iCount = 0; /* Count conflicting options */ if (g_ScreenInfo[i].fMultiWindow) ++iCount; #ifdef XWIN_MULTIWINDOWEXTWM if (g_ScreenInfo[i].fMWExtWM) ++iCount; #endif if (g_ScreenInfo[i].fRootless) ++iCount; /* Check if the first screen is without rootless and multiwindow */ if (iCount == 0 && i == 0) fHasNormalScreen0 = TRUE; /* Fail if two or more conflicting options */ if (iCount > 1) { ErrorF("winValidateArgs - Only one of -multiwindow, -mwextwm, " "and -rootless can be specific at a time.\n"); return FALSE; } } /* Check for -multiwindow or -mwextwm and Xdmcp */ /* allow xdmcp if screen 0 is normal. */ if (g_fXdmcpEnabled && !fHasNormalScreen0 && (FALSE || g_ScreenInfo[i]. fMultiWindow #ifdef XWIN_MULTIWINDOWEXTWM || g_ScreenInfo[i]. fMWExtWM #endif ) ) { ErrorF("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) " "is invalid with -multiwindow or -mwextwm.\n"); return FALSE; } /* Check for -multiwindow, -mwextwm, or -rootless and -fullscreen */ if (g_ScreenInfo[i].fFullScreen && (FALSE || g_ScreenInfo[i].fMultiWindow #ifdef XWIN_MULTIWINDOWEXTWM || g_ScreenInfo[i].fMWExtWM #endif || g_ScreenInfo[i].fRootless) ) { ErrorF("winValidateArgs - -fullscreen is invalid with " "-multiwindow, -mwextwm, or -rootless.\n"); return FALSE; } /* Check for -multiwindow, -mwextwm, or -rootless and -nodecoration */ if (!g_ScreenInfo[i].fDecoration && (FALSE || g_ScreenInfo[i].fMultiWindow #ifdef XWIN_MULTIWINDOWEXTWM || g_ScreenInfo[i].fMWExtWM #endif || g_ScreenInfo[i].fRootless) ) { ErrorF("winValidateArgs - -nodecoration is invalid with " "-multiwindow, -mwextwm, or -rootless.\n"); return FALSE; } /* Check for !fullscreen and any fullscreen-only parameters */ if (!g_ScreenInfo[i].fFullScreen && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP)) { ErrorF("winValidateArgs - -refresh and -depth are only valid " "with -fullscreen.\n"); return FALSE; } /* Check for fullscreen and any non-fullscreen parameters */ if (g_ScreenInfo[i].fFullScreen && ((g_ScreenInfo[i].iResizeMode != resizeNotAllowed) || !g_ScreenInfo[i].fDecoration || g_ScreenInfo[i].fLessPointer)) { ErrorF("winValidateArgs - -fullscreen is invalid with " "-scrollbars, -resize, -nodecoration, or -lesspointer.\n"); return FALSE; } } winDebug("winValidateArgs - Returning.\n"); return TRUE; } xorg-server-1.20.8/hw/xfree86/0000755000175000017500000000000013640201534012771 500000000000000xorg-server-1.20.8/hw/xfree86/ramdac/0000755000175000017500000000000013640201534014220 500000000000000xorg-server-1.20.8/hw/xfree86/ramdac/IBM.c0000644000175000017500000005326013640201473014723 00000000000000/* * Copyright 1998 by Alan Hourihane, Wigan, England. * * 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 Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE 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. * * Authors: Alan Hourihane, * * IBM RAMDAC routines. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Cursor.h" #define INIT_IBM_RAMDAC_INFO #include "IBMPriv.h" #include "xf86RamDacPriv.h" #define INITIALFREQERR 100000 unsigned long IBMramdac640CalculateMNPCForClock(unsigned long RefClock, /* In 100Hz units */ unsigned long ReqClock, /* In 100Hz units */ char IsPixClock, /* boolean, is this the pixel or the sys clock */ unsigned long MinClock, /* Min VCO rating */ unsigned long MaxClock, /* Max VCO rating */ unsigned long *rM, /* M Out */ unsigned long *rN, /* N Out */ unsigned long *rP, /* Min P In, P Out */ unsigned long *rC /* C Out */ ) { unsigned long M, N, P, iP = *rP; unsigned long IntRef, VCO, Clock; long freqErr, lowestFreqErr = INITIALFREQERR; unsigned long ActualClock = 0; for (N = 0; N <= 63; N++) { IntRef = RefClock / (N + 1); if (IntRef < 10000) break; /* IntRef needs to be >= 1MHz */ for (M = 2; M <= 127; M++) { VCO = IntRef * (M + 1); if ((VCO < MinClock) || (VCO > MaxClock)) continue; for (P = iP; P <= 4; P++) { if (P != 0) Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P); else Clock = (RefClock * (M + 1)) / (N + 1); freqErr = (Clock - ReqClock); if (freqErr < 0) { /* PixelClock gets rounded up always so monitor reports correct frequency. */ if (IsPixClock) continue; freqErr = -freqErr; } if (freqErr < lowestFreqErr) { *rM = M; *rN = N; *rP = P; *rC = (VCO <= 1280000 ? 1 : 2); ActualClock = Clock; lowestFreqErr = freqErr; /* Return if we found an exact match */ if (freqErr == 0) return ActualClock; } } } } return ActualClock; } unsigned long IBMramdac526CalculateMNPCForClock(unsigned long RefClock, /* In 100Hz units */ unsigned long ReqClock, /* In 100Hz units */ char IsPixClock, /* boolean, is this the pixel or the sys clock */ unsigned long MinClock, /* Min VCO rating */ unsigned long MaxClock, /* Max VCO rating */ unsigned long *rM, /* M Out */ unsigned long *rN, /* N Out */ unsigned long *rP, /* Min P In, P Out */ unsigned long *rC /* C Out */ ) { unsigned long M, N, P, iP = *rP; unsigned long IntRef, VCO, Clock; long freqErr, lowestFreqErr = INITIALFREQERR; unsigned long ActualClock = 0; for (N = 0; N <= 63; N++) { IntRef = RefClock / (N + 1); if (IntRef < 10000) break; /* IntRef needs to be >= 1MHz */ for (M = 0; M <= 63; M++) { VCO = IntRef * (M + 1); if ((VCO < MinClock) || (VCO > MaxClock)) continue; for (P = iP; P <= 4; P++) { if (P) Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P); else Clock = VCO; freqErr = (Clock - ReqClock); if (freqErr < 0) { /* PixelClock gets rounded up always so monitor reports correct frequency. */ if (IsPixClock) continue; freqErr = -freqErr; } if (freqErr < lowestFreqErr) { *rM = M; *rN = N; *rP = P; *rC = (VCO <= 1280000 ? 1 : 2); ActualClock = Clock; lowestFreqErr = freqErr; /* Return if we found an exact match */ if (freqErr == 0) return ActualClock; } } } } return ActualClock; } void IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg) { int i, maxreg, dacreg; switch (ramdacPtr->RamDacType) { case IBM640_RAMDAC: maxreg = 0x300; dacreg = 1024; break; default: maxreg = 0x100; dacreg = 768; break; } /* Here we pass a short, so that we can evaluate a mask too */ /* So that the mask is the high byte and the data the low byte */ for (i = 0; i < maxreg; i++) (*ramdacPtr->WriteDAC) (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8, ramdacReg->DacRegs[i]); (*ramdacPtr->WriteAddress) (pScrn, 0); for (i = 0; i < dacreg; i++) (*ramdacPtr->WriteData) (pScrn, ramdacReg->DAC[i]); } void IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg) { int i, maxreg, dacreg; switch (ramdacPtr->RamDacType) { case IBM640_RAMDAC: maxreg = 0x300; dacreg = 1024; break; default: maxreg = 0x100; dacreg = 768; break; } (*ramdacPtr->ReadAddress) (pScrn, 0); for (i = 0; i < dacreg; i++) ramdacReg->DAC[i] = (*ramdacPtr->ReadData) (pScrn); for (i = 0; i < maxreg; i++) ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC) (pScrn, i); } RamDacHelperRecPtr IBMramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs /* , RamDacRecPtr ramdacPtr */ ) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); RamDacHelperRecPtr ramdacHelperPtr = NULL; Bool RamDacIsSupported = FALSE; int IBMramdac_ID = -1; int i; unsigned char id, rev, id2, rev2; /* read ID and revision */ rev = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_rev); id = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_id); /* check if ID and revision are read only */ (*ramdacPtr->WriteDAC) (pScrn, ~rev, 0, IBMRGB_rev); (*ramdacPtr->WriteDAC) (pScrn, ~id, 0, IBMRGB_id); rev2 = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_rev); id2 = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_id); switch (id) { case 0x30: if (rev == 0xc0) IBMramdac_ID = IBM624_RAMDAC; if (rev == 0x80) IBMramdac_ID = IBM624DB_RAMDAC; break; case 0x12: if (rev == 0x1c) IBMramdac_ID = IBM640_RAMDAC; break; case 0x01: IBMramdac_ID = IBM525_RAMDAC; break; case 0x02: if (rev == 0xf0) IBMramdac_ID = IBM524_RAMDAC; if (rev == 0xe0) IBMramdac_ID = IBM524A_RAMDAC; if (rev == 0xc0) IBMramdac_ID = IBM526_RAMDAC; if (rev == 0x80) IBMramdac_ID = IBM526DB_RAMDAC; break; } if (id == 1 || id == 2) { if (id == id2 && rev == rev2) { /* IBM RGB52x found */ /* check for 128bit VRAM -> RGB528 */ if (((*ramdacPtr->ReadDAC) (pScrn, IBMRGB_misc1) & 0x03) == 0x03) { IBMramdac_ID = IBM528_RAMDAC; /* 128bit DAC found */ if (rev == 0xe0) IBMramdac_ID = IBM528A_RAMDAC; } } } (*ramdacPtr->WriteDAC) (pScrn, rev, 0, IBMRGB_rev); (*ramdacPtr->WriteDAC) (pScrn, id, 0, IBMRGB_id); if (IBMramdac_ID == -1) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Cannot determine IBM RAMDAC type, aborting\n"); return NULL; } else { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Attached RAMDAC is %s\n", IBMramdacDeviceInfo[IBMramdac_ID & 0xFFFF].DeviceName); } for (i = 0; ramdacs[i].token != -1; i++) { if (ramdacs[i].token == IBMramdac_ID) RamDacIsSupported = TRUE; } if (!RamDacIsSupported) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "This IBM RAMDAC is NOT supported by this driver, aborting\n"); return NULL; } ramdacHelperPtr = RamDacHelperCreateInfoRec(); switch (IBMramdac_ID) { case IBM526_RAMDAC: case IBM526DB_RAMDAC: ramdacHelperPtr->SetBpp = IBMramdac526SetBpp; ramdacHelperPtr->HWCursorInit = IBMramdac526HWCursorInit; break; case IBM640_RAMDAC: ramdacHelperPtr->SetBpp = IBMramdac640SetBpp; ramdacHelperPtr->HWCursorInit = IBMramdac640HWCursorInit; break; } ramdacPtr->RamDacType = IBMramdac_ID; ramdacHelperPtr->RamDacType = IBMramdac_ID; ramdacHelperPtr->Save = IBMramdacSave; ramdacHelperPtr->Restore = IBMramdacRestore; return ramdacHelperPtr; } void IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg) { ramdacReg->DacRegs[IBMRGB_key_control] = 0x00; /* Disable Chroma Key */ switch (pScrn->bitsPerPixel) { case 32: ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_32BPP; ramdacReg->DacRegs[IBMRGB_32bpp] = B32_DCOL_DIRECT; ramdacReg->DacRegs[IBMRGB_24bpp] = 0; ramdacReg->DacRegs[IBMRGB_16bpp] = 0; ramdacReg->DacRegs[IBMRGB_8bpp] = 0; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { ramdacReg->DacRegs[IBMRGB_key_control] = 0x01; /* Enable Key */ ramdacReg->DacRegs[IBMRGB_key] = 0xFF; ramdacReg->DacRegs[IBMRGB_key_mask] = 0xFF; } break; case 24: ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_24BPP; ramdacReg->DacRegs[IBMRGB_32bpp] = 0; ramdacReg->DacRegs[IBMRGB_24bpp] = B24_DCOL_DIRECT; ramdacReg->DacRegs[IBMRGB_16bpp] = 0; ramdacReg->DacRegs[IBMRGB_8bpp] = 0; break; case 16: if (pScrn->depth == 16) { ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP; ramdacReg->DacRegs[IBMRGB_32bpp] = 0; ramdacReg->DacRegs[IBMRGB_24bpp] = 0; ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT | B16_LINEAR | B16_CONTIGUOUS | B16_565; ramdacReg->DacRegs[IBMRGB_8bpp] = 0; } else { ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP; ramdacReg->DacRegs[IBMRGB_32bpp] = 0; ramdacReg->DacRegs[IBMRGB_24bpp] = 0; ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT | B16_LINEAR | B16_CONTIGUOUS | B16_555; ramdacReg->DacRegs[IBMRGB_8bpp] = 0; } break; case 8: ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_8BPP; ramdacReg->DacRegs[IBMRGB_32bpp] = 0; ramdacReg->DacRegs[IBMRGB_24bpp] = 0; ramdacReg->DacRegs[IBMRGB_16bpp] = 0; ramdacReg->DacRegs[IBMRGB_8bpp] = B8_DCOL_INDIRECT; break; case 4: ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_4BPP; ramdacReg->DacRegs[IBMRGB_32bpp] = 0; ramdacReg->DacRegs[IBMRGB_24bpp] = 0; ramdacReg->DacRegs[IBMRGB_16bpp] = 0; ramdacReg->DacRegs[IBMRGB_8bpp] = 0; } } IBMramdac526SetBppProc * IBMramdac526SetBppWeak(void) { return IBMramdac526SetBpp; } void IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg) { unsigned char bpp = 0x00; unsigned char overlaybpp = 0x00; unsigned char offset = 0x00; unsigned char dispcont = 0x44; ramdacReg->DacRegs[RGB640_SER_WID_03_00] = 0x00; ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x00; ramdacReg->DacRegs[RGB640_DIAGS] = 0x07; switch (pScrn->depth) { case 8: ramdacReg->DacRegs[RGB640_SER_07_00] = 0x00; ramdacReg->DacRegs[RGB640_SER_15_08] = 0x00; ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00; ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00; ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_16_1; /*16:1 Mux */ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */ bpp = 0x03; break; case 15: ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10; ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11; ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00; ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00; ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux */ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */ bpp = 0x0E; break; case 16: ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10; ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11; ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00; ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00; ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux */ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */ bpp = 0x05; break; case 24: ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30; ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31; ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32; ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33; ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux */ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */ bpp = 0x09; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x04; ramdacReg->DacRegs[RGB640_CHROMA_KEY0] = 0xFF; ramdacReg->DacRegs[RGB640_CHROMA_MASK0] = 0xFF; offset = 0x04; overlaybpp = 0x04; dispcont = 0x48; } break; case 30: /* 10 bit dac */ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30; ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31; ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32; ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33; ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux */ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PSIZE10 | IBM640_PCLK_8; /* pll / 8 */ bpp = 0x0D; break; } { int i; for (i = 0x100; i < 0x140; i += 4) { /* Initialize FrameBuffer Window Attribute Table */ ramdacReg->DacRegs[i + 0] = bpp; ramdacReg->DacRegs[i + 1] = offset; ramdacReg->DacRegs[i + 2] = 0x00; ramdacReg->DacRegs[i + 3] = 0x00; /* Initialize Overlay Window Attribute Table */ ramdacReg->DacRegs[i + 0x100] = overlaybpp; ramdacReg->DacRegs[i + 0x101] = 0x00; ramdacReg->DacRegs[i + 0x102] = 0x00; ramdacReg->DacRegs[i + 0x103] = dispcont; } } } static void IBMramdac526ShowCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Enable cursor - X11 mode */ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs, 0x00, 0x07); } static void IBMramdac640ShowCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Enable cursor - mode2 (x11 mode) */ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x0B); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CROSSHAIR_CONTROL, 0x00, 0x00); } static void IBMramdac526HideCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Disable cursor - X11 mode */ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs, 0x00, 0x24); } static void IBMramdac640HideCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Disable cursor - mode2 (x11 mode) */ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x08); } static void IBMramdac526SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); x += 64; y += 64; (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_hot_x, 0x00, 0x3f); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_hot_y, 0x00, 0x3f); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_xl, 0x00, x & 0xff); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_xh, 0x00, (x >> 8) & 0xf); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_yl, 0x00, y & 0xff); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_yh, 0x00, (y >> 8) & 0xf); } static void IBMramdac640SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); x += 64; y += 64; (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_OFFSETX, 0x00, 0x3f); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_OFFSETY, 0x00, 0x3f); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_X_LOW, 0x00, x & 0xff); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_X_HIGH, 0x00, (x >> 8) & 0xf); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_Y_LOW, 0x00, y & 0xff); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_Y_HIGH, 0x00, (y >> 8) & 0xf); } static void IBMramdac526SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col1_r, 0x00, bg >> 16); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col1_g, 0x00, bg >> 8); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col1_b, 0x00, bg); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col2_r, 0x00, fg >> 16); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col2_g, 0x00, fg >> 8); (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col2_b, 0x00, fg); } static void IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_COL0, 0x00, 0); (*ramdacPtr->WriteData) (pScrn, fg >> 16); (*ramdacPtr->WriteData) (pScrn, fg >> 8); (*ramdacPtr->WriteData) (pScrn, fg); (*ramdacPtr->WriteData) (pScrn, bg >> 16); (*ramdacPtr->WriteData) (pScrn, bg >> 8); (*ramdacPtr->WriteData) (pScrn, bg); (*ramdacPtr->WriteData) (pScrn, fg >> 16); (*ramdacPtr->WriteData) (pScrn, fg >> 8); (*ramdacPtr->WriteData) (pScrn, fg); (*ramdacPtr->WriteData) (pScrn, bg >> 16); (*ramdacPtr->WriteData) (pScrn, bg >> 8); (*ramdacPtr->WriteData) (pScrn, bg); } static Bool IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); int i; /* * Output the cursor data. The realize function has put the planes into * their correct order, so we can just blast this out. */ for (i = 0; i < 1024; i++) (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_array + i, 0x00, (*src++)); return TRUE; } static Bool IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); int i; /* * Output the cursor data. The realize function has put the planes into * their correct order, so we can just blast this out. */ for (i = 0; i < 1024; i++) (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++)); return TRUE; } static Bool IBMramdac526UseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { return TRUE; } static Bool IBMramdac640UseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { return TRUE; } void IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr) { infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; infoPtr->SetCursorColors = IBMramdac526SetCursorColors; infoPtr->SetCursorPosition = IBMramdac526SetCursorPosition; infoPtr->LoadCursorImageCheck = IBMramdac526LoadCursorImage; infoPtr->HideCursor = IBMramdac526HideCursor; infoPtr->ShowCursor = IBMramdac526ShowCursor; infoPtr->UseHWCursor = IBMramdac526UseHWCursor; } void IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr) { infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; infoPtr->SetCursorColors = IBMramdac640SetCursorColors; infoPtr->SetCursorPosition = IBMramdac640SetCursorPosition; infoPtr->LoadCursorImageCheck = IBMramdac640LoadCursorImage; infoPtr->HideCursor = IBMramdac640HideCursor; infoPtr->ShowCursor = IBMramdac640ShowCursor; infoPtr->UseHWCursor = IBMramdac640UseHWCursor; } xorg-server-1.20.8/hw/xfree86/ramdac/xf86RamDac.c0000644000175000017500000000721313640201473016154 00000000000000/* * Copyright 1998 by Alan Hourihane, Wigan, England. * * 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 Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE 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. * * Authors: Alan Hourihane, * * Generic RAMDAC access routines. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86_OSproc.h" #include "xf86RamDacPriv.h" int RamDacHWPrivateIndex = -1; int RamDacScreenPrivateIndex = -1; RamDacRecPtr RamDacCreateInfoRec(void) { RamDacRecPtr infoRec; infoRec = calloc(1, sizeof(RamDacRec)); return infoRec; } RamDacHelperRecPtr RamDacHelperCreateInfoRec(void) { RamDacHelperRecPtr infoRec; infoRec = calloc(1, sizeof(RamDacHelperRec)); return infoRec; } void RamDacDestroyInfoRec(RamDacRecPtr infoRec) { free(infoRec); } void RamDacHelperDestroyInfoRec(RamDacHelperRecPtr infoRec) { free(infoRec); } Bool RamDacInit(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPriv) { RamDacScreenRecPtr ramdacScrPtr; /* * make sure the RamDacRec is allocated */ if (!RamDacGetRec(pScrn)) return FALSE; ramdacScrPtr = ((RamDacScreenRecPtr) (pScrn)->privates[RamDacGetScreenIndex()].ptr); ramdacScrPtr->RamDacRec = ramdacPriv; return TRUE; } void RamDacGetRecPrivate(void) { if (RamDacHWPrivateIndex < 0) RamDacHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); if (RamDacScreenPrivateIndex < 0) RamDacScreenPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); return; } Bool RamDacGetRec(ScrnInfoPtr scrp) { RamDacGetRecPrivate(); /* * New privates are always set to NULL, so we can check if the allocation * has already been done. */ if (scrp->privates[RamDacHWPrivateIndex].ptr != NULL) return TRUE; if (scrp->privates[RamDacScreenPrivateIndex].ptr != NULL) return TRUE; scrp->privates[RamDacHWPrivateIndex].ptr = xnfcalloc(sizeof(RamDacHWRec), 1); scrp->privates[RamDacScreenPrivateIndex].ptr = xnfcalloc(sizeof(RamDacScreenRec), 1); return TRUE; } void RamDacFreeRec(ScrnInfoPtr pScrn) { RamDacHWRecPtr ramdacHWPtr; RamDacScreenRecPtr ramdacScrPtr; if (RamDacHWPrivateIndex < 0) return; if (RamDacScreenPrivateIndex < 0) return; ramdacHWPtr = RAMDACHWPTR(pScrn); ramdacScrPtr = ((RamDacScreenRecPtr) (pScrn)->privates[RamDacGetScreenIndex()].ptr); free(ramdacHWPtr); ramdacHWPtr = NULL; free(ramdacScrPtr); ramdacScrPtr = NULL; } int RamDacGetHWIndex(void) { return RamDacHWPrivateIndex; } int RamDacGetScreenIndex(void) { return RamDacScreenPrivateIndex; } xorg-server-1.20.8/hw/xfree86/ramdac/Makefile.am0000644000175000017500000000056713640201473016206 00000000000000noinst_LTLIBRARIES = libramdac.la libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \ xf86CursorRD.c xf86HWCurs.c IBM.c BT.c TI.c sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \ CURSOR.NOTES AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) xorg-server-1.20.8/hw/xfree86/ramdac/CURSOR.NOTES0000644000175000017500000001542013640201473015773 00000000000000 CURSOR.NOTES This file describes how to add hardware cursor support to a chipset driver. Though the cursor support itself is in the ramdac module, cursor management is separate from the rest of the module. 1) CURSOR INITIALIZATION AND SHUTDOWN All relevant prototypes and defines are in xf86Cursor.h. To initialize the cursor, the driver should allocate an xf86CursorInfoRec via xf86CreateCursorInfoRec(), fill it out as described later in this document and pass it to xf86InitCursor(). xf86InitCursor() must be called _after_ the software cursor initialization (usually miDCInitialize). When shutting down, the driver should free the xf86CursorInfoRec structure in its CloseScreen function via xf86DestroyCursorInfoRec(). 2) FILLING OUT THE xf86CursorInfoRec The driver informs the ramdac module of it's hardware cursor capablities by filling out an xf86CursorInfoRec structure and passing it to xf86InitCursor(). The xf86CursorInfoRec contains the following function pointers: /**** These functions are required ****/ void ShowCursor(ScrnInfoPtr pScrn) ShowCursor should display the current cursor. void HideCursor(ScrnInfoPtr pScrn) HideCursor should hide the current cursor. void SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) Set the cursor position to (x,y). X and/or y may be negative indicating that the cursor image is partially offscreen on the left and/or top edges of the screen. It is up to the driver to trap for this and deal with that situation. void SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) Set the cursor foreground and background colors. In 8bpp, fg and bg are indicies into the current colormap unless the HARDWARE_CURSOR_TRUECOLOR_AT_8BPP flag is set. In that case and in all other bpps the fg and bg are in 8-8-8 RGB format. void LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits) LoadCursorImage is how the hardware cursor bits computed by the RealizeCursor function will be passed to the driver when the cursor shape needs to be changed. /**** These functions are optional ****/ unsigned char* RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) If RealizeCursor is not provided by the driver, one will be provided for you based on the Flags field described below. The driver must provide this function if the hardware cursor format is not one of the common ones supported by this module. Bool UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) If the driver is unable to use a hardware cursor for reasons other than the cursor being larger than the maximum specified in the MaxWidth or MaxHeight field below, it can supply the UseHWCursor function. If UseHWCursor is provided by the driver, it will be called whenever the cursor shape changes or the video mode changes. This is useful for when the hardware cursor cannot be used in interlaced or doublescan modes. /**** The following fields are required ****/ MaxWidth MaxHeight These indicate the largest sized cursor that can be a hardware cursor. It will fall back to a software cursor when a cursor exceeding this size needs to be used. Flags /* Color related flags */ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP This indicates that the colors passed to the SetCursorColors function should not be in 8-8-8 RGB format in 8bpp but rather, they should be the pixel values from the current colormap. /* Cursor data loading flags */ HARDWARE_CURSOR_SHOW_TRANSPARENT The HideCursor entry will normally be called instead of displaying a completely transparent cursor, or when a switch to a software cursor needs to occur. This flag prevents this behaviour, thus causing the LoadCursorImage entry to be called with transparent cursor data. NOTE: If you use this flag and provide your own RealizeCursor() entry, ensure this entry returns transparent cursor data when called with a NULL pCurs parameter. HARDWARE_CURSOR_UPDATE_UNHIDDEN This flag prevents the HideCursor call that would normally occur just before the LoadCursorImage entry is to be called to load a new hardware cursor image. /* Cursor data packing flags */ Hardware cursor data consists of two pieces, a source and a mask. The mask is a bitmap indicating which parts of the cursor are transparent and which parts are drawn. The source is a bitmap indicating which parts of the non-transparent portion of the the cursor should be painted in the foreground color and which should be painted in the background color. HARDWARE_CURSOR_INVERT_MASK By default, set bits indicate the opaque part of the mask bitmap and clear bits indicate the transparent part. If your hardware wants this the opposite way, this flag will invert the mask. HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK By default, RealizeCursor will store the source first and then the mask. If the hardware needs this order reversed then this flag should be set. HARDWARE_CURSOR_AND_SOURCE_WITH_MASK This flag will have the module logical AND the source with the mask to make sure there are no source bits set if the corresponding mask bits aren't set. Some hardware will not care if source bits are set where there are supposed to be transparent areas, but some hardware will interpret this as a third cursor color or similar. That type of hardware will need this flag set. HARDWARE_CURSOR_BIT_ORDER_MSBFIRST By default, it is assumed that the least significant bit in each byte corresponds to the leftmost pixel on the screen. If your hardware has this reversed you should set this flag. HARDWARE_CURSOR_NIBBLE_SWAPPED If your hardware requires byte swapping of the hardware cursor, enable this option. /* Source-Mask interleaving flags */ By default the source and mask data are inlined (source first unless the HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK flag is set). Some hardware will require the source and mask to be interleaved, that is, X number of source bits should packed and then X number of mask bits repeating until the entire pattern is stored. The following flags describe the bit interleave. HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED This one is the default. The following are for interleaved cursors. 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 And once again, if your hardware requires something different than these packing styles, your driver can supply its own RealizeCursor function. $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4tsi Exp $ xorg-server-1.20.8/hw/xfree86/ramdac/xf86CursorRD.c0000644000175000017500000004110113640201473016522 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86CursorPriv.h" #include "colormapst.h" #include "cursorstr.h" /* FIXME: This was added with the ABI change of the miPointerSpriteFuncs for * MPX. * inputInfo is needed to pass the core pointer as the default argument into * the cursor functions. * * Externing inputInfo is not the nice way to do it but it works. */ #include "inputstr.h" DevPrivateKeyRec xf86CursorScreenKeyRec; /* sprite functions */ static Bool xf86CursorRealizeCursor(DeviceIntPtr, ScreenPtr, CursorPtr); static Bool xf86CursorUnrealizeCursor(DeviceIntPtr, ScreenPtr, CursorPtr); static void xf86CursorSetCursor(DeviceIntPtr, ScreenPtr, CursorPtr, int, int); static void xf86CursorMoveCursor(DeviceIntPtr, ScreenPtr, int, int); static Bool xf86DeviceCursorInitialize(DeviceIntPtr, ScreenPtr); static void xf86DeviceCursorCleanup(DeviceIntPtr, ScreenPtr); static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { xf86CursorRealizeCursor, xf86CursorUnrealizeCursor, xf86CursorSetCursor, xf86CursorMoveCursor, xf86DeviceCursorInitialize, xf86DeviceCursorCleanup }; /* Screen functions */ static void xf86CursorInstallColormap(ColormapPtr); static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool); static Bool xf86CursorCloseScreen(ScreenPtr); static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *, ScreenPtr); /* ScrnInfoRec functions */ static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr, Bool); static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr); Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CursorScreenPtr ScreenPriv; miPointerScreenPtr PointPriv; if (!xf86InitHardwareCursor(pScreen, infoPtr)) return FALSE; if (!dixRegisterPrivateKey(&xf86CursorScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; ScreenPriv = calloc(1, sizeof(xf86CursorScreenRec)); if (!ScreenPriv) return FALSE; dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, ScreenPriv); ScreenPriv->SWCursor = TRUE; ScreenPriv->isUp = FALSE; ScreenPriv->CurrentCursor = NULL; ScreenPriv->CursorInfoPtr = infoPtr; ScreenPriv->PalettedCursor = FALSE; ScreenPriv->pInstalledMap = NULL; ScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86CursorCloseScreen; ScreenPriv->QueryBestSize = pScreen->QueryBestSize; pScreen->QueryBestSize = xf86CursorQueryBestSize; ScreenPriv->RecolorCursor = pScreen->RecolorCursor; pScreen->RecolorCursor = xf86CursorRecolorCursor; if ((infoPtr->pScrn->bitsPerPixel == 8) && !(infoPtr->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP)) { ScreenPriv->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = xf86CursorInstallColormap; ScreenPriv->PalettedCursor = TRUE; } PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); ScreenPriv->showTransparent = PointPriv->showTransparent; if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) PointPriv->showTransparent = TRUE; else PointPriv->showTransparent = FALSE; ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; PointPriv->spriteFuncs = &xf86CursorSpriteFuncs; ScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess; ScreenPriv->SwitchMode = pScrn->SwitchMode; ScreenPriv->ForceHWCursorCount = 0; ScreenPriv->HWCursorForced = FALSE; pScrn->EnableDisableFBAccess = xf86CursorEnableDisableFBAccess; if (pScrn->SwitchMode) pScrn->SwitchMode = xf86CursorSwitchMode; return TRUE; } /***** Screen functions *****/ static Bool xf86CursorCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); miPointerScreenPtr PointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (ScreenPriv->isUp && pScrn->vtSema) xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); if (ScreenPriv->CurrentCursor) FreeCursor(ScreenPriv->CurrentCursor, None); pScreen->CloseScreen = ScreenPriv->CloseScreen; pScreen->QueryBestSize = ScreenPriv->QueryBestSize; pScreen->RecolorCursor = ScreenPriv->RecolorCursor; if (ScreenPriv->InstallColormap) pScreen->InstallColormap = ScreenPriv->InstallColormap; PointPriv->spriteFuncs = ScreenPriv->spriteFuncs; PointPriv->showTransparent = ScreenPriv->showTransparent; pScrn->EnableDisableFBAccess = ScreenPriv->EnableDisableFBAccess; pScrn->SwitchMode = ScreenPriv->SwitchMode; free(ScreenPriv->transparentData); free(ScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static void xf86CursorQueryBestSize(int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (class == CursorShape) { if (*width > ScreenPriv->CursorInfoPtr->MaxWidth) *width = ScreenPriv->CursorInfoPtr->MaxWidth; if (*height > ScreenPriv->CursorInfoPtr->MaxHeight) *height = ScreenPriv->CursorInfoPtr->MaxHeight; } else (*ScreenPriv->QueryBestSize) (class, width, height, pScreen); } static void xf86CursorInstallColormap(ColormapPtr pMap) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pMap->pScreen->devPrivates, xf86CursorScreenKey); ScreenPriv->pInstalledMap = pMap; (*ScreenPriv->InstallColormap) (pMap); } static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (!displayed) return; if (ScreenPriv->SWCursor) (*ScreenPriv->RecolorCursor) (pDev, pScreen, pCurs, displayed); else xf86RecolorCursor(pScreen, pCurs, displayed); } /***** ScrnInfoRec functions *********/ static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { DeviceIntPtr pDev = inputInfo.pointer; ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (!enable && ScreenPriv->CurrentCursor != NullCursor) { CursorPtr currentCursor = ScreenPriv->CurrentCursor; xf86CursorSetCursor(pDev, pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->isUp = FALSE; ScreenPriv->SWCursor = TRUE; ScreenPriv->SavedCursor = currentCursor; } if (ScreenPriv->EnableDisableFBAccess) (*ScreenPriv->EnableDisableFBAccess) (pScrn, enable); if (enable && ScreenPriv->SavedCursor) { /* * Re-set current cursor so drivers can react to FB access having been * temporarily disabled. */ xf86CursorSetCursor(pDev, pScreen, ScreenPriv->SavedCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->SavedCursor = NULL; } } static Bool xf86CursorSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool ret; ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (ScreenPriv->isUp) { xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->isUp = FALSE; } ret = (*ScreenPriv->SwitchMode) (pScrn, mode); /* * Cannot restore cursor here because the new frame[XY][01] haven't been * calculated yet. However, because the hardware cursor was removed above, * ensure the cursor is repainted by miPointerWarpCursor(). */ ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor; miPointerSetWaitForUpdate(pScreen, FALSE); /* Force cursor repaint */ return ret; } /****** miPointerSpriteFunctions *******/ static Bool xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (CursorRefCount(pCurs) <= 1) dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL); return (*ScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCurs); } static Bool xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (CursorRefCount(pCurs) <= 1) { free(dixLookupScreenPrivate (&pCurs->devPrivates, CursorScreenKey, pScreen)); dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL); } return (*ScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCurs); } static void xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */ if (ScreenPriv->SWCursor || !(GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)) (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, NullCursor, x, y); else if (ScreenPriv->isUp) { xf86SetCursor(pScreen, NullCursor, x, y); ScreenPriv->isUp = FALSE; } if (ScreenPriv->CurrentCursor) FreeCursor(ScreenPriv->CurrentCursor, None); ScreenPriv->CurrentCursor = NullCursor; return; } /* only update for VCP, otherwise we get cursor jumps when removing a sprite. The second cursor is never HW rendered anyway. */ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer) { CursorPtr cursor = RefCursor(pCurs); if (ScreenPriv->CurrentCursor) FreeCursor(ScreenPriv->CurrentCursor, None); ScreenPriv->CurrentCursor = cursor; ScreenPriv->x = x; ScreenPriv->y = y; ScreenPriv->CursorToRestore = NULL; ScreenPriv->HotX = cursor->bits->xhot; ScreenPriv->HotY = cursor->bits->yhot; if (!infoPtr->pScrn->vtSema) { ScreenPriv->SavedCursor = cursor; return; } if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || xf86CheckHWCursor(pScreen, cursor, infoPtr))) { if (ScreenPriv->SWCursor) /* remove the SW cursor */ (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, NullCursor, x, y); if (xf86SetCursor(pScreen, cursor, x, y)) { ScreenPriv->SWCursor = FALSE; ScreenPriv->isUp = TRUE; miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse); return; } } miPointerSetWaitForUpdate(pScreen, TRUE); if (ScreenPriv->isUp) { /* Remove the HW cursor, or make it transparent */ if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) { xf86SetTransparentCursor(pScreen); } else { xf86SetCursor(pScreen, NullCursor, x, y); ScreenPriv->isUp = FALSE; } } if (!ScreenPriv->SWCursor) ScreenPriv->SWCursor = TRUE; } if (pCurs->bits->emptyMask && !ScreenPriv->showTransparent) pCurs = NullCursor; (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCurs, x, y); } /* Re-set the current cursor. This will switch between hardware and software * cursor depending on whether hardware cursor is currently supported * according to the driver. */ void xf86CursorResetCursor(ScreenPtr pScreen) { xf86CursorScreenPtr ScreenPriv; if (!inputInfo.pointer) return; if (!dixPrivateKeyRegistered(xf86CursorScreenKey)) return; ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (!ScreenPriv) return; xf86CursorSetCursor(inputInfo.pointer, pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); } static void xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); /* only update coordinate state for first sprite, otherwise we get jumps when removing a sprite. The second sprite is never HW rendered anyway */ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer) { ScreenPriv->x = x; ScreenPriv->y = y; if (ScreenPriv->CursorToRestore) xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CursorToRestore, x, y); else if (ScreenPriv->SWCursor) (*ScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); else if (ScreenPriv->isUp) xf86MoveCursor(pScreen, x, y); } else (*ScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); } void xf86ForceHWCursor(ScreenPtr pScreen, Bool on) { DeviceIntPtr pDev = inputInfo.pointer; xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); if (on) { if (ScreenPriv->ForceHWCursorCount++ == 0) { if (ScreenPriv->SWCursor && ScreenPriv->CurrentCursor) { ScreenPriv->HWCursorForced = TRUE; xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); } else ScreenPriv->HWCursorForced = FALSE; } } else { if (--ScreenPriv->ForceHWCursorCount == 0) { if (ScreenPriv->HWCursorForced && ScreenPriv->CurrentCursor) xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); } } } CursorPtr xf86CurrentCursor(ScreenPtr pScreen) { xf86CursorScreenPtr ScreenPriv; if (pScreen->is_output_slave) pScreen = pScreen->current_master; ScreenPriv = dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); return ScreenPriv->CurrentCursor; } xf86CursorInfoPtr xf86CreateCursorInfoRec(void) { return calloc(1, sizeof(xf86CursorInfoRec)); } void xf86DestroyCursorInfoRec(xf86CursorInfoPtr infoPtr) { free(infoPtr); } /** * New cursor has been created. Do your initalizations here. */ static Bool xf86DeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { int ret; xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); /* Init SW cursor */ ret = (*ScreenPriv->spriteFuncs->DeviceCursorInitialize) (pDev, pScreen); return ret; } /** * Cursor has been removed. Clean up after yourself. */ static void xf86DeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); /* Clean up SW cursor */ (*ScreenPriv->spriteFuncs->DeviceCursorCleanup) (pDev, pScreen); } xorg-server-1.20.8/hw/xfree86/ramdac/xf86CursorPriv.h0000644000175000017500000000277713640201473017162 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _XF86CURSORPRIV_H #define _XF86CURSORPRIV_H #include "xf86Cursor.h" #include "mipointrst.h" typedef struct { Bool SWCursor; Bool isUp; Bool showTransparent; short HotX; short HotY; short x; short y; CursorPtr CurrentCursor, CursorToRestore; xf86CursorInfoPtr CursorInfoPtr; CloseScreenProcPtr CloseScreen; RecolorCursorProcPtr RecolorCursor; InstallColormapProcPtr InstallColormap; QueryBestSizeProcPtr QueryBestSize; miPointerSpriteFuncPtr spriteFuncs; Bool PalettedCursor; ColormapPtr pInstalledMap; Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); xf86EnableDisableFBAccessProc *EnableDisableFBAccess; CursorPtr SavedCursor; /* Number of requests to force HW cursor */ int ForceHWCursorCount; Bool HWCursorForced; void *transparentData; } xf86CursorScreenRec, *xf86CursorScreenPtr; Bool xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); void xf86SetTransparentCursor(ScreenPtr pScreen); void xf86MoveCursor(ScreenPtr pScreen, int x, int y); void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); Bool xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr); extern _X_EXPORT DevPrivateKeyRec xf86CursorScreenKeyRec; #define xf86CursorScreenKey (&xf86CursorScreenKeyRec) #endif /* _XF86CURSORPRIV_H */ xorg-server-1.20.8/hw/xfree86/ramdac/TIPriv.h0000644000175000017500000000113213640201473015465 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include "TI.h" typedef struct { const char *DeviceName; } xf86TIramdacInfo; extern xf86TIramdacInfo TIramdacDeviceInfo[]; #ifdef INIT_TI_RAMDAC_INFO xf86TIramdacInfo TIramdacDeviceInfo[] = { {"TI TVP3030"}, {"TI TVP3026"} }; #endif #define TISAVE(_reg) do { \ ramdacReg->DacRegs[_reg] = (*ramdacPtr->ReadDAC)(pScrn, _reg); \ } while (0) #define TIRESTORE(_reg) do { \ (*ramdacPtr->WriteDAC)(pScrn, _reg, \ (ramdacReg->DacRegs[_reg] & 0xFF00) >> 8, \ ramdacReg->DacRegs[_reg]); \ } while (0) xorg-server-1.20.8/hw/xfree86/ramdac/xf86RamDacPriv.h0000644000175000017500000000052213640201473017016 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86RamDac.h" #include "xf86cmap.h" void RamDacGetRecPrivate(void); Bool RamDacGetRec(ScrnInfoPtr pScrn); int RamDacGetScreenIndex(void); void RamDacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual); xorg-server-1.20.8/hw/xfree86/ramdac/xf86RamDac.h0000644000175000017500000000560013640201473016157 00000000000000 #ifndef _XF86RAMDAC_H #define _XF86RAMDAC_H 1 #include "colormapst.h" #include "xf86Cursor.h" /* Define unique vendor codes for RAMDAC's */ #define VENDOR_IBM 0x0000 #define VENDOR_BT 0x0001 #define VENDOR_TI 0x0002 typedef struct _RamDacRegRec { /* This is probably the nastiest assumption, we allocate 1024 slots for * ramdac registers, should be enough. I've checked IBM and TVP series * and they seem o.k * Then we allocate 768 entries for the DAC too. IBM640 needs 1024 -FIXME */ unsigned short DacRegs[0x400]; /* register set */ unsigned char DAC[0x300]; /* colour map */ Bool Overlay; } RamDacRegRec, *RamDacRegRecPtr; typedef struct _RamDacHWRegRec { RamDacRegRec SavedReg; RamDacRegRec ModeReg; } RamDacHWRec, *RamDacHWRecPtr; typedef struct _RamDacRec { CARD32 RamDacType; void (*LoadPalette) (ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual); unsigned char (*ReadDAC) (ScrnInfoPtr pScrn, CARD32); void (*WriteDAC) (ScrnInfoPtr pScrn, CARD32, unsigned char, unsigned char); void (*WriteAddress) (ScrnInfoPtr pScrn, CARD32); void (*WriteData) (ScrnInfoPtr pScrn, unsigned char); void (*ReadAddress) (ScrnInfoPtr pScrn, CARD32); unsigned char (*ReadData) (ScrnInfoPtr pScrn); } RamDacRec, *RamDacRecPtr; typedef struct _RamDacHelperRec { CARD32 RamDacType; void (*Restore) (ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg); void (*Save) (ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg); void (*SetBpp) (ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg); void (*HWCursorInit) (xf86CursorInfoPtr infoPtr); } RamDacHelperRec, *RamDacHelperRecPtr; #define RAMDACHWPTR(p) ((RamDacHWRecPtr)((p)->privates[RamDacGetHWIndex()].ptr)) typedef struct _RamdacScreenRec { RamDacRecPtr RamDacRec; } RamDacScreenRec, *RamDacScreenRecPtr; #define RAMDACSCRPTR(p) ((RamDacScreenRecPtr)((p)->privates[RamDacGetScreenIndex()].ptr))->RamDacRec extern _X_EXPORT int RamDacHWPrivateIndex; extern _X_EXPORT int RamDacScreenPrivateIndex; typedef struct { int token; } RamDacSupportedInfoRec, *RamDacSupportedInfoRecPtr; extern _X_EXPORT RamDacRecPtr RamDacCreateInfoRec(void); extern _X_EXPORT RamDacHelperRecPtr RamDacHelperCreateInfoRec(void); extern _X_EXPORT void RamDacDestroyInfoRec(RamDacRecPtr RamDacRec); extern _X_EXPORT void RamDacHelperDestroyInfoRec(RamDacHelperRecPtr RamDacRec); extern _X_EXPORT Bool RamDacInit(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec); extern _X_EXPORT Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits, unsigned int flags); extern _X_EXPORT void RamDacFreeRec(ScrnInfoPtr pScrn); extern _X_EXPORT int RamDacGetHWIndex(void); #endif /* _XF86RAMDAC_H */ xorg-server-1.20.8/hw/xfree86/ramdac/IBM.h0000644000175000017500000003670213640201473014732 00000000000000 #include extern _X_EXPORT RamDacHelperRecPtr IBMramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs); extern _X_EXPORT void IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT unsigned long IBMramdac526CalculateMNPCForClock(unsigned long RefClock, unsigned long ReqClock, char IsPixClock, unsigned long MinClock, unsigned long MaxClock, unsigned long *rM, unsigned long *rN, unsigned long *rP, unsigned long *rC); extern _X_EXPORT unsigned long IBMramdac640CalculateMNPCForClock(unsigned long RefClock, unsigned long ReqClock, char IsPixClock, unsigned long MinClock, unsigned long MaxClock, unsigned long *rM, unsigned long *rN, unsigned long *rP, unsigned long *rC); extern _X_EXPORT void IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr); extern _X_EXPORT void IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr); typedef void IBMramdac526SetBppProc(ScrnInfoPtr, RamDacRegRecPtr); extern _X_EXPORT IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void); #define IBM524_RAMDAC ((VENDOR_IBM << 16) | 0x00) #define IBM524A_RAMDAC ((VENDOR_IBM << 16) | 0x01) #define IBM525_RAMDAC ((VENDOR_IBM << 16) | 0x02) #define IBM526_RAMDAC ((VENDOR_IBM << 16) | 0x03) #define IBM526DB_RAMDAC ((VENDOR_IBM << 16) | 0x04) #define IBM528_RAMDAC ((VENDOR_IBM << 16) | 0x05) #define IBM528A_RAMDAC ((VENDOR_IBM << 16) | 0x06) #define IBM624_RAMDAC ((VENDOR_IBM << 16) | 0x07) #define IBM624DB_RAMDAC ((VENDOR_IBM << 16) | 0x08) #define IBM640_RAMDAC ((VENDOR_IBM << 16) | 0x09) /* * IBM Ramdac registers */ #define IBMRGB_REF_FREQ_1 14.31818 #define IBMRGB_REF_FREQ_2 50.00000 #define IBMRGB_rev 0x00 #define IBMRGB_id 0x01 #define IBMRGB_misc_clock 0x02 #define IBMRGB_sync 0x03 #define IBMRGB_hsync_pos 0x04 #define IBMRGB_pwr_mgmt 0x05 #define IBMRGB_dac_op 0x06 #define IBMRGB_pal_ctrl 0x07 #define IBMRGB_sysclk 0x08 /* not RGB525 */ #define IBMRGB_pix_fmt 0x0a #define IBMRGB_8bpp 0x0b #define IBMRGB_16bpp 0x0c #define IBMRGB_24bpp 0x0d #define IBMRGB_32bpp 0x0e #define IBMRGB_pll_ctrl1 0x10 #define IBMRGB_pll_ctrl2 0x11 #define IBMRGB_pll_ref_div_fix 0x14 #define IBMRGB_sysclk_ref_div 0x15 /* not RGB525 */ #define IBMRGB_sysclk_vco_div 0x16 /* not RGB525 */ /* #define IBMRGB_f0 0x20 */ #define IBMRGB_sysclk_n 0x15 #define IBMRGB_sysclk_m 0x16 #define IBMRGB_sysclk_p 0x17 #define IBMRGB_sysclk_c 0x18 #define IBMRGB_m0 0x20 #define IBMRGB_n0 0x21 #define IBMRGB_p0 0x22 #define IBMRGB_c0 0x23 #define IBMRGB_m1 0x24 #define IBMRGB_n1 0x25 #define IBMRGB_p1 0x26 #define IBMRGB_c1 0x27 #define IBMRGB_m2 0x28 #define IBMRGB_n2 0x29 #define IBMRGB_p2 0x2a #define IBMRGB_c2 0x2b #define IBMRGB_m3 0x2c #define IBMRGB_n3 0x2d #define IBMRGB_p3 0x2e #define IBMRGB_c3 0x2f #define IBMRGB_curs 0x30 #define IBMRGB_curs_xl 0x31 #define IBMRGB_curs_xh 0x32 #define IBMRGB_curs_yl 0x33 #define IBMRGB_curs_yh 0x34 #define IBMRGB_curs_hot_x 0x35 #define IBMRGB_curs_hot_y 0x36 #define IBMRGB_curs_col1_r 0x40 #define IBMRGB_curs_col1_g 0x41 #define IBMRGB_curs_col1_b 0x42 #define IBMRGB_curs_col2_r 0x43 #define IBMRGB_curs_col2_g 0x44 #define IBMRGB_curs_col2_b 0x45 #define IBMRGB_curs_col3_r 0x46 #define IBMRGB_curs_col3_g 0x47 #define IBMRGB_curs_col3_b 0x48 #define IBMRGB_border_col_r 0x60 #define IBMRGB_border_col_g 0x61 #define IBMRGB_botder_col_b 0x62 #define IBMRGB_key 0x68 #define IBMRGB_key_mask 0x6C #define IBMRGB_misc1 0x70 #define IBMRGB_misc2 0x71 #define IBMRGB_misc3 0x72 #define IBMRGB_misc4 0x73 /* not RGB525 */ #define IBMRGB_key_control 0x78 #define IBMRGB_dac_sense 0x82 #define IBMRGB_misr_r 0x84 #define IBMRGB_misr_g 0x86 #define IBMRGB_misr_b 0x88 #define IBMRGB_pll_vco_div_in 0x8e #define IBMRGB_pll_ref_div_in 0x8f #define IBMRGB_vram_mask_0 0x90 #define IBMRGB_vram_mask_1 0x91 #define IBMRGB_vram_mask_2 0x92 #define IBMRGB_vram_mask_3 0x93 #define IBMRGB_curs_array 0x100 /* Constants rgb525.h */ /* RGB525_REVISION_LEVEL */ #define RGB525_PRODUCT_REV_LEVEL 0xf0 /* RGB525_ID */ #define RGB525_PRODUCT_ID 0x01 /* RGB525_MISC_CTRL_1 */ #define MISR_CNTL_ENABLE 0x80 #define VMSK_CNTL_ENABLE 0x40 #define PADR_RDMT_RDADDR 0x0 #define PADR_RDMT_PAL_STATE 0x20 #define SENS_DSAB_DISABLE 0x10 #define SENS_SEL_BIT3 0x0 #define SENS_SEL_BIT7 0x08 #define VRAM_SIZE_32 0x0 #define VRAM_SIZE_64 0x01 /* RGB525_MISC_CTRL_2 */ #define PCLK_SEL_LCLK 0x0 #define PCLK_SEL_PLL 0x40 #define PCLK_SEL_EXT 0x80 #define INTL_MODE_ENABLE 0x20 #define BLANK_CNTL_ENABLE 0x10 #define COL_RES_6BIT 0x0 #define COL_RES_8BIT 0x04 #define PORT_SEL_VGA 0x0 #define PORT_SEL_VRAM 0x01 /* RGB525_MISC_CTRL_3 */ #define SWAP_RB 0x80 #define SWAP_WORD_LOHI 0x0 #define SWAP_WORD_HILO 0x10 #define SWAP_NIB_HILO 0x0 #define SWAP_NIB_LOHI 0x02 /* RGB525_MISC_CLK_CTRL */ #define DDOT_CLK_ENABLE 0x0 #define DDOT_CLK_DISABLE 0x80 #define SCLK_ENABLE 0x0 #define SCLK_DISABLE 0x40 #define B24P_DDOT_PLL 0x0 #define B24P_DDOT_SCLK 0x20 #define DDOT_DIV_PLL_1 0x0 #define DDOT_DIV_PLL_2 0x02 #define DDOT_DIV_PLL_4 0x04 #define DDOT_DIV_PLL_8 0x06 #define DDOT_DIV_PLL_16 0x08 #define PLL_DISABLE 0x0 #define PLL_ENABLE 0x01 /* RGB525_SYNC_CTRL */ #define DLY_CNTL_ADD 0x0 #define DLY_SYNC_NOADD 0x80 #define CSYN_INVT_DISABLE 0x0 #define CSYN_INVT_ENABLE 0x40 #define VSYN_INVT_DISABLE 0x0 #define VSYN_INVT_ENABLE 0x20 #define HSYN_INVT_DISABLE 0x0 #define HSYN_INVT_ENABLE 0x10 #define VSYN_CNTL_NORMAL 0x0 #define VSYN_CNTL_HIGH 0x04 #define VSYN_CNTL_LOW 0x08 #define VSYN_CNTL_DISABLE 0x0C #define HSYN_CNTL_NORMAL 0x0 #define HSYN_CNTL_HIGH 0x01 #define HSYN_CNTL_LOW 0x02 #define HSYN_CNTL_DISABLE 0x03 /* RGB525_HSYNC_CTRL */ #define HSYN_POS(n) (n) /* RGB525_POWER_MANAGEMENT */ #define SCLK_PWR_NORMAL 0x0 #define SCLK_PWR_DISABLE 0x10 #define DDOT_PWR_NORMAL 0x0 #define DDOT_PWR_DISABLE 0x08 #define SYNC_PWR_NORMAL 0x0 #define SYNC_PWR_DISABLE 0x04 #define ICLK_PWR_NORMAL 0x0 #define ICLK_PWR_DISABLE 0x02 #define DAC_PWR_NORMAL 0x0 #define DAC_PWR_DISABLE 0x01 /* RGB525_DAC_OPERATION */ #define SOG_DISABLE 0x0 #define SOG_ENABLE 0x08 #define BRB_NORMAL 0x0 #define BRB_ALWAYS 0x04 #define DSR_DAC_SLOW 0x02 #define DSR_DAC_FAST 0x0 #define DPE_DISABLE 0x0 #define DPE_ENABLE 0x01 /* RGB525_PALETTE_CTRL */ #define SIXBIT_LINEAR_ENABLE 0x0 #define SIXBIT_LINEAR_DISABLE 0x80 #define PALETTE_PARITION(n) (n) /* RGB525_PIXEL_FORMAT */ #define PIXEL_FORMAT_4BPP 0x02 #define PIXEL_FORMAT_8BPP 0x03 #define PIXEL_FORMAT_16BPP 0x04 #define PIXEL_FORMAT_24BPP 0x05 #define PIXEL_FORMAT_32BPP 0x06 /* RGB525_8BPP_CTRL */ #define B8_DCOL_INDIRECT 0x0 #define B8_DCOL_DIRECT 0x01 /* RGB525_16BPP_CTRL */ #define B16_DCOL_INDIRECT 0x0 #define B16_DCOL_DYNAMIC 0x40 #define B16_DCOL_DIRECT 0xC0 #define B16_POL_FORCE_BYPASS 0x0 #define B16_POL_FORCE_LOOKUP 0x20 #define B16_ZIB 0x0 #define B16_LINEAR 0x04 #define B16_555 0x0 #define B16_565 0x02 #define B16_SPARSE 0x0 #define B16_CONTIGUOUS 0x01 /* RGB525_24BPP_CTRL */ #define B24_DCOL_INDIRECT 0x0 #define B24_DCOL_DIRECT 0x01 /* RGB525_32BPP_CTRL */ #define B32_POL_FORCE_BYPASS 0x0 #define B32_POL_FORCE_LOOKUP 0x04 #define B32_DCOL_INDIRECT 0x0 #define B32_DCOL_DYNAMIC 0x01 #define B32_DCOL_DIRECT 0x03 /* RGB525_PLL_CTRL_1 */ #define REF_SRC_REFCLK 0x0 #define REF_SRC_EXTCLK 0x10 #define PLL_EXT_FS_3_0 0x0 #define PLL_EXT_FS_2_0 0x01 #define PLL_CNTL2_3_0 0x02 #define PLL_CNTL2_2_0 0x03 /* RGB525_PLL_CTRL_2 */ #define PLL_INT_FS_3_0(n) (n) #define PLL_INT_FS_2_0(n) (n) /* RGB525_PLL_REF_DIV_COUNT */ #define REF_DIV_COUNT(n) (n) /* RGB525_F0 - RGB525_F15 */ #define VCO_DIV_COUNT(n) (n) /* RGB525_PLL_REFCLK values */ #define RGB525_PLL_REFCLK_MHz(n) ((n)/2) /* RGB525_CURSOR_CONTROL */ #define SMLC_PART_0 0x0 #define SMLC_PART_1 0x40 #define SMLC_PART_2 0x80 #define SMLC_PART_3 0xC0 #define PIX_ORDER_RL 0x0 #define PIX_ORDER_LR 0x20 #define LOC_READ_LAST 0x0 #define LOC_READ_ACTUAL 0x10 #define UPDT_CNTL_DELAYED 0x0 #define UPDT_CNTL_IMMEDIATE 0x08 #define CURSOR_SIZE_32 0x0 #define CURSOR_SIZE_64 0x40 #define CURSOR_MODE_OFF 0x0 #define CURSOR_MODE_3_COLOR 0x01 #define CURSOR_MODE_2_COLOR_HL 0x02 #define CURSOR_MODE_2_COLOR 0x03 /* RGB525_REVISION_LEVEL */ #define REVISION_LEVEL 0xF0 /* predefined */ /* RGB525_ID */ #define ID_CODE 0x01 /* predefined */ /* MISR status */ #define RGB525_MISR_DONE 0x01 /* the IBMRGB640 is rather different from the rest of the RAMDACs, so we define a completely new set of register names for it */ #define RGB640_SER_07_00 0x02 #define RGB640_SER_15_08 0x03 #define RGB640_SER_23_16 0x04 #define RGB640_SER_31_24 0x05 #define RGB640_SER_WID_03_00 0x06 #define RGB640_SER_WID_07_04 0x07 #define RGB640_SER_MODE 0x08 #define IBM640_SER_2_1 0x00 #define IBM640_SER_4_1 0x01 #define IBM640_SER_8_1 0x02 #define IBM640_SER_16_1 0x03 #define IBM640_SER_16_3 0x05 #define IBM640_SER_5_1 0x06 #define RGB640_PIXEL_INTERLEAVE 0x09 #define RGB640_MISC_CONF 0x0a #define IBM640_PCLK 0x00 #define IBM640_PCLK_2 0x40 #define IBM640_PCLK_4 0x80 #define IBM640_PCLK_8 0xc0 #define IBM640_PSIZE10 0x10 #define IBM640_LCI 0x08 #define IBM640_WIDCTL_MASK 0x07 #define RGB640_VGA_CONTROL 0x0b #define IBM640_RDBK 0x04 #define IBM640_PSIZE8 0x02 #define IBM640_VRAM 0x01 #define RGB640_DAC_CONTROL 0x0d #define IBM640_MONO 0x08 #define IBM640_DACENBL 0x04 #define IBM640_SHUNT 0x02 #define IBM640_SLOWSLEW 0x01 #define RGB640_OUTPUT_CONTROL 0x0e #define IBM640_RDAI 0x04 #define IBM640_WDAI 0x02 #define IBM640_WATCTL 0x01 #define RGB640_SYNC_CONTROL 0x0f #define IBM640_PWR 0x20 #define IBM640_VSP 0x10 #define IBM640_HSP 0x08 #define IBM640_CSE 0x04 #define IBM640_CSG 0x02 #define IBM640_BPE 0x01 #define RGB640_PLL_N 0x10 #define RGB640_PLL_M 0x11 #define RGB640_PLL_P 0x12 #define RGB640_PLL_CTL 0x13 #define IBM640_PLL_EN 0x04 #define IBM640_PLL_HIGH 0x10 #define IBM640_PLL_LOW 0x01 #define RGB640_AUX_PLL_CTL 0x17 #define IBM640_AUXPLL 0x04 #define IBM640_AUX_HI 0x02 #define IBM640_AUX_LO 0x01 #define RGB640_CHROMA_KEY0 0x20 #define RGB640_CHROMA_MASK0 0x21 #define RGB640_CURS_X_LOW 0x40 #define RGB640_CURS_X_HIGH 0x41 #define RGB640_CURS_Y_LOW 0x42 #define RGB640_CURS_Y_HIGH 0x43 #define RGB640_CURS_OFFSETX 0x44 #define RGB640_CURS_OFFSETY 0x45 #define RGB640_CURSOR_CONTROL 0x4B #define IBM640_CURS_OFF 0x00 #define IBM640_CURS_MODE0 0x01 #define IBM640_CURS_MODE1 0x02 #define IBM640_CURS_MODE2 0x03 #define IBM640_CURS_ADV 0x04 #define RGB640_CROSSHAIR_CONTROL 0x57 #define RGB640_VRAM_MASK0 0xf0 #define RGB640_VRAM_MASK1 0xf1 #define RGB640_VRAM_MASK2 0xf2 #define RGB640_DIAGS 0xfa #define RGB640_CURS_WRITE 0x1000 #define RGB640_CURS_COL0 0x4800 #define RGB640_CURS_COL1 0x4801 #define RGB640_CURS_COL2 0x4802 #define RGB640_CURS_COL3 0x4803 xorg-server-1.20.8/hw/xfree86/ramdac/xf86Cursor.h0000644000175000017500000000664313640201473016315 00000000000000 #ifndef _XF86CURSOR_H #define _XF86CURSOR_H #include "xf86str.h" #include "mipointer.h" typedef struct _xf86CursorInfoRec { ScrnInfoPtr pScrn; int Flags; int MaxWidth; int MaxHeight; void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg); void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y); void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits); Bool (*LoadCursorImageCheck) (ScrnInfoPtr pScrn, unsigned char *bits); void (*HideCursor) (ScrnInfoPtr pScrn); void (*ShowCursor) (ScrnInfoPtr pScrn); Bool (*ShowCursorCheck) (ScrnInfoPtr pScrn); unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr); Bool (*UseHWCursor) (ScreenPtr, CursorPtr); Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr); void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr); Bool (*LoadCursorARGBCheck) (ScrnInfoPtr, CursorPtr); } xf86CursorInfoRec, *xf86CursorInfoPtr; static inline Bool xf86DriverHasLoadCursorImage(xf86CursorInfoPtr infoPtr) { return infoPtr->LoadCursorImageCheck || infoPtr->LoadCursorImage; } static inline Bool xf86DriverLoadCursorImage(xf86CursorInfoPtr infoPtr, unsigned char *bits) { if(infoPtr->LoadCursorImageCheck) return infoPtr->LoadCursorImageCheck(infoPtr->pScrn, bits); infoPtr->LoadCursorImage(infoPtr->pScrn, bits); return TRUE; } static inline Bool xf86DriverHasShowCursor(xf86CursorInfoPtr infoPtr) { return infoPtr->ShowCursorCheck || infoPtr->ShowCursor; } static inline Bool xf86DriverShowCursor(xf86CursorInfoPtr infoPtr) { if(infoPtr->ShowCursorCheck) return infoPtr->ShowCursorCheck(infoPtr->pScrn); infoPtr->ShowCursor(infoPtr->pScrn); return TRUE; } static inline Bool xf86DriverHasLoadCursorARGB(xf86CursorInfoPtr infoPtr) { return infoPtr->LoadCursorARGBCheck || infoPtr->LoadCursorARGB; } static inline Bool xf86DriverLoadCursorARGB(xf86CursorInfoPtr infoPtr, CursorPtr pCursor) { if(infoPtr->LoadCursorARGBCheck) return infoPtr->LoadCursorARGBCheck(infoPtr->pScrn, pCursor); infoPtr->LoadCursorARGB(infoPtr->pScrn, pCursor); return TRUE; } extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); extern _X_EXPORT xf86CursorInfoPtr xf86CreateCursorInfoRec(void); extern _X_EXPORT void xf86DestroyCursorInfoRec(xf86CursorInfoPtr); extern _X_EXPORT void xf86CursorResetCursor(ScreenPtr pScreen); extern _X_EXPORT void xf86ForceHWCursor(ScreenPtr pScreen, Bool on); extern _X_EXPORT CursorPtr xf86CurrentCursor(ScreenPtr pScreen); #define HARDWARE_CURSOR_INVERT_MASK 0x00000001 #define HARDWARE_CURSOR_AND_SOURCE_WITH_MASK 0x00000002 #define HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK 0x00000004 #define HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED 0x00000008 #define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 0x00000010 #define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 0x00000020 #define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 0x00000040 #define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 0x00000080 #define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 0x00000100 #define HARDWARE_CURSOR_TRUECOLOR_AT_8BPP 0x00000200 #define HARDWARE_CURSOR_BIT_ORDER_MSBFIRST 0x00000400 #define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800 #define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000 #define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000 #define HARDWARE_CURSOR_ARGB 0x00004000 #endif /* _XF86CURSOR_H */ xorg-server-1.20.8/hw/xfree86/ramdac/xf86RamDacCmap.c0000644000175000017500000000474213640201473016761 00000000000000/* * Copyright 1998 by Alan Hourihane, Wigan, England. * * 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 Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE 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. * * Authors: Alan Hourihane, * * Generic RAMDAC access to colormaps. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "windowstr.h" #include "mipointer.h" #include "micmap.h" #include "xf86.h" #include "colormapst.h" #include "xf86RamDacPriv.h" void RamDacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual) { RamDacRecPtr hwp = RAMDACSCRPTR(pScrn); int i, index; for (i = 0; i < numColors; i++) { index = indices[i]; (*hwp->WriteAddress) (pScrn, index); (*hwp->WriteData) (pScrn, colors[index].red); (*hwp->WriteData) (pScrn, colors[index].green); (*hwp->WriteData) (pScrn, colors[index].blue); } } Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits, unsigned int flags) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RamDacRecPtr hwp = RAMDACSCRPTR(pScrn); if (hwp->LoadPalette == NULL) return xf86HandleColormaps(pScreen, maxColors, sigRGBbits, RamDacLoadPalette, NULL, flags); else return xf86HandleColormaps(pScreen, maxColors, sigRGBbits, hwp->LoadPalette, NULL, flags); } xorg-server-1.20.8/hw/xfree86/ramdac/Makefile.in0000644000175000017500000007251713640201513016216 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/ramdac ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libramdac_la_LIBADD = am_libramdac_la_OBJECTS = xf86RamDac.lo xf86RamDacCmap.lo \ xf86CursorRD.lo xf86HWCurs.lo IBM.lo BT.lo TI.lo libramdac_la_OBJECTS = $(am_libramdac_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/BT.Plo ./$(DEPDIR)/IBM.Plo \ ./$(DEPDIR)/TI.Plo ./$(DEPDIR)/xf86CursorRD.Plo \ ./$(DEPDIR)/xf86HWCurs.Plo ./$(DEPDIR)/xf86RamDac.Plo \ ./$(DEPDIR)/xf86RamDacCmap.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libramdac_la_SOURCES) DIST_SOURCES = $(libramdac_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libramdac.la libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \ xf86CursorRD.c xf86HWCurs.c IBM.c BT.c TI.c sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \ CURSOR.NOTES AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/ramdac/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/ramdac/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libramdac.la: $(libramdac_la_OBJECTS) $(libramdac_la_DEPENDENCIES) $(EXTRA_libramdac_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libramdac_la_OBJECTS) $(libramdac_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BT.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IBM.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TI.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86CursorRD.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86HWCurs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RamDac.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RamDacCmap.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/BT.Plo -rm -f ./$(DEPDIR)/IBM.Plo -rm -f ./$(DEPDIR)/TI.Plo -rm -f ./$(DEPDIR)/xf86CursorRD.Plo -rm -f ./$(DEPDIR)/xf86HWCurs.Plo -rm -f ./$(DEPDIR)/xf86RamDac.Plo -rm -f ./$(DEPDIR)/xf86RamDacCmap.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/BT.Plo -rm -f ./$(DEPDIR)/IBM.Plo -rm -f ./$(DEPDIR)/TI.Plo -rm -f ./$(DEPDIR)/xf86CursorRD.Plo -rm -f ./$(DEPDIR)/xf86HWCurs.Plo -rm -f ./$(DEPDIR)/xf86RamDac.Plo -rm -f ./$(DEPDIR)/xf86RamDacCmap.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/ramdac/IBMPriv.h0000644000175000017500000000073713640201473015572 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include "IBM.h" typedef struct { const char *DeviceName; } xf86IBMramdacInfo; extern xf86IBMramdacInfo IBMramdacDeviceInfo[]; #ifdef INIT_IBM_RAMDAC_INFO xf86IBMramdacInfo IBMramdacDeviceInfo[] = { {"IBM 524"}, {"IBM 524A"}, {"IBM 525"}, {"IBM 526"}, {"IBM 526DB(DoubleBuffer)"}, {"IBM 528"}, {"IBM 528A"}, {"IBM 624"}, {"IBM 624DB(DoubleBuffer)"}, {"IBM 640"} }; #endif xorg-server-1.20.8/hw/xfree86/ramdac/TI.c0000644000175000017500000006503713640201473014635 00000000000000/* * Copyright 1998 by Alan Hourihane, Wigan, England. * * 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 Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE 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. * * Authors: Alan Hourihane, * * Modified from IBM.c to support TI RAMDAC routines * by Jens Owen, . */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Cursor.h" #define INIT_TI_RAMDAC_INFO #include "TIPriv.h" #include "xf86RamDacPriv.h" /* The following values are in kHz */ #define TI_MIN_VCO_FREQ 110000 #define TI_MAX_VCO_FREQ 220000 unsigned long TIramdacCalculateMNPForClock(unsigned long RefClock, /* In 100Hz units */ unsigned long ReqClock, /* In 100Hz units */ char IsPixClock, /* boolean, is this the pixel or the sys clock */ unsigned long MinClock, /* Min VCO rating */ unsigned long MaxClock, /* Max VCO rating */ unsigned long *rM, /* M Out */ unsigned long *rN, /* N Out */ unsigned long *rP /* Min P In, P Out */ ) { unsigned long n, p; unsigned long best_m = 0, best_n = 0; double VCO, IntRef = (double) RefClock; double m_err, inc_m, calc_m; unsigned long ActualClock; /* Make sure that MinClock <= ReqClock <= MaxClock */ if (ReqClock < MinClock) ReqClock = MinClock; if (ReqClock > MaxClock) ReqClock = MaxClock; /* * ActualClock = VCO / 2 ^ p * Choose p so that TI_MIN_VCO_FREQ <= VCO <= TI_MAX_VCO_FREQ * Note that since TI_MAX_VCO_FREQ = 2 * TI_MIN_VCO_FREQ * we don't have to bother checking for this maximum limit. */ VCO = (double) ReqClock; for (p = 0; p < 3 && VCO < TI_MIN_VCO_FREQ; (p)++) VCO *= 2.0; /* * We avoid doing multiplications by ( 65 - n ), * and add an increment instead - this keeps any error small. */ inc_m = VCO / (IntRef * 8.0); /* Initial value of calc_m for the loop */ calc_m = inc_m + inc_m + inc_m; /* Initial amount of error for an integer - impossibly large */ m_err = 2.0; /* Search for the closest INTEGER value of ( 65 - m ) */ for (n = 3; n <= 25; (n)++, calc_m += inc_m) { /* Ignore values of ( 65 - m ) which we can't use */ if (calc_m < 3.0 || calc_m > 64.0) continue; /* * Pick the closest INTEGER (has smallest fractional part). * The optimizer should clean this up for us. */ if ((calc_m - (int) calc_m) < m_err) { m_err = calc_m - (int) calc_m; best_m = (int) calc_m; best_n = n; } } /* 65 - ( 65 - x ) = x */ *rM = 65 - best_m; *rN = 65 - best_n; *rP = p; /* Now all the calculations can be completed */ VCO = 8.0 * IntRef * best_m / best_n; ActualClock = VCO / (1 << p); DebugF("f_out=%ld f_vco=%.1f n=%lu m=%lu p=%lu\n", ActualClock, VCO, *rN, *rM, *rP); return ActualClock; } void TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg) { int i; unsigned long status; /* Here we pass a short, so that we can evaluate a mask too * So that the mask is the high byte and the data the low byte * Order is important */ TIRESTORE(TIDAC_latch_ctrl); TIRESTORE(TIDAC_true_color_ctrl); TIRESTORE(TIDAC_multiplex_ctrl); TIRESTORE(TIDAC_clock_select); TIRESTORE(TIDAC_palette_page); TIRESTORE(TIDAC_general_ctrl); TIRESTORE(TIDAC_misc_ctrl); /* 0x2A & 0x2B are reserved */ TIRESTORE(TIDAC_key_over_low); TIRESTORE(TIDAC_key_over_high); TIRESTORE(TIDAC_key_red_low); TIRESTORE(TIDAC_key_red_high); TIRESTORE(TIDAC_key_green_low); TIRESTORE(TIDAC_key_green_high); TIRESTORE(TIDAC_key_blue_low); TIRESTORE(TIDAC_key_blue_high); TIRESTORE(TIDAC_key_ctrl); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_clock_ctrl, 0, 0x30); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_clock_ctrl, 0, 0x38); TIRESTORE(TIDAC_clock_ctrl); TIRESTORE(TIDAC_sense_test); TIRESTORE(TIDAC_ind_curs_ctrl); /* only restore clocks if they were valid to begin with */ if (ramdacReg->DacRegs[TIDAC_PIXEL_VALID]) { /* Reset pixel clock */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0, 0x3c); /* Restore N, M & P values for pixel clocks */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0, ramdacReg->DacRegs[TIDAC_PIXEL_N]); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0, ramdacReg->DacRegs[TIDAC_PIXEL_M]); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0, ramdacReg->DacRegs[TIDAC_PIXEL_P]); /* wait for pixel clock to lock */ i = 1000000; do { status = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data); } while ((!(status & 0x40)) && (--i)); if (!(status & 0x40)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Pixel clock setup timed out\n"); return; } } if (ramdacReg->DacRegs[TIDAC_LOOP_VALID]) { /* Reset loop clock */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0, 0x70); /* Restore N, M & P values for pixel clocks */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0, ramdacReg->DacRegs[TIDAC_LOOP_N]); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0, ramdacReg->DacRegs[TIDAC_LOOP_M]); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0, ramdacReg->DacRegs[TIDAC_LOOP_P]); /* wait for loop clock to lock */ i = 1000000; do { status = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data); } while ((!(status & 0x40)) && (--i)); if (!(status & 0x40)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Loop clock setup timed out\n"); return; } } /* restore palette */ (*ramdacPtr->WriteAddress) (pScrn, 0); #ifndef NOT_DONE for (i = 0; i < 768; i++) (*ramdacPtr->WriteData) (pScrn, ramdacReg->DAC[i]); #else (*ramdacPtr->WriteData) (pScrn, 0); (*ramdacPtr->WriteData) (pScrn, 0); (*ramdacPtr->WriteData) (pScrn, 0); for (i = 0; i < 765; i++) (*ramdacPtr->WriteData) (pScrn, 0xff); #endif } void TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg) { int i; (*ramdacPtr->ReadAddress) (pScrn, 0); for (i = 0; i < 768; i++) ramdacReg->DAC[i] = (*ramdacPtr->ReadData) (pScrn); /* Read back N,M and P values for pixel clock */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0); ramdacReg->DacRegs[TIDAC_PIXEL_N] = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x11); ramdacReg->DacRegs[TIDAC_PIXEL_M] = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22); ramdacReg->DacRegs[TIDAC_PIXEL_P] = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data); /* Read back N,M and P values for loop clock */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0); ramdacReg->DacRegs[TIDAC_LOOP_N] = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x11); ramdacReg->DacRegs[TIDAC_LOOP_M] = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22); ramdacReg->DacRegs[TIDAC_LOOP_P] = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data); /* Order is important */ TISAVE(TIDAC_latch_ctrl); TISAVE(TIDAC_true_color_ctrl); TISAVE(TIDAC_multiplex_ctrl); TISAVE(TIDAC_clock_select); TISAVE(TIDAC_palette_page); TISAVE(TIDAC_general_ctrl); TISAVE(TIDAC_misc_ctrl); /* 0x2A & 0x2B are reserved */ TISAVE(TIDAC_key_over_low); TISAVE(TIDAC_key_over_high); TISAVE(TIDAC_key_red_low); TISAVE(TIDAC_key_red_high); TISAVE(TIDAC_key_green_low); TISAVE(TIDAC_key_green_high); TISAVE(TIDAC_key_blue_low); TISAVE(TIDAC_key_blue_high); TISAVE(TIDAC_key_ctrl); TISAVE(TIDAC_clock_ctrl); TISAVE(TIDAC_sense_test); TISAVE(TIDAC_ind_curs_ctrl); } RamDacHelperRecPtr TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); RamDacHelperRecPtr ramdacHelperPtr = NULL; Bool RamDacIsSupported = FALSE; int TIramdac_ID = -1; int i; unsigned char id, rev, rev2, id2; /* read ID and revision */ rev = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_rev); id = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_id); /* check if ID and revision are read only */ (*ramdacPtr->WriteDAC) (pScrn, ~rev, 0, TIDAC_rev); (*ramdacPtr->WriteDAC) (pScrn, ~id, 0, TIDAC_id); rev2 = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_rev); id2 = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_id); switch (id) { case TIDAC_TVP_3030_ID: if (id == id2 && rev == rev2) /* check for READ ONLY */ TIramdac_ID = TI3030_RAMDAC; break; case TIDAC_TVP_3026_ID: if (id == id2 && rev == rev2) /* check for READ ONLY */ TIramdac_ID = TI3026_RAMDAC; break; } (*ramdacPtr->WriteDAC) (pScrn, rev, 0, TIDAC_rev); (*ramdacPtr->WriteDAC) (pScrn, id, 0, TIDAC_id); if (TIramdac_ID == -1) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Cannot determine TI RAMDAC type, aborting\n"); return NULL; } else { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Attached RAMDAC is %s\n", TIramdacDeviceInfo[TIramdac_ID & 0xFFFF].DeviceName); } for (i = 0; ramdacs[i].token != -1; i++) { if (ramdacs[i].token == TIramdac_ID) RamDacIsSupported = TRUE; } if (!RamDacIsSupported) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "This TI RAMDAC is NOT supported by this driver, aborting\n"); return NULL; } ramdacHelperPtr = RamDacHelperCreateInfoRec(); switch (TIramdac_ID) { case TI3030_RAMDAC: ramdacHelperPtr->SetBpp = TIramdac3030SetBpp; ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit; break; case TI3026_RAMDAC: ramdacHelperPtr->SetBpp = TIramdac3026SetBpp; ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit; break; } ramdacPtr->RamDacType = TIramdac_ID; ramdacHelperPtr->RamDacType = TIramdac_ID; ramdacHelperPtr->Save = TIramdacSave; ramdacHelperPtr->Restore = TIramdacRestore; return ramdacHelperPtr; } void TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg) { switch (pScrn->bitsPerPixel) { case 32: /* order is important */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46; ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5c; ramdacReg->DacRegs[TIDAC_clock_select] = 0x05; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01; } ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; case 24: /* order is important */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56; ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58; ramdacReg->DacRegs[TIDAC_clock_select] = 0x25; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; case 16: /* order is important */ #if 0 /* Matrox driver uses this */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07; #else ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; #endif if (pScrn->depth == 16) { ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45; } else { ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44; } #if 0 /* Matrox driver uses this */ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50; ramdacReg->DacRegs[TIDAC_clock_select] = 0x15; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00; #else ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x54; ramdacReg->DacRegs[TIDAC_clock_select] = 0x05; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10; #endif ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; case 8: /* order is important */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80; ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4c; ramdacReg->DacRegs[TIDAC_clock_select] = 0x05; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; } } void TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg) { switch (pScrn->bitsPerPixel) { case 32: /* order is important */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46; ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5D; ramdacReg->DacRegs[TIDAC_clock_select] = 0x05; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01; } ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; case 24: /* order is important */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56; ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58; ramdacReg->DacRegs[TIDAC_clock_select] = 0x25; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; case 16: /* order is important */ #if 0 /* Matrox driver uses this */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07; #else ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; #endif if (pScrn->depth == 16) { ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45; } else { ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44; } #if 0 /* Matrox driver uses this */ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50; ramdacReg->DacRegs[TIDAC_clock_select] = 0x15; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00; #else ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x55; ramdacReg->DacRegs[TIDAC_clock_select] = 0x85; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10; #endif ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; case 8: /* order is important */ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06; ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80; ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4d; ramdacReg->DacRegs[TIDAC_clock_select] = 0x05; ramdacReg->DacRegs[TIDAC_palette_page] = 0x00; ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10; ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C; /* 0x2A & 0x2B are reserved */ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF; ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF; ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00; ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00; ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00; ramdacReg->DacRegs[TIDAC_sense_test] = 0x00; ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00; break; } } static void TIramdacShowCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Enable cursor - X11 mode */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_ind_curs_ctrl, 0, 0x03); } static void TIramdacHideCursor(ScrnInfoPtr pScrn) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Disable cursor - X11 mode */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_ind_curs_ctrl, 0, 0x00); } static void TIramdacSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); x += 64; y += 64; (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_XLOW, 0, x & 0xff); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_XHIGH, 0, (x >> 8) & 0x0f); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_YLOW, 0, y & 0xff); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_YHIGH, 0, (y >> 8) & 0x0f); } static void TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); /* Background color */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_WRITE_ADDR, 0, 1); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, ((bg & 0x00ff0000) >> 16)); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, ((bg & 0x0000ff00) >> 8)); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (bg & 0x000000ff)); /* Foreground color */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_WRITE_ADDR, 0, 2); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, ((fg & 0x00ff0000) >> 16)); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, ((fg & 0x0000ff00) >> 8)); (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (fg & 0x000000ff)); } static Bool TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); int i = 1024; /* reset A9,A8 */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_ind_curs_ctrl, 0, 0x00); /* reset cursor RAM load address A7..A0 */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_INDEX, 0x00, 0x00); while (i--) { /* NOT_DONE: might need a delay here */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++)); } return TRUE; } static Bool TIramdacUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { return TRUE; } void TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr) { infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; infoPtr->SetCursorColors = TIramdacSetCursorColors; infoPtr->SetCursorPosition = TIramdacSetCursorPosition; infoPtr->LoadCursorImageCheck = TIramdacLoadCursorImage; infoPtr->HideCursor = TIramdacHideCursor; infoPtr->ShowCursor = TIramdacShowCursor; infoPtr->UseHWCursor = TIramdacUseHWCursor; } void TIramdacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual) { RamDacRecPtr hwp = RAMDACSCRPTR(pScrn); int i, index, shift; if (pScrn->depth == 16) { for (i = 0; i < numColors; i++) { index = indices[i]; (*hwp->WriteAddress) (pScrn, index << 2); (*hwp->WriteData) (pScrn, colors[index >> 1].red); (*hwp->WriteData) (pScrn, colors[index].green); (*hwp->WriteData) (pScrn, colors[index >> 1].blue); if (index <= 31) { (*hwp->WriteAddress) (pScrn, index << 3); (*hwp->WriteData) (pScrn, colors[index].red); (*hwp->WriteData) (pScrn, colors[(index << 1) + 1].green); (*hwp->WriteData) (pScrn, colors[index].blue); } } } else { shift = (pScrn->depth == 15) ? 3 : 0; for (i = 0; i < numColors; i++) { index = indices[i]; (*hwp->WriteAddress) (pScrn, index << shift); (*hwp->WriteData) (pScrn, colors[index].red); (*hwp->WriteData) (pScrn, colors[index].green); (*hwp->WriteData) (pScrn, colors[index].blue); } } } TIramdacLoadPaletteProc * TIramdacLoadPaletteWeak(void) { return TIramdacLoadPalette; } xorg-server-1.20.8/hw/xfree86/ramdac/xf86HWCurs.c0000644000175000017500000004625613640201473016212 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" #include "xf86str.h" #include "cursorstr.h" #include "mi.h" #include "mipointer.h" #include "randrstr.h" #include "xf86CursorPriv.h" #include "servermd.h" static void xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs); static CARD32 xf86ReverseBitOrder(CARD32 v) { return (((0x01010101 & v) << 7) | ((0x02020202 & v) << 5) | ((0x04040404 & v) << 3) | ((0x08080808 & v) << 1) | ((0x10101010 & v) >> 1) | ((0x20202020 & v) >> 3) | ((0x40404040 & v) >> 5) | ((0x80808080 & v) >> 7)); } #if BITMAP_SCANLINE_PAD == 64 #if 1 /* Cursors might be only 32 wide. Give'em a chance */ #define SCANLINE CARD32 #define CUR_BITMAP_SCANLINE_PAD 32 #define CUR_LOG2_BITMAP_PAD 5 #define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w) #else #define SCANLINE CARD64 #define CUR_BITMAP_SCANLINE_PAD BITMAP_SCANLINE_PAD #define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD #define REVERSE_BIT_ORDER(w) xf86CARD64ReverseBits(w) static CARD64 xf86CARD64ReverseBits(CARD64 w); static CARD64 xf86CARD64ReverseBits(CARD64 w) { unsigned char *p = (unsigned char *) &w; p[0] = byte_reversed[p[0]]; p[1] = byte_reversed[p[1]]; p[2] = byte_reversed[p[2]]; p[3] = byte_reversed[p[3]]; p[4] = byte_reversed[p[4]]; p[5] = byte_reversed[p[5]]; p[6] = byte_reversed[p[6]]; p[7] = byte_reversed[p[7]]; return w; } #endif #else #define SCANLINE CARD32 #define CUR_BITMAP_SCANLINE_PAD BITMAP_SCANLINE_PAD #define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD #define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w) #endif /* BITMAP_SCANLINE_PAD == 64 */ static unsigned char *RealizeCursorInterleave0(xf86CursorInfoPtr, CursorPtr); static unsigned char *RealizeCursorInterleave1(xf86CursorInfoPtr, CursorPtr); static unsigned char *RealizeCursorInterleave8(xf86CursorInfoPtr, CursorPtr); static unsigned char *RealizeCursorInterleave16(xf86CursorInfoPtr, CursorPtr); static unsigned char *RealizeCursorInterleave32(xf86CursorInfoPtr, CursorPtr); static unsigned char *RealizeCursorInterleave64(xf86CursorInfoPtr, CursorPtr); Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) { if ((infoPtr->MaxWidth <= 0) || (infoPtr->MaxHeight <= 0)) return FALSE; /* These are required for now */ if (!infoPtr->SetCursorPosition || !xf86DriverHasLoadCursorImage(infoPtr) || !infoPtr->HideCursor || !xf86DriverHasShowCursor(infoPtr) || !infoPtr->SetCursorColors) return FALSE; if (infoPtr->RealizeCursor) { /* Don't overwrite a driver provided Realize Cursor function */ } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave1; } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave8; } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave16; } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave32; } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave64; } else { /* not interleaved */ infoPtr->RealizeCursor = RealizeCursorInterleave0; } infoPtr->pScrn = xf86ScreenToScrn(pScreen); return TRUE; } static Bool xf86ScreenCheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr) { return (cursor->bits->argb && infoPtr->UseHWCursorARGB && infoPtr->UseHWCursorARGB(pScreen, cursor)) || (cursor->bits->argb == 0 && cursor->bits->height <= infoPtr->MaxHeight && cursor->bits->width <= infoPtr->MaxWidth && (!infoPtr->UseHWCursor || infoPtr->UseHWCursor(pScreen, cursor))); } Bool xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr) { ScreenPtr pSlave; Bool use_hw_cursor = TRUE; input_lock(); if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr)) { use_hw_cursor = FALSE; goto unlock; } /* ask each driver consuming a pixmap if it can support HW cursor */ xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) { xf86CursorScreenPtr sPriv; if (!RRHasScanoutPixmap(pSlave)) continue; sPriv = dixLookupPrivate(&pSlave->devPrivates, xf86CursorScreenKey); if (!sPriv) { /* NULL if Option "SWCursor", possibly other conditions */ use_hw_cursor = FALSE; break; } /* FALSE if HWCursor not supported by slave */ if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) { use_hw_cursor = FALSE; break; } } unlock: input_unlock(); return use_hw_cursor; } static Bool xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr; unsigned char *bits; if (!ScreenPriv) { /* NULL if Option "SWCursor" */ return (pCurs == NullCursor); } infoPtr = ScreenPriv->CursorInfoPtr; if (pCurs == NullCursor) { (*infoPtr->HideCursor) (infoPtr->pScrn); return TRUE; } /* * Hot plugged GPU's do not have a CursorScreenKey, force sw cursor. * This check can be removed once dix/privates.c gets relocation code for * PRIVATE_CURSOR. Also see the related comment in AddGPUScreen(). */ if (!_dixGetScreenPrivateKey(CursorScreenKey, pScreen)) return FALSE; bits = dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen); x -= infoPtr->pScrn->frameX0; y -= infoPtr->pScrn->frameY0; if (!pCurs->bits->argb || !xf86DriverHasLoadCursorARGB(infoPtr)) if (!bits) { bits = (*infoPtr->RealizeCursor) (infoPtr, pCurs); dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, bits); } if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) (*infoPtr->HideCursor) (infoPtr->pScrn); if (pCurs->bits->argb && xf86DriverHasLoadCursorARGB(infoPtr)) { if (!xf86DriverLoadCursorARGB (infoPtr, pCurs)) return FALSE; } else if (bits) if (!xf86DriverLoadCursorImage (infoPtr, bits)) return FALSE; xf86RecolorCursor_locked (ScreenPriv, pCurs); (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y); return xf86DriverShowCursor(infoPtr); } Bool xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); ScreenPtr pSlave; Bool ret = FALSE; input_lock(); x -= ScreenPriv->HotX; y -= ScreenPriv->HotY; if (!xf86ScreenSetCursor(pScreen, pCurs, x, y)) goto out; /* ask each slave driver to set the cursor. */ xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) { if (!RRHasScanoutPixmap(pSlave)) continue; if (!xf86ScreenSetCursor(pSlave, pCurs, x, y)) { /* * hide the master (and successfully set slave) cursors, * otherwise both the hw and sw cursor will show. */ xf86SetCursor(pScreen, NullCursor, x, y); goto out; } } ret = TRUE; out: input_unlock(); return ret; } void xf86SetTransparentCursor(ScreenPtr pScreen) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; input_lock(); if (!ScreenPriv->transparentData) ScreenPriv->transparentData = (*infoPtr->RealizeCursor) (infoPtr, NullCursor); if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) (*infoPtr->HideCursor) (infoPtr->pScrn); if (ScreenPriv->transparentData) xf86DriverLoadCursorImage (infoPtr, ScreenPriv->transparentData); xf86DriverShowCursor(infoPtr); input_unlock(); } static void xf86ScreenMoveCursor(ScreenPtr pScreen, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; x -= infoPtr->pScrn->frameX0; y -= infoPtr->pScrn->frameY0; (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y); } void xf86MoveCursor(ScreenPtr pScreen, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); ScreenPtr pSlave; input_lock(); x -= ScreenPriv->HotX; y -= ScreenPriv->HotY; xf86ScreenMoveCursor(pScreen, x, y); /* ask each slave driver to move the cursor */ xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) { if (!RRHasScanoutPixmap(pSlave)) continue; xf86ScreenMoveCursor(pSlave, x, y); } input_unlock(); } static void xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs) { xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; /* recoloring isn't applicable to ARGB cursors and drivers shouldn't have to ignore SetCursorColors requests */ if (pCurs->bits->argb) return; if (ScreenPriv->PalettedCursor) { xColorItem sourceColor, maskColor; ColormapPtr pmap = ScreenPriv->pInstalledMap; if (!pmap) return; sourceColor.red = pCurs->foreRed; sourceColor.green = pCurs->foreGreen; sourceColor.blue = pCurs->foreBlue; FakeAllocColor(pmap, &sourceColor); maskColor.red = pCurs->backRed; maskColor.green = pCurs->backGreen; maskColor.blue = pCurs->backBlue; FakeAllocColor(pmap, &maskColor); FakeFreeColor(pmap, sourceColor.pixel); FakeFreeColor(pmap, maskColor.pixel); (*infoPtr->SetCursorColors) (infoPtr->pScrn, maskColor.pixel, sourceColor.pixel); } else { /* Pass colors in 8-8-8 RGB format */ (*infoPtr->SetCursorColors) (infoPtr->pScrn, (pCurs->backBlue >> 8) | ((pCurs->backGreen >> 8) << 8) | ((pCurs->backRed >> 8) << 16), (pCurs->foreBlue >> 8) | ((pCurs->foreGreen >> 8) << 8) | ((pCurs->foreRed >> 8) << 16) ); } } void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); input_lock(); xf86RecolorCursor_locked (ScreenPriv, pCurs); input_unlock(); } /* These functions assume that MaxWidth is a multiple of 32 */ static unsigned char * RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { SCANLINE *SrcS, *SrcM, *DstS, *DstM; SCANLINE *pSrc, *pMsk; unsigned char *mem; int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; int SrcPitch, DstPitch, Pitch, y, x; /* how many words are in the source or mask */ int words = size / (CUR_BITMAP_SCANLINE_PAD / 4); if (!(mem = calloc(1, size))) return NULL; if (pCurs == NullCursor) { if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) { DstM = (SCANLINE *) mem; if (!(infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)) DstM += words; memset(DstM, -1, words * sizeof(SCANLINE)); } return mem; } /* SrcPitch == the number of scanlines wide the cursor image is */ SrcPitch = (pCurs->bits->width + (BITMAP_SCANLINE_PAD - 1)) >> CUR_LOG2_BITMAP_PAD; /* DstPitch is the width of the hw cursor in scanlines */ DstPitch = infoPtr->MaxWidth >> CUR_LOG2_BITMAP_PAD; Pitch = SrcPitch < DstPitch ? SrcPitch : DstPitch; SrcS = (SCANLINE *) pCurs->bits->source; SrcM = (SCANLINE *) pCurs->bits->mask; DstS = (SCANLINE *) mem; DstM = DstS + words; if (infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK) { SCANLINE *tmp; tmp = DstS; DstS = DstM; DstM = tmp; } if (infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) { for (y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; y--; pSrc += DstPitch, pMsk += DstPitch, SrcS += SrcPitch, SrcM += SrcPitch) { for (x = 0; x < Pitch; x++) { pSrc[x] = SrcS[x] & SrcM[x]; pMsk[x] = SrcM[x]; } } } else { for (y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; y--; pSrc += DstPitch, pMsk += DstPitch, SrcS += SrcPitch, SrcM += SrcPitch) { for (x = 0; x < Pitch; x++) { pSrc[x] = SrcS[x]; pMsk[x] = SrcM[x]; } } } if (infoPtr->Flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) { int count = size; unsigned char *pntr1 = (unsigned char *) DstS; unsigned char *pntr2 = (unsigned char *) DstM; unsigned char a, b; while (count) { a = *pntr1; b = *pntr2; *pntr1 = ((a & 0xF0) >> 4) | ((a & 0x0F) << 4); *pntr2 = ((b & 0xF0) >> 4) | ((b & 0x0F) << 4); pntr1++; pntr2++; count -= 2; } } /* * Must be _after_ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK to avoid wiping * out entire source mask. */ if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) { int count = words; SCANLINE *pntr = DstM; while (count--) { *pntr = ~(*pntr); pntr++; } } if (infoPtr->Flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) { for (y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; y--; pSrc += DstPitch, pMsk += DstPitch) { for (x = 0; x < Pitch; x++) { pSrc[x] = REVERSE_BIT_ORDER(pSrc[x]); pMsk[x] = REVERSE_BIT_ORDER(pMsk[x]); } } } return mem; } static unsigned char * RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned char *DstS, *DstM; unsigned char *pntr; unsigned char *mem, *mem2; int count; int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; /* Realize the cursor without interleaving */ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; if (!(mem = calloc(1, size))) { free(mem2); return NULL; } /* 1 bit interleave */ DstS = mem2; DstM = DstS + (size >> 1); pntr = mem; count = size; while (count) { *pntr++ = ((*DstS & 0x01)) | ((*DstM & 0x01) << 1) | ((*DstS & 0x02) << 1) | ((*DstM & 0x02) << 2) | ((*DstS & 0x04) << 2) | ((*DstM & 0x04) << 3) | ((*DstS & 0x08) << 3) | ((*DstM & 0x08) << 4); *pntr++ = ((*DstS & 0x10) >> 4) | ((*DstM & 0x10) >> 3) | ((*DstS & 0x20) >> 3) | ((*DstM & 0x20) >> 2) | ((*DstS & 0x40) >> 2) | ((*DstM & 0x40) >> 1) | ((*DstS & 0x80) >> 1) | ((*DstM & 0x80)); DstS++; DstM++; count -= 2; } /* Free the uninterleaved cursor */ free(mem2); return mem; } static unsigned char * RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned char *DstS, *DstM; unsigned char *pntr; unsigned char *mem, *mem2; int count; int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; /* Realize the cursor without interleaving */ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; if (!(mem = calloc(1, size))) { free(mem2); return NULL; } /* 8 bit interleave */ DstS = mem2; DstM = DstS + (size >> 1); pntr = mem; count = size; while (count) { *pntr++ = *DstS++; *pntr++ = *DstM++; count -= 2; } /* Free the uninterleaved cursor */ free(mem2); return mem; } static unsigned char * RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned short *DstS, *DstM; unsigned short *pntr; unsigned char *mem, *mem2; int count; int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; /* Realize the cursor without interleaving */ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; if (!(mem = calloc(1, size))) { free(mem2); return NULL; } /* 16 bit interleave */ DstS = (void *) mem2; DstM = DstS + (size >> 2); pntr = (void *) mem; count = (size >> 1); while (count) { *pntr++ = *DstS++; *pntr++ = *DstM++; count -= 2; } /* Free the uninterleaved cursor */ free(mem2); return mem; } static unsigned char * RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { CARD32 *DstS, *DstM; CARD32 *pntr; unsigned char *mem, *mem2; int count; int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; /* Realize the cursor without interleaving */ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; if (!(mem = calloc(1, size))) { free(mem2); return NULL; } /* 32 bit interleave */ DstS = (void *) mem2; DstM = DstS + (size >> 3); pntr = (void *) mem; count = (size >> 2); while (count) { *pntr++ = *DstS++; *pntr++ = *DstM++; count -= 2; } /* Free the uninterleaved cursor */ free(mem2); return mem; } static unsigned char * RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { CARD32 *DstS, *DstM; CARD32 *pntr; unsigned char *mem, *mem2; int count; int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; /* Realize the cursor without interleaving */ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; if (!(mem = calloc(1, size))) { free(mem2); return NULL; } /* 64 bit interleave */ DstS = (void *) mem2; DstM = DstS + (size >> 3); pntr = (void *) mem; count = (size >> 2); while (count) { *pntr++ = *DstS++; *pntr++ = *DstS++; *pntr++ = *DstM++; *pntr++ = *DstM++; count -= 4; } /* Free the uninterleaved cursor */ free(mem2); return mem; } xorg-server-1.20.8/hw/xfree86/ramdac/BT.c0000644000175000017500000001227713640201473014624 00000000000000/* * Copyright 1998 by Alan Hourihane, Wigan, England. * * 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 Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE 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. * * Authors: Alan Hourihane, * * BT RAMDAC routines. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86_OSproc.h" #define INIT_BT_RAMDAC_INFO #include "BTPriv.h" #include "xf86RamDacPriv.h" void BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg) { int i; /* Here we pass a short, so that we can evaluate a mask too */ /* So that the mask is the high byte and the data the low byte */ /* Just the command/status registers */ for (i = 0x06; i < 0x0A; i++) (*ramdacPtr->WriteDAC) (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8, ramdacReg->DacRegs[i]); } void BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg) { int i; (*ramdacPtr->ReadAddress) (pScrn, 0); /* Start at index 0 */ for (i = 0; i < 768; i++) ramdacReg->DAC[i] = (*ramdacPtr->ReadData) (pScrn); /* Just the command/status registers */ for (i = 0x06; i < 0x0A; i++) ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC) (pScrn, i); } RamDacHelperRecPtr BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs /*, RamDacRecPtr ramdacPtr */ ) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); Bool RamDacIsSupported = FALSE; RamDacHelperRecPtr ramdacHelperPtr = NULL; int BTramdac_ID = -1; int i, status, cmd0; /* Save COMMAND Register 0 */ cmd0 = (*ramdacPtr->ReadDAC) (pScrn, BT_COMMAND_REG_0); /* Ensure were going to access the STATUS Register on next read */ (*ramdacPtr->WriteDAC) (pScrn, BT_COMMAND_REG_0, 0x7F, 0x00); status = (*ramdacPtr->ReadDAC) (pScrn, BT_STATUS_REG); switch (status) { case 0x40: BTramdac_ID = ATT20C504_RAMDAC; break; case 0xD0: BTramdac_ID = ATT20C505_RAMDAC; break; default: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Unknown BT RAMDAC type (0x%x), assuming BT485\n", status); case 0x80: case 0x90: case 0xA0: case 0xB0: case 0x28: /* This is for the DEC TGA - Questionable ? */ BTramdac_ID = BT485_RAMDAC; break; } /* Restore COMMAND Register 0 */ (*ramdacPtr->WriteDAC) (pScrn, BT_COMMAND_REG_0, 0x00, cmd0); if (BTramdac_ID == -1) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Cannot determine BT RAMDAC type, aborting\n"); return NULL; } else { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Attached RAMDAC is %s\n", BTramdacDeviceInfo[BTramdac_ID & 0xFFFF].DeviceName); } for (i = 0; ramdacs[i].token != -1; i++) { if (ramdacs[i].token == BTramdac_ID) RamDacIsSupported = TRUE; } if (!RamDacIsSupported) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "This BT RAMDAC is NOT supported by this driver, aborting\n"); return NULL; } ramdacHelperPtr = RamDacHelperCreateInfoRec(); switch (BTramdac_ID) { case BT485_RAMDAC: ramdacHelperPtr->SetBpp = BTramdacSetBpp; break; } ramdacPtr->RamDacType = BTramdac_ID; ramdacHelperPtr->RamDacType = BTramdac_ID; ramdacHelperPtr->Save = BTramdacSave; ramdacHelperPtr->Restore = BTramdacRestore; return ramdacHelperPtr; } void BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg) { /* We need to deal with Direct Colour visuals for 8bpp and other * good stuff for colours */ switch (pScrn->bitsPerPixel) { case 32: ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10; break; case 24: ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10; break; case 16: ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x38; break; case 15: ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x30; break; case 8: ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x40; break; case 4: ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x60; break; } } xorg-server-1.20.8/hw/xfree86/ramdac/BTPriv.h0000644000175000017500000000051113640201473015456 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include "BT.h" typedef struct { const char *DeviceName; } xf86BTramdacInfo; extern xf86BTramdacInfo BTramdacDeviceInfo[]; #ifdef INIT_BT_RAMDAC_INFO xf86BTramdacInfo BTramdacDeviceInfo[] = { {"AT&T 20C504"}, {"AT&T 20C505"}, {"BT485/484"} }; #endif xorg-server-1.20.8/hw/xfree86/ramdac/TI.h0000644000175000017500000001013613640201473014630 00000000000000 #include extern _X_EXPORT unsigned long TIramdacCalculateMNPForClock(unsigned long RefClock, unsigned long ReqClock, char IsPixClock, unsigned long MinClock, unsigned long MaxClock, unsigned long *rM, unsigned long *rN, unsigned long *rP); extern _X_EXPORT RamDacHelperRecPtr TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs); extern _X_EXPORT void TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr); extern _X_EXPORT void TIramdacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual); typedef void TIramdacLoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr); extern _X_EXPORT TIramdacLoadPaletteProc *TIramdacLoadPaletteWeak(void); #define TI3030_RAMDAC (VENDOR_TI << 16) | 0x00 #define TI3026_RAMDAC (VENDOR_TI << 16) | 0x01 /* * TI Ramdac registers */ #define TIDAC_rev 0x01 #define TIDAC_ind_curs_ctrl 0x06 #define TIDAC_byte_router_ctrl 0x07 #define TIDAC_latch_ctrl 0x0f #define TIDAC_true_color_ctrl 0x18 #define TIDAC_multiplex_ctrl 0x19 #define TIDAC_clock_select 0x1a #define TIDAC_palette_page 0x1c #define TIDAC_general_ctrl 0x1d #define TIDAC_misc_ctrl 0x1e #define TIDAC_pll_addr 0x2c #define TIDAC_pll_pixel_data 0x2d #define TIDAC_pll_memory_data 0x2e #define TIDAC_pll_loop_data 0x2f #define TIDAC_key_over_low 0x30 #define TIDAC_key_over_high 0x31 #define TIDAC_key_red_low 0x32 #define TIDAC_key_red_high 0x33 #define TIDAC_key_green_low 0x34 #define TIDAC_key_green_high 0x35 #define TIDAC_key_blue_low 0x36 #define TIDAC_key_blue_high 0x37 #define TIDAC_key_ctrl 0x38 #define TIDAC_clock_ctrl 0x39 #define TIDAC_sense_test 0x3a #define TIDAC_test_mode_data 0x3b #define TIDAC_crc_remain_lsb 0x3c #define TIDAC_crc_remain_msb 0x3d #define TIDAC_crc_bit_select 0x3e #define TIDAC_id 0x3f /* These are pll values that are accessed via TIDAC_pll_pixel_data */ #define TIDAC_PIXEL_N 0x80 #define TIDAC_PIXEL_M 0x81 #define TIDAC_PIXEL_P 0x82 #define TIDAC_PIXEL_VALID 0x83 /* These are pll values that are accessed via TIDAC_pll_loop_data */ #define TIDAC_LOOP_N 0x90 #define TIDAC_LOOP_M 0x91 #define TIDAC_LOOP_P 0x92 #define TIDAC_LOOP_VALID 0x93 /* Direct mapping addresses */ #define TIDAC_INDEX 0xa0 #define TIDAC_PALETTE_DATA 0xa1 #define TIDAC_READ_MASK 0xa2 #define TIDAC_READ_ADDR 0xa3 #define TIDAC_CURS_WRITE_ADDR 0xa4 #define TIDAC_CURS_COLOR 0xa5 #define TIDAC_CURS_READ_ADDR 0xa7 #define TIDAC_CURS_CTL 0xa9 #define TIDAC_INDEXED_DATA 0xaa #define TIDAC_CURS_RAM_DATA 0xab #define TIDAC_CURS_XLOW 0xac #define TIDAC_CURS_XHIGH 0xad #define TIDAC_CURS_YLOW 0xae #define TIDAC_CURS_YHIGH 0xaf #define TIDAC_sw_reset 0xff /* Constants */ #define TIDAC_TVP_3026_ID 0x26 #define TIDAC_TVP_3030_ID 0x30 xorg-server-1.20.8/hw/xfree86/ramdac/BT.h0000644000175000017500000000240513640201473014621 00000000000000 #include "xf86RamDac.h" extern _X_EXPORT RamDacHelperRecPtr BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs); extern _X_EXPORT void BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec); extern _X_EXPORT void BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec); #define ATT20C504_RAMDAC (VENDOR_BT << 16) | 0x00 #define ATT20C505_RAMDAC (VENDOR_BT << 16) | 0x01 #define BT485_RAMDAC (VENDOR_BT << 16) | 0x02 /* * BT registers */ #define BT_WRITE_ADDR 0x00 #define BT_RAMDAC_DATA 0x01 #define BT_PIXEL_MASK 0x02 #define BT_READ_ADDR 0x03 #define BT_CURS_WR_ADDR 0x04 #define BT_CURS_DATA 0x05 #define BT_COMMAND_REG_0 0x06 #define BT_CURS_RD_ADDR 0x07 #define BT_COMMAND_REG_1 0x08 #define BT_COMMAND_REG_2 0x09 #define BT_STATUS_REG 0x0A #define BT_CURS_RAM_DATA 0x0B #define BT_CURS_X_LOW 0x0C #define BT_CURS_X_HIGH 0x0D #define BT_CURS_Y_LOW 0x0E #define BT_CURS_Y_HIGH 0x0F xorg-server-1.20.8/hw/xfree86/ramdac/meson.build0000644000175000017500000000072413640201473016307 00000000000000srcs_xorg_ramdac = [ 'xf86RamDac.c', 'xf86RamDacCmap.c', 'xf86CursorRD.c', 'xf86HWCurs.c', 'IBM.c', 'BT.c', 'TI.c', ] xorg_ramdac = static_library('xorg_ramdac', srcs_xorg_ramdac, include_directories: [inc, xorg_inc], dependencies: common_dep, c_args: xorg_c_args, ) install_data( [ 'BT.h', 'IBM.h', 'TI.h', 'xf86Cursor.h', 'xf86RamDac.h', ], install_dir: xorgsdkdir, ) xorg-server-1.20.8/hw/xfree86/dri2/0000755000175000017500000000000013640201534013631 500000000000000xorg-server-1.20.8/hw/xfree86/dri2/dri2.h0000644000175000017500000003744113640201473014575 00000000000000/* * Copyright © 2007 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Soft- * ware"), to deal in the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, provided that the above copyright * notice(s) and this permission notice appear in all copies of the Soft- * ware and that both the above copyright notice(s) and this permission * notice appear in supporting documentation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- * QUENTIAL 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 PERFOR- * MANCE OF THIS SOFTWARE. * * Except as contained in this notice, the name of a copyright holder shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization of * the copyright holder. * * Authors: * Kristian Høgsberg (krh@redhat.com) */ #ifndef _DRI2_H_ #define _DRI2_H_ #include /* Version 2 structure (with format at the end) */ typedef struct { unsigned int attachment; unsigned int name; unsigned int pitch; unsigned int cpp; unsigned int flags; unsigned int format; void *driverPrivate; } DRI2BufferRec, *DRI2BufferPtr; extern CARD8 dri2_major; /* version of DRI2 supported by DDX */ extern CARD8 dri2_minor; typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr; typedef void (*DRI2SwapEventPtr) (ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, CARD32 sbc); typedef DRI2BufferPtr(*DRI2CreateBuffersProcPtr) (DrawablePtr pDraw, unsigned int *attachments, int count); typedef void (*DRI2DestroyBuffersProcPtr) (DrawablePtr pDraw, DRI2BufferPtr buffers, int count); typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw, RegionPtr pRegion, DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer); typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence); typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic); typedef int (*DRI2AuthMagic2ProcPtr) (ScreenPtr pScreen, uint32_t magic); /** * Schedule a buffer swap * * This callback is used to support glXSwapBuffers and the OML_sync_control * extension (see it for a description of the params). * * Drivers should queue an event for the frame count that satisfies the * parameters passed in. If the event is in the future (i.e. the conditions * aren't currently satisfied), the server may block the client at the next * GLX request using DRI2WaitSwap. When the event arrives, drivers should call * \c DRI2SwapComplete, which will handle waking the client and returning * the appropriate data. * * The DDX is responsible for doing a flip, exchange, or blit of the swap * when the corresponding event arrives. The \c DRI2CanFlip and * \c DRI2CanExchange functions can be used as helpers for this purpose. * * \param client client pointer (used for block/unblock) * \param pDraw drawable whose count we want * \param pDestBuffer current front buffer * \param pSrcBuffer current back buffer * \param target_msc frame count to wait for * \param divisor divisor for condition equation * \param remainder remainder for division equation * \param func function to call when the swap completes * \param data data for the callback \p func. */ typedef int (*DRI2ScheduleSwapProcPtr) (ClientPtr client, DrawablePtr pDraw, DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer, CARD64 * target_msc, CARD64 divisor, CARD64 remainder, DRI2SwapEventPtr func, void *data); typedef DRI2BufferPtr(*DRI2CreateBufferProcPtr) (DrawablePtr pDraw, unsigned int attachment, unsigned int format); typedef void (*DRI2DestroyBufferProcPtr) (DrawablePtr pDraw, DRI2BufferPtr buffer); /** * Notifies driver when DRI2GetBuffers reuses a dri2 buffer. * * Driver may rename the dri2 buffer in this notify if it is required. * * \param pDraw drawable whose count we want * \param buffer buffer that will be returned to client */ typedef void (*DRI2ReuseBufferNotifyProcPtr) (DrawablePtr pDraw, DRI2BufferPtr buffer); /** * Get current media stamp counter values * * This callback is used to support the SGI_video_sync and OML_sync_control * extensions. * * Drivers should return the current frame counter and the timestamp from * when the returned frame count was last incremented. * * The count should correspond to the screen where the drawable is currently * visible. If the drawable isn't visible (e.g. redirected), the server * should return BadDrawable to the client, pending GLX spec updates to * define this behavior. * * \param pDraw drawable whose count we want * \param ust timestamp from when the count was last incremented. * \param mst current frame count */ typedef int (*DRI2GetMSCProcPtr) (DrawablePtr pDraw, CARD64 * ust, CARD64 * msc); /** * Schedule a frame count related wait * * This callback is used to support the SGI_video_sync and OML_sync_control * extensions. See those specifications for details on how to handle * the divisor and remainder parameters. * * Drivers should queue an event for the frame count that satisfies the * parameters passed in. If the event is in the future (i.e. the conditions * aren't currently satisfied), the driver should block the client using * \c DRI2BlockClient. When the event arrives, drivers should call * \c DRI2WaitMSCComplete, which will handle waking the client and returning * the appropriate data. * * \param client client pointer (used for block/unblock) * \param pDraw drawable whose count we want * \param target_msc frame count to wait for * \param divisor divisor for condition equation * \param remainder remainder for division equation */ typedef int (*DRI2ScheduleWaitMSCProcPtr) (ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, CARD64 divisor, CARD64 remainder); typedef void (*DRI2InvalidateProcPtr) (DrawablePtr pDraw, void *data, XID id); /** * DRI2 calls this hook when ever swap_limit is going to be changed. Default * implementation for the hook only accepts one as swap_limit. If driver can * support other swap_limits it has to implement supported limits with this * callback. * * \param pDraw drawable whos swap_limit is going to be changed * \param swap_limit new swap_limit that going to be set * \return TRUE if limit is support, FALSE if not. */ typedef Bool (*DRI2SwapLimitValidateProcPtr) (DrawablePtr pDraw, int swap_limit); typedef DRI2BufferPtr(*DRI2CreateBuffer2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw, unsigned int attachment, unsigned int format); typedef void (*DRI2DestroyBuffer2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw, DRI2BufferPtr buffer); typedef void (*DRI2CopyRegion2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw, RegionPtr pRegion, DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer); /** * \brief Get the value of a parameter. * * The parameter's \a value is looked up on the screen associated with * \a pDrawable. * * \return \c Success or error code. */ typedef int (*DRI2GetParamProcPtr) (ClientPtr client, DrawablePtr pDrawable, CARD64 param, BOOL *is_param_recognized, CARD64 *value); /** * Version of the DRI2InfoRec structure defined in this header */ #define DRI2INFOREC_VERSION 9 typedef struct { unsigned int version; /**< Version of this struct */ int fd; const char *driverName; const char *deviceName; DRI2CreateBufferProcPtr CreateBuffer; DRI2DestroyBufferProcPtr DestroyBuffer; DRI2CopyRegionProcPtr CopyRegion; DRI2WaitProcPtr Wait; /* added in version 4 */ DRI2ScheduleSwapProcPtr ScheduleSwap; DRI2GetMSCProcPtr GetMSC; DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; /* number of drivers in the driverNames array */ unsigned int numDrivers; /* array of driver names, indexed by DRI2Driver* driver types */ /* a name of NULL means that driver is not supported */ const char *const *driverNames; /* added in version 5 */ DRI2AuthMagicProcPtr AuthMagic; /* added in version 6 */ DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; DRI2SwapLimitValidateProcPtr SwapLimitValidate; /* added in version 7 */ DRI2GetParamProcPtr GetParam; /* added in version 8 */ /* AuthMagic callback which passes extra context */ /* If this is NULL the AuthMagic callback is used */ /* If this is non-NULL the AuthMagic callback is ignored */ DRI2AuthMagic2ProcPtr AuthMagic2; /* added in version 9 */ DRI2CreateBuffer2ProcPtr CreateBuffer2; DRI2DestroyBuffer2ProcPtr DestroyBuffer2; DRI2CopyRegion2ProcPtr CopyRegion2; } DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info); extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen); extern _X_EXPORT Bool DRI2HasSwapControl(ScreenPtr pScreen); extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen, unsigned int driverType, int *fd, const char **driverName, const char **deviceName); extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic); extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id, DRI2InvalidateProcPtr invalidate, void *priv); extern _X_EXPORT int DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id, DRI2InvalidateProcPtr invalidate, void *priv, XID *dri2_id_out); extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height, unsigned int *attachments, int count, int *out_count); extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, unsigned int dest, unsigned int src); /** * Determine the major and minor version of the DRI2 extension. * * Provides a mechanism to other modules (e.g., 2D drivers) to determine the * version of the DRI2 extension. While it is possible to peek directly at * the \c XF86ModuleData from a layered module, such a module will fail to * load (due to an unresolved symbol) if the DRI2 extension is not loaded. * * \param major Location to store the major verion of the DRI2 extension * \param minor Location to store the minor verion of the DRI2 extension * * \note * This interface was added some time after the initial release of the DRI2 * module. Layered modules that wish to use this interface must first test * its existance by calling \c xf86LoaderCheckSymbol. */ extern _X_EXPORT void DRI2Version(int *major, int *minor); extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height, unsigned int *attachments, int count, int *out_count); extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval); extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit); extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable, CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 * swap_target, DRI2SwapEventPtr func, void *data); extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable); extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 * ust, CARD64 * msc, CARD64 * sbc); extern _X_EXPORT int DRI2WaitMSC(ClientPtr client, DrawablePtr pDrawable, CARD64 target_msc, CARD64 divisor, CARD64 remainder); extern _X_EXPORT int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc); extern _X_EXPORT int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc); extern _X_EXPORT Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw); extern _X_EXPORT Bool DRI2CanFlip(DrawablePtr pDraw); extern _X_EXPORT Bool DRI2CanExchange(DrawablePtr pDraw); /* Note: use *only* for MSC related waits */ extern _X_EXPORT void DRI2BlockClient(ClientPtr client, DrawablePtr pDraw); extern _X_EXPORT void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec, int type, DRI2SwapEventPtr swap_complete, void *swap_data); extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec); extern _X_EXPORT int DRI2GetParam(ClientPtr client, DrawablePtr pDrawable, CARD64 param, BOOL *is_param_recognized, CARD64 *value); extern _X_EXPORT DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest); #endif xorg-server-1.20.8/hw/xfree86/dri2/Makefile.am0000644000175000017500000000043713640201473015613 00000000000000SUBDIRS=pci_ids noinst_LTLIBRARIES = libdri2.la AM_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ @DIX_CFLAGS@ @XORG_CFLAGS@ \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support/bus libdri2_la_SOURCES = \ dri2.c \ dri2.h \ dri2ext.c \ dri2int.h sdk_HEADERS = dri2.h xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/0000755000175000017500000000000013640201534015243 500000000000000xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/Makefile.am0000644000175000017500000000034613640201473017224 00000000000000EXTRA_DIST = \ pci_id_driver_map.h \ i810_pci_ids.h \ i915_pci_ids.h \ i965_pci_ids.h \ r200_pci_ids.h \ r300_pci_ids.h \ r600_pci_ids.h \ radeon_pci_ids.h \ radeonsi_pci_ids.h \ virtio_gpu_pci_ids.h \ vmwgfx_pci_ids.h xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/virtio_gpu_pci_ids.h0000644000175000017500000000010013640201473021206 00000000000000CHIPSET(0x0010, VIRTGL, VIRTGL) CHIPSET(0x1050, VIRTGL, VIRTGL) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/i915_pci_ids.h0000644000175000017500000000124013640201473017514 00000000000000CHIPSET(0x3577, I830_M, "Intel(R) 830M") CHIPSET(0x2562, 845_G, "Intel(R) 845G") CHIPSET(0x3582, I855_GM, "Intel(R) 852GM/855GM") CHIPSET(0x2572, I865_G, "Intel(R) 865G") CHIPSET(0x2582, I915_G, "Intel(R) 915G") CHIPSET(0x258A, E7221_G, "Intel(R) E7221G (i915)") CHIPSET(0x2592, I915_GM, "Intel(R) 915GM") CHIPSET(0x2772, I945_G, "Intel(R) 945G") CHIPSET(0x27A2, I945_GM, "Intel(R) 945GM") CHIPSET(0x27AE, I945_GME, "Intel(R) 945GME") CHIPSET(0x29B2, Q35_G, "Intel(R) Q35") CHIPSET(0x29C2, G33_G, "Intel(R) G33") CHIPSET(0x29D2, Q33_G, "Intel(R) Q33") CHIPSET(0xA011, PNV_GM, "Intel(R) Pineview M") CHIPSET(0xA001, PNV_G, "Intel(R) Pineview") xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/i810_pci_ids.h0000644000175000017500000000017013640201473017507 00000000000000CHIPSET(0x7121, I810, i8xx) CHIPSET(0x7123, I810_DC100, i8xx) CHIPSET(0x7125, I810_E, i8xx) CHIPSET(0x1132, I815, i8xx) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/vmwgfx_pci_ids.h0000644000175000017500000000004013640201473020340 00000000000000CHIPSET(0x0405, SVGAII, SVGAII) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/r200_pci_ids.h0000644000175000017500000000131013640201473017506 00000000000000CHIPSET(0x5148, R200_QH, R200) CHIPSET(0x514C, R200_QL, R200) CHIPSET(0x514D, R200_QM, R200) CHIPSET(0x4242, R200_BB, R200) CHIPSET(0x4966, RV250_If, RV250) CHIPSET(0x4967, RV250_Ig, RV250) CHIPSET(0x4C64, RV250_Ld, RV250) CHIPSET(0x4C66, RV250_Lf, RV250) CHIPSET(0x4C67, RV250_Lg, RV250) CHIPSET(0x4C6E, RV280_4C6E, RV280) CHIPSET(0x5960, RV280_5960, RV280) CHIPSET(0x5961, RV280_5961, RV280) CHIPSET(0x5962, RV280_5962, RV280) CHIPSET(0x5964, RV280_5964, RV280) CHIPSET(0x5965, RV280_5965, RV280) CHIPSET(0x5C61, RV280_5C61, RV280) CHIPSET(0x5C63, RV280_5C63, RV280) CHIPSET(0x5834, RS300_5834, RS300) CHIPSET(0x5835, RS300_5835, RS300) CHIPSET(0x7834, RS350_7834, RS300) CHIPSET(0x7835, RS350_7835, RS300) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h0000644000175000017500000000440213640201473020775 00000000000000#ifndef _PCI_ID_DRIVER_MAP_H_ #define _PCI_ID_DRIVER_MAP_H_ #include #ifndef ARRAY_SIZE #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #endif static const int i915_chip_ids[] = { #define CHIPSET(chip, desc, name) chip, #include "pci_ids/i915_pci_ids.h" #undef CHIPSET }; static const int i965_chip_ids[] = { #define CHIPSET(chip, family, name) chip, #include "pci_ids/i965_pci_ids.h" #undef CHIPSET }; #ifndef DRIVER_MAP_GALLIUM_ONLY static const int r100_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/radeon_pci_ids.h" #undef CHIPSET }; static const int r200_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/r200_pci_ids.h" #undef CHIPSET }; #endif static const int r300_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/r300_pci_ids.h" #undef CHIPSET }; static const int r600_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/r600_pci_ids.h" #undef CHIPSET }; static const int radeonsi_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/radeonsi_pci_ids.h" #undef CHIPSET }; static const int virtio_gpu_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/virtio_gpu_pci_ids.h" #undef CHIPSET }; static const int vmwgfx_chip_ids[] = { #define CHIPSET(chip, name, family) chip, #include "pci_ids/vmwgfx_pci_ids.h" #undef CHIPSET }; static const struct { int vendor_id; const char *driver; const int *chip_ids; int num_chips_ids; } driver_map[] = { { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) }, { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) }, #ifndef DRIVER_MAP_GALLIUM_ONLY { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) }, { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) }, #endif { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) }, { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) }, { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) }, { 0x10de, "nouveau", NULL, -1 }, { 0x1af4, "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) }, { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) }, { 0x0000, NULL, NULL, 0 }, }; #endif /* _PCI_ID_DRIVER_MAP_H_ */ xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/radeon_pci_ids.h0000644000175000017500000000125713640201473020305 00000000000000CHIPSET(0x4C57, RADEON_LW, RV200) CHIPSET(0x4C58, RADEON_LX, RV200) CHIPSET(0x4C59, RADEON_LY, RV100) CHIPSET(0x4C5A, RADEON_LZ, RV100) CHIPSET(0x5144, RADEON_QD, R100) CHIPSET(0x5145, RADEON_QE, R100) CHIPSET(0x5146, RADEON_QF, R100) CHIPSET(0x5147, RADEON_QG, R100) CHIPSET(0x5159, RADEON_QY, RV100) CHIPSET(0x515A, RADEON_QZ, RV100) CHIPSET(0x5157, RV200_QW, RV200) CHIPSET(0x5158, RV200_QX, RV200) CHIPSET(0x515E, RN50_515E, UNKNOWN) CHIPSET(0x5969, RN50_5969, UNKNOWN) CHIPSET(0x4136, RS100_4136, RS100) CHIPSET(0x4336, RS100_4336, RS100) CHIPSET(0x4137, RS200_4137, RS200) CHIPSET(0x4337, RS200_4337, RS200) CHIPSET(0x4237, RS250_4237, RS200) CHIPSET(0x4437, RS250_4437, RS200) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/r300_pci_ids.h0000644000175000017500000001543513640201473017524 00000000000000CHIPSET(0x4144, R300_AD, R300) CHIPSET(0x4145, R300_AE, R300) CHIPSET(0x4146, R300_AF, R300) CHIPSET(0x4147, R300_AG, R300) CHIPSET(0x4E44, R300_ND, R300) CHIPSET(0x4E45, R300_NE, R300) CHIPSET(0x4E46, R300_NF, R300) CHIPSET(0x4E47, R300_NG, R300) CHIPSET(0x4E48, R350_NH, R350) CHIPSET(0x4E49, R350_NI, R350) CHIPSET(0x4E4B, R350_NK, R350) CHIPSET(0x4148, R350_AH, R350) CHIPSET(0x4149, R350_AI, R350) CHIPSET(0x414A, R350_AJ, R350) CHIPSET(0x414B, R350_AK, R350) CHIPSET(0x4E4A, R360_NJ, R350) CHIPSET(0x4150, RV350_AP, RV350) CHIPSET(0x4151, RV350_AQ, RV350) CHIPSET(0x4152, RV350_AR, RV350) CHIPSET(0x4153, RV350_AS, RV350) CHIPSET(0x4154, RV350_AT, RV350) CHIPSET(0x4155, RV350_AU, RV350) CHIPSET(0x4156, RV350_AV, RV350) CHIPSET(0x4E50, RV350_NP, RV350) CHIPSET(0x4E51, RV350_NQ, RV350) CHIPSET(0x4E52, RV350_NR, RV350) CHIPSET(0x4E53, RV350_NS, RV350) CHIPSET(0x4E54, RV350_NT, RV350) CHIPSET(0x4E56, RV350_NV, RV350) CHIPSET(0x5460, RV370_5460, RV370) CHIPSET(0x5462, RV370_5462, RV370) CHIPSET(0x5464, RV370_5464, RV370) CHIPSET(0x5B60, RV370_5B60, RV370) CHIPSET(0x5B62, RV370_5B62, RV370) CHIPSET(0x5B63, RV370_5B63, RV370) CHIPSET(0x5B64, RV370_5B64, RV370) CHIPSET(0x5B65, RV370_5B65, RV370) CHIPSET(0x3150, RV380_3150, RV380) CHIPSET(0x3151, RV380_3151, RV380) CHIPSET(0x3152, RV380_3152, RV380) CHIPSET(0x3154, RV380_3154, RV380) CHIPSET(0x3155, RV380_3155, RV380) CHIPSET(0x3E50, RV380_3E50, RV380) CHIPSET(0x3E54, RV380_3E54, RV380) CHIPSET(0x4A48, R420_JH, R420) CHIPSET(0x4A49, R420_JI, R420) CHIPSET(0x4A4A, R420_JJ, R420) CHIPSET(0x4A4B, R420_JK, R420) CHIPSET(0x4A4C, R420_JL, R420) CHIPSET(0x4A4D, R420_JM, R420) CHIPSET(0x4A4E, R420_JN, R420) CHIPSET(0x4A4F, R420_JO, R420) CHIPSET(0x4A50, R420_JP, R420) CHIPSET(0x4A54, R420_JT, R420) CHIPSET(0x5548, R423_UH, R423) CHIPSET(0x5549, R423_UI, R423) CHIPSET(0x554A, R423_UJ, R423) CHIPSET(0x554B, R423_UK, R423) CHIPSET(0x5550, R423_5550, R423) CHIPSET(0x5551, R423_UQ, R423) CHIPSET(0x5552, R423_UR, R423) CHIPSET(0x5554, R423_UT, R423) CHIPSET(0x5D57, R423_5D57, R423) CHIPSET(0x554C, R430_554C, R430) CHIPSET(0x554D, R430_554D, R430) CHIPSET(0x554E, R430_554E, R430) CHIPSET(0x554F, R430_554F, R430) CHIPSET(0x5D48, R430_5D48, R430) CHIPSET(0x5D49, R430_5D49, R430) CHIPSET(0x5D4A, R430_5D4A, R430) CHIPSET(0x5D4C, R480_5D4C, R480) CHIPSET(0x5D4D, R480_5D4D, R480) CHIPSET(0x5D4E, R480_5D4E, R480) CHIPSET(0x5D4F, R480_5D4F, R480) CHIPSET(0x5D50, R480_5D50, R480) CHIPSET(0x5D52, R480_5D52, R480) CHIPSET(0x4B48, R481_4B48, R481) CHIPSET(0x4B49, R481_4B49, R481) CHIPSET(0x4B4A, R481_4B4A, R481) CHIPSET(0x4B4B, R481_4B4B, R481) CHIPSET(0x4B4C, R481_4B4C, R481) CHIPSET(0x564A, RV410_564A, RV410) CHIPSET(0x564B, RV410_564B, RV410) CHIPSET(0x564F, RV410_564F, RV410) CHIPSET(0x5652, RV410_5652, RV410) CHIPSET(0x5653, RV410_5653, RV410) CHIPSET(0x5657, RV410_5657, RV410) CHIPSET(0x5E48, RV410_5E48, RV410) CHIPSET(0x5E4A, RV410_5E4A, RV410) CHIPSET(0x5E4B, RV410_5E4B, RV410) CHIPSET(0x5E4C, RV410_5E4C, RV410) CHIPSET(0x5E4D, RV410_5E4D, RV410) CHIPSET(0x5E4F, RV410_5E4F, RV410) CHIPSET(0x5A41, RS400_5A41, RS400) CHIPSET(0x5A42, RS400_5A42, RS400) CHIPSET(0x5A61, RC410_5A61, RC410) CHIPSET(0x5A62, RC410_5A62, RC410) CHIPSET(0x5954, RS480_5954, RS480) CHIPSET(0x5955, RS480_5955, RS480) CHIPSET(0x5974, RS482_5974, RS480) CHIPSET(0x5975, RS482_5975, RS480) CHIPSET(0x7100, R520_7100, R520) CHIPSET(0x7101, R520_7101, R520) CHIPSET(0x7102, R520_7102, R520) CHIPSET(0x7103, R520_7103, R520) CHIPSET(0x7104, R520_7104, R520) CHIPSET(0x7105, R520_7105, R520) CHIPSET(0x7106, R520_7106, R520) CHIPSET(0x7108, R520_7108, R520) CHIPSET(0x7109, R520_7109, R520) CHIPSET(0x710A, R520_710A, R520) CHIPSET(0x710B, R520_710B, R520) CHIPSET(0x710C, R520_710C, R520) CHIPSET(0x710E, R520_710E, R520) CHIPSET(0x710F, R520_710F, R520) CHIPSET(0x7140, RV515_7140, RV515) CHIPSET(0x7141, RV515_7141, RV515) CHIPSET(0x7142, RV515_7142, RV515) CHIPSET(0x7143, RV515_7143, RV515) CHIPSET(0x7144, RV515_7144, RV515) CHIPSET(0x7145, RV515_7145, RV515) CHIPSET(0x7146, RV515_7146, RV515) CHIPSET(0x7147, RV515_7147, RV515) CHIPSET(0x7149, RV515_7149, RV515) CHIPSET(0x714A, RV515_714A, RV515) CHIPSET(0x714B, RV515_714B, RV515) CHIPSET(0x714C, RV515_714C, RV515) CHIPSET(0x714D, RV515_714D, RV515) CHIPSET(0x714E, RV515_714E, RV515) CHIPSET(0x714F, RV515_714F, RV515) CHIPSET(0x7151, RV515_7151, RV515) CHIPSET(0x7152, RV515_7152, RV515) CHIPSET(0x7153, RV515_7153, RV515) CHIPSET(0x715E, RV515_715E, RV515) CHIPSET(0x715F, RV515_715F, RV515) CHIPSET(0x7180, RV515_7180, RV515) CHIPSET(0x7181, RV515_7181, RV515) CHIPSET(0x7183, RV515_7183, RV515) CHIPSET(0x7186, RV515_7186, RV515) CHIPSET(0x7187, RV515_7187, RV515) CHIPSET(0x7188, RV515_7188, RV515) CHIPSET(0x718A, RV515_718A, RV515) CHIPSET(0x718B, RV515_718B, RV515) CHIPSET(0x718C, RV515_718C, RV515) CHIPSET(0x718D, RV515_718D, RV515) CHIPSET(0x718F, RV515_718F, RV515) CHIPSET(0x7193, RV515_7193, RV515) CHIPSET(0x7196, RV515_7196, RV515) CHIPSET(0x719B, RV515_719B, RV515) CHIPSET(0x719F, RV515_719F, RV515) CHIPSET(0x7200, RV515_7200, RV515) CHIPSET(0x7210, RV515_7210, RV515) CHIPSET(0x7211, RV515_7211, RV515) CHIPSET(0x71C0, RV530_71C0, RV530) CHIPSET(0x71C1, RV530_71C1, RV530) CHIPSET(0x71C2, RV530_71C2, RV530) CHIPSET(0x71C3, RV530_71C3, RV530) CHIPSET(0x71C4, RV530_71C4, RV530) CHIPSET(0x71C5, RV530_71C5, RV530) CHIPSET(0x71C6, RV530_71C6, RV530) CHIPSET(0x71C7, RV530_71C7, RV530) CHIPSET(0x71CD, RV530_71CD, RV530) CHIPSET(0x71CE, RV530_71CE, RV530) CHIPSET(0x71D2, RV530_71D2, RV530) CHIPSET(0x71D4, RV530_71D4, RV530) CHIPSET(0x71D5, RV530_71D5, RV530) CHIPSET(0x71D6, RV530_71D6, RV530) CHIPSET(0x71DA, RV530_71DA, RV530) CHIPSET(0x71DE, RV530_71DE, RV530) CHIPSET(0x7281, RV560_7281, RV560) CHIPSET(0x7283, RV560_7283, RV560) CHIPSET(0x7287, RV560_7287, RV560) CHIPSET(0x7290, RV560_7290, RV560) CHIPSET(0x7291, RV560_7291, RV560) CHIPSET(0x7293, RV560_7293, RV560) CHIPSET(0x7297, RV560_7297, RV560) CHIPSET(0x7280, RV570_7280, RV570) CHIPSET(0x7288, RV570_7288, RV570) CHIPSET(0x7289, RV570_7289, RV570) CHIPSET(0x728B, RV570_728B, RV570) CHIPSET(0x728C, RV570_728C, RV570) CHIPSET(0x7240, R580_7240, R580) CHIPSET(0x7243, R580_7243, R580) CHIPSET(0x7244, R580_7244, R580) CHIPSET(0x7245, R580_7245, R580) CHIPSET(0x7246, R580_7246, R580) CHIPSET(0x7247, R580_7247, R580) CHIPSET(0x7248, R580_7248, R580) CHIPSET(0x7249, R580_7249, R580) CHIPSET(0x724A, R580_724A, R580) CHIPSET(0x724B, R580_724B, R580) CHIPSET(0x724C, R580_724C, R580) CHIPSET(0x724D, R580_724D, R580) CHIPSET(0x724E, R580_724E, R580) CHIPSET(0x724F, R580_724F, R580) CHIPSET(0x7284, R580_7284, R580) CHIPSET(0x793F, RS600_793F, RS600) CHIPSET(0x7941, RS600_7941, RS600) CHIPSET(0x7942, RS600_7942, RS600) CHIPSET(0x791E, RS690_791E, RS690) CHIPSET(0x791F, RS690_791F, RS690) CHIPSET(0x796C, RS740_796C, RS740) CHIPSET(0x796D, RS740_796D, RS740) CHIPSET(0x796E, RS740_796E, RS740) CHIPSET(0x796F, RS740_796F, RS740) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/Makefile.in0000644000175000017500000005053213640201512017231 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/dri2/pci_ids ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ pci_id_driver_map.h \ i810_pci_ids.h \ i915_pci_ids.h \ i965_pci_ids.h \ r200_pci_ids.h \ r300_pci_ids.h \ r600_pci_ids.h \ radeon_pci_ids.h \ radeonsi_pci_ids.h \ virtio_gpu_pci_ids.h \ vmwgfx_pci_ids.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dri2/pci_ids/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/dri2/pci_ids/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/r600_pci_ids.h0000644000175000017500000002506413640201473017526 00000000000000CHIPSET(0x9400, R600_9400, R600) CHIPSET(0x9401, R600_9401, R600) CHIPSET(0x9402, R600_9402, R600) CHIPSET(0x9403, R600_9403, R600) CHIPSET(0x9405, R600_9405, R600) CHIPSET(0x940A, R600_940A, R600) CHIPSET(0x940B, R600_940B, R600) CHIPSET(0x940F, R600_940F, R600) CHIPSET(0x94C0, RV610_94C0, RV610) CHIPSET(0x94C1, RV610_94C1, RV610) CHIPSET(0x94C3, RV610_94C3, RV610) CHIPSET(0x94C4, RV610_94C4, RV610) CHIPSET(0x94C5, RV610_94C5, RV610) CHIPSET(0x94C6, RV610_94C6, RV610) CHIPSET(0x94C7, RV610_94C7, RV610) CHIPSET(0x94C8, RV610_94C8, RV610) CHIPSET(0x94C9, RV610_94C9, RV610) CHIPSET(0x94CB, RV610_94CB, RV610) CHIPSET(0x94CC, RV610_94CC, RV610) CHIPSET(0x94CD, RV610_94CD, RV610) CHIPSET(0x9580, RV630_9580, RV630) CHIPSET(0x9581, RV630_9581, RV630) CHIPSET(0x9583, RV630_9583, RV630) CHIPSET(0x9586, RV630_9586, RV630) CHIPSET(0x9587, RV630_9587, RV630) CHIPSET(0x9588, RV630_9588, RV630) CHIPSET(0x9589, RV630_9589, RV630) CHIPSET(0x958A, RV630_958A, RV630) CHIPSET(0x958B, RV630_958B, RV630) CHIPSET(0x958C, RV630_958C, RV630) CHIPSET(0x958D, RV630_958D, RV630) CHIPSET(0x958E, RV630_958E, RV630) CHIPSET(0x958F, RV630_958F, RV630) CHIPSET(0x9500, RV670_9500, RV670) CHIPSET(0x9501, RV670_9501, RV670) CHIPSET(0x9504, RV670_9504, RV670) CHIPSET(0x9505, RV670_9505, RV670) CHIPSET(0x9506, RV670_9506, RV670) CHIPSET(0x9507, RV670_9507, RV670) CHIPSET(0x9508, RV670_9508, RV670) CHIPSET(0x9509, RV670_9509, RV670) CHIPSET(0x950F, RV670_950F, RV670) CHIPSET(0x9511, RV670_9511, RV670) CHIPSET(0x9515, RV670_9515, RV670) CHIPSET(0x9517, RV670_9517, RV670) CHIPSET(0x9519, RV670_9519, RV670) CHIPSET(0x95C0, RV620_95C0, RV620) CHIPSET(0x95C2, RV620_95C2, RV620) CHIPSET(0x95C4, RV620_95C4, RV620) CHIPSET(0x95C5, RV620_95C5, RV620) CHIPSET(0x95C6, RV620_95C6, RV620) CHIPSET(0x95C7, RV620_95C7, RV620) CHIPSET(0x95C9, RV620_95C9, RV620) CHIPSET(0x95CC, RV620_95CC, RV620) CHIPSET(0x95CD, RV620_95CD, RV620) CHIPSET(0x95CE, RV620_95CE, RV620) CHIPSET(0x95CF, RV620_95CF, RV620) CHIPSET(0x9590, RV635_9590, RV635) CHIPSET(0x9591, RV635_9591, RV635) CHIPSET(0x9593, RV635_9593, RV635) CHIPSET(0x9595, RV635_9595, RV635) CHIPSET(0x9596, RV635_9596, RV635) CHIPSET(0x9597, RV635_9597, RV635) CHIPSET(0x9598, RV635_9598, RV635) CHIPSET(0x9599, RV635_9599, RV635) CHIPSET(0x959B, RV635_959B, RV635) CHIPSET(0x9610, RS780_9610, RS780) CHIPSET(0x9611, RS780_9611, RS780) CHIPSET(0x9612, RS780_9612, RS780) CHIPSET(0x9613, RS780_9613, RS780) CHIPSET(0x9614, RS780_9614, RS780) CHIPSET(0x9615, RS780_9615, RS780) CHIPSET(0x9616, RS780_9616, RS780) CHIPSET(0x9710, RS880_9710, RS880) CHIPSET(0x9711, RS880_9711, RS880) CHIPSET(0x9712, RS880_9712, RS880) CHIPSET(0x9713, RS880_9713, RS880) CHIPSET(0x9714, RS880_9714, RS880) CHIPSET(0x9715, RS880_9715, RS880) CHIPSET(0x9440, RV770_9440, RV770) CHIPSET(0x9441, RV770_9441, RV770) CHIPSET(0x9442, RV770_9442, RV770) CHIPSET(0x9443, RV770_9443, RV770) CHIPSET(0x9444, RV770_9444, RV770) CHIPSET(0x9446, RV770_9446, RV770) CHIPSET(0x944A, RV770_944A, RV770) CHIPSET(0x944B, RV770_944B, RV770) CHIPSET(0x944C, RV770_944C, RV770) CHIPSET(0x944E, RV770_944E, RV770) CHIPSET(0x9450, RV770_9450, RV770) CHIPSET(0x9452, RV770_9452, RV770) CHIPSET(0x9456, RV770_9456, RV770) CHIPSET(0x945A, RV770_945A, RV770) CHIPSET(0x945B, RV770_945B, RV770) CHIPSET(0x945E, RV770_945E, RV770) CHIPSET(0x9460, RV790_9460, RV770) CHIPSET(0x9462, RV790_9462, RV770) CHIPSET(0x946A, RV770_946A, RV770) CHIPSET(0x946B, RV770_946B, RV770) CHIPSET(0x947A, RV770_947A, RV770) CHIPSET(0x947B, RV770_947B, RV770) CHIPSET(0x9480, RV730_9480, RV730) CHIPSET(0x9487, RV730_9487, RV730) CHIPSET(0x9488, RV730_9488, RV730) CHIPSET(0x9489, RV730_9489, RV730) CHIPSET(0x948A, RV730_948A, RV730) CHIPSET(0x948F, RV730_948F, RV730) CHIPSET(0x9490, RV730_9490, RV730) CHIPSET(0x9491, RV730_9491, RV730) CHIPSET(0x9495, RV730_9495, RV730) CHIPSET(0x9498, RV730_9498, RV730) CHIPSET(0x949C, RV730_949C, RV730) CHIPSET(0x949E, RV730_949E, RV730) CHIPSET(0x949F, RV730_949F, RV730) CHIPSET(0x9540, RV710_9540, RV710) CHIPSET(0x9541, RV710_9541, RV710) CHIPSET(0x9542, RV710_9542, RV710) CHIPSET(0x954E, RV710_954E, RV710) CHIPSET(0x954F, RV710_954F, RV710) CHIPSET(0x9552, RV710_9552, RV710) CHIPSET(0x9553, RV710_9553, RV710) CHIPSET(0x9555, RV710_9555, RV710) CHIPSET(0x9557, RV710_9557, RV710) CHIPSET(0x955F, RV710_955F, RV710) CHIPSET(0x94A0, RV740_94A0, RV740) CHIPSET(0x94A1, RV740_94A1, RV740) CHIPSET(0x94A3, RV740_94A3, RV740) CHIPSET(0x94B1, RV740_94B1, RV740) CHIPSET(0x94B3, RV740_94B3, RV740) CHIPSET(0x94B4, RV740_94B4, RV740) CHIPSET(0x94B5, RV740_94B5, RV740) CHIPSET(0x94B9, RV740_94B9, RV740) CHIPSET(0x68E0, CEDAR_68E0, CEDAR) CHIPSET(0x68E1, CEDAR_68E1, CEDAR) CHIPSET(0x68E4, CEDAR_68E4, CEDAR) CHIPSET(0x68E5, CEDAR_68E5, CEDAR) CHIPSET(0x68E8, CEDAR_68E8, CEDAR) CHIPSET(0x68E9, CEDAR_68E9, CEDAR) CHIPSET(0x68F1, CEDAR_68F1, CEDAR) CHIPSET(0x68F2, CEDAR_68F2, CEDAR) CHIPSET(0x68F8, CEDAR_68F8, CEDAR) CHIPSET(0x68F9, CEDAR_68F9, CEDAR) CHIPSET(0x68FA, CEDAR_68FA, CEDAR) CHIPSET(0x68FE, CEDAR_68FE, CEDAR) CHIPSET(0x68C0, REDWOOD_68C0, REDWOOD) CHIPSET(0x68C1, REDWOOD_68C1, REDWOOD) CHIPSET(0x68C7, REDWOOD_68C7, REDWOOD) CHIPSET(0x68C8, REDWOOD_68C8, REDWOOD) CHIPSET(0x68C9, REDWOOD_68C9, REDWOOD) CHIPSET(0x68D8, REDWOOD_68D8, REDWOOD) CHIPSET(0x68D9, REDWOOD_68D9, REDWOOD) CHIPSET(0x68DA, REDWOOD_68DA, REDWOOD) CHIPSET(0x68DE, REDWOOD_68DE, REDWOOD) CHIPSET(0x68A0, JUNIPER_68A0, JUNIPER) CHIPSET(0x68A1, JUNIPER_68A1, JUNIPER) CHIPSET(0x68A8, JUNIPER_68A8, JUNIPER) CHIPSET(0x68A9, JUNIPER_68A9, JUNIPER) CHIPSET(0x68B0, JUNIPER_68B0, JUNIPER) CHIPSET(0x68B8, JUNIPER_68B8, JUNIPER) CHIPSET(0x68B9, JUNIPER_68B9, JUNIPER) CHIPSET(0x68BA, JUNIPER_68BA, JUNIPER) CHIPSET(0x68BE, JUNIPER_68BE, JUNIPER) CHIPSET(0x68BF, JUNIPER_68BF, JUNIPER) CHIPSET(0x6880, CYPRESS_6880, CYPRESS) CHIPSET(0x6888, CYPRESS_6888, CYPRESS) CHIPSET(0x6889, CYPRESS_6889, CYPRESS) CHIPSET(0x688A, CYPRESS_688A, CYPRESS) CHIPSET(0x688C, CYPRESS_688C, CYPRESS) CHIPSET(0x688D, CYPRESS_688D, CYPRESS) CHIPSET(0x6898, CYPRESS_6898, CYPRESS) CHIPSET(0x6899, CYPRESS_6899, CYPRESS) CHIPSET(0x689B, CYPRESS_689B, CYPRESS) CHIPSET(0x689E, CYPRESS_689E, CYPRESS) CHIPSET(0x689C, HEMLOCK_689C, HEMLOCK) CHIPSET(0x689D, HEMLOCK_689D, HEMLOCK) CHIPSET(0x9802, PALM_9802, PALM) CHIPSET(0x9803, PALM_9803, PALM) CHIPSET(0x9804, PALM_9804, PALM) CHIPSET(0x9805, PALM_9805, PALM) CHIPSET(0x9806, PALM_9806, PALM) CHIPSET(0x9807, PALM_9807, PALM) CHIPSET(0x9808, PALM_9808, PALM) CHIPSET(0x9809, PALM_9809, PALM) CHIPSET(0x980A, PALM_980A, PALM) CHIPSET(0x9640, SUMO_9640, SUMO) CHIPSET(0x9641, SUMO_9641, SUMO) CHIPSET(0x9642, SUMO2_9642, SUMO2) CHIPSET(0x9643, SUMO2_9643, SUMO2) CHIPSET(0x9644, SUMO2_9644, SUMO2) CHIPSET(0x9645, SUMO2_9645, SUMO2) CHIPSET(0x9647, SUMO_9647, SUMO) CHIPSET(0x9648, SUMO_9648, SUMO) CHIPSET(0x9649, SUMO2_9649, SUMO2) CHIPSET(0x964a, SUMO_964A, SUMO) CHIPSET(0x964b, SUMO_964B, SUMO) CHIPSET(0x964c, SUMO_964C, SUMO) CHIPSET(0x964e, SUMO_964E, SUMO) CHIPSET(0x964f, SUMO_964F, SUMO) CHIPSET(0x6700, CAYMAN_6700, CAYMAN) CHIPSET(0x6701, CAYMAN_6701, CAYMAN) CHIPSET(0x6702, CAYMAN_6702, CAYMAN) CHIPSET(0x6703, CAYMAN_6703, CAYMAN) CHIPSET(0x6704, CAYMAN_6704, CAYMAN) CHIPSET(0x6705, CAYMAN_6705, CAYMAN) CHIPSET(0x6706, CAYMAN_6706, CAYMAN) CHIPSET(0x6707, CAYMAN_6707, CAYMAN) CHIPSET(0x6708, CAYMAN_6708, CAYMAN) CHIPSET(0x6709, CAYMAN_6709, CAYMAN) CHIPSET(0x6718, CAYMAN_6718, CAYMAN) CHIPSET(0x6719, CAYMAN_6719, CAYMAN) CHIPSET(0x671C, CAYMAN_671C, CAYMAN) CHIPSET(0x671D, CAYMAN_671D, CAYMAN) CHIPSET(0x671F, CAYMAN_671F, CAYMAN) CHIPSET(0x6720, BARTS_6720, BARTS) CHIPSET(0x6721, BARTS_6721, BARTS) CHIPSET(0x6722, BARTS_6722, BARTS) CHIPSET(0x6723, BARTS_6723, BARTS) CHIPSET(0x6724, BARTS_6724, BARTS) CHIPSET(0x6725, BARTS_6725, BARTS) CHIPSET(0x6726, BARTS_6726, BARTS) CHIPSET(0x6727, BARTS_6727, BARTS) CHIPSET(0x6728, BARTS_6728, BARTS) CHIPSET(0x6729, BARTS_6729, BARTS) CHIPSET(0x6738, BARTS_6738, BARTS) CHIPSET(0x6739, BARTS_6739, BARTS) CHIPSET(0x673E, BARTS_673E, BARTS) CHIPSET(0x6740, TURKS_6740, TURKS) CHIPSET(0x6741, TURKS_6741, TURKS) CHIPSET(0x6742, TURKS_6742, TURKS) CHIPSET(0x6743, TURKS_6743, TURKS) CHIPSET(0x6744, TURKS_6744, TURKS) CHIPSET(0x6745, TURKS_6745, TURKS) CHIPSET(0x6746, TURKS_6746, TURKS) CHIPSET(0x6747, TURKS_6747, TURKS) CHIPSET(0x6748, TURKS_6748, TURKS) CHIPSET(0x6749, TURKS_6749, TURKS) CHIPSET(0x674A, TURKS_674A, TURKS) CHIPSET(0x6750, TURKS_6750, TURKS) CHIPSET(0x6751, TURKS_6751, TURKS) CHIPSET(0x6758, TURKS_6758, TURKS) CHIPSET(0x6759, TURKS_6759, TURKS) CHIPSET(0x675B, TURKS_675B, TURKS) CHIPSET(0x675D, TURKS_675D, TURKS) CHIPSET(0x675F, TURKS_675F, TURKS) CHIPSET(0x6840, TURKS_6840, TURKS) CHIPSET(0x6841, TURKS_6841, TURKS) CHIPSET(0x6842, TURKS_6842, TURKS) CHIPSET(0x6843, TURKS_6843, TURKS) CHIPSET(0x6849, TURKS_6849, TURKS) CHIPSET(0x6850, TURKS_6850, TURKS) CHIPSET(0x6858, TURKS_6858, TURKS) CHIPSET(0x6859, TURKS_6859, TURKS) CHIPSET(0x6760, CAICOS_6760, CAICOS) CHIPSET(0x6761, CAICOS_6761, CAICOS) CHIPSET(0x6762, CAICOS_6762, CAICOS) CHIPSET(0x6763, CAICOS_6763, CAICOS) CHIPSET(0x6764, CAICOS_6764, CAICOS) CHIPSET(0x6765, CAICOS_6765, CAICOS) CHIPSET(0x6766, CAICOS_6766, CAICOS) CHIPSET(0x6767, CAICOS_6767, CAICOS) CHIPSET(0x6768, CAICOS_6768, CAICOS) CHIPSET(0x6770, CAICOS_6770, CAICOS) CHIPSET(0x6771, CAICOS_6771, CAICOS) CHIPSET(0x6772, CAICOS_6772, CAICOS) CHIPSET(0x6778, CAICOS_6778, CAICOS) CHIPSET(0x6779, CAICOS_6779, CAICOS) CHIPSET(0x677B, CAICOS_677B, CAICOS) CHIPSET(0x9900, ARUBA_9900, ARUBA) CHIPSET(0x9901, ARUBA_9901, ARUBA) CHIPSET(0x9903, ARUBA_9903, ARUBA) CHIPSET(0x9904, ARUBA_9904, ARUBA) CHIPSET(0x9905, ARUBA_9905, ARUBA) CHIPSET(0x9906, ARUBA_9906, ARUBA) CHIPSET(0x9907, ARUBA_9907, ARUBA) CHIPSET(0x9908, ARUBA_9908, ARUBA) CHIPSET(0x9909, ARUBA_9909, ARUBA) CHIPSET(0x990A, ARUBA_990A, ARUBA) CHIPSET(0x990B, ARUBA_990B, ARUBA) CHIPSET(0x990C, ARUBA_990C, ARUBA) CHIPSET(0x990D, ARUBA_990D, ARUBA) CHIPSET(0x990E, ARUBA_990E, ARUBA) CHIPSET(0x990F, ARUBA_990F, ARUBA) CHIPSET(0x9910, ARUBA_9910, ARUBA) CHIPSET(0x9913, ARUBA_9913, ARUBA) CHIPSET(0x9917, ARUBA_9917, ARUBA) CHIPSET(0x9918, ARUBA_9918, ARUBA) CHIPSET(0x9919, ARUBA_9919, ARUBA) CHIPSET(0x9990, ARUBA_9990, ARUBA) CHIPSET(0x9991, ARUBA_9991, ARUBA) CHIPSET(0x9992, ARUBA_9992, ARUBA) CHIPSET(0x9993, ARUBA_9993, ARUBA) CHIPSET(0x9994, ARUBA_9994, ARUBA) CHIPSET(0x9995, ARUBA_9995, ARUBA) CHIPSET(0x9996, ARUBA_9996, ARUBA) CHIPSET(0x9997, ARUBA_9997, ARUBA) CHIPSET(0x9998, ARUBA_9998, ARUBA) CHIPSET(0x9999, ARUBA_9999, ARUBA) CHIPSET(0x999A, ARUBA_999A, ARUBA) CHIPSET(0x999B, ARUBA_999B, ARUBA) CHIPSET(0x999C, ARUBA_999C, ARUBA) CHIPSET(0x999D, ARUBA_999D, ARUBA) CHIPSET(0x99A0, ARUBA_99A0, ARUBA) CHIPSET(0x99A2, ARUBA_99A2, ARUBA) CHIPSET(0x99A4, ARUBA_99A4, ARUBA) xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/i965_pci_ids.h0000644000175000017500000003372013640201473017531 00000000000000#ifndef IRIS CHIPSET(0x29A2, i965, "Intel(R) 965G") CHIPSET(0x2992, i965, "Intel(R) 965Q") CHIPSET(0x2982, i965, "Intel(R) 965G") CHIPSET(0x2972, i965, "Intel(R) 946GZ") CHIPSET(0x2A02, i965, "Intel(R) 965GM") CHIPSET(0x2A12, i965, "Intel(R) 965GME/GLE") CHIPSET(0x2A42, g4x, "Mobile Intel® GM45 Express Chipset") CHIPSET(0x2E02, g4x, "Intel(R) Integrated Graphics Device") CHIPSET(0x2E12, g4x, "Intel(R) Q45/Q43") CHIPSET(0x2E22, g4x, "Intel(R) G45/G43") CHIPSET(0x2E32, g4x, "Intel(R) G41") CHIPSET(0x2E42, g4x, "Intel(R) B43") CHIPSET(0x2E92, g4x, "Intel(R) B43") CHIPSET(0x0042, ilk, "Intel(R) Ironlake Desktop") CHIPSET(0x0046, ilk, "Intel(R) Ironlake Mobile") CHIPSET(0x0102, snb_gt1, "Intel(R) Sandybridge Desktop") CHIPSET(0x0112, snb_gt2, "Intel(R) Sandybridge Desktop") CHIPSET(0x0122, snb_gt2, "Intel(R) Sandybridge Desktop") CHIPSET(0x0106, snb_gt1, "Intel(R) Sandybridge Mobile") CHIPSET(0x0116, snb_gt2, "Intel(R) Sandybridge Mobile") CHIPSET(0x0126, snb_gt2, "Intel(R) Sandybridge Mobile") CHIPSET(0x010A, snb_gt1, "Intel(R) Sandybridge Server") CHIPSET(0x0152, ivb_gt1, "Intel(R) Ivybridge Desktop") CHIPSET(0x0162, ivb_gt2, "Intel(R) Ivybridge Desktop") CHIPSET(0x0156, ivb_gt1, "Intel(R) Ivybridge Mobile") CHIPSET(0x0166, ivb_gt2, "Intel(R) Ivybridge Mobile") CHIPSET(0x015a, ivb_gt1, "Intel(R) Ivybridge Server") CHIPSET(0x016a, ivb_gt2, "Intel(R) Ivybridge Server") CHIPSET(0x0402, hsw_gt1, "Intel(R) Haswell Desktop") CHIPSET(0x0412, hsw_gt2, "Intel(R) Haswell Desktop") CHIPSET(0x0422, hsw_gt3, "Intel(R) Haswell Desktop") CHIPSET(0x0406, hsw_gt1, "Intel(R) Haswell Mobile") CHIPSET(0x0416, hsw_gt2, "Intel(R) Haswell Mobile") CHIPSET(0x0426, hsw_gt3, "Intel(R) Haswell Mobile") CHIPSET(0x040A, hsw_gt1, "Intel(R) Haswell Server") CHIPSET(0x041A, hsw_gt2, "Intel(R) Haswell Server") CHIPSET(0x042A, hsw_gt3, "Intel(R) Haswell Server") CHIPSET(0x040B, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x041B, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x042B, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x040E, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x041E, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x042E, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0C02, hsw_gt1, "Intel(R) Haswell Desktop") CHIPSET(0x0C12, hsw_gt2, "Intel(R) Haswell Desktop") CHIPSET(0x0C22, hsw_gt3, "Intel(R) Haswell Desktop") CHIPSET(0x0C06, hsw_gt1, "Intel(R) Haswell Mobile") CHIPSET(0x0C16, hsw_gt2, "Intel(R) Haswell Mobile") CHIPSET(0x0C26, hsw_gt3, "Intel(R) Haswell Mobile") CHIPSET(0x0C0A, hsw_gt1, "Intel(R) Haswell Server") CHIPSET(0x0C1A, hsw_gt2, "Intel(R) Haswell Server") CHIPSET(0x0C2A, hsw_gt3, "Intel(R) Haswell Server") CHIPSET(0x0C0B, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x0C1B, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x0C2B, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0C0E, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x0C1E, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x0C2E, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0A02, hsw_gt1, "Intel(R) Haswell Desktop") CHIPSET(0x0A12, hsw_gt2, "Intel(R) Haswell Desktop") CHIPSET(0x0A22, hsw_gt3, "Intel(R) Haswell Desktop") CHIPSET(0x0A06, hsw_gt1, "Intel(R) Haswell Mobile") CHIPSET(0x0A16, hsw_gt2, "Intel(R) Haswell Mobile") CHIPSET(0x0A26, hsw_gt3, "Intel(R) Haswell Mobile") CHIPSET(0x0A0A, hsw_gt1, "Intel(R) Haswell Server") CHIPSET(0x0A1A, hsw_gt2, "Intel(R) Haswell Server") CHIPSET(0x0A2A, hsw_gt3, "Intel(R) Haswell Server") CHIPSET(0x0A0B, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x0A1B, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x0A2B, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0A0E, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x0A1E, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x0A2E, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0D02, hsw_gt1, "Intel(R) Haswell Desktop") CHIPSET(0x0D12, hsw_gt2, "Intel(R) Haswell Desktop") CHIPSET(0x0D22, hsw_gt3, "Intel(R) Haswell Desktop") CHIPSET(0x0D06, hsw_gt1, "Intel(R) Haswell Mobile") CHIPSET(0x0D16, hsw_gt2, "Intel(R) Haswell Mobile") CHIPSET(0x0D26, hsw_gt3, "Intel(R) Haswell Mobile") CHIPSET(0x0D0A, hsw_gt1, "Intel(R) Haswell Server") CHIPSET(0x0D1A, hsw_gt2, "Intel(R) Haswell Server") CHIPSET(0x0D2A, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0D0B, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x0D1B, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x0D2B, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0D0E, hsw_gt1, "Intel(R) Haswell") CHIPSET(0x0D1E, hsw_gt2, "Intel(R) Haswell") CHIPSET(0x0D2E, hsw_gt3, "Intel(R) Haswell") CHIPSET(0x0F31, byt, "Intel(R) Bay Trail") CHIPSET(0x0F32, byt, "Intel(R) Bay Trail") CHIPSET(0x0F33, byt, "Intel(R) Bay Trail") CHIPSET(0x0157, byt, "Intel(R) Bay Trail") CHIPSET(0x0155, byt, "Intel(R) Bay Trail") CHIPSET(0x22B0, chv, "Intel(R) HD Graphics (Cherrytrail)") CHIPSET(0x22B1, chv, "Intel(R) HD Graphics XXX (Braswell)") /* Overridden in brw_get_renderer_string */ CHIPSET(0x22B2, chv, "Intel(R) HD Graphics (Cherryview)") CHIPSET(0x22B3, chv, "Intel(R) HD Graphics (Cherryview)") #endif CHIPSET(0x1602, bdw_gt1, "Intel(R) Broadwell GT1") CHIPSET(0x1606, bdw_gt1, "Intel(R) Broadwell GT1") CHIPSET(0x160A, bdw_gt1, "Intel(R) Broadwell GT1") CHIPSET(0x160B, bdw_gt1, "Intel(R) Broadwell GT1") CHIPSET(0x160D, bdw_gt1, "Intel(R) Broadwell GT1") CHIPSET(0x160E, bdw_gt1, "Intel(R) Broadwell GT1") CHIPSET(0x1612, bdw_gt2, "Intel(R) HD Graphics 5600 (Broadwell GT2)") CHIPSET(0x1616, bdw_gt2, "Intel(R) HD Graphics 5500 (Broadwell GT2)") CHIPSET(0x161A, bdw_gt2, "Intel(R) Broadwell GT2") CHIPSET(0x161B, bdw_gt2, "Intel(R) Broadwell GT2") CHIPSET(0x161D, bdw_gt2, "Intel(R) Broadwell GT2") CHIPSET(0x161E, bdw_gt2, "Intel(R) HD Graphics 5300 (Broadwell GT2)") CHIPSET(0x1622, bdw_gt3, "Intel(R) Iris Pro 6200 (Broadwell GT3e)") CHIPSET(0x1626, bdw_gt3, "Intel(R) HD Graphics 6000 (Broadwell GT3)") CHIPSET(0x162A, bdw_gt3, "Intel(R) Iris Pro P6300 (Broadwell GT3e)") CHIPSET(0x162B, bdw_gt3, "Intel(R) Iris 6100 (Broadwell GT3)") CHIPSET(0x162D, bdw_gt3, "Intel(R) Broadwell GT3") CHIPSET(0x162E, bdw_gt3, "Intel(R) Broadwell GT3") CHIPSET(0x1902, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") CHIPSET(0x1906, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") CHIPSET(0x190A, skl_gt1, "Intel(R) Skylake GT1") CHIPSET(0x190B, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") CHIPSET(0x190E, skl_gt1, "Intel(R) Skylake GT1") CHIPSET(0x1912, skl_gt2, "Intel(R) HD Graphics 530 (Skylake GT2)") CHIPSET(0x1913, skl_gt2, "Intel(R) Skylake GT2f") CHIPSET(0x1915, skl_gt2, "Intel(R) Skylake GT2f") CHIPSET(0x1916, skl_gt2, "Intel(R) HD Graphics 520 (Skylake GT2)") CHIPSET(0x1917, skl_gt2, "Intel(R) Skylake GT2f") CHIPSET(0x191A, skl_gt2, "Intel(R) Skylake GT2") CHIPSET(0x191B, skl_gt2, "Intel(R) HD Graphics 530 (Skylake GT2)") CHIPSET(0x191D, skl_gt2, "Intel(R) HD Graphics P530 (Skylake GT2)") CHIPSET(0x191E, skl_gt2, "Intel(R) HD Graphics 515 (Skylake GT2)") CHIPSET(0x1921, skl_gt2, "Intel(R) HD Graphics 520 (Skylake GT2)") CHIPSET(0x1923, skl_gt3, "Intel(R) Skylake GT3e") CHIPSET(0x1926, skl_gt3, "Intel(R) Iris Graphics 540 (Skylake GT3e)") CHIPSET(0x1927, skl_gt3, "Intel(R) Iris Graphics 550 (Skylake GT3e)") CHIPSET(0x192A, skl_gt4, "Intel(R) Skylake GT4") CHIPSET(0x192B, skl_gt3, "Intel(R) Iris Graphics 555 (Skylake GT3e)") CHIPSET(0x192D, skl_gt3, "Intel(R) Iris Graphics P555 (Skylake GT3e)") CHIPSET(0x1932, skl_gt4, "Intel(R) Iris Pro Graphics 580 (Skylake GT4e)") CHIPSET(0x193A, skl_gt4, "Intel(R) Iris Pro Graphics P580 (Skylake GT4e)") CHIPSET(0x193B, skl_gt4, "Intel(R) Iris Pro Graphics 580 (Skylake GT4e)") CHIPSET(0x193D, skl_gt4, "Intel(R) Iris Pro Graphics P580 (Skylake GT4e)") CHIPSET(0x0A84, bxt, "Intel(R) HD Graphics (Broxton)") CHIPSET(0x1A84, bxt, "Intel(R) HD Graphics (Broxton)") CHIPSET(0x1A85, bxt_2x6, "Intel(R) HD Graphics (Broxton 2x6)") CHIPSET(0x5A84, bxt, "Intel(R) HD Graphics 505 (Broxton)") CHIPSET(0x5A85, bxt_2x6, "Intel(R) HD Graphics 500 (Broxton 2x6)") CHIPSET(0x5902, kbl_gt1, "Intel(R) HD Graphics 610 (Kaby Lake GT1)") CHIPSET(0x5906, kbl_gt1, "Intel(R) HD Graphics 610 (Kaby Lake GT1)") CHIPSET(0x590A, kbl_gt1, "Intel(R) Kabylake GT1") CHIPSET(0x5908, kbl_gt1, "Intel(R) Kabylake GT1") CHIPSET(0x590B, kbl_gt1, "Intel(R) Kabylake GT1") CHIPSET(0x590E, kbl_gt1, "Intel(R) Kabylake GT1") CHIPSET(0x5913, kbl_gt1_5, "Intel(R) Kabylake GT1.5") CHIPSET(0x5915, kbl_gt1_5, "Intel(R) Kabylake GT1.5") CHIPSET(0x5917, kbl_gt2, "Intel(R) UHD Graphics 620 (Kabylake GT2)") CHIPSET(0x5912, kbl_gt2, "Intel(R) HD Graphics 630 (Kaby Lake GT2)") CHIPSET(0x5916, kbl_gt2, "Intel(R) HD Graphics 620 (Kaby Lake GT2)") CHIPSET(0x591A, kbl_gt2, "Intel(R) HD Graphics P630 (Kaby Lake GT2)") CHIPSET(0x591B, kbl_gt2, "Intel(R) HD Graphics 630 (Kaby Lake GT2)") CHIPSET(0x591D, kbl_gt2, "Intel(R) HD Graphics P630 (Kaby Lake GT2)") CHIPSET(0x591E, kbl_gt2, "Intel(R) HD Graphics 615 (Kaby Lake GT2)") CHIPSET(0x5921, kbl_gt2, "Intel(R) Kabylake GT2F") CHIPSET(0x5923, kbl_gt3, "Intel(R) Kabylake GT3") CHIPSET(0x5926, kbl_gt3, "Intel(R) Iris Plus Graphics 640 (Kaby Lake GT3e)") CHIPSET(0x5927, kbl_gt3, "Intel(R) Iris Plus Graphics 650 (Kaby Lake GT3e)") CHIPSET(0x593B, kbl_gt4, "Intel(R) Kabylake GT4") CHIPSET(0x591C, kbl_gt2, "Intel(R) Amber Lake (Kabylake) GT2") CHIPSET(0x87C0, kbl_gt2, "Intel(R) Amber Lake (Kabylake) GT2") CHIPSET(0x87CA, cfl_gt2, "Intel(R) Amber Lake (Coffeelake) GT2") CHIPSET(0x3184, glk, "Intel(R) UHD Graphics 605 (Geminilake)") CHIPSET(0x3185, glk_2x6, "Intel(R) UHD Graphics 600 (Geminilake 2x6)") CHIPSET(0x3E90, cfl_gt1, "Intel(R) UHD Graphics 610 (Coffeelake 2x6 GT1)") CHIPSET(0x3E93, cfl_gt1, "Intel(R) UHD Graphics 610 (Coffeelake 2x6 GT1)") CHIPSET(0x3E99, cfl_gt1, "Intel(R) HD Graphics (Coffeelake 2x6 GT1)") CHIPSET(0x3E9C, cfl_gt1, "Intel(R) HD Graphics (Coffeelake 2x6 GT1)") CHIPSET(0x3E91, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") CHIPSET(0x3E92, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") CHIPSET(0x3E96, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") CHIPSET(0x3E98, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") CHIPSET(0x3E9A, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") CHIPSET(0x3E9B, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") CHIPSET(0x3E94, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") CHIPSET(0x3EA9, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") CHIPSET(0x3EA5, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") CHIPSET(0x3EA6, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") CHIPSET(0x3EA7, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") CHIPSET(0x3EA8, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") CHIPSET(0x3EA1, cfl_gt1, "Intel(R) HD Graphics (Whiskey Lake 2x6 GT1)") CHIPSET(0x3EA4, cfl_gt1, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT1)") CHIPSET(0x3EA0, cfl_gt2, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT2)") CHIPSET(0x3EA3, cfl_gt2, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT2)") CHIPSET(0x3EA2, cfl_gt3, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT3)") CHIPSET(0x9B21, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BA0, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BA2, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BA4, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BA5, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BA8, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BAA, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BAB, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9BAC, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") CHIPSET(0x9B41, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BC0, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BC2, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BC4, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BC5, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BC8, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BCA, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BCB, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x9BCC, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") CHIPSET(0x5A49, cnl_2x8, "Intel(R) HD Graphics (Cannonlake 2x8 GT0.5)") CHIPSET(0x5A4A, cnl_2x8, "Intel(R) HD Graphics (Cannonlake 2x8 GT0.5)") CHIPSET(0x5A41, cnl_3x8, "Intel(R) HD Graphics (Cannonlake 3x8 GT1)") CHIPSET(0x5A42, cnl_3x8, "Intel(R) HD Graphics (Cannonlake 3x8 GT1)") CHIPSET(0x5A44, cnl_3x8, "Intel(R) HD Graphics (Cannonlake 3x8 GT1)") CHIPSET(0x5A59, cnl_4x8, "Intel(R) HD Graphics (Cannonlake 4x8 GT1.5)") CHIPSET(0x5A5A, cnl_4x8, "Intel(R) HD Graphics (Cannonlake 4x8 GT1.5)") CHIPSET(0x5A5C, cnl_4x8, "Intel(R) HD Graphics (Cannonlake 4x8 GT1.5)") CHIPSET(0x5A50, cnl_5x8, "Intel(R) HD Graphics (Cannonlake 5x8 GT2)") CHIPSET(0x5A51, cnl_5x8, "Intel(R) HD Graphics (Cannonlake 5x8 GT2)") CHIPSET(0x5A52, cnl_5x8, "Intel(R) HD Graphics (Cannonlake 5x8 GT2)") CHIPSET(0x5A54, cnl_5x8, "Intel(R) HD Graphics (Cannonlake 5x8 GT2)") CHIPSET(0x8A50, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") CHIPSET(0x8A51, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") CHIPSET(0x8A52, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") CHIPSET(0x8A53, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") CHIPSET(0x8A54, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") CHIPSET(0x8A56, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") CHIPSET(0x8A57, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") CHIPSET(0x8A58, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") CHIPSET(0x8A59, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") CHIPSET(0x8A5A, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") CHIPSET(0x8A5B, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") CHIPSET(0x8A5C, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") CHIPSET(0x8A5D, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") CHIPSET(0x8A71, icl_1x8, "Intel(R) HD Graphics (Ice Lake 1x8 GT0.5)") CHIPSET(0x4500, ehl_4x8, "Intel(R) HD Graphics (Elkhart Lake 4x8)") CHIPSET(0x4571, ehl_4x8, "Intel(R) HD Graphics (Elkhart Lake 4x8)") CHIPSET(0x4551, ehl_4x4, "Intel(R) HD Graphics (Elkhart Lake 4x4)") CHIPSET(0x4541, ehl_2x4, "Intel(R) HD Graphics (Elkhart Lake 2x4)") xorg-server-1.20.8/hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h0000644000175000017500000001737513640201473020651 00000000000000CHIPSET(0x6780, TAHITI_6780, TAHITI) CHIPSET(0x6784, TAHITI_6784, TAHITI) CHIPSET(0x6788, TAHITI_6788, TAHITI) CHIPSET(0x678A, TAHITI_678A, TAHITI) CHIPSET(0x6790, TAHITI_6790, TAHITI) CHIPSET(0x6791, TAHITI_6791, TAHITI) CHIPSET(0x6792, TAHITI_6792, TAHITI) CHIPSET(0x6798, TAHITI_6798, TAHITI) CHIPSET(0x6799, TAHITI_6799, TAHITI) CHIPSET(0x679A, TAHITI_679A, TAHITI) CHIPSET(0x679B, TAHITI_679B, TAHITI) CHIPSET(0x679E, TAHITI_679E, TAHITI) CHIPSET(0x679F, TAHITI_679F, TAHITI) CHIPSET(0x6800, PITCAIRN_6800, PITCAIRN) CHIPSET(0x6801, PITCAIRN_6801, PITCAIRN) CHIPSET(0x6802, PITCAIRN_6802, PITCAIRN) CHIPSET(0x6806, PITCAIRN_6806, PITCAIRN) CHIPSET(0x6808, PITCAIRN_6808, PITCAIRN) CHIPSET(0x6809, PITCAIRN_6809, PITCAIRN) CHIPSET(0x6810, PITCAIRN_6810, PITCAIRN) CHIPSET(0x6811, PITCAIRN_6811, PITCAIRN) CHIPSET(0x6816, PITCAIRN_6816, PITCAIRN) CHIPSET(0x6817, PITCAIRN_6817, PITCAIRN) CHIPSET(0x6818, PITCAIRN_6818, PITCAIRN) CHIPSET(0x6819, PITCAIRN_6819, PITCAIRN) CHIPSET(0x684C, PITCAIRN_684C, PITCAIRN) CHIPSET(0x6820, VERDE_6820, VERDE) CHIPSET(0x6821, VERDE_6821, VERDE) CHIPSET(0x6822, VERDE_6822, VERDE) CHIPSET(0x6823, VERDE_6823, VERDE) CHIPSET(0x6824, VERDE_6824, VERDE) CHIPSET(0x6825, VERDE_6825, VERDE) CHIPSET(0x6826, VERDE_6826, VERDE) CHIPSET(0x6827, VERDE_6827, VERDE) CHIPSET(0x6828, VERDE_6828, VERDE) CHIPSET(0x6829, VERDE_6829, VERDE) CHIPSET(0x682A, VERDE_682A, VERDE) CHIPSET(0x682B, VERDE_682B, VERDE) CHIPSET(0x682C, VERDE_682C, VERDE) CHIPSET(0x682D, VERDE_682D, VERDE) CHIPSET(0x682F, VERDE_682F, VERDE) CHIPSET(0x6830, VERDE_6830, VERDE) CHIPSET(0x6831, VERDE_6831, VERDE) CHIPSET(0x6835, VERDE_6835, VERDE) CHIPSET(0x6837, VERDE_6837, VERDE) CHIPSET(0x6838, VERDE_6838, VERDE) CHIPSET(0x6839, VERDE_6839, VERDE) CHIPSET(0x683B, VERDE_683B, VERDE) CHIPSET(0x683D, VERDE_683D, VERDE) CHIPSET(0x683F, VERDE_683F, VERDE) CHIPSET(0x6600, OLAND_6600, OLAND) CHIPSET(0x6601, OLAND_6601, OLAND) CHIPSET(0x6602, OLAND_6602, OLAND) CHIPSET(0x6603, OLAND_6603, OLAND) CHIPSET(0x6604, OLAND_6604, OLAND) CHIPSET(0x6605, OLAND_6605, OLAND) CHIPSET(0x6606, OLAND_6606, OLAND) CHIPSET(0x6607, OLAND_6607, OLAND) CHIPSET(0x6608, OLAND_6608, OLAND) CHIPSET(0x6610, OLAND_6610, OLAND) CHIPSET(0x6611, OLAND_6611, OLAND) CHIPSET(0x6613, OLAND_6613, OLAND) CHIPSET(0x6617, OLAND_6617, OLAND) CHIPSET(0x6620, OLAND_6620, OLAND) CHIPSET(0x6621, OLAND_6621, OLAND) CHIPSET(0x6623, OLAND_6623, OLAND) CHIPSET(0x6631, OLAND_6631, OLAND) CHIPSET(0x6660, HAINAN_6660, HAINAN) CHIPSET(0x6663, HAINAN_6663, HAINAN) CHIPSET(0x6664, HAINAN_6664, HAINAN) CHIPSET(0x6665, HAINAN_6665, HAINAN) CHIPSET(0x6667, HAINAN_6667, HAINAN) CHIPSET(0x666F, HAINAN_666F, HAINAN) CHIPSET(0x6640, BONAIRE_6640, BONAIRE) CHIPSET(0x6641, BONAIRE_6641, BONAIRE) CHIPSET(0x6646, BONAIRE_6646, BONAIRE) CHIPSET(0x6647, BONAIRE_6647, BONAIRE) CHIPSET(0x6649, BONAIRE_6649, BONAIRE) CHIPSET(0x6650, BONAIRE_6650, BONAIRE) CHIPSET(0x6651, BONAIRE_6651, BONAIRE) CHIPSET(0x6658, BONAIRE_6658, BONAIRE) CHIPSET(0x665C, BONAIRE_665C, BONAIRE) CHIPSET(0x665D, BONAIRE_665D, BONAIRE) CHIPSET(0x665F, BONAIRE_665F, BONAIRE) CHIPSET(0x9830, KABINI_9830, KABINI) CHIPSET(0x9831, KABINI_9831, KABINI) CHIPSET(0x9832, KABINI_9832, KABINI) CHIPSET(0x9833, KABINI_9833, KABINI) CHIPSET(0x9834, KABINI_9834, KABINI) CHIPSET(0x9835, KABINI_9835, KABINI) CHIPSET(0x9836, KABINI_9836, KABINI) CHIPSET(0x9837, KABINI_9837, KABINI) CHIPSET(0x9838, KABINI_9838, KABINI) CHIPSET(0x9839, KABINI_9839, KABINI) CHIPSET(0x983A, KABINI_983A, KABINI) CHIPSET(0x983B, KABINI_983B, KABINI) CHIPSET(0x983C, KABINI_983C, KABINI) CHIPSET(0x983D, KABINI_983D, KABINI) CHIPSET(0x983E, KABINI_983E, KABINI) CHIPSET(0x983F, KABINI_983F, KABINI) CHIPSET(0x9850, MULLINS_9850, MULLINS) CHIPSET(0x9851, MULLINS_9851, MULLINS) CHIPSET(0x9852, MULLINS_9852, MULLINS) CHIPSET(0x9853, MULLINS_9853, MULLINS) CHIPSET(0x9854, MULLINS_9854, MULLINS) CHIPSET(0x9855, MULLINS_9855, MULLINS) CHIPSET(0x9856, MULLINS_9856, MULLINS) CHIPSET(0x9857, MULLINS_9857, MULLINS) CHIPSET(0x9858, MULLINS_9858, MULLINS) CHIPSET(0x9859, MULLINS_9859, MULLINS) CHIPSET(0x985A, MULLINS_985A, MULLINS) CHIPSET(0x985B, MULLINS_985B, MULLINS) CHIPSET(0x985C, MULLINS_985C, MULLINS) CHIPSET(0x985D, MULLINS_985D, MULLINS) CHIPSET(0x985E, MULLINS_985E, MULLINS) CHIPSET(0x985F, MULLINS_985F, MULLINS) CHIPSET(0x1304, KAVERI_1304, KAVERI) CHIPSET(0x1305, KAVERI_1305, KAVERI) CHIPSET(0x1306, KAVERI_1306, KAVERI) CHIPSET(0x1307, KAVERI_1307, KAVERI) CHIPSET(0x1309, KAVERI_1309, KAVERI) CHIPSET(0x130A, KAVERI_130A, KAVERI) CHIPSET(0x130B, KAVERI_130B, KAVERI) CHIPSET(0x130C, KAVERI_130C, KAVERI) CHIPSET(0x130D, KAVERI_130D, KAVERI) CHIPSET(0x130E, KAVERI_130E, KAVERI) CHIPSET(0x130F, KAVERI_130F, KAVERI) CHIPSET(0x1310, KAVERI_1310, KAVERI) CHIPSET(0x1311, KAVERI_1311, KAVERI) CHIPSET(0x1312, KAVERI_1312, KAVERI) CHIPSET(0x1313, KAVERI_1313, KAVERI) CHIPSET(0x1315, KAVERI_1315, KAVERI) CHIPSET(0x1316, KAVERI_1316, KAVERI) CHIPSET(0x1317, KAVERI_1317, KAVERI) CHIPSET(0x1318, KAVERI_1318, KAVERI) CHIPSET(0x131B, KAVERI_131B, KAVERI) CHIPSET(0x131C, KAVERI_131C, KAVERI) CHIPSET(0x131D, KAVERI_131D, KAVERI) CHIPSET(0x67A0, HAWAII_67A0, HAWAII) CHIPSET(0x67A1, HAWAII_67A1, HAWAII) CHIPSET(0x67A2, HAWAII_67A2, HAWAII) CHIPSET(0x67A8, HAWAII_67A8, HAWAII) CHIPSET(0x67A9, HAWAII_67A9, HAWAII) CHIPSET(0x67AA, HAWAII_67AA, HAWAII) CHIPSET(0x67B0, HAWAII_67B0, HAWAII) CHIPSET(0x67B1, HAWAII_67B1, HAWAII) CHIPSET(0x67B8, HAWAII_67B8, HAWAII) CHIPSET(0x67B9, HAWAII_67B9, HAWAII) CHIPSET(0x67BA, HAWAII_67BA, HAWAII) CHIPSET(0x67BE, HAWAII_67BE, HAWAII) CHIPSET(0x6900, ICELAND_, ICELAND) CHIPSET(0x6901, ICELAND_, ICELAND) CHIPSET(0x6902, ICELAND_, ICELAND) CHIPSET(0x6903, ICELAND_, ICELAND) CHIPSET(0x6907, ICELAND_, ICELAND) CHIPSET(0x6920, TONGA_, TONGA) CHIPSET(0x6921, TONGA_, TONGA) CHIPSET(0x6928, TONGA_, TONGA) CHIPSET(0x6929, TONGA_, TONGA) CHIPSET(0x692B, TONGA_, TONGA) CHIPSET(0x692F, TONGA_, TONGA) CHIPSET(0x6930, TONGA_, TONGA) CHIPSET(0x6938, TONGA_, TONGA) CHIPSET(0x6939, TONGA_, TONGA) CHIPSET(0x9870, CARRIZO_, CARRIZO) CHIPSET(0x9874, CARRIZO_, CARRIZO) CHIPSET(0x9875, CARRIZO_, CARRIZO) CHIPSET(0x9876, CARRIZO_, CARRIZO) CHIPSET(0x9877, CARRIZO_, CARRIZO) CHIPSET(0x7300, FIJI_, FIJI) CHIPSET(0x67E0, POLARIS11_, POLARIS11) CHIPSET(0x67E1, POLARIS11_, POLARIS11) CHIPSET(0x67E3, POLARIS11_, POLARIS11) CHIPSET(0x67E7, POLARIS11_, POLARIS11) CHIPSET(0x67E8, POLARIS11_, POLARIS11) CHIPSET(0x67E9, POLARIS11_, POLARIS11) CHIPSET(0x67EB, POLARIS11_, POLARIS11) CHIPSET(0x67EF, POLARIS11_, POLARIS11) CHIPSET(0x67FF, POLARIS11_, POLARIS11) CHIPSET(0x67C0, POLARIS10_, POLARIS10) CHIPSET(0x67C1, POLARIS10_, POLARIS10) CHIPSET(0x67C2, POLARIS10_, POLARIS10) CHIPSET(0x67C4, POLARIS10_, POLARIS10) CHIPSET(0x67C7, POLARIS10_, POLARIS10) CHIPSET(0x67C8, POLARIS10_, POLARIS10) CHIPSET(0x67C9, POLARIS10_, POLARIS10) CHIPSET(0x67CA, POLARIS10_, POLARIS10) CHIPSET(0x67CC, POLARIS10_, POLARIS10) CHIPSET(0x67CF, POLARIS10_, POLARIS10) CHIPSET(0x67DF, POLARIS10_, POLARIS10) CHIPSET(0x98E4, STONEY_, STONEY) CHIPSET(0x6980, POLARIS12_, POLARIS12) CHIPSET(0x6981, POLARIS12_, POLARIS12) CHIPSET(0x6985, POLARIS12_, POLARIS12) CHIPSET(0x6986, POLARIS12_, POLARIS12) CHIPSET(0x6987, POLARIS12_, POLARIS12) CHIPSET(0x6995, POLARIS12_, POLARIS12) CHIPSET(0x6997, POLARIS12_, POLARIS12) CHIPSET(0x699F, POLARIS12_, POLARIS12) CHIPSET(0x694C, VEGAM_, VEGAM) CHIPSET(0x694E, VEGAM_, VEGAM) CHIPSET(0x6860, VEGA10_, VEGA10) CHIPSET(0x6861, VEGA10_, VEGA10) CHIPSET(0x6862, VEGA10_, VEGA10) CHIPSET(0x6863, VEGA10_, VEGA10) CHIPSET(0x6864, VEGA10_, VEGA10) CHIPSET(0x6867, VEGA10_, VEGA10) CHIPSET(0x6868, VEGA10_, VEGA10) CHIPSET(0x687F, VEGA10_, VEGA10) CHIPSET(0x686C, VEGA10_, VEGA10) CHIPSET(0x69A0, VEGA12_, VEGA12) CHIPSET(0x69A1, VEGA12_, VEGA12) CHIPSET(0x69A2, VEGA12_, VEGA12) CHIPSET(0x69A3, VEGA12_, VEGA12) CHIPSET(0x69AF, VEGA12_, VEGA12) CHIPSET(0x15DD, RAVEN_, RAVEN) xorg-server-1.20.8/hw/xfree86/dri2/Makefile.in0000644000175000017500000010074013640201512015614 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/dri2 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdri2_la_LIBADD = am_libdri2_la_OBJECTS = dri2.lo dri2ext.lo libdri2_la_OBJECTS = $(am_libdri2_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dri2.Plo ./$(DEPDIR)/dri2ext.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdri2_la_SOURCES) DIST_SOURCES = $(libdri2_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = pci_ids noinst_LTLIBRARIES = libdri2.la AM_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ @DIX_CFLAGS@ @XORG_CFLAGS@ \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support/bus libdri2_la_SOURCES = \ dri2.c \ dri2.h \ dri2ext.c \ dri2int.h sdk_HEADERS = dri2.h all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dri2/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/dri2/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdri2.la: $(libdri2_la_OBJECTS) $(libdri2_la_DEPENDENCIES) $(EXTRA_libdri2_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libdri2_la_OBJECTS) $(libdri2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri2ext.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/dri2.Plo -rm -f ./$(DEPDIR)/dri2ext.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/dri2.Plo -rm -f ./$(DEPDIR)/dri2ext.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-sdkHEADERS install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/dri2/dri2ext.c0000644000175000017500000004521113640201473015303 00000000000000/* * Copyright © 2008 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Soft- * ware"), to deal in the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, provided that the above copyright * notice(s) and this permission notice appear in all copies of the Soft- * ware and that both the above copyright notice(s) and this permission * notice appear in supporting documentation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- * QUENTIAL 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 PERFOR- * MANCE OF THIS SOFTWARE. * * Except as contained in this notice, the name of a copyright holder shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization of * the copyright holder. * * Authors: * Kristian Høgsberg (krh@redhat.com) */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "dixstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "xfixes.h" #include "dri2.h" #include "dri2int.h" #include "protocol-versions.h" /* The only xf86 includes */ #include "xf86Module.h" #include "xf86Extensions.h" static int DRI2EventBase; static Bool validDrawable(ClientPtr client, XID drawable, Mask access_mode, DrawablePtr *pDrawable, int *status) { *status = dixLookupDrawable(pDrawable, drawable, client, M_DRAWABLE_WINDOW | M_DRAWABLE_PIXMAP, access_mode); if (*status != Success) { client->errorValue = drawable; return FALSE; } return TRUE; } static int ProcDRI2QueryVersion(ClientPtr client) { REQUEST(xDRI2QueryVersionReq); xDRI2QueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = dri2_major, .minorVersion = dri2_minor }; if (client->swapped) swaps(&stuff->length); REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep); return Success; } static int ProcDRI2Connect(ClientPtr client) { REQUEST(xDRI2ConnectReq); xDRI2ConnectReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .driverNameLength = 0, .deviceNameLength = 0 }; DrawablePtr pDraw; int fd, status; const char *driverName; const char *deviceName; REQUEST_SIZE_MATCH(xDRI2ConnectReq); if (!validDrawable(client, stuff->window, DixGetAttrAccess, &pDraw, &status)) return status; if (!DRI2Connect(client, pDraw->pScreen, stuff->driverType, &fd, &driverName, &deviceName)) goto fail; rep.driverNameLength = strlen(driverName); rep.deviceNameLength = strlen(deviceName); rep.length = (rep.driverNameLength + 3) / 4 + (rep.deviceNameLength + 3) / 4; fail: WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); WriteToClient(client, rep.driverNameLength, driverName); WriteToClient(client, rep.deviceNameLength, deviceName); return Success; } static int ProcDRI2Authenticate(ClientPtr client) { REQUEST(xDRI2AuthenticateReq); xDRI2AuthenticateReply rep; DrawablePtr pDraw; int status; REQUEST_SIZE_MATCH(xDRI2AuthenticateReq); if (!validDrawable(client, stuff->window, DixGetAttrAccess, &pDraw, &status)) return status; rep = (xDRI2AuthenticateReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic) }; WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); return Success; } static void DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv, XID id) { ClientPtr client = priv; xDRI2InvalidateBuffers event = { .type = DRI2EventBase + DRI2_InvalidateBuffers, .drawable = id }; WriteEventsToClient(client, 1, (xEvent *) &event); } static int ProcDRI2CreateDrawable(ClientPtr client) { REQUEST(xDRI2CreateDrawableReq); DrawablePtr pDrawable; int status; REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq); if (!validDrawable(client, stuff->drawable, DixAddAccess, &pDrawable, &status)) return status; status = DRI2CreateDrawable(client, pDrawable, stuff->drawable, DRI2InvalidateBuffersEvent, client); if (status != Success) return status; return Success; } static int ProcDRI2DestroyDrawable(ClientPtr client) { REQUEST(xDRI2DestroyDrawableReq); DrawablePtr pDrawable; int status; REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq); if (!validDrawable(client, stuff->drawable, DixRemoveAccess, &pDrawable, &status)) return status; return Success; } static int send_buffers_reply(ClientPtr client, DrawablePtr pDrawable, DRI2BufferPtr * buffers, int count, int width, int height) { xDRI2GetBuffersReply rep; int skip = 0; int i; if (buffers == NULL) return BadAlloc; if (pDrawable->type == DRAWABLE_WINDOW) { for (i = 0; i < count; i++) { /* Do not send the real front buffer of a window to the client. */ if (buffers[i]->attachment == DRI2BufferFrontLeft) { skip++; continue; } } } rep = (xDRI2GetBuffersReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = (count - skip) * sizeof(xDRI2Buffer) / 4, .width = width, .height = height, .count = count - skip }; WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep); for (i = 0; i < count; i++) { xDRI2Buffer buffer; /* Do not send the real front buffer of a window to the client. */ if ((pDrawable->type == DRAWABLE_WINDOW) && (buffers[i]->attachment == DRI2BufferFrontLeft)) { continue; } buffer.attachment = buffers[i]->attachment; buffer.name = buffers[i]->name; buffer.pitch = buffers[i]->pitch; buffer.cpp = buffers[i]->cpp; buffer.flags = buffers[i]->flags; WriteToClient(client, sizeof(xDRI2Buffer), &buffer); } return Success; } static int ProcDRI2GetBuffers(ClientPtr client) { REQUEST(xDRI2GetBuffersReq); DrawablePtr pDrawable; DRI2BufferPtr *buffers; int status, width, height, count; unsigned int *attachments; REQUEST_AT_LEAST_SIZE(xDRI2GetBuffersReq); /* stuff->count is a count of CARD32 attachments that follows */ if (stuff->count > (INT_MAX / sizeof(CARD32))) return BadLength; REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * sizeof(CARD32)); if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess, &pDrawable, &status)) return status; if (DRI2ThrottleClient(client, pDrawable)) return Success; attachments = (unsigned int *) &stuff[1]; buffers = DRI2GetBuffers(pDrawable, &width, &height, attachments, stuff->count, &count); return send_buffers_reply(client, pDrawable, buffers, count, width, height); } static int ProcDRI2GetBuffersWithFormat(ClientPtr client) { REQUEST(xDRI2GetBuffersReq); DrawablePtr pDrawable; DRI2BufferPtr *buffers; int status, width, height, count; unsigned int *attachments; REQUEST_AT_LEAST_SIZE(xDRI2GetBuffersReq); /* stuff->count is a count of pairs of CARD32s (attachments & formats) that follows */ if (stuff->count > (INT_MAX / (2 * sizeof(CARD32)))) return BadLength; REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * (2 * sizeof(CARD32))); if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess, &pDrawable, &status)) return status; if (DRI2ThrottleClient(client, pDrawable)) return Success; attachments = (unsigned int *) &stuff[1]; buffers = DRI2GetBuffersWithFormat(pDrawable, &width, &height, attachments, stuff->count, &count); return send_buffers_reply(client, pDrawable, buffers, count, width, height); } static int ProcDRI2CopyRegion(ClientPtr client) { REQUEST(xDRI2CopyRegionReq); xDRI2CopyRegionReply rep; DrawablePtr pDrawable; int status; RegionPtr pRegion; REQUEST_SIZE_MATCH(xDRI2CopyRegionReq); if (!validDrawable(client, stuff->drawable, DixWriteAccess, &pDrawable, &status)) return status; VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess); status = DRI2CopyRegion(pDrawable, pRegion, stuff->dest, stuff->src); if (status != Success) return status; /* CopyRegion needs to be a round trip to make sure the X server * queues the swap buffer rendering commands before the DRI client * continues rendering. The reply has a bitmask to signal the * presense of optional return values as well, but we're not using * that yet. */ rep = (xDRI2CopyRegionReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; WriteToClient(client, sizeof(xDRI2CopyRegionReply), &rep); return Success; } static void load_swap_reply(xDRI2SwapBuffersReply * rep, CARD64 sbc) { rep->swap_hi = sbc >> 32; rep->swap_lo = sbc & 0xffffffff; } static CARD64 vals_to_card64(CARD32 lo, CARD32 hi) { return (CARD64) hi << 32 | lo; } static void DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, CARD32 sbc) { DrawablePtr pDrawable = data; xDRI2BufferSwapComplete2 event = { .type = DRI2EventBase + DRI2_BufferSwapComplete, .event_type = type, .drawable = pDrawable->id, .ust_hi = (CARD64) ust >> 32, .ust_lo = ust & 0xffffffff, .msc_hi = (CARD64) msc >> 32, .msc_lo = msc & 0xffffffff, .sbc = sbc }; WriteEventsToClient(client, 1, (xEvent *) &event); } static int ProcDRI2SwapBuffers(ClientPtr client) { REQUEST(xDRI2SwapBuffersReq); xDRI2SwapBuffersReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; DrawablePtr pDrawable; CARD64 target_msc, divisor, remainder, swap_target; int status; REQUEST_SIZE_MATCH(xDRI2SwapBuffersReq); if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess, &pDrawable, &status)) return status; /* * Ensures an out of control client can't exhaust our swap queue, and * also orders swaps. */ if (DRI2ThrottleClient(client, pDrawable)) return Success; target_msc = vals_to_card64(stuff->target_msc_lo, stuff->target_msc_hi); divisor = vals_to_card64(stuff->divisor_lo, stuff->divisor_hi); remainder = vals_to_card64(stuff->remainder_lo, stuff->remainder_hi); status = DRI2SwapBuffers(client, pDrawable, target_msc, divisor, remainder, &swap_target, DRI2SwapEvent, pDrawable); if (status != Success) return BadDrawable; load_swap_reply(&rep, swap_target); WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep); return Success; } static void load_msc_reply(xDRI2MSCReply * rep, CARD64 ust, CARD64 msc, CARD64 sbc) { rep->ust_hi = ust >> 32; rep->ust_lo = ust & 0xffffffff; rep->msc_hi = msc >> 32; rep->msc_lo = msc & 0xffffffff; rep->sbc_hi = sbc >> 32; rep->sbc_lo = sbc & 0xffffffff; } static int ProcDRI2GetMSC(ClientPtr client) { REQUEST(xDRI2GetMSCReq); xDRI2MSCReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; DrawablePtr pDrawable; CARD64 ust, msc, sbc; int status; REQUEST_SIZE_MATCH(xDRI2GetMSCReq); if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable, &status)) return status; status = DRI2GetMSC(pDrawable, &ust, &msc, &sbc); if (status != Success) return status; load_msc_reply(&rep, ust, msc, sbc); WriteToClient(client, sizeof(xDRI2MSCReply), &rep); return Success; } static int ProcDRI2WaitMSC(ClientPtr client) { REQUEST(xDRI2WaitMSCReq); DrawablePtr pDrawable; CARD64 target, divisor, remainder; int status; /* FIXME: in restart case, client may be gone at this point */ REQUEST_SIZE_MATCH(xDRI2WaitMSCReq); if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable, &status)) return status; target = vals_to_card64(stuff->target_msc_lo, stuff->target_msc_hi); divisor = vals_to_card64(stuff->divisor_lo, stuff->divisor_hi); remainder = vals_to_card64(stuff->remainder_lo, stuff->remainder_hi); status = DRI2WaitMSC(client, pDrawable, target, divisor, remainder); if (status != Success) return status; return Success; } int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc) { xDRI2MSCReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; load_msc_reply(&rep, ust, msc, sbc); WriteToClient(client, sizeof(xDRI2MSCReply), &rep); return Success; } static int ProcDRI2SwapInterval(ClientPtr client) { REQUEST(xDRI2SwapIntervalReq); DrawablePtr pDrawable; int status; /* FIXME: in restart case, client may be gone at this point */ REQUEST_SIZE_MATCH(xDRI2SwapIntervalReq); if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess, &pDrawable, &status)) return status; DRI2SwapInterval(pDrawable, stuff->interval); return Success; } static int ProcDRI2WaitSBC(ClientPtr client) { REQUEST(xDRI2WaitSBCReq); DrawablePtr pDrawable; CARD64 target; int status; REQUEST_SIZE_MATCH(xDRI2WaitSBCReq); if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable, &status)) return status; target = vals_to_card64(stuff->target_sbc_lo, stuff->target_sbc_hi); status = DRI2WaitSBC(client, pDrawable, target); return status; } static int ProcDRI2GetParam(ClientPtr client) { REQUEST(xDRI2GetParamReq); xDRI2GetParamReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; DrawablePtr pDrawable; CARD64 value; int status; REQUEST_SIZE_MATCH(xDRI2GetParamReq); if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable, &status)) return status; status = DRI2GetParam(client, pDrawable, stuff->param, &rep.is_param_recognized, &value); rep.value_hi = value >> 32; rep.value_lo = value & 0xffffffff; if (status != Success) return status; WriteToClient(client, sizeof(xDRI2GetParamReply), &rep); return status; } static int ProcDRI2Dispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_DRI2QueryVersion: return ProcDRI2QueryVersion(client); } if (!client->local) return BadRequest; switch (stuff->data) { case X_DRI2Connect: return ProcDRI2Connect(client); case X_DRI2Authenticate: return ProcDRI2Authenticate(client); case X_DRI2CreateDrawable: return ProcDRI2CreateDrawable(client); case X_DRI2DestroyDrawable: return ProcDRI2DestroyDrawable(client); case X_DRI2GetBuffers: return ProcDRI2GetBuffers(client); case X_DRI2CopyRegion: return ProcDRI2CopyRegion(client); case X_DRI2GetBuffersWithFormat: return ProcDRI2GetBuffersWithFormat(client); case X_DRI2SwapBuffers: return ProcDRI2SwapBuffers(client); case X_DRI2GetMSC: return ProcDRI2GetMSC(client); case X_DRI2WaitMSC: return ProcDRI2WaitMSC(client); case X_DRI2WaitSBC: return ProcDRI2WaitSBC(client); case X_DRI2SwapInterval: return ProcDRI2SwapInterval(client); case X_DRI2GetParam: return ProcDRI2GetParam(client); default: return BadRequest; } } static int _X_COLD SProcDRI2Connect(ClientPtr client) { REQUEST(xDRI2ConnectReq); xDRI2ConnectReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .driverNameLength = 0, .deviceNameLength = 0 }; /* If the client is swapped, it's not local. Talk to the hand. */ swaps(&stuff->length); if (sizeof(*stuff) / 4 != client->req_len) return BadLength; swaps(&rep.sequenceNumber); WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); return Success; } static int _X_COLD SProcDRI2Dispatch(ClientPtr client) { REQUEST(xReq); /* * Only local clients are allowed DRI access, but remote clients * still need these requests to find out cleanly. */ switch (stuff->data) { case X_DRI2QueryVersion: return ProcDRI2QueryVersion(client); case X_DRI2Connect: return SProcDRI2Connect(client); default: return BadRequest; } } void DRI2ExtensionInit(void) { ExtensionEntry *dri2Extension; #ifdef PANORAMIX if (!noPanoramiXExtension) return; #endif dri2Extension = AddExtension(DRI2_NAME, DRI2NumberEvents, DRI2NumberErrors, ProcDRI2Dispatch, SProcDRI2Dispatch, NULL, StandardMinorOpcode); DRI2EventBase = dri2Extension->eventBase; DRI2ModuleSetup(); } xorg-server-1.20.8/hw/xfree86/dri2/dri2int.h0000644000175000017500000000232513640201473015301 00000000000000/* * Copyright © 2011 Daniel Stone * * 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. * * Author: Daniel Stone */ extern Bool DRI2ModuleSetup(void); xorg-server-1.20.8/hw/xfree86/dri2/dri2.c0000644000175000017500000013711713640201473014571 00000000000000/* * Copyright © 2007, 2008 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Soft- * ware"), to deal in the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, provided that the above copyright * notice(s) and this permission notice appear in all copies of the Soft- * ware and that both the above copyright notice(s) and this permission * notice appear in supporting documentation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- * QUENTIAL 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 PERFOR- * MANCE OF THIS SOFTWARE. * * Except as contained in this notice, the name of a copyright holder shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization of * the copyright holder. * * Authors: * Kristian Høgsberg (krh@redhat.com) */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #ifdef WITH_LIBDRM #include #endif #include "xf86Module.h" #include "list.h" #include "scrnintstr.h" #include "windowstr.h" #include "dixstruct.h" #include "dri2.h" #include "dri2int.h" #include "xf86VGAarbiter.h" #include "damage.h" #include "xf86.h" CARD8 dri2_major; /* version of DRI2 supported by DDX */ CARD8 dri2_minor; uint32_t prime_id_allocate_bitmask; static DevPrivateKeyRec dri2ScreenPrivateKeyRec; #define dri2ScreenPrivateKey (&dri2ScreenPrivateKeyRec) static DevPrivateKeyRec dri2WindowPrivateKeyRec; #define dri2WindowPrivateKey (&dri2WindowPrivateKeyRec) static DevPrivateKeyRec dri2PixmapPrivateKeyRec; #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec) static DevPrivateKeyRec dri2ClientPrivateKeyRec; #define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec) #define dri2ClientPrivate(_pClient) (dixLookupPrivate(&(_pClient)->devPrivates, \ dri2ClientPrivateKey)) typedef struct _DRI2Client { int prime_id; } DRI2ClientRec, *DRI2ClientPtr; static RESTYPE dri2DrawableRes; typedef struct _DRI2Screen *DRI2ScreenPtr; typedef struct _DRI2Drawable { DRI2ScreenPtr dri2_screen; DrawablePtr drawable; struct xorg_list reference_list; int width; int height; DRI2BufferPtr *buffers; int bufferCount; unsigned int swapsPending; int swap_interval; CARD64 swap_count; int64_t target_sbc; /* -1 means no SBC wait outstanding */ CARD64 last_swap_target; /* most recently queued swap target */ CARD64 last_swap_msc; /* msc at completion of most recent swap */ CARD64 last_swap_ust; /* ust at completion of most recent swap */ int swap_limit; /* for N-buffering */ unsigned blocked[3]; Bool needInvalidate; int prime_id; PixmapPtr prime_slave_pixmap; PixmapPtr redirectpixmap; } DRI2DrawableRec, *DRI2DrawablePtr; typedef struct _DRI2Screen { ScreenPtr screen; int refcnt; unsigned int numDrivers; const char **driverNames; const char *deviceName; int fd; unsigned int lastSequence; int prime_id; DRI2CreateBufferProcPtr CreateBuffer; DRI2DestroyBufferProcPtr DestroyBuffer; DRI2CopyRegionProcPtr CopyRegion; DRI2ScheduleSwapProcPtr ScheduleSwap; DRI2GetMSCProcPtr GetMSC; DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; DRI2AuthMagic2ProcPtr AuthMagic; DRI2AuthMagicProcPtr LegacyAuthMagic; DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; DRI2SwapLimitValidateProcPtr SwapLimitValidate; DRI2GetParamProcPtr GetParam; HandleExposuresProcPtr HandleExposures; ConfigNotifyProcPtr ConfigNotify; SetWindowPixmapProcPtr SetWindowPixmap; DRI2CreateBuffer2ProcPtr CreateBuffer2; DRI2DestroyBuffer2ProcPtr DestroyBuffer2; DRI2CopyRegion2ProcPtr CopyRegion2; } DRI2ScreenRec; static void destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, int prime_id); enum DRI2WakeType { WAKE_SBC, WAKE_MSC, WAKE_SWAP, }; #define Wake(c, t) (void *)((uintptr_t)(c) | (t)) static Bool dri2WakeClient(ClientPtr client, void *closure) { ClientWakeup(client); return TRUE; } static Bool dri2WakeAll(ClientPtr client, DRI2DrawablePtr pPriv, enum DRI2WakeType t) { int count; if (!pPriv->blocked[t]) return FALSE; count = ClientSignalAll(client, dri2WakeClient, Wake(pPriv, t)); pPriv->blocked[t] -= count; return count; } static Bool dri2Sleep(ClientPtr client, DRI2DrawablePtr pPriv, enum DRI2WakeType t) { if (ClientSleep(client, dri2WakeClient, Wake(pPriv, t))) { pPriv->blocked[t]++; return TRUE; } return FALSE; } static DRI2ScreenPtr DRI2GetScreen(ScreenPtr pScreen) { return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey); } static ScreenPtr GetScreenPrime(ScreenPtr master, int prime_id) { ScreenPtr slave; if (prime_id == 0) { return master; } xorg_list_for_each_entry(slave, &master->slave_list, slave_head) { DRI2ScreenPtr ds; if (!slave->is_offload_slave) continue; ds = DRI2GetScreen(slave); if (ds == NULL) continue; if (ds->prime_id == prime_id) return slave; } return master; } static DRI2ScreenPtr DRI2GetScreenPrime(ScreenPtr master, int prime_id) { ScreenPtr slave = GetScreenPrime(master, prime_id); return DRI2GetScreen(slave); } static DRI2DrawablePtr DRI2GetDrawable(DrawablePtr pDraw) { WindowPtr pWin; PixmapPtr pPixmap; switch (pDraw->type) { case DRAWABLE_WINDOW: pWin = (WindowPtr) pDraw; return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); case DRAWABLE_PIXMAP: pPixmap = (PixmapPtr) pDraw; return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); default: return NULL; } } static DRI2DrawablePtr DRI2AllocateDrawable(DrawablePtr pDraw) { DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; CARD64 ust; WindowPtr pWin; PixmapPtr pPixmap; pPriv = malloc(sizeof *pPriv); if (pPriv == NULL) return NULL; pPriv->dri2_screen = ds; pPriv->drawable = pDraw; pPriv->width = pDraw->width; pPriv->height = pDraw->height; pPriv->buffers = NULL; pPriv->bufferCount = 0; pPriv->swapsPending = 0; pPriv->swap_count = 0; pPriv->target_sbc = -1; pPriv->swap_interval = 1; /* Initialize last swap target from DDX if possible */ if (!ds->GetMSC || !(*ds->GetMSC) (pDraw, &ust, &pPriv->last_swap_target)) pPriv->last_swap_target = 0; memset(pPriv->blocked, 0, sizeof(pPriv->blocked)); pPriv->swap_limit = 1; /* default to double buffering */ pPriv->last_swap_msc = 0; pPriv->last_swap_ust = 0; xorg_list_init(&pPriv->reference_list); pPriv->needInvalidate = FALSE; pPriv->redirectpixmap = NULL; pPriv->prime_slave_pixmap = NULL; if (pDraw->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv); } else { pPixmap = (PixmapPtr) pDraw; dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv); } return pPriv; } Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); DRI2ScreenPtr ds; if (!pPriv) return FALSE; ds = pPriv->dri2_screen; if (!ds->SwapLimitValidate || !ds->SwapLimitValidate(pDraw, swap_limit)) return FALSE; pPriv->swap_limit = swap_limit; /* Check throttling */ if (pPriv->swapsPending >= pPriv->swap_limit) return TRUE; dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); return TRUE; } typedef struct DRI2DrawableRefRec { XID id; XID dri2_id; DRI2InvalidateProcPtr invalidate; void *priv; struct xorg_list link; } DRI2DrawableRefRec, *DRI2DrawableRefPtr; static DRI2DrawableRefPtr DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id) { DRI2DrawableRefPtr ref; xorg_list_for_each_entry(ref, &pPriv->reference_list, link) { if (ref->id == id) return ref; } return NULL; } static int DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id, DRI2InvalidateProcPtr invalidate, void *priv) { DRI2DrawableRefPtr ref; ref = malloc(sizeof *ref); if (ref == NULL) return BadAlloc; if (!AddResource(dri2_id, dri2DrawableRes, pPriv)) { free(ref); return BadAlloc; } if (!DRI2LookupDrawableRef(pPriv, id)) if (!AddResource(id, dri2DrawableRes, pPriv)) { FreeResourceByType(dri2_id, dri2DrawableRes, TRUE); free(ref); return BadAlloc; } ref->id = id; ref->dri2_id = dri2_id; ref->invalidate = invalidate; ref->priv = priv; xorg_list_add(&ref->link, &pPriv->reference_list); return Success; } int DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id, DRI2InvalidateProcPtr invalidate, void *priv, XID *dri2_id_out) { DRI2DrawablePtr pPriv; DRI2ClientPtr dri2_client = dri2ClientPrivate(client); XID dri2_id; int rc; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) pPriv = DRI2AllocateDrawable(pDraw); if (pPriv == NULL) return BadAlloc; pPriv->prime_id = dri2_client->prime_id; dri2_id = FakeClientID(client->index); rc = DRI2AddDrawableRef(pPriv, id, dri2_id, invalidate, priv); if (rc != Success) return rc; if (dri2_id_out) *dri2_id_out = dri2_id; return Success; } int DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id, DRI2InvalidateProcPtr invalidate, void *priv) { return DRI2CreateDrawable2(client, pDraw, id, invalidate, priv, NULL); } static int DRI2DrawableGone(void *p, XID id) { DRI2DrawablePtr pPriv = p; DRI2DrawableRefPtr ref, next; WindowPtr pWin; PixmapPtr pPixmap; DrawablePtr pDraw; int i; xorg_list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) { if (ref->dri2_id == id) { xorg_list_del(&ref->link); /* If this was the last ref under this X drawable XID, * unregister the X drawable resource. */ if (!DRI2LookupDrawableRef(pPriv, ref->id)) FreeResourceByType(ref->id, dri2DrawableRes, TRUE); free(ref); break; } if (ref->id == id) { xorg_list_del(&ref->link); FreeResourceByType(ref->dri2_id, dri2DrawableRes, TRUE); free(ref); } } if (!xorg_list_is_empty(&pPriv->reference_list)) return Success; pDraw = pPriv->drawable; if (pDraw->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL); } else { pPixmap = (PixmapPtr) pDraw; dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL); } if (pPriv->prime_slave_pixmap) { (*pPriv->prime_slave_pixmap->master_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_slave_pixmap->master_pixmap); (*pPriv->prime_slave_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_slave_pixmap); } if (pPriv->buffers != NULL) { for (i = 0; i < pPriv->bufferCount; i++) destroy_buffer(pDraw, pPriv->buffers[i], pPriv->prime_id); free(pPriv->buffers); } if (pPriv->redirectpixmap) { (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); (*pDraw->pScreen->DestroyPixmap)(pPriv->redirectpixmap); } dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_MSC); dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SBC); free(pPriv); return Success; } static DRI2BufferPtr create_buffer(DRI2ScreenPtr ds, DrawablePtr pDraw, unsigned int attachment, unsigned int format) { DRI2BufferPtr buffer; if (ds->CreateBuffer2) buffer = (*ds->CreateBuffer2)(GetScreenPrime(pDraw->pScreen, DRI2GetDrawable(pDraw)->prime_id), pDraw, attachment, format); else buffer = (*ds->CreateBuffer)(pDraw, attachment, format); return buffer; } static void destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, int prime_id) { ScreenPtr primeScreen; DRI2ScreenPtr ds; primeScreen = GetScreenPrime(pDraw->pScreen, prime_id); ds = DRI2GetScreen(primeScreen); if (ds->DestroyBuffer2) (*ds->DestroyBuffer2)(primeScreen, pDraw, buffer); else (*ds->DestroyBuffer)(pDraw, buffer); } static int find_attachment(DRI2DrawablePtr pPriv, unsigned attachment) { int i; if (pPriv->buffers == NULL) { return -1; } for (i = 0; i < pPriv->bufferCount; i++) { if ((pPriv->buffers[i] != NULL) && (pPriv->buffers[i]->attachment == attachment)) { return i; } } return -1; } static Bool allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, DRI2DrawablePtr pPriv, unsigned int attachment, unsigned int format, int dimensions_match, DRI2BufferPtr * buffer) { int old_buf = find_attachment(pPriv, attachment); if ((old_buf < 0) || attachment == DRI2BufferFrontLeft || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) { *buffer = create_buffer(ds, pDraw, attachment, format); return TRUE; } else { *buffer = pPriv->buffers[old_buf]; if (ds->ReuseBufferNotify) (*ds->ReuseBufferNotify) (pDraw, *buffer); pPriv->buffers[old_buf] = NULL; return FALSE; } } static void update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw, DRI2BufferPtr * buffers, int out_count, int *width, int *height) { int i; if (pPriv->buffers != NULL) { for (i = 0; i < pPriv->bufferCount; i++) { if (pPriv->buffers[i] != NULL) { destroy_buffer(pDraw, pPriv->buffers[i], pPriv->prime_id); } } free(pPriv->buffers); } pPriv->buffers = buffers; pPriv->bufferCount = out_count; pPriv->width = pDraw->width; pPriv->height = pDraw->height; *width = pPriv->width; *height = pPriv->height; } static DRI2BufferPtr * do_get_buffers(DrawablePtr pDraw, int *width, int *height, unsigned int *attachments, int count, int *out_count, int has_format) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); DRI2ScreenPtr ds; DRI2BufferPtr *buffers; int need_real_front = 0; int need_fake_front = 0; int have_fake_front = 0; int front_format = 0; int dimensions_match; int buffers_changed = 0; int i; if (!pPriv) { *width = pDraw->width; *height = pDraw->height; *out_count = 0; return NULL; } ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id); dimensions_match = (pDraw->width == pPriv->width) && (pDraw->height == pPriv->height); buffers = calloc((count + 1), sizeof(buffers[0])); if (!buffers) goto err_out; for (i = 0; i < count; i++) { const unsigned attachment = *(attachments++); const unsigned format = (has_format) ? *(attachments++) : 0; if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment, format, dimensions_match, &buffers[i])) buffers_changed = 1; if (buffers[i] == NULL) goto err_out; /* If the drawable is a window and the front-buffer is requested, * silently add the fake front-buffer to the list of requested * attachments. The counting logic in the loop accounts for the case * where the client requests both the fake and real front-buffer. */ if (attachment == DRI2BufferBackLeft) { need_real_front++; front_format = format; } if (attachment == DRI2BufferFrontLeft) { need_real_front--; front_format = format; if (pDraw->type == DRAWABLE_WINDOW) { need_fake_front++; } } if (pDraw->type == DRAWABLE_WINDOW) { if (attachment == DRI2BufferFakeFrontLeft) { need_fake_front--; have_fake_front = 1; } } } if (need_real_front > 0) { if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft, front_format, dimensions_match, &buffers[i])) buffers_changed = 1; if (buffers[i] == NULL) goto err_out; i++; } if (need_fake_front > 0) { if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft, front_format, dimensions_match, &buffers[i])) buffers_changed = 1; if (buffers[i] == NULL) goto err_out; i++; have_fake_front = 1; } *out_count = i; update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height); /* If the client is getting a fake front-buffer, pre-fill it with the * contents of the real front-buffer. This ensures correct operation of * applications that call glXWaitX before calling glDrawBuffer. */ if (have_fake_front && buffers_changed) { BoxRec box; RegionRec region; box.x1 = 0; box.y1 = 0; box.x2 = pPriv->width; box.y2 = pPriv->height; RegionInit(®ion, &box, 0); DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft); } pPriv->needInvalidate = TRUE; return pPriv->buffers; err_out: *out_count = 0; if (buffers) { for (i = 0; i < count; i++) { if (buffers[i] != NULL) destroy_buffer(pDraw, buffers[i], 0); } free(buffers); buffers = NULL; } update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height); return buffers; } DRI2BufferPtr * DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height, unsigned int *attachments, int count, int *out_count) { return do_get_buffers(pDraw, width, height, attachments, count, out_count, FALSE); } DRI2BufferPtr * DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height, unsigned int *attachments, int count, int *out_count) { return do_get_buffers(pDraw, width, height, attachments, count, out_count, TRUE); } static void DRI2InvalidateDrawable(DrawablePtr pDraw) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); DRI2DrawableRefPtr ref; if (!pPriv || !pPriv->needInvalidate) return; pPriv->needInvalidate = FALSE; xorg_list_for_each_entry(ref, &pPriv->reference_list, link) ref->invalidate(pDraw, ref->priv, ref->id); } /* * In the direct rendered case, we throttle the clients that have more * than their share of outstanding swaps (and thus busy buffers) when a * new GetBuffers request is received. In the AIGLX case, we allow the * client to get the new buffers, but throttle when the next GLX request * comes in (see __glXDRIcontextWait()). */ Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw) { DRI2DrawablePtr pPriv; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) return FALSE; /* Throttle to swap limit */ if (pPriv->swapsPending >= pPriv->swap_limit) { if (dri2Sleep(client, pPriv, WAKE_SWAP)) { ResetCurrentRequest(client); client->sequence--; return TRUE; } } return FALSE; } void DRI2BlockClient(ClientPtr client, DrawablePtr pDraw) { DRI2DrawablePtr pPriv; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) return; dri2Sleep(client, pPriv, WAKE_MSC); } static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable) { if (drawable->type == DRAWABLE_PIXMAP) return (PixmapPtr)drawable; else { struct _Window *pWin = (struct _Window *)drawable; return drawable->pScreen->GetWindowPixmap(pWin); } } /* * A TraverseTree callback to invalidate all windows using the same * pixmap */ static int DRI2InvalidateWalk(WindowPtr pWin, void *data) { if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data) return WT_DONTWALKCHILDREN; DRI2InvalidateDrawable(&pWin->drawable); return WT_WALKCHILDREN; } static void DRI2InvalidateDrawableAll(DrawablePtr pDraw) { if (pDraw->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDraw; PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin); /* * Find the top-most window using this pixmap */ while (pWin->parent && pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap) pWin = pWin->parent; /* * Walk the sub-tree to invalidate all of the * windows using the same pixmap */ TraverseTree(pWin, DRI2InvalidateWalk, pPixmap); DRI2InvalidateDrawable(&pPixmap->drawable); } else DRI2InvalidateDrawable(pDraw); } DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); PixmapPtr spix; PixmapPtr mpix = GetDrawablePixmap(pDraw); ScreenPtr master, slave; Bool ret; master = mpix->drawable.pScreen; if (pDraw->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr)pDraw; PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin); if (pDraw->pScreen->GetScreenPixmap(pDraw->pScreen) == pPixmap) { if (pPriv->redirectpixmap && pPriv->redirectpixmap->drawable.width == pDraw->width && pPriv->redirectpixmap->drawable.height == pDraw->height && pPriv->redirectpixmap->drawable.depth == pDraw->depth) { mpix = pPriv->redirectpixmap; } else { if (master->ReplaceScanoutPixmap) { mpix = (*master->CreatePixmap)(master, pDraw->width, pDraw->height, pDraw->depth, CREATE_PIXMAP_USAGE_SHARED); if (!mpix) return NULL; ret = (*master->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); if (ret == FALSE) { (*master->DestroyPixmap)(mpix); return NULL; } pPriv->redirectpixmap = mpix; } else return NULL; } } else if (pPriv->redirectpixmap) { (*master->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); (*master->DestroyPixmap)(pPriv->redirectpixmap); pPriv->redirectpixmap = NULL; } } slave = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); /* check if the pixmap is still fine */ if (pPriv->prime_slave_pixmap) { if (pPriv->prime_slave_pixmap->master_pixmap == mpix) return &pPriv->prime_slave_pixmap->drawable; else { PixmapUnshareSlavePixmap(pPriv->prime_slave_pixmap); (*pPriv->prime_slave_pixmap->master_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_slave_pixmap->master_pixmap); (*slave->DestroyPixmap)(pPriv->prime_slave_pixmap); pPriv->prime_slave_pixmap = NULL; } } spix = PixmapShareToSlave(mpix, slave); if (!spix) return NULL; pPriv->prime_slave_pixmap = spix; #ifdef COMPOSITE spix->screen_x = mpix->screen_x; spix->screen_y = mpix->screen_y; #endif DRI2InvalidateDrawableAll(pDraw); return &spix->drawable; } static void dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, DRI2BufferPtr pDest, DRI2BufferPtr pSrc) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); DRI2ScreenPtr ds; ScreenPtr primeScreen; primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); ds = DRI2GetScreen(primeScreen); if (ds->CopyRegion2) (*ds->CopyRegion2)(primeScreen, pDraw, pRegion, pDest, pSrc); else (*ds->CopyRegion) (pDraw, pRegion, pDest, pSrc); /* cause damage to the box */ if (pPriv->prime_id) { BoxRec box; RegionRec region; box.x1 = 0; box.x2 = box.x1 + pDraw->width; box.y1 = 0; box.y2 = box.y1 + pDraw->height; RegionInit(®ion, &box, 1); RegionTranslate(®ion, pDraw->x, pDraw->y); DamageRegionAppend(pDraw, ®ion); DamageRegionProcessPending(pDraw); RegionUninit(®ion); } } int DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, unsigned int dest, unsigned int src) { DRI2DrawablePtr pPriv; DRI2BufferPtr pDestBuffer, pSrcBuffer; int i; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) return BadDrawable; pDestBuffer = NULL; pSrcBuffer = NULL; for (i = 0; i < pPriv->bufferCount; i++) { if (pPriv->buffers[i]->attachment == dest) pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i]; if (pPriv->buffers[i]->attachment == src) pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i]; } if (pSrcBuffer == NULL || pDestBuffer == NULL) return BadValue; dri2_copy_region(pDraw, pRegion, pDestBuffer, pSrcBuffer); return Success; } /* Can this drawable be page flipped? */ Bool DRI2CanFlip(DrawablePtr pDraw) { ScreenPtr pScreen = pDraw->pScreen; WindowPtr pWin, pRoot; PixmapPtr pWinPixmap, pRootPixmap; if (pDraw->type == DRAWABLE_PIXMAP) return TRUE; pRoot = pScreen->root; pRootPixmap = pScreen->GetWindowPixmap(pRoot); pWin = (WindowPtr) pDraw; pWinPixmap = pScreen->GetWindowPixmap(pWin); if (pRootPixmap != pWinPixmap) return FALSE; if (!RegionEqual(&pWin->clipList, &pRoot->winSize)) return FALSE; /* Does the window match the pixmap exactly? */ if (pDraw->x != 0 || pDraw->y != 0 || #ifdef COMPOSITE pDraw->x != pWinPixmap->screen_x || pDraw->y != pWinPixmap->screen_y || #endif pDraw->width != pWinPixmap->drawable.width || pDraw->height != pWinPixmap->drawable.height) return FALSE; return TRUE; } /* Can we do a pixmap exchange instead of a blit? */ Bool DRI2CanExchange(DrawablePtr pDraw) { return FALSE; } void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec) { DRI2DrawablePtr pPriv; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) return; ProcDRI2WaitMSCReply(client, ((CARD64) tv_sec * 1000000) + tv_usec, frame, pPriv->swap_count); dri2WakeAll(client, pPriv, WAKE_MSC); } static void DRI2WakeClient(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec) { ScreenPtr pScreen = pDraw->pScreen; DRI2DrawablePtr pPriv; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: bad drawable\n", __func__); return; } /* * Swap completed. * Wake the client iff: * - it was waiting on SBC * - was blocked due to GLX make current * - was blocked due to swap throttling * - is not blocked due to an MSC wait */ if (pPriv->target_sbc != -1 && pPriv->target_sbc <= pPriv->swap_count) { if (dri2WakeAll(client, pPriv, WAKE_SBC)) { ProcDRI2WaitMSCReply(client, ((CARD64) tv_sec * 1000000) + tv_usec, frame, pPriv->swap_count); pPriv->target_sbc = -1; } } dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); } void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec, int type, DRI2SwapEventPtr swap_complete, void *swap_data) { ScreenPtr pScreen = pDraw->pScreen; DRI2DrawablePtr pPriv; CARD64 ust = 0; BoxRec box; RegionRec region; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: bad drawable\n", __func__); return; } pPriv->swapsPending--; pPriv->swap_count++; box.x1 = 0; box.y1 = 0; box.x2 = pDraw->width; box.y2 = pDraw->height; RegionInit(®ion, &box, 0); DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft); ust = ((CARD64) tv_sec * 1000000) + tv_usec; if (swap_complete) swap_complete(client, swap_data, type, ust, frame, pPriv->swap_count); pPriv->last_swap_msc = frame; pPriv->last_swap_ust = ust; DRI2WakeClient(client, pDraw, frame, tv_sec, tv_usec); } Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable); /* If we're currently waiting for a swap on this drawable, reset * the request and suspend the client. */ if (pPriv && pPriv->swapsPending) { if (dri2Sleep(client, pPriv, WAKE_SWAP)) { ResetCurrentRequest(client); client->sequence--; return TRUE; } } return FALSE; } int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 * swap_target, DRI2SwapEventPtr func, void *data) { ScreenPtr pScreen = pDraw->pScreen; DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL; int ret, i; CARD64 ust, current_msc; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: bad drawable\n", __func__); return BadDrawable; } /* According to spec, return expected swapbuffers count SBC after this swap * will complete. This is ignored unless we return Success, but it must be * initialized on every path where we return Success or the caller will send * an uninitialized value off the stack to the client. So let's initialize * it as early as possible, just to be sure. */ *swap_target = pPriv->swap_count + pPriv->swapsPending + 1; for (i = 0; i < pPriv->bufferCount; i++) { if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft) pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i]; if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft) pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i]; } if (pSrcBuffer == NULL || pDestBuffer == NULL) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: drawable has no back or front?\n", __func__); return BadDrawable; } /* Old DDX or no swap interval, just blit */ if (!ds->ScheduleSwap || !pPriv->swap_interval || pPriv->prime_id) { BoxRec box; RegionRec region; box.x1 = 0; box.y1 = 0; box.x2 = pDraw->width; box.y2 = pDraw->height; RegionInit(®ion, &box, 0); pPriv->swapsPending++; dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer); DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE, func, data); return Success; } /* * In the simple glXSwapBuffers case, all params will be 0, and we just * need to schedule a swap for the last swap target + the swap interval. */ if (target_msc == 0 && divisor == 0 && remainder == 0) { /* If the current vblank count of the drawable's crtc is lower * than the count stored in last_swap_target from a previous swap * then reinitialize last_swap_target to the current crtc's msc, * otherwise the swap will hang. This will happen if the drawable * is moved to a crtc with a lower refresh rate, or a crtc that just * got enabled. */ if (ds->GetMSC) { if (!(*ds->GetMSC) (pDraw, &ust, ¤t_msc)) pPriv->last_swap_target = 0; if (current_msc < pPriv->last_swap_target) pPriv->last_swap_target = current_msc; } /* * Swap target for this swap is last swap target + swap interval since * we have to account for the current swap count, interval, and the * number of pending swaps. */ target_msc = pPriv->last_swap_target + pPriv->swap_interval; } pPriv->swapsPending++; ret = (*ds->ScheduleSwap) (client, pDraw, pDestBuffer, pSrcBuffer, &target_msc, divisor, remainder, func, data); if (!ret) { pPriv->swapsPending--; /* didn't schedule */ xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: driver failed to schedule swap\n", __func__); return BadDrawable; } pPriv->last_swap_target = target_msc; DRI2InvalidateDrawableAll(pDraw); return Success; } void DRI2SwapInterval(DrawablePtr pDrawable, int interval) { ScreenPtr pScreen = pDrawable->pScreen; DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable); if (pPriv == NULL) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: bad drawable\n", __func__); return; } /* fixme: check against arbitrary max? */ pPriv->swap_interval = interval; } int DRI2GetMSC(DrawablePtr pDraw, CARD64 * ust, CARD64 * msc, CARD64 * sbc) { ScreenPtr pScreen = pDraw->pScreen; DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; Bool ret; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: bad drawable\n", __func__); return BadDrawable; } if (!ds->GetMSC) { *ust = 0; *msc = 0; *sbc = pPriv->swap_count; return Success; } /* * Spec needs to be updated to include unmapped or redirected * drawables */ ret = (*ds->GetMSC) (pDraw, ust, msc); if (!ret) return BadDrawable; *sbc = pPriv->swap_count; return Success; } int DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, CARD64 divisor, CARD64 remainder) { DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; Bool ret; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) return BadDrawable; /* Old DDX just completes immediately */ if (!ds->ScheduleWaitMSC) { DRI2WaitMSCComplete(client, pDraw, target_msc, 0, 0); return Success; } ret = (*ds->ScheduleWaitMSC) (client, pDraw, target_msc, divisor, remainder); if (!ret) return BadDrawable; return Success; } int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc) { DRI2DrawablePtr pPriv; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) return BadDrawable; if (pPriv->target_sbc != -1) /* already in use */ return BadDrawable; /* target_sbc == 0 means to block until all pending swaps are * finished. Recalculate target_sbc to get that behaviour. */ if (target_sbc == 0) target_sbc = pPriv->swap_count + pPriv->swapsPending; /* If current swap count already >= target_sbc, reply and * return immediately with (ust, msc, sbc) triplet of * most recent completed swap. */ if (pPriv->swap_count >= target_sbc) { ProcDRI2WaitMSCReply(client, pPriv->last_swap_ust, pPriv->last_swap_msc, pPriv->swap_count); return Success; } if (!dri2Sleep(client, pPriv, WAKE_SBC)) return BadAlloc; pPriv->target_sbc = target_sbc; return Success; } Bool DRI2HasSwapControl(ScreenPtr pScreen) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); return ds->ScheduleSwap && ds->GetMSC; } Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen, unsigned int driverType, int *fd, const char **driverName, const char **deviceName) { DRI2ScreenPtr ds; uint32_t prime_id = DRI2DriverPrimeId(driverType); uint32_t driver_id = driverType & 0xffff; if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey)) return FALSE; ds = DRI2GetScreenPrime(pScreen, prime_id); if (ds == NULL) return FALSE; if (driver_id >= ds->numDrivers || !ds->driverNames[driver_id]) return FALSE; *driverName = ds->driverNames[driver_id]; *deviceName = ds->deviceName; *fd = ds->fd; if (client) { DRI2ClientPtr dri2_client; dri2_client = dri2ClientPrivate(client); dri2_client->prime_id = prime_id; } return TRUE; } static int DRI2AuthMagic (ScreenPtr pScreen, uint32_t magic) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); if (ds == NULL) return -EINVAL; return (*ds->LegacyAuthMagic) (ds->fd, magic); } Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic) { DRI2ScreenPtr ds; DRI2ClientPtr dri2_client = dri2ClientPrivate(client); ScreenPtr primescreen; ds = DRI2GetScreenPrime(pScreen, dri2_client->prime_id); if (ds == NULL) return FALSE; primescreen = GetScreenPrime(pScreen, dri2_client->prime_id); if ((*ds->AuthMagic)(primescreen, magic)) return FALSE; return TRUE; } static int DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw, WindowPtr pSib) { DrawablePtr pDraw = (DrawablePtr) pWin; ScreenPtr pScreen = pDraw->pScreen; DRI2ScreenPtr ds = DRI2GetScreen(pScreen); DRI2DrawablePtr dd = DRI2GetDrawable(pDraw); int ret; if (ds->ConfigNotify) { pScreen->ConfigNotify = ds->ConfigNotify; ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib); ds->ConfigNotify = pScreen->ConfigNotify; pScreen->ConfigNotify = DRI2ConfigNotify; if (ret) return ret; } if (!dd || (dd->width == w && dd->height == h)) return Success; DRI2InvalidateDrawable(pDraw); return Success; } static void DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) { ScreenPtr pScreen = pWin->drawable.pScreen; DRI2ScreenPtr ds = DRI2GetScreen(pScreen); pScreen->SetWindowPixmap = ds->SetWindowPixmap; (*pScreen->SetWindowPixmap) (pWin, pPix); ds->SetWindowPixmap = pScreen->SetWindowPixmap; pScreen->SetWindowPixmap = DRI2SetWindowPixmap; DRI2InvalidateDrawable(&pWin->drawable); } #define MAX_PRIME DRI2DriverPrimeMask static int get_prime_id(void) { int i; /* start at 1, prime id 0 is just normal driver */ for (i = 1; i < MAX_PRIME; i++) { if (prime_id_allocate_bitmask & (1 << i)) continue; prime_id_allocate_bitmask |= (1 << i); return i; } return -1; } #include "pci_ids/pci_id_driver_map.h" static char * dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) { #ifdef WITH_LIBDRM int i, j; char *driver = NULL; drmDevicePtr dev; /* For non-PCI devices and drmGetDevice fail, just assume that * the 3D driver is named the same as the kernel driver. This is * currently true for vc4 and msm (freedreno). */ if (drmGetDevice(info->fd, &dev) || dev->bustype != DRM_BUS_PCI) { drmVersionPtr version = drmGetVersion(info->fd); if (!version) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] Couldn't drmGetVersion() on non-PCI device, " "no driver name found.\n"); return NULL; } driver = strndup(version->name, version->name_len); drmFreeVersion(version); return driver; } for (i = 0; driver_map[i].driver; i++) { if (dev->deviceinfo.pci->vendor_id != driver_map[i].vendor_id) continue; if (driver_map[i].num_chips_ids == -1) { driver = strdup(driver_map[i].driver); goto out; } for (j = 0; j < driver_map[i].num_chips_ids; j++) { if (driver_map[i].chip_ids[j] == dev->deviceinfo.pci->device_id) { driver = strdup(driver_map[i].driver); goto out; } } } xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] No driver mapping found for PCI device " "0x%04x / 0x%04x\n", dev->deviceinfo.pci->vendor_id, dev->deviceinfo.pci->device_id); out: drmFreeDevice(&dev); return driver; #else return NULL; #endif } Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) { DRI2ScreenPtr ds; const char *driverTypeNames[] = { "DRI", /* DRI2DriverDRI */ "VDPAU", /* DRI2DriverVDPAU */ }; unsigned int i; CARD8 cur_minor; if (info->version < 3) return FALSE; if (!xf86VGAarbiterAllowDRI(pScreen)) { xf86DrvMsg(pScreen->myNum, X_WARNING, "[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n"); return FALSE; } if (!dixRegisterPrivateKey(&dri2ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&dri2WindowPrivateKeyRec, PRIVATE_WINDOW, 0)) return FALSE; if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0)) return FALSE; if (!dixRegisterPrivateKey(&dri2ClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DRI2ClientRec))) return FALSE; ds = calloc(1, sizeof *ds); if (!ds) return FALSE; ds->screen = pScreen; ds->fd = info->fd; ds->deviceName = info->deviceName; dri2_major = 1; ds->CreateBuffer = info->CreateBuffer; ds->DestroyBuffer = info->DestroyBuffer; ds->CopyRegion = info->CopyRegion; cur_minor = 1; if (info->version >= 4) { ds->ScheduleSwap = info->ScheduleSwap; ds->ScheduleWaitMSC = info->ScheduleWaitMSC; ds->GetMSC = info->GetMSC; cur_minor = 3; } if (info->version >= 5) { ds->LegacyAuthMagic = info->AuthMagic; } if (info->version >= 6) { ds->ReuseBufferNotify = info->ReuseBufferNotify; ds->SwapLimitValidate = info->SwapLimitValidate; } if (info->version >= 7) { ds->GetParam = info->GetParam; cur_minor = 4; } if (info->version >= 8) { ds->AuthMagic = info->AuthMagic2; } if (info->version >= 9) { ds->CreateBuffer2 = info->CreateBuffer2; if (info->CreateBuffer2 && pScreen->isGPU) { ds->prime_id = get_prime_id(); if (ds->prime_id == -1) { free(ds); return FALSE; } } ds->DestroyBuffer2 = info->DestroyBuffer2; ds->CopyRegion2 = info->CopyRegion2; } /* * if the driver doesn't provide an AuthMagic function or the info struct * version is too low, call through LegacyAuthMagic */ if (!ds->AuthMagic) { ds->AuthMagic = DRI2AuthMagic; /* * If the driver doesn't provide an AuthMagic function * it relies on the old method (using libdrm) or fails */ if (!ds->LegacyAuthMagic) #ifdef WITH_LIBDRM ds->LegacyAuthMagic = drmAuthMagic; #else goto err_out; #endif } /* Initialize minor if needed and set to minimum provied by DDX */ if (!dri2_minor || dri2_minor > cur_minor) dri2_minor = cur_minor; if (info->version == 3 || info->numDrivers == 0) { /* Driver too old: use the old-style driverName field */ ds->numDrivers = info->driverName ? 1 : 2; ds->driverNames = xallocarray(ds->numDrivers, sizeof(*ds->driverNames)); if (!ds->driverNames) goto err_out; if (info->driverName) { ds->driverNames[0] = info->driverName; } else { ds->driverNames[0] = ds->driverNames[1] = dri2_probe_driver_name(pScreen, info); if (!ds->driverNames[0]) return FALSE; } } else { ds->numDrivers = info->numDrivers; ds->driverNames = xallocarray(info->numDrivers, sizeof(*ds->driverNames)); if (!ds->driverNames) goto err_out; memcpy(ds->driverNames, info->driverNames, info->numDrivers * sizeof(*ds->driverNames)); } dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds); ds->ConfigNotify = pScreen->ConfigNotify; pScreen->ConfigNotify = DRI2ConfigNotify; ds->SetWindowPixmap = pScreen->SetWindowPixmap; pScreen->SetWindowPixmap = DRI2SetWindowPixmap; xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n"); for (i = 0; i < ARRAY_SIZE(driverTypeNames); i++) { if (i < ds->numDrivers && ds->driverNames[i]) { xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] %s driver: %s\n", driverTypeNames[i], ds->driverNames[i]); } } return TRUE; err_out: xf86DrvMsg(pScreen->myNum, X_WARNING, "[DRI2] Initialization failed for info version %d.\n", info->version); free(ds); return FALSE; } void DRI2CloseScreen(ScreenPtr pScreen) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); pScreen->ConfigNotify = ds->ConfigNotify; pScreen->SetWindowPixmap = ds->SetWindowPixmap; if (ds->prime_id) prime_id_allocate_bitmask &= ~(1 << ds->prime_id); free(ds->driverNames); free(ds); dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL); } /* Called by InitExtensions() */ Bool DRI2ModuleSetup(void) { dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable"); if (!dri2DrawableRes) return FALSE; return TRUE; } void DRI2Version(int *major, int *minor) { if (major != NULL) *major = 1; if (minor != NULL) *minor = 2; } int DRI2GetParam(ClientPtr client, DrawablePtr drawable, CARD64 param, BOOL *is_param_recognized, CARD64 *value) { DRI2ScreenPtr ds = DRI2GetScreen(drawable->pScreen); char high_byte = (param >> 24); switch (high_byte) { case 0: /* Parameter names whose high_byte is 0 are reserved for the X * server. The server currently recognizes no parameters. */ goto not_recognized; case 1: /* Parameter names whose high byte is 1 are reserved for the DDX. */ if (ds->GetParam) return ds->GetParam(client, drawable, param, is_param_recognized, value); else goto not_recognized; default: /* Other parameter names are reserved for future use. They are never * recognized. */ goto not_recognized; } not_recognized: *is_param_recognized = FALSE; return Success; } xorg-server-1.20.8/hw/xfree86/dri2/meson.build0000644000175000017500000000045213640201473015716 00000000000000srcs_xorg_dri2 = [ 'dri2.c', 'dri2ext.c', ] xorg_dri2 = static_library('xorg_dri2', srcs_xorg_dri2, include_directories: [inc, xorg_inc], dependencies: [ common_dep, libdrm_dep, ], c_args: xorg_c_args, ) install_data('dri2.h', install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/Makefile.am0000644000175000017500000000774113640201473014760 00000000000000 if DRI DRI_SUBDIR = dri DRI_LIB = dri/libdri.la endif if DRI2 DRI2_SUBDIR = dri2 DRI2_LIB = dri2/libdri2.la endif if DRI3 DRI3_BUILDDIR = $(top_builddir)/dri3 DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la endif if GLX GLXVND_LIB = $(top_builddir)/glx/libglxvnd.la endif if GLAMOR_EGL GLAMOR_EGL_SUBDIR = glamor_egl endif if XF86UTILS XF86UTILS_SUBDIR = utils endif if VGAHW VGAHW_SUBDIR = vgahw endif if VBE VBE_SUBDIR = vbe endif if INT10MODULE INT10_SUBDIR = int10 endif SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods xkb \ fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ $(GLAMOR_EGL_SUBDIR) drivers DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ parser ramdac shadowfb vbe vgahw \ loader dixmods xkb dri dri2 exa modes \ utils doc man glamor_egl drivers bin_PROGRAMS = Xorg nodist_Xorg_SOURCES = sdksyms.c AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/parser \ -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \ -I$(srcdir)/dri -I$(srcdir)/dri2 -I$(top_srcdir)/dri3 LOCAL_LIBS = \ $(MAIN_LIB) \ $(XSERVER_LIBS) \ loader/libloader.la \ common/libcommon.la \ os-support/libxorgos.la \ parser/libxf86config.la \ dixmods/libdixmods.la \ modes/libxf86modes.la \ ramdac/libramdac.la \ ddc/libddc.la \ i2c/libi2c.la \ $(XORG_LIBS) \ xkb/libxorgxkb.la \ $(DRI_LIB) \ $(DRI2_LIB) \ $(DRI3_LIB) \ $(GLXVND_LIB) \ $(top_builddir)/miext/sync/libsync.la \ $(top_builddir)/mi/libmi.la \ $(top_builddir)/os/libos.la \ $(top_builddir)/Xext/libXvidmode.la Xorg_LDADD = \ $(LOCAL_LIBS) \ $(XORG_SYS_LIBS) \ $(XSERVER_SYS_LIBS) Xorg_DEPENDENCIES = $(LOCAL_LIBS) Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) if SUID_WRAPPER wrapexecdir = $(SUID_WRAPPER_DIR) wrapexec_PROGRAMS = Xorg.wrap Xorg_wrap_SOURCES = xorg-wrapper.c endif BUILT_SOURCES = xorg.conf.example DISTCLEANFILES = xorg.conf.example EXTRA_DIST = xorgconf.cpp # Without logdir, X will post an error on the terminal and will not start install-data-local: $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir) if CYGWIN $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a endif install-exec-hook: (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg$(EXEEXT) X) if INSTALL_SETUID chown 0 $(DESTDIR)$(bindir)/Xorg chmod u+s $(DESTDIR)$(bindir)/Xorg endif if SUID_WRAPPER $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg -chown 0 $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap endif uninstall-local: if CYGWIN $(AM_V_at)rm -f $(DESTDIR)$(libdir)/libXorg.exe.a endif uninstall-hook: $(AM_V_at)rm -f $(DESTDIR)$(bindir)/X # Use variables from XORG_MANPAGE_SECTIONS and X Server configuration # Do not include manpages.am as values are not appropriate for rc files CONF_SUBSTS = -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \ -e 's|MODULEPATH|$(DEFAULT_MODULE_PATH)|g' \ -e 's|DEFAULTFONTPATH|$(COMPILEDDEFAULTFONTPATH)|g' xorg.conf.example: xorgconf.cpp $(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $(srcdir)/xorgconf.cpp > $@ relink: $(AM_V_at)rm -f Xorg$(EXEEXT) && $(MAKE) Xorg$(EXEEXT) CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh EXTRA_DIST += sdksyms.sh sdksyms.dep sdksyms.c: sdksyms.sh $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) SDKSYMS_DEP = sdksyms.dep -include $(SDKSYMS_DEP) i2c/libi2c.la: $(AM_V_at)cd i2c && $(MAKE) libi2c.la dixmods/libdixmods.la: $(AM_V_at)cd dixmods && $(MAKE) libdixmods.la xkb/libxorgxkb.la: $(AM_V_at)cd xkb && $(MAKE) libxorgxkb.la xorg-server-1.20.8/hw/xfree86/xorg-wrapper.c0000644000175000017500000002041313640201473015514 00000000000000/* * Copyright © 2014 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. * * Author: Hans de Goede */ #include "dix-config.h" #include "xorg-config.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_SYSMACROS_H #include #endif #include #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #endif #include #ifdef WITH_LIBDRM #include #include /* For DRM_DEV_NAME */ #endif #include "misc.h" #define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config" static const char *progname; enum { ROOT_ONLY, CONSOLE_ONLY, ANYBODY }; /* KISS non locale / LANG parsing isspace version */ static int is_space(char c) { return c == ' ' || c == '\t' || c == '\n'; } static char *strip(char *s) { int i; /* Strip leading whitespace */ while (s[0] && is_space(s[0])) s++; /* Strip trailing whitespace */ i = strlen(s) - 1; while (i >= 0 && is_space(s[i])) { s[i] = 0; i--; } return s; } static void parse_config(int *allowed, int *needs_root_rights) { FILE *f; char buf[1024]; char *stripped, *equals, *key, *value; int line = 0; f = fopen(CONFIG_FILE, "r"); if (!f) return; while (fgets(buf, sizeof(buf), f)) { line++; /* Skip comments and empty lines */ stripped = strip(buf); if (stripped[0] == '#' || stripped[0] == 0) continue; /* Split in a key + value pair */ equals = strchr(stripped, '='); if (!equals) { fprintf(stderr, "%s: Syntax error at %s line %d\n", progname, CONFIG_FILE, line); exit(1); } *equals = 0; key = strip(stripped); /* To remove trailing whitespace from key */ value = strip(equals + 1); /* To remove leading whitespace from val */ if (!key[0]) { fprintf(stderr, "%s: Missing key at %s line %d\n", progname, CONFIG_FILE, line); exit(1); } if (!value[0]) { fprintf(stderr, "%s: Missing value at %s line %d\n", progname, CONFIG_FILE, line); exit(1); } /* And finally process */ if (strcmp(key, "allowed_users") == 0) { if (strcmp(value, "rootonly") == 0) *allowed = ROOT_ONLY; else if (strcmp(value, "console") == 0) *allowed = CONSOLE_ONLY; else if (strcmp(value, "anybody") == 0) *allowed = ANYBODY; else { fprintf(stderr, "%s: Invalid value '%s' for 'allowed_users' at %s line %d\n", progname, value, CONFIG_FILE, line); exit(1); } } else if (strcmp(key, "needs_root_rights") == 0) { if (strcmp(value, "yes") == 0) *needs_root_rights = 1; else if (strcmp(value, "no") == 0) *needs_root_rights = 0; else if (strcmp(value, "auto") == 0) *needs_root_rights = -1; else { fprintf(stderr, "%s: Invalid value '%s' for 'needs_root_rights' at %s line %d\n", progname, value, CONFIG_FILE, line); exit(1); } } else if (strcmp(key, "nice_value") == 0) { /* Backward compatibility with older Debian Xwrapper, ignore */ } else { fprintf(stderr, "%s: Invalid key '%s' at %s line %d\n", key, progname, CONFIG_FILE, line); exit(1); } } fclose(f); } static int on_console(int fd) { #if defined(__linux__) struct stat st; int r; r = fstat(fd, &st); if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4) return 1; #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int idx; if (ioctl(fd, VT_GETINDEX, &idx) != -1) return 1; #else #warning This program needs porting to your kernel. static int seen; if (!seen) { fprintf(stderr, "%s: Unable to determine if running on a console\n", progname); seen = 1; } #endif return 0; } int main(int argc, char *argv[]) { #ifdef WITH_LIBDRM struct drm_mode_card_res res; #endif char buf[PATH_MAX]; int i, r, fd; int kms_cards = 0; int total_cards = 0; int allowed = CONSOLE_ONLY; int needs_root_rights = -1; char *const empty_envp[1] = { NULL, }; progname = argv[0]; parse_config(&allowed, &needs_root_rights); /* For non root users check if they are allowed to run the X server */ if (getuid() != 0) { switch (allowed) { case ROOT_ONLY: /* Already checked above */ fprintf(stderr, "%s: Only root is allowed to run the X server\n", argv[0]); exit(1); break; case CONSOLE_ONLY: /* Some of stdin / stdout / stderr maybe redirected to a file */ for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) { if (on_console(i)) break; } if (i > STDERR_FILENO) { fprintf(stderr, "%s: Only console users are allowed to run the X server\n", argv[0]); exit(1); } break; case ANYBODY: break; } } #ifdef WITH_LIBDRM /* Detect if we need root rights, except when overriden by the config */ if (needs_root_rights == -1) { for (i = 0; i < 16; i++) { snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, i); fd = open(buf, O_RDWR); if (fd == -1) continue; total_cards++; memset(&res, 0, sizeof(struct drm_mode_card_res)); r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res); if (r == 0) kms_cards++; close(fd); } } #endif /* If we've found cards, and all cards support kms, drop root rights */ if (needs_root_rights == 0 || (total_cards && kms_cards == total_cards)) { gid_t realgid = getgid(); uid_t realuid = getuid(); if (setresgid(-1, realgid, realgid) != 0) { fprintf(stderr, "%s: Could not drop setgid privileges: %s\n", progname, strerror(errno)); exit(1); } if (setresuid(-1, realuid, realuid) != 0) { fprintf(stderr, "%s: Could not drop setuid privileges: %s\n", progname, strerror(errno)); exit(1); } } snprintf(buf, sizeof(buf), "%s/Xorg", SUID_WRAPPER_DIR); /* Check if the server is executable by our real uid */ if (access(buf, X_OK) != 0) { fprintf(stderr, "%s: Missing execute permissions for %s: %s\n", progname, buf, strerror(errno)); exit(1); } argv[0] = buf; if (getuid() == geteuid()) (void) execv(argv[0], argv); else (void) execve(argv[0], argv, empty_envp); fprintf(stderr, "%s: Failed to execute %s: %s\n", progname, buf, strerror(errno)); exit(1); } xorg-server-1.20.8/hw/xfree86/i2c/0000755000175000017500000000000013640201534013446 500000000000000xorg-server-1.20.8/hw/xfree86/i2c/Makefile.am0000644000175000017500000000024713640201473015427 00000000000000noinst_LTLIBRARIES = libi2c.la libi2c_la_SOURCES = xf86i2c.c AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = xf86i2c.h i2c_def.h xorg-server-1.20.8/hw/xfree86/i2c/xf86i2c.c0000644000175000017500000005471313640201473014737 00000000000000/* * Copyright (C) 1998 Itai Nahshon, Michael Schimek * * The original code was derived from and inspired by * the I2C driver from the Linux kernel. * (c) 1998 Gerd Knorr */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include #include #include #include "scrnintstr.h" #include "regionstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "validate.h" #include "resource.h" #include "gcstruct.h" #include "dixstruct.h" #include "xf86i2c.h" #define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */ #define I2C_TRACE(x) /*(x)*/ /* Report progress */ /* This is the default I2CUDelay function if not supplied by the driver. * High level I2C interfaces implementing the bus protocol in hardware * should supply this function too. * * Delay execution at least usec microseconds. * All values 0 to 1e6 inclusive must be expected. */ static void I2CUDelay(I2CBusPtr b, int usec) { struct timeval begin, cur; long d_secs, d_usecs; long diff; if (usec > 0) { X_GETTIMEOFDAY(&begin); do { /* It would be nice to use {xf86}usleep, * but usleep (1) takes >10000 usec ! */ X_GETTIMEOFDAY(&cur); d_secs = (cur.tv_sec - begin.tv_sec); d_usecs = (cur.tv_usec - begin.tv_usec); diff = d_secs * 1000000 + d_usecs; } while (diff >= 0 && diff < (usec + 1)); } } /* Most drivers will register just with GetBits/PutBits functions. * The following functions implement a software I2C protocol * by using the promitive functions given by the driver. * ================================================================ * * It is assumed that there is just one master on the I2C bus, therefore * there is no explicit test for conflits. */ #define RISEFALLTIME 2 /* usec, actually 300 to 1000 ns according to the i2c specs */ /* Some devices will hold SCL low to slow down the bus or until * ready for transmission. * * This condition will be noticed when the master tries to raise * the SCL line. You can set the timeout to zero if the slave device * does not support this clock synchronization. */ static Bool I2CRaiseSCL(I2CBusPtr b, int sda, int timeout) { int i, scl; b->I2CPutBits(b, 1, sda); b->I2CUDelay(b, b->RiseFallTime); for (i = timeout; i > 0; i -= b->RiseFallTime) { b->I2CGetBits(b, &scl, &sda); if (scl) break; b->I2CUDelay(b, b->RiseFallTime); } if (i <= 0) { I2C_TIMEOUT(ErrorF ("[I2CRaiseSCL(<%s>, %d, %d) timeout]", b->BusName, sda, timeout)); return FALSE; } return TRUE; } /* Send a start signal on the I2C bus. The start signal notifies * devices that a new transaction is initiated by the bus master. * * The start signal is always followed by a slave address. * Slave addresses are 8+ bits. The first 7 bits identify the * device and the last bit signals if this is a read (1) or * write (0) operation. * * There may be more than one start signal on one transaction. * This happens for example on some devices that allow reading * of registers. First send a start bit followed by the device * address (with the last bit 0) and the register number. Then send * a new start bit with the device address (with the last bit 1) * and then read the value from the device. * * Note this is function does not implement a multiple master * arbitration procedure. */ static Bool I2CStart(I2CBusPtr b, int timeout) { if (!I2CRaiseSCL(b, 1, timeout)) return FALSE; b->I2CPutBits(b, 1, 0); b->I2CUDelay(b, b->HoldTime); b->I2CPutBits(b, 0, 0); b->I2CUDelay(b, b->HoldTime); I2C_TRACE(ErrorF("\ni2c: <")); return TRUE; } /* This is the default I2CStop function if not supplied by the driver. * * Signal devices on the I2C bus that a transaction on the * bus has finished. There may be more than one start signal * on a transaction but only one stop signal. */ static void I2CStop(I2CDevPtr d) { I2CBusPtr b = d->pI2CBus; b->I2CPutBits(b, 0, 0); b->I2CUDelay(b, b->RiseFallTime); b->I2CPutBits(b, 1, 0); b->I2CUDelay(b, b->HoldTime); b->I2CPutBits(b, 1, 1); b->I2CUDelay(b, b->HoldTime); I2C_TRACE(ErrorF(">\n")); } /* Write/Read a single bit to/from a device. * Return FALSE if a timeout occurs. */ static Bool I2CWriteBit(I2CBusPtr b, int sda, int timeout) { Bool r; b->I2CPutBits(b, 0, sda); b->I2CUDelay(b, b->RiseFallTime); r = I2CRaiseSCL(b, sda, timeout); b->I2CUDelay(b, b->HoldTime); b->I2CPutBits(b, 0, sda); b->I2CUDelay(b, b->HoldTime); return r; } static Bool I2CReadBit(I2CBusPtr b, int *psda, int timeout) { Bool r; int scl; r = I2CRaiseSCL(b, 1, timeout); b->I2CUDelay(b, b->HoldTime); b->I2CGetBits(b, &scl, psda); b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->HoldTime); return r; } /* This is the default I2CPutByte function if not supplied by the driver. * * A single byte is sent to the device. * The function returns FALSE if a timeout occurs, you should send * a stop condition afterwards to reset the bus. * * A timeout occurs, * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs, * or slows down the bus for more than BitTimeout usecs for each bit, * or does not send an ACK bit (0) to acknowledge the transmission within * AcknTimeout usecs, but a NACK (1) bit. * * AcknTimeout must be at least b->HoldTime, the other timeouts can be * zero according to the comment on I2CRaiseSCL. */ static Bool I2CPutByte(I2CDevPtr d, I2CByte data) { Bool r; int i, scl, sda; I2CBusPtr b = d->pI2CBus; if (!I2CWriteBit(b, (data >> 7) & 1, d->ByteTimeout)) return FALSE; for (i = 6; i >= 0; i--) if (!I2CWriteBit(b, (data >> i) & 1, d->BitTimeout)) return FALSE; b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->RiseFallTime); r = I2CRaiseSCL(b, 1, b->HoldTime); if (r) { for (i = d->AcknTimeout; i > 0; i -= b->HoldTime) { b->I2CUDelay(b, b->HoldTime); b->I2CGetBits(b, &scl, &sda); if (sda == 0) break; } if (i <= 0) { I2C_TIMEOUT(ErrorF("[I2CPutByte(<%s>, 0x%02x, %d, %d, %d) timeout]", b->BusName, data, d->BitTimeout, d->ByteTimeout, d->AcknTimeout)); r = FALSE; } I2C_TRACE(ErrorF("W%02x%c ", (int) data, sda ? '-' : '+')); } b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->HoldTime); return r; } /* This is the default I2CGetByte function if not supplied by the driver. * * A single byte is read from the device. * The function returns FALSE if a timeout occurs, you should send * a stop condition afterwards to reset the bus. * * A timeout occurs, * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs, * or slows down the bus for more than b->BitTimeout usecs for each bit. * * ByteTimeout must be at least b->HoldTime, the other timeouts can be * zero according to the comment on I2CRaiseSCL. * * For the byte in a sequence the acknowledge bit NACK (1), * otherwise ACK (0) will be sent. */ static Bool I2CGetByte(I2CDevPtr d, I2CByte * data, Bool last) { int i, sda; I2CBusPtr b = d->pI2CBus; b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->RiseFallTime); if (!I2CReadBit(b, &sda, d->ByteTimeout)) return FALSE; *data = (sda > 0) << 7; for (i = 6; i >= 0; i--) if (!I2CReadBit(b, &sda, d->BitTimeout)) return FALSE; else *data |= (sda > 0) << i; if (!I2CWriteBit(b, last ? 1 : 0, d->BitTimeout)) return FALSE; I2C_TRACE(ErrorF("R%02x%c ", (int) *data, last ? '+' : '-')); return TRUE; } /* This is the default I2CAddress function if not supplied by the driver. * * It creates the start condition, followed by the d->SlaveAddr. * Higher level functions must call this routine rather than * I2CStart/PutByte because a hardware I2C master may not be able * to send a slave address without a start condition. * * The same timeouts apply as with I2CPutByte and additional a * StartTimeout, similar to the ByteTimeout but for the start * condition. * * In case of a timeout, the bus is left in a clean idle condition. * I. e. you *must not* send a Stop. If this function succeeds, you *must*. * * The slave address format is 16 bit, with the legacy _8_bit_ slave address * in the least significant byte. This is, the slave address must include the * R/_W flag as least significant bit. * * The most significant byte of the address will be sent _after_ the LSB, * but only if the LSB indicates: * a) an 11 bit address, this is LSB = 1111 0xxx. * b) a 'general call address', this is LSB = 0000 000x - see the I2C specs * for more. */ static Bool I2CAddress(I2CDevPtr d, I2CSlaveAddr addr) { if (I2CStart(d->pI2CBus, d->StartTimeout)) { if (I2CPutByte(d, addr & 0xFF)) { if ((addr & 0xF8) != 0xF0 && (addr & 0xFE) != 0x00) return TRUE; if (I2CPutByte(d, (addr >> 8) & 0xFF)) return TRUE; } I2CStop(d); } return FALSE; } /* These are the hardware independent I2C helper functions. * ======================================================== */ /* Function for probing. Just send the slave address * and return true if the device responds. The slave address * must have the lsb set to reflect a read (1) or write (0) access. * Don't expect a read- or write-only device will respond otherwise. */ Bool xf86I2CProbeAddress(I2CBusPtr b, I2CSlaveAddr addr) { int r; I2CDevRec d; d.DevName = "Probing"; d.BitTimeout = b->BitTimeout; d.ByteTimeout = b->ByteTimeout; d.AcknTimeout = b->AcknTimeout; d.StartTimeout = b->StartTimeout; d.SlaveAddr = addr; d.pI2CBus = b; d.NextDev = NULL; r = b->I2CAddress(&d, addr); if (r) b->I2CStop(&d); return r; } /* All functions below are related to devices and take the * slave address and timeout values from an I2CDevRec. They * return FALSE in case of an error (presumably a timeout). */ /* General purpose read and write function. * * 1st, if nWrite > 0 * Send a start condition * Send the slave address (1 or 2 bytes) with write flag * Write n bytes from WriteBuffer * 2nd, if nRead > 0 * Send a start condition [again] * Send the slave address (1 or 2 bytes) with read flag * Read n bytes to ReadBuffer * 3rd, if a Start condition has been successfully sent, * Send a Stop condition. * * The functions exits immediately when an error occures, * not proceeding any data left. However, step 3 will * be executed anyway to leave the bus in clean idle state. */ static Bool I2CWriteRead(I2CDevPtr d, I2CByte * WriteBuffer, int nWrite, I2CByte * ReadBuffer, int nRead) { Bool r = TRUE; I2CBusPtr b = d->pI2CBus; int s = 0; if (r && nWrite > 0) { r = b->I2CAddress(d, d->SlaveAddr & ~1); if (r) { for (; nWrite > 0; WriteBuffer++, nWrite--) if (!(r = b->I2CPutByte(d, *WriteBuffer))) break; s++; } } if (r && nRead > 0) { r = b->I2CAddress(d, d->SlaveAddr | 1); if (r) { for (; nRead > 0; ReadBuffer++, nRead--) if (!(r = b->I2CGetByte(d, ReadBuffer, nRead == 1))) break; s++; } } if (s) b->I2CStop(d); return r; } /* wrapper - for compatibility and convinience */ Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte * WriteBuffer, int nWrite, I2CByte * ReadBuffer, int nRead) { I2CBusPtr b = d->pI2CBus; return b->I2CWriteRead(d, WriteBuffer, nWrite, ReadBuffer, nRead); } /* Read a byte, the only readable register of a device. */ Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte * pbyte) { return xf86I2CWriteRead(d, NULL, 0, pbyte, 1); } /* Read a byte from one of the registers determined by its sub-address. */ Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte * pbyte) { return xf86I2CWriteRead(d, &subaddr, 1, pbyte, 1); } /* Read bytes from subsequent registers determined by the * sub-address of the first register. */ Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte * pbyte, int n) { return xf86I2CWriteRead(d, &subaddr, 1, pbyte, n); } /* Read a word (high byte, then low byte) from one of the registers * determined by its sub-address. */ Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword) { I2CByte rb[2]; if (!xf86I2CWriteRead(d, &subaddr, 1, rb, 2)) return FALSE; *pword = (rb[0] << 8) | rb[1]; return TRUE; } /* Write a byte to one of the registers determined by its sub-address. */ Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte) { I2CByte wb[2]; wb[0] = subaddr; wb[1] = byte; return xf86I2CWriteRead(d, wb, 2, NULL, 0); } /* Write bytes to subsequent registers determined by the * sub-address of the first register. */ Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte * WriteBuffer, int nWrite) { I2CBusPtr b = d->pI2CBus; Bool r = TRUE; if (nWrite > 0) { r = b->I2CAddress(d, d->SlaveAddr & ~1); if (r) { if ((r = b->I2CPutByte(d, subaddr))) for (; nWrite > 0; WriteBuffer++, nWrite--) if (!(r = b->I2CPutByte(d, *WriteBuffer))) break; b->I2CStop(d); } } return r; } /* Write a word (high byte, then low byte) to one of the registers * determined by its sub-address. */ Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word) { I2CByte wb[3]; wb[0] = subaddr; wb[1] = word >> 8; wb[2] = word & 0xFF; return xf86I2CWriteRead(d, wb, 3, NULL, 0); } /* Write a vector of bytes to not adjacent registers. This vector is, * 1st byte sub-address, 2nd byte value, 3rd byte sub-address asf. * This function is intended to initialize devices. Note this function * exits immediately when an error occurs, some registers may * remain uninitialized. */ Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte * vec, int nValues) { I2CBusPtr b = d->pI2CBus; Bool r = TRUE; int s = 0; if (nValues > 0) { for (; nValues > 0; nValues--, vec += 2) { if (!(r = b->I2CAddress(d, d->SlaveAddr & ~1))) break; s++; if (!(r = b->I2CPutByte(d, vec[0]))) break; if (!(r = b->I2CPutByte(d, vec[1]))) break; } if (s > 0) b->I2CStop(d); } return r; } /* Administrative functions. * ========================= */ /* Allocates an I2CDevRec for you and initializes with propper defaults * you may modify before calling xf86I2CDevInit. Your I2CDevRec must * contain at least a SlaveAddr, and a pI2CBus pointer to the bus this * device shall be linked to. * * See function I2CAddress for the slave address format. Always set * the least significant bit, indicating a read or write access, to zero. */ I2CDevPtr xf86CreateI2CDevRec(void) { return calloc(1, sizeof(I2CDevRec)); } /* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec * you should set to free it. */ void xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc) { if (d && d->pI2CBus) { I2CDevPtr *p; /* Remove this from the list of active I2C devices. */ for (p = &d->pI2CBus->FirstDev; *p != NULL; p = &(*p)->NextDev) if (*p == d) { *p = (*p)->NextDev; break; } xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO, "I2C device \"%s:%s\" removed.\n", d->pI2CBus->BusName, d->DevName); } if (unalloc) free(d); } /* I2C transmissions are related to an I2CDevRec you must link to a * previously registered bus (see xf86I2CBusInit) before attempting * to read and write data. You may call xf86I2CProbeAddress first to * see if the device in question is present on this bus. * * xf86I2CDevInit will not allocate an I2CBusRec for you, instead you * may enter a pointer to a statically allocated I2CDevRec or the (modified) * result of xf86CreateI2CDevRec. * * If you don't specify timeouts for the device (n <= 0), it will inherit * the bus-wide defaults. The function returns TRUE on success. */ Bool xf86I2CDevInit(I2CDevPtr d) { I2CBusPtr b; if (d == NULL || (b = d->pI2CBus) == NULL || (d->SlaveAddr & 1) || xf86I2CFindDev(b, d->SlaveAddr) != NULL) return FALSE; if (d->BitTimeout <= 0) d->BitTimeout = b->BitTimeout; if (d->ByteTimeout <= 0) d->ByteTimeout = b->ByteTimeout; if (d->AcknTimeout <= 0) d->AcknTimeout = b->AcknTimeout; if (d->StartTimeout <= 0) d->StartTimeout = b->StartTimeout; d->NextDev = b->FirstDev; b->FirstDev = d; xf86DrvMsg(b->scrnIndex, X_INFO, "I2C device \"%s:%s\" registered at address 0x%02X.\n", b->BusName, d->DevName, d->SlaveAddr); return TRUE; } I2CDevPtr xf86I2CFindDev(I2CBusPtr b, I2CSlaveAddr addr) { I2CDevPtr d; if (b) { for (d = b->FirstDev; d != NULL; d = d->NextDev) if (d->SlaveAddr == addr) return d; } return NULL; } static I2CBusPtr I2CBusList; /* Allocates an I2CBusRec for you and initializes with propper defaults * you may modify before calling xf86I2CBusInit. Your I2CBusRec must * contain at least a BusName, a scrnIndex (or -1), and a complete set * of either high or low level I2C function pointers. You may pass * bus-wide timeouts, otherwise inplausible values will be replaced * with safe defaults. */ I2CBusPtr xf86CreateI2CBusRec(void) { I2CBusPtr b; b = (I2CBusPtr) calloc(1, sizeof(I2CBusRec)); if (b != NULL) { b->scrnIndex = -1; b->pScrn = NULL; b->HoldTime = 5; /* 100 kHz bus */ b->BitTimeout = 5; b->ByteTimeout = 5; b->AcknTimeout = 5; b->StartTimeout = 5; b->RiseFallTime = RISEFALLTIME; } return b; } /* Unregister an I2C bus. If you got the I2CBusRec from xf86CreateI2CBusRec * you should set to free it. If you set , the function * xf86DestroyI2CDevRec will be called for all devices linked to the bus * first, passing down the option. */ void xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too) { if (b) { I2CBusPtr *p; /* Remove this from the list of active I2C buses */ for (p = &I2CBusList; *p != NULL; p = &(*p)->NextBus) if (*p == b) { *p = (*p)->NextBus; break; } if (b->FirstDev != NULL) { if (devs_too) { I2CDevPtr d; while ((d = b->FirstDev) != NULL) { b->FirstDev = d->NextDev; xf86DestroyI2CDevRec(d, unalloc); } } else { if (unalloc) { xf86Msg(X_ERROR, "i2c bug: Attempt to remove I2C bus \"%s\", " "but device list is not empty.\n", b->BusName); return; } } } xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n", b->BusName); if (unalloc) free(b); } } /* I2C masters have to register themselves using this function. * It will not allocate an I2CBusRec for you, instead you may enter * a pointer to a statically allocated I2CBusRec or the (modified) * result of xf86CreateI2CBusRec. Returns TRUE on success. * * At this point there won't be any traffic on the I2C bus. */ Bool xf86I2CBusInit(I2CBusPtr b) { /* I2C buses must be identified by a unique scrnIndex * and name. If scrnIndex is unspecified (a negative value), * then the name must be unique throughout the server. */ if (b->BusName == NULL || xf86I2CFindBus(b->scrnIndex, b->BusName) != NULL) return FALSE; /* If the high level functions are not * supplied, use the generic functions. * In this case we need the low-level * function. */ if (b->I2CWriteRead == NULL) { b->I2CWriteRead = I2CWriteRead; if (b->I2CPutBits == NULL || b->I2CGetBits == NULL) { if (b->I2CPutByte == NULL || b->I2CGetByte == NULL || b->I2CAddress == NULL || b->I2CStart == NULL || b->I2CStop == NULL) return FALSE; } else { b->I2CPutByte = I2CPutByte; b->I2CGetByte = I2CGetByte; b->I2CAddress = I2CAddress; b->I2CStop = I2CStop; b->I2CStart = I2CStart; } } if (b->I2CUDelay == NULL) b->I2CUDelay = I2CUDelay; if (b->HoldTime < 2) b->HoldTime = 5; if (b->BitTimeout <= 0) b->BitTimeout = b->HoldTime; if (b->ByteTimeout <= 0) b->ByteTimeout = b->HoldTime; if (b->AcknTimeout <= 0) b->AcknTimeout = b->HoldTime; if (b->StartTimeout <= 0) b->StartTimeout = b->HoldTime; /* Put new bus on list. */ b->NextBus = I2CBusList; I2CBusList = b; xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n", b->BusName); return TRUE; } I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name) { I2CBusPtr p; if (name != NULL) for (p = I2CBusList; p != NULL; p = p->NextBus) if (scrnIndex < 0 || p->scrnIndex == scrnIndex) if (!strcmp(p->BusName, name)) return p; return NULL; } /* * Return an array of I2CBusPtr's related to a screen. The caller is * responsible for freeing the array. */ int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr ** pppI2CBus) { I2CBusPtr pI2CBus; int n = 0; if (pppI2CBus) *pppI2CBus = NULL; for (pI2CBus = I2CBusList; pI2CBus; pI2CBus = pI2CBus->NextBus) { if ((pI2CBus->scrnIndex >= 0) && (pI2CBus->scrnIndex != scrnIndex)) continue; n++; if (!pppI2CBus) continue; *pppI2CBus = xnfreallocarray(*pppI2CBus, n, sizeof(I2CBusPtr)); (*pppI2CBus)[n - 1] = pI2CBus; } return n; } xorg-server-1.20.8/hw/xfree86/i2c/Makefile.in0000644000175000017500000006766013640201513015447 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/i2c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libi2c_la_LIBADD = am_libi2c_la_OBJECTS = xf86i2c.lo libi2c_la_OBJECTS = $(am_libi2c_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/xf86i2c.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libi2c_la_SOURCES) DIST_SOURCES = $(libi2c_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libi2c.la libi2c_la_SOURCES = xf86i2c.c AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = xf86i2c.h i2c_def.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/i2c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/i2c/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libi2c.la: $(libi2c_la_OBJECTS) $(libi2c_la_DEPENDENCIES) $(EXTRA_libi2c_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libi2c_la_OBJECTS) $(libi2c_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86i2c.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/xf86i2c.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/xf86i2c.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/i2c/i2c_def.h0000644000175000017500000000011213640201473015026 00000000000000#ifndef __I2C_DEF_H__ #define __I2C_DEF_H__ #include "xf86i2c.h" #endif xorg-server-1.20.8/hw/xfree86/i2c/meson.build0000644000175000017500000000040413640201473015530 00000000000000srcs_xorg_i2c = [ 'xf86i2c.c' ] xorg_i2c = static_library('xorg_i2c', srcs_xorg_i2c, include_directories: [inc, xorg_inc], dependencies: common_dep, c_args: xorg_c_args, ) install_data(['xf86i2c.h', 'i2c_def.h'], install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/i2c/xf86i2c.h0000644000175000017500000001020613640201473014731 00000000000000/* * Copyright (C) 1998 Itai Nahshon, Michael Schimek */ #ifndef _XF86I2C_H #define _XF86I2C_H #include "regionstr.h" #include "xf86.h" typedef unsigned char I2CByte; typedef unsigned short I2CSlaveAddr; typedef struct _I2CBusRec *I2CBusPtr; typedef struct _I2CDevRec *I2CDevPtr; /* I2C masters have to register themselves */ typedef struct _I2CBusRec { char *BusName; int scrnIndex; ScrnInfoPtr pScrn; void (*I2CUDelay) (I2CBusPtr b, int usec); void (*I2CPutBits) (I2CBusPtr b, int scl, int sda); void (*I2CGetBits) (I2CBusPtr b, int *scl, int *sda); /* Look at the generic routines to see how these functions should behave. */ Bool (*I2CStart) (I2CBusPtr b, int timeout); Bool (*I2CAddress) (I2CDevPtr d, I2CSlaveAddr); void (*I2CStop) (I2CDevPtr d); Bool (*I2CPutByte) (I2CDevPtr d, I2CByte data); Bool (*I2CGetByte) (I2CDevPtr d, I2CByte * data, Bool); DevUnion DriverPrivate; int HoldTime; /* 1 / bus clock frequency, 5 or 2 usec */ int BitTimeout; /* usec */ int ByteTimeout; /* usec */ int AcknTimeout; /* usec */ int StartTimeout; /* usec */ int RiseFallTime; /* usec */ I2CDevPtr FirstDev; I2CBusPtr NextBus; Bool (*I2CWriteRead) (I2CDevPtr d, I2CByte * WriteBuffer, int nWrite, I2CByte * ReadBuffer, int nRead); } I2CBusRec; #define CreateI2CBusRec xf86CreateI2CBusRec extern _X_EXPORT I2CBusPtr xf86CreateI2CBusRec(void); #define DestroyI2CBusRec xf86DestroyI2CBusRec extern _X_EXPORT void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too); #define I2CBusInit xf86I2CBusInit extern _X_EXPORT Bool xf86I2CBusInit(I2CBusPtr pI2CBus); extern _X_EXPORT I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name); extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr ** pppI2CBus); /* I2C slave devices */ typedef struct _I2CDevRec { const char *DevName; int BitTimeout; /* usec */ int ByteTimeout; /* usec */ int AcknTimeout; /* usec */ int StartTimeout; /* usec */ I2CSlaveAddr SlaveAddr; I2CBusPtr pI2CBus; I2CDevPtr NextDev; DevUnion DriverPrivate; } I2CDevRec; #define CreateI2CDevRec xf86CreateI2CDevRec extern _X_EXPORT I2CDevPtr xf86CreateI2CDevRec(void); extern _X_EXPORT void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc); #define I2CDevInit xf86I2CDevInit extern _X_EXPORT Bool xf86I2CDevInit(I2CDevPtr pI2CDev); extern _X_EXPORT I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr); /* See descriptions of these functions in xf86i2c.c */ #define I2CProbeAddress xf86I2CProbeAddress extern _X_EXPORT Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr); #define I2C_WriteRead xf86I2CWriteRead extern _X_EXPORT Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte * WriteBuffer, int nWrite, I2CByte * ReadBuffer, int nRead); #define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr) extern _X_EXPORT Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte * pbyte); extern _X_EXPORT Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte * pbyte); extern _X_EXPORT Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte * pbyte, int n); extern _X_EXPORT Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword); #define xf86I2CWrite(d, wb, nw) xf86I2CWriteRead(d, wb, nw, NULL, 0) extern _X_EXPORT Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte); extern _X_EXPORT Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte * WriteBuffer, int nWrite); extern _X_EXPORT Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word); extern _X_EXPORT Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte * vec, int nValues); #endif /*_XF86I2C_H */ xorg-server-1.20.8/hw/xfree86/sdksyms.sh0000755000175000017500000002060013640201473014745 00000000000000#!/bin/sh cat > sdksyms.c << EOF /* This file is automatically generated by sdksyms.sh. */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #ifdef HAVE_XORG_CONFIG_H #include #endif /* These must be included first */ #include "misc.h" #include "miscstruct.h" /* render/Makefile.am */ #include "picture.h" #include "mipict.h" #include "glyphstr.h" #include "picturestr.h" /* fb/Makefile.am -- module */ /* #include "fb.h" #include "fbrop.h" #include "fboverlay.h" #include "wfbrename.h" #include "fbpict.h" */ /* miext/shadow/Makefile.am -- module */ /* #include "shadow.h" */ /* miext/damage/Makefile.am */ #include "damage.h" #include "damagestr.h" /* miext/sync/Makefile.am */ #include "misync.h" #include "misyncstr.h" #if HAVE_XSHMFENCE #include "misyncshm.h" #endif /* Xext/Makefile.am -- half is module, half is builtin */ #ifdef XV #include "xvdix.h" #include "xvmcext.h" #endif #include "geext.h" #ifdef MITSHM #include "shmint.h" #endif #include "syncsdk.h" #ifdef XINERAMA # include "panoramiXsrv.h" # include "panoramiX.h" #endif /* glx/Makefile.am */ #ifdef GLX #include "vndserver.h" #endif /* hw/xfree86/int10/Makefile.am -- module */ /* #include "xf86int10.h" */ /* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ #include "xf86i2c.h" /* #include "bt829.h" #include "fi1236.h" #include "msp3430.h" #include "tda8425.h" #include "tda9850.h" #include "tda9885.h" #include "uda1380.h" #include "i2c_def.h" */ /* hw/xfree86/modes/Makefile.am */ #include "xf86Crtc.h" #include "xf86Modes.h" #include "xf86RandR12.h" /* #include "xf86Rename.h" */ /* hw/xfree86/ddc/Makefile.am */ #include "edid.h" #include "xf86DDC.h" /* hw/xfree86/dri2/Makefile.am -- module */ #ifdef DRI2 # include "dri2.h" #endif # include "dri3.h" /* hw/xfree86/vgahw/Makefile.am -- module */ /* #include "vgaHW.h" */ /* hw/xfree86/fbdevhw/Makefile.am -- module */ /* #include "fbdevhw.h" */ /* hw/xfree86/common/Makefile.am */ #include "compiler.h" #include "fourcc.h" #include "xf86.h" #include "xf86Module.h" #include "xf86Opt.h" #ifdef XSERVER_LIBPCIACCESS #include "xf86VGAarbiter.h" #endif #include "xf86Priv.h" #include "xf86Privstr.h" #include "xf86cmap.h" #include "xf86fbman.h" #include "xf86str.h" #include "xf86Xinput.h" #include "xisb.h" #ifdef XV # include "xf86xv.h" # include "xf86xvmc.h" # include "xf86xvpriv.h" #endif #include "xorgVersion.h" #if defined(__sparc__) || defined(__sparc) # include "xf86sbusBus.h" #endif /* hw/xfree86/ramdac/Makefile.am */ #include "BT.h" #include "IBM.h" #include "TI.h" #include "xf86Cursor.h" #include "xf86RamDac.h" /* hw/xfree86/shadowfb/Makefile.am -- module */ /* #include "shadowfb.h" */ /* hw/xfree86/os-support/solaris/Makefile.am */ #if defined(sun386) # include "agpgart.h" #endif /* hw/xfree86/os-support/Makefile.am */ #include "xf86_OSproc.h" #include "xf86_OSlib.h" /* hw/xfree86/os-support/bus/Makefile.am */ #ifdef XSERVER_LIBPCIACCESS # include "xf86Pci.h" #endif #if defined(__sparc__) || defined(__sparc) # include "xf86Sbus.h" #endif /* hw/xfree86/parser/Makefile.am */ #include "xf86Parser.h" #include "xf86Optrec.h" /* hw/xfree86/vbe/Makefile.am -- module */ /* #include "vbe.h" #include "vbeModes.h" */ /* hw/xfree86/dri/Makefile.am -- module */ #ifdef XF86DRI # include "dri.h" # include "sarea.h" # include "dristruct.h" #endif /* mi/Makefile.am */ #include "micmap.h" #include "miline.h" #include "mipointer.h" #include "mi.h" #include "migc.h" #include "mipointrst.h" #include "mizerarc.h" #include "micoord.h" #include "mifillarc.h" #include "mistruct.h" #include "mioverlay.h" /* randr/Makefile.am */ #include "randrstr.h" #include "rrtransform.h" /* dbe/Makefile.am -- module */ #ifdef DBE #include "dbestruct.h" #endif /* exa/Makefile.am -- module */ /* #include "exa.h" */ #ifdef COMPOSITE #include "compositeext.h" #endif /* xfixes/Makefile.am */ #include "xfixes.h" /* include/Makefile.am */ #include "XIstubs.h" #include "Xprintf.h" #include "closestr.h" #include "closure.h" #include "colormap.h" #include "colormapst.h" #include "hotplug.h" #include "client.h" #include "cursor.h" #include "cursorstr.h" #include "dix.h" #include "dixaccess.h" #include "dixevents.h" #define _FONTPROTO_H #include "dixfont.h" #include "dixfontstr.h" #include "dixgrabs.h" #include "dixstruct.h" #include "exevents.h" #include "extension.h" #include "extnsionst.h" #include "gc.h" #include "gcstruct.h" #include "globals.h" #include "input.h" #include "inputstr.h" /* already included */ /* #include "misc.h" #include "miscstruct.h" */ #include "opaque.h" #include "os.h" #include "pixmap.h" #include "pixmapstr.h" #include "privates.h" #include "property.h" #include "propertyst.h" #include "ptrveloc.h" #include "region.h" #include "regionstr.h" #include "registry.h" #include "resource.h" #include "rgb.h" #include "screenint.h" #include "scrnintstr.h" #include "selection.h" #include "servermd.h" #include "site.h" #include "validate.h" #include "window.h" #include "windowstr.h" #include "xace.h" #include "xkbfile.h" #include "xkbsrv.h" #include "xkbstr.h" #include "xkbrules.h" #include "xserver-properties.h" EOF topdir=$(readlink -f $1) shift LC_ALL=C export LC_ALL ${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $? ${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' BEGIN { sdk = 0; print("/*"); print(" * These symbols are referenced to ensure they"); print(" * will be available in the X Server binary."); print(" */"); printf("/* topdir=%s */\n", topdir); print("_X_HIDDEN void *xorg_symbols[] = {"); printf("sdksyms.c:") > "sdksyms.dep"; } /^# [0-9]+ "/ { # Match preprocessor linemarkers which have the form: # # linenum "filename" flags # # Only process text for sdk exports where the linemarker filename has a # relative path, or an absolute path matching $top_srcdir. # # canonicalize filename if ($3 in canonicalized) { c = canonicalized[$3] } else { cmd = "readlink -f " $3 cmd | getline c close(cmd) canonicalized[$3] = c } # note that index() starts at 1; 0 means no match. sdk = $3 !~ /^"\// || index(c, topdir) == 1; if (sdk && $3 ~ /\.h"$/) { # remove quotes gsub(/"/, "", $3); line = $2; header = $3; if (! headers[$3]) { printf(" \\\n %s", $3) >> "sdksyms.dep"; headers[$3] = 1; } } next; } /^extern[ ]/ { if (sdk) { n = 3; # skip line numbers GCC 5 adds before __attribute__ while ($n == "" || $0 ~ /^# [0-9]+ "/) { getline; n = 1; } # skip attribute, if any while ($n ~ /^(__attribute__|__global)/ || # skip modifiers, if any $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ || # skip pointer $n ~ /^[a-zA-Z0-9_]*\*$/) { n++; # skip line numbers GCC 5 adds after __attribute__ while ($n == "" || $0 ~ /^# [0-9]+ "/) { getline; n = 1; } } # hack: pid_t becomes __pid_t on NetBSD, same for uint32_t -> __uint32_t. # GCC 5 inserts additional lines around this. if (($1 == "__pid_t" || $1 == "__uint32_t") && NF == 1) { getline; n++; # skip line numbers GCC 5 adds (after typedef return type?) while ($n == "" || $0 ~ /^# [0-9]+ "/) { getline; n = 1; } } # type specifier may not be set, as in # extern _X_EXPORT unsigned name(...) if ($n !~ /[^a-zA-Z0-9_]/) n++; # go back if we are at the parameter list already if ($n ~ /^[(]([^*].*)?$/) n--; # match # extern _X_EXPORT type (* name[])(...) if ($n ~ /^[^a-zA-Z0-9_]+$/) n++; # match # extern _X_EXPORT const name *const ... if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) n++; # actual name may be in the next line, as in # extern _X_EXPORT type # possibly ending with a * # name(...) if ($n == "" || $n ~ /^\*+$/) { getline; n = 1; # indent may have inserted a blank link if ($0 == "") getline; } # dont modify $0 or $n symbol = $n; # remove starting non word chars sub(/^[^a-zA-Z0-9_]+/, "",symbol); # remove from first non word to end of line sub(/[^a-zA-Z0-9_].*/, "", symbol); #print; if (symbol != "") printf(" (void *) &%-50s /* %s:%s */\n", symbol ",", header, line); } } { line++; } END { print("};"); print("") >> "sdksyms.dep"; }' > _sdksyms.c STATUS=$? cat _sdksyms.c >> sdksyms.c rm _sdksyms.c [ $? != 0 ] && exit $? exit $STATUS xorg-server-1.20.8/hw/xfree86/loader/0000755000175000017500000000000013640201534014237 500000000000000xorg-server-1.20.8/hw/xfree86/loader/loadmod.c0000644000175000017500000007316213640201473015755 00000000000000/* * Copyright 1995-1998 by Metro Link, 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 Metro Link, Inc. not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Metro Link, Inc. makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL METRO LINK, INC. 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. */ /* * Copyright (c) 1997-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "dix.h" #include "os.h" #include "loaderProcs.h" #include "xf86Module.h" #include "loader.h" #include #include #include #include #include typedef struct _pattern { const char *pattern; regex_t rex; } PatternRec, *PatternPtr; /* Prototypes for static functions */ static char *FindModule(const char *, const char *, PatternPtr); static Bool CheckVersion(const char *, XF86ModuleVersionInfo *, const XF86ModReqInfo *); static char *LoaderGetCanonicalName(const char *, PatternPtr); static void RemoveChild(ModuleDescPtr); const ModuleVersions LoaderVersionInfo = { XORG_VERSION_CURRENT, ABI_ANSIC_VERSION, ABI_VIDEODRV_VERSION, ABI_XINPUT_VERSION, ABI_EXTENSION_VERSION, }; static int ModuleDuplicated[] = { }; static void FreeStringList(char **paths) { char **p; if (!paths) return; for (p = paths; *p; p++) free(*p); free(paths); } static char **defaultPathList = NULL; static Bool PathIsAbsolute(const char *path) { return *path == '/'; } /* * Convert a comma-separated path into a NULL-terminated array of path * elements, rejecting any that are not full absolute paths, and appending * a '/' when it isn't already present. */ static char ** InitPathList(const char *path) { char *fullpath = NULL; char *elem = NULL; char **list = NULL, **save = NULL; int len; int addslash; int n = 0; fullpath = strdup(path); if (!fullpath) return NULL; elem = strtok(fullpath, ","); while (elem) { if (PathIsAbsolute(elem)) { len = strlen(elem); addslash = (elem[len - 1] != '/'); if (addslash) len++; save = list; list = reallocarray(list, n + 2, sizeof(char *)); if (!list) { if (save) { save[n] = NULL; FreeStringList(save); } free(fullpath); return NULL; } list[n] = malloc(len + 1); if (!list[n]) { FreeStringList(list); free(fullpath); return NULL; } strcpy(list[n], elem); if (addslash) { list[n][len - 1] = '/'; list[n][len] = '\0'; } n++; } elem = strtok(NULL, ","); } if (list) list[n] = NULL; free(fullpath); return list; } void LoaderSetPath(const char *path) { if (!path) return; FreeStringList(defaultPathList); defaultPathList = InitPathList(path); } /* Standard set of module subdirectories to search, in order of preference */ static const char *stdSubdirs[] = { "", "input/", "drivers/", "extensions/", NULL }; /* * Standard set of module name patterns to check, in order of preference * These are regular expressions (suitable for use with POSIX regex(3)). * * This list assumes that you're an ELFish platform and therefore your * shared libraries are named something.so. If we're ever nuts enough * to port this DDX to, say, Darwin, we'll need to fix this. */ static PatternRec stdPatterns[] = { #ifdef __CYGWIN__ {"^cyg(.*)\\.dll$",}, {"(.*)_drv\\.dll$",}, {"(.*)\\.dll$",}, #else {"^lib(.*)\\.so$",}, {"(.*)_drv\\.so$",}, {"(.*)\\.so$",}, #endif {NULL,} }; static PatternPtr InitPatterns(const char **patternlist) { char errmsg[80]; int i, e; PatternPtr patterns = NULL; PatternPtr p = NULL; static int firstTime = 1; const char **s; if (firstTime) { /* precompile stdPatterns */ firstTime = 0; for (p = stdPatterns; p->pattern; p++) if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) { regerror(e, &p->rex, errmsg, sizeof(errmsg)); FatalError("InitPatterns: regcomp error for `%s': %s\n", p->pattern, errmsg); } } if (patternlist) { for (i = 0, s = patternlist; *s; i++, s++) if (*s == DEFAULT_LIST) i += ARRAY_SIZE(stdPatterns) - 1 - 1; patterns = xallocarray(i + 1, sizeof(PatternRec)); if (!patterns) { return NULL; } for (i = 0, s = patternlist; *s; i++, s++) if (*s != DEFAULT_LIST) { p = patterns + i; p->pattern = *s; if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) { regerror(e, &p->rex, errmsg, sizeof(errmsg)); ErrorF("InitPatterns: regcomp error for `%s': %s\n", p->pattern, errmsg); i--; } } else { for (p = stdPatterns; p->pattern; p++, i++) patterns[i] = *p; if (p != stdPatterns) i--; } patterns[i].pattern = NULL; } else patterns = stdPatterns; return patterns; } static void FreePatterns(PatternPtr patterns) { if (patterns && patterns != stdPatterns) free(patterns); } static char * FindModuleInSubdir(const char *dirpath, const char *module) { struct dirent *direntry = NULL; DIR *dir = NULL; char *ret = NULL, tmpBuf[PATH_MAX]; struct stat stat_buf; dir = opendir(dirpath); if (!dir) return NULL; while ((direntry = readdir(dir))) { if (direntry->d_name[0] == '.') continue; snprintf(tmpBuf, PATH_MAX, "%s%s/", dirpath, direntry->d_name); /* the stat with the appended / fails for normal files, and works for sub dirs fine, looks a bit strange in strace but does seem to work */ if ((stat(tmpBuf, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode)) { if ((ret = FindModuleInSubdir(tmpBuf, module))) break; continue; } #ifdef __CYGWIN__ snprintf(tmpBuf, PATH_MAX, "cyg%s.dll", module); #else snprintf(tmpBuf, PATH_MAX, "lib%s.so", module); #endif if (strcmp(direntry->d_name, tmpBuf) == 0) { if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) ret = NULL; break; } #ifdef __CYGWIN__ snprintf(tmpBuf, PATH_MAX, "%s_drv.dll", module); #else snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module); #endif if (strcmp(direntry->d_name, tmpBuf) == 0) { if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) ret = NULL; break; } #ifdef __CYGWIN__ snprintf(tmpBuf, PATH_MAX, "%s.dll", module); #else snprintf(tmpBuf, PATH_MAX, "%s.so", module); #endif if (strcmp(direntry->d_name, tmpBuf) == 0) { if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) ret = NULL; break; } } closedir(dir); return ret; } static char * FindModule(const char *module, const char *dirname, PatternPtr patterns) { char buf[PATH_MAX + 1]; char *name = NULL; const char **s; if (strlen(dirname) > PATH_MAX) return NULL; for (s = stdSubdirs; *s; s++) { snprintf(buf, PATH_MAX, "%s%s", dirname, *s); if ((name = FindModuleInSubdir(buf, module))) break; } return name; } const char ** LoaderListDir(const char *subdir, const char **patternlist) { char buf[PATH_MAX + 1]; char **pathlist; char **elem; PatternPtr patterns = NULL; PatternPtr p; DIR *d; struct dirent *dp; regmatch_t match[2]; struct stat stat_buf; int len, dirlen; char *fp; char **listing = NULL; char **save; char **ret = NULL; int n = 0; if (!(pathlist = defaultPathList)) return NULL; if (!(patterns = InitPatterns(patternlist))) goto bail; for (elem = pathlist; *elem; elem++) { dirlen = snprintf(buf, PATH_MAX, "%s/%s", *elem, subdir); fp = buf + dirlen; if (stat(buf, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode) && (d = opendir(buf))) { if (buf[dirlen - 1] != '/') { buf[dirlen++] = '/'; fp++; } while ((dp = readdir(d))) { if (dirlen + strlen(dp->d_name) > PATH_MAX) continue; strcpy(fp, dp->d_name); if (!(stat(buf, &stat_buf) == 0 && S_ISREG(stat_buf.st_mode))) continue; for (p = patterns; p->pattern; p++) { if (regexec(&p->rex, dp->d_name, 2, match, 0) == 0 && match[1].rm_so != -1) { len = match[1].rm_eo - match[1].rm_so; save = listing; listing = reallocarray(listing, n + 2, sizeof(char *)); if (!listing) { if (save) { save[n] = NULL; FreeStringList(save); } closedir(d); goto bail; } listing[n] = malloc(len + 1); if (!listing[n]) { FreeStringList(listing); closedir(d); goto bail; } strncpy(listing[n], dp->d_name + match[1].rm_so, len); listing[n][len] = '\0'; n++; break; } } } closedir(d); } } if (listing) listing[n] = NULL; ret = listing; bail: FreePatterns(patterns); return (const char **) ret; } static Bool CheckVersion(const char *module, XF86ModuleVersionInfo * data, const XF86ModReqInfo * req) { int vercode[4]; long ver = data->xf86version; MessageType errtype; LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", data->modname ? data->modname : "UNKNOWN!", data->vendor ? data->vendor : "UNKNOWN!"); vercode[0] = ver / 10000000; vercode[1] = (ver / 100000) % 100; vercode[2] = (ver / 1000) % 100; vercode[3] = ver % 1000; LogWrite(1, "\tcompiled for %d.%d.%d", vercode[0], vercode[1], vercode[2]); if (vercode[3] != 0) LogWrite(1, ".%d", vercode[3]); LogWrite(1, ", module version = %d.%d.%d\n", data->majorversion, data->minorversion, data->patchlevel); if (data->moduleclass) LogWrite(2, "\tModule class: %s\n", data->moduleclass); ver = -1; if (data->abiclass) { int abimaj, abimin; int vermaj, vermin; if (!strcmp(data->abiclass, ABI_CLASS_ANSIC)) ver = LoaderVersionInfo.ansicVersion; else if (!strcmp(data->abiclass, ABI_CLASS_VIDEODRV)) ver = LoaderVersionInfo.videodrvVersion; else if (!strcmp(data->abiclass, ABI_CLASS_XINPUT)) ver = LoaderVersionInfo.xinputVersion; else if (!strcmp(data->abiclass, ABI_CLASS_EXTENSION)) ver = LoaderVersionInfo.extensionVersion; abimaj = GET_ABI_MAJOR(data->abiversion); abimin = GET_ABI_MINOR(data->abiversion); LogWrite(2, "\tABI class: %s, version %d.%d\n", data->abiclass, abimaj, abimin); if (ver != -1) { vermaj = GET_ABI_MAJOR(ver); vermin = GET_ABI_MINOR(ver); if (abimaj != vermaj) { if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) errtype = X_WARNING; else errtype = X_ERROR; LogMessageVerb(errtype, 0, "%s: module ABI major version (%d) " "doesn't match the server's version (%d)\n", module, abimaj, vermaj); if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)) return FALSE; } else if (abimin > vermin) { if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) errtype = X_WARNING; else errtype = X_ERROR; LogMessageVerb(errtype, 0, "%s: module ABI minor version (%d) " "is newer than the server's version (%d)\n", module, abimin, vermin); if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)) return FALSE; } } } /* Check against requirements that the caller has specified */ if (req) { if (data->majorversion != req->majorversion) { LogMessageVerb(X_WARNING, 2, "%s: module major version (%d) " "doesn't match required major version (%d)\n", module, data->majorversion, req->majorversion); return FALSE; } else if (data->minorversion < req->minorversion) { LogMessageVerb(X_WARNING, 2, "%s: module minor version (%d) is " "less than the required minor version (%d)\n", module, data->minorversion, req->minorversion); return FALSE; } else if (data->minorversion == req->minorversion && data->patchlevel < req->patchlevel) { LogMessageVerb(X_WARNING, 2, "%s: module patch level (%d) " "is less than the required patch level " "(%d)\n", module, data->patchlevel, req->patchlevel); return FALSE; } if (req->moduleclass) { if (!data->moduleclass || strcmp(req->moduleclass, data->moduleclass)) { LogMessageVerb(X_WARNING, 2, "%s: Module class (%s) doesn't " "match the required class (%s)\n", module, data->moduleclass ? data->moduleclass : "", req->moduleclass); return FALSE; } } else if (req->abiclass != ABI_CLASS_NONE) { if (!data->abiclass || strcmp(req->abiclass, data->abiclass)) { LogMessageVerb(X_WARNING, 2, "%s: ABI class (%s) doesn't match" " the required ABI class (%s)\n", module, data->abiclass ? data->abiclass : "", req->abiclass); return FALSE; } } if (req->abiclass != ABI_CLASS_NONE) { int reqmaj, reqmin, maj, min; reqmaj = GET_ABI_MAJOR(req->abiversion); reqmin = GET_ABI_MINOR(req->abiversion); maj = GET_ABI_MAJOR(data->abiversion); min = GET_ABI_MINOR(data->abiversion); if (maj != reqmaj) { LogMessageVerb(X_WARNING, 2, "%s: ABI major version (%d) " "doesn't match the required ABI major version " "(%d)\n", module, maj, reqmaj); return FALSE; } /* XXX Maybe this should be the other way around? */ if (min > reqmin) { LogMessageVerb(X_WARNING, 2, "%s: module ABI minor version " "(%d) is newer than that available (%d)\n", module, min, reqmin); return FALSE; } } } return TRUE; } static ModuleDescPtr AddSibling(ModuleDescPtr head, ModuleDescPtr new) { new->sib = head; return new; } void * LoadSubModule(void *_parent, const char *module, const char **subdirlist, const char **patternlist, void *options, const XF86ModReqInfo * modreq, int *errmaj, int *errmin) { ModuleDescPtr submod; ModuleDescPtr parent = (ModuleDescPtr) _parent; LogMessageVerb(X_INFO, 3, "Loading sub module \"%s\"\n", module); if (PathIsAbsolute(module)) { LogMessage(X_ERROR, "LoadSubModule: " "Absolute module path not permitted: \"%s\"\n", module); if (errmaj) *errmaj = LDR_BADUSAGE; if (errmin) *errmin = 0; return NULL; } submod = LoadModule(module, options, modreq, errmaj); if (submod && submod != (ModuleDescPtr) 1) { parent->child = AddSibling(parent->child, submod); submod->parent = parent; } return submod; } ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) { ModuleDescPtr ret; if (!mod) return NULL; ret = calloc(1, sizeof(ModuleDesc)); if (ret == NULL) return NULL; ret->handle = mod->handle; ret->SetupProc = mod->SetupProc; ret->TearDownProc = mod->TearDownProc; ret->TearDownData = ModuleDuplicated; ret->child = DuplicateModule(mod->child, ret); ret->sib = DuplicateModule(mod->sib, parent); ret->parent = parent; ret->VersionInfo = mod->VersionInfo; return ret; } static const char *compiled_in_modules[] = { "ddc", "i2c", "ramdac", "dbe", "record", "extmod", "dri", "dri2", #ifdef DRI3 "dri3", #endif #ifdef PRESENT "present", #endif NULL }; /* * LoadModule: load a module * * module The module name. Normally this is not a filename but the * module's "canonical name. A full pathname is, however, * also accepted. * options A NULL terminated list of Options that are passed to the * module's SetupProc function. * modreq An optional XF86ModReqInfo* containing * version/ABI/vendor-ABI requirements to check for when * loading the module. The following fields of the * XF86ModReqInfo struct are checked: * majorversion - must match the module's majorversion exactly * minorversion - the module's minorversion must be >= this * patchlevel - the module's minorversion.patchlevel must be * >= this. Patchlevel is ignored when * minorversion is not set. * abiclass - (string) must match the module's abiclass * abiversion - must be consistent with the module's * abiversion (major equal, minor no older) * moduleclass - string must match the module's moduleclass * string * "don't care" values are ~0 for numbers, and NULL for strings * errmaj Major error return. * */ ModuleDescPtr LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq, int *errmaj) { XF86ModuleData *initdata = NULL; char **pathlist = NULL; char *found = NULL; char *name = NULL; char **path_elem = NULL; char *p = NULL; ModuleDescPtr ret = NULL; PatternPtr patterns = NULL; int noncanonical = 0; char *m = NULL; const char **cim; LogMessageVerb(X_INFO, 3, "LoadModule: \"%s\"", module); patterns = InitPatterns(NULL); name = LoaderGetCanonicalName(module, patterns); noncanonical = (name && strcmp(module, name) != 0); if (noncanonical) { LogWrite(3, " (%s)\n", name); LogMessageVerb(X_WARNING, 1, "LoadModule: given non-canonical module name \"%s\"\n", module); m = name; } else { LogWrite(3, "\n"); m = (char *) module; } for (cim = compiled_in_modules; *cim; cim++) if (!strcmp(m, *cim)) { LogMessageVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m); ret = (ModuleDescPtr) 1; goto LoadModule_exit; } if (!name) { if (errmaj) *errmaj = LDR_BADUSAGE; goto LoadModule_fail; } ret = calloc(1, sizeof(ModuleDesc)); if (!ret) { if (errmaj) *errmaj = LDR_NOMEM; goto LoadModule_fail; } pathlist = defaultPathList; if (!pathlist) { /* This could be a malloc failure too */ if (errmaj) *errmaj = LDR_BADUSAGE; goto LoadModule_fail; } /* * if the module name is not a full pathname, we need to * check the elements in the path */ if (PathIsAbsolute(module)) found = xstrdup(module); path_elem = pathlist; while (!found && *path_elem != NULL) { found = FindModule(m, *path_elem, patterns); path_elem++; /* * When the module name isn't the canonical name, search for the * former if no match was found for the latter. */ if (!*path_elem && m == name) { path_elem = pathlist; m = (char *) module; } } /* * did we find the module? */ if (!found) { LogMessage(X_WARNING, "Warning, couldn't open module %s\n", module); if (errmaj) *errmaj = LDR_NOENT; goto LoadModule_fail; } ret->handle = LoaderOpen(found, errmaj); if (ret->handle == NULL) goto LoadModule_fail; /* drop any explicit suffix from the module name */ p = strchr(name, '.'); if (p) *p = '\0'; /* * now check if the special data object ModuleData is * present. */ if (asprintf(&p, "%sModuleData", name) == -1) { p = NULL; if (errmaj) *errmaj = LDR_NOMEM; goto LoadModule_fail; } initdata = LoaderSymbolFromModule(ret->handle, p); if (initdata) { ModuleSetupProc setup; ModuleTearDownProc teardown; XF86ModuleVersionInfo *vers; vers = initdata->vers; setup = initdata->setup; teardown = initdata->teardown; if (vers) { if (!CheckVersion(module, vers, modreq)) { if (errmaj) *errmaj = LDR_MISMATCH; goto LoadModule_fail; } } else { LogMessage(X_ERROR, "LoadModule: Module %s does not supply" " version information\n", module); if (errmaj) *errmaj = LDR_INVALID; goto LoadModule_fail; } if (setup) ret->SetupProc = setup; if (teardown) ret->TearDownProc = teardown; ret->VersionInfo = vers; } else { /* no initdata, fail the load */ LogMessage(X_ERROR, "LoadModule: Module %s does not have a %s " "data object.\n", module, p); if (errmaj) *errmaj = LDR_INVALID; goto LoadModule_fail; } if (ret->SetupProc) { ret->TearDownData = ret->SetupProc(ret, options, errmaj, NULL); if (!ret->TearDownData) { goto LoadModule_fail; } } else if (options) { LogMessage(X_WARNING, "Module Options present, but no SetupProc " "available for %s\n", module); } goto LoadModule_exit; LoadModule_fail: UnloadModule(ret); ret = NULL; LoadModule_exit: FreePatterns(patterns); free(found); free(name); free(p); return ret; } void UnloadModule(void *_mod) { ModuleDescPtr mod = _mod; if (mod == (ModuleDescPtr) 1) return; if (mod == NULL) return; if (mod->VersionInfo) { const char *name = mod->VersionInfo->modname; if (mod->parent) LogMessageVerbSigSafe(X_INFO, 3, "UnloadSubModule: \"%s\"\n", name); else LogMessageVerbSigSafe(X_INFO, 3, "UnloadModule: \"%s\"\n", name); if (mod->TearDownData != ModuleDuplicated) { if ((mod->TearDownProc) && (mod->TearDownData)) mod->TearDownProc(mod->TearDownData); LoaderUnload(name, mod->handle); } } if (mod->child) UnloadModule(mod->child); if (mod->sib) UnloadModule(mod->sib); free(mod); } void UnloadSubModule(void *_mod) { ModuleDescPtr mod = (ModuleDescPtr) _mod; /* Some drivers are calling us on built-in submodules, ignore them */ if (mod == (ModuleDescPtr) 1) return; RemoveChild(mod); UnloadModule(mod); } static void RemoveChild(ModuleDescPtr child) { ModuleDescPtr mdp; ModuleDescPtr prevsib; ModuleDescPtr parent; if (!child->parent) return; parent = child->parent; if (parent->child == child) { parent->child = child->sib; return; } prevsib = parent->child; mdp = prevsib->sib; while (mdp && mdp != child) { prevsib = mdp; mdp = mdp->sib; } if (mdp == child) prevsib->sib = child->sib; child->sib = NULL; return; } void LoaderErrorMsg(const char *name, const char *modname, int errmaj, int errmin) { const char *msg; MessageType type = X_ERROR; switch (errmaj) { case LDR_NOERROR: msg = "no error"; break; case LDR_NOMEM: msg = "out of memory"; break; case LDR_NOENT: msg = "module does not exist"; break; case LDR_NOLOAD: msg = "loader failed"; break; case LDR_ONCEONLY: msg = "already loaded"; type = X_INFO; break; case LDR_MISMATCH: msg = "module requirement mismatch"; break; case LDR_BADUSAGE: msg = "invalid argument(s) to LoadModule()"; break; case LDR_INVALID: msg = "invalid module"; break; case LDR_BADOS: msg = "module doesn't support this OS"; break; case LDR_MODSPECIFIC: msg = "module-specific error"; break; default: msg = "unknown error"; } if (name) LogMessage(type, "%s: Failed to load module \"%s\" (%s, %d)\n", name, modname, msg, errmin); else LogMessage(type, "Failed to load module \"%s\" (%s, %d)\n", modname, msg, errmin); } /* Given a module path or file name, return the module's canonical name */ static char * LoaderGetCanonicalName(const char *modname, PatternPtr patterns) { char *str; const char *s; int len; PatternPtr p; regmatch_t match[2]; /* Strip off any leading path */ s = strrchr(modname, '/'); if (s == NULL) s = modname; else s++; /* Find the first regex that is matched */ for (p = patterns; p->pattern; p++) if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) { len = match[1].rm_eo - match[1].rm_so; str = malloc(len + 1); if (!str) return NULL; strncpy(str, s + match[1].rm_so, len); str[len] = '\0'; return str; } /* If there is no match, return the whole name minus the leading path */ return strdup(s); } /* * Return the module version information. */ unsigned long LoaderGetModuleVersion(ModuleDescPtr mod) { if (!mod || mod == (ModuleDescPtr) 1 || !mod->VersionInfo) return 0; return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion, mod->VersionInfo->minorversion, mod->VersionInfo->patchlevel); } xorg-server-1.20.8/hw/xfree86/loader/Makefile.am0000644000175000017500000000065513640201473016223 00000000000000noinst_LTLIBRARIES = libloader.la AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../parser \ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \ -I$(srcdir)/../ramdac -I$(srcdir)/../dri -I$(srcdir)/../dri2 #AM_LDFLAGS = -r AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = \ loader.h \ loaderProcs.h libloader_la_SOURCES = \ loader.c \ loaderProcs.h \ loadmod.c libloader_la_LIBADD = $(DLOPEN_LIBS) xorg-server-1.20.8/hw/xfree86/loader/loaderProcs.h0000644000175000017500000000722513640201473016615 00000000000000/* * Copyright 1995-1998 by Metro Link, 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 Metro Link, Inc. not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Metro Link, Inc. makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL METRO LINK, INC. 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. */ /* * Copyright (c) 1997-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _LOADERPROCS_H #define _LOADERPROCS_H #include "xf86Module.h" typedef struct module_desc { struct module_desc *child; struct module_desc *sib; struct module_desc *parent; void *handle; ModuleSetupProc SetupProc; ModuleTearDownProc TearDownProc; void *TearDownData; /* returned from SetupProc */ const XF86ModuleVersionInfo *VersionInfo; } ModuleDesc, *ModuleDescPtr; /* External API for the loader */ void LoaderInit(void); ModuleDescPtr LoadModule(const char *, void *, const XF86ModReqInfo *, int *); ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent); void UnloadDriver(ModuleDescPtr); void LoaderSetPath(const char *path); void LoaderUnload(const char *, void *); unsigned long LoaderGetModuleVersion(ModuleDescPtr mod); void LoaderResetOptions(void); void LoaderSetOptions(unsigned long); const char **LoaderListDir(const char *, const char **); /* Options for LoaderSetOptions */ #define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001 #endif /* _LOADERPROCS_H */ xorg-server-1.20.8/hw/xfree86/loader/loader.h0000644000175000017500000000625313640201473015606 00000000000000/* * Copyright 1995-1998 by Metro Link, 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 Metro Link, Inc. not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Metro Link, Inc. makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL METRO LINK, INC. 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. */ /* * Copyright (c) 1997-2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _LOADER_H #define _LOADER_H #include #include #include /* Compiled-in version information */ typedef struct { int xf86Version; int ansicVersion; int videodrvVersion; int xinputVersion; int extensionVersion; int fontVersion; } ModuleVersions; extern const ModuleVersions LoaderVersionInfo; extern unsigned long LoaderOptions; /* Internal Functions */ void *LoaderOpen(const char *, int *); void *LoaderSymbolFromModule(void *, const char *); #endif /* _LOADER_H */ xorg-server-1.20.8/hw/xfree86/loader/symbol-test.c0000644000175000017500000000341213640201473016607 00000000000000/* * Copyright © 2017 Broadcom * * 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. */ /* Small test program to see if we can successfully resolve all * symbols of a set of X.Org modules when they're loaded in order. */ #include #include #include int main (int argc, char**argv) { void *ret; if (argc < 2) { fprintf(stderr, "Must pass path any modules to be loaded.\n"); exit(1); } for (int i = 1; i < argc; i++) { fprintf(stderr, "opening %s\n", argv[i]); ret = dlopen(argv[i], RTLD_GLOBAL | RTLD_NOW); if (!ret) { fprintf(stderr, "dlopen error: %s\n", dlerror()); exit(1); } } return 0; } xorg-server-1.20.8/hw/xfree86/loader/loader.c0000644000175000017500000001306413640201473015577 00000000000000/* * Copyright 1995-1998 by Metro Link, 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 Metro Link, Inc. not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Metro Link, Inc. makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL METRO LINK, INC. 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. */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "loader.h" #include "loaderProcs.h" #ifdef HAVE_DLFCN_H #include #include #else #error i have no dynamic linker and i must scream #endif #ifndef XORG_NO_SDKSYMS extern void *xorg_symbols[]; #endif void LoaderInit(void) { #ifndef XORG_NO_SDKSYMS LogMessageVerb(X_INFO, 2, "Loader magic: %p\n", (void *) xorg_symbols); #endif LogMessageVerb(X_INFO, 2, "Module ABI versions:\n"); LogWrite(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), GET_ABI_MINOR(LoaderVersionInfo.ansicVersion)); LogWrite(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV, GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion), GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion)); LogWrite(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT, GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion), GET_ABI_MINOR(LoaderVersionInfo.xinputVersion)); LogWrite(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); } /* Public Interface to the loader. */ void * LoaderOpen(const char *module, int *errmaj) { void *ret; #if defined(DEBUG) ErrorF("LoaderOpen(%s)\n", module); #endif LogMessage(X_INFO, "Loading %s\n", module); if (!(ret = dlopen(module, RTLD_LAZY | RTLD_GLOBAL))) { LogMessage(X_ERROR, "Failed to load %s: %s\n", module, dlerror()); if (errmaj) *errmaj = LDR_NOLOAD; return NULL; } return ret; } void * LoaderSymbol(const char *name) { static void *global_scope = NULL; void *p; p = dlsym(RTLD_DEFAULT, name); if (p != NULL) return p; if (!global_scope) global_scope = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); if (global_scope) return dlsym(global_scope, name); return NULL; } void * LoaderSymbolFromModule(void *handle, const char *name) { return dlsym(handle, name); } void LoaderUnload(const char *name, void *handle) { LogMessageVerbSigSafe(X_INFO, 1, "Unloading %s\n", name); if (handle) dlclose(handle); } unsigned long LoaderOptions = 0; void LoaderSetOptions(unsigned long opts) { LoaderOptions |= opts; } Bool LoaderShouldIgnoreABI(void) { return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; } int LoaderGetABIVersion(const char *abiclass) { struct { const char *name; int version; } classes[] = { {ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, {ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, {ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, {ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, {NULL, 0} }; int i; for (i = 0; classes[i].name; i++) { if (!strcmp(classes[i].name, abiclass)) { return classes[i].version; } } return 0; } xorg-server-1.20.8/hw/xfree86/loader/Makefile.in0000644000175000017500000006444513640201513016236 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/loader ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libloader_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libloader_la_OBJECTS = loader.lo loadmod.lo libloader_la_OBJECTS = $(am_libloader_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/loader.Plo ./$(DEPDIR)/loadmod.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libloader_la_SOURCES) DIST_SOURCES = $(libloader_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libloader.la AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../parser \ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \ -I$(srcdir)/../ramdac -I$(srcdir)/../dri -I$(srcdir)/../dri2 #AM_LDFLAGS = -r AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = \ loader.h \ loaderProcs.h libloader_la_SOURCES = \ loader.c \ loaderProcs.h \ loadmod.c libloader_la_LIBADD = $(DLOPEN_LIBS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/loader/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/loader/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libloader.la: $(libloader_la_OBJECTS) $(libloader_la_DEPENDENCIES) $(EXTRA_libloader_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libloader_la_OBJECTS) $(libloader_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loader.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadmod.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/loader.Plo -rm -f ./$(DEPDIR)/loadmod.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/loader.Plo -rm -f ./$(DEPDIR)/loadmod.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/loader/meson.build0000644000175000017500000000051413640201473016323 00000000000000srcs_xorg_loader = [ 'loader.c', 'loadmod.c', ] xorg_loader = static_library('xorg_loader', srcs_xorg_loader, include_directories: [inc, xorg_inc], dependencies: [common_dep, dl_dep], c_args: xorg_c_args, ) xorg_symbol_test = executable('xorg_symbol_test', 'symbol-test.c', dependencies: dl_dep, ) xorg-server-1.20.8/hw/xfree86/xorgconf.cpp0000644000175000017500000004111713640201473015250 00000000000000# # Copyright (c) 1994-1998 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 XFREE86 PROJECT 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 XFree86 Project 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 # XFree86 Project. # # $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $ # ********************************************************************** # This is a sample configuration file only, intended to illustrate # what a config file might look like. Refer to the xorg.conf(__filemansuffix__) # man page for details about the format of this file. # ********************************************************************** # The ordering of sections is not important in XFree86 4.0 and later, # nor in any Xorg release. # ********************************************************************** # Files section. This allows default font and module paths to be set # ********************************************************************** Section "Files" # Multiple FontPath entries are allowed (which are concatenated together), # as well as specifying multiple comma-separated entries in one FontPath # command (or a combination of both methods). # The default path is shown here. # FontPath DEFAULTFONTPATH # ModulePath can be used to set a search path for the X server modules. # The default path is shown here. # ModulePath MODULEPATH EndSection # ********************************************************************** # Module section -- this is an optional section which is used to specify # which run-time loadable modules to load when the X server starts up. # ********************************************************************** Section "Module" # This loads the DBE extension module. Load "dbe" # This loads the miscellaneous extensions module, and disables # initialisation of the XFree86-DGA extension within that module. SubSection "extmod" Option "omit xfree86-dga" EndSubSection EndSection # ********************************************************************** # Server flags section. This contains various server-wide Options. # ********************************************************************** Section "ServerFlags" # Uncomment this to cause a core dump at the spot where a signal is # received. This may leave the console in an unusable state, but may # provide a better stack trace in the core dump to aid in debugging # Option "NoTrapSignals" # Uncomment this to disable the VT switch sequence # (where n is 1 through 12). This allows clients to receive these key # events. # Option "DontVTSwitch" # Uncomment this to disable the server abort sequence # This allows clients to receive this key event. # Option "DontZap" "true" # Uncomment this to disable the / mode switching # sequences. This allows clients to receive these key events. # Option "DontZoom" # Uncomment this to disable tuning with the xvidtune client. With # it the client can still run and fetch card and monitor attributes, # but it will not be allowed to change them. If it tries it will # receive a protocol error. # Option "DisableVidModeExtension" # Uncomment this to enable the use of a non-local xvidtune client. # Option "AllowNonLocalXvidtune" # Set the basic blanking screen saver timeout. Option "BlankTime" "10" # 10 minutes # Set the DPMS timeouts. These are set here because they are global # rather than screen-specific. These settings alone don't enable DPMS. # It is enabled per-screen (or per-monitor), and even then only when # the driver supports it. Option "StandbyTime" "10" # 10 minutes Option "SuspendTime" "10" # 10 minutes Option "OffTime" "10" # 10 minutes EndSection # ********************************************************************** # Input devices # ********************************************************************** # ********************************************************************** # Core keyboard's InputDevice section # ********************************************************************** Section "InputDevice" Identifier "Keyboard1" Driver "kbd" # Set the keyboard auto repeat parameters. Not all platforms implement # this. Option "AutoRepeat" "500 5" # Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)). # Option "Xleds" "1 2 3" # To customise the XKB settings to suit your keyboard, modify the # lines below (which are the defaults). For example, for a European # keyboard, you will probably want to use one of: # # Option "XkbModel" "pc102" # Option "XkbModel" "pc105" # # If you have a Microsoft Natural keyboard, you can use: # # Option "XkbModel" "microsoft" # # If you have a US "windows" keyboard you will want: # # Option "XkbModel" "pc104" # # Then to change the language, change the Layout setting. # For example, a german layout can be obtained with: # # Option "XkbLayout" "de" # # or: # # Option "XkbLayout" "de" # Option "XkbVariant" "nodeadkeys" # # If you'd like to switch the positions of your capslock and # control keys, use: # # Option "XkbOptions" "ctrl:swapcaps" # These are the default XKB settings for xorg # # Option "XkbRules" "xorg" # Option "XkbModel" "pc105" # Option "XkbLayout" "us" # Option "XkbVariant" "" # Option "XkbOptions" "" EndSection # ********************************************************************** # Core Pointer's InputDevice section # ********************************************************************** Section "InputDevice" # Identifier and driver Identifier "Mouse1" Driver "mouse" # The mouse protocol and device. The device is normally set to /dev/mouse, # which is usually a symbolic link to the real device. Option "Protocol" "Microsoft" Option "Device" "/dev/mouse" # On platforms where PnP mouse detection is supported the following # protocol setting can be used when using a newer PnP mouse: # Option "Protocol" "Auto" # When using mouse connected to a PS/2 port (aka "MousePort"), set the # the protocol as follows. On some platforms some other settings may # be available. # Option "Protocol" "PS/2" # Baudrate and SampleRate are only for some older Logitech mice. In # almost every case these lines should be omitted. # Option "BaudRate" "9600" # Option "SampleRate" "150" # Emulate3Buttons is an option for 2-button mice # Emulate3Timeout is the timeout in milliseconds (default is 50ms) # Option "Emulate3Buttons" # Option "Emulate3Timeout" "50" # ChordMiddle is an option for some 3-button Logitech mice, or any # 3-button mouse where the middle button generates left+right button # events. # Option "ChordMiddle" EndSection Section "InputDevice" Identifier "Mouse2" Driver "mouse" Option "Protocol" "MouseMan" Option "Device" "/dev/mouse2" EndSection # Some examples of extended input devices # Section "InputDevice" # Identifier "spaceball" # Driver "magellan" # Option "Device" "/dev/cua0" # EndSection # # Section "InputDevice" # Identifier "spaceball2" # Driver "spaceorb" # Option "Device" "/dev/cua0" # EndSection # # Section "InputDevice" # Identifier "touchscreen0" # Driver "microtouch" # Option "Device" "/dev/ttyS0" # Option "MinX" "1412" # Option "MaxX" "15184" # Option "MinY" "15372" # Option "MaxY" "1230" # Option "ScreenNumber" "0" # Option "ReportingMode" "Scaled" # Option "ButtonNumber" "1" # Option "SendCoreEvents" # EndSection # # Section "InputDevice" # Identifier "touchscreen1" # Driver "elo2300" # Option "Device" "/dev/ttyS0" # Option "MinX" "231" # Option "MaxX" "3868" # Option "MinY" "3858" # Option "MaxY" "272" # Option "ScreenNumber" "0" # Option "ReportingMode" "Scaled" # Option "ButtonThreshold" "17" # Option "ButtonNumber" "1" # Option "SendCoreEvents" # EndSection # ********************************************************************** # Monitor section # ********************************************************************** # Any number of monitor sections may be present Section "Monitor" # The identifier line must be present. Identifier "Generic Monitor" # HorizSync is in kHz unless units are specified. # HorizSync may be a comma separated list of discrete values, or a # comma separated list of ranges of values. # NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S # USER MANUAL FOR THE CORRECT NUMBERS. # HorizSync 31.5 # typical for a single frequency fixed-sync monitor # HorizSync 30-64 # multisync # HorizSync 31.5, 35.2 # multiple fixed sync frequencies # HorizSync 15-25, 30-50 # multiple ranges of sync frequencies # VertRefresh is in Hz unless units are specified. # VertRefresh may be a comma separated list of discrete values, or a # comma separated list of ranges of values. # NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S # USER MANUAL FOR THE CORRECT NUMBERS. # VertRefresh 60 # typical for a single frequency fixed-sync monitor # VertRefresh 50-100 # multisync # VertRefresh 60, 65 # multiple fixed sync frequencies # VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies # Modes can be specified in two formats. A compact one-line format, or # a multi-line format. # A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz) # These two are equivalent # ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525 Mode "640x480" DotClock 25.175 HTimings 640 664 760 800 VTimings 480 491 493 525 EndMode # These two are equivalent # ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace # Mode "1024x768i" # DotClock 45 # HTimings 1024 1048 1208 1264 # VTimings 768 776 784 817 # Flags "Interlace" # EndMode # If a monitor has DPMS support, that can be indicated here. This will # enable DPMS when the monitor is used with drivers that support it. # Option "dpms" # If a monitor requires that the sync signals be superimposed on the # green signal, the following option will enable this when used with # drivers that support it. Only a relatively small range of hardware # (and drivers) actually support this. # Option "sync on green" EndSection # ********************************************************************** # Graphics device section # ********************************************************************** # Any number of graphics device sections may be present Section "Device" # The Identifier must be present. Identifier "Generic VESA" # The Driver line must be present. When using run-time loadable driver # modules, this line instructs the server to load the specified driver # module. Even when not using loadable driver modules, this line # indicates which driver should interpret the information in this section. Driver "vesa" # The chipset line is optional in most cases. It can be used to override # the driver's chipset detection, and should not normally be specified. # Chipset "generic" # Various other lines can be specified to override the driver's automatic # detection code. In most cases they are not needed. # VideoRam 256 # Clocks 25.2 28.3 # The BusID line is used to specify which of possibly multiple devices # this section is intended for. When this line isn't present, a device # section can only match up with the primary video device. For PCI # devices a line like the following could be used. This line should not # normally be included unless there is more than one video device # intalled. # BusID "PCI:0:10:0" # Various option lines can be added here as required. Some options # are more appropriate in Screen sections, Display subsections or even # Monitor sections. # Option "hw cursor" "off" EndSection Section "Device" Identifier "any supported Trident chip" Driver "trident" EndSection Section "Device" Identifier "MGA Millennium I" Driver "mga" Option "hw cursor" "off" BusID "PCI:0:10:0" EndSection Section "Device" Identifier "MGA G200 AGP" Driver "mga" BusID "PCI:1:0:0" Option "pci retry" EndSection # ********************************************************************** # Screen sections. # ********************************************************************** # Any number of screen sections may be present. Each describes # the configuration of a single screen. A single specific screen section # may be specified from the X server command line with the "-screen" # option. Section "Screen" # The Identifier, Device and Monitor lines must be present Identifier "Screen 1" Device "Generic VESA" Monitor "Generic Monitor" # The favoured Depth and/or Bpp may be specified here DefaultDepth 8 SubSection "Display" Depth 8 Modes "640x480" ViewPort 0 0 Virtual 800 600 EndSubsection SubSection "Display" Depth 4 Modes "640x480" EndSubSection SubSection "Display" Depth 1 Modes "640x480" EndSubSection EndSection Section "Screen" Identifier "Screen MGA1" Device "MGA Millennium I" Monitor "Generic Monitor" Option "no accel" DefaultDepth 16 # DefaultDepth 24 SubSection "Display" Depth 8 Modes "1280x1024" Option "rgb bits" "8" Visual "StaticColor" EndSubSection SubSection "Display" Depth 16 Modes "1280x1024" EndSubSection SubSection "Display" Depth 24 Modes "1280x1024" EndSubSection EndSection Section "Screen" Identifier "Screen MGA2" Device "MGA G200 AGP" Monitor "Generic Monitor" DefaultDepth 8 SubSection "Display" Depth 8 Modes "1280x1024" Option "rgb bits" "8" Visual "StaticColor" EndSubSection EndSection # ********************************************************************** # ServerLayout sections. # ********************************************************************** # Any number of ServerLayout sections may be present. Each describes # the way multiple screens are organised. A specific ServerLayout # section may be specified from the X server command line with the # "-layout" option. In the absence of this, the first section is used. # When now ServerLayout section is present, the first Screen section # is used alone. Section "ServerLayout" # The Identifier line must be present Identifier "Main Layout" # Each Screen line specifies a Screen section name, and optionally # the relative position of other screens. The four names after # primary screen name are the screens to the top, bottom, left and right # of the primary screen. In this example, screen 2 is located to the # right of screen 1. Screen "Screen MGA 1" "" "" "" "Screen MGA 2" Screen "Screen MGA 2" "" "" "Screen MGA 1" "" # Each InputDevice line specifies an InputDevice section name and # optionally some options to specify the way the device is to be # used. Those options include "CorePointer", "CoreKeyboard" and # "SendCoreEvents". In this example, "Mouse1" is the core pointer, # and "Mouse2" is an extended input device that also generates core # pointer events (i.e., both mice will move the standard pointer). InputDevice "Mouse1" "CorePointer" InputDevice "Mouse2" "SendCoreEvents" InputDevice "Keyboard1" "CoreKeyboard" EndSection Section "ServerLayout" Identifier "another layout" Screen "Screen 1" Screen "Screen MGA 1" InputDevice "Mouse1" "CorePointer" InputDevice "Keyboard1" "CoreKeyboard" EndSection Section "ServerLayout" Identifier "simple layout" Screen "Screen 1" InputDevice "Mouse1" "CorePointer" InputDevice "Keyboard1" "CoreKeyboard" EndSection xorg-server-1.20.8/hw/xfree86/utils/0000755000175000017500000000000013640201534014131 500000000000000xorg-server-1.20.8/hw/xfree86/utils/Makefile.am0000644000175000017500000000003713640201473016107 00000000000000SUBDIRS = \ gtf \ cvt \ man xorg-server-1.20.8/hw/xfree86/utils/gtf/0000755000175000017500000000000013640201534014711 500000000000000xorg-server-1.20.8/hw/xfree86/utils/gtf/Makefile.am0000644000175000017500000000234413640201473016672 00000000000000# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 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. # bin_PROGRAMS = gtf gtf_SOURCES = gtf.c gtf_CFLAGS = $(XORG_CFLAGS) gtf_LDADD = -lm xorg-server-1.20.8/hw/xfree86/utils/gtf/gtf.c0000644000175000017500000005270613640201473015571 00000000000000/* gtf.c Generate mode timings using the GTF Timing Standard * * gcc gtf.c -o gtf -lm -Wall * * Copyright (c) 2001, Andy Ritger aritger@nvidia.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * o Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * o Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * o Neither the name of NVIDIA nor the names of its contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * * * This program is based on the Generalized Timing Formula(GTF TM) * Standard Version: 1.0, Revision: 1.0 * * The GTF Document contains the following Copyright information: * * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards * Association. Duplication of this document within VESA member * companies for review purposes is permitted. All other rights * reserved. * * While every precaution has been taken in the preparation * of this standard, the Video Electronics Standards Association and * its contributors assume no responsibility for errors or omissions, * and make no warranties, expressed or implied, of functionality * of suitability for any purpose. The sample code contained within * this standard may be used without restriction. * * * * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive) * implementation of the GTF Timing Standard, is available at: * * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls * * * * This program takes a desired resolution and vertical refresh rate, * and computes mode timings according to the GTF Timing Standard. * These mode timings can then be formatted as an XServer modeline * or a mode description for use by fbset(8). * * * * NOTES: * * The GTF allows for computation of "margins" (the visible border * surrounding the addressable video); on most non-overscan type * systems, the margin period is zero. I've implemented the margin * computations but not enabled it because 1) I don't really have * any experience with this, and 2) neither XServer modelines nor * fbset fb.modes provide an obvious way for margin timings to be * included in their mode descriptions (needs more investigation). * * The GTF provides for computation of interlaced mode timings; * I've implemented the computations but not enabled them, yet. * I should probably enable and test this at some point. * * * * TODO: * * o Add support for interlaced modes. * * o Implement the other portions of the GTF: compute mode timings * given either the desired pixel clock or the desired horizontal * frequency. * * o It would be nice if this were more general purpose to do things * outside the scope of the GTF: like generate double scan mode * timings, for example. * * o Printing digits to the right of the decimal point when the * digits are 0 annoys me. * * o Error checking. * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #define MARGIN_PERCENT 1.8 /* % of active vertical image */ #define CELL_GRAN 8.0 /* assumed character cell granularity */ #define MIN_PORCH 1 /* minimum front porch */ #define V_SYNC_RQD 3 /* width of vsync in lines */ #define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */ #define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */ #define M 600.0 /* blanking formula gradient */ #define C 40.0 /* blanking formula offset */ #define K 128.0 /* blanking formula scaling factor */ #define J 20.0 /* blanking formula scaling factor */ /* C' and M' are part of the Blanking Duty Cycle computation */ #define C_PRIME (((C - J) * K/256.0) + J) #define M_PRIME (K/256.0 * M) /* struct definitions */ typedef struct __mode { int hr, hss, hse, hfl; int vr, vss, vse, vfl; float pclk, h_freq, v_freq; } mode; typedef struct __options { int x, y; int xorgmode, fbmode; float v_freq; } options; /* prototypes */ void print_value(int n, const char *name, float val); void print_xf86_mode(mode * m); void print_fb_mode(mode * m); mode *vert_refresh(int h_pixels, int v_lines, float freq, int interlaced, int margins); options *parse_command_line(int argc, char *argv[]); /* * print_value() - print the result of the named computation; this is * useful when comparing against the GTF EXCEL spreadsheet. */ int global_verbose = 0; void print_value(int n, const char *name, float val) { if (global_verbose) { printf("%2d: %-27s: %15f\n", n, name, val); } } /* print_xf86_mode() - print the XServer modeline, given mode timings. */ void print_xf86_mode(mode * m) { printf("\n"); printf(" # %dx%d @ %.2f Hz (GTF) hsync: %.2f kHz; pclk: %.2f MHz\n", m->hr, m->vr, m->v_freq, m->h_freq, m->pclk); printf(" Modeline \"%dx%d_%.2f\" %.2f" " %d %d %d %d" " %d %d %d %d" " -HSync +Vsync\n\n", m->hr, m->vr, m->v_freq, m->pclk, m->hr, m->hss, m->hse, m->hfl, m->vr, m->vss, m->vse, m->vfl); } /* * print_fb_mode() - print a mode description in fbset(8) format; * see the fb.modes(8) manpage. The timing description used in * this is rather odd; they use "left and right margin" to refer * to the portion of the hblank before and after the sync pulse * by conceptually wrapping the portion of the blank after the pulse * to infront of the visible region; ie: * * * Timing description I'm accustomed to: * * * * <--------1--------> <--2--> <--3--> <--4--> * _________ * |-------------------|_______| |_______ * * R SS SE FL * * 1: visible image * 2: blank before sync (aka front porch) * 3: sync pulse * 4: blank after sync (aka back porch) * R: Resolution * SS: Sync Start * SE: Sync End * FL: Frame Length * * * But the fb.modes format is: * * * <--4--> <--------1--------> <--2--> <--3--> * _________ * _______|-------------------|_______| | * * The fb.modes(8) manpage refers to <4> and <2> as the left and * right "margin" (as well as upper and lower margin in the vertical * direction) -- note that this has nothing to do with the term * "margin" used in the GTF Timing Standard. * * XXX always prints the 32 bit mode -- should I provide a command * line option to specify the bpp? It's simple enough for a user * to edit the mode description after it's generated. */ void print_fb_mode(mode * m) { printf("\n"); printf("mode \"%dx%d %.2fHz 32bit (GTF)\"\n", m->hr, m->vr, m->v_freq); printf(" # PCLK: %.2f MHz, H: %.2f kHz, V: %.2f Hz\n", m->pclk, m->h_freq, m->v_freq); printf(" geometry %d %d %d %d 32\n", m->hr, m->vr, m->hr, m->vr); printf(" timings %d %d %d %d %d %d %d\n", (int)lrint(1000000.0 / m->pclk), /* pixclock in picoseconds */ m->hfl - m->hse, /* left margin (in pixels) */ m->hss - m->hr, /* right margin (in pixels) */ m->vfl - m->vse, /* upper margin (in pixel lines) */ m->vss - m->vr, /* lower margin (in pixel lines) */ m->hse - m->hss, /* horizontal sync length (pixels) */ m->vse - m->vss); /* vert sync length (pixel lines) */ printf(" hsync low\n"); printf(" vsync high\n"); printf("endmode\n\n"); } /* * vert_refresh() - as defined by the GTF Timing Standard, compute the * Stage 1 Parameters using the vertical refresh frequency. In other * words: input a desired resolution and desired refresh rate, and * output the GTF mode timings. * * XXX All the code is in place to compute interlaced modes, but I don't * feel like testing it right now. * * XXX margin computations are implemented but not tested (nor used by * XServer of fbset mode descriptions, from what I can tell). */ mode * vert_refresh(int h_pixels, int v_lines, float freq, int interlaced, int margins) { float h_pixels_rnd; float v_lines_rnd; float v_field_rate_rqd; float top_margin; float bottom_margin; float interlace; float h_period_est; float vsync_plus_bp; float v_back_porch; float total_v_lines; float v_field_rate_est; float h_period; float v_field_rate; float v_frame_rate; float left_margin; float right_margin; float total_active_pixels; float ideal_duty_cycle; float h_blank; float total_pixels; float pixel_freq; float h_freq; float h_sync; float h_front_porch; float v_odd_front_porch_lines; mode *m = (mode *) malloc(sizeof(mode)); /* 1. In order to give correct results, the number of horizontal * pixels requested is first processed to ensure that it is divisible * by the character size, by rounding it to the nearest character * cell boundary: * * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND]) */ h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN; print_value(1, "[H PIXELS RND]", h_pixels_rnd); /* 2. If interlace is requested, the number of vertical lines assumed * by the calculation must be halved, as the computation calculates * the number of vertical lines per field. In either case, the * number of lines is rounded to the nearest integer. * * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0), * ROUND([V LINES],0)) */ v_lines_rnd = interlaced ? rint((float) v_lines) / 2.0 : rint((float) v_lines); print_value(2, "[V LINES RND]", v_lines_rnd); /* 3. Find the frame rate required: * * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2, * [I/P FREQ RQD]) */ v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq); print_value(3, "[V FIELD RATE RQD]", v_field_rate_rqd); /* 4. Find number of lines in Top margin: * * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y", * ROUND(([MARGIN%]/100*[V LINES RND]),0), * 0) */ top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0); print_value(4, "[TOP MARGIN (LINES)]", top_margin); /* 5. Find number of lines in Bottom margin: * * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y", * ROUND(([MARGIN%]/100*[V LINES RND]),0), * 0) */ bottom_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0); print_value(5, "[BOT MARGIN (LINES)]", bottom_margin); /* 6. If interlace is required, then set variable [INTERLACE]=0.5: * * [INTERLACE]=(IF([INT RQD?]="y",0.5,0)) */ interlace = interlaced ? 0.5 : 0.0; print_value(6, "[INTERLACE]", interlace); /* 7. Estimate the Horizontal period * * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) / * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) + * [MIN PORCH RND]+[INTERLACE]) * 1000000 */ h_period_est = (((1.0 / v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP / 1000000.0)) / (v_lines_rnd + (2 * top_margin) + MIN_PORCH + interlace) * 1000000.0); print_value(7, "[H PERIOD EST]", h_period_est); /* 8. Find the number of lines in V sync + back porch: * * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0) */ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP / h_period_est); print_value(8, "[V SYNC+BP]", vsync_plus_bp); /* 9. Find the number of lines in V back porch alone: * * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND] * * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]? */ v_back_porch = vsync_plus_bp - V_SYNC_RQD; print_value(9, "[V BACK PORCH]", v_back_porch); /* 10. Find the total number of lines in Vertical field period: * * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] + * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] + * [MIN PORCH RND] */ total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp + interlace + MIN_PORCH; print_value(10, "[TOTAL V LINES]", total_v_lines); /* 11. Estimate the Vertical field frequency: * * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000 */ v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0; print_value(11, "[V FIELD RATE EST]", v_field_rate_est); /* 12. Find the actual horizontal period: * * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST]) */ h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est); print_value(12, "[H PERIOD]", h_period); /* 13. Find the actual Vertical field frequency: * * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000 */ v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0; print_value(13, "[V FIELD RATE]", v_field_rate); /* 14. Find the Vertical frame frequency: * * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE])) */ v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate; print_value(14, "[V FRAME RATE]", v_frame_rate); /* 15. Find number of pixels in left margin: * * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / * [CELL GRAN RND]),0)) * [CELL GRAN RND], * 0)) */ left_margin = margins ? rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : 0.0; print_value(15, "[LEFT MARGIN (PIXELS)]", left_margin); /* 16. Find number of pixels in right margin: * * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / * [CELL GRAN RND]),0)) * [CELL GRAN RND], * 0)) */ right_margin = margins ? rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : 0.0; print_value(16, "[RIGHT MARGIN (PIXELS)]", right_margin); /* 17. Find total number of active pixels in image and left and right * margins: * * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] + * [RIGHT MARGIN (PIXELS)] */ total_active_pixels = h_pixels_rnd + left_margin + right_margin; print_value(17, "[TOTAL ACTIVE PIXELS]", total_active_pixels); /* 18. Find the ideal blanking duty cycle from the blanking duty cycle * equation: * * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000) */ ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0); print_value(18, "[IDEAL DUTY CYCLE]", ideal_duty_cycle); /* 19. Find the number of pixels in the blanking time to the nearest * double character cell: * * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] * * [IDEAL DUTY CYCLE] / * (100-[IDEAL DUTY CYCLE]) / * (2*[CELL GRAN RND])), 0)) * * (2*[CELL GRAN RND]) */ h_blank = rint(total_active_pixels * ideal_duty_cycle / (100.0 - ideal_duty_cycle) / (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN); print_value(19, "[H BLANK (PIXELS)]", h_blank); /* 20. Find total number of pixels: * * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)] */ total_pixels = total_active_pixels + h_blank; print_value(20, "[TOTAL PIXELS]", total_pixels); /* 21. Find pixel clock frequency: * * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD] */ pixel_freq = total_pixels / h_period; print_value(21, "[PIXEL FREQ]", pixel_freq); /* 22. Find horizontal frequency: * * [H FREQ] = 1000 / [H PERIOD] */ h_freq = 1000.0 / h_period; print_value(22, "[H FREQ]", h_freq); /* Stage 1 computations are now complete; I should really pass the results to another function and do the Stage 2 computations, but I only need a few more values so I'll just append the computations here for now */ /* 17. Find the number of pixels in the horizontal sync period: * * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] / * [CELL GRAN RND]),0))*[CELL GRAN RND] */ h_sync = rint(H_SYNC_PERCENT / 100.0 * total_pixels / CELL_GRAN) * CELL_GRAN; print_value(17, "[H SYNC (PIXELS)]", h_sync); /* 18. Find the number of pixels in the horizontal front porch period: * * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)] */ h_front_porch = (h_blank / 2.0) - h_sync; print_value(18, "[H FRONT PORCH (PIXELS)]", h_front_porch); /* 36. Find the number of lines in the odd front porch period: * * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE]) */ v_odd_front_porch_lines = MIN_PORCH + interlace; print_value(36, "[V ODD FRONT PORCH(LINES)]", v_odd_front_porch_lines); /* finally, pack the results in the mode struct */ m->hr = (int) (h_pixels_rnd); m->hss = (int) (h_pixels_rnd + h_front_porch); m->hse = (int) (h_pixels_rnd + h_front_porch + h_sync); m->hfl = (int) (total_pixels); m->vr = (int) (v_lines_rnd); m->vss = (int) (v_lines_rnd + v_odd_front_porch_lines); m->vse = (int) (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD); m->vfl = (int) (total_v_lines); m->pclk = pixel_freq; m->h_freq = h_freq; m->v_freq = freq; return m; } /* * parse_command_line() - parse the command line and return an * alloced structure containing the results. On error print usage * and return NULL. */ options * parse_command_line(int argc, char *argv[]) { int n; options *o = (options *) calloc(1, sizeof(options)); if (argc < 4) goto bad_option; o->x = atoi(argv[1]); o->y = atoi(argv[2]); o->v_freq = atof(argv[3]); /* XXX should check for errors in the above */ n = 4; while (n < argc) { if ((strcmp(argv[n], "-v") == 0) || (strcmp(argv[n], "--verbose") == 0)) { global_verbose = 1; } else if ((strcmp(argv[n], "-f") == 0) || (strcmp(argv[n], "--fbmode") == 0)) { o->fbmode = 1; } else if ((strcmp(argv[n], "-x") == 0) || (strcmp(argv[n], "--xorgmode") == 0) || (strcmp(argv[n], "--xf86mode") == 0)) { o->xorgmode = 1; } else { goto bad_option; } n++; } /* if neither xorgmode nor fbmode were requested, default to xorgmode */ if (!o->fbmode && !o->xorgmode) o->xorgmode = 1; return o; bad_option: fprintf(stderr, "\n"); fprintf(stderr, "usage: %s x y refresh [-v|--verbose] " "[-f|--fbmode] [-x|--xorgmode]\n", argv[0]); fprintf(stderr, "\n"); fprintf(stderr, " x : the desired horizontal " "resolution (required)\n"); fprintf(stderr, " y : the desired vertical " "resolution (required)\n"); fprintf(stderr, " refresh : the desired refresh " "rate (required)\n"); fprintf(stderr, " -v|--verbose : enable verbose printouts " "(traces each step of the computation)\n"); fprintf(stderr, " -f|--fbmode : output an fbset(8)-style mode " "description\n"); fprintf(stderr, " -x|--xorgmode : output an " __XSERVERNAME__ "-style mode " "description (this is the default\n" " if no mode description is requested)\n"); fprintf(stderr, "\n"); free(o); return NULL; } int main(int argc, char *argv[]) { mode *m; options *o; o = parse_command_line(argc, argv); if (!o) exit(1); m = vert_refresh(o->x, o->y, o->v_freq, 0, 0); if (!m) exit(1); if (o->xorgmode) print_xf86_mode(m); if (o->fbmode) print_fb_mode(m); free(m); return 0; } xorg-server-1.20.8/hw/xfree86/utils/gtf/Makefile.in0000644000175000017500000007442113640201513016703 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 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. # VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = gtf$(EXEEXT) subdir = hw/xfree86/utils/gtf ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_gtf_OBJECTS = gtf-gtf.$(OBJEXT) gtf_OBJECTS = $(am_gtf_OBJECTS) gtf_DEPENDENCIES = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = gtf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(gtf_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/gtf-gtf.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(gtf_SOURCES) DIST_SOURCES = $(gtf_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ gtf_SOURCES = gtf.c gtf_CFLAGS = $(XORG_CFLAGS) gtf_LDADD = -lm all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/gtf/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/utils/gtf/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list gtf$(EXEEXT): $(gtf_OBJECTS) $(gtf_DEPENDENCIES) $(EXTRA_gtf_DEPENDENCIES) @rm -f gtf$(EXEEXT) $(AM_V_CCLD)$(gtf_LINK) $(gtf_OBJECTS) $(gtf_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtf-gtf.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< gtf-gtf.o: gtf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -MT gtf-gtf.o -MD -MP -MF $(DEPDIR)/gtf-gtf.Tpo -c -o gtf-gtf.o `test -f 'gtf.c' || echo '$(srcdir)/'`gtf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtf-gtf.Tpo $(DEPDIR)/gtf-gtf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gtf.c' object='gtf-gtf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -c -o gtf-gtf.o `test -f 'gtf.c' || echo '$(srcdir)/'`gtf.c gtf-gtf.obj: gtf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -MT gtf-gtf.obj -MD -MP -MF $(DEPDIR)/gtf-gtf.Tpo -c -o gtf-gtf.obj `if test -f 'gtf.c'; then $(CYGPATH_W) 'gtf.c'; else $(CYGPATH_W) '$(srcdir)/gtf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtf-gtf.Tpo $(DEPDIR)/gtf-gtf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gtf.c' object='gtf-gtf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -c -o gtf-gtf.obj `if test -f 'gtf.c'; then $(CYGPATH_W) 'gtf.c'; else $(CYGPATH_W) '$(srcdir)/gtf.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/gtf-gtf.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/gtf-gtf.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/utils/Makefile.in0000644000175000017500000006456613640201513016134 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/utils ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = \ gtf \ cvt \ man all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/utils/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/utils/man/0000755000175000017500000000000013640201534014704 500000000000000xorg-server-1.20.8/hw/xfree86/utils/man/Makefile.am0000644000175000017500000000007713640201473016666 00000000000000include $(top_srcdir)/manpages.am appman_PRE = cvt.man gtf.man xorg-server-1.20.8/hw/xfree86/utils/man/cvt.man0000644000175000017500000000230213640201473016114 00000000000000.TH CVT 1 @vendorversion@ .SH NAME cvt - calculate VESA CVT mode lines .SH SYNOPSIS .B cvt .RB [ \-v | \-\-verbose ] .RB [ \-r | \-\-reduced ] .I h-resolution .I v-resolution .RB [ refresh ] .SH DESCRIPTION .I Cvt is a utility for calculating VESA Coordinated Video Timing modes. Given the desired horizontal and vertical resolutions, a modeline adhering to the CVT standard is printed. This modeline can be included in Xorg .B xorg.conf(@filemansuffix@) . .SH OPTIONS .TP 8 .BR refresh Provide a vertical refresh rate in Hz. The CVT standard prefers either 50.0, 60.0, 75.0 or 85.0Hz. The default is 60.0Hz. .TP 8 .BR \-v | \-\-verbose Warn verbosely when a given mode does not completely correspond with CVT standards. .TP 8 .BR \-r | \-\-reduced Create a mode with reduced blanking. This allows for higher frequency signals, with a lower or equal dotclock. Not for Cathode Ray Tube based displays though. .SH "SEE ALSO" xorg.conf(@filemansuffix@), gtf(@appmansuffix@) .SH AUTHOR Luc Verhaegen. .PP This program is based on the Coordinated Video Timing sample implementation written by Graham Loveridge. This file is publicly available at . CVT is a VESA trademark. xorg-server-1.20.8/hw/xfree86/utils/man/Makefile.in0000644000175000017500000006562613640201513016705 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/utils/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man appman_PRE = cvt.man gtf.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/utils/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/utils/man/gtf.man0000644000175000017500000000236613640201473016112 00000000000000.TH GTF 1 @vendorversion@ .SH NAME gtf - calculate VESA GTF mode lines .SH SYNOPSIS .B gtf .I h-resolution .I v-resolution .I refresh .RB [ \-v | \-\-verbose ] .RB [ \-f | \-\-fbmode ] .RB [ \-x | \-\-xorgmode ] .SH DESCRIPTION .I Gtf is a utility for calculating VESA GTF modes. Given the desired horizontal and vertical resolutions and refresh rate (in Hz), the parameters for a matching VESA GTF mode are printed out. Two output formats are supported: mode lines suitable for the Xorg .B xorg.conf(@filemansuffix@) file, and mode parameters suitable for the Linux .B fbset(8) utility. .SH OPTIONS .TP 8 .BR \-v | \-\-verbose Enable verbose printouts This shows a trace for each step of the computation. .TP 8 .BR \-x | \-\-xorgmode Print the mode parameters as Xorg-style mode lines. This is the default format. .TP 8 .BR \-f | \-\-fbset Print the mode parameters in a format suitable for .BR fbset(8) . .SH "SEE ALSO" xorg.conf(@filemansuffix@), cvt(@appmansuffix@) .SH AUTHOR Andy Ritger. .PP This program is based on the Generalized Timing Formula (GTF(TM)) Standard Version: 1.0, Revision: 1.0. The GTF Excel(TM) spreadsheet, a sample (and the definitive) implementation of the GTF Timing Standard is available at . xorg-server-1.20.8/hw/xfree86/utils/cvt/0000755000175000017500000000000013640201534014725 500000000000000xorg-server-1.20.8/hw/xfree86/utils/cvt/Makefile.am0000644000175000017500000000270313640201473016705 00000000000000# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 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. # bin_PROGRAMS = cvt AM_CPPFLAGS = $(XORG_INCS) \ -I$(top_srcdir)/hw/xfree86/ddc \ -I$(top_srcdir)/hw/xfree86/modes \ -I$(top_srcdir)/hw/xfree86/parser # gah cvt_SOURCES = cvt.c \ $(top_srcdir)/hw/xfree86/modes/xf86cvt.c \ $(top_srcdir)/os/xprintf.c cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) xorg-server-1.20.8/hw/xfree86/utils/cvt/Makefile.in0000644000175000017500000010557713640201513016726 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 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. # VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = cvt$(EXEEXT) subdir = hw/xfree86/utils/cvt ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_cvt_OBJECTS = cvt-cvt.$(OBJEXT) cvt-xf86cvt.$(OBJEXT) \ cvt-xprintf.$(OBJEXT) cvt_OBJECTS = $(am_cvt_OBJECTS) cvt_LDADD = $(LDADD) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = cvt_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cvt_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/cvt-cvt.Po \ ./$(DEPDIR)/cvt-xf86cvt.Po ./$(DEPDIR)/cvt-xprintf.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(cvt_SOURCES) DIST_SOURCES = $(cvt_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = $(XORG_INCS) \ -I$(top_srcdir)/hw/xfree86/ddc \ -I$(top_srcdir)/hw/xfree86/modes \ -I$(top_srcdir)/hw/xfree86/parser # gah cvt_SOURCES = cvt.c \ $(top_srcdir)/hw/xfree86/modes/xf86cvt.c \ $(top_srcdir)/os/xprintf.c cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/cvt/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/utils/cvt/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list cvt$(EXEEXT): $(cvt_OBJECTS) $(cvt_DEPENDENCIES) $(EXTRA_cvt_DEPENDENCIES) @rm -f cvt$(EXEEXT) $(AM_V_CCLD)$(cvt_LINK) $(cvt_OBJECTS) $(cvt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvt-cvt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvt-xf86cvt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvt-xprintf.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< cvt-cvt.o: cvt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-cvt.o -MD -MP -MF $(DEPDIR)/cvt-cvt.Tpo -c -o cvt-cvt.o `test -f 'cvt.c' || echo '$(srcdir)/'`cvt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cvt-cvt.Tpo $(DEPDIR)/cvt-cvt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cvt.c' object='cvt-cvt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-cvt.o `test -f 'cvt.c' || echo '$(srcdir)/'`cvt.c cvt-cvt.obj: cvt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-cvt.obj -MD -MP -MF $(DEPDIR)/cvt-cvt.Tpo -c -o cvt-cvt.obj `if test -f 'cvt.c'; then $(CYGPATH_W) 'cvt.c'; else $(CYGPATH_W) '$(srcdir)/cvt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cvt-cvt.Tpo $(DEPDIR)/cvt-cvt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cvt.c' object='cvt-cvt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-cvt.obj `if test -f 'cvt.c'; then $(CYGPATH_W) 'cvt.c'; else $(CYGPATH_W) '$(srcdir)/cvt.c'; fi` cvt-xf86cvt.o: $(top_srcdir)/hw/xfree86/modes/xf86cvt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-xf86cvt.o -MD -MP -MF $(DEPDIR)/cvt-xf86cvt.Tpo -c -o cvt-xf86cvt.o `test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/xfree86/modes/xf86cvt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cvt-xf86cvt.Tpo $(DEPDIR)/cvt-xf86cvt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' object='cvt-xf86cvt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-xf86cvt.o `test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/xfree86/modes/xf86cvt.c cvt-xf86cvt.obj: $(top_srcdir)/hw/xfree86/modes/xf86cvt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-xf86cvt.obj -MD -MP -MF $(DEPDIR)/cvt-xf86cvt.Tpo -c -o cvt-xf86cvt.obj `if test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cvt-xf86cvt.Tpo $(DEPDIR)/cvt-xf86cvt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' object='cvt-xf86cvt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-xf86cvt.obj `if test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; fi` cvt-xprintf.o: $(top_srcdir)/os/xprintf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-xprintf.o -MD -MP -MF $(DEPDIR)/cvt-xprintf.Tpo -c -o cvt-xprintf.o `test -f '$(top_srcdir)/os/xprintf.c' || echo '$(srcdir)/'`$(top_srcdir)/os/xprintf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cvt-xprintf.Tpo $(DEPDIR)/cvt-xprintf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/os/xprintf.c' object='cvt-xprintf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-xprintf.o `test -f '$(top_srcdir)/os/xprintf.c' || echo '$(srcdir)/'`$(top_srcdir)/os/xprintf.c cvt-xprintf.obj: $(top_srcdir)/os/xprintf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-xprintf.obj -MD -MP -MF $(DEPDIR)/cvt-xprintf.Tpo -c -o cvt-xprintf.obj `if test -f '$(top_srcdir)/os/xprintf.c'; then $(CYGPATH_W) '$(top_srcdir)/os/xprintf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/xprintf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cvt-xprintf.Tpo $(DEPDIR)/cvt-xprintf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/os/xprintf.c' object='cvt-xprintf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-xprintf.obj `if test -f '$(top_srcdir)/os/xprintf.c'; then $(CYGPATH_W) '$(top_srcdir)/os/xprintf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/xprintf.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/cvt-cvt.Po -rm -f ./$(DEPDIR)/cvt-xf86cvt.Po -rm -f ./$(DEPDIR)/cvt-xprintf.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/cvt-cvt.Po -rm -f ./$(DEPDIR)/cvt-xf86cvt.Po -rm -f ./$(DEPDIR)/cvt-xprintf.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/utils/cvt/cvt.c0000644000175000017500000002053613640201473015615 00000000000000/* * Copyright 2005-2006 Luc Verhaegen. * * 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. * */ /* Standalone VESA CVT standard timing modelines generator. */ #include "xf86.h" #include "xf86Modes.h" /* FatalError implementation used by the server code we built in */ void FatalError(const char *f, ...) { va_list args; va_start(args, f); vfprintf(stderr, f, args); va_end(args); exit(1); } /* xnfalloc implementation used by the server code we built in */ void * XNFalloc(unsigned long n) { void *r; r = malloc(n); if (!r) { perror("malloc failed"); exit(1); } return r; } /* xnfcalloc implementation used by the server code we built in */ void * XNFcallocarray(size_t nmemb, size_t size) { void *r; r = calloc(nmemb, size); if (!r) { perror("calloc failed"); exit(1); } return r; } /* * Quickly check wether this is a CVT standard mode. */ static Bool CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Verbose) { Bool IsCVT = TRUE; if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) || (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) || (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) || (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) || (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))); else { if (Verbose) fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n"); IsCVT = FALSE; } if ((VRefresh != 50.0) && (VRefresh != 60.0) && (VRefresh != 75.0) && (VRefresh != 85.0)) { if (Verbose) fprintf(stderr, "Warning: Refresh Rate is not CVT standard " "(50, 60, 75 or 85Hz).\n"); IsCVT = FALSE; } return IsCVT; } /* * I'm not documenting --interlaced for obvious reasons, even though I did * implement it. I also can't deny having looked at gtf here. */ static void PrintUsage(char *Name) { fprintf(stderr, "\n"); fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n", Name); fprintf(stderr, "\n"); fprintf(stderr, " -v|--verbose : Warn about CVT standard adherance.\n"); fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking " "(default: normal blanking).\n"); fprintf(stderr, " X : Desired horizontal resolution " "(multiple of 8, required).\n"); fprintf(stderr, " Y : Desired vertical resolution (required).\n"); fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n"); fprintf(stderr, "\n"); fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines" " for use with X.\n"); } /* * */ static void PrintComment(DisplayModeRec * Mode, Bool CVT, Bool Reduced) { printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh); if (CVT) { printf("(CVT %.2fM", ((float) Mode->HDisplay * Mode->VDisplay) / 1000000.0); if (!(Mode->VDisplay % 3) && ((Mode->VDisplay * 4 / 3) == Mode->HDisplay)) printf("3"); else if (!(Mode->VDisplay % 9) && ((Mode->VDisplay * 16 / 9) == Mode->HDisplay)) printf("9"); else if (!(Mode->VDisplay % 10) && ((Mode->VDisplay * 16 / 10) == Mode->HDisplay)) printf("A"); else if (!(Mode->VDisplay % 4) && ((Mode->VDisplay * 5 / 4) == Mode->HDisplay)) printf("4"); else if (!(Mode->VDisplay % 9) && ((Mode->VDisplay * 15 / 9) == Mode->HDisplay)) printf("9"); if (Reduced) printf("-R"); printf(") "); } else printf("(CVT) "); printf("hsync: %.2f kHz; ", Mode->HSync); printf("pclk: %.2f MHz", ((float) Mode->Clock) / 1000.0); printf("\n"); } /* * Originally grabbed from xf86Mode.c. * * Ignoring the actual Mode->name, as the user will want something solid * to grab hold of. */ static void PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh, Bool Reduced) { if (Reduced) printf("Modeline \"%dx%dR\" ", HDisplay, VDisplay); else printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh); printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock / 1000., Mode->HDisplay, Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay, Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal); if (Mode->Flags & V_INTERLACE) printf(" interlace"); if (Mode->Flags & V_PHSYNC) printf(" +hsync"); if (Mode->Flags & V_NHSYNC) printf(" -hsync"); if (Mode->Flags & V_PVSYNC) printf(" +vsync"); if (Mode->Flags & V_NVSYNC) printf(" -vsync"); printf("\n"); } /* * */ int main(int argc, char *argv[]) { DisplayModeRec *Mode; int HDisplay = 0, VDisplay = 0; float VRefresh = 0.0; Bool Reduced = FALSE, Verbose = FALSE, IsCVT; Bool Interlaced = FALSE; int n; if ((argc < 3) || (argc > 7)) { PrintUsage(argv[0]); return 1; } /* This doesn't filter out bad flags properly. Bad flags get passed down * to atoi/atof, which then return 0, so that these variables can get * filled next time round. So this is just a cosmetic problem. */ for (n = 1; n < argc; n++) { if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced")) Reduced = TRUE; else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced")) Interlaced = TRUE; else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose")) Verbose = TRUE; else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) { PrintUsage(argv[0]); return 0; } else if (!HDisplay) { HDisplay = atoi(argv[n]); if (!HDisplay) { PrintUsage(argv[0]); return 1; } } else if (!VDisplay) { VDisplay = atoi(argv[n]); if (!VDisplay) { PrintUsage(argv[0]); return 1; } } else if (!VRefresh) { VRefresh = atof(argv[n]); if (!VRefresh) { PrintUsage(argv[0]); return 1; } } else { PrintUsage(argv[0]); return 1; } } if (!HDisplay || !VDisplay) { PrintUsage(argv[0]); return 0; } /* Default to 60.0Hz */ if (!VRefresh) VRefresh = 60.0; /* Horizontal timing is always a multiple of 8: round up. */ if (HDisplay & 0x07) { HDisplay &= ~0x07; HDisplay += 8; } if (Reduced) { if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) { fprintf(stderr, "\nERROR: Multiple of 60Hz refresh rate required for " " reduced blanking.\n"); PrintUsage(argv[0]); return 0; } } IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose); Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced); PrintComment(Mode, IsCVT, Reduced); PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced); return 0; } xorg-server-1.20.8/hw/xfree86/parser/0000755000175000017500000000000013640201534014265 500000000000000xorg-server-1.20.8/hw/xfree86/parser/Monitor.c0000644000175000017500000007213013640201473016005 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec MonitorTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {VENDOR, "vendorname"}, {MODEL, "modelname"}, {USEMODES, "usemodes"}, {MODELINE, "modeline"}, {DISPLAYSIZE, "displaysize"}, {HORIZSYNC, "horizsync"}, {VERTREFRESH, "vertrefresh"}, {MODE, "mode"}, {GAMMA, "gamma"}, {OPTION, "option"}, {-1, ""}, }; static const xf86ConfigSymTabRec ModesTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {MODELINE, "modeline"}, {MODE, "mode"}, {-1, ""}, }; static const xf86ConfigSymTabRec TimingTab[] = { {TT_INTERLACE, "interlace"}, {TT_PHSYNC, "+hsync"}, {TT_NHSYNC, "-hsync"}, {TT_PVSYNC, "+vsync"}, {TT_NVSYNC, "-vsync"}, {TT_CSYNC, "composite"}, {TT_PCSYNC, "+csync"}, {TT_NCSYNC, "-csync"}, {TT_DBLSCAN, "doublescan"}, {TT_HSKEW, "hskew"}, {TT_BCAST, "bcast"}, {TT_VSCAN, "vscan"}, {-1, ""}, }; static const xf86ConfigSymTabRec ModeTab[] = { {DOTCLOCK, "dotclock"}, {HTIMINGS, "htimings"}, {VTIMINGS, "vtimings"}, {FLAGS, "flags"}, {HSKEW, "hskew"}, {BCAST, "bcast"}, {VSCAN, "vscan"}, {ENDMODE, "endmode"}, {-1, ""}, }; #define CLEANUP xf86freeModeLineList static void xf86freeModeLineList(XF86ConfModeLinePtr ptr) { XF86ConfModeLinePtr prev; while (ptr) { TestFree(ptr->ml_identifier); TestFree(ptr->ml_comment); prev = ptr; ptr = ptr->list.next; free(prev); } } static XF86ConfModeLinePtr xf86parseModeLine(void) { int token; parsePrologue(XF86ConfModeLinePtr, XF86ConfModeLineRec) /* Identifier */ if (xf86getSubToken(&(ptr->ml_comment)) != STRING) Error("ModeLine identifier expected"); ptr->ml_identifier = xf86_lex_val.str; /* DotClock */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine dotclock expected"); ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); /* HDisplay */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine Hdisplay expected"); ptr->ml_hdisplay = xf86_lex_val.num; /* HSyncStart */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HSyncStart expected"); ptr->ml_hsyncstart = xf86_lex_val.num; /* HSyncEnd */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HSyncEnd expected"); ptr->ml_hsyncend = xf86_lex_val.num; /* HTotal */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HTotal expected"); ptr->ml_htotal = xf86_lex_val.num; /* VDisplay */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine Vdisplay expected"); ptr->ml_vdisplay = xf86_lex_val.num; /* VSyncStart */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VSyncStart expected"); ptr->ml_vsyncstart = xf86_lex_val.num; /* VSyncEnd */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VSyncEnd expected"); ptr->ml_vsyncend = xf86_lex_val.num; /* VTotal */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VTotal expected"); ptr->ml_vtotal = xf86_lex_val.num; token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab); while ((token == TT_INTERLACE) || (token == TT_PHSYNC) || (token == TT_NHSYNC) || (token == TT_PVSYNC) || (token == TT_NVSYNC) || (token == TT_CSYNC) || (token == TT_PCSYNC) || (token == TT_NCSYNC) || (token == TT_DBLSCAN) || (token == TT_HSKEW) || (token == TT_VSCAN) || (token == TT_BCAST)) { switch (token) { case TT_INTERLACE: ptr->ml_flags |= XF86CONF_INTERLACE; break; case TT_PHSYNC: ptr->ml_flags |= XF86CONF_PHSYNC; break; case TT_NHSYNC: ptr->ml_flags |= XF86CONF_NHSYNC; break; case TT_PVSYNC: ptr->ml_flags |= XF86CONF_PVSYNC; break; case TT_NVSYNC: ptr->ml_flags |= XF86CONF_NVSYNC; break; case TT_CSYNC: ptr->ml_flags |= XF86CONF_CSYNC; break; case TT_PCSYNC: ptr->ml_flags |= XF86CONF_PCSYNC; break; case TT_NCSYNC: ptr->ml_flags |= XF86CONF_NCSYNC; break; case TT_DBLSCAN: ptr->ml_flags |= XF86CONF_DBLSCAN; break; case TT_HSKEW: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error(NUMBER_MSG, "Hskew"); ptr->ml_hskew = xf86_lex_val.num; ptr->ml_flags |= XF86CONF_HSKEW; break; case TT_BCAST: ptr->ml_flags |= XF86CONF_BCAST; break; case TT_VSCAN: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error(NUMBER_MSG, "Vscan"); ptr->ml_vscan = xf86_lex_val.num; ptr->ml_flags |= XF86CONF_VSCAN; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab); } xf86unGetToken(token); #ifdef DEBUG printf("ModeLine parsed\n"); #endif return ptr; } static XF86ConfModeLinePtr xf86parseVerboseMode(void) { int token, token2; int had_dotclock = 0, had_htimings = 0, had_vtimings = 0; parsePrologue(XF86ConfModeLinePtr, XF86ConfModeLineRec) if (xf86getSubToken(&(ptr->ml_comment)) != STRING) Error("Mode name expected"); ptr->ml_identifier = xf86_lex_val.str; while ((token = xf86getToken(ModeTab)) != ENDMODE) { switch (token) { case COMMENT: ptr->ml_comment = xf86addComment(ptr->ml_comment, xf86_lex_val.str); break; case DOTCLOCK: if ((token = xf86getSubToken(&(ptr->ml_comment))) != NUMBER) Error(NUMBER_MSG, "DotClock"); ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); had_dotclock = 1; break; case HTIMINGS: if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_hdisplay = xf86_lex_val.num; else Error("Horizontal display expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_hsyncstart = xf86_lex_val.num; else Error("Horizontal sync start expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_hsyncend = xf86_lex_val.num; else Error("Horizontal sync end expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_htotal = xf86_lex_val.num; else Error("Horizontal total expected"); had_htimings = 1; break; case VTIMINGS: if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_vdisplay = xf86_lex_val.num; else Error("Vertical display expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_vsyncstart = xf86_lex_val.num; else Error("Vertical sync start expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_vsyncend = xf86_lex_val.num; else Error("Vertical sync end expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) ptr->ml_vtotal = xf86_lex_val.num; else Error("Vertical total expected"); had_vtimings = 1; break; case FLAGS: token = xf86getSubToken(&(ptr->ml_comment)); if (token != STRING) Error(QUOTE_MSG, "Flags"); while (token == STRING) { token2 = xf86getStringToken(TimingTab); switch (token2) { case TT_INTERLACE: ptr->ml_flags |= XF86CONF_INTERLACE; break; case TT_PHSYNC: ptr->ml_flags |= XF86CONF_PHSYNC; break; case TT_NHSYNC: ptr->ml_flags |= XF86CONF_NHSYNC; break; case TT_PVSYNC: ptr->ml_flags |= XF86CONF_PVSYNC; break; case TT_NVSYNC: ptr->ml_flags |= XF86CONF_NVSYNC; break; case TT_CSYNC: ptr->ml_flags |= XF86CONF_CSYNC; break; case TT_PCSYNC: ptr->ml_flags |= XF86CONF_PCSYNC; break; case TT_NCSYNC: ptr->ml_flags |= XF86CONF_NCSYNC; break; case TT_DBLSCAN: ptr->ml_flags |= XF86CONF_DBLSCAN; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error("Unknown flag string"); break; } token = xf86getSubToken(&(ptr->ml_comment)); } xf86unGetToken(token); break; case HSKEW: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("Horizontal skew expected"); ptr->ml_flags |= XF86CONF_HSKEW; ptr->ml_hskew = xf86_lex_val.num; break; case VSCAN: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("Vertical scan count expected"); ptr->ml_flags |= XF86CONF_VSCAN; ptr->ml_vscan = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error("Unexepcted token in verbose \"Mode\" entry\n"); } } if (!had_dotclock) Error("the dotclock is missing"); if (!had_htimings) Error("the horizontal timings are missing"); if (!had_vtimings) Error("the vertical timings are missing"); #ifdef DEBUG printf("Verbose Mode parsed\n"); #endif return ptr; } #undef CLEANUP #define CLEANUP xf86freeMonitorList XF86ConfMonitorPtr xf86parseMonitorSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec) while ((token = xf86getToken(MonitorTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->mon_comment = xf86addComment(ptr->mon_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->mon_identifier = xf86_lex_val.str; has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); ptr->mon_vendor = xf86_lex_val.str; break; case MODEL: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "ModelName"); ptr->mon_modelname = xf86_lex_val.str; break; case MODE: HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode, XF86ConfModeLinePtr); break; case MODELINE: HANDLE_LIST(mon_modeline_lst, xf86parseModeLine, XF86ConfModeLinePtr); break; case DISPLAYSIZE: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(DISPLAYSIZE_MSG); ptr->mon_width = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(DISPLAYSIZE_MSG); ptr->mon_height = xf86_lex_val.realnum; break; case HORIZSYNC: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(HORIZSYNC_MSG); do { if (ptr->mon_n_hsync >= CONF_MAX_HSYNC) Error("Sorry. Too many horizontal sync intervals."); ptr->mon_hsync[ptr->mon_n_hsync].lo = xf86_lex_val.realnum; switch (token = xf86getSubToken(&(ptr->mon_comment))) { case COMMA: ptr->mon_hsync[ptr->mon_n_hsync].hi = ptr->mon_hsync[ptr->mon_n_hsync].lo; break; case DASH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER || (float) xf86_lex_val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo) Error(HORIZSYNC_MSG); ptr->mon_hsync[ptr->mon_n_hsync].hi = xf86_lex_val.realnum; if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_hsync++; goto HorizDone; default: /* We cannot currently know if a '\n' was found, * or this is a real error */ ptr->mon_hsync[ptr->mon_n_hsync].hi = ptr->mon_hsync[ptr->mon_n_hsync].lo; ptr->mon_n_hsync++; goto HorizDone; } ptr->mon_n_hsync++; } while ((token = xf86getSubToken(&(ptr->mon_comment))) == NUMBER); HorizDone: xf86unGetToken(token); break; case VERTREFRESH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(VERTREFRESH_MSG); do { ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = xf86_lex_val.realnum; switch (token = xf86getSubToken(&(ptr->mon_comment))) { case COMMA: ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo; break; case DASH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER || (float) xf86_lex_val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo) Error(VERTREFRESH_MSG); ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = xf86_lex_val.realnum; if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_vrefresh++; goto VertDone; default: /* We cannot currently know if a '\n' was found, * or this is a real error */ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo; ptr->mon_n_vrefresh++; goto VertDone; } if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH) Error("Sorry. Too many vertical refresh intervals."); ptr->mon_n_vrefresh++; } while ((token = xf86getSubToken(&(ptr->mon_comment))) == NUMBER); VertDone: xf86unGetToken(token); break; case GAMMA: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) { Error(INVALID_GAMMA_MSG); } else { ptr->mon_gamma_red = ptr->mon_gamma_green = ptr->mon_gamma_blue = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) { ptr->mon_gamma_green = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) { ptr->mon_gamma_blue = xf86_lex_val.realnum; } else { Error(INVALID_GAMMA_MSG); } } else xf86unGetToken(token); } break; case OPTION: ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst); break; case USEMODES: { XF86ConfModesLinkPtr mptr; if ((token = xf86getSubToken(&(ptr->mon_comment))) != STRING) Error(QUOTE_MSG, "UseModes"); /* add to the end of the list of modes sections referenced here */ mptr = calloc(1, sizeof(XF86ConfModesLinkRec)); mptr->list.next = NULL; mptr->ml_modes_str = xf86_lex_val.str; mptr->ml_modes = NULL; ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr) xf86addListItem((GenericListPtr) ptr->mon_modes_sect_lst, (GenericListPtr) mptr); } break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString()); CLEANUP(ptr); return NULL; break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("Monitor section parsed\n"); #endif return ptr; } #undef CLEANUP #define CLEANUP xf86freeModesList XF86ConfModesPtr xf86parseModesSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfModesPtr, XF86ConfModesRec) while ((token = xf86getToken(ModesTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->modes_comment = xf86addComment(ptr->modes_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->modes_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->modes_identifier = xf86_lex_val.str; has_ident = TRUE; break; case MODE: HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode, XF86ConfModeLinePtr); break; case MODELINE: HANDLE_LIST(mon_modeline_lst, xf86parseModeLine, XF86ConfModeLinePtr); break; default: xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString()); CLEANUP(ptr); return NULL; break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("Modes section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printMonitorSection(FILE * cf, XF86ConfMonitorPtr ptr) { int i; XF86ConfModeLinePtr mlptr; XF86ConfModesLinkPtr mptr; while (ptr) { mptr = ptr->mon_modes_sect_lst; fprintf(cf, "Section \"Monitor\"\n"); if (ptr->mon_comment) fprintf(cf, "%s", ptr->mon_comment); if (ptr->mon_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier); if (ptr->mon_vendor) fprintf(cf, "\tVendorName \"%s\"\n", ptr->mon_vendor); if (ptr->mon_modelname) fprintf(cf, "\tModelName \"%s\"\n", ptr->mon_modelname); while (mptr) { fprintf(cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str); mptr = mptr->list.next; } if (ptr->mon_width) fprintf(cf, "\tDisplaySize %d\t%d\n", ptr->mon_width, ptr->mon_height); for (i = 0; i < ptr->mon_n_hsync; i++) { fprintf(cf, "\tHorizSync %2.1f - %2.1f\n", ptr->mon_hsync[i].lo, ptr->mon_hsync[i].hi); } for (i = 0; i < ptr->mon_n_vrefresh; i++) { fprintf(cf, "\tVertRefresh %2.1f - %2.1f\n", ptr->mon_vrefresh[i].lo, ptr->mon_vrefresh[i].hi); } if (ptr->mon_gamma_red) { if (ptr->mon_gamma_red == ptr->mon_gamma_green && ptr->mon_gamma_red == ptr->mon_gamma_blue) { fprintf(cf, "\tGamma %.4g\n", ptr->mon_gamma_red); } else { fprintf(cf, "\tGamma %.4g %.4g %.4g\n", ptr->mon_gamma_red, ptr->mon_gamma_green, ptr->mon_gamma_blue); } } for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) { fprintf(cf, "\tModeLine \"%s\" %2.1f ", mlptr->ml_identifier, mlptr->ml_clock / 1000.0); fprintf(cf, "%d %d %d %d %d %d %d %d", mlptr->ml_hdisplay, mlptr->ml_hsyncstart, mlptr->ml_hsyncend, mlptr->ml_htotal, mlptr->ml_vdisplay, mlptr->ml_vsyncstart, mlptr->ml_vsyncend, mlptr->ml_vtotal); if (mlptr->ml_flags & XF86CONF_PHSYNC) fprintf(cf, " +hsync"); if (mlptr->ml_flags & XF86CONF_NHSYNC) fprintf(cf, " -hsync"); if (mlptr->ml_flags & XF86CONF_PVSYNC) fprintf(cf, " +vsync"); if (mlptr->ml_flags & XF86CONF_NVSYNC) fprintf(cf, " -vsync"); if (mlptr->ml_flags & XF86CONF_INTERLACE) fprintf(cf, " interlace"); if (mlptr->ml_flags & XF86CONF_CSYNC) fprintf(cf, " composite"); if (mlptr->ml_flags & XF86CONF_PCSYNC) fprintf(cf, " +csync"); if (mlptr->ml_flags & XF86CONF_NCSYNC) fprintf(cf, " -csync"); if (mlptr->ml_flags & XF86CONF_DBLSCAN) fprintf(cf, " doublescan"); if (mlptr->ml_flags & XF86CONF_HSKEW) fprintf(cf, " hskew %d", mlptr->ml_hskew); if (mlptr->ml_flags & XF86CONF_BCAST) fprintf(cf, " bcast"); fprintf(cf, "\n"); } xf86printOptionList(cf, ptr->mon_option_lst, 1); fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } void xf86printModesSection(FILE * cf, XF86ConfModesPtr ptr) { XF86ConfModeLinePtr mlptr; while (ptr) { fprintf(cf, "Section \"Modes\"\n"); if (ptr->modes_comment) fprintf(cf, "%s", ptr->modes_comment); if (ptr->modes_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier); for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) { fprintf(cf, "\tModeLine \"%s\" %2.1f ", mlptr->ml_identifier, mlptr->ml_clock / 1000.0); fprintf(cf, "%d %d %d %d %d %d %d %d", mlptr->ml_hdisplay, mlptr->ml_hsyncstart, mlptr->ml_hsyncend, mlptr->ml_htotal, mlptr->ml_vdisplay, mlptr->ml_vsyncstart, mlptr->ml_vsyncend, mlptr->ml_vtotal); if (mlptr->ml_flags & XF86CONF_PHSYNC) fprintf(cf, " +hsync"); if (mlptr->ml_flags & XF86CONF_NHSYNC) fprintf(cf, " -hsync"); if (mlptr->ml_flags & XF86CONF_PVSYNC) fprintf(cf, " +vsync"); if (mlptr->ml_flags & XF86CONF_NVSYNC) fprintf(cf, " -vsync"); if (mlptr->ml_flags & XF86CONF_INTERLACE) fprintf(cf, " interlace"); if (mlptr->ml_flags & XF86CONF_CSYNC) fprintf(cf, " composite"); if (mlptr->ml_flags & XF86CONF_PCSYNC) fprintf(cf, " +csync"); if (mlptr->ml_flags & XF86CONF_NCSYNC) fprintf(cf, " -csync"); if (mlptr->ml_flags & XF86CONF_DBLSCAN) fprintf(cf, " doublescan"); if (mlptr->ml_flags & XF86CONF_HSKEW) fprintf(cf, " hskew %d", mlptr->ml_hskew); if (mlptr->ml_flags & XF86CONF_VSCAN) fprintf(cf, " vscan %d", mlptr->ml_vscan); if (mlptr->ml_flags & XF86CONF_BCAST) fprintf(cf, " bcast"); if (mlptr->ml_comment) fprintf(cf, "%s", mlptr->ml_comment); else fprintf(cf, "\n"); } fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } void xf86freeMonitorList(XF86ConfMonitorPtr ptr) { XF86ConfMonitorPtr prev; while (ptr) { TestFree(ptr->mon_identifier); TestFree(ptr->mon_vendor); TestFree(ptr->mon_modelname); TestFree(ptr->mon_comment); xf86optionListFree(ptr->mon_option_lst); xf86freeModeLineList(ptr->mon_modeline_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } void xf86freeModesList(XF86ConfModesPtr ptr) { XF86ConfModesPtr prev; while (ptr) { TestFree(ptr->modes_identifier); TestFree(ptr->modes_comment); xf86freeModeLineList(ptr->mon_modeline_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p) { while (p) { if (xf86nameCompare(ident, p->mon_identifier) == 0) return p; p = p->list.next; } return NULL; } XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p) { while (p) { if (xf86nameCompare(ident, p->modes_identifier) == 0) return p; p = p->list.next; } return NULL; } XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p) { while (p) { if (xf86nameCompare(ident, p->ml_identifier) == 0) return p; p = p->list.next; } return NULL; } int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen) { XF86ConfMonitorPtr monitor = screen->scrn_monitor; XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst; XF86ConfModesPtr modes; while (modeslnk) { modes = xf86findModes(modeslnk->ml_modes_str, p->conf_modes_lst); if (!modes) { xf86validationError(UNDEFINED_MODES_MSG, modeslnk->ml_modes_str, screen->scrn_identifier); return FALSE; } modeslnk->ml_modes = modes; modeslnk = modeslnk->list.next; } return TRUE; } xorg-server-1.20.8/hw/xfree86/parser/Makefile.am0000644000175000017500000000107713640201473016250 00000000000000noinst_LTLIBRARIES = libxf86config.la INTERNAL_SOURCES= \ Device.c \ Files.c \ Flags.c \ Input.c \ InputClass.c \ OutputClass.c \ Layout.c \ Module.c \ Video.c \ Monitor.c \ Pointer.c \ Screen.c \ Vendor.c \ read.c \ scan.c \ write.c \ DRI.c \ Extensions.c libxf86config_la_SOURCES = \ $(INTERNAL_SOURCES) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \ -DDATADIR=\"$(datadir)\" EXTRA_DIST = \ Configint.h \ configProcs.h \ xf86Optrec.h \ xf86Parser.h \ xf86tokens.h sdk_HEADERS = \ xf86Parser.h \ xf86Optrec.h AM_CPPFLAGS = -I$(srcdir)/../common xorg-server-1.20.8/hw/xfree86/parser/xf86Optrec.h0000644000175000017500000001071413640201473016333 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * Copyright (c) 1997-2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the Option Record that is passed between the Parser, * and Module setup procs. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _xf86Optrec_h_ #define _xf86Optrec_h_ #include #include #include "xf86Optionstr.h" #include extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val); extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt); extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt); extern _X_EXPORT char *xf86optionName(XF86OptionPtr opt); extern _X_EXPORT char *xf86optionValue(XF86OptionPtr opt); extern _X_EXPORT XF86OptionPtr xf86newOption(char *name, char *value); extern _X_EXPORT XF86OptionPtr xf86nextOption(XF86OptionPtr list); extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name); extern _X_EXPORT const char *xf86findOptionValue(XF86OptionPtr list, const char *name); extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used); extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail); extern _X_EXPORT int xf86nameCompare(const char *s1, const char *s2); extern _X_EXPORT char *xf86uLongToString(unsigned long i); extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head); extern _X_EXPORT void xf86printOptionList(FILE * fp, XF86OptionPtr list, int tabs); #endif /* _xf86Optrec_h_ */ xorg-server-1.20.8/hw/xfree86/parser/OutputClass.c0000644000175000017500000001275613640201473016654 00000000000000/* * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec OutputClassTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {DRIVER, "driver"}, {MODULEPATH, "modulepath"}, {OPTION, "option"}, {MATCH_DRIVER, "matchdriver"}, {-1, ""}, }; static void xf86freeOutputClassList(XF86ConfOutputClassPtr ptr) { XF86ConfOutputClassPtr prev; while (ptr) { xf86MatchGroup *group, *next; char **list; TestFree(ptr->identifier); TestFree(ptr->comment); TestFree(ptr->driver); TestFree(ptr->modulepath); xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xf86optionListFree(ptr->option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } #define CLEANUP xf86freeOutputClassList #define TOKEN_SEP "|" static void add_group_entry(struct xorg_list *head, char **values) { xf86MatchGroup *group; group = malloc(sizeof(*group)); if (group) { group->values = values; xorg_list_add(&group->entry, head); } } XF86ConfOutputClassPtr xf86parseOutputClassSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfOutputClassPtr, XF86ConfOutputClassRec) /* Initialize MatchGroup lists */ xorg_list_init(&ptr->match_driver); while ((token = xf86getToken(OutputClassTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Driver"); else ptr->driver = xf86_lex_val.str; break; case MODULEPATH: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "ModulePath"); if (ptr->modulepath) { char *path; XNFasprintf(&path, "%s,%s", ptr->modulepath, xf86_lex_val.str); free(xf86_lex_val.str); free(ptr->modulepath); ptr->modulepath = path; } else { ptr->modulepath = xf86_lex_val.str; } break; case OPTION: ptr->option_lst = xf86parseOption(ptr->option_lst); break; case MATCH_DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDriver"); add_group_entry(&ptr->match_driver, xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); free(xf86_lex_val.str); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("OutputClass section parsed\n"); #endif return ptr; } void xf86printOutputClassSection(FILE * cf, XF86ConfOutputClassPtr ptr) { const xf86MatchGroup *group; char *const *cur; while (ptr) { fprintf(cf, "Section \"OutputClass\"\n"); if (ptr->comment) fprintf(cf, "%s", ptr->comment); if (ptr->identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); if (ptr->driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); xorg_list_for_each_entry(group, &ptr->match_driver, entry) { fprintf(cf, "\tMatchDriver \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } xorg-server-1.20.8/hw/xfree86/parser/Input.c0000644000175000017500000001431613640201473015457 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec InputTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, {DRIVER, "driver"}, {-1, ""}, }; #define CLEANUP xf86freeInputList XF86ConfInputPtr xf86parseInputSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken(InputTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->inp_identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Driver"); if (strcmp(xf86_lex_val.str, "keyboard") == 0) { ptr->inp_driver = strdup("kbd"); free(xf86_lex_val.str); } else ptr->inp_driver = xf86_lex_val.str; break; case OPTION: ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("InputDevice section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printInputSection(FILE * cf, XF86ConfInputPtr ptr) { while (ptr) { fprintf(cf, "Section \"InputDevice\"\n"); if (ptr->inp_comment) fprintf(cf, "%s", ptr->inp_comment); if (ptr->inp_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier); if (ptr->inp_driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->inp_driver); xf86printOptionList(cf, ptr->inp_option_lst, 1); fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } void xf86freeInputList(XF86ConfInputPtr ptr) { XF86ConfInputPtr prev; while (ptr) { TestFree(ptr->inp_identifier); TestFree(ptr->inp_driver); TestFree(ptr->inp_comment); xf86optionListFree(ptr->inp_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } int xf86validateInput(XF86ConfigPtr p) { XF86ConfInputPtr input = p->conf_input_lst; while (input) { if (!input->inp_driver) { xf86validationError(UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier); return FALSE; } input = input->list.next; } return TRUE; } XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p) { while (p) { if (xf86nameCompare(ident, p->inp_identifier) == 0) return p; p = p->list.next; } return NULL; } XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p) { while (p) { if (xf86nameCompare(driver, p->inp_driver) == 0) return p; p = p->list.next; } return NULL; } xorg-server-1.20.8/hw/xfree86/parser/DRI.c0000644000175000017500000000706513640201473015001 00000000000000/* DRI.c -- DRI Section in XF86Config file * Created: Fri Mar 19 08:40:22 1999 by faith@precisioninsight.com * Revised: Thu Jun 17 16:08:05 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec DRITab[] = { {ENDSECTION, "endsection"}, {GROUP, "group"}, {MODE, "mode"}, {-1, ""}, }; #define CLEANUP xf86freeDRI XF86ConfDRIPtr xf86parseDRISection(void) { int token; parsePrologue(XF86ConfDRIPtr, XF86ConfDRIRec); /* Zero is a valid value for this. */ ptr->dri_group = -1; while ((token = xf86getToken(DRITab)) != ENDSECTION) { switch (token) { case GROUP: if ((token = xf86getSubToken(&(ptr->dri_comment))) == STRING) ptr->dri_group_name = xf86_lex_val.str; else if (token == NUMBER) ptr->dri_group = xf86_lex_val.num; else Error(GROUP_MSG); break; case MODE: if (xf86getSubToken(&(ptr->dri_comment)) != NUMBER) Error(NUMBER_MSG, "Mode"); if (xf86_lex_val.numType != PARSE_OCTAL) Error(MUST_BE_OCTAL_MSG, xf86_lex_val.num); ptr->dri_mode = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; case COMMENT: ptr->dri_comment = xf86addComment(ptr->dri_comment, xf86_lex_val.str); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG ErrorF("DRI section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printDRISection(FILE * cf, XF86ConfDRIPtr ptr) { if (ptr == NULL) return; fprintf(cf, "Section \"DRI\"\n"); if (ptr->dri_comment) fprintf(cf, "%s", ptr->dri_comment); if (ptr->dri_group_name) fprintf(cf, "\tGroup \"%s\"\n", ptr->dri_group_name); else if (ptr->dri_group >= 0) fprintf(cf, "\tGroup %d\n", ptr->dri_group); if (ptr->dri_mode) fprintf(cf, "\tMode 0%o\n", ptr->dri_mode); fprintf(cf, "EndSection\n\n"); } void xf86freeDRI(XF86ConfDRIPtr ptr) { if (ptr == NULL) return; TestFree(ptr->dri_comment); free(ptr); } xorg-server-1.20.8/hw/xfree86/parser/Pointer.c0000644000175000017500000002147113640201473016000 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" #include "Xprintf.h" static const xf86ConfigSymTabRec PointerTab[] = { {PROTOCOL, "protocol"}, {EMULATE3, "emulate3buttons"}, {EM3TIMEOUT, "emulate3timeout"}, {ENDSUBSECTION, "endsubsection"}, {ENDSECTION, "endsection"}, {PDEVICE, "device"}, {PDEVICE, "port"}, {BAUDRATE, "baudrate"}, {SAMPLERATE, "samplerate"}, {CLEARDTR, "cleardtr"}, {CLEARRTS, "clearrts"}, {CHORDMIDDLE, "chordmiddle"}, {PRESOLUTION, "resolution"}, {DEVICE_NAME, "devicename"}, {ALWAYSCORE, "alwayscore"}, {PBUTTONS, "buttons"}, {ZAXISMAPPING, "zaxismapping"}, {-1, ""}, }; static const xf86ConfigSymTabRec ZMapTab[] = { {XAXIS, "x"}, {YAXIS, "y"}, {-1, ""}, }; #define CLEANUP xf86freeInputList XF86ConfInputPtr xf86parsePointerSection(void) { char *s; unsigned long val1; int token; parsePrologue(XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken(PointerTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str); break; case PROTOCOL: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Protocol"), xf86_lex_val.str); break; case PDEVICE: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Device"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Device"), xf86_lex_val.str); break; case EMULATE3: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Emulate3Buttons"), NULL); break; case EM3TIMEOUT: if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Emulate3Timeout"); s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Emulate3Timeout"), s); break; case CHORDMIDDLE: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("ChordMiddle"), NULL); break; case PBUTTONS: if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Buttons"); s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Buttons"), s); break; case BAUDRATE: if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "BaudRate"); s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("BaudRate"), s); break; case SAMPLERATE: if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "SampleRate"); s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("SampleRate"), s); break; case PRESOLUTION: if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Resolution"); s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Resolution"), s); break; case CLEARDTR: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("ClearDTR"), NULL); break; case CLEARRTS: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("ClearRTS"), NULL); break; case ZAXISMAPPING: switch (xf86getToken(ZMapTab)) { case NUMBER: if (xf86_lex_val.num < 0) Error(ZAXISMAPPING_MSG); val1 = xf86_lex_val.num; if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) { Error(ZAXISMAPPING_MSG); } if (asprintf(&s, "%lu %u", val1, xf86_lex_val.num) == -1) s = NULL; break; case XAXIS: s = strdup("x"); break; case YAXIS: s = strdup("y"); break; default: Error(ZAXISMAPPING_MSG); break; } ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("ZAxisMapping"), s); break; case ALWAYSCORE: break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER); ptr->inp_driver = strdup("mouse"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("CorePointer"), NULL); #ifdef DEBUG printf("Pointer section parsed\n"); #endif return ptr; } #undef CLEANUP xorg-server-1.20.8/hw/xfree86/parser/Video.c0000644000175000017500000002176013640201473015427 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec VideoPortTab[] = { {ENDSUBSECTION, "endsubsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, {-1, ""}, }; #define CLEANUP xf86freeVideoPortList static void xf86freeVideoPortList(XF86ConfVideoPortPtr ptr) { XF86ConfVideoPortPtr prev; while (ptr) { TestFree(ptr->vp_identifier); TestFree(ptr->vp_comment); xf86optionListFree(ptr->vp_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } static XF86ConfVideoPortPtr xf86parseVideoPortSubSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfVideoPortPtr, XF86ConfVideoPortRec) while ((token = xf86getToken(VideoPortTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: ptr->vp_comment = xf86addComment(ptr->vp_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vp_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->vp_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG printf("VideoPort subsection parsed\n"); #endif return ptr; } #undef CLEANUP static const xf86ConfigSymTabRec VideoAdaptorTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {VENDOR, "vendorname"}, {BOARD, "boardname"}, {BUSID, "busid"}, {DRIVER, "driver"}, {OPTION, "option"}, {SUBSECTION, "subsection"}, {-1, ""}, }; #define CLEANUP xf86freeVideoAdaptorList XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec) while ((token = xf86getToken(VideoAdaptorTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->va_comment = xf86addComment(ptr->va_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); ptr->va_identifier = xf86_lex_val.str; if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); ptr->va_vendor = xf86_lex_val.str; break; case BOARD: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Board"); ptr->va_board = xf86_lex_val.str; break; case BUSID: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "BusID"); ptr->va_busid = xf86_lex_val.str; break; case DRIVER: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Driver"); ptr->va_driver = xf86_lex_val.str; break; case OPTION: ptr->va_option_lst = xf86parseOption(ptr->va_option_lst); break; case SUBSECTION: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); { HANDLE_LIST(va_port_lst, xf86parseVideoPortSubSection, XF86ConfVideoPortPtr); } break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("VideoAdaptor section parsed\n"); #endif return ptr; } void xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr) { XF86ConfVideoPortPtr pptr; while (ptr) { fprintf(cf, "Section \"VideoAdaptor\"\n"); if (ptr->va_comment) fprintf(cf, "%s", ptr->va_comment); if (ptr->va_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->va_identifier); if (ptr->va_vendor) fprintf(cf, "\tVendorName \"%s\"\n", ptr->va_vendor); if (ptr->va_board) fprintf(cf, "\tBoardName \"%s\"\n", ptr->va_board); if (ptr->va_busid) fprintf(cf, "\tBusID \"%s\"\n", ptr->va_busid); if (ptr->va_driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->va_driver); xf86printOptionList(cf, ptr->va_option_lst, 1); for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next) { fprintf(cf, "\tSubSection \"VideoPort\"\n"); if (pptr->vp_comment) fprintf(cf, "%s", pptr->vp_comment); if (pptr->vp_identifier) fprintf(cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier); xf86printOptionList(cf, pptr->vp_option_lst, 2); fprintf(cf, "\tEndSubSection\n"); } fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr) { XF86ConfVideoAdaptorPtr prev; while (ptr) { TestFree(ptr->va_identifier); TestFree(ptr->va_vendor); TestFree(ptr->va_board); TestFree(ptr->va_busid); TestFree(ptr->va_driver); TestFree(ptr->va_fwdref); TestFree(ptr->va_comment); xf86freeVideoPortList(ptr->va_port_lst); xf86optionListFree(ptr->va_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p) { while (p) { if (xf86nameCompare(ident, p->va_identifier) == 0) return p; p = p->list.next; } return NULL; } xorg-server-1.20.8/hw/xfree86/parser/configProcs.h0000644000175000017500000001241113640201473016633 00000000000000/* * Copyright (c) 1997-2001 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). */ /* Private procs. Public procs are in xf86Parser.h and xf86Optrec.h */ /* exported functions are/were used by the X Server */ /* Device.c */ XF86ConfDevicePtr xf86parseDeviceSection(void); void xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr); void xf86freeDeviceList(XF86ConfDevicePtr ptr); int xf86validateDevice(XF86ConfigPtr p); /* Files.c */ XF86ConfFilesPtr xf86parseFilesSection(void); void xf86printFileSection(FILE * cf, XF86ConfFilesPtr ptr); void xf86freeFiles(XF86ConfFilesPtr p); /* Flags.c */ XF86ConfFlagsPtr xf86parseFlagsSection(void); void xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags); void xf86freeFlags(XF86ConfFlagsPtr flags); /* Input.c */ XF86ConfInputPtr xf86parseInputSection(void); void xf86printInputSection(FILE * f, XF86ConfInputPtr ptr); void xf86freeInputList(XF86ConfInputPtr ptr); int xf86validateInput(XF86ConfigPtr p); /* InputClass.c */ XF86ConfInputClassPtr xf86parseInputClassSection(void); void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr); /* OutputClass.c */ XF86ConfOutputClassPtr xf86parseOutputClassSection(void); void xf86printOutputClassSection(FILE * f, XF86ConfOutputClassPtr ptr); /* Layout.c */ XF86ConfLayoutPtr xf86parseLayoutSection(void); void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr); void xf86freeLayoutList(XF86ConfLayoutPtr ptr); int xf86validateLayout(XF86ConfigPtr p); /* Module.c */ XF86ConfModulePtr xf86parseModuleSection(void); void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr); extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, const char *name, int type, XF86OptionPtr opts); void xf86freeModules(XF86ConfModulePtr ptr); /* Monitor.c */ XF86ConfMonitorPtr xf86parseMonitorSection(void); XF86ConfModesPtr xf86parseModesSection(void); void xf86printMonitorSection(FILE * cf, XF86ConfMonitorPtr ptr); void xf86printModesSection(FILE * cf, XF86ConfModesPtr ptr); extern _X_EXPORT void xf86freeMonitorList(XF86ConfMonitorPtr ptr); void xf86freeModesList(XF86ConfModesPtr ptr); int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen); /* Pointer.c */ XF86ConfInputPtr xf86parsePointerSection(void); /* Screen.c */ XF86ConfScreenPtr xf86parseScreenSection(void); void xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr); extern _X_EXPORT void xf86freeScreenList(XF86ConfScreenPtr ptr); int xf86validateScreen(XF86ConfigPtr p); /* Vendor.c */ XF86ConfVendorPtr xf86parseVendorSection(void); void xf86freeVendorList(XF86ConfVendorPtr p); void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr); /* Video.c */ XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void); void xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr); void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr); /* scan.c */ int xf86getToken(const xf86ConfigSymTabRec * tab); int xf86getSubToken(char **comment); int xf86getSubTokenWithTab(char **comment, const xf86ConfigSymTabRec * tab); void xf86unGetToken(int token); char *xf86tokenString(void); void xf86parseError(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2); void xf86validationError(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2); void xf86setSection(const char *section); int xf86getStringToken(const xf86ConfigSymTabRec * tab); /* write.c */ /* DRI.c */ XF86ConfDRIPtr xf86parseDRISection(void); void xf86printDRISection(FILE * cf, XF86ConfDRIPtr ptr); void xf86freeDRI(XF86ConfDRIPtr ptr); /* Extensions.c */ XF86ConfExtensionsPtr xf86parseExtensionsSection(void); void xf86printExtensionsSection(FILE * cf, XF86ConfExtensionsPtr ptr); void xf86freeExtensions(XF86ConfExtensionsPtr ptr); #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef HAVE_XORG_CONFIG_H /* Externally provided functions */ void ErrorF(const char *f, ...); void VErrorF(const char *f, va_list args); #endif xorg-server-1.20.8/hw/xfree86/parser/read.c0000644000175000017500000002527613640201473015302 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Config.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec TopLevelTab[] = { {SECTION, "section"}, {-1, ""}, }; #define CLEANUP xf86freeConfig /* * This function resolves name references and reports errors if the named * objects cannot be found. */ static int xf86validateConfig(XF86ConfigPtr p) { if (!xf86validateScreen(p)) return FALSE; if (!xf86validateInput(p)) return FALSE; if (!xf86validateLayout(p)) return FALSE; return TRUE; } XF86ConfigPtr xf86readConfigFile(void) { int token; XF86ConfigPtr ptr = NULL; if ((ptr = xf86allocateConfig()) == NULL) { return NULL; } while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) { switch (token) { case COMMENT: ptr->conf_comment = xf86addComment(ptr->conf_comment, xf86_lex_val.str); break; case SECTION: if (xf86getSubToken(&(ptr->conf_comment)) != STRING) { xf86parseError(QUOTE_MSG, "Section"); CLEANUP(ptr); return NULL; } xf86setSection(xf86_lex_val.str); if (xf86nameCompare(xf86_lex_val.str, "files") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_RETURN(conf_files, xf86parseFilesSection()); } else if (xf86nameCompare(xf86_lex_val.str, "serverflags") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_RETURN(conf_flags, xf86parseFlagsSection()); } else if (xf86nameCompare(xf86_lex_val.str, "pointer") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_input_lst, xf86parsePointerSection, XF86ConfInputPtr); } else if (xf86nameCompare(xf86_lex_val.str, "videoadaptor") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection, XF86ConfVideoAdaptorPtr); } else if (xf86nameCompare(xf86_lex_val.str, "device") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_device_lst, xf86parseDeviceSection, XF86ConfDevicePtr); } else if (xf86nameCompare(xf86_lex_val.str, "monitor") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection, XF86ConfMonitorPtr); } else if (xf86nameCompare(xf86_lex_val.str, "modes") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_modes_lst, xf86parseModesSection, XF86ConfModesPtr); } else if (xf86nameCompare(xf86_lex_val.str, "screen") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_screen_lst, xf86parseScreenSection, XF86ConfScreenPtr); } else if (xf86nameCompare(xf86_lex_val.str, "inputdevice") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_input_lst, xf86parseInputSection, XF86ConfInputPtr); } else if (xf86nameCompare(xf86_lex_val.str, "inputclass") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_inputclass_lst, xf86parseInputClassSection, XF86ConfInputClassPtr); } else if (xf86nameCompare(xf86_lex_val.str, "outputclass") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_outputclass_lst, xf86parseOutputClassSection, XF86ConfOutputClassPtr); } else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_RETURN(conf_modules, xf86parseModuleSection()); } else if (xf86nameCompare(xf86_lex_val.str, "serverlayout") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection, XF86ConfLayoutPtr); } else if (xf86nameCompare(xf86_lex_val.str, "vendor") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection, XF86ConfVendorPtr); } else if (xf86nameCompare(xf86_lex_val.str, "dri") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_RETURN(conf_dri, xf86parseDRISection()); } else if (xf86nameCompare(xf86_lex_val.str, "extensions") == 0) { free(xf86_lex_val.str); xf86_lex_val.str = NULL; HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection()); } else { free(xf86_lex_val.str); xf86_lex_val.str = NULL; Error(INVALID_SECTION_MSG, xf86tokenString()); } break; default: free(xf86_lex_val.str); xf86_lex_val.str = NULL; Error(INVALID_KEYWORD_MSG, xf86tokenString()); } } if (xf86validateConfig(ptr)) return ptr; else { CLEANUP(ptr); return NULL; } } #undef CLEANUP /* * adds an item to the end of the linked list. Any record whose first field * is a GenericListRec can be cast to this type and used with this function. * A pointer to the head of the list is returned to handle the addition of * the first item. */ GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr new) { GenericListPtr p = head; GenericListPtr last = NULL; while (p) { last = p; p = p->next; } if (last) { last->next = new; return head; } else return new; } /* * Test if one chained list contains the other. * In this case both list have the same endpoint (provided they don't loop) */ int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2) { GenericListPtr p = list_1; GenericListPtr last_1 = NULL, last_2 = NULL; while (p) { last_1 = p; p = p->next; } p = list_2; while (p) { last_2 = p; p = p->next; } return (!(last_1 == last_2)); } /* * Conditionally allocate config struct, but only allocate it * if it's not already there. In either event, return the pointer * to the global config struct. */ XF86ConfigPtr xf86allocateConfig(void) { if (!xf86configptr) { xf86configptr = calloc(1, sizeof(XF86ConfigRec)); } return xf86configptr; } void xf86freeConfig(XF86ConfigPtr p) { if (p == NULL) return; xf86freeFiles(p->conf_files); xf86freeModules(p->conf_modules); xf86freeFlags(p->conf_flags); xf86freeMonitorList(p->conf_monitor_lst); xf86freeModesList(p->conf_modes_lst); xf86freeVideoAdaptorList(p->conf_videoadaptor_lst); xf86freeDeviceList(p->conf_device_lst); xf86freeScreenList(p->conf_screen_lst); xf86freeLayoutList(p->conf_layout_lst); xf86freeInputList(p->conf_input_lst); xf86freeVendorList(p->conf_vendor_lst); xf86freeDRI(p->conf_dri); xf86freeExtensions(p->conf_extensions); TestFree(p->conf_comment); free(p); } xorg-server-1.20.8/hw/xfree86/parser/Vendor.c0000644000175000017500000001633413640201473015617 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec VendorSubTab[] = { {ENDSUBSECTION, "endsubsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, {-1, ""}, }; static void xf86freeVendorSubList(XF86ConfVendSubPtr ptr) { XF86ConfVendSubPtr prev; while (ptr) { TestFree(ptr->vs_identifier); TestFree(ptr->vs_name); TestFree(ptr->vs_comment); xf86optionListFree(ptr->vs_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } #define CLEANUP xf86freeVendorSubList static XF86ConfVendSubPtr xf86parseVendorSubSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfVendSubPtr, XF86ConfVendSubRec) while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: ptr->vs_comment = xf86addComment(ptr->vs_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vs_comment))) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->vs_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG printf("Vendor subsection parsed\n"); #endif return ptr; } #undef CLEANUP static const xf86ConfigSymTabRec VendorTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, {SUBSECTION, "subsection"}, {-1, ""}, }; #define CLEANUP xf86freeVendorList XF86ConfVendorPtr xf86parseVendorSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfVendorPtr, XF86ConfVendorRec) while ((token = xf86getToken(VendorTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->vnd_comment = xf86addComment(ptr->vnd_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vnd_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->vnd_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst); break; case SUBSECTION: if (xf86getSubToken(&(ptr->vnd_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); { HANDLE_LIST(vnd_sub_lst, xf86parseVendorSubSection, XF86ConfVendSubPtr); } break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("Vendor section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr) { XF86ConfVendSubPtr pptr; while (ptr) { fprintf(cf, "Section \"Vendor\"\n"); if (ptr->vnd_comment) fprintf(cf, "%s", ptr->vnd_comment); if (ptr->vnd_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier); xf86printOptionList(cf, ptr->vnd_option_lst, 1); for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next) { fprintf(cf, "\tSubSection \"Vendor\"\n"); if (pptr->vs_comment) fprintf(cf, "%s", pptr->vs_comment); if (pptr->vs_identifier) fprintf(cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier); xf86printOptionList(cf, pptr->vs_option_lst, 2); fprintf(cf, "\tEndSubSection\n"); } fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } void xf86freeVendorList(XF86ConfVendorPtr p) { if (p == NULL) return; xf86freeVendorSubList(p->vnd_sub_lst); TestFree(p->vnd_identifier); TestFree(p->vnd_comment); xf86optionListFree(p->vnd_option_lst); free(p); } xorg-server-1.20.8/hw/xfree86/parser/Configint.h0000644000175000017500000001745313640201473016312 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * Copyright (c) 1997-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * These definitions are used through out the configuration file parser, but * they should not be visible outside of the parser. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _Configint_h_ #define _Configint_h_ #include #include #include #include #include "xf86Parser.h" typedef enum { PARSE_DECIMAL, PARSE_OCTAL, PARSE_HEX } ParserNumType; typedef struct { int num; /* returned number */ char *str; /* private copy of the return-string */ double realnum; /* returned number as a real */ ParserNumType numType; /* used to enforce correct number formatting */ } LexRec, *LexPtr; extern LexRec xf86_lex_val; #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #include "configProcs.h" #include #define TestFree(a) if (a) { free ((void *) a); a = NULL; } #define parsePrologue(typeptr,typerec) typeptr ptr; \ if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; } #define HANDLE_RETURN(f,func)\ if ((ptr->f=func) == NULL)\ {\ CLEANUP (ptr);\ return NULL;\ } #define HANDLE_LIST(field,func,type)\ {\ type p = func ();\ if (p == NULL)\ {\ CLEANUP (ptr);\ return NULL;\ }\ else\ {\ ptr->field = (type) xf86addListItem ((glp) ptr->field, (glp) p);\ }\ } #define Error(...) do { \ xf86parseError (__VA_ARGS__); CLEANUP (ptr); return NULL; \ } while (0) /* * These are defines for error messages to promote consistency. * error messages are preceded by the line number, section and file name, * so these messages should be about the specific keyword and syntax in error. * To help limit namespace polution, end each with _MSG. * limit messages to 70 characters if possible. */ #define BAD_OPTION_MSG \ "The Option keyword requires 1 or 2 quoted strings to follow it." #define INVALID_KEYWORD_MSG \ "\"%s\" is not a valid keyword in this section." #define INVALID_SECTION_MSG \ "\"%s\" is not a valid section name." #define UNEXPECTED_EOF_MSG \ "Unexpected EOF. Missing EndSection keyword?" #define QUOTE_MSG \ "The %s keyword requires a quoted string to follow it." #define NUMBER_MSG \ "The %s keyword requires a number to follow it." #define POSITIVE_INT_MSG \ "The %s keyword requires a positive integer to follow it." #define BOOL_MSG \ "The %s keyword requires a boolean to follow it." #define ZAXISMAPPING_MSG \ "The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it." #define DACSPEED_MSG \ "The DacSpeed keyword must be followed by a list of up to %d numbers." #define DISPLAYSIZE_MSG \ "The DisplaySize keyword must be followed by the width and height in mm." #define HORIZSYNC_MSG \ "The HorizSync keyword must be followed by a list of numbers or ranges." #define VERTREFRESH_MSG \ "The VertRefresh keyword must be followed by a list of numbers or ranges." #define VIEWPORT_MSG \ "The Viewport keyword must be followed by an X and Y value." #define VIRTUAL_MSG \ "The Virtual keyword must be followed by a width and height value." #define WEIGHT_MSG \ "The Weight keyword must be followed by red, green and blue values." #define BLACK_MSG \ "The Black keyword must be followed by red, green and blue values." #define WHITE_MSG \ "The White keyword must be followed by red, green and blue values." #define SCREEN_MSG \ "The Screen keyword must be followed by an optional number, a screen name\n" \ "\tin quotes, and optional position/layout information." #define INVALID_SCR_MSG \ "Invalid Screen line." #define INPUTDEV_MSG \ "The InputDevice keyword must be followed by an input device name in quotes." #define INACTIVE_MSG \ "The Inactive keyword must be followed by a Device name in quotes." #define UNDEFINED_SCREEN_MSG \ "Undefined Screen \"%s\" referenced by ServerLayout \"%s\"." #define UNDEFINED_MODES_MSG \ "Undefined Modes Section \"%s\" referenced by Monitor \"%s\"." #define UNDEFINED_DEVICE_MSG \ "Undefined Device \"%s\" referenced by Screen \"%s\"." #define UNDEFINED_ADAPTOR_MSG \ "Undefined VideoAdaptor \"%s\" referenced by Screen \"%s\"." #define ADAPTOR_REF_TWICE_MSG \ "VideoAdaptor \"%s\" already referenced by Screen \"%s\"." #define UNDEFINED_DEVICE_LAY_MSG \ "Undefined Device \"%s\" referenced by ServerLayout \"%s\"." #define UNDEFINED_INPUT_MSG \ "Undefined InputDevice \"%s\" referenced by ServerLayout \"%s\"." #define NO_IDENT_MSG \ "This section must have an Identifier line." #define ONLY_ONE_MSG \ "This section must have only one of either %s line." #define UNDEFINED_INPUTDRIVER_MSG \ "InputDevice section \"%s\" must have a Driver line." #define INVALID_GAMMA_MSG \ "gamma correction value(s) expected\n either one value or three r/g/b values." #define GROUP_MSG \ "The Group keyword must be followed by either a group name in quotes or\n" \ "\ta numerical group id." #define MULTIPLE_MSG \ "Multiple \"%s\" lines." #define MUST_BE_OCTAL_MSG \ "The number \"%d\" given in this section must be in octal (0xxx) format." #define GPU_DEVICE_TOO_MANY \ "More than %d GPU devices defined." /* Warning messages */ #define OBSOLETE_MSG \ "Ignoring obsolete keyword \"%s\"." #endif /* _Configint_h_ */ xorg-server-1.20.8/hw/xfree86/parser/Extensions.c0000644000175000017500000000561613640201473016522 00000000000000/* * Copyright 2004 Red Hat Inc., Raleigh, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Kevin E. Martin * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec ExtensionsTab[] = { {ENDSECTION, "endsection"}, {OPTION, "option"}, {-1, ""}, }; #define CLEANUP xf86freeExtensions XF86ConfExtensionsPtr xf86parseExtensionsSection(void) { int token; parsePrologue(XF86ConfExtensionsPtr, XF86ConfExtensionsRec); while ((token = xf86getToken(ExtensionsTab)) != ENDSECTION) { switch (token) { case OPTION: ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; case COMMENT: ptr->extensions_comment = xf86addComment(ptr->extensions_comment, xf86_lex_val.str); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG ErrorF("Extensions section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printExtensionsSection(FILE * cf, XF86ConfExtensionsPtr ptr) { XF86OptionPtr p; if (ptr == NULL || ptr->ext_option_lst == NULL) return; p = ptr->ext_option_lst; fprintf(cf, "Section \"Extensions\"\n"); if (ptr->extensions_comment) fprintf(cf, "%s", ptr->extensions_comment); xf86printOptionList(cf, p, 1); fprintf(cf, "EndSection\n\n"); } void xf86freeExtensions(XF86ConfExtensionsPtr ptr) { if (ptr == NULL) return; xf86optionListFree(ptr->ext_option_lst); TestFree(ptr->extensions_comment); free(ptr); } xorg-server-1.20.8/hw/xfree86/parser/xf86tokens.h0000644000175000017500000001511613640201473016403 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _xf86_tokens_h #define _xf86_tokens_h /* Undefine symbols that some OSs might define */ #undef IOBASE /* * Each token should have a unique value regardless of the section * it is used in. */ typedef enum { /* errno-style tokens */ OBSOLETE_TOKEN = -5, EOF_TOKEN = -4, LOCK_TOKEN = -3, ERROR_TOKEN = -2, /* value type tokens */ NUMBER = 1, STRING, /* Tokens that can appear in many sections */ SECTION, SUBSECTION, ENDSECTION, ENDSUBSECTION, IDENTIFIER, VENDOR, DASH, COMMA, MATCHSEAT, OPTION, COMMENT, /* Frequency units */ HRZ, KHZ, MHZ, /* File tokens */ FONTPATH, MODULEPATH, LOGFILEPATH, XKBDIR, /* Server Flag tokens. These are deprecated in favour of generic Options */ NOTRAPSIGNALS, DONTZAP, DONTZOOM, DISABLEVIDMODE, ALLOWNONLOCAL, DISABLEMODINDEV, MODINDEVALLOWNONLOCAL, ALLOWMOUSEOPENFAIL, BLANKTIME, STANDBYTIME, SUSPENDTIME, OFFTIME, DEFAULTLAYOUT, /* Monitor tokens */ MODEL, MODELINE, DISPLAYSIZE, HORIZSYNC, VERTREFRESH, MODE, GAMMA, USEMODES, /* Modes tokens */ /* no new ones */ /* Mode tokens */ DOTCLOCK, HTIMINGS, VTIMINGS, FLAGS, HSKEW, BCAST, VSCAN, ENDMODE, /* Screen tokens */ OBSDRIVER, MDEVICE, GDEVICE, MONITOR, SCREENNO, DEFAULTDEPTH, DEFAULTBPP, DEFAULTFBBPP, /* VideoAdaptor tokens */ VIDEOADAPTOR, /* Mode timing tokens */ TT_INTERLACE, TT_PHSYNC, TT_NHSYNC, TT_PVSYNC, TT_NVSYNC, TT_CSYNC, TT_PCSYNC, TT_NCSYNC, TT_DBLSCAN, TT_HSKEW, TT_BCAST, TT_VSCAN, /* Module tokens */ LOAD, LOAD_DRIVER, DISABLE, /* Device tokens */ DRIVER, CHIPSET, CLOCKS, VIDEORAM, BOARD, IOBASE, RAMDAC, DACSPEED, BIOSBASE, MEMBASE, CLOCKCHIP, CHIPID, CHIPREV, CARD, BUSID, IRQ, /* Keyboard tokens */ AUTOREPEAT, XLEDS, KPROTOCOL, XKBKEYMAP, XKBCOMPAT, XKBTYPES, XKBKEYCODES, XKBGEOMETRY, XKBSYMBOLS, XKBDISABLE, PANIX106, XKBRULES, XKBMODEL, XKBLAYOUT, XKBVARIANT, XKBOPTIONS, /* Obsolete keyboard tokens */ SERVERNUM, LEFTALT, RIGHTALT, SCROLLLOCK_TOK, RIGHTCTL, /* arguments for the above obsolete tokens */ CONF_KM_META, CONF_KM_COMPOSE, CONF_KM_MODESHIFT, CONF_KM_MODELOCK, CONF_KM_SCROLLLOCK, CONF_KM_CONTROL, /* Pointer tokens */ EMULATE3, BAUDRATE, SAMPLERATE, PRESOLUTION, CLEARDTR, CLEARRTS, CHORDMIDDLE, PROTOCOL, PDEVICE, EM3TIMEOUT, DEVICE_NAME, ALWAYSCORE, PBUTTONS, ZAXISMAPPING, /* Pointer Z axis mapping tokens */ XAXIS, YAXIS, /* Display tokens */ MODES, VIEWPORT, VIRTUAL, VISUAL, BLACK_TOK, WHITE_TOK, DEPTH, BPP, WEIGHT, /* Layout Tokens */ SCREEN, INACTIVE, INPUTDEVICE, /* Adjaceny Tokens */ RIGHTOF, LEFTOF, ABOVE, BELOW, RELATIVE, ABSOLUTE, /* Vendor Tokens */ VENDORNAME, /* DRI Tokens */ GROUP, /* InputClass Tokens */ MATCH_PRODUCT, MATCH_VENDOR, MATCH_DEVICE_PATH, MATCH_OS, MATCH_PNPID, MATCH_USBID, MATCH_DRIVER, MATCH_TAG, MATCH_LAYOUT, MATCH_IS_KEYBOARD, MATCH_IS_POINTER, MATCH_IS_JOYSTICK, MATCH_IS_TABLET, MATCH_IS_TABLET_PAD, MATCH_IS_TOUCHPAD, MATCH_IS_TOUCHSCREEN, NOMATCH_PRODUCT, NOMATCH_VENDOR, NOMATCH_DEVICE_PATH, NOMATCH_OS, NOMATCH_PNPID, NOMATCH_USBID, NOMATCH_DRIVER, NOMATCH_TAG, NOMATCH_LAYOUT, } ParserTokens; #endif /* _xf86_tokens_h */ xorg-server-1.20.8/hw/xfree86/parser/Files.c0000644000175000017500000001667213640201473015431 00000000000000/* * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec FilesTab[] = { {ENDSECTION, "endsection"}, {FONTPATH, "fontpath"}, {MODULEPATH, "modulepath"}, {LOGFILEPATH, "logfile"}, {XKBDIR, "xkbdir"}, /* Obsolete keywords that aren't used but shouldn't cause errors: */ {OBSOLETE_TOKEN, "rgbpath"}, {OBSOLETE_TOKEN, "inputdevices"}, {-1, ""}, }; #define CLEANUP xf86freeFiles XF86ConfFilesPtr xf86parseFilesSection(void) { int i, j; int k, l; char *str; int token; parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec) while ((token = xf86getToken(FilesTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->file_comment = xf86addComment(ptr->file_comment, xf86_lex_val.str); break; case FONTPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "FontPath"); j = FALSE; str = xf86_lex_val.str; if (ptr->file_fontpath == NULL) { ptr->file_fontpath = calloc(1, 1); i = strlen(str) + 1; } else { i = strlen(ptr->file_fontpath) + strlen(str) + 1; if (ptr->file_fontpath[strlen(ptr->file_fontpath) - 1] != ',') { i++; j = TRUE; } } ptr->file_fontpath = realloc(ptr->file_fontpath, i); if (j) strcat(ptr->file_fontpath, ","); strcat(ptr->file_fontpath, str); free(xf86_lex_val.str); break; case MODULEPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "ModulePath"); l = FALSE; str = xf86_lex_val.str; if (ptr->file_modulepath == NULL) { ptr->file_modulepath = malloc(1); ptr->file_modulepath[0] = '\0'; k = strlen(str) + 1; } else { k = strlen(ptr->file_modulepath) + strlen(str) + 1; if (ptr->file_modulepath[strlen(ptr->file_modulepath) - 1] != ',') { k++; l = TRUE; } } ptr->file_modulepath = realloc(ptr->file_modulepath, k); if (l) strcat(ptr->file_modulepath, ","); strcat(ptr->file_modulepath, str); free(xf86_lex_val.str); break; case LOGFILEPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "LogFile"); ptr->file_logfile = xf86_lex_val.str; break; case XKBDIR: if (xf86getSubToken(&(ptr->file_xkbdir)) != STRING) Error(QUOTE_MSG, "XkbDir"); ptr->file_xkbdir = xf86_lex_val.str; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; case OBSOLETE_TOKEN: xf86parseError(OBSOLETE_MSG, xf86tokenString()); xf86getSubToken(&(ptr->file_comment)); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG printf("File section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printFileSection(FILE * cf, XF86ConfFilesPtr ptr) { char *p, *s; if (ptr == NULL) return; if (ptr->file_comment) fprintf(cf, "%s", ptr->file_comment); if (ptr->file_logfile) fprintf(cf, "\tLogFile \"%s\"\n", ptr->file_logfile); if (ptr->file_modulepath) { s = ptr->file_modulepath; p = index(s, ','); while (p) { *p = '\000'; fprintf(cf, "\tModulePath \"%s\"\n", s); *p = ','; s = p; s++; p = index(s, ','); } fprintf(cf, "\tModulePath \"%s\"\n", s); } if (ptr->file_fontpath) { s = ptr->file_fontpath; p = index(s, ','); while (p) { *p = '\000'; fprintf(cf, "\tFontPath \"%s\"\n", s); *p = ','; s = p; s++; p = index(s, ','); } fprintf(cf, "\tFontPath \"%s\"\n", s); } if (ptr->file_xkbdir) fprintf(cf, "\tXkbDir \"%s\"\n", ptr->file_xkbdir); } void xf86freeFiles(XF86ConfFilesPtr p) { if (p == NULL) return; TestFree(p->file_logfile); TestFree(p->file_modulepath); TestFree(p->file_fontpath); TestFree(p->file_comment); TestFree(p->file_xkbdir); free(p); } xorg-server-1.20.8/hw/xfree86/parser/Flags.c0000644000175000017500000003244613640201473015420 00000000000000/* * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" #include #include "Xprintf.h" #include "optionstr.h" static const xf86ConfigSymTabRec ServerFlagsTab[] = { {ENDSECTION, "endsection"}, {NOTRAPSIGNALS, "notrapsignals"}, {DONTZAP, "dontzap"}, {DONTZOOM, "dontzoom"}, {DISABLEVIDMODE, "disablevidmodeextension"}, {ALLOWNONLOCAL, "allownonlocalxvidtune"}, {DISABLEMODINDEV, "disablemodindev"}, {MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"}, {ALLOWMOUSEOPENFAIL, "allowmouseopenfail"}, {OPTION, "option"}, {BLANKTIME, "blanktime"}, {STANDBYTIME, "standbytime"}, {SUSPENDTIME, "suspendtime"}, {OFFTIME, "offtime"}, {DEFAULTLAYOUT, "defaultserverlayout"}, {-1, ""}, }; #define CLEANUP xf86freeFlags XF86ConfFlagsPtr xf86parseFlagsSection(void) { int token; parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec) while ((token = xf86getToken(ServerFlagsTab)) != ENDSECTION) { int hasvalue = FALSE; int strvalue = FALSE; int tokentype; switch (token) { case COMMENT: ptr->flg_comment = xf86addComment(ptr->flg_comment, xf86_lex_val.str); break; /* * these old keywords are turned into standard generic options. * we fall through here on purpose */ case DEFAULTLAYOUT: strvalue = TRUE; case BLANKTIME: case STANDBYTIME: case SUSPENDTIME: case OFFTIME: hasvalue = TRUE; case NOTRAPSIGNALS: case DONTZAP: case DONTZOOM: case DISABLEVIDMODE: case ALLOWNONLOCAL: case DISABLEMODINDEV: case MODINDEVALLOWNONLOCAL: case ALLOWMOUSEOPENFAIL: { int i = 0; while (ServerFlagsTab[i].token != -1) { char *tmp; if (ServerFlagsTab[i].token == token) { char *valstr = NULL; tmp = strdup(ServerFlagsTab[i].name); if (hasvalue) { tokentype = xf86getSubToken(&(ptr->flg_comment)); if (strvalue) { if (tokentype != STRING) Error(QUOTE_MSG, tmp); valstr = xf86_lex_val.str; } else { if (tokentype != NUMBER) Error(NUMBER_MSG, tmp); if (asprintf(&valstr, "%d", xf86_lex_val.num) == -1) valstr = NULL; } } ptr->flg_option_lst = xf86addNewOption (ptr->flg_option_lst, tmp, valstr); } i++; } } break; case OPTION: ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG printf("Flags section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags) { XF86OptionPtr p; if ((!flags) || (!flags->flg_option_lst)) return; p = flags->flg_option_lst; fprintf(f, "Section \"ServerFlags\"\n"); if (flags->flg_comment) fprintf(f, "%s", flags->flg_comment); xf86printOptionList(f, p, 1); fprintf(f, "EndSection\n\n"); } static XF86OptionPtr addNewOption2(XF86OptionPtr head, char *name, char *_val, int used) { XF86OptionPtr new, old = NULL; /* Don't allow duplicates, free old strings */ if (head != NULL && (old = xf86findOption(head, name)) != NULL) { new = old; free(new->opt_name); free(new->opt_val); } else new = calloc(1, sizeof(*new)); new->opt_name = name; new->opt_val = _val; new->opt_used = used; if (old) return head; return ((XF86OptionPtr) xf86addListItem((glp) head, (glp) new)); } XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *_val) { return addNewOption2(head, name, _val, 0); } void xf86freeFlags(XF86ConfFlagsPtr flags) { if (flags == NULL) return; xf86optionListFree(flags->flg_option_lst); TestFree(flags->flg_comment); free(flags); } XF86OptionPtr xf86optionListDup(XF86OptionPtr opt) { XF86OptionPtr newopt = NULL; char *_val; while (opt) { _val = opt->opt_val ? strdup(opt->opt_val) : NULL; newopt = xf86addNewOption(newopt, strdup(opt->opt_name), _val); newopt->opt_used = opt->opt_used; if (opt->opt_comment) newopt->opt_comment = strdup(opt->opt_comment); opt = opt->list.next; } return newopt; } void xf86optionListFree(XF86OptionPtr opt) { XF86OptionPtr prev; while (opt) { TestFree(opt->opt_name); TestFree(opt->opt_val); TestFree(opt->opt_comment); prev = opt; opt = opt->list.next; free(prev); } } char * xf86optionName(XF86OptionPtr opt) { if (opt) return opt->opt_name; return 0; } char * xf86optionValue(XF86OptionPtr opt) { if (opt) return opt->opt_val; return 0; } XF86OptionPtr xf86newOption(char *name, char *value) { XF86OptionPtr opt; opt = calloc(1, sizeof(*opt)); if (!opt) return NULL; opt->opt_used = 0; opt->list.next = 0; opt->opt_name = name; opt->opt_val = value; return opt; } XF86OptionPtr xf86nextOption(XF86OptionPtr list) { if (!list) return NULL; return list->list.next; } /* * this function searches the given option list for the named option and * returns a pointer to the option rec if found. If not found, it returns * NULL */ XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name) { while (list) { if (xf86nameCompare(list->opt_name, name) == 0) return list; list = list->list.next; } return NULL; } /* * this function searches the given option list for the named option. If * found and the option has a parameter, a pointer to the parameter is * returned. If the option does not have a parameter an empty string is * returned. If the option is not found, a NULL is returned. */ const char * xf86findOptionValue(XF86OptionPtr list, const char *name) { XF86OptionPtr p = xf86findOption(list, name); if (p) { if (p->opt_val) return p->opt_val; else return ""; } return NULL; } XF86OptionPtr xf86optionListCreate(const char **options, int count, int used) { XF86OptionPtr p = NULL; char *t1, *t2; int i; if (count == -1) { for (count = 0; options[count]; count++); } if ((count % 2) != 0) { fprintf(stderr, "xf86optionListCreate: count must be an even number.\n"); return NULL; } for (i = 0; i < count; i += 2) { t1 = strdup(options[i]); t2 = strdup(options[i + 1]); p = addNewOption2(p, t1, t2, used); } return p; } /* the 2 given lists are merged. If an option with the same name is present in * both, the option from the user list - specified in the second argument - * is used. The end result is a single valid list of options. Duplicates * are freed, and the original lists are no longer guaranteed to be complete. */ XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail) { XF86OptionPtr a, b, ap = NULL, bp = NULL; a = tail; b = head; while (tail && b) { if (xf86nameCompare(a->opt_name, b->opt_name) == 0) { if (b == head) head = a; else bp->list.next = a; if (a == tail) tail = a->list.next; else ap->list.next = a->list.next; a->list.next = b->list.next; b->list.next = NULL; xf86optionListFree(b); b = a->list.next; bp = a; a = tail; ap = NULL; } else { ap = a; if (!(a = a->list.next)) { a = tail; bp = b; b = b->list.next; ap = NULL; } } } if (head) { for (a = head; a->list.next; a = a->list.next); a->list.next = tail; } else head = tail; return head; } char * xf86uLongToString(unsigned long i) { char *s; if (asprintf(&s, "%lu", i) == -1) return NULL; return s; } XF86OptionPtr xf86parseOption(XF86OptionPtr head) { XF86OptionPtr option, cnew, old; char *name, *comment = NULL; int token; if ((token = xf86getSubToken(&comment)) != STRING) { xf86parseError(BAD_OPTION_MSG); free(comment); return head; } name = xf86_lex_val.str; if ((token = xf86getSubToken(&comment)) == STRING) { option = xf86newOption(name, xf86_lex_val.str); option->opt_comment = comment; if ((token = xf86getToken(NULL)) == COMMENT) option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str); else xf86unGetToken(token); } else { option = xf86newOption(name, NULL); option->opt_comment = comment; if (token == COMMENT) option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str); else xf86unGetToken(token); } old = NULL; /* Don't allow duplicates */ if (head != NULL && (old = xf86findOption(head, name)) != NULL) { cnew = old; free(option->opt_name); TestFree(option->opt_val); TestFree(option->opt_comment); free(option); } else cnew = option; if (old == NULL) return ((XF86OptionPtr) xf86addListItem((glp) head, (glp) cnew)); return head; } void xf86printOptionList(FILE * fp, XF86OptionPtr list, int tabs) { int i; if (!list) return; while (list) { for (i = 0; i < tabs; i++) fputc('\t', fp); if (list->opt_val) fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name, list->opt_val); else fprintf(fp, "Option \"%s\"", list->opt_name); if (list->opt_comment) fprintf(fp, "%s", list->opt_comment); else fputc('\n', fp); list = list->list.next; } } xorg-server-1.20.8/hw/xfree86/parser/Device.c0000644000175000017500000003052313640201473015555 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec DeviceTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {VENDOR, "vendorname"}, {BOARD, "boardname"}, {CHIPSET, "chipset"}, {RAMDAC, "ramdac"}, {DACSPEED, "dacspeed"}, {CLOCKS, "clocks"}, {MATCHSEAT, "matchseat"}, {OPTION, "option"}, {VIDEORAM, "videoram"}, {BIOSBASE, "biosbase"}, {MEMBASE, "membase"}, {IOBASE, "iobase"}, {CLOCKCHIP, "clockchip"}, {CHIPID, "chipid"}, {CHIPREV, "chiprev"}, {CARD, "card"}, {DRIVER, "driver"}, {BUSID, "busid"}, {IRQ, "irq"}, {SCREEN, "screen"}, {-1, ""}, }; #define CLEANUP xf86freeDeviceList XF86ConfDevicePtr xf86parseDeviceSection(void) { int i; int has_ident = FALSE; int token; parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec) /* Zero is a valid value for these */ ptr->dev_chipid = -1; ptr->dev_chiprev = -1; ptr->dev_irq = -1; while ((token = xf86getToken(DeviceTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->dev_comment = xf86addComment(ptr->dev_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->dev_identifier = xf86_lex_val.str; has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); ptr->dev_vendor = xf86_lex_val.str; break; case BOARD: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Board"); ptr->dev_board = xf86_lex_val.str; break; case CHIPSET: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Chipset"); ptr->dev_chipset = xf86_lex_val.str; break; case CARD: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Card"); ptr->dev_card = xf86_lex_val.str; break; case DRIVER: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Driver"); ptr->dev_driver = xf86_lex_val.str; break; case RAMDAC: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Ramdac"); ptr->dev_ramdac = xf86_lex_val.str; break; case DACSPEED: for (i = 0; i < CONF_MAXDACSPEEDS; i++) ptr->dev_dacSpeeds[i] = 0; if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) { Error(DACSPEED_MSG, CONF_MAXDACSPEEDS); } else { ptr->dev_dacSpeeds[0] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); for (i = 1; i < CONF_MAXDACSPEEDS; i++) { if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER) ptr->dev_dacSpeeds[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); else { xf86unGetToken(token); break; } } } break; case VIDEORAM: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "VideoRam"); ptr->dev_videoram = xf86_lex_val.num; break; case BIOSBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "BIOSBase"); /* ignored */ break; case MEMBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "MemBase"); ptr->dev_mem_base = xf86_lex_val.num; break; case IOBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "IOBase"); ptr->dev_io_base = xf86_lex_val.num; break; case CLOCKCHIP: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "ClockChip"); ptr->dev_clockchip = xf86_lex_val.str; break; case CHIPID: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "ChipID"); ptr->dev_chipid = xf86_lex_val.num; break; case CHIPREV: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "ChipRev"); ptr->dev_chiprev = xf86_lex_val.num; break; case CLOCKS: token = xf86getSubToken(&(ptr->dev_comment)); for (i = ptr->dev_clocks; token == NUMBER && i < CONF_MAXCLOCKS; i++) { ptr->dev_clock[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); token = xf86getSubToken(&(ptr->dev_comment)); } ptr->dev_clocks = i; xf86unGetToken(token); break; case MATCHSEAT: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "MatchSeat"); ptr->match_seat = xf86_lex_val.str; break; case OPTION: ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst); break; case BUSID: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "BusID"); ptr->dev_busid = xf86_lex_val.str; break; case IRQ: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(QUOTE_MSG, "IRQ"); ptr->dev_irq = xf86_lex_val.num; break; case SCREEN: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "Screen"); ptr->dev_screen = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("Device section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr) { int i; while (ptr) { fprintf(cf, "Section \"Device\"\n"); if (ptr->dev_comment) fprintf(cf, "%s", ptr->dev_comment); if (ptr->dev_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier); if (ptr->dev_driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->dev_driver); if (ptr->dev_vendor) fprintf(cf, "\tVendorName \"%s\"\n", ptr->dev_vendor); if (ptr->dev_board) fprintf(cf, "\tBoardName \"%s\"\n", ptr->dev_board); if (ptr->dev_chipset) fprintf(cf, "\tChipSet \"%s\"\n", ptr->dev_chipset); if (ptr->dev_card) fprintf(cf, "\tCard \"%s\"\n", ptr->dev_card); if (ptr->dev_ramdac) fprintf(cf, "\tRamDac \"%s\"\n", ptr->dev_ramdac); if (ptr->dev_dacSpeeds[0] > 0) { fprintf(cf, "\tDacSpeed "); for (i = 0; i < CONF_MAXDACSPEEDS && ptr->dev_dacSpeeds[i] > 0; i++) fprintf(cf, "%g ", (double) (ptr->dev_dacSpeeds[i]) / 1000.0); fprintf(cf, "\n"); } if (ptr->dev_videoram) fprintf(cf, "\tVideoRam %d\n", ptr->dev_videoram); if (ptr->dev_mem_base) fprintf(cf, "\tMemBase 0x%lx\n", ptr->dev_mem_base); if (ptr->dev_io_base) fprintf(cf, "\tIOBase 0x%lx\n", ptr->dev_io_base); if (ptr->dev_clockchip) fprintf(cf, "\tClockChip \"%s\"\n", ptr->dev_clockchip); if (ptr->dev_chipid != -1) fprintf(cf, "\tChipId 0x%x\n", ptr->dev_chipid); if (ptr->dev_chiprev != -1) fprintf(cf, "\tChipRev 0x%x\n", ptr->dev_chiprev); xf86printOptionList(cf, ptr->dev_option_lst, 1); if (ptr->dev_clocks > 0) { fprintf(cf, "\tClocks "); for (i = 0; i < ptr->dev_clocks; i++) fprintf(cf, "%.1f ", (double) ptr->dev_clock[i] / 1000.0); fprintf(cf, "\n"); } if (ptr->dev_busid) fprintf(cf, "\tBusID \"%s\"\n", ptr->dev_busid); if (ptr->dev_screen > 0) fprintf(cf, "\tScreen %d\n", ptr->dev_screen); if (ptr->dev_irq >= 0) fprintf(cf, "\tIRQ %d\n", ptr->dev_irq); fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } void xf86freeDeviceList(XF86ConfDevicePtr ptr) { XF86ConfDevicePtr prev; while (ptr) { TestFree(ptr->dev_identifier); TestFree(ptr->dev_vendor); TestFree(ptr->dev_board); TestFree(ptr->dev_chipset); TestFree(ptr->dev_card); TestFree(ptr->dev_driver); TestFree(ptr->dev_ramdac); TestFree(ptr->dev_clockchip); TestFree(ptr->dev_comment); xf86optionListFree(ptr->dev_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p) { while (p) { if (xf86nameCompare(ident, p->dev_identifier) == 0) return p; p = p->list.next; } return NULL; } xorg-server-1.20.8/hw/xfree86/parser/Makefile.in0000644000175000017500000007714013640201513016260 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/parser ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libxf86config_la_LIBADD = am__objects_1 = Device.lo Files.lo Flags.lo Input.lo InputClass.lo \ OutputClass.lo Layout.lo Module.lo Video.lo Monitor.lo \ Pointer.lo Screen.lo Vendor.lo read.lo scan.lo write.lo DRI.lo \ Extensions.lo am_libxf86config_la_OBJECTS = $(am__objects_1) libxf86config_la_OBJECTS = $(am_libxf86config_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/DRI.Plo ./$(DEPDIR)/Device.Plo \ ./$(DEPDIR)/Extensions.Plo ./$(DEPDIR)/Files.Plo \ ./$(DEPDIR)/Flags.Plo ./$(DEPDIR)/Input.Plo \ ./$(DEPDIR)/InputClass.Plo ./$(DEPDIR)/Layout.Plo \ ./$(DEPDIR)/Module.Plo ./$(DEPDIR)/Monitor.Plo \ ./$(DEPDIR)/OutputClass.Plo ./$(DEPDIR)/Pointer.Plo \ ./$(DEPDIR)/Screen.Plo ./$(DEPDIR)/Vendor.Plo \ ./$(DEPDIR)/Video.Plo ./$(DEPDIR)/read.Plo \ ./$(DEPDIR)/scan.Plo ./$(DEPDIR)/write.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libxf86config_la_SOURCES) DIST_SOURCES = $(libxf86config_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libxf86config.la INTERNAL_SOURCES = \ Device.c \ Files.c \ Flags.c \ Input.c \ InputClass.c \ OutputClass.c \ Layout.c \ Module.c \ Video.c \ Monitor.c \ Pointer.c \ Screen.c \ Vendor.c \ read.c \ scan.c \ write.c \ DRI.c \ Extensions.c libxf86config_la_SOURCES = \ $(INTERNAL_SOURCES) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \ -DDATADIR=\"$(datadir)\" EXTRA_DIST = \ Configint.h \ configProcs.h \ xf86Optrec.h \ xf86Parser.h \ xf86tokens.h sdk_HEADERS = \ xf86Parser.h \ xf86Optrec.h AM_CPPFLAGS = -I$(srcdir)/../common all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/parser/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/parser/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libxf86config.la: $(libxf86config_la_OBJECTS) $(libxf86config_la_DEPENDENCIES) $(EXTRA_libxf86config_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libxf86config_la_OBJECTS) $(libxf86config_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DRI.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Device.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Extensions.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Files.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Flags.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Input.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InputClass.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Layout.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Module.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Monitor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OutputClass.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pointer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Screen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vendor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/DRI.Plo -rm -f ./$(DEPDIR)/Device.Plo -rm -f ./$(DEPDIR)/Extensions.Plo -rm -f ./$(DEPDIR)/Files.Plo -rm -f ./$(DEPDIR)/Flags.Plo -rm -f ./$(DEPDIR)/Input.Plo -rm -f ./$(DEPDIR)/InputClass.Plo -rm -f ./$(DEPDIR)/Layout.Plo -rm -f ./$(DEPDIR)/Module.Plo -rm -f ./$(DEPDIR)/Monitor.Plo -rm -f ./$(DEPDIR)/OutputClass.Plo -rm -f ./$(DEPDIR)/Pointer.Plo -rm -f ./$(DEPDIR)/Screen.Plo -rm -f ./$(DEPDIR)/Vendor.Plo -rm -f ./$(DEPDIR)/Video.Plo -rm -f ./$(DEPDIR)/read.Plo -rm -f ./$(DEPDIR)/scan.Plo -rm -f ./$(DEPDIR)/write.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/DRI.Plo -rm -f ./$(DEPDIR)/Device.Plo -rm -f ./$(DEPDIR)/Extensions.Plo -rm -f ./$(DEPDIR)/Files.Plo -rm -f ./$(DEPDIR)/Flags.Plo -rm -f ./$(DEPDIR)/Input.Plo -rm -f ./$(DEPDIR)/InputClass.Plo -rm -f ./$(DEPDIR)/Layout.Plo -rm -f ./$(DEPDIR)/Module.Plo -rm -f ./$(DEPDIR)/Monitor.Plo -rm -f ./$(DEPDIR)/OutputClass.Plo -rm -f ./$(DEPDIR)/Pointer.Plo -rm -f ./$(DEPDIR)/Screen.Plo -rm -f ./$(DEPDIR)/Vendor.Plo -rm -f ./$(DEPDIR)/Video.Plo -rm -f ./$(DEPDIR)/read.Plo -rm -f ./$(DEPDIR)/scan.Plo -rm -f ./$(DEPDIR)/write.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/parser/Module.c0000644000175000017500000002065713640201473015612 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec SubModuleTab[] = { {ENDSUBSECTION, "endsubsection"}, {OPTION, "option"}, {-1, ""}, }; static const xf86ConfigSymTabRec ModuleTab[] = { {ENDSECTION, "endsection"}, {LOAD, "load"}, {DISABLE, "disable"}, {LOAD_DRIVER, "loaddriver"}, {SUBSECTION, "subsection"}, {-1, ""}, }; #define CLEANUP xf86freeModules static XF86LoadPtr xf86parseModuleSubSection(XF86LoadPtr head, char *name) { int token; parsePrologue(XF86LoadPtr, XF86LoadRec) ptr->load_name = name; ptr->load_type = XF86_LOAD_MODULE; ptr->ignore = 0; ptr->load_opt = NULL; ptr->list.next = NULL; while ((token = xf86getToken(SubModuleTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: ptr->load_comment = xf86addComment(ptr->load_comment, xf86_lex_val.str); break; case OPTION: ptr->load_opt = xf86parseOption(ptr->load_opt); break; case EOF_TOKEN: xf86parseError(UNEXPECTED_EOF_MSG); free(ptr); return NULL; default: xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString()); free(ptr); return NULL; break; } } return ((XF86LoadPtr) xf86addListItem((glp) head, (glp) ptr)); } XF86ConfModulePtr xf86parseModuleSection(void) { int token; parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec) while ((token = xf86getToken(ModuleTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->mod_comment = xf86addComment(ptr->mod_comment, xf86_lex_val.str); break; case LOAD: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "Load"); ptr->mod_load_lst = xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str, XF86_LOAD_MODULE, NULL); break; case DISABLE: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "Disable"); ptr->mod_disable_lst = xf86addNewLoadDirective(ptr->mod_disable_lst, xf86_lex_val.str, XF86_DISABLE_MODULE, NULL); break; case LOAD_DRIVER: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "LoadDriver"); ptr->mod_load_lst = xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str, XF86_LOAD_DRIVER, NULL); break; case SUBSECTION: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); ptr->mod_load_lst = xf86parseModuleSubSection(ptr->mod_load_lst, xf86_lex_val.str); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG printf("Module section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr) { XF86LoadPtr lptr; if (ptr == NULL) return; if (ptr->mod_comment) fprintf(cf, "%s", ptr->mod_comment); for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next) { switch (lptr->load_type) { case XF86_LOAD_MODULE: if (lptr->load_opt == NULL) { fprintf(cf, "\tLoad \"%s\"", lptr->load_name); if (lptr->load_comment) fprintf(cf, "%s", lptr->load_comment); else fputc('\n', cf); } else { fprintf(cf, "\tSubSection \"%s\"\n", lptr->load_name); if (lptr->load_comment) fprintf(cf, "%s", lptr->load_comment); xf86printOptionList(cf, lptr->load_opt, 2); fprintf(cf, "\tEndSubSection\n"); } break; case XF86_LOAD_DRIVER: fprintf(cf, "\tLoadDriver \"%s\"", lptr->load_name); if (lptr->load_comment) fprintf(cf, "%s", lptr->load_comment); else fputc('\n', cf); break; #if 0 default: fprintf(cf, "#\tUnknown type \"%s\"\n", lptr->load_name); break; #endif } } } XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, const char *name, int type, XF86OptionPtr opts) { XF86LoadPtr new; int token; new = calloc(1, sizeof(XF86LoadRec)); new->load_name = name; new->load_type = type; new->load_opt = opts; new->ignore = 0; new->list.next = NULL; if ((token = xf86getToken(NULL)) == COMMENT) new->load_comment = xf86addComment(new->load_comment, xf86_lex_val.str); else xf86unGetToken(token); return ((XF86LoadPtr) xf86addListItem((glp) head, (glp) new)); } void xf86freeModules(XF86ConfModulePtr ptr) { XF86LoadPtr lptr; XF86LoadPtr prev; if (ptr == NULL) return; lptr = ptr->mod_load_lst; while (lptr) { TestFree(lptr->load_name); TestFree(lptr->load_comment); prev = lptr; lptr = lptr->list.next; free(prev); } lptr = ptr->mod_disable_lst; while (lptr) { TestFree(lptr->load_name); TestFree(lptr->load_comment); prev = lptr; lptr = lptr->list.next; free(prev); } TestFree(ptr->mod_comment); free(ptr); } xorg-server-1.20.8/hw/xfree86/parser/xf86Parser.h0000644000175000017500000003621213640201473016334 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the external interfaces for the XFree86 configuration * file parser. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _xf86Parser_h_ #define _xf86Parser_h_ #include #include "xf86Optrec.h" #include "list.h" #define HAVE_PARSER_DECLS typedef struct { char *file_logfile; char *file_modulepath; char *file_fontpath; char *file_comment; char *file_xkbdir; } XF86ConfFilesRec, *XF86ConfFilesPtr; /* Values for load_type */ #define XF86_LOAD_MODULE 0 #define XF86_LOAD_DRIVER 1 #define XF86_DISABLE_MODULE 2 typedef struct { GenericListRec list; int load_type; const char *load_name; XF86OptionPtr load_opt; char *load_comment; int ignore; } XF86LoadRec, *XF86LoadPtr; typedef struct { XF86LoadPtr mod_load_lst; XF86LoadPtr mod_disable_lst; char *mod_comment; } XF86ConfModuleRec, *XF86ConfModulePtr; #define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard" #define CONF_IMPLICIT_POINTER "Implicit Core Pointer" #define XF86CONF_PHSYNC 0x0001 #define XF86CONF_NHSYNC 0x0002 #define XF86CONF_PVSYNC 0x0004 #define XF86CONF_NVSYNC 0x0008 #define XF86CONF_INTERLACE 0x0010 #define XF86CONF_DBLSCAN 0x0020 #define XF86CONF_CSYNC 0x0040 #define XF86CONF_PCSYNC 0x0080 #define XF86CONF_NCSYNC 0x0100 #define XF86CONF_HSKEW 0x0200 /* hskew provided */ #define XF86CONF_BCAST 0x0400 #define XF86CONF_VSCAN 0x1000 typedef struct { GenericListRec list; const char *ml_identifier; int ml_clock; int ml_hdisplay; int ml_hsyncstart; int ml_hsyncend; int ml_htotal; int ml_vdisplay; int ml_vsyncstart; int ml_vsyncend; int ml_vtotal; int ml_vscan; int ml_flags; int ml_hskew; char *ml_comment; } XF86ConfModeLineRec, *XF86ConfModeLinePtr; typedef struct { GenericListRec list; const char *vp_identifier; XF86OptionPtr vp_option_lst; char *vp_comment; } XF86ConfVideoPortRec, *XF86ConfVideoPortPtr; typedef struct { GenericListRec list; const char *va_identifier; const char *va_vendor; const char *va_board; const char *va_busid; const char *va_driver; XF86OptionPtr va_option_lst; XF86ConfVideoPortPtr va_port_lst; const char *va_fwdref; char *va_comment; } XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr; #define CONF_MAX_HSYNC 8 #define CONF_MAX_VREFRESH 8 typedef struct { float hi, lo; } parser_range; typedef struct { int red, green, blue; } parser_rgb; typedef struct { GenericListRec list; const char *modes_identifier; XF86ConfModeLinePtr mon_modeline_lst; char *modes_comment; } XF86ConfModesRec, *XF86ConfModesPtr; typedef struct { GenericListRec list; const char *ml_modes_str; XF86ConfModesPtr ml_modes; } XF86ConfModesLinkRec, *XF86ConfModesLinkPtr; typedef struct { GenericListRec list; const char *mon_identifier; const char *mon_vendor; char *mon_modelname; int mon_width; /* in mm */ int mon_height; /* in mm */ XF86ConfModeLinePtr mon_modeline_lst; int mon_n_hsync; parser_range mon_hsync[CONF_MAX_HSYNC]; int mon_n_vrefresh; parser_range mon_vrefresh[CONF_MAX_VREFRESH]; float mon_gamma_red; float mon_gamma_green; float mon_gamma_blue; XF86OptionPtr mon_option_lst; XF86ConfModesLinkPtr mon_modes_sect_lst; char *mon_comment; } XF86ConfMonitorRec, *XF86ConfMonitorPtr; #define CONF_MAXDACSPEEDS 4 #define CONF_MAXCLOCKS 128 typedef struct { GenericListRec list; const char *dev_identifier; const char *dev_vendor; const char *dev_board; const char *dev_chipset; const char *dev_busid; const char *dev_card; const char *dev_driver; const char *dev_ramdac; int dev_dacSpeeds[CONF_MAXDACSPEEDS]; int dev_videoram; unsigned long dev_mem_base; unsigned long dev_io_base; const char *dev_clockchip; int dev_clocks; int dev_clock[CONF_MAXCLOCKS]; int dev_chipid; int dev_chiprev; int dev_irq; int dev_screen; XF86OptionPtr dev_option_lst; char *dev_comment; char *match_seat; } XF86ConfDeviceRec, *XF86ConfDevicePtr; typedef struct { GenericListRec list; const char *mode_name; } XF86ModeRec, *XF86ModePtr; typedef struct { GenericListRec list; int disp_frameX0; int disp_frameY0; int disp_virtualX; int disp_virtualY; int disp_depth; int disp_bpp; const char *disp_visual; parser_rgb disp_weight; parser_rgb disp_black; parser_rgb disp_white; XF86ModePtr disp_mode_lst; XF86OptionPtr disp_option_lst; char *disp_comment; } XF86ConfDisplayRec, *XF86ConfDisplayPtr; typedef struct { XF86OptionPtr flg_option_lst; char *flg_comment; } XF86ConfFlagsRec, *XF86ConfFlagsPtr; typedef struct { GenericListRec list; const char *al_adaptor_str; XF86ConfVideoAdaptorPtr al_adaptor; } XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr; #define CONF_MAXGPUDEVICES 4 typedef struct { GenericListRec list; const char *scrn_identifier; const char *scrn_obso_driver; int scrn_defaultdepth; int scrn_defaultbpp; int scrn_defaultfbbpp; const char *scrn_monitor_str; XF86ConfMonitorPtr scrn_monitor; const char *scrn_device_str; XF86ConfDevicePtr scrn_device; XF86ConfAdaptorLinkPtr scrn_adaptor_lst; XF86ConfDisplayPtr scrn_display_lst; XF86OptionPtr scrn_option_lst; char *scrn_comment; int scrn_virtualX, scrn_virtualY; char *match_seat; int num_gpu_devices; const char *scrn_gpu_device_str[CONF_MAXGPUDEVICES]; XF86ConfDevicePtr scrn_gpu_devices[CONF_MAXGPUDEVICES]; } XF86ConfScreenRec, *XF86ConfScreenPtr; typedef struct { GenericListRec list; char *inp_identifier; char *inp_driver; XF86OptionPtr inp_option_lst; char *inp_comment; } XF86ConfInputRec, *XF86ConfInputPtr; typedef struct { GenericListRec list; XF86ConfInputPtr iref_inputdev; char *iref_inputdev_str; XF86OptionPtr iref_option_lst; } XF86ConfInputrefRec, *XF86ConfInputrefPtr; typedef struct { Bool set; Bool val; } xf86TriState; typedef struct { struct xorg_list entry; char **values; Bool is_negated; } xf86MatchGroup; typedef struct { GenericListRec list; char *identifier; char *driver; struct xorg_list match_product; struct xorg_list match_vendor; struct xorg_list match_device; struct xorg_list match_os; struct xorg_list match_pnpid; struct xorg_list match_usbid; struct xorg_list match_driver; struct xorg_list match_tag; struct xorg_list match_layout; xf86TriState is_keyboard; xf86TriState is_pointer; xf86TriState is_joystick; xf86TriState is_tablet; xf86TriState is_tablet_pad; xf86TriState is_touchpad; xf86TriState is_touchscreen; XF86OptionPtr option_lst; char *comment; } XF86ConfInputClassRec, *XF86ConfInputClassPtr; typedef struct { GenericListRec list; char *identifier; char *driver; char *modulepath; struct xorg_list match_driver; XF86OptionPtr option_lst; char *comment; } XF86ConfOutputClassRec, *XF86ConfOutputClassPtr; /* Values for adj_where */ #define CONF_ADJ_OBSOLETE -1 #define CONF_ADJ_ABSOLUTE 0 #define CONF_ADJ_RIGHTOF 1 #define CONF_ADJ_LEFTOF 2 #define CONF_ADJ_ABOVE 3 #define CONF_ADJ_BELOW 4 #define CONF_ADJ_RELATIVE 5 typedef struct { GenericListRec list; int adj_scrnum; XF86ConfScreenPtr adj_screen; const char *adj_screen_str; XF86ConfScreenPtr adj_top; const char *adj_top_str; XF86ConfScreenPtr adj_bottom; const char *adj_bottom_str; XF86ConfScreenPtr adj_left; const char *adj_left_str; XF86ConfScreenPtr adj_right; const char *adj_right_str; int adj_where; int adj_x; int adj_y; const char *adj_refscreen; } XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr; typedef struct { GenericListRec list; const char *inactive_device_str; XF86ConfDevicePtr inactive_device; } XF86ConfInactiveRec, *XF86ConfInactivePtr; typedef struct { GenericListRec list; const char *lay_identifier; XF86ConfAdjacencyPtr lay_adjacency_lst; XF86ConfInactivePtr lay_inactive_lst; XF86ConfInputrefPtr lay_input_lst; XF86OptionPtr lay_option_lst; char *match_seat; char *lay_comment; } XF86ConfLayoutRec, *XF86ConfLayoutPtr; typedef struct { GenericListRec list; const char *vs_name; const char *vs_identifier; XF86OptionPtr vs_option_lst; char *vs_comment; } XF86ConfVendSubRec, *XF86ConfVendSubPtr; typedef struct { GenericListRec list; const char *vnd_identifier; XF86OptionPtr vnd_option_lst; XF86ConfVendSubPtr vnd_sub_lst; char *vnd_comment; } XF86ConfVendorRec, *XF86ConfVendorPtr; typedef struct { const char *dri_group_name; int dri_group; int dri_mode; char *dri_comment; } XF86ConfDRIRec, *XF86ConfDRIPtr; typedef struct { XF86OptionPtr ext_option_lst; char *extensions_comment; } XF86ConfExtensionsRec, *XF86ConfExtensionsPtr; typedef struct { XF86ConfFilesPtr conf_files; XF86ConfModulePtr conf_modules; XF86ConfFlagsPtr conf_flags; XF86ConfVideoAdaptorPtr conf_videoadaptor_lst; XF86ConfModesPtr conf_modes_lst; XF86ConfMonitorPtr conf_monitor_lst; XF86ConfDevicePtr conf_device_lst; XF86ConfScreenPtr conf_screen_lst; XF86ConfInputPtr conf_input_lst; XF86ConfInputClassPtr conf_inputclass_lst; XF86ConfOutputClassPtr conf_outputclass_lst; XF86ConfLayoutPtr conf_layout_lst; XF86ConfVendorPtr conf_vendor_lst; XF86ConfDRIPtr conf_dri; XF86ConfExtensionsPtr conf_extensions; char *conf_comment; } XF86ConfigRec, *XF86ConfigPtr; typedef struct { int token; /* id of the token */ const char *name; /* pointer to the LOWERCASED name */ } xf86ConfigSymTabRec, *xf86ConfigSymTabPtr; /* * prototypes for public functions */ extern void xf86initConfigFiles(void); extern char *xf86openConfigFile(const char *path, const char *cmdline, const char *projroot); extern char *xf86openConfigDirFiles(const char *path, const char *cmdline, const char *projroot); extern void xf86setBuiltinConfig(const char *config[]); extern XF86ConfigPtr xf86readConfigFile(void); extern void xf86closeConfigFile(void); extern XF86ConfigPtr xf86allocateConfig(void); extern void xf86freeConfig(XF86ConfigPtr p); extern int xf86writeConfigFile(const char *, XF86ConfigPtr); extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p); extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p); extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout); extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); extern _X_EXPORT int xf86pathIsAbsolute(const char *path); extern _X_EXPORT int xf86pathIsSafe(const char *path); extern _X_EXPORT char *xf86addComment(char *cur, const char *add); extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str); #endif /* _xf86Parser_h_ */ xorg-server-1.20.8/hw/xfree86/parser/Layout.c0000644000175000017500000004340513640201473015636 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" #include #include "optionstr.h" /* Needed for auto server layout */ extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt); static const xf86ConfigSymTabRec LayoutTab[] = { {ENDSECTION, "endsection"}, {SCREEN, "screen"}, {IDENTIFIER, "identifier"}, {MATCHSEAT, "matchseat"}, {INACTIVE, "inactive"}, {INPUTDEVICE, "inputdevice"}, {OPTION, "option"}, {-1, ""}, }; static const xf86ConfigSymTabRec AdjTab[] = { {RIGHTOF, "rightof"}, {LEFTOF, "leftof"}, {ABOVE, "above"}, {BELOW, "below"}, {RELATIVE, "relative"}, {ABSOLUTE, "absolute"}, {-1, ""}, }; #define CLEANUP xf86freeLayoutList XF86ConfLayoutPtr xf86parseLayoutSection(void) { int has_ident = FALSE; int token; parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec) while ((token = xf86getToken(LayoutTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->lay_comment = xf86addComment(ptr->lay_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->lay_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->lay_identifier = xf86_lex_val.str; has_ident = TRUE; break; case MATCHSEAT: if (xf86getSubToken(&(ptr->lay_comment)) != STRING) Error(QUOTE_MSG, "MatchSeat"); ptr->match_seat = xf86_lex_val.str; break; case INACTIVE: { XF86ConfInactivePtr iptr; iptr = calloc(1, sizeof(XF86ConfInactiveRec)); iptr->list.next = NULL; if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(iptr); Error(INACTIVE_MSG); } iptr->inactive_device_str = xf86_lex_val.str; ptr->lay_inactive_lst = (XF86ConfInactivePtr) xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr); } break; case SCREEN: { XF86ConfAdjacencyPtr aptr; int absKeyword = 0; aptr = calloc(1, sizeof(XF86ConfAdjacencyRec)); aptr->list.next = NULL; aptr->adj_scrnum = -1; aptr->adj_where = CONF_ADJ_OBSOLETE; aptr->adj_x = 0; aptr->adj_y = 0; aptr->adj_refscreen = NULL; if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER) aptr->adj_scrnum = xf86_lex_val.num; else xf86unGetToken(token); token = xf86getSubToken(&(ptr->lay_comment)); if (token != STRING) { free(aptr); Error(SCREEN_MSG); } aptr->adj_screen_str = xf86_lex_val.str; token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab); switch (token) { case RIGHTOF: aptr->adj_where = CONF_ADJ_RIGHTOF; break; case LEFTOF: aptr->adj_where = CONF_ADJ_LEFTOF; break; case ABOVE: aptr->adj_where = CONF_ADJ_ABOVE; break; case BELOW: aptr->adj_where = CONF_ADJ_BELOW; break; case RELATIVE: aptr->adj_where = CONF_ADJ_RELATIVE; break; case ABSOLUTE: aptr->adj_where = CONF_ADJ_ABSOLUTE; absKeyword = 1; break; case EOF_TOKEN: free(aptr); Error(UNEXPECTED_EOF_MSG); break; default: xf86unGetToken(token); token = xf86getSubToken(&(ptr->lay_comment)); if (token == STRING) aptr->adj_where = CONF_ADJ_OBSOLETE; else aptr->adj_where = CONF_ADJ_ABSOLUTE; } switch (aptr->adj_where) { case CONF_ADJ_ABSOLUTE: if (absKeyword) token = xf86getSubToken(&(ptr->lay_comment)); if (token == NUMBER) { aptr->adj_x = xf86_lex_val.num; token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } aptr->adj_y = xf86_lex_val.num; } else { if (absKeyword) { free(aptr); Error(INVALID_SCR_MSG); } else xf86unGetToken(token); } break; case CONF_ADJ_RIGHTOF: case CONF_ADJ_LEFTOF: case CONF_ADJ_ABOVE: case CONF_ADJ_BELOW: case CONF_ADJ_RELATIVE: token = xf86getSubToken(&(ptr->lay_comment)); if (token != STRING) { free(aptr); Error(INVALID_SCR_MSG); } aptr->adj_refscreen = xf86_lex_val.str; if (aptr->adj_where == CONF_ADJ_RELATIVE) { token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } aptr->adj_x = xf86_lex_val.num; token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } aptr->adj_y = xf86_lex_val.num; } break; case CONF_ADJ_OBSOLETE: /* top */ aptr->adj_top_str = xf86_lex_val.str; /* bottom */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } aptr->adj_bottom_str = xf86_lex_val.str; /* left */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } aptr->adj_left_str = xf86_lex_val.str; /* right */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } aptr->adj_right_str = xf86_lex_val.str; } ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst, (glp) aptr); } break; case INPUTDEVICE: { XF86ConfInputrefPtr iptr; iptr = calloc(1, sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(iptr); Error(INPUTDEV_MSG); } iptr->iref_inputdev_str = xf86_lex_val.str; while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) { iptr->iref_option_lst = xf86addNewOption(iptr->iref_option_lst, xf86_lex_val.str, NULL); } xf86unGetToken(token); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); } break; case OPTION: ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("Layout section parsed\n"); #endif return ptr; } #undef CLEANUP void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr) { XF86ConfAdjacencyPtr aptr; XF86ConfInactivePtr iptr; XF86ConfInputrefPtr inptr; XF86OptionPtr optr; while (ptr) { fprintf(cf, "Section \"ServerLayout\"\n"); if (ptr->lay_comment) fprintf(cf, "%s", ptr->lay_comment); if (ptr->lay_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier); for (aptr = ptr->lay_adjacency_lst; aptr; aptr = aptr->list.next) { fprintf(cf, "\tScreen "); if (aptr->adj_scrnum >= 0) fprintf(cf, "%2d", aptr->adj_scrnum); else fprintf(cf, " "); fprintf(cf, " \"%s\"", aptr->adj_screen_str); switch (aptr->adj_where) { case CONF_ADJ_OBSOLETE: fprintf(cf, " \"%s\"", aptr->adj_top_str); fprintf(cf, " \"%s\"", aptr->adj_bottom_str); fprintf(cf, " \"%s\"", aptr->adj_right_str); fprintf(cf, " \"%s\"\n", aptr->adj_left_str); break; case CONF_ADJ_ABSOLUTE: if (aptr->adj_x != -1) fprintf(cf, " %d %d\n", aptr->adj_x, aptr->adj_y); else fprintf(cf, "\n"); break; case CONF_ADJ_RIGHTOF: fprintf(cf, " RightOf \"%s\"\n", aptr->adj_refscreen); break; case CONF_ADJ_LEFTOF: fprintf(cf, " LeftOf \"%s\"\n", aptr->adj_refscreen); break; case CONF_ADJ_ABOVE: fprintf(cf, " Above \"%s\"\n", aptr->adj_refscreen); break; case CONF_ADJ_BELOW: fprintf(cf, " Below \"%s\"\n", aptr->adj_refscreen); break; case CONF_ADJ_RELATIVE: fprintf(cf, " Relative \"%s\" %d %d\n", aptr->adj_refscreen, aptr->adj_x, aptr->adj_y); break; } } for (iptr = ptr->lay_inactive_lst; iptr; iptr = iptr->list.next) fprintf(cf, "\tInactive \"%s\"\n", iptr->inactive_device_str); for (inptr = ptr->lay_input_lst; inptr; inptr = inptr->list.next) { fprintf(cf, "\tInputDevice \"%s\"", inptr->iref_inputdev_str); for (optr = inptr->iref_option_lst; optr; optr = optr->list.next) { fprintf(cf, " \"%s\"", optr->opt_name); } fprintf(cf, "\n"); } xf86printOptionList(cf, ptr->lay_option_lst, 1); fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } static void xf86freeAdjacencyList(XF86ConfAdjacencyPtr ptr) { XF86ConfAdjacencyPtr prev; while (ptr) { TestFree(ptr->adj_screen_str); TestFree(ptr->adj_top_str); TestFree(ptr->adj_bottom_str); TestFree(ptr->adj_left_str); TestFree(ptr->adj_right_str); prev = ptr; ptr = ptr->list.next; free(prev); } } static void xf86freeInputrefList(XF86ConfInputrefPtr ptr) { XF86ConfInputrefPtr prev; while (ptr) { TestFree(ptr->iref_inputdev_str); xf86optionListFree(ptr->iref_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } void xf86freeLayoutList(XF86ConfLayoutPtr ptr) { XF86ConfLayoutPtr prev; while (ptr) { TestFree(ptr->lay_identifier); TestFree(ptr->lay_comment); xf86freeAdjacencyList(ptr->lay_adjacency_lst); xf86freeInputrefList(ptr->lay_input_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout) { int count = 0; XF86ConfInputPtr input = config->conf_input_lst; XF86ConfInputrefPtr inptr; /* add all AutoServerLayout devices to the server layout */ while (input) { if (xf86CheckBoolOption (input->inp_option_lst, "AutoServerLayout", FALSE)) { XF86ConfInputrefPtr iref = layout->lay_input_lst; /* avoid duplicates if referenced but lists AutoServerLayout too */ while (iref) { if (strcmp(iref->iref_inputdev_str, input->inp_identifier) == 0) break; iref = iref->list.next; } if (!iref) { XF86ConfInputrefPtr iptr; iptr = calloc(1, sizeof(XF86ConfInputrefRec)); iptr->iref_inputdev_str = input->inp_identifier; layout->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) layout->lay_input_lst, (glp) iptr); count++; } } input = input->list.next; } inptr = layout->lay_input_lst; while (inptr) { input = xf86findInput(inptr->iref_inputdev_str, config->conf_input_lst); if (!input) { xf86validationError(UNDEFINED_INPUT_MSG, inptr->iref_inputdev_str, layout->lay_identifier); return -1; } else inptr->iref_inputdev = input; inptr = inptr->list.next; } return count; } int xf86validateLayout(XF86ConfigPtr p) { XF86ConfLayoutPtr layout = p->conf_layout_lst; XF86ConfAdjacencyPtr adj; XF86ConfInactivePtr iptr; XF86ConfScreenPtr screen; XF86ConfDevicePtr device; while (layout) { adj = layout->lay_adjacency_lst; while (adj) { /* the first one can't be "" but all others can */ screen = xf86findScreen(adj->adj_screen_str, p->conf_screen_lst); if (!screen) { xf86validationError(UNDEFINED_SCREEN_MSG, adj->adj_screen_str, layout->lay_identifier); return FALSE; } else adj->adj_screen = screen; adj = adj->list.next; } iptr = layout->lay_inactive_lst; while (iptr) { device = xf86findDevice(iptr->inactive_device_str, p->conf_device_lst); if (!device) { xf86validationError(UNDEFINED_DEVICE_LAY_MSG, iptr->inactive_device_str, layout->lay_identifier); return FALSE; } else iptr->inactive_device = device; iptr = iptr->list.next; } if (xf86layoutAddInputDevices(p, layout) == -1) return FALSE; layout = layout->list.next; } return TRUE; } XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list) { while (list) { if (xf86nameCompare(list->lay_identifier, name) == 0) return list; list = list->list.next; } return NULL; } xorg-server-1.20.8/hw/xfree86/parser/scan.c0000644000175000017500000007375613640201473015321 00000000000000/* * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #if !defined(MAXHOSTNAMELEN) #define MAXHOSTNAMELEN 32 #endif /* !MAXHOSTNAMELEN */ /* For PATH_MAX */ #include "misc.h" #include "Configint.h" #include "xf86tokens.h" #define CONFIG_BUF_LEN 1024 #define CONFIG_MAX_FILES 64 static struct { FILE *file; char *path; } configFiles[CONFIG_MAX_FILES]; static const char **builtinConfig = NULL; static int builtinIndex = 0; static int configPos = 0; /* current readers position */ static int configLineNo = 0; /* linenumber */ static char *configBuf, *configRBuf; /* buffer for lines */ static char *configSection = NULL; /* name of current section being parsed */ static int numFiles = 0; /* number of config files */ static int curFileIndex = 0; /* index of current config file */ static int pushToken = LOCK_TOKEN; static int eol_seen = 0; /* private state to handle comments */ LexRec xf86_lex_val; /* * xf86getNextLine -- * * read from the configFiles FILE stream until we encounter a new * line; this is effectively just a big wrapper for fgets(3). * * xf86getToken() assumes that we will read up to the next * newline; we need to grow configBuf and configRBuf as needed to * support that. */ static char * xf86getNextLine(void) { static int configBufLen = CONFIG_BUF_LEN; char *tmpConfigBuf, *tmpConfigRBuf; int c, i, pos = 0, eolFound = 0; char *ret = NULL; /* * reallocate the string if it was grown last time (i.e., is no * longer CONFIG_BUF_LEN); we malloc the new strings first, so * that if either of the mallocs fail, we can fall back on the * existing buffer allocations */ if (configBufLen != CONFIG_BUF_LEN) { tmpConfigBuf = malloc(CONFIG_BUF_LEN); tmpConfigRBuf = malloc(CONFIG_BUF_LEN); if (!tmpConfigBuf || !tmpConfigRBuf) { /* * at least one of the mallocs failed; keep the old buffers * and free any partial allocations */ free(tmpConfigBuf); free(tmpConfigRBuf); } else { /* * malloc succeeded; free the old buffers and use the new * buffers */ configBufLen = CONFIG_BUF_LEN; free(configBuf); free(configRBuf); configBuf = tmpConfigBuf; configRBuf = tmpConfigRBuf; } } /* read in another block of chars */ do { ret = fgets(configBuf + pos, configBufLen - pos - 1, configFiles[curFileIndex].file); if (!ret) { /* * if the file doesn't end in a newline, add one * and trigger another read */ if (pos != 0) { strcpy(&configBuf[pos], "\n"); ret = configBuf; } else break; } /* search for EOL in the new block of chars */ for (i = pos; i < (configBufLen - 1); i++) { c = configBuf[i]; if (c == '\0') break; if ((c == '\n') || (c == '\r')) { eolFound = 1; break; } } /* * if we didn't find EOL, then grow the string and * read in more */ if (!eolFound) { tmpConfigBuf = realloc(configBuf, configBufLen + CONFIG_BUF_LEN); tmpConfigRBuf = realloc(configRBuf, configBufLen + CONFIG_BUF_LEN); if (!tmpConfigBuf || !tmpConfigRBuf) { /* * at least one of the reallocations failed; use the * new allocation that succeeded, but we have to * fallback to the previous configBufLen size and use * the string we have, even though we don't have an * EOL */ if (tmpConfigBuf) configBuf = tmpConfigBuf; if (tmpConfigRBuf) configRBuf = tmpConfigRBuf; break; } else { /* reallocation succeeded */ configBuf = tmpConfigBuf; configRBuf = tmpConfigRBuf; pos = i; configBufLen += CONFIG_BUF_LEN; } } } while (!eolFound); return ret; } static int StringToToken(const char *str, const xf86ConfigSymTabRec * tab) { int i; for (i = 0; tab[i].token != -1; i++) { if (!xf86nameCompare(tab[i].name, str)) return tab[i].token; } return ERROR_TOKEN; } /* * xf86getToken -- * Read next Token from the config file. Handle the global variable * pushToken. */ int xf86getToken(const xf86ConfigSymTabRec * tab) { int c, i; /* * First check whether pushToken has a different value than LOCK_TOKEN. * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the * oth * case the next token must be read from the input. */ if (pushToken == EOF_TOKEN) return EOF_TOKEN; else if (pushToken == LOCK_TOKEN) { /* * eol_seen is only set for the first token after a newline. */ eol_seen = 0; c = configBuf[configPos]; /* * Get start of next Token. EOF is handled, * whitespaces are skipped. */ again: if (!c) { char *ret; if (numFiles > 0) ret = xf86getNextLine(); else { if (builtinConfig[builtinIndex] == NULL) ret = NULL; else { strlcpy(configBuf, builtinConfig[builtinIndex], CONFIG_BUF_LEN); ret = configBuf; builtinIndex++; } } if (ret == NULL) { /* * if necessary, move to the next file and * read the first line */ if (curFileIndex + 1 < numFiles) { curFileIndex++; configLineNo = 0; goto again; } else return pushToken = EOF_TOKEN; } configLineNo++; configPos = 0; eol_seen = 1; } i = 0; for (;;) { c = configBuf[configPos++]; configRBuf[i++] = c; switch (c) { case ' ': case '\t': case '\r': continue; case '\n': i = 0; continue; } break; } if (c == '\0') goto again; if (c == '#') { do { configRBuf[i++] = (c = configBuf[configPos++]); } while ((c != '\n') && (c != '\r') && (c != '\0')); configRBuf[i] = '\0'; /* XXX no private copy. * Use xf86addComment when setting a comment. */ xf86_lex_val.str = configRBuf; return COMMENT; } /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */ else if ((c == ',') && !isalpha(configBuf[configPos])) { return COMMA; } else if ((c == '-') && !isalpha(configBuf[configPos])) { return DASH; } /* * Numbers are returned immediately ... */ if (isdigit(c)) { int base; if (c == '0') if ((configBuf[configPos] == 'x') || (configBuf[configPos] == 'X')) { base = 16; xf86_lex_val.numType = PARSE_HEX; } else { base = 8; xf86_lex_val.numType = PARSE_OCTAL; } else { base = 10; xf86_lex_val.numType = PARSE_DECIMAL; } configRBuf[0] = c; i = 1; while (isdigit(c = configBuf[configPos++]) || (c == '.') || (c == 'x') || (c == 'X') || ((base == 16) && (((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'))))) configRBuf[i++] = c; configPos--; /* GJA -- one too far */ configRBuf[i] = '\0'; xf86_lex_val.num = strtoul(configRBuf, NULL, 0); xf86_lex_val.realnum = atof(configRBuf); return NUMBER; } /* * All Strings START with a \" ... */ else if (c == '\"') { i = -1; do { configRBuf[++i] = (c = configBuf[configPos++]); } while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0')); configRBuf[i] = '\0'; xf86_lex_val.str = malloc(strlen(configRBuf) + 1); strcpy(xf86_lex_val.str, configRBuf); /* private copy ! */ return STRING; } /* * ... and now we MUST have a valid token. The search is * handled later along with the pushed tokens. */ else { configRBuf[0] = c; i = 0; do { configRBuf[++i] = (c = configBuf[configPos++]); } while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0') && (c != '#')); --configPos; configRBuf[i] = '\0'; i = 0; } } else { /* * Here we deal with pushed tokens. Reinitialize pushToken again. If * the pushed token was NUMBER || STRING return them again ... */ int temp = pushToken; pushToken = LOCK_TOKEN; if (temp == COMMA || temp == DASH) return temp; if (temp == NUMBER || temp == STRING) return temp; } /* * Joop, at last we have to lookup the token ... */ if (tab) return StringToToken(configRBuf, tab); return ERROR_TOKEN; /* Error catcher */ } int xf86getSubToken(char **comment) { int token; for (;;) { token = xf86getToken(NULL); if (token == COMMENT) { if (comment) *comment = xf86addComment(*comment, xf86_lex_val.str); } else return token; } /*NOTREACHED*/} int xf86getSubTokenWithTab(char **comment, const xf86ConfigSymTabRec * tab) { int token; for (;;) { token = xf86getToken(tab); if (token == COMMENT) { if (comment) *comment = xf86addComment(*comment, xf86_lex_val.str); } else return token; } /*NOTREACHED*/} void xf86unGetToken(int token) { pushToken = token; } char * xf86tokenString(void) { return configRBuf; } int xf86pathIsAbsolute(const char *path) { if (path && path[0] == '/') return 1; return 0; } /* A path is "safe" if it is relative and if it contains no ".." elements. */ int xf86pathIsSafe(const char *path) { if (xf86pathIsAbsolute(path)) return 0; /* Compare with ".." */ if (!strcmp(path, "..")) return 0; /* Look for leading "../" */ if (!strncmp(path, "../", 3)) return 0; /* Look for trailing "/.." */ if ((strlen(path) > 3) && !strcmp(path + strlen(path) - 3, "/..")) return 0; /* Look for "/../" */ if (strstr(path, "/../")) return 0; return 1; } /* * This function substitutes the following escape sequences: * * %A cmdline argument as an absolute path (must be absolute to match) * %R cmdline argument as a relative path * %S cmdline argument as a "safe" path (relative, and no ".." elements) * %X default config file name ("xorg.conf") * %H hostname * %E config file environment ($XORGCONFIG) as an absolute path * %F config file environment ($XORGCONFIG) as a relative path * %G config file environment ($XORGCONFIG) as a safe path * %P projroot * %C sysconfdir * %D datadir * %% % */ #define XCONFIGSUFFIX ".conf" #define XCONFENV "XORGCONFIG" #define BAIL_OUT do { \ free(result); \ return NULL; \ } while (0) #define CHECK_LENGTH do { \ if (l > PATH_MAX) { \ BAIL_OUT; \ } \ } while (0) #define APPEND_STR(s) do { \ if (strlen(s) + l > PATH_MAX) { \ BAIL_OUT; \ } else { \ strcpy(result + l, s); \ l += strlen(s); \ } \ } while (0) static char * DoSubstitution(const char *template, const char *cmdline, const char *projroot, int *cmdlineUsed, int *envUsed, const char *XConfigFile) { char *result; int i, l; static const char *env = NULL; static char *hostname = NULL; if (!template) return NULL; if (cmdlineUsed) *cmdlineUsed = 0; if (envUsed) *envUsed = 0; result = malloc(PATH_MAX + 1); l = 0; for (i = 0; template[i]; i++) { if (template[i] != '%') { result[l++] = template[i]; CHECK_LENGTH; } else { switch (template[++i]) { case 'A': if (cmdline && xf86pathIsAbsolute(cmdline)) { APPEND_STR(cmdline); if (cmdlineUsed) *cmdlineUsed = 1; } else BAIL_OUT; break; case 'R': if (cmdline && !xf86pathIsAbsolute(cmdline)) { APPEND_STR(cmdline); if (cmdlineUsed) *cmdlineUsed = 1; } else BAIL_OUT; break; case 'S': if (cmdline && xf86pathIsSafe(cmdline)) { APPEND_STR(cmdline); if (cmdlineUsed) *cmdlineUsed = 1; } else BAIL_OUT; break; case 'X': APPEND_STR(XConfigFile); break; case 'H': if (!hostname) { if ((hostname = malloc(MAXHOSTNAMELEN + 1))) { if (gethostname(hostname, MAXHOSTNAMELEN) == 0) { hostname[MAXHOSTNAMELEN] = '\0'; } else { free(hostname); hostname = NULL; } } } if (hostname) APPEND_STR(hostname); break; case 'E': if (!env) env = getenv(XCONFENV); if (env && xf86pathIsAbsolute(env)) { APPEND_STR(env); if (envUsed) *envUsed = 1; } else BAIL_OUT; break; case 'F': if (!env) env = getenv(XCONFENV); if (env && !xf86pathIsAbsolute(env)) { APPEND_STR(env); if (envUsed) *envUsed = 1; } else BAIL_OUT; break; case 'G': if (!env) env = getenv(XCONFENV); if (env && xf86pathIsSafe(env)) { APPEND_STR(env); if (envUsed) *envUsed = 1; } else BAIL_OUT; break; case 'P': if (projroot && xf86pathIsAbsolute(projroot)) APPEND_STR(projroot); else BAIL_OUT; break; case 'C': APPEND_STR(SYSCONFDIR); break; case 'D': APPEND_STR(DATADIR); break; case '%': result[l++] = '%'; CHECK_LENGTH; break; default: fprintf(stderr, "invalid escape %%%c found in path template\n", template[i]); BAIL_OUT; break; } } } #ifdef DEBUG fprintf(stderr, "Converted `%s' to `%s'\n", template, result); #endif return result; } /* * Given some searching parameters, locate and open the xorg config file. */ static char * OpenConfigFile(const char *path, const char *cmdline, const char *projroot, const char *confname) { char *filepath = NULL; char *pathcopy; const char *template; int cmdlineUsed = 0; FILE *file = NULL; pathcopy = strdup(path); for (template = strtok(pathcopy, ","); template && !file; template = strtok(NULL, ",")) { filepath = DoSubstitution(template, cmdline, projroot, &cmdlineUsed, NULL, confname); if (!filepath) continue; if (cmdline && !cmdlineUsed) { free(filepath); filepath = NULL; continue; } file = fopen(filepath, "r"); if (!file) { free(filepath); filepath = NULL; } } free(pathcopy); if (file) { configFiles[numFiles].file = file; configFiles[numFiles].path = strdup(filepath); numFiles++; } return filepath; } /* * Match non-hidden files in the xorg config directory with a .conf * suffix. This filter is passed to scandir(3). */ static int ConfigFilter(const struct dirent *de) { const char *name = de->d_name; size_t len; size_t suflen = strlen(XCONFIGSUFFIX); if (!name || name[0] == '.') return 0; len = strlen(name); if (len <= suflen) return 0; if (strcmp(&name[len - suflen], XCONFIGSUFFIX) != 0) return 0; return 1; } static Bool AddConfigDirFiles(const char *dirpath, struct dirent **list, int num) { int i; Bool openedFile = FALSE; Bool warnOnce = FALSE; for (i = 0; i < num; i++) { char *path; FILE *file; if (numFiles >= CONFIG_MAX_FILES) { if (!warnOnce) { ErrorF("Maximum number of configuration " "files opened\n"); warnOnce = TRUE; } continue; } path = malloc(PATH_MAX + 1); snprintf(path, PATH_MAX + 1, "%s/%s", dirpath, list[i]->d_name); file = fopen(path, "r"); if (!file) { free(path); continue; } openedFile = TRUE; configFiles[numFiles].file = file; configFiles[numFiles].path = path; numFiles++; } return openedFile; } /* * Given some searching parameters, locate and open the xorg config * directory. The directory does not need to contain config files. */ static char * OpenConfigDir(const char *path, const char *cmdline, const char *projroot, const char *confname) { char *dirpath = NULL, *pathcopy; const char *template; Bool found = FALSE; int cmdlineUsed = 0; pathcopy = strdup(path); for (template = strtok(pathcopy, ","); template && !found; template = strtok(NULL, ",")) { struct dirent **list = NULL; int num; dirpath = DoSubstitution(template, cmdline, projroot, &cmdlineUsed, NULL, confname); if (!dirpath) continue; if (cmdline && !cmdlineUsed) { free(dirpath); dirpath = NULL; continue; } /* match files named *.conf */ num = scandir(dirpath, &list, ConfigFilter, alphasort); if (num < 0) { list = NULL; num = 0; } found = AddConfigDirFiles(dirpath, list, num); if (!found) { free(dirpath); dirpath = NULL; } while (num--) free(list[num]); free(list); } free(pathcopy); return dirpath; } /* * xf86initConfigFiles -- Setup global variables and buffers. */ void xf86initConfigFiles(void) { curFileIndex = 0; configPos = 0; configLineNo = 0; pushToken = LOCK_TOKEN; configBuf = malloc(CONFIG_BUF_LEN); configRBuf = malloc(CONFIG_BUF_LEN); configBuf[0] = '\0'; /* sanity ... */ } /* * xf86openConfigFile -- * * This function take a config file search path (optional), a command-line * specified file name (optional) and the ProjectRoot path (optional) and * locates and opens a config file based on that information. If a * command-line file name is specified, then this function fails if none * of the located files. * * The return value is a pointer to the actual name of the file that was * opened. When no file is found, the return value is NULL. The caller should * free() the returned value. * * The escape sequences allowed in the search path are defined above. * */ #ifndef DEFAULT_CONF_PATH #define DEFAULT_CONF_PATH "/etc/X11/%S," \ "%P/etc/X11/%S," \ "/etc/X11/%G," \ "%P/etc/X11/%G," \ "/etc/X11/%X-%M," \ "/etc/X11/%X," \ "/etc/%X," \ "%P/etc/X11/%X.%H," \ "%P/etc/X11/%X-%M," \ "%P/etc/X11/%X," \ "%P/lib/X11/%X.%H," \ "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif char * xf86openConfigFile(const char *path, const char *cmdline, const char *projroot) { if (!path || !path[0]) path = DEFAULT_CONF_PATH; if (!projroot || !projroot[0]) projroot = PROJECTROOT; /* Search for a config file */ return OpenConfigFile(path, cmdline, projroot, XCONFIGFILE); } /* * xf86openConfigDirFiles -- * * This function take a config directory search path (optional), a * command-line specified directory name (optional) and the ProjectRoot path * (optional) and locates and opens a config directory based on that * information. If a command-line name is specified, then this function * fails if it is not found. * * The return value is a pointer to the actual name of the directory that was * opened. When no directory is found, the return value is NULL. The caller * should free() the returned value. * * The escape sequences allowed in the search path are defined above. * */ char * xf86openConfigDirFiles(const char *path, const char *cmdline, const char *projroot) { if (!path || !path[0]) path = DEFAULT_CONF_PATH; if (!projroot || !projroot[0]) projroot = PROJECTROOT; /* Search for the multiconf directory */ return OpenConfigDir(path, cmdline, projroot, XCONFIGDIR); } void xf86closeConfigFile(void) { int i; free(configRBuf); configRBuf = NULL; free(configBuf); configBuf = NULL; if (numFiles == 0) { builtinConfig = NULL; builtinIndex = 0; } for (i = 0; i < numFiles; i++) { fclose(configFiles[i].file); configFiles[i].file = NULL; free(configFiles[i].path); configFiles[i].path = NULL; } numFiles = 0; } void xf86setBuiltinConfig(const char *config[]) { builtinConfig = config; } void xf86parseError(const char *format, ...) { va_list ap; const char *filename = numFiles ? configFiles[curFileIndex].path : ""; ErrorF("Parse error on line %d of section %s in file %s\n\t", configLineNo, configSection, filename); va_start(ap, format); VErrorF(format, ap); va_end(ap); ErrorF("\n"); } void xf86validationError(const char *format, ...) { va_list ap; const char *filename = numFiles ? configFiles[curFileIndex].path : ""; ErrorF("Data incomplete in file %s\n\t", filename); va_start(ap, format); VErrorF(format, ap); va_end(ap); ErrorF("\n"); } void xf86setSection(const char *section) { free(configSection); configSection = strdup(section); } /* * xf86getToken -- * Lookup a string if it is actually a token in disguise. */ int xf86getStringToken(const xf86ConfigSymTabRec * tab) { return StringToToken(xf86_lex_val.str, tab); } /* * Compare two names. The characters '_', ' ', and '\t' are ignored * in the comparison. */ int xf86nameCompare(const char *s1, const char *s2) { char c1, c2; if (!s1 || *s1 == 0) { if (!s2 || *s2 == 0) return 0; else return 1; } else if (!s2 || *s2 == 0) { return -1; } while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') s1++; while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') s2++; c1 = (isupper(*s1) ? tolower(*s1) : *s1); c2 = (isupper(*s2) ? tolower(*s2) : *s2); while (c1 == c2) { if (c1 == '\0') return 0; s1++; s2++; while (*s1 == '_' || *s1 == ' ' || *s1 == '\t') s1++; while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') s2++; c1 = (isupper(*s1) ? tolower(*s1) : *s1); c2 = (isupper(*s2) ? tolower(*s2) : *s2); } return c1 - c2; } char * xf86addComment(char *cur, const char *add) { char *str; const char *cstr; int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline; if (add == NULL || add[0] == '\0') return cur; if (cur) { curlen = strlen(cur); if (curlen) hasnewline = cur[curlen - 1] == '\n'; eol_seen = 0; } else curlen = 0; cstr = add; iscomment = 0; while (*cstr) { if (*cstr != ' ' && *cstr != '\t') break; ++cstr; } iscomment = (*cstr == '#'); len = strlen(add); endnewline = add[len - 1] == '\n'; insnewline = eol_seen || (curlen && !hasnewline); if (insnewline) len++; if (!iscomment) len++; if (!endnewline) len++; /* Allocate + 1 char for '\0' terminator. */ str = realloc(cur, curlen + len + 1); if (!str) return cur; cur = str; if (insnewline) cur[curlen++] = '\n'; if (!iscomment) cur[curlen++] = '#'; strcpy(cur + curlen, add); if (!endnewline) strcat(cur, "\n"); return cur; } Bool xf86getBoolValue(Bool *val, const char *str) { if (!val || !str) return FALSE; if (*str == '\0') { *val = TRUE; } else { if (xf86nameCompare(str, "1") == 0) *val = TRUE; else if (xf86nameCompare(str, "on") == 0) *val = TRUE; else if (xf86nameCompare(str, "true") == 0) *val = TRUE; else if (xf86nameCompare(str, "yes") == 0) *val = TRUE; else if (xf86nameCompare(str, "0") == 0) *val = FALSE; else if (xf86nameCompare(str, "off") == 0) *val = FALSE; else if (xf86nameCompare(str, "false") == 0) *val = FALSE; else if (xf86nameCompare(str, "no") == 0) *val = FALSE; else return FALSE; } return TRUE; } xorg-server-1.20.8/hw/xfree86/parser/write.c0000644000175000017500000001451313640201473015511 00000000000000/* * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" #include #include #include #include #if defined(HAVE_SETEUID) && defined(_POSIX_SAVED_IDS) && _POSIX_SAVED_IDS > 0 #define HAS_SAVED_IDS_AND_SETEUID #endif #if defined(WIN32) #define HAS_NO_UIDS #endif static int doWriteConfigFile(const char *filename, XF86ConfigPtr cptr) { FILE *cf; if ((cf = fopen(filename, "w")) == NULL) { return 0; } if (cptr->conf_comment) fprintf(cf, "%s\n", cptr->conf_comment); xf86printLayoutSection(cf, cptr->conf_layout_lst); if (cptr->conf_files != NULL) { fprintf(cf, "Section \"Files\"\n"); xf86printFileSection(cf, cptr->conf_files); fprintf(cf, "EndSection\n\n"); } if (cptr->conf_modules != NULL) { fprintf(cf, "Section \"Module\"\n"); xf86printModuleSection(cf, cptr->conf_modules); fprintf(cf, "EndSection\n\n"); } xf86printVendorSection(cf, cptr->conf_vendor_lst); xf86printServerFlagsSection(cf, cptr->conf_flags); xf86printInputSection(cf, cptr->conf_input_lst); xf86printInputClassSection(cf, cptr->conf_inputclass_lst); xf86printOutputClassSection(cf, cptr->conf_outputclass_lst); xf86printVideoAdaptorSection(cf, cptr->conf_videoadaptor_lst); xf86printModesSection(cf, cptr->conf_modes_lst); xf86printMonitorSection(cf, cptr->conf_monitor_lst); xf86printDeviceSection(cf, cptr->conf_device_lst); xf86printScreenSection(cf, cptr->conf_screen_lst); xf86printDRISection(cf, cptr->conf_dri); xf86printExtensionsSection(cf, cptr->conf_extensions); fclose(cf); return 1; } int xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr) { #ifndef HAS_NO_UIDS int ret; if (getuid() != geteuid()) { #if !defined(HAS_SAVED_IDS_AND_SETEUID) int pid, p; int status; void (*csig) (int); /* Need to fork to change ruid without loosing euid */ csig = OsSignal(SIGCHLD, SIG_DFL); switch ((pid = fork())) { case -1: ErrorF("xf86writeConfigFile(): fork failed (%s)\n", strerror(errno)); return 0; case 0: /* child */ if (setuid(getuid()) == -1) FatalError("xf86writeConfigFile(): " "setuid failed(%s)\n", strerror(errno)); ret = doWriteConfigFile(filename, cptr); exit(ret); break; default: /* parent */ do { p = waitpid(pid, &status, 0); } while (p == -1 && errno == EINTR); } OsSignal(SIGCHLD, csig); if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0) return 1; /* success */ else return 0; #else /* HAS_SAVED_IDS_AND_SETEUID */ int ruid, euid; ruid = getuid(); euid = geteuid(); if (seteuid(ruid) == -1) { ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n", ruid, strerror(errno)); return 0; } ret = doWriteConfigFile(filename, cptr); if (seteuid(euid) == -1) { ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n", euid, strerror(errno)); } return ret; #endif /* HAS_SAVED_IDS_AND_SETEUID */ } else #endif /* !HAS_NO_UIDS */ return doWriteConfigFile(filename, cptr); } xorg-server-1.20.8/hw/xfree86/parser/meson.build0000644000175000017500000000122113640201473016345 00000000000000srcs_xorg_parser = [ 'Device.c', 'Files.c', 'Flags.c', 'Input.c', 'InputClass.c', 'OutputClass.c', 'Layout.c', 'Module.c', 'Video.c', 'Monitor.c', 'Pointer.c', 'Screen.c', 'Vendor.c', 'read.c', 'scan.c', 'write.c', 'DRI.c', 'Extensions.c', ] xorg_parser = static_library('xorg_parser', srcs_xorg_parser, include_directories: [inc, xorg_inc], dependencies: common_dep, c_args: [ xorg_c_args, '-DDATADIR="' + join_paths(get_option('prefix'), get_option('datadir')) + '"', ], ) install_data(['xf86Parser.h', 'xf86Optrec.h'], install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/parser/InputClass.c0000644000175000017500000004470013640201473016445 00000000000000/* * Copyright (c) 2009 Dan Nicholson * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec InputClassTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, {DRIVER, "driver"}, {MATCH_PRODUCT, "matchproduct"}, {MATCH_VENDOR, "matchvendor"}, {MATCH_DEVICE_PATH, "matchdevicepath"}, {MATCH_OS, "matchos"}, {MATCH_PNPID, "matchpnpid"}, {MATCH_USBID, "matchusbid"}, {MATCH_DRIVER, "matchdriver"}, {MATCH_TAG, "matchtag"}, {MATCH_LAYOUT, "matchlayout"}, {MATCH_IS_KEYBOARD, "matchiskeyboard"}, {MATCH_IS_POINTER, "matchispointer"}, {MATCH_IS_JOYSTICK, "matchisjoystick"}, {MATCH_IS_TABLET, "matchistablet"}, {MATCH_IS_TABLET_PAD, "matchistabletpad"}, {MATCH_IS_TOUCHPAD, "matchistouchpad"}, {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"}, {NOMATCH_PRODUCT, "nomatchproduct"}, {NOMATCH_VENDOR, "nomatchvendor"}, {NOMATCH_DEVICE_PATH, "nomatchdevicepath"}, {NOMATCH_OS, "nomatchos"}, {NOMATCH_PNPID, "nomatchpnpid"}, {NOMATCH_USBID, "nomatchusbid"}, {NOMATCH_DRIVER, "nomatchdriver"}, {NOMATCH_TAG, "nomatchtag"}, {NOMATCH_LAYOUT, "nomatchlayout"}, {-1, ""}, }; static void xf86freeInputClassList(XF86ConfInputClassPtr ptr) { XF86ConfInputClassPtr prev; while (ptr) { xf86MatchGroup *group, *next; char **list; TestFree(ptr->identifier); TestFree(ptr->driver); xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) free(*list); free(group); } TestFree(ptr->comment); xf86optionListFree(ptr->option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } #define CLEANUP xf86freeInputClassList #define TOKEN_SEP "|" enum MatchType { MATCH_NORMAL, MATCH_NEGATED, }; static void add_group_entry(struct xorg_list *head, char **values, enum MatchType type) { xf86MatchGroup *group; group = malloc(sizeof(*group)); if (group) { group->is_negated = (type == MATCH_NEGATED); group->values = values; xorg_list_add(&group->entry, head); } } XF86ConfInputClassPtr xf86parseInputClassSection(void) { int has_ident = FALSE; int token; enum MatchType matchtype; parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec) /* Initialize MatchGroup lists */ xorg_list_init(&ptr->match_product); xorg_list_init(&ptr->match_vendor); xorg_list_init(&ptr->match_device); xorg_list_init(&ptr->match_os); xorg_list_init(&ptr->match_pnpid); xorg_list_init(&ptr->match_usbid); xorg_list_init(&ptr->match_driver); xorg_list_init(&ptr->match_tag); xorg_list_init(&ptr->match_layout); while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { matchtype = MATCH_NORMAL; switch (token) { case COMMENT: ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); ptr->identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Driver"); if (strcmp(xf86_lex_val.str, "keyboard") == 0) { ptr->driver = strdup("kbd"); free(xf86_lex_val.str); } else ptr->driver = xf86_lex_val.str; break; case OPTION: ptr->option_lst = xf86parseOption(ptr->option_lst); break; case NOMATCH_PRODUCT: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_PRODUCT: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchProduct"); add_group_entry(&ptr->match_product, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_VENDOR: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_VENDOR: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchVendor"); add_group_entry(&ptr->match_vendor, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_DEVICE_PATH: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_DEVICE_PATH: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDevicePath"); add_group_entry(&ptr->match_device, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_OS: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_OS: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchOS"); add_group_entry(&ptr->match_os, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_PNPID: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_PNPID: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchPnPID"); add_group_entry(&ptr->match_pnpid, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_USBID: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_USBID: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchUSBID"); add_group_entry(&ptr->match_usbid, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_DRIVER: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDriver"); add_group_entry(&ptr->match_driver, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_TAG: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_TAG: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchTag"); add_group_entry(&ptr->match_tag, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case NOMATCH_LAYOUT: matchtype = MATCH_NEGATED; /* fallthrough */ case MATCH_LAYOUT: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchLayout"); add_group_entry(&ptr->match_layout, xstrtokenize(xf86_lex_val.str, TOKEN_SEP), matchtype); free(xf86_lex_val.str); break; case MATCH_IS_KEYBOARD: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsKeyboard"); ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_keyboard.set) Error(BOOL_MSG, "MatchIsKeyboard"); break; case MATCH_IS_POINTER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsPointer"); ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_pointer.set) Error(BOOL_MSG, "MatchIsPointer"); break; case MATCH_IS_JOYSTICK: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsJoystick"); ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_joystick.set) Error(BOOL_MSG, "MatchIsJoystick"); break; case MATCH_IS_TABLET: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTablet"); ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_tablet.set) Error(BOOL_MSG, "MatchIsTablet"); break; case MATCH_IS_TABLET_PAD: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTabletPad"); ptr->is_tablet_pad.set = xf86getBoolValue(&ptr->is_tablet_pad.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_tablet_pad.set) Error(BOOL_MSG, "MatchIsTabletPad"); break; case MATCH_IS_TOUCHPAD: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTouchpad"); ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_touchpad.set) Error(BOOL_MSG, "MatchIsTouchpad"); break; case MATCH_IS_TOUCHSCREEN: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTouchscreen"); ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, xf86_lex_val.str); free(xf86_lex_val.str); if (!ptr->is_touchscreen.set) Error(BOOL_MSG, "MatchIsTouchscreen"); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident) Error(NO_IDENT_MSG); #ifdef DEBUG printf("InputClass section parsed\n"); #endif return ptr; } void xf86printInputClassSection(FILE * cf, XF86ConfInputClassPtr ptr) { const xf86MatchGroup *group; char *const *cur; while (ptr) { fprintf(cf, "Section \"InputClass\"\n"); if (ptr->comment) fprintf(cf, "%s", ptr->comment); if (ptr->identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); if (ptr->driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); xorg_list_for_each_entry(group, &ptr->match_product, entry) { fprintf(cf, "\tMatchProduct \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_vendor, entry) { fprintf(cf, "\tMatchVendor \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_device, entry) { fprintf(cf, "\tMatchDevicePath \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_os, entry) { fprintf(cf, "\tMatchOS \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_pnpid, entry) { fprintf(cf, "\tMatchPnPID \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_usbid, entry) { fprintf(cf, "\tMatchUSBID \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_driver, entry) { fprintf(cf, "\tMatchDriver \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_tag, entry) { fprintf(cf, "\tMatchTag \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } xorg_list_for_each_entry(group, &ptr->match_layout, entry) { fprintf(cf, "\tMatchLayout \""); for (cur = group->values; *cur; cur++) fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, *cur); fprintf(cf, "\"\n"); } if (ptr->is_keyboard.set) fprintf(cf, "\tIsKeyboard \"%s\"\n", ptr->is_keyboard.val ? "yes" : "no"); if (ptr->is_pointer.set) fprintf(cf, "\tIsPointer \"%s\"\n", ptr->is_pointer.val ? "yes" : "no"); if (ptr->is_joystick.set) fprintf(cf, "\tIsJoystick \"%s\"\n", ptr->is_joystick.val ? "yes" : "no"); if (ptr->is_tablet.set) fprintf(cf, "\tIsTablet \"%s\"\n", ptr->is_tablet.val ? "yes" : "no"); if (ptr->is_tablet_pad.set) fprintf(cf, "\tIsTabletPad \"%s\"\n", ptr->is_tablet_pad.val ? "yes" : "no"); if (ptr->is_touchpad.set) fprintf(cf, "\tIsTouchpad \"%s\"\n", ptr->is_touchpad.val ? "yes" : "no"); if (ptr->is_touchscreen.set) fprintf(cf, "\tIsTouchscreen \"%s\"\n", ptr->is_touchscreen.val ? "yes" : "no"); xf86printOptionList(cf, ptr->option_lst, 1); fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } xorg-server-1.20.8/hw/xfree86/parser/Screen.c0000644000175000017500000004742113640201473015602 00000000000000/* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" static const xf86ConfigSymTabRec DisplayTab[] = { {ENDSUBSECTION, "endsubsection"}, {MODES, "modes"}, {VIEWPORT, "viewport"}, {VIRTUAL, "virtual"}, {VISUAL, "visual"}, {BLACK_TOK, "black"}, {WHITE_TOK, "white"}, {DEPTH, "depth"}, {BPP, "fbbpp"}, {WEIGHT, "weight"}, {OPTION, "option"}, {-1, ""}, }; static void xf86freeModeList(XF86ModePtr ptr) { XF86ModePtr prev; while (ptr) { TestFree(ptr->mode_name); prev = ptr; ptr = ptr->list.next; free(prev); } } static void xf86freeDisplayList(XF86ConfDisplayPtr ptr) { XF86ConfDisplayPtr prev; while (ptr) { xf86freeModeList(ptr->disp_mode_lst); xf86optionListFree(ptr->disp_option_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } #define CLEANUP xf86freeDisplayList static XF86ConfDisplayPtr xf86parseDisplaySubSection(void) { int token; parsePrologue(XF86ConfDisplayPtr, XF86ConfDisplayRec) ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1; ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1; ptr->disp_frameX0 = ptr->disp_frameY0 = -1; while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: ptr->disp_comment = xf86addComment(ptr->disp_comment, xf86_lex_val.str); break; case VIEWPORT: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIEWPORT_MSG); ptr->disp_frameX0 = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIEWPORT_MSG); ptr->disp_frameY0 = xf86_lex_val.num; break; case VIRTUAL: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIRTUAL_MSG); ptr->disp_virtualX = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIRTUAL_MSG); ptr->disp_virtualY = xf86_lex_val.num; break; case DEPTH: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(NUMBER_MSG, "Display"); ptr->disp_depth = xf86_lex_val.num; break; case BPP: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(NUMBER_MSG, "Display"); ptr->disp_bpp = xf86_lex_val.num; break; case VISUAL: if (xf86getSubToken(&(ptr->disp_comment)) != STRING) Error(QUOTE_MSG, "Display"); ptr->disp_visual = xf86_lex_val.str; break; case WEIGHT: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); ptr->disp_weight.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); ptr->disp_weight.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); ptr->disp_weight.blue = xf86_lex_val.num; break; case BLACK_TOK: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); ptr->disp_black.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); ptr->disp_black.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); ptr->disp_black.blue = xf86_lex_val.num; break; case WHITE_TOK: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); ptr->disp_white.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); ptr->disp_white.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); ptr->disp_white.blue = xf86_lex_val.num; break; case MODES: { XF86ModePtr mptr; while ((token = xf86getSubTokenWithTab(&(ptr->disp_comment), DisplayTab)) == STRING) { mptr = calloc(1, sizeof(XF86ModeRec)); mptr->mode_name = xf86_lex_val.str; mptr->list.next = NULL; ptr->disp_mode_lst = (XF86ModePtr) xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr); } xf86unGetToken(token); } break; case OPTION: ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } #ifdef DEBUG printf("Display subsection parsed\n"); #endif return ptr; } #undef CLEANUP static const xf86ConfigSymTabRec ScreenTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {MATCHSEAT, "matchseat"}, {OBSDRIVER, "driver"}, {MDEVICE, "device"}, {MONITOR, "monitor"}, {VIDEOADAPTOR, "videoadaptor"}, {SCREENNO, "screenno"}, {SUBSECTION, "subsection"}, {DEFAULTDEPTH, "defaultcolordepth"}, {DEFAULTDEPTH, "defaultdepth"}, {DEFAULTBPP, "defaultbpp"}, {DEFAULTFBBPP, "defaultfbbpp"}, {VIRTUAL, "virtual"}, {OPTION, "option"}, {GDEVICE, "gpudevice"}, {-1, ""}, }; #define CLEANUP xf86freeScreenList XF86ConfScreenPtr xf86parseScreenSection(void) { int has_ident = FALSE; int has_driver = FALSE; int token; parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec) while ((token = xf86getToken(ScreenTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->scrn_comment = xf86addComment(ptr->scrn_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); ptr->scrn_identifier = xf86_lex_val.str; if (has_ident || has_driver) Error(ONLY_ONE_MSG, "Identifier or Driver"); has_ident = TRUE; break; case MATCHSEAT: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "MatchSeat"); ptr->match_seat = xf86_lex_val.str; break; case OBSDRIVER: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Driver"); ptr->scrn_obso_driver = xf86_lex_val.str; if (has_ident || has_driver) Error(ONLY_ONE_MSG, "Identifier or Driver"); has_driver = TRUE; break; case DEFAULTDEPTH: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultDepth"); ptr->scrn_defaultdepth = xf86_lex_val.num; break; case DEFAULTBPP: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultBPP"); ptr->scrn_defaultbpp = xf86_lex_val.num; break; case DEFAULTFBBPP: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultFbBPP"); ptr->scrn_defaultfbbpp = xf86_lex_val.num; break; case MDEVICE: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Device"); ptr->scrn_device_str = xf86_lex_val.str; break; case GDEVICE: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "GPUDevice"); if (ptr->num_gpu_devices == CONF_MAXGPUDEVICES) Error(GPU_DEVICE_TOO_MANY, CONF_MAXGPUDEVICES); ptr->scrn_gpu_device_str[ptr->num_gpu_devices++] = xf86_lex_val.str; break; case MONITOR: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Monitor"); ptr->scrn_monitor_str = xf86_lex_val.str; break; case VIDEOADAPTOR: { XF86ConfAdaptorLinkPtr aptr; if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "VideoAdaptor"); /* Don't allow duplicates */ for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next) if (xf86nameCompare(xf86_lex_val.str, aptr->al_adaptor_str) == 0) break; if (aptr == NULL) { aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec)); aptr->list.next = NULL; aptr->al_adaptor_str = xf86_lex_val.str; ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr) xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr); } } break; case VIRTUAL: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(VIRTUAL_MSG); ptr->scrn_virtualX = xf86_lex_val.num; if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(VIRTUAL_MSG); ptr->scrn_virtualY = xf86_lex_val.num; break; case OPTION: ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst); break; case SUBSECTION: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); { free(xf86_lex_val.str); HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection, XF86ConfDisplayPtr); } break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); break; } } if (!has_ident && !has_driver) Error(NO_IDENT_MSG); #ifdef DEBUG printf("Screen section parsed\n"); #endif return ptr; } void xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr) { XF86ConfAdaptorLinkPtr aptr; XF86ConfDisplayPtr dptr; XF86ModePtr mptr; int i; while (ptr) { fprintf(cf, "Section \"Screen\"\n"); if (ptr->scrn_comment) fprintf(cf, "%s", ptr->scrn_comment); if (ptr->scrn_identifier) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier); if (ptr->scrn_obso_driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver); if (ptr->scrn_device_str) fprintf(cf, "\tDevice \"%s\"\n", ptr->scrn_device_str); for (i = 0; i < ptr->num_gpu_devices; i++) if (ptr->scrn_gpu_device_str[i]) fprintf(cf, "\tGPUDevice \"%s\"\n", ptr->scrn_gpu_device_str[i]); if (ptr->scrn_monitor_str) fprintf(cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str); if (ptr->scrn_defaultdepth) fprintf(cf, "\tDefaultDepth %d\n", ptr->scrn_defaultdepth); if (ptr->scrn_defaultbpp) fprintf(cf, "\tDefaultBPP %d\n", ptr->scrn_defaultbpp); if (ptr->scrn_defaultfbbpp) fprintf(cf, "\tDefaultFbBPP %d\n", ptr->scrn_defaultfbbpp); xf86printOptionList(cf, ptr->scrn_option_lst, 1); for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next) { fprintf(cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str); } if (ptr->scrn_virtualX && ptr->scrn_virtualY) fprintf(cf, "\tVirtual %d %d\n", ptr->scrn_virtualX, ptr->scrn_virtualY); for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next) { fprintf(cf, "\tSubSection \"Display\"\n"); if (dptr->disp_comment) fprintf(cf, "%s", dptr->disp_comment); if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0) { fprintf(cf, "\t\tViewport %d %d\n", dptr->disp_frameX0, dptr->disp_frameY0); } if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0) { fprintf(cf, "\t\tVirtual %d %d\n", dptr->disp_virtualX, dptr->disp_virtualY); } if (dptr->disp_depth) { fprintf(cf, "\t\tDepth %d\n", dptr->disp_depth); } if (dptr->disp_bpp) { fprintf(cf, "\t\tFbBPP %d\n", dptr->disp_bpp); } if (dptr->disp_visual) { fprintf(cf, "\t\tVisual \"%s\"\n", dptr->disp_visual); } if (dptr->disp_weight.red != 0) { fprintf(cf, "\t\tWeight %d %d %d\n", dptr->disp_weight.red, dptr->disp_weight.green, dptr->disp_weight.blue); } if (dptr->disp_black.red != -1) { fprintf(cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n", dptr->disp_black.red, dptr->disp_black.green, dptr->disp_black.blue); } if (dptr->disp_white.red != -1) { fprintf(cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n", dptr->disp_white.red, dptr->disp_white.green, dptr->disp_white.blue); } if (dptr->disp_mode_lst) { fprintf(cf, "\t\tModes "); } for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next) { fprintf(cf, " \"%s\"", mptr->mode_name); } if (dptr->disp_mode_lst) { fprintf(cf, "\n"); } xf86printOptionList(cf, dptr->disp_option_lst, 2); fprintf(cf, "\tEndSubSection\n"); } fprintf(cf, "EndSection\n\n"); ptr = ptr->list.next; } } static void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr) { XF86ConfAdaptorLinkPtr prev; while (ptr) { TestFree(ptr->al_adaptor_str); prev = ptr; ptr = ptr->list.next; free(prev); } } void xf86freeScreenList(XF86ConfScreenPtr ptr) { XF86ConfScreenPtr prev; int i; while (ptr) { TestFree(ptr->scrn_identifier); TestFree(ptr->scrn_monitor_str); TestFree(ptr->scrn_device_str); for (i = 0; i < ptr->num_gpu_devices; i++) TestFree(ptr->scrn_gpu_device_str[i]); TestFree(ptr->scrn_comment); xf86optionListFree(ptr->scrn_option_lst); xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst); xf86freeDisplayList(ptr->scrn_display_lst); prev = ptr; ptr = ptr->list.next; free(prev); } } int xf86validateScreen(XF86ConfigPtr p) { XF86ConfScreenPtr screen = p->conf_screen_lst; XF86ConfMonitorPtr monitor; XF86ConfAdaptorLinkPtr adaptor; int i; while (screen) { if (screen->scrn_obso_driver && !screen->scrn_identifier) screen->scrn_identifier = screen->scrn_obso_driver; monitor = xf86findMonitor(screen->scrn_monitor_str, p->conf_monitor_lst); if (screen->scrn_monitor_str) { if (monitor) { screen->scrn_monitor = monitor; if (!xf86validateMonitor(p, screen)) return FALSE; } } screen->scrn_device = xf86findDevice(screen->scrn_device_str, p->conf_device_lst); for (i = 0; i < screen->num_gpu_devices; i++) { screen->scrn_gpu_devices[i] = xf86findDevice(screen->scrn_gpu_device_str[i], p->conf_device_lst); } adaptor = screen->scrn_adaptor_lst; while (adaptor) { adaptor->al_adaptor = xf86findVideoAdaptor(adaptor->al_adaptor_str, p->conf_videoadaptor_lst); if (!adaptor->al_adaptor) { xf86validationError(UNDEFINED_ADAPTOR_MSG, adaptor->al_adaptor_str, screen->scrn_identifier); return FALSE; } else if (adaptor->al_adaptor->va_fwdref) { xf86validationError(ADAPTOR_REF_TWICE_MSG, adaptor->al_adaptor_str, adaptor->al_adaptor->va_fwdref); return FALSE; } adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier); adaptor = adaptor->list.next; } screen = screen->list.next; } return TRUE; } XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p) { while (p) { if (xf86nameCompare(ident, p->scrn_identifier) == 0) return p; p = p->list.next; } return NULL; } xorg-server-1.20.8/hw/xfree86/glamor_egl/0000755000175000017500000000000013640201534015101 500000000000000xorg-server-1.20.8/hw/xfree86/glamor_egl/Makefile.am0000644000175000017500000000307613640201473017065 00000000000000# Copyright © 2013 Intel Corporation # # 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. module_LTLIBRARIES = libglamoregl.la libglamoregl_la_SOURCES = \ $(top_srcdir)/glamor/glamor_egl.c \ $(top_srcdir)/glamor/glamor_eglmodule.c \ glamor_xf86_xv.c \ $() libglamoregl_la_LDFLAGS = \ -avoid-version \ $(GBM_LIBS) \ $() libglamoregl_la_LIBADD = \ $(top_builddir)/glamor/libglamor.la \ $() AM_CPPFLAGS = $(XORG_INCS) \ -I$(top_srcdir)/dri3 \ -I$(top_srcdir)/glamor \ $() AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(GLAMOR_CFLAGS) $(GBM_CFLAGS) xorg-server-1.20.8/hw/xfree86/glamor_egl/Makefile.in0000644000175000017500000010117713640201513017072 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright © 2013 Intel Corporation # # 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. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/glamor_egl ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" LTLIBRARIES = $(module_LTLIBRARIES) libglamoregl_la_DEPENDENCIES = $(top_builddir)/glamor/libglamor.la am_libglamoregl_la_OBJECTS = glamor_egl.lo glamor_eglmodule.lo \ glamor_xf86_xv.lo libglamoregl_la_OBJECTS = $(am_libglamoregl_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libglamoregl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libglamoregl_la_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/glamor_egl.Plo \ ./$(DEPDIR)/glamor_eglmodule.Plo \ ./$(DEPDIR)/glamor_xf86_xv.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libglamoregl_la_SOURCES) DIST_SOURCES = $(libglamoregl_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libglamoregl.la libglamoregl_la_SOURCES = \ $(top_srcdir)/glamor/glamor_egl.c \ $(top_srcdir)/glamor/glamor_eglmodule.c \ glamor_xf86_xv.c \ $() libglamoregl_la_LDFLAGS = \ -avoid-version \ $(GBM_LIBS) \ $() libglamoregl_la_LIBADD = \ $(top_builddir)/glamor/libglamor.la \ $() AM_CPPFLAGS = $(XORG_INCS) \ -I$(top_srcdir)/dri3 \ -I$(top_srcdir)/glamor \ $() AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(GLAMOR_CFLAGS) $(GBM_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/glamor_egl/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/glamor_egl/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libglamoregl.la: $(libglamoregl_la_OBJECTS) $(libglamoregl_la_DEPENDENCIES) $(EXTRA_libglamoregl_la_DEPENDENCIES) $(AM_V_CCLD)$(libglamoregl_la_LINK) -rpath $(moduledir) $(libglamoregl_la_OBJECTS) $(libglamoregl_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_egl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_eglmodule.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_xf86_xv.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< glamor_egl.lo: $(top_srcdir)/glamor/glamor_egl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glamor_egl.lo -MD -MP -MF $(DEPDIR)/glamor_egl.Tpo -c -o glamor_egl.lo `test -f '$(top_srcdir)/glamor/glamor_egl.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_egl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glamor_egl.Tpo $(DEPDIR)/glamor_egl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/glamor/glamor_egl.c' object='glamor_egl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glamor_egl.lo `test -f '$(top_srcdir)/glamor/glamor_egl.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_egl.c glamor_eglmodule.lo: $(top_srcdir)/glamor/glamor_eglmodule.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glamor_eglmodule.lo -MD -MP -MF $(DEPDIR)/glamor_eglmodule.Tpo -c -o glamor_eglmodule.lo `test -f '$(top_srcdir)/glamor/glamor_eglmodule.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_eglmodule.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glamor_eglmodule.Tpo $(DEPDIR)/glamor_eglmodule.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/glamor/glamor_eglmodule.c' object='glamor_eglmodule.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glamor_eglmodule.lo `test -f '$(top_srcdir)/glamor/glamor_eglmodule.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_eglmodule.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(moduledir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/glamor_egl.Plo -rm -f ./$(DEPDIR)/glamor_eglmodule.Plo -rm -f ./$(DEPDIR)/glamor_xf86_xv.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-moduleLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/glamor_egl.Plo -rm -f ./$(DEPDIR)/glamor_eglmodule.Plo -rm -f ./$(DEPDIR)/glamor_xf86_xv.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-moduleLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-moduleLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/glamor_egl/glamor_xf86_xv.c0000644000175000017500000001340013640201473020036 00000000000000/* * Copyright © 2013 Red Hat * * 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. * * Authors: * Dave Airlie * * some code is derived from the xf86-video-ati radeon driver, mainly * the calculations. */ /** @file glamor_xf86_xv.c * * This implements the XF86 XV interface, and calls into glamor core * for its support of the suspiciously similar XF86 and Kdrive * device-dependent XV interfaces. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #define GLAMOR_FOR_XORG #include "glamor_priv.h" #include #include "fourcc.h" #define NUM_FORMATS 4 static XF86VideoFormatRec Formats[NUM_FORMATS] = { {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, {30, TrueColor} }; static void glamor_xf86_xv_stop_video(ScrnInfoPtr pScrn, void *data, Bool cleanup) { if (!cleanup) return; glamor_xv_stop_video(data); } static int glamor_xf86_xv_set_port_attribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, void *data) { return glamor_xv_set_port_attribute(data, attribute, value); } static int glamor_xf86_xv_get_port_attribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value, void *data) { return glamor_xv_get_port_attribute(data, attribute, value); } static void glamor_xf86_xv_query_best_size(ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, void *data) { *p_w = drw_w; *p_h = drw_h; } static int glamor_xf86_xv_query_image_attributes(ScrnInfoPtr pScrn, int id, unsigned short *w, unsigned short *h, int *pitches, int *offsets) { return glamor_xv_query_image_attributes(id, w, h, pitches, offsets); } static int glamor_xf86_xv_put_image(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int id, unsigned char *buf, short width, short height, Bool sync, RegionPtr clipBoxes, void *data, DrawablePtr pDrawable) { return glamor_xv_put_image(data, pDrawable, src_x, src_y, drw_x, drw_y, src_w, src_h, drw_w, drw_h, id, buf, width, height, sync, clipBoxes); } static XF86VideoEncodingRec DummyEncodingGLAMOR[1] = { { 0, "XV_IMAGE", 8192, 8192, {1, 1} } }; XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr screen, int num_texture_ports) { glamor_port_private *port_priv; XF86VideoAdaptorPtr adapt; int i; glamor_xv_core_init(screen); adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports * (sizeof(glamor_port_private) + sizeof(DevUnion))); if (adapt == NULL) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = 0; adapt->name = "GLAMOR Textured Video"; adapt->nEncodings = 1; adapt->pEncodings = DummyEncodingGLAMOR; adapt->nFormats = NUM_FORMATS; adapt->pFormats = Formats; adapt->nPorts = num_texture_ports; adapt->pPortPrivates = (DevUnion *) (&adapt[1]); adapt->pAttributes = glamor_xv_attributes; adapt->nAttributes = glamor_xv_num_attributes; port_priv = (glamor_port_private *) (&adapt->pPortPrivates[num_texture_ports]); adapt->pImages = glamor_xv_images; adapt->nImages = glamor_xv_num_images; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; adapt->StopVideo = glamor_xf86_xv_stop_video; adapt->SetPortAttribute = glamor_xf86_xv_set_port_attribute; adapt->GetPortAttribute = glamor_xf86_xv_get_port_attribute; adapt->QueryBestSize = glamor_xf86_xv_query_best_size; adapt->PutImage = glamor_xf86_xv_put_image; adapt->ReputImage = NULL; adapt->QueryImageAttributes = glamor_xf86_xv_query_image_attributes; for (i = 0; i < num_texture_ports; i++) { glamor_port_private *pPriv = &port_priv[i]; pPriv->brightness = 0; pPriv->contrast = 0; pPriv->saturation = 0; pPriv->hue = 0; pPriv->gamma = 1000; pPriv->transform_index = 0; REGION_NULL(pScreen, &pPriv->clip); adapt->pPortPrivates[i].ptr = (void *) (pPriv); } return adapt; } xorg-server-1.20.8/hw/xfree86/glamor_egl/meson.build0000644000175000017500000000066013640201473017167 00000000000000glamoregl_src = [ '../../../glamor/glamor_egl.c', '../../../glamor/glamor_eglmodule.c', 'glamor_xf86_xv.c', ] shared_module( 'glamoregl', glamoregl_src, include_directories: [inc, xorg_inc], c_args: xorg_c_args, dependencies: [ common_dep, dependency('libdrm', version: '>= 2.4.46'), gbm_dep, ], link_with: glamor, install: true, install_dir: module_dir, ) xorg-server-1.20.8/hw/xfree86/ddc/0000755000175000017500000000000013640201534013523 500000000000000xorg-server-1.20.8/hw/xfree86/ddc/ddcProperty.c0000644000175000017500000000474213640201473016117 00000000000000/* * Copyright 2006 Luc Verhaegen. * * 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, sub license, * 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86DDC.h" #include "xf86Priv.h" #include #include "property.h" #include "propertyst.h" #include #define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA" static int edidSize(const xf86MonPtr DDC) { int ret = 128; if (DDC->flags & EDID_COMPLETE_RAWDATA) ret += DDC->no_sections * 128; return ret; } static void setRootWindowEDID(ScreenPtr pScreen, xf86MonPtr DDC) { Atom atom = MakeAtom(EDID1_ATOM_NAME, strlen(EDID1_ATOM_NAME), TRUE); dixChangeWindowProperty(serverClient, pScreen->root, atom, XA_INTEGER, 8, PropModeReplace, edidSize(DDC), DDC->rawData, FALSE); } static void addEDIDProp(CallbackListPtr *pcbl, void *scrn, void *screen) { ScreenPtr pScreen = screen; ScrnInfoPtr pScrn = scrn; if (xf86ScreenToScrn(pScreen) == pScrn) setRootWindowEDID(pScreen, pScrn->monitor->DDC); } Bool xf86SetDDCproperties(ScrnInfoPtr pScrn, xf86MonPtr DDC) { if (!pScrn || !pScrn->monitor || !DDC) return FALSE; xf86EdidMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC); if (xf86Initialising) AddCallback(&RootWindowFinalizeCallback, addEDIDProp, pScrn); else setRootWindowEDID(pScrn->pScreen, DDC); return TRUE; } xorg-server-1.20.8/hw/xfree86/ddc/Makefile.am0000644000175000017500000000036713640201473015507 00000000000000sdk_HEADERS = edid.h xf86DDC.h noinst_LTLIBRARIES = libddc.la libddc_la_SOURCES = ddc.c interpret_edid.c print_edid.c ddcProperty.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = DDC.HOWTO xorg-server-1.20.8/hw/xfree86/ddc/print_edid.c0000644000175000017500000004641713640201473015746 00000000000000/* * Copyright 1998 by Egbert Eich * Copyright 2007 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. * * print_edid.c: print out all information retrieved from display device */ #ifdef HAVE_XORG_CONFIG_H #include #endif /* XXX kinda gross */ #define _PARSE_EDID_ #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86DDC.h" #include "edid.h" #define EDID_WIDTH 16 static void print_vendor(int scrnIndex, struct vendor *c) { xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer: %s Model: %x Serial#: %u\n", (char *) &c->name, c->prod_id, c->serial); xf86DrvMsg(scrnIndex, X_INFO, "Year: %u Week: %u\n", c->year, c->week); } static void print_version(int scrnIndex, struct edid_version *c) { xf86DrvMsg(scrnIndex, X_INFO, "EDID Version: %u.%u\n", c->version, c->revision); } static const char *digital_interfaces[] = { "undefined", "DVI", "HDMI-a", "HDMI-b", "MDDI", "DisplayPort", "unknown" }; static void print_input_features(int scrnIndex, struct disp_features *c, struct edid_version *v) { if (DIGITAL(c->input_type)) { xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n"); if (v->revision == 2 || v->revision == 3) { if (DFP1(c->input_dfp)) xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n"); } else if (v->revision >= 4) { int interface = c->input_interface; int bpc = c->input_bpc; if (interface > 6) interface = 6; /* unknown */ if (bpc == 0 || bpc == 7) xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n"); else xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n", bpc * 2 + 4); xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n", digital_interfaces[interface]); } } else { xf86DrvMsg(scrnIndex, X_INFO, "Analog Display Input, "); xf86ErrorF("Input Voltage Level: "); switch (c->input_voltage) { case V070: xf86ErrorF("0.700/0.300 V\n"); break; case V071: xf86ErrorF("0.714/0.286 V\n"); break; case V100: xf86ErrorF("1.000/0.400 V\n"); break; case V007: xf86ErrorF("0.700/0.700 V\n"); break; default: xf86ErrorF("undefined\n"); } if (SIG_SETUP(c->input_setup)) xf86DrvMsg(scrnIndex, X_INFO, "Signal levels configurable\n"); xf86DrvMsg(scrnIndex, X_INFO, "Sync:"); if (SEP_SYNC(c->input_sync)) xf86ErrorF(" Separate"); if (COMP_SYNC(c->input_sync)) xf86ErrorF(" Composite"); if (SYNC_O_GREEN(c->input_sync)) xf86ErrorF(" SyncOnGreen"); if (SYNC_SERR(c->input_sync)) xf86ErrorF("Serration on. " "V.Sync Pulse req. if CompSync or SyncOnGreen\n"); else xf86ErrorF("\n"); } } static void print_dpms_features(int scrnIndex, struct disp_features *c, struct edid_version *v) { if (c->dpms) { xf86DrvMsg(scrnIndex, X_INFO, "DPMS capabilities:"); if (DPMS_STANDBY(c->dpms)) xf86ErrorF(" StandBy"); if (DPMS_SUSPEND(c->dpms)) xf86ErrorF(" Suspend"); if (DPMS_OFF(c->dpms)) xf86ErrorF(" Off"); } else xf86DrvMsg(scrnIndex, X_INFO, "No DPMS capabilities specified"); if (!c->input_type) { /* analog */ switch (c->display_type) { case DISP_MONO: xf86ErrorF("; Monochorome/GrayScale Display\n"); break; case DISP_RGB: xf86ErrorF("; RGB/Color Display\n"); break; case DISP_MULTCOLOR: xf86ErrorF("; Non RGB Multicolor Display\n"); break; default: xf86ErrorF("\n"); break; } } else { int enc = c->display_type; xf86ErrorF("\n"); xf86DrvMsg(scrnIndex, X_INFO, "Supported color encodings: " "RGB 4:4:4 %s%s\n", enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "", enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : ""); } if (STD_COLOR_SPACE(c->msc)) xf86DrvMsg(scrnIndex, X_INFO, "Default color space is primary color space\n"); if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) { xf86DrvMsg(scrnIndex, X_INFO, "First detailed timing is preferred mode\n"); if (v->revision >= 4) xf86DrvMsg(scrnIndex, X_INFO, "Preferred mode is native pixel format and refresh rate\n"); } else if (v->revision == 3) { xf86DrvMsg(scrnIndex, X_INFO, "First detailed timing not preferred " "mode in violation of standard!\n"); } if (v->revision >= 4) { if (GFT_SUPPORTED(c->msc)) { xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n"); } } else { if (GFT_SUPPORTED(c->msc)) xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n"); } } static void print_whitepoint(int scrnIndex, struct disp_features *disp) { xf86DrvMsg(scrnIndex, X_INFO, "redX: %.3f redY: %.3f ", disp->redx, disp->redy); xf86ErrorF("greenX: %.3f greenY: %.3f\n", disp->greenx, disp->greeny); xf86DrvMsg(scrnIndex, X_INFO, "blueX: %.3f blueY: %.3f ", disp->bluex, disp->bluey); xf86ErrorF("whiteX: %.3f whiteY: %.3f\n", disp->whitex, disp->whitey); } static void print_display(int scrnIndex, struct disp_features *disp, struct edid_version *v) { print_input_features(scrnIndex, disp, v); if (disp->hsize && disp->vsize) { xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: "); xf86ErrorF("horiz.: %i ", disp->hsize); xf86ErrorF("vert.: %i\n", disp->vsize); } else if (v->revision >= 4 && (disp->hsize || disp->vsize)) { if (disp->hsize) xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n", (disp->hsize + 99) / 100.0); if (disp->vsize) xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n", 100.0 / (float) (disp->vsize + 99)); } else { xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n"); } if (!disp->gamma && v->revision >= 1.4) xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n"); else xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma); print_dpms_features(scrnIndex, disp, v); print_whitepoint(scrnIndex, disp); } static void print_established_timings(int scrnIndex, struct established_timings *t) { unsigned char c; if (t->t1 || t->t2 || t->t_manu) xf86DrvMsg(scrnIndex, X_INFO, "Supported established timings:\n"); c = t->t1; if (c & 0x80) xf86DrvMsg(scrnIndex, X_INFO, "720x400@70Hz\n"); if (c & 0x40) xf86DrvMsg(scrnIndex, X_INFO, "720x400@88Hz\n"); if (c & 0x20) xf86DrvMsg(scrnIndex, X_INFO, "640x480@60Hz\n"); if (c & 0x10) xf86DrvMsg(scrnIndex, X_INFO, "640x480@67Hz\n"); if (c & 0x08) xf86DrvMsg(scrnIndex, X_INFO, "640x480@72Hz\n"); if (c & 0x04) xf86DrvMsg(scrnIndex, X_INFO, "640x480@75Hz\n"); if (c & 0x02) xf86DrvMsg(scrnIndex, X_INFO, "800x600@56Hz\n"); if (c & 0x01) xf86DrvMsg(scrnIndex, X_INFO, "800x600@60Hz\n"); c = t->t2; if (c & 0x80) xf86DrvMsg(scrnIndex, X_INFO, "800x600@72Hz\n"); if (c & 0x40) xf86DrvMsg(scrnIndex, X_INFO, "800x600@75Hz\n"); if (c & 0x20) xf86DrvMsg(scrnIndex, X_INFO, "832x624@75Hz\n"); if (c & 0x10) xf86DrvMsg(scrnIndex, X_INFO, "1024x768@87Hz (interlaced)\n"); if (c & 0x08) xf86DrvMsg(scrnIndex, X_INFO, "1024x768@60Hz\n"); if (c & 0x04) xf86DrvMsg(scrnIndex, X_INFO, "1024x768@70Hz\n"); if (c & 0x02) xf86DrvMsg(scrnIndex, X_INFO, "1024x768@75Hz\n"); if (c & 0x01) xf86DrvMsg(scrnIndex, X_INFO, "1280x1024@75Hz\n"); c = t->t_manu; if (c & 0x80) xf86DrvMsg(scrnIndex, X_INFO, "1152x864@75Hz\n"); xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer's mask: %X\n", c & 0x7F); } static void print_std_timings(int scrnIndex, struct std_timings *t) { int i; char done = 0; for (i = 0; i < STD_TIMINGS; i++) { if (t[i].hsize > 256) { /* sanity check */ if (!done) { xf86DrvMsg(scrnIndex, X_INFO, "Supported standard timings:\n"); done = 1; } xf86DrvMsg(scrnIndex, X_INFO, "#%i: hsize: %i vsize %i refresh: %i vid: %i\n", i, t[i].hsize, t[i].vsize, t[i].refresh, t[i].id); } } } static void print_cvt_timings(int si, struct cvt_timings *t) { int i; for (i = 0; i < 4; i++) { if (t[i].height) { xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n", t[i].width, t[i].height, t[i].rates & 0x10 ? "50," : "", t[i].rates & 0x08 ? "60," : "", t[i].rates & 0x04 ? "75," : "", t[i].rates & 0x02 ? "85," : "", t[i].rates & 0x01 ? "60RB" : ""); } else break; } } static void print_detailed_timings(int scrnIndex, struct detailed_timings *t) { if (t->clock > 15000000) { /* sanity check */ xf86DrvMsg(scrnIndex, X_INFO, "Supported detailed timing:\n"); xf86DrvMsg(scrnIndex, X_INFO, "clock: %.1f MHz ", t->clock / 1000000.0); xf86ErrorF("Image Size: %i x %i mm\n", t->h_size, t->v_size); xf86DrvMsg(scrnIndex, X_INFO, "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ", t->h_active, t->h_sync_off + t->h_active, t->h_sync_off + t->h_sync_width + t->h_active, t->h_active + t->h_blanking); xf86ErrorF("h_border: %i\n", t->h_border); xf86DrvMsg(scrnIndex, X_INFO, "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ", t->v_active, t->v_sync_off + t->v_active, t->v_sync_off + t->v_sync_width + t->v_active, t->v_active + t->v_blanking); xf86ErrorF("v_border: %i\n", t->v_border); if (IS_STEREO(t->stereo)) { xf86DrvMsg(scrnIndex, X_INFO, "Stereo: "); if (IS_RIGHT_STEREO(t->stereo)) { if (!t->stereo_1) xf86ErrorF("right channel on sync\n"); else xf86ErrorF("left channel on sync\n"); } else if (IS_LEFT_STEREO(t->stereo)) { if (!t->stereo_1) xf86ErrorF("right channel on even line\n"); else xf86ErrorF("left channel on evel line\n"); } if (IS_4WAY_STEREO(t->stereo)) { if (!t->stereo_1) xf86ErrorF("4-way interleaved\n"); else xf86ErrorF("side-by-side interleaved"); } } } } /* This function handle all detailed patchs, * including EDID and EDID-extension */ struct det_print_parameter { xf86MonPtr m; int index; ddc_quirk_t quirks; }; static void handle_detailed_print(struct detailed_monitor_section *det_mon, void *data) { int j, scrnIndex; struct det_print_parameter *p; p = (struct det_print_parameter *) data; scrnIndex = p->m->scrnIndex; xf86DetTimingApplyQuirks(det_mon, p->quirks, p->m->features.hsize, p->m->features.vsize); switch (det_mon->type) { case DT: print_detailed_timings(scrnIndex, &det_mon->section.d_timings); break; case DS_SERIAL: xf86DrvMsg(scrnIndex, X_INFO, "Serial No: %s\n", det_mon->section.serial); break; case DS_ASCII_STR: xf86DrvMsg(scrnIndex, X_INFO, " %s\n", det_mon->section.ascii_data); break; case DS_NAME: xf86DrvMsg(scrnIndex, X_INFO, "Monitor name: %s\n", det_mon->section.name); break; case DS_RANGES: { struct monitor_ranges *r = &det_mon->section.ranges; xf86DrvMsg(scrnIndex, X_INFO, "Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,", r->min_v, r->max_v, r->min_h, r->max_h); if (r->max_clock_khz != 0) { xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz); if (r->maxwidth) xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n", r->maxwidth); xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:"); if (r->supported_aspect & SUPPORTED_ASPECT_4_3) xf86ErrorF(" 4:3%s", r->preferred_aspect == PREFERRED_ASPECT_4_3 ? "*" : ""); if (r->supported_aspect & SUPPORTED_ASPECT_16_9) xf86ErrorF(" 16:9%s", r->preferred_aspect == PREFERRED_ASPECT_16_9 ? "*" : ""); if (r->supported_aspect & SUPPORTED_ASPECT_16_10) xf86ErrorF(" 16:10%s", r->preferred_aspect == PREFERRED_ASPECT_16_10 ? "*" : ""); if (r->supported_aspect & SUPPORTED_ASPECT_5_4) xf86ErrorF(" 5:4%s", r->preferred_aspect == PREFERRED_ASPECT_5_4 ? "*" : ""); if (r->supported_aspect & SUPPORTED_ASPECT_15_9) xf86ErrorF(" 15:9%s", r->preferred_aspect == PREFERRED_ASPECT_15_9 ? "*" : ""); xf86ErrorF("\n"); xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:"); if (r->supported_blanking & CVT_STANDARD) xf86ErrorF(" standard"); if (r->supported_blanking & CVT_REDUCED) xf86ErrorF(" reduced"); xf86ErrorF("\n"); xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:"); if (r->supported_scaling & SCALING_HSHRINK) xf86ErrorF(" hshrink"); if (r->supported_scaling & SCALING_HSTRETCH) xf86ErrorF(" hstretch"); if (r->supported_scaling & SCALING_VSHRINK) xf86ErrorF(" vshrink"); if (r->supported_scaling & SCALING_VSTRETCH) xf86ErrorF(" vstretch"); xf86ErrorF("\n"); if (r->preferred_refresh) xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n", r->preferred_refresh); else xf86DrvMsg(scrnIndex, X_INFO, "Buggy monitor, no preferred " "refresh rate given\n"); } else if (r->max_clock != 0) { xf86ErrorF(" PixClock max %i MHz\n", r->max_clock); } else { xf86ErrorF("\n"); } if (r->gtf_2nd_f > 0) xf86DrvMsg(scrnIndex, X_INFO, " 2nd GTF parameters: f: %i kHz " "c: %i m: %i k %i j %i\n", r->gtf_2nd_f, r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k, r->gtf_2nd_j); break; } case DS_STD_TIMINGS: for (j = 0; j < 5; j++) xf86DrvMsg(scrnIndex, X_INFO, "#%i: hsize: %i vsize %i refresh: %i " "vid: %i\n", p->index, det_mon->section.std_t[j].hsize, det_mon->section.std_t[j].vsize, det_mon->section.std_t[j].refresh, det_mon->section.std_t[j].id); break; case DS_WHITE_P: for (j = 0; j < 2; j++) if (det_mon->section.wp[j].index != 0) xf86DrvMsg(scrnIndex, X_INFO, "White point %i: whiteX: %f, whiteY: %f; gamma: %f\n", det_mon->section.wp[j].index, det_mon->section.wp[j].white_x, det_mon->section.wp[j].white_y, det_mon->section.wp[j].white_gamma); break; case DS_CMD: xf86DrvMsg(scrnIndex, X_INFO, "Color management data: (not decoded)\n"); break; case DS_CVT: xf86DrvMsg(scrnIndex, X_INFO, "CVT 3-byte-code modes:\n"); print_cvt_timings(scrnIndex, det_mon->section.cvt); break; case DS_EST_III: xf86DrvMsg(scrnIndex, X_INFO, "Established timings III: (not decoded)\n"); break; case DS_DUMMY: default: break; } if (det_mon->type >= DS_VENDOR && det_mon->type <= DS_VENDOR_MAX) { xf86DrvMsg(scrnIndex, X_INFO, "Unknown vendor-specific block %hx\n", det_mon->type - DS_VENDOR); } p->index = p->index + 1; } static void print_number_sections(int scrnIndex, int num) { if (num) xf86DrvMsg(scrnIndex, X_INFO, "Number of EDID sections to follow: %i\n", num); } xf86MonPtr xf86PrintEDID(xf86MonPtr m) { CARD16 i, j, n; char buf[EDID_WIDTH * 2 + 1]; struct det_print_parameter p; if (!m) return NULL; print_vendor(m->scrnIndex, &m->vendor); print_version(m->scrnIndex, &m->ver); print_display(m->scrnIndex, &m->features, &m->ver); print_established_timings(m->scrnIndex, &m->timings1); print_std_timings(m->scrnIndex, m->timings2); p.m = m; p.index = 0; p.quirks = xf86DDCDetectQuirks(m->scrnIndex, m, FALSE); xf86ForEachDetailedBlock(m, handle_detailed_print, &p); print_number_sections(m->scrnIndex, m->no_sections); /* extension block section stuff */ xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n"); n = 128; if (m->flags & EDID_COMPLETE_RAWDATA) n += m->no_sections * 128; for (i = 0; i < n; i += j) { for (j = 0; j < EDID_WIDTH; ++j) { sprintf(&buf[j * 2], "%02x", m->rawData[i + j]); } xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf); } return m; } xorg-server-1.20.8/hw/xfree86/ddc/DDC.HOWTO0000644000175000017500000000723613640201473014671 00000000000000 DDC.HOWTO This file describes how to add DDC support to a chipset driver. 1) DDC INITIALIZATION When implementing DDC in the driver one has the choice between DDC1 and DDC2. DDC1 data is continuously transmitted by a DDC1 capable display device. The data is send serially over a data line; the Vsync signal serves as clock. Only one EDID 1.x data block can be transmitted using DDC1. Since transmission of an EDID1 block using a regular Vsync frequency would take up several seconds the driver can increase the Vsync frequency to up to 25 kHz as soon as it detects DDC1 activity on the data line. DDC2 data is transmitted using the I2C protocol. This requires an additional clock line. DDC2 is capable of transmitting EDID1 and EDID2 block as well as a VDIF block on display devices that support these. Display devices switch into the DDC2 mode as soon as they detect activity on the DDC clock line. Once the are in DDC2 mode they stop transmitting DDC1 signals until the next power cycle. Some graphics chipset configurations which are not capable of DDC2 might still be able to read DDC1 data. Where available DDC2 it is preferable. All relevant prototypes and defines are in xf86DDC.h. DDC2 additionally requires I2C support. The I2C prototypes are in xf86i2c.h. DDC1 Support: The driver has to provide a read function which waits for the end of the next Vsync signal and reads in and returns the status of the DDC line: unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn) Additionally a function is required to increase the Vsync frequency to max. 25 kHz. void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed) If the speed argument is DDC_FAST the function should increase the Vsync frequency on DDC_SLOW it should restore the original value. For convenience a generic ddc1SetSpeed() function is provided in the vga module for VGA-like chipsets. void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, sf86ddcSpeed speed). To read out the DDC1 data the driver should call xf86MonPtr xf86DoEDID_DDC1(int scrnIndex, void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed), unsigned int (*DDC1Read)(ScrnInfoPtr)) in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed() function, DDC1Read has to point to the DDC1 read function. The function will return a pointer to the xf86Monitor structure which contains all information retrieved by DDC. NULL will be returned on failure. DDC2 Support To read out DDC2 information I2C has to be initialized first. (See documentation for the i2c module). The function xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus) is provided to read out and process DDC2 data. A pointer to the I2CBusRec of the appropriate I2C Bus has to be passed as the second argument. The function will return a pointer to the xf86Monitor structure which contains all information retrieved by DDC. NULL will be returned on failure. Printing monitor parameters To print out the information contained in the xf86Monitor structure the function xf86MonPtr xf86PrintEDID(xf86MonPtr monitor) is provided. Further processing of the xf86Monitor structure is not yet implemented. However, it is planned to use the information about video modes, gamma values etc. Therefore it is strongly recommended to read out DDC data before any video mode processing is done. $XFree86: xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO,v 1.2 1998/12/06 13:30:39 dawes Exp $ xorg-server-1.20.8/hw/xfree86/ddc/interpret_edid.c0000644000175000017500000005032613640201473016620 00000000000000/* * Copyright 1998 by Egbert Eich * Copyright 2007 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. * * interpret_edid.c: interpret a primary EDID block */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #define _PARSE_EDID_ #include "xf86DDC.h" #include static void get_vendor_section(Uchar *, struct vendor *); static void get_version_section(Uchar *, struct edid_version *); static void get_display_section(Uchar *, struct disp_features *, struct edid_version *); static void get_established_timing_section(Uchar *, struct established_timings *); static void get_std_timing_section(Uchar *, struct std_timings *, struct edid_version *); static void fetch_detailed_block(Uchar * c, struct edid_version *ver, struct detailed_monitor_section *det_mon); static void get_dt_md_section(Uchar *, struct edid_version *, struct detailed_monitor_section *det_mon); static void copy_string(Uchar *, Uchar *); static void get_dst_timing_section(Uchar *, struct std_timings *, struct edid_version *); static void get_monitor_ranges(Uchar *, struct monitor_ranges *); static void get_whitepoint_section(Uchar *, struct whitePoints *); static void get_detailed_timing_section(Uchar *, struct detailed_timings *); static Bool validate_version(int scrnIndex, struct edid_version *); static void find_ranges_section(struct detailed_monitor_section *det, void *ranges) { if (det->type == DS_RANGES && det->section.ranges.max_clock) *(struct monitor_ranges **) ranges = &det->section.ranges; } static void find_max_detailed_clock(struct detailed_monitor_section *det, void *ret) { if (det->type == DT) { *(int *) ret = max(*((int *) ret), det->section.d_timings.clock); } } static void handle_edid_quirks(xf86MonPtr m) { struct monitor_ranges *ranges = NULL; /* * max_clock is only encoded in EDID in tens of MHz, so occasionally we * find a monitor claiming a max of 160 with a mode requiring 162, or * similar. Strictly we should refuse to round up too far, but let's * see how well this works. */ /* Try to find Monitor Range and max clock, then re-set range value */ xf86ForEachDetailedBlock(m, find_ranges_section, &ranges); if (ranges && ranges->max_clock) { int clock = 0; xf86ForEachDetailedBlock(m, find_max_detailed_clock, &clock); if (clock && (ranges->max_clock * 1e6 < clock)) { xf86Msg(X_WARNING, "EDID timing clock %.2f exceeds claimed max " "%dMHz, fixing\n", clock / 1.0e6, ranges->max_clock); ranges->max_clock = (clock + 999999) / 1e6; } } } struct det_hv_parameter { int real_hsize; int real_vsize; float target_aspect; }; static void handle_detailed_hvsize(struct detailed_monitor_section *det_mon, void *data) { struct det_hv_parameter *p = (struct det_hv_parameter *) data; float timing_aspect; if (det_mon->type == DT) { struct detailed_timings *timing; timing = &det_mon->section.d_timings; if (!timing->v_size) return; timing_aspect = (float) timing->h_size / timing->v_size; if (fabs(1 - (timing_aspect / p->target_aspect)) < 0.05) { p->real_hsize = max(p->real_hsize, timing->h_size); p->real_vsize = max(p->real_vsize, timing->v_size); } } } static void encode_aspect_ratio(xf86MonPtr m) { /* * some monitors encode the aspect ratio instead of the physical size. * try to find the largest detailed timing that matches that aspect * ratio and use that to fill in the feature section. */ if ((m->features.hsize == 16 && m->features.vsize == 9) || (m->features.hsize == 16 && m->features.vsize == 10) || (m->features.hsize == 4 && m->features.vsize == 3) || (m->features.hsize == 5 && m->features.vsize == 4)) { struct det_hv_parameter p; p.real_hsize = 0; p.real_vsize = 0; p.target_aspect = (float) m->features.hsize / m->features.vsize; xf86ForEachDetailedBlock(m, handle_detailed_hvsize, &p); if (!p.real_hsize || !p.real_vsize) { m->features.hsize = m->features.vsize = 0; } else if ((m->features.hsize * 10 == p.real_hsize) && (m->features.vsize * 10 == p.real_vsize)) { /* exact match is just unlikely, should do a better check though */ m->features.hsize = m->features.vsize = 0; } else { /* convert mm to cm */ m->features.hsize = (p.real_hsize + 5) / 10; m->features.vsize = (p.real_vsize + 5) / 10; } xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n", m->features.hsize, m->features.vsize); } } xf86MonPtr xf86InterpretEDID(int scrnIndex, Uchar * block) { xf86MonPtr m; if (!block) return NULL; if (!(m = xnfcalloc(sizeof(xf86Monitor), 1))) return NULL; m->scrnIndex = scrnIndex; m->rawData = block; get_vendor_section(SECTION(VENDOR_SECTION, block), &m->vendor); get_version_section(SECTION(VERSION_SECTION, block), &m->ver); if (!validate_version(scrnIndex, &m->ver)) goto error; get_display_section(SECTION(DISPLAY_SECTION, block), &m->features, &m->ver); get_established_timing_section(SECTION(ESTABLISHED_TIMING_SECTION, block), &m->timings1); get_std_timing_section(SECTION(STD_TIMING_SECTION, block), m->timings2, &m->ver); get_dt_md_section(SECTION(DET_TIMING_SECTION, block), &m->ver, m->det_mon); m->no_sections = (int) *(char *) SECTION(NO_EDID, block); handle_edid_quirks(m); encode_aspect_ratio(m); return m; error: free(m); return NULL; } static int get_cea_detail_timing(Uchar * blk, xf86MonPtr mon, struct detailed_monitor_section *det_mon) { int dt_num; int dt_offset = ((struct cea_ext_body *) blk)->dt_offset; dt_num = 0; if (dt_offset < CEA_EXT_MIN_DATA_OFFSET) return dt_num; for (; dt_offset < (CEA_EXT_MAX_DATA_OFFSET - DET_TIMING_INFO_LEN) && dt_num < CEA_EXT_DET_TIMING_NUM; _NEXT_DT_MD_SECTION(dt_offset)) { fetch_detailed_block(blk + dt_offset, &mon->ver, det_mon + dt_num); dt_num = dt_num + 1; } return dt_num; } static void handle_cea_detail_block(Uchar * ext, xf86MonPtr mon, handle_detailed_fn fn, void *data) { int i; struct detailed_monitor_section det_mon[CEA_EXT_DET_TIMING_NUM]; int det_mon_num; det_mon_num = get_cea_detail_timing(ext, mon, det_mon); for (i = 0; i < det_mon_num; i++) fn(det_mon + i, data); } void xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn fn, void *data) { int i; Uchar *ext; if (mon == NULL) return; for (i = 0; i < DET_TIMINGS; i++) fn(mon->det_mon + i, data); for (i = 0; i < mon->no_sections; i++) { ext = mon->rawData + EDID1_LEN * (i + 1); switch (ext[EXT_TAG]) { case CEA_EXT: handle_cea_detail_block(ext, mon, fn, data); break; case VTB_EXT: case DI_EXT: case LS_EXT: case MI_EXT: break; } } } static struct cea_data_block * extract_cea_data_block(Uchar * ext, int data_type) { struct cea_ext_body *cea; struct cea_data_block *data_collection; struct cea_data_block *data_end; cea = (struct cea_ext_body *) ext; if (cea->dt_offset <= CEA_EXT_MIN_DATA_OFFSET) return NULL; data_collection = &cea->data_collection; data_end = (struct cea_data_block *) (cea->dt_offset + ext); for (; data_collection < data_end;) { if (data_type == data_collection->tag) { return data_collection; } data_collection = (void *) ((unsigned char *) data_collection + data_collection->len + 1); } return NULL; } static void handle_cea_video_block(Uchar * ext, handle_video_fn fn, void *data) { struct cea_video_block *video; struct cea_video_block *video_end; struct cea_data_block *data_collection; data_collection = extract_cea_data_block(ext, CEA_VIDEO_BLK); if (data_collection == NULL) return; video = &data_collection->u.video; video_end = (struct cea_video_block *) ((Uchar *) video + data_collection->len); for (; video < video_end; video = video + 1) { fn(video, data); } } void xf86ForEachVideoBlock(xf86MonPtr mon, handle_video_fn fn, void *data) { int i; Uchar *ext; if (mon == NULL) return; for (i = 0; i < mon->no_sections; i++) { ext = mon->rawData + EDID1_LEN * (i + 1); switch (ext[EXT_TAG]) { case CEA_EXT: handle_cea_video_block(ext, fn, data); break; case VTB_EXT: case DI_EXT: case LS_EXT: case MI_EXT: break; } } } static Bool cea_db_offsets(Uchar *cea, int *start, int *end) { /* Data block offset in CEA extension block */ *start = CEA_EXT_MIN_DATA_OFFSET; *end = cea[2]; if (*end == 0) *end = CEA_EXT_MAX_DATA_OFFSET; if (*end < CEA_EXT_MIN_DATA_OFFSET || *end > CEA_EXT_MAX_DATA_OFFSET) return FALSE; return TRUE; } static int cea_db_len(Uchar *db) { return db[0] & 0x1f; } static int cea_db_tag(Uchar *db) { return db[0] >> 5; } typedef void (*handle_cea_db_fn) (Uchar *, void *); static void cea_for_each_db(xf86MonPtr mon, handle_cea_db_fn fn, void *data) { int i; if (!mon) return; if (!(mon->flags & EDID_COMPLETE_RAWDATA)) return; if (!mon->no_sections) return; if (!mon->rawData) return; for (i = 0; i < mon->no_sections; i++) { int start, end, offset; Uchar *ext; ext = mon->rawData + EDID1_LEN * (i + 1); if (ext[EXT_TAG] != CEA_EXT) continue; if (!cea_db_offsets(ext, &start, &end)) continue; for (offset = start; offset < end && offset + cea_db_len(&ext[offset]) < end; offset += cea_db_len(&ext[offset]) + 1) fn(&ext[offset], data); } } struct find_hdmi_block_data { struct cea_data_block *hdmi; }; static void find_hdmi_block(Uchar *db, void *data) { struct find_hdmi_block_data *result = data; int oui; if (cea_db_tag(db) != CEA_VENDOR_BLK) return; if (cea_db_len(db) < 5) return; oui = (db[3] << 16) | (db[2] << 8) | db[1]; if (oui == IEEE_ID_HDMI) result->hdmi = (struct cea_data_block *)db; } struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon) { struct find_hdmi_block_data result = { NULL }; cea_for_each_db(mon, find_hdmi_block, &result); return result.hdmi; } xf86MonPtr xf86InterpretEEDID(int scrnIndex, Uchar * block) { xf86MonPtr m; m = xf86InterpretEDID(scrnIndex, block); if (!m) return NULL; /* extension parse */ return m; } static void get_vendor_section(Uchar * c, struct vendor *r) { r->name[0] = L1; r->name[1] = L2; r->name[2] = L3; r->name[3] = '\0'; r->prod_id = PROD_ID; r->serial = SERIAL_NO; r->week = WEEK; r->year = YEAR; } static void get_version_section(Uchar * c, struct edid_version *r) { r->version = VERSION; r->revision = REVISION; } static void get_display_section(Uchar * c, struct disp_features *r, struct edid_version *v) { r->input_type = INPUT_TYPE; if (!DIGITAL(r->input_type)) { r->input_voltage = INPUT_VOLTAGE; r->input_setup = SETUP; r->input_sync = SYNC; } else if (v->revision == 2 || v->revision == 3) { r->input_dfp = DFP; } else if (v->revision >= 4) { r->input_bpc = BPC; r->input_interface = DIGITAL_INTERFACE; } r->hsize = HSIZE_MAX; r->vsize = VSIZE_MAX; r->gamma = GAMMA; r->dpms = DPMS; r->display_type = DISPLAY_TYPE; r->msc = MSC; r->redx = REDX; r->redy = REDY; r->greenx = GREENX; r->greeny = GREENY; r->bluex = BLUEX; r->bluey = BLUEY; r->whitex = WHITEX; r->whitey = WHITEY; } static void get_established_timing_section(Uchar * c, struct established_timings *r) { r->t1 = T1; r->t2 = T2; r->t_manu = T_MANU; } static void get_cvt_timing_section(Uchar * c, struct cvt_timings *r) { int i; for (i = 0; i < 4; i++) { if (c[0] && c[1] && c[2]) { r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2; switch (c[1] & 0xc0) { case 0x00: r[i].width = r[i].height * 4 / 3; break; case 0x40: r[i].width = r[i].height * 16 / 9; break; case 0x80: r[i].width = r[i].height * 16 / 10; break; case 0xc0: r[i].width = r[i].height * 15 / 9; break; } switch (c[2] & 0x60) { case 0x00: r[i].rate = 50; break; case 0x20: r[i].rate = 60; break; case 0x40: r[i].rate = 75; break; case 0x60: r[i].rate = 85; break; } r[i].rates = c[2] & 0x1f; } else { return; } c += 3; } } static void get_std_timing_section(Uchar * c, struct std_timings *r, struct edid_version *v) { int i; for (i = 0; i < STD_TIMINGS; i++) { if (VALID_TIMING) { r[i].hsize = HSIZE1; VSIZE1(r[i].vsize); r[i].refresh = REFRESH_R; r[i].id = STD_TIMING_ID; } else { r[i].hsize = r[i].vsize = r[i].refresh = r[i].id = 0; } NEXT_STD_TIMING; } } static const unsigned char empty_block[18]; static void fetch_detailed_block(Uchar * c, struct edid_version *ver, struct detailed_monitor_section *det_mon) { if (ver->version == 1 && ver->revision >= 1 && IS_MONITOR_DESC) { switch (MONITOR_DESC_TYPE) { case SERIAL_NUMBER: det_mon->type = DS_SERIAL; copy_string(c, det_mon->section.serial); break; case ASCII_STR: det_mon->type = DS_ASCII_STR; copy_string(c, det_mon->section.ascii_data); break; case MONITOR_RANGES: det_mon->type = DS_RANGES; get_monitor_ranges(c, &det_mon->section.ranges); break; case MONITOR_NAME: det_mon->type = DS_NAME; copy_string(c, det_mon->section.name); break; case ADD_COLOR_POINT: det_mon->type = DS_WHITE_P; get_whitepoint_section(c, det_mon->section.wp); break; case ADD_STD_TIMINGS: det_mon->type = DS_STD_TIMINGS; get_dst_timing_section(c, det_mon->section.std_t, ver); break; case COLOR_MANAGEMENT_DATA: det_mon->type = DS_CMD; break; case CVT_3BYTE_DATA: det_mon->type = DS_CVT; get_cvt_timing_section(c, det_mon->section.cvt); break; case ADD_EST_TIMINGS: det_mon->type = DS_EST_III; memcpy(det_mon->section.est_iii, c + 6, 6); break; case ADD_DUMMY: det_mon->type = DS_DUMMY; break; default: det_mon->type = DS_UNKOWN; break; } if (c[3] <= 0x0F && memcmp(c, empty_block, sizeof(empty_block))) { det_mon->type = DS_VENDOR + c[3]; } } else { det_mon->type = DT; get_detailed_timing_section(c, &det_mon->section.d_timings); } } static void get_dt_md_section(Uchar * c, struct edid_version *ver, struct detailed_monitor_section *det_mon) { int i; for (i = 0; i < DET_TIMINGS; i++) { fetch_detailed_block(c, ver, det_mon + i); NEXT_DT_MD_SECTION; } } static void copy_string(Uchar * c, Uchar * s) { int i; c = c + 5; for (i = 0; (i < 13 && *c != 0x0A); i++) *(s++) = *(c++); *s = 0; while (i-- && (*--s == 0x20)) *s = 0; } static void get_dst_timing_section(Uchar * c, struct std_timings *t, struct edid_version *v) { int j; c = c + 5; for (j = 0; j < 5; j++) { t[j].hsize = HSIZE1; VSIZE1(t[j].vsize); t[j].refresh = REFRESH_R; t[j].id = STD_TIMING_ID; NEXT_STD_TIMING; } } static void get_monitor_ranges(Uchar * c, struct monitor_ranges *r) { r->min_v = MIN_V; r->max_v = MAX_V; r->min_h = MIN_H; r->max_h = MAX_H; r->max_clock = 0; if (MAX_CLOCK != 0xff) /* is specified? */ r->max_clock = MAX_CLOCK * 10 + 5; if (HAVE_2ND_GTF) { r->gtf_2nd_f = F_2ND_GTF; r->gtf_2nd_c = C_2ND_GTF; r->gtf_2nd_m = M_2ND_GTF; r->gtf_2nd_k = K_2ND_GTF; r->gtf_2nd_j = J_2ND_GTF; } else { r->gtf_2nd_f = 0; } if (HAVE_CVT) { r->max_clock_khz = MAX_CLOCK_KHZ; r->max_clock = r->max_clock_khz / 1000; r->maxwidth = MAXWIDTH; r->supported_aspect = SUPPORTED_ASPECT; r->preferred_aspect = PREFERRED_ASPECT; r->supported_blanking = SUPPORTED_BLANKING; r->supported_scaling = SUPPORTED_SCALING; r->preferred_refresh = PREFERRED_REFRESH; } else { r->max_clock_khz = 0; } } static void get_whitepoint_section(Uchar * c, struct whitePoints *wp) { wp[0].white_x = WHITEX1; wp[0].white_y = WHITEY1; wp[1].white_x = WHITEX2; wp[1].white_y = WHITEY2; wp[0].index = WHITE_INDEX1; wp[1].index = WHITE_INDEX2; wp[0].white_gamma = WHITE_GAMMA1; wp[1].white_gamma = WHITE_GAMMA2; } static void get_detailed_timing_section(Uchar * c, struct detailed_timings *r) { r->clock = PIXEL_CLOCK; r->h_active = H_ACTIVE; r->h_blanking = H_BLANK; r->v_active = V_ACTIVE; r->v_blanking = V_BLANK; r->h_sync_off = H_SYNC_OFF; r->h_sync_width = H_SYNC_WIDTH; r->v_sync_off = V_SYNC_OFF; r->v_sync_width = V_SYNC_WIDTH; r->h_size = H_SIZE; r->v_size = V_SIZE; r->h_border = H_BORDER; r->v_border = V_BORDER; r->interlaced = INTERLACED; r->stereo = STEREO; r->stereo_1 = STEREO1; r->sync = SYNC_T; r->misc = MISC; } #define MAX_EDID_MINOR 4 static Bool validate_version(int scrnIndex, struct edid_version *r) { if (r->version != 1) { xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n", r->version); return FALSE; } if (r->revision > MAX_EDID_MINOR) xf86DrvMsg(scrnIndex, X_WARNING, "Assuming version 1.%d is compatible with 1.%d\n", r->revision, MAX_EDID_MINOR); return TRUE; } /* * Returns true if HDMI, false if definitely not or unknown. */ Bool xf86MonitorIsHDMI(xf86MonPtr mon) { return xf86MonitorFindHDMIBlock(mon) != NULL; } xorg-server-1.20.8/hw/xfree86/ddc/ddc.c0000644000175000017500000002671713640201473014360 00000000000000/* xf86DDC.c * * Copyright 1998,1999 by Egbert Eich */ /* * A note on terminology. DDC1 is the original dumb serial protocol, and * can only do up to 128 bytes of EDID. DDC2 is I2C-encapsulated and * introduces extension blocks. EDID is the old display identification * block, DisplayID is the new one. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86DDC.h" #include #define RETRIES 4 typedef enum { DDCOPT_NODDC1, DDCOPT_NODDC2, DDCOPT_NODDC } DDCOpts; static const OptionInfoRec DDCOptions[] = { {DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE}, {DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE}, {DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; /* DDC1 */ static int find_start(unsigned int *ptr) { unsigned int comp[9], test[9]; int i, j; for (i = 0; i < 9; i++) { comp[i] = *(ptr++); test[i] = 1; } for (i = 0; i < 127; i++) { for (j = 0; j < 9; j++) { test[j] = test[j] & !(comp[j] ^ *(ptr++)); } } for (i = 0; i < 9; i++) if (test[i]) return i + 1; return -1; } static unsigned char * find_header(unsigned char *block) { unsigned char *ptr, *head_ptr, *end; unsigned char header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; ptr = block; end = block + EDID1_LEN; while (ptr < end) { int i; head_ptr = ptr; for (i = 0; i < 8; i++) { if (header[i] != *(head_ptr++)) break; if (head_ptr == end) head_ptr = block; } if (i == 8) break; ptr++; } if (ptr == end) return NULL; return ptr; } static unsigned char * resort(unsigned char *s_block) { unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end; unsigned char tmp; s_ptr = find_header(s_block); if (!s_ptr) return NULL; s_end = s_block + EDID1_LEN; d_new = malloc(EDID1_LEN); if (!d_new) return NULL; d_end = d_new + EDID1_LEN; for (d_ptr = d_new; d_ptr < d_end; d_ptr++) { tmp = *(s_ptr++); *d_ptr = tmp; if (s_ptr == s_end) s_ptr = s_block; } free(s_block); return d_new; } static int DDC_checksum(const unsigned char *block, int len) { int i, result = 0; int not_null = 0; for (i = 0; i < len; i++) { not_null |= block[i]; result += block[i]; } #ifdef DEBUG if (result & 0xFF) ErrorF("DDC checksum not correct\n"); if (!not_null) ErrorF("DDC read all Null\n"); #endif /* catch the trivial case where all bytes are 0 */ if (!not_null) return 1; return result & 0xFF; } static unsigned char * GetEDID_DDC1(unsigned int *s_ptr) { unsigned char *d_block, *d_pos; unsigned int *s_pos, *s_end; int s_start; int i, j; s_start = find_start(s_ptr); if (s_start == -1) return NULL; s_end = s_ptr + NUM; s_pos = s_ptr + s_start; d_block = calloc(1, EDID1_LEN); if (!d_block) return NULL; d_pos = d_block; for (i = 0; i < EDID1_LEN; i++) { for (j = 0; j < 8; j++) { *d_pos <<= 1; if (*s_pos) { *d_pos |= 0x01; } s_pos++; if (s_pos == s_end) s_pos = s_ptr; }; s_pos++; if (s_pos == s_end) s_pos = s_ptr; d_pos++; } free(s_ptr); if (d_block && DDC_checksum(d_block, EDID1_LEN)) { free(d_block); return NULL; } return (resort(d_block)); } /* fetch entire EDID record; DDC bit needs to be masked */ static unsigned int * FetchEDID_DDC1(register ScrnInfoPtr pScrn, register unsigned int (*read_DDC) (ScrnInfoPtr)) { int count = NUM; unsigned int *ptr, *xp; ptr = xp = malloc(sizeof(int) * NUM); if (!ptr) return NULL; do { /* wait for next retrace */ *xp = read_DDC(pScrn); xp++; } while (--count); return ptr; } /* test if DDC1 return 0 if not */ static Bool TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC) (ScrnInfoPtr)) { int old, count; old = read_DDC(pScrn); count = HEADER * BITS_PER_BYTE; do { /* wait for next retrace */ if (old != read_DDC(pScrn)) break; } while (count--); return count; } /* * read EDID record , pass it to callback function to interpret. * callback function will store it for further use by calling * function; it will also decide if we need to reread it */ static unsigned char * EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed, unsigned int (*read_DDC) (ScrnInfoPtr)) { unsigned char *EDID_block = NULL; int count = RETRIES; if (!read_DDC) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "chipset doesn't support DDC1\n"); return NULL; }; if (TestDDC1(pScrn, read_DDC) == -1) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n"); return NULL; }; if (DDCSpeed) DDCSpeed(pScrn, DDC_FAST); do { EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn, read_DDC)); count--; } while (!EDID_block && count); if (DDCSpeed) DDCSpeed(pScrn, DDC_SLOW); return EDID_block; } /** * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are * unset. EDID information blocks are interpreted and the results returned in * an xf86MonPtr. * * This function does not affect the list of modes used by drivers -- it is up * to the driver to decide policy on what to do with EDID information. * * @return pointer to a new xf86MonPtr containing the EDID information. * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, unsigned int (*DDC1Read) (ScrnInfoPtr)) { unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; /* Default DDC and DDC1 to enabled. */ Bool noddc = FALSE, noddc1 = FALSE; OptionInfoPtr options; options = xnfalloc(sizeof(DDCOptions)); (void) memcpy(options, DDCOptions, sizeof(DDCOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1); free(options); if (noddc || noddc1) return NULL; OsBlockSignals(); EDID_block = EDIDRead_DDC1(pScrn, DDC1SetSpeed, DDC1Read); OsReleaseSignals(); if (EDID_block) { tmp = xf86InterpretEDID(pScrn->scrnIndex, EDID_block); } #ifdef DEBUG else ErrorF("No EDID block returned\n"); if (!tmp) ErrorF("Cannot interpret EDID block\n"); #endif return tmp; } /* DDC2 */ static I2CDevPtr DDC2MakeDevice(I2CBusPtr pBus, int address, const char *name) { I2CDevPtr dev = NULL; if (!(dev = xf86I2CFindDev(pBus, address))) { dev = xf86CreateI2CDevRec(); dev->DevName = name; dev->SlaveAddr = address; dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ dev->StartTimeout = 550; dev->BitTimeout = 40; dev->AcknTimeout = 40; dev->pI2CBus = pBus; if (!xf86I2CDevInit(dev)) { xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n"); return NULL; } } return dev; } static I2CDevPtr DDC2Init(I2CBusPtr pBus) { I2CDevPtr dev = NULL; /* * Slow down the bus so that older monitors don't * miss things. */ pBus->RiseFallTime = 20; dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2"); if (xf86I2CProbeAddress(pBus, 0x0060)) DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register"); return dev; } /* Mmmm, smell the hacks */ static void EEDIDStop(I2CDevPtr d) { } /* block is the EDID block number. a segment is two blocks. */ static Bool DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer) { unsigned char W_Buffer[1]; int i, segment; I2CDevPtr seg; void (*stop) (I2CDevPtr); for (i = 0; i < RETRIES; i++) { /* Stop bits reset the segment pointer to 0, so be careful here. */ segment = block >> 1; if (segment) { Bool b; if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060))) return FALSE; W_Buffer[0] = segment; stop = dev->pI2CBus->I2CStop; dev->pI2CBus->I2CStop = EEDIDStop; b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0); dev->pI2CBus->I2CStop = stop; if (!b) { dev->pI2CBus->I2CStop(dev); continue; } } W_Buffer[0] = (block & 0x01) * EDID1_LEN; if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) { if (!DDC_checksum(R_Buffer, EDID1_LEN)) return TRUE; } } return FALSE; } /** * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are * unset. EDID information blocks are interpreted and the results returned in * an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return * the complete EDID data, including all extension blocks, if the 'complete' * parameter is TRUE; * * This function does not affect the list of modes used by drivers -- it is up * to the driver to decide policy on what to do with EDID information. * * @return pointer to a new xf86MonPtr containing the EDID information. * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool complete) { unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; I2CDevPtr dev = NULL; /* Default DDC and DDC2 to enabled. */ Bool noddc = FALSE, noddc2 = FALSE; OptionInfoPtr options; options = malloc(sizeof(DDCOptions)); if (!options) return NULL; memcpy(options, DDCOptions, sizeof(DDCOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); free(options); if (noddc || noddc2) return NULL; if (!(dev = DDC2Init(pBus))) return NULL; EDID_block = calloc(1, EDID1_LEN); if (!EDID_block) return NULL; if (DDC2Read(dev, 0, EDID_block)) { int i, n = EDID_block[0x7e]; if (complete && n) { EDID_block = reallocarray(EDID_block, 1 + n, EDID1_LEN); for (i = 0; i < n; i++) DDC2Read(dev, i + 1, EDID_block + (EDID1_LEN * (1 + i))); } tmp = xf86InterpretEEDID(pScrn->scrnIndex, EDID_block); } if (tmp && complete) tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA; return tmp; } /** * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are * unset. EDID information blocks are interpreted and the results returned in * an xf86MonPtr. * * This function does not affect the list of modes used by drivers -- it is up * to the driver to decide policy on what to do with EDID information. * * @return pointer to a new xf86MonPtr containing the EDID information. * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus) { return xf86DoEEDID(pScrn, pBus, FALSE); } xorg-server-1.20.8/hw/xfree86/ddc/xf86DDC.h0000644000175000017500000000641613640201473014733 00000000000000 /* xf86DDC.h * * This file contains all information to interpret a standard EDIC block * transmitted by a display device via DDC (Display Data Channel). So far * there is no information to deal with optional EDID blocks. * DDC is a Trademark of VESA (Video Electronics Standard Association). * * Copyright 1998 by Egbert Eich */ #ifndef XF86_DDC_H #define XF86_DDC_H #include "edid.h" #include "xf86i2c.h" #include "xf86str.h" /* speed up / slow down */ typedef enum { DDC_SLOW, DDC_FAST } xf86ddcSpeed; typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed); extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, unsigned int (*DDC1Read) (ScrnInfoPtr) ); extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus); extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool); extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr); extern _X_EXPORT xf86MonPtr xf86InterpretEDID(int screenIndex, Uchar * block); extern _X_EXPORT xf86MonPtr xf86InterpretEEDID(int screenIndex, Uchar * block); extern _X_EXPORT void xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC); extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC); extern _X_EXPORT Bool xf86MonitorIsHDMI(xf86MonPtr mon); extern _X_EXPORT DisplayModePtr FindDMTMode(int hsize, int vsize, int refresh, Bool rb); extern _X_EXPORT const DisplayModeRec DMTModes[]; /* * Quirks to work around broken EDID data from various monitors. */ typedef enum { DDC_QUIRK_NONE = 0, /* First detailed mode is bogus, prefer largest mode at 60hz */ DDC_QUIRK_PREFER_LARGE_60 = 1 << 0, /* 135MHz clock is too high, drop a bit */ DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 1, /* Prefer the largest mode at 75 Hz */ DDC_QUIRK_PREFER_LARGE_75 = 1 << 2, /* Convert detailed timing's horizontal from units of cm to mm */ DDC_QUIRK_DETAILED_H_IN_CM = 1 << 3, /* Convert detailed timing's vertical from units of cm to mm */ DDC_QUIRK_DETAILED_V_IN_CM = 1 << 4, /* Detailed timing descriptors have bogus size values, so just take the * maximum size and use that. */ DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5, /* Monitor forgot to set the first detailed is preferred bit. */ DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6, /* use +hsync +vsync for detailed mode */ DDC_QUIRK_DETAILED_SYNC_PP = 1 << 7, /* Force single-link DVI bandwidth limit */ DDC_QUIRK_DVI_SINGLE_LINK = 1 << 8, } ddc_quirk_t; typedef void (*handle_detailed_fn) (struct detailed_monitor_section *, void *); void xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn, void *data); ddc_quirk_t xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose); void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon, ddc_quirk_t quirks, int hsize, int vsize); typedef void (*handle_video_fn) (struct cea_video_block *, void *); void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *); struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon); #endif xorg-server-1.20.8/hw/xfree86/ddc/Makefile.in0000644000175000017500000007116713640201512015520 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/ddc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libddc_la_LIBADD = am_libddc_la_OBJECTS = ddc.lo interpret_edid.lo print_edid.lo \ ddcProperty.lo libddc_la_OBJECTS = $(am_libddc_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/ddc.Plo ./$(DEPDIR)/ddcProperty.Plo \ ./$(DEPDIR)/interpret_edid.Plo ./$(DEPDIR)/print_edid.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libddc_la_SOURCES) DIST_SOURCES = $(libddc_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ sdk_HEADERS = edid.h xf86DDC.h noinst_LTLIBRARIES = libddc.la libddc_la_SOURCES = ddc.c interpret_edid.c print_edid.c ddcProperty.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = DDC.HOWTO all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/ddc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/ddc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libddc.la: $(libddc_la_OBJECTS) $(libddc_la_DEPENDENCIES) $(EXTRA_libddc_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libddc_la_OBJECTS) $(libddc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcProperty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret_edid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_edid.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/ddc.Plo -rm -f ./$(DEPDIR)/ddcProperty.Plo -rm -f ./$(DEPDIR)/interpret_edid.Plo -rm -f ./$(DEPDIR)/print_edid.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/ddc.Plo -rm -f ./$(DEPDIR)/ddcProperty.Plo -rm -f ./$(DEPDIR)/interpret_edid.Plo -rm -f ./$(DEPDIR)/print_edid.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/ddc/edid.h0000644000175000017500000004527713640201473014542 00000000000000/* * edid.h: defines to parse an EDID block * * This file contains all information to interpret a standard EDIC block * transmitted by a display device via DDC (Display Data Channel). So far * there is no information to deal with optional EDID blocks. * DDC is a Trademark of VESA (Video Electronics Standard Association). * * Copyright 1998 by Egbert Eich */ #ifndef _EDID_H_ #define _EDID_H_ #include #ifndef _X_EXPORT #include #endif /* read complete EDID record */ #define EDID1_LEN 128 #define BITS_PER_BYTE 9 #define NUM BITS_PER_BYTE*EDID1_LEN #define HEADER 6 #define STD_TIMINGS 8 #define DET_TIMINGS 4 #ifdef _PARSE_EDID_ /* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */ #define HEADER_SECTION 0 #define HEADER_LENGTH 8 /* vendor section */ #define VENDOR_SECTION (HEADER_SECTION + HEADER_LENGTH) #define V_MANUFACTURER 0 #define V_PROD_ID (V_MANUFACTURER + 2) #define V_SERIAL (V_PROD_ID + 2) #define V_WEEK (V_SERIAL + 4) #define V_YEAR (V_WEEK + 1) #define VENDOR_LENGTH (V_YEAR + 1) /* EDID version */ #define VERSION_SECTION (VENDOR_SECTION + VENDOR_LENGTH) #define V_VERSION 0 #define V_REVISION (V_VERSION + 1) #define VERSION_LENGTH (V_REVISION + 1) /* display information */ #define DISPLAY_SECTION (VERSION_SECTION + VERSION_LENGTH) #define D_INPUT 0 #define D_HSIZE (D_INPUT + 1) #define D_VSIZE (D_HSIZE + 1) #define D_GAMMA (D_VSIZE + 1) #define FEAT_S (D_GAMMA + 1) #define D_RG_LOW (FEAT_S + 1) #define D_BW_LOW (D_RG_LOW + 1) #define D_REDX (D_BW_LOW + 1) #define D_REDY (D_REDX + 1) #define D_GREENX (D_REDY + 1) #define D_GREENY (D_GREENX + 1) #define D_BLUEX (D_GREENY + 1) #define D_BLUEY (D_BLUEX + 1) #define D_WHITEX (D_BLUEY + 1) #define D_WHITEY (D_WHITEX + 1) #define DISPLAY_LENGTH (D_WHITEY + 1) /* supported VESA and other standard timings */ #define ESTABLISHED_TIMING_SECTION (DISPLAY_SECTION + DISPLAY_LENGTH) #define E_T1 0 #define E_T2 (E_T1 + 1) #define E_TMANU (E_T2 + 1) #define E_TIMING_LENGTH (E_TMANU + 1) /* non predefined standard timings supported by display */ #define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH) #define STD_TIMING_INFO_LEN 2 #define STD_TIMING_INFO_NUM STD_TIMINGS #define STD_TIMING_LENGTH (STD_TIMING_INFO_LEN * STD_TIMING_INFO_NUM) /* detailed timing info of non standard timings */ #define DET_TIMING_SECTION (STD_TIMING_SECTION + STD_TIMING_LENGTH) #define DET_TIMING_INFO_LEN 18 #define MONITOR_DESC_LEN DET_TIMING_INFO_LEN #define DET_TIMING_INFO_NUM DET_TIMINGS #define DET_TIMING_LENGTH (DET_TIMING_INFO_LEN * DET_TIMING_INFO_NUM) /* number of EDID sections to follow */ #define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH) /* one byte checksum */ #define CHECKSUM (NO_EDID + 1) #if (CHECKSUM != (EDID1_LEN - 1)) #error "EDID1 length != 128!" #endif #define SECTION(x,y) (Uchar *)(x + y) #define GET_ARRAY(y) ((Uchar *)(c + y)) #define GET(y) *(Uchar *)(c + y) /* extract information from vendor section */ #define _PROD_ID(x) x[0] + (x[1] << 8); #define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID)) #define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24) #define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL)) #define _YEAR(x) (x & 0xFF) + 1990 #define YEAR _YEAR(GET(V_YEAR)) #define WEEK GET(V_WEEK) & 0xFF #define _L1(x) ((x[0] & 0x7C) >> 2) + '@' #define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@' #define _L3(x) (x[1] & 0x1F) + '@'; #define L1 _L1(GET_ARRAY(V_MANUFACTURER)) #define L2 _L2(GET_ARRAY(V_MANUFACTURER)) #define L3 _L3(GET_ARRAY(V_MANUFACTURER)) /* extract information from version section */ #define VERSION GET(V_VERSION) #define REVISION GET(V_REVISION) /* extract information from display section */ #define _INPUT_TYPE(x) ((x & 0x80) >> 7) #define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT)) #define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5) #define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT)) #define _SETUP(x) ((x & 0x10) >> 4) #define SETUP _SETUP(GET(D_INPUT)) #define _SYNC(x) (x & 0x0F) #define SYNC _SYNC(GET(D_INPUT)) #define _DFP(x) (x & 0x01) #define DFP _DFP(GET(D_INPUT)) #define _BPC(x) ((x & 0x70) >> 4) #define BPC _BPC(GET(D_INPUT)) #define _DIGITAL_INTERFACE(x) (x & 0x0F) #define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT)) #define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0)) #define GAMMA _GAMMA(GET(D_GAMMA)) #define HSIZE_MAX GET(D_HSIZE) #define VSIZE_MAX GET(D_VSIZE) #define _DPMS(x) ((x & 0xE0) >> 5) #define DPMS _DPMS(GET(FEAT_S)) #define _DISPLAY_TYPE(x) ((x & 0x18) >> 3) #define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S)) #define _MSC(x) (x & 0x7) #define MSC _MSC(GET(FEAT_S)) /* color characteristics */ #define CC_L(x,y) ((x & (0x03 << y)) >> y) #define CC_H(x) (x << 2) #define I_CC(x,y,z) CC_H(y) | CC_L(x,z) #define F_CC(x) ((x)/1024.0) #define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6)) #define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4)) #define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2)) #define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0)) #define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6)) #define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4)) #define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2)) #define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0)) /* extract information from standard timing section */ #define T1 GET(E_T1) #define T2 GET(E_T2) #define T_MANU GET(E_TMANU) /* extract information from estabished timing section */ #define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \ || ((x[0] == 0x00) && (x[1] == 0x00)) \ || ((x[0] == 0x20) && (x[1] == 0x20)) ) #define VALID_TIMING _VALID_TIMING(c) #define _HSIZE1(x) ((x[0] + 31) * 8) #define HSIZE1 _HSIZE1(c) #define RATIO(x) ((x[1] & 0xC0) >> 6) #define RATIO1_1 0 /* EDID Ver. 1.3 redefined this */ #define RATIO16_10 RATIO1_1 #define RATIO4_3 1 #define RATIO5_4 2 #define RATIO16_9 3 #define _VSIZE1(x,y,r) switch(RATIO(x)){ \ case RATIO1_1: y = ((v->version > 1 || v->revision > 2) \ ? (_HSIZE1(x) * 10) / 16 : _HSIZE1(x)); break; \ case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \ case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \ case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \ } #define VSIZE1(x) _VSIZE1(c,x,v) #define _REFRESH_R(x) (x[1] & 0x3F) + 60 #define REFRESH_R _REFRESH_R(c) #define _ID_LOW(x) x[0] #define ID_LOW _ID_LOW(c) #define _ID_HIGH(x) (x[1] << 8) #define ID_HIGH _ID_HIGH(c) #define STD_TIMING_ID (ID_LOW | ID_HIGH) #define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN)) #define NEXT_STD_TIMING _NEXT_STD_TIMING(c) /* EDID Ver. >= 1.2 */ /** * Returns true if the pointer is the start of a monitor descriptor block * instead of a detailed timing descriptor. * * Checking the reserved pad fields for zeroes fails on some monitors with * broken empty ASCII strings. Only the first two bytes are reliable. */ #define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0) #define IS_MONITOR_DESC _IS_MONITOR_DESC(c) #define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000 #define PIXEL_CLOCK _PIXEL_CLOCK(c) #define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4)) #define H_ACTIVE _H_ACTIVE(c) #define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8)) #define H_BLANK _H_BLANK(c) #define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4)) #define V_ACTIVE _V_ACTIVE(c) #define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8)) #define V_BLANK _V_BLANK(c) #define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2)) #define H_SYNC_OFF _H_SYNC_OFF(c) #define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4)) #define H_SYNC_WIDTH _H_SYNC_WIDTH(c) #define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2)) #define V_SYNC_OFF _V_SYNC_OFF(c) #define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4)) #define V_SYNC_WIDTH _V_SYNC_WIDTH(c) #define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4)) #define H_SIZE _H_SIZE(c) #define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8)) #define V_SIZE _V_SIZE(c) #define _H_BORDER(x) (x[15]) #define H_BORDER _H_BORDER(c) #define _V_BORDER(x) (x[16]) #define V_BORDER _V_BORDER(c) #define _INTERLACED(x) ((x[17] & 0x80) >> 7) #define INTERLACED _INTERLACED(c) #define _STEREO(x) ((x[17] & 0x60) >> 5) #define STEREO _STEREO(c) #define _STEREO1(x) (x[17] & 0x1) #define STEREO1 _STEREO(c) #define _SYNC_T(x) ((x[17] & 0x18) >> 3) #define SYNC_T _SYNC_T(c) #define _MISC(x) ((x[17] & 0x06) >> 1) #define MISC _MISC(c) #define _MONITOR_DESC_TYPE(x) x[3] #define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c) #define SERIAL_NUMBER 0xFF #define ASCII_STR 0xFE #define MONITOR_RANGES 0xFD #define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255) #define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255) #define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255) #define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255) #define _MIN_V(x) x[5] #define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c)) #define _MAX_V(x) x[6] #define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c)) #define _MIN_H(x) x[7] #define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c)) #define _MAX_H(x) x[8] #define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c)) #define _MAX_CLOCK(x) x[9] #define MAX_CLOCK _MAX_CLOCK(c) #define _HAVE_2ND_GTF(x) (x[10] == 0x02) #define HAVE_2ND_GTF _HAVE_2ND_GTF(c) #define _F_2ND_GTF(x) (x[12] * 2) #define F_2ND_GTF _F_2ND_GTF(c) #define _C_2ND_GTF(x) (x[13] / 2) #define C_2ND_GTF _C_2ND_GTF(c) #define _M_2ND_GTF(x) (x[14] + (x[15] << 8)) #define M_2ND_GTF _M_2ND_GTF(c) #define _K_2ND_GTF(x) (x[16]) #define K_2ND_GTF _K_2ND_GTF(c) #define _J_2ND_GTF(x) (x[17] / 2) #define J_2ND_GTF _J_2ND_GTF(c) #define _HAVE_CVT(x) (x[10] == 0x04) #define HAVE_CVT _HAVE_CVT(c) #define _MAX_CLOCK_KHZ(x) (x[12] >> 2) #define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250) #define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8) #define MAXWIDTH _MAXWIDTH(c) #define _SUPPORTED_ASPECT(x) x[14] #define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c) #define SUPPORTED_ASPECT_4_3 0x80 #define SUPPORTED_ASPECT_16_9 0x40 #define SUPPORTED_ASPECT_16_10 0x20 #define SUPPORTED_ASPECT_5_4 0x10 #define SUPPORTED_ASPECT_15_9 0x08 #define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5) #define PREFERRED_ASPECT _PREFERRED_ASPECT(c) #define PREFERRED_ASPECT_4_3 0 #define PREFERRED_ASPECT_16_9 1 #define PREFERRED_ASPECT_16_10 2 #define PREFERRED_ASPECT_5_4 3 #define PREFERRED_ASPECT_15_9 4 #define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3) #define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c) #define CVT_STANDARD 0x01 #define CVT_REDUCED 0x02 #define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4) #define SUPPORTED_SCALING _SUPPORTED_SCALING(c) #define SCALING_HSHRINK 0x08 #define SCALING_HSTRETCH 0x04 #define SCALING_VSHRINK 0x02 #define SCALING_VSTRETCH 0x01 #define _PREFERRED_REFRESH(x) x[17] #define PREFERRED_REFRESH _PREFERRED_REFRESH(c) #define MONITOR_NAME 0xFC #define ADD_COLOR_POINT 0xFB #define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2)) #define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0)) #define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2)) #define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0)) #define _WHITE_INDEX1(x) x[5] #define WHITE_INDEX1 _WHITE_INDEX1(c) #define _WHITE_INDEX2(x) x[10] #define WHITE_INDEX2 _WHITE_INDEX2(c) #define WHITEX1 _WHITEX_ADD(c,6) #define WHITEY1 _WHITEY_ADD(c,6) #define WHITEX2 _WHITEX_ADD(c,12) #define WHITEY2 _WHITEY_ADD(c,12) #define _WHITE_GAMMA1(x) _GAMMA(x[9]) #define WHITE_GAMMA1 _WHITE_GAMMA1(c) #define _WHITE_GAMMA2(x) _GAMMA(x[14]) #define WHITE_GAMMA2 _WHITE_GAMMA2(c) #define ADD_STD_TIMINGS 0xFA #define COLOR_MANAGEMENT_DATA 0xF9 #define CVT_3BYTE_DATA 0xF8 #define ADD_EST_TIMINGS 0xF7 #define ADD_DUMMY 0x10 #define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN)) #define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c) #endif /* _PARSE_EDID_ */ /* input type */ #define DIGITAL(x) x /* DFP */ #define DFP1(x) x /* input voltage level */ #define V070 0 /* 0.700V/0.300V */ #define V071 1 /* 0.714V/0.286V */ #define V100 2 /* 1.000V/0.400V */ #define V007 3 /* 0.700V/0.000V */ /* Signal level setup */ #define SIG_SETUP(x) (x) /* sync characteristics */ #define SEP_SYNC(x) (x & 0x08) #define COMP_SYNC(x) (x & 0x04) #define SYNC_O_GREEN(x) (x & 0x02) #define SYNC_SERR(x) (x & 0x01) /* DPMS features */ #define DPMS_STANDBY(x) (x & 0x04) #define DPMS_SUSPEND(x) (x & 0x02) #define DPMS_OFF(x) (x & 0x01) /* display type, analog */ #define DISP_MONO 0 #define DISP_RGB 1 #define DISP_MULTCOLOR 2 /* display color encodings, digital */ #define DISP_YCRCB444 0x01 #define DISP_YCRCB422 0x02 /* Msc stuff EDID Ver > 1.1 */ #define STD_COLOR_SPACE(x) (x & 0x4) #define PREFERRED_TIMING_MODE(x) (x & 0x2) #define GFT_SUPPORTED(x) (x & 0x1) #define GTF_SUPPORTED(x) (x & 0x1) #define CVT_SUPPORTED(x) (x & 0x1) /* detailed timing misc */ #define IS_INTERLACED(x) (x) #define IS_STEREO(x) (x) #define IS_RIGHT_STEREO(x) (x & 0x01) #define IS_LEFT_STEREO(x) (x & 0x02) #define IS_4WAY_STEREO(x) (x & 0x03) #define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x) #define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x) typedef unsigned int Uint; typedef unsigned char Uchar; struct vendor { char name[4]; int prod_id; Uint serial; int week; int year; }; struct edid_version { int version; int revision; }; struct disp_features { unsigned int input_type:1; unsigned int input_voltage:2; unsigned int input_setup:1; unsigned int input_sync:5; unsigned int input_dfp:1; unsigned int input_bpc:3; unsigned int input_interface:4; /* 15 bit hole */ int hsize; int vsize; float gamma; unsigned int dpms:3; unsigned int display_type:2; unsigned int msc:3; float redx; float redy; float greenx; float greeny; float bluex; float bluey; float whitex; float whitey; }; struct established_timings { Uchar t1; Uchar t2; Uchar t_manu; }; struct std_timings { int hsize; int vsize; int refresh; CARD16 id; }; struct detailed_timings { int clock; int h_active; int h_blanking; int v_active; int v_blanking; int h_sync_off; int h_sync_width; int v_sync_off; int v_sync_width; int h_size; int v_size; int h_border; int v_border; unsigned int interlaced:1; unsigned int stereo:2; unsigned int sync:2; unsigned int misc:2; unsigned int stereo_1:1; }; #define DT 0 #define DS_SERIAL 0xFF #define DS_ASCII_STR 0xFE #define DS_NAME 0xFC #define DS_RANGES 0xFD #define DS_WHITE_P 0xFB #define DS_STD_TIMINGS 0xFA #define DS_CMD 0xF9 #define DS_CVT 0xF8 #define DS_EST_III 0xF7 #define DS_DUMMY 0x10 #define DS_UNKOWN 0x100 /* type is an int */ #define DS_VENDOR 0x101 #define DS_VENDOR_MAX 0x110 struct monitor_ranges { int min_v; int max_v; int min_h; int max_h; int max_clock; /* in mhz */ int gtf_2nd_f; int gtf_2nd_c; int gtf_2nd_m; int gtf_2nd_k; int gtf_2nd_j; int max_clock_khz; int maxwidth; /* in pixels */ char supported_aspect; char preferred_aspect; char supported_blanking; char supported_scaling; int preferred_refresh; /* in hz */ }; struct whitePoints { int index; float white_x; float white_y; float white_gamma; }; struct cvt_timings { int width; int height; int rate; int rates; }; /* * Be careful when adding new sections; this structure can't grow, it's * embedded in the middle of xf86Monitor which is ABI. Sizes below are * in bytes, for ILP32 systems. If all else fails just copy the section * literally like serial and friends. */ struct detailed_monitor_section { int type; union { struct detailed_timings d_timings; /* 56 */ Uchar serial[13]; Uchar ascii_data[13]; Uchar name[13]; struct monitor_ranges ranges; /* 56 */ struct std_timings std_t[5]; /* 80 */ struct whitePoints wp[2]; /* 32 */ /* color management data */ struct cvt_timings cvt[4]; /* 64 */ Uchar est_iii[6]; /* 6 */ } section; /* max: 80 */ }; /* flags */ #define MONITOR_EDID_COMPLETE_RAWDATA 0x01 /* old, don't use */ #define EDID_COMPLETE_RAWDATA 0x01 /* * For DisplayID devices, only the scrnIndex, flags, and rawData fields * are meaningful. For EDID, they all are. */ typedef struct { int scrnIndex; struct vendor vendor; struct edid_version ver; struct disp_features features; struct established_timings timings1; struct std_timings timings2[8]; struct detailed_monitor_section det_mon[4]; unsigned long flags; int no_sections; Uchar *rawData; } xf86Monitor, *xf86MonPtr; extern _X_EXPORT xf86MonPtr ConfiguredMonitor; #define EXT_TAG 0 #define EXT_REV 1 #define CEA_EXT 0x02 #define VTB_EXT 0x10 #define DI_EXT 0x40 #define LS_EXT 0x50 #define MI_EXT 0x60 #define CEA_EXT_MIN_DATA_OFFSET 4 #define CEA_EXT_MAX_DATA_OFFSET 127 #define CEA_EXT_DET_TIMING_NUM 6 #define IEEE_ID_HDMI 0x000C03 #define CEA_AUDIO_BLK 1 #define CEA_VIDEO_BLK 2 #define CEA_VENDOR_BLK 3 #define CEA_SPEAKER_ALLOC_BLK 4 #define CEA_VESA_DTC_BLK 5 #define VENDOR_SUPPORT_AI(x) ((x) >> 7) #define VENDOR_SUPPORT_DC_48bit(x) ( ( (x) >> 6) & 0x01) #define VENDOR_SUPPORT_DC_36bit(x) ( ( (x) >> 5) & 0x01) #define VENDOR_SUPPORT_DC_30bit(x) ( ( (x) >> 4) & 0x01) #define VENDOR_SUPPORT_DC_Y444(x) ( ( (x) >> 3) & 0x01) #define VENDOR_LATENCY_PRESENT(x) ( (x) >> 7) #define VENDOR_LATENCY_PRESENT_I(x) ( ( (x) >> 6) & 0x01) #define HDMI_MAX_TMDS_UNIT (5000) struct cea_video_block { Uchar video_code; }; struct cea_audio_block_descriptor { Uchar audio_code[3]; }; struct cea_audio_block { struct cea_audio_block_descriptor descriptor[10]; }; struct cea_vendor_block_hdmi { Uchar portB:4; Uchar portA:4; Uchar portD:4; Uchar portC:4; Uchar support_flags; Uchar max_tmds_clock; Uchar latency_present; Uchar video_latency; Uchar audio_latency; Uchar interlaced_video_latency; Uchar interlaced_audio_latency; }; struct cea_vendor_block { unsigned char ieee_id[3]; union { struct cea_vendor_block_hdmi hdmi; /* any other vendor blocks we know about */ }; }; struct cea_speaker_block { Uchar FLR:1; Uchar LFE:1; Uchar FC:1; Uchar RLR:1; Uchar RC:1; Uchar FLRC:1; Uchar RLRC:1; Uchar FLRW:1; Uchar FLRH:1; Uchar TC:1; Uchar FCH:1; Uchar Resv:5; Uchar ResvByte; }; struct cea_data_block { Uchar len:5; Uchar tag:3; union { struct cea_video_block video; struct cea_audio_block audio; struct cea_vendor_block vendor; struct cea_speaker_block speaker; } u; }; struct cea_ext_body { Uchar tag; Uchar rev; Uchar dt_offset; Uchar flags; struct cea_data_block data_collection; }; #endif /* _EDID_H_ */ xorg-server-1.20.8/hw/xfree86/ddc/meson.build0000644000175000017500000000047713640201473015617 00000000000000srcs_xorg_ddc = [ 'ddc.c', 'interpret_edid.c', 'print_edid.c', 'ddcProperty.c', ] xorg_ddc = static_library('xorg_ddc', srcs_xorg_ddc, include_directories: [inc, xorg_inc], dependencies: common_dep, c_args: xorg_c_args, ) install_data(['edid.h', 'xf86DDC.h'], install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/drivers/0000755000175000017500000000000013640201534014447 500000000000000xorg-server-1.20.8/hw/xfree86/drivers/Makefile.am0000644000175000017500000000010313640201473016417 00000000000000SUBDIRS = if XORG_DRIVER_MODESETTING SUBDIRS += modesetting endif xorg-server-1.20.8/hw/xfree86/drivers/modesetting/0000755000175000017500000000000013640201534016771 500000000000000xorg-server-1.20.8/hw/xfree86/drivers/modesetting/Makefile.am0000644000175000017500000000445513640201473020757 00000000000000# Copyright 2005 Adam Jackson. # # 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 # on the rights to use, copy, modify, merge, publish, distribute, sub # license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL # ADAM JACKSON 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 is obnoxious: # -module lets us name the module exactly how we want # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. include $(top_srcdir)/manpages.am AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS) AM_CPPFLAGS = \ $(XORG_INCS) \ -I$(top_srcdir)/glamor \ -I$(srcdir)/../../ddc \ -I$(srcdir)/../../dri2 \ -I$(srcdir)/../../i2c \ -I$(srcdir)/../../modes \ -I$(srcdir)/../../parser \ -I$(srcdir)/../../ramdac \ $(NULL) modesetting_drv_la_LTLIBRARIES = modesetting_drv.la modesetting_drv_la_LDFLAGS = -module -avoid-version modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS) modesetting_drv_ladir = @moduledir@/drivers modesetting_drv_la_SOURCES = \ dri2.c \ driver.c \ driver.h \ drmmode_display.c \ drmmode_display.h \ dumb_bo.c \ dumb_bo.h \ present.c \ vblank.c \ pageflip.c \ $(NULL) drivermandir = $(DRIVER_MAN_DIR) driverman_PRE = modesetting.man driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@) EXTRA_DIST = modesetting.man CLEANFILES = $(driverman_DATA) xorg-server-1.20.8/hw/xfree86/drivers/modesetting/dumb_bo.h0000644000175000017500000000322013640201473020470 00000000000000/* * Copyright © 2007 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. * * Authors: * Dave Airlie * */ #ifndef DUMB_BO_H #define DUMB_BO_H #include struct dumb_bo { uint32_t handle; uint32_t size; void *ptr; uint32_t pitch; }; struct dumb_bo *dumb_bo_create(int fd, const unsigned width, const unsigned height, const unsigned bpp); int dumb_bo_map(int fd, struct dumb_bo *bo); int dumb_bo_destroy(int fd, struct dumb_bo *bo); struct dumb_bo *dumb_get_bo_from_fd(int fd, int handle, int pitch, int size); #endif xorg-server-1.20.8/hw/xfree86/drivers/modesetting/dumb_bo.c0000644000175000017500000000626413640201473020476 00000000000000/* * Copyright © 2007 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. * * Authors: * Dave Airlie * */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include "dumb_bo.h" #include #include #include #include #include #include #include struct dumb_bo * dumb_bo_create(int fd, const unsigned width, const unsigned height, const unsigned bpp) { struct drm_mode_create_dumb arg; struct dumb_bo *bo; int ret; bo = calloc(1, sizeof(*bo)); if (!bo) return NULL; memset(&arg, 0, sizeof(arg)); arg.width = width; arg.height = height; arg.bpp = bpp; ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg); if (ret) goto err_free; bo->handle = arg.handle; bo->size = arg.size; bo->pitch = arg.pitch; return bo; err_free: free(bo); return NULL; } int dumb_bo_map(int fd, struct dumb_bo *bo) { struct drm_mode_map_dumb arg; int ret; void *map; if (bo->ptr) { return 0; } memset(&arg, 0, sizeof(arg)); arg.handle = bo->handle; ret = drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg); if (ret) return ret; map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, arg.offset); if (map == MAP_FAILED) return -errno; bo->ptr = map; return 0; } int dumb_bo_destroy(int fd, struct dumb_bo *bo) { struct drm_mode_destroy_dumb arg; int ret; if (bo->ptr) { munmap(bo->ptr, bo->size); bo->ptr = NULL; } memset(&arg, 0, sizeof(arg)); arg.handle = bo->handle; ret = drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg); if (ret) return -errno; free(bo); return 0; } struct dumb_bo * dumb_get_bo_from_fd(int fd, int handle, int pitch, int size) { struct dumb_bo *bo; int ret; bo = calloc(1, sizeof(*bo)); if (!bo) return NULL; ret = drmPrimeFDToHandle(fd, handle, &bo->handle); if (ret) { free(bo); return NULL; } bo->pitch = pitch; bo->size = size; return bo; } xorg-server-1.20.8/hw/xfree86/drivers/modesetting/driver.c0000644000175000017500000014531513640201473020363 00000000000000/* * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. * Copyright 2011 Dave Airlie * 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, sub license, 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 NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Original Author: Alan Hourihane * Rewrite: Dave Airlie * */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSproc.h" #include "compiler.h" #include "xf86Pci.h" #include "mipointer.h" #include "micmap.h" #include #include "fb.h" #include "edid.h" #include "xf86i2c.h" #include "xf86Crtc.h" #include "miscstruct.h" #include "dixstruct.h" #include "shadow.h" #include "xf86xv.h" #include #include #ifdef XSERVER_PLATFORM_BUS #include "xf86platformBus.h" #endif #ifdef XSERVER_LIBPCIACCESS #include #endif #include "driver.h" static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y); static Bool CloseScreen(ScreenPtr pScreen); static Bool EnterVT(ScrnInfoPtr pScrn); static void Identify(int flags); static const OptionInfoRec *AvailableOptions(int chipid, int busid); static ModeStatus ValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags); static void FreeScreen(ScrnInfoPtr pScrn); static void LeaveVT(ScrnInfoPtr pScrn); static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv); static Bool PreInit(ScrnInfoPtr pScrn, int flags); static Bool Probe(DriverPtr drv, int flags); static Bool ms_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data); static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data); #ifdef XSERVER_LIBPCIACCESS static const struct pci_id_match ms_device_match[] = { { PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0x00030000, 0x00ff0000, 0}, {0, 0, 0}, }; #endif #ifndef XSERVER_PLATFORM_BUS struct xf86_platform_device; #endif #ifdef XSERVER_PLATFORM_BUS static Bool ms_platform_probe(DriverPtr driver, int entity_num, int flags, struct xf86_platform_device *device, intptr_t match_data); #endif _X_EXPORT DriverRec modesetting = { 1, "modesetting", Identify, Probe, AvailableOptions, NULL, 0, ms_driver_func, ms_device_match, ms_pci_probe, #ifdef XSERVER_PLATFORM_BUS ms_platform_probe, #endif }; static SymTabRec Chipsets[] = { {0, "kms"}, {-1, NULL} }; static const OptionInfoRec Options[] = { {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_DEVICE_PATH, "kmsdev", OPTV_STRING, {0}, FALSE}, {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, FALSE}, {OPTION_PAGEFLIP, "PageFlip", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_ZAPHOD_HEADS, "ZaphodHeads", OPTV_STRING, {0}, FALSE}, {OPTION_DOUBLE_SHADOW, "DoubleShadow", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_ATOMIC, "Atomic", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; int ms_entity_index = -1; static MODULESETUPPROTO(Setup); static XF86ModuleVersionInfo VersRec = { "modesetting", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, MOD_CLASS_VIDEODRV, {0, 0, 0, 0} }; _X_EXPORT XF86ModuleData modesettingModuleData = { &VersRec, Setup, NULL }; static void * Setup(void *module, void *opts, int *errmaj, int *errmin) { static Bool setupDone = 0; /* This module should be loaded only once, but check to be sure. */ if (!setupDone) { setupDone = 1; xf86AddDriver(&modesetting, module, HaveDriverFuncs); /* * The return value must be non-NULL on success even though there * is no TearDownProc. */ return (void *) 1; } else { if (errmaj) *errmaj = LDR_ONCEONLY; return NULL; } } static void Identify(int flags) { xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers", Chipsets); } modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn) { DevUnion *pPriv; modesettingPtr ms = modesettingPTR(scrn); pPriv = xf86GetEntityPrivate(ms->pEnt->index, ms_entity_index); return pPriv->ptr; } static int get_passed_fd(void) { if (xf86DRMMasterFd >= 0) { xf86DrvMsg(-1, X_INFO, "Using passed DRM master file descriptor %d\n", xf86DRMMasterFd); return dup(xf86DRMMasterFd); } return -1; } static int open_hw(const char *dev) { int fd; if ((fd = get_passed_fd()) != -1) return fd; if (dev) fd = open(dev, O_RDWR | O_CLOEXEC, 0); else { dev = getenv("KMSDEVICE"); if ((NULL == dev) || ((fd = open(dev, O_RDWR | O_CLOEXEC, 0)) == -1)) { dev = "/dev/dri/card0"; fd = open(dev, O_RDWR | O_CLOEXEC, 0); } } if (fd == -1) xf86DrvMsg(-1, X_ERROR, "open %s: %s\n", dev, strerror(errno)); return fd; } static int check_outputs(int fd, int *count) { drmModeResPtr res = drmModeGetResources(fd); int ret; if (!res) return FALSE; if (count) *count = res->count_connectors; ret = res->count_connectors > 0; #if defined(GLAMOR_HAS_GBM_LINEAR) if (ret == FALSE) { uint64_t value = 0; if (drmGetCap(fd, DRM_CAP_PRIME, &value) == 0 && (value & DRM_PRIME_CAP_EXPORT)) ret = TRUE; } #endif drmModeFreeResources(res); return ret; } static Bool probe_hw(const char *dev, struct xf86_platform_device *platform_dev) { int fd; #ifdef XF86_PDEV_SERVER_FD if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) { fd = xf86_platform_device_odev_attributes(platform_dev)->fd; if (fd == -1) return FALSE; return check_outputs(fd, NULL); } #endif fd = open_hw(dev); if (fd != -1) { int ret = check_outputs(fd, NULL); close(fd); return ret; } return FALSE; } static char * ms_DRICreatePCIBusID(const struct pci_device *dev) { char *busID; if (asprintf(&busID, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus, dev->dev, dev->func) == -1) return NULL; return busID; } static Bool probe_hw_pci(const char *dev, struct pci_device *pdev) { int ret = FALSE, fd = open_hw(dev); char *id, *devid; drmSetVersion sv; if (fd == -1) return FALSE; sv.drm_di_major = 1; sv.drm_di_minor = 4; sv.drm_dd_major = -1; sv.drm_dd_minor = -1; if (drmSetInterfaceVersion(fd, &sv)) { close(fd); return FALSE; } id = drmGetBusid(fd); devid = ms_DRICreatePCIBusID(pdev); if (id && devid && !strcmp(id, devid)) ret = check_outputs(fd, NULL); close(fd); free(id); free(devid); return ret; } static const OptionInfoRec * AvailableOptions(int chipid, int busid) { return Options; } static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data) { xorgHWFlags *flag; switch (op) { case GET_REQUIRED_HW_INTERFACES: flag = (CARD32 *) data; (*flag) = 0; return TRUE; case SUPPORTS_SERVER_FDS: return TRUE; default: return FALSE; } } static void ms_setup_scrn_hooks(ScrnInfoPtr scrn) { scrn->driverVersion = 1; scrn->driverName = "modesetting"; scrn->name = "modeset"; scrn->Probe = NULL; scrn->PreInit = PreInit; scrn->ScreenInit = ScreenInit; scrn->SwitchMode = SwitchMode; scrn->AdjustFrame = AdjustFrame; scrn->EnterVT = EnterVT; scrn->LeaveVT = LeaveVT; scrn->FreeScreen = FreeScreen; scrn->ValidMode = ValidMode; } static void ms_setup_entity(ScrnInfoPtr scrn, int entity_num) { DevUnion *pPriv; xf86SetEntitySharable(entity_num); if (ms_entity_index == -1) ms_entity_index = xf86AllocateEntityPrivateIndex(); pPriv = xf86GetEntityPrivate(entity_num, ms_entity_index); xf86SetEntityInstanceForScreen(scrn, entity_num, xf86GetNumEntityInstances(entity_num) - 1); if (!pPriv->ptr) pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1); } #ifdef XSERVER_LIBPCIACCESS static Bool ms_pci_probe(DriverPtr driver, int entity_num, struct pci_device *dev, intptr_t match_data) { ScrnInfoPtr scrn = NULL; scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL, NULL, NULL, NULL, NULL, NULL); if (scrn) { const char *devpath; GDevPtr devSection = xf86GetDevFromEntity(scrn->entityList[0], scrn->entityInstanceList[0]); devpath = xf86FindOptionValue(devSection->options, "kmsdev"); if (probe_hw_pci(devpath, dev)) { ms_setup_scrn_hooks(scrn); xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "claimed PCI slot %d@%d:%d:%d\n", dev->bus, dev->domain, dev->dev, dev->func); xf86DrvMsg(scrn->scrnIndex, X_INFO, "using %s\n", devpath ? devpath : "default device"); ms_setup_entity(scrn, entity_num); } else scrn = NULL; } return scrn != NULL; } #endif #ifdef XSERVER_PLATFORM_BUS static Bool ms_platform_probe(DriverPtr driver, int entity_num, int flags, struct xf86_platform_device *dev, intptr_t match_data) { ScrnInfoPtr scrn = NULL; const char *path = xf86_platform_device_odev_attributes(dev)->path; int scr_flags = 0; if (flags & PLATFORM_PROBE_GPU_SCREEN) scr_flags = XF86_ALLOCATE_GPU_SCREEN; if (probe_hw(path, dev)) { scrn = xf86AllocateScreen(driver, scr_flags); if (xf86IsEntitySharable(entity_num)) xf86SetEntityShared(entity_num); xf86AddEntityToScreen(scrn, entity_num); ms_setup_scrn_hooks(scrn); xf86DrvMsg(scrn->scrnIndex, X_INFO, "using drv %s\n", path ? path : "default device"); ms_setup_entity(scrn, entity_num); } return scrn != NULL; } #endif static Bool Probe(DriverPtr drv, int flags) { int i, numDevSections; GDevPtr *devSections; Bool foundScreen = FALSE; const char *dev; ScrnInfoPtr scrn = NULL; /* For now, just bail out for PROBE_DETECT. */ if (flags & PROBE_DETECT) return FALSE; /* * Find the config file Device sections that match this * driver, and return if there are none. */ if ((numDevSections = xf86MatchDevice("modesetting", &devSections)) <= 0) { return FALSE; } for (i = 0; i < numDevSections; i++) { int entity_num; dev = xf86FindOptionValue(devSections[i]->options, "kmsdev"); if (probe_hw(dev, NULL)) { entity_num = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE); scrn = xf86ConfigFbEntity(scrn, 0, entity_num, NULL, NULL, NULL, NULL); } if (scrn) { foundScreen = TRUE; ms_setup_scrn_hooks(scrn); scrn->Probe = Probe; xf86DrvMsg(scrn->scrnIndex, X_INFO, "using %s\n", dev ? dev : "default device"); ms_setup_entity(scrn, entity_num); } } free(devSections); return foundScreen; } static Bool GetRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate) return TRUE; pScrn->driverPrivate = xnfcalloc(sizeof(modesettingRec), 1); return TRUE; } static int dispatch_dirty_region(ScrnInfoPtr scrn, PixmapPtr pixmap, DamagePtr damage, int fb_id) { modesettingPtr ms = modesettingPTR(scrn); RegionPtr dirty = DamageRegion(damage); unsigned num_cliprects = REGION_NUM_RECTS(dirty); int ret = 0; if (num_cliprects) { drmModeClip *clip = xallocarray(num_cliprects, sizeof(drmModeClip)); BoxPtr rect = REGION_RECTS(dirty); int i; if (!clip) return -ENOMEM; /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { clip[i].x1 = rect->x1; clip[i].y1 = rect->y1; clip[i].x2 = rect->x2; clip[i].y2 = rect->y2; } /* TODO query connector property to see if this is needed */ ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects); /* if we're swamping it with work, try one at a time */ if (ret == -EINVAL) { for (i = 0; i < num_cliprects; i++) { if ((ret = drmModeDirtyFB(ms->fd, fb_id, &clip[i], 1)) < 0) break; } } free(clip); DamageEmpty(damage); } return ret; } static void dispatch_dirty(ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(scrn); PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen); int fb_id = ms->drmmode.fb_id; int ret; ret = dispatch_dirty_region(scrn, pixmap, ms->damage, fb_id); if (ret == -EINVAL || ret == -ENOSYS) { ms->dirty_enabled = FALSE; DamageUnregister(ms->damage); DamageDestroy(ms->damage); ms->damage = NULL; xf86DrvMsg(scrn->scrnIndex, X_INFO, "Disabling kernel dirty updates, not required.\n"); return; } } static void dispatch_dirty_pixmap(ScrnInfoPtr scrn, xf86CrtcPtr crtc, PixmapPtr ppix) { modesettingPtr ms = modesettingPTR(scrn); msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, ppix); DamagePtr damage = ppriv->slave_damage; int fb_id = ppriv->fb_id; dispatch_dirty_region(scrn, ppix, damage, fb_id); } static void dispatch_slave_dirty(ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); 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]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (!drmmode_crtc) continue; if (drmmode_crtc->prime_pixmap) dispatch_dirty_pixmap(scrn, crtc, drmmode_crtc->prime_pixmap); if (drmmode_crtc->prime_pixmap_back) dispatch_dirty_pixmap(scrn, crtc, drmmode_crtc->prime_pixmap_back); } } static void redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout) { RegionRec pixregion; PixmapRegionInit(&pixregion, dirty->slave_dst); DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion); PixmapSyncDirtyHelper(dirty); if (!screen->isGPU) { #ifdef GLAMOR_HAS_GBM modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); /* * When copying from the master framebuffer to the shared pixmap, * we must ensure the copy is complete before the slave starts a * copy to its own framebuffer (some slaves scanout directly from * the shared pixmap, but not all). */ if (ms->drmmode.glamor) glamor_finish(screen); #endif /* Ensure the slave processes the damage immediately */ if (timeout) *timeout = 0; } DamageRegionProcessPending(&dirty->slave_dst->drawable); RegionUninit(&pixregion); } static void ms_dirty_update(ScreenPtr screen, int *timeout) { modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); RegionPtr region; PixmapDirtyUpdatePtr ent; if (xorg_list_is_empty(&screen->pixmap_dirty_list)) return; xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) { region = DamageRegion(ent->damage); if (RegionNotEmpty(region)) { if (!screen->isGPU) { msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, ent->slave_dst->master_pixmap); if (ppriv->notify_on_damage) { ppriv->notify_on_damage = FALSE; ent->slave_dst->drawable.pScreen-> SharedPixmapNotifyDamage(ent->slave_dst); } /* Requested manual updating */ if (ppriv->defer_dirty_update) continue; } redisplay_dirty(screen, ent, timeout); DamageEmpty(ent->damage); } } } static PixmapDirtyUpdatePtr ms_dirty_get_ent(ScreenPtr screen, PixmapPtr slave_dst) { PixmapDirtyUpdatePtr ent; if (xorg_list_is_empty(&screen->pixmap_dirty_list)) return NULL; xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) { if (ent->slave_dst == slave_dst) return ent; } return NULL; } static void msBlockHandler(ScreenPtr pScreen, void *timeout) { modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); pScreen->BlockHandler = ms->BlockHandler; pScreen->BlockHandler(pScreen, timeout); ms->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = msBlockHandler; if (pScreen->isGPU && !ms->drmmode.reverse_prime_offload_mode) dispatch_slave_dirty(pScreen); else if (ms->dirty_enabled) dispatch_dirty(pScreen); ms_dirty_update(pScreen, timeout); } static void msBlockHandler_oneshot(ScreenPtr pScreen, void *pTimeout) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); msBlockHandler(pScreen, pTimeout); drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE); } static void FreeRec(ScrnInfoPtr pScrn) { modesettingPtr ms; if (!pScrn) return; ms = modesettingPTR(pScrn); if (!ms) return; if (ms->fd > 0) { modesettingEntPtr ms_ent; int ret; ms_ent = ms_ent_priv(pScrn); ms_ent->fd_ref--; if (!ms_ent->fd_ref) { if (ms->pEnt->location.type == BUS_PCI) ret = drmClose(ms->fd); else #ifdef XF86_PDEV_SERVER_FD if (!(ms->pEnt->location.type == BUS_PLATFORM && (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))) #endif ret = close(ms->fd); (void) ret; ms_ent->fd = 0; } } pScrn->driverPrivate = NULL; free(ms->drmmode.Options); free(ms); } static void try_enable_glamor(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); const char *accel_method_str = xf86GetOptValString(ms->drmmode.Options, OPTION_ACCEL_METHOD); Bool do_glamor = (!accel_method_str || strcmp(accel_method_str, "glamor") == 0); ms->drmmode.glamor = FALSE; #ifdef GLAMOR_HAS_GBM if (ms->drmmode.force_24_32) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cannot use glamor with 24bpp packed fb\n"); return; } if (!do_glamor) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "glamor disabled\n"); return; } if (xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME)) { if (glamor_egl_init(pScrn, ms->fd)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n"); ms->drmmode.glamor = TRUE; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "glamor initialization failed\n"); } } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to load glamor module.\n"); } #else if (do_glamor) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No glamor support in the X Server\n"); } #endif } static Bool msShouldDoubleShadow(ScrnInfoPtr pScrn, modesettingPtr ms) { Bool ret = FALSE, asked; int from; drmVersionPtr v = drmGetVersion(ms->fd); if (!ms->drmmode.shadow_enable) return FALSE; if (!strcmp(v->name, "mgag200") || !strcmp(v->name, "ast")) /* XXX || rn50 */ ret = TRUE; drmFreeVersion(v); asked = xf86GetOptValBool(ms->drmmode.Options, OPTION_DOUBLE_SHADOW, &ret); if (asked) from = X_CONFIG; else from = X_INFO; xf86DrvMsg(pScrn->scrnIndex, from, "Double-buffered shadow updates: %s\n", ret ? "on" : "off"); return ret; } static Bool ms_get_drm_master_fd(ScrnInfoPtr pScrn) { EntityInfoPtr pEnt; modesettingPtr ms; modesettingEntPtr ms_ent; ms = modesettingPTR(pScrn); ms_ent = ms_ent_priv(pScrn); pEnt = ms->pEnt; if (ms_ent->fd) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, " reusing fd for second head\n"); ms->fd = ms_ent->fd; ms_ent->fd_ref++; return TRUE; } ms->fd_passed = FALSE; if ((ms->fd = get_passed_fd()) >= 0) { ms->fd_passed = TRUE; return TRUE; } #ifdef XSERVER_PLATFORM_BUS if (pEnt->location.type == BUS_PLATFORM) { #ifdef XF86_PDEV_SERVER_FD if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD) ms->fd = xf86_platform_device_odev_attributes(pEnt->location.id.plat)-> fd; else #endif { char *path = xf86_platform_device_odev_attributes(pEnt->location.id.plat)-> path; ms->fd = open_hw(path); } } else #endif #ifdef XSERVER_LIBPCIACCESS if (pEnt->location.type == BUS_PCI) { char *BusID = NULL; struct pci_device *PciInfo; PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); if (PciInfo) { if ((BusID = ms_DRICreatePCIBusID(PciInfo)) != NULL) { ms->fd = drmOpen(NULL, BusID); free(BusID); } } } else #endif { const char *devicename; devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev"); ms->fd = open_hw(devicename); } if (ms->fd < 0) return FALSE; ms_ent->fd = ms->fd; ms_ent->fd_ref = 1; return TRUE; } static Bool PreInit(ScrnInfoPtr pScrn, int flags) { modesettingPtr ms; rgb defaultWeight = { 0, 0, 0 }; EntityInfoPtr pEnt; uint64_t value = 0; int ret; int bppflags, connector_count; int defaultdepth, defaultbpp; if (pScrn->numEntities != 1) return FALSE; if (flags & PROBE_DETECT) { return FALSE; } /* Allocate driverPrivate */ if (!GetRec(pScrn)) return FALSE; pEnt = xf86GetEntityInfo(pScrn->entityList[0]); ms = modesettingPTR(pScrn); ms->SaveGeneration = -1; ms->pEnt = pEnt; ms->drmmode.is_secondary = FALSE; pScrn->displayWidth = 640; /* default it */ if (xf86IsEntityShared(pScrn->entityList[0])) { if (xf86IsPrimInitDone(pScrn->entityList[0])) ms->drmmode.is_secondary = TRUE; else xf86SetPrimInitDone(pScrn->entityList[0]); } pScrn->monitor = pScrn->confScreen->monitor; pScrn->progClock = TRUE; pScrn->rgbBits = 8; if (!ms_get_drm_master_fd(pScrn)) return FALSE; ms->drmmode.fd = ms->fd; if (!check_outputs(ms->fd, &connector_count)) return FALSE; drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp); if (defaultdepth == 24 && defaultbpp == 24) { ms->drmmode.force_24_32 = TRUE; ms->drmmode.kbpp = 24; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using 24bpp hw front buffer with 32bpp shadow\n"); defaultbpp = 32; } else { ms->drmmode.kbpp = 0; } bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb; if (!xf86SetDepthBpp (pScrn, defaultdepth, defaultdepth, defaultbpp, bppflags)) return FALSE; switch (pScrn->depth) { case 15: case 16: case 24: case 30: break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by the driver\n", pScrn->depth); return FALSE; } xf86PrintDepthBpp(pScrn); if (!ms->drmmode.kbpp) ms->drmmode.kbpp = pScrn->bitsPerPixel; /* Process the options */ xf86CollectOptions(pScrn, NULL); if (!(ms->drmmode.Options = malloc(sizeof(Options)))) return FALSE; memcpy(ms->drmmode.Options, Options, sizeof(Options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->drmmode.Options); if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; if (xf86ReturnOptValBool(ms->drmmode.Options, OPTION_SW_CURSOR, FALSE)) { ms->drmmode.sw_cursor = TRUE; } ms->cursor_width = 64; ms->cursor_height = 64; ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_WIDTH, &value); if (!ret) { ms->cursor_width = value; } ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_HEIGHT, &value); if (!ret) { ms->cursor_height = value; } try_enable_glamor(pScrn); if (!ms->drmmode.glamor) { Bool prefer_shadow = TRUE; if (ms->drmmode.force_24_32) { prefer_shadow = TRUE; ms->drmmode.shadow_enable = TRUE; } else { ret = drmGetCap(ms->fd, DRM_CAP_DUMB_PREFER_SHADOW, &value); if (!ret) { prefer_shadow = !!value; } ms->drmmode.shadow_enable = xf86ReturnOptValBool(ms->drmmode.Options, OPTION_SHADOW_FB, prefer_shadow); } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB: preferred %s, enabled %s\n", prefer_shadow ? "YES" : "NO", ms->drmmode.force_24_32 ? "FORCE" : ms->drmmode.shadow_enable ? "YES" : "NO"); ms->drmmode.shadow_enable2 = msShouldDoubleShadow(pScrn, ms); } ms->drmmode.pageflip = xf86ReturnOptValBool(ms->drmmode.Options, OPTION_PAGEFLIP, TRUE); pScrn->capabilities = 0; ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value); if (ret == 0) { if (connector_count && (value & DRM_PRIME_CAP_IMPORT)) { pScrn->capabilities |= RR_Capability_SinkOutput; if (ms->drmmode.glamor) pScrn->capabilities |= RR_Capability_SinkOffload; } #ifdef GLAMOR_HAS_GBM_LINEAR if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor) pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload; #endif } if (xf86ReturnOptValBool(ms->drmmode.Options, OPTION_ATOMIC, FALSE)) { ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 1); ms->atomic_modeset = (ret == 0); } else { ms->atomic_modeset = FALSE; } ms->kms_has_modifiers = FALSE; ret = drmGetCap(ms->fd, DRM_CAP_ADDFB2_MODIFIERS, &value); if (ret == 0 && value != 0) ms->kms_has_modifiers = TRUE; if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n"); goto fail; } /* * If the driver can do gamma correction, it should call xf86SetGamma() here. */ { Gamma zeros = { 0.0, 0.0, 0.0 }; if (!xf86SetGamma(pScrn, zeros)) { return FALSE; } } if (!(pScrn->is_gpu && connector_count == 0) && pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n"); return FALSE; } pScrn->currentMode = pScrn->modes; /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); /* Load the required sub modules */ if (!xf86LoadSubModule(pScrn, "fb")) { return FALSE; } if (ms->drmmode.shadow_enable) { if (!xf86LoadSubModule(pScrn, "shadow")) { return FALSE; } } return TRUE; fail: return FALSE; } static void * msShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode, CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(pScrn); int stride; stride = (pScrn->displayWidth * ms->drmmode.kbpp) / 8; *size = stride; return ((uint8_t *) ms->drmmode.front_bo.dumb->ptr + row * stride + offset); } /* somewhat arbitrary tile size, in pixels */ #define TILE 16 static int msUpdateIntersect(modesettingPtr ms, shadowBufPtr pBuf, BoxPtr box, xRectangle *prect) { int i, dirty = 0, stride = pBuf->pPixmap->devKind, cpp = ms->drmmode.cpp; int width = (box->x2 - box->x1) * cpp; unsigned char *old, *new; old = ms->drmmode.shadow_fb2; old += (box->y1 * stride) + (box->x1 * cpp); new = ms->drmmode.shadow_fb; new += (box->y1 * stride) + (box->x1 * cpp); for (i = box->y2 - box->y1 - 1; i >= 0; i--) { unsigned char *o = old + i * stride, *n = new + i * stride; if (memcmp(o, n, width) != 0) { dirty = 1; memcpy(o, n, width); } } if (dirty) { prect->x = box->x1; prect->y = box->y1; prect->width = box->x2 - box->x1; prect->height = box->y2 - box->y1; } return dirty; } static void msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); Bool use_3224 = ms->drmmode.force_24_32 && pScrn->bitsPerPixel == 32; if (ms->drmmode.shadow_enable2 && ms->drmmode.shadow_fb2) do { RegionPtr damage = DamageRegion(pBuf->pDamage), tiles; BoxPtr extents = RegionExtents(damage); xRectangle *prect; int nrects; int i, j, tx1, tx2, ty1, ty2; tx1 = extents->x1 / TILE; tx2 = (extents->x2 + TILE - 1) / TILE; ty1 = extents->y1 / TILE; ty2 = (extents->y2 + TILE - 1) / TILE; nrects = (tx2 - tx1) * (ty2 - ty1); if (!(prect = calloc(nrects, sizeof(xRectangle)))) break; nrects = 0; for (j = ty2 - 1; j >= ty1; j--) { for (i = tx2 - 1; i >= tx1; i--) { BoxRec box; box.x1 = max(i * TILE, extents->x1); box.y1 = max(j * TILE, extents->y1); box.x2 = min((i+1) * TILE, extents->x2); box.y2 = min((j+1) * TILE, extents->y2); if (RegionContainsRect(damage, &box) != rgnOUT) { if (msUpdateIntersect(ms, pBuf, &box, prect + nrects)) { nrects++; } } } } tiles = RegionFromRects(nrects, prect, CT_NONE); RegionIntersect(damage, damage, tiles); RegionDestroy(tiles); free(prect); } while (0); if (use_3224) shadowUpdate32to24(pScreen, pBuf); else shadowUpdatePacked(pScreen, pBuf); } static Bool msEnableSharedPixmapFlipping(RRCrtcPtr crtc, PixmapPtr front, PixmapPtr back) { ScreenPtr screen = crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); EntityInfoPtr pEnt = ms->pEnt; xf86CrtcPtr xf86Crtc = crtc->devPrivate; if (!xf86Crtc) return FALSE; /* Not supported if we can't flip */ if (!ms->drmmode.pageflip) return FALSE; /* Not currently supported with reverse PRIME */ if (ms->drmmode.reverse_prime_offload_mode) return FALSE; #ifdef XSERVER_PLATFORM_BUS if (pEnt->location.type == BUS_PLATFORM) { char *syspath = xf86_platform_device_odev_attributes(pEnt->location.id.plat)-> syspath; /* Not supported for devices using USB transport due to misbehaved * vblank events */ if (syspath && strstr(syspath, "usb")) return FALSE; /* EVDI uses USB transport but is platform device, not usb. * Blacklist it explicitly */ if (syspath && strstr(syspath, "evdi")) return FALSE; } #endif return drmmode_EnableSharedPixmapFlipping(xf86Crtc, &ms->drmmode, front, back); } static void msDisableSharedPixmapFlipping(RRCrtcPtr crtc) { ScreenPtr screen = crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); xf86CrtcPtr xf86Crtc = crtc->devPrivate; if (xf86Crtc) drmmode_DisableSharedPixmapFlipping(xf86Crtc, &ms->drmmode); } static Bool msStartFlippingPixmapTracking(RRCrtcPtr crtc, DrawablePtr src, PixmapPtr slave_dst1, PixmapPtr slave_dst2, int x, int y, int dst_x, int dst_y, Rotation rotation) { ScreenPtr pScreen = src->pScreen; modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); msPixmapPrivPtr ppriv1 = msGetPixmapPriv(&ms->drmmode, slave_dst1->master_pixmap), ppriv2 = msGetPixmapPriv(&ms->drmmode, slave_dst2->master_pixmap); if (!PixmapStartDirtyTracking(src, slave_dst1, x, y, dst_x, dst_y, rotation)) { return FALSE; } if (!PixmapStartDirtyTracking(src, slave_dst2, x, y, dst_x, dst_y, rotation)) { PixmapStopDirtyTracking(src, slave_dst1); return FALSE; } ppriv1->slave_src = src; ppriv2->slave_src = src; ppriv1->dirty = ms_dirty_get_ent(pScreen, slave_dst1); ppriv2->dirty = ms_dirty_get_ent(pScreen, slave_dst2); ppriv1->defer_dirty_update = TRUE; ppriv2->defer_dirty_update = TRUE; return TRUE; } static Bool msPresentSharedPixmap(PixmapPtr slave_dst) { ScreenPtr pScreen = slave_dst->master_pixmap->drawable.pScreen; modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, slave_dst->master_pixmap); RegionPtr region = DamageRegion(ppriv->dirty->damage); if (RegionNotEmpty(region)) { redisplay_dirty(ppriv->slave_src->pScreen, ppriv->dirty, NULL); DamageEmpty(ppriv->dirty->damage); return TRUE; } return FALSE; } static Bool msStopFlippingPixmapTracking(DrawablePtr src, PixmapPtr slave_dst1, PixmapPtr slave_dst2) { ScreenPtr pScreen = src->pScreen; modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); msPixmapPrivPtr ppriv1 = msGetPixmapPriv(&ms->drmmode, slave_dst1->master_pixmap), ppriv2 = msGetPixmapPriv(&ms->drmmode, slave_dst2->master_pixmap); Bool ret = TRUE; ret &= PixmapStopDirtyTracking(src, slave_dst1); ret &= PixmapStopDirtyTracking(src, slave_dst2); if (ret) { ppriv1->slave_src = NULL; ppriv2->slave_src = NULL; ppriv1->dirty = NULL; ppriv2->dirty = NULL; ppriv1->defer_dirty_update = FALSE; ppriv2->defer_dirty_update = FALSE; } return ret; } static Bool CreateScreenResources(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); PixmapPtr rootPixmap; Bool ret; void *pixels = NULL; int err; pScreen->CreateScreenResources = ms->createScreenResources; ret = pScreen->CreateScreenResources(pScreen); pScreen->CreateScreenResources = CreateScreenResources; if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, pScrn->is_gpu)) return FALSE; if (!drmmode_glamor_handle_new_screen_pixmap(&ms->drmmode)) return FALSE; drmmode_uevent_init(pScrn, &ms->drmmode); if (!ms->drmmode.sw_cursor) drmmode_map_cursor_bos(pScrn, &ms->drmmode); if (!ms->drmmode.gbm) { pixels = drmmode_map_front_bo(&ms->drmmode); if (!pixels) return FALSE; } rootPixmap = pScreen->GetScreenPixmap(pScreen); if (ms->drmmode.shadow_enable) pixels = ms->drmmode.shadow_fb; if (ms->drmmode.shadow_enable2) { ms->drmmode.shadow_fb2 = calloc(1, pScrn->displayWidth * pScrn->virtualY * ((pScrn->bitsPerPixel + 7) >> 3)); if (!ms->drmmode.shadow_fb2) ms->drmmode.shadow_enable2 = FALSE; } if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, pixels)) FatalError("Couldn't adjust screen pixmap\n"); if (ms->drmmode.shadow_enable) { if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked, msShadowWindow, 0, 0)) return FALSE; } err = drmModeDirtyFB(ms->fd, ms->drmmode.fb_id, NULL, 0); if (err != -EINVAL && err != -ENOSYS) { ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, pScreen, rootPixmap); if (ms->damage) { DamageRegister(&rootPixmap->drawable, ms->damage); ms->dirty_enabled = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n"); } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to create screen damage record\n"); return FALSE; } } if (dixPrivateKeyRegistered(rrPrivKey)) { rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); pScrPriv->rrEnableSharedPixmapFlipping = msEnableSharedPixmapFlipping; pScrPriv->rrDisableSharedPixmapFlipping = msDisableSharedPixmapFlipping; pScrPriv->rrStartFlippingPixmapTracking = msStartFlippingPixmapTracking; } return ret; } static Bool msShadowInit(ScreenPtr pScreen) { if (!shadowSetup(pScreen)) { return FALSE; } return TRUE; } static Bool msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle) { #ifdef GLAMOR_HAS_GBM int ret; CARD16 stride; CARD32 size; ret = glamor_shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix, &stride, &size); if (ret == -1) return FALSE; *handle = (void *)(long)(ret); return TRUE; #endif return FALSE; } static Bool msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle) { #ifdef GLAMOR_HAS_GBM ScreenPtr screen = ppix->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); Bool ret; int ihandle = (int) (long) fd_handle; if (ihandle == -1) if (!ms->drmmode.reverse_prime_offload_mode) return drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, 0, 0); if (ms->drmmode.reverse_prime_offload_mode) { ret = glamor_back_pixmap_from_fd(ppix, ihandle, ppix->drawable.width, ppix->drawable.height, ppix->devKind, ppix->drawable.depth, ppix->drawable.bitsPerPixel); } else { int size = ppix->devKind * ppix->drawable.height; ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size); } if (ret == FALSE) return ret; return TRUE; #else return FALSE; #endif } static Bool msRequestSharedPixmapNotifyDamage(PixmapPtr ppix) { ScreenPtr screen = ppix->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, ppix->master_pixmap); ppriv->notify_on_damage = TRUE; return TRUE; } static Bool msSharedPixmapNotifyDamage(PixmapPtr ppix) { Bool ret = FALSE; int c; ScreenPtr screen = ppix->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, ppix); if (!ppriv->wait_for_damage) return ret; ppriv->wait_for_damage = FALSE; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (!drmmode_crtc) continue; if (!(drmmode_crtc->prime_pixmap && drmmode_crtc->prime_pixmap_back)) continue; // Received damage on master screen pixmap, schedule present on vblank ret |= drmmode_SharedPixmapPresentOnVBlank(ppix, crtc, &ms->drmmode); } return ret; } static Bool SetMaster(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); int ret; #ifdef XF86_PDEV_SERVER_FD if (ms->pEnt->location.type == BUS_PLATFORM && (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)) return TRUE; #endif if (ms->fd_passed) return TRUE; ret = drmSetMaster(ms->fd); if (ret) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "drmSetMaster failed: %s\n", strerror(errno)); return ret == 0; } /* When the root window is created, initialize the screen contents from * console if -background none was specified on the command line */ static Bool CreateWindow_oneshot(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); Bool ret; pScreen->CreateWindow = ms->CreateWindow; ret = pScreen->CreateWindow(pWin); if (ret) drmmode_copy_fb(pScrn, &ms->drmmode); return ret; } static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); VisualPtr visual; pScrn->pScreen = pScreen; if (!SetMaster(pScrn)) return FALSE; #ifdef GLAMOR_HAS_GBM if (ms->drmmode.glamor) ms->drmmode.gbm = glamor_egl_get_gbm_device(pScreen); #endif /* HW dependent - FIXME */ pScrn->displayWidth = pScrn->virtualX; if (!drmmode_create_initial_bos(pScrn, &ms->drmmode)) return FALSE; if (ms->drmmode.shadow_enable) { ms->drmmode.shadow_fb = calloc(1, pScrn->displayWidth * pScrn->virtualY * ((pScrn->bitsPerPixel + 7) >> 3)); if (!ms->drmmode.shadow_fb) ms->drmmode.shadow_enable = FALSE; } miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; if (!miSetPixmapDepths()) return FALSE; if (!dixRegisterScreenSpecificPrivateKey (pScreen, &ms->drmmode.pixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof(msPixmapPrivRec))) { return FALSE; } pScrn->memPhysBase = 0; pScrn->fbOffset = 0; if (!fbScreenInit(pScreen, NULL, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { if ((visual->class | DynamicClass) == DirectColor) { visual->offsetRed = pScrn->offset.red; visual->offsetGreen = pScrn->offset.green; visual->offsetBlue = pScrn->offset.blue; visual->redMask = pScrn->mask.red; visual->greenMask = pScrn->mask.green; visual->blueMask = pScrn->mask.blue; } } } fbPictureInit(pScreen, NULL, 0); if (drmmode_init(pScrn, &ms->drmmode) == FALSE) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize glamor at ScreenInit() time.\n"); return FALSE; } if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "shadow fb init failed\n"); return FALSE; } ms->createScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = CreateScreenResources; xf86SetBlackWhitePixels(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); /* Need to extend HWcursor support to handle mask interleave */ if (!ms->drmmode.sw_cursor) xf86_cursors_init(pScreen, ms->cursor_width, ms->cursor_height, HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_UPDATE_UNHIDDEN | HARDWARE_CURSOR_ARGB); /* Must force it before EnterVT, so we are in control of VT and * later memory should be bound when allocating, e.g rotate_mem */ pScrn->vtSema = TRUE; if (serverGeneration == 1 && bgNoneRoot && ms->drmmode.glamor) { ms->CreateWindow = pScreen->CreateWindow; pScreen->CreateWindow = CreateWindow_oneshot; } pScreen->SaveScreen = xf86SaveScreen; ms->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = CloseScreen; ms->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = msBlockHandler_oneshot; pScreen->SharePixmapBacking = msSharePixmapBacking; pScreen->SetSharedPixmapBacking = msSetSharedPixmapBacking; pScreen->StartPixmapTracking = PixmapStartDirtyTracking; pScreen->StopPixmapTracking = PixmapStopDirtyTracking; pScreen->SharedPixmapNotifyDamage = msSharedPixmapNotifyDamage; pScreen->RequestSharedPixmapNotifyDamage = msRequestSharedPixmapNotifyDamage; pScreen->PresentSharedPixmap = msPresentSharedPixmap; pScreen->StopFlippingPixmapTracking = msStopFlippingPixmapTracking; if (!xf86CrtcScreenInit(pScreen)) return FALSE; if (!drmmode_setup_colormap(pScreen, pScrn)) return FALSE; if (ms->atomic_modeset) xf86DPMSInit(pScreen, drmmode_set_dpms, 0); else xf86DPMSInit(pScreen, xf86DPMSSet, 0); #ifdef GLAMOR_HAS_GBM if (ms->drmmode.glamor) { XF86VideoAdaptorPtr glamor_adaptor; glamor_adaptor = glamor_xv_init(pScreen, 16); if (glamor_adaptor != NULL) xf86XVScreenInit(pScreen, &glamor_adaptor, 1); else xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize XV support.\n"); } #endif if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); if (!ms_vblank_screen_init(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize vblank support.\n"); return FALSE; } #ifdef GLAMOR_HAS_GBM if (ms->drmmode.glamor) { if (!(ms->drmmode.dri2_enable = ms_dri2_screen_init(pScreen))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize the DRI2 extension.\n"); } if (!(ms->drmmode.present_enable = ms_present_screen_init(pScreen))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize the Present extension.\n"); } /* enable reverse prime if we are a GPU screen, and accelerated, and not * i915. i915 is happy scanning out from sysmem. */ if (pScreen->isGPU) { drmVersionPtr version; /* enable if we are an accelerated GPU screen */ ms->drmmode.reverse_prime_offload_mode = TRUE; /* disable if we detect i915 */ if ((version = drmGetVersion(ms->drmmode.fd))) { if (!strncmp("i915", version->name, version->name_len)) { ms->drmmode.reverse_prime_offload_mode = FALSE; } drmFreeVersion(version); } } } #endif pScrn->vtSema = TRUE; return TRUE; } static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y) { modesettingPtr ms = modesettingPTR(pScrn); drmmode_adjust_frame(pScrn, &ms->drmmode, x, y); } static void FreeScreen(ScrnInfoPtr pScrn) { FreeRec(pScrn); } static void LeaveVT(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); xf86_hide_cursors(pScrn); pScrn->vtSema = FALSE; #ifdef XF86_PDEV_SERVER_FD if (ms->pEnt->location.type == BUS_PLATFORM && (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)) return; #endif if (!ms->fd_passed) drmDropMaster(ms->fd); } /* * This gets called when gaining control of the VT, and from ScreenInit(). */ static Bool EnterVT(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); pScrn->vtSema = TRUE; SetMaster(pScrn); if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE)) return FALSE; return TRUE; } static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { return xf86SetSingleMode(pScrn, mode, RR_Rotate_0); } static Bool CloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); modesettingEntPtr ms_ent = ms_ent_priv(pScrn); /* Clear mask of assigned crtc's in this generation */ ms_ent->assigned_crtcs = 0; #ifdef GLAMOR_HAS_GBM if (ms->drmmode.dri2_enable) { ms_dri2_close_screen(pScreen); } #endif ms_vblank_close_screen(pScreen); if (ms->damage) { DamageUnregister(ms->damage); DamageDestroy(ms->damage); ms->damage = NULL; } if (ms->drmmode.shadow_enable) { shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); free(ms->drmmode.shadow_fb); ms->drmmode.shadow_fb = NULL; free(ms->drmmode.shadow_fb2); ms->drmmode.shadow_fb2 = NULL; } drmmode_uevent_fini(pScrn, &ms->drmmode); drmmode_free_bos(pScrn, &ms->drmmode); if (pScrn->vtSema) { LeaveVT(pScrn); } pScreen->CreateScreenResources = ms->createScreenResources; pScreen->BlockHandler = ms->BlockHandler; pScrn->vtSema = FALSE; pScreen->CloseScreen = ms->CloseScreen; return (*pScreen->CloseScreen) (pScreen); } static ModeStatus ValidMode(ScrnInfoPtr arg, DisplayModePtr mode, Bool verbose, int flags) { return MODE_OK; } xorg-server-1.20.8/hw/xfree86/drivers/modesetting/drmmode_display.h0000644000175000017500000002144113640201473022242 00000000000000/* * Copyright © 2007 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. * * Authors: * Dave Airlie * */ #ifndef DRMMODE_DISPLAY_H #define DRMMODE_DISPLAY_H #include "xf86drmMode.h" #ifdef CONFIG_UDEV_KMS #include "libudev.h" #endif #include "dumb_bo.h" struct gbm_device; enum drmmode_plane_property { DRMMODE_PLANE_TYPE = 0, DRMMODE_PLANE_FB_ID, DRMMODE_PLANE_IN_FORMATS, DRMMODE_PLANE_CRTC_ID, DRMMODE_PLANE_SRC_X, DRMMODE_PLANE_SRC_Y, DRMMODE_PLANE_SRC_W, DRMMODE_PLANE_SRC_H, DRMMODE_PLANE_CRTC_X, DRMMODE_PLANE_CRTC_Y, DRMMODE_PLANE_CRTC_W, DRMMODE_PLANE_CRTC_H, DRMMODE_PLANE__COUNT }; enum drmmode_plane_type { DRMMODE_PLANE_TYPE_PRIMARY = 0, DRMMODE_PLANE_TYPE_CURSOR, DRMMODE_PLANE_TYPE_OVERLAY, DRMMODE_PLANE_TYPE__COUNT }; enum drmmode_connector_property { DRMMODE_CONNECTOR_CRTC_ID, DRMMODE_CONNECTOR__COUNT }; enum drmmode_crtc_property { DRMMODE_CRTC_ACTIVE, DRMMODE_CRTC_MODE_ID, DRMMODE_CRTC__COUNT }; typedef struct { uint32_t width; uint32_t height; struct dumb_bo *dumb; #ifdef GLAMOR_HAS_GBM Bool used_modifiers; struct gbm_bo *gbm; #endif } drmmode_bo; typedef struct { int fd; unsigned fb_id; drmModeFBPtr mode_fb; int cpp; int kbpp; ScrnInfoPtr scrn; struct gbm_device *gbm; #ifdef CONFIG_UDEV_KMS struct udev_monitor *uevent_monitor; InputHandlerProc uevent_handler; #endif drmEventContext event_context; drmmode_bo front_bo; Bool sw_cursor; /* Broken-out options. */ OptionInfoPtr Options; Bool glamor; Bool shadow_enable; Bool shadow_enable2; /** Is Option "PageFlip" enabled? */ Bool pageflip; Bool force_24_32; void *shadow_fb; void *shadow_fb2; DevPrivateKeyRec pixmapPrivateKeyRec; Bool reverse_prime_offload_mode; Bool is_secondary; PixmapPtr fbcon_pixmap; Bool dri2_flipping; Bool present_flipping; Bool dri2_enable; Bool present_enable; } drmmode_rec, *drmmode_ptr; typedef struct { const char *name; Bool valid; uint64_t value; } drmmode_prop_enum_info_rec, *drmmode_prop_enum_info_ptr; typedef struct { const char *name; uint32_t prop_id; unsigned int num_enum_values; drmmode_prop_enum_info_rec *enum_values; } drmmode_prop_info_rec, *drmmode_prop_info_ptr; typedef struct { drmModeModeInfo mode_info; uint32_t blob_id; struct xorg_list entry; } drmmode_mode_rec, *drmmode_mode_ptr; typedef struct { uint32_t format; uint32_t num_modifiers; uint64_t *modifiers; } drmmode_format_rec, *drmmode_format_ptr; typedef struct { drmmode_ptr drmmode; drmModeCrtcPtr mode_crtc; uint32_t vblank_pipe; int dpms_mode; struct dumb_bo *cursor_bo; Bool cursor_up; uint16_t lut_r[256], lut_g[256], lut_b[256]; drmmode_prop_info_rec props[DRMMODE_CRTC__COUNT]; drmmode_prop_info_rec props_plane[DRMMODE_PLANE__COUNT]; uint32_t plane_id; drmmode_mode_ptr current_mode; uint32_t num_formats; drmmode_format_rec *formats; drmmode_bo rotate_bo; unsigned rotate_fb_id; PixmapPtr prime_pixmap; PixmapPtr prime_pixmap_back; unsigned prime_pixmap_x; /** * @{ MSC (vblank count) handling for the PRESENT extension. * * The kernel's vblank counters are 32 bits and apparently full of * lies, and we need to give a reliable 64-bit msc for GL, so we * have to track and convert to a userland-tracked 64-bit msc. */ uint32_t msc_prev; uint64_t msc_high; /** @} */ Bool need_modeset; struct xorg_list mode_list; Bool enable_flipping; Bool flipping_active; } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr; typedef struct { drmModePropertyPtr mode_prop; uint64_t value; int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */ Atom *atoms; } drmmode_prop_rec, *drmmode_prop_ptr; typedef struct { drmmode_ptr drmmode; int output_id; drmModeConnectorPtr mode_output; drmModeEncoderPtr *mode_encoders; drmModePropertyBlobPtr edid_blob; drmModePropertyBlobPtr tile_blob; int dpms_enum_id; int dpms; int num_props; drmmode_prop_ptr props; drmmode_prop_info_rec props_connector[DRMMODE_CONNECTOR__COUNT]; int enc_mask; int enc_clone_mask; xf86CrtcPtr current_crtc; } drmmode_output_private_rec, *drmmode_output_private_ptr; typedef struct { uint32_t lessee_id; } drmmode_lease_private_rec, *drmmode_lease_private_ptr; typedef struct _msPixmapPriv { uint32_t fb_id; struct dumb_bo *backing_bo; /* if this pixmap is backed by a dumb bo */ DamagePtr slave_damage; /** Sink fields for flipping shared pixmaps */ int flip_seq; /* seq of current page flip event handler */ Bool wait_for_damage; /* if we have requested damage notification from source */ /** Source fields for flipping shared pixmaps */ Bool defer_dirty_update; /* if we want to manually update */ PixmapDirtyUpdatePtr dirty; /* cached dirty ent to avoid searching list */ DrawablePtr slave_src; /* if we exported shared pixmap, dirty tracking src */ Bool notify_on_damage; /* if sink has requested damage notification */ } msPixmapPrivRec, *msPixmapPrivPtr; extern DevPrivateKeyRec msPixmapPrivateKeyRec; #define msPixmapPrivateKey (&msPixmapPrivateKeyRec) #define msGetPixmapPriv(drmmode, p) ((msPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &(drmmode)->pixmapPrivateKeyRec)) Bool drmmode_is_format_supported(ScrnInfoPtr scrn, uint32_t format, uint64_t modifier); int drmmode_bo_import(drmmode_ptr drmmode, drmmode_bo *bo, uint32_t *fb_id); int drmmode_bo_destroy(drmmode_ptr drmmode, drmmode_bo *bo); uint32_t drmmode_bo_get_pitch(drmmode_bo *bo); uint32_t drmmode_bo_get_handle(drmmode_bo *bo); Bool drmmode_glamor_handle_new_screen_pixmap(drmmode_ptr drmmode); void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv); Bool drmmode_SetSlaveBO(PixmapPtr ppix, drmmode_ptr drmmode, int fd_handle, int pitch, int size); Bool drmmode_EnableSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode, PixmapPtr front, PixmapPtr back); Bool drmmode_SharedPixmapPresentOnVBlank(PixmapPtr frontTarget, xf86CrtcPtr crtc, drmmode_ptr drmmode); Bool drmmode_SharedPixmapFlip(PixmapPtr frontTarget, xf86CrtcPtr crtc, drmmode_ptr drmmode); void drmmode_DisableSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode); extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp); extern Bool drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode); void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y); extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw); extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn); extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode); extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode); Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode); void *drmmode_map_front_bo(drmmode_ptr drmmode); Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode); void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode); void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth, int *bpp); void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode); int drmmode_crtc_flip(xf86CrtcPtr crtc, uint32_t fb_id, uint32_t flags, void *data); void drmmode_set_dpms(ScrnInfoPtr scrn, int PowerManagementMode, int flags); #endif xorg-server-1.20.8/hw/xfree86/drivers/modesetting/Makefile.in0000644000175000017500000011243713640201512020762 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright 2005 Adam Jackson. # # 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 # on the rights to use, copy, modify, merge, publish, distribute, sub # license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL # ADAM JACKSON 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 is obnoxious: # -module lets us name the module exactly how we want # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/drivers/modesetting ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(modesetting_drv_ladir)" \ "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" LTLIBRARIES = $(modesetting_drv_la_LTLIBRARIES) am__DEPENDENCIES_1 = modesetting_drv_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_modesetting_drv_la_OBJECTS = dri2.lo driver.lo drmmode_display.lo \ dumb_bo.lo present.lo vblank.lo pageflip.lo modesetting_drv_la_OBJECTS = $(am_modesetting_drv_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = modesetting_drv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(modesetting_drv_la_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dri2.Plo ./$(DEPDIR)/driver.Plo \ ./$(DEPDIR)/drmmode_display.Plo ./$(DEPDIR)/dumb_bo.Plo \ ./$(DEPDIR)/pageflip.Plo ./$(DEPDIR)/present.Plo \ ./$(DEPDIR)/vblank.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(modesetting_drv_la_SOURCES) DIST_SOURCES = $(modesetting_drv_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) EXTRA_DIST = modesetting.man CLEANFILES = $(driverman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS) AM_CPPFLAGS = \ $(XORG_INCS) \ -I$(top_srcdir)/glamor \ -I$(srcdir)/../../ddc \ -I$(srcdir)/../../dri2 \ -I$(srcdir)/../../i2c \ -I$(srcdir)/../../modes \ -I$(srcdir)/../../parser \ -I$(srcdir)/../../ramdac \ $(NULL) modesetting_drv_la_LTLIBRARIES = modesetting_drv.la modesetting_drv_la_LDFLAGS = -module -avoid-version modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS) modesetting_drv_ladir = @moduledir@/drivers modesetting_drv_la_SOURCES = \ dri2.c \ driver.c \ driver.h \ drmmode_display.c \ drmmode_display.h \ dumb_bo.c \ dumb_bo.h \ present.c \ vblank.c \ pageflip.c \ $(NULL) driverman_PRE = modesetting.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/drivers/modesetting/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/drivers/modesetting/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-modesetting_drv_laLTLIBRARIES: $(modesetting_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(modesetting_drv_la_LTLIBRARIES)'; test -n "$(modesetting_drv_ladir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(modesetting_drv_ladir)'"; \ $(MKDIR_P) "$(DESTDIR)$(modesetting_drv_ladir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(modesetting_drv_ladir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(modesetting_drv_ladir)"; \ } uninstall-modesetting_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(modesetting_drv_la_LTLIBRARIES)'; test -n "$(modesetting_drv_ladir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(modesetting_drv_ladir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(modesetting_drv_ladir)/$$f"; \ done clean-modesetting_drv_laLTLIBRARIES: -test -z "$(modesetting_drv_la_LTLIBRARIES)" || rm -f $(modesetting_drv_la_LTLIBRARIES) @list='$(modesetting_drv_la_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } modesetting_drv.la: $(modesetting_drv_la_OBJECTS) $(modesetting_drv_la_DEPENDENCIES) $(EXTRA_modesetting_drv_la_DEPENDENCIES) $(AM_V_CCLD)$(modesetting_drv_la_LINK) -rpath $(modesetting_drv_ladir) $(modesetting_drv_la_OBJECTS) $(modesetting_drv_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driver.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drmmode_display.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumb_bo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pageflip.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/present.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vblank.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: for dir in "$(DESTDIR)$(modesetting_drv_ladir)" "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool \ clean-modesetting_drv_laLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/dri2.Plo -rm -f ./$(DEPDIR)/driver.Plo -rm -f ./$(DEPDIR)/drmmode_display.Plo -rm -f ./$(DEPDIR)/dumb_bo.Plo -rm -f ./$(DEPDIR)/pageflip.Plo -rm -f ./$(DEPDIR)/present.Plo -rm -f ./$(DEPDIR)/vblank.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-modesetting_drv_laLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/dri2.Plo -rm -f ./$(DEPDIR)/driver.Plo -rm -f ./$(DEPDIR)/drmmode_display.Plo -rm -f ./$(DEPDIR)/dumb_bo.Plo -rm -f ./$(DEPDIR)/pageflip.Plo -rm -f ./$(DEPDIR)/present.Plo -rm -f ./$(DEPDIR)/vblank.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA uninstall-modesetting_drv_laLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool \ clean-modesetting_drv_laLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-appmanDATA \ install-data install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man \ install-modesetting_drv_laLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-appmanDATA \ uninstall-drivermanDATA uninstall-filemanDATA \ uninstall-modesetting_drv_laLTLIBRARIES .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/drivers/modesetting/present.c0000644000175000017500000002611313640201473020542 00000000000000/* * Copyright © 2014 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. */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "driver.h" #include "drmmode_display.h" #if 0 #define DebugPresent(x) ErrorF x #else #define DebugPresent(x) #endif struct ms_present_vblank_event { uint64_t event_id; Bool unflip; }; static RRCrtcPtr ms_present_get_crtc(WindowPtr window) { return ms_randr_crtc_covering_drawable(&window->drawable); } static int ms_present_get_ust_msc(RRCrtcPtr crtc, CARD64 *ust, CARD64 *msc) { xf86CrtcPtr xf86_crtc = crtc->devPrivate; return ms_get_crtc_ust_msc(xf86_crtc, ust, msc); } /* * Called when the queued vblank event has occurred */ static void ms_present_vblank_handler(uint64_t msc, uint64_t usec, void *data) { struct ms_present_vblank_event *event = data; DebugPresent(("\t\tmh %lld msc %llu\n", (long long) event->event_id, (long long) msc)); present_event_notify(event->event_id, usec, msc); free(event); } /* * Called when the queued vblank is aborted */ static void ms_present_vblank_abort(void *data) { struct ms_present_vblank_event *event = data; DebugPresent(("\t\tma %lld\n", (long long) event->event_id)); free(event); } /* * Queue an event to report back to the Present extension when the specified * MSC has past */ static int ms_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { xf86CrtcPtr xf86_crtc = crtc->devPrivate; struct ms_present_vblank_event *event; uint32_t seq; event = calloc(sizeof(struct ms_present_vblank_event), 1); if (!event) return BadAlloc; event->event_id = event_id; seq = ms_drm_queue_alloc(xf86_crtc, event, ms_present_vblank_handler, ms_present_vblank_abort); if (!seq) { free(event); return BadAlloc; } if (!ms_queue_vblank(xf86_crtc, MS_QUEUE_ABSOLUTE, msc, NULL, seq)) return BadAlloc; DebugPresent(("\t\tmq %lld seq %u msc %llu (hw msc %u)\n", (long long) event_id, seq, (long long) msc, vbl.request.sequence)); return Success; } static Bool ms_present_event_match(void *data, void *match_data) { struct ms_present_vblank_event *event = data; uint64_t *match = match_data; return *match == event->event_id; } /* * Remove a pending vblank event from the DRM queue so that it is not reported * to the extension */ static void ms_present_abort_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { ScreenPtr screen = crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); ms_drm_abort(scrn, ms_present_event_match, &event_id); } /* * Flush our batch buffer when requested by the Present extension. */ static void ms_present_flush(WindowPtr window) { #ifdef GLAMOR_HAS_GBM ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); if (ms->drmmode.glamor) glamor_block_handler(screen); #endif } #ifdef GLAMOR_HAS_GBM /** * Callback for the DRM event queue when a flip has completed on all pipes * * Notify the extension code */ static void ms_present_flip_handler(modesettingPtr ms, uint64_t msc, uint64_t ust, void *data) { struct ms_present_vblank_event *event = data; DebugPresent(("\t\tms:fc %lld msc %llu ust %llu\n", (long long) event->event_id, (long long) msc, (long long) ust)); if (event->unflip) ms->drmmode.present_flipping = FALSE; ms_present_vblank_handler(msc, ust, event); } /* * Callback for the DRM queue abort code. A flip has been aborted. */ static void ms_present_flip_abort(modesettingPtr ms, void *data) { struct ms_present_vblank_event *event = data; DebugPresent(("\t\tms:fa %lld\n", (long long) event->event_id)); free(event); } /* * Test to see if page flipping is possible on the target crtc */ static Bool ms_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip, PresentFlipReason *reason) { ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int num_crtcs_on = 0; int i; struct gbm_bo *gbm; if (!ms->drmmode.pageflip) return FALSE; if (ms->drmmode.dri2_flipping) return FALSE; if (!scrn->vtSema) return FALSE; for (i = 0; i < config->num_crtc; i++) { drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private; /* Don't do pageflipping if CRTCs are rotated. */ if (drmmode_crtc->rotate_bo.gbm) return FALSE; if (ms_crtc_on(config->crtc[i])) num_crtcs_on++; } /* We can't do pageflipping if all the CRTCs are off. */ if (num_crtcs_on == 0) return FALSE; /* Check stride, can't change that on flip */ if (!ms->atomic_modeset && pixmap->devKind != drmmode_bo_get_pitch(&ms->drmmode.front_bo)) return FALSE; #ifdef GBM_BO_WITH_MODIFIERS /* Check if buffer format/modifier is supported by all active CRTCs */ gbm = glamor_gbm_bo_from_pixmap(screen, pixmap); if (gbm) { uint32_t format; uint64_t modifier; format = gbm_bo_get_format(gbm); modifier = gbm_bo_get_modifier(gbm); gbm_bo_destroy(gbm); if (!drmmode_is_format_supported(scrn, format, modifier)) { if (reason) *reason = PRESENT_FLIP_REASON_BUFFER_FORMAT; return FALSE; } } #endif /* Make sure there's a bo we can get to */ /* XXX: actually do this. also...is it sufficient? * if (!glamor_get_pixmap_private(pixmap)) * return FALSE; */ return TRUE; } /* * Queue a flip on 'crtc' to 'pixmap' at 'target_msc'. If 'sync_flip' is true, * then wait for vblank. Otherwise, flip immediately */ static Bool ms_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc, PixmapPtr pixmap, Bool sync_flip) { ScreenPtr screen = crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); xf86CrtcPtr xf86_crtc = crtc->devPrivate; drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private; Bool ret; struct ms_present_vblank_event *event; if (!ms_present_check_flip(crtc, screen->root, pixmap, sync_flip, NULL)) return FALSE; event = calloc(1, sizeof(struct ms_present_vblank_event)); if (!event) return FALSE; DebugPresent(("\t\tms:pf %lld msc %llu\n", (long long) event_id, (long long) target_msc)); event->event_id = event_id; event->unflip = FALSE; ret = ms_do_pageflip(screen, pixmap, event, drmmode_crtc->vblank_pipe, !sync_flip, ms_present_flip_handler, ms_present_flip_abort); if (!ret) xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n"); else ms->drmmode.present_flipping = TRUE; return ret; } /* * Queue a flip back to the normal frame buffer */ static void ms_present_unflip(ScreenPtr screen, uint64_t event_id) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); PixmapPtr pixmap = screen->GetScreenPixmap(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int i; struct ms_present_vblank_event *event; event = calloc(1, sizeof(struct ms_present_vblank_event)); if (!event) return; event->event_id = event_id; event->unflip = TRUE; if (ms_present_check_flip(NULL, screen->root, pixmap, TRUE, NULL) && ms_do_pageflip(screen, pixmap, event, -1, FALSE, ms_present_flip_handler, ms_present_flip_abort)) { return; } for (i = 0; i < config->num_crtc; i++) { xf86CrtcPtr crtc = config->crtc[i]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (!crtc->enabled) continue; /* info->drmmode.fb_id still points to the FB for the last flipped BO. * Clear it, drmmode_set_mode_major will re-create it */ if (drmmode_crtc->drmmode->fb_id) { drmModeRmFB(drmmode_crtc->drmmode->fd, drmmode_crtc->drmmode->fb_id); drmmode_crtc->drmmode->fb_id = 0; } if (drmmode_crtc->dpms_mode == DPMSModeOn) crtc->funcs->set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); else drmmode_crtc->need_modeset = TRUE; } present_event_notify(event_id, 0, 0); ms->drmmode.present_flipping = FALSE; } #endif static present_screen_info_rec ms_present_screen_info = { .version = PRESENT_SCREEN_INFO_VERSION, .get_crtc = ms_present_get_crtc, .get_ust_msc = ms_present_get_ust_msc, .queue_vblank = ms_present_queue_vblank, .abort_vblank = ms_present_abort_vblank, .flush = ms_present_flush, .capabilities = PresentCapabilityNone, #ifdef GLAMOR_HAS_GBM .check_flip = NULL, .check_flip2 = ms_present_check_flip, .flip = ms_present_flip, .unflip = ms_present_unflip, #endif }; Bool ms_present_screen_init(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); uint64_t value; int ret; ret = drmGetCap(ms->fd, DRM_CAP_ASYNC_PAGE_FLIP, &value); if (ret == 0 && value == 1) ms_present_screen_info.capabilities |= PresentCapabilityAsync; return present_screen_init(screen, &ms_present_screen_info); } xorg-server-1.20.8/hw/xfree86/drivers/modesetting/drmmode_display.c0000644000175000017500000035373313640201473022251 00000000000000/* * Copyright © 2007 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. * * Authors: * Dave Airlie * */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include #include #include #include #include "dumb_bo.h" #include "xf86str.h" #include "X11/Xatom.h" #include "mi.h" #include "micmap.h" #include "xf86cmap.h" #include "xf86DDC.h" #include #include #include #include "xf86Crtc.h" #include "drmmode_display.h" #include "present.h" #include #include #include "driver.h" static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height); static PixmapPtr drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData); static inline uint32_t * formats_ptr(struct drm_format_modifier_blob *blob) { return (uint32_t *)(((char *)blob) + blob->formats_offset); } static inline struct drm_format_modifier * modifiers_ptr(struct drm_format_modifier_blob *blob) { return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset); } static uint32_t get_opaque_format(uint32_t format) { switch (format) { case DRM_FORMAT_ARGB8888: return DRM_FORMAT_XRGB8888; case DRM_FORMAT_ARGB2101010: return DRM_FORMAT_XRGB2101010; default: return format; } } Bool drmmode_is_format_supported(ScrnInfoPtr scrn, uint32_t format, uint64_t modifier) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c, i, j; /* BO are imported as opaque surface, so let's pretend there is no alpha */ format = get_opaque_format(format); for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; Bool found = FALSE; if (!crtc->enabled) continue; if (drmmode_crtc->num_formats == 0) continue; for (i = 0; i < drmmode_crtc->num_formats; i++) { drmmode_format_ptr iter = &drmmode_crtc->formats[i]; if (iter->format != format) continue; if (modifier == DRM_FORMAT_MOD_INVALID || iter->num_modifiers == 0) { found = TRUE; break; } for (j = 0; j < iter->num_modifiers; j++) { if (iter->modifiers[j] == modifier) { found = TRUE; break; } } break; } if (!found) return FALSE; } return TRUE; } #ifdef GBM_BO_WITH_MODIFIERS static uint32_t get_modifiers_set(ScrnInfoPtr scrn, uint32_t format, uint64_t **modifiers, Bool enabled_crtc_only, Bool exclude_multiplane) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); modesettingPtr ms = modesettingPTR(scrn); drmmode_ptr drmmode = &ms->drmmode; int c, i, j, k, count_modifiers = 0; uint64_t *tmp, *ret = NULL; /* BOs are imported as opaque surfaces, so pretend the same thing here */ format = get_opaque_format(format); *modifiers = NULL; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (enabled_crtc_only && !crtc->enabled) continue; for (i = 0; i < drmmode_crtc->num_formats; i++) { drmmode_format_ptr iter = &drmmode_crtc->formats[i]; if (iter->format != format) continue; for (j = 0; j < iter->num_modifiers; j++) { Bool found = FALSE; /* Don't choose multi-plane formats for our screen pixmap. * These will get used with frontbuffer rendering, which will * lead to worse-than-tearing with multi-plane formats, as the * primary and auxiliary planes go out of sync. */ if (exclude_multiplane && gbm_device_get_format_modifier_plane_count(drmmode->gbm, format, iter->modifiers[j]) > 1) { continue; } for (k = 0; k < count_modifiers; k++) { if (iter->modifiers[j] == ret[k]) found = TRUE; } if (!found) { count_modifiers++; tmp = realloc(ret, count_modifiers * sizeof(uint64_t)); if (!tmp) { free(ret); return 0; } ret = tmp; ret[count_modifiers - 1] = iter->modifiers[j]; } } } } *modifiers = ret; return count_modifiers; } static Bool get_drawable_modifiers(DrawablePtr draw, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers) { ScrnInfoPtr scrn = xf86ScreenToScrn(draw->pScreen); modesettingPtr ms = modesettingPTR(scrn); if (!present_can_window_flip((WindowPtr) draw) || !ms->drmmode.pageflip || ms->drmmode.dri2_flipping || !scrn->vtSema) { *num_modifiers = 0; *modifiers = NULL; return TRUE; } *num_modifiers = get_modifiers_set(scrn, format, modifiers, TRUE, FALSE); return TRUE; } #endif static Bool drmmode_zaphod_string_matches(ScrnInfoPtr scrn, const char *s, char *output_name) { char **token = xstrtokenize(s, ", \t\n\r"); Bool ret = FALSE; if (!token) return FALSE; for (int i = 0; token[i]; i++) { if (strcmp(token[i], output_name) == 0) ret = TRUE; free(token[i]); } free(token); return ret; } static uint64_t drmmode_prop_get_value(drmmode_prop_info_ptr info, drmModeObjectPropertiesPtr props, uint64_t def) { unsigned int i; if (info->prop_id == 0) return def; for (i = 0; i < props->count_props; i++) { unsigned int j; if (props->props[i] != info->prop_id) continue; /* Simple (non-enum) types can return the value directly */ if (info->num_enum_values == 0) return props->prop_values[i]; /* Map from raw value to enum value */ for (j = 0; j < info->num_enum_values; j++) { if (!info->enum_values[j].valid) continue; if (info->enum_values[j].value != props->prop_values[i]) continue; return j; } } return def; } static uint32_t drmmode_prop_info_update(drmmode_ptr drmmode, drmmode_prop_info_ptr info, unsigned int num_infos, drmModeObjectProperties *props) { drmModePropertyRes *prop; uint32_t valid_mask = 0; unsigned i, j; assert(num_infos <= 32 && "update return type"); for (i = 0; i < props->count_props; i++) { Bool props_incomplete = FALSE; unsigned int k; for (j = 0; j < num_infos; j++) { if (info[j].prop_id == props->props[i]) break; if (!info[j].prop_id) props_incomplete = TRUE; } /* We've already discovered this property. */ if (j != num_infos) continue; /* We haven't found this property ID, but as we've already * found all known properties, we don't need to look any * further. */ if (!props_incomplete) break; prop = drmModeGetProperty(drmmode->fd, props->props[i]); if (!prop) continue; for (j = 0; j < num_infos; j++) { if (!strcmp(prop->name, info[j].name)) break; } /* We don't know/care about this property. */ if (j == num_infos) { drmModeFreeProperty(prop); continue; } info[j].prop_id = props->props[i]; valid_mask |= 1U << j; if (info[j].num_enum_values == 0) { drmModeFreeProperty(prop); continue; } if (!(prop->flags & DRM_MODE_PROP_ENUM)) { xf86DrvMsg(drmmode->scrn->scrnIndex, X_WARNING, "expected property %s to be an enum," " but it is not; ignoring\n", prop->name); drmModeFreeProperty(prop); continue; } for (k = 0; k < info[j].num_enum_values; k++) { int l; if (info[j].enum_values[k].valid) continue; for (l = 0; l < prop->count_enums; l++) { if (!strcmp(prop->enums[l].name, info[j].enum_values[k].name)) break; } if (l == prop->count_enums) continue; info[j].enum_values[k].valid = TRUE; info[j].enum_values[k].value = prop->enums[l].value; } drmModeFreeProperty(prop); } return valid_mask; } static Bool drmmode_prop_info_copy(drmmode_prop_info_ptr dst, const drmmode_prop_info_rec *src, unsigned int num_props, Bool copy_prop_id) { unsigned int i; memcpy(dst, src, num_props * sizeof(*dst)); for (i = 0; i < num_props; i++) { unsigned int j; if (copy_prop_id) dst[i].prop_id = src[i].prop_id; else dst[i].prop_id = 0; if (src[i].num_enum_values == 0) continue; dst[i].enum_values = malloc(src[i].num_enum_values * sizeof(*dst[i].enum_values)); if (!dst[i].enum_values) goto err; memcpy(dst[i].enum_values, src[i].enum_values, src[i].num_enum_values * sizeof(*dst[i].enum_values)); for (j = 0; j < dst[i].num_enum_values; j++) dst[i].enum_values[j].valid = FALSE; } return TRUE; err: while (i--) free(dst[i].enum_values); return FALSE; } static void drmmode_prop_info_free(drmmode_prop_info_ptr info, int num_props) { int i; for (i = 0; i < num_props; i++) free(info[i].enum_values); } static void drmmode_ConvertToKMode(ScrnInfoPtr scrn, drmModeModeInfo * kmode, DisplayModePtr mode); static int plane_add_prop(drmModeAtomicReq *req, drmmode_crtc_private_ptr drmmode_crtc, enum drmmode_plane_property prop, uint64_t val) { drmmode_prop_info_ptr info = &drmmode_crtc->props_plane[prop]; int ret; if (!info) return -1; ret = drmModeAtomicAddProperty(req, drmmode_crtc->plane_id, info->prop_id, val); return (ret <= 0) ? -1 : 0; } static int plane_add_props(drmModeAtomicReq *req, xf86CrtcPtr crtc, uint32_t fb_id, int x, int y) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; int ret = 0; ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_FB_ID, fb_id); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_CRTC_ID, fb_id ? drmmode_crtc->mode_crtc->crtc_id : 0); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_SRC_X, x << 16); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_SRC_Y, y << 16); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_SRC_W, crtc->mode.HDisplay << 16); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_SRC_H, crtc->mode.VDisplay << 16); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_CRTC_X, 0); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_CRTC_Y, 0); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_CRTC_W, crtc->mode.HDisplay); ret |= plane_add_prop(req, drmmode_crtc, DRMMODE_PLANE_CRTC_H, crtc->mode.VDisplay); return ret; } static int crtc_add_prop(drmModeAtomicReq *req, drmmode_crtc_private_ptr drmmode_crtc, enum drmmode_crtc_property prop, uint64_t val) { drmmode_prop_info_ptr info = &drmmode_crtc->props[prop]; int ret; if (!info) return -1; ret = drmModeAtomicAddProperty(req, drmmode_crtc->mode_crtc->crtc_id, info->prop_id, val); return (ret <= 0) ? -1 : 0; } static int connector_add_prop(drmModeAtomicReq *req, drmmode_output_private_ptr drmmode_output, enum drmmode_connector_property prop, uint64_t val) { drmmode_prop_info_ptr info = &drmmode_output->props_connector[prop]; int ret; if (!info) return -1; ret = drmModeAtomicAddProperty(req, drmmode_output->output_id, info->prop_id, val); return (ret <= 0) ? -1 : 0; } static int drmmode_CompareKModes(drmModeModeInfo * kmode, drmModeModeInfo * other) { return memcmp(kmode, other, sizeof(*kmode)); } static int drm_mode_ensure_blob(xf86CrtcPtr crtc, drmModeModeInfo mode_info) { modesettingPtr ms = modesettingPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_mode_ptr mode; int ret; if (drmmode_crtc->current_mode && drmmode_CompareKModes(&drmmode_crtc->current_mode->mode_info, &mode_info) == 0) return 0; mode = calloc(sizeof(drmmode_mode_rec), 1); if (!mode) return -1; mode->mode_info = mode_info; ret = drmModeCreatePropertyBlob(ms->fd, &mode->mode_info, sizeof(mode->mode_info), &mode->blob_id); drmmode_crtc->current_mode = mode; xorg_list_add(&mode->entry, &drmmode_crtc->mode_list); return ret; } static int crtc_add_dpms_props(drmModeAtomicReq *req, xf86CrtcPtr crtc, int new_dpms, Bool *active) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; Bool crtc_active = FALSE; int i; int ret = 0; for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output = output->driver_private; if (output->crtc != crtc) { if (drmmode_output->current_crtc == crtc) { ret |= connector_add_prop(req, drmmode_output, DRMMODE_CONNECTOR_CRTC_ID, 0); } continue; } if (drmmode_output->output_id == -1) continue; if (new_dpms == DPMSModeOn) crtc_active = TRUE; ret |= connector_add_prop(req, drmmode_output, DRMMODE_CONNECTOR_CRTC_ID, crtc_active ? drmmode_crtc->mode_crtc->crtc_id : 0); } if (crtc_active) { drmModeModeInfo kmode; drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode); ret |= drm_mode_ensure_blob(crtc, kmode); ret |= crtc_add_prop(req, drmmode_crtc, DRMMODE_CRTC_ACTIVE, 1); ret |= crtc_add_prop(req, drmmode_crtc, DRMMODE_CRTC_MODE_ID, drmmode_crtc->current_mode->blob_id); } else { ret |= crtc_add_prop(req, drmmode_crtc, DRMMODE_CRTC_ACTIVE, 0); ret |= crtc_add_prop(req, drmmode_crtc, DRMMODE_CRTC_MODE_ID, 0); } if (active) *active = crtc_active; return ret; } static void drm_mode_destroy(xf86CrtcPtr crtc, drmmode_mode_ptr mode) { modesettingPtr ms = modesettingPTR(crtc->scrn); if (mode->blob_id) drmModeDestroyPropertyBlob(ms->fd, mode->blob_id); xorg_list_del(&mode->entry); free(mode); } static int drmmode_crtc_can_test_mode(xf86CrtcPtr crtc) { modesettingPtr ms = modesettingPTR(crtc->scrn); return ms->atomic_modeset; } static Bool drmmode_crtc_get_fb_id(xf86CrtcPtr crtc, uint32_t *fb_id, int *x, int *y) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; int ret; *fb_id = 0; if (drmmode_crtc->prime_pixmap) { if (!drmmode->reverse_prime_offload_mode) { msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, drmmode_crtc->prime_pixmap); *fb_id = ppriv->fb_id; *x = 0; } else *x = drmmode_crtc->prime_pixmap_x; *y = 0; } else if (drmmode_crtc->rotate_fb_id) { *fb_id = drmmode_crtc->rotate_fb_id; *x = *y = 0; } else { *fb_id = drmmode->fb_id; *x = crtc->x; *y = crtc->y; } if (*fb_id == 0) { ret = drmmode_bo_import(drmmode, &drmmode->front_bo, &drmmode->fb_id); if (ret < 0) { ErrorF("failed to add fb %d\n", ret); return FALSE; } *fb_id = drmmode->fb_id; } return TRUE; } void drmmode_set_dpms(ScrnInfoPtr scrn, int dpms, int flags) { modesettingPtr ms = modesettingPTR(scrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); drmModeAtomicReq *req = drmModeAtomicAlloc(); uint32_t mode_flags = DRM_MODE_ATOMIC_ALLOW_MODESET; int ret = 0; int i; assert(ms->atomic_modeset); if (!req) return; for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output = output->driver_private; if (output->crtc != NULL) continue; ret = connector_add_prop(req, drmmode_output, DRMMODE_CONNECTOR_CRTC_ID, 0); } for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; Bool active = FALSE; ret |= crtc_add_dpms_props(req, crtc, dpms, &active); if (dpms == DPMSModeOn && active && drmmode_crtc->need_modeset) { uint32_t fb_id; int x, y; if (!drmmode_crtc_get_fb_id(crtc, &fb_id, &x, &y)) continue; ret |= plane_add_props(req, crtc, fb_id, x, y); drmmode_crtc->need_modeset = FALSE; } } if (ret == 0) drmModeAtomicCommit(ms->fd, req, mode_flags, NULL); drmModeAtomicFree(req); ms->pending_modeset = TRUE; xf86DPMSSet(scrn, dpms, flags); ms->pending_modeset = FALSE; } static int drmmode_output_disable(xf86OutputPtr output) { modesettingPtr ms = modesettingPTR(output->scrn); drmmode_output_private_ptr drmmode_output = output->driver_private; xf86CrtcPtr crtc = drmmode_output->current_crtc; drmModeAtomicReq *req = drmModeAtomicAlloc(); uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET; int ret = 0; assert(ms->atomic_modeset); if (!req) return 1; ret |= connector_add_prop(req, drmmode_output, DRMMODE_CONNECTOR_CRTC_ID, 0); if (crtc) ret |= crtc_add_dpms_props(req, crtc, DPMSModeOff, NULL); if (ret == 0) ret = drmModeAtomicCommit(ms->fd, req, flags, NULL); if (ret == 0) drmmode_output->current_crtc = NULL; drmModeAtomicFree(req); return ret; } static int drmmode_crtc_disable(xf86CrtcPtr crtc) { modesettingPtr ms = modesettingPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmModeAtomicReq *req = drmModeAtomicAlloc(); uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET; int ret = 0; assert(ms->atomic_modeset); if (!req) return 1; ret |= crtc_add_prop(req, drmmode_crtc, DRMMODE_CRTC_ACTIVE, 0); ret |= crtc_add_prop(req, drmmode_crtc, DRMMODE_CRTC_MODE_ID, 0); if (ret == 0) ret = drmModeAtomicCommit(ms->fd, req, flags, NULL); drmModeAtomicFree(req); return ret; } static int drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only) { modesettingPtr ms = modesettingPTR(crtc->scrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; ScreenPtr screen = crtc->scrn->pScreen; drmModeModeInfo kmode; int output_count = 0; uint32_t *output_ids = NULL; uint32_t fb_id; int x, y; int i, ret = 0; if (!drmmode_crtc_get_fb_id(crtc, &fb_id, &x, &y)) return 1; #ifdef GLAMOR_HAS_GBM /* Make sure any pending drawing will be visible in a new scanout buffer */ if (drmmode->glamor) glamor_finish(screen); #endif if (ms->atomic_modeset) { drmModeAtomicReq *req = drmModeAtomicAlloc(); Bool active; uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET; if (!req) return 1; ret |= crtc_add_dpms_props(req, crtc, DPMSModeOn, &active); ret |= plane_add_props(req, crtc, active ? fb_id : 0, x, y); /* Orphaned CRTCs need to be disabled right now in atomic mode */ for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr other_crtc = xf86_config->crtc[i]; drmmode_crtc_private_ptr other_drmmode_crtc = other_crtc->driver_private; int lost_outputs = 0; int remaining_outputs = 0; int j; if (other_crtc == crtc) continue; for (j = 0; j < xf86_config->num_output; j++) { xf86OutputPtr output = xf86_config->output[j]; drmmode_output_private_ptr drmmode_output = output->driver_private; if (drmmode_output->current_crtc == other_crtc) { if (output->crtc == crtc) lost_outputs++; else remaining_outputs++; } } if (lost_outputs > 0 && remaining_outputs == 0) { ret |= crtc_add_prop(req, other_drmmode_crtc, DRMMODE_CRTC_ACTIVE, 0); ret |= crtc_add_prop(req, other_drmmode_crtc, DRMMODE_CRTC_MODE_ID, 0); } } if (test_only) flags |= DRM_MODE_ATOMIC_TEST_ONLY; if (ret == 0) ret = drmModeAtomicCommit(ms->fd, req, flags, NULL); if (ret == 0 && !test_only) { for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output = output->driver_private; if (output->crtc == crtc) drmmode_output->current_crtc = crtc; else if (drmmode_output->current_crtc == crtc) drmmode_output->current_crtc = NULL; } } drmModeAtomicFree(req); return ret; } output_ids = calloc(sizeof(uint32_t), xf86_config->num_output); if (!output_ids) return -1; for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output; if (output->crtc != crtc) continue; drmmode_output = output->driver_private; if (drmmode_output->output_id == -1) continue; output_ids[output_count] = drmmode_output->output_id; output_count++; } drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode); ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, fb_id, x, y, output_ids, output_count, &kmode); free(output_ids); return ret; } int drmmode_crtc_flip(xf86CrtcPtr crtc, uint32_t fb_id, uint32_t flags, void *data) { modesettingPtr ms = modesettingPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; int ret; if (ms->atomic_modeset) { drmModeAtomicReq *req = drmModeAtomicAlloc(); if (!req) return 1; ret = plane_add_props(req, crtc, fb_id, crtc->x, crtc->y); flags |= DRM_MODE_ATOMIC_NONBLOCK; if (ret == 0) ret = drmModeAtomicCommit(ms->fd, req, flags, data); drmModeAtomicFree(req); return ret; } return drmModePageFlip(ms->fd, drmmode_crtc->mode_crtc->crtc_id, fb_id, flags, data); } int drmmode_bo_destroy(drmmode_ptr drmmode, drmmode_bo *bo) { int ret; #ifdef GLAMOR_HAS_GBM if (bo->gbm) { gbm_bo_destroy(bo->gbm); bo->gbm = NULL; } #endif if (bo->dumb) { ret = dumb_bo_destroy(drmmode->fd, bo->dumb); if (ret == 0) bo->dumb = NULL; } return 0; } uint32_t drmmode_bo_get_pitch(drmmode_bo *bo) { #ifdef GLAMOR_HAS_GBM if (bo->gbm) return gbm_bo_get_stride(bo->gbm); #endif return bo->dumb->pitch; } static Bool drmmode_bo_has_bo(drmmode_bo *bo) { #ifdef GLAMOR_HAS_GBM if (bo->gbm) return TRUE; #endif return bo->dumb != NULL; } uint32_t drmmode_bo_get_handle(drmmode_bo *bo) { #ifdef GLAMOR_HAS_GBM if (bo->gbm) return gbm_bo_get_handle(bo->gbm).u32; #endif return bo->dumb->handle; } static void * drmmode_bo_map(drmmode_ptr drmmode, drmmode_bo *bo) { int ret; #ifdef GLAMOR_HAS_GBM if (bo->gbm) return NULL; #endif if (bo->dumb->ptr) return bo->dumb->ptr; ret = dumb_bo_map(drmmode->fd, bo->dumb); if (ret) return NULL; return bo->dumb->ptr; } int drmmode_bo_import(drmmode_ptr drmmode, drmmode_bo *bo, uint32_t *fb_id) { #ifdef GBM_BO_WITH_MODIFIERS modesettingPtr ms = modesettingPTR(drmmode->scrn); if (bo->gbm && ms->kms_has_modifiers && gbm_bo_get_modifier(bo->gbm) != DRM_FORMAT_MOD_INVALID) { int num_fds; num_fds = gbm_bo_get_plane_count(bo->gbm); if (num_fds > 0) { int i; uint32_t format; uint32_t handles[4]; uint32_t strides[4]; uint32_t offsets[4]; uint64_t modifiers[4]; memset(handles, 0, sizeof(handles)); memset(strides, 0, sizeof(strides)); memset(offsets, 0, sizeof(offsets)); memset(modifiers, 0, sizeof(modifiers)); format = gbm_bo_get_format(bo->gbm); format = get_opaque_format(format); for (i = 0; i < num_fds; i++) { handles[i] = gbm_bo_get_handle_for_plane(bo->gbm, i).u32; strides[i] = gbm_bo_get_stride_for_plane(bo->gbm, i); offsets[i] = gbm_bo_get_offset(bo->gbm, i); modifiers[i] = gbm_bo_get_modifier(bo->gbm); } return drmModeAddFB2WithModifiers(drmmode->fd, bo->width, bo->height, format, handles, strides, offsets, modifiers, fb_id, DRM_MODE_FB_MODIFIERS); } } #endif return drmModeAddFB(drmmode->fd, bo->width, bo->height, drmmode->scrn->depth, drmmode->kbpp, drmmode_bo_get_pitch(bo), drmmode_bo_get_handle(bo), fb_id); } static Bool drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo, unsigned width, unsigned height, unsigned bpp) { bo->width = width; bo->height = height; #ifdef GLAMOR_HAS_GBM if (drmmode->glamor) { uint32_t format; if (drmmode->scrn->depth == 30) format = GBM_FORMAT_ARGB2101010; else format = GBM_FORMAT_ARGB8888; #ifdef GBM_BO_WITH_MODIFIERS uint32_t num_modifiers; uint64_t *modifiers = NULL; num_modifiers = get_modifiers_set(drmmode->scrn, format, &modifiers, FALSE, TRUE); if (num_modifiers > 0 && !(num_modifiers == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID)) { bo->gbm = gbm_bo_create_with_modifiers(drmmode->gbm, width, height, format, modifiers, num_modifiers); free(modifiers); if (bo->gbm) { bo->used_modifiers = TRUE; return TRUE; } } #endif bo->gbm = gbm_bo_create(drmmode->gbm, width, height, format, GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); bo->used_modifiers = FALSE; return bo->gbm != NULL; } #endif bo->dumb = dumb_bo_create(drmmode->fd, width, height, bpp); return bo->dumb != NULL; } Bool drmmode_SetSlaveBO(PixmapPtr ppix, drmmode_ptr drmmode, int fd_handle, int pitch, int size) { msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, ppix); if (fd_handle == -1) { dumb_bo_destroy(drmmode->fd, ppriv->backing_bo); ppriv->backing_bo = NULL; return TRUE; } ppriv->backing_bo = dumb_get_bo_from_fd(drmmode->fd, fd_handle, pitch, size); if (!ppriv->backing_bo) return FALSE; close(fd_handle); return TRUE; } static Bool drmmode_SharedPixmapPresent(PixmapPtr ppix, xf86CrtcPtr crtc, drmmode_ptr drmmode) { ScreenPtr master = crtc->randr_crtc->pScreen->current_master; if (master->PresentSharedPixmap(ppix)) { /* Success, queue flip to back target */ if (drmmode_SharedPixmapFlip(ppix, crtc, drmmode)) return TRUE; xf86DrvMsg(drmmode->scrn->scrnIndex, X_WARNING, "drmmode_SharedPixmapFlip() failed, trying again next vblank\n"); return drmmode_SharedPixmapPresentOnVBlank(ppix, crtc, drmmode); } /* Failed to present, try again on next vblank after damage */ if (master->RequestSharedPixmapNotifyDamage) { msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, ppix); /* Set flag first in case we are immediately notified */ ppriv->wait_for_damage = TRUE; if (master->RequestSharedPixmapNotifyDamage(ppix)) return TRUE; else ppriv->wait_for_damage = FALSE; } /* Damage notification not available, just try again on vblank */ return drmmode_SharedPixmapPresentOnVBlank(ppix, crtc, drmmode); } struct vblank_event_args { PixmapPtr frontTarget; PixmapPtr backTarget; xf86CrtcPtr crtc; drmmode_ptr drmmode; Bool flip; }; static void drmmode_SharedPixmapVBlankEventHandler(uint64_t frame, uint64_t usec, void *data) { struct vblank_event_args *args = data; drmmode_crtc_private_ptr drmmode_crtc = args->crtc->driver_private; if (args->flip) { /* frontTarget is being displayed, update crtc to reflect */ drmmode_crtc->prime_pixmap = args->frontTarget; drmmode_crtc->prime_pixmap_back = args->backTarget; /* Safe to present on backTarget, no longer displayed */ drmmode_SharedPixmapPresent(args->backTarget, args->crtc, args->drmmode); } else { /* backTarget is still being displayed, present on frontTarget */ drmmode_SharedPixmapPresent(args->frontTarget, args->crtc, args->drmmode); } free(args); } static void drmmode_SharedPixmapVBlankEventAbort(void *data) { struct vblank_event_args *args = data; msGetPixmapPriv(args->drmmode, args->frontTarget)->flip_seq = 0; free(args); } Bool drmmode_SharedPixmapPresentOnVBlank(PixmapPtr ppix, xf86CrtcPtr crtc, drmmode_ptr drmmode) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, ppix); struct vblank_event_args *event_args; if (ppix == drmmode_crtc->prime_pixmap) return FALSE; /* Already flipped to this pixmap */ if (ppix != drmmode_crtc->prime_pixmap_back) return FALSE; /* Pixmap is not a scanout pixmap for CRTC */ event_args = calloc(1, sizeof(*event_args)); if (!event_args) return FALSE; event_args->frontTarget = ppix; event_args->backTarget = drmmode_crtc->prime_pixmap; event_args->crtc = crtc; event_args->drmmode = drmmode; event_args->flip = FALSE; ppriv->flip_seq = ms_drm_queue_alloc(crtc, event_args, drmmode_SharedPixmapVBlankEventHandler, drmmode_SharedPixmapVBlankEventAbort); return ms_queue_vblank(crtc, MS_QUEUE_RELATIVE, 1, NULL, ppriv->flip_seq); } Bool drmmode_SharedPixmapFlip(PixmapPtr frontTarget, xf86CrtcPtr crtc, drmmode_ptr drmmode) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; msPixmapPrivPtr ppriv_front = msGetPixmapPriv(drmmode, frontTarget); struct vblank_event_args *event_args; event_args = calloc(1, sizeof(*event_args)); if (!event_args) return FALSE; event_args->frontTarget = frontTarget; event_args->backTarget = drmmode_crtc->prime_pixmap; event_args->crtc = crtc; event_args->drmmode = drmmode; event_args->flip = TRUE; ppriv_front->flip_seq = ms_drm_queue_alloc(crtc, event_args, drmmode_SharedPixmapVBlankEventHandler, drmmode_SharedPixmapVBlankEventAbort); if (drmModePageFlip(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, ppriv_front->fb_id, DRM_MODE_PAGE_FLIP_EVENT, (void *)(intptr_t) ppriv_front->flip_seq) < 0) { ms_drm_abort_seq(crtc->scrn, ppriv_front->flip_seq); return FALSE; } return TRUE; } static Bool drmmode_InitSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (!drmmode_crtc->enable_flipping) return FALSE; if (drmmode_crtc->flipping_active) return TRUE; drmmode_crtc->flipping_active = drmmode_SharedPixmapPresent(drmmode_crtc->prime_pixmap_back, crtc, drmmode); return drmmode_crtc->flipping_active; } static void drmmode_FiniSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode) { uint32_t seq; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (!drmmode_crtc->flipping_active) return; drmmode_crtc->flipping_active = FALSE; /* Abort page flip event handler on prime_pixmap */ seq = msGetPixmapPriv(drmmode, drmmode_crtc->prime_pixmap)->flip_seq; if (seq) ms_drm_abort_seq(crtc->scrn, seq); /* Abort page flip event handler on prime_pixmap_back */ seq = msGetPixmapPriv(drmmode, drmmode_crtc->prime_pixmap_back)->flip_seq; if (seq) ms_drm_abort_seq(crtc->scrn, seq); } static Bool drmmode_set_target_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix, PixmapPtr *target); Bool drmmode_EnableSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode, PixmapPtr front, PixmapPtr back) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc->enable_flipping = TRUE; /* Set front scanout pixmap */ drmmode_crtc->enable_flipping &= drmmode_set_target_scanout_pixmap(crtc, front, &drmmode_crtc->prime_pixmap); if (!drmmode_crtc->enable_flipping) return FALSE; /* Set back scanout pixmap */ drmmode_crtc->enable_flipping &= drmmode_set_target_scanout_pixmap(crtc, back, &drmmode_crtc->prime_pixmap_back); if (!drmmode_crtc->enable_flipping) { drmmode_set_target_scanout_pixmap(crtc, NULL, &drmmode_crtc->prime_pixmap); return FALSE; } return TRUE; } void drmmode_DisableSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc->enable_flipping = FALSE; drmmode_FiniSharedPixmapFlipping(crtc, drmmode); drmmode_set_target_scanout_pixmap(crtc, NULL, &drmmode_crtc->prime_pixmap); drmmode_set_target_scanout_pixmap(crtc, NULL, &drmmode_crtc->prime_pixmap_back); } static void drmmode_ConvertFromKMode(ScrnInfoPtr scrn, drmModeModeInfo * kmode, DisplayModePtr mode) { memset(mode, 0, sizeof(DisplayModeRec)); mode->status = MODE_OK; mode->Clock = kmode->clock; mode->HDisplay = kmode->hdisplay; mode->HSyncStart = kmode->hsync_start; mode->HSyncEnd = kmode->hsync_end; mode->HTotal = kmode->htotal; mode->HSkew = kmode->hskew; mode->VDisplay = kmode->vdisplay; mode->VSyncStart = kmode->vsync_start; mode->VSyncEnd = kmode->vsync_end; mode->VTotal = kmode->vtotal; mode->VScan = kmode->vscan; mode->Flags = kmode->flags; //& FLAG_BITS; mode->name = strdup(kmode->name); if (kmode->type & DRM_MODE_TYPE_DRIVER) mode->type = M_T_DRIVER; if (kmode->type & DRM_MODE_TYPE_PREFERRED) mode->type |= M_T_PREFERRED; xf86SetModeCrtc(mode, scrn->adjustFlags); } static void drmmode_ConvertToKMode(ScrnInfoPtr scrn, drmModeModeInfo * kmode, DisplayModePtr mode) { memset(kmode, 0, sizeof(*kmode)); kmode->clock = mode->Clock; kmode->hdisplay = mode->HDisplay; kmode->hsync_start = mode->HSyncStart; kmode->hsync_end = mode->HSyncEnd; kmode->htotal = mode->HTotal; kmode->hskew = mode->HSkew; kmode->vdisplay = mode->VDisplay; kmode->vsync_start = mode->VSyncStart; kmode->vsync_end = mode->VSyncEnd; kmode->vtotal = mode->VTotal; kmode->vscan = mode->VScan; kmode->flags = mode->Flags; //& FLAG_BITS; if (mode->name) strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN); kmode->name[DRM_DISPLAY_MODE_LEN - 1] = 0; } static void drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode) { modesettingPtr ms = modesettingPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; /* XXX Check if DPMS mode is already the right one */ drmmode_crtc->dpms_mode = mode; if (ms->atomic_modeset) { if (mode != DPMSModeOn && !ms->pending_modeset) drmmode_crtc_disable(crtc); } else if (crtc->enabled == FALSE) { drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, 0, 0, NULL, 0, NULL); } } #ifdef GLAMOR_HAS_GBM static PixmapPtr create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) { PixmapPtr pixmap = drmmode->fbcon_pixmap; drmModeFBPtr fbcon; ScreenPtr pScreen = xf86ScrnToScreen(pScrn); Bool ret; if (pixmap) return pixmap; fbcon = drmModeGetFB(drmmode->fd, fbcon_id); if (fbcon == NULL) return NULL; if (fbcon->depth != pScrn->depth || fbcon->width != pScrn->virtualX || fbcon->height != pScrn->virtualY) goto out_free_fb; pixmap = drmmode_create_pixmap_header(pScreen, fbcon->width, fbcon->height, fbcon->depth, fbcon->bpp, fbcon->pitch, NULL); if (!pixmap) goto out_free_fb; ret = glamor_egl_create_textured_pixmap(pixmap, fbcon->handle, fbcon->pitch); if (!ret) { FreePixmap(pixmap); pixmap = NULL; } drmmode->fbcon_pixmap = pixmap; out_free_fb: drmModeFreeFB(fbcon); return pixmap; } #endif void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { #ifdef GLAMOR_HAS_GBM xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PixmapPtr src, dst; int fbcon_id = 0; GCPtr gc; int i; for (i = 0; i < xf86_config->num_crtc; i++) { drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[i]->driver_private; if (drmmode_crtc->mode_crtc->buffer_id) fbcon_id = drmmode_crtc->mode_crtc->buffer_id; } if (!fbcon_id) return; if (fbcon_id == drmmode->fb_id) { /* in some rare case there might be no fbcon and we might already * be the one with the current fb to avoid a false deadlck in * kernel ttm code just do nothing as anyway there is nothing * to do */ return; } src = create_pixmap_for_fbcon(drmmode, pScrn, fbcon_id); if (!src) return; dst = pScreen->GetScreenPixmap(pScreen); gc = GetScratchGC(pScrn->depth, pScreen); ValidateGC(&dst->drawable, gc); (*gc->ops->CopyArea)(&src->drawable, &dst->drawable, gc, 0, 0, pScrn->virtualX, pScrn->virtualY, 0, 0); FreeScratchGC(gc); pScreen->canDoBGNoneRoot = TRUE; if (drmmode->fbcon_pixmap) pScrn->pScreen->DestroyPixmap(drmmode->fbcon_pixmap); drmmode->fbcon_pixmap = NULL; #endif } static Bool drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y) { modesettingPtr ms = modesettingPTR(crtc->scrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; int saved_x, saved_y; Rotation saved_rotation; DisplayModeRec saved_mode; Bool ret = TRUE; Bool can_test; int i; saved_mode = crtc->mode; saved_x = crtc->x; saved_y = crtc->y; saved_rotation = crtc->rotation; if (mode) { crtc->mode = *mode; crtc->x = x; crtc->y = y; crtc->rotation = rotation; if (!xf86CrtcRotate(crtc)) { goto done; } crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green, crtc->gamma_blue, crtc->gamma_size); can_test = drmmode_crtc_can_test_mode(crtc); if (drmmode_crtc_set_mode(crtc, can_test)) { xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "failed to set mode: %s\n", strerror(errno)); ret = FALSE; goto done; } else ret = TRUE; if (crtc->scrn->pScreen) xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen); ms->pending_modeset = TRUE; drmmode_crtc->need_modeset = FALSE; crtc->funcs->dpms(crtc, DPMSModeOn); if (drmmode_crtc->prime_pixmap_back) drmmode_InitSharedPixmapFlipping(crtc, drmmode); /* go through all the outputs and force DPMS them back on? */ for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output; if (output->crtc != crtc) continue; drmmode_output = output->driver_private; if (drmmode_output->output_id == -1) continue; output->funcs->dpms(output, DPMSModeOn); } /* if we only tested the mode previously, really set it now */ if (can_test) drmmode_crtc_set_mode(crtc, FALSE); ms->pending_modeset = FALSE; } done: if (!ret) { crtc->x = saved_x; crtc->y = saved_y; crtc->rotation = saved_rotation; crtc->mode = saved_mode; } else crtc->active = TRUE; return ret; } static void drmmode_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) { } static void drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, x, y); } static Bool drmmode_set_cursor(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; uint32_t handle = drmmode_crtc->cursor_bo->handle; modesettingPtr ms = modesettingPTR(crtc->scrn); CursorPtr cursor = xf86CurrentCursor(crtc->scrn->pScreen); int ret = -EINVAL; if (cursor == NullCursor) return TRUE; ret = drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, ms->cursor_width, ms->cursor_height, cursor->bits->xhot, cursor->bits->yhot); /* -EINVAL can mean that an old kernel supports drmModeSetCursor but * not drmModeSetCursor2, though it can mean other things too. */ if (ret == -EINVAL) ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, ms->cursor_width, ms->cursor_height); /* -ENXIO normally means that the current drm driver supports neither * cursor_set nor cursor_set2. Disable hardware cursor support for * the rest of the session in that case. */ if (ret == -ENXIO) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; cursor_info->MaxWidth = cursor_info->MaxHeight = 0; drmmode_crtc->drmmode->sw_cursor = TRUE; } if (ret) /* fallback to swcursor */ return FALSE; return TRUE; } static void drmmode_hide_cursor(xf86CrtcPtr crtc); /* * The load_cursor_argb_check driver hook. * * Sets the hardware cursor by calling the drmModeSetCursor2 ioctl. * On failure, returns FALSE indicating that the X server should fall * back to software cursors. */ static Bool drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image) { modesettingPtr ms = modesettingPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; int i; uint32_t *ptr; /* cursor should be mapped already */ ptr = (uint32_t *) (drmmode_crtc->cursor_bo->ptr); for (i = 0; i < ms->cursor_width * ms->cursor_height; i++) ptr[i] = image[i]; // cpu_to_le32(image[i]); if (drmmode_crtc->cursor_up) return drmmode_set_cursor(crtc); return TRUE; } static void drmmode_hide_cursor(xf86CrtcPtr crtc) { modesettingPtr ms = modesettingPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; drmmode_crtc->cursor_up = FALSE; drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, ms->cursor_width, ms->cursor_height); } static Bool drmmode_show_cursor(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc->cursor_up = TRUE; return drmmode_set_cursor(crtc); } static void drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t * red, uint16_t * green, uint16_t * blue, int size) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; drmModeCrtcSetGamma(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, size, red, green, blue); } static Bool drmmode_set_target_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix, PixmapPtr *target) { ScreenPtr screen = xf86ScrnToScreen(crtc->scrn); PixmapPtr screenpix = screen->GetScreenPixmap(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; int c, total_width = 0, max_height = 0, this_x = 0; if (*target) { PixmapStopDirtyTracking(&(*target)->drawable, screenpix); if (drmmode->fb_id) { drmModeRmFB(drmmode->fd, drmmode->fb_id); drmmode->fb_id = 0; } drmmode_crtc->prime_pixmap_x = 0; *target = NULL; } if (!ppix) return TRUE; /* iterate over all the attached crtcs to work out the bounding box */ for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr iter = xf86_config->crtc[c]; if (!iter->enabled && iter != crtc) continue; if (iter == crtc) { this_x = total_width; total_width += ppix->drawable.width; if (max_height < ppix->drawable.height) max_height = ppix->drawable.height; } else { total_width += iter->mode.HDisplay; if (max_height < iter->mode.VDisplay) max_height = iter->mode.VDisplay; } } if (total_width != screenpix->drawable.width || max_height != screenpix->drawable.height) { if (!drmmode_xf86crtc_resize(crtc->scrn, total_width, max_height)) return FALSE; screenpix = screen->GetScreenPixmap(screen); screen->width = screenpix->drawable.width = total_width; screen->height = screenpix->drawable.height = max_height; } drmmode_crtc->prime_pixmap_x = this_x; PixmapStartDirtyTracking(&ppix->drawable, screenpix, 0, 0, this_x, 0, RR_Rotate_0); *target = ppix; return TRUE; } static Bool drmmode_set_target_scanout_pixmap_cpu(xf86CrtcPtr crtc, PixmapPtr ppix, PixmapPtr *target) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; msPixmapPrivPtr ppriv; void *ptr; if (*target) { ppriv = msGetPixmapPriv(drmmode, *target); drmModeRmFB(drmmode->fd, ppriv->fb_id); ppriv->fb_id = 0; if (ppriv->slave_damage) { DamageUnregister(ppriv->slave_damage); ppriv->slave_damage = NULL; } *target = NULL; } if (!ppix) return TRUE; ppriv = msGetPixmapPriv(drmmode, ppix); if (!ppriv->slave_damage) { ppriv->slave_damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, crtc->randr_crtc->pScreen, NULL); } ptr = drmmode_map_slave_bo(drmmode, ppriv); ppix->devPrivate.ptr = ptr; DamageRegister(&ppix->drawable, ppriv->slave_damage); if (ppriv->fb_id == 0) { drmModeAddFB(drmmode->fd, ppix->drawable.width, ppix->drawable.height, ppix->drawable.depth, ppix->drawable.bitsPerPixel, ppix->devKind, ppriv->backing_bo->handle, &ppriv->fb_id); } *target = ppix; return TRUE; } static Bool drmmode_set_target_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix, PixmapPtr *target) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; if (drmmode->reverse_prime_offload_mode) return drmmode_set_target_scanout_pixmap_gpu(crtc, ppix, target); else return drmmode_set_target_scanout_pixmap_cpu(crtc, ppix, target); } static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; /* Use DisableSharedPixmapFlipping before switching to single buf */ if (drmmode_crtc->enable_flipping) return FALSE; return drmmode_set_target_scanout_pixmap(crtc, ppix, &drmmode_crtc->prime_pixmap); } static void drmmode_clear_pixmap(PixmapPtr pixmap) { ScreenPtr screen = pixmap->drawable.pScreen; GCPtr gc; gc = GetScratchGC(pixmap->drawable.depth, screen); if (gc) { miClearDrawable(&pixmap->drawable, gc); FreeScratchGC(gc); } } static void * drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; int ret; if (!drmmode_create_bo(drmmode, &drmmode_crtc->rotate_bo, width, height, drmmode->kbpp)) { xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "Couldn't allocate shadow memory for rotated CRTC\n"); return NULL; } ret = drmmode_bo_import(drmmode, &drmmode_crtc->rotate_bo, &drmmode_crtc->rotate_fb_id); if (ret) { ErrorF("failed to add rotate fb\n"); drmmode_bo_destroy(drmmode, &drmmode_crtc->rotate_bo); return NULL; } #ifdef GLAMOR_HAS_GBM if (drmmode->gbm) return drmmode_crtc->rotate_bo.gbm; #endif return drmmode_crtc->rotate_bo.dumb; } static PixmapPtr drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData) { PixmapPtr pixmap; /* width and height of 0 means don't allocate any pixmap data */ pixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (pixmap) { if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth, bitsPerPixel, devKind, pPixData)) return pixmap; (*pScreen->DestroyPixmap)(pixmap); } return NullPixmap; } static Bool drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo); static PixmapPtr drmmode_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) { ScrnInfoPtr scrn = crtc->scrn; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; uint32_t rotate_pitch; PixmapPtr rotate_pixmap; void *pPixData = NULL; if (!data) { data = drmmode_shadow_allocate(crtc, width, height); if (!data) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Couldn't allocate shadow pixmap for rotated CRTC\n"); return NULL; } } if (!drmmode_bo_has_bo(&drmmode_crtc->rotate_bo)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Couldn't allocate shadow pixmap for rotated CRTC\n"); return NULL; } pPixData = drmmode_bo_map(drmmode, &drmmode_crtc->rotate_bo); rotate_pitch = drmmode_bo_get_pitch(&drmmode_crtc->rotate_bo), rotate_pixmap = drmmode_create_pixmap_header(scrn->pScreen, width, height, scrn->depth, drmmode->kbpp, rotate_pitch, pPixData); if (rotate_pixmap == NULL) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Couldn't allocate shadow pixmap for rotated CRTC\n"); return NULL; } drmmode_set_pixmap_bo(drmmode, rotate_pixmap, &drmmode_crtc->rotate_bo); return rotate_pixmap; } static void drmmode_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; if (rotate_pixmap) { rotate_pixmap->drawable.pScreen->DestroyPixmap(rotate_pixmap); } if (data) { drmModeRmFB(drmmode->fd, drmmode_crtc->rotate_fb_id); drmmode_crtc->rotate_fb_id = 0; drmmode_bo_destroy(drmmode, &drmmode_crtc->rotate_bo); memset(&drmmode_crtc->rotate_bo, 0, sizeof drmmode_crtc->rotate_bo); } } static void drmmode_crtc_destroy(xf86CrtcPtr crtc) { drmmode_mode_ptr iterator, next; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; modesettingPtr ms = modesettingPTR(crtc->scrn); if (!ms->atomic_modeset) return; drmmode_prop_info_free(drmmode_crtc->props_plane, DRMMODE_PLANE__COUNT); xorg_list_for_each_entry_safe(iterator, next, &drmmode_crtc->mode_list, entry) { drm_mode_destroy(crtc, iterator); } } static const xf86CrtcFuncsRec drmmode_crtc_funcs = { .dpms = drmmode_crtc_dpms, .set_mode_major = drmmode_set_mode_major, .set_cursor_colors = drmmode_set_cursor_colors, .set_cursor_position = drmmode_set_cursor_position, .show_cursor_check = drmmode_show_cursor, .hide_cursor = drmmode_hide_cursor, .load_cursor_argb_check = drmmode_load_cursor_argb_check, .gamma_set = drmmode_crtc_gamma_set, .destroy = drmmode_crtc_destroy, .set_scanout_pixmap = drmmode_set_scanout_pixmap, .shadow_allocate = drmmode_shadow_allocate, .shadow_create = drmmode_shadow_create, .shadow_destroy = drmmode_shadow_destroy, }; static uint32_t drmmode_crtc_vblank_pipe(int crtc_id) { if (crtc_id > 1) return crtc_id << DRM_VBLANK_HIGH_CRTC_SHIFT; else if (crtc_id > 0) return DRM_VBLANK_SECONDARY; else return 0; } static Bool is_plane_assigned(ScrnInfoPtr scrn, int plane_id) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr iter = xf86_config->crtc[c]; drmmode_crtc_private_ptr drmmode_crtc = iter->driver_private; if (drmmode_crtc->plane_id == plane_id) return TRUE; } return FALSE; } /** * Populates the formats array, and the modifiers of each format for a drm_plane. */ static Bool populate_format_modifiers(xf86CrtcPtr crtc, const drmModePlane *kplane, uint32_t blob_id) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; unsigned i, j; drmModePropertyBlobRes *blob; struct drm_format_modifier_blob *fmt_mod_blob; uint32_t *blob_formats; struct drm_format_modifier *blob_modifiers; if (!blob_id) return FALSE; blob = drmModeGetPropertyBlob(drmmode->fd, blob_id); if (!blob) return FALSE; fmt_mod_blob = blob->data; blob_formats = formats_ptr(fmt_mod_blob); blob_modifiers = modifiers_ptr(fmt_mod_blob); assert(drmmode_crtc->num_formats == fmt_mod_blob->count_formats); for (i = 0; i < fmt_mod_blob->count_formats; i++) { uint32_t num_modifiers = 0; uint64_t *modifiers = NULL; uint64_t *tmp; for (j = 0; j < fmt_mod_blob->count_modifiers; j++) { struct drm_format_modifier *mod = &blob_modifiers[j]; if ((i < mod->offset) || (i > mod->offset + 63)) continue; if (!(mod->formats & (1 << (i - mod->offset)))) continue; num_modifiers++; tmp = realloc(modifiers, num_modifiers * sizeof(modifiers[0])); if (!tmp) { free(modifiers); drmModeFreePropertyBlob(blob); return FALSE; } modifiers = tmp; modifiers[num_modifiers - 1] = mod->modifier; } drmmode_crtc->formats[i].format = blob_formats[i]; drmmode_crtc->formats[i].modifiers = modifiers; drmmode_crtc->formats[i].num_modifiers = num_modifiers; } drmModeFreePropertyBlob(blob); return TRUE; } static void drmmode_crtc_create_planes(xf86CrtcPtr crtc, int num) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; drmModePlaneRes *kplane_res; drmModePlane *kplane, *best_kplane = NULL; drmModeObjectProperties *props; uint32_t i, type, blob_id; int current_crtc, best_plane = 0; static drmmode_prop_enum_info_rec plane_type_enums[] = { [DRMMODE_PLANE_TYPE_PRIMARY] = { .name = "Primary", }, [DRMMODE_PLANE_TYPE_OVERLAY] = { .name = "Overlay", }, [DRMMODE_PLANE_TYPE_CURSOR] = { .name = "Cursor", }, }; static const drmmode_prop_info_rec plane_props[] = { [DRMMODE_PLANE_TYPE] = { .name = "type", .enum_values = plane_type_enums, .num_enum_values = DRMMODE_PLANE_TYPE__COUNT, }, [DRMMODE_PLANE_FB_ID] = { .name = "FB_ID", }, [DRMMODE_PLANE_CRTC_ID] = { .name = "CRTC_ID", }, [DRMMODE_PLANE_IN_FORMATS] = { .name = "IN_FORMATS", }, [DRMMODE_PLANE_SRC_X] = { .name = "SRC_X", }, [DRMMODE_PLANE_SRC_Y] = { .name = "SRC_Y", }, [DRMMODE_PLANE_SRC_W] = { .name = "SRC_W", }, [DRMMODE_PLANE_SRC_H] = { .name = "SRC_H", }, [DRMMODE_PLANE_CRTC_X] = { .name = "CRTC_X", }, [DRMMODE_PLANE_CRTC_Y] = { .name = "CRTC_Y", }, [DRMMODE_PLANE_CRTC_W] = { .name = "CRTC_W", }, [DRMMODE_PLANE_CRTC_H] = { .name = "CRTC_H", }, }; drmmode_prop_info_rec tmp_props[DRMMODE_PLANE__COUNT]; if (!drmmode_prop_info_copy(tmp_props, plane_props, DRMMODE_PLANE__COUNT, 0)) { xf86DrvMsg(drmmode->scrn->scrnIndex, X_ERROR, "failed to copy plane property info\n"); drmmode_prop_info_free(tmp_props, DRMMODE_PLANE__COUNT); return; } kplane_res = drmModeGetPlaneResources(drmmode->fd); if (!kplane_res) { xf86DrvMsg(drmmode->scrn->scrnIndex, X_ERROR, "failed to get plane resources: %s\n", strerror(errno)); drmmode_prop_info_free(tmp_props, DRMMODE_PLANE__COUNT); return; } for (i = 0; i < kplane_res->count_planes; i++) { int plane_id; kplane = drmModeGetPlane(drmmode->fd, kplane_res->planes[i]); if (!kplane) continue; if (!(kplane->possible_crtcs & (1 << num)) || is_plane_assigned(drmmode->scrn, kplane->plane_id)) { drmModeFreePlane(kplane); continue; } plane_id = kplane->plane_id; props = drmModeObjectGetProperties(drmmode->fd, plane_id, DRM_MODE_OBJECT_PLANE); if (!props) { xf86DrvMsg(drmmode->scrn->scrnIndex, X_ERROR, "couldn't get plane properties\n"); drmModeFreePlane(kplane); continue; } drmmode_prop_info_update(drmmode, tmp_props, DRMMODE_PLANE__COUNT, props); /* Only primary planes are important for atomic page-flipping */ type = drmmode_prop_get_value(&tmp_props[DRMMODE_PLANE_TYPE], props, DRMMODE_PLANE_TYPE__COUNT); if (type != DRMMODE_PLANE_TYPE_PRIMARY) { drmModeFreePlane(kplane); drmModeFreeObjectProperties(props); continue; } /* Check if plane is already on this CRTC */ current_crtc = drmmode_prop_get_value(&tmp_props[DRMMODE_PLANE_CRTC_ID], props, 0); if (current_crtc == drmmode_crtc->mode_crtc->crtc_id) { if (best_plane) { drmModeFreePlane(best_kplane); drmmode_prop_info_free(drmmode_crtc->props_plane, DRMMODE_PLANE__COUNT); } best_plane = plane_id; best_kplane = kplane; blob_id = drmmode_prop_get_value(&tmp_props[DRMMODE_PLANE_IN_FORMATS], props, 0); drmmode_prop_info_copy(drmmode_crtc->props_plane, tmp_props, DRMMODE_PLANE__COUNT, 1); drmModeFreeObjectProperties(props); break; } if (!best_plane) { best_plane = plane_id; best_kplane = kplane; blob_id = drmmode_prop_get_value(&tmp_props[DRMMODE_PLANE_IN_FORMATS], props, 0); drmmode_prop_info_copy(drmmode_crtc->props_plane, tmp_props, DRMMODE_PLANE__COUNT, 1); } else { drmModeFreePlane(kplane); } drmModeFreeObjectProperties(props); } drmmode_crtc->plane_id = best_plane; if (best_kplane) { drmmode_crtc->num_formats = best_kplane->count_formats; drmmode_crtc->formats = calloc(sizeof(drmmode_format_rec), best_kplane->count_formats); if (!populate_format_modifiers(crtc, best_kplane, blob_id)) { for (i = 0; i < best_kplane->count_formats; i++) drmmode_crtc->formats[i].format = best_kplane->formats[i]; } drmModeFreePlane(best_kplane); } drmmode_prop_info_free(tmp_props, DRMMODE_PLANE__COUNT); drmModeFreePlaneResources(kplane_res); } static unsigned int drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res, int num) { xf86CrtcPtr crtc; drmmode_crtc_private_ptr drmmode_crtc; modesettingEntPtr ms_ent = ms_ent_priv(pScrn); modesettingPtr ms = modesettingPTR(pScrn); drmModeObjectPropertiesPtr props; static const drmmode_prop_info_rec crtc_props[] = { [DRMMODE_CRTC_ACTIVE] = { .name = "ACTIVE" }, [DRMMODE_CRTC_MODE_ID] = { .name = "MODE_ID" }, }; crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs); if (crtc == NULL) return 0; drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1); crtc->driver_private = drmmode_crtc; drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd, mode_res->crtcs[num]); drmmode_crtc->drmmode = drmmode; drmmode_crtc->vblank_pipe = drmmode_crtc_vblank_pipe(num); xorg_list_init(&drmmode_crtc->mode_list); if (ms->atomic_modeset) { props = drmModeObjectGetProperties(drmmode->fd, mode_res->crtcs[num], DRM_MODE_OBJECT_CRTC); if (!props || !drmmode_prop_info_copy(drmmode_crtc->props, crtc_props, DRMMODE_CRTC__COUNT, 0)) { xf86CrtcDestroy(crtc); return 0; } drmmode_prop_info_update(drmmode, drmmode_crtc->props, DRMMODE_CRTC__COUNT, props); drmModeFreeObjectProperties(props); drmmode_crtc_create_planes(crtc, num); } /* Hide any cursors which may be active from previous users */ drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, 0, 0); /* Mark num'th crtc as in use on this device. */ ms_ent->assigned_crtcs |= (1 << num); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG, "Allocated crtc nr. %d to this screen.\n", num); return 1; } /* * Update all of the property values for an output */ static void drmmode_output_update_properties(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; int i, j, k; int err; drmModeConnectorPtr koutput; /* Use the most recently fetched values from the kernel */ koutput = drmmode_output->mode_output; if (!koutput) return; for (i = 0; i < drmmode_output->num_props; i++) { drmmode_prop_ptr p = &drmmode_output->props[i]; for (j = 0; koutput && j < koutput->count_props; j++) { if (koutput->props[j] == p->mode_prop->prop_id) { /* Check to see if the property value has changed */ if (koutput->prop_values[j] != p->value) { p->value = koutput->prop_values[j]; if (p->mode_prop->flags & DRM_MODE_PROP_RANGE) { INT32 value = p->value; err = RRChangeOutputProperty(output->randr_output, p->atoms[0], XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } else if (p->mode_prop->flags & DRM_MODE_PROP_ENUM) { for (k = 0; k < p->mode_prop->count_enums; k++) if (p->mode_prop->enums[k].value == p->value) break; if (k < p->mode_prop->count_enums) { err = RRChangeOutputProperty(output->randr_output, p->atoms[0], XA_ATOM, 32, PropModeReplace, 1, &p->atoms[k + 1], FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } } } break; } } } } static xf86OutputStatus drmmode_output_detect(xf86OutputPtr output) { /* go to the hw and retrieve a new output struct */ drmmode_output_private_ptr drmmode_output = output->driver_private; drmmode_ptr drmmode = drmmode_output->drmmode; xf86OutputStatus status; if (drmmode_output->output_id == -1) return XF86OutputStatusDisconnected; drmModeFreeConnector(drmmode_output->mode_output); drmmode_output->mode_output = drmModeGetConnector(drmmode->fd, drmmode_output->output_id); if (!drmmode_output->mode_output) { drmmode_output->output_id = -1; return XF86OutputStatusDisconnected; } drmmode_output_update_properties(output); switch (drmmode_output->mode_output->connection) { case DRM_MODE_CONNECTED: status = XF86OutputStatusConnected; break; case DRM_MODE_DISCONNECTED: status = XF86OutputStatusDisconnected; break; default: case DRM_MODE_UNKNOWNCONNECTION: status = XF86OutputStatusUnknown; break; } return status; } static Bool drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes) { return MODE_OK; } static int koutput_get_prop_idx(int fd, drmModeConnectorPtr koutput, int type, const char *name) { int idx = -1; for (int i = 0; i < koutput->count_props; i++) { drmModePropertyPtr prop = drmModeGetProperty(fd, koutput->props[i]); if (!prop) continue; if (drm_property_type_is(prop, type) && !strcmp(prop->name, name)) idx = i; drmModeFreeProperty(prop); if (idx > -1) break; } return idx; } static int koutput_get_prop_id(int fd, drmModeConnectorPtr koutput, int type, const char *name) { int idx = koutput_get_prop_idx(fd, koutput, type, name); return (idx > -1) ? koutput->props[idx] : -1; } static drmModePropertyBlobPtr koutput_get_prop_blob(int fd, drmModeConnectorPtr koutput, const char *name) { drmModePropertyBlobPtr blob = NULL; int idx = koutput_get_prop_idx(fd, koutput, DRM_MODE_PROP_BLOB, name); if (idx > -1) blob = drmModeGetPropertyBlob(fd, koutput->prop_values[idx]); return blob; } static void drmmode_output_attach_tile(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr koutput = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; struct xf86CrtcTileInfo tile_info, *set = NULL; if (!koutput) { xf86OutputSetTile(output, NULL); return; } drmModeFreePropertyBlob(drmmode_output->tile_blob); /* look for a TILE property */ drmmode_output->tile_blob = koutput_get_prop_blob(drmmode->fd, koutput, "TILE"); if (drmmode_output->tile_blob) { if (xf86OutputParseKMSTile(drmmode_output->tile_blob->data, drmmode_output->tile_blob->length, &tile_info) == TRUE) set = &tile_info; } xf86OutputSetTile(output, set); } static Bool has_panel_fitter(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr koutput = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; int idx; /* Presume that if the output supports scaling, then we have a * panel fitter capable of adjust any mode to suit. */ idx = koutput_get_prop_idx(drmmode->fd, koutput, DRM_MODE_PROP_ENUM, "scaling mode"); return (idx > -1); } static DisplayModePtr drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes) { xf86MonPtr mon = output->MonInfo; DisplayModePtr i, m, preferred = NULL; int max_x = 0, max_y = 0; float max_vrefresh = 0.0; if (mon && GTF_SUPPORTED(mon->features.msc)) return Modes; if (!has_panel_fitter(output)) return Modes; for (m = Modes; m; m = m->next) { if (m->type & M_T_PREFERRED) preferred = m; max_x = max(max_x, m->HDisplay); max_y = max(max_y, m->VDisplay); max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(m)); } max_vrefresh = max(max_vrefresh, 60.0); max_vrefresh *= (1 + SYNC_TOLERANCE); m = xf86GetDefaultModes(); xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0); for (i = m; i; i = i->next) { if (xf86ModeVRefresh(i) > max_vrefresh) i->status = MODE_VSYNC; if (preferred && i->HDisplay >= preferred->HDisplay && i->VDisplay >= preferred->VDisplay && xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred)) i->status = MODE_VSYNC; } xf86PruneInvalidModes(output->scrn, &m, FALSE); return xf86ModesAdd(Modes, m); } static DisplayModePtr drmmode_output_get_modes(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr koutput = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; int i; DisplayModePtr Modes = NULL, Mode; xf86MonPtr mon = NULL; if (!koutput) return NULL; drmModeFreePropertyBlob(drmmode_output->edid_blob); /* look for an EDID property */ drmmode_output->edid_blob = koutput_get_prop_blob(drmmode->fd, koutput, "EDID"); if (drmmode_output->edid_blob) { mon = xf86InterpretEDID(output->scrn->scrnIndex, drmmode_output->edid_blob->data); if (mon && drmmode_output->edid_blob->length > 128) mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA; } xf86OutputSetEDID(output, mon); drmmode_output_attach_tile(output); /* modes should already be available */ for (i = 0; i < koutput->count_modes; i++) { Mode = xnfalloc(sizeof(DisplayModeRec)); drmmode_ConvertFromKMode(output->scrn, &koutput->modes[i], Mode); Modes = xf86ModesAdd(Modes, Mode); } return drmmode_output_add_gtf_modes(output, Modes); } static void drmmode_output_destroy(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; int i; drmModeFreePropertyBlob(drmmode_output->edid_blob); drmModeFreePropertyBlob(drmmode_output->tile_blob); for (i = 0; i < drmmode_output->num_props; i++) { drmModeFreeProperty(drmmode_output->props[i].mode_prop); free(drmmode_output->props[i].atoms); } free(drmmode_output->props); if (drmmode_output->mode_output) { for (i = 0; i < drmmode_output->mode_output->count_encoders; i++) { drmModeFreeEncoder(drmmode_output->mode_encoders[i]); } drmModeFreeConnector(drmmode_output->mode_output); } free(drmmode_output->mode_encoders); free(drmmode_output); output->driver_private = NULL; } static void drmmode_output_dpms(xf86OutputPtr output, int mode) { modesettingPtr ms = modesettingPTR(output->scrn); drmmode_output_private_ptr drmmode_output = output->driver_private; drmmode_ptr drmmode = drmmode_output->drmmode; xf86CrtcPtr crtc = output->crtc; drmModeConnectorPtr koutput = drmmode_output->mode_output; if (!koutput) return; /* XXX Check if DPMS mode is already the right one */ drmmode_output->dpms = mode; if (ms->atomic_modeset) { if (mode != DPMSModeOn && !ms->pending_modeset) drmmode_output_disable(output); } else { drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id, drmmode_output->dpms_enum_id, mode); } if (crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; if (mode == DPMSModeOn) { if (drmmode_crtc->need_modeset) drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); if (drmmode_crtc->enable_flipping) drmmode_InitSharedPixmapFlipping(crtc, drmmode_crtc->drmmode); } else { if (drmmode_crtc->enable_flipping) drmmode_FiniSharedPixmapFlipping(crtc, drmmode_crtc->drmmode); } } return; } static Bool drmmode_property_ignore(drmModePropertyPtr prop) { if (!prop) return TRUE; /* ignore blob prop */ if (prop->flags & DRM_MODE_PROP_BLOB) return TRUE; /* ignore standard property */ if (!strcmp(prop->name, "EDID") || !strcmp(prop->name, "DPMS") || !strcmp(prop->name, "CRTC_ID")) return TRUE; return FALSE; } static void drmmode_output_create_resources(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr mode_output = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; drmModePropertyPtr drmmode_prop; int i, j, err; drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec)); if (!drmmode_output->props) return; drmmode_output->num_props = 0; for (i = 0, j = 0; i < mode_output->count_props; i++) { drmmode_prop = drmModeGetProperty(drmmode->fd, mode_output->props[i]); if (drmmode_property_ignore(drmmode_prop)) { drmModeFreeProperty(drmmode_prop); continue; } drmmode_output->props[j].mode_prop = drmmode_prop; drmmode_output->props[j].value = mode_output->prop_values[i]; drmmode_output->num_props++; j++; } /* Create CONNECTOR_ID property */ { Atom name = MakeAtom("CONNECTOR_ID", 12, TRUE); INT32 value = mode_output->connector_id; if (name != BAD_RESOURCE) { err = RRConfigureOutputProperty(output->randr_output, name, FALSE, FALSE, TRUE, 1, &value); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } err = RRChangeOutputProperty(output->randr_output, name, XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, FALSE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } } for (i = 0; i < drmmode_output->num_props; i++) { drmmode_prop_ptr p = &drmmode_output->props[i]; drmmode_prop = p->mode_prop; if (drmmode_prop->flags & DRM_MODE_PROP_RANGE) { INT32 prop_range[2]; INT32 value = p->value; p->num_atoms = 1; p->atoms = calloc(p->num_atoms, sizeof(Atom)); if (!p->atoms) continue; p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE); prop_range[0] = drmmode_prop->values[0]; prop_range[1] = drmmode_prop->values[1]; err = RRConfigureOutputProperty(output->randr_output, p->atoms[0], FALSE, TRUE, drmmode_prop-> flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE, 2, prop_range); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } err = RRChangeOutputProperty(output->randr_output, p->atoms[0], XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) { p->num_atoms = drmmode_prop->count_enums + 1; p->atoms = calloc(p->num_atoms, sizeof(Atom)); if (!p->atoms) continue; p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE); for (j = 1; j <= drmmode_prop->count_enums; j++) { struct drm_mode_property_enum *e = &drmmode_prop->enums[j - 1]; p->atoms[j] = MakeAtom(e->name, strlen(e->name), TRUE); } err = RRConfigureOutputProperty(output->randr_output, p->atoms[0], FALSE, FALSE, drmmode_prop-> flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE, p->num_atoms - 1, (INT32 *) &p->atoms[1]); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } for (j = 0; j < drmmode_prop->count_enums; j++) if (drmmode_prop->enums[j].value == p->value) break; /* there's always a matching value */ err = RRChangeOutputProperty(output->randr_output, p->atoms[0], XA_ATOM, 32, PropModeReplace, 1, &p->atoms[j + 1], FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } } } static Bool drmmode_output_set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmmode_ptr drmmode = drmmode_output->drmmode; int i; for (i = 0; i < drmmode_output->num_props; i++) { drmmode_prop_ptr p = &drmmode_output->props[i]; if (p->atoms[0] != property) continue; if (p->mode_prop->flags & DRM_MODE_PROP_RANGE) { uint32_t val; if (value->type != XA_INTEGER || value->format != 32 || value->size != 1) return FALSE; val = *(uint32_t *) value->data; drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id, p->mode_prop->prop_id, (uint64_t) val); return TRUE; } else if (p->mode_prop->flags & DRM_MODE_PROP_ENUM) { Atom atom; const char *name; int j; if (value->type != XA_ATOM || value->format != 32 || value->size != 1) return FALSE; memcpy(&atom, value->data, 4); if (!(name = NameForAtom(atom))) return FALSE; /* search for matching name string, then set its value down */ for (j = 0; j < p->mode_prop->count_enums; j++) { if (!strcmp(p->mode_prop->enums[j].name, name)) { drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id, p->mode_prop->prop_id, p->mode_prop->enums[j].value); return TRUE; } } } } return TRUE; } static Bool drmmode_output_get_property(xf86OutputPtr output, Atom property) { return TRUE; } static const xf86OutputFuncsRec drmmode_output_funcs = { .dpms = drmmode_output_dpms, .create_resources = drmmode_output_create_resources, .set_property = drmmode_output_set_property, .get_property = drmmode_output_get_property, .detect = drmmode_output_detect, .mode_valid = drmmode_output_mode_valid, .get_modes = drmmode_output_get_modes, .destroy = drmmode_output_destroy }; static int subpixel_conv_table[7] = { 0, SubPixelUnknown, SubPixelHorizontalRGB, SubPixelHorizontalBGR, SubPixelVerticalRGB, SubPixelVerticalBGR, SubPixelNone }; static const char *const output_names[] = { "None", "VGA", "DVI-I", "DVI-D", "DVI-A", "Composite", "SVIDEO", "LVDS", "Component", "DIN", "DP", "HDMI", "HDMI-B", "TV", "eDP", "Virtual", "DSI", "DPI", }; static xf86OutputPtr find_output(ScrnInfoPtr pScrn, int id) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int i; for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output; drmmode_output = output->driver_private; if (drmmode_output->output_id == id) return output; } return NULL; } static int parse_path_blob(drmModePropertyBlobPtr path_blob, int *conn_base_id, char **path) { char *conn; char conn_id[5]; int id, len; char *blob_data; if (!path_blob) return -1; blob_data = path_blob->data; /* we only handle MST paths for now */ if (strncmp(blob_data, "mst:", 4)) return -1; conn = strchr(blob_data + 4, '-'); if (!conn) return -1; len = conn - (blob_data + 4); if (len + 1> 5) return -1; memcpy(conn_id, blob_data + 4, len); conn_id[len] = '\0'; id = strtoul(conn_id, NULL, 10); *conn_base_id = id; *path = conn + 1; return 0; } static void drmmode_create_name(ScrnInfoPtr pScrn, drmModeConnectorPtr koutput, char *name, drmModePropertyBlobPtr path_blob) { int ret; char *extra_path; int conn_id; xf86OutputPtr output; ret = parse_path_blob(path_blob, &conn_id, &extra_path); if (ret == -1) goto fallback; output = find_output(pScrn, conn_id); if (!output) goto fallback; snprintf(name, 32, "%s-%s", output->name, extra_path); return; fallback: if (koutput->connector_type >= ARRAY_SIZE(output_names)) snprintf(name, 32, "Unknown%d-%d", koutput->connector_type, koutput->connector_type_id); else if (pScrn->is_gpu) snprintf(name, 32, "%s-%d-%d", output_names[koutput->connector_type], pScrn->scrnIndex - GPU_SCREEN_OFFSET + 1, koutput->connector_type_id); else snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id); } static unsigned int drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res, int num, Bool dynamic, int crtcshift) { xf86OutputPtr output; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); modesettingPtr ms = modesettingPTR(pScrn); drmModeConnectorPtr koutput; drmModeEncoderPtr *kencoders = NULL; drmmode_output_private_ptr drmmode_output; char name[32]; int i; Bool nonDesktop = FALSE; drmModePropertyBlobPtr path_blob = NULL; const char *s; drmModeObjectPropertiesPtr props; static const drmmode_prop_info_rec connector_props[] = { [DRMMODE_CONNECTOR_CRTC_ID] = { .name = "CRTC_ID", }, }; koutput = drmModeGetConnector(drmmode->fd, mode_res->connectors[num]); if (!koutput) return 0; path_blob = koutput_get_prop_blob(drmmode->fd, koutput, "PATH"); i = koutput_get_prop_idx(drmmode->fd, koutput, DRM_MODE_PROP_RANGE, RR_PROPERTY_NON_DESKTOP); if (i >= 0) nonDesktop = koutput->prop_values[i] != 0; drmmode_create_name(pScrn, koutput, name, path_blob); if (path_blob) drmModeFreePropertyBlob(path_blob); if (path_blob && dynamic) { /* see if we have an output with this name already and hook stuff up */ for (i = 0; i < xf86_config->num_output; i++) { output = xf86_config->output[i]; if (strncmp(output->name, name, 32)) continue; drmmode_output = output->driver_private; drmmode_output->output_id = mode_res->connectors[num]; drmmode_output->mode_output = koutput; output->non_desktop = nonDesktop; return 1; } } kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders); if (!kencoders) { goto out_free_encoders; } for (i = 0; i < koutput->count_encoders; i++) { kencoders[i] = drmModeGetEncoder(drmmode->fd, koutput->encoders[i]); if (!kencoders[i]) { goto out_free_encoders; } } if (xf86IsEntityShared(pScrn->entityList[0])) { if ((s = xf86GetOptValString(drmmode->Options, OPTION_ZAPHOD_HEADS))) { if (!drmmode_zaphod_string_matches(pScrn, s, name)) goto out_free_encoders; } else { if (!drmmode->is_secondary && (num != 0)) goto out_free_encoders; else if (drmmode->is_secondary && (num != 1)) goto out_free_encoders; } } output = xf86OutputCreate(pScrn, &drmmode_output_funcs, name); if (!output) { goto out_free_encoders; } drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1); if (!drmmode_output) { xf86OutputDestroy(output); goto out_free_encoders; } drmmode_output->output_id = mode_res->connectors[num]; drmmode_output->mode_output = koutput; drmmode_output->mode_encoders = kencoders; drmmode_output->drmmode = drmmode; output->mm_width = koutput->mmWidth; output->mm_height = koutput->mmHeight; output->subpixel_order = subpixel_conv_table[koutput->subpixel]; output->interlaceAllowed = TRUE; output->doubleScanAllowed = TRUE; output->driver_private = drmmode_output; output->non_desktop = nonDesktop; output->possible_crtcs = 0x7f; for (i = 0; i < koutput->count_encoders; i++) { output->possible_crtcs &= kencoders[i]->possible_crtcs >> crtcshift; } /* work out the possible clones later */ output->possible_clones = 0; if (ms->atomic_modeset) { if (!drmmode_prop_info_copy(drmmode_output->props_connector, connector_props, DRMMODE_CONNECTOR__COUNT, 0)) { goto out_free_encoders; } props = drmModeObjectGetProperties(drmmode->fd, drmmode_output->output_id, DRM_MODE_OBJECT_CONNECTOR); drmmode_prop_info_update(drmmode, drmmode_output->props_connector, DRMMODE_CONNECTOR__COUNT, props); } else { drmmode_output->dpms_enum_id = koutput_get_prop_id(drmmode->fd, koutput, DRM_MODE_PROP_ENUM, "DPMS"); } if (dynamic) output->randr_output = RROutputCreate(xf86ScrnToScreen(pScrn), output->name, strlen(output->name), output); return 1; out_free_encoders: if (kencoders) { for (i = 0; i < koutput->count_encoders; i++) drmModeFreeEncoder(kencoders[i]); free(kencoders); } drmModeFreeConnector(koutput); return 0; } static uint32_t find_clones(ScrnInfoPtr scrn, xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private, clone_drmout; int i; xf86OutputPtr clone_output; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int index_mask = 0; if (drmmode_output->enc_clone_mask == 0) return index_mask; for (i = 0; i < xf86_config->num_output; i++) { clone_output = xf86_config->output[i]; clone_drmout = clone_output->driver_private; if (output == clone_output) continue; if (clone_drmout->enc_mask == 0) continue; if (drmmode_output->enc_clone_mask == clone_drmout->enc_mask) index_mask |= (1 << i); } return index_mask; } static void drmmode_clones_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, drmModeResPtr mode_res) { int i, j; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; drmmode_output_private_ptr drmmode_output; drmmode_output = output->driver_private; drmmode_output->enc_clone_mask = 0xff; /* and all the possible encoder clones for this output together */ for (j = 0; j < drmmode_output->mode_output->count_encoders; j++) { int k; for (k = 0; k < mode_res->count_encoders; k++) { if (mode_res->encoders[k] == drmmode_output->mode_encoders[j]->encoder_id) drmmode_output->enc_mask |= (1 << k); } drmmode_output->enc_clone_mask &= drmmode_output->mode_encoders[j]->possible_clones; } } for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; output->possible_clones = find_clones(scrn, output); } } static Bool drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo) { #ifdef GLAMOR_HAS_GBM ScrnInfoPtr scrn = drmmode->scrn; if (!drmmode->glamor) return TRUE; if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm, bo->used_modifiers)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create pixmap\n"); return FALSE; } #endif return TRUE; } Bool drmmode_glamor_handle_new_screen_pixmap(drmmode_ptr drmmode) { ScreenPtr screen = xf86ScrnToScreen(drmmode->scrn); PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen); if (!drmmode_set_pixmap_bo(drmmode, screen_pixmap, &drmmode->front_bo)) return FALSE; return TRUE; } static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); modesettingPtr ms = modesettingPTR(scrn); drmmode_ptr drmmode = &ms->drmmode; drmmode_bo old_front; ScreenPtr screen = xf86ScrnToScreen(scrn); uint32_t old_fb_id; int i, pitch, old_width, old_height, old_pitch; int cpp = (scrn->bitsPerPixel + 7) / 8; int kcpp = (drmmode->kbpp + 7) / 8; PixmapPtr ppix = screen->GetScreenPixmap(screen); void *new_pixels = NULL; if (scrn->virtualX == width && scrn->virtualY == height) return TRUE; xf86DrvMsg(scrn->scrnIndex, X_INFO, "Allocate new frame buffer %dx%d stride\n", width, height); old_width = scrn->virtualX; old_height = scrn->virtualY; old_pitch = drmmode_bo_get_pitch(&drmmode->front_bo); old_front = drmmode->front_bo; old_fb_id = drmmode->fb_id; drmmode->fb_id = 0; if (!drmmode_create_bo(drmmode, &drmmode->front_bo, width, height, drmmode->kbpp)) goto fail; pitch = drmmode_bo_get_pitch(&drmmode->front_bo); scrn->virtualX = width; scrn->virtualY = height; scrn->displayWidth = pitch / kcpp; if (!drmmode->gbm) { new_pixels = drmmode_map_front_bo(drmmode); if (!new_pixels) goto fail; } if (drmmode->shadow_enable) { uint32_t size = scrn->displayWidth * scrn->virtualY * cpp; new_pixels = calloc(1, size); if (new_pixels == NULL) goto fail; free(drmmode->shadow_fb); drmmode->shadow_fb = new_pixels; } if (drmmode->shadow_enable2) { uint32_t size = scrn->displayWidth * scrn->virtualY * cpp; void *fb2 = calloc(1, size); free(drmmode->shadow_fb2); drmmode->shadow_fb2 = fb2; } screen->ModifyPixmapHeader(ppix, width, height, -1, -1, scrn->displayWidth * cpp, new_pixels); if (!drmmode_glamor_handle_new_screen_pixmap(drmmode)) goto fail; drmmode_clear_pixmap(ppix); for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; if (!crtc->enabled) continue; drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); } if (old_fb_id) { drmModeRmFB(drmmode->fd, old_fb_id); drmmode_bo_destroy(drmmode, &old_front); } return TRUE; fail: drmmode_bo_destroy(drmmode, &drmmode->front_bo); drmmode->front_bo = old_front; scrn->virtualX = old_width; scrn->virtualY = old_height; scrn->displayWidth = old_pitch / kcpp; drmmode->fb_id = old_fb_id; return FALSE; } static void drmmode_validate_leases(ScrnInfoPtr scrn) { ScreenPtr screen = scrn->pScreen; rrScrPrivPtr scr_priv; modesettingPtr ms = modesettingPTR(scrn); drmmode_ptr drmmode = &ms->drmmode; drmModeLesseeListPtr lessees; RRLeasePtr lease, next; int l; /* Bail out if RandR wasn't initialized. */ if (!dixPrivateKeyRegistered(rrPrivKey)) return; scr_priv = rrGetScrPriv(screen); /* We can't talk to the kernel about leases when VT switched */ if (!scrn->vtSema) return; lessees = drmModeListLessees(drmmode->fd); if (!lessees) return; xorg_list_for_each_entry_safe(lease, next, &scr_priv->leases, list) { drmmode_lease_private_ptr lease_private = lease->devPrivate; for (l = 0; l < lessees->count; l++) { if (lessees->lessees[l] == lease_private->lessee_id) break; } /* check to see if the lease has gone away */ if (l == lessees->count) { free(lease_private); lease->devPrivate = NULL; xf86CrtcLeaseTerminated(lease); } } free(lessees); } static int drmmode_create_lease(RRLeasePtr lease, int *fd) { ScreenPtr screen = lease->screen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); drmmode_ptr drmmode = &ms->drmmode; int ncrtc = lease->numCrtcs; int noutput = lease->numOutputs; int nobjects; int c, o; int i; int lease_fd; uint32_t *objects; drmmode_lease_private_ptr lease_private; nobjects = ncrtc + noutput; if (ms->atomic_modeset) nobjects += ncrtc; /* account for planes as well */ if (nobjects == 0) return BadValue; lease_private = calloc(1, sizeof (drmmode_lease_private_rec)); if (!lease_private) return BadAlloc; objects = xallocarray(nobjects, sizeof (uint32_t)); if (!objects) { free(lease_private); return BadAlloc; } i = 0; /* Add CRTC and plane ids */ for (c = 0; c < ncrtc; c++) { xf86CrtcPtr crtc = lease->crtcs[c]->devPrivate; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; objects[i++] = drmmode_crtc->mode_crtc->crtc_id; if (ms->atomic_modeset) objects[i++] = drmmode_crtc->plane_id; } /* Add connector ids */ for (o = 0; o < noutput; o++) { xf86OutputPtr output = lease->outputs[o]->devPrivate; drmmode_output_private_ptr drmmode_output = output->driver_private; objects[i++] = drmmode_output->mode_output->connector_id; } /* call kernel to create lease */ assert (i == nobjects); lease_fd = drmModeCreateLease(drmmode->fd, objects, nobjects, 0, &lease_private->lessee_id); free(objects); if (lease_fd < 0) { free(lease_private); return BadMatch; } lease->devPrivate = lease_private; xf86CrtcLeaseStarted(lease); *fd = lease_fd; return Success; } static void drmmode_terminate_lease(RRLeasePtr lease) { ScreenPtr screen = lease->screen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); drmmode_ptr drmmode = &ms->drmmode; drmmode_lease_private_ptr lease_private = lease->devPrivate; if (drmModeRevokeLease(drmmode->fd, lease_private->lessee_id) == 0) { free(lease_private); lease->devPrivate = NULL; xf86CrtcLeaseTerminated(lease); } } static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = { .resize = drmmode_xf86crtc_resize, .create_lease = drmmode_create_lease, .terminate_lease = drmmode_terminate_lease }; Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp) { modesettingEntPtr ms_ent = ms_ent_priv(pScrn); int i; int ret; uint64_t value = 0; unsigned int crtcs_needed = 0; drmModeResPtr mode_res; int crtcshift; /* check for dumb capability */ ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_BUFFER, &value); if (ret > 0 || value != 1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS doesn't support dumb interface\n"); return FALSE; } xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs); drmmode->scrn = pScrn; drmmode->cpp = cpp; mode_res = drmModeGetResources(drmmode->fd); if (!mode_res) return FALSE; crtcshift = ffs(ms_ent->assigned_crtcs ^ 0xffffffff) - 1; for (i = 0; i < mode_res->count_connectors; i++) crtcs_needed += drmmode_output_init(pScrn, drmmode, mode_res, i, FALSE, crtcshift); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG, "Up to %d crtcs needed for screen.\n", crtcs_needed); xf86CrtcSetSizeRange(pScrn, 320, 200, mode_res->max_width, mode_res->max_height); for (i = 0; i < mode_res->count_crtcs; i++) if (!xf86IsEntityShared(pScrn->entityList[0]) || (crtcs_needed && !(ms_ent->assigned_crtcs & (1 << i)))) crtcs_needed -= drmmode_crtc_init(pScrn, drmmode, mode_res, i); /* All ZaphodHeads outputs provided with matching crtcs? */ if (xf86IsEntityShared(pScrn->entityList[0]) && (crtcs_needed > 0)) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%d ZaphodHeads crtcs unavailable. Some outputs will stay off.\n", crtcs_needed); /* workout clones */ drmmode_clones_init(pScrn, drmmode, mode_res); drmModeFreeResources(mode_res); xf86ProviderSetup(pScrn, NULL, "modesetting"); xf86InitialConfiguration(pScrn, TRUE); return TRUE; } Bool drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { #ifdef GLAMOR_HAS_GBM ScreenPtr pScreen = xf86ScrnToScreen(pScrn); if (drmmode->glamor) { if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) { return FALSE; } #ifdef GBM_BO_WITH_MODIFIERS glamor_set_drawable_modifiers_func(pScreen, get_drawable_modifiers); #endif } #endif return TRUE; } void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86OutputPtr output = config->output[config->compat_output]; xf86CrtcPtr crtc = output->crtc; if (crtc && crtc->enabled) { drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, x, y); } } Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; xf86OutputPtr output = NULL; int o; /* Skip disabled CRTCs */ if (!crtc->enabled) { if (set_hw) { drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, 0, 0, NULL, 0, NULL); } continue; } if (config->output[config->compat_output]->crtc == crtc) output = config->output[config->compat_output]; 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, pScrn->currentMode); if (!mode) return FALSE; crtc->desiredMode = *mode; crtc->desiredRotation = RR_Rotate_0; crtc->desiredX = 0; crtc->desiredY = 0; } if (set_hw) { if (!crtc->funcs-> set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation, crtc->desiredX, crtc->desiredY)) return FALSE; } else { crtc->mode = crtc->desiredMode; crtc->rotation = crtc->desiredRotation; crtc->x = crtc->desiredX; crtc->y = crtc->desiredY; if (!xf86CrtcRotate(crtc)) return FALSE; } } /* Validate leases on VT re-entry */ drmmode_validate_leases(pScrn); return TRUE; } static void drmmode_load_palette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); uint16_t lut_r[256], lut_g[256], lut_b[256]; int index, j, i; int c; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; for (i = 0; i < 256; i++) { lut_r[i] = drmmode_crtc->lut_r[i] << 6; lut_g[i] = drmmode_crtc->lut_g[i] << 6; lut_b[i] = drmmode_crtc->lut_b[i] << 6; } switch (pScrn->depth) { case 15: for (i = 0; i < numColors; i++) { index = indices[i]; for (j = 0; j < 8; j++) { lut_r[index * 8 + j] = colors[index].red << 6; lut_g[index * 8 + j] = colors[index].green << 6; lut_b[index * 8 + j] = colors[index].blue << 6; } } break; case 16: for (i = 0; i < numColors; i++) { index = indices[i]; if (i <= 31) { for (j = 0; j < 8; j++) { lut_r[index * 8 + j] = colors[index].red << 6; lut_b[index * 8 + j] = colors[index].blue << 6; } } for (j = 0; j < 4; j++) { lut_g[index * 4 + j] = colors[index].green << 6; } } break; default: for (i = 0; i < numColors; i++) { index = indices[i]; lut_r[index] = colors[index].red << 6; lut_g[index] = colors[index].green << 6; lut_b[index] = colors[index].blue << 6; } break; } /* Make the change through RandR */ if (crtc->randr_crtc) RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b); else crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256); } } Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0, "Initializing kms color map for depth %d, %d bpc.\n", pScrn->depth, pScrn->rgbBits); if (!miCreateDefColormap(pScreen)) return FALSE; /* Adapt color map size and depth to color depth of screen. */ if (!xf86HandleColormaps(pScreen, 1 << pScrn->rgbBits, 10, drmmode_load_palette, NULL, CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; return TRUE; } #ifdef CONFIG_UDEV_KMS #define DRM_MODE_LINK_STATUS_GOOD 0 #define DRM_MODE_LINK_STATUS_BAD 1 static void drmmode_handle_uevents(int fd, void *closure) { drmmode_ptr drmmode = closure; ScrnInfoPtr scrn = drmmode->scrn; struct udev_device *dev; drmModeResPtr mode_res; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int i, j; Bool found = FALSE; Bool changed = FALSE; while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) { udev_device_unref(dev); found = TRUE; } if (!found) return; /* Try to re-set the mode on all the connectors with a BAD link-state: * This may happen if a link degrades and a new modeset is necessary, using * different link-training parameters. If the kernel found that the current * mode is not achievable anymore, it should have pruned the mode before * sending the hotplug event. Try to re-set the currently-set mode to keep * the display alive, this will fail if the mode has been pruned. * In any case, we will send randr events for the Desktop Environment to * deal with it, if it wants to. */ for (i = 0; i < config->num_output; i++) { xf86OutputPtr output = config->output[i]; drmmode_output_private_ptr drmmode_output = output->driver_private; drmmode_output_detect(output); /* Get an updated view of the properties for the current connector and * look for the link-status property */ for (j = 0; j < drmmode_output->num_props; j++) { drmmode_prop_ptr p = &drmmode_output->props[j]; if (!strcmp(p->mode_prop->name, "link-status")) { if (p->value == DRM_MODE_LINK_STATUS_BAD) { xf86CrtcPtr crtc = output->crtc; if (!crtc) continue; /* the connector got a link failure, re-set the current mode */ drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); xf86DrvMsg(scrn->scrnIndex, X_WARNING, "hotplug event: connector %u's link-state is BAD, " "tried resetting the current mode. You may be left" "with a black screen if this fails...\n", drmmode_output->mode_output->connector_id); } break; } } } mode_res = drmModeGetResources(drmmode->fd); if (!mode_res) goto out; if (mode_res->count_crtcs != config->num_crtc) { /* this triggers with Zaphod mode where we don't currently support connector hotplug or MST. */ goto out_free_res; } /* figure out if we have gotten rid of any connectors traverse old output list looking for outputs */ for (i = 0; i < config->num_output; i++) { xf86OutputPtr output = config->output[i]; drmmode_output_private_ptr drmmode_output; drmmode_output = output->driver_private; found = FALSE; for (j = 0; j < mode_res->count_connectors; j++) { if (mode_res->connectors[j] == drmmode_output->output_id) { found = TRUE; break; } } if (found) continue; drmModeFreeConnector(drmmode_output->mode_output); drmmode_output->mode_output = NULL; drmmode_output->output_id = -1; changed = TRUE; } /* find new output ids we don't have outputs for */ for (i = 0; i < mode_res->count_connectors; i++) { found = FALSE; for (j = 0; j < config->num_output; j++) { xf86OutputPtr output = config->output[j]; drmmode_output_private_ptr drmmode_output; drmmode_output = output->driver_private; if (mode_res->connectors[i] == drmmode_output->output_id) { found = TRUE; break; } } if (found) continue; changed = TRUE; drmmode_output_init(scrn, drmmode, mode_res, i, TRUE, 0); } if (changed) { RRSetChanged(xf86ScrnToScreen(scrn)); RRTellChanged(xf86ScrnToScreen(scrn)); } out_free_res: /* Check to see if a lessee has disappeared */ drmmode_validate_leases(scrn); drmModeFreeResources(mode_res); out: RRGetInfo(xf86ScrnToScreen(scrn), TRUE); } #undef DRM_MODE_LINK_STATUS_BAD #undef DRM_MODE_LINK_STATUS_GOOD #endif void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode) { #ifdef CONFIG_UDEV_KMS struct udev *u; struct udev_monitor *mon; u = udev_new(); if (!u) return; mon = udev_monitor_new_from_netlink(u, "udev"); if (!mon) { udev_unref(u); return; } if (udev_monitor_filter_add_match_subsystem_devtype(mon, "drm", "drm_minor") < 0 || udev_monitor_enable_receiving(mon) < 0) { udev_monitor_unref(mon); udev_unref(u); return; } drmmode->uevent_handler = xf86AddGeneralHandler(udev_monitor_get_fd(mon), drmmode_handle_uevents, drmmode); drmmode->uevent_monitor = mon; #endif } void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode) { #ifdef CONFIG_UDEV_KMS if (drmmode->uevent_handler) { struct udev *u = udev_monitor_get_udev(drmmode->uevent_monitor); xf86RemoveGeneralHandler(drmmode->uevent_handler); udev_monitor_unref(drmmode->uevent_monitor); udev_unref(u); } #endif } /* create front and cursor BOs */ Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { modesettingPtr ms = modesettingPTR(pScrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int width; int height; int bpp = ms->drmmode.kbpp; int i; int cpp = (bpp + 7) / 8; width = pScrn->virtualX; height = pScrn->virtualY; if (!drmmode_create_bo(drmmode, &drmmode->front_bo, width, height, bpp)) return FALSE; pScrn->displayWidth = drmmode_bo_get_pitch(&drmmode->front_bo) / cpp; width = ms->cursor_width; height = ms->cursor_height; bpp = 32; for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc->cursor_bo = dumb_bo_create(drmmode->fd, width, height, bpp); } return TRUE; } void * drmmode_map_front_bo(drmmode_ptr drmmode) { return drmmode_bo_map(drmmode, &drmmode->front_bo); } void * drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv) { int ret; if (ppriv->backing_bo->ptr) return ppriv->backing_bo->ptr; ret = dumb_bo_map(drmmode->fd, ppriv->backing_bo); if (ret) return NULL; return ppriv->backing_bo->ptr; } Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int i, ret; for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; ret = dumb_bo_map(drmmode->fd, drmmode_crtc->cursor_bo); if (ret) return FALSE; } return TRUE; } void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int i; if (drmmode->fb_id) { drmModeRmFB(drmmode->fd, drmmode->fb_id); drmmode->fb_id = 0; } drmmode_bo_destroy(drmmode, &drmmode->front_bo); for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; dumb_bo_destroy(drmmode->fd, drmmode_crtc->cursor_bo); } } /* ugly workaround to see if we can create 32bpp */ void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth, int *bpp) { drmModeResPtr mode_res; uint64_t value; struct dumb_bo *bo; uint32_t fb_id; int ret; /* 16 is fine */ ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &value); if (!ret && (value == 16 || value == 8)) { *depth = value; *bpp = value; return; } *depth = 24; mode_res = drmModeGetResources(drmmode->fd); if (!mode_res) return; if (mode_res->min_width == 0) mode_res->min_width = 1; if (mode_res->min_height == 0) mode_res->min_height = 1; /*create a bo */ bo = dumb_bo_create(drmmode->fd, mode_res->min_width, mode_res->min_height, 32); if (!bo) { *bpp = 24; goto out; } ret = drmModeAddFB(drmmode->fd, mode_res->min_width, mode_res->min_height, 24, 32, bo->pitch, bo->handle, &fb_id); if (ret) { *bpp = 24; dumb_bo_destroy(drmmode->fd, bo); goto out; } drmModeRmFB(drmmode->fd, fb_id); *bpp = 32; dumb_bo_destroy(drmmode->fd, bo); out: drmModeFreeResources(mode_res); return; } xorg-server-1.20.8/hw/xfree86/drivers/modesetting/driver.h0000644000175000017500000001233013640201473020356 00000000000000/* * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, 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 NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Author: Alan Hourihane * */ #include #include #include #include #include #include #ifdef GLAMOR_HAS_GBM #define GLAMOR_FOR_XORG 1 #include "glamor.h" #include #endif #include "drmmode_display.h" #define MS_LOGLEVEL_DEBUG 4 typedef enum { OPTION_SW_CURSOR, OPTION_DEVICE_PATH, OPTION_SHADOW_FB, OPTION_ACCEL_METHOD, OPTION_PAGEFLIP, OPTION_ZAPHOD_HEADS, OPTION_DOUBLE_SHADOW, OPTION_ATOMIC, } modesettingOpts; typedef struct { int fd; int fd_ref; unsigned long fd_wakeup_registered; /* server generation for which fd has been registered for wakeup handling */ int fd_wakeup_ref; unsigned int assigned_crtcs; } modesettingEntRec, *modesettingEntPtr; typedef void (*ms_drm_handler_proc)(uint64_t frame, uint64_t usec, void *data); typedef void (*ms_drm_abort_proc)(void *data); /** * A tracked handler for an event that will hopefully be generated by * the kernel, and what to do when it is encountered. */ struct ms_drm_queue { struct xorg_list list; xf86CrtcPtr crtc; uint32_t seq; void *data; ScrnInfoPtr scrn; ms_drm_handler_proc handler; ms_drm_abort_proc abort; }; typedef struct _modesettingRec { int fd; Bool fd_passed; int Chipset; EntityInfoPtr pEnt; Bool noAccel; CloseScreenProcPtr CloseScreen; CreateWindowProcPtr CreateWindow; unsigned int SaveGeneration; CreateScreenResourcesProcPtr createScreenResources; ScreenBlockHandlerProcPtr BlockHandler; void *driver; drmmode_rec drmmode; drmEventContext event_context; /** * Page flipping stuff. * @{ */ Bool atomic_modeset; Bool pending_modeset; /** @} */ DamagePtr damage; Bool dirty_enabled; uint32_t cursor_width, cursor_height; Bool has_queue_sequence; Bool tried_queue_sequence; Bool kms_has_modifiers; } modesettingRec, *modesettingPtr; #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate)) modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn); uint32_t ms_drm_queue_alloc(xf86CrtcPtr crtc, void *data, ms_drm_handler_proc handler, ms_drm_abort_proc abort); typedef enum ms_queue_flag { MS_QUEUE_ABSOLUTE = 0, MS_QUEUE_RELATIVE = 1, MS_QUEUE_NEXT_ON_MISS = 2 } ms_queue_flag; Bool ms_queue_vblank(xf86CrtcPtr crtc, ms_queue_flag flags, uint64_t msc, uint64_t *msc_queued, uint32_t seq); void ms_drm_abort(ScrnInfoPtr scrn, Bool (*match)(void *data, void *match_data), void *match_data); void ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq); Bool ms_crtc_on(xf86CrtcPtr crtc); xf86CrtcPtr ms_dri2_crtc_covering_drawable(DrawablePtr pDraw); RRCrtcPtr ms_randr_crtc_covering_drawable(DrawablePtr pDraw); int ms_get_crtc_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc); uint64_t ms_kernel_msc_to_crtc_msc(xf86CrtcPtr crtc, uint64_t sequence, Bool is64bit); Bool ms_dri2_screen_init(ScreenPtr screen); void ms_dri2_close_screen(ScreenPtr screen); Bool ms_vblank_screen_init(ScreenPtr screen); void ms_vblank_close_screen(ScreenPtr screen); Bool ms_present_screen_init(ScreenPtr screen); #ifdef GLAMOR_HAS_GBM typedef void (*ms_pageflip_handler_proc)(modesettingPtr ms, uint64_t frame, uint64_t usec, void *data); typedef void (*ms_pageflip_abort_proc)(modesettingPtr ms, void *data); Bool ms_do_pageflip(ScreenPtr screen, PixmapPtr new_front, void *event, int ref_crtc_vblank_pipe, Bool async, ms_pageflip_handler_proc pageflip_handler, ms_pageflip_abort_proc pageflip_abort); #endif int ms_flush_drm_events(ScreenPtr screen); xorg-server-1.20.8/hw/xfree86/drivers/modesetting/modesetting.man0000644000175000017500000000632413640201473021737 00000000000000.\" shorthand for double quote that works everywhere. .ds q \N'34' .TH MODESETTING @drivermansuffix@ @vendorversion@ .SH NAME modesetting \- video driver for framebuffer device .SH SYNOPSIS .nf .B "Section \*qDevice\*q" .BI " Identifier \*q" devname \*q .B " Driver \*qmodesetting\*q" .BI " BusID \*qpci:" bus : dev : func \*q \ \ ... .B EndSection .fi .SH DESCRIPTION .B modesetting is an @xservername@ driver for KMS devices. This driver supports TrueColor visuals at framebuffer depths of 15, 16, 24, and 30. RandR 1.2 is supported for multi-head configurations. Acceleration is available through glamor for devices supporting at least OpenGL ES 2.0 or OpenGL 2.1. If glamor is not enabled, a shadow framebuffer is configured based on the KMS drivers' preference (unless the framebuffer is 24 bits per pixel, in which case the shadow framebuffer is always used). .SH SUPPORTED HARDWARE The .B modesetting driver supports all hardware where a KMS driver is available. modesetting uses the Linux DRM KMS ioctls and dumb object create/map. .SH CONFIGURATION DETAILS Please refer to @xconfigfile@(@filemansuffix@) for general configuration details. This section only covers configuration details specific to this driver. .PP For this driver it is not required to specify modes in the screen section of the config file. The .B modesetting driver can pick up the currently used video mode from the kernel driver and will use it if there are no video modes configured. .PP For PCI boards you might have to add a BusID line to the Device section. See above for a sample line. .PP The following driver .B Options are supported: .TP .BI "Option \*qSWcursor\*q \*q" boolean \*q Selects software cursor. The default is .B off. .TP .BI "Option \*qkmsdev\*q \*q" string \*q The framebuffer device to use. Default: /dev/dri/card0. .TP .BI "Option \*qShadowFB\*q \*q" boolean \*q Enable or disable use of the shadow framebuffer layer. Default: on. .TP .BI "Option \*qDoubleShadow\*q \*q" boolean \*q Double-buffer shadow updates. When enabled, the driver will keep two copies of the shadow framebuffer. When the shadow framebuffer is flushed, the old and new versions of the shadow are compared, and only tiles that have actually changed are uploaded to the device. This is an optimization for server-class GPUs with a remote display function (typically VNC), where remote updates are triggered by any framebuffer write, so minimizing the amount of data uploaded is crucial. This defaults to enabled for ASPEED and Matrox G200 devices, and disabled otherwise. .TP .BI "Option \*qAccelMethod\*q \*q" string \*q One of \*qglamor\*q or \*qnone\*q. Default: glamor. .TP .BI "Option \*qPageFlip\*q \*q" boolean \*q Enable DRI3 page flipping. The default is .B on. .TP .BI "Option \*qZaphodHeads\*q \*q" string \*q Specify the RandR output(s) to use with zaphod mode for a particular driver instance. If you use this option you must use this option for all instances of the driver. .br For example: .B Option \*qZaphodHeads\*q \*qLVDS,VGA-0\*q will assign xrandr outputs LVDS and VGA-0 to this instance of the driver. .TP .SH "SEE ALSO" @xservername@(@appmansuffix@), @xconfigfile@(@filemansuffix@), Xserver(@appmansuffix@), X(@miscmansuffix@) .SH AUTHORS Authors include: Dave Airlie xorg-server-1.20.8/hw/xfree86/drivers/modesetting/vblank.c0000644000175000017500000004636013640201473020345 00000000000000/* * Copyright © 2013 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. */ /** @file vblank.c * * Support for tracking the DRM's vblank events. */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include #include #include #include "driver.h" #include "drmmode_display.h" /** * Tracking for outstanding events queued to the kernel. * * Each list entry is a struct ms_drm_queue, which has a uint32_t * value generated from drm_seq that identifies the event and a * reference back to the crtc/screen associated with the event. It's * done this way rather than in the screen because we want to be able * to drain the list of event handlers that should be called at server * regen time, even though we don't close the drm fd and have no way * to actually drain the kernel events. */ static struct xorg_list ms_drm_queue; static uint32_t ms_drm_seq; static void ms_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; if (dest->x1 >= dest->x2) { dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0; return; } dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1; dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2; if (dest->y1 >= dest->y2) dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0; } static void ms_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 void ms_randr_crtc_box(RRCrtcPtr crtc, BoxPtr crtc_box) { if (crtc->mode) { crtc_box->x1 = crtc->x; crtc_box->y1 = crtc->y; switch (crtc->rotation) { case RR_Rotate_0: case RR_Rotate_180: default: crtc_box->x2 = crtc->x + crtc->mode->mode.width; crtc_box->y2 = crtc->y + crtc->mode->mode.height; break; case RR_Rotate_90: case RR_Rotate_270: crtc_box->x2 = crtc->x + crtc->mode->mode.height; crtc_box->y2 = crtc->y + crtc->mode->mode.width; break; } } else crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0; } static int ms_box_area(BoxPtr box) { return (int)(box->x2 - box->x1) * (int)(box->y2 - box->y1); } Bool ms_crtc_on(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; return crtc->enabled && drmmode_crtc->dpms_mode == DPMSModeOn; } /* * Return the first output which is connected to an active CRTC on this screen. * * RRFirstOutput() will return an output from a slave screen if it is primary, * which is not the behavior that ms_covering_crtc() wants. */ static RROutputPtr ms_first_output(ScreenPtr pScreen) { rrScrPriv(pScreen); RROutputPtr output; int i, j; if (!pScrPriv) return NULL; if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc && (pScrPriv->primaryOutput->pScreen == pScreen)) { 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; } /* * Return the crtc covering 'box'. If two crtcs cover a portion of * 'box', then prefer the crtc with greater coverage. */ static xf86CrtcPtr ms_covering_xf86_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CrtcPtr crtc, best_crtc; int coverage, best_coverage; int c; BoxRec crtc_box, cover_box; Bool crtc_on; best_crtc = NULL; best_coverage = 0; if (!xf86_config) return NULL; for (c = 0; c < xf86_config->num_crtc; c++) { crtc = xf86_config->crtc[c]; if (screen_is_ms) crtc_on = ms_crtc_on(crtc); else crtc_on = crtc->enabled; /* If the CRTC is off, treat it as not covering */ if (!crtc_on) continue; ms_crtc_box(crtc, &crtc_box); ms_box_intersect(&cover_box, &crtc_box, box); coverage = ms_box_area(&cover_box); if (coverage > best_coverage) { best_crtc = crtc; best_coverage = coverage; } } /* Fallback to primary crtc for drawable's on slave outputs */ if (best_crtc == NULL && !pScreen->isGPU) { RROutputPtr primary_output = NULL; ScreenPtr slave; if (dixPrivateKeyRegistered(rrPrivKey)) primary_output = ms_first_output(scrn->pScreen); if (!primary_output || !primary_output->crtc) return NULL; crtc = primary_output->crtc->devPrivate; if (!ms_crtc_on(crtc)) return NULL; xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) { if (!slave->is_output_slave) continue; if (ms_covering_xf86_crtc(slave, box, FALSE)) { /* The drawable is on a slave output, return primary crtc */ return crtc; } } } return best_crtc; } static RRCrtcPtr ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); rrScrPrivPtr pScrPriv; RRCrtcPtr crtc, best_crtc; int coverage, best_coverage; int c; BoxRec crtc_box, cover_box; Bool crtc_on; best_crtc = NULL; best_coverage = 0; if (!dixPrivateKeyRegistered(rrPrivKey)) return NULL; pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) return NULL; for (c = 0; c < pScrPriv->numCrtcs; c++) { crtc = pScrPriv->crtcs[c]; if (screen_is_ms) { crtc_on = ms_crtc_on((xf86CrtcPtr) crtc->devPrivate); } else { crtc_on = !!crtc->mode; } /* If the CRTC is off, treat it as not covering */ if (!crtc_on) continue; ms_randr_crtc_box(crtc, &crtc_box); ms_box_intersect(&cover_box, &crtc_box, box); coverage = ms_box_area(&cover_box); if (coverage > best_coverage) { best_crtc = crtc; best_coverage = coverage; } } /* Fallback to primary crtc for drawable's on slave outputs */ if (best_crtc == NULL && !pScreen->isGPU) { RROutputPtr primary_output = NULL; ScreenPtr slave; if (dixPrivateKeyRegistered(rrPrivKey)) primary_output = ms_first_output(scrn->pScreen); if (!primary_output || !primary_output->crtc) return NULL; crtc = primary_output->crtc; if (!ms_crtc_on((xf86CrtcPtr) crtc->devPrivate)) return NULL; xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) { if (!slave->is_output_slave) continue; if (ms_covering_randr_crtc(slave, box, FALSE)) { /* The drawable is on a slave output, return primary crtc */ return crtc; } } } return best_crtc; } xf86CrtcPtr ms_dri2_crtc_covering_drawable(DrawablePtr pDraw) { ScreenPtr pScreen = pDraw->pScreen; BoxRec box; box.x1 = pDraw->x; box.y1 = pDraw->y; box.x2 = box.x1 + pDraw->width; box.y2 = box.y1 + pDraw->height; return ms_covering_xf86_crtc(pScreen, &box, TRUE); } RRCrtcPtr ms_randr_crtc_covering_drawable(DrawablePtr pDraw) { ScreenPtr pScreen = pDraw->pScreen; BoxRec box; box.x1 = pDraw->x; box.y1 = pDraw->y; box.x2 = box.x1 + pDraw->width; box.y2 = box.y1 + pDraw->height; return ms_covering_randr_crtc(pScreen, &box, TRUE); } static Bool ms_get_kernel_ust_msc(xf86CrtcPtr crtc, uint64_t *msc, uint64_t *ust) { ScreenPtr screen = crtc->randr_crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmVBlank vbl; int ret; if (ms->has_queue_sequence || !ms->tried_queue_sequence) { uint64_t ns; ms->tried_queue_sequence = TRUE; ret = drmCrtcGetSequence(ms->fd, drmmode_crtc->mode_crtc->crtc_id, msc, &ns); if (ret != -1 || (errno != ENOTTY && errno != EINVAL)) { ms->has_queue_sequence = TRUE; if (ret == 0) *ust = ns / 1000; return ret == 0; } } /* Get current count */ vbl.request.type = DRM_VBLANK_RELATIVE | drmmode_crtc->vblank_pipe; vbl.request.sequence = 0; vbl.request.signal = 0; ret = drmWaitVBlank(ms->fd, &vbl); if (ret) { *msc = 0; *ust = 0; return FALSE; } else { *msc = vbl.reply.sequence; *ust = (CARD64) vbl.reply.tval_sec * 1000000 + vbl.reply.tval_usec; return TRUE; } } Bool ms_queue_vblank(xf86CrtcPtr crtc, ms_queue_flag flags, uint64_t msc, uint64_t *msc_queued, uint32_t seq) { ScreenPtr screen = crtc->randr_crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmVBlank vbl; int ret; for (;;) { /* Queue an event at the specified sequence */ if (ms->has_queue_sequence || !ms->tried_queue_sequence) { uint32_t drm_flags = 0; uint64_t kernel_queued; ms->tried_queue_sequence = TRUE; if (flags & MS_QUEUE_RELATIVE) drm_flags |= DRM_CRTC_SEQUENCE_RELATIVE; if (flags & MS_QUEUE_NEXT_ON_MISS) drm_flags |= DRM_CRTC_SEQUENCE_NEXT_ON_MISS; ret = drmCrtcQueueSequence(ms->fd, drmmode_crtc->mode_crtc->crtc_id, drm_flags, msc, &kernel_queued, seq); if (ret == 0) { if (msc_queued) *msc_queued = ms_kernel_msc_to_crtc_msc(crtc, kernel_queued, TRUE); ms->has_queue_sequence = TRUE; return TRUE; } if (ret != -1 || (errno != ENOTTY && errno != EINVAL)) { ms->has_queue_sequence = TRUE; goto check; } } vbl.request.type = DRM_VBLANK_EVENT | drmmode_crtc->vblank_pipe; if (flags & MS_QUEUE_RELATIVE) vbl.request.type |= DRM_VBLANK_RELATIVE; else vbl.request.type |= DRM_VBLANK_ABSOLUTE; if (flags & MS_QUEUE_NEXT_ON_MISS) vbl.request.type |= DRM_VBLANK_NEXTONMISS; vbl.request.sequence = msc; vbl.request.signal = seq; ret = drmWaitVBlank(ms->fd, &vbl); if (ret == 0) { if (msc_queued) *msc_queued = ms_kernel_msc_to_crtc_msc(crtc, vbl.reply.sequence, FALSE); return TRUE; } check: if (errno != EBUSY) { ms_drm_abort_seq(scrn, seq); return FALSE; } ms_flush_drm_events(screen); } } /** * Convert a 32-bit or 64-bit kernel MSC sequence number to a 64-bit local * sequence number, adding in the high 32 bits, and dealing with 32-bit * wrapping if needed. */ uint64_t ms_kernel_msc_to_crtc_msc(xf86CrtcPtr crtc, uint64_t sequence, Bool is64bit) { drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private; if (!is64bit) { /* sequence is provided as a 32 bit value from one of the 32 bit apis, * e.g., drmWaitVBlank(), classic vblank events, or pageflip events. * * Track and handle 32-Bit wrapping, somewhat robust against occasional * out-of-order not always monotonically increasing sequence values. */ if ((int64_t) sequence < ((int64_t) drmmode_crtc->msc_prev - 0x40000000)) drmmode_crtc->msc_high += 0x100000000L; if ((int64_t) sequence > ((int64_t) drmmode_crtc->msc_prev + 0x40000000)) drmmode_crtc->msc_high -= 0x100000000L; drmmode_crtc->msc_prev = sequence; return drmmode_crtc->msc_high + sequence; } /* True 64-Bit sequence from Linux 4.15+ 64-Bit drmCrtcGetSequence / * drmCrtcQueueSequence apis and events. Pass through sequence unmodified, * but update the 32-bit tracking variables with reliable ground truth. * * With 64-Bit api in use, the only !is64bit input is from pageflip events, * and any pageflip event is usually preceeded by some is64bit input from * swap scheduling, so this should provide reliable mapping for pageflip * events based on true 64-bit input as baseline as well. */ drmmode_crtc->msc_prev = sequence; drmmode_crtc->msc_high = sequence & 0xffffffff00000000; return sequence; } int ms_get_crtc_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc) { ScreenPtr screen = crtc->randr_crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); uint64_t kernel_msc; if (!ms_get_kernel_ust_msc(crtc, &kernel_msc, ust)) return BadMatch; *msc = ms_kernel_msc_to_crtc_msc(crtc, kernel_msc, ms->has_queue_sequence); return Success; } /** * Check for pending DRM events and process them. */ static void ms_drm_socket_handler(int fd, int ready, void *data) { ScreenPtr screen = data; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); if (data == NULL) return; drmHandleEvent(fd, &ms->event_context); } /* * Enqueue a potential drm response; when the associated response * appears, we've got data to pass to the handler from here */ uint32_t ms_drm_queue_alloc(xf86CrtcPtr crtc, void *data, ms_drm_handler_proc handler, ms_drm_abort_proc abort) { ScreenPtr screen = crtc->randr_crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct ms_drm_queue *q; q = calloc(1, sizeof(struct ms_drm_queue)); if (!q) return 0; if (!ms_drm_seq) ++ms_drm_seq; q->seq = ms_drm_seq++; q->scrn = scrn; q->crtc = crtc; q->data = data; q->handler = handler; q->abort = abort; xorg_list_add(&q->list, &ms_drm_queue); return q->seq; } /** * Abort one queued DRM entry, removing it * from the list, calling the abort function and * freeing the memory */ static void ms_drm_abort_one(struct ms_drm_queue *q) { xorg_list_del(&q->list); q->abort(q->data); free(q); } /** * Abort all queued entries on a specific scrn, used * when resetting the X server */ static void ms_drm_abort_scrn(ScrnInfoPtr scrn) { struct ms_drm_queue *q, *tmp; xorg_list_for_each_entry_safe(q, tmp, &ms_drm_queue, list) { if (q->scrn == scrn) ms_drm_abort_one(q); } } /** * Abort by drm queue sequence number. */ void ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq) { struct ms_drm_queue *q, *tmp; xorg_list_for_each_entry_safe(q, tmp, &ms_drm_queue, list) { if (q->seq == seq) { ms_drm_abort_one(q); break; } } } /* * Externally usable abort function that uses a callback to match a single * queued entry to abort */ void ms_drm_abort(ScrnInfoPtr scrn, Bool (*match)(void *data, void *match_data), void *match_data) { struct ms_drm_queue *q; xorg_list_for_each_entry(q, &ms_drm_queue, list) { if (match(q->data, match_data)) { ms_drm_abort_one(q); break; } } } /* * General DRM kernel handler. Looks for the matching sequence number in the * drm event queue and calls the handler for it. */ static void ms_drm_sequence_handler(int fd, uint64_t frame, uint64_t ns, Bool is64bit, uint64_t user_data) { struct ms_drm_queue *q, *tmp; uint32_t seq = (uint32_t) user_data; xorg_list_for_each_entry_safe(q, tmp, &ms_drm_queue, list) { if (q->seq == seq) { uint64_t msc; msc = ms_kernel_msc_to_crtc_msc(q->crtc, frame, is64bit); xorg_list_del(&q->list); q->handler(msc, ns / 1000, q->data); free(q); break; } } } static void ms_drm_sequence_handler_64bit(int fd, uint64_t frame, uint64_t ns, uint64_t user_data) { /* frame is true 64 bit wrapped into 64 bit */ ms_drm_sequence_handler(fd, frame, ns, TRUE, user_data); } static void ms_drm_handler(int fd, uint32_t frame, uint32_t sec, uint32_t usec, void *user_ptr) { /* frame is 32 bit wrapped into 64 bit */ ms_drm_sequence_handler(fd, frame, ((uint64_t) sec * 1000000 + usec) * 1000, FALSE, (uint32_t) (uintptr_t) user_ptr); } Bool ms_vblank_screen_init(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); modesettingEntPtr ms_ent = ms_ent_priv(scrn); xorg_list_init(&ms_drm_queue); ms->event_context.version = 4; ms->event_context.vblank_handler = ms_drm_handler; ms->event_context.page_flip_handler = ms_drm_handler; ms->event_context.sequence_handler = ms_drm_sequence_handler_64bit; /* We need to re-register the DRM fd for the synchronisation * feedback on every server generation, so perform the * registration within ScreenInit and not PreInit. */ if (ms_ent->fd_wakeup_registered != serverGeneration) { SetNotifyFd(ms->fd, ms_drm_socket_handler, X_NOTIFY_READ, screen); ms_ent->fd_wakeup_registered = serverGeneration; ms_ent->fd_wakeup_ref = 1; } else ms_ent->fd_wakeup_ref++; return TRUE; } void ms_vblank_close_screen(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); modesettingEntPtr ms_ent = ms_ent_priv(scrn); ms_drm_abort_scrn(scrn); if (ms_ent->fd_wakeup_registered == serverGeneration && !--ms_ent->fd_wakeup_ref) { RemoveNotifyFd(ms->fd); } } xorg-server-1.20.8/hw/xfree86/drivers/modesetting/dri2.c0000644000175000017500000010034313640201473017720 00000000000000/* * Copyright © 2013 Intel Corporation * Copyright © 2014 Broadcom * * 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. */ /** * @file dri2.c * * Implements generic support for DRI2 on KMS, using glamor pixmaps * for color buffer management (no support for other aux buffers), and * the DRM vblank ioctls. * * This doesn't implement pageflipping yet. */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include #include "list.h" #include "xf86.h" #include "driver.h" #include "dri2.h" #ifdef GLAMOR_HAS_GBM enum ms_dri2_frame_event_type { MS_DRI2_QUEUE_SWAP, MS_DRI2_QUEUE_FLIP, MS_DRI2_WAIT_MSC, }; typedef struct ms_dri2_frame_event { ScreenPtr screen; DrawablePtr drawable; ClientPtr client; enum ms_dri2_frame_event_type type; int frame; xf86CrtcPtr crtc; struct xorg_list drawable_resource, client_resource; /* for swaps & flips only */ DRI2SwapEventPtr event_complete; void *event_data; DRI2BufferPtr front; DRI2BufferPtr back; } ms_dri2_frame_event_rec, *ms_dri2_frame_event_ptr; typedef struct { int refcnt; PixmapPtr pixmap; } ms_dri2_buffer_private_rec, *ms_dri2_buffer_private_ptr; static DevPrivateKeyRec ms_dri2_client_key; static RESTYPE frame_event_client_type, frame_event_drawable_type; static int ms_dri2_server_generation; struct ms_dri2_resource { XID id; RESTYPE type; struct xorg_list list; }; static struct ms_dri2_resource * ms_get_resource(XID id, RESTYPE type) { struct ms_dri2_resource *resource; void *ptr; ptr = NULL; dixLookupResourceByType(&ptr, id, type, NULL, DixWriteAccess); if (ptr) return ptr; resource = malloc(sizeof(*resource)); if (resource == NULL) return NULL; if (!AddResource(id, type, resource)) return NULL; resource->id = id; resource->type = type; xorg_list_init(&resource->list); return resource; } static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable) { ScreenPtr screen = drawable->pScreen; if (drawable->type == DRAWABLE_PIXMAP) return (PixmapPtr) drawable; else return screen->GetWindowPixmap((WindowPtr) drawable); } static DRI2Buffer2Ptr ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable, unsigned int attachment, unsigned int format) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); DRI2Buffer2Ptr buffer; PixmapPtr pixmap; CARD32 size; CARD16 pitch; ms_dri2_buffer_private_ptr private; buffer = calloc(1, sizeof *buffer); if (buffer == NULL) return NULL; private = calloc(1, sizeof(*private)); if (private == NULL) { free(buffer); return NULL; } pixmap = NULL; if (attachment == DRI2BufferFrontLeft) { pixmap = get_drawable_pixmap(drawable); if (pixmap && pixmap->drawable.pScreen != screen) pixmap = NULL; if (pixmap) pixmap->refcnt++; } if (pixmap == NULL) { int pixmap_width = drawable->width; int pixmap_height = drawable->height; int pixmap_cpp = (format != 0) ? format : drawable->depth; /* Assume that non-color-buffers require special * device-specific handling. Mesa currently makes no requests * for non-color aux buffers. */ switch (attachment) { case DRI2BufferAccum: case DRI2BufferBackLeft: case DRI2BufferBackRight: case DRI2BufferFakeFrontLeft: case DRI2BufferFakeFrontRight: case DRI2BufferFrontLeft: case DRI2BufferFrontRight: break; case DRI2BufferStencil: case DRI2BufferDepth: case DRI2BufferDepthStencil: case DRI2BufferHiz: default: xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Request for DRI2 buffer attachment %d unsupported\n", attachment); free(private); free(buffer); return NULL; } pixmap = screen->CreatePixmap(screen, pixmap_width, pixmap_height, pixmap_cpp, 0); if (pixmap == NULL) { free(private); free(buffer); return NULL; } } buffer->attachment = attachment; buffer->cpp = pixmap->drawable.bitsPerPixel / 8; buffer->format = format; /* The buffer's flags field is unused by the client drivers in * Mesa currently. */ buffer->flags = 0; buffer->name = glamor_name_from_pixmap(pixmap, &pitch, &size); buffer->pitch = pitch; if (buffer->name == -1) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to get DRI2 name for pixmap\n"); screen->DestroyPixmap(pixmap); free(private); free(buffer); return NULL; } buffer->driverPrivate = private; private->refcnt = 1; private->pixmap = pixmap; return buffer; } static DRI2Buffer2Ptr ms_dri2_create_buffer(DrawablePtr drawable, unsigned int attachment, unsigned int format) { return ms_dri2_create_buffer2(drawable->pScreen, drawable, attachment, format); } static void ms_dri2_reference_buffer(DRI2Buffer2Ptr buffer) { if (buffer) { ms_dri2_buffer_private_ptr private = buffer->driverPrivate; private->refcnt++; } } static void ms_dri2_destroy_buffer2(ScreenPtr unused, DrawablePtr unused2, DRI2Buffer2Ptr buffer) { if (!buffer) return; if (buffer->driverPrivate) { ms_dri2_buffer_private_ptr private = buffer->driverPrivate; if (--private->refcnt == 0) { ScreenPtr screen = private->pixmap->drawable.pScreen; screen->DestroyPixmap(private->pixmap); free(private); free(buffer); } } else { free(buffer); } } static void ms_dri2_destroy_buffer(DrawablePtr drawable, DRI2Buffer2Ptr buffer) { ms_dri2_destroy_buffer2(NULL, drawable, buffer); } static void ms_dri2_copy_region2(ScreenPtr screen, DrawablePtr drawable, RegionPtr pRegion, DRI2BufferPtr destBuffer, DRI2BufferPtr sourceBuffer) { ms_dri2_buffer_private_ptr src_priv = sourceBuffer->driverPrivate; ms_dri2_buffer_private_ptr dst_priv = destBuffer->driverPrivate; PixmapPtr src_pixmap = src_priv->pixmap; PixmapPtr dst_pixmap = dst_priv->pixmap; DrawablePtr src = (sourceBuffer->attachment == DRI2BufferFrontLeft) ? drawable : &src_pixmap->drawable; DrawablePtr dst = (destBuffer->attachment == DRI2BufferFrontLeft) ? drawable : &dst_pixmap->drawable; int off_x = 0, off_y = 0; Bool translate = FALSE; RegionPtr pCopyClip; GCPtr gc; if (destBuffer->attachment == DRI2BufferFrontLeft && drawable->pScreen != screen) { dst = DRI2UpdatePrime(drawable, destBuffer); if (!dst) return; if (dst != drawable) translate = TRUE; } if (translate && drawable->type == DRAWABLE_WINDOW) { #ifdef COMPOSITE PixmapPtr pixmap = get_drawable_pixmap(drawable); off_x = -pixmap->screen_x; off_y = -pixmap->screen_y; #endif off_x += drawable->x; off_y += drawable->y; } gc = GetScratchGC(dst->depth, screen); if (!gc) return; pCopyClip = REGION_CREATE(screen, NULL, 0); REGION_COPY(screen, pCopyClip, pRegion); if (translate) REGION_TRANSLATE(screen, pCopyClip, off_x, off_y); (*gc->funcs->ChangeClip) (gc, CT_REGION, pCopyClip, 0); ValidateGC(dst, gc); /* It's important that this copy gets submitted before the direct * rendering client submits rendering for the next frame, but we * don't actually need to submit right now. The client will wait * for the DRI2CopyRegion reply or the swap buffer event before * rendering, and we'll hit the flush callback chain before those * messages are sent. We submit our batch buffers from the flush * callback chain so we know that will happen before the client * tries to render again. */ gc->ops->CopyArea(src, dst, gc, 0, 0, drawable->width, drawable->height, off_x, off_y); FreeScratchGC(gc); } static void ms_dri2_copy_region(DrawablePtr drawable, RegionPtr pRegion, DRI2BufferPtr destBuffer, DRI2BufferPtr sourceBuffer) { ms_dri2_copy_region2(drawable->pScreen, drawable, pRegion, destBuffer, sourceBuffer); } static uint64_t gettime_us(void) { struct timespec tv; if (clock_gettime(CLOCK_MONOTONIC, &tv)) return 0; return (uint64_t)tv.tv_sec * 1000000 + tv.tv_nsec / 1000; } /** * Get current frame count and frame count timestamp, based on drawable's * crtc. */ static int ms_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc) { int ret; xf86CrtcPtr crtc = ms_dri2_crtc_covering_drawable(draw); /* Drawable not displayed, make up a *monotonic* value */ if (crtc == NULL) { *ust = gettime_us(); *msc = 0; return TRUE; } ret = ms_get_crtc_ust_msc(crtc, ust, msc); if (ret) return FALSE; return TRUE; } static XID get_client_id(ClientPtr client) { XID *ptr = dixGetPrivateAddr(&client->devPrivates, &ms_dri2_client_key); if (*ptr == 0) *ptr = FakeClientID(client->index); return *ptr; } /* * Hook this frame event into the server resource * database so we can clean it up if the drawable or * client exits while the swap is pending */ static Bool ms_dri2_add_frame_event(ms_dri2_frame_event_ptr info) { struct ms_dri2_resource *resource; resource = ms_get_resource(get_client_id(info->client), frame_event_client_type); if (resource == NULL) return FALSE; xorg_list_add(&info->client_resource, &resource->list); resource = ms_get_resource(info->drawable->id, frame_event_drawable_type); if (resource == NULL) { xorg_list_del(&info->client_resource); return FALSE; } xorg_list_add(&info->drawable_resource, &resource->list); return TRUE; } static void ms_dri2_del_frame_event(ms_dri2_frame_event_rec *info) { xorg_list_del(&info->client_resource); xorg_list_del(&info->drawable_resource); if (info->front) ms_dri2_destroy_buffer(NULL, info->front); if (info->back) ms_dri2_destroy_buffer(NULL, info->back); free(info); } static void ms_dri2_blit_swap(DrawablePtr drawable, DRI2BufferPtr dst, DRI2BufferPtr src) { BoxRec box; RegionRec region; box.x1 = 0; box.y1 = 0; box.x2 = drawable->width; box.y2 = drawable->height; REGION_INIT(pScreen, ®ion, &box, 0); ms_dri2_copy_region(drawable, ®ion, dst, src); } struct ms_dri2_vblank_event { XID drawable_id; ClientPtr client; DRI2SwapEventPtr event_complete; void *event_data; }; static void ms_dri2_flip_abort(modesettingPtr ms, void *data) { struct ms_present_vblank_event *event = data; ms->drmmode.dri2_flipping = FALSE; free(event); } static void ms_dri2_flip_handler(modesettingPtr ms, uint64_t msc, uint64_t ust, void *data) { struct ms_dri2_vblank_event *event = data; uint32_t frame = msc; uint32_t tv_sec = ust / 1000000; uint32_t tv_usec = ust % 1000000; DrawablePtr drawable; int status; status = dixLookupDrawable(&drawable, event->drawable_id, serverClient, M_ANY, DixWriteAccess); if (status == Success) DRI2SwapComplete(event->client, drawable, frame, tv_sec, tv_usec, DRI2_FLIP_COMPLETE, event->event_complete, event->event_data); ms->drmmode.dri2_flipping = FALSE; free(event); } static Bool ms_dri2_schedule_flip(ms_dri2_frame_event_ptr info) { DrawablePtr draw = info->drawable; ScreenPtr screen = draw->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); ms_dri2_buffer_private_ptr back_priv = info->back->driverPrivate; struct ms_dri2_vblank_event *event; drmmode_crtc_private_ptr drmmode_crtc = info->crtc->driver_private; event = calloc(1, sizeof(struct ms_dri2_vblank_event)); if (!event) return FALSE; event->drawable_id = draw->id; event->client = info->client; event->event_complete = info->event_complete; event->event_data = info->event_data; if (ms_do_pageflip(screen, back_priv->pixmap, event, drmmode_crtc->vblank_pipe, FALSE, ms_dri2_flip_handler, ms_dri2_flip_abort)) { ms->drmmode.dri2_flipping = TRUE; return TRUE; } return FALSE; } static Bool update_front(DrawablePtr draw, DRI2BufferPtr front) { ScreenPtr screen = draw->pScreen; PixmapPtr pixmap = get_drawable_pixmap(draw); ms_dri2_buffer_private_ptr priv = front->driverPrivate; CARD32 size; CARD16 pitch; int name; name = glamor_name_from_pixmap(pixmap, &pitch, &size); if (name < 0) return FALSE; front->name = name; (*screen->DestroyPixmap) (priv->pixmap); front->pitch = pixmap->devKind; front->cpp = pixmap->drawable.bitsPerPixel / 8; priv->pixmap = pixmap; pixmap->refcnt++; return TRUE; } static Bool can_exchange(ScrnInfoPtr scrn, DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back) { ms_dri2_buffer_private_ptr front_priv = front->driverPrivate; ms_dri2_buffer_private_ptr back_priv = back->driverPrivate; PixmapPtr front_pixmap; PixmapPtr back_pixmap = back_priv->pixmap; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int num_crtcs_on = 0; int i; for (i = 0; i < config->num_crtc; i++) { drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private; /* Don't do pageflipping if CRTCs are rotated. */ #ifdef GLAMOR_HAS_GBM if (drmmode_crtc->rotate_bo.gbm) return FALSE; #endif if (ms_crtc_on(config->crtc[i])) num_crtcs_on++; } /* We can't do pageflipping if all the CRTCs are off. */ if (num_crtcs_on == 0) return FALSE; if (!update_front(draw, front)) return FALSE; front_pixmap = front_priv->pixmap; if (front_pixmap->drawable.width != back_pixmap->drawable.width) return FALSE; if (front_pixmap->drawable.height != back_pixmap->drawable.height) return FALSE; if (front_pixmap->drawable.bitsPerPixel != back_pixmap->drawable.bitsPerPixel) return FALSE; if (front_pixmap->devKind != back_pixmap->devKind) return FALSE; return TRUE; } static Bool can_flip(ScrnInfoPtr scrn, DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back) { modesettingPtr ms = modesettingPTR(scrn); return draw->type == DRAWABLE_WINDOW && ms->drmmode.pageflip && !ms->drmmode.present_flipping && scrn->vtSema && DRI2CanFlip(draw) && can_exchange(scrn, draw, front, back); } static void ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back) { ms_dri2_buffer_private_ptr front_priv = front->driverPrivate; ms_dri2_buffer_private_ptr back_priv = back->driverPrivate; ScreenPtr screen = draw->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); msPixmapPrivPtr front_pix = msGetPixmapPriv(&ms->drmmode, front_priv->pixmap); msPixmapPrivPtr back_pix = msGetPixmapPriv(&ms->drmmode, back_priv->pixmap); msPixmapPrivRec tmp_pix; RegionRec region; int tmp; /* Swap BO names so DRI works */ tmp = front->name; front->name = back->name; back->name = tmp; /* Swap pixmap privates */ tmp_pix = *front_pix; *front_pix = *back_pix; *back_pix = tmp_pix; glamor_egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap); /* Post damage on the front buffer so that listeners, such * as DisplayLink know take a copy and shove it over the USB. */ region.extents.x1 = region.extents.y1 = 0; region.extents.x2 = front_priv->pixmap->drawable.width; region.extents.y2 = front_priv->pixmap->drawable.height; region.data = NULL; DamageRegionAppend(&front_priv->pixmap->drawable, ®ion); DamageRegionProcessPending(&front_priv->pixmap->drawable); } static void ms_dri2_frame_event_handler(uint64_t msc, uint64_t usec, void *data) { ms_dri2_frame_event_ptr frame_info = data; DrawablePtr drawable = frame_info->drawable; ScreenPtr screen = frame_info->screen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); uint32_t tv_sec = usec / 1000000; uint32_t tv_usec = usec % 1000000; if (!drawable) { ms_dri2_del_frame_event(frame_info); return; } switch (frame_info->type) { case MS_DRI2_QUEUE_FLIP: if (can_flip(scrn, drawable, frame_info->front, frame_info->back) && ms_dri2_schedule_flip(frame_info)) { ms_dri2_exchange_buffers(drawable, frame_info->front, frame_info->back); break; } /* else fall through to blit */ case MS_DRI2_QUEUE_SWAP: ms_dri2_blit_swap(drawable, frame_info->front, frame_info->back); DRI2SwapComplete(frame_info->client, drawable, msc, tv_sec, tv_usec, DRI2_BLIT_COMPLETE, frame_info->client ? frame_info->event_complete : NULL, frame_info->event_data); break; case MS_DRI2_WAIT_MSC: if (frame_info->client) DRI2WaitMSCComplete(frame_info->client, drawable, msc, tv_sec, tv_usec); break; default: xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: unknown vblank event (type %d) received\n", __func__, frame_info->type); break; } ms_dri2_del_frame_event(frame_info); } static void ms_dri2_frame_event_abort(void *data) { ms_dri2_frame_event_ptr frame_info = data; ms_dri2_del_frame_event(frame_info); } /** * Request a DRM event when the requested conditions will be satisfied. * * We need to handle the event and ask the server to wake up the client when * we receive it. */ static int ms_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, CARD64 target_msc, CARD64 divisor, CARD64 remainder) { ScreenPtr screen = draw->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); ms_dri2_frame_event_ptr wait_info; int ret; xf86CrtcPtr crtc = ms_dri2_crtc_covering_drawable(draw); CARD64 current_msc, current_ust, request_msc; uint32_t seq; uint64_t queued_msc; /* Drawable not visible, return immediately */ if (!crtc) goto out_complete; wait_info = calloc(1, sizeof(*wait_info)); if (!wait_info) goto out_complete; wait_info->screen = screen; wait_info->drawable = draw; wait_info->client = client; wait_info->type = MS_DRI2_WAIT_MSC; if (!ms_dri2_add_frame_event(wait_info)) { free(wait_info); wait_info = NULL; goto out_complete; } /* Get current count */ ret = ms_get_crtc_ust_msc(crtc, ¤t_ust, ¤t_msc); /* * If divisor is zero, or current_msc is smaller than target_msc, * we just need to make sure target_msc passes before waking up the * client. */ if (divisor == 0 || current_msc < target_msc) { /* If target_msc already reached or passed, set it to * current_msc to ensure we return a reasonable value back * to the caller. This keeps the client from continually * sending us MSC targets from the past by forcibly updating * their count on this call. */ seq = ms_drm_queue_alloc(crtc, wait_info, ms_dri2_frame_event_handler, ms_dri2_frame_event_abort); if (!seq) goto out_free; if (current_msc >= target_msc) target_msc = current_msc; ret = ms_queue_vblank(crtc, MS_QUEUE_ABSOLUTE, target_msc, &queued_msc, seq); if (!ret) { static int limit = 5; if (limit) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s:%d get vblank counter failed: %s\n", __FUNCTION__, __LINE__, strerror(errno)); limit--; } goto out_free; } wait_info->frame = queued_msc; DRI2BlockClient(client, draw); return TRUE; } /* * If we get here, target_msc has already passed or we don't have one, * so we queue an event that will satisfy the divisor/remainder equation. */ request_msc = current_msc - (current_msc % divisor) + remainder; /* * If calculated remainder is larger than requested remainder, * it means we've passed the last point where * seq % divisor == remainder, so we need to wait for the next time * that will happen. */ if ((current_msc % divisor) >= remainder) request_msc += divisor; seq = ms_drm_queue_alloc(crtc, wait_info, ms_dri2_frame_event_handler, ms_dri2_frame_event_abort); if (!seq) goto out_free; if (!ms_queue_vblank(crtc, MS_QUEUE_ABSOLUTE, request_msc, &queued_msc, seq)) { static int limit = 5; if (limit) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s:%d get vblank counter failed: %s\n", __FUNCTION__, __LINE__, strerror(errno)); limit--; } goto out_free; } wait_info->frame = queued_msc; DRI2BlockClient(client, draw); return TRUE; out_free: ms_dri2_del_frame_event(wait_info); out_complete: DRI2WaitMSCComplete(client, draw, target_msc, 0, 0); return TRUE; } /** * ScheduleSwap is responsible for requesting a DRM vblank event for * the appropriate frame, or executing the swap immediately if it * doesn't need to wait. * * When the swap is complete, the driver should call into the server so it * can send any swap complete events that have been requested. */ static int ms_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back, CARD64 *target_msc, CARD64 divisor, CARD64 remainder, DRI2SwapEventPtr func, void *data) { ScreenPtr screen = draw->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); int ret, flip = 0; xf86CrtcPtr crtc = ms_dri2_crtc_covering_drawable(draw); ms_dri2_frame_event_ptr frame_info = NULL; uint64_t current_msc, current_ust; uint64_t request_msc; uint32_t seq; ms_queue_flag ms_flag = MS_QUEUE_ABSOLUTE; uint64_t queued_msc; /* Drawable not displayed... just complete the swap */ if (!crtc) goto blit_fallback; frame_info = calloc(1, sizeof(*frame_info)); if (!frame_info) goto blit_fallback; frame_info->screen = screen; frame_info->drawable = draw; frame_info->client = client; frame_info->event_complete = func; frame_info->event_data = data; frame_info->front = front; frame_info->back = back; frame_info->crtc = crtc; frame_info->type = MS_DRI2_QUEUE_SWAP; if (!ms_dri2_add_frame_event(frame_info)) { free(frame_info); frame_info = NULL; goto blit_fallback; } ms_dri2_reference_buffer(front); ms_dri2_reference_buffer(back); ret = ms_get_crtc_ust_msc(crtc, ¤t_ust, ¤t_msc); if (ret != Success) goto blit_fallback; /* Flips need to be submitted one frame before */ if (can_flip(scrn, draw, front, back)) { frame_info->type = MS_DRI2_QUEUE_FLIP; flip = 1; } /* Correct target_msc by 'flip' if frame_info->type == MS_DRI2_QUEUE_FLIP. * Do it early, so handling of different timing constraints * for divisor, remainder and msc vs. target_msc works. */ if (*target_msc > 0) *target_msc -= flip; /* If non-pageflipping, but blitting/exchanging, we need to use * DRM_VBLANK_NEXTONMISS to avoid unreliable timestamping later * on. */ if (flip == 0) ms_flag |= MS_QUEUE_NEXT_ON_MISS; /* * If divisor is zero, or current_msc is smaller than target_msc * we just need to make sure target_msc passes before initiating * the swap. */ if (divisor == 0 || current_msc < *target_msc) { /* If target_msc already reached or passed, set it to * current_msc to ensure we return a reasonable value back * to the caller. This makes swap_interval logic more robust. */ if (current_msc >= *target_msc) *target_msc = current_msc; seq = ms_drm_queue_alloc(crtc, frame_info, ms_dri2_frame_event_handler, ms_dri2_frame_event_abort); if (!seq) goto blit_fallback; if (!ms_queue_vblank(crtc, ms_flag, *target_msc, &queued_msc, seq)) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "divisor 0 get vblank counter failed: %s\n", strerror(errno)); goto blit_fallback; } *target_msc = queued_msc + flip; frame_info->frame = *target_msc; return TRUE; } /* * If we get here, target_msc has already passed or we don't have one, * and we need to queue an event that will satisfy the divisor/remainder * equation. */ request_msc = current_msc - (current_msc % divisor) + remainder; /* * If the calculated deadline vbl.request.sequence is smaller than * or equal to current_msc, it means we've passed the last point * when effective onset frame seq could satisfy * seq % divisor == remainder, so we need to wait for the next time * this will happen. * This comparison takes the DRM_VBLANK_NEXTONMISS delay into account. */ if (request_msc <= current_msc) request_msc += divisor; seq = ms_drm_queue_alloc(crtc, frame_info, ms_dri2_frame_event_handler, ms_dri2_frame_event_abort); if (!seq) goto blit_fallback; /* Account for 1 frame extra pageflip delay if flip > 0 */ if (!ms_queue_vblank(crtc, ms_flag, request_msc - flip, &queued_msc, seq)) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "final get vblank counter failed: %s\n", strerror(errno)); goto blit_fallback; } /* Adjust returned value for 1 fame pageflip offset of flip > 0 */ *target_msc = queued_msc + flip; frame_info->frame = *target_msc; return TRUE; blit_fallback: ms_dri2_blit_swap(draw, front, back); DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_BLIT_COMPLETE, func, data); if (frame_info) ms_dri2_del_frame_event(frame_info); *target_msc = 0; /* offscreen, so zero out target vblank count */ return TRUE; } static int ms_dri2_frame_event_client_gone(void *data, XID id) { struct ms_dri2_resource *resource = data; while (!xorg_list_is_empty(&resource->list)) { ms_dri2_frame_event_ptr info = xorg_list_first_entry(&resource->list, ms_dri2_frame_event_rec, client_resource); xorg_list_del(&info->client_resource); info->client = NULL; } free(resource); return Success; } static int ms_dri2_frame_event_drawable_gone(void *data, XID id) { struct ms_dri2_resource *resource = data; while (!xorg_list_is_empty(&resource->list)) { ms_dri2_frame_event_ptr info = xorg_list_first_entry(&resource->list, ms_dri2_frame_event_rec, drawable_resource); xorg_list_del(&info->drawable_resource); info->drawable = NULL; } free(resource); return Success; } static Bool ms_dri2_register_frame_event_resource_types(void) { frame_event_client_type = CreateNewResourceType(ms_dri2_frame_event_client_gone, "Frame Event Client"); if (!frame_event_client_type) return FALSE; frame_event_drawable_type = CreateNewResourceType(ms_dri2_frame_event_drawable_gone, "Frame Event Drawable"); if (!frame_event_drawable_type) return FALSE; return TRUE; } Bool ms_dri2_screen_init(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); DRI2InfoRec info; const char *driver_names[2] = { NULL, NULL }; if (!glamor_supports_pixmap_import_export(screen)) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "DRI2: glamor lacks support for pixmap import/export\n"); } if (!xf86LoaderCheckSymbol("DRI2Version")) return FALSE; if (!dixRegisterPrivateKey(&ms_dri2_client_key, PRIVATE_CLIENT, sizeof(XID))) return FALSE; if (serverGeneration != ms_dri2_server_generation) { ms_dri2_server_generation = serverGeneration; if (!ms_dri2_register_frame_event_resource_types()) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Cannot register DRI2 frame event resources\n"); return FALSE; } } memset(&info, '\0', sizeof(info)); info.fd = ms->fd; info.driverName = NULL; /* Compat field, unused. */ info.deviceName = drmGetDeviceNameFromFd(ms->fd); info.version = 9; info.CreateBuffer = ms_dri2_create_buffer; info.DestroyBuffer = ms_dri2_destroy_buffer; info.CopyRegion = ms_dri2_copy_region; info.ScheduleSwap = ms_dri2_schedule_swap; info.GetMSC = ms_dri2_get_msc; info.ScheduleWaitMSC = ms_dri2_schedule_wait_msc; info.CreateBuffer2 = ms_dri2_create_buffer2; info.DestroyBuffer2 = ms_dri2_destroy_buffer2; info.CopyRegion2 = ms_dri2_copy_region2; /* Ask Glamor to obtain the DRI driver name via EGL_MESA_query_driver. */ driver_names[0] = glamor_egl_get_driver_name(screen); if (driver_names[0]) { /* There is no VDPAU driver for Intel, fallback to the generic * OpenGL/VAAPI va_gl backend to emulate VDPAU. Otherwise, * guess that the DRI and VDPAU drivers have the same name. */ if (strcmp(driver_names[0], "i965") == 0 || strcmp(driver_names[0], "iris") == 0) { driver_names[1] = "va_gl"; } else { driver_names[1] = driver_names[0]; } info.numDrivers = 2; info.driverNames = driver_names; } else { /* EGL_MESA_query_driver was unavailable; let dri2.c select the * driver and fill in these fields for us. */ info.numDrivers = 0; info.driverNames = NULL; } return DRI2ScreenInit(screen, &info); } void ms_dri2_close_screen(ScreenPtr screen) { DRI2CloseScreen(screen); } #endif /* GLAMOR_HAS_GBM */ xorg-server-1.20.8/hw/xfree86/drivers/modesetting/meson.build0000644000175000017500000000236213640201473021060 00000000000000modesetting_srcs = [ 'dri2.c', 'driver.c', 'drmmode_display.c', 'dumb_bo.c', 'pageflip.c', 'present.c', 'vblank.c', ] shared_module( 'modesetting_drv', modesetting_srcs, name_prefix: '', include_directories: [inc, xorg_inc], c_args: xorg_c_args, dependencies: [ common_dep, udev_dep, libdrm_dep, gbm_dep, ], install: true, install_dir: join_paths(module_dir, 'drivers'), ) # Test that we don't have any unresolved symbols from our module to Xorg. xorg_build_root = join_paths(meson.build_root(), 'hw', 'xfree86') symbol_test_args = [] symbol_test_args += join_paths(xorg_build_root, 'libxorgserver.so') symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libfb.so') symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libshadow.so') if gbm_dep.found() symbol_test_args += join_paths(xorg_build_root, 'glamor_egl', 'libglamoregl.so') endif symbol_test_args += join_paths(xorg_build_root, 'drivers', 'modesetting', 'modesetting_drv.so') install_man(configure_file( input: 'modesetting.man', output: 'modesetting.4', configuration: manpage_config, )) test('modesetting symbol test', xorg_symbol_test, args: symbol_test_args, ) xorg-server-1.20.8/hw/xfree86/drivers/modesetting/pageflip.c0000644000175000017500000002451413640201473020654 00000000000000/* * Copyright © 2014 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. */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif #include #include #include "driver.h" /* * Flush the DRM event queue when full; makes space for new events. * * Returns a negative value on error, 0 if there was nothing to process, * or 1 if we handled any events. */ int ms_flush_drm_events(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); struct pollfd p = { .fd = ms->fd, .events = POLLIN }; int r; do { r = xserver_poll(&p, 1, 0); } while (r == -1 && (errno == EINTR || errno == EAGAIN)); /* If there was an error, r will be < 0. Return that. If there was * nothing to process, r == 0. Return that. */ if (r <= 0) return r; /* Try to handle the event. If there was an error, return it. */ r = drmHandleEvent(ms->fd, &ms->event_context); if (r < 0) return r; /* Otherwise return 1 to indicate that we handled an event. */ return 1; } #ifdef GLAMOR_HAS_GBM /* * Event data for an in progress flip. * This contains a pointer to the vblank event, * and information about the flip in progress. * a reference to this is stored in the per-crtc * flips. */ struct ms_flipdata { ScreenPtr screen; void *event; ms_pageflip_handler_proc event_handler; ms_pageflip_abort_proc abort_handler; /* number of CRTC events referencing this */ int flip_count; uint64_t fe_msc; uint64_t fe_usec; uint32_t old_fb_id; }; /* * Per crtc pageflipping infomation, * These are submitted to the queuing code * one of them per crtc per flip. */ struct ms_crtc_pageflip { Bool on_reference_crtc; /* reference to the ms_flipdata */ struct ms_flipdata *flipdata; }; /** * Free an ms_crtc_pageflip. * * Drops the reference count on the flipdata. */ static void ms_pageflip_free(struct ms_crtc_pageflip *flip) { struct ms_flipdata *flipdata = flip->flipdata; free(flip); if (--flipdata->flip_count > 0) return; free(flipdata); } /** * Callback for the DRM event queue when a single flip has completed * * Once the flip has been completed on all pipes, notify the * extension code telling it when that happened */ static void ms_pageflip_handler(uint64_t msc, uint64_t ust, void *data) { struct ms_crtc_pageflip *flip = data; struct ms_flipdata *flipdata = flip->flipdata; ScreenPtr screen = flipdata->screen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); if (flip->on_reference_crtc) { flipdata->fe_msc = msc; flipdata->fe_usec = ust; } if (flipdata->flip_count == 1) { flipdata->event_handler(ms, flipdata->fe_msc, flipdata->fe_usec, flipdata->event); drmModeRmFB(ms->fd, flipdata->old_fb_id); } ms_pageflip_free(flip); } /* * Callback for the DRM queue abort code. A flip has been aborted. */ static void ms_pageflip_abort(void *data) { struct ms_crtc_pageflip *flip = data; struct ms_flipdata *flipdata = flip->flipdata; ScreenPtr screen = flipdata->screen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); if (flipdata->flip_count == 1) flipdata->abort_handler(ms, flipdata->event); ms_pageflip_free(flip); } static Bool do_queue_flip_on_crtc(modesettingPtr ms, xf86CrtcPtr crtc, uint32_t flags, uint32_t seq) { return drmmode_crtc_flip(crtc, ms->drmmode.fb_id, flags, (void *) (uintptr_t) seq); } static Bool queue_flip_on_crtc(ScreenPtr screen, xf86CrtcPtr crtc, struct ms_flipdata *flipdata, int ref_crtc_vblank_pipe, uint32_t flags) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; struct ms_crtc_pageflip *flip; uint32_t seq; int err; flip = calloc(1, sizeof(struct ms_crtc_pageflip)); if (flip == NULL) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue: carrier alloc failed.\n"); return FALSE; } /* Only the reference crtc will finally deliver its page flip * completion event. All other crtc's events will be discarded. */ flip->on_reference_crtc = (drmmode_crtc->vblank_pipe == ref_crtc_vblank_pipe); flip->flipdata = flipdata; seq = ms_drm_queue_alloc(crtc, flip, ms_pageflip_handler, ms_pageflip_abort); if (!seq) { free(flip); return FALSE; } /* take a reference on flipdata for use in flip */ flipdata->flip_count++; while (do_queue_flip_on_crtc(ms, crtc, flags, seq)) { err = errno; /* We may have failed because the event queue was full. Flush it * and retry. If there was nothing to flush, then we failed for * some other reason and should just return an error. */ if (ms_flush_drm_events(screen) <= 0) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed: %s\n", strerror(err)); /* Aborting will also decrement flip_count and free(flip). */ ms_drm_abort_seq(scrn, seq); return FALSE; } /* We flushed some events, so try again. */ xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue retry\n"); } /* The page flip succeded. */ return TRUE; } Bool ms_do_pageflip(ScreenPtr screen, PixmapPtr new_front, void *event, int ref_crtc_vblank_pipe, Bool async, ms_pageflip_handler_proc pageflip_handler, ms_pageflip_abort_proc pageflip_abort) { #ifndef GLAMOR_HAS_GBM return FALSE; #else ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); drmmode_bo new_front_bo; uint32_t flags; int i; struct ms_flipdata *flipdata; glamor_block_handler(screen); new_front_bo.gbm = glamor_gbm_bo_from_pixmap(screen, new_front); new_front_bo.dumb = NULL; if (!new_front_bo.gbm) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to get GBM bo for flip to new front.\n"); return FALSE; } flipdata = calloc(1, sizeof(struct ms_flipdata)); if (!flipdata) { drmmode_bo_destroy(&ms->drmmode, &new_front_bo); xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to allocate flipdata.\n"); return FALSE; } flipdata->event = event; flipdata->screen = screen; flipdata->event_handler = pageflip_handler; flipdata->abort_handler = pageflip_abort; /* * Take a local reference on flipdata. * if the first flip fails, the sequence abort * code will free the crtc flip data, and drop * it's reference which would cause this to be * freed when we still required it. */ flipdata->flip_count++; /* Create a new handle for the back buffer */ flipdata->old_fb_id = ms->drmmode.fb_id; new_front_bo.width = new_front->drawable.width; new_front_bo.height = new_front->drawable.height; if (drmmode_bo_import(&ms->drmmode, &new_front_bo, &ms->drmmode.fb_id)) goto error_out; flags = DRM_MODE_PAGE_FLIP_EVENT; if (async) flags |= DRM_MODE_PAGE_FLIP_ASYNC; /* Queue flips on all enabled CRTCs. * * Note that if/when we get per-CRTC buffers, we'll have to update this. * Right now it assumes a single shared fb across all CRTCs, with the * kernel fixing up the offset of each CRTC as necessary. * * Also, flips queued on disabled or incorrectly configured displays * may never complete; this is a configuration error. */ for (i = 0; i < config->num_crtc; i++) { xf86CrtcPtr crtc = config->crtc[i]; if (!ms_crtc_on(crtc)) continue; if (!queue_flip_on_crtc(screen, crtc, flipdata, ref_crtc_vblank_pipe, flags)) { goto error_undo; } } drmmode_bo_destroy(&ms->drmmode, &new_front_bo); /* * Do we have more than our local reference, * if so and no errors, then drop our local * reference and return now. */ if (flipdata->flip_count > 1) { flipdata->flip_count--; return TRUE; } error_undo: /* * Have we just got the local reference? * free the framebuffer if so since nobody successfully * submitted anything */ if (flipdata->flip_count == 1) { drmModeRmFB(ms->fd, ms->drmmode.fb_id); ms->drmmode.fb_id = flipdata->old_fb_id; } error_out: xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Page flip failed: %s\n", strerror(errno)); drmmode_bo_destroy(&ms->drmmode, &new_front_bo); /* if only the local reference - free the structure, * else drop the local reference and return */ if (flipdata->flip_count == 1) free(flipdata); else flipdata->flip_count--; return FALSE; #endif /* GLAMOR_HAS_GBM */ } #endif xorg-server-1.20.8/hw/xfree86/drivers/Makefile.in0000644000175000017500000006466013640201512016444 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @XORG_DRIVER_MODESETTING_TRUE@am__append_1 = modesetting subdir = hw/xfree86/drivers ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = modesetting am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = $(am__append_1) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/drivers/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/drivers/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/int10/0000755000175000017500000000000013640201534013724 500000000000000xorg-server-1.20.8/hw/xfree86/int10/stub.c0000644000175000017500000000202413640201473014765 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86str.h" #include "xf86_OSproc.h" #define _INT10_PRIVATE #include "xf86int10.h" xf86Int10InfoPtr xf86InitInt10(int entityIndex) { return xf86ExtendedInitInt10(entityIndex, 0); } xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags) { return NULL; } Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { return FALSE; } void xf86FreeInt10(xf86Int10InfoPtr pInt) { return; } void * xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) { *off = 0; return NULL; } void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) { return; } Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt) { return FALSE; } void xf86ExecX86int10(xf86Int10InfoPtr pInt) { return; } void * xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr) { return 0; } xorg-server-1.20.8/hw/xfree86/int10/INT10.HOWTO0000644000175000017500000003426313640201473015273 00000000000000 INT10 X86 Real Mode executor ============================= PRELIMINARY INT10 is a XFree86 module for soft-booting and executing real mode int10 BIOS calls. The BIOS call code is largely untested, yet. 1. Usage ======== To use the int10 module in a driver the header file xfree86/os-support/int10/xf86int10.h must be included. a. Initialization ----------------- The int10-executer gets initialized by calling: xf86Int10InfoPtr xf86InitInt10(int entityIndex); The function will soft-boot any non-primary device and return a pointer to a xf86Int10InfoRec on success. If anything fails or if int10 execution is disabled by an option in the device section NULL will be returned. The driver should store this pointer for later calls to other int10 module functions. b. Memory allocation -------------------- To allocate memory in the real mode execution environment void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off); can be called. It allocates num consecutive pagesize chunks. It returns the address of the allocated area. off is set to its offset in the real mode memory space. void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num); Is used to free num pages beginning at pbase. c. Doing int10 BIOS calls ------------------------- The BIOS call is executed by calling: void xf86ExecX86int10(xf86Int10InfoPtr pInt); The number of the interrupt (normally 10) and the initial values of the ax, bx, cx, dx, si, di and es x86-CPU registers can be set in the xf86Int10InfoRec passed to the function. On return this structure contains the exit values of the registers listed above and the CPU flag register. d. De-initializing ----------------- If no further int10 calls are required for a certain chipset the driver should call: void xf86FreeInt10(xf86Int10InfoPtr pInt); to free the memory allocated for real mode int10 calls. 2. Porting issues ================= The int10 real mode executor is designed to run on top of various x86 CPU emulators as well as in vm86 mode of a real x86 CPU. If used with a CPU emulator the emulator and CPU specific interfaces can be held separate thus requiring minimal efforts to port the int10 module to new platforms. Currently an interface to the x86emu real mode emulator is provided. Since details of setting up and running the vm86 mode is platform dependent both the platform dependent environment and the emulation layer have to be ported. Several helper functions are provided for that. A CPU emulator should meet certain requirements to be usable for the INT10 executor: 1. It must trap calls to intXX instructions and pass execution to an external function which is allowed to modify CPU registers including the instruction pointer (IP) before returning to the emulator for continuing execution. When the external function is called the IP must point to the instruction past the intXX call. 2. The emulator should use externally provided functions to handle PIO. 3. The emulator should be able to use externally provided functions to access memory from the real mode memory environment. Note, that the vm86 mode usually requires one hunk of consecutive memory starting at address 0 in the process virtual memory space. Thus if this mode is to be used, the OS environment has to be able to provide that, ie. it must be able to remap the processes virtual memory space onto itself. If the emulator is able to handle memory access thru externally provided functions the real mode process memory can be located anywhere in the processes virtual memory. It does not even have to be consecutive. 4. The executor should terminate on encountering a 'hlt' instruction. Functions to implement: To simplify development the code has been split into a general setup part and an emulator specific one. A generic setup code is provided in generic.c. It should be usable with any emulator satisfying the conditions mentioned above. Therefore the following section on int10 setup may be skipped when porting int10 to new emulator. If the vm86() is to be used no memory access functions can be used. Therefore the layout of the real mode memory image has to meet certain requirements. Therefore when porting to other platforms a new setup code may have to be designed, too. The following section will give guidelines how this may be done. A sample implementation using SysV IPC to map the appropriate real mode memory image to address 0 in virtual address space just prior to execution may be found in xfree86/os-support/linux/int10/linux.c. On non-PC like platforms emulation of certain PC features such as initialization of BIOS int vectors, sys_BIOS constants or PCI config method 1 can be turned on by defining _PC. I. Setup Code ------------- This sets up the real mode memory image, calls the emulator to POST the chipset if required and maintains memory allocations in real mode address space. 1. xf86Int10InfoPtr xf86InitInt10(int entityIndex); This function should first find the screen assigned to the entity carrying entitiyIndex and then call Bool int10skip(ScrnInfoPtr pScrn) to find out if the user has requested not to initialize int10. If so xf86InitInt10() should return NULL. Otherwise an xf86Int10InfoRec should be allocated. This structure contains the following fields: a. int entityIndex - index of the entity whose BIOS is to be executed. b. int scrnIndex - index of the screen assigned the entity. c. pointer cpuRegs - pointer to a emulator/vm86-mode private structure. May hold cpu register values for the emulator. d. CARD16 BIOSseg - Video BIOS segment address. e. pointer private - pointer to a os specific data structure. f. struct _int10Mem* - pointer to a structure to hold the memory access functions for use by an emulator. g. int num - number of the int to be called. h. int ax..es,flags - CPU register values to pass to int-call. The Init function should initialize a-f. To initialize the emulator specific execute environment the function Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt) should be called. If this function returns FALSE any already allocated memory should be freed and xf86Int10Init(0 should exit returning NULL. If the platform has a PC like system BIOS it may be copied to or mapped into memory locations SYS_BIOS to SYS_SIZE-1 of the real mode memory environment of this process. Otherwise the helper function: int setup_system_bios(CARD32 base_addr); may be called to set up a rudimentary system BIOS sufficient to be used to boot video BIOSes. base_addr specifies the virtual address corresponding to SYS_BIOS in the real mode environment. If a PC-like int vector and BIOS data area is available it should be copied to 0 to LOW_PAGE_SIZE of the entities real mode environment. In this case the video interrupt related entries should be reset for all non-primary cards by calling: void reset_int_vect(xf86Int10InfoPtr pInt); To initialize the correct video BIOS entry points the BIOS must be warm-booted. If no PC-like int vector is available one can be set up by calling void setup_int_vect(xf86Int10InfoPtr pInt); In this case the video BIOS has to be warm-booted always. If the video BIOS for this entity has been installed during boot it may be mapped (or copied) directly to the correct address in the real mode memory environment. Otherwise int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address); should be called to copy the BIOS image from PCI ROM. 'address' specifies the address this image should be copied to. Sufficient space to hold an entire BIOS image should be allocated prior to calling mapPciRom(). This function will return the size of the BIOS image in bytes if it was able to successfully copy the image and 0 otherwise. To create a well defined point to exit the softbooter void set_return_trap(xf86Int10Ptr pInt); may be called. It sets up a 'hlt' instruction in the emulator memory just above the BIOS variable area. Before entering real mode execution this address will be pushed onto the return stack. If the BIOS needs to be warm-booted this should be done before leaving xf86InitInt10() by setting num in the xf86Int10InfoRec to 0xe6 and calling void xf86ExecX86int10(xf86Int10IfoPtr pInt); The implementation of this function will be discussed below. This function should be wrapped by calls to void LockLegacyVGA(screen, legacyVGAPtr vga); and void UnlockLegacyVGA(screen, legacyVGAPtr vga); The struct vga is used to hold the state of the legacy VGA access registers if a legacy VGA device exists. xf86InitInt10() should return a pointer to the xf86Int10InfoRec allocated. 2. Bool MapCurrentInt10(xf86Int10InfoPtr pInt); In case a platform specific mapping has to be performed to map the memory allocated for the real mode memory environment into a specific location prior to executing the x86 real mode code a function Bool MapCurrentInt10(xf86Int10InfoPtr pInt); has to be provided. It will be called by a helper function whenever the active entity changes. If the vm86 mode is used it is most likely that the 1MB real mode memory space located somewhere in the processes virtual memory will have to be remapped to address 0 of the virtual memory space. 3. void xf86FreeInt10(xf86Int10InfoPtr pInt); To free all memory allocated for video BIOS calls of a specific entity the function void xf86FreeInt10(xf86Int10InfoPtr pInt); should be provided. If the entity to be freed was mapped by MapCurrentInt10() this mapping needs to be undone also. 4. void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) xf86Int10AllocPages() should allocate 'num' consecutive page-size chunks of memory. In real mode memory space this range needs to occupy consecutive addresses, too. The function must return the address of this memory. The offset in real mode memory needs to be returned in 'off'. If no block of 'num' pages are available the function should return NULL. xf86Int10FreePages() will free the 'num' pages starting at 'pbase'. 'num' is equal to the number of pages allocated by a single xf86Int10AllocatePages() call. 'pbase' is the address of the range previously returned by xf86Int10AllocatePages(). II. Emulator specific functions ------------------------------- 1. Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt); This function will be called from xf86InitInt10(). It may be used to set up the static emulator specific part of the real mode environment. On success it should return TRUE. 2. xf86ExecX86int10(xf86Int10InfoPtr pInt); This function gets called to execute an int call. It may call the helper function: void setup_int(xf86Int10InfoPrt pInt); to copy the register values to the emulator specific locations and to set up the non-static real mode execution environment. On return from setup_int() 'Int10Current' holds a pointer to the current xf86Int10InfoRec. It should start execution by calling Bool int_handler(xf86Int10InfoPtr pInt); and if this function returns TRUE it should call whatever necessary to continue execution until a 'hlt' instruction is encountered. To copy the resulting register values back to the xf86Int10InfoRec structure void finish_int(xf86Int10InfoPtr pInt); should be called. Helper functions are provided to aid the implementation of a vm86 call: Bool vm86_GP_fault(xf86Int10InfoPtr pInt); This function handles instructions which cause a vm86 call to trap. PIO access is handled by the in/out calls as defined in compiler.h. Optionally the PIO instructions can be logged by defining PRINT_PORT in xf86int10.h. This is meant for debugging purposes. Unknown instructions and 'hlt' cause vm86_GP_fault() to return FALSE. Otherwise TRUE is returned. Note: This function is currently based on the Linux vm86 call. It might have to be modified or even rewritten for other OS. So your milage may vary. Functions to dump memory, code, xf86 CPU register values and stack are also provided. Take a look at helper.c To view a memory range the function void dprint(unsigned long start, unsigned long size) is provided. The use should be self explanatory. Register and memory access functions are provided in helper_mem.c. The PIO register access functions can trap access to PCI config space access register (config method 1) if _PC is not defined. A header file 'defines.h' is required to define OS/emulator specific ways to access memory and xf86 CPU registers: Defines need to be provided for memory byte/work/long read/write access (MEM_RB(name,addr),MEM_RW(name,addr),MEM_RL(name,addr), MEM_WB(name,addr,val),MEM_WL(name,addr,val),MEM_WL(name,addr,val)) of the real mode memory environment. 'name' will contain a pointer to the current xf86Int10InfoRec. Currently defines are available for vm86-mode under Linux and x86emu. They may be activated by defining _X86EMU or _VM86_LINUX respectively. Note: Emulators usually are not able to pass this pointer when calling memory access functions. In this case a global variable should be defined which can hold this pointer. This variable can be set in MapCurrentInt10(). It also must be set in xf86InitInt10() if this function calls the memory access functions either directly or by calling xf86ExecX86int10(pInt). Defines to access the emulator specific xf86 CPU register locations are also required: X86_EAX,...,X86_EFLAGS for access of the full 32 bit registers, X86_AX...X86_FLAGS for access of the 16 bit registers and XF86_AL,XF86_BL,XF86_CL,XF86_DL to access the lower byte of the AX,BX,CX and DX register. $XFree86: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO,v 1.2 2000/02/08 13:13:22 eich Exp $ xorg-server-1.20.8/hw/xfree86/int10/Makefile.am0000644000175000017500000000201413640201473015677 00000000000000module_LTLIBRARIES = libint10.la sdk_HEADERS = xf86int10.h EXTRA_CFLAGS = libint10_la_LDFLAGS = -avoid-version libint10_la_LIBADD = $(PCIACCESS_LIBS) COMMON_SOURCES = \ helper_exec.c \ helper_mem.c \ xf86int10.c \ xf86int10module.c if I386_VIDEO I386_VIDEO_CFLAGS = -D_PC endif AM_CPPFLAGS = $(XORG_INCS) if INT10_VM86 AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS) libint10_la_SOURCES = \ $(COMMON_SOURCES) \ $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \ $(srcdir)/../os-support/linux/int10/linux.c endif if INT10_X86EMU AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \ $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS += -I$(srcdir)/../x86emu libint10_la_SOURCES = \ $(COMMON_SOURCES) \ xf86x86emu.c \ generic.c \ x86emu.c endif if INT10_STUB AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS) libint10_la_SOURCES = stub.c xf86int10module.c endif EXTRA_DIST = xf86x86emu.h INT10.HOWTO xorg-server-1.20.8/hw/xfree86/int10/x86emu.c0000644000175000017500000000027613640201473015153 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include "debug.c" #include "decode.c" #include "fpu.c" #include "ops.c" #include "ops2.c" #include "prim_ops.c" #include "sys.c" xorg-server-1.20.8/hw/xfree86/int10/xf86int10.h0000644000175000017500000001477113640201473015500 00000000000000 /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifndef _XF86INT10_H #define _XF86INT10_H #include #include #include "xf86Pci.h" #define SEG_ADDR(x) (((x) >> 4) & 0x00F000) #define SEG_OFF(x) ((x) & 0x0FFFF) #define SET_BIOS_SCRATCH 0x1 #define RESTORE_BIOS_SCRATCH 0x2 /* int10 info structure */ typedef struct { int entityIndex; uint16_t BIOSseg; uint16_t inb40time; ScrnInfoPtr pScrn; void *cpuRegs; char *BIOSScratch; int Flags; void *private; struct _int10Mem *mem; int num; int ax; int bx; int cx; int dx; int si; int di; int es; int bp; int flags; int stackseg; struct pci_device *dev; struct pci_io_handle *io; } xf86Int10InfoRec, *xf86Int10InfoPtr; typedef struct _int10Mem { uint8_t (*rb) (xf86Int10InfoPtr, int); uint16_t (*rw) (xf86Int10InfoPtr, int); uint32_t (*rl) (xf86Int10InfoPtr, int); void (*wb) (xf86Int10InfoPtr, int, uint8_t); void (*ww) (xf86Int10InfoPtr, int, uint16_t); void (*wl) (xf86Int10InfoPtr, int, uint32_t); } int10MemRec, *int10MemPtr; typedef struct { uint8_t save_msr; uint8_t save_pos102; uint8_t save_vse; uint8_t save_46e8; } legacyVGARec, *legacyVGAPtr; /* OS dependent functions */ extern _X_EXPORT xf86Int10InfoPtr xf86InitInt10(int entityIndex); extern _X_EXPORT xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags); extern _X_EXPORT void xf86FreeInt10(xf86Int10InfoPtr pInt); extern _X_EXPORT void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off); extern _X_EXPORT void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num); extern _X_EXPORT void *xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr); /* x86 executor related functions */ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt); #ifdef _INT10_PRIVATE #define I_S_DEFAULT_INT_VECT 0xFF065 #define SYS_SIZE 0x100000 #define SYS_BIOS 0xF0000 #if 1 #define BIOS_SIZE 0x10000 #else /* a bug in DGUX requires this - let's try it */ #define BIOS_SIZE (0x10000 - 1) #endif #define LOW_PAGE_SIZE 0x600 #define V_RAM 0xA0000 #define VRAM_SIZE 0x20000 #define V_BIOS_SIZE 0x10000 #define V_BIOS 0xC0000 #define BIOS_SCRATCH_OFF 0x449 #define BIOS_SCRATCH_END 0x466 #define BIOS_SCRATCH_LEN (BIOS_SCRATCH_END - BIOS_SCRATCH_OFF + 1) #define HIGH_MEM V_BIOS #define HIGH_MEM_SIZE (SYS_BIOS - HIGH_MEM) #define SEG_ADR(type, seg, reg) type((seg << 4) + (X86_##reg)) #define SEG_EADR(type, seg, reg) type((seg << 4) + (X86_E##reg)) #define X86_TF_MASK 0x00000100 #define X86_IF_MASK 0x00000200 #define X86_IOPL_MASK 0x00003000 #define X86_NT_MASK 0x00004000 #define X86_VM_MASK 0x00020000 #define X86_AC_MASK 0x00040000 #define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */ #define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */ #define X86_ID_MASK 0x00200000 #define MEM_RB(name, addr) (*name->mem->rb)(name, addr) #define MEM_RW(name, addr) (*name->mem->rw)(name, addr) #define MEM_RL(name, addr) (*name->mem->rl)(name, addr) #define MEM_WB(name, addr, val) (*name->mem->wb)(name, addr, val) #define MEM_WW(name, addr, val) (*name->mem->ww)(name, addr, val) #define MEM_WL(name, addr, val) (*name->mem->wl)(name, addr, val) /* OS dependent functions */ extern _X_EXPORT Bool MapCurrentInt10(xf86Int10InfoPtr pInt); /* x86 executor related functions */ extern _X_EXPORT Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt); /* int.c */ extern _X_EXPORT xf86Int10InfoPtr Int10Current; int int_handler(xf86Int10InfoPtr pInt); /* helper_exec.c */ int setup_int(xf86Int10InfoPtr pInt); void finish_int(xf86Int10InfoPtr, int sig); uint32_t getIntVect(xf86Int10InfoPtr pInt, int num); void pushw(xf86Int10InfoPtr pInt, uint16_t val); int run_bios_int(int num, xf86Int10InfoPtr pInt); void dump_code(xf86Int10InfoPtr pInt); void dump_registers(xf86Int10InfoPtr pInt); void stack_trace(xf86Int10InfoPtr pInt); uint8_t bios_checksum(const uint8_t *start, int size); void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga); void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga); #if defined (_PC) extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save); #endif int port_rep_inb(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_inw(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_inl(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_outb(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_outw(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_outl(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count); uint8_t x_inb(uint16_t port); uint16_t x_inw(uint16_t port); void x_outb(uint16_t port, uint8_t val); void x_outw(uint16_t port, uint16_t val); uint32_t x_inl(uint16_t port); void x_outl(uint16_t port, uint32_t val); uint8_t Mem_rb(uint32_t addr); uint16_t Mem_rw(uint32_t addr); uint32_t Mem_rl(uint32_t addr); void Mem_wb(uint32_t addr, uint8_t val); void Mem_ww(uint32_t addr, uint16_t val); void Mem_wl(uint32_t addr, uint32_t val); /* helper_mem.c */ void setup_int_vect(xf86Int10InfoPtr pInt); int setup_system_bios(void *base_addr); void reset_int_vect(xf86Int10InfoPtr pInt); void set_return_trap(xf86Int10InfoPtr pInt); extern _X_EXPORT void *xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex); Bool int10skip(const void *options); Bool int10_check_bios(int scrnIndex, int codeSeg, const unsigned char *vbiosMem); Bool initPrimary(const void *options); extern _X_EXPORT BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt); extern _X_EXPORT Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base); #ifdef DEBUG void dprint(unsigned long start, unsigned long size); #endif #endif /* _INT10_PRIVATE */ #endif /* _XF86INT10_H */ xorg-server-1.20.8/hw/xfree86/int10/xf86int10module.c0000644000175000017500000000152213640201473016667 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86str.h" #include "xf86Pci.h" #include "xf86int10.h" #ifndef MOD_NAME #define MOD_NAME int10 #endif #define stringify(x) #x #define STRING(x) stringify(x) #define concat(x,y) x ## y #define combine(a,b) concat(a,b) #define NAME(x) combine(MOD_NAME,x) static XF86ModuleVersionInfo NAME(VersRec) = { STRING(NAME()), MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, { 0, 0, 0, 0} }; _X_EXPORT XF86ModuleData NAME(ModuleData) = { &NAME(VersRec), NULL, NULL}; xorg-server-1.20.8/hw/xfree86/int10/xf86int10.c0000644000175000017500000007717513640201473015502 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "compiler.h" #define _INT10_PRIVATE #include "xf86int10.h" #include "int10Defines.h" #include "Pci.h" #define REG pInt xf86Int10InfoPtr Int10Current = NULL; static int int1A_handler(xf86Int10InfoPtr pInt); #ifndef _PC static int int42_handler(xf86Int10InfoPtr pInt); #endif static int intE6_handler(xf86Int10InfoPtr pInt); static struct pci_device *findPci(xf86Int10InfoPtr pInt, unsigned short bx); static CARD32 pciSlotBX(const struct pci_device *pvp); int int_handler(xf86Int10InfoPtr pInt) { int num = pInt->num; int ret = 0; switch (num) { #ifndef _PC case 0x10: case 0x42: case 0x6D: if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT) ret = int42_handler(pInt); break; #endif case 0x1A: ret = int1A_handler(pInt); break; case 0xe6: ret = intE6_handler(pInt); break; default: break; } if (!ret) ret = run_bios_int(num, pInt); if (!ret) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num); dump_registers(pInt); stack_trace(pInt); } return ret; } #ifndef _PC /* * This is derived from a number of PC system BIOS'es. The intent here is to * provide very primitive video support, before an EGA/VGA BIOS installs its * own interrupt vector. Here, "Ignored" calls should remain so. "Not * Implemented" denotes functionality that can be implemented should the need * arise. What are "Not Implemented" throughout are video memory accesses. * Also, very little input validity checking is done here. */ static int int42_handler(xf86Int10InfoPtr pInt) { switch (X86_AH) { case 0x00: /* Set Video Mode */ /* Enter: AL = video mode number */ /* Leave: Nothing */ /* Implemented (except for clearing the screen) */ { /* Localise */ unsigned int ioport; int i; CARD16 int1d, regvals, tmp; CARD8 mode, cgamode, cgacolour; /* * Ignore all mode numbers but 0x00-0x13. Some systems also ignore * 0x0B and 0x0C, but don't do that here. */ if (X86_AL > 0x13) break; /* * You didn't think that was really the mode set, did you? There * are only so many slots in the video parameter table... */ mode = X86_AL; ioport = 0x03D4; switch (MEM_RB(pInt, 0x0410) & 0x30) { case 0x30: /* MDA */ mode = 0x07; /* Force mode to 0x07 */ ioport = 0x03B4; break; case 0x10: /* CGA 40x25 */ if (mode >= 0x07) mode = 0x01; break; case 0x20: /* CGA 80x25 (MCGA?) */ if (mode >= 0x07) mode = 0x03; break; case 0x00: /* EGA/VGA */ if (mode >= 0x07) /* Don't try MDA timings */ mode = 0x01; /* !?!?! */ break; } /* Locate data in video parameter table */ int1d = MEM_RW(pInt, 0x1d << 2); regvals = ((mode >> 1) << 4) + int1d; cgacolour = 0x30; if (mode == 0x06) { regvals -= 0x10; cgacolour = 0x3F; } /** Update BIOS Data Area **/ /* Video mode */ MEM_WB(pInt, 0x0449, mode); /* Columns */ tmp = MEM_RB(pInt, mode + int1d + 0x48); MEM_WW(pInt, 0x044A, tmp); /* Page length */ tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40); MEM_WW(pInt, 0x044C, tmp); /* Start Address */ MEM_WW(pInt, 0x044E, 0); /* Cursor positions, one for each display page */ for (i = 0x0450; i < 0x0460; i += 2) MEM_WW(pInt, i, 0); /* Cursor start & end scanlines */ tmp = MEM_RB(pInt, regvals + 0x0B); MEM_WB(pInt, 0x0460, tmp); tmp = MEM_RB(pInt, regvals + 0x0A); MEM_WB(pInt, 0x0461, tmp); /* Current display page number */ MEM_WB(pInt, 0x0462, 0); /* CRTC I/O address */ MEM_WW(pInt, 0x0463, ioport); /* CGA Mode register value */ cgamode = MEM_RB(pInt, mode + int1d + 0x50); MEM_WB(pInt, 0x0465, cgamode); /* CGA Colour register value */ MEM_WB(pInt, 0x0466, cgacolour); /* Rows */ MEM_WB(pInt, 0x0484, (25 - 1)); /* Program the mode */ pci_io_write8(pInt->io, ioport + 4, cgamode & 0x37); /* Turn off screen */ for (i = 0; i < 0x10; i++) { tmp = MEM_RB(pInt, regvals + i); pci_io_write8(pInt->io, ioport, i); pci_io_write8(pInt->io, ioport + 1, tmp); } pci_io_write8(pInt->io, ioport + 5, cgacolour); /* Select colour mode */ pci_io_write8(pInt->io, ioport + 4, cgamode); /* Turn on screen */ } break; case 0x01: /* Set Cursor Type */ /* Enter: CH = starting line for cursor */ /* CL = ending line for cursor */ /* Leave: Nothing */ /* Implemented */ { /* Localise */ unsigned int ioport = MEM_RW(pInt, 0x0463); MEM_WB(pInt, 0x0460, X86_CL); MEM_WB(pInt, 0x0461, X86_CH); pci_io_write8(pInt->io, ioport, 0x0A); pci_io_write8(pInt->io, ioport + 1, X86_CH); pci_io_write8(pInt->io, ioport, 0x0B); pci_io_write8(pInt->io, ioport + 1, X86_CL); } break; case 0x02: /* Set Cursor Position */ /* Enter: BH = display page number */ /* DH = row */ /* DL = column */ /* Leave: Nothing */ /* Implemented */ { /* Localise */ unsigned int ioport; CARD16 offset; MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL); MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH); if (X86_BH != MEM_RB(pInt, 0x0462)) break; offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL; offset += MEM_RW(pInt, 0x044E) << 1; ioport = MEM_RW(pInt, 0x0463); pci_io_write8(pInt->io, ioport, 0x0E); pci_io_write8(pInt->io, ioport + 1, offset >> 8); pci_io_write8(pInt->io, ioport, 0x0F); pci_io_write8(pInt->io, ioport + 1, offset & 0xFF); } break; case 0x03: /* Get Cursor Position */ /* Enter: BH = display page number */ /* Leave: CH = starting line for cursor */ /* CL = ending line for cursor */ /* DH = row */ /* DL = column */ /* Implemented */ { /* Localise */ X86_CL = MEM_RB(pInt, 0x0460); X86_CH = MEM_RB(pInt, 0x0461); X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450); X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451); } break; case 0x04: /* Get Light Pen Position */ /* Enter: Nothing */ /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */ /* BX = pixel column */ /* CX = pixel row */ /* DH = character row */ /* DL = character column */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } X86_AH = X86_BX = X86_CX = X86_DX = 0; } break; case 0x05: /* Set Display Page */ /* Enter: AL = display page number */ /* Leave: Nothing */ /* Implemented */ { /* Localise */ unsigned int ioport = MEM_RW(pInt, 0x0463); CARD16 start; CARD8 x, y; /* Calculate new start address */ MEM_WB(pInt, 0x0462, X86_AL); start = X86_AL * MEM_RW(pInt, 0x044C); MEM_WW(pInt, 0x044E, start); start <<= 1; /* Update start address */ pci_io_write8(pInt->io, ioport, 0x0C); pci_io_write8(pInt->io, ioport + 1, start >> 8); pci_io_write8(pInt->io, ioport, 0x0D); pci_io_write8(pInt->io, ioport + 1, start & 0xFF); /* Switch cursor position */ y = MEM_RB(pInt, (X86_AL << 1) + 0x0450); x = MEM_RB(pInt, (X86_AL << 1) + 0x0451); start += (y * MEM_RW(pInt, 0x044A)) + x; /* Update cursor position */ pci_io_write8(pInt->io, ioport, 0x0E); pci_io_write8(pInt->io, ioport + 1, start >> 8); pci_io_write8(pInt->io, ioport, 0x0F); pci_io_write8(pInt->io, ioport + 1, start & 0xFF); } break; case 0x06: /* Initialise or Scroll Window Up */ /* Enter: AL = lines to scroll up */ /* BH = attribute for blank */ /* CH = upper y of window */ /* CL = left x of window */ /* DH = lower y of window */ /* DL = right x of window */ /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, " AL=0x%2.2x, BH=0x%2.2x," " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; case 0x07: /* Initialise or Scroll Window Down */ /* Enter: AL = lines to scroll down */ /* BH = attribute for blank */ /* CH = upper y of window */ /* CL = left x of window */ /* DH = lower y of window */ /* DL = right x of window */ /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, " AL=0x%2.2x, BH=0x%2.2x," " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; case 0x08: /* Read Character and Attribute at Cursor */ /* Enter: BH = display page number */ /* Leave: AH = attribute */ /* AL = character */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at" " Cursor\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "BH=0x%2.2x\n", X86_BH); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } X86_AX = 0; } break; case 0x09: /* Write Character and Attribute at Cursor */ /* Enter: AL = character */ /* BH = display page number */ /* BL = attribute (text) or colour (graphics) */ /* CX = replication count */ /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at" " Cursor\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", X86_AL, X86_BH, X86_BL, X86_CX); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; case 0x0a: /* Write Character at Cursor */ /* Enter: AL = character */ /* BH = display page number */ /* BL = colour */ /* CX = replication count */ /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", X86_AL, X86_BH, X86_BL, X86_CX); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; case 0x0b: /* Set Palette, Background or Border */ /* Enter: BH = 0x00 or 0x01 */ /* BL = colour or palette (respectively) */ /* Leave: Nothing */ /* Implemented */ { /* Localise */ unsigned int ioport = MEM_RW(pInt, 0x0463) + 5; CARD8 cgacolour = MEM_RB(pInt, 0x0466); if (X86_BH) { cgacolour &= 0xDF; cgacolour |= (X86_BL & 0x01) << 5; } else { cgacolour &= 0xE0; cgacolour |= X86_BL & 0x1F; } MEM_WB(pInt, 0x0466, cgacolour); pci_io_write8(pInt->io, ioport, cgacolour); } break; case 0x0c: /* Write Graphics Pixel */ /* Enter: AL = pixel value */ /* BH = display page number */ /* CX = column */ /* DX = row */ /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_AL, X86_BH, X86_CX, X86_DX); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; case 0x0d: /* Read Graphics Pixel */ /* Enter: BH = display page number */ /* CX = column */ /* DX = row */ /* Leave: AL = pixel value */ /* Not Implemented */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX, X86_DX); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } X86_AL = 0; } break; case 0x0e: /* Write Character in Teletype Mode */ /* Enter: AL = character */ /* BH = display page number */ /* BL = foreground colour */ /* Leave: Nothing */ /* Not Implemented */ /* WARNING: Emulation of BEL characters will require */ /* emulation of RTC and PC speaker I/O. */ /* Also, this recurses through int 0x10 */ /* which might or might not have been */ /* installed yet. */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n", X86_AL, X86_BH, X86_BL); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; case 0x0f: /* Get Video Mode */ /* Enter: Nothing */ /* Leave: AH = number of columns */ /* AL = video mode number */ /* BH = display page number */ /* Implemented */ { /* Localise */ X86_AH = MEM_RW(pInt, 0x044A); X86_AL = MEM_RB(pInt, 0x0449); X86_BH = MEM_RB(pInt, 0x0462); } break; case 0x10: /* Colour Control (subfunction in AL) */ /* Enter: Various */ /* Leave: Various */ /* Ignored */ break; case 0x11: /* Font Control (subfunction in AL) */ /* Enter: Various */ /* Leave: Various */ /* Ignored */ break; case 0x12: /* Miscellaneous (subfunction in BL) */ /* Enter: Various */ /* Leave: Various */ /* Ignored. Previous code here optionally allowed */ /* the enabling and disabling of VGA, but no system */ /* BIOS I've come across actually implements it. */ break; case 0x13: /* Write String in Teletype Mode */ /* Enter: AL = write mode */ /* BL = attribute (if (AL & 0x02) == 0) */ /* CX = string length */ /* DH = row */ /* DL = column */ /* ES:BP = string segment:offset */ /* Leave: Nothing */ /* Not Implemented */ /* WARNING: Emulation of BEL characters will require */ /* emulation of RTC and PC speaker I/O. */ /* Also, this recurses through int 0x10 */ /* which might or might not have been */ /* installed yet. */ { /* Localise */ xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n", pInt->num); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x," " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n", X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } } break; default: /* Various extensions */ /* Enter: Various */ /* Leave: Various */ /* Ignored */ break; } return 1; } #endif #define SUCCESSFUL 0x00 #define DEVICE_NOT_FOUND 0x86 #define BAD_REGISTER_NUMBER 0x87 #ifdef SHOW_ALL_DEVICES /** * These functions are meant to be used by the PCI BIOS emulation. Some * BIOSes need to see if there are \b other chips of the same type around so * by setting \c exclude one PCI device can be explicitely excluded, if * required. */ static struct pci_device * do_find(const struct pci_id_match *m, char n, const struct pci_device *exclude) { struct pci_device *dev; struct pci_device_iterator *iter; n++; iter = pci_id_match_iterator_create(m); while ((dev = pci_device_next(iter)) != NULL) { if ((dev != exclude) && !(--n)) { break; } } pci_iterator_destroy(iter); return dev; } static struct pci_device * find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID, char n, const struct pci_device *exclude) { struct pci_id_match m; m.vendor_id = vendorID; m.device_id = deviceID; m.subvendor_id = PCI_MATCH_ANY; m.subdevice_id = PCI_MATCH_ANY; m.device_class = 0; m.device_class_mask = 0; return do_find(&m, n, exclude); } static struct pci_device * find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class, char n, const struct pci_device *exclude) { struct pci_id_match m; m.vendor_id = PCI_MATCH_ANY; m.device_id = PCI_MATCH_ANY; m.subvendor_id = PCI_MATCH_ANY; m.subdevice_id = PCI_MATCH_ANY; m.device_class = (((uint32_t) _class) << 16) | (((uint32_t) subClass) << 8) | intf; m.device_class_mask = 0x00ffffff; return do_find(&m, n, exclude); } #endif /* * Return the last bus number in the same domain as dev. Only look at the * one domain since this is going into %cl, and VGA I/O is per-domain anyway. */ static int int1A_last_bus_number(struct pci_device *dev) { struct pci_device *d; struct pci_slot_match m = { dev->domain, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY }; struct pci_device_iterator *iter; int i = 0; iter = pci_slot_match_iterator_create(&m); while ((d = pci_device_next(iter))) if (d->bus > i) i = d->bus; pci_iterator_destroy(iter); return i; } static int int1A_handler(xf86Int10InfoPtr pInt) { struct pci_device *const pvp = xf86GetPciInfoForEntity(pInt->entityIndex); struct pci_device *dev; if (pvp == NULL) return 0; /* oops */ #ifdef PRINT_INT ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n", X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI); #endif switch (X86_AX) { case 0xb101: X86_EAX &= 0xFF00; /* no config space/special cycle support */ X86_EDX = 0x20494350; /* " ICP" */ X86_EBX = 0x0210; /* Version 2.10 */ X86_ECX &= 0xFF00; X86_ECX |= int1A_last_bus_number(pvp); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ #ifdef PRINT_INT ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb102: if ((X86_DX == pvp->vendor_id) && (X86_CX == pvp->device_id) && (X86_ESI == 0)) { X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ X86_EBX = pciSlotBX(pvp); } #ifdef SHOW_ALL_DEVICES else if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) { X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ X86_EBX = pciSlotBX(dev); } #endif else { X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS); #endif return 1; case 0xb103: if ((X86_ECX & 0x00FFFFFF) == pvp->device_class) { X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EBX = pciSlotBX(pvp); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } #ifdef SHOW_ALL_DEVICES else if ((dev = find_pci_class(X86_CL, X86_CH, (X86_ECX & 0xffff0000) >> 16, X86_ESI, pvp))) { X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ X86_EBX = pciSlotBX(dev); } #endif else { X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; case 0xb108: if ((dev = findPci(pInt, X86_EBX)) != NULL) { pci_device_cfg_read_u8(dev, &X86_CL, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } else { X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb109: if ((dev = findPci(pInt, X86_EBX)) != NULL) { pci_device_cfg_read_u16(dev, &X86_CX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } else { X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb10a: if ((dev = findPci(pInt, X86_EBX)) != NULL) { pci_device_cfg_read_u32(dev, &X86_ECX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } else { X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb10b: if ((dev = findPci(pInt, X86_EBX)) != NULL) { pci_device_cfg_write_u8(dev, X86_CL, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } else { X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; case 0xb10c: if ((dev = findPci(pInt, X86_EBX)) != NULL) { pci_device_cfg_write_u16(dev, X86_CX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } else { X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; case 0xb10d: if ((dev = findPci(pInt, X86_EBX)) != NULL) { pci_device_cfg_write_u32(dev, X86_ECX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */ } else { X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */ } #ifdef PRINT_INT ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; default: xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x1a subfunction\n"); dump_registers(pInt); if (xf86GetVerbosity() > 3) stack_trace(pInt); return 0; } } static struct pci_device * findPci(xf86Int10InfoPtr pInt, unsigned short bx) { const unsigned bus = (bx >> 8) & 0x00FF; const unsigned dev = (bx >> 3) & 0x001F; const unsigned func = (bx) & 0x0007; return pci_device_find_by_slot(pInt->dev->domain, bus, dev, func); } static CARD32 pciSlotBX(const struct pci_device *pvp) { return ((pvp->bus << 8) & 0x00FF00) | (pvp->dev << 3) | (pvp->func); } /* * handle initialization */ static int intE6_handler(xf86Int10InfoPtr pInt) { struct pci_device *pvp; if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7); pushw(pInt, X86_CS); pushw(pInt, X86_IP); X86_CS = pInt->BIOSseg; X86_EIP = 0x0003; X86_ES = 0; /* standard pc es */ return 1; } xorg-server-1.20.8/hw/xfree86/int10/helper_exec.c0000644000175000017500000005170513640201473016305 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich * * Part of this code was inspired by the VBIOS POSTing code in DOSEMU * developed by the "DOSEMU-Development-Team" */ /* * To debug port accesses define PRINT_PORT to 1. * Note! You also have to comment out ioperm() * in xf86EnableIO(). Otherwise we won't trap * on PIO. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #define PRINT_PORT 0 #include #include #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" #define _INT10_PRIVATE #include "int10Defines.h" #include "xf86int10.h" #include "Pci.h" #ifdef _X86EMU #include "x86emu/x86emui.h" #else #define DEBUG_IO_TRACE() 0 #endif #include static int pciCfg1in(uint16_t addr, uint32_t *val); static int pciCfg1out(uint16_t addr, uint32_t val); static int pciCfg1inw(uint16_t addr, uint16_t *val); static int pciCfg1outw(uint16_t addr, uint16_t val); static int pciCfg1inb(uint16_t addr, uint8_t *val); static int pciCfg1outb(uint16_t addr, uint8_t val); #if defined (_PC) static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set); #endif #define REG pInt int setup_int(xf86Int10InfoPtr pInt) { if (pInt != Int10Current) { if (!MapCurrentInt10(pInt)) return -1; Int10Current = pInt; } X86_EAX = (uint32_t) pInt->ax; X86_EBX = (uint32_t) pInt->bx; X86_ECX = (uint32_t) pInt->cx; X86_EDX = (uint32_t) pInt->dx; X86_ESI = (uint32_t) pInt->si; X86_EDI = (uint32_t) pInt->di; X86_EBP = (uint32_t) pInt->bp; X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4; X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */ X86_DS = 0x40; /* standard pc ds */ X86_ES = pInt->es; X86_FS = 0; X86_GS = 0; X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK; #if defined (_PC) if (pInt->Flags & SET_BIOS_SCRATCH) SetResetBIOSVars(pInt, TRUE); #endif OsBlockSignals(); return 0; } void finish_int(xf86Int10InfoPtr pInt, int sig) { OsReleaseSignals(); pInt->ax = (uint32_t) X86_EAX; pInt->bx = (uint32_t) X86_EBX; pInt->cx = (uint32_t) X86_ECX; pInt->dx = (uint32_t) X86_EDX; pInt->si = (uint32_t) X86_ESI; pInt->di = (uint32_t) X86_EDI; pInt->es = (uint16_t) X86_ES; pInt->bp = (uint32_t) X86_EBP; pInt->flags = (uint32_t) X86_FLAGS; #if defined (_PC) if (pInt->Flags & RESTORE_BIOS_SCRATCH) SetResetBIOSVars(pInt, FALSE); #endif } /* general software interrupt handler */ uint32_t getIntVect(xf86Int10InfoPtr pInt, int num) { return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4); } void pushw(xf86Int10InfoPtr pInt, uint16_t val) { X86_ESP -= 2; MEM_WW(pInt, ((uint32_t) X86_SS << 4) + X86_SP, val); } int run_bios_int(int num, xf86Int10InfoPtr pInt) { uint32_t eflags; #ifndef _PC /* check if bios vector is initialized */ if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ? */ if (num == 21 && X86_AH == 0x4e) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_NOTICE, "Failing Find-Matching-File on non-PC" " (int 21, func 4e)\n"); X86_AX = 2; SET_FLAG(F_CF); return 1; } else { xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "Ignoring int 0x%02x call\n", num); if (xf86GetVerbosity() > 3) { dump_registers(pInt); stack_trace(pInt); } return 1; } } #endif #ifdef PRINT_INT ErrorF("calling card BIOS at: "); #endif eflags = X86_EFLAGS; #if 0 eflags = eflags | IF_MASK; X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK); #endif pushw(pInt, eflags); pushw(pInt, X86_CS); pushw(pInt, X86_IP); X86_CS = MEM_RW(pInt, (num << 2) + 2); X86_IP = MEM_RW(pInt, num << 2); #ifdef PRINT_INT ErrorF("0x%x:%lx\n", X86_CS, X86_EIP); #endif return 1; } /* Debugging stuff */ void dump_code(xf86Int10InfoPtr pInt) { int i; uint32_t lina = SEG_ADR((uint32_t), X86_CS, IP); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", (unsigned) lina); for (i = 0; i < 0x10; i++) xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); xf86ErrorFVerb(3, "\n"); for (; i < 0x20; i++) xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); xf86ErrorFVerb(3, "\n"); } void dump_registers(xf86Int10InfoPtr pInt) { xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n", (unsigned long) X86_EAX, (unsigned long) X86_EBX, (unsigned long) X86_ECX, (unsigned long) X86_EDX); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n", (unsigned long) X86_ESP, (unsigned long) X86_EBP, (unsigned long) X86_ESI, (unsigned long) X86_EDI); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "CS=0x%4.4x, SS=0x%4.4x," " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n", X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n", (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS); } void stack_trace(xf86Int10InfoPtr pInt) { int i = 0; unsigned long stack = SEG_ADR((uint32_t), X86_SS, SP); unsigned long tail = (uint32_t) ((X86_SS << 4) + 0x1000); if (stack >= tail) return; xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack); for (; stack < tail; stack++) { xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack)); i = (i + 1) % 0x10; if (!i) xf86ErrorFVerb(3, "\n"); } if (i) xf86ErrorFVerb(3, "\n"); } int port_rep_inb(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -1 : 1; uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { MEM_WB(pInt, dst, x_inb(port)); dst += inc; } return dst - base; } int port_rep_inw(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -2 : 2; uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { MEM_WW(pInt, dst, x_inw(port)); dst += inc; } return dst - base; } int port_rep_inl(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -4 : 4; uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { MEM_WL(pInt, dst, x_inl(port)); dst += inc; } return dst - base; } int port_rep_outb(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -1 : 1; uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { x_outb(port, MEM_RB(pInt, dst)); dst += inc; } return dst - base; } int port_rep_outw(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -2 : 2; uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { x_outw(port, MEM_RW(pInt, dst)); dst += inc; } return dst - base; } int port_rep_outl(xf86Int10InfoPtr pInt, uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -4 : 4; uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { x_outl(port, MEM_RL(pInt, dst)); dst += inc; } return dst - base; } uint8_t x_inb(uint16_t port) { uint8_t val; if (port == 0x40) { Int10Current->inb40time++; val = (uint8_t) (Int10Current->inb40time >> ((Int10Current->inb40time & 1) << 3)); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" inb(%#x) = %2.2x\n", port, val); #ifdef __NOT_YET__ } else if (port < 0x0100) { /* Don't interfere with mainboard */ val = 0; xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "inb 0x%4.4x\n", port); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); stack_trace(Int10Current); } #endif /* __NOT_YET__ */ } else if (!pciCfg1inb(port, &val)) { val = pci_io_read8(Int10Current->io, port); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" inb(%#x) = %2.2x\n", port, val); } return val; } uint16_t x_inw(uint16_t port) { uint16_t val; if (port == 0x5c) { struct timeval tv; /* * Emulate a PC's timer. Typical resolution is 3.26 usec. * Approximate this by dividing by 3. */ X_GETTIMEOFDAY(&tv); val = (uint16_t) (tv.tv_usec / 3); } else if (!pciCfg1inw(port, &val)) { val = pci_io_read16(Int10Current->io, port); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" inw(%#x) = %4.4x\n", port, val); } return val; } void x_outb(uint16_t port, uint8_t val) { if ((port == 0x43) && (val == 0)) { struct timeval tv; /* * Emulate a PC's timer 0. Such timers typically have a resolution of * some .838 usec per tick, but this can only provide 1 usec per tick. * (Not that this matters much, given inherent emulation delays.) Use * the bottom bit as a byte select. See inb(0x40) above. */ X_GETTIMEOFDAY(&tv); Int10Current->inb40time = (uint16_t) (tv.tv_usec | 1); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" outb(%#x, %2.2x)\n", port, val); #ifdef __NOT_YET__ } else if (port < 0x0100) { /* Don't interfere with mainboard */ xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "outb 0x%4.4x,0x%2.2x\n", port, val); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); stack_trace(Int10Current); } #endif /* __NOT_YET__ */ } else if (!pciCfg1outb(port, val)) { if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" outb(%#x, %2.2x)\n", port, val); pci_io_write8(Int10Current->io, port, val); } } void x_outw(uint16_t port, uint16_t val) { if (!pciCfg1outw(port, val)) { if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" outw(%#x, %4.4x)\n", port, val); pci_io_write16(Int10Current->io, port, val); } } uint32_t x_inl(uint16_t port) { uint32_t val; if (!pciCfg1in(port, &val)) { val = pci_io_read32(Int10Current->io, port); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, (unsigned) val); } return val; } void x_outl(uint16_t port, uint32_t val) { if (!pciCfg1out(port, val)) { if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, (unsigned) val); pci_io_write32(Int10Current->io, port, val); } } uint8_t Mem_rb(uint32_t addr) { return (*Int10Current->mem->rb) (Int10Current, addr); } uint16_t Mem_rw(uint32_t addr) { return (*Int10Current->mem->rw) (Int10Current, addr); } uint32_t Mem_rl(uint32_t addr) { return (*Int10Current->mem->rl) (Int10Current, addr); } void Mem_wb(uint32_t addr, uint8_t val) { (*Int10Current->mem->wb) (Int10Current, addr, val); } void Mem_ww(uint32_t addr, uint16_t val) { (*Int10Current->mem->ww) (Int10Current, addr, val); } void Mem_wl(uint32_t addr, uint32_t val) { (*Int10Current->mem->wl) (Int10Current, addr, val); } static uint32_t PciCfg1Addr = 0; #define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK)) #define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK)) #define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11) #define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8) #define PCI_OFFSET(x) ((x) & 0x000000ff) #define PCI_TAG(x) ((x) & 0x7fffff00) static struct pci_device * pci_device_for_cfg_address(uint32_t addr) { struct pci_device *dev = NULL; uint32_t tag = PCI_TAG(addr); struct pci_slot_match slot_match = { .domain = PCI_DOM_FROM_TAG(tag), .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)), .dev = PCI_DEV_FROM_TAG(tag), .func = PCI_FUNC_FROM_TAG(tag), .match_data = 0 }; struct pci_device_iterator *iter = pci_slot_match_iterator_create(&slot_match); if (iter) dev = pci_device_next(iter); pci_iterator_destroy(iter); return dev; } static int pciCfg1in(uint16_t addr, uint32_t *val) { if (addr == 0xCF8) { *val = PciCfg1Addr; return 1; } if (addr == 0xCFC) { pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr), (uint32_t *) val, PCI_OFFSET(PciCfg1Addr)); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", (unsigned) PciCfg1Addr, (unsigned) *val); return 1; } return 0; } static int pciCfg1out(uint16_t addr, uint32_t val) { if (addr == 0xCF8) { PciCfg1Addr = val; return 1; } if (addr == 0xCFC) { if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", (unsigned) PciCfg1Addr, (unsigned) val); pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr)); return 1; } return 0; } static int pciCfg1inw(uint16_t addr, uint16_t *val) { int shift; if ((addr >= 0xCF8) && (addr <= 0xCFB)) { shift = (addr - 0xCF8) * 8; *val = (PciCfg1Addr >> shift) & 0xffff; return 1; } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", (unsigned) (PciCfg1Addr + offset), (unsigned) *val); return 1; } return 0; } static int pciCfg1outw(uint16_t addr, uint16_t val) { int shift; if ((addr >= 0xCF8) && (addr <= 0xCFB)) { shift = (addr - 0xCF8) * 8; PciCfg1Addr &= ~(0xffff << shift); PciCfg1Addr |= ((uint32_t) val) << shift; return 1; } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", (unsigned) (PciCfg1Addr + offset), (unsigned) val); pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); return 1; } return 0; } static int pciCfg1inb(uint16_t addr, uint8_t *val) { int shift; if ((addr >= 0xCF8) && (addr <= 0xCFB)) { shift = (addr - 0xCF8) * 8; *val = (PciCfg1Addr >> shift) & 0xff; return 1; } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", (unsigned) (PciCfg1Addr + offset), (unsigned) *val); return 1; } return 0; } static int pciCfg1outb(uint16_t addr, uint8_t val) { int shift; if ((addr >= 0xCF8) && (addr <= 0xCFB)) { shift = (addr - 0xCF8) * 8; PciCfg1Addr &= ~(0xff << shift); PciCfg1Addr |= ((uint32_t) val) << shift; return 1; } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", (unsigned) (PciCfg1Addr + offset), (unsigned) val); pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); return 1; } return 0; } uint8_t bios_checksum(const uint8_t *start, int size) { uint8_t sum = 0; while (size-- > 0) sum += *start++; return sum; } /* * Lock/Unlock legacy VGA. Some Bioses try to be very clever and make * an attempt to detect a legacy ISA card. If they find one they might * act very strange: for example they might configure the card as a * monochrome card. This might cause some drivers to choke. * To avoid this we attempt legacy VGA by writing to all know VGA * disable registers before we call the BIOS initialization and * restore the original values afterwards. In beween we hold our * breath. To get to a (possibly exising) ISA card need to disable * our current PCI card. */ /* * This is just for booting: we just want to catch pure * legacy vga therefore we don't worry about mmio etc. * This stuff should really go into vgaHW.c. However then * the driver would have to load the vga-module prior to * doing int10. */ void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) { vga->save_msr = pci_io_read8(pInt->io, 0x03CC); vga->save_vse = pci_io_read8(pInt->io, 0x03C3); #ifndef __ia64__ vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8); #endif vga->save_pos102 = pci_io_read8(pInt->io, 0x0102); pci_io_write8(pInt->io, 0x03C2, ~(uint8_t) 0x03 & vga->save_msr); pci_io_write8(pInt->io, 0x03C3, ~(uint8_t) 0x01 & vga->save_vse); #ifndef __ia64__ pci_io_write8(pInt->io, 0x46E8, ~(uint8_t) 0x08 & vga->save_46e8); #endif pci_io_write8(pInt->io, 0x0102, ~(uint8_t) 0x01 & vga->save_pos102); } void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) { pci_io_write8(pInt->io, 0x0102, vga->save_pos102); #ifndef __ia64__ pci_io_write8(pInt->io, 0x46E8, vga->save_46e8); #endif pci_io_write8(pInt->io, 0x03C3, vga->save_vse); pci_io_write8(pInt->io, 0x03C2, vga->save_msr); } #if defined (_PC) static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set) { int pagesize = getpagesize(); unsigned char *base; int i; if (pci_device_map_legacy (pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **) &base)) return; /* eek */ if (set) { for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++) MEM_WW(pInt, i, *(base + i)); } else { for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++) *(base + i) = MEM_RW(pInt, i); } pci_device_unmap_legacy(pInt->dev, base, pagesize); } void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save) { int pagesize = getpagesize(); unsigned char *base; int i; if (!xf86IsEntityPrimary(pInt->entityIndex) || (!save && !pInt->BIOSScratch)) return; if (pci_device_map_legacy (pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **) &base)) return; /* eek */ base += BIOS_SCRATCH_OFF; if (save) { if ((pInt->BIOSScratch = xnfalloc(BIOS_SCRATCH_LEN))) for (i = 0; i < BIOS_SCRATCH_LEN; i++) *(((char *) pInt->BIOSScratch + i)) = *(base + i); } else { if (pInt->BIOSScratch) { for (i = 0; i < BIOS_SCRATCH_LEN; i++) *(base + i) = *(pInt->BIOSScratch + i); free(pInt->BIOSScratch); pInt->BIOSScratch = NULL; } } pci_device_unmap_legacy(pInt->dev, base - BIOS_SCRATCH_OFF, pagesize); } #endif xf86Int10InfoPtr xf86InitInt10(int entityIndex) { return xf86ExtendedInitInt10(entityIndex, 0); } xorg-server-1.20.8/hw/xfree86/int10/generic.c0000644000175000017500000002761013640201473015434 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" #define _INT10_PRIVATE #include "xf86int10.h" #include "int10Defines.h" #include "Pci.h" #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) #include /* needed for memmove */ static __inline__ uint32_t ldl_u(uint32_t * p) { uint32_t ret; memmove(&ret, p, sizeof(*p)); return ret; } static __inline__ uint16_t ldw_u(uint16_t * p) { uint16_t ret; memmove(&ret, p, sizeof(*p)); return ret; } static __inline__ void stl_u(uint32_t val, uint32_t * p) { uint32_t tmp = val; memmove(p, &tmp, sizeof(*p)); } static __inline__ void stw_u(uint16_t val, uint16_t * p) { uint16_t tmp = val; memmove(p, &tmp, sizeof(*p)); } static uint8_t read_b(xf86Int10InfoPtr pInt, int addr); static uint16_t read_w(xf86Int10InfoPtr pInt, int addr); static uint32_t read_l(xf86Int10InfoPtr pInt, int addr); static void write_b(xf86Int10InfoPtr pInt, int addr, uint8_t val); static void write_w(xf86Int10InfoPtr pInt, int addr, uint16_t val); static void write_l(xf86Int10InfoPtr pInt, int addr, uint32_t val); /* * the emulator cannot pass a pointer to the current xf86Int10InfoRec * to the memory access functions therefore store it here. */ typedef struct { int shift; int entries; void *base; void *vRam; int highMemory; void *sysMem; char *alloc; } genericInt10Priv; #define INTPriv(x) ((genericInt10Priv*)x->private) int10MemRec genericMem = { read_b, read_w, read_l, write_b, write_w, write_l }; static void MapVRam(xf86Int10InfoPtr pInt); static void UnmapVRam(xf86Int10InfoPtr pInt); #ifdef _PC #define GET_HIGH_BASE(x) (((V_BIOS + (x) + getpagesize() - 1)/getpagesize()) \ * getpagesize()) #endif static void *sysMem = NULL; static Bool readIntVec(struct pci_device *dev, unsigned char *buf, int len) { void *map; if (pci_device_map_legacy(dev, 0, len, 0, &map)) return FALSE; memcpy(buf, map, len); pci_device_unmap_legacy(dev, map, len); return TRUE; } xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags) { xf86Int10InfoPtr pInt; void *base = 0; void *vbiosMem = 0; void *options = NULL; legacyVGARec vga; ScrnInfoPtr pScrn; pScrn = xf86FindScreenForEntity(entityIndex); options = xf86HandleInt10Options(pScrn, entityIndex); if (int10skip(options)) { free(options); return NULL; } pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec)); pInt->entityIndex = entityIndex; if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &genericMem; pInt->private = (void *) xnfcalloc(1, sizeof(genericInt10Priv)); INTPriv(pInt)->alloc = (void *) xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); pInt->pScrn = pScrn; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); /* FIXME: Shouldn't this be a failure case? Leaving dev as NULL seems like * FIXME: an error */ pInt->dev = xf86GetPciInfoForEntity(entityIndex); /* * we need to map video RAM MMIO as some chipsets map mmio * registers into this range. */ MapVRam(pInt); #ifdef _PC if (!sysMem) pci_device_map_legacy(pInt->dev, V_BIOS, BIOS_SIZE + SYS_BIOS - V_BIOS, PCI_DEV_MAP_FLAG_WRITABLE, &sysMem); INTPriv(pInt)->sysMem = sysMem; if (!readIntVec(pInt->dev, base, LOW_PAGE_SIZE)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n"); goto error1; } /* * Retrieve everything between V_BIOS and SYS_BIOS as some system BIOSes * have executable code there. */ memset((char *) base + V_BIOS, 0, SYS_BIOS - V_BIOS); INTPriv(pInt)->highMemory = V_BIOS; if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) { if (!xf86int10GetBiosSegment(pInt, (unsigned char *) sysMem - V_BIOS)) goto error1; set_return_trap(pInt); pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); if (!(pInt->Flags & SET_BIOS_SCRATCH)) pInt->Flags &= ~RESTORE_BIOS_SCRATCH; xf86Int10SaveRestoreBIOSVars(pInt, TRUE); } else { const BusType location_type = xf86int10GetBiosLocationType(pInt); int bios_location = V_BIOS; reset_int_vect(pInt); set_return_trap(pInt); switch (location_type) { case BUS_PCI:{ int err; struct pci_device *rom_device = xf86GetPciInfoForEntity(pInt->entityIndex); vbiosMem = (unsigned char *) base + bios_location; err = pci_device_read_rom(rom_device, vbiosMem); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (3) %s\n", strerror(err)); goto error1; } INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size); break; } default: goto error1; } pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); UnlockLegacyVGA(pInt, &vga); } #else if (!sysMem) { sysMem = xnfalloc(BIOS_SIZE); setup_system_bios(sysMem); } INTPriv(pInt)->sysMem = sysMem; setup_int_vect(pInt); set_return_trap(pInt); /* Retrieve the entire legacy video BIOS segment. This can be upto * 128KiB. */ vbiosMem = (char *) base + V_BIOS; memset(vbiosMem, 0, 2 * V_BIOS_SIZE); if (pci_device_read_rom(pInt->dev, vbiosMem) != 0 || pInt->dev->rom_size < V_BIOS_SIZE) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to retrieve all of segment 0x0C0000.\n"); } /* * If this adapter is the primary, use its post-init BIOS (if we can find * it). */ { int bios_location = V_BIOS; Bool done = FALSE; vbiosMem = (unsigned char *) base + bios_location; if (xf86IsEntityPrimary(entityIndex)) { if (int10_check_bios(pScrn->scrnIndex, bios_location >> 4, vbiosMem)) done = TRUE; else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No legacy BIOS found -- trying PCI\n"); } if (!done) { int err; struct pci_device *rom_device = xf86GetPciInfoForEntity(pInt->entityIndex); err = pci_device_read_rom(rom_device, vbiosMem); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (5) %s\n", strerror(err)); goto error1; } } } pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); UnlockLegacyVGA(pInt, &vga); #endif free(options); return pInt; error1: free(base); UnmapVRam(pInt); free(INTPriv(pInt)->alloc); free(pInt->private); error0: free(pInt); free(options); return NULL; } static void MapVRam(xf86Int10InfoPtr pInt) { int pagesize = getpagesize(); int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize; pci_device_map_legacy(pInt->dev, V_RAM, size, PCI_DEV_MAP_FLAG_WRITABLE, &(INTPriv(pInt)->vRam)); pInt->io = pci_legacy_open_io(pInt->dev, 0, 64 * 1024); } static void UnmapVRam(xf86Int10InfoPtr pInt) { int pagesize = getpagesize(); int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize; pci_device_unmap_legacy(pInt->dev, INTPriv(pInt)->vRam, size); pci_device_close_io(pInt->dev, pInt->io); pInt->io = NULL; } Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { /* nothing to do here */ return TRUE; } void xf86FreeInt10(xf86Int10InfoPtr pInt) { if (!pInt) return; #if defined (_PC) xf86Int10SaveRestoreBIOSVars(pInt, FALSE); #endif if (Int10Current == pInt) Int10Current = NULL; free(INTPriv(pInt)->base); UnmapVRam(pInt); free(INTPriv(pInt)->alloc); free(pInt->private); free(pInt); } void * xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) { int pagesize = getpagesize(); int num_pages = ALLOC_ENTRIES(pagesize); int i, j; for (i = 0; i < (num_pages - num); i++) { if (INTPriv(pInt)->alloc[i] == 0) { for (j = i; j < (num + i); j++) if (INTPriv(pInt)->alloc[j] != 0) break; if (j == (num + i)) break; i += num; } } if (i == (num_pages - num)) return NULL; for (j = i; j < (i + num); j++) INTPriv(pInt)->alloc[j] = 1; *off = (i + 1) * pagesize; return (char *) INTPriv(pInt)->base + *off; } void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) { int pagesize = getpagesize(); int first = (((char *) pbase - (char *) INTPriv(pInt)->base) / pagesize) - 1; int i; for (i = first; i < (first + num); i++) INTPriv(pInt)->alloc[i] = 0; } #define OFF(addr) ((addr) & 0xffff) #if defined _PC #define HIGH_OFFSET (INTPriv(pInt)->highMemory) #define HIGH_BASE V_BIOS #else #define HIGH_OFFSET SYS_BIOS #define HIGH_BASE SYS_BIOS #endif #define SYS(addr) ((addr) >= HIGH_OFFSET) #define V_ADDR(addr) \ (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \ : (((char*)(INTPriv(pInt)->base) + addr))) #define VRAM_ADDR(addr) (addr - V_RAM) #define VRAM_BASE (INTPriv(pInt)->vRam) #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE))) #define V_ADDR_RB(addr) \ (VRAM(addr)) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr)) \ : *(uint8_t*) V_ADDR(addr) #define V_ADDR_RW(addr) \ (VRAM(addr)) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr)) \ : ldw_u((void *)V_ADDR(addr)) #define V_ADDR_RL(addr) \ (VRAM(addr)) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr)) \ : ldl_u((void *)V_ADDR(addr)) #define V_ADDR_WB(addr,val) \ if(VRAM(addr)) \ MMIO_OUT8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ else \ *(uint8_t*) V_ADDR(addr) = val; #define V_ADDR_WW(addr,val) \ if(VRAM(addr)) \ MMIO_OUT16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ else \ stw_u((val),(void *)(V_ADDR(addr))); #define V_ADDR_WL(addr,val) \ if (VRAM(addr)) \ MMIO_OUT32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ else \ stl_u(val,(void *)(V_ADDR(addr))); static uint8_t read_b(xf86Int10InfoPtr pInt, int addr) { return V_ADDR_RB(addr); } static uint16_t read_w(xf86Int10InfoPtr pInt, int addr) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN if (OFF(addr + 1) > 0) return V_ADDR_RW(addr); #endif return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8); } static uint32_t read_l(xf86Int10InfoPtr pInt, int addr) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN if (OFF(addr + 3) > 2) return V_ADDR_RL(addr); #endif return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8) | (V_ADDR_RB(addr + 2) << 16) | (V_ADDR_RB(addr + 3) << 24); } static void write_b(xf86Int10InfoPtr pInt, int addr, uint8_t val) { V_ADDR_WB(addr, val); } static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN if (OFF(addr + 1) > 0) { V_ADDR_WW(addr, val); } #endif V_ADDR_WB(addr, val); V_ADDR_WB(addr + 1, val >> 8); } static void write_l(xf86Int10InfoPtr pInt, int addr, uint32_t val) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN if (OFF(addr + 3) > 2) { V_ADDR_WL(addr, val); } #endif V_ADDR_WB(addr, val); V_ADDR_WB(addr + 1, val >> 8); V_ADDR_WB(addr + 2, val >> 16); V_ADDR_WB(addr + 3, val >> 24); } void * xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr) { return V_ADDR(addr); } xorg-server-1.20.8/hw/xfree86/int10/xf86x86emu.c0000644000175000017500000000305413640201473015664 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Pci.h" #define _INT10_PRIVATE #include "xf86int10.h" #include "int10Defines.h" #include #define M _X86EMU_env static void x86emu_do_int(int num) { Int10Current->num = num; if (!int_handler(Int10Current)) { X86EMU_halt_sys(); } } void xf86ExecX86int10(xf86Int10InfoPtr pInt) { int sig = setup_int(pInt); if (sig < 0) return; if (int_handler(pInt)) { X86EMU_exec(); } finish_int(pInt, sig); } Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt) { int i; X86EMU_intrFuncs intFuncs[256]; X86EMU_pioFuncs pioFuncs = { .inb = x_inb, .inw = x_inw, .inl = x_inl, .outb = x_outb, .outw = x_outw, .outl = x_outl }; X86EMU_memFuncs memFuncs = { (&Mem_rb), (&Mem_rw), (&Mem_rl), (&Mem_wb), (&Mem_ww), (&Mem_wl) }; X86EMU_setupMemFuncs(&memFuncs); pInt->cpuRegs = &M; M.mem_base = 0; M.mem_size = 1024 * 1024 + 1024; X86EMU_setupPioFuncs(&pioFuncs); for (i = 0; i < 256; i++) intFuncs[i] = x86emu_do_int; X86EMU_setupIntrFuncs(intFuncs); return TRUE; } void printk(const char *fmt, ...) { va_list argptr; va_start(argptr, fmt); VErrorF(fmt, argptr); va_end(argptr); } xorg-server-1.20.8/hw/xfree86/int10/Makefile.in0000644000175000017500000010632213640201513015712 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @INT10_X86EMU_TRUE@am__append_1 = -I$(srcdir)/../x86emu subdir = hw/xfree86/int10 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) am__DEPENDENCIES_1 = libint10_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libint10_la_SOURCES_DIST = stub.c xf86int10module.c helper_exec.c \ helper_mem.c xf86int10.c \ $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \ $(srcdir)/../os-support/linux/int10/linux.c xf86x86emu.c \ generic.c x86emu.c am__objects_1 = helper_exec.lo helper_mem.lo xf86int10.lo \ xf86int10module.lo @INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@am_libint10_la_OBJECTS = $(am__objects_1) \ @INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@ xf86x86emu.lo \ @INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@ generic.lo \ @INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@ x86emu.lo @INT10_STUB_FALSE@@INT10_VM86_TRUE@am_libint10_la_OBJECTS = \ @INT10_STUB_FALSE@@INT10_VM86_TRUE@ $(am__objects_1) \ @INT10_STUB_FALSE@@INT10_VM86_TRUE@ linux_vm86.lo linux.lo @INT10_STUB_TRUE@am_libint10_la_OBJECTS = stub.lo xf86int10module.lo libint10_la_OBJECTS = $(am_libint10_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libint10_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libint10_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/generic.Plo \ ./$(DEPDIR)/helper_exec.Plo ./$(DEPDIR)/helper_mem.Plo \ ./$(DEPDIR)/linux.Plo ./$(DEPDIR)/linux_vm86.Plo \ ./$(DEPDIR)/stub.Plo ./$(DEPDIR)/x86emu.Plo \ ./$(DEPDIR)/xf86int10.Plo ./$(DEPDIR)/xf86int10module.Plo \ ./$(DEPDIR)/xf86x86emu.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libint10_la_SOURCES) DIST_SOURCES = $(am__libint10_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libint10.la sdk_HEADERS = xf86int10.h EXTRA_CFLAGS = libint10_la_LDFLAGS = -avoid-version libint10_la_LIBADD = $(PCIACCESS_LIBS) COMMON_SOURCES = \ helper_exec.c \ helper_mem.c \ xf86int10.c \ xf86int10module.c @I386_VIDEO_TRUE@I386_VIDEO_CFLAGS = -D_PC AM_CPPFLAGS = $(XORG_INCS) $(am__append_1) @INT10_STUB_TRUE@AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS) @INT10_VM86_TRUE@AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS) @INT10_X86EMU_TRUE@AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \ @INT10_X86EMU_TRUE@ $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS) @INT10_STUB_TRUE@libint10_la_SOURCES = stub.c xf86int10module.c @INT10_VM86_TRUE@libint10_la_SOURCES = \ @INT10_VM86_TRUE@ $(COMMON_SOURCES) \ @INT10_VM86_TRUE@ $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \ @INT10_VM86_TRUE@ $(srcdir)/../os-support/linux/int10/linux.c @INT10_X86EMU_TRUE@libint10_la_SOURCES = \ @INT10_X86EMU_TRUE@ $(COMMON_SOURCES) \ @INT10_X86EMU_TRUE@ xf86x86emu.c \ @INT10_X86EMU_TRUE@ generic.c \ @INT10_X86EMU_TRUE@ x86emu.c EXTRA_DIST = xf86x86emu.h INT10.HOWTO all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/int10/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/int10/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libint10.la: $(libint10_la_OBJECTS) $(libint10_la_DEPENDENCIES) $(EXTRA_libint10_la_DEPENDENCIES) $(AM_V_CCLD)$(libint10_la_LINK) -rpath $(moduledir) $(libint10_la_OBJECTS) $(libint10_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_exec.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_mem.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_vm86.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86emu.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86int10.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86int10module.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86x86emu.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< linux_vm86.lo: $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linux_vm86.lo -MD -MP -MF $(DEPDIR)/linux_vm86.Tpo -c -o linux_vm86.lo `test -f '$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/linux_vm86.Tpo $(DEPDIR)/linux_vm86.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c' object='linux_vm86.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linux_vm86.lo `test -f '$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c linux.lo: $(srcdir)/../os-support/linux/int10/linux.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linux.lo -MD -MP -MF $(DEPDIR)/linux.Tpo -c -o linux.lo `test -f '$(srcdir)/../os-support/linux/int10/linux.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/linux.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/linux.Tpo $(DEPDIR)/linux.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../os-support/linux/int10/linux.c' object='linux.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linux.lo `test -f '$(srcdir)/../os-support/linux/int10/linux.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/linux.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/generic.Plo -rm -f ./$(DEPDIR)/helper_exec.Plo -rm -f ./$(DEPDIR)/helper_mem.Plo -rm -f ./$(DEPDIR)/linux.Plo -rm -f ./$(DEPDIR)/linux_vm86.Plo -rm -f ./$(DEPDIR)/stub.Plo -rm -f ./$(DEPDIR)/x86emu.Plo -rm -f ./$(DEPDIR)/xf86int10.Plo -rm -f ./$(DEPDIR)/xf86int10module.Plo -rm -f ./$(DEPDIR)/xf86x86emu.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/generic.Plo -rm -f ./$(DEPDIR)/helper_exec.Plo -rm -f ./$(DEPDIR)/helper_mem.Plo -rm -f ./$(DEPDIR)/linux.Plo -rm -f ./$(DEPDIR)/linux_vm86.Plo -rm -f ./$(DEPDIR)/stub.Plo -rm -f ./$(DEPDIR)/x86emu.Plo -rm -f ./$(DEPDIR)/xf86int10.Plo -rm -f ./$(DEPDIR)/xf86int10module.Plo -rm -f ./$(DEPDIR)/xf86x86emu.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-moduleLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/int10/meson.build0000644000175000017500000000231013640201473016004 00000000000000srcs_xorg_int10 = [ 'helper_exec.c', 'helper_mem.c', 'xf86int10.c', 'xf86int10module.c', ] int10_c_args = [xorg_c_args] int10_link = [] if host_machine.cpu() == 'i386' or host_machine.cpu() == 'x86_64' int10_c_args += '-D_PC' endif if int10 == 'stub' srcs_xorg_int10 += 'stub.c' int10_c_args += '-D_VM86_LINUX' endif if int10 == 'x86emu' srcs_xorg_int10 += [ 'generic.c', 'xf86x86emu.c', 'x86emu.c', ] int10_c_args += '-D_X86EMU' int10_c_args += '-DNO_SYS_HEADERS' # Silence some useless warnings from x86emu if cc.has_argument('-Wno-format-nonliteral') int10_c_args += '-Wno-format-nonliteral' endif int10_link += xorg_x86emu endif if int10 == 'vm86' srcs_xorg_int10 += [ 'vm86/linux_vm86.c', 'linux.c', ] int10_c_args += '-D_VM86_LINUX' endif xorg_int10 = shared_module('int10', srcs_xorg_int10, include_directories: [ inc, xorg_inc, include_directories('../x86emu') ], dependencies: common_dep, link_with: int10_link, c_args: int10_c_args, install: true, install_dir: module_dir, ) install_data('xf86int10.h', install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/int10/xf86x86emu.h0000644000175000017500000000231213640201473015665 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef XF86X86EMU_H_ #define XF86X86EMU_H_ #include #define M _X86EMU_env #define X86_EAX M.x86.R_EAX #define X86_EBX M.x86.R_EBX #define X86_ECX M.x86.R_ECX #define X86_EDX M.x86.R_EDX #define X86_ESI M.x86.R_ESI #define X86_EDI M.x86.R_EDI #define X86_EBP M.x86.R_EBP #define X86_EIP M.x86.R_EIP #define X86_ESP M.x86.R_ESP #define X86_EFLAGS M.x86.R_EFLG #define X86_FLAGS M.x86.R_FLG #define X86_AX M.x86.R_AX #define X86_BX M.x86.R_BX #define X86_CX M.x86.R_CX #define X86_DX M.x86.R_DX #define X86_SI M.x86.R_SI #define X86_DI M.x86.R_DI #define X86_BP M.x86.R_BP #define X86_IP M.x86.R_IP #define X86_SP M.x86.R_SP #define X86_CS M.x86.R_CS #define X86_DS M.x86.R_DS #define X86_ES M.x86.R_ES #define X86_SS M.x86.R_SS #define X86_FS M.x86.R_FS #define X86_GS M.x86.R_GS #define X86_AL M.x86.R_AL #define X86_BL M.x86.R_BL #define X86_CL M.x86.R_CL #define X86_DL M.x86.R_DL #define X86_AH M.x86.R_AH #define X86_BH M.x86.R_BH #define X86_CH M.x86.R_CH #define X86_DH M.x86.R_DH #endif xorg-server-1.20.8/hw/xfree86/int10/helper_mem.c0000644000175000017500000002123013640201473016125 00000000000000/* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" #include "xf86Pci.h" #define _INT10_PRIVATE #if 0 #include "int10Defines.h" #endif #include "xf86int10.h" #define REG pInt typedef enum { OPT_NOINT10, OPT_INIT_PRIMARY, } INT10Opts; static const OptionInfoRec INT10Options[] = { {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE}, {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; #ifdef DEBUG void dprint(unsigned long start, unsigned long size) { int i, j; char *c = (char *) start; for (j = 0; j < (size >> 4); j++) { char *d = c; ErrorF("\n0x%lx: ", (unsigned long) c); for (i = 0; i < 16; i++) ErrorF("%2.2x ", (unsigned char) (*(c++))); c = d; for (i = 0; i < 16; i++) { ErrorF("%c", ((((CARD8) (*c)) > 32) && (((CARD8) (*c)) < 128)) ? (unsigned char) (*(c)) : '.'); c++; } } ErrorF("\n"); } #endif #ifndef _PC /* * here we are really paranoid about faking a "real" * BIOS. Most of this information was pulled from * dosemu. */ void setup_int_vect(xf86Int10InfoPtr pInt) { int i; /* let the int vects point to the SYS_BIOS seg */ for (i = 0; i < 0x80; i++) { MEM_WW(pInt, i << 2, 0); MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4); } reset_int_vect(pInt); /* font tables default location (int 1F) */ MEM_WW(pInt, 0x1f << 2, 0xfa6e); /* int 11 default location (Get Equipment Configuration) */ MEM_WW(pInt, 0x11 << 2, 0xf84d); /* int 12 default location (Get Conventional Memory Size) */ MEM_WW(pInt, 0x12 << 2, 0xf841); /* int 15 default location (I/O System Extensions) */ MEM_WW(pInt, 0x15 << 2, 0xf859); /* int 1A default location (RTC, PCI and others) */ MEM_WW(pInt, 0x1a << 2, 0xff6e); /* int 05 default location (Bound Exceeded) */ MEM_WW(pInt, 0x05 << 2, 0xff54); /* int 08 default location (Double Fault) */ MEM_WW(pInt, 0x08 << 2, 0xfea5); /* int 13 default location (Disk) */ MEM_WW(pInt, 0x13 << 2, 0xec59); /* int 0E default location (Page Fault) */ MEM_WW(pInt, 0x0e << 2, 0xef57); /* int 17 default location (Parallel Port) */ MEM_WW(pInt, 0x17 << 2, 0xefd2); /* fdd table default location (int 1e) */ MEM_WW(pInt, 0x1e << 2, 0xefc7); /* Set Equipment flag to VGA */ i = MEM_RB(pInt, 0x0410) & 0xCF; MEM_WB(pInt, 0x0410, i); /* XXX Perhaps setup more of the BDA here. See also int42(0x00). */ } #endif int setup_system_bios(void *base_addr) { char *base = (char *) base_addr; /* * we trap the "industry standard entry points" to the BIOS * and all other locations by filling them with "hlt" * TODO: implement hlt-handler for these */ memset(base, 0xf4, 0x10000); /* set bios date */ strcpy(base + 0x0FFF5, "06/11/99"); /* set up eisa ident string */ strcpy(base + 0x0FFD9, "PCI_ISA"); /* write system model id for IBM-AT */ *((unsigned char *) (base + 0x0FFFE)) = 0xfc; return 1; } void reset_int_vect(xf86Int10InfoPtr pInt) { /* * This table is normally located at 0xF000:0xF0A4. However, int 0x42, * function 0 (Mode Set) expects it (or a copy) somewhere in the bottom * 64kB. Note that because this data doesn't survive POST, int 0x42 should * only be used during EGA/VGA BIOS initialisation. */ static const CARD8 VideoParms[] = { /* Timing for modes 0x00 & 0x01 */ 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, /* Timing for modes 0x02 & 0x03 */ 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, /* Timing for modes 0x04, 0x05 & 0x06 */ 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70, 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, /* Timing for mode 0x07 */ 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19, 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, /* Display page lengths in little endian order */ 0x00, 0x08, /* Modes 0x00 and 0x01 */ 0x00, 0x10, /* Modes 0x02 and 0x03 */ 0x00, 0x40, /* Modes 0x04 and 0x05 */ 0x00, 0x40, /* Modes 0x06 and 0x07 */ /* Number of columns for each mode */ 40, 40, 80, 80, 40, 40, 80, 80, /* CGA Mode register value for each mode */ 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29, /* Padding */ 0x00, 0x00, 0x00, 0x00 }; int i; for (i = 0; i < sizeof(VideoParms); i++) MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]); MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms)); MEM_WW(pInt, (0x1d << 2) + 2, 0); MEM_WW(pInt, 0x10 << 2, 0xf065); MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4); MEM_WW(pInt, 0x42 << 2, 0xf065); MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4); MEM_WW(pInt, 0x6D << 2, 0xf065); MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4); } void set_return_trap(xf86Int10InfoPtr pInt) { /* * Here we set the exit condition: We return when we encounter * 'hlt' (=0xf4), which we locate at address 0x600 in x86 memory. */ MEM_WB(pInt, 0x0600, 0xf4); /* * Allocate a segment for the stack */ xf86Int10AllocPages(pInt, 1, &pInt->stackseg); } void * xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex) { EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); OptionInfoPtr options = NULL; if (pEnt->device) { void *configOptions = NULL; /* Check if xf86CollectOptions() has already been called */ if (((pEnt->index < 0) || !pScrn || !(configOptions = pScrn->options)) && pEnt->device) configOptions = pEnt->device->options; if (configOptions) { if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options)))) return NULL; (void) memcpy(options, INT10Options, sizeof(INT10Options)); xf86ProcessOptions(pScrn->scrnIndex, configOptions, options); } } free(pEnt); return options; } Bool int10skip(const void *options) { Bool noint10 = FALSE; if (!options) return FALSE; xf86GetOptValBool(options, OPT_NOINT10, &noint10); return noint10; } Bool int10_check_bios(int scrnIndex, int codeSeg, const unsigned char *vbiosMem) { int size; if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */ ((codeSeg << 4) < V_BIOS) || ((codeSeg << 4) >= SYS_SIZE)) return FALSE; if ((*vbiosMem != 0x55) || (*(vbiosMem + 1) != 0xAA) || !*(vbiosMem + 2)) return FALSE; size = *(vbiosMem + 2) * 512; if ((size + (codeSeg << 4)) > SYS_SIZE) return FALSE; if (bios_checksum(vbiosMem, size)) xf86DrvMsg(scrnIndex, X_INFO, "Bad V_BIOS checksum\n"); return TRUE; } Bool initPrimary(const void *options) { Bool initPrimary = FALSE; if (!options) return FALSE; xf86GetOptValBool(options, OPT_INIT_PRIMARY, &initPrimary); return initPrimary; } BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt) { BusType location_type; EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); location_type = pEnt->location.type; free(pEnt); return location_type; } #define CHECK_V_SEGMENT_RANGE(x) \ if (((x) << 4) < V_BIOS) { \ xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, \ "V_BIOS address 0x%lx out of range\n", \ (unsigned long)(x) << 4); \ return FALSE; \ } Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base) { unsigned i; int cs = ~0; int segments[4]; segments[0] = MEM_RW(pInt, (0x10 << 2) + 2); segments[1] = MEM_RW(pInt, (0x42 << 2) + 2); segments[2] = V_BIOS >> 4; segments[3] = ~0; for (i = 0; segments[i] != ~0; i++) { unsigned char *vbiosMem; cs = segments[i]; CHECK_V_SEGMENT_RANGE(cs); vbiosMem = (unsigned char *) base + (cs << 4); if (int10_check_bios(pInt->pScrn->scrnIndex, cs, vbiosMem)) { break; } } if (segments[i] == ~0) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "No V_BIOS found\n"); return FALSE; } xf86DrvMsg(pInt->pScrn->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", (unsigned long) cs); pInt->BIOSseg = cs; return TRUE; } xorg-server-1.20.8/hw/xfree86/x86emu/0000755000175000017500000000000013640201534014125 500000000000000xorg-server-1.20.8/hw/xfree86/x86emu/fpu.c0000644000175000017500000006476113640201473015023 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file contains the code to implement the decoding and * emulation of the FPU instructions. * ****************************************************************************/ #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ /* opcode=0xd8 */ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("ESC D8\n"); DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_d9_tab[] = { "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ", "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t", "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ", "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t", "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ", "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t", }; static const char *x86emu_fpu_op_d9_tab1[] = { "FLD\t", "FLD\t", "FLD\t", "FLD\t", "FLD\t", "FLD\t", "FLD\t", "FLD\t", "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t", "FNOP", "ESC_D9", "ESC_D9", "ESC_D9", "ESC_D9", "ESC_D9", "ESC_D9", "ESC_D9", "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t", "FCHS", "FABS", "ESC_D9", "ESC_D9", "FTST", "FXAM", "ESC_D9", "ESC_D9", "FLD1", "FLDL2T", "FLDL2E", "FLDPI", "FLDLG2", "FLDLN2", "FLDZ", "ESC_D9", "F2XM1", "FYL2X", "FPTAN", "FPATAN", "FXTRACT", "ESC_D9", "FDECSTP", "FINCSTP", "FPREM", "FYL2XP1", "FSQRT", "ESC_D9", "FRNDINT", "FSCALE", "ESC_D9", "ESC_D9", }; #endif /* DEBUG */ /* opcode=0xd9 */ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; u8 stkelem = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (mod != 3) { DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl); } else { DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]); } #endif switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); break; case 3: /* register to register */ stkelem = (u8) rl; if (rh < 4) { DECODE_PRINTF2("ST(%d)\n", stkelem); } else { DECODE_PRINTF("\n"); } break; } #ifdef X86EMU_FPU_PRESENT /* execute */ switch (mod) { case 3: switch (rh) { case 0: x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem); break; case 1: x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem); break; case 2: switch (rl) { case 0: x86emu_fpu_R_nop(); break; default: x86emu_fpu_illegal(); break; } case 3: x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem); break; case 4: switch (rl) { case 0: x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP); break; case 1: x86emu_fpu_R_fabs(X86EMU_FPU_STKTOP); break; case 4: x86emu_fpu_R_ftst(X86EMU_FPU_STKTOP); break; case 5: x86emu_fpu_R_fxam(X86EMU_FPU_STKTOP); break; default: /* 2,3,6,7 */ x86emu_fpu_illegal(); break; } break; case 5: switch (rl) { case 0: x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP); break; case 1: x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP); break; case 2: x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP); break; case 3: x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP); break; case 4: x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP); break; case 5: x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP); break; case 6: x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP); break; default: /* 7 */ x86emu_fpu_illegal(); break; } break; case 6: switch (rl) { case 0: x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP); break; case 1: x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP); break; case 2: x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP); break; case 3: x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP); break; case 4: x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP); break; case 5: x86emu_fpu_illegal(); break; case 6: x86emu_fpu_R_decstp(); break; case 7: x86emu_fpu_R_incstp(); break; } break; case 7: switch (rl) { case 0: x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP); break; case 1: x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP); break; case 2: x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP); break; case 3: x86emu_fpu_illegal(); break; case 4: x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP); break; case 5: x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP); break; case 6: case 7: default: x86emu_fpu_illegal(); break; } break; default: switch (rh) { case 0: x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset); break; case 1: x86emu_fpu_illegal(); break; case 2: x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset); break; case 3: x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset); break; case 4: x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset); break; case 5: x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset); break; case 6: x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset); break; case 7: x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset); break; } } } #else (void) destoffset; (void) stkelem; #endif /* X86EMU_FPU_PRESENT */ DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_da_tab[] = { "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ", "FICOMP\tDWORD PTR ", "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ", "FIDIVR\tDWORD PTR ", "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ", "FICOMP\tDWORD PTR ", "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ", "FIDIVR\tDWORD PTR ", "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ", "FICOMP\tDWORD PTR ", "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ", "FIDIVR\tDWORD PTR ", "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ", }; #endif /* DEBUG */ /* opcode=0xda */ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; u8 stkelem = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); break; case 3: /* register to register */ stkelem = (u8) rl; DECODE_PRINTF2("\tST(%d),ST\n", stkelem); break; } #ifdef X86EMU_FPU_PRESENT switch (mod) { case 3: x86emu_fpu_illegal(); break; default: switch (rh) { case 0: x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset); break; case 1: x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset); break; case 2: x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset); break; case 3: x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset); break; case 4: x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset); break; case 5: x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset); break; case 6: x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset); break; case 7: x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset); break; } } #else (void) destoffset; (void) stkelem; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_db_tab[] = { "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ", "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ", "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ", "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ", "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ", "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ", }; #endif /* DEBUG */ /* opcode=0xdb */ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (mod != 3) { DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl); } else if (rh == 4) { /* === 11 10 0 nnn */ switch (rl) { case 0: DECODE_PRINTF("FENI\n"); break; case 1: DECODE_PRINTF("FDISI\n"); break; case 2: DECODE_PRINTF("FCLEX\n"); break; case 3: DECODE_PRINTF("FINIT\n"); break; } } else { DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl)); } #endif /* DEBUG */ switch (mod) { case 0: destoffset = decode_rm00_address(rl); break; case 1: destoffset = decode_rm01_address(rl); break; case 2: destoffset = decode_rm10_address(rl); break; case 3: /* register to register */ break; } #ifdef X86EMU_FPU_PRESENT /* execute */ switch (mod) { case 3: switch (rh) { case 4: switch (rl) { case 0: x86emu_fpu_R_feni(); break; case 1: x86emu_fpu_R_fdisi(); break; case 2: x86emu_fpu_R_fclex(); break; case 3: x86emu_fpu_R_finit(); break; default: x86emu_fpu_illegal(); break; } break; default: x86emu_fpu_illegal(); break; } break; default: switch (rh) { case 0: x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset); break; case 1: x86emu_fpu_illegal(); break; case 2: x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset); break; case 3: x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset); break; case 4: x86emu_fpu_illegal(); break; case 5: x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset); break; case 6: x86emu_fpu_illegal(); break; case 7: x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset); break; } } #else (void) destoffset; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_dc_tab[] = { "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ", "FCOMP\tQWORD PTR ", "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ", "FDIVR\tQWORD PTR ", "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ", "FCOMP\tQWORD PTR ", "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ", "FDIVR\tQWORD PTR ", "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ", "FCOMP\tQWORD PTR ", "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ", "FDIVR\tQWORD PTR ", "FADD\t", "FMUL\t", "FCOM\t", "FCOMP\t", "FSUBR\t", "FSUB\t", "FDIVR\t", "FDIV\t", }; #endif /* DEBUG */ /* opcode=0xdc */ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; u8 stkelem = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); break; case 3: /* register to register */ stkelem = (u8) rl; DECODE_PRINTF2("\tST(%d),ST\n", stkelem); break; } #ifdef X86EMU_FPU_PRESENT /* execute */ switch (mod) { case 3: switch (rh) { case 0: x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP); break; case 1: x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP); break; case 2: x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP); break; case 3: x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP); break; case 4: x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP); break; case 5: x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP); break; case 6: x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP); break; case 7: x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP); break; } break; default: switch (rh) { case 0: x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset); break; case 1: x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset); break; case 2: x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset); break; case 3: x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset); break; case 4: x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset); break; case 5: x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset); break; case 6: x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset); break; case 7: x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset); break; } } #else (void) destoffset; (void) stkelem; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_dd_tab[] = { "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ", "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t", "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ", "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t", "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ", "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t", "FFREE\t", "FXCH\t", "FST\t", "FSTP\t", "ESC_DD\t2C,", "ESC_DD\t2D,", "ESC_DD\t2E,", "ESC_DD\t2F,", }; #endif /* DEBUG */ /* opcode=0xdd */ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; u8 stkelem = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); break; case 3: /* register to register */ stkelem = (u8) rl; DECODE_PRINTF2("\tST(%d),ST\n", stkelem); break; } #ifdef X86EMU_FPU_PRESENT switch (mod) { case 3: switch (rh) { case 0: x86emu_fpu_R_ffree(stkelem); break; case 1: x86emu_fpu_R_fxch(stkelem); break; case 2: x86emu_fpu_R_fst(stkelem); /* register version */ break; case 3: x86emu_fpu_R_fstp(stkelem); /* register version */ break; default: x86emu_fpu_illegal(); break; } break; default: switch (rh) { case 0: x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset); break; case 1: x86emu_fpu_illegal(); break; case 2: x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset); break; case 3: x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset); break; case 4: x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset); break; case 5: x86emu_fpu_illegal(); break; case 6: x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset); break; case 7: x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset); break; } } #else (void) destoffset; (void) stkelem; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_de_tab[] = { "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ", "FICOMP\tWORD PTR ", "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ", "FIDIVR\tWORD PTR ", "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ", "FICOMP\tWORD PTR ", "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ", "FIDIVR\tWORD PTR ", "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ", "FICOMP\tWORD PTR ", "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ", "FIDIVR\tWORD PTR ", "FADDP\t", "FMULP\t", "FCOMP\t", "FCOMPP\t", "FSUBRP\t", "FSUBP\t", "FDIVRP\t", "FDIVP\t", }; #endif /* DEBUG */ /* opcode=0xde */ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; u8 stkelem = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); break; case 3: /* register to register */ stkelem = (u8) rl; DECODE_PRINTF2("\tST(%d),ST\n", stkelem); break; } #ifdef X86EMU_FPU_PRESENT switch (mod) { case 3: switch (rh) { case 0: x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP); break; case 1: x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP); break; case 2: x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP); break; case 3: if (stkelem == 1) x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP); else x86emu_fpu_illegal(); break; case 4: x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP); break; case 5: x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP); break; case 6: x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP); break; case 7: x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP); break; } break; default: switch (rh) { case 0: x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset); break; case 1: x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset); break; case 2: x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset); break; case 3: x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset); break; case 4: x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset); break; case 5: x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset); break; case 6: x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset); break; case 7: x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset); break; } } #else (void) destoffset; (void) stkelem; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } #ifdef DEBUG static const char *x86emu_fpu_op_df_tab[] = { /* mod == 00 */ "FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ", "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ", "FISTP\tQWORD PTR ", /* mod == 01 */ "FILD\tWORD PTR ", "ESC_DF\t39 ", "FIST\tWORD PTR ", "FISTP\tWORD PTR ", "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ", "FISTP\tQWORD PTR ", /* mod == 10 */ "FILD\tWORD PTR ", "ESC_DF\t39 ", "FIST\tWORD PTR ", "FISTP\tWORD PTR ", "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ", "FISTP\tQWORD PTR ", /* mod == 11 */ "FFREE\t", "FXCH\t", "FST\t", "FSTP\t", "ESC_DF\t3C,", "ESC_DF\t3D,", "ESC_DF\t3E,", "ESC_DF\t3F," }; #endif /* DEBUG */ /* opcode=0xdf */ void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset = 0; u8 stkelem = 0; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); break; case 3: /* register to register */ stkelem = (u8) rl; DECODE_PRINTF2("\tST(%d)\n", stkelem); break; } #ifdef X86EMU_FPU_PRESENT switch (mod) { case 3: switch (rh) { case 0: x86emu_fpu_R_ffree(stkelem); break; case 1: x86emu_fpu_R_fxch(stkelem); break; case 2: x86emu_fpu_R_fst(stkelem); /* register version */ break; case 3: x86emu_fpu_R_fstp(stkelem); /* register version */ break; default: x86emu_fpu_illegal(); break; } break; default: switch (rh) { case 0: x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset); break; case 1: x86emu_fpu_illegal(); break; case 2: x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset); break; case 3: x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset); break; case 4: x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset); break; case 5: x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset); break; case 6: x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset); break; case 7: x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset); break; } } #else (void) destoffset; (void) stkelem; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR_NO_TRACE(); } xorg-server-1.20.8/hw/xfree86/x86emu/Makefile.am0000644000175000017500000000133213640201473016102 00000000000000if INT10_X86EMU noinst_LTLIBRARIES = libx86emu.la endif libx86emu_la_SOURCES = debug.c \ decode.c \ fpu.c \ ops2.c \ ops.c \ prim_ops.c \ sys.c \ x86emu.h AM_CPPFLAGS = AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = validate.c \ x86emu/debug.h \ x86emu/decode.h \ x86emu/fpu.h \ x86emu/fpu_regs.h \ x86emu/ops.h \ x86emu/prim_asm.h \ x86emu/prim_ops.h \ x86emu/prim_x86_gcc.h \ x86emu/regs.h \ x86emu/types.h \ x86emu/x86emui.h xorg-server-1.20.8/hw/xfree86/x86emu/decode.c0000644000175000017500000007747313640201473015460 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file includes subroutines which are related to * instruction decoding and accessess of immediate data via IP. etc. * ****************************************************************************/ #include #if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */ # undef CS # undef DS # undef SS # undef ES # undef FS # undef GS #endif #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ /**************************************************************************** REMARKS: Handles any pending asychronous interrupts. ****************************************************************************/ static void x86emu_intr_handle(void) { u8 intno; if (M.x86.intr & INTR_SYNCH) { intno = M.x86.intno; if (_X86EMU_intrTab[intno]) { (*_X86EMU_intrTab[intno]) (intno); } else { push_word((u16) M.x86.R_FLG); CLEAR_FLAG(F_IF); CLEAR_FLAG(F_TF); push_word(M.x86.R_CS); M.x86.R_CS = mem_access_word(intno * 4 + 2); push_word(M.x86.R_IP); M.x86.R_IP = mem_access_word(intno * 4); M.x86.intr = 0; } } } /**************************************************************************** PARAMETERS: intrnum - Interrupt number to raise REMARKS: Raise the specified interrupt to be handled before the execution of the next instruction. ****************************************************************************/ void x86emu_intr_raise(u8 intrnum) { M.x86.intno = intrnum; M.x86.intr |= INTR_SYNCH; } /**************************************************************************** REMARKS: Main execution loop for the emulator. We return from here when the system halts, which is normally caused by a stack fault when we return from the original real mode call. ****************************************************************************/ void X86EMU_exec(void) { u8 op1; M.x86.intr = 0; DB(x86emu_end_instr(); ) for (;;) { DB(if (CHECK_IP_FETCH()) x86emu_check_ip_access();) /* If debugging, save the IP and CS values. */ SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP); INC_DECODED_INST_LEN(1); if (M.x86.intr) { if (M.x86.intr & INTR_HALTED) { DB(if (M.x86.R_SP != 0) { printk("halted\n"); X86EMU_trace_regs();} else { if (M.x86.debug) printk("Service completed successfully\n");} ) return; } if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) || !ACCESS_FLAG(F_IF)) { x86emu_intr_handle(); } } op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++)); (*x86emu_optab[op1]) (op1); if (M.x86.debug & DEBUG_EXIT) { M.x86.debug &= ~DEBUG_EXIT; return; } } } /**************************************************************************** REMARKS: Halts the system by setting the halted system flag. ****************************************************************************/ void X86EMU_halt_sys(void) { M.x86.intr |= INTR_HALTED; } /**************************************************************************** PARAMETERS: mod - Mod value from decoded byte regh - Reg h value from decoded byte regl - Reg l value from decoded byte REMARKS: Raise the specified interrupt to be handled before the execution of the next instruction. NOTE: Do not inline this function, as (*sys_rdb) is already inline! ****************************************************************************/ void fetch_decode_modrm(int *mod, int *regh, int *regl) { int fetched; DB(if (CHECK_IP_FETCH()) x86emu_check_ip_access();) fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++)); INC_DECODED_INST_LEN(1); *mod = (fetched >> 6) & 0x03; *regh = (fetched >> 3) & 0x07; *regl = (fetched >> 0) & 0x07; } /**************************************************************************** RETURNS: Immediate byte value read from instruction queue REMARKS: This function returns the immediate byte from the instruction queue, and moves the instruction pointer to the next value. NOTE: Do not inline this function, as (*sys_rdb) is already inline! ****************************************************************************/ u8 fetch_byte_imm(void) { u8 fetched; DB(if (CHECK_IP_FETCH()) x86emu_check_ip_access();) fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++)); INC_DECODED_INST_LEN(1); return fetched; } /**************************************************************************** RETURNS: Immediate word value read from instruction queue REMARKS: This function returns the immediate byte from the instruction queue, and moves the instruction pointer to the next value. NOTE: Do not inline this function, as (*sys_rdw) is already inline! ****************************************************************************/ u16 fetch_word_imm(void) { u16 fetched; DB(if (CHECK_IP_FETCH()) x86emu_check_ip_access();) fetched = (*sys_rdw) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP)); M.x86.R_IP += 2; INC_DECODED_INST_LEN(2); return fetched; } /**************************************************************************** RETURNS: Immediate lone value read from instruction queue REMARKS: This function returns the immediate byte from the instruction queue, and moves the instruction pointer to the next value. NOTE: Do not inline this function, as (*sys_rdw) is already inline! ****************************************************************************/ u32 fetch_long_imm(void) { u32 fetched; DB(if (CHECK_IP_FETCH()) x86emu_check_ip_access();) fetched = (*sys_rdl) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP)); M.x86.R_IP += 4; INC_DECODED_INST_LEN(4); return fetched; } /**************************************************************************** RETURNS: Value of the default data segment REMARKS: Inline function that returns the default data segment for the current instruction. On the x86 processor, the default segment is not always DS if there is no segment override. Address modes such as -3[BP] or 10[BP+SI] all refer to addresses relative to SS (ie: on the stack). So, at the minimum, all decodings of addressing modes would have to set/clear a bit describing whether the access is relative to DS or SS. That is the function of the cpu-state-varible M.x86.mode. There are several potential states: repe prefix seen (handled elsewhere) repne prefix seen (ditto) cs segment override ds segment override es segment override fs segment override gs segment override ss segment override ds/ss select (in absense of override) Each of the above 7 items are handled with a bit in the mode field. ****************************************************************************/ _INLINE u32 get_data_segment(void) { #define GET_SEGMENT(segment) switch (M.x86.mode & SYSMODE_SEGMASK) { case 0: /* default case: use ds register */ case SYSMODE_SEGOVR_DS: case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS: return M.x86.R_DS; case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */ return M.x86.R_SS; case SYSMODE_SEGOVR_CS: case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS: return M.x86.R_CS; case SYSMODE_SEGOVR_ES: case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS: return M.x86.R_ES; case SYSMODE_SEGOVR_FS: case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS: return M.x86.R_FS; case SYSMODE_SEGOVR_GS: case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS: return M.x86.R_GS; case SYSMODE_SEGOVR_SS: case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS: return M.x86.R_SS; default: #ifdef DEBUG printk("error: should not happen: multiple overrides.\n"); #endif HALT_SYS(); return 0; } } /**************************************************************************** PARAMETERS: offset - Offset to load data from RETURNS: Byte value read from the absolute memory location. NOTE: Do not inline this function as (*sys_rdX) is already inline! ****************************************************************************/ u8 fetch_data_byte(uint offset) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16) get_data_segment(), offset); #endif return (*sys_rdb) ((get_data_segment() << 4) + offset); } /**************************************************************************** PARAMETERS: offset - Offset to load data from RETURNS: Word value read from the absolute memory location. NOTE: Do not inline this function as (*sys_rdX) is already inline! ****************************************************************************/ u16 fetch_data_word(uint offset) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16) get_data_segment(), offset); #endif return (*sys_rdw) ((get_data_segment() << 4) + offset); } /**************************************************************************** PARAMETERS: offset - Offset to load data from RETURNS: Long value read from the absolute memory location. NOTE: Do not inline this function as (*sys_rdX) is already inline! ****************************************************************************/ u32 fetch_data_long(uint offset) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16) get_data_segment(), offset); #endif return (*sys_rdl) ((get_data_segment() << 4) + offset); } /**************************************************************************** PARAMETERS: segment - Segment to load data from offset - Offset to load data from RETURNS: Byte value read from the absolute memory location. NOTE: Do not inline this function as (*sys_rdX) is already inline! ****************************************************************************/ u8 fetch_data_byte_abs(uint segment, uint offset) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset); #endif return (*sys_rdb) (((u32) segment << 4) + offset); } /**************************************************************************** PARAMETERS: segment - Segment to load data from offset - Offset to load data from RETURNS: Word value read from the absolute memory location. NOTE: Do not inline this function as (*sys_rdX) is already inline! ****************************************************************************/ u16 fetch_data_word_abs(uint segment, uint offset) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset); #endif return (*sys_rdw) (((u32) segment << 4) + offset); } /**************************************************************************** PARAMETERS: segment - Segment to load data from offset - Offset to load data from RETURNS: Long value read from the absolute memory location. NOTE: Do not inline this function as (*sys_rdX) is already inline! ****************************************************************************/ u32 fetch_data_long_abs(uint segment, uint offset) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset); #endif return (*sys_rdl) (((u32) segment << 4) + offset); } /**************************************************************************** PARAMETERS: offset - Offset to store data at val - Value to store REMARKS: Writes a word value to an segmented memory location. The segment used is the current 'default' segment, which may have been overridden. NOTE: Do not inline this function as (*sys_wrX) is already inline! ****************************************************************************/ void store_data_byte(uint offset, u8 val) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16) get_data_segment(), offset); #endif (*sys_wrb) ((get_data_segment() << 4) + offset, val); } /**************************************************************************** PARAMETERS: offset - Offset to store data at val - Value to store REMARKS: Writes a word value to an segmented memory location. The segment used is the current 'default' segment, which may have been overridden. NOTE: Do not inline this function as (*sys_wrX) is already inline! ****************************************************************************/ void store_data_word(uint offset, u16 val) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16) get_data_segment(), offset); #endif (*sys_wrw) ((get_data_segment() << 4) + offset, val); } /**************************************************************************** PARAMETERS: offset - Offset to store data at val - Value to store REMARKS: Writes a long value to an segmented memory location. The segment used is the current 'default' segment, which may have been overridden. NOTE: Do not inline this function as (*sys_wrX) is already inline! ****************************************************************************/ void store_data_long(uint offset, u32 val) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16) get_data_segment(), offset); #endif (*sys_wrl) ((get_data_segment() << 4) + offset, val); } /**************************************************************************** PARAMETERS: segment - Segment to store data at offset - Offset to store data at val - Value to store REMARKS: Writes a byte value to an absolute memory location. NOTE: Do not inline this function as (*sys_wrX) is already inline! ****************************************************************************/ void store_data_byte_abs(uint segment, uint offset, u8 val) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset); #endif (*sys_wrb) (((u32) segment << 4) + offset, val); } /**************************************************************************** PARAMETERS: segment - Segment to store data at offset - Offset to store data at val - Value to store REMARKS: Writes a word value to an absolute memory location. NOTE: Do not inline this function as (*sys_wrX) is already inline! ****************************************************************************/ void store_data_word_abs(uint segment, uint offset, u16 val) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset); #endif (*sys_wrw) (((u32) segment << 4) + offset, val); } /**************************************************************************** PARAMETERS: segment - Segment to store data at offset - Offset to store data at val - Value to store REMARKS: Writes a long value to an absolute memory location. NOTE: Do not inline this function as (*sys_wrX) is already inline! ****************************************************************************/ void store_data_long_abs(uint segment, uint offset, u32 val) { #ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset); #endif (*sys_wrl) (((u32) segment << 4) + offset, val); } /**************************************************************************** PARAMETERS: reg - Register to decode RETURNS: Pointer to the appropriate register REMARKS: Return a pointer to the register given by the R/RM field of the modrm byte, for byte operands. Also enables the decoding of instructions. ****************************************************************************/ u8 * decode_rm_byte_register(int reg) { switch (reg) { case 0: DECODE_PRINTF("AL"); return &M.x86.R_AL; case 1: DECODE_PRINTF("CL"); return &M.x86.R_CL; case 2: DECODE_PRINTF("DL"); return &M.x86.R_DL; case 3: DECODE_PRINTF("BL"); return &M.x86.R_BL; case 4: DECODE_PRINTF("AH"); return &M.x86.R_AH; case 5: DECODE_PRINTF("CH"); return &M.x86.R_CH; case 6: DECODE_PRINTF("DH"); return &M.x86.R_DH; case 7: DECODE_PRINTF("BH"); return &M.x86.R_BH; } HALT_SYS(); return NULL; /* NOT REACHED OR REACHED ON ERROR */ } /**************************************************************************** PARAMETERS: reg - Register to decode RETURNS: Pointer to the appropriate register REMARKS: Return a pointer to the register given by the R/RM field of the modrm byte, for word operands. Also enables the decoding of instructions. ****************************************************************************/ u16 * decode_rm_word_register(int reg) { switch (reg) { case 0: DECODE_PRINTF("AX"); return &M.x86.R_AX; case 1: DECODE_PRINTF("CX"); return &M.x86.R_CX; case 2: DECODE_PRINTF("DX"); return &M.x86.R_DX; case 3: DECODE_PRINTF("BX"); return &M.x86.R_BX; case 4: DECODE_PRINTF("SP"); return &M.x86.R_SP; case 5: DECODE_PRINTF("BP"); return &M.x86.R_BP; case 6: DECODE_PRINTF("SI"); return &M.x86.R_SI; case 7: DECODE_PRINTF("DI"); return &M.x86.R_DI; } HALT_SYS(); return NULL; /* NOTREACHED OR REACHED ON ERROR */ } /**************************************************************************** PARAMETERS: reg - Register to decode RETURNS: Pointer to the appropriate register REMARKS: Return a pointer to the register given by the R/RM field of the modrm byte, for dword operands. Also enables the decoding of instructions. ****************************************************************************/ u32 * decode_rm_long_register(int reg) { switch (reg) { case 0: DECODE_PRINTF("EAX"); return &M.x86.R_EAX; case 1: DECODE_PRINTF("ECX"); return &M.x86.R_ECX; case 2: DECODE_PRINTF("EDX"); return &M.x86.R_EDX; case 3: DECODE_PRINTF("EBX"); return &M.x86.R_EBX; case 4: DECODE_PRINTF("ESP"); return &M.x86.R_ESP; case 5: DECODE_PRINTF("EBP"); return &M.x86.R_EBP; case 6: DECODE_PRINTF("ESI"); return &M.x86.R_ESI; case 7: DECODE_PRINTF("EDI"); return &M.x86.R_EDI; } HALT_SYS(); return NULL; /* NOTREACHED OR REACHED ON ERROR */ } /**************************************************************************** PARAMETERS: reg - Register to decode RETURNS: Pointer to the appropriate register REMARKS: Return a pointer to the register given by the R/RM field of the modrm byte, for word operands, modified from above for the weirdo special case of segreg operands. Also enables the decoding of instructions. ****************************************************************************/ u16 * decode_rm_seg_register(int reg) { switch (reg) { case 0: DECODE_PRINTF("ES"); return &M.x86.R_ES; case 1: DECODE_PRINTF("CS"); return &M.x86.R_CS; case 2: DECODE_PRINTF("SS"); return &M.x86.R_SS; case 3: DECODE_PRINTF("DS"); return &M.x86.R_DS; case 4: DECODE_PRINTF("FS"); return &M.x86.R_FS; case 5: DECODE_PRINTF("GS"); return &M.x86.R_GS; case 6: case 7: DECODE_PRINTF("ILLEGAL SEGREG"); break; } HALT_SYS(); return NULL; /* NOT REACHED OR REACHED ON ERROR */ } /* * * return offset from the SIB Byte */ u32 decode_sib_address(int sib, int mod) { u32 base = 0, i = 0, scale = 1; switch (sib & 0x07) { case 0: DECODE_PRINTF("[EAX]"); base = M.x86.R_EAX; break; case 1: DECODE_PRINTF("[ECX]"); base = M.x86.R_ECX; break; case 2: DECODE_PRINTF("[EDX]"); base = M.x86.R_EDX; break; case 3: DECODE_PRINTF("[EBX]"); base = M.x86.R_EBX; break; case 4: DECODE_PRINTF("[ESP]"); base = M.x86.R_ESP; M.x86.mode |= SYSMODE_SEG_DS_SS; break; case 5: if (mod == 0) { base = fetch_long_imm(); DECODE_PRINTF2("%08x", base); } else { DECODE_PRINTF("[EBP]"); base = M.x86.R_ESP; M.x86.mode |= SYSMODE_SEG_DS_SS; } break; case 6: DECODE_PRINTF("[ESI]"); base = M.x86.R_ESI; break; case 7: DECODE_PRINTF("[EDI]"); base = M.x86.R_EDI; break; } switch ((sib >> 3) & 0x07) { case 0: DECODE_PRINTF("[EAX"); i = M.x86.R_EAX; break; case 1: DECODE_PRINTF("[ECX"); i = M.x86.R_ECX; break; case 2: DECODE_PRINTF("[EDX"); i = M.x86.R_EDX; break; case 3: DECODE_PRINTF("[EBX"); i = M.x86.R_EBX; break; case 4: i = 0; break; case 5: DECODE_PRINTF("[EBP"); i = M.x86.R_EBP; break; case 6: DECODE_PRINTF("[ESI"); i = M.x86.R_ESI; break; case 7: DECODE_PRINTF("[EDI"); i = M.x86.R_EDI; break; } scale = 1 << ((sib >> 6) & 0x03); if (((sib >> 3) & 0x07) != 4) { if (scale == 1) { DECODE_PRINTF("]"); } else { DECODE_PRINTF2("*%d]", scale); } } return base + (i * scale); } /**************************************************************************** PARAMETERS: rm - RM value to decode RETURNS: Offset in memory for the address decoding REMARKS: Return the offset given by mod=00 addressing. Also enables the decoding of instructions. NOTE: The code which specifies the corresponding segment (ds vs ss) below in the case of [BP+..]. The assumption here is that at the point that this subroutine is called, the bit corresponding to SYSMODE_SEG_DS_SS will be zero. After every instruction except the segment override instructions, this bit (as well as any bits indicating segment overrides) will be clear. So if a SS access is needed, set this bit. Otherwise, DS access occurs (unless any of the segment override bits are set). ****************************************************************************/ u32 decode_rm00_address(int rm) { u32 offset; int sib; if (M.x86.mode & SYSMODE_PREFIX_ADDR) { /* 32-bit addressing */ switch (rm) { case 0: DECODE_PRINTF("[EAX]"); return M.x86.R_EAX; case 1: DECODE_PRINTF("[ECX]"); return M.x86.R_ECX; case 2: DECODE_PRINTF("[EDX]"); return M.x86.R_EDX; case 3: DECODE_PRINTF("[EBX]"); return M.x86.R_EBX; case 4: sib = fetch_byte_imm(); return decode_sib_address(sib, 0); case 5: offset = fetch_long_imm(); DECODE_PRINTF2("[%08x]", offset); return offset; case 6: DECODE_PRINTF("[ESI]"); return M.x86.R_ESI; case 7: DECODE_PRINTF("[EDI]"); return M.x86.R_EDI; } HALT_SYS(); } else { /* 16-bit addressing */ switch (rm) { case 0: DECODE_PRINTF("[BX+SI]"); return (M.x86.R_BX + M.x86.R_SI) & 0xffff; case 1: DECODE_PRINTF("[BX+DI]"); return (M.x86.R_BX + M.x86.R_DI) & 0xffff; case 2: DECODE_PRINTF("[BP+SI]"); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + M.x86.R_SI) & 0xffff; case 3: DECODE_PRINTF("[BP+DI]"); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + M.x86.R_DI) & 0xffff; case 4: DECODE_PRINTF("[SI]"); return M.x86.R_SI; case 5: DECODE_PRINTF("[DI]"); return M.x86.R_DI; case 6: offset = fetch_word_imm(); DECODE_PRINTF2("[%04x]", offset); return offset; case 7: DECODE_PRINTF("[BX]"); return M.x86.R_BX; } HALT_SYS(); } return 0; } /**************************************************************************** PARAMETERS: rm - RM value to decode RETURNS: Offset in memory for the address decoding REMARKS: Return the offset given by mod=01 addressing. Also enables the decoding of instructions. ****************************************************************************/ u32 decode_rm01_address(int rm) { int displacement = 0; int sib; /* Fetch disp8 if no SIB byte */ if (!((M.x86.mode & SYSMODE_PREFIX_ADDR) && (rm == 4))) displacement = (s8) fetch_byte_imm(); if (M.x86.mode & SYSMODE_PREFIX_ADDR) { /* 32-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%d[EAX]", displacement); return M.x86.R_EAX + displacement; case 1: DECODE_PRINTF2("%d[ECX]", displacement); return M.x86.R_ECX + displacement; case 2: DECODE_PRINTF2("%d[EDX]", displacement); return M.x86.R_EDX + displacement; case 3: DECODE_PRINTF2("%d[EBX]", displacement); return M.x86.R_EBX + displacement; case 4: sib = fetch_byte_imm(); displacement = (s8) fetch_byte_imm(); DECODE_PRINTF2("%d", displacement); return decode_sib_address(sib, 1) + displacement; case 5: DECODE_PRINTF2("%d[EBP]", displacement); return M.x86.R_EBP + displacement; case 6: DECODE_PRINTF2("%d[ESI]", displacement); return M.x86.R_ESI + displacement; case 7: DECODE_PRINTF2("%d[EDI]", displacement); return M.x86.R_EDI + displacement; } HALT_SYS(); } else { /* 16-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%d[BX+SI]", displacement); return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff; case 1: DECODE_PRINTF2("%d[BX+DI]", displacement); return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff; case 2: DECODE_PRINTF2("%d[BP+SI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff; case 3: DECODE_PRINTF2("%d[BP+DI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff; case 4: DECODE_PRINTF2("%d[SI]", displacement); return (M.x86.R_SI + displacement) & 0xffff; case 5: DECODE_PRINTF2("%d[DI]", displacement); return (M.x86.R_DI + displacement) & 0xffff; case 6: DECODE_PRINTF2("%d[BP]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + displacement) & 0xffff; case 7: DECODE_PRINTF2("%d[BX]", displacement); return (M.x86.R_BX + displacement) & 0xffff; } HALT_SYS(); } return 0; /* SHOULD NOT HAPPEN */ } /**************************************************************************** PARAMETERS: rm - RM value to decode RETURNS: Offset in memory for the address decoding REMARKS: Return the offset given by mod=10 addressing. Also enables the decoding of instructions. ****************************************************************************/ u32 decode_rm10_address(int rm) { u32 displacement = 0; int sib; /* Fetch disp16 if 16-bit addr mode */ if (!(M.x86.mode & SYSMODE_PREFIX_ADDR)) displacement = (u16) fetch_word_imm(); else { /* Fetch disp32 if no SIB byte */ if (rm != 4) displacement = (u32) fetch_long_imm(); } if (M.x86.mode & SYSMODE_PREFIX_ADDR) { /* 32-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%08x[EAX]", displacement); return M.x86.R_EAX + displacement; case 1: DECODE_PRINTF2("%08x[ECX]", displacement); return M.x86.R_ECX + displacement; case 2: DECODE_PRINTF2("%08x[EDX]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return M.x86.R_EDX + displacement; case 3: DECODE_PRINTF2("%08x[EBX]", displacement); return M.x86.R_EBX + displacement; case 4: sib = fetch_byte_imm(); displacement = (u32) fetch_long_imm(); DECODE_PRINTF2("%08x", displacement); return decode_sib_address(sib, 2) + displacement; break; case 5: DECODE_PRINTF2("%08x[EBP]", displacement); return M.x86.R_EBP + displacement; case 6: DECODE_PRINTF2("%08x[ESI]", displacement); return M.x86.R_ESI + displacement; case 7: DECODE_PRINTF2("%08x[EDI]", displacement); return M.x86.R_EDI + displacement; } HALT_SYS(); } else { /* 16-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%04x[BX+SI]", displacement); return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff; case 1: DECODE_PRINTF2("%04x[BX+DI]", displacement); return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff; case 2: DECODE_PRINTF2("%04x[BP+SI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff; case 3: DECODE_PRINTF2("%04x[BP+DI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff; case 4: DECODE_PRINTF2("%04x[SI]", displacement); return (M.x86.R_SI + displacement) & 0xffff; case 5: DECODE_PRINTF2("%04x[DI]", displacement); return (M.x86.R_DI + displacement) & 0xffff; case 6: DECODE_PRINTF2("%04x[BP]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; return (M.x86.R_BP + displacement) & 0xffff; case 7: DECODE_PRINTF2("%04x[BX]", displacement); return (M.x86.R_BX + displacement) & 0xffff; } HALT_SYS(); } return 0; /*NOTREACHED */ } xorg-server-1.20.8/hw/xfree86/x86emu/ops2.c0000644000175000017500000027104113640201473015103 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file includes subroutines to implement the decoding * and emulation of all the x86 extended two-byte processor * instructions. * ****************************************************************************/ #include "x86emu/x86emui.h" #undef bswap_32 #define bswap_32(x) (((x & 0xff000000) >> 24) | \ ((x & 0x00ff0000) >> 8) | \ ((x & 0x0000ff00) << 8) | \ ((x & 0x000000ff) << 24)) /*----------------------------- Implementation ----------------------------*/ /**************************************************************************** PARAMETERS: op1 - Instruction op code REMARKS: Handles illegal opcodes. ****************************************************************************/ static void x86emuOp2_illegal_op(u8 op2) { START_OF_INSTR(); DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n"); TRACE_REGS(); printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n", M.x86.R_CS, M.x86.R_IP - 2, op2); HALT_SYS(); END_OF_INSTR(); } #define xorl(a,b) ((a) && !(b)) || (!(a) && (b)) /**************************************************************************** REMARKS: Handles opcode 0x0f,0x31 ****************************************************************************/ static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2)) { #ifdef __HAS_LONG_LONG__ static u64 counter = 0; #else static u32 counter = 0; #endif counter += 0x10000; /* read timestamp counter */ /* * Note that instead of actually trying to accurately measure this, we just * increase the counter by a fixed amount every time we hit one of these * instructions. Feel free to come up with a better method. */ START_OF_INSTR(); DECODE_PRINTF("RDTSC\n"); TRACE_AND_STEP(); #ifdef __HAS_LONG_LONG__ M.x86.R_EAX = counter & 0xffffffff; M.x86.R_EDX = counter >> 32; #else M.x86.R_EAX = counter; M.x86.R_EDX = 0; #endif DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0x80-0x8F ****************************************************************************/ static void x86emuOp2_long_jump(u8 op2) { s32 target; const char *name = NULL; int cond = 0; /* conditional jump to word offset. */ START_OF_INSTR(); switch (op2) { case 0x80: name = "JO\t"; cond = ACCESS_FLAG(F_OF); break; case 0x81: name = "JNO\t"; cond = !ACCESS_FLAG(F_OF); break; case 0x82: name = "JB\t"; cond = ACCESS_FLAG(F_CF); break; case 0x83: name = "JNB\t"; cond = !ACCESS_FLAG(F_CF); break; case 0x84: name = "JZ\t"; cond = ACCESS_FLAG(F_ZF); break; case 0x85: name = "JNZ\t"; cond = !ACCESS_FLAG(F_ZF); break; case 0x86: name = "JBE\t"; cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF); break; case 0x87: name = "JNBE\t"; cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)); break; case 0x88: name = "JS\t"; cond = ACCESS_FLAG(F_SF); break; case 0x89: name = "JNS\t"; cond = !ACCESS_FLAG(F_SF); break; case 0x8a: name = "JP\t"; cond = ACCESS_FLAG(F_PF); break; case 0x8b: name = "JNP\t"; cond = !ACCESS_FLAG(F_PF); break; case 0x8c: name = "JL\t"; cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); break; case 0x8d: name = "JNL\t"; cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF))); break; case 0x8e: name = "JLE\t"; cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || ACCESS_FLAG(F_ZF)); break; case 0x8f: name = "JNLE\t"; cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || ACCESS_FLAG(F_ZF)); break; } DECODE_PRINTF(name); (void) name; target = (s16) fetch_word_imm(); target += (s16) M.x86.R_IP; DECODE_PRINTF2("%04x\n", target); TRACE_AND_STEP(); if (cond) M.x86.R_IP = (u16) target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0x90-0x9F ****************************************************************************/ static void x86emuOp2_set_byte(u8 op2) { int mod, rl, rh; uint destoffset; u8 *destreg; const char *name = NULL; int cond = 0; START_OF_INSTR(); switch (op2) { case 0x90: name = "SETO\t"; cond = ACCESS_FLAG(F_OF); break; case 0x91: name = "SETNO\t"; cond = !ACCESS_FLAG(F_OF); break; case 0x92: name = "SETB\t"; cond = ACCESS_FLAG(F_CF); break; case 0x93: name = "SETNB\t"; cond = !ACCESS_FLAG(F_CF); break; case 0x94: name = "SETZ\t"; cond = ACCESS_FLAG(F_ZF); break; case 0x95: name = "SETNZ\t"; cond = !ACCESS_FLAG(F_ZF); break; case 0x96: name = "SETBE\t"; cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF); break; case 0x97: name = "SETNBE\t"; cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)); break; case 0x98: name = "SETS\t"; cond = ACCESS_FLAG(F_SF); break; case 0x99: name = "SETNS\t"; cond = !ACCESS_FLAG(F_SF); break; case 0x9a: name = "SETP\t"; cond = ACCESS_FLAG(F_PF); break; case 0x9b: name = "SETNP\t"; cond = !ACCESS_FLAG(F_PF); break; case 0x9c: name = "SETL\t"; cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); break; case 0x9d: name = "SETNL\t"; cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); break; case 0x9e: name = "SETLE\t"; cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || ACCESS_FLAG(F_ZF)); break; case 0x9f: name = "SETNLE\t"; cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || ACCESS_FLAG(F_ZF)); break; } DECODE_PRINTF(name); (void) name; FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); TRACE_AND_STEP(); store_data_byte(destoffset, cond ? 0x01 : 0x00); break; case 1: destoffset = decode_rm01_address(rl); TRACE_AND_STEP(); store_data_byte(destoffset, cond ? 0x01 : 0x00); break; case 2: destoffset = decode_rm10_address(rl); TRACE_AND_STEP(); store_data_byte(destoffset, cond ? 0x01 : 0x00); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); TRACE_AND_STEP(); *destreg = cond ? 0x01 : 0x00; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa0 ****************************************************************************/ static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2)) { START_OF_INSTR(); DECODE_PRINTF("PUSH\tFS\n"); TRACE_AND_STEP(); push_word(M.x86.R_FS); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa1 ****************************************************************************/ static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2)) { START_OF_INSTR(); DECODE_PRINTF("POP\tFS\n"); TRACE_AND_STEP(); M.x86.R_FS = pop_word(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output Handles opcode 0x0f,0xa2 ****************************************************************************/ static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2)) { START_OF_INSTR(); DECODE_PRINTF("CPUID\n"); TRACE_AND_STEP(); cpuid(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa3 ****************************************************************************/ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; int bit, disp; START_OF_INSTR(); DECODE_PRINTF("BT\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval; u32 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF); } else { u16 srcval; u16 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval; u32 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF); } else { u16 srcval; u16 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval; u32 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF); } else { u16 srcval; u16 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg, *shiftreg; srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF); } else { u16 *srcreg, *shiftreg; srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa4 ****************************************************************************/ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint destoffset; u8 shift; START_OF_INSTR(); DECODE_PRINTF("SHLD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shld_long(destval, *shiftreg, shift); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shld_word(destval, *shiftreg, shift); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shld_long(destval, *shiftreg, shift); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shld_word(destval, *shiftreg, shift); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shld_long(destval, *shiftreg, shift); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shld_word(destval, *shiftreg, shift); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *shiftreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); *destreg = shld_long(*destreg, *shiftreg, shift); } else { u16 *destreg, *shiftreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); *destreg = shld_word(*destreg, *shiftreg, shift); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa5 ****************************************************************************/ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("SHLD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shld_long(destval, *shiftreg, M.x86.R_CL); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shld_word(destval, *shiftreg, M.x86.R_CL); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shld_long(destval, *shiftreg, M.x86.R_CL); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shld_word(destval, *shiftreg, M.x86.R_CL); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shld_long(destval, *shiftreg, M.x86.R_CL); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shld_word(destval, *shiftreg, M.x86.R_CL); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *shiftreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); *destreg = shld_long(*destreg, *shiftreg, M.x86.R_CL); } else { u16 *destreg, *shiftreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); *destreg = shld_word(*destreg, *shiftreg, M.x86.R_CL); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa8 ****************************************************************************/ static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2)) { START_OF_INSTR(); DECODE_PRINTF("PUSH\tGS\n"); TRACE_AND_STEP(); push_word(M.x86.R_GS); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xa9 ****************************************************************************/ static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2)) { START_OF_INSTR(); DECODE_PRINTF("POP\tGS\n"); TRACE_AND_STEP(); M.x86.R_GS = pop_word(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xab ****************************************************************************/ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; int bit, disp; START_OF_INSTR(); DECODE_PRINTF("BTS\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval | mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, srcval | mask); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval | mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, srcval | mask); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval | mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, srcval | mask); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg, *shiftreg; u32 mask; srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; mask = (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); *srcreg |= mask; } else { u16 *srcreg, *shiftreg; u16 mask; srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); *srcreg |= mask; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xac ****************************************************************************/ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint destoffset; u8 shift; START_OF_INSTR(); DECODE_PRINTF("SHLD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shrd_long(destval, *shiftreg, shift); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shrd_word(destval, *shiftreg, shift); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shrd_long(destval, *shiftreg, shift); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shrd_word(destval, *shiftreg, shift); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shrd_long(destval, *shiftreg, shift); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shrd_word(destval, *shiftreg, shift); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *shiftreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); *destreg = shrd_long(*destreg, *shiftreg, shift); } else { u16 *destreg, *shiftreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); shift = fetch_byte_imm(); DECODE_PRINTF2("%d\n", shift); TRACE_AND_STEP(); *destreg = shrd_word(*destreg, *shiftreg, shift); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xad ****************************************************************************/ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("SHLD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shrd_long(destval, *shiftreg, M.x86.R_CL); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shrd_word(destval, *shiftreg, M.x86.R_CL); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shrd_long(destval, *shiftreg, M.x86.R_CL); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shrd_word(destval, *shiftreg, M.x86.R_CL); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_long(destoffset); destval = shrd_long(destval, *shiftreg, M.x86.R_CL); store_data_long(destoffset, destval); } else { u16 destval; u16 *shiftreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = fetch_data_word(destoffset); destval = shrd_word(destval, *shiftreg, M.x86.R_CL); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *shiftreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); *destreg = shrd_long(*destreg, *shiftreg, M.x86.R_CL); } else { u16 *destreg, *shiftreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); *destreg = shrd_word(*destreg, *shiftreg, M.x86.R_CL); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xaf ****************************************************************************/ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("IMUL\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); TRACE_AND_STEP(); res = (s16) * destreg * (s16) srcval; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); TRACE_AND_STEP(); res = (s16) * destreg * (s16) srcval; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); TRACE_AND_STEP(); res = (s16) * destreg * (s16) srcval; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) * srcreg); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg, *srcreg; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); res = (s16) * destreg * (s16) * srcreg; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xb2 ****************************************************************************/ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2)) { int mod, rh, rl; u16 *dstreg; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("LSS\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_SS = fetch_data_word(srcoffset + 2); break; case 1: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_SS = fetch_data_word(srcoffset + 2); break; case 2: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_SS = fetch_data_word(srcoffset + 2); break; case 3: /* register to register */ /* UNDEFINED! */ TRACE_AND_STEP(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xb3 ****************************************************************************/ static void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; int bit, disp; START_OF_INSTR(); DECODE_PRINTF("BTR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval & ~mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, (u16) (srcval & ~mask)); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval & ~mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, (u16) (srcval & ~mask)); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval & ~mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, (u16) (srcval & ~mask)); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg, *shiftreg; u32 mask; srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; mask = (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); *srcreg &= ~mask; } else { u16 *srcreg, *shiftreg; u16 mask; srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); *srcreg &= ~mask; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xb4 ****************************************************************************/ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2)) { int mod, rh, rl; u16 *dstreg; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("LFS\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_FS = fetch_data_word(srcoffset + 2); break; case 1: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_FS = fetch_data_word(srcoffset + 2); break; case 2: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_FS = fetch_data_word(srcoffset + 2); break; case 3: /* register to register */ /* UNDEFINED! */ TRACE_AND_STEP(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xb5 ****************************************************************************/ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2)) { int mod, rh, rl; u16 *dstreg; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("LGS\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_GS = fetch_data_word(srcoffset + 2); break; case 1: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_GS = fetch_data_word(srcoffset + 2); break; case 2: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_GS = fetch_data_word(srcoffset + 2); break; case 3: /* register to register */ /* UNDEFINED! */ TRACE_AND_STEP(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xb6 ****************************************************************************/ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("MOVZX\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u8 *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; } else { u16 *destreg; u8 *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xb7 ****************************************************************************/ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; u32 *destreg; u32 srcval; u16 *srcreg; START_OF_INSTR(); DECODE_PRINTF("MOVZX\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 1: destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 2: destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 3: /* register to register */ destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xba ****************************************************************************/ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; int bit; START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); switch (rh) { case 4: DECODE_PRINTF("BT\t"); break; case 5: DECODE_PRINTF("BTS\t"); break; case 6: DECODE_PRINTF("BTR\t"); break; case 7: DECODE_PRINTF("BTC\t"); break; default: DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n"); TRACE_REGS(); printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n", M.x86.R_CS, M.x86.R_IP - 3, op2, (mod << 6) | (rh << 3) | rl); HALT_SYS(); } switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u8 shift; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0x1F; srcval = fetch_data_long(srcoffset); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); switch (rh) { case 5: store_data_long(srcoffset, srcval | mask); break; case 6: store_data_long(srcoffset, srcval & ~mask); break; case 7: store_data_long(srcoffset, srcval ^ mask); break; default: break; } } else { u16 srcval, mask; u8 shift; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0xF; srcval = fetch_data_word(srcoffset); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); switch (rh) { case 5: store_data_word(srcoffset, srcval | mask); break; case 6: store_data_word(srcoffset, srcval & ~mask); break; case 7: store_data_word(srcoffset, srcval ^ mask); break; default: break; } } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u8 shift; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0x1F; srcval = fetch_data_long(srcoffset); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); switch (rh) { case 5: store_data_long(srcoffset, srcval | mask); break; case 6: store_data_long(srcoffset, srcval & ~mask); break; case 7: store_data_long(srcoffset, srcval ^ mask); break; default: break; } } else { u16 srcval, mask; u8 shift; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0xF; srcval = fetch_data_word(srcoffset); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); switch (rh) { case 5: store_data_word(srcoffset, srcval | mask); break; case 6: store_data_word(srcoffset, srcval & ~mask); break; case 7: store_data_word(srcoffset, srcval ^ mask); break; default: break; } } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u8 shift; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0x1F; srcval = fetch_data_long(srcoffset); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); switch (rh) { case 5: store_data_long(srcoffset, srcval | mask); break; case 6: store_data_long(srcoffset, srcval & ~mask); break; case 7: store_data_long(srcoffset, srcval ^ mask); break; default: break; } } else { u16 srcval, mask; u8 shift; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0xF; srcval = fetch_data_word(srcoffset); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); switch (rh) { case 5: store_data_word(srcoffset, srcval | mask); break; case 6: store_data_word(srcoffset, srcval & ~mask); break; case 7: store_data_word(srcoffset, srcval ^ mask); break; default: break; } } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; u32 mask; u8 shift; srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0x1F; mask = (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); switch (rh) { case 5: *srcreg |= mask; break; case 6: *srcreg &= ~mask; break; case 7: *srcreg ^= mask; break; default: break; } } else { u16 *srcreg; u16 mask; u8 shift; srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shift = fetch_byte_imm(); TRACE_AND_STEP(); bit = shift & 0xF; mask = (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); switch (rh) { case 5: *srcreg |= mask; break; case 6: *srcreg &= ~mask; break; case 7: *srcreg ^= mask; break; default: break; } } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xbb ****************************************************************************/ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; int bit, disp; START_OF_INSTR(); DECODE_PRINTF("BTC\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval ^ mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, (u16) (srcval ^ mask)); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval ^ mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, (u16) (srcval ^ mask)); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, mask; u32 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; disp = (s16) * shiftreg >> 5; srcval = fetch_data_long(srcoffset + disp); mask = (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_long(srcoffset + disp, srcval ^ mask); } else { u16 srcval, mask; u16 *shiftreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; disp = (s16) * shiftreg >> 4; srcval = fetch_data_word(srcoffset + disp); mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(srcval & mask, F_CF); store_data_word(srcoffset + disp, (u16) (srcval ^ mask)); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg, *shiftreg; u32 mask; srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0x1F; mask = (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); *srcreg ^= mask; } else { u16 *srcreg, *shiftreg; u16 mask; srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); shiftreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); bit = *shiftreg & 0xF; mask = (u16) (0x1 << bit); CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF); *srcreg ^= mask; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xbc ****************************************************************************/ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("BSF\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_long(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 32; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_word(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 16; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_long(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 32; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_word(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 16; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_long(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 32; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_word(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 16; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcval = *DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 32; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcval = *DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 0; *dstreg < 16; (*dstreg)++) if ((srcval >> *dstreg) & 1) break; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xbd ****************************************************************************/ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("BSR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_long(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 31; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcoffset = decode_rm00_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_word(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 15; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_long(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 31; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcoffset = decode_rm01_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_word(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 15; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_long(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 31; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcoffset = decode_rm10_address(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); srcval = fetch_data_word(srcoffset); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 15; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 srcval, *dstreg; srcval = *DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_LONG_REGISTER(rh); TRACE_AND_STEP(); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 31; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } else { u16 srcval, *dstreg; srcval = *DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); dstreg = DECODE_RM_WORD_REGISTER(rh); TRACE_AND_STEP(); CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); for (*dstreg = 15; *dstreg > 0; (*dstreg)--) if ((srcval >> *dstreg) & 1) break; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xbe ****************************************************************************/ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("MOVSX\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = (s32) ((s8) fetch_data_byte(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = (s16) ((s8) fetch_data_byte(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = (s32) ((s8) fetch_data_byte(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = (s16) ((s8) fetch_data_byte(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = (s32) ((s8) fetch_data_byte(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = (s16) ((s8) fetch_data_byte(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u8 *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = (s32) ((s8) * srcreg); } else { u16 *destreg; u8 *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = (s16) ((s8) * srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f,0xbf ****************************************************************************/ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2)) { int mod, rl, rh; uint srcoffset; u32 *destreg; u32 srcval; u16 *srcreg; START_OF_INSTR(); DECODE_PRINTF("MOVSX\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = (s32) ((s16) fetch_data_word(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 1: destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = (s32) ((s16) fetch_data_word(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 2: destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = (s32) ((s16) fetch_data_word(srcoffset)); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 3: /* register to register */ destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = (s32) ((s16) * srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /* Handles opcodes 0xc8-0xcf */ static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2)) { START_OF_INSTR(); DECODE_PRINTF("BSWAP\n"); TRACE_AND_STEP(); switch (op2) { case 0xc8: M.x86.R_EAX = bswap_32(M.x86.R_EAX); break; case 0xc9: M.x86.R_ECX = bswap_32(M.x86.R_ECX); break; case 0xca: M.x86.R_EDX = bswap_32(M.x86.R_EDX); break; case 0xcb: M.x86.R_EBX = bswap_32(M.x86.R_EBX); break; case 0xcc: M.x86.R_ESP = bswap_32(M.x86.R_ESP); break; case 0xcd: M.x86.R_EBP = bswap_32(M.x86.R_EBP); break; case 0xce: M.x86.R_ESI = bswap_32(M.x86.R_ESI); break; case 0xcf: M.x86.R_EDI = bswap_32(M.x86.R_EDI); break; default: /* can't happen */ break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /*************************************************************************** * Double byte operation code table: **************************************************************************/ void (*x86emu_optab2[256]) (u8) = { /* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */ /* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */ /* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */ /* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */ /* 0x04 */ x86emuOp2_illegal_op, /* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */ /* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */ /* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */ /* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */ /* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */ /* 0x0a */ x86emuOp2_illegal_op, /* 0x0b */ x86emuOp2_illegal_op, /* 0x0c */ x86emuOp2_illegal_op, /* 0x0d */ x86emuOp2_illegal_op, /* 0x0e */ x86emuOp2_illegal_op, /* 0x0f */ x86emuOp2_illegal_op, /* 0x10 */ x86emuOp2_illegal_op, /* 0x11 */ x86emuOp2_illegal_op, /* 0x12 */ x86emuOp2_illegal_op, /* 0x13 */ x86emuOp2_illegal_op, /* 0x14 */ x86emuOp2_illegal_op, /* 0x15 */ x86emuOp2_illegal_op, /* 0x16 */ x86emuOp2_illegal_op, /* 0x17 */ x86emuOp2_illegal_op, /* 0x18 */ x86emuOp2_illegal_op, /* 0x19 */ x86emuOp2_illegal_op, /* 0x1a */ x86emuOp2_illegal_op, /* 0x1b */ x86emuOp2_illegal_op, /* 0x1c */ x86emuOp2_illegal_op, /* 0x1d */ x86emuOp2_illegal_op, /* 0x1e */ x86emuOp2_illegal_op, /* 0x1f */ x86emuOp2_illegal_op, /* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */ /* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */ /* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */ /* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */ /* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */ /* 0x25 */ x86emuOp2_illegal_op, /* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */ /* 0x27 */ x86emuOp2_illegal_op, /* 0x28 */ x86emuOp2_illegal_op, /* 0x29 */ x86emuOp2_illegal_op, /* 0x2a */ x86emuOp2_illegal_op, /* 0x2b */ x86emuOp2_illegal_op, /* 0x2c */ x86emuOp2_illegal_op, /* 0x2d */ x86emuOp2_illegal_op, /* 0x2e */ x86emuOp2_illegal_op, /* 0x2f */ x86emuOp2_illegal_op, /* 0x30 */ x86emuOp2_illegal_op, /* 0x31 */ x86emuOp2_rdtsc, /* 0x32 */ x86emuOp2_illegal_op, /* 0x33 */ x86emuOp2_illegal_op, /* 0x34 */ x86emuOp2_illegal_op, /* 0x35 */ x86emuOp2_illegal_op, /* 0x36 */ x86emuOp2_illegal_op, /* 0x37 */ x86emuOp2_illegal_op, /* 0x38 */ x86emuOp2_illegal_op, /* 0x39 */ x86emuOp2_illegal_op, /* 0x3a */ x86emuOp2_illegal_op, /* 0x3b */ x86emuOp2_illegal_op, /* 0x3c */ x86emuOp2_illegal_op, /* 0x3d */ x86emuOp2_illegal_op, /* 0x3e */ x86emuOp2_illegal_op, /* 0x3f */ x86emuOp2_illegal_op, /* 0x40 */ x86emuOp2_illegal_op, /* 0x41 */ x86emuOp2_illegal_op, /* 0x42 */ x86emuOp2_illegal_op, /* 0x43 */ x86emuOp2_illegal_op, /* 0x44 */ x86emuOp2_illegal_op, /* 0x45 */ x86emuOp2_illegal_op, /* 0x46 */ x86emuOp2_illegal_op, /* 0x47 */ x86emuOp2_illegal_op, /* 0x48 */ x86emuOp2_illegal_op, /* 0x49 */ x86emuOp2_illegal_op, /* 0x4a */ x86emuOp2_illegal_op, /* 0x4b */ x86emuOp2_illegal_op, /* 0x4c */ x86emuOp2_illegal_op, /* 0x4d */ x86emuOp2_illegal_op, /* 0x4e */ x86emuOp2_illegal_op, /* 0x4f */ x86emuOp2_illegal_op, /* 0x50 */ x86emuOp2_illegal_op, /* 0x51 */ x86emuOp2_illegal_op, /* 0x52 */ x86emuOp2_illegal_op, /* 0x53 */ x86emuOp2_illegal_op, /* 0x54 */ x86emuOp2_illegal_op, /* 0x55 */ x86emuOp2_illegal_op, /* 0x56 */ x86emuOp2_illegal_op, /* 0x57 */ x86emuOp2_illegal_op, /* 0x58 */ x86emuOp2_illegal_op, /* 0x59 */ x86emuOp2_illegal_op, /* 0x5a */ x86emuOp2_illegal_op, /* 0x5b */ x86emuOp2_illegal_op, /* 0x5c */ x86emuOp2_illegal_op, /* 0x5d */ x86emuOp2_illegal_op, /* 0x5e */ x86emuOp2_illegal_op, /* 0x5f */ x86emuOp2_illegal_op, /* 0x60 */ x86emuOp2_illegal_op, /* 0x61 */ x86emuOp2_illegal_op, /* 0x62 */ x86emuOp2_illegal_op, /* 0x63 */ x86emuOp2_illegal_op, /* 0x64 */ x86emuOp2_illegal_op, /* 0x65 */ x86emuOp2_illegal_op, /* 0x66 */ x86emuOp2_illegal_op, /* 0x67 */ x86emuOp2_illegal_op, /* 0x68 */ x86emuOp2_illegal_op, /* 0x69 */ x86emuOp2_illegal_op, /* 0x6a */ x86emuOp2_illegal_op, /* 0x6b */ x86emuOp2_illegal_op, /* 0x6c */ x86emuOp2_illegal_op, /* 0x6d */ x86emuOp2_illegal_op, /* 0x6e */ x86emuOp2_illegal_op, /* 0x6f */ x86emuOp2_illegal_op, /* 0x70 */ x86emuOp2_illegal_op, /* 0x71 */ x86emuOp2_illegal_op, /* 0x72 */ x86emuOp2_illegal_op, /* 0x73 */ x86emuOp2_illegal_op, /* 0x74 */ x86emuOp2_illegal_op, /* 0x75 */ x86emuOp2_illegal_op, /* 0x76 */ x86emuOp2_illegal_op, /* 0x77 */ x86emuOp2_illegal_op, /* 0x78 */ x86emuOp2_illegal_op, /* 0x79 */ x86emuOp2_illegal_op, /* 0x7a */ x86emuOp2_illegal_op, /* 0x7b */ x86emuOp2_illegal_op, /* 0x7c */ x86emuOp2_illegal_op, /* 0x7d */ x86emuOp2_illegal_op, /* 0x7e */ x86emuOp2_illegal_op, /* 0x7f */ x86emuOp2_illegal_op, /* 0x80 */ x86emuOp2_long_jump, /* 0x81 */ x86emuOp2_long_jump, /* 0x82 */ x86emuOp2_long_jump, /* 0x83 */ x86emuOp2_long_jump, /* 0x84 */ x86emuOp2_long_jump, /* 0x85 */ x86emuOp2_long_jump, /* 0x86 */ x86emuOp2_long_jump, /* 0x87 */ x86emuOp2_long_jump, /* 0x88 */ x86emuOp2_long_jump, /* 0x89 */ x86emuOp2_long_jump, /* 0x8a */ x86emuOp2_long_jump, /* 0x8b */ x86emuOp2_long_jump, /* 0x8c */ x86emuOp2_long_jump, /* 0x8d */ x86emuOp2_long_jump, /* 0x8e */ x86emuOp2_long_jump, /* 0x8f */ x86emuOp2_long_jump, /* 0x90 */ x86emuOp2_set_byte, /* 0x91 */ x86emuOp2_set_byte, /* 0x92 */ x86emuOp2_set_byte, /* 0x93 */ x86emuOp2_set_byte, /* 0x94 */ x86emuOp2_set_byte, /* 0x95 */ x86emuOp2_set_byte, /* 0x96 */ x86emuOp2_set_byte, /* 0x97 */ x86emuOp2_set_byte, /* 0x98 */ x86emuOp2_set_byte, /* 0x99 */ x86emuOp2_set_byte, /* 0x9a */ x86emuOp2_set_byte, /* 0x9b */ x86emuOp2_set_byte, /* 0x9c */ x86emuOp2_set_byte, /* 0x9d */ x86emuOp2_set_byte, /* 0x9e */ x86emuOp2_set_byte, /* 0x9f */ x86emuOp2_set_byte, /* 0xa0 */ x86emuOp2_push_FS, /* 0xa1 */ x86emuOp2_pop_FS, /* 0xa2 */ x86emuOp2_cpuid, /* 0xa3 */ x86emuOp2_bt_R, /* 0xa4 */ x86emuOp2_shld_IMM, /* 0xa5 */ x86emuOp2_shld_CL, /* 0xa6 */ x86emuOp2_illegal_op, /* 0xa7 */ x86emuOp2_illegal_op, /* 0xa8 */ x86emuOp2_push_GS, /* 0xa9 */ x86emuOp2_pop_GS, /* 0xaa */ x86emuOp2_illegal_op, /* 0xab */ x86emuOp2_bts_R, /* 0xac */ x86emuOp2_shrd_IMM, /* 0xad */ x86emuOp2_shrd_CL, /* 0xae */ x86emuOp2_illegal_op, /* 0xaf */ x86emuOp2_imul_R_RM, /* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */ /* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */ /* 0xb2 */ x86emuOp2_lss_R_IMM, /* 0xb3 */ x86emuOp2_btr_R, /* 0xb4 */ x86emuOp2_lfs_R_IMM, /* 0xb5 */ x86emuOp2_lgs_R_IMM, /* 0xb6 */ x86emuOp2_movzx_byte_R_RM, /* 0xb7 */ x86emuOp2_movzx_word_R_RM, /* 0xb8 */ x86emuOp2_illegal_op, /* 0xb9 */ x86emuOp2_illegal_op, /* 0xba */ x86emuOp2_btX_I, /* 0xbb */ x86emuOp2_btc_R, /* 0xbc */ x86emuOp2_bsf, /* 0xbd */ x86emuOp2_bsr, /* 0xbe */ x86emuOp2_movsx_byte_R_RM, /* 0xbf */ x86emuOp2_movsx_word_R_RM, /* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */ /* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */ /* 0xc2 */ x86emuOp2_illegal_op, /* 0xc3 */ x86emuOp2_illegal_op, /* 0xc4 */ x86emuOp2_illegal_op, /* 0xc5 */ x86emuOp2_illegal_op, /* 0xc6 */ x86emuOp2_illegal_op, /* 0xc7 */ x86emuOp2_illegal_op, /* 0xc8 */ x86emuOp2_bswap, /* 0xc9 */ x86emuOp2_bswap, /* 0xca */ x86emuOp2_bswap, /* 0xcb */ x86emuOp2_bswap, /* 0xcc */ x86emuOp2_bswap, /* 0xcd */ x86emuOp2_bswap, /* 0xce */ x86emuOp2_bswap, /* 0xcf */ x86emuOp2_bswap, /* 0xd0 */ x86emuOp2_illegal_op, /* 0xd1 */ x86emuOp2_illegal_op, /* 0xd2 */ x86emuOp2_illegal_op, /* 0xd3 */ x86emuOp2_illegal_op, /* 0xd4 */ x86emuOp2_illegal_op, /* 0xd5 */ x86emuOp2_illegal_op, /* 0xd6 */ x86emuOp2_illegal_op, /* 0xd7 */ x86emuOp2_illegal_op, /* 0xd8 */ x86emuOp2_illegal_op, /* 0xd9 */ x86emuOp2_illegal_op, /* 0xda */ x86emuOp2_illegal_op, /* 0xdb */ x86emuOp2_illegal_op, /* 0xdc */ x86emuOp2_illegal_op, /* 0xdd */ x86emuOp2_illegal_op, /* 0xde */ x86emuOp2_illegal_op, /* 0xdf */ x86emuOp2_illegal_op, /* 0xe0 */ x86emuOp2_illegal_op, /* 0xe1 */ x86emuOp2_illegal_op, /* 0xe2 */ x86emuOp2_illegal_op, /* 0xe3 */ x86emuOp2_illegal_op, /* 0xe4 */ x86emuOp2_illegal_op, /* 0xe5 */ x86emuOp2_illegal_op, /* 0xe6 */ x86emuOp2_illegal_op, /* 0xe7 */ x86emuOp2_illegal_op, /* 0xe8 */ x86emuOp2_illegal_op, /* 0xe9 */ x86emuOp2_illegal_op, /* 0xea */ x86emuOp2_illegal_op, /* 0xeb */ x86emuOp2_illegal_op, /* 0xec */ x86emuOp2_illegal_op, /* 0xed */ x86emuOp2_illegal_op, /* 0xee */ x86emuOp2_illegal_op, /* 0xef */ x86emuOp2_illegal_op, /* 0xf0 */ x86emuOp2_illegal_op, /* 0xf1 */ x86emuOp2_illegal_op, /* 0xf2 */ x86emuOp2_illegal_op, /* 0xf3 */ x86emuOp2_illegal_op, /* 0xf4 */ x86emuOp2_illegal_op, /* 0xf5 */ x86emuOp2_illegal_op, /* 0xf6 */ x86emuOp2_illegal_op, /* 0xf7 */ x86emuOp2_illegal_op, /* 0xf8 */ x86emuOp2_illegal_op, /* 0xf9 */ x86emuOp2_illegal_op, /* 0xfa */ x86emuOp2_illegal_op, /* 0xfb */ x86emuOp2_illegal_op, /* 0xfc */ x86emuOp2_illegal_op, /* 0xfd */ x86emuOp2_illegal_op, /* 0xfe */ x86emuOp2_illegal_op, /* 0xff */ x86emuOp2_illegal_op, }; xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/0000755000175000017500000000000013640201534015261 500000000000000xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/fpu.h0000644000175000017500000000474013640201473016153 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for FPU instruction decoding. * ****************************************************************************/ #ifndef __X86EMU_FPU_H #define __X86EMU_FPU_H #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif /* these have to be defined, whether 8087 support compiled in or not. */ extern void x86emuOp_esc_coprocess_d8(u8 op1); extern void x86emuOp_esc_coprocess_d9(u8 op1); extern void x86emuOp_esc_coprocess_da(u8 op1); extern void x86emuOp_esc_coprocess_db(u8 op1); extern void x86emuOp_esc_coprocess_dc(u8 op1); extern void x86emuOp_esc_coprocess_dd(u8 op1); extern void x86emuOp_esc_coprocess_de(u8 op1); extern void x86emuOp_esc_coprocess_df(u8 op1); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_FPU_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/fpu_regs.h0000644000175000017500000000731113640201473017170 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for FPU register definitions. * ****************************************************************************/ #ifndef __X86EMU_FPU_REGS_H #define __X86EMU_FPU_REGS_H #ifdef X86_FPU_SUPPORT #ifdef PACK #pragma PACK #endif /* Basic 8087 register can hold any of the following values: */ union x86_fpu_reg_u { s8 tenbytes[10]; double dval; float fval; s16 sval; s32 lval; }; struct x86_fpu_reg { union x86_fpu_reg_u reg; char tag; }; /* * Since we are not going to worry about the problems of aliasing * registers, every time a register is modified, its result type is * set in the tag fields for that register. If some operation * attempts to access the type in a way inconsistent with its current * storage format, then we flag the operation. If common, we'll * attempt the conversion. */ #define X86_FPU_VALID 0x80 #define X86_FPU_REGTYP(r) ((r) & 0x7F) #define X86_FPU_WORD 0x0 #define X86_FPU_SHORT 0x1 #define X86_FPU_LONG 0x2 #define X86_FPU_FLOAT 0x3 #define X86_FPU_DOUBLE 0x4 #define X86_FPU_LDBL 0x5 #define X86_FPU_BSD 0x6 #define X86_FPU_STKTOP 0 struct x86_fpu_registers { struct x86_fpu_reg x86_fpu_stack[8]; int x86_fpu_flags; int x86_fpu_config; /* rounding modes, etc. */ short x86_fpu_tos, x86_fpu_bos; }; #ifdef END_PACK #pragma END_PACK #endif /* * There are two versions of the following macro. * * One version is for opcode D9, for which there are more than 32 * instructions encoded in the second byte of the opcode. * * The other version, deals with all the other 7 i87 opcodes, for * which there are only 32 strings needed to describe the * instructions. */ #endif /* X86_FPU_SUPPORT */ #ifdef DEBUG #define DECODE_PRINTINSTR32(t,mod,rh,rl) \ DECODE_PRINTF(t[(mod<<3)+(rh)]); #define DECODE_PRINTINSTR256(t,mod,rh,rl) \ DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]); #else #define DECODE_PRINTINSTR32(t,mod,rh,rl) #define DECODE_PRINTINSTR256(t,mod,rh,rl) #endif #endif /* __X86EMU_FPU_REGS_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/ops.h0000644000175000017500000000362213640201473016160 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for operand decoding functions. * ****************************************************************************/ #ifndef __X86EMU_OPS_H #define __X86EMU_OPS_H extern void (*x86emu_optab[0x100]) (u8 op1); extern void (*x86emu_optab2[0x100]) (u8 op2); #endif /* __X86EMU_OPS_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/decode.h0000644000175000017500000000721413640201473016603 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for instruction decoding logic. * ****************************************************************************/ #ifndef __X86EMU_DECODE_H #define __X86EMU_DECODE_H /*---------------------- Macros and type definitions ----------------------*/ /* Instruction Decoding Stuff */ #define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl) #define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r) #define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r) #define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r) #define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK /*-------------------------- Function Prototypes --------------------------*/ #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif void x86emu_intr_raise(u8 type); void fetch_decode_modrm(int *mod, int *regh, int *regl); u8 fetch_byte_imm(void); u16 fetch_word_imm(void); u32 fetch_long_imm(void); u8 fetch_data_byte(uint offset); u8 fetch_data_byte_abs(uint segment, uint offset); u16 fetch_data_word(uint offset); u16 fetch_data_word_abs(uint segment, uint offset); u32 fetch_data_long(uint offset); u32 fetch_data_long_abs(uint segment, uint offset); void store_data_byte(uint offset, u8 val); void store_data_byte_abs(uint segment, uint offset, u8 val); void store_data_word(uint offset, u16 val); void store_data_word_abs(uint segment, uint offset, u16 val); void store_data_long(uint offset, u32 val); void store_data_long_abs(uint segment, uint offset, u32 val); u8 *decode_rm_byte_register(int reg); u16 *decode_rm_word_register(int reg); u32 *decode_rm_long_register(int reg); u16 *decode_rm_seg_register(int reg); u32 decode_rm00_address(int rm); u32 decode_rm01_address(int rm); u32 decode_rm10_address(int rm); u32 decode_sib_address(int sib, int mod); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_DECODE_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h0000644000175000017500000000603713640201473017652 00000000000000/**************************************************************************** * * Inline helpers for x86emu * * Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: GNU C * Environment: GCC on i386 or x86-64 * Developer: Bart Trojanowski * * Description: This file defines a few x86 macros that can be used by the * emulator to execute native instructions. * * For PIC vs non-PIC code refer to: * http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well * ****************************************************************************/ #ifndef __X86EMU_PRIM_X86_GCC_H #define __X86EMU_PRIM_X86_GCC_H #include "x86emu/types.h" #if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)) #error This file is intended to be used by gcc on i386 or x86-64 system #endif #if defined(__PIC__) && defined(__i386__) #define X86EMU_HAS_HW_CPUID 1 static inline void hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d) { __asm__ __volatile__("pushl %%ebx \n\t" "cpuid \n\t" "movl %%ebx, %1 \n\t" "popl %%ebx \n\t":"=a"(*a), "=r"(*b), "=c"(*c), "=d"(*d) :"a"(*a), "c"(*c) :"cc"); } #else /* ! (__PIC__ && __i386__) */ #define x86EMU_HAS_HW_CPUID 1 static inline void hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d) { __asm__ __volatile__("cpuid":"=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d) :"a"(*a), "c"(*c) :"cc"); } #endif /* __PIC__ && __i386__ */ #endif /* __X86EMU_PRIM_X86_GCC_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/prim_asm.h0000644000175000017500000007147013640201473017174 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: Watcom C++ 10.6 or later * Environment: Any * Developer: Kendall Bennett * * Description: Inline assembler versions of the primitive operand * functions for faster performance. At the moment this is * x86 inline assembler, but these functions could be replaced * with native inline assembler for each supported processor * platform. * ****************************************************************************/ #ifndef __X86EMU_PRIM_ASM_H #define __X86EMU_PRIM_ASM_H #ifdef __WATCOMC__ #ifndef VALIDATE #define __HAVE_INLINE_ASSEMBLER__ #endif u32 get_flags_asm(void); #pragma aux get_flags_asm = \ "pushf" \ "pop eax" \ value [eax] \ modify exact [eax]; u16 aaa_word_asm(u32 * flags, u16 d); #pragma aux aaa_word_asm = \ "push [edi]" \ "popf" \ "aaa" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u16 aas_word_asm(u32 * flags, u16 d); #pragma aux aas_word_asm = \ "push [edi]" \ "popf" \ "aas" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u16 aad_word_asm(u32 * flags, u16 d); #pragma aux aad_word_asm = \ "push [edi]" \ "popf" \ "aad" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u16 aam_word_asm(u32 * flags, u8 d); #pragma aux aam_word_asm = \ "push [edi]" \ "popf" \ "aam" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [ax] \ modify exact [ax]; u8 adc_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux adc_byte_asm = \ "push [edi]" \ "popf" \ "adc al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 adc_word_asm(u32 * flags, u16 d, u16 s); #pragma aux adc_word_asm = \ "push [edi]" \ "popf" \ "adc ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 adc_long_asm(u32 * flags, u32 d, u32 s); #pragma aux adc_long_asm = \ "push [edi]" \ "popf" \ "adc eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; u8 add_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux add_byte_asm = \ "push [edi]" \ "popf" \ "add al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 add_word_asm(u32 * flags, u16 d, u16 s); #pragma aux add_word_asm = \ "push [edi]" \ "popf" \ "add ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 add_long_asm(u32 * flags, u32 d, u32 s); #pragma aux add_long_asm = \ "push [edi]" \ "popf" \ "add eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; u8 and_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux and_byte_asm = \ "push [edi]" \ "popf" \ "and al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 and_word_asm(u32 * flags, u16 d, u16 s); #pragma aux and_word_asm = \ "push [edi]" \ "popf" \ "and ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 and_long_asm(u32 * flags, u32 d, u32 s); #pragma aux and_long_asm = \ "push [edi]" \ "popf" \ "and eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; u8 cmp_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux cmp_byte_asm = \ "push [edi]" \ "popf" \ "cmp al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 cmp_word_asm(u32 * flags, u16 d, u16 s); #pragma aux cmp_word_asm = \ "push [edi]" \ "popf" \ "cmp ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 cmp_long_asm(u32 * flags, u32 d, u32 s); #pragma aux cmp_long_asm = \ "push [edi]" \ "popf" \ "cmp eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; u8 daa_byte_asm(u32 * flags, u8 d); #pragma aux daa_byte_asm = \ "push [edi]" \ "popf" \ "daa" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [al] \ modify exact [al]; u8 das_byte_asm(u32 * flags, u8 d); #pragma aux das_byte_asm = \ "push [edi]" \ "popf" \ "das" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [al] \ modify exact [al]; u8 dec_byte_asm(u32 * flags, u8 d); #pragma aux dec_byte_asm = \ "push [edi]" \ "popf" \ "dec al" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [al] \ modify exact [al]; u16 dec_word_asm(u32 * flags, u16 d); #pragma aux dec_word_asm = \ "push [edi]" \ "popf" \ "dec ax" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u32 dec_long_asm(u32 * flags, u32 d); #pragma aux dec_long_asm = \ "push [edi]" \ "popf" \ "dec eax" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] \ value [eax] \ modify exact [eax]; u8 inc_byte_asm(u32 * flags, u8 d); #pragma aux inc_byte_asm = \ "push [edi]" \ "popf" \ "inc al" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [al] \ modify exact [al]; u16 inc_word_asm(u32 * flags, u16 d); #pragma aux inc_word_asm = \ "push [edi]" \ "popf" \ "inc ax" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u32 inc_long_asm(u32 * flags, u32 d); #pragma aux inc_long_asm = \ "push [edi]" \ "popf" \ "inc eax" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] \ value [eax] \ modify exact [eax]; u8 or_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux or_byte_asm = \ "push [edi]" \ "popf" \ "or al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 or_word_asm(u32 * flags, u16 d, u16 s); #pragma aux or_word_asm = \ "push [edi]" \ "popf" \ "or ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 or_long_asm(u32 * flags, u32 d, u32 s); #pragma aux or_long_asm = \ "push [edi]" \ "popf" \ "or eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; u8 neg_byte_asm(u32 * flags, u8 d); #pragma aux neg_byte_asm = \ "push [edi]" \ "popf" \ "neg al" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [al] \ modify exact [al]; u16 neg_word_asm(u32 * flags, u16 d); #pragma aux neg_word_asm = \ "push [edi]" \ "popf" \ "neg ax" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u32 neg_long_asm(u32 * flags, u32 d); #pragma aux neg_long_asm = \ "push [edi]" \ "popf" \ "neg eax" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] \ value [eax] \ modify exact [eax]; u8 not_byte_asm(u32 * flags, u8 d); #pragma aux not_byte_asm = \ "push [edi]" \ "popf" \ "not al" \ "pushf" \ "pop [edi]" \ parm [edi] [al] \ value [al] \ modify exact [al]; u16 not_word_asm(u32 * flags, u16 d); #pragma aux not_word_asm = \ "push [edi]" \ "popf" \ "not ax" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] \ value [ax] \ modify exact [ax]; u32 not_long_asm(u32 * flags, u32 d); #pragma aux not_long_asm = \ "push [edi]" \ "popf" \ "not eax" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] \ value [eax] \ modify exact [eax]; u8 rcl_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux rcl_byte_asm = \ "push [edi]" \ "popf" \ "rcl al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 rcl_word_asm(u32 * flags, u16 d, u8 s); #pragma aux rcl_word_asm = \ "push [edi]" \ "popf" \ "rcl ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 rcl_long_asm(u32 * flags, u32 d, u8 s); #pragma aux rcl_long_asm = \ "push [edi]" \ "popf" \ "rcl eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u8 rcr_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux rcr_byte_asm = \ "push [edi]" \ "popf" \ "rcr al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 rcr_word_asm(u32 * flags, u16 d, u8 s); #pragma aux rcr_word_asm = \ "push [edi]" \ "popf" \ "rcr ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 rcr_long_asm(u32 * flags, u32 d, u8 s); #pragma aux rcr_long_asm = \ "push [edi]" \ "popf" \ "rcr eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u8 rol_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux rol_byte_asm = \ "push [edi]" \ "popf" \ "rol al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 rol_word_asm(u32 * flags, u16 d, u8 s); #pragma aux rol_word_asm = \ "push [edi]" \ "popf" \ "rol ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 rol_long_asm(u32 * flags, u32 d, u8 s); #pragma aux rol_long_asm = \ "push [edi]" \ "popf" \ "rol eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u8 ror_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux ror_byte_asm = \ "push [edi]" \ "popf" \ "ror al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 ror_word_asm(u32 * flags, u16 d, u8 s); #pragma aux ror_word_asm = \ "push [edi]" \ "popf" \ "ror ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 ror_long_asm(u32 * flags, u32 d, u8 s); #pragma aux ror_long_asm = \ "push [edi]" \ "popf" \ "ror eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u8 shl_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux shl_byte_asm = \ "push [edi]" \ "popf" \ "shl al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 shl_word_asm(u32 * flags, u16 d, u8 s); #pragma aux shl_word_asm = \ "push [edi]" \ "popf" \ "shl ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 shl_long_asm(u32 * flags, u32 d, u8 s); #pragma aux shl_long_asm = \ "push [edi]" \ "popf" \ "shl eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u8 shr_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux shr_byte_asm = \ "push [edi]" \ "popf" \ "shr al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 shr_word_asm(u32 * flags, u16 d, u8 s); #pragma aux shr_word_asm = \ "push [edi]" \ "popf" \ "shr ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 shr_long_asm(u32 * flags, u32 d, u8 s); #pragma aux shr_long_asm = \ "push [edi]" \ "popf" \ "shr eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u8 sar_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux sar_byte_asm = \ "push [edi]" \ "popf" \ "sar al,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [cl] \ value [al] \ modify exact [al cl]; u16 sar_word_asm(u32 * flags, u16 d, u8 s); #pragma aux sar_word_asm = \ "push [edi]" \ "popf" \ "sar ax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [cl] \ value [ax] \ modify exact [ax cl]; u32 sar_long_asm(u32 * flags, u32 d, u8 s); #pragma aux sar_long_asm = \ "push [edi]" \ "popf" \ "sar eax,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [cl] \ value [eax] \ modify exact [eax cl]; u16 shld_word_asm(u32 * flags, u16 d, u16 fill, u8 s); #pragma aux shld_word_asm = \ "push [edi]" \ "popf" \ "shld ax,dx,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [dx] [cl] \ value [ax] \ modify exact [ax dx cl]; u32 shld_long_asm(u32 * flags, u32 d, u32 fill, u8 s); #pragma aux shld_long_asm = \ "push [edi]" \ "popf" \ "shld eax,edx,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [edx] [cl] \ value [eax] \ modify exact [eax edx cl]; u16 shrd_word_asm(u32 * flags, u16 d, u16 fill, u8 s); #pragma aux shrd_word_asm = \ "push [edi]" \ "popf" \ "shrd ax,dx,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [dx] [cl] \ value [ax] \ modify exact [ax dx cl]; u32 shrd_long_asm(u32 * flags, u32 d, u32 fill, u8 s); #pragma aux shrd_long_asm = \ "push [edi]" \ "popf" \ "shrd eax,edx,cl" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [edx] [cl] \ value [eax] \ modify exact [eax edx cl]; u8 sbb_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux sbb_byte_asm = \ "push [edi]" \ "popf" \ "sbb al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 sbb_word_asm(u32 * flags, u16 d, u16 s); #pragma aux sbb_word_asm = \ "push [edi]" \ "popf" \ "sbb ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 sbb_long_asm(u32 * flags, u32 d, u32 s); #pragma aux sbb_long_asm = \ "push [edi]" \ "popf" \ "sbb eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; u8 sub_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux sub_byte_asm = \ "push [edi]" \ "popf" \ "sub al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 sub_word_asm(u32 * flags, u16 d, u16 s); #pragma aux sub_word_asm = \ "push [edi]" \ "popf" \ "sub ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 sub_long_asm(u32 * flags, u32 d, u32 s); #pragma aux sub_long_asm = \ "push [edi]" \ "popf" \ "sub eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; void test_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux test_byte_asm = \ "push [edi]" \ "popf" \ "test al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ modify exact [al bl]; void test_word_asm(u32 * flags, u16 d, u16 s); #pragma aux test_word_asm = \ "push [edi]" \ "popf" \ "test ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ modify exact [ax bx]; void test_long_asm(u32 * flags, u32 d, u32 s); #pragma aux test_long_asm = \ "push [edi]" \ "popf" \ "test eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ modify exact [eax ebx]; u8 xor_byte_asm(u32 * flags, u8 d, u8 s); #pragma aux xor_byte_asm = \ "push [edi]" \ "popf" \ "xor al,bl" \ "pushf" \ "pop [edi]" \ parm [edi] [al] [bl] \ value [al] \ modify exact [al bl]; u16 xor_word_asm(u32 * flags, u16 d, u16 s); #pragma aux xor_word_asm = \ "push [edi]" \ "popf" \ "xor ax,bx" \ "pushf" \ "pop [edi]" \ parm [edi] [ax] [bx] \ value [ax] \ modify exact [ax bx]; u32 xor_long_asm(u32 * flags, u32 d, u32 s); #pragma aux xor_long_asm = \ "push [edi]" \ "popf" \ "xor eax,ebx" \ "pushf" \ "pop [edi]" \ parm [edi] [eax] [ebx] \ value [eax] \ modify exact [eax ebx]; void imul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s); #pragma aux imul_byte_asm = \ "push [edi]" \ "popf" \ "imul bl" \ "pushf" \ "pop [edi]" \ "mov [esi],ax" \ parm [edi] [esi] [al] [bl] \ modify exact [esi ax bl]; void imul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s); #pragma aux imul_word_asm = \ "push [edi]" \ "popf" \ "imul bx" \ "pushf" \ "pop [edi]" \ "mov [esi],ax" \ "mov [ecx],dx" \ parm [edi] [esi] [ecx] [ax] [bx]\ modify exact [esi edi ax bx dx]; void imul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s); #pragma aux imul_long_asm = \ "push [edi]" \ "popf" \ "imul ebx" \ "pushf" \ "pop [edi]" \ "mov [esi],eax" \ "mov [ecx],edx" \ parm [edi] [esi] [ecx] [eax] [ebx] \ modify exact [esi edi eax ebx edx]; void mul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s); #pragma aux mul_byte_asm = \ "push [edi]" \ "popf" \ "mul bl" \ "pushf" \ "pop [edi]" \ "mov [esi],ax" \ parm [edi] [esi] [al] [bl] \ modify exact [esi ax bl]; void mul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s); #pragma aux mul_word_asm = \ "push [edi]" \ "popf" \ "mul bx" \ "pushf" \ "pop [edi]" \ "mov [esi],ax" \ "mov [ecx],dx" \ parm [edi] [esi] [ecx] [ax] [bx]\ modify exact [esi edi ax bx dx]; void mul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s); #pragma aux mul_long_asm = \ "push [edi]" \ "popf" \ "mul ebx" \ "pushf" \ "pop [edi]" \ "mov [esi],eax" \ "mov [ecx],edx" \ parm [edi] [esi] [ecx] [eax] [ebx] \ modify exact [esi edi eax ebx edx]; void idiv_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s); #pragma aux idiv_byte_asm = \ "push [edi]" \ "popf" \ "idiv bl" \ "pushf" \ "pop [edi]" \ "mov [esi],al" \ "mov [ecx],ah" \ parm [edi] [esi] [ecx] [ax] [bl]\ modify exact [esi edi ax bl]; void idiv_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s); #pragma aux idiv_word_asm = \ "push [edi]" \ "popf" \ "idiv bx" \ "pushf" \ "pop [edi]" \ "mov [esi],ax" \ "mov [ecx],dx" \ parm [edi] [esi] [ecx] [ax] [dx] [bx]\ modify exact [esi edi ax dx bx]; void idiv_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s); #pragma aux idiv_long_asm = \ "push [edi]" \ "popf" \ "idiv ebx" \ "pushf" \ "pop [edi]" \ "mov [esi],eax" \ "mov [ecx],edx" \ parm [edi] [esi] [ecx] [eax] [edx] [ebx]\ modify exact [esi edi eax edx ebx]; void div_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s); #pragma aux div_byte_asm = \ "push [edi]" \ "popf" \ "div bl" \ "pushf" \ "pop [edi]" \ "mov [esi],al" \ "mov [ecx],ah" \ parm [edi] [esi] [ecx] [ax] [bl]\ modify exact [esi edi ax bl]; void div_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s); #pragma aux div_word_asm = \ "push [edi]" \ "popf" \ "div bx" \ "pushf" \ "pop [edi]" \ "mov [esi],ax" \ "mov [ecx],dx" \ parm [edi] [esi] [ecx] [ax] [dx] [bx]\ modify exact [esi edi ax dx bx]; void div_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s); #pragma aux div_long_asm = \ "push [edi]" \ "popf" \ "div ebx" \ "pushf" \ "pop [edi]" \ "mov [esi],eax" \ "mov [ecx],edx" \ parm [edi] [esi] [ecx] [eax] [edx] [ebx]\ modify exact [esi edi eax edx ebx]; #endif #endif /* __X86EMU_PRIM_ASM_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/prim_ops.h0000644000175000017500000001120413640201473017202 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for primitive operation functions. * ****************************************************************************/ #ifndef __X86EMU_PRIM_OPS_H #define __X86EMU_PRIM_OPS_H #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif u16 aaa_word(u16 d); u16 aas_word(u16 d); u16 aad_word(u16 d); u16 aam_word(u8 d); u8 adc_byte(u8 d, u8 s); u16 adc_word(u16 d, u16 s); u32 adc_long(u32 d, u32 s); u8 add_byte(u8 d, u8 s); u16 add_word(u16 d, u16 s); u32 add_long(u32 d, u32 s); u8 and_byte(u8 d, u8 s); u16 and_word(u16 d, u16 s); u32 and_long(u32 d, u32 s); u8 cmp_byte(u8 d, u8 s); u16 cmp_word(u16 d, u16 s); u32 cmp_long(u32 d, u32 s); u8 daa_byte(u8 d); u8 das_byte(u8 d); u8 dec_byte(u8 d); u16 dec_word(u16 d); u32 dec_long(u32 d); u8 inc_byte(u8 d); u16 inc_word(u16 d); u32 inc_long(u32 d); u8 or_byte(u8 d, u8 s); u16 or_word(u16 d, u16 s); u32 or_long(u32 d, u32 s); u8 neg_byte(u8 s); u16 neg_word(u16 s); u32 neg_long(u32 s); u8 not_byte(u8 s); u16 not_word(u16 s); u32 not_long(u32 s); u8 rcl_byte(u8 d, u8 s); u16 rcl_word(u16 d, u8 s); u32 rcl_long(u32 d, u8 s); u8 rcr_byte(u8 d, u8 s); u16 rcr_word(u16 d, u8 s); u32 rcr_long(u32 d, u8 s); u8 rol_byte(u8 d, u8 s); u16 rol_word(u16 d, u8 s); u32 rol_long(u32 d, u8 s); u8 ror_byte(u8 d, u8 s); u16 ror_word(u16 d, u8 s); u32 ror_long(u32 d, u8 s); u8 shl_byte(u8 d, u8 s); u16 shl_word(u16 d, u8 s); u32 shl_long(u32 d, u8 s); u8 shr_byte(u8 d, u8 s); u16 shr_word(u16 d, u8 s); u32 shr_long(u32 d, u8 s); u8 sar_byte(u8 d, u8 s); u16 sar_word(u16 d, u8 s); u32 sar_long(u32 d, u8 s); u16 shld_word(u16 d, u16 fill, u8 s); u32 shld_long(u32 d, u32 fill, u8 s); u16 shrd_word(u16 d, u16 fill, u8 s); u32 shrd_long(u32 d, u32 fill, u8 s); u8 sbb_byte(u8 d, u8 s); u16 sbb_word(u16 d, u16 s); u32 sbb_long(u32 d, u32 s); u8 sub_byte(u8 d, u8 s); u16 sub_word(u16 d, u16 s); u32 sub_long(u32 d, u32 s); void test_byte(u8 d, u8 s); void test_word(u16 d, u16 s); void test_long(u32 d, u32 s); u8 xor_byte(u8 d, u8 s); u16 xor_word(u16 d, u16 s); u32 xor_long(u32 d, u32 s); void imul_byte(u8 s); void imul_word(u16 s); void imul_long(u32 s); void imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s); void mul_byte(u8 s); void mul_word(u16 s); void mul_long(u32 s); void idiv_byte(u8 s); void idiv_word(u16 s); void idiv_long(u32 s); void div_byte(u8 s); void div_word(u16 s); void div_long(u32 s); void ins(int size); void outs(int size); u16 mem_access_word(int addr); void push_word(u16 w); void push_long(u32 w); u16 pop_word(void); u32 pop_long(void); void cpuid(void); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_PRIM_OPS_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/regs.h0000644000175000017500000002401713640201473016320 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for x86 register definitions. * ****************************************************************************/ #ifndef __X86EMU_REGS_H #define __X86EMU_REGS_H #include /*---------------------- Macros and type definitions ----------------------*/ #ifdef PACK #pragma PACK #endif /* * General EAX, EBX, ECX, EDX type registers. Note that for * portability, and speed, the issue of byte swapping is not addressed * in the registers. All registers are stored in the default format * available on the host machine. The only critical issue is that the * registers should line up EXACTLY in the same manner as they do in * the 386. That is: * * EAX & 0xff === AL * EAX & 0xffff == AX * * etc. The result is that alot of the calculations can then be * done using the native instruction set fully. */ #ifdef __BIG_ENDIAN__ typedef struct { u32 e_reg; } I32_reg_t; typedef struct { u16 filler0, x_reg; } I16_reg_t; typedef struct { u8 filler0, filler1, h_reg, l_reg; } I8_reg_t; #else /* !__BIG_ENDIAN__ */ typedef struct { u32 e_reg; } I32_reg_t; typedef struct { u16 x_reg; } I16_reg_t; typedef struct { u8 l_reg, h_reg; } I8_reg_t; #endif /* BIG_ENDIAN */ typedef union { I32_reg_t I32_reg; I16_reg_t I16_reg; I8_reg_t I8_reg; } i386_general_register; struct i386_general_regs { i386_general_register A, B, C, D; }; typedef struct i386_general_regs Gen_reg_t; struct i386_special_regs { i386_general_register SP, BP, SI, DI, IP; u32 FLAGS; }; /* * Segment registers here represent the 16 bit quantities * CS, DS, ES, SS. */ #if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */ # undef CS # undef DS # undef SS # undef ES # undef FS # undef GS #endif struct i386_segment_regs { u16 CS, DS, SS, ES, FS, GS; }; /* 8 bit registers */ #define R_AH gen.A.I8_reg.h_reg #define R_AL gen.A.I8_reg.l_reg #define R_BH gen.B.I8_reg.h_reg #define R_BL gen.B.I8_reg.l_reg #define R_CH gen.C.I8_reg.h_reg #define R_CL gen.C.I8_reg.l_reg #define R_DH gen.D.I8_reg.h_reg #define R_DL gen.D.I8_reg.l_reg /* 16 bit registers */ #define R_AX gen.A.I16_reg.x_reg #define R_BX gen.B.I16_reg.x_reg #define R_CX gen.C.I16_reg.x_reg #define R_DX gen.D.I16_reg.x_reg /* 32 bit extended registers */ #define R_EAX gen.A.I32_reg.e_reg #define R_EBX gen.B.I32_reg.e_reg #define R_ECX gen.C.I32_reg.e_reg #define R_EDX gen.D.I32_reg.e_reg /* special registers */ #define R_SP spc.SP.I16_reg.x_reg #define R_BP spc.BP.I16_reg.x_reg #define R_SI spc.SI.I16_reg.x_reg #define R_DI spc.DI.I16_reg.x_reg #define R_IP spc.IP.I16_reg.x_reg #define R_FLG spc.FLAGS /* special registers */ #define R_ESP spc.SP.I32_reg.e_reg #define R_EBP spc.BP.I32_reg.e_reg #define R_ESI spc.SI.I32_reg.e_reg #define R_EDI spc.DI.I32_reg.e_reg #define R_EIP spc.IP.I32_reg.e_reg #define R_EFLG spc.FLAGS /* segment registers */ #define R_CS seg.CS #define R_DS seg.DS #define R_SS seg.SS #define R_ES seg.ES #define R_FS seg.FS #define R_GS seg.GS /* flag conditions */ #define FB_CF 0x0001 /* CARRY flag */ #define FB_PF 0x0004 /* PARITY flag */ #define FB_AF 0x0010 /* AUX flag */ #define FB_ZF 0x0040 /* ZERO flag */ #define FB_SF 0x0080 /* SIGN flag */ #define FB_TF 0x0100 /* TRAP flag */ #define FB_IF 0x0200 /* INTERRUPT ENABLE flag */ #define FB_DF 0x0400 /* DIR flag */ #define FB_OF 0x0800 /* OVERFLOW flag */ /* 80286 and above always have bit#1 set */ #define F_ALWAYS_ON (0x0002) /* flag bits always on */ /* * Define a mask for only those flag bits we will ever pass back * (via PUSHF) */ #define F_MSK (FB_CF|FB_PF|FB_AF|FB_ZF|FB_SF|FB_TF|FB_IF|FB_DF|FB_OF) /* following bits masked in to a 16bit quantity */ #define F_CF 0x0001 /* CARRY flag */ #define F_PF 0x0004 /* PARITY flag */ #define F_AF 0x0010 /* AUX flag */ #define F_ZF 0x0040 /* ZERO flag */ #define F_SF 0x0080 /* SIGN flag */ #define F_TF 0x0100 /* TRAP flag */ #define F_IF 0x0200 /* INTERRUPT ENABLE flag */ #define F_DF 0x0400 /* DIR flag */ #define F_OF 0x0800 /* OVERFLOW flag */ #define TOGGLE_FLAG(flag) (M.x86.R_FLG ^= (flag)) #define SET_FLAG(flag) (M.x86.R_FLG |= (flag)) #define CLEAR_FLAG(flag) (M.x86.R_FLG &= ~(flag)) #define ACCESS_FLAG(flag) (M.x86.R_FLG & (flag)) #define CLEARALL_FLAG(m) (M.x86.R_FLG = 0) #define CONDITIONAL_SET_FLAG(COND,FLAG) \ if (COND) SET_FLAG(FLAG); else CLEAR_FLAG(FLAG) #define F_PF_CALC 0x010000 /* PARITY flag has been calced */ #define F_ZF_CALC 0x020000 /* ZERO flag has been calced */ #define F_SF_CALC 0x040000 /* SIGN flag has been calced */ #define F_ALL_CALC 0xff0000 /* All have been calced */ /* * Emulator machine state. * Segment usage control. */ #define SYSMODE_SEG_DS_SS 0x00000001 #define SYSMODE_SEGOVR_CS 0x00000002 #define SYSMODE_SEGOVR_DS 0x00000004 #define SYSMODE_SEGOVR_ES 0x00000008 #define SYSMODE_SEGOVR_FS 0x00000010 #define SYSMODE_SEGOVR_GS 0x00000020 #define SYSMODE_SEGOVR_SS 0x00000040 #define SYSMODE_PREFIX_REPE 0x00000080 #define SYSMODE_PREFIX_REPNE 0x00000100 #define SYSMODE_PREFIX_DATA 0x00000200 #define SYSMODE_PREFIX_ADDR 0x00000400 #define SYSMODE_INTR_PENDING 0x10000000 #define SYSMODE_EXTRN_INTR 0x20000000 #define SYSMODE_HALTED 0x40000000 #define SYSMODE_SEGMASK (SYSMODE_SEG_DS_SS | \ SYSMODE_SEGOVR_CS | \ SYSMODE_SEGOVR_DS | \ SYSMODE_SEGOVR_ES | \ SYSMODE_SEGOVR_FS | \ SYSMODE_SEGOVR_GS | \ SYSMODE_SEGOVR_SS) #define SYSMODE_CLRMASK (SYSMODE_SEG_DS_SS | \ SYSMODE_SEGOVR_CS | \ SYSMODE_SEGOVR_DS | \ SYSMODE_SEGOVR_ES | \ SYSMODE_SEGOVR_FS | \ SYSMODE_SEGOVR_GS | \ SYSMODE_SEGOVR_SS | \ SYSMODE_PREFIX_DATA | \ SYSMODE_PREFIX_ADDR) #define INTR_SYNCH 0x1 #define INTR_ASYNCH 0x2 #define INTR_HALTED 0x4 typedef struct { struct i386_general_regs gen; struct i386_special_regs spc; struct i386_segment_regs seg; /* * MODE contains information on: * REPE prefix 2 bits repe,repne * SEGMENT overrides 5 bits normal,DS,SS,CS,ES * Delayed flag set 3 bits (zero, signed, parity) * reserved 6 bits * interrupt # 8 bits instruction raised interrupt * BIOS video segregs 4 bits * Interrupt Pending 1 bits * Extern interrupt 1 bits * Halted 1 bits */ u32 mode; volatile int intr; /* mask of pending interrupts */ int debug; #ifdef DEBUG int check; u16 saved_ip; u16 saved_cs; int enc_pos; int enc_str_pos; char decode_buf[32]; /* encoded byte stream */ char decoded_buf[256]; /* disassembled strings */ #endif u8 intno; u8 __pad[3]; } X86EMU_regs; /**************************************************************************** REMARKS: Structure maintaining the emulator machine state. MEMBERS: mem_base - Base real mode memory for the emulator mem_size - Size of the real mode memory block for the emulator private - private data pointer x86 - X86 registers ****************************************************************************/ typedef struct { unsigned long mem_base; unsigned long mem_size; void *private; X86EMU_regs x86; } X86EMU_sysEnv; #ifdef END_PACK #pragma END_PACK #endif /*----------------------------- Global Variables --------------------------*/ #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif /* Global emulator machine state. * * We keep it global to avoid pointer dereferences in the code for speed. */ extern X86EMU_sysEnv _X86EMU_env; #define M _X86EMU_env /*-------------------------- Function Prototypes --------------------------*/ /* Function to log information at runtime */ void printk(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1, 2); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_REGS_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/debug.h0000644000175000017500000001705713640201473016454 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for debug definitions. * ****************************************************************************/ #ifndef __X86EMU_DEBUG_H #define __X86EMU_DEBUG_H /*---------------------- Macros and type definitions ----------------------*/ /* checks to be enabled for "runtime" */ #define CHECK_IP_FETCH_F 0x1 #define CHECK_SP_ACCESS_F 0x2 #define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */ #define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset */ #ifdef DEBUG #define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F) #define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F) #define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F) #define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F) #else #define CHECK_IP_FETCH() #define CHECK_SP_ACCESS() #define CHECK_MEM_ACCESS() #define CHECK_DATA_ACCESS() #endif #ifdef DEBUG #define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F) #define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F) #define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F) #define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F) #define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F) #define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F) #define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F) #define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F) #define DEBUG_FS() (M.x86.debug & DEBUG_FS_F) #define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F) #define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F) #define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F) #define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F) #define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F) #define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F) #define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F) #define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F) #else #define DEBUG_INSTRUMENT() 0 #define DEBUG_DECODE() 0 #define DEBUG_TRACE() 0 #define DEBUG_STEP() 0 #define DEBUG_DISASSEMBLE() 0 #define DEBUG_BREAK() 0 #define DEBUG_SVC() 0 #define DEBUG_SAVE_IP_CS() 0 #define DEBUG_FS() 0 #define DEBUG_PROC() 0 #define DEBUG_SYSINT() 0 #define DEBUG_TRACECALL() 0 #define DEBUG_TRACECALLREGS() 0 #define DEBUG_SYS() 0 #define DEBUG_MEM_TRACE() 0 #define DEBUG_IO_TRACE() 0 #define DEBUG_DECODE_NOPRINT() 0 #endif #ifdef DEBUG #define DECODE_PRINTF(x) if (DEBUG_DECODE()) \ x86emu_decode_printf("%s",x) #define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \ x86emu_decode_printf(x,y) /* * The following allow us to look at the bytes of an instruction. The * first INCR_INSTRN_LEN, is called everytime bytes are consumed in * the decoding process. The SAVE_IP_CS is called initially when the * major opcode of the instruction is accessed. */ #define INC_DECODED_INST_LEN(x) \ if (DEBUG_DECODE()) \ x86emu_inc_decoded_inst_len(x) #define SAVE_IP_CS(x,y) \ if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \ | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \ M.x86.saved_cs = x; \ M.x86.saved_ip = y; \ } #else #define INC_DECODED_INST_LEN(x) #define DECODE_PRINTF(x) #define DECODE_PRINTF2(x,y) #define SAVE_IP_CS(x,y) #endif #ifdef DEBUG #define TRACE_REGS() \ if (DEBUG_DISASSEMBLE()) { \ x86emu_just_disassemble(); \ goto EndOfTheInstructionProcedure; \ } \ if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs() #else #define TRACE_REGS() #endif #ifdef DEBUG #define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step() #else #define SINGLE_STEP() #endif #define TRACE_AND_STEP() \ TRACE_REGS(); \ SINGLE_STEP() #ifdef DEBUG #define START_OF_INSTR() #define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr(); #define END_OF_INSTR_NO_TRACE() x86emu_end_instr(); #else #define START_OF_INSTR() #define END_OF_INSTR() #define END_OF_INSTR_NO_TRACE() #endif #ifdef DEBUG #define CALL_TRACE(u,v,w,x,s) \ if (DEBUG_TRACECALLREGS()) \ x86emu_dump_regs(); \ if (DEBUG_TRACECALL()) \ printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x); #define RETURN_TRACE(n,u,v) \ if (DEBUG_TRACECALLREGS()) \ x86emu_dump_regs(); \ if (DEBUG_TRACECALL()) \ printk("%04x:%04x: %s\n",u,v,n); #else #define CALL_TRACE(u,v,w,x,s) #define RETURN_TRACE(n,u,v) #endif #ifdef DEBUG #define DB(x) x #else #define DB(x) #endif /*-------------------------- Function Prototypes --------------------------*/ #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif extern void x86emu_inc_decoded_inst_len(int x); extern void x86emu_decode_printf(const char *x, ...) _X_ATTRIBUTE_PRINTF(1,2); extern void x86emu_just_disassemble(void); extern void x86emu_single_step(void); extern void x86emu_end_instr(void); extern void x86emu_dump_regs(void); extern void x86emu_dump_xregs(void); extern void x86emu_print_int_vect(u16 iv); extern void x86emu_instrument_instruction(void); extern void x86emu_check_ip_access(void); extern void x86emu_check_sp_access(void); extern void x86emu_check_mem_access(u32 p); extern void x86emu_check_data_access(uint s, uint o); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_DEBUG_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/types.h0000644000175000017500000000506013640201473016521 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for x86 emulator type definitions. * ****************************************************************************/ #ifndef __X86EMU_TYPES_H #define __X86EMU_TYPES_H #ifndef NO_SYS_HEADERS #include #endif /* * The following kludge is an attempt to work around typedef conflicts with * . */ #define u8 x86emuu8 #define u16 x86emuu16 #define u32 x86emuu32 #define u64 x86emuu64 #define s8 x86emus8 #define s16 x86emus16 #define s32 x86emus32 #define s64 x86emus64 #define uint x86emuuint #define sint x86emusint /*---------------------- Macros and type definitions ----------------------*/ #include #include typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; typedef unsigned int uint; typedef int sint; typedef u16 X86EMU_pioAddr; #endif /* __X86EMU_TYPES_H */ xorg-server-1.20.8/hw/xfree86/x86emu/x86emu/x86emui.h0000644000175000017500000000734313640201473016670 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for system specific functions. These functions * are always compiled and linked in the OS depedent libraries, * and never in a binary portable driver. * ****************************************************************************/ #ifndef __X86EMU_X86EMUI_H #define __X86EMU_X86EMUI_H /* If we are compiling in C++ mode, we can compile some functions as * inline to increase performance (however the code size increases quite * dramatically in this case). */ #if defined(__cplusplus) #define _INLINE inline #else #define _INLINE static #endif /* Get rid of unused parameters in C++ compilation mode */ #ifdef __cplusplus #define X86EMU_UNUSED(v) #else #define X86EMU_UNUSED(v) v #endif #include "x86emu.h" #include "x86emu/regs.h" #include "x86emu/debug.h" #include "x86emu/decode.h" #include "x86emu/ops.h" #include "x86emu/prim_ops.h" #include "x86emu/fpu.h" #include "x86emu/fpu_regs.h" #ifndef NO_SYS_HEADERS #include #include #include /* avoid conflicts with Solaris sys/regset.h */ # if defined(__sun) && defined(CS) # undef CS # undef DS # undef SS # undef ES # undef FS # undef GS # endif #endif /* NO_SYS_HEADERS */ /*--------------------------- Inline Functions ----------------------------*/ #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif extern u8(X86APIP sys_rdb) (u32 addr); extern u16(X86APIP sys_rdw) (u32 addr); extern u32(X86APIP sys_rdl) (u32 addr); extern void (X86APIP sys_wrb) (u32 addr, u8 val); extern void (X86APIP sys_wrw) (u32 addr, u16 val); extern void (X86APIP sys_wrl) (u32 addr, u32 val); extern u8(X86APIP sys_inb) (X86EMU_pioAddr addr); extern u16(X86APIP sys_inw) (X86EMU_pioAddr addr); extern u32(X86APIP sys_inl) (X86EMU_pioAddr addr); extern void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val); extern void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val); extern void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_X86EMUI_H */ xorg-server-1.20.8/hw/xfree86/x86emu/sys.c0000644000175000017500000003606013640201473015036 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file includes subroutines which are related to * programmed I/O and memory access. Included in this module * are default functions with limited usefulness. For real * uses these functions will most likely be overriden by the * user library. * ****************************************************************************/ #include "x86emu.h" #include "x86emu/x86emui.h" #include "x86emu/regs.h" #include "x86emu/debug.h" #include "x86emu/prim_ops.h" #ifndef NO_SYS_HEADERS #include #endif #ifdef __GNUC__ /* Define some packed structures to use with unaligned accesses */ struct __una_u64 { u64 x __attribute__ ((packed)); }; struct __una_u32 { u32 x __attribute__ ((packed)); }; struct __una_u16 { u16 x __attribute__ ((packed)); }; /* Elemental unaligned loads */ static __inline__ u64 ldq_u(u64 * p) { const struct __una_u64 *ptr = (const struct __una_u64 *) p; return ptr->x; } static __inline__ u32 ldl_u(u32 * p) { const struct __una_u32 *ptr = (const struct __una_u32 *) p; return ptr->x; } static __inline__ u16 ldw_u(u16 * p) { const struct __una_u16 *ptr = (const struct __una_u16 *) p; return ptr->x; } /* Elemental unaligned stores */ static __inline__ void stq_u(u64 val, u64 * p) { struct __una_u64 *ptr = (struct __una_u64 *) p; ptr->x = val; } static __inline__ void stl_u(u32 val, u32 * p) { struct __una_u32 *ptr = (struct __una_u32 *) p; ptr->x = val; } static __inline__ void stw_u(u16 val, u16 * p) { struct __una_u16 *ptr = (struct __una_u16 *) p; ptr->x = val; } #else /* !__GNUC__ */ static __inline__ u64 ldq_u(u64 * p) { u64 ret; memmove(&ret, p, sizeof(*p)); return ret; } static __inline__ u32 ldl_u(u32 * p) { u32 ret; memmove(&ret, p, sizeof(*p)); return ret; } static __inline__ u16 ldw_u(u16 * p) { u16 ret; memmove(&ret, p, sizeof(*p)); return ret; } static __inline__ void stq_u(u64 val, u64 * p) { u64 tmp = val; memmove(p, &tmp, sizeof(*p)); } static __inline__ void stl_u(u32 val, u32 * p) { u32 tmp = val; memmove(p, &tmp, sizeof(*p)); } static __inline__ void stw_u(u16 val, u16 * p) { u16 tmp = val; memmove(p, &tmp, sizeof(*p)); } #endif /* __GNUC__ */ /*------------------------- Global Variables ------------------------------*/ X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */ X86EMU_intrFuncs _X86EMU_intrTab[256]; /*----------------------------- Implementation ----------------------------*/ /**************************************************************************** PARAMETERS: addr - Emulator memory address to read RETURNS: Byte value read from emulator memory. REMARKS: Reads a byte value from the emulator memory. ****************************************************************************/ u8 X86API rdb(u32 addr) { u8 val; if (addr > M.mem_size - 1) { DB(printk("mem_read: address %#" PRIx32 " out of range!\n", addr); ) HALT_SYS(); } val = *(u8 *) (M.mem_base + addr); DB(if (DEBUG_MEM_TRACE()) printk("%#08x 1 -> %#x\n", addr, val);) return val; } /**************************************************************************** PARAMETERS: addr - Emulator memory address to read RETURNS: Word value read from emulator memory. REMARKS: Reads a word value from the emulator memory. ****************************************************************************/ u16 X86API rdw(u32 addr) { u16 val = 0; if (addr > M.mem_size - 2) { DB(printk("mem_read: address %#" PRIx32 " out of range!\n", addr); ) HALT_SYS(); } #ifdef __BIG_ENDIAN__ if (addr & 0x1) { val = (*(u8 *) (M.mem_base + addr) | (*(u8 *) (M.mem_base + addr + 1) << 8)); } else #endif val = ldw_u((u16 *) (M.mem_base + addr)); DB(if (DEBUG_MEM_TRACE()) printk("%#08x 2 -> %#x\n", addr, val);) return val; } /**************************************************************************** PARAMETERS: addr - Emulator memory address to read RETURNS: Long value read from emulator memory. REMARKS: Reads a long value from the emulator memory. ****************************************************************************/ u32 X86API rdl(u32 addr) { u32 val = 0; if (addr > M.mem_size - 4) { DB(printk("mem_read: address %#" PRIx32 " out of range!\n", addr); ) HALT_SYS(); } #ifdef __BIG_ENDIAN__ if (addr & 0x3) { val = (*(u8 *) (M.mem_base + addr + 0) | (*(u8 *) (M.mem_base + addr + 1) << 8) | (*(u8 *) (M.mem_base + addr + 2) << 16) | (*(u8 *) (M.mem_base + addr + 3) << 24)); } else #endif val = ldl_u((u32 *) (M.mem_base + addr)); DB(if (DEBUG_MEM_TRACE()) printk("%#08x 4 -> %#x\n", addr, val);) return val; } /**************************************************************************** PARAMETERS: addr - Emulator memory address to read val - Value to store REMARKS: Writes a byte value to emulator memory. ****************************************************************************/ void X86API wrb(u32 addr, u8 val) { DB(if (DEBUG_MEM_TRACE()) printk("%#08x 1 <- %#x\n", addr, val);) if (addr > M.mem_size - 1) { DB(printk("mem_write: address %#" PRIx32 " out of range!\n",addr); ) HALT_SYS(); } *(u8 *) (M.mem_base + addr) = val; } /**************************************************************************** PARAMETERS: addr - Emulator memory address to read val - Value to store REMARKS: Writes a word value to emulator memory. ****************************************************************************/ void X86API wrw(u32 addr, u16 val) { DB(if (DEBUG_MEM_TRACE()) printk("%#08x 2 <- %#x\n", addr, val);) if (addr > M.mem_size - 2) { DB(printk("mem_write: address %#" PRIx32 " out of range!\n",addr); ) HALT_SYS(); } #ifdef __BIG_ENDIAN__ if (addr & 0x1) { *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff; *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff; } else #endif stw_u(val, (u16 *) (M.mem_base + addr)); } /**************************************************************************** PARAMETERS: addr - Emulator memory address to read val - Value to store REMARKS: Writes a long value to emulator memory. ****************************************************************************/ void X86API wrl(u32 addr, u32 val) { DB(if (DEBUG_MEM_TRACE()) printk("%#08x 4 <- %#x\n", addr, val);) if (addr > M.mem_size - 4) { DB(printk("mem_write: address %#" PRIx32 " out of range!\n",addr); ) HALT_SYS(); } #ifdef __BIG_ENDIAN__ if (addr & 0x1) { *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff; *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff; *(u8 *) (M.mem_base + addr + 2) = (val >> 16) & 0xff; *(u8 *) (M.mem_base + addr + 3) = (val >> 24) & 0xff; } else #endif stl_u(val, (u32 *) (M.mem_base + addr)); } /**************************************************************************** PARAMETERS: addr - PIO address to read RETURN: 0 REMARKS: Default PIO byte read function. Doesn't perform real inb. ****************************************************************************/ static u8 X86API p_inb(X86EMU_pioAddr addr) { DB(if (DEBUG_IO_TRACE()) printk("inb %#04x \n", addr);) return 0; } /**************************************************************************** PARAMETERS: addr - PIO address to read RETURN: 0 REMARKS: Default PIO word read function. Doesn't perform real inw. ****************************************************************************/ static u16 X86API p_inw(X86EMU_pioAddr addr) { DB(if (DEBUG_IO_TRACE()) printk("inw %#04x \n", addr);) return 0; } /**************************************************************************** PARAMETERS: addr - PIO address to read RETURN: 0 REMARKS: Default PIO long read function. Doesn't perform real inl. ****************************************************************************/ static u32 X86API p_inl(X86EMU_pioAddr addr) { DB(if (DEBUG_IO_TRACE()) printk("inl %#04x \n", addr);) return 0; } /**************************************************************************** PARAMETERS: addr - PIO address to write val - Value to store REMARKS: Default PIO byte write function. Doesn't perform real outb. ****************************************************************************/ static void X86API p_outb(X86EMU_pioAddr addr, u8 val) { DB(if (DEBUG_IO_TRACE()) printk("outb %#02x -> %#04x \n", val, addr);) return; } /**************************************************************************** PARAMETERS: addr - PIO address to write val - Value to store REMARKS: Default PIO word write function. Doesn't perform real outw. ****************************************************************************/ static void X86API p_outw(X86EMU_pioAddr addr, u16 val) { DB(if (DEBUG_IO_TRACE()) printk("outw %#04x -> %#04x \n", val, addr);) return; } /**************************************************************************** PARAMETERS: addr - PIO address to write val - Value to store REMARKS: Default PIO ;ong write function. Doesn't perform real outl. ****************************************************************************/ static void X86API p_outl(X86EMU_pioAddr addr, u32 val) { DB(if (DEBUG_IO_TRACE()) printk("outl %#08x -> %#04x \n", val, addr);) return; } /*------------------------- Global Variables ------------------------------*/ u8(X86APIP sys_rdb) (u32 addr) = rdb; u16(X86APIP sys_rdw) (u32 addr) = rdw; u32(X86APIP sys_rdl) (u32 addr) = rdl; void (X86APIP sys_wrb) (u32 addr, u8 val) = wrb; void (X86APIP sys_wrw) (u32 addr, u16 val) = wrw; void (X86APIP sys_wrl) (u32 addr, u32 val) = wrl; u8(X86APIP sys_inb) (X86EMU_pioAddr addr) = p_inb; u16(X86APIP sys_inw) (X86EMU_pioAddr addr) = p_inw; u32(X86APIP sys_inl) (X86EMU_pioAddr addr) = p_inl; void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val) = p_outb; void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val) = p_outw; void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val) = p_outl; /*----------------------------- Setup -------------------------------------*/ /**************************************************************************** PARAMETERS: funcs - New memory function pointers to make active REMARKS: This function is used to set the pointers to functions which access memory space, allowing the user application to override these functions and hook them out as necessary for their application. ****************************************************************************/ void X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs) { sys_rdb = funcs->rdb; sys_rdw = funcs->rdw; sys_rdl = funcs->rdl; sys_wrb = funcs->wrb; sys_wrw = funcs->wrw; sys_wrl = funcs->wrl; } /**************************************************************************** PARAMETERS: funcs - New programmed I/O function pointers to make active REMARKS: This function is used to set the pointers to functions which access I/O space, allowing the user application to override these functions and hook them out as necessary for their application. ****************************************************************************/ void X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs) { sys_inb = funcs->inb; sys_inw = funcs->inw; sys_inl = funcs->inl; sys_outb = funcs->outb; sys_outw = funcs->outw; sys_outl = funcs->outl; } /**************************************************************************** PARAMETERS: funcs - New interrupt vector table to make active REMARKS: This function is used to set the pointers to functions which handle interrupt processing in the emulator, allowing the user application to hook interrupts as necessary for their application. Any interrupts that are not hooked by the user application, and reflected and handled internally in the emulator via the interrupt vector table. This allows the application to get control when the code being emulated executes specific software interrupts. ****************************************************************************/ void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]) { int i; for (i = 0; i < 256; i++) _X86EMU_intrTab[i] = NULL; if (funcs) { for (i = 0; i < 256; i++) _X86EMU_intrTab[i] = funcs[i]; } } /**************************************************************************** PARAMETERS: int - New software interrupt to prepare for REMARKS: This function is used to set up the emulator state to exceute a software interrupt. This can be used by the user application code to allow an interrupt to be hooked, examined and then reflected back to the emulator so that the code in the emulator will continue processing the software interrupt as per normal. This essentially allows system code to actively hook and handle certain software interrupts as necessary. ****************************************************************************/ void X86EMU_prepareForInt(int num) { push_word((u16) M.x86.R_FLG); CLEAR_FLAG(F_IF); CLEAR_FLAG(F_TF); push_word(M.x86.R_CS); M.x86.R_CS = mem_access_word(num * 4 + 2); push_word(M.x86.R_IP); M.x86.R_IP = mem_access_word(num * 4); M.x86.intr = 0; } xorg-server-1.20.8/hw/xfree86/x86emu/x86emu.h0000644000175000017500000001635413640201473015365 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: Header file for public specific functions. * Any application linking against us should only * include this header * ****************************************************************************/ #ifndef __X86EMU_X86EMU_H #define __X86EMU_X86EMU_H #ifdef SCITECH #include "scitech.h" #define X86API _ASMAPI #define X86APIP _ASMAPIP typedef int X86EMU_pioAddr; #else #include "x86emu/types.h" #define X86API #define X86APIP * #endif #include "x86emu/regs.h" /*---------------------- Macros and type definitions ----------------------*/ #ifdef PACK #pragma PACK /* Don't pack structs with function pointers! */ #endif /**************************************************************************** REMARKS: Data structure containing ponters to programmed I/O functions used by the emulator. This is used so that the user program can hook all programmed I/O for the emulator to handled as necessary by the user program. By default the emulator contains simple functions that do not do access the hardware in any way. To allow the emualtor access the hardware, you will need to override the programmed I/O functions using the X86EMU_setupPioFuncs function. HEADER: x86emu.h MEMBERS: inb - Function to read a byte from an I/O port inw - Function to read a word from an I/O port inl - Function to read a dword from an I/O port outb - Function to write a byte to an I/O port outw - Function to write a word to an I/O port outl - Function to write a dword to an I/O port ****************************************************************************/ typedef struct { u8(X86APIP inb) (X86EMU_pioAddr addr); u16(X86APIP inw) (X86EMU_pioAddr addr); u32(X86APIP inl) (X86EMU_pioAddr addr); void (X86APIP outb) (X86EMU_pioAddr addr, u8 val); void (X86APIP outw) (X86EMU_pioAddr addr, u16 val); void (X86APIP outl) (X86EMU_pioAddr addr, u32 val); } X86EMU_pioFuncs; /**************************************************************************** REMARKS: Data structure containing ponters to memory access functions used by the emulator. This is used so that the user program can hook all memory access functions as necessary for the emulator. By default the emulator contains simple functions that only access the internal memory of the emulator. If you need specialised functions to handle access to different types of memory (ie: hardware framebuffer accesses and BIOS memory access etc), you will need to override this using the X86EMU_setupMemFuncs function. HEADER: x86emu.h MEMBERS: rdb - Function to read a byte from an address rdw - Function to read a word from an address rdl - Function to read a dword from an address wrb - Function to write a byte to an address wrw - Function to write a word to an address wrl - Function to write a dword to an address ****************************************************************************/ typedef struct { u8(X86APIP rdb) (u32 addr); u16(X86APIP rdw) (u32 addr); u32(X86APIP rdl) (u32 addr); void (X86APIP wrb) (u32 addr, u8 val); void (X86APIP wrw) (u32 addr, u16 val); void (X86APIP wrl) (u32 addr, u32 val); } X86EMU_memFuncs; /**************************************************************************** Here are the default memory read and write function in case they are needed as fallbacks. ***************************************************************************/ extern u8 X86API rdb(u32 addr); extern u16 X86API rdw(u32 addr); extern u32 X86API rdl(u32 addr); extern void X86API wrb(u32 addr, u8 val); extern void X86API wrw(u32 addr, u16 val); extern void X86API wrl(u32 addr, u32 val); #ifdef END_PACK #pragma END_PACK #endif /*--------------------- type definitions -----------------------------------*/ typedef void (X86APIP X86EMU_intrFuncs) (int num); extern X86EMU_intrFuncs _X86EMU_intrTab[256]; /*-------------------------- Function Prototypes --------------------------*/ #ifdef __cplusplus extern "C" { /* Use "C" linkage when in C++ mode */ #endif void X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs); void X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs); void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]); void X86EMU_prepareForInt(int num); /* decode.c */ void X86EMU_exec(void); void X86EMU_halt_sys(void); #ifdef DEBUG #define HALT_SYS() \ printk("halt_sys: file %s, line %d\n", __FILE__, __LINE__), \ X86EMU_halt_sys() #else #define HALT_SYS() X86EMU_halt_sys() #endif /* Debug options */ #define DEBUG_DECODE_F 0x000001 /* print decoded instruction */ #define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */ #define DEBUG_STEP_F 0x000004 #define DEBUG_DISASSEMBLE_F 0x000008 #define DEBUG_BREAK_F 0x000010 #define DEBUG_SVC_F 0x000020 #define DEBUG_SAVE_IP_CS_F 0x000040 #define DEBUG_FS_F 0x000080 #define DEBUG_PROC_F 0x000100 #define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */ #define DEBUG_TRACECALL_F 0x000400 #define DEBUG_INSTRUMENT_F 0x000800 #define DEBUG_MEM_TRACE_F 0x001000 #define DEBUG_IO_TRACE_F 0x002000 #define DEBUG_TRACECALL_REGS_F 0x004000 #define DEBUG_DECODE_NOPRINT_F 0x008000 #define DEBUG_EXIT 0x010000 #define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F) void X86EMU_trace_regs(void); void X86EMU_trace_xregs(void); void X86EMU_dump_memory(u16 seg, u16 off, u32 amt); int X86EMU_trace_on(void); int X86EMU_trace_off(void); #ifdef __cplusplus } /* End of "C" linkage for C++ */ #endif #endif /* __X86EMU_X86EMU_H */ xorg-server-1.20.8/hw/xfree86/x86emu/Makefile.in0000644000175000017500000006673113640201514016125 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/x86emu ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libx86emu_la_LIBADD = am_libx86emu_la_OBJECTS = debug.lo decode.lo fpu.lo ops2.lo ops.lo \ prim_ops.lo sys.lo libx86emu_la_OBJECTS = $(am_libx86emu_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = @INT10_X86EMU_TRUE@am_libx86emu_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/debug.Plo ./$(DEPDIR)/decode.Plo \ ./$(DEPDIR)/fpu.Plo ./$(DEPDIR)/ops.Plo ./$(DEPDIR)/ops2.Plo \ ./$(DEPDIR)/prim_ops.Plo ./$(DEPDIR)/sys.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libx86emu_la_SOURCES) DIST_SOURCES = $(libx86emu_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @INT10_X86EMU_TRUE@noinst_LTLIBRARIES = libx86emu.la libx86emu_la_SOURCES = debug.c \ decode.c \ fpu.c \ ops2.c \ ops.c \ prim_ops.c \ sys.c \ x86emu.h AM_CPPFLAGS = AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = validate.c \ x86emu/debug.h \ x86emu/decode.h \ x86emu/fpu.h \ x86emu/fpu_regs.h \ x86emu/ops.h \ x86emu/prim_asm.h \ x86emu/prim_ops.h \ x86emu/prim_x86_gcc.h \ x86emu/regs.h \ x86emu/types.h \ x86emu/x86emui.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/x86emu/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/x86emu/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libx86emu.la: $(libx86emu_la_OBJECTS) $(libx86emu_la_DEPENDENCIES) $(EXTRA_libx86emu_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libx86emu_la_rpath) $(libx86emu_la_OBJECTS) $(libx86emu_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpu.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ops.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ops2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prim_ops.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/debug.Plo -rm -f ./$(DEPDIR)/decode.Plo -rm -f ./$(DEPDIR)/fpu.Plo -rm -f ./$(DEPDIR)/ops.Plo -rm -f ./$(DEPDIR)/ops2.Plo -rm -f ./$(DEPDIR)/prim_ops.Plo -rm -f ./$(DEPDIR)/sys.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/debug.Plo -rm -f ./$(DEPDIR)/decode.Plo -rm -f ./$(DEPDIR)/fpu.Plo -rm -f ./$(DEPDIR)/ops.Plo -rm -f ./$(DEPDIR)/ops2.Plo -rm -f ./$(DEPDIR)/prim_ops.Plo -rm -f ./$(DEPDIR)/sys.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/x86emu/debug.c0000644000175000017500000003006313640201473015303 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file contains the code to handle debugging of the * emulator. * ****************************************************************************/ #include "x86emu/x86emui.h" #include #include #include #ifndef NO_SYS_HEADERS #include #endif /*----------------------------- Implementation ----------------------------*/ #ifdef DEBUG static void print_encoded_bytes(u16 s, u16 o); static void print_decoded_instruction(void); static int parse_line(char *s, int *ps, int *n); /* should look something like debug's output. */ void X86EMU_trace_regs(void) { if (DEBUG_TRACE()) { x86emu_dump_regs(); } if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) { printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip); print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip); print_decoded_instruction(); } } void X86EMU_trace_xregs(void) { if (DEBUG_TRACE()) { x86emu_dump_xregs(); } } void x86emu_just_disassemble(void) { /* * This routine called if the flag DEBUG_DISASSEMBLE is set kind * of a hack! */ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip); print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip); print_decoded_instruction(); } static void disassemble_forward(u16 seg, u16 off, int n) { X86EMU_sysEnv tregs; int i; u8 op1; /* * hack, hack, hack. What we do is use the exact machinery set up * for execution, except that now there is an additional state * flag associated with the "execution", and we are using a copy * of the register struct. All the major opcodes, once fully * decoded, have the following two steps: TRACE_REGS(r,m); * SINGLE_STEP(r,m); which disappear if DEBUG is not defined to * the preprocessor. The TRACE_REGS macro expands to: * * if (debug&DEBUG_DISASSEMBLE) * {just_disassemble(); goto EndOfInstruction;} * if (debug&DEBUG_TRACE) trace_regs(r,m); * * ...... and at the last line of the routine. * * EndOfInstruction: end_instr(); * * Up to the point where TRACE_REG is expanded, NO modifications * are done to any register EXCEPT the IP register, for fetch and * decoding purposes. * * This was done for an entirely different reason, but makes a * nice way to get the system to help debug codes. */ tregs = M; tregs.x86.R_IP = off; tregs.x86.R_CS = seg; /* reset the decoding buffers */ tregs.x86.enc_str_pos = 0; tregs.x86.enc_pos = 0; /* turn on the "disassemble only, no execute" flag */ tregs.x86.debug |= DEBUG_DISASSEMBLE_F; /* DUMP NEXT n instructions to screen in straight_line fashion */ /* * This looks like the regular instruction fetch stream, except * that when this occurs, each fetched opcode, upon seeing the * DEBUG_DISASSEMBLE flag set, exits immediately after decoding * the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!! * Note the use of a copy of the register structure... */ for (i = 0; i < n; i++) { op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++)); (x86emu_optab[op1]) (op1); } /* end major hack mode. */ } void x86emu_check_ip_access(void) { /* NULL as of now */ } void x86emu_check_sp_access(void) { } void x86emu_check_mem_access(u32 dummy) { /* check bounds, etc */ } void x86emu_check_data_access(uint dummy1, uint dummy2) { /* check bounds, etc */ } void x86emu_inc_decoded_inst_len(int x) { M.x86.enc_pos += x; } void x86emu_decode_printf(const char *x, ...) { va_list ap; char temp[100]; va_start(ap, x); vsnprintf(temp, sizeof(temp), x, ap); va_end(ap); sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp); M.x86.enc_str_pos += strlen(temp); } void x86emu_end_instr(void) { M.x86.enc_str_pos = 0; M.x86.enc_pos = 0; } static void print_encoded_bytes(u16 s, u16 o) { int i; char buf1[64]; for (i = 0; i < M.x86.enc_pos; i++) { sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i)); } printk("%-20s", buf1); } static void print_decoded_instruction(void) { printk("%s", M.x86.decoded_buf); } void x86emu_print_int_vect(u16 iv) { u16 seg, off; if (iv > 256) return; seg = fetch_data_word_abs(0, iv * 4); off = fetch_data_word_abs(0, iv * 4 + 2); printk("%04x:%04x ", seg, off); } void X86EMU_dump_memory(u16 seg, u16 off, u32 amt) { u32 start = off & 0xfffffff0; u32 end = (off + 16) & 0xfffffff0; u32 i; while (end <= off + amt) { printk("%04x:%04x ", seg, start); for (i = start; i < off; i++) printk(" "); for (; i < end; i++) printk("%02x ", fetch_data_byte_abs(seg, i)); printk("\n"); start = end; end = start + 16; } } void x86emu_single_step(void) { char s[1024]; int ps[10]; int ntok; int cmd; int done; int segment; int offset; static int breakpoint; static int noDecode = 1; if (DEBUG_BREAK()) { if (M.x86.saved_ip != breakpoint) { return; } else { M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; M.x86.debug |= DEBUG_TRACE_F; M.x86.debug &= ~DEBUG_BREAK_F; print_decoded_instruction(); X86EMU_trace_regs(); } } done = 0; offset = M.x86.saved_ip; while (!done) { printk("-"); (void)fgets(s, 1023, stdin); cmd = parse_line(s, ps, &ntok); switch (cmd) { case 'u': disassemble_forward(M.x86.saved_cs, (u16) offset, 10); break; case 'd': if (ntok == 2) { segment = M.x86.saved_cs; offset = ps[1]; X86EMU_dump_memory(segment, (u16) offset, 16); offset += 16; } else if (ntok == 3) { segment = ps[1]; offset = ps[2]; X86EMU_dump_memory(segment, (u16) offset, 16); offset += 16; } else { segment = M.x86.saved_cs; X86EMU_dump_memory(segment, (u16) offset, 16); offset += 16; } break; case 'c': M.x86.debug ^= DEBUG_TRACECALL_F; break; case 's': M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F; break; case 'r': X86EMU_trace_regs(); break; case 'x': X86EMU_trace_xregs(); break; case 'g': if (ntok == 2) { breakpoint = ps[1]; if (noDecode) { M.x86.debug |= DEBUG_DECODE_NOPRINT_F; } else { M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; } M.x86.debug &= ~DEBUG_TRACE_F; M.x86.debug |= DEBUG_BREAK_F; done = 1; } break; case 'q': M.x86.debug |= DEBUG_EXIT; return; case 'P': noDecode = (noDecode) ? 0 : 1; printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE"); break; case 't': case 0: done = 1; break; } } } int X86EMU_trace_on(void) { return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F; } int X86EMU_trace_off(void) { return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F); } static int parse_line(char *s, int *ps, int *n) { int cmd; *n = 0; while (*s == ' ' || *s == '\t') s++; ps[*n] = *s; switch (*s) { case '\n': *n += 1; return 0; default: cmd = *s; *n += 1; } while (1) { while (*s != ' ' && *s != '\t' && *s != '\n') s++; if (*s == '\n') return cmd; while (*s == ' ' || *s == '\t') s++; sscanf(s, "%x", &ps[*n]); *n += 1; } } #endif /* DEBUG */ void x86emu_dump_regs(void) { printk("\tAX=%04x ", M.x86.R_AX); printk("BX=%04x ", M.x86.R_BX); printk("CX=%04x ", M.x86.R_CX); printk("DX=%04x ", M.x86.R_DX); printk("SP=%04x ", M.x86.R_SP); printk("BP=%04x ", M.x86.R_BP); printk("SI=%04x ", M.x86.R_SI); printk("DI=%04x\n", M.x86.R_DI); printk("\tDS=%04x ", M.x86.R_DS); printk("ES=%04x ", M.x86.R_ES); printk("SS=%04x ", M.x86.R_SS); printk("CS=%04x ", M.x86.R_CS); printk("IP=%04x ", M.x86.R_IP); if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */ else printk("NV "); if (ACCESS_FLAG(F_DF)) printk("DN "); else printk("UP "); if (ACCESS_FLAG(F_IF)) printk("EI "); else printk("DI "); if (ACCESS_FLAG(F_SF)) printk("NG "); else printk("PL "); if (ACCESS_FLAG(F_ZF)) printk("ZR "); else printk("NZ "); if (ACCESS_FLAG(F_AF)) printk("AC "); else printk("NA "); if (ACCESS_FLAG(F_PF)) printk("PE "); else printk("PO "); if (ACCESS_FLAG(F_CF)) printk("CY "); else printk("NC "); printk("\n"); } void x86emu_dump_xregs(void) { printk("\tEAX=%08x ", M.x86.R_EAX); printk("EBX=%08x ", M.x86.R_EBX); printk("ECX=%08x ", M.x86.R_ECX); printk("EDX=%08x \n", M.x86.R_EDX); printk("\tESP=%08x ", M.x86.R_ESP); printk("EBP=%08x ", M.x86.R_EBP); printk("ESI=%08x ", M.x86.R_ESI); printk("EDI=%08x\n", M.x86.R_EDI); printk("\tDS=%04x ", M.x86.R_DS); printk("ES=%04x ", M.x86.R_ES); printk("SS=%04x ", M.x86.R_SS); printk("CS=%04x ", M.x86.R_CS); printk("EIP=%08x\n\t", M.x86.R_EIP); if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */ else printk("NV "); if (ACCESS_FLAG(F_DF)) printk("DN "); else printk("UP "); if (ACCESS_FLAG(F_IF)) printk("EI "); else printk("DI "); if (ACCESS_FLAG(F_SF)) printk("NG "); else printk("PL "); if (ACCESS_FLAG(F_ZF)) printk("ZR "); else printk("NZ "); if (ACCESS_FLAG(F_AF)) printk("AC "); else printk("NA "); if (ACCESS_FLAG(F_PF)) printk("PE "); else printk("PO "); if (ACCESS_FLAG(F_CF)) printk("CY "); else printk("NC "); printk("\n"); } xorg-server-1.20.8/hw/xfree86/x86emu/validate.c0000644000175000017500000012415013640201473016007 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: Watcom C 10.6 or later * Environment: 32-bit DOS * Developer: Kendall Bennett * * Description: Program to validate the x86 emulator library for * correctness. We run the emulator primitive operations * functions against the real x86 CPU, and compare the result * and flags to ensure correctness. * * We use inline assembler to compile and build this program. * ****************************************************************************/ #include #include #include #include #include "x86emu.h" #include "x86emu/prim_asm.h" /*-------------------------- Implementation -------------------------------*/ #define true 1 #define false 0 #define ALL_FLAGS (F_CF | F_PF | F_AF | F_ZF | F_SF | F_OF) #define VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \ { \ parm_type d,s; \ res_type r,r_asm; \ ulong flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < dmax; d += dincr) { \ for (s = 0; s < smax; s += sincr) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { #define VAL_TEST_BINARY(name) \ r_asm = name##_asm(&flags,d,s); \ r = name(d,s); \ if (r != r_asm || M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { #define VAL_TEST_BINARY_VOID(name) \ name##_asm(&flags,d,s); \ name(d,s); \ r = r_asm = 0; \ if (M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { #define VAL_FAIL_BYTE_BYTE_BINARY(name) \ if (failed) \ printk("fail\n"); \ printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_FAIL_WORD_WORD_BINARY(name) \ if (failed) \ printk("fail\n"); \ printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_FAIL_LONG_LONG_BINARY(name) \ if (failed) \ printk("fail\n"); \ printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_END_BINARY() \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_BYTE_BYTE_BINARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \ VAL_TEST_BINARY(name) \ VAL_FAIL_BYTE_BYTE_BINARY(name) \ VAL_END_BINARY() #define VAL_WORD_WORD_BINARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \ VAL_TEST_BINARY(name) \ VAL_FAIL_WORD_WORD_BINARY(name) \ VAL_END_BINARY() #define VAL_LONG_LONG_BINARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \ VAL_TEST_BINARY(name) \ VAL_FAIL_LONG_LONG_BINARY(name) \ VAL_END_BINARY() #define VAL_VOID_BYTE_BINARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \ VAL_TEST_BINARY_VOID(name) \ VAL_FAIL_BYTE_BYTE_BINARY(name) \ VAL_END_BINARY() #define VAL_VOID_WORD_BINARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \ VAL_TEST_BINARY_VOID(name) \ VAL_FAIL_WORD_WORD_BINARY(name) \ VAL_END_BINARY() #define VAL_VOID_LONG_BINARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \ VAL_TEST_BINARY_VOID(name) \ VAL_FAIL_LONG_LONG_BINARY(name) \ VAL_END_BINARY() #define VAL_BYTE_ROTATE(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u8,u8,0xFF,8,1,1) \ VAL_TEST_BINARY(name) \ VAL_FAIL_BYTE_BYTE_BINARY(name) \ VAL_END_BINARY() #define VAL_WORD_ROTATE(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u16,u16,0xFF00,16,0x100,1) \ VAL_TEST_BINARY(name) \ VAL_FAIL_WORD_WORD_BINARY(name) \ VAL_END_BINARY() #define VAL_LONG_ROTATE(name) \ printk("Validating %s ... ", #name); \ VAL_START_BINARY(u32,u32,0xFF000000,32,0x1000000,1) \ VAL_TEST_BINARY(name) \ VAL_FAIL_LONG_LONG_BINARY(name) \ VAL_END_BINARY() #define VAL_START_TERNARY(parm_type,res_type,dmax,smax,dincr,sincr,maxshift)\ { \ parm_type d,s; \ res_type r,r_asm; \ u8 shift; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < dmax; d += dincr) { \ for (s = 0; s < smax; s += sincr) { \ for (shift = 0; shift < maxshift; shift += 1) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { #define VAL_TEST_TERNARY(name) \ r_asm = name##_asm(&flags,d,s,shift); \ r = name(d,s,shift); \ if (r != r_asm || M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { #define VAL_FAIL_WORD_WORD_TERNARY(name) \ if (failed) \ printk("fail\n"); \ printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \ r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \ r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_FAIL_LONG_LONG_TERNARY(name) \ if (failed) \ printk("fail\n"); \ printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \ r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \ r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_END_TERNARY() \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_WORD_ROTATE_DBL(name) \ printk("Validating %s ... ", #name); \ VAL_START_TERNARY(u16,u16,0xFF00,0xFF00,0x100,0x100,16) \ VAL_TEST_TERNARY(name) \ VAL_FAIL_WORD_WORD_TERNARY(name) \ VAL_END_TERNARY() #define VAL_LONG_ROTATE_DBL(name) \ printk("Validating %s ... ", #name); \ VAL_START_TERNARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000,32) \ VAL_TEST_TERNARY(name) \ VAL_FAIL_LONG_LONG_TERNARY(name) \ VAL_END_TERNARY() #define VAL_START_UNARY(parm_type,max,incr) \ { \ parm_type d,r,r_asm; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < max; d += incr) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { #define VAL_TEST_UNARY(name) \ r_asm = name##_asm(&flags,d); \ r = name(d); \ if (r != r_asm || M.x86.R_EFLG != flags) { \ failed = true; #define VAL_FAIL_BYTE_UNARY(name) \ printk("fail\n"); \ printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_FAIL_WORD_UNARY(name) \ printk("fail\n"); \ printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_FAIL_LONG_UNARY(name) \ printk("fail\n"); \ printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); #define VAL_END_UNARY() \ } \ M.x86.R_EFLG = inflags = flags = def_flags | ALL_FLAGS; \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_BYTE_UNARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_UNARY(u8,0xFF,0x1) \ VAL_TEST_UNARY(name) \ VAL_FAIL_BYTE_UNARY(name) \ VAL_END_UNARY() #define VAL_WORD_UNARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_UNARY(u16,0xFF00,0x100) \ VAL_TEST_UNARY(name) \ VAL_FAIL_WORD_UNARY(name) \ VAL_END_UNARY() #define VAL_WORD_BYTE_UNARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_UNARY(u16,0xFF,0x1) \ VAL_TEST_UNARY(name) \ VAL_FAIL_WORD_UNARY(name) \ VAL_END_UNARY() #define VAL_LONG_UNARY(name) \ printk("Validating %s ... ", #name); \ VAL_START_UNARY(u32,0xFF000000,0x1000000) \ VAL_TEST_UNARY(name) \ VAL_FAIL_LONG_UNARY(name) \ VAL_END_UNARY() #define VAL_BYTE_MUL(name) \ printk("Validating %s ... ", #name); \ { \ u8 d,s; \ u16 r,r_asm; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < 0xFF; d += 1) { \ for (s = 0; s < 0xFF; s += 1) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { \ name##_asm(&flags,&r_asm,d,s); \ M.x86.R_AL = d; \ name(s); \ r = M.x86.R_AX; \ if (r != r_asm || M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { \ if (failed) \ printk("fail\n"); \ printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_WORD_MUL(name) \ printk("Validating %s ... ", #name); \ { \ u16 d,s; \ u16 r_lo,r_asm_lo; \ u16 r_hi,r_asm_hi; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < 0xFF00; d += 0x100) { \ for (s = 0; s < 0xFF00; s += 0x100) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { \ name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \ M.x86.R_AX = d; \ name(s); \ r_lo = M.x86.R_AX; \ r_hi = M.x86.R_DX; \ if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\ failed = true; \ if (failed || trace) { \ if (failed) \ printk("fail\n"); \ printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_LONG_MUL(name) \ printk("Validating %s ... ", #name); \ { \ u32 d,s; \ u32 r_lo,r_asm_lo; \ u32 r_hi,r_asm_hi; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < 0xFF000000; d += 0x1000000) { \ for (s = 0; s < 0xFF000000; s += 0x1000000) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { \ name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \ M.x86.R_EAX = d; \ name(s); \ r_lo = M.x86.R_EAX; \ r_hi = M.x86.R_EDX; \ if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\ failed = true; \ if (failed || trace) { \ if (failed) \ printk("fail\n"); \ printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_BYTE_DIV(name) \ printk("Validating %s ... ", #name); \ { \ u16 d,s; \ u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < 0xFF00; d += 0x100) { \ for (s = 1; s < 0xFF; s += 1) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { \ M.x86.intr = 0; \ M.x86.R_AX = d; \ name(s); \ r_quot = M.x86.R_AL; \ r_rem = M.x86.R_AH; \ if (M.x86.intr & INTR_SYNCH) \ continue; \ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { \ if (failed) \ printk("fail\n"); \ printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \ r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \ r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_WORD_DIV(name) \ printk("Validating %s ... ", #name); \ { \ u32 d,s; \ u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < 0xFF000000; d += 0x1000000) { \ for (s = 0x100; s < 0xFF00; s += 0x100) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { \ M.x86.intr = 0; \ M.x86.R_AX = d & 0xFFFF; \ M.x86.R_DX = d >> 16; \ name(s); \ r_quot = M.x86.R_AX; \ r_rem = M.x86.R_DX; \ if (M.x86.intr & INTR_SYNCH) \ continue; \ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { \ if (failed) \ printk("fail\n"); \ printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \ r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \ r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } #define VAL_LONG_DIV(name) \ printk("Validating %s ... ", #name); \ { \ u32 d,s; \ u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ for (d = 0; d < 0xFF000000; d += 0x1000000) { \ for (s = 0x100; s < 0xFF00; s += 0x100) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { \ M.x86.intr = 0; \ M.x86.R_EAX = d; \ M.x86.R_EDX = 0; \ name(s); \ r_quot = M.x86.R_EAX; \ r_rem = M.x86.R_EDX; \ if (M.x86.intr & INTR_SYNCH) \ continue; \ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ failed = true; \ if (failed || trace) { \ if (failed) \ printk("fail\n"); \ printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \ r_quot, r_rem, #name, 0, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \ r_asm_quot, r_asm_rem, #name"_asm", 0, d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ } \ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (failed) \ break; \ } \ if (!failed) \ printk("passed\n"); \ } void printk(const char *fmt, ...) { va_list argptr; va_start(argptr, fmt); vfprintf(stdout, fmt, argptr); fflush(stdout); va_end(argptr); } char * print_flags(char *buf, ulong flags) { char *separator = ""; buf[0] = 0; if (flags & F_CF) { strcat(buf, separator); strcat(buf, "CF"); separator = ","; } if (flags & F_PF) { strcat(buf, separator); strcat(buf, "PF"); separator = ","; } if (flags & F_AF) { strcat(buf, separator); strcat(buf, "AF"); separator = ","; } if (flags & F_ZF) { strcat(buf, separator); strcat(buf, "ZF"); separator = ","; } if (flags & F_SF) { strcat(buf, separator); strcat(buf, "SF"); separator = ","; } if (flags & F_OF) { strcat(buf, separator); strcat(buf, "OF"); separator = ","; } if (separator[0] == 0) strcpy(buf, "None"); return buf; } int main(int argc) { ulong def_flags; int trace = false; if (argc > 1) trace = true; memset(&M, 0, sizeof(M)); def_flags = get_flags_asm() & ~ALL_FLAGS; VAL_WORD_UNARY(aaa_word); VAL_WORD_UNARY(aas_word); VAL_WORD_UNARY(aad_word); VAL_WORD_UNARY(aam_word); VAL_BYTE_BYTE_BINARY(adc_byte); VAL_WORD_WORD_BINARY(adc_word); VAL_LONG_LONG_BINARY(adc_long); VAL_BYTE_BYTE_BINARY(add_byte); VAL_WORD_WORD_BINARY(add_word); VAL_LONG_LONG_BINARY(add_long); VAL_BYTE_BYTE_BINARY(and_byte); VAL_WORD_WORD_BINARY(and_word); VAL_LONG_LONG_BINARY(and_long); VAL_BYTE_BYTE_BINARY(cmp_byte); VAL_WORD_WORD_BINARY(cmp_word); VAL_LONG_LONG_BINARY(cmp_long); VAL_BYTE_UNARY(daa_byte); VAL_BYTE_UNARY(das_byte); /* Fails for 0x9A (out of range anyway) */ VAL_BYTE_UNARY(dec_byte); VAL_WORD_UNARY(dec_word); VAL_LONG_UNARY(dec_long); VAL_BYTE_UNARY(inc_byte); VAL_WORD_UNARY(inc_word); VAL_LONG_UNARY(inc_long); VAL_BYTE_BYTE_BINARY(or_byte); VAL_WORD_WORD_BINARY(or_word); VAL_LONG_LONG_BINARY(or_long); VAL_BYTE_UNARY(neg_byte); VAL_WORD_UNARY(neg_word); VAL_LONG_UNARY(neg_long); VAL_BYTE_UNARY(not_byte); VAL_WORD_UNARY(not_word); VAL_LONG_UNARY(not_long); VAL_BYTE_ROTATE(rcl_byte); VAL_WORD_ROTATE(rcl_word); VAL_LONG_ROTATE(rcl_long); VAL_BYTE_ROTATE(rcr_byte); VAL_WORD_ROTATE(rcr_word); VAL_LONG_ROTATE(rcr_long); VAL_BYTE_ROTATE(rol_byte); VAL_WORD_ROTATE(rol_word); VAL_LONG_ROTATE(rol_long); VAL_BYTE_ROTATE(ror_byte); VAL_WORD_ROTATE(ror_word); VAL_LONG_ROTATE(ror_long); VAL_BYTE_ROTATE(shl_byte); VAL_WORD_ROTATE(shl_word); VAL_LONG_ROTATE(shl_long); VAL_BYTE_ROTATE(shr_byte); VAL_WORD_ROTATE(shr_word); VAL_LONG_ROTATE(shr_long); VAL_BYTE_ROTATE(sar_byte); VAL_WORD_ROTATE(sar_word); VAL_LONG_ROTATE(sar_long); VAL_WORD_ROTATE_DBL(shld_word); VAL_LONG_ROTATE_DBL(shld_long); VAL_WORD_ROTATE_DBL(shrd_word); VAL_LONG_ROTATE_DBL(shrd_long); VAL_BYTE_BYTE_BINARY(sbb_byte); VAL_WORD_WORD_BINARY(sbb_word); VAL_LONG_LONG_BINARY(sbb_long); VAL_BYTE_BYTE_BINARY(sub_byte); VAL_WORD_WORD_BINARY(sub_word); VAL_LONG_LONG_BINARY(sub_long); VAL_BYTE_BYTE_BINARY(xor_byte); VAL_WORD_WORD_BINARY(xor_word); VAL_LONG_LONG_BINARY(xor_long); VAL_VOID_BYTE_BINARY(test_byte); VAL_VOID_WORD_BINARY(test_word); VAL_VOID_LONG_BINARY(test_long); VAL_BYTE_MUL(imul_byte); VAL_WORD_MUL(imul_word); VAL_LONG_MUL(imul_long); VAL_BYTE_MUL(mul_byte); VAL_WORD_MUL(mul_word); VAL_LONG_MUL(mul_long); VAL_BYTE_DIV(idiv_byte); VAL_WORD_DIV(idiv_word); VAL_LONG_DIV(idiv_long); VAL_BYTE_DIV(div_byte); VAL_WORD_DIV(div_word); VAL_LONG_DIV(div_long); return 0; } xorg-server-1.20.8/hw/xfree86/x86emu/ops.c0000644000175000017500000130471013640201473015022 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file includes subroutines to implement the decoding * and emulation of all the x86 processor instructions. * * There are approximately 250 subroutines in here, which correspond * to the 256 byte-"opcodes" found on the 8086. The table which * dispatches this is found in the files optab.[ch]. * * Each opcode proc has a comment preceeding it which gives it's table * address. Several opcodes are missing (undefined) in the table. * * Each proc includes information for decoding (DECODE_PRINTF and * DECODE_PRINTF2), debugging (TRACE_REGS, SINGLE_STEP), and misc * functions (START_OF_INSTR, END_OF_INSTR). * * Many of the procedures are *VERY* similar in coding. This has * allowed for a very large amount of code to be generated in a fairly * short amount of time (i.e. cut, paste, and modify). The result is * that much of the code below could have been folded into subroutines * for a large reduction in size of this file. The downside would be * that there would be a penalty in execution speed. The file could * also have been *MUCH* larger by inlining certain functions which * were called. This could have resulted even faster execution. The * prime directive I used to decide whether to inline the code or to * modularize it, was basically: 1) no unnecessary subroutine calls, * 2) no routines more than about 200 lines in size, and 3) modularize * any code that I might not get right the first time. The fetch_* * subroutines fall into the latter category. The The decode_* fall * into the second category. The coding of the "switch(mod){ .... }" * in many of the subroutines below falls into the first category. * Especially, the coding of {add,and,or,sub,...}_{byte,word} * subroutines are an especially glaring case of the third guideline. * Since so much of the code is cloned from other modules (compare * opcode #00 to opcode #01), making the basic operations subroutine * calls is especially important; otherwise mistakes in coding an * "add" would represent a nightmare in maintenance. * ****************************************************************************/ #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ /**************************************************************************** PARAMETERS: op1 - Instruction op code REMARKS: Handles illegal opcodes. ****************************************************************************/ static void x86emuOp_illegal_op(u8 op1) { START_OF_INSTR(); if (M.x86.R_SP != 0) { DECODE_PRINTF("ILLEGAL X86 OPCODE\n"); TRACE_REGS(); DB(printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n", M.x86.R_CS, M.x86.R_IP - 1, op1)); HALT_SYS(); } else { /* If we get here, it means the stack pointer is back to zero * so we are just returning from an emulator service call * so therte is no need to display an error message. We trap * the emulator with an 0xF1 opcode to finish the service * call. */ X86EMU_halt_sys(); } END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x00 ****************************************************************************/ static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; u8 *destreg, *srcreg; u8 destval; START_OF_INSTR(); DECODE_PRINTF("ADD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x01 ****************************************************************************/ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("ADD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = add_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x02 ****************************************************************************/ static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("ADD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x03 ****************************************************************************/ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("ADD\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = add_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x04 ****************************************************************************/ static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("ADD\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = add_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x05 ****************************************************************************/ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("ADD\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("ADD\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = add_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = add_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x06 ****************************************************************************/ static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("PUSH\tES\n"); TRACE_AND_STEP(); push_word(M.x86.R_ES); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x07 ****************************************************************************/ static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("POP\tES\n"); TRACE_AND_STEP(); M.x86.R_ES = pop_word(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x08 ****************************************************************************/ static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("OR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x09 ****************************************************************************/ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("OR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = or_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0a ****************************************************************************/ static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("OR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0b ****************************************************************************/ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("OR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = or_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0c ****************************************************************************/ static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("OR\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = or_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0d ****************************************************************************/ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("OR\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("OR\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = or_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = or_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0e ****************************************************************************/ static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("PUSH\tCS\n"); TRACE_AND_STEP(); push_word(M.x86.R_CS); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x0f. Escape for two-byte opcode (286 or better) ****************************************************************************/ static void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1)) { u8 op2 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++)); INC_DECODED_INST_LEN(1); (*x86emu_optab2[op2]) (op2); } /**************************************************************************** REMARKS: Handles opcode 0x10 ****************************************************************************/ static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("ADC\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x11 ****************************************************************************/ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("ADC\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = adc_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x12 ****************************************************************************/ static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("ADC\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x13 ****************************************************************************/ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("ADC\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = adc_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x14 ****************************************************************************/ static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("ADC\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = adc_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x15 ****************************************************************************/ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("ADC\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("ADC\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = adc_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x16 ****************************************************************************/ static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("PUSH\tSS\n"); TRACE_AND_STEP(); push_word(M.x86.R_SS); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x17 ****************************************************************************/ static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("POP\tSS\n"); TRACE_AND_STEP(); M.x86.R_SS = pop_word(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x18 ****************************************************************************/ static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("SBB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x19 ****************************************************************************/ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("SBB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sbb_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x1a ****************************************************************************/ static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("SBB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x1b ****************************************************************************/ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("SBB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sbb_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x1c ****************************************************************************/ static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("SBB\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = sbb_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x1d ****************************************************************************/ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("SBB\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("SBB\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = sbb_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x1e ****************************************************************************/ static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("PUSH\tDS\n"); TRACE_AND_STEP(); push_word(M.x86.R_DS); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x1f ****************************************************************************/ static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("POP\tDS\n"); TRACE_AND_STEP(); M.x86.R_DS = pop_word(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x20 ****************************************************************************/ static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("AND\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x21 ****************************************************************************/ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("AND\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = and_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x22 ****************************************************************************/ static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("AND\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x23 ****************************************************************************/ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("AND\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_long(*destreg, srcval); break; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_word(*destreg, srcval); break; } case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = and_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x24 ****************************************************************************/ static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("AND\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = and_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x25 ****************************************************************************/ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("AND\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("AND\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = and_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = and_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x26 ****************************************************************************/ static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("ES:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_SEGOVR_ES; /* * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4 * opcode subroutines we do not want to do this. */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x27 ****************************************************************************/ static void x86emuOp_daa(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("DAA\n"); TRACE_AND_STEP(); M.x86.R_AL = daa_byte(M.x86.R_AL); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x28 ****************************************************************************/ static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("SUB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x29 ****************************************************************************/ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("SUB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = sub_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x2a ****************************************************************************/ static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("SUB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x2b ****************************************************************************/ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("SUB\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = sub_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x2c ****************************************************************************/ static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("SUB\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = sub_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x2d ****************************************************************************/ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("SUB\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("SUB\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = sub_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x2e ****************************************************************************/ static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("CS:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_SEGOVR_CS; /* note no DECODE_CLEAR_SEGOVR here. */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x2f ****************************************************************************/ static void x86emuOp_das(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("DAS\n"); TRACE_AND_STEP(); M.x86.R_AL = das_byte(M.x86.R_AL); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x30 ****************************************************************************/ static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("XOR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_byte(destval, *srcreg); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x31 ****************************************************************************/ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("XOR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_long(destval, *srcreg); store_data_long(destoffset, destval); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = xor_word(destval, *srcreg); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x32 ****************************************************************************/ static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("XOR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x33 ****************************************************************************/ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("XOR\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = xor_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x34 ****************************************************************************/ static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("XOR\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); M.x86.R_AL = xor_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x35 ****************************************************************************/ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XOR\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("XOR\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval); } else { M.x86.R_AX = xor_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x36 ****************************************************************************/ static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("SS:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_SEGOVR_SS; /* no DECODE_CLEAR_SEGOVR ! */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x37 ****************************************************************************/ static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("AAA\n"); TRACE_AND_STEP(); M.x86.R_AX = aaa_word(M.x86.R_AX); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x38 ****************************************************************************/ static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; u8 *destreg, *srcreg; u8 destval; START_OF_INSTR(); DECODE_PRINTF("CMP\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(destval, *srcreg); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(destval, *srcreg); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(destval, *srcreg); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x39 ****************************************************************************/ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("CMP\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(destval, *srcreg); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(destval, *srcreg); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(destval, *srcreg); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(destval, *srcreg); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(destval, *srcreg); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(destval, *srcreg); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x3a ****************************************************************************/ static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("CMP\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(*destreg, srcval); break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(*destreg, srcval); break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(*destreg, srcval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x3b ****************************************************************************/ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("CMP\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(*destreg, srcval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(*destreg, srcval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(*destreg, srcval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); cmp_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x3c ****************************************************************************/ static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 srcval; START_OF_INSTR(); DECODE_PRINTF("CMP\tAL,"); srcval = fetch_byte_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); cmp_byte(M.x86.R_AL, srcval); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x3d ****************************************************************************/ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("CMP\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("CMP\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { cmp_long(M.x86.R_EAX, srcval); } else { cmp_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x3e ****************************************************************************/ static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("DS:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_SEGOVR_DS; /* NO DECODE_CLEAR_SEGOVR! */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x3f ****************************************************************************/ static void x86emuOp_aas(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("AAS\n"); TRACE_AND_STEP(); M.x86.R_AX = aas_word(M.x86.R_AX); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x40 ****************************************************************************/ static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tEAX\n"); } else { DECODE_PRINTF("INC\tAX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = inc_long(M.x86.R_EAX); } else { M.x86.R_AX = inc_word(M.x86.R_AX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x41 ****************************************************************************/ static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tECX\n"); } else { DECODE_PRINTF("INC\tCX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ECX = inc_long(M.x86.R_ECX); } else { M.x86.R_CX = inc_word(M.x86.R_CX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x42 ****************************************************************************/ static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tEDX\n"); } else { DECODE_PRINTF("INC\tDX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDX = inc_long(M.x86.R_EDX); } else { M.x86.R_DX = inc_word(M.x86.R_DX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x43 ****************************************************************************/ static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tEBX\n"); } else { DECODE_PRINTF("INC\tBX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBX = inc_long(M.x86.R_EBX); } else { M.x86.R_BX = inc_word(M.x86.R_BX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x44 ****************************************************************************/ static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tESP\n"); } else { DECODE_PRINTF("INC\tSP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESP = inc_long(M.x86.R_ESP); } else { M.x86.R_SP = inc_word(M.x86.R_SP); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x45 ****************************************************************************/ static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tEBP\n"); } else { DECODE_PRINTF("INC\tBP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBP = inc_long(M.x86.R_EBP); } else { M.x86.R_BP = inc_word(M.x86.R_BP); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x46 ****************************************************************************/ static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tESI\n"); } else { DECODE_PRINTF("INC\tSI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESI = inc_long(M.x86.R_ESI); } else { M.x86.R_SI = inc_word(M.x86.R_SI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x47 ****************************************************************************/ static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tEDI\n"); } else { DECODE_PRINTF("INC\tDI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDI = inc_long(M.x86.R_EDI); } else { M.x86.R_DI = inc_word(M.x86.R_DI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x48 ****************************************************************************/ static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tEAX\n"); } else { DECODE_PRINTF("DEC\tAX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = dec_long(M.x86.R_EAX); } else { M.x86.R_AX = dec_word(M.x86.R_AX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x49 ****************************************************************************/ static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tECX\n"); } else { DECODE_PRINTF("DEC\tCX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ECX = dec_long(M.x86.R_ECX); } else { M.x86.R_CX = dec_word(M.x86.R_CX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x4a ****************************************************************************/ static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tEDX\n"); } else { DECODE_PRINTF("DEC\tDX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDX = dec_long(M.x86.R_EDX); } else { M.x86.R_DX = dec_word(M.x86.R_DX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x4b ****************************************************************************/ static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tEBX\n"); } else { DECODE_PRINTF("DEC\tBX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBX = dec_long(M.x86.R_EBX); } else { M.x86.R_BX = dec_word(M.x86.R_BX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x4c ****************************************************************************/ static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tESP\n"); } else { DECODE_PRINTF("DEC\tSP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESP = dec_long(M.x86.R_ESP); } else { M.x86.R_SP = dec_word(M.x86.R_SP); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x4d ****************************************************************************/ static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tEBP\n"); } else { DECODE_PRINTF("DEC\tBP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBP = dec_long(M.x86.R_EBP); } else { M.x86.R_BP = dec_word(M.x86.R_BP); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x4e ****************************************************************************/ static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tESI\n"); } else { DECODE_PRINTF("DEC\tSI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESI = dec_long(M.x86.R_ESI); } else { M.x86.R_SI = dec_word(M.x86.R_SI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x4f ****************************************************************************/ static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tEDI\n"); } else { DECODE_PRINTF("DEC\tDI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDI = dec_long(M.x86.R_EDI); } else { M.x86.R_DI = dec_word(M.x86.R_DI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x50 ****************************************************************************/ static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tEAX\n"); } else { DECODE_PRINTF("PUSH\tAX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EAX); } else { push_word(M.x86.R_AX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x51 ****************************************************************************/ static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tECX\n"); } else { DECODE_PRINTF("PUSH\tCX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_ECX); } else { push_word(M.x86.R_CX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x52 ****************************************************************************/ static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tEDX\n"); } else { DECODE_PRINTF("PUSH\tDX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EDX); } else { push_word(M.x86.R_DX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x53 ****************************************************************************/ static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tEBX\n"); } else { DECODE_PRINTF("PUSH\tBX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EBX); } else { push_word(M.x86.R_BX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x54 ****************************************************************************/ static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tESP\n"); } else { DECODE_PRINTF("PUSH\tSP\n"); } TRACE_AND_STEP(); /* Always push (E)SP, since we are emulating an i386 and above * processor. This is necessary as some BIOS'es use this to check * what type of processor is in the system. */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_ESP); } else { push_word((u16) (M.x86.R_SP)); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x55 ****************************************************************************/ static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tEBP\n"); } else { DECODE_PRINTF("PUSH\tBP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EBP); } else { push_word(M.x86.R_BP); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x56 ****************************************************************************/ static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tESI\n"); } else { DECODE_PRINTF("PUSH\tSI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_ESI); } else { push_word(M.x86.R_SI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x57 ****************************************************************************/ static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSH\tEDI\n"); } else { DECODE_PRINTF("PUSH\tDI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EDI); } else { push_word(M.x86.R_DI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x58 ****************************************************************************/ static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tEAX\n"); } else { DECODE_PRINTF("POP\tAX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = pop_long(); } else { M.x86.R_AX = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x59 ****************************************************************************/ static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tECX\n"); } else { DECODE_PRINTF("POP\tCX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ECX = pop_long(); } else { M.x86.R_CX = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x5a ****************************************************************************/ static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tEDX\n"); } else { DECODE_PRINTF("POP\tDX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDX = pop_long(); } else { M.x86.R_DX = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x5b ****************************************************************************/ static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tEBX\n"); } else { DECODE_PRINTF("POP\tBX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBX = pop_long(); } else { M.x86.R_BX = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x5c ****************************************************************************/ static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tESP\n"); } else { DECODE_PRINTF("POP\tSP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESP = pop_long(); } else { M.x86.R_SP = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x5d ****************************************************************************/ static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tEBP\n"); } else { DECODE_PRINTF("POP\tBP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBP = pop_long(); } else { M.x86.R_BP = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x5e ****************************************************************************/ static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tESI\n"); } else { DECODE_PRINTF("POP\tSI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESI = pop_long(); } else { M.x86.R_SI = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x5f ****************************************************************************/ static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POP\tEDI\n"); } else { DECODE_PRINTF("POP\tDI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDI = pop_long(); } else { M.x86.R_DI = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x60 ****************************************************************************/ static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSHAD\n"); } else { DECODE_PRINTF("PUSHA\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 old_sp = M.x86.R_ESP; push_long(M.x86.R_EAX); push_long(M.x86.R_ECX); push_long(M.x86.R_EDX); push_long(M.x86.R_EBX); push_long(old_sp); push_long(M.x86.R_EBP); push_long(M.x86.R_ESI); push_long(M.x86.R_EDI); } else { u16 old_sp = M.x86.R_SP; push_word(M.x86.R_AX); push_word(M.x86.R_CX); push_word(M.x86.R_DX); push_word(M.x86.R_BX); push_word(old_sp); push_word(M.x86.R_BP); push_word(M.x86.R_SI); push_word(M.x86.R_DI); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x61 ****************************************************************************/ static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POPAD\n"); } else { DECODE_PRINTF("POPA\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDI = pop_long(); M.x86.R_ESI = pop_long(); M.x86.R_EBP = pop_long(); M.x86.R_ESP += 4; /* skip ESP */ M.x86.R_EBX = pop_long(); M.x86.R_EDX = pop_long(); M.x86.R_ECX = pop_long(); M.x86.R_EAX = pop_long(); } else { M.x86.R_DI = pop_word(); M.x86.R_SI = pop_word(); M.x86.R_BP = pop_word(); M.x86.R_SP += 2; /* skip SP */ M.x86.R_BX = pop_word(); M.x86.R_DX = pop_word(); M.x86.R_CX = pop_word(); M.x86.R_AX = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /*opcode 0x62 ILLEGAL OP, calls x86emuOp_illegal_op() */ /*opcode 0x63 ILLEGAL OP, calls x86emuOp_illegal_op() */ /**************************************************************************** REMARKS: Handles opcode 0x64 ****************************************************************************/ static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("FS:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_SEGOVR_FS; /* * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4 * opcode subroutines we do not want to do this. */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x65 ****************************************************************************/ static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("GS:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_SEGOVR_GS; /* * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4 * opcode subroutines we do not want to do this. */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x66 - prefix for 32-bit register ****************************************************************************/ static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("DATA:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_PREFIX_DATA; /* note no DECODE_CLEAR_SEGOVR here. */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x67 - prefix for 32-bit address ****************************************************************************/ static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("ADDR:\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_PREFIX_ADDR; /* note no DECODE_CLEAR_SEGOVR here. */ END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x68 ****************************************************************************/ static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1)) { u32 imm; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { imm = fetch_long_imm(); } else { imm = fetch_word_imm(); } DECODE_PRINTF2("PUSH\t%x\n", imm); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(imm); } else { push_word((u16) imm); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x69 ****************************************************************************/ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("IMUL\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; s32 imm; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); imm = fetch_long_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; s16 imm; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); imm = fetch_word_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); res = (s16) srcval *(s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; s32 imm; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); imm = fetch_long_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; s16 imm; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); imm = fetch_word_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); res = (s16) srcval *(s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; s32 imm; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); imm = fetch_long_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; s16 imm; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); imm = fetch_word_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); res = (s16) srcval *(s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; u32 res_lo, res_hi; s32 imm; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); imm = fetch_long_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg, *srcreg; u32 res; s16 imm; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); imm = fetch_word_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); res = (s16) * srcreg * (s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x6a ****************************************************************************/ static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1)) { s16 imm; START_OF_INSTR(); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2("PUSH\t%d\n", imm); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long((s32) imm); } else { push_word(imm); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x6b ****************************************************************************/ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; s8 imm; START_OF_INSTR(); DECODE_PRINTF("IMUL\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); res = (s16) srcval *(s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); res = (s16) srcval *(s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg; u16 srcval; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); res = (s16) srcval *(s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; u32 res_lo, res_hi; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); TRACE_AND_STEP(); imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm); if (res_hi != 0) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u32) res_lo; } else { u16 *destreg, *srcreg; u32 res; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%d\n", (s32) imm); res = (s16) * srcreg * (s16) imm; if (res > 0xFFFF) { SET_FLAG(F_CF); SET_FLAG(F_OF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } *destreg = (u16) res; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x6c ****************************************************************************/ static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("INSB\n"); ins(1); TRACE_AND_STEP(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x6d ****************************************************************************/ static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INSD\n"); ins(4); } else { DECODE_PRINTF("INSW\n"); ins(2); } TRACE_AND_STEP(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x6e ****************************************************************************/ static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("OUTSB\n"); outs(1); TRACE_AND_STEP(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x6f ****************************************************************************/ static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("OUTSD\n"); outs(4); } else { DECODE_PRINTF("OUTSW\n"); outs(2); } TRACE_AND_STEP(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x70 ****************************************************************************/ static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if overflow flag is set */ START_OF_INSTR(); DECODE_PRINTF("JO\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (ACCESS_FLAG(F_OF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x71 ****************************************************************************/ static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if overflow is not set */ START_OF_INSTR(); DECODE_PRINTF("JNO\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (!ACCESS_FLAG(F_OF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x72 ****************************************************************************/ static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if carry flag is set. */ START_OF_INSTR(); DECODE_PRINTF("JB\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (ACCESS_FLAG(F_CF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x73 ****************************************************************************/ static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if carry flag is clear. */ START_OF_INSTR(); DECODE_PRINTF("JNB\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (!ACCESS_FLAG(F_CF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x74 ****************************************************************************/ static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if zero flag is set. */ START_OF_INSTR(); DECODE_PRINTF("JZ\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (ACCESS_FLAG(F_ZF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x75 ****************************************************************************/ static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if zero flag is clear. */ START_OF_INSTR(); DECODE_PRINTF("JNZ\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (!ACCESS_FLAG(F_ZF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x76 ****************************************************************************/ static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if carry flag is set or if the zero flag is set. */ START_OF_INSTR(); DECODE_PRINTF("JBE\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x77 ****************************************************************************/ static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if carry flag is clear and if the zero flag is clear */ START_OF_INSTR(); DECODE_PRINTF("JNBE\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x78 ****************************************************************************/ static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if sign flag is set */ START_OF_INSTR(); DECODE_PRINTF("JS\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (ACCESS_FLAG(F_SF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x79 ****************************************************************************/ static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if sign flag is clear */ START_OF_INSTR(); DECODE_PRINTF("JNS\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (!ACCESS_FLAG(F_SF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x7a ****************************************************************************/ static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if parity flag is set (even parity) */ START_OF_INSTR(); DECODE_PRINTF("JP\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (ACCESS_FLAG(F_PF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x7b ****************************************************************************/ static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; /* jump to byte offset if parity flag is clear (odd parity) */ START_OF_INSTR(); DECODE_PRINTF("JNP\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (!ACCESS_FLAG(F_PF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x7c ****************************************************************************/ static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; int sf, of; /* jump to byte offset if sign flag not equal to overflow flag. */ START_OF_INSTR(); DECODE_PRINTF("JL\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); sf = ACCESS_FLAG(F_SF) != 0; of = ACCESS_FLAG(F_OF) != 0; if (sf ^ of) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x7d ****************************************************************************/ static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; int sf, of; /* jump to byte offset if sign flag not equal to overflow flag. */ START_OF_INSTR(); DECODE_PRINTF("JNL\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); sf = ACCESS_FLAG(F_SF) != 0; of = ACCESS_FLAG(F_OF) != 0; /* note: inverse of above, but using == instead of xor. */ if (sf == of) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x7e ****************************************************************************/ static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; int sf, of; /* jump to byte offset if sign flag not equal to overflow flag or the zero flag is set */ START_OF_INSTR(); DECODE_PRINTF("JLE\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); sf = ACCESS_FLAG(F_SF) != 0; of = ACCESS_FLAG(F_OF) != 0; if ((sf ^ of) || ACCESS_FLAG(F_ZF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x7f ****************************************************************************/ static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1)) { s8 offset; u16 target; int sf, of; /* jump to byte offset if sign flag equal to overflow flag. and the zero flag is clear */ START_OF_INSTR(); DECODE_PRINTF("JNLE\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + (s16) offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); sf = ACCESS_FLAG(F_SF) != 0; of = ACCESS_FLAG(F_OF) != 0; if ((sf == of) && !ACCESS_FLAG(F_ZF)) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } static u8(*opc80_byte_operation[]) (u8 d, u8 s) = { add_byte, /* 00 */ or_byte, /* 01 */ adc_byte, /* 02 */ sbb_byte, /* 03 */ and_byte, /* 04 */ sub_byte, /* 05 */ xor_byte, /* 06 */ cmp_byte, /* 07 */ }; /**************************************************************************** REMARKS: Handles opcode 0x80 ****************************************************************************/ static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 imm; u8 destval; /* * Weirdo special case instruction format. Part of the opcode * held below in "RH". Doubly nested case would result, except * that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ADD\t"); break; case 1: DECODE_PRINTF("OR\t"); break; case 2: DECODE_PRINTF("ADC\t"); break; case 3: DECODE_PRINTF("SBB\t"); break; case 4: DECODE_PRINTF("AND\t"); break; case 5: DECODE_PRINTF("SUB\t"); break; case 6: DECODE_PRINTF("XOR\t"); break; case 7: DECODE_PRINTF("CMP\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc80_byte_operation[rh]) (destval, imm); if (rh != 7) store_data_byte(destoffset, destval); break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc80_byte_operation[rh]) (destval, imm); if (rh != 7) store_data_byte(destoffset, destval); break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc80_byte_operation[rh]) (destval, imm); if (rh != 7) store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc80_byte_operation[rh]) (*destreg, imm); if (rh != 7) *destreg = destval; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } static u16(*opc81_word_operation[]) (u16 d, u16 s) = { add_word, /*00 */ or_word, /*01 */ adc_word, /*02 */ sbb_word, /*03 */ and_word, /*04 */ sub_word, /*05 */ xor_word, /*06 */ cmp_word, /*07 */ }; static u32(*opc81_long_operation[]) (u32 d, u32 s) = { add_long, /*00 */ or_long, /*01 */ adc_long, /*02 */ sbb_long, /*03 */ and_long, /*04 */ sub_long, /*05 */ xor_long, /*06 */ cmp_long, /*07 */ }; /**************************************************************************** REMARKS: Handles opcode 0x81 ****************************************************************************/ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; /* * Weirdo special case instruction format. Part of the opcode * held below in "RH". Doubly nested case would result, except * that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ADD\t"); break; case 1: DECODE_PRINTF("OR\t"); break; case 2: DECODE_PRINTF("ADC\t"); break; case 3: DECODE_PRINTF("SBB\t"); break; case 4: DECODE_PRINTF("AND\t"); break; case 5: DECODE_PRINTF("SUB\t"); break; case 6: DECODE_PRINTF("XOR\t"); break; case 7: DECODE_PRINTF("CMP\t"); break; } } #endif /* * Know operation, decode the mod byte to find the addressing * mode. */ switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); imm = fetch_long_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_long_operation[rh]) (destval, imm); if (rh != 7) store_data_long(destoffset, destval); } else { u16 destval, imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); imm = fetch_word_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_word_operation[rh]) (destval, imm); if (rh != 7) store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); imm = fetch_long_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_long_operation[rh]) (destval, imm); if (rh != 7) store_data_long(destoffset, destval); } else { u16 destval, imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); imm = fetch_word_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_word_operation[rh]) (destval, imm); if (rh != 7) store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); imm = fetch_long_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_long_operation[rh]) (destval, imm); if (rh != 7) store_data_long(destoffset, destval); } else { u16 destval, imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); imm = fetch_word_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_word_operation[rh]) (destval, imm); if (rh != 7) store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 destval, imm; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); imm = fetch_long_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_long_operation[rh]) (*destreg, imm); if (rh != 7) *destreg = destval; } else { u16 *destreg; u16 destval, imm; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); imm = fetch_word_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); destval = (*opc81_word_operation[rh]) (*destreg, imm); if (rh != 7) *destreg = destval; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } static u8(*opc82_byte_operation[]) (u8 s, u8 d) = { add_byte, /*00 */ or_byte, /*01 *//*YYY UNUSED ???? */ adc_byte, /*02 */ sbb_byte, /*03 */ and_byte, /*04 *//*YYY UNUSED ???? */ sub_byte, /*05 */ xor_byte, /*06 *//*YYY UNUSED ???? */ cmp_byte, /*07 */ }; /**************************************************************************** REMARKS: Handles opcode 0x82 ****************************************************************************/ static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 imm; u8 destval; /* * Weirdo special case instruction format. Part of the opcode * held below in "RH". Doubly nested case would result, except * that the decoded instruction Similar to opcode 81, except that * the immediate byte is sign extended to a word length. */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ADD\t"); break; case 1: DECODE_PRINTF("OR\t"); break; case 2: DECODE_PRINTF("ADC\t"); break; case 3: DECODE_PRINTF("SBB\t"); break; case 4: DECODE_PRINTF("AND\t"); break; case 5: DECODE_PRINTF("SUB\t"); break; case 6: DECODE_PRINTF("XOR\t"); break; case 7: DECODE_PRINTF("CMP\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); destval = fetch_data_byte(destoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc82_byte_operation[rh]) (destval, imm); if (rh != 7) store_data_byte(destoffset, destval); break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); destval = fetch_data_byte(destoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc82_byte_operation[rh]) (destval, imm); if (rh != 7) store_data_byte(destoffset, destval); break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); destval = fetch_data_byte(destoffset); imm = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc82_byte_operation[rh]) (destval, imm); if (rh != 7) store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc82_byte_operation[rh]) (*destreg, imm); if (rh != 7) *destreg = destval; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } static u16(*opc83_word_operation[]) (u16 s, u16 d) = { add_word, /*00 */ or_word, /*01 *//*YYY UNUSED ???? */ adc_word, /*02 */ sbb_word, /*03 */ and_word, /*04 *//*YYY UNUSED ???? */ sub_word, /*05 */ xor_word, /*06 *//*YYY UNUSED ???? */ cmp_word, /*07 */ }; static u32(*opc83_long_operation[]) (u32 s, u32 d) = { add_long, /*00 */ or_long, /*01 *//*YYY UNUSED ???? */ adc_long, /*02 */ sbb_long, /*03 */ and_long, /*04 *//*YYY UNUSED ???? */ sub_long, /*05 */ xor_long, /*06 *//*YYY UNUSED ???? */ cmp_long, /*07 */ }; /**************************************************************************** REMARKS: Handles opcode 0x83 ****************************************************************************/ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; /* * Weirdo special case instruction format. Part of the opcode * held below in "RH". Doubly nested case would result, except * that the decoded instruction Similar to opcode 81, except that * the immediate byte is sign extended to a word length. */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ADD\t"); break; case 1: DECODE_PRINTF("OR\t"); break; case 2: DECODE_PRINTF("ADC\t"); break; case 3: DECODE_PRINTF("SBB\t"); break; case 4: DECODE_PRINTF("AND\t"); break; case 5: DECODE_PRINTF("SUB\t"); break; case 6: DECODE_PRINTF("XOR\t"); break; case 7: DECODE_PRINTF("CMP\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm00_address(rl); destval = fetch_data_long(destoffset); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_long_operation[rh]) (destval, imm); if (rh != 7) store_data_long(destoffset, destval); } else { u16 destval, imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm00_address(rl); destval = fetch_data_word(destoffset); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_word_operation[rh]) (destval, imm); if (rh != 7) store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm01_address(rl); destval = fetch_data_long(destoffset); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_long_operation[rh]) (destval, imm); if (rh != 7) store_data_long(destoffset, destval); } else { u16 destval, imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm01_address(rl); destval = fetch_data_word(destoffset); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_word_operation[rh]) (destval, imm); if (rh != 7) store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm10_address(rl); destval = fetch_data_long(destoffset); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_long_operation[rh]) (destval, imm); if (rh != 7) store_data_long(destoffset, destval); } else { u16 destval, imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm10_address(rl); destval = fetch_data_word(destoffset); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_word_operation[rh]) (destval, imm); if (rh != 7) store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 destval, imm; destreg = DECODE_RM_LONG_REGISTER(rl); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_long_operation[rh]) (*destreg, imm); if (rh != 7) *destreg = destval; } else { u16 *destreg; u16 destval, imm; destreg = DECODE_RM_WORD_REGISTER(rl); imm = (s8) fetch_byte_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); destval = (*opc83_word_operation[rh]) (*destreg, imm); if (rh != 7) *destreg = destval; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x84 ****************************************************************************/ static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; START_OF_INSTR(); DECODE_PRINTF("TEST\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_byte(destval, *srcreg); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_byte(destval, *srcreg); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_byte(destval, *srcreg); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_byte(*destreg, *srcreg); break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x85 ****************************************************************************/ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("TEST\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_long(destval, *srcreg); } else { u16 destval; u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_word(destval, *srcreg); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_long(destval, *srcreg); } else { u16 destval; u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_word(destval, *srcreg); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_long(destval, *srcreg); } else { u16 destval; u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_word(destval, *srcreg); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_long(*destreg, *srcreg); } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); test_word(*destreg, *srcreg); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x86 ****************************************************************************/ static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; u8 destval; u8 tmp; START_OF_INSTR(); DECODE_PRINTF("XCHG\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_byte(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_byte(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_byte(destoffset); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = *destreg; *destreg = tmp; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x87 ****************************************************************************/ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("XCHG\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; u32 destval, tmp; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_long(destoffset, destval); } else { u16 *srcreg; u16 destval, tmp; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; u32 destval, tmp; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_long(destoffset, destval); } else { u16 *srcreg; u16 destval, tmp; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; u32 destval, tmp; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_long(destoffset); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_long(destoffset, destval); } else { u16 *srcreg; u16 destval, tmp; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); destval = fetch_data_word(destoffset); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = destval; destval = tmp; store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; u32 tmp; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = *destreg; *destreg = tmp; } else { u16 *destreg, *srcreg; u16 tmp; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); tmp = *srcreg; *srcreg = *destreg; *destreg = tmp; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x88 ****************************************************************************/ static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_byte(destoffset, *srcreg); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_byte(destoffset, *srcreg); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_byte(destoffset, *srcreg); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x89 ****************************************************************************/ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u32 destoffset; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_long(destoffset, *srcreg); } else { u16 *srcreg; destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_word(destoffset, *srcreg); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_long(destoffset, *srcreg); } else { u16 *srcreg; destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_word(destoffset, *srcreg); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_long(destoffset, *srcreg); } else { u16 *srcreg; destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); store_data_word(destoffset, *srcreg); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x8a ****************************************************************************/ static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg, *srcreg; uint srcoffset; u8 srcval; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 1: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 2: destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_byte(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x8b ****************************************************************************/ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_long(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } else { u16 *destreg; u16 srcval; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg, *srcreg; destreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; } else { u16 *destreg, *srcreg; destreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x8c ****************************************************************************/ static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u16 *destreg, *srcreg; uint destoffset; u16 destval; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcreg = decode_rm_seg_register(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = *srcreg; store_data_word(destoffset, destval); break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcreg = decode_rm_seg_register(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = *srcreg; store_data_word(destoffset, destval); break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcreg = decode_rm_seg_register(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = *srcreg; store_data_word(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcreg = decode_rm_seg_register(rh); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x8d ****************************************************************************/ static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("LEA\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_ADDR) { u32 *srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *srcreg = (u32) destoffset; } else { u16 *srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *srcreg = (u16) destoffset; } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_ADDR) { u32 *srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *srcreg = (u32) destoffset; } else { u16 *srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *srcreg = (u16) destoffset; } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_ADDR) { u32 *srcreg = DECODE_RM_LONG_REGISTER(rh); DECODE_PRINTF(","); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *srcreg = (u32) destoffset; } else { u16 *srcreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *srcreg = (u16) destoffset; } break; case 3: /* register to register */ /* undefined. Do nothing. */ break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x8e ****************************************************************************/ static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u16 *destreg, *srcreg; uint srcoffset; u16 srcval; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: destreg = decode_rm_seg_register(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 1: destreg = decode_rm_seg_register(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 2: destreg = decode_rm_seg_register(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); srcval = fetch_data_word(srcoffset); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = srcval; break; case 3: /* register to register */ destreg = decode_rm_seg_register(rh); DECODE_PRINTF(","); srcreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = *srcreg; break; } /* * Clean up, and reset all the R_xSP pointers to the correct * locations. This is about 3x too much overhead (doing all the * segreg ptrs when only one is needed, but this instruction * *cannot* be that common, and this isn't too much work anyway. */ DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x8f ****************************************************************************/ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("POP\t"); FETCH_DECODE_MODRM(mod, rh, rl); if (rh != 0) { DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n"); HALT_SYS(); } switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = pop_long(); store_data_long(destoffset, destval); } else { u16 destval; destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = pop_word(); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = pop_long(); store_data_long(destoffset, destval); } else { u16 destval; destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = pop_word(); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = pop_long(); store_data_long(destoffset, destval); } else { u16 destval; destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); destval = pop_word(); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = pop_long(); } else { u16 *destreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = pop_word(); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x90 ****************************************************************************/ static void x86emuOp_nop(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("NOP\n"); TRACE_AND_STEP(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x91 ****************************************************************************/ static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,ECX\n"); } else { DECODE_PRINTF("XCHG\tAX,CX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_ECX; M.x86.R_ECX = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_CX; M.x86.R_CX = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x92 ****************************************************************************/ static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,EDX\n"); } else { DECODE_PRINTF("XCHG\tAX,DX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_EDX; M.x86.R_EDX = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_DX; M.x86.R_DX = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x93 ****************************************************************************/ static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,EBX\n"); } else { DECODE_PRINTF("XCHG\tAX,BX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_EBX; M.x86.R_EBX = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_BX; M.x86.R_BX = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x94 ****************************************************************************/ static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,ESP\n"); } else { DECODE_PRINTF("XCHG\tAX,SP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_ESP; M.x86.R_ESP = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_SP; M.x86.R_SP = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x95 ****************************************************************************/ static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,EBP\n"); } else { DECODE_PRINTF("XCHG\tAX,BP\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_EBP; M.x86.R_EBP = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_BP; M.x86.R_BP = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x96 ****************************************************************************/ static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,ESI\n"); } else { DECODE_PRINTF("XCHG\tAX,SI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_ESI; M.x86.R_ESI = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_SI; M.x86.R_SI = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x97 ****************************************************************************/ static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1)) { u32 tmp; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("XCHG\tEAX,EDI\n"); } else { DECODE_PRINTF("XCHG\tAX,DI\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { tmp = M.x86.R_EAX; M.x86.R_EAX = M.x86.R_EDI; M.x86.R_EDI = tmp; } else { tmp = M.x86.R_AX; M.x86.R_AX = M.x86.R_DI; M.x86.R_DI = (u16) tmp; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x98 ****************************************************************************/ static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("CWDE\n"); } else { DECODE_PRINTF("CBW\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { if (M.x86.R_AX & 0x8000) { M.x86.R_EAX |= 0xffff0000; } else { M.x86.R_EAX &= 0x0000ffff; } } else { if (M.x86.R_AL & 0x80) { M.x86.R_AH = 0xff; } else { M.x86.R_AH = 0x0; } } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x99 ****************************************************************************/ static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("CDQ\n"); } else { DECODE_PRINTF("CWD\n"); } DECODE_PRINTF("CWD\n"); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { if (M.x86.R_EAX & 0x80000000) { M.x86.R_EDX = 0xffffffff; } else { M.x86.R_EDX = 0x0; } } else { if (M.x86.R_AX & 0x8000) { M.x86.R_DX = 0xffff; } else { M.x86.R_DX = 0x0; } } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x9a ****************************************************************************/ static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1)) { u32 farseg, faroff; START_OF_INSTR(); DECODE_PRINTF("CALL\t"); if (M.x86.mode & SYSMODE_PREFIX_DATA) { faroff = fetch_long_imm(); farseg = fetch_word_imm(); } else { faroff = fetch_word_imm(); farseg = fetch_word_imm(); } DECODE_PRINTF2("%04x:", farseg); DECODE_PRINTF2("%04x\n", faroff); CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR "); /* XXX * * Hooked interrupt vectors calling into our "BIOS" will cause * problems unless all intersegment stuff is checked for BIOS * access. Check needed here. For moment, let it alone. */ TRACE_AND_STEP(); push_word(M.x86.R_CS); M.x86.R_CS = farseg; if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EIP); } else { push_word(M.x86.R_IP); } M.x86.R_EIP = faroff & 0xffff; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x9b ****************************************************************************/ static void x86emuOp_wait(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("WAIT"); TRACE_AND_STEP(); /* NADA. */ DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x9c ****************************************************************************/ static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1)) { u32 flags; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("PUSHFD\n"); } else { DECODE_PRINTF("PUSHF\n"); } TRACE_AND_STEP(); /* clear out *all* bits not representing flags, and turn on real bits */ flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON; if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(flags); } else { push_word((u16) flags); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x9d ****************************************************************************/ static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("POPFD\n"); } else { DECODE_PRINTF("POPF\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EFLG = pop_long(); } else { M.x86.R_FLG = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x9e ****************************************************************************/ static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("SAHF\n"); TRACE_AND_STEP(); /* clear the lower bits of the flag register */ M.x86.R_FLG &= 0xffffff00; /* or in the AH register into the flags register */ M.x86.R_FLG |= M.x86.R_AH; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0x9f ****************************************************************************/ static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("LAHF\n"); TRACE_AND_STEP(); M.x86.R_AH = (u8) (M.x86.R_FLG & 0xff); /*undocumented TC++ behavior??? Nope. It's documented, but you have too look real hard to notice it. */ M.x86.R_AH |= 0x2; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa0 ****************************************************************************/ static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1)) { u16 offset; START_OF_INSTR(); DECODE_PRINTF("MOV\tAL,"); offset = fetch_word_imm(); DECODE_PRINTF2("[%04x]\n", offset); TRACE_AND_STEP(); M.x86.R_AL = fetch_data_byte(offset); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa1 ****************************************************************************/ static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1)) { u16 offset; START_OF_INSTR(); offset = fetch_word_imm(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset); } else { DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = fetch_data_long(offset); } else { M.x86.R_AX = fetch_data_word(offset); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa2 ****************************************************************************/ static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1)) { u16 offset; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); offset = fetch_word_imm(); DECODE_PRINTF2("[%04x],AL\n", offset); TRACE_AND_STEP(); store_data_byte(offset, M.x86.R_AL); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa3 ****************************************************************************/ static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1)) { u16 offset; START_OF_INSTR(); offset = fetch_word_imm(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset); } else { DECODE_PRINTF2("MOV\t[%04x],AX\n", offset); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { store_data_long(offset, M.x86.R_EAX); } else { store_data_word(offset, M.x86.R_AX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa4 ****************************************************************************/ static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1)) { u8 val; u32 count; int inc; START_OF_INSTR(); DECODE_PRINTF("MOVS\tBYTE\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -1; else inc = 1; TRACE_AND_STEP(); count = 1; if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* move them until CX is ZERO. */ count = M.x86.R_CX; M.x86.R_CX = 0; M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } while (count--) { val = fetch_data_byte(M.x86.R_SI); store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val); M.x86.R_SI += inc; M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa5 ****************************************************************************/ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1)) { u32 val; int inc; u32 count; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOVS\tDWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -4; else inc = 4; } else { DECODE_PRINTF("MOVS\tWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -2; else inc = 2; } TRACE_AND_STEP(); count = 1; if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* move them until CX is ZERO. */ count = M.x86.R_CX; M.x86.R_CX = 0; M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } while (count--) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val = fetch_data_long(M.x86.R_SI); store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val); } else { val = fetch_data_word(M.x86.R_SI); store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16) val); } M.x86.R_SI += inc; M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa6 ****************************************************************************/ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1)) { s8 val1, val2; int inc; START_OF_INSTR(); DECODE_PRINTF("CMPS\tBYTE\n"); TRACE_AND_STEP(); if (ACCESS_FLAG(F_DF)) /* down */ inc = -1; else inc = 1; if (M.x86.mode & SYSMODE_PREFIX_REPE) { /* REPE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { val1 = fetch_data_byte(M.x86.R_SI); val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); cmp_byte(val1, val2); M.x86.R_CX -= 1; M.x86.R_SI += inc; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF) == 0) break; } M.x86.mode &= ~SYSMODE_PREFIX_REPE; } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { /* REPNE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { val1 = fetch_data_byte(M.x86.R_SI); val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); cmp_byte(val1, val2); M.x86.R_CX -= 1; M.x86.R_SI += inc; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF)) break; /* zero flag set means equal */ } M.x86.mode &= ~SYSMODE_PREFIX_REPNE; } else { val1 = fetch_data_byte(M.x86.R_SI); val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); cmp_byte(val1, val2); M.x86.R_SI += inc; M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa7 ****************************************************************************/ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1)) { u32 val1, val2; int inc; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("CMPS\tDWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -4; else inc = 4; } else { DECODE_PRINTF("CMPS\tWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -2; else inc = 2; } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_REPE) { /* REPE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val1 = fetch_data_long(M.x86.R_SI); val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); cmp_long(val1, val2); } else { val1 = fetch_data_word(M.x86.R_SI); val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); cmp_word((u16) val1, (u16) val2); } M.x86.R_CX -= 1; M.x86.R_SI += inc; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF) == 0) break; } M.x86.mode &= ~SYSMODE_PREFIX_REPE; } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { /* REPNE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val1 = fetch_data_long(M.x86.R_SI); val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); cmp_long(val1, val2); } else { val1 = fetch_data_word(M.x86.R_SI); val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); cmp_word((u16) val1, (u16) val2); } M.x86.R_CX -= 1; M.x86.R_SI += inc; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF)) break; /* zero flag set means equal */ } M.x86.mode &= ~SYSMODE_PREFIX_REPNE; } else { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val1 = fetch_data_long(M.x86.R_SI); val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); cmp_long(val1, val2); } else { val1 = fetch_data_word(M.x86.R_SI); val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); cmp_word((u16) val1, (u16) val2); } M.x86.R_SI += inc; M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa8 ****************************************************************************/ static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1)) { int imm; START_OF_INSTR(); DECODE_PRINTF("TEST\tAL,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%04x\n", imm); TRACE_AND_STEP(); test_byte(M.x86.R_AL, (u8) imm); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xa9 ****************************************************************************/ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("TEST\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("TEST\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { test_long(M.x86.R_EAX, srcval); } else { test_word(M.x86.R_AX, (u16) srcval); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xaa ****************************************************************************/ static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1)) { int inc; START_OF_INSTR(); DECODE_PRINTF("STOS\tBYTE\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -1; else inc = 1; TRACE_AND_STEP(); if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL); M.x86.R_CX -= 1; M.x86.R_DI += inc; } M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } else { store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL); M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xab ****************************************************************************/ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1)) { int inc; u32 count; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("STOS\tDWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -4; else inc = 4; } else { DECODE_PRINTF("STOS\tWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -2; else inc = 2; } TRACE_AND_STEP(); count = 1; if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* move them until CX is ZERO. */ count = M.x86.R_CX; M.x86.R_CX = 0; M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } while (count--) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX); } else { store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX); } M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xac ****************************************************************************/ static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1)) { int inc; START_OF_INSTR(); DECODE_PRINTF("LODS\tBYTE\n"); TRACE_AND_STEP(); if (ACCESS_FLAG(F_DF)) /* down */ inc = -1; else inc = 1; if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { M.x86.R_AL = fetch_data_byte(M.x86.R_SI); M.x86.R_CX -= 1; M.x86.R_SI += inc; } M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } else { M.x86.R_AL = fetch_data_byte(M.x86.R_SI); M.x86.R_SI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xad ****************************************************************************/ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1)) { int inc; u32 count; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("LODS\tDWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -4; else inc = 4; } else { DECODE_PRINTF("LODS\tWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -2; else inc = 2; } TRACE_AND_STEP(); count = 1; if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* move them until CX is ZERO. */ count = M.x86.R_CX; M.x86.R_CX = 0; M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } while (count--) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = fetch_data_long(M.x86.R_SI); } else { M.x86.R_AX = fetch_data_word(M.x86.R_SI); } M.x86.R_SI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xae ****************************************************************************/ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1)) { s8 val2; int inc; START_OF_INSTR(); DECODE_PRINTF("SCAS\tBYTE\n"); TRACE_AND_STEP(); if (ACCESS_FLAG(F_DF)) /* down */ inc = -1; else inc = 1; if (M.x86.mode & SYSMODE_PREFIX_REPE) { /* REPE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); cmp_byte(M.x86.R_AL, val2); M.x86.R_CX -= 1; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF) == 0) break; } M.x86.mode &= ~SYSMODE_PREFIX_REPE; } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { /* REPNE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); cmp_byte(M.x86.R_AL, val2); M.x86.R_CX -= 1; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF)) break; /* zero flag set means equal */ } M.x86.mode &= ~SYSMODE_PREFIX_REPNE; } else { val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); cmp_byte(M.x86.R_AL, val2); M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xaf ****************************************************************************/ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1)) { int inc; u32 val; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("SCAS\tDWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -4; else inc = 4; } else { DECODE_PRINTF("SCAS\tWORD\n"); if (ACCESS_FLAG(F_DF)) /* down */ inc = -2; else inc = 2; } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_REPE) { /* REPE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); cmp_long(M.x86.R_EAX, val); } else { val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); cmp_word(M.x86.R_AX, (u16) val); } M.x86.R_CX -= 1; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF) == 0) break; } M.x86.mode &= ~SYSMODE_PREFIX_REPE; } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { /* REPNE */ /* move them until CX is ZERO. */ while (M.x86.R_CX != 0) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); cmp_long(M.x86.R_EAX, val); } else { val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); cmp_word(M.x86.R_AX, (u16) val); } M.x86.R_CX -= 1; M.x86.R_DI += inc; if (ACCESS_FLAG(F_ZF)) break; /* zero flag set means equal */ } M.x86.mode &= ~SYSMODE_PREFIX_REPNE; } else { if (M.x86.mode & SYSMODE_PREFIX_DATA) { val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); cmp_long(M.x86.R_EAX, val); } else { val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); cmp_word(M.x86.R_AX, (u16) val); } M.x86.R_DI += inc; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb0 ****************************************************************************/ static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tAL,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_AL = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb1 ****************************************************************************/ static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tCL,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_CL = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb2 ****************************************************************************/ static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tDL,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_DL = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb3 ****************************************************************************/ static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tBL,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_BL = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb4 ****************************************************************************/ static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tAH,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_AH = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb5 ****************************************************************************/ static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tCH,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_CH = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb6 ****************************************************************************/ static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tDH,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_DH = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb7 ****************************************************************************/ static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1)) { u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\tBH,"); imm = fetch_byte_imm(); DECODE_PRINTF2("%x\n", imm); TRACE_AND_STEP(); M.x86.R_BH = imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb8 ****************************************************************************/ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tEAX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tAX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = srcval; } else { M.x86.R_AX = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xb9 ****************************************************************************/ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tECX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tCX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ECX = srcval; } else { M.x86.R_CX = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xba ****************************************************************************/ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tEDX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tDX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDX = srcval; } else { M.x86.R_DX = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xbb ****************************************************************************/ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tEBX,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tBX,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBX = srcval; } else { M.x86.R_BX = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xbc ****************************************************************************/ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tESP,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tSP,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESP = srcval; } else { M.x86.R_SP = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xbd ****************************************************************************/ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tEBP,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tBP,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBP = srcval; } else { M.x86.R_BP = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xbe ****************************************************************************/ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tESI,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tSI,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ESI = srcval; } else { M.x86.R_SI = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xbf ****************************************************************************/ static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1)) { u32 srcval; START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("MOV\tEDI,"); srcval = fetch_long_imm(); } else { DECODE_PRINTF("MOV\tDI,"); srcval = fetch_word_imm(); } DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EDI = srcval; } else { M.x86.R_DI = (u16) srcval; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /* used by opcodes c0, d0, and d2. */ static u8(*opcD0_byte_operation[]) (u8 d, u8 s) = { rol_byte, ror_byte, rcl_byte, rcr_byte, shl_byte, shr_byte, shl_byte, /* sal_byte === shl_byte by definition */ sar_byte,}; /**************************************************************************** REMARKS: Handles opcode 0xc0 ****************************************************************************/ static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 destval; u8 amt; /* * Yet another weirdo special case instruction format. Part of * the opcode held below in "RH". Doubly nested case would * result, except that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ROL\t"); break; case 1: DECODE_PRINTF("ROR\t"); break; case 2: DECODE_PRINTF("RCL\t"); break; case 3: DECODE_PRINTF("RCR\t"); break; case 4: DECODE_PRINTF("SHL\t"); break; case 5: DECODE_PRINTF("SHR\t"); break; case 6: DECODE_PRINTF("SAL\t"); break; case 7: DECODE_PRINTF("SAR\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, amt); store_data_byte(destoffset, destval); break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, amt); store_data_byte(destoffset, destval); break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, amt); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (*destreg, amt); *destreg = destval; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /* used by opcodes c1, d1, and d3. */ static u16(*opcD1_word_operation[]) (u16 s, u8 d) = { rol_word, ror_word, rcl_word, rcr_word, shl_word, shr_word, shl_word, /* sal_byte === shl_byte by definition */ sar_word,}; /* used by opcodes c1, d1, and d3. */ static u32(*opcD1_long_operation[]) (u32 s, u8 d) = { rol_long, ror_long, rcl_long, rcr_long, shl_long, shr_long, shl_long, /* sal_byte === shl_byte by definition */ sar_long,}; /**************************************************************************** REMARKS: Handles opcode 0xc1 ****************************************************************************/ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; u8 amt; /* * Yet another weirdo special case instruction format. Part of * the opcode held below in "RH". Doubly nested case would * result, except that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ROL\t"); break; case 1: DECODE_PRINTF("ROR\t"); break; case 2: DECODE_PRINTF("RCL\t"); break; case 3: DECODE_PRINTF("RCR\t"); break; case 4: DECODE_PRINTF("SHL\t"); break; case 5: DECODE_PRINTF("SHR\t"); break; case 6: DECODE_PRINTF("SAL\t"); break; case 7: DECODE_PRINTF("SAR\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm00_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, amt); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm00_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, amt); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm01_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, amt); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm01_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, amt); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm10_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, amt); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm10_address(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, amt); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; destreg = DECODE_RM_LONG_REGISTER(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); TRACE_AND_STEP(); *destreg = (*opcD1_long_operation[rh]) (*destreg, amt); } else { u16 *destreg; destreg = DECODE_RM_WORD_REGISTER(rl); amt = fetch_byte_imm(); DECODE_PRINTF2(",%x\n", amt); TRACE_AND_STEP(); *destreg = (*opcD1_word_operation[rh]) (*destreg, amt); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc2 ****************************************************************************/ static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1)) { u16 imm; START_OF_INSTR(); DECODE_PRINTF("RET\t"); imm = fetch_word_imm(); DECODE_PRINTF2("%x\n", imm); RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EIP = pop_long(); } else { M.x86.R_IP = pop_word(); } M.x86.R_SP += imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc3 ****************************************************************************/ static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("RET\n"); RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EIP = pop_long(); } else { M.x86.R_IP = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc4 ****************************************************************************/ static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rh, rl; u16 *dstreg; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("LES\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_ES = fetch_data_word(srcoffset + 2); break; case 1: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_ES = fetch_data_word(srcoffset + 2); break; case 2: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_ES = fetch_data_word(srcoffset + 2); break; case 3: /* register to register */ /* UNDEFINED! */ TRACE_AND_STEP(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc5 ****************************************************************************/ static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rh, rl; u16 *dstreg; uint srcoffset; START_OF_INSTR(); DECODE_PRINTF("LDS\t"); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_DS = fetch_data_word(srcoffset + 2); break; case 1: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_DS = fetch_data_word(srcoffset + 2); break; case 2: dstreg = DECODE_RM_WORD_REGISTER(rh); DECODE_PRINTF(","); srcoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *dstreg = fetch_data_word(srcoffset); M.x86.R_DS = fetch_data_word(srcoffset + 2); break; case 3: /* register to register */ /* UNDEFINED! */ TRACE_AND_STEP(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc6 ****************************************************************************/ static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 imm; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); if (rh != 0) { DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n"); HALT_SYS(); } switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%2x\n", imm); TRACE_AND_STEP(); store_data_byte(destoffset, imm); break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%2x\n", imm); TRACE_AND_STEP(); store_data_byte(destoffset, imm); break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%2x\n", imm); TRACE_AND_STEP(); store_data_byte(destoffset, imm); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); imm = fetch_byte_imm(); DECODE_PRINTF2(",%2x\n", imm); TRACE_AND_STEP(); *destreg = imm; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc7 ****************************************************************************/ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; START_OF_INSTR(); DECODE_PRINTF("MOV\t"); FETCH_DECODE_MODRM(mod, rh, rl); if (rh != 0) { DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n"); HALT_SYS(); } switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm00_address(rl); imm = fetch_long_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); store_data_long(destoffset, imm); } else { u16 imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm00_address(rl); imm = fetch_word_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); store_data_word(destoffset, imm); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm01_address(rl); imm = fetch_long_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); store_data_long(destoffset, imm); } else { u16 imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm01_address(rl); imm = fetch_word_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); store_data_word(destoffset, imm); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 imm; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm10_address(rl); imm = fetch_long_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); store_data_long(destoffset, imm); } else { u16 imm; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm10_address(rl); imm = fetch_word_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); store_data_word(destoffset, imm); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 imm; destreg = DECODE_RM_LONG_REGISTER(rl); imm = fetch_long_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); *destreg = imm; } else { u16 *destreg; u16 imm; destreg = DECODE_RM_WORD_REGISTER(rl); imm = fetch_word_imm(); DECODE_PRINTF2(",%x\n", imm); TRACE_AND_STEP(); *destreg = imm; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc8 ****************************************************************************/ static void x86emuOp_enter(u8 X86EMU_UNUSED(op1)) { u16 local, frame_pointer; u8 nesting; int i; START_OF_INSTR(); local = fetch_word_imm(); nesting = fetch_byte_imm(); DECODE_PRINTF2("ENTER %x\n", local); DECODE_PRINTF2(",%x\n", nesting); TRACE_AND_STEP(); push_word(M.x86.R_BP); frame_pointer = M.x86.R_SP; if (nesting > 0) { for (i = 1; i < nesting; i++) { if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_BP -= 4; push_long(fetch_data_long_abs(M.x86.R_SS, M.x86.R_BP)); } else { M.x86.R_BP -= 2; push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP)); } } push_word(frame_pointer); } M.x86.R_BP = frame_pointer; M.x86.R_SP = (u16) (M.x86.R_SP - local); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xc9 ****************************************************************************/ static void x86emuOp_leave(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("LEAVE\n"); TRACE_AND_STEP(); M.x86.R_SP = M.x86.R_BP; if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EBP = pop_long(); } else { M.x86.R_BP = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xca ****************************************************************************/ static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1)) { u16 imm; START_OF_INSTR(); DECODE_PRINTF("RETF\t"); imm = fetch_word_imm(); DECODE_PRINTF2("%x\n", imm); RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EIP = pop_long(); M.x86.R_CS = pop_long() & 0xffff; } else { M.x86.R_IP = pop_word(); M.x86.R_CS = pop_word(); } M.x86.R_SP += imm; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xcb ****************************************************************************/ static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("RETF\n"); RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EIP = pop_long(); M.x86.R_CS = pop_long() & 0xffff; } else { M.x86.R_IP = pop_word(); M.x86.R_CS = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xcc ****************************************************************************/ static void x86emuOp_int3(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("INT 3\n"); TRACE_AND_STEP(); if (_X86EMU_intrTab[3]) { (*_X86EMU_intrTab[3]) (3); } else { push_word((u16) M.x86.R_FLG); CLEAR_FLAG(F_IF); CLEAR_FLAG(F_TF); push_word(M.x86.R_CS); M.x86.R_CS = mem_access_word(3 * 4 + 2); push_word(M.x86.R_IP); M.x86.R_IP = mem_access_word(3 * 4); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xcd ****************************************************************************/ static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1)) { u8 intnum; START_OF_INSTR(); DECODE_PRINTF("INT\t"); intnum = fetch_byte_imm(); DECODE_PRINTF2("%x\n", intnum); TRACE_AND_STEP(); if (_X86EMU_intrTab[intnum]) { (*_X86EMU_intrTab[intnum]) (intnum); } else { push_word((u16) M.x86.R_FLG); CLEAR_FLAG(F_IF); CLEAR_FLAG(F_TF); push_word(M.x86.R_CS); M.x86.R_CS = mem_access_word(intnum * 4 + 2); push_word(M.x86.R_IP); M.x86.R_IP = mem_access_word(intnum * 4); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xce ****************************************************************************/ static void x86emuOp_into(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("INTO\n"); TRACE_AND_STEP(); if (ACCESS_FLAG(F_OF)) { if (_X86EMU_intrTab[4]) { (*_X86EMU_intrTab[4]) (4); } else { push_word((u16) M.x86.R_FLG); CLEAR_FLAG(F_IF); CLEAR_FLAG(F_TF); push_word(M.x86.R_CS); M.x86.R_CS = mem_access_word(4 * 4 + 2); push_word(M.x86.R_IP); M.x86.R_IP = mem_access_word(4 * 4); } } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xcf ****************************************************************************/ static void x86emuOp_iret(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("IRET\n"); TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EIP = pop_long(); M.x86.R_CS = pop_long() & 0xffff; M.x86.R_EFLG = (pop_long() & 0x257FD5) | (M.x86.R_EFLG & 0x1A0000); } else { M.x86.R_IP = pop_word(); M.x86.R_CS = pop_word(); M.x86.R_FLG = pop_word(); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xd0 ****************************************************************************/ static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 destval; /* * Yet another weirdo special case instruction format. Part of * the opcode held below in "RH". Doubly nested case would * result, except that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ROL\t"); break; case 1: DECODE_PRINTF("ROR\t"); break; case 2: DECODE_PRINTF("RCL\t"); break; case 3: DECODE_PRINTF("RCR\t"); break; case 4: DECODE_PRINTF("SHL\t"); break; case 5: DECODE_PRINTF("SHR\t"); break; case 6: DECODE_PRINTF("SAL\t"); break; case 7: DECODE_PRINTF("SAR\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, 1); store_data_byte(destoffset, destval); break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, 1); store_data_byte(destoffset, destval); break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, 1); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(",1\n"); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (*destreg, 1); *destreg = destval; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xd1 ****************************************************************************/ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; /* * Yet another weirdo special case instruction format. Part of * the opcode held below in "RH". Doubly nested case would * result, except that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ROL\t"); break; case 1: DECODE_PRINTF("ROR\t"); break; case 2: DECODE_PRINTF("RCL\t"); break; case 3: DECODE_PRINTF("RCR\t"); break; case 4: DECODE_PRINTF("SHL\t"); break; case 5: DECODE_PRINTF("SHR\t"); break; case 6: DECODE_PRINTF("SAL\t"); break; case 7: DECODE_PRINTF("SAR\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, 1); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, 1); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, 1); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, 1); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, 1); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(",1\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, 1); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; u32 *destreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(",1\n"); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (*destreg, 1); *destreg = destval; } else { u16 destval; u16 *destreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(",1\n"); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (*destreg, 1); *destreg = destval; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xd2 ****************************************************************************/ static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 destval; u8 amt; /* * Yet another weirdo special case instruction format. Part of * the opcode held below in "RH". Doubly nested case would * result, except that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ROL\t"); break; case 1: DECODE_PRINTF("ROR\t"); break; case 2: DECODE_PRINTF("RCL\t"); break; case 3: DECODE_PRINTF("RCR\t"); break; case 4: DECODE_PRINTF("SHL\t"); break; case 5: DECODE_PRINTF("SHR\t"); break; case 6: DECODE_PRINTF("SAL\t"); break; case 7: DECODE_PRINTF("SAR\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ amt = M.x86.R_CL; switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, amt); store_data_byte(destoffset, destval); break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, amt); store_data_byte(destoffset, destval); break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (destval, amt); store_data_byte(destoffset, destval); break; case 3: /* register to register */ destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); destval = (*opcD0_byte_operation[rh]) (*destreg, amt); *destreg = destval; break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xd3 ****************************************************************************/ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; u8 amt; /* * Yet another weirdo special case instruction format. Part of * the opcode held below in "RH". Doubly nested case would * result, except that the decoded instruction */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("ROL\t"); break; case 1: DECODE_PRINTF("ROR\t"); break; case 2: DECODE_PRINTF("RCL\t"); break; case 3: DECODE_PRINTF("RCR\t"); break; case 4: DECODE_PRINTF("SHL\t"); break; case 5: DECODE_PRINTF("SHR\t"); break; case 6: DECODE_PRINTF("SAL\t"); break; case 7: DECODE_PRINTF("SAR\t"); break; } } #endif /* know operation, decode the mod byte to find the addressing mode. */ amt = M.x86.R_CL; switch (mod) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, amt); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, amt); store_data_word(destoffset, destval); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, amt); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, amt); store_data_word(destoffset, destval); } break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = (*opcD1_long_operation[rh]) (destval, amt); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("WORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(",CL\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = (*opcD1_word_operation[rh]) (destval, amt); store_data_word(destoffset, destval); } break; case 3: /* register to register */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); *destreg = (*opcD1_long_operation[rh]) (*destreg, amt); } else { u16 *destreg; destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(",CL\n"); TRACE_AND_STEP(); *destreg = (*opcD1_word_operation[rh]) (*destreg, amt); } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xd4 ****************************************************************************/ static void x86emuOp_aam(u8 X86EMU_UNUSED(op1)) { u8 a; START_OF_INSTR(); DECODE_PRINTF("AAM\n"); a = fetch_byte_imm(); /* this is a stupid encoding. */ if (a != 10) { /* fix: add base decoding aam_word(u8 val, int base a) */ DECODE_PRINTF("ERROR DECODING AAM\n"); TRACE_REGS(); HALT_SYS(); } TRACE_AND_STEP(); /* note the type change here --- returning AL and AH in AX. */ M.x86.R_AX = aam_word(M.x86.R_AL); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xd5 ****************************************************************************/ static void x86emuOp_aad(u8 X86EMU_UNUSED(op1)) { u8 a; START_OF_INSTR(); DECODE_PRINTF("AAD\n"); a = fetch_byte_imm(); if (a != 10) { /* fix: add base decoding aad_word(u16 val, int base a) */ DECODE_PRINTF("ERROR DECODING AAM\n"); TRACE_REGS(); HALT_SYS(); } TRACE_AND_STEP(); M.x86.R_AX = aad_word(M.x86.R_AX); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /* opcode 0xd6 ILLEGAL OPCODE */ /**************************************************************************** REMARKS: Handles opcode 0xd7 ****************************************************************************/ static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1)) { u16 addr; START_OF_INSTR(); DECODE_PRINTF("XLAT\n"); TRACE_AND_STEP(); addr = (u16) (M.x86.R_BX + (u8) M.x86.R_AL); M.x86.R_AL = fetch_data_byte(addr); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /* instuctions D8 .. DF are in i87_ops.c */ /**************************************************************************** REMARKS: Handles opcode 0xe0 ****************************************************************************/ static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1)) { s16 ip; START_OF_INSTR(); DECODE_PRINTF("LOOPNE\t"); ip = (s8) fetch_byte_imm(); ip += (s16) M.x86.R_IP; DECODE_PRINTF2("%04x\n", ip); TRACE_AND_STEP(); M.x86.R_CX -= 1; if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */ M.x86.R_IP = ip; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe1 ****************************************************************************/ static void x86emuOp_loope(u8 X86EMU_UNUSED(op1)) { s16 ip; START_OF_INSTR(); DECODE_PRINTF("LOOPE\t"); ip = (s8) fetch_byte_imm(); ip += (s16) M.x86.R_IP; DECODE_PRINTF2("%04x\n", ip); TRACE_AND_STEP(); M.x86.R_CX -= 1; if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */ M.x86.R_IP = ip; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe2 ****************************************************************************/ static void x86emuOp_loop(u8 X86EMU_UNUSED(op1)) { s16 ip; START_OF_INSTR(); DECODE_PRINTF("LOOP\t"); ip = (s8) fetch_byte_imm(); ip += (s16) M.x86.R_IP; DECODE_PRINTF2("%04x\n", ip); TRACE_AND_STEP(); M.x86.R_CX -= 1; if (M.x86.R_CX != 0) M.x86.R_IP = ip; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe3 ****************************************************************************/ static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1)) { u16 target; s8 offset; /* jump to byte offset if overflow flag is set */ START_OF_INSTR(); DECODE_PRINTF("JCXZ\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); if (M.x86.R_CX == 0) M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe4 ****************************************************************************/ static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) { u8 port; START_OF_INSTR(); DECODE_PRINTF("IN\t"); port = (u8) fetch_byte_imm(); DECODE_PRINTF2("%x,AL\n", port); TRACE_AND_STEP(); M.x86.R_AL = (*sys_inb) (port); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe5 ****************************************************************************/ static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1)) { u8 port; START_OF_INSTR(); DECODE_PRINTF("IN\t"); port = (u8) fetch_byte_imm(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF2("EAX,%x\n", port); } else { DECODE_PRINTF2("AX,%x\n", port); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = (*sys_inl) (port); } else { M.x86.R_AX = (*sys_inw) (port); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe6 ****************************************************************************/ static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1)) { u8 port; START_OF_INSTR(); DECODE_PRINTF("OUT\t"); port = (u8) fetch_byte_imm(); DECODE_PRINTF2("%x,AL\n", port); TRACE_AND_STEP(); (*sys_outb) (port, M.x86.R_AL); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe7 ****************************************************************************/ static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1)) { u8 port; START_OF_INSTR(); DECODE_PRINTF("OUT\t"); port = (u8) fetch_byte_imm(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF2("%x,EAX\n", port); } else { DECODE_PRINTF2("%x,AX\n", port); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { (*sys_outl) (port, M.x86.R_EAX); } else { (*sys_outw) (port, M.x86.R_AX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe8 ****************************************************************************/ static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1)) { s16 ip16 = 0; s32 ip32 = 0; START_OF_INSTR(); DECODE_PRINTF("CALL\t"); if (M.x86.mode & SYSMODE_PREFIX_DATA) { ip32 = (s32) fetch_long_imm(); ip32 += (s16) M.x86.R_IP; /* CHECK SIGN */ DECODE_PRINTF2("%04x\n", (u16) ip32); CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip32, ""); } else { ip16 = (s16) fetch_word_imm(); ip16 += (s16) M.x86.R_IP; /* CHECK SIGN */ DECODE_PRINTF2("%04x\n", (u16) ip16); CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip16, ""); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { push_long(M.x86.R_EIP); M.x86.R_EIP = ip32 & 0xffff; } else { push_word(M.x86.R_IP); M.x86.R_EIP = ip16; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xe9 ****************************************************************************/ static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1)) { u32 ip; START_OF_INSTR(); DECODE_PRINTF("JMP\t"); if (M.x86.mode & SYSMODE_PREFIX_DATA) { ip = (u32) fetch_long_imm(); ip += (u32) M.x86.R_EIP; DECODE_PRINTF2("%08x\n", (u32) ip); TRACE_AND_STEP(); M.x86.R_EIP = (u32) ip; } else { ip = (s16) fetch_word_imm(); ip += (s16) M.x86.R_IP; DECODE_PRINTF2("%04x\n", (u16) ip); TRACE_AND_STEP(); M.x86.R_IP = (u16) ip; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xea ****************************************************************************/ static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1)) { u16 cs; u32 ip; START_OF_INSTR(); DECODE_PRINTF("JMP\tFAR "); if (M.x86.mode & SYSMODE_PREFIX_DATA) { ip = fetch_long_imm(); } else { ip = fetch_word_imm(); } cs = fetch_word_imm(); DECODE_PRINTF2("%04x:", cs); DECODE_PRINTF2("%04x\n", ip); TRACE_AND_STEP(); M.x86.R_EIP = ip & 0xffff; M.x86.R_CS = cs; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xeb ****************************************************************************/ static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1)) { u16 target; s8 offset; START_OF_INSTR(); DECODE_PRINTF("JMP\t"); offset = (s8) fetch_byte_imm(); target = (u16) (M.x86.R_IP + offset); DECODE_PRINTF2("%x\n", target); TRACE_AND_STEP(); M.x86.R_IP = target; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xec ****************************************************************************/ static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("IN\tAL,DX\n"); TRACE_AND_STEP(); M.x86.R_AL = (*sys_inb) (M.x86.R_DX); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xed ****************************************************************************/ static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("IN\tEAX,DX\n"); } else { DECODE_PRINTF("IN\tAX,DX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_EAX = (*sys_inl) (M.x86.R_DX); } else { M.x86.R_AX = (*sys_inw) (M.x86.R_DX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xee ****************************************************************************/ static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("OUT\tDX,AL\n"); TRACE_AND_STEP(); (*sys_outb) (M.x86.R_DX, M.x86.R_AL); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xef ****************************************************************************/ static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("OUT\tDX,EAX\n"); } else { DECODE_PRINTF("OUT\tDX,AX\n"); } TRACE_AND_STEP(); if (M.x86.mode & SYSMODE_PREFIX_DATA) { (*sys_outl) (M.x86.R_DX, M.x86.R_EAX); } else { (*sys_outw) (M.x86.R_DX, M.x86.R_AX); } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf0 ****************************************************************************/ static void x86emuOp_lock(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("LOCK:\n"); TRACE_AND_STEP(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /*opcode 0xf1 ILLEGAL OPERATION */ /**************************************************************************** REMARKS: Handles opcode 0xf2 ****************************************************************************/ static void x86emuOp_repne(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("REPNE\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_PREFIX_REPNE; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf3 ****************************************************************************/ static void x86emuOp_repe(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("REPE\n"); TRACE_AND_STEP(); M.x86.mode |= SYSMODE_PREFIX_REPE; DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf4 ****************************************************************************/ static void x86emuOp_halt(u8 X86EMU_UNUSED(op1)) { START_OF_INSTR(); DECODE_PRINTF("HALT\n"); TRACE_AND_STEP(); HALT_SYS(); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf5 ****************************************************************************/ static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1)) { /* complement the carry flag. */ START_OF_INSTR(); DECODE_PRINTF("CMC\n"); TRACE_AND_STEP(); TOGGLE_FLAG(F_CF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf6 ****************************************************************************/ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; u8 *destreg; uint destoffset; u8 destval, srcval; /* long, drawn out code follows. Double switch for a total of 32 cases. */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: /* mod=00 */ switch (rh) { case 0: /* test byte imm */ DECODE_PRINTF("TEST\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcval = fetch_byte_imm(); DECODE_PRINTF2("%02x\n", srcval); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); test_byte(destval, srcval); break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: DECODE_PRINTF("NOT\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = not_byte(destval); store_data_byte(destoffset, destval); break; case 3: DECODE_PRINTF("NEG\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = neg_byte(destval); store_data_byte(destoffset, destval); break; case 4: DECODE_PRINTF("MUL\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); mul_byte(destval); break; case 5: DECODE_PRINTF("IMUL\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); imul_byte(destval); break; case 6: DECODE_PRINTF("DIV\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); div_byte(destval); break; case 7: DECODE_PRINTF("IDIV\tBYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); idiv_byte(destval); break; } break; /* end mod==00 */ case 1: /* mod=01 */ switch (rh) { case 0: /* test byte imm */ DECODE_PRINTF("TEST\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcval = fetch_byte_imm(); DECODE_PRINTF2("%02x\n", srcval); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); test_byte(destval, srcval); break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: DECODE_PRINTF("NOT\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = not_byte(destval); store_data_byte(destoffset, destval); break; case 3: DECODE_PRINTF("NEG\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = neg_byte(destval); store_data_byte(destoffset, destval); break; case 4: DECODE_PRINTF("MUL\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); mul_byte(destval); break; case 5: DECODE_PRINTF("IMUL\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); imul_byte(destval); break; case 6: DECODE_PRINTF("DIV\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); div_byte(destval); break; case 7: DECODE_PRINTF("IDIV\tBYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); idiv_byte(destval); break; } break; /* end mod==01 */ case 2: /* mod=10 */ switch (rh) { case 0: /* test byte imm */ DECODE_PRINTF("TEST\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcval = fetch_byte_imm(); DECODE_PRINTF2("%02x\n", srcval); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); test_byte(destval, srcval); break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: DECODE_PRINTF("NOT\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = not_byte(destval); store_data_byte(destoffset, destval); break; case 3: DECODE_PRINTF("NEG\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = neg_byte(destval); store_data_byte(destoffset, destval); break; case 4: DECODE_PRINTF("MUL\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); mul_byte(destval); break; case 5: DECODE_PRINTF("IMUL\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); imul_byte(destval); break; case 6: DECODE_PRINTF("DIV\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); div_byte(destval); break; case 7: DECODE_PRINTF("IDIV\tBYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); idiv_byte(destval); break; } break; /* end mod==10 */ case 3: /* mod=11 */ switch (rh) { case 0: /* test byte imm */ DECODE_PRINTF("TEST\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF(","); srcval = fetch_byte_imm(); DECODE_PRINTF2("%02x\n", srcval); TRACE_AND_STEP(); test_byte(*destreg, srcval); break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: DECODE_PRINTF("NOT\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = not_byte(*destreg); break; case 3: DECODE_PRINTF("NEG\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = neg_byte(*destreg); break; case 4: DECODE_PRINTF("MUL\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); mul_byte(*destreg); /*!!! */ break; case 5: DECODE_PRINTF("IMUL\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); imul_byte(*destreg); break; case 6: DECODE_PRINTF("DIV\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); div_byte(*destreg); break; case 7: DECODE_PRINTF("IDIV\t"); destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); idiv_byte(*destreg); break; } break; /* end mod==11 */ } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf7 ****************************************************************************/ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1)) { int mod, rl, rh; uint destoffset; /* long, drawn out code follows. Double switch for a total of 32 cases. */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); switch (mod) { case 0: /* mod=00 */ switch (rh) { case 0: /* test word imm */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, srcval; DECODE_PRINTF("TEST\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcval = fetch_long_imm(); DECODE_PRINTF2("%x\n", srcval); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); test_long(destval, srcval); } else { u16 destval, srcval; DECODE_PRINTF("TEST\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF(","); srcval = fetch_word_imm(); DECODE_PRINTF2("%x\n", srcval); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); test_word(destval, srcval); } break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n"); HALT_SYS(); break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("NOT\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = not_long(destval); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("NOT\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = not_word(destval); store_data_word(destoffset, destval); } break; case 3: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("NEG\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = neg_long(destval); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("NEG\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = neg_word(destval); store_data_word(destoffset, destval); } break; case 4: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("MUL\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); mul_long(destval); } else { u16 destval; DECODE_PRINTF("MUL\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); mul_word(destval); } break; case 5: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("IMUL\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); imul_long(destval); } else { u16 destval; DECODE_PRINTF("IMUL\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); imul_word(destval); } break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DIV\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); div_long(destval); } else { u16 destval; DECODE_PRINTF("DIV\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); div_word(destval); } break; case 7: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("IDIV\tDWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); idiv_long(destval); } else { u16 destval; DECODE_PRINTF("IDIV\tWORD PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); idiv_word(destval); } break; } break; /* end mod==00 */ case 1: /* mod=01 */ switch (rh) { case 0: /* test word imm */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, srcval; DECODE_PRINTF("TEST\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcval = fetch_long_imm(); DECODE_PRINTF2("%x\n", srcval); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); test_long(destval, srcval); } else { u16 destval, srcval; DECODE_PRINTF("TEST\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF(","); srcval = fetch_word_imm(); DECODE_PRINTF2("%x\n", srcval); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); test_word(destval, srcval); } break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("NOT\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = not_long(destval); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("NOT\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = not_word(destval); store_data_word(destoffset, destval); } break; case 3: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("NEG\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = neg_long(destval); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("NEG\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = neg_word(destval); store_data_word(destoffset, destval); } break; case 4: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("MUL\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); mul_long(destval); } else { u16 destval; DECODE_PRINTF("MUL\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); mul_word(destval); } break; case 5: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("IMUL\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); imul_long(destval); } else { u16 destval; DECODE_PRINTF("IMUL\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); imul_word(destval); } break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DIV\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); div_long(destval); } else { u16 destval; DECODE_PRINTF("DIV\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); div_word(destval); } break; case 7: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("IDIV\tDWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); idiv_long(destval); } else { u16 destval; DECODE_PRINTF("IDIV\tWORD PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); idiv_word(destval); } break; } break; /* end mod==01 */ case 2: /* mod=10 */ switch (rh) { case 0: /* test word imm */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval, srcval; DECODE_PRINTF("TEST\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcval = fetch_long_imm(); DECODE_PRINTF2("%x\n", srcval); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); test_long(destval, srcval); } else { u16 destval, srcval; DECODE_PRINTF("TEST\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF(","); srcval = fetch_word_imm(); DECODE_PRINTF2("%x\n", srcval); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); test_word(destval, srcval); } break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("NOT\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = not_long(destval); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("NOT\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = not_word(destval); store_data_word(destoffset, destval); } break; case 3: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("NEG\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); destval = neg_long(destval); store_data_long(destoffset, destval); } else { u16 destval; DECODE_PRINTF("NEG\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); destval = neg_word(destval); store_data_word(destoffset, destval); } break; case 4: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("MUL\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); mul_long(destval); } else { u16 destval; DECODE_PRINTF("MUL\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); mul_word(destval); } break; case 5: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("IMUL\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); imul_long(destval); } else { u16 destval; DECODE_PRINTF("IMUL\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); imul_word(destval); } break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("DIV\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); div_long(destval); } else { u16 destval; DECODE_PRINTF("DIV\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); div_word(destval); } break; case 7: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval; DECODE_PRINTF("IDIV\tDWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_long(destoffset); TRACE_AND_STEP(); idiv_long(destval); } else { u16 destval; DECODE_PRINTF("IDIV\tWORD PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); destval = fetch_data_word(destoffset); TRACE_AND_STEP(); idiv_word(destval); } break; } break; /* end mod==10 */ case 3: /* mod=11 */ switch (rh) { case 0: /* test word imm */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; u32 srcval; DECODE_PRINTF("TEST\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF(","); srcval = fetch_long_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); test_long(*destreg, srcval); } else { u16 *destreg; u16 srcval; DECODE_PRINTF("TEST\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF(","); srcval = fetch_word_imm(); DECODE_PRINTF2("%x\n", srcval); TRACE_AND_STEP(); test_word(*destreg, srcval); } break; case 1: DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n"); HALT_SYS(); break; case 2: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; DECODE_PRINTF("NOT\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = not_long(*destreg); } else { u16 *destreg; DECODE_PRINTF("NOT\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = not_word(*destreg); } break; case 3: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; DECODE_PRINTF("NEG\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = neg_long(*destreg); } else { u16 *destreg; DECODE_PRINTF("NEG\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg = neg_word(*destreg); } break; case 4: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; DECODE_PRINTF("MUL\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); mul_long(*destreg); /*!!! */ } else { u16 *destreg; DECODE_PRINTF("MUL\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); mul_word(*destreg); /*!!! */ } break; case 5: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; DECODE_PRINTF("IMUL\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); imul_long(*destreg); } else { u16 *destreg; DECODE_PRINTF("IMUL\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); imul_word(*destreg); } break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; DECODE_PRINTF("DIV\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); div_long(*destreg); } else { u16 *destreg; DECODE_PRINTF("DIV\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); div_word(*destreg); } break; case 7: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg; DECODE_PRINTF("IDIV\t"); destreg = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); idiv_long(*destreg); } else { u16 *destreg; DECODE_PRINTF("IDIV\t"); destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); idiv_word(*destreg); } break; } break; /* end mod==11 */ } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf8 ****************************************************************************/ static void x86emuOp_clc(u8 X86EMU_UNUSED(op1)) { /* clear the carry flag. */ START_OF_INSTR(); DECODE_PRINTF("CLC\n"); TRACE_AND_STEP(); CLEAR_FLAG(F_CF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xf9 ****************************************************************************/ static void x86emuOp_stc(u8 X86EMU_UNUSED(op1)) { /* set the carry flag. */ START_OF_INSTR(); DECODE_PRINTF("STC\n"); TRACE_AND_STEP(); SET_FLAG(F_CF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xfa ****************************************************************************/ static void x86emuOp_cli(u8 X86EMU_UNUSED(op1)) { /* clear interrupts. */ START_OF_INSTR(); DECODE_PRINTF("CLI\n"); TRACE_AND_STEP(); CLEAR_FLAG(F_IF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xfb ****************************************************************************/ static void x86emuOp_sti(u8 X86EMU_UNUSED(op1)) { /* enable interrupts. */ START_OF_INSTR(); DECODE_PRINTF("STI\n"); TRACE_AND_STEP(); SET_FLAG(F_IF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xfc ****************************************************************************/ static void x86emuOp_cld(u8 X86EMU_UNUSED(op1)) { /* clear interrupts. */ START_OF_INSTR(); DECODE_PRINTF("CLD\n"); TRACE_AND_STEP(); CLEAR_FLAG(F_DF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xfd ****************************************************************************/ static void x86emuOp_std(u8 X86EMU_UNUSED(op1)) { /* clear interrupts. */ START_OF_INSTR(); DECODE_PRINTF("STD\n"); TRACE_AND_STEP(); SET_FLAG(F_DF); DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xfe ****************************************************************************/ static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1)) { int mod, rh, rl; u8 destval; uint destoffset; u8 *destreg; /* Yet another special case instruction. */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: DECODE_PRINTF("INC\t"); break; case 1: DECODE_PRINTF("DEC\t"); break; case 2: case 3: case 4: case 5: case 6: case 7: DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod); HALT_SYS(); break; } } #endif switch (mod) { case 0: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: /* inc word ptr ... */ destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = inc_byte(destval); store_data_byte(destoffset, destval); break; case 1: /* dec word ptr ... */ destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = dec_byte(destval); store_data_byte(destoffset, destval); break; } break; case 1: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = inc_byte(destval); store_data_byte(destoffset, destval); break; case 1: destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = dec_byte(destval); store_data_byte(destoffset, destval); break; } break; case 2: DECODE_PRINTF("BYTE PTR "); destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = inc_byte(destval); store_data_byte(destoffset, destval); break; case 1: destval = fetch_data_byte(destoffset); TRACE_AND_STEP(); destval = dec_byte(destval); store_data_byte(destoffset, destval); break; } break; case 3: destreg = DECODE_RM_BYTE_REGISTER(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: TRACE_AND_STEP(); *destreg = inc_byte(*destreg); break; case 1: TRACE_AND_STEP(); *destreg = dec_byte(*destreg); break; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /**************************************************************************** REMARKS: Handles opcode 0xff ****************************************************************************/ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) { int mod, rh, rl; uint destoffset = 0; u16 *destreg; u16 destval, destval2; /* Yet another special case instruction. */ START_OF_INSTR(); FETCH_DECODE_MODRM(mod, rh, rl); #ifdef DEBUG if (DEBUG_DECODE()) { /* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings in the same format, even though the result is that the above test is done twice. */ switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("INC\tDWORD PTR "); } else { DECODE_PRINTF("INC\tWORD PTR "); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { DECODE_PRINTF("DEC\tDWORD PTR "); } else { DECODE_PRINTF("DEC\tWORD PTR "); } break; case 2: DECODE_PRINTF("CALL\t"); break; case 3: DECODE_PRINTF("CALL\tFAR "); break; case 4: DECODE_PRINTF("JMP\t"); break; case 5: DECODE_PRINTF("JMP\tFAR "); break; case 6: DECODE_PRINTF("PUSH\t"); break; case 7: DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t"); HALT_SYS(); break; } } #endif switch (mod) { case 0: destoffset = decode_rm00_address(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: /* inc word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); destval32 = inc_long(destval32); store_data_long(destoffset, destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); destval16 = inc_word(destval16); store_data_word(destoffset, destval16); } break; case 1: /* dec word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); destval32 = dec_long(destval32); store_data_long(destoffset, destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); destval16 = dec_word(destval16); store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destval = fetch_data_long(destoffset); TRACE_AND_STEP(); push_long(M.x86.R_EIP); M.x86.R_EIP = destval; } else { destval = fetch_data_word(destoffset); TRACE_AND_STEP(); push_word(M.x86.R_IP); M.x86.R_IP = destval; } break; case 3: /* call far ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destval = fetch_data_long(destoffset); destval2 = fetch_data_word(destoffset + 4); TRACE_AND_STEP(); push_long(M.x86.R_CS); M.x86.R_CS = destval2; push_long(M.x86.R_EIP); M.x86.R_EIP = destval; } else { destval = fetch_data_word(destoffset); destval2 = fetch_data_word(destoffset + 2); TRACE_AND_STEP(); push_word(M.x86.R_CS); M.x86.R_CS = destval2; push_word(M.x86.R_IP); M.x86.R_IP = destval; } break; case 4: /* jmp word ptr ... */ destval = fetch_data_word(destoffset); TRACE_AND_STEP(); M.x86.R_IP = destval; break; case 5: /* jmp far ptr ... */ destval = fetch_data_word(destoffset); destval2 = fetch_data_word(destoffset + 2); TRACE_AND_STEP(); M.x86.R_IP = destval; M.x86.R_CS = destval2; break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); push_long(destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); push_word(destval16); } break; } break; case 1: destoffset = decode_rm01_address(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); destval32 = inc_long(destval32); store_data_long(destoffset, destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); destval16 = inc_word(destval16); store_data_word(destoffset, destval16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); destval32 = dec_long(destval32); store_data_long(destoffset, destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); destval16 = dec_word(destval16); store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destval = fetch_data_long(destoffset); TRACE_AND_STEP(); push_long(M.x86.R_EIP); M.x86.R_EIP = destval; } else { destval = fetch_data_word(destoffset); TRACE_AND_STEP(); push_word(M.x86.R_IP); M.x86.R_IP = destval; } break; case 3: /* call far ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destval = fetch_data_long(destoffset); destval2 = fetch_data_word(destoffset + 4); TRACE_AND_STEP(); push_long(M.x86.R_CS); M.x86.R_CS = destval2; push_long(M.x86.R_EIP); M.x86.R_EIP = destval; } else { destval = fetch_data_word(destoffset); destval2 = fetch_data_word(destoffset + 2); TRACE_AND_STEP(); push_word(M.x86.R_CS); M.x86.R_CS = destval2; push_word(M.x86.R_IP); M.x86.R_IP = destval; } break; case 4: /* jmp word ptr ... */ destval = fetch_data_word(destoffset); TRACE_AND_STEP(); M.x86.R_IP = destval; break; case 5: /* jmp far ptr ... */ destval = fetch_data_word(destoffset); destval2 = fetch_data_word(destoffset + 2); TRACE_AND_STEP(); M.x86.R_IP = destval; M.x86.R_CS = destval2; break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); push_long(destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); push_word(destval16); } break; } break; case 2: destoffset = decode_rm10_address(rl); DECODE_PRINTF("\n"); switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); destval32 = inc_long(destval32); store_data_long(destoffset, destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); destval16 = inc_word(destval16); store_data_word(destoffset, destval16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); destval32 = dec_long(destval32); store_data_long(destoffset, destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); destval16 = dec_word(destval16); store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destval = fetch_data_long(destoffset); TRACE_AND_STEP(); push_long(M.x86.R_EIP); M.x86.R_EIP = destval; } else { destval = fetch_data_word(destoffset); TRACE_AND_STEP(); push_word(M.x86.R_IP); M.x86.R_IP = destval; } break; case 3: /* call far ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destval = fetch_data_long(destoffset); destval2 = fetch_data_word(destoffset + 4); TRACE_AND_STEP(); push_long(M.x86.R_CS); M.x86.R_CS = destval2; push_long(M.x86.R_EIP); M.x86.R_EIP = destval; } else { destval = fetch_data_word(destoffset); destval2 = fetch_data_word(destoffset + 2); TRACE_AND_STEP(); push_word(M.x86.R_CS); M.x86.R_CS = destval2; push_word(M.x86.R_IP); M.x86.R_IP = destval; } break; case 4: /* jmp word ptr ... */ destval = fetch_data_word(destoffset); TRACE_AND_STEP(); M.x86.R_IP = destval; break; case 5: /* jmp far ptr ... */ destval = fetch_data_word(destoffset); destval2 = fetch_data_word(destoffset + 2); TRACE_AND_STEP(); M.x86.R_IP = destval; M.x86.R_CS = destval2; break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 destval32; destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); push_long(destval32); } else { u16 destval16; destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); push_word(destval16); } break; } break; case 3: switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg32; destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg32 = inc_long(*destreg32); } else { u16 *destreg16; destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg16 = inc_word(*destreg16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg32; destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg32 = dec_long(*destreg32); } else { u16 *destreg16; destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); *destreg16 = dec_word(*destreg16); } break; case 2: /* call word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { destreg = (u16 *)DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); push_long(M.x86.R_EIP); M.x86.R_EIP = *destreg; } else { destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); push_word(M.x86.R_IP); M.x86.R_IP = *destreg; } break; case 3: /* jmp far ptr ... */ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n"); TRACE_AND_STEP(); HALT_SYS(); break; case 4: /* jmp ... */ destreg = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); M.x86.R_IP = (u16) (*destreg); break; case 5: /* jmp far ptr ... */ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n"); TRACE_AND_STEP(); HALT_SYS(); break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { u32 *destreg32; destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); push_long(*destreg32); } else { u16 *destreg16; destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); push_word(*destreg16); } break; } break; } DECODE_CLEAR_SEGOVR(); END_OF_INSTR(); } /*************************************************************************** * Single byte operation code table: **************************************************************************/ void (*x86emu_optab[256]) (u8) = { /* 0x00 */ x86emuOp_add_byte_RM_R, /* 0x01 */ x86emuOp_add_word_RM_R, /* 0x02 */ x86emuOp_add_byte_R_RM, /* 0x03 */ x86emuOp_add_word_R_RM, /* 0x04 */ x86emuOp_add_byte_AL_IMM, /* 0x05 */ x86emuOp_add_word_AX_IMM, /* 0x06 */ x86emuOp_push_ES, /* 0x07 */ x86emuOp_pop_ES, /* 0x08 */ x86emuOp_or_byte_RM_R, /* 0x09 */ x86emuOp_or_word_RM_R, /* 0x0a */ x86emuOp_or_byte_R_RM, /* 0x0b */ x86emuOp_or_word_R_RM, /* 0x0c */ x86emuOp_or_byte_AL_IMM, /* 0x0d */ x86emuOp_or_word_AX_IMM, /* 0x0e */ x86emuOp_push_CS, /* 0x0f */ x86emuOp_two_byte, /* 0x10 */ x86emuOp_adc_byte_RM_R, /* 0x11 */ x86emuOp_adc_word_RM_R, /* 0x12 */ x86emuOp_adc_byte_R_RM, /* 0x13 */ x86emuOp_adc_word_R_RM, /* 0x14 */ x86emuOp_adc_byte_AL_IMM, /* 0x15 */ x86emuOp_adc_word_AX_IMM, /* 0x16 */ x86emuOp_push_SS, /* 0x17 */ x86emuOp_pop_SS, /* 0x18 */ x86emuOp_sbb_byte_RM_R, /* 0x19 */ x86emuOp_sbb_word_RM_R, /* 0x1a */ x86emuOp_sbb_byte_R_RM, /* 0x1b */ x86emuOp_sbb_word_R_RM, /* 0x1c */ x86emuOp_sbb_byte_AL_IMM, /* 0x1d */ x86emuOp_sbb_word_AX_IMM, /* 0x1e */ x86emuOp_push_DS, /* 0x1f */ x86emuOp_pop_DS, /* 0x20 */ x86emuOp_and_byte_RM_R, /* 0x21 */ x86emuOp_and_word_RM_R, /* 0x22 */ x86emuOp_and_byte_R_RM, /* 0x23 */ x86emuOp_and_word_R_RM, /* 0x24 */ x86emuOp_and_byte_AL_IMM, /* 0x25 */ x86emuOp_and_word_AX_IMM, /* 0x26 */ x86emuOp_segovr_ES, /* 0x27 */ x86emuOp_daa, /* 0x28 */ x86emuOp_sub_byte_RM_R, /* 0x29 */ x86emuOp_sub_word_RM_R, /* 0x2a */ x86emuOp_sub_byte_R_RM, /* 0x2b */ x86emuOp_sub_word_R_RM, /* 0x2c */ x86emuOp_sub_byte_AL_IMM, /* 0x2d */ x86emuOp_sub_word_AX_IMM, /* 0x2e */ x86emuOp_segovr_CS, /* 0x2f */ x86emuOp_das, /* 0x30 */ x86emuOp_xor_byte_RM_R, /* 0x31 */ x86emuOp_xor_word_RM_R, /* 0x32 */ x86emuOp_xor_byte_R_RM, /* 0x33 */ x86emuOp_xor_word_R_RM, /* 0x34 */ x86emuOp_xor_byte_AL_IMM, /* 0x35 */ x86emuOp_xor_word_AX_IMM, /* 0x36 */ x86emuOp_segovr_SS, /* 0x37 */ x86emuOp_aaa, /* 0x38 */ x86emuOp_cmp_byte_RM_R, /* 0x39 */ x86emuOp_cmp_word_RM_R, /* 0x3a */ x86emuOp_cmp_byte_R_RM, /* 0x3b */ x86emuOp_cmp_word_R_RM, /* 0x3c */ x86emuOp_cmp_byte_AL_IMM, /* 0x3d */ x86emuOp_cmp_word_AX_IMM, /* 0x3e */ x86emuOp_segovr_DS, /* 0x3f */ x86emuOp_aas, /* 0x40 */ x86emuOp_inc_AX, /* 0x41 */ x86emuOp_inc_CX, /* 0x42 */ x86emuOp_inc_DX, /* 0x43 */ x86emuOp_inc_BX, /* 0x44 */ x86emuOp_inc_SP, /* 0x45 */ x86emuOp_inc_BP, /* 0x46 */ x86emuOp_inc_SI, /* 0x47 */ x86emuOp_inc_DI, /* 0x48 */ x86emuOp_dec_AX, /* 0x49 */ x86emuOp_dec_CX, /* 0x4a */ x86emuOp_dec_DX, /* 0x4b */ x86emuOp_dec_BX, /* 0x4c */ x86emuOp_dec_SP, /* 0x4d */ x86emuOp_dec_BP, /* 0x4e */ x86emuOp_dec_SI, /* 0x4f */ x86emuOp_dec_DI, /* 0x50 */ x86emuOp_push_AX, /* 0x51 */ x86emuOp_push_CX, /* 0x52 */ x86emuOp_push_DX, /* 0x53 */ x86emuOp_push_BX, /* 0x54 */ x86emuOp_push_SP, /* 0x55 */ x86emuOp_push_BP, /* 0x56 */ x86emuOp_push_SI, /* 0x57 */ x86emuOp_push_DI, /* 0x58 */ x86emuOp_pop_AX, /* 0x59 */ x86emuOp_pop_CX, /* 0x5a */ x86emuOp_pop_DX, /* 0x5b */ x86emuOp_pop_BX, /* 0x5c */ x86emuOp_pop_SP, /* 0x5d */ x86emuOp_pop_BP, /* 0x5e */ x86emuOp_pop_SI, /* 0x5f */ x86emuOp_pop_DI, /* 0x60 */ x86emuOp_push_all, /* 0x61 */ x86emuOp_pop_all, /* 0x62 */ x86emuOp_illegal_op, /* bound */ /* 0x63 */ x86emuOp_illegal_op, /* arpl */ /* 0x64 */ x86emuOp_segovr_FS, /* 0x65 */ x86emuOp_segovr_GS, /* 0x66 */ x86emuOp_prefix_data, /* 0x67 */ x86emuOp_prefix_addr, /* 0x68 */ x86emuOp_push_word_IMM, /* 0x69 */ x86emuOp_imul_word_IMM, /* 0x6a */ x86emuOp_push_byte_IMM, /* 0x6b */ x86emuOp_imul_byte_IMM, /* 0x6c */ x86emuOp_ins_byte, /* 0x6d */ x86emuOp_ins_word, /* 0x6e */ x86emuOp_outs_byte, /* 0x6f */ x86emuOp_outs_word, /* 0x70 */ x86emuOp_jump_near_O, /* 0x71 */ x86emuOp_jump_near_NO, /* 0x72 */ x86emuOp_jump_near_B, /* 0x73 */ x86emuOp_jump_near_NB, /* 0x74 */ x86emuOp_jump_near_Z, /* 0x75 */ x86emuOp_jump_near_NZ, /* 0x76 */ x86emuOp_jump_near_BE, /* 0x77 */ x86emuOp_jump_near_NBE, /* 0x78 */ x86emuOp_jump_near_S, /* 0x79 */ x86emuOp_jump_near_NS, /* 0x7a */ x86emuOp_jump_near_P, /* 0x7b */ x86emuOp_jump_near_NP, /* 0x7c */ x86emuOp_jump_near_L, /* 0x7d */ x86emuOp_jump_near_NL, /* 0x7e */ x86emuOp_jump_near_LE, /* 0x7f */ x86emuOp_jump_near_NLE, /* 0x80 */ x86emuOp_opc80_byte_RM_IMM, /* 0x81 */ x86emuOp_opc81_word_RM_IMM, /* 0x82 */ x86emuOp_opc82_byte_RM_IMM, /* 0x83 */ x86emuOp_opc83_word_RM_IMM, /* 0x84 */ x86emuOp_test_byte_RM_R, /* 0x85 */ x86emuOp_test_word_RM_R, /* 0x86 */ x86emuOp_xchg_byte_RM_R, /* 0x87 */ x86emuOp_xchg_word_RM_R, /* 0x88 */ x86emuOp_mov_byte_RM_R, /* 0x89 */ x86emuOp_mov_word_RM_R, /* 0x8a */ x86emuOp_mov_byte_R_RM, /* 0x8b */ x86emuOp_mov_word_R_RM, /* 0x8c */ x86emuOp_mov_word_RM_SR, /* 0x8d */ x86emuOp_lea_word_R_M, /* 0x8e */ x86emuOp_mov_word_SR_RM, /* 0x8f */ x86emuOp_pop_RM, /* 0x90 */ x86emuOp_nop, /* 0x91 */ x86emuOp_xchg_word_AX_CX, /* 0x92 */ x86emuOp_xchg_word_AX_DX, /* 0x93 */ x86emuOp_xchg_word_AX_BX, /* 0x94 */ x86emuOp_xchg_word_AX_SP, /* 0x95 */ x86emuOp_xchg_word_AX_BP, /* 0x96 */ x86emuOp_xchg_word_AX_SI, /* 0x97 */ x86emuOp_xchg_word_AX_DI, /* 0x98 */ x86emuOp_cbw, /* 0x99 */ x86emuOp_cwd, /* 0x9a */ x86emuOp_call_far_IMM, /* 0x9b */ x86emuOp_wait, /* 0x9c */ x86emuOp_pushf_word, /* 0x9d */ x86emuOp_popf_word, /* 0x9e */ x86emuOp_sahf, /* 0x9f */ x86emuOp_lahf, /* 0xa0 */ x86emuOp_mov_AL_M_IMM, /* 0xa1 */ x86emuOp_mov_AX_M_IMM, /* 0xa2 */ x86emuOp_mov_M_AL_IMM, /* 0xa3 */ x86emuOp_mov_M_AX_IMM, /* 0xa4 */ x86emuOp_movs_byte, /* 0xa5 */ x86emuOp_movs_word, /* 0xa6 */ x86emuOp_cmps_byte, /* 0xa7 */ x86emuOp_cmps_word, /* 0xa8 */ x86emuOp_test_AL_IMM, /* 0xa9 */ x86emuOp_test_AX_IMM, /* 0xaa */ x86emuOp_stos_byte, /* 0xab */ x86emuOp_stos_word, /* 0xac */ x86emuOp_lods_byte, /* 0xad */ x86emuOp_lods_word, /* 0xac */ x86emuOp_scas_byte, /* 0xad */ x86emuOp_scas_word, /* 0xb0 */ x86emuOp_mov_byte_AL_IMM, /* 0xb1 */ x86emuOp_mov_byte_CL_IMM, /* 0xb2 */ x86emuOp_mov_byte_DL_IMM, /* 0xb3 */ x86emuOp_mov_byte_BL_IMM, /* 0xb4 */ x86emuOp_mov_byte_AH_IMM, /* 0xb5 */ x86emuOp_mov_byte_CH_IMM, /* 0xb6 */ x86emuOp_mov_byte_DH_IMM, /* 0xb7 */ x86emuOp_mov_byte_BH_IMM, /* 0xb8 */ x86emuOp_mov_word_AX_IMM, /* 0xb9 */ x86emuOp_mov_word_CX_IMM, /* 0xba */ x86emuOp_mov_word_DX_IMM, /* 0xbb */ x86emuOp_mov_word_BX_IMM, /* 0xbc */ x86emuOp_mov_word_SP_IMM, /* 0xbd */ x86emuOp_mov_word_BP_IMM, /* 0xbe */ x86emuOp_mov_word_SI_IMM, /* 0xbf */ x86emuOp_mov_word_DI_IMM, /* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM, /* 0xc1 */ x86emuOp_opcC1_word_RM_MEM, /* 0xc2 */ x86emuOp_ret_near_IMM, /* 0xc3 */ x86emuOp_ret_near, /* 0xc4 */ x86emuOp_les_R_IMM, /* 0xc5 */ x86emuOp_lds_R_IMM, /* 0xc6 */ x86emuOp_mov_byte_RM_IMM, /* 0xc7 */ x86emuOp_mov_word_RM_IMM, /* 0xc8 */ x86emuOp_enter, /* 0xc9 */ x86emuOp_leave, /* 0xca */ x86emuOp_ret_far_IMM, /* 0xcb */ x86emuOp_ret_far, /* 0xcc */ x86emuOp_int3, /* 0xcd */ x86emuOp_int_IMM, /* 0xce */ x86emuOp_into, /* 0xcf */ x86emuOp_iret, /* 0xd0 */ x86emuOp_opcD0_byte_RM_1, /* 0xd1 */ x86emuOp_opcD1_word_RM_1, /* 0xd2 */ x86emuOp_opcD2_byte_RM_CL, /* 0xd3 */ x86emuOp_opcD3_word_RM_CL, /* 0xd4 */ x86emuOp_aam, /* 0xd5 */ x86emuOp_aad, /* 0xd6 */ x86emuOp_illegal_op, /* Undocumented SETALC instruction */ /* 0xd7 */ x86emuOp_xlat, /* 0xd8 */ x86emuOp_esc_coprocess_d8, /* 0xd9 */ x86emuOp_esc_coprocess_d9, /* 0xda */ x86emuOp_esc_coprocess_da, /* 0xdb */ x86emuOp_esc_coprocess_db, /* 0xdc */ x86emuOp_esc_coprocess_dc, /* 0xdd */ x86emuOp_esc_coprocess_dd, /* 0xde */ x86emuOp_esc_coprocess_de, /* 0xdf */ x86emuOp_esc_coprocess_df, /* 0xe0 */ x86emuOp_loopne, /* 0xe1 */ x86emuOp_loope, /* 0xe2 */ x86emuOp_loop, /* 0xe3 */ x86emuOp_jcxz, /* 0xe4 */ x86emuOp_in_byte_AL_IMM, /* 0xe5 */ x86emuOp_in_word_AX_IMM, /* 0xe6 */ x86emuOp_out_byte_IMM_AL, /* 0xe7 */ x86emuOp_out_word_IMM_AX, /* 0xe8 */ x86emuOp_call_near_IMM, /* 0xe9 */ x86emuOp_jump_near_IMM, /* 0xea */ x86emuOp_jump_far_IMM, /* 0xeb */ x86emuOp_jump_byte_IMM, /* 0xec */ x86emuOp_in_byte_AL_DX, /* 0xed */ x86emuOp_in_word_AX_DX, /* 0xee */ x86emuOp_out_byte_DX_AL, /* 0xef */ x86emuOp_out_word_DX_AX, /* 0xf0 */ x86emuOp_lock, /* 0xf1 */ x86emuOp_illegal_op, /* 0xf2 */ x86emuOp_repne, /* 0xf3 */ x86emuOp_repe, /* 0xf4 */ x86emuOp_halt, /* 0xf5 */ x86emuOp_cmc, /* 0xf6 */ x86emuOp_opcF6_byte_RM, /* 0xf7 */ x86emuOp_opcF7_word_RM, /* 0xf8 */ x86emuOp_clc, /* 0xf9 */ x86emuOp_stc, /* 0xfa */ x86emuOp_cli, /* 0xfb */ x86emuOp_sti, /* 0xfc */ x86emuOp_cld, /* 0xfd */ x86emuOp_std, /* 0xfe */ x86emuOp_opcFE_byte_RM, /* 0xff */ x86emuOp_opcFF_word_RM, }; xorg-server-1.20.8/hw/xfree86/x86emu/prim_ops.c0000644000175000017500000024156613640201473016061 00000000000000/**************************************************************************** * * Realmode X86 Emulator Library * * Copyright (C) 1996-1999 SciTech Software, Inc. * Copyright (C) David Mosberger-Tang * Copyright (C) 1999 Egbert Eich * * ======================================================================== * * 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 authors not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The authors makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHORS 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. * * ======================================================================== * * Language: ANSI C * Environment: Any * Developer: Kendall Bennett * * Description: This file contains the code to implement the primitive * machine operations used by the emulation code in ops.c * * Carry Chain Calculation * * This represents a somewhat expensive calculation which is * apparently required to emulate the setting of the OF and AF flag. * The latter is not so important, but the former is. The overflow * flag is the XOR of the top two bits of the carry chain for an * addition (similar for subtraction). Since we do not want to * simulate the addition in a bitwise manner, we try to calculate the * carry chain given the two operands and the result. * * So, given the following table, which represents the addition of two * bits, we can derive a formula for the carry chain. * * a b cin r cout * 0 0 0 0 0 * 0 0 1 1 0 * 0 1 0 1 0 * 0 1 1 0 1 * 1 0 0 1 0 * 1 0 1 0 1 * 1 1 0 0 1 * 1 1 1 1 1 * * Construction of table for cout: * * ab * r \ 00 01 11 10 * |------------------ * 0 | 0 1 1 1 * 1 | 0 0 1 0 * * By inspection, one gets: cc = ab + r'(a + b) * * That represents alot of operations, but NO CHOICE.... * * Borrow Chain Calculation. * * The following table represents the subtraction of two bits, from * which we can derive a formula for the borrow chain. * * a b bin r bout * 0 0 0 0 0 * 0 0 1 1 1 * 0 1 0 1 1 * 0 1 1 0 1 * 1 0 0 1 0 * 1 0 1 0 0 * 1 1 0 0 0 * 1 1 1 1 1 * * Construction of table for cout: * * ab * r \ 00 01 11 10 * |------------------ * 0 | 0 1 0 0 * 1 | 1 1 1 0 * * By inspection, one gets: bc = a'b + r(a' + b) * ****************************************************************************/ #include #define PRIM_OPS_NO_REDEFINE_ASM #include "x86emu/x86emui.h" #if defined(__GNUC__) #if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__) #include "x86emu/prim_x86_gcc.h" #endif #endif /*------------------------- Global Variables ------------------------------*/ static u32 x86emu_parity_tab[8] = { 0x96696996, 0x69969669, 0x69969669, 0x96696996, 0x69969669, 0x96696996, 0x96696996, 0x69969669, }; #define PARITY(x) (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0) #define XOR2(x) (((x) ^ ((x)>>1)) & 0x1) /*----------------------------- Implementation ----------------------------*/ /**************************************************************************** REMARKS: Implements the AAA instruction and side effects. ****************************************************************************/ u16 aaa_word(u16 d) { u16 res; if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) { d += 0x6; d += 0x100; SET_FLAG(F_AF); SET_FLAG(F_CF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); } res = (u16) (d & 0xFF0F); CLEAR_FLAG(F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return res; } /**************************************************************************** REMARKS: Implements the AAA instruction and side effects. ****************************************************************************/ u16 aas_word(u16 d) { u16 res; if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) { d -= 0x6; d -= 0x100; SET_FLAG(F_AF); SET_FLAG(F_CF); } else { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); } res = (u16) (d & 0xFF0F); CLEAR_FLAG(F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return res; } /**************************************************************************** REMARKS: Implements the AAD instruction and side effects. ****************************************************************************/ u16 aad_word(u16 d) { u16 l; u8 hb, lb; hb = (u8) ((d >> 8) & 0xff); lb = (u8) ((d & 0xff)); l = (u16) ((lb + 10 * hb) & 0xFF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(l & 0x80, F_SF); CONDITIONAL_SET_FLAG(l == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF); return l; } /**************************************************************************** REMARKS: Implements the AAM instruction and side effects. ****************************************************************************/ u16 aam_word(u8 d) { u16 h, l; h = (u16) (d / 10); l = (u16) (d % 10); l |= (u16) (h << 8); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(l & 0x80, F_SF); CONDITIONAL_SET_FLAG(l == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF); return l; } /**************************************************************************** REMARKS: Implements the ADC instruction and side effects. ****************************************************************************/ u8 adc_byte(u8 d, u8 s) { register u32 res; /* all operands in native machine order */ register u32 cc; if (ACCESS_FLAG(F_CF)) res = 1 + d + s; else res = d + s; CONDITIONAL_SET_FLAG(res & 0x100, F_CF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (s & d) | ((~res) & (s | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return (u8) res; } /**************************************************************************** REMARKS: Implements the ADC instruction and side effects. ****************************************************************************/ u16 adc_word(u16 d, u16 s) { register u32 res; /* all operands in native machine order */ register u32 cc; if (ACCESS_FLAG(F_CF)) res = 1 + d + s; else res = d + s; CONDITIONAL_SET_FLAG(res & 0x10000, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (s & d) | ((~res) & (s | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return (u16) res; } /**************************************************************************** REMARKS: Implements the ADC instruction and side effects. ****************************************************************************/ u32 adc_long(u32 d, u32 s) { register u32 lo; /* all operands in native machine order */ register u32 hi; register u32 res; register u32 cc; if (ACCESS_FLAG(F_CF)) { lo = 1 + (d & 0xFFFF) + (s & 0xFFFF); res = 1 + d + s; } else { lo = (d & 0xFFFF) + (s & 0xFFFF); res = d + s; } hi = (lo >> 16) + (d >> 16) + (s >> 16); CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (s & d) | ((~res) & (s | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the ADD instruction and side effects. ****************************************************************************/ u8 add_byte(u8 d, u8 s) { register u32 res; /* all operands in native machine order */ register u32 cc; res = d + s; CONDITIONAL_SET_FLAG(res & 0x100, F_CF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (s & d) | ((~res) & (s | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return (u8) res; } /**************************************************************************** REMARKS: Implements the ADD instruction and side effects. ****************************************************************************/ u16 add_word(u16 d, u16 s) { register u32 res; /* all operands in native machine order */ register u32 cc; res = d + s; CONDITIONAL_SET_FLAG(res & 0x10000, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (s & d) | ((~res) & (s | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return (u16) res; } /**************************************************************************** REMARKS: Implements the ADD instruction and side effects. ****************************************************************************/ u32 add_long(u32 d, u32 s) { register u32 lo; /* all operands in native machine order */ register u32 hi; register u32 res; register u32 cc; lo = (d & 0xFFFF) + (s & 0xFFFF); res = d + s; hi = (lo >> 16) + (d >> 16) + (s >> 16); CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (s & d) | ((~res) & (s | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the AND instruction and side effects. ****************************************************************************/ u8 and_byte(u8 d, u8 s) { register u8 res; /* all operands in native machine order */ res = d & s; /* set the flags */ CLEAR_FLAG(F_OF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res), F_PF); return res; } /**************************************************************************** REMARKS: Implements the AND instruction and side effects. ****************************************************************************/ u16 and_word(u16 d, u16 s) { register u16 res; /* all operands in native machine order */ res = d & s; /* set the flags */ CLEAR_FLAG(F_OF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return res; } /**************************************************************************** REMARKS: Implements the AND instruction and side effects. ****************************************************************************/ u32 and_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ res = d & s; /* set the flags */ CLEAR_FLAG(F_OF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return res; } /**************************************************************************** REMARKS: Implements the CMP instruction and side effects. ****************************************************************************/ u8 cmp_byte(u8 d, u8 s) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - s; CLEAR_FLAG(F_CF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x80, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return d; } /**************************************************************************** REMARKS: Implements the CMP instruction and side effects. ****************************************************************************/ u16 cmp_word(u16 d, u16 s) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - s; CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return d; } /**************************************************************************** REMARKS: Implements the CMP instruction and side effects. ****************************************************************************/ u32 cmp_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - s; CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return d; } /**************************************************************************** REMARKS: Implements the DAA instruction and side effects. ****************************************************************************/ u8 daa_byte(u8 d) { u32 res = d; if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) { res += 6; SET_FLAG(F_AF); } if (res > 0x9F || ACCESS_FLAG(F_CF)) { res += 0x60; SET_FLAG(F_CF); } CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return (u8) res; } /**************************************************************************** REMARKS: Implements the DAS instruction and side effects. ****************************************************************************/ u8 das_byte(u8 d) { if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) { d -= 6; SET_FLAG(F_AF); } if (d > 0x9F || ACCESS_FLAG(F_CF)) { d -= 0x60; SET_FLAG(F_CF); } CONDITIONAL_SET_FLAG(d & 0x80, F_SF); CONDITIONAL_SET_FLAG(d == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF); return d; } /**************************************************************************** REMARKS: Implements the DEC instruction and side effects. ****************************************************************************/ u8 dec_byte(u8 d) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - 1; CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ /* based on sub_byte, uses s==1. */ bc = (res & (~d | 1)) | (~d & 1); /* carry flag unchanged */ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return (u8) res; } /**************************************************************************** REMARKS: Implements the DEC instruction and side effects. ****************************************************************************/ u16 dec_word(u16 d) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - 1; CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ /* based on the sub_byte routine, with s==1 */ bc = (res & (~d | 1)) | (~d & 1); /* carry flag unchanged */ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return (u16) res; } /**************************************************************************** REMARKS: Implements the DEC instruction and side effects. ****************************************************************************/ u32 dec_long(u32 d) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - 1; CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | 1)) | (~d & 1); /* carry flag unchanged */ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the INC instruction and side effects. ****************************************************************************/ u8 inc_byte(u8 d) { register u32 res; /* all operands in native machine order */ register u32 cc; res = d + 1; CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = ((1 & d) | (~res)) & (1 | d); CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return (u8) res; } /**************************************************************************** REMARKS: Implements the INC instruction and side effects. ****************************************************************************/ u16 inc_word(u16 d) { register u32 res; /* all operands in native machine order */ register u32 cc; res = d + 1; CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (1 & d) | ((~res) & (1 | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return (u16) res; } /**************************************************************************** REMARKS: Implements the INC instruction and side effects. ****************************************************************************/ u32 inc_long(u32 d) { register u32 res; /* all operands in native machine order */ register u32 cc; res = d + 1; CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the carry chain SEE NOTE AT TOP. */ cc = (1 & d) | ((~res) & (1 | d)); CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF); CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the OR instruction and side effects. ****************************************************************************/ u8 or_byte(u8 d, u8 s) { register u8 res; /* all operands in native machine order */ res = d | s; CLEAR_FLAG(F_OF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res), F_PF); return res; } /**************************************************************************** REMARKS: Implements the OR instruction and side effects. ****************************************************************************/ u16 or_word(u16 d, u16 s) { register u16 res; /* all operands in native machine order */ res = d | s; /* set the carry flag to be bit 8 */ CLEAR_FLAG(F_OF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return res; } /**************************************************************************** REMARKS: Implements the OR instruction and side effects. ****************************************************************************/ u32 or_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ res = d | s; /* set the carry flag to be bit 8 */ CLEAR_FLAG(F_OF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); return res; } /**************************************************************************** REMARKS: Implements the OR instruction and side effects. ****************************************************************************/ u8 neg_byte(u8 s) { register u8 res; register u8 bc; CONDITIONAL_SET_FLAG(s != 0, F_CF); res = (u8) - s; CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(PARITY(res), F_PF); /* calculate the borrow chain --- modified such that d=0. substitutiing d=0 into bc= res&(~d|s)|(~d&s); (the one used for sub) and simplifying, since ~d=0xff..., ~d|s == 0xffff..., and res&0xfff... == res. Similarly ~d&s == s. So the simplified result is: */ bc = res | s; CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the OR instruction and side effects. ****************************************************************************/ u16 neg_word(u16 s) { register u16 res; register u16 bc; CONDITIONAL_SET_FLAG(s != 0, F_CF); res = (u16) - s; CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain --- modified such that d=0. substitutiing d=0 into bc= res&(~d|s)|(~d&s); (the one used for sub) and simplifying, since ~d=0xff..., ~d|s == 0xffff..., and res&0xfff... == res. Similarly ~d&s == s. So the simplified result is: */ bc = res | s; CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the OR instruction and side effects. ****************************************************************************/ u32 neg_long(u32 s) { register u32 res; register u32 bc; CONDITIONAL_SET_FLAG(s != 0, F_CF); res = (u32) - s; CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain --- modified such that d=0. substitutiing d=0 into bc= res&(~d|s)|(~d&s); (the one used for sub) and simplifying, since ~d=0xff..., ~d|s == 0xffff..., and res&0xfff... == res. Similarly ~d&s == s. So the simplified result is: */ bc = res | s; CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the NOT instruction and side effects. ****************************************************************************/ u8 not_byte(u8 s) { return ~s; } /**************************************************************************** REMARKS: Implements the NOT instruction and side effects. ****************************************************************************/ u16 not_word(u16 s) { return ~s; } /**************************************************************************** REMARKS: Implements the NOT instruction and side effects. ****************************************************************************/ u32 not_long(u32 s) { return ~s; } /**************************************************************************** REMARKS: Implements the RCL instruction and side effects. ****************************************************************************/ u8 rcl_byte(u8 d, u8 s) { register unsigned int res, cnt, mask, cf; /* s is the rotate distance. It varies from 0 - 8. */ /* have CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0 want to rotate through the carry by "s" bits. We could loop, but that's inefficient. So the width is 9, and we split into three parts: The new carry flag (was B_n) the stuff in B_n-1 .. B_0 the stuff in B_7 .. B_n+1 The new rotate is done mod 9, and given this, for a rotation of n bits (mod 9) the new carry flag is then located n bits from the MSB. The low part is then shifted up cnt bits, and the high part is or'd in. Using CAPS for new values, and lowercase for the original values, this can be expressed as: IF n > 0 1) CF <- b_(8-n) 2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 3) B_(n-1) <- cf 4) B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) */ res = d; if ((cnt = s % 9) != 0) { /* extract the new CARRY FLAG. */ /* CF <- b_(8-n) */ cf = (d >> (8 - cnt)) & 0x1; /* get the low stuff which rotated into the range B_7 .. B_cnt */ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */ /* note that the right hand side done by the mask */ res = (d << cnt) & 0xff; /* now the high stuff which rotated around into the positions B_cnt-2 .. B_0 */ /* B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) */ /* shift it downward, 7-(n-2) = 9-n positions. and mask off the result before or'ing in. */ mask = (1 << (cnt - 1)) - 1; res |= (d >> (9 - cnt)) & mask; /* if the carry flag was set, or it in. */ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ /* B_(n-1) <- cf */ res |= 1 << (cnt - 1); } /* set the new carry flag, based on the variable "cf" */ CONDITIONAL_SET_FLAG(cf, F_CF); /* OVERFLOW is set *IFF* cnt==1, then it is the xor of CF and the most significant bit. Blecck. */ /* parenthesized this expression since it appears to be causing OF to be misset */ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)), F_OF); } return (u8) res; } /**************************************************************************** REMARKS: Implements the RCL instruction and side effects. ****************************************************************************/ u16 rcl_word(u16 d, u8 s) { register unsigned int res, cnt, mask, cf; res = d; if ((cnt = s % 17) != 0) { cf = (d >> (16 - cnt)) & 0x1; res = (d << cnt) & 0xffff; mask = (1 << (cnt - 1)) - 1; res |= (d >> (17 - cnt)) & mask; if (ACCESS_FLAG(F_CF)) { res |= 1 << (cnt - 1); } CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)), F_OF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the RCL instruction and side effects. ****************************************************************************/ u32 rcl_long(u32 d, u8 s) { register u32 res, cnt, mask, cf; res = d; if ((cnt = s % 33) != 0) { cf = (d >> (32 - cnt)) & 0x1; res = (d << cnt) & 0xffffffff; mask = (1 << (cnt - 1)) - 1; res |= (d >> (33 - cnt)) & mask; if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ res |= 1 << (cnt - 1); } CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)), F_OF); } return res; } /**************************************************************************** REMARKS: Implements the RCR instruction and side effects. ****************************************************************************/ u8 rcr_byte(u8 d, u8 s) { u32 res, cnt; u32 mask, cf, ocf = 0; /* rotate right through carry */ /* s is the rotate distance. It varies from 0 - 8. d is the byte object rotated. have CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0 The new rotate is done mod 9, and given this, for a rotation of n bits (mod 9) the new carry flag is then located n bits from the LSB. The low part is then shifted up cnt bits, and the high part is or'd in. Using CAPS for new values, and lowercase for the original values, this can be expressed as: IF n > 0 1) CF <- b_(n-1) 2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) 3) B_(8-n) <- cf 4) B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) */ res = d; if ((cnt = s % 9) != 0) { /* extract the new CARRY FLAG. */ /* CF <- b_(n-1) */ if (cnt == 1) { cf = d & 0x1; /* note hackery here. Access_flag(..) evaluates to either 0 if flag not set non-zero if flag is set. doing access_flag(..) != 0 casts that into either 0..1 in any representation of the flags register (i.e. packed bit array or unpacked.) */ ocf = ACCESS_FLAG(F_CF) != 0; } else cf = (d >> (cnt - 1)) & 0x1; /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */ /* note that the right hand side done by the mask This is effectively done by shifting the object to the right. The result must be masked, in case the object came in and was treated as a negative number. Needed??? */ mask = (1 << (8 - cnt)) - 1; res = (d >> cnt) & mask; /* now the high stuff which rotated around into the positions B_cnt-2 .. B_0 */ /* B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) */ /* shift it downward, 7-(n-2) = 9-n positions. and mask off the result before or'ing in. */ res |= (d << (9 - cnt)); /* if the carry flag was set, or it in. */ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ /* B_(8-n) <- cf */ res |= 1 << (8 - cnt); } /* set the new carry flag, based on the variable "cf" */ CONDITIONAL_SET_FLAG(cf, F_CF); /* OVERFLOW is set *IFF* cnt==1, then it is the xor of CF and the most significant bit. Blecck. */ /* parenthesized... */ if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)), F_OF); } } return (u8) res; } /**************************************************************************** REMARKS: Implements the RCR instruction and side effects. ****************************************************************************/ u16 rcr_word(u16 d, u8 s) { u32 res, cnt; u32 mask, cf, ocf = 0; /* rotate right through carry */ res = d; if ((cnt = s % 17) != 0) { if (cnt == 1) { cf = d & 0x1; ocf = ACCESS_FLAG(F_CF) != 0; } else cf = (d >> (cnt - 1)) & 0x1; mask = (1 << (16 - cnt)) - 1; res = (d >> cnt) & mask; res |= (d << (17 - cnt)); if (ACCESS_FLAG(F_CF)) { res |= 1 << (16 - cnt); } CONDITIONAL_SET_FLAG(cf, F_CF); if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)), F_OF); } } return (u16) res; } /**************************************************************************** REMARKS: Implements the RCR instruction and side effects. ****************************************************************************/ u32 rcr_long(u32 d, u8 s) { u32 res, cnt; u32 mask, cf, ocf = 0; /* rotate right through carry */ res = d; if ((cnt = s % 33) != 0) { if (cnt == 1) { cf = d & 0x1; ocf = ACCESS_FLAG(F_CF) != 0; } else cf = (d >> (cnt - 1)) & 0x1; mask = (1 << (32 - cnt)) - 1; res = (d >> cnt) & mask; if (cnt != 1) res |= (d << (33 - cnt)); if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ res |= 1 << (32 - cnt); } CONDITIONAL_SET_FLAG(cf, F_CF); if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)), F_OF); } } return res; } /**************************************************************************** REMARKS: Implements the ROL instruction and side effects. ****************************************************************************/ u8 rol_byte(u8 d, u8 s) { register unsigned int res, cnt, mask; /* rotate left */ /* s is the rotate distance. It varies from 0 - 8. d is the byte object rotated. have CF B_7 ... B_0 The new rotate is done mod 8. Much simpler than the "rcl" or "rcr" operations. IF n > 0 1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) 2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */ res = d; if ((cnt = s % 8) != 0) { /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */ res = (d << cnt); /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */ mask = (1 << cnt) - 1; res |= (d >> (8 - cnt)) & mask; /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); /* OVERFLOW is set *IFF* s==1, then it is the xor of CF and the most significant bit. Blecck. */ CONDITIONAL_SET_FLAG(s == 1 && XOR2((res & 0x1) + ((res >> 6) & 0x2)), F_OF); } if (s != 0) { /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); } return (u8) res; } /**************************************************************************** REMARKS: Implements the ROL instruction and side effects. ****************************************************************************/ u16 rol_word(u16 d, u8 s) { register unsigned int res, cnt, mask; res = d; if ((cnt = s % 16) != 0) { res = (d << cnt); mask = (1 << cnt) - 1; res |= (d >> (16 - cnt)) & mask; CONDITIONAL_SET_FLAG(res & 0x1, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2((res & 0x1) + ((res >> 14) & 0x2)), F_OF); } if (s != 0) { /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the ROL instruction and side effects. ****************************************************************************/ u32 rol_long(u32 d, u8 s) { register u32 res, cnt, mask; res = d; if ((cnt = s % 32) != 0) { res = (d << cnt); mask = (1 << cnt) - 1; res |= (d >> (32 - cnt)) & mask; CONDITIONAL_SET_FLAG(res & 0x1, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2((res & 0x1) + ((res >> 30) & 0x2)), F_OF); } if (s != 0) { /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); } return res; } /**************************************************************************** REMARKS: Implements the ROR instruction and side effects. ****************************************************************************/ u8 ror_byte(u8 d, u8 s) { register unsigned int res, cnt, mask; /* rotate right */ /* s is the rotate distance. It varies from 0 - 8. d is the byte object rotated. have B_7 ... B_0 The rotate is done mod 8. IF n > 0 1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) 2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */ res = d; if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */ /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */ res = (d << (8 - cnt)); /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) */ mask = (1 << (8 - cnt)) - 1; res |= (d >> (cnt)) & mask; /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x80, F_CF); /* OVERFLOW is set *IFF* s==1, then it is the xor of the two most significant bits. Blecck. */ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF); } else if (s != 0) { /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x80, F_CF); } return (u8) res; } /**************************************************************************** REMARKS: Implements the ROR instruction and side effects. ****************************************************************************/ u16 ror_word(u16 d, u8 s) { register unsigned int res, cnt, mask; res = d; if ((cnt = s % 16) != 0) { res = (d << (16 - cnt)); mask = (1 << (16 - cnt)) - 1; res |= (d >> (cnt)) & mask; CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF); } else if (s != 0) { /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the ROR instruction and side effects. ****************************************************************************/ u32 ror_long(u32 d, u8 s) { register u32 res, cnt, mask; res = d; if ((cnt = s % 32) != 0) { res = (d << (32 - cnt)); mask = (1 << (32 - cnt)) - 1; res |= (d >> (cnt)) & mask; CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF); } else if (s != 0) { /* set the new carry flag, Note that it is the low order bit of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); } return res; } /**************************************************************************** REMARKS: Implements the SHL instruction and side effects. ****************************************************************************/ u8 shl_byte(u8 d, u8 s) { unsigned int cnt, res, cf; if (s < 8) { cnt = s % 8; /* last bit shifted out goes into carry flag */ if (cnt > 0) { res = d << cnt; cf = d & (1 << (8 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = (u8) d; } if (cnt == 1) { /* Needs simplification. */ CONDITIONAL_SET_FLAG((((res & 0x80) == 0x80) ^ (ACCESS_FLAG(F_CF) != 0)), /* was (M.x86.R_FLG&F_CF)==F_CF)), */ F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80, F_CF); CLEAR_FLAG(F_OF); CLEAR_FLAG(F_SF); SET_FLAG(F_PF); SET_FLAG(F_ZF); } return (u8) res; } /**************************************************************************** REMARKS: Implements the SHL instruction and side effects. ****************************************************************************/ u16 shl_word(u16 d, u8 s) { unsigned int cnt, res, cf; if (s < 16) { cnt = s % 16; if (cnt > 0) { res = d << cnt; cf = d & (1 << (16 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = (u16) d; } if (cnt == 1) { CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^ (ACCESS_FLAG(F_CF) != 0)), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF); CLEAR_FLAG(F_OF); CLEAR_FLAG(F_SF); SET_FLAG(F_PF); SET_FLAG(F_ZF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the SHL instruction and side effects. ****************************************************************************/ u32 shl_long(u32 d, u8 s) { unsigned int cnt, res, cf; if (s < 32) { cnt = s % 32; if (cnt > 0) { res = d << cnt; cf = d & (1 << (32 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^ (ACCESS_FLAG(F_CF) != 0)), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF); CLEAR_FLAG(F_OF); CLEAR_FLAG(F_SF); SET_FLAG(F_PF); SET_FLAG(F_ZF); } return res; } /**************************************************************************** REMARKS: Implements the SHR instruction and side effects. ****************************************************************************/ u8 shr_byte(u8 d, u8 s) { unsigned int cnt, res, cf; if (s < 8) { cnt = s % 8; if (cnt > 0) { cf = d & (1 << (cnt - 1)); res = d >> cnt; CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = (u8) d; } if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CONDITIONAL_SET_FLAG((d >> (s - 1)) & 0x1, F_CF); CLEAR_FLAG(F_OF); CLEAR_FLAG(F_SF); SET_FLAG(F_PF); SET_FLAG(F_ZF); } return (u8) res; } /**************************************************************************** REMARKS: Implements the SHR instruction and side effects. ****************************************************************************/ u16 shr_word(u16 d, u8 s) { unsigned int cnt, res, cf; if (s < 16) { cnt = s % 16; if (cnt > 0) { cf = d & (1 << (cnt - 1)); res = d >> cnt; CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the SHR instruction and side effects. ****************************************************************************/ u32 shr_long(u32 d, u8 s) { unsigned int cnt, res, cf; if (s < 32) { cnt = s % 32; if (cnt > 0) { cf = d & (1 << (cnt - 1)); res = d >> cnt; CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } return res; } /**************************************************************************** REMARKS: Implements the SAR instruction and side effects. ****************************************************************************/ u8 sar_byte(u8 d, u8 s) { unsigned int cnt, res, cf, mask, sf; res = d; sf = d & 0x80; cnt = s % 8; if (cnt > 0 && cnt < 8) { mask = (1 << (8 - cnt)) - 1; cf = d & (1 << (cnt - 1)); res = (d >> cnt) & mask; CONDITIONAL_SET_FLAG(cf, F_CF); if (sf) { res |= ~mask; } CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); } else if (cnt >= 8) { if (sf) { res = 0xff; SET_FLAG(F_CF); CLEAR_FLAG(F_ZF); SET_FLAG(F_SF); SET_FLAG(F_PF); } else { res = 0; CLEAR_FLAG(F_CF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } } return (u8) res; } /**************************************************************************** REMARKS: Implements the SAR instruction and side effects. ****************************************************************************/ u16 sar_word(u16 d, u8 s) { unsigned int cnt, res, cf, mask, sf; sf = d & 0x8000; cnt = s % 16; res = d; if (cnt > 0 && cnt < 16) { mask = (1 << (16 - cnt)) - 1; cf = d & (1 << (cnt - 1)); res = (d >> cnt) & mask; CONDITIONAL_SET_FLAG(cf, F_CF); if (sf) { res |= ~mask; } CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else if (cnt >= 16) { if (sf) { res = 0xffff; SET_FLAG(F_CF); CLEAR_FLAG(F_ZF); SET_FLAG(F_SF); SET_FLAG(F_PF); } else { res = 0; CLEAR_FLAG(F_CF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } } return (u16) res; } /**************************************************************************** REMARKS: Implements the SAR instruction and side effects. ****************************************************************************/ u32 sar_long(u32 d, u8 s) { u32 cnt, res, cf, mask, sf; sf = d & 0x80000000; cnt = s % 32; res = d; if (cnt > 0 && cnt < 32) { mask = (1 << (32 - cnt)) - 1; cf = d & (1 << (cnt - 1)); res = (d >> cnt) & mask; CONDITIONAL_SET_FLAG(cf, F_CF); if (sf) { res |= ~mask; } CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else if (cnt >= 32) { if (sf) { res = 0xffffffff; SET_FLAG(F_CF); CLEAR_FLAG(F_ZF); SET_FLAG(F_SF); SET_FLAG(F_PF); } else { res = 0; CLEAR_FLAG(F_CF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } } return res; } /**************************************************************************** REMARKS: Implements the SHLD instruction and side effects. ****************************************************************************/ u16 shld_word(u16 d, u16 fill, u8 s) { unsigned int cnt, res, cf; if (s < 16) { cnt = s % 16; if (cnt > 0) { res = (d << cnt) | (fill >> (16 - cnt)); cf = d & (1 << (16 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^ (ACCESS_FLAG(F_CF) != 0)), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF); CLEAR_FLAG(F_OF); CLEAR_FLAG(F_SF); SET_FLAG(F_PF); SET_FLAG(F_ZF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the SHLD instruction and side effects. ****************************************************************************/ u32 shld_long(u32 d, u32 fill, u8 s) { unsigned int cnt, res, cf; if (s < 32) { cnt = s % 32; if (cnt > 0) { res = (d << cnt) | (fill >> (32 - cnt)); cf = d & (1 << (32 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^ (ACCESS_FLAG(F_CF) != 0)), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF); CLEAR_FLAG(F_OF); CLEAR_FLAG(F_SF); SET_FLAG(F_PF); SET_FLAG(F_ZF); } return res; } /**************************************************************************** REMARKS: Implements the SHRD instruction and side effects. ****************************************************************************/ u16 shrd_word(u16 d, u16 fill, u8 s) { unsigned int cnt, res, cf; if (s < 16) { cnt = s % 16; if (cnt > 0) { cf = d & (1 << (cnt - 1)); res = (d >> cnt) | (fill << (16 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } return (u16) res; } /**************************************************************************** REMARKS: Implements the SHRD instruction and side effects. ****************************************************************************/ u32 shrd_long(u32 d, u32 fill, u8 s) { unsigned int cnt, res, cf; if (s < 32) { cnt = s % 32; if (cnt > 0) { cf = d & (1 << (cnt - 1)); res = (d >> cnt) | (fill << (32 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); } else { res = d; } if (cnt == 1) { CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF); } else { CLEAR_FLAG(F_OF); } } else { res = 0; CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); SET_FLAG(F_ZF); CLEAR_FLAG(F_SF); CLEAR_FLAG(F_PF); } return res; } /**************************************************************************** REMARKS: Implements the SBB instruction and side effects. ****************************************************************************/ u8 sbb_byte(u8 d, u8 s) { register u32 res; /* all operands in native machine order */ register u32 bc; if (ACCESS_FLAG(F_CF)) res = d - s - 1; else res = d - s; CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x80, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return (u8) res; } /**************************************************************************** REMARKS: Implements the SBB instruction and side effects. ****************************************************************************/ u16 sbb_word(u16 d, u16 s) { register u32 res; /* all operands in native machine order */ register u32 bc; if (ACCESS_FLAG(F_CF)) res = d - s - 1; else res = d - s; CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return (u16) res; } /**************************************************************************** REMARKS: Implements the SBB instruction and side effects. ****************************************************************************/ u32 sbb_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ register u32 bc; if (ACCESS_FLAG(F_CF)) res = d - s - 1; else res = d - s; CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the SUB instruction and side effects. ****************************************************************************/ u8 sub_byte(u8 d, u8 s) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - s; CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x80, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return (u8) res; } /**************************************************************************** REMARKS: Implements the SUB instruction and side effects. ****************************************************************************/ u16 sub_word(u16 d, u16 s) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - s; CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return (u16) res; } /**************************************************************************** REMARKS: Implements the SUB instruction and side effects. ****************************************************************************/ u32 sub_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ register u32 bc; res = d - s; CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* calculate the borrow chain. See note at top */ bc = (res & (~d | s)) | (~d & s); CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF); CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); return res; } /**************************************************************************** REMARKS: Implements the TEST instruction and side effects. ****************************************************************************/ void test_byte(u8 d, u8 s) { register u32 res; /* all operands in native machine order */ res = d & s; CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* AF == dont care */ CLEAR_FLAG(F_CF); } /**************************************************************************** REMARKS: Implements the TEST instruction and side effects. ****************************************************************************/ void test_word(u16 d, u16 s) { register u32 res; /* all operands in native machine order */ res = d & s; CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* AF == dont care */ CLEAR_FLAG(F_CF); } /**************************************************************************** REMARKS: Implements the TEST instruction and side effects. ****************************************************************************/ void test_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ res = d & s; CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); /* AF == dont care */ CLEAR_FLAG(F_CF); } /**************************************************************************** REMARKS: Implements the XOR instruction and side effects. ****************************************************************************/ u8 xor_byte(u8 d, u8 s) { register u8 res; /* all operands in native machine order */ res = d ^ s; CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(res & 0x80, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res), F_PF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); return res; } /**************************************************************************** REMARKS: Implements the XOR instruction and side effects. ****************************************************************************/ u16 xor_word(u16 d, u16 s) { register u16 res; /* all operands in native machine order */ res = d ^ s; CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); return res; } /**************************************************************************** REMARKS: Implements the XOR instruction and side effects. ****************************************************************************/ u32 xor_long(u32 d, u32 s) { register u32 res; /* all operands in native machine order */ res = d ^ s; CLEAR_FLAG(F_OF); CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); CONDITIONAL_SET_FLAG(res == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); return res; } /**************************************************************************** REMARKS: Implements the IMUL instruction and side effects. ****************************************************************************/ void imul_byte(u8 s) { s16 res = (s16) ((s8) M.x86.R_AL * (s8) s); M.x86.R_AX = res; if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) || ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } else { SET_FLAG(F_CF); SET_FLAG(F_OF); } } /**************************************************************************** REMARKS: Implements the IMUL instruction and side effects. ****************************************************************************/ void imul_word(u16 s) { s32 res = (s16) M.x86.R_AX * (s16) s; M.x86.R_AX = (u16) res; M.x86.R_DX = (u16) (res >> 16); if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) || ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } else { SET_FLAG(F_CF); SET_FLAG(F_OF); } } /**************************************************************************** REMARKS: Implements the IMUL instruction and side effects. ****************************************************************************/ void imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s) { #ifdef __HAS_LONG_LONG__ s64 res = (s64) (s32) d * (s32) s; *res_lo = (u32) res; *res_hi = (u32) (res >> 32); #else u32 d_lo, d_hi, d_sign; u32 s_lo, s_hi, s_sign; u32 rlo_lo, rlo_hi, rhi_lo; if ((d_sign = d & 0x80000000) != 0) d = -d; d_lo = d & 0xFFFF; d_hi = d >> 16; if ((s_sign = s & 0x80000000) != 0) s = -s; s_lo = s & 0xFFFF; s_hi = s >> 16; rlo_lo = d_lo * s_lo; rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16); rhi_lo = d_hi * s_hi + (rlo_hi >> 16); *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF); *res_hi = rhi_lo; if (d_sign != s_sign) { d = ~*res_lo; s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16); *res_lo = ~*res_lo + 1; *res_hi = ~*res_hi + (s >> 16); } #endif } /**************************************************************************** REMARKS: Implements the IMUL instruction and side effects. ****************************************************************************/ void imul_long(u32 s) { imul_long_direct(&M.x86.R_EAX, &M.x86.R_EDX, M.x86.R_EAX, s); if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) || ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } else { SET_FLAG(F_CF); SET_FLAG(F_OF); } } /**************************************************************************** REMARKS: Implements the MUL instruction and side effects. ****************************************************************************/ void mul_byte(u8 s) { u16 res = (u16) (M.x86.R_AL * s); M.x86.R_AX = res; if (M.x86.R_AH == 0) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } else { SET_FLAG(F_CF); SET_FLAG(F_OF); } } /**************************************************************************** REMARKS: Implements the MUL instruction and side effects. ****************************************************************************/ void mul_word(u16 s) { u32 res = M.x86.R_AX * s; M.x86.R_AX = (u16) res; M.x86.R_DX = (u16) (res >> 16); if (M.x86.R_DX == 0) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } else { SET_FLAG(F_CF); SET_FLAG(F_OF); } } /**************************************************************************** REMARKS: Implements the MUL instruction and side effects. ****************************************************************************/ void mul_long(u32 s) { #ifdef __HAS_LONG_LONG__ u64 res = (u64) M.x86.R_EAX * s; M.x86.R_EAX = (u32) res; M.x86.R_EDX = (u32) (res >> 32); #else u32 a, a_lo, a_hi; u32 s_lo, s_hi; u32 rlo_lo, rlo_hi, rhi_lo; a = M.x86.R_EAX; a_lo = a & 0xFFFF; a_hi = a >> 16; s_lo = s & 0xFFFF; s_hi = s >> 16; rlo_lo = a_lo * s_lo; rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16); rhi_lo = a_hi * s_hi + (rlo_hi >> 16); M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF); M.x86.R_EDX = rhi_lo; #endif if (M.x86.R_EDX == 0) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_OF); } else { SET_FLAG(F_CF); SET_FLAG(F_OF); } } /**************************************************************************** REMARKS: Implements the IDIV instruction and side effects. ****************************************************************************/ void idiv_byte(u8 s) { s32 dvd, div, mod; dvd = (s16) M.x86.R_AX; if (s == 0) { x86emu_intr_raise(0); return; } div = dvd / (s8) s; mod = dvd % (s8) s; if (abs(div) > 0x7f) { x86emu_intr_raise(0); return; } M.x86.R_AL = (s8) div; M.x86.R_AH = (s8) mod; } /**************************************************************************** REMARKS: Implements the IDIV instruction and side effects. ****************************************************************************/ void idiv_word(u16 s) { s32 dvd, div, mod; dvd = (((s32) M.x86.R_DX) << 16) | M.x86.R_AX; if (s == 0) { x86emu_intr_raise(0); return; } div = dvd / (s16) s; mod = dvd % (s16) s; if (abs(div) > 0x7fff) { x86emu_intr_raise(0); return; } CLEAR_FLAG(F_CF); CLEAR_FLAG(F_SF); CONDITIONAL_SET_FLAG(div == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); M.x86.R_AX = (u16) div; M.x86.R_DX = (u16) mod; } /**************************************************************************** REMARKS: Implements the IDIV instruction and side effects. ****************************************************************************/ void idiv_long(u32 s) { #ifdef __HAS_LONG_LONG__ s64 dvd, div, mod; dvd = (((s64) M.x86.R_EDX) << 32) | M.x86.R_EAX; if (s == 0) { x86emu_intr_raise(0); return; } div = dvd / (s32) s; mod = dvd % (s32) s; if (abs(div) > 0x7fffffff) { x86emu_intr_raise(0); return; } #else s32 div = 0, mod; s32 h_dvd = M.x86.R_EDX; u32 l_dvd = M.x86.R_EAX; u32 abs_s = s & 0x7FFFFFFF; u32 abs_h_dvd = h_dvd & 0x7FFFFFFF; u32 h_s = abs_s >> 1; u32 l_s = abs_s << 31; int counter = 31; int carry; if (s == 0) { x86emu_intr_raise(0); return; } do { div <<= 1; carry = (l_dvd >= l_s) ? 0 : 1; if (abs_h_dvd < (h_s + carry)) { h_s >>= 1; l_s = abs_s << (--counter); continue; } else { abs_h_dvd -= (h_s + carry); l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1) : (l_dvd - l_s); h_s >>= 1; l_s = abs_s << (--counter); div |= 1; continue; } } while (counter > -1); /* overflow */ if (abs_h_dvd || (l_dvd > abs_s)) { x86emu_intr_raise(0); return; } /* sign */ div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000)); mod = l_dvd; #endif CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CLEAR_FLAG(F_SF); SET_FLAG(F_ZF); CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); M.x86.R_EAX = (u32) div; M.x86.R_EDX = (u32) mod; } /**************************************************************************** REMARKS: Implements the DIV instruction and side effects. ****************************************************************************/ void div_byte(u8 s) { u32 dvd, div, mod; dvd = M.x86.R_AX; if (s == 0) { x86emu_intr_raise(0); return; } div = dvd / (u8) s; mod = dvd % (u8) s; if (abs(div) > 0xff) { x86emu_intr_raise(0); return; } M.x86.R_AL = (u8) div; M.x86.R_AH = (u8) mod; } /**************************************************************************** REMARKS: Implements the DIV instruction and side effects. ****************************************************************************/ void div_word(u16 s) { u32 dvd, div, mod; dvd = (((u32) M.x86.R_DX) << 16) | M.x86.R_AX; if (s == 0) { x86emu_intr_raise(0); return; } div = dvd / (u16) s; mod = dvd % (u16) s; if (abs(div) > 0xffff) { x86emu_intr_raise(0); return; } CLEAR_FLAG(F_CF); CLEAR_FLAG(F_SF); CONDITIONAL_SET_FLAG(div == 0, F_ZF); CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); M.x86.R_AX = (u16) div; M.x86.R_DX = (u16) mod; } /**************************************************************************** REMARKS: Implements the DIV instruction and side effects. ****************************************************************************/ void div_long(u32 s) { #ifdef __HAS_LONG_LONG__ u64 dvd, div, mod; dvd = (((u64) M.x86.R_EDX) << 32) | M.x86.R_EAX; if (s == 0) { x86emu_intr_raise(0); return; } div = dvd / (u32) s; mod = dvd % (u32) s; if (abs(div) > 0xffffffff) { x86emu_intr_raise(0); return; } #else s32 div = 0, mod; s32 h_dvd = M.x86.R_EDX; u32 l_dvd = M.x86.R_EAX; u32 h_s = s; u32 l_s = 0; int counter = 32; int carry; if (s == 0) { x86emu_intr_raise(0); return; } do { div <<= 1; carry = (l_dvd >= l_s) ? 0 : 1; if (h_dvd < (h_s + carry)) { h_s >>= 1; l_s = s << (--counter); continue; } else { h_dvd -= (h_s + carry); l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1) : (l_dvd - l_s); h_s >>= 1; l_s = s << (--counter); div |= 1; continue; } } while (counter > -1); /* overflow */ if (h_dvd || (l_dvd > s)) { x86emu_intr_raise(0); return; } mod = l_dvd; #endif CLEAR_FLAG(F_CF); CLEAR_FLAG(F_AF); CLEAR_FLAG(F_SF); SET_FLAG(F_ZF); CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); M.x86.R_EAX = (u32) div; M.x86.R_EDX = (u32) mod; } /**************************************************************************** REMARKS: Implements the IN string instruction and side effects. ****************************************************************************/ void ins(int size) { int inc = size; if (ACCESS_FLAG(F_DF)) { inc = -size; } if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* in until CX is ZERO. */ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ? M.x86.R_ECX : M.x86.R_CX); switch (size) { case 1: while (count--) { store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, (*sys_inb) (M.x86.R_DX)); M.x86.R_DI += inc; } break; case 2: while (count--) { store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (*sys_inw) (M.x86.R_DX)); M.x86.R_DI += inc; } break; case 4: while (count--) { store_data_long_abs(M.x86.R_ES, M.x86.R_DI, (*sys_inl) (M.x86.R_DX)); M.x86.R_DI += inc; break; } } M.x86.R_CX = 0; if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ECX = 0; } M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } else { switch (size) { case 1: store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, (*sys_inb) (M.x86.R_DX)); break; case 2: store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (*sys_inw) (M.x86.R_DX)); break; case 4: store_data_long_abs(M.x86.R_ES, M.x86.R_DI, (*sys_inl) (M.x86.R_DX)); break; } M.x86.R_DI += inc; } } /**************************************************************************** REMARKS: Implements the OUT string instruction and side effects. ****************************************************************************/ void outs(int size) { int inc = size; if (ACCESS_FLAG(F_DF)) { inc = -size; } if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { /* dont care whether REPE or REPNE */ /* out until CX is ZERO. */ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ? M.x86.R_ECX : M.x86.R_CX); switch (size) { case 1: while (count--) { (*sys_outb) (M.x86.R_DX, fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI)); M.x86.R_SI += inc; } break; case 2: while (count--) { (*sys_outw) (M.x86.R_DX, fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI)); M.x86.R_SI += inc; } break; case 4: while (count--) { (*sys_outl) (M.x86.R_DX, fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI)); M.x86.R_SI += inc; break; } } M.x86.R_CX = 0; if (M.x86.mode & SYSMODE_PREFIX_DATA) { M.x86.R_ECX = 0; } M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); } else { switch (size) { case 1: (*sys_outb) (M.x86.R_DX, fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI)); break; case 2: (*sys_outw) (M.x86.R_DX, fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI)); break; case 4: (*sys_outl) (M.x86.R_DX, fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI)); break; } M.x86.R_SI += inc; } } /**************************************************************************** PARAMETERS: addr - Address to fetch word from REMARKS: Fetches a word from emulator memory using an absolute address. ****************************************************************************/ u16 mem_access_word(int addr) { DB(if (CHECK_MEM_ACCESS()) x86emu_check_mem_access(addr);) return (*sys_rdw) (addr); } /**************************************************************************** REMARKS: Pushes a word onto the stack. NOTE: Do not inline this, as (*sys_wrX) is already inline! ****************************************************************************/ void push_word(u16 w) { DB(if (CHECK_SP_ACCESS()) x86emu_check_sp_access();) M.x86.R_SP -= 2; (*sys_wrw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w); } /**************************************************************************** REMARKS: Pushes a long onto the stack. NOTE: Do not inline this, as (*sys_wrX) is already inline! ****************************************************************************/ void push_long(u32 w) { DB(if (CHECK_SP_ACCESS()) x86emu_check_sp_access();) M.x86.R_SP -= 4; (*sys_wrl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w); } /**************************************************************************** REMARKS: Pops a word from the stack. NOTE: Do not inline this, as (*sys_rdX) is already inline! ****************************************************************************/ u16 pop_word(void) { register u16 res; DB(if (CHECK_SP_ACCESS()) x86emu_check_sp_access();) res = (*sys_rdw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP); M.x86.R_SP += 2; return res; } /**************************************************************************** REMARKS: Pops a long from the stack. NOTE: Do not inline this, as (*sys_rdX) is already inline! ****************************************************************************/ u32 pop_long(void) { register u32 res; DB(if (CHECK_SP_ACCESS()) x86emu_check_sp_access();) res = (*sys_rdl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP); M.x86.R_SP += 4; return res; } /**************************************************************************** REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output ****************************************************************************/ void cpuid(void) { u32 feature = M.x86.R_EAX; #ifdef X86EMU_HAS_HW_CPUID /* If the platform allows it, we will base our values on the real * results from the CPUID instruction. We limit support to the * first two features, and the results of those are sanitized. */ if (feature <= 1) hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX); #endif switch (feature) { case 0: /* Regardless if we have real data from the hardware, the emulator * will only support upto feature 1, which we set in register EAX. * Registers EBX:EDX:ECX contain a string identifying the CPU. */ M.x86.R_EAX = 1; #ifndef X86EMU_HAS_HW_CPUID /* EBX:EDX:ECX = "GenuineIntel" */ M.x86.R_EBX = 0x756e6547; M.x86.R_EDX = 0x49656e69; M.x86.R_ECX = 0x6c65746e; #endif break; case 1: #ifndef X86EMU_HAS_HW_CPUID /* If we don't have x86 compatible hardware, we return values from an * Intel 486dx4; which was one of the first processors to have CPUID. */ M.x86.R_EAX = 0x00000480; M.x86.R_EBX = 0x00000000; M.x86.R_ECX = 0x00000000; M.x86.R_EDX = 0x00000002; /* VME */ #else /* In the case that we have hardware CPUID instruction, we make sure * that the features reported are limited to TSC and VME. */ M.x86.R_EDX &= 0x00000012; #endif break; default: /* Finally, we don't support any additional features. Most CPUs * return all zeros when queried for invalid or unsupported feature * numbers. */ M.x86.R_EAX = 0; M.x86.R_EBX = 0; M.x86.R_ECX = 0; M.x86.R_EDX = 0; break; } } xorg-server-1.20.8/hw/xfree86/x86emu/meson.build0000644000175000017500000000040513640201473016210 00000000000000srcs_xorg_x86emu = [ 'debug.c', 'decode.c', 'fpu.c', 'ops2.c', 'ops.c', 'prim_ops.c', 'sys.c', ] xorg_x86emu = static_library('x86emu', srcs_xorg_x86emu, include_directories: [inc, xorg_inc], dependencies: common_dep, ) xorg-server-1.20.8/hw/xfree86/modes/0000755000175000017500000000000013640201534014100 500000000000000xorg-server-1.20.8/hw/xfree86/modes/Makefile.am0000644000175000017500000000122613640201473016057 00000000000000noinst_LTLIBRARIES = libxf86modes.la if DGA DGA_SRCS = xf86DiDGA.c endif libxf86modes_la_SOURCES = \ xf86Crtc.c \ xf86Crtc.h \ xf86Cursors.c \ xf86cvt.c \ xf86gtf.c \ xf86EdidModes.c \ xf86Modes.c \ xf86Modes.h \ xf86RandR12.c \ xf86RandR12.h \ xf86Rotate.c \ $(DGA_SRCS) AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \ -I$(srcdir)/../dixmods/extmod sdk_HEADERS = \ xf86Crtc.h \ xf86Modes.h \ xf86RandR12.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) xorg-server-1.20.8/hw/xfree86/modes/xf86Crtc.c0000644000175000017500000032141113640201473015577 00000000000000/* * 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 #endif #include #include #include #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" #ifdef XV #include "xf86xv.h" #endif #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; config->compat_output = -1; 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 = xallocarray(crtc->gamma_size, 3 * 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 = reallocarray(xf86_config->crtc, xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr)); else crtcs = xallocarray(xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr)); if (!crtcs) { free(crtc->gamma_red); 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; } /** * Return whether the crtc is leased by a client */ static Bool xf86CrtcIsLeased(xf86CrtcPtr crtc) { /* If the DIX structure hasn't been created, it can't have been leased */ if (!crtc->randr_crtc) return FALSE; return RRCrtcIsLeased(crtc->randr_crtc); } /** * Return whether the output is leased by a client */ static Bool xf86OutputIsLeased(xf86OutputPtr output) { /* If the DIX structure hasn't been created, it can't have been leased */ if (!output->randr_output) return FALSE; return RROutputIsLeased(output->randr_output); } void xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) { int subpixel_order = SubPixelUnknown; Bool has_none = FALSE; ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int icrtc, o; for (icrtc = 0; icrtc < xf86_config->num_crtc; icrtc++) { xf86CrtcPtr crtc = xf86_config->crtc[icrtc]; 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 sc; for (rotate = 0; rotate < 4; rotate++) if (crtc->rotation & (1 << rotate)) break; for (sc = 0; sc < 4; sc++) if (circle[sc] == subpixel_order) break; sc = (sc + rotate) & 0x3; if ((crtc->rotation & RR_Reflect_X) && !(sc & 1)) sc ^= 2; if ((crtc->rotation & RR_Reflect_Y) && (sc & 1)) sc ^= 2; subpixel_order = circle[sc]; 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) && !xf86CrtcIsLeased(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); /* Make sure the HW cursor is hidden if it's supposed to be, in case * it was hidden while the CRTC was disabled */ if (!xf86_config->cursor_on) xf86_hide_cursors(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((void *) 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 (xf86CrtcIsLeased(crtc)) return; 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_ZOOM_MODES, 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_ZOOM_MODES, "ZoomModes", 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, OPTION_PREFER_CLONEMODE, }; static OptionInfoRec xf86DeviceOptions[] = { {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_PREFER_CLONEMODE, "PreferCloneMode", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; static void xf86OutputSetMonitor(xf86OutputPtr output) { char *option_name; const 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 which are supposed to be on the desktop */ if (strict) { enable = output->status == XF86OutputStatusConnected && !output->non_desktop; } /* 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 const char *direction[4] = { "normal", "left", "inverted", "right" }; static Rotation xf86OutputInitialRotation(xf86OutputPtr output) { const 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 = reallocarray(xf86_config->output, xf86_config->num_output + 1, sizeof(xf86OutputPtr)); else outputs = xallocarray(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 = xf86ScreenToScrn(screen); 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(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o, c; /* The randr_output and randr_crtc pointers are already invalid as * the DIX resources were freed when the associated resources were * freed. Clear them now; referencing through them during the rest * of the CloseScreen sequence will not end well. */ 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; } screen->CloseScreen = config->CloseScreen; xf86RotateCloseScreen(screen); xf86RandR12CloseScreen(screen); screen->CloseScreen(screen); /* detach any providers */ if (config->randr_provider) { RRProviderDestroy(config->randr_provider); config->randr_provider = NULL; } return TRUE; } /* * Called at ScreenInit time to set up */ #ifdef RANDR_13_INTERFACE int #else Bool #endif xf86CrtcScreenInit(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int c; /* Rotation */ 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; /* This might still be marked wrapped from a previous generation */ config->BlockHandler = NULL; #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; 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_score = xf86PickCrtcs(scrn, best_crtcs, modes, n + 1, width, height); if (modes[n] == NULL) return best_score; crtcs = xallocarray(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_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]; const char *position; const 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; /* check for initial right-of heuristic */ for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; if (output->initial_x || output->initial_y) return TRUE; } 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; const char *relative_name; const 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]; const 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((void *) 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 const char * preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output) { const 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; } /** identify a token * args * *src a string with zero or more tokens, e.g. "tok0 tok1", * **token stores a pointer to the first token character, * *len stores the token length. * return * a pointer into src[] at the token terminating character, or * NULL if no token is found. */ static const char * gettoken(const char *src, const char **token, int *len) { const char *delim = " \t"; int skip; if (!src) return NULL; skip = strspn(src, delim); *token = &src[skip]; *len = strcspn(*token, delim); /* Support for backslash escaped delimiters could be implemented * here. */ /* (*token)[0] != '\0' <==> *len > 0 */ if (*len > 0) return &(*token)[*len]; else return NULL; } /** Check for a user configured zoom mode list, Option "ZoomModes": * * Section "Monitor" * Identifier "a21inch" * Option "ZoomModes" "1600x1200 1280x1024 1280x1024 640x480" * EndSection * * Each user mode name is searched for independently so the list * specification order is free. An output mode is matched at most * once, a mode with an already set M_T_USERDEF type bit is skipped. * Thus a repeat mode name specification matches the next output mode * with the same name. * * Ctrl+Alt+Keypad-{Plus,Minus} zooms {in,out} by selecting the * {next,previous} M_T_USERDEF mode in the screen modes list, itself * sorted toward lower dot area or lower dot clock frequency, see * modes/xf86Crtc.c: xf86SortModes() xf86SetScrnInfoModes(), and * common/xf86Cursor.c: xf86ZoomViewport(). */ static int processZoomModes(xf86OutputPtr output) { const char *zoom_modes; int count = 0; zoom_modes = xf86GetOptValString(output->options, OPTION_ZOOM_MODES); if (zoom_modes) { const char *token, *next; int len; next = gettoken(zoom_modes, &token, &len); while (next) { DisplayModePtr mode; for (mode = output->probed_modes; mode; mode = mode->next) if (!strncmp(token, mode->name, len) /* prefix match */ && mode->name[len] == '\0' /* equal length */ && !(mode->type & M_T_USERDEF)) { /* no rematch */ mode->type |= M_T_USERDEF; break; } count++; next = gettoken(next, &token, &len); } } return count; } 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; const 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; struct cea_data_block *hdmi_db; /* 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); /* Look at the CEA HDMI vendor block for the max TMDS freq */ hdmi_db = xf86MonitorFindHDMIBlock(edid_monitor); if (hdmi_db && hdmi_db->len >= 7) { int tmds_freq = hdmi_db->u.vendor.hdmi.max_tmds_clock * 5000; xf86DrvMsg(scrn->scrnIndex, X_PROBED, "HDMI max TMDS frequency %dKHz\n", tmds_freq); if (tmds_freq > max_clock) max_clock = tmds_freq; } } 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; } } } /* Ctrl+Alt+Keypad-{Plus,Minus} zoom mode: M_T_USERDEF mode type */ processZoomModes(output); 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 */ 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; if (config->num_output == 0) return NULL; /* 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 if (config->compat_output >= 0 && config->compat_output < config->num_output) { /* Don't change the compat output when no valid outputs found */ output = config->output[config->compat_output]; } /* All outputs are disconnected, select one to fake */ if (!output && config->num_output) { config->compat_output = 0; 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) { scrn->modes = xf86ModesAdd(scrn->modes, xf86CVTMode(scrn->display->virtualX, scrn->display->virtualY, 60, 0, 0)); } /* 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; /* * Don't bother enabling outputs on GPU screens: a client needs to attach * it to a source provider before setting a mode that scans out a shared * pixmap. */ if (scrn->is_gpu) return FALSE; 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 int numEnabledOutputs(xf86CrtcConfigPtr config, Bool *enabled) { int i = 0, p; for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ; return i; } static Bool xf86TargetRightOf(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, DisplayModePtr *modes, Bool *enabled, int width, int height) { int o; int w = 0; Bool has_tile = FALSE; uint32_t configured_outputs; xf86GetOptValBool(config->options, OPTION_PREFER_CLONEMODE, &scrn->preferClone); if (scrn->preferClone) return FALSE; if (numEnabledOutputs(config, enabled) < 2) return FALSE; for (o = -1; nextEnabledOutput(config, enabled, &o); ) { DisplayModePtr mode = xf86OutputHasPreferredMode(config->output[o], width, height); if (!mode) return FALSE; w += mode->HDisplay; } if (w > width) return FALSE; w = 0; configured_outputs = 0; for (o = -1; nextEnabledOutput(config, enabled, &o); ) { DisplayModePtr mode = xf86OutputHasPreferredMode(config->output[o], width, height); if (configured_outputs & (1 << o)) continue; if (config->output[o]->tile_info.group_id) { has_tile = TRUE; continue; } config->output[o]->initial_x = w; w += mode->HDisplay; configured_outputs |= (1 << o); modes[o] = mode; } if (has_tile) { for (o = -1; nextEnabledOutput(config, enabled, &o); ) { int ht, vt, ot; int add_x, cur_x = w; struct xf86CrtcTileInfo *tile_info = &config->output[o]->tile_info, *this_tile; if (configured_outputs & (1 << o)) continue; if (!tile_info->group_id) continue; if (tile_info->tile_h_loc != 0 && tile_info->tile_v_loc != 0) continue; for (ht = 0; ht < tile_info->num_h_tile; ht++) { int cur_y = 0; add_x = 0; for (vt = 0; vt < tile_info->num_v_tile; vt++) { for (ot = -1; nextEnabledOutput(config, enabled, &ot); ) { DisplayModePtr mode = xf86OutputHasPreferredMode(config->output[ot], width, height); if (!config->output[ot]->tile_info.group_id) continue; this_tile = &config->output[ot]->tile_info; if (this_tile->group_id != tile_info->group_id) continue; if (this_tile->tile_h_loc != ht || this_tile->tile_v_loc != vt) continue; config->output[ot]->initial_x = cur_x; config->output[ot]->initial_y = cur_y; if (vt == 0) add_x = this_tile->tile_h_size; cur_y += this_tile->tile_v_size; configured_outputs |= (1 << ot); modes[ot] = mode; } } cur_x += add_x; } w = cur_x; } } return TRUE; } 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; /* * First see if the preferred mode matches on the next * output as well. This catches the common case of identical * monitors and makes sure they all have the same timings * and refresh. If that fails, we fall back to trying to * match just width & height. */ mode = xf86OutputHasPreferredMode(output, pref_width, pref_height); if (mode && xf86ModesEqual(mode, preferred[p])) { preferred[o] = mode; match = TRUE; } else { for (mode = output->probed_modes; mode; mode = mode->next) { Rotation ir = output->initial_rotation; if (xf86ModeWidth(mode, ir) == pref_width && xf86ModeHeight(mode, ir) == 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 or 4:3, assuming one exists. */ if (!ret) do { float aspect = 0.0; DisplayModePtr a = NULL, b = NULL; if (numEnabledOutputs(config, enabled) != 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; a = bestModeForAspect(config, enabled, 4.0/3.0); if (aspect) b = bestModeForAspect(config, enabled, aspect); preferred_match[p] = biggestMode(a, b); 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; } /** * 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; Bool success = FALSE; /* 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 && !scrn->is_gpu) width = scrn->display->virtualX; else width = config->maxWidth; if (scrn->display->virtualY && !scrn->is_gpu) 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) { if (!scrn->is_gpu) 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 (xf86TargetRightOf(scrn, config, modes, enabled, width, height)) xf86DrvMsg(i, X_INFO, "Using spanning desktop 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 +%d+%d\n", config->output[o]->name, modes[o]->name, config->output[o]->initial_x, config->output[o]->initial_y); } /* * Set the position of each output */ if (!xf86InitialOutputPositions(scrn, modes)) goto bailout; /* * Set initial panning of each output */ xf86InitialPanning(scrn); /* * Assign CRTCs to fit output configuration */ if (have_outputs && !xf86PickCrtcs(scrn, crtcs, modes, 0, width, height)) goto bailout; /* XXX override xf86 common frame computation code */ if (!scrn->is_gpu) { 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 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) { xf86SaveModeContents(&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; } else { output->crtc = NULL; } } if (scrn->display->virtualX == 0 || scrn->is_gpu) { /* * 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; } } if (!scrn->is_gpu) { 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) goto bailout; /* * 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); } xf86SetScrnInfoModes(scrn); success = TRUE; bailout: free(crtcs); free(modes); free(enabled); return success; } /* Turn a CRTC off, using the DPMS function and disabling the cursor */ static void xf86DisableCrtc(xf86CrtcPtr crtc) { if (xf86CrtcIsLeased(crtc)) return; crtc->funcs->dpms(crtc, DPMSModeOff); xf86_crtc_hide_cursor(crtc); } /* * 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 (xf86OutputIsLeased(output)) continue; #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++) { xf86CrtcPtr crtc = config->crtc[c]; #if RANDR_GET_CRTC_INTERFACE xf86OutputPtr output = NULL; uint32_t desired_outputs = 0, current_outputs = 0; int o; if (xf86CrtcIsLeased(crtc)) continue; 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) xf86DisableCrtc(crtc); #else if (xf86CrtcIsLeased(crtc)) continue; xf86DisableCrtc(crtc); #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 enabled = 0, failed = 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; xf86SaveModeContents(&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)) { ++enabled; } else { for (o = 0; o < config->num_output; o++) if (config->output[o]->crtc == crtc) config->output[o]->crtc = NULL; crtc->enabled = FALSE; ++failed; } } xf86DisableUnusedFunctions(scrn); return enabled != 0 || failed == 0; } /** * 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 { xf86SaveModeContents(&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 (!xf86OutputIsLeased(output) && 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 (!xf86OutputIsLeased(output) && 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 = xf86ScreenToScrn(pScreen); 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) { xf86DisableCrtc(crtc); 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); if (pScrn->pScreen) { if (pScrn->pScreen->isGPU) xf86CursorResetCursor(pScrn->pScreen->current_master); else xf86CursorResetCursor(pScrn->pScreen); } } #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); } } #define TILE_ATOM_NAME "TILE" /* changing this in the future could be tricky as people may hardcode 8 */ #define TILE_PROP_NUM_ITEMS 8 static void xf86OutputSetTileProperty(xf86OutputPtr output) { Atom tile_atom = MakeAtom(TILE_ATOM_NAME, sizeof(TILE_ATOM_NAME) - 1, TRUE); /* This may get called before the RandR resources have been created */ if (output->randr_output == NULL) return; if (output->tile_info.group_id != 0) { RRChangeOutputProperty(output->randr_output, tile_atom, XA_INTEGER, 32, PropModeReplace, TILE_PROP_NUM_ITEMS, (uint32_t *)&output->tile_info, FALSE, TRUE); } else { RRDeleteOutputProperty(output->randr_output, tile_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) { /* some sanity checking for aspect ratio: assume any h / v (or v / h) > 2.4 to be bogus. This would even include cinemascope */ if (((det_mon->section.d_timings.h_size * 5) < (det_mon->section.d_timings.v_size * 12)) && ((det_mon->section.d_timings.v_size * 5) < (det_mon->section.d_timings.h_size * 12))) { 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; } else xf86DrvMsg(p->output->scrn->scrnIndex, X_WARNING, "Output %s: Strange aspect ratio (%i/%i), " "consider adding a quirk\n", p->output->name, det_mon->section.d_timings.h_size, det_mon->section.d_timings.v_size); } } Bool xf86OutputParseKMSTile(const char *tile_data, int tile_length, struct xf86CrtcTileInfo *tile_info) { int ret; ret = sscanf(tile_data, "%d:%d:%d:%d:%d:%d:%d:%d", &tile_info->group_id, &tile_info->flags, &tile_info->num_h_tile, &tile_info->num_v_tile, &tile_info->tile_h_loc, &tile_info->tile_v_loc, &tile_info->tile_h_size, &tile_info->tile_v_size); if (ret != 8) return FALSE; return TRUE; } void xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info) { if (tile_info) output->tile_info = *tile_info; else memset(&output->tile_info, 0, sizeof(output->tile_info)); #ifdef RANDR_12_INTERFACE xf86OutputSetTileProperty(output); #endif } /** * 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 */ /* GPU screens don't have a root window */ if (output == xf86CompatOutput(scrn) && !scrn->is_gpu) 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, pDDCBus, TRUE); if (mon) xf86DDCApplyQuirks(scrn->scrnIndex, mon); return mon; } static const char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D", "DVI-A", "Composite", "S-Video", "Component", "LFP", "Proprietary", "HDMI", "DisplayPort", }; const char * xf86ConnectorGetName(xf86ConnectorType connector) { return _xf86ConnectorNames[connector]; } #ifdef XV 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; } #endif xf86_crtc_notify_proc_ptr xf86_wrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr new) { if (xf86CrtcConfigPrivateIndex != -1) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); 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 = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); config->xf86_crtc_notify = old; } } void xf86_crtc_notify(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); 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; } void xf86ProviderSetup(ScrnInfoPtr scrn, const xf86ProviderFuncsRec *funcs, const char *name) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); assert(!xf86_config->name); assert(name); xf86_config->name = strdup(name); xf86_config->provider_funcs = funcs; #ifdef RANDR_12_INTERFACE xf86_config->randr_provider = NULL; #endif } void xf86DetachAllCrtc(ScrnInfoPtr scrn) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int i; for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; if (crtc->randr_crtc) RRCrtcDetachScanoutPixmap(crtc->randr_crtc); /* dpms off */ xf86DisableCrtc(crtc); /* force a reset the next time its used */ crtc->randr_crtc->mode = NULL; crtc->mode.HDisplay = 0; crtc->x = crtc->y = 0; } } xorg-server-1.20.8/hw/xfree86/modes/xf86RandR12.h0000644000175000017500000000502713640201473016064 00000000000000/* * 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 _XF86_RANDR_H_ #define _XF86_RANDR_H_ #include #include extern _X_EXPORT Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen); extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen); extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen); extern _X_EXPORT void xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotation); extern _X_EXPORT void xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms); extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); extern _X_EXPORT Rotation xf86RandR12GetRotation(ScreenPtr pScreen); extern _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); extern _X_EXPORT Bool xf86RandR12PreInit(ScrnInfoPtr pScrn); extern _X_EXPORT void xf86RandR12TellChanged(ScreenPtr pScreen); extern void xf86RandR12LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); extern Bool xf86RandR12InitGamma(ScrnInfoPtr pScrn, unsigned gammaSize); #endif /* _XF86_RANDR_H_ */ xorg-server-1.20.8/hw/xfree86/modes/xf86DiDGA.c0000644000175000017500000001347213640201473015561 00000000000000/* * 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 #endif #include "xf86.h" #include "xf86DDC.h" #include "xf86_OSproc.h" #include "dgaproc.h" #include "xf86Crtc.h" #include "xf86Modes.h" #include "gcstruct.h" #include "scrnintstr.h" #include "windowstr.h" static Bool xf86_dga_get_modes(ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); DGAModePtr modes, mode; DisplayModePtr display_mode; int bpp = scrn->bitsPerPixel >> 3; int num; num = 0; display_mode = scrn->modes; while (display_mode) { num++; display_mode = display_mode->next; if (display_mode == scrn->modes) break; } if (!num) return FALSE; modes = xallocarray(num, sizeof(DGAModeRec)); if (!modes) return FALSE; num = 0; display_mode = scrn->modes; while (display_mode) { mode = modes + num++; mode->mode = display_mode; mode->flags = DGA_CONCURRENT_ACCESS; if (display_mode->Flags & V_DBLSCAN) mode->flags |= DGA_DOUBLESCAN; if (display_mode->Flags & V_INTERLACE) mode->flags |= DGA_INTERLACED; mode->byteOrder = scrn->imageByteOrder; mode->depth = scrn->depth; mode->bitsPerPixel = scrn->bitsPerPixel; mode->red_mask = scrn->mask.red; mode->green_mask = scrn->mask.green; mode->blue_mask = scrn->mask.blue; mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor; mode->viewportWidth = display_mode->HDisplay; mode->viewportHeight = display_mode->VDisplay; mode->xViewportStep = (bpp == 3) ? 2 : 1; mode->yViewportStep = 1; mode->viewportFlags = DGA_FLIP_RETRACE; mode->offset = 0; mode->address = 0; mode->imageWidth = mode->viewportWidth; mode->imageHeight = mode->viewportHeight; mode->bytesPerScanline = (mode->imageWidth * scrn->bitsPerPixel) >> 3; mode->pixmapWidth = mode->imageWidth; mode->pixmapHeight = mode->imageHeight; mode->maxViewportX = 0; mode->maxViewportY = 0; display_mode = display_mode->next; if (display_mode == scrn->modes) break; } free(xf86_config->dga_modes); xf86_config->dga_nmode = num; xf86_config->dga_modes = modes; return TRUE; } static Bool xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode) { ScreenPtr pScreen = scrn->pScreen; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); if (!display_mode) { if (xf86_config->dga_save_mode) { xf86SwitchMode(pScreen, xf86_config->dga_save_mode); xf86_config->dga_save_mode = NULL; } } else { if (!xf86_config->dga_save_mode) { xf86_config->dga_save_mode = scrn->currentMode; xf86SwitchMode(pScreen, display_mode->mode); } } return TRUE; } static int xf86_dga_get_viewport(ScrnInfoPtr scrn) { return 0; } static void xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags) { scrn->AdjustFrame(scrn, x, y); } static Bool xf86_dga_open_framebuffer(ScrnInfoPtr scrn, char **name, unsigned char **mem, int *size, int *offset, int *flags) { return FALSE; } static void xf86_dga_close_framebuffer(ScrnInfoPtr scrn) { } static DGAFunctionRec xf86_dga_funcs = { xf86_dga_open_framebuffer, xf86_dga_close_framebuffer, xf86_dga_set_mode, xf86_dga_set_viewport, xf86_dga_get_viewport, NULL, NULL, NULL, NULL }; Bool xf86DiDGAReInit(ScreenPtr pScreen) { return TRUE; } Bool _xf86_di_dga_reinit_internal(ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); if (!DGAScreenAvailable(pScreen)) return TRUE; if (!xf86_dga_get_modes(pScreen)) return FALSE; return DGAReInitModes(pScreen, xf86_config->dga_modes, xf86_config->dga_nmode); } Bool xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address) { return TRUE; } Bool _xf86_di_dga_init_internal(ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86_config->dga_flags = 0; xf86_config->dga_address = 0; xf86_config->dga_width = 0; xf86_config->dga_height = 0; xf86_config->dga_stride = 0; if (!xf86_dga_get_modes(pScreen)) return FALSE; return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode); } xorg-server-1.20.8/hw/xfree86/modes/xf86Modes.h0000644000175000017500000001066613640201473015767 00000000000000/* * Copyright © 2006 Intel Corporation * * 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. * * Authors: * Eric Anholt * */ #ifndef _XF86MODES_H_ #define _XF86MODES_H_ #include #include #include #include "xf86.h" #include "xorgVersion.h" #include "edid.h" #include "xf86Parser.h" extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode); extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode); extern _X_EXPORT unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth); extern _X_EXPORT int xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation); extern _X_EXPORT int xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation); extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode); extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode); extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec * pMode1, const DisplayModeRec * pMode2); extern _X_EXPORT void xf86PrintModeline(int scrnIndex, DisplayModePtr mode); extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced); extern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins); extern _X_EXPORT Bool xf86ModeIsReduced(const DisplayModeRec * mode); extern _X_EXPORT void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags); extern _X_EXPORT void xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, int *min, int *max, int n_ranges); extern _X_EXPORT void xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, int maxX, int maxY, int maxPitch); extern _X_EXPORT void xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon); extern _X_EXPORT void xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, unsigned int bandwidth, int depth); extern _X_EXPORT void xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList); extern _X_EXPORT void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList, Bool verbose); extern _X_EXPORT DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes); extern _X_EXPORT void xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList); extern _X_EXPORT DisplayModePtr xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor); extern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void); extern _X_EXPORT void xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode); extern _X_EXPORT void xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC); #endif /* _XF86MODES_H_ */ xorg-server-1.20.8/hw/xfree86/modes/xf86EdidModes.c0000644000175000017500000015205413640201473016546 00000000000000/* * Copyright 2006 Luc Verhaegen. * Copyright 2008 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, sub license, * 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 NON-INFRINGEMENT. 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. */ /** * @file This file covers code to convert a xf86MonPtr containing EDID-probed * information into a list of modes, including applying monitor-specific * quirks to fix broken EDID data. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #define _PARSE_EDID_ #include "xf86.h" #include "xf86DDC.h" #include #include "property.h" #include "propertyst.h" #include "xf86Crtc.h" #include #include static void handle_detailed_rblank(struct detailed_monitor_section *det_mon, void *data) { if (det_mon->type == DS_RANGES) if (det_mon->section.ranges.supported_blanking & CVT_REDUCED) *(Bool *) data = TRUE; } static Bool xf86MonitorSupportsReducedBlanking(xf86MonPtr DDC) { /* EDID 1.4 explicitly defines RB support */ if (DDC->ver.revision >= 4) { Bool ret = FALSE; xf86ForEachDetailedBlock(DDC, handle_detailed_rblank, &ret); return ret; } /* For anything older, assume digital means RB support. Boo. */ if (DDC->features.input_type) return TRUE; return FALSE; } static Bool quirk_prefer_large_60(int scrnIndex, xf86MonPtr DDC) { /* Belinea 10 15 55 */ if (memcmp(DDC->vendor.name, "MAX", 4) == 0 && ((DDC->vendor.prod_id == 1516) || (DDC->vendor.prod_id == 0x77e))) return TRUE; /* Acer AL1706 */ if (memcmp(DDC->vendor.name, "ACR", 4) == 0 && DDC->vendor.prod_id == 44358) return TRUE; /* Bug #10814: Samsung SyncMaster 225BW */ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 596) return TRUE; /* Bug #10545: Samsung SyncMaster 226BW */ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 638) return TRUE; /* Acer F51 */ if (memcmp(DDC->vendor.name, "API", 4) == 0 && DDC->vendor.prod_id == 0x7602) return TRUE; return FALSE; } static Bool quirk_prefer_large_75(int scrnIndex, xf86MonPtr DDC) { /* Bug #11603: Funai Electronics PM36B */ if (memcmp(DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600) return TRUE; return FALSE; } static Bool quirk_detailed_h_in_cm(int scrnIndex, xf86MonPtr DDC) { /* Bug #11603: Funai Electronics PM36B */ if (memcmp(DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600) return TRUE; return FALSE; } static Bool quirk_detailed_v_in_cm(int scrnIndex, xf86MonPtr DDC) { /* Bug #11603: Funai Electronics PM36B */ if (memcmp(DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600) return TRUE; /* Bug #21000: LGPhilipsLCD LP154W01-TLAJ */ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 47360) return TRUE; /* Bug #10304: LGPhilipsLCD LP154W01-A5 */ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 0) return TRUE; /* Bug #24482: LGPhilipsLCD LP154W01-TLA1 */ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 0x2a00) return TRUE; /* Bug #28414: HP Compaq NC8430 LP154W01-TLA8 */ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 5750) return TRUE; /* Bug #21750: Samsung Syncmaster 2333HD */ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 1157) return TRUE; return FALSE; } static Bool quirk_detailed_use_maximum_size(int scrnIndex, xf86MonPtr DDC) { /* ADA 1024x600 7" display */ if (memcmp(DDC->vendor.name, "ADA", 4) == 0 && DDC->vendor.prod_id == 4) return TRUE; /* Bug #21324: Iiyama Vision Master 450 */ if (memcmp(DDC->vendor.name, "IVM", 4) == 0 && DDC->vendor.prod_id == 6400) return TRUE; /* Bug #41141: Acer Aspire One */ if (memcmp(DDC->vendor.name, "LGD", 4) == 0 && DDC->vendor.prod_id == 0x7f01) return TRUE; /* Sony Vaio Pro 13 */ if (memcmp(DDC->vendor.name, "MEI", 4) == 0 && DDC->vendor.prod_id == 0x96a2) return TRUE; return FALSE; } static Bool quirk_135_clock_too_high(int scrnIndex, xf86MonPtr DDC) { /* Envision Peripherals, Inc. EN-7100e. See bug #9550. */ if (memcmp(DDC->vendor.name, "EPI", 4) == 0 && DDC->vendor.prod_id == 59264) return TRUE; return FALSE; } static Bool quirk_first_detailed_preferred(int scrnIndex, xf86MonPtr DDC) { /* Philips 107p5 CRT. Reported on xorg@ with pastebin. */ if (memcmp(DDC->vendor.name, "PHL", 4) == 0 && DDC->vendor.prod_id == 57364) return TRUE; /* Proview AY765C 17" LCD. See bug #15160 */ if (memcmp(DDC->vendor.name, "PTS", 4) == 0 && DDC->vendor.prod_id == 765) return TRUE; /* ACR of some sort RH #284231 */ if (memcmp(DDC->vendor.name, "ACR", 4) == 0 && DDC->vendor.prod_id == 2423) return TRUE; /* Peacock Ergovision 19. See rh#492359 */ if (memcmp(DDC->vendor.name, "PEA", 4) == 0 && DDC->vendor.prod_id == 9003) return TRUE; return FALSE; } static Bool quirk_detailed_sync_pp(int scrnIndex, xf86MonPtr DDC) { /* Bug #12439: Samsung SyncMaster 205BW */ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 541) return TRUE; return FALSE; } /* This should probably be made more generic */ static Bool quirk_dvi_single_link(int scrnIndex, xf86MonPtr DDC) { /* Red Hat bug #453106: Apple 23" Cinema Display */ if (memcmp(DDC->vendor.name, "APL", 4) == 0 && DDC->vendor.prod_id == 0x921c) return TRUE; return FALSE; } typedef struct { Bool (*detect) (int scrnIndex, xf86MonPtr DDC); ddc_quirk_t quirk; const char *description; } ddc_quirk_map_t; static const ddc_quirk_map_t ddc_quirks[] = { { quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60, "Detailed timing is not preferred, use largest mode at 60Hz"}, { quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH, "Recommended 135MHz pixel clock is too high"}, { quirk_prefer_large_75, DDC_QUIRK_PREFER_LARGE_75, "Detailed timing is not preferred, use largest mode at 75Hz"}, { quirk_detailed_h_in_cm, DDC_QUIRK_DETAILED_H_IN_CM, "Detailed timings give horizontal size in cm."}, { quirk_detailed_v_in_cm, DDC_QUIRK_DETAILED_V_IN_CM, "Detailed timings give vertical size in cm."}, { quirk_detailed_use_maximum_size, DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE, "Use maximum size instead of detailed timing sizes."}, { quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED, "First detailed timing was not marked as preferred."}, { quirk_detailed_sync_pp, DDC_QUIRK_DETAILED_SYNC_PP, "Use +hsync +vsync for detailed timing."}, { quirk_dvi_single_link, DDC_QUIRK_DVI_SINGLE_LINK, "Forcing maximum pixel clock to single DVI link."}, { NULL, DDC_QUIRK_NONE, "No known quirks"}, }; /* * These more or less come from the DMT spec. The 720x400 modes are * inferred from historical 80x25 practice. The 640x480@67 and 832x624@75 * modes are old-school Mac modes. The EDID spec says the 1152x864@75 mode * should be 1152x870, again for the Mac, but instead we use the x864 DMT * mode. * * The DMT modes have been fact-checked; the rest are mild guesses. */ #define MODEPREFIX NULL, NULL, NULL, 0, M_T_DRIVER #define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 static const DisplayModeRec DDCEstablishedModes[17] = { {MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@60Hz */ {MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@56Hz */ {MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@75Hz */ {MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 492, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@72Hz */ {MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@67Hz */ {MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@60Hz */ {MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 720x400@88Hz */ {MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 720x400@70Hz */ {MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@75Hz */ {MODEPREFIX, 78750, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1024x768@75Hz */ {MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@70Hz */ {MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@60Hz */ {MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 772, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* 1024x768@43Hz */ {MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 832x624@75Hz */ {MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@75Hz */ {MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@72Hz */ {MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1152x864@75Hz */ }; static DisplayModePtr DDCModesFromEstablished(int scrnIndex, struct established_timings *timing, ddc_quirk_t quirks) { DisplayModePtr Modes = NULL, Mode = NULL; CARD32 bits = (timing->t1) | (timing->t2 << 8) | ((timing->t_manu & 0x80) << 9); int i; for (i = 0; i < 17; i++) { if (bits & (0x01 << i)) { Mode = xf86DuplicateMode(&DDCEstablishedModes[i]); Modes = xf86ModesAdd(Modes, Mode); } } return Modes; } /* Autogenerated from the DMT spec */ const DisplayModeRec DMTModes[] = { {MODEPREFIX, 31500, 640, 672, 736, 832, 0, 350, 382, 385, 445, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x350@85Hz */ {MODEPREFIX, 31500, 640, 672, 736, 832, 0, 400, 401, 404, 445, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 640x400@85Hz */ {MODEPREFIX, 35500, 720, 756, 828, 936, 0, 400, 401, 404, 446, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 720x400@85Hz */ {MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@60Hz */ {MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 492, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@72Hz */ {MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@75Hz */ {MODEPREFIX, 36000, 640, 696, 752, 832, 0, 480, 481, 484, 509, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@85Hz */ {MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@56Hz */ {MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@60Hz */ {MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@72Hz */ {MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@75Hz */ {MODEPREFIX, 56250, 800, 832, 896, 1048, 0, 600, 601, 604, 631, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@85Hz */ {MODEPREFIX, 73250, 800, 848, 880, 960, 0, 600, 603, 607, 636, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 800x600@120Hz RB */ {MODEPREFIX, 33750, 848, 864, 976, 1088, 0, 480, 486, 494, 517, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 848x480@60Hz */ {MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 772, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* 1024x768@43Hz (interlaced) */ {MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@60Hz */ {MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@70Hz */ {MODEPREFIX, 78750, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1024x768@75Hz */ {MODEPREFIX, 94500, 1024, 1072, 1168, 1376, 0, 768, 769, 772, 808, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1024x768@85Hz */ {MODEPREFIX, 115500, 1024, 1072, 1104, 1184, 0, 768, 771, 775, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@120Hz RB */ {MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1152x864@75Hz */ {MODEPREFIX, 68250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 790, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x768@60Hz RB */ {MODEPREFIX, 79500, 1280, 1344, 1472, 1664, 0, 768, 771, 778, 798, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x768@60Hz */ {MODEPREFIX, 102250, 1280, 1360, 1488, 1696, 0, 768, 771, 778, 805, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x768@75Hz */ {MODEPREFIX, 117500, 1280, 1360, 1496, 1712, 0, 768, 771, 778, 809, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x768@85Hz */ {MODEPREFIX, 140250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x768@120Hz RB */ {MODEPREFIX, 71000, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 823, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x800@60Hz RB */ {MODEPREFIX, 83500, 1280, 1352, 1480, 1680, 0, 800, 803, 809, 831, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x800@60Hz */ {MODEPREFIX, 106500, 1280, 1360, 1488, 1696, 0, 800, 803, 809, 838, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x800@75Hz */ {MODEPREFIX, 122500, 1280, 1360, 1496, 1712, 0, 800, 803, 809, 843, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x800@85Hz */ {MODEPREFIX, 146250, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 847, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x800@120Hz RB */ {MODEPREFIX, 108000, 1280, 1376, 1488, 1800, 0, 960, 961, 964, 1000, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x960@60Hz */ {MODEPREFIX, 148500, 1280, 1344, 1504, 1728, 0, 960, 961, 964, 1011, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x960@85Hz */ {MODEPREFIX, 175500, 1280, 1328, 1360, 1440, 0, 960, 963, 967, 1017, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x960@120Hz RB */ {MODEPREFIX, 108000, 1280, 1328, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@60Hz */ {MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@75Hz */ {MODEPREFIX, 157500, 1280, 1344, 1504, 1728, 0, 1024, 1025, 1028, 1072, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@85Hz */ {MODEPREFIX, 187250, 1280, 1328, 1360, 1440, 0, 1024, 1027, 1034, 1084, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x1024@120Hz RB */ {MODEPREFIX, 85500, 1360, 1424, 1536, 1792, 0, 768, 771, 777, 795, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1360x768@60Hz */ {MODEPREFIX, 148250, 1360, 1408, 1440, 1520, 0, 768, 771, 776, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1360x768@120Hz RB */ {MODEPREFIX, 101000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1080, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1400x1050@60Hz RB */ {MODEPREFIX, 121750, 1400, 1488, 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1400x1050@60Hz */ {MODEPREFIX, 156000, 1400, 1504, 1648, 1896, 0, 1050, 1053, 1057, 1099, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1400x1050@75Hz */ {MODEPREFIX, 179500, 1400, 1504, 1656, 1912, 0, 1050, 1053, 1057, 1105, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1400x1050@85Hz */ {MODEPREFIX, 208000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1112, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1400x1050@120Hz RB */ {MODEPREFIX, 88750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 926, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1440x900@60Hz RB */ {MODEPREFIX, 106500, 1440, 1520, 1672, 1904, 0, 900, 903, 909, 934, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1440x900@60Hz */ {MODEPREFIX, 136750, 1440, 1536, 1688, 1936, 0, 900, 903, 909, 942, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1440x900@75Hz */ {MODEPREFIX, 157000, 1440, 1544, 1696, 1952, 0, 900, 903, 909, 948, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1440x900@85Hz */ {MODEPREFIX, 182750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 953, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1440x900@120Hz RB */ {MODEPREFIX, 162000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@60Hz */ {MODEPREFIX, 175500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@65Hz */ {MODEPREFIX, 189000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@70Hz */ {MODEPREFIX, 202500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@75Hz */ {MODEPREFIX, 229500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@85Hz */ {MODEPREFIX, 268250, 1600, 1648, 1680, 1760, 0, 1200, 1203, 1207, 1271, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1600x1200@120Hz RB */ {MODEPREFIX, 119000, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1080, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1680x1050@60Hz RB */ {MODEPREFIX, 146250, 1680, 1784, 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1680x1050@60Hz */ {MODEPREFIX, 187000, 1680, 1800, 1976, 2272, 0, 1050, 1053, 1059, 1099, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1680x1050@75Hz */ {MODEPREFIX, 214750, 1680, 1808, 1984, 2288, 0, 1050, 1053, 1059, 1105, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1680x1050@85Hz */ {MODEPREFIX, 245500, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1112, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1680x1050@120Hz RB */ {MODEPREFIX, 204750, 1792, 1920, 2120, 2448, 0, 1344, 1345, 1348, 1394, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1792x1344@60Hz */ {MODEPREFIX, 261000, 1792, 1888, 2104, 2456, 0, 1344, 1345, 1348, 1417, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1792x1344@75Hz */ {MODEPREFIX, 333250, 1792, 1840, 1872, 1952, 0, 1344, 1347, 1351, 1423, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1792x1344@120Hz RB */ {MODEPREFIX, 218250, 1856, 1952, 2176, 2528, 0, 1392, 1393, 1396, 1439, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1856x1392@60Hz */ {MODEPREFIX, 288000, 1856, 1984, 2208, 2560, 0, 1392, 1393, 1396, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1856x1392@75Hz */ {MODEPREFIX, 356500, 1856, 1904, 1936, 2016, 0, 1392, 1395, 1399, 1474, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1856x1392@120Hz RB */ {MODEPREFIX, 154000, 1920, 1968, 2000, 2080, 0, 1200, 1203, 1209, 1235, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1920x1200@60Hz RB */ {MODEPREFIX, 193250, 1920, 2056, 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1200@60Hz */ {MODEPREFIX, 245250, 1920, 2056, 2264, 2608, 0, 1200, 1203, 1209, 1255, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1200@75Hz */ {MODEPREFIX, 281250, 1920, 2064, 2272, 2624, 0, 1200, 1203, 1209, 1262, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1200@85Hz */ {MODEPREFIX, 317000, 1920, 1968, 2000, 2080, 0, 1200, 1203, 1209, 1271, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1920x1200@120Hz RB */ {MODEPREFIX, 234000, 1920, 2048, 2256, 2600, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1440@60Hz */ {MODEPREFIX, 297000, 1920, 2064, 2288, 2640, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1440@75Hz */ {MODEPREFIX, 380500, 1920, 1968, 2000, 2080, 0, 1440, 1443, 1447, 1525, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1920x1440@120Hz RB */ {MODEPREFIX, 268500, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1646, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 2560x1600@60Hz RB */ {MODEPREFIX, 348500, 2560, 2752, 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 2560x1600@60Hz */ {MODEPREFIX, 443250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1672, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 2560x1600@75Hz */ {MODEPREFIX, 505250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1682, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 2560x1600@85Hz */ {MODEPREFIX, 552750, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1694, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 2560x1600@120Hz RB */ }; #define LEVEL_DMT 0 #define LEVEL_GTF 1 #define LEVEL_CVT 2 static int MonitorStandardTimingLevel(xf86MonPtr DDC) { if (DDC->ver.revision >= 2) { if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) { return LEVEL_CVT; } return LEVEL_GTF; } return LEVEL_DMT; } static int ModeRefresh(const DisplayModeRec * mode) { return (int) (xf86ModeVRefresh(mode) + 0.5); } /* * If rb is not set, then we'll not consider reduced-blanking modes as * part of the DMT pool. For the 'standard' EDID mode descriptor there's * no way to specify whether the mode should be RB or not. */ DisplayModePtr FindDMTMode(int hsize, int vsize, int refresh, Bool rb) { int i; const DisplayModeRec *ret; for (i = 0; i < ARRAY_SIZE(DMTModes); i++) { ret = &DMTModes[i]; if (!rb && xf86ModeIsReduced(ret)) continue; if (ret->HDisplay == hsize && ret->VDisplay == vsize && refresh == ModeRefresh(ret)) return xf86DuplicateMode(ret); } return NULL; } /* * Appendix B of the EDID 1.4 spec defines the right thing to do here. * If the timing given here matches a mode defined in the VESA DMT standard, * we _must_ use that. If the device supports CVT modes, then we should * generate a CVT timing. If both of the above fail, use GTF. * * There are some wrinkles here. EDID 1.1 and 1.0 sinks can't really * "support" GTF, since it wasn't a standard yet; so if they ask for a * timing in this section that isn't defined in DMT, returning a GTF mode * may not actually be valid. EDID 1.3 sinks often report support for * some CVT modes, but they are not required to support CVT timings for * modes in the standard timing descriptor, so we should _not_ treat them * as CVT-compliant (unless specified in an extension block I suppose). * * EDID 1.4 requires that all sink devices support both GTF and CVT timings * for modes in this section, but does say that CVT is preferred. */ static DisplayModePtr DDCModesFromStandardTiming(DisplayModePtr pool, struct std_timings *timing, ddc_quirk_t quirks, int timing_level, Bool rb) { DisplayModePtr Modes = NULL, Mode = NULL; int i, hsize, vsize, refresh; for (i = 0; i < STD_TIMINGS; i++) { DisplayModePtr p = NULL; hsize = timing[i].hsize; vsize = timing[i].vsize; refresh = timing[i].refresh; /* HDTV hack, part one */ if (refresh == 60 && ((hsize == 1360 && vsize == 765) || (hsize == 1368 && vsize == 769))) { hsize = 1366; vsize = 768; } /* If we already have a detailed timing for this size, don't add more */ for (p = pool; p; p = p->next) { if (p->HDisplay == hsize && p->VDisplay == vsize && refresh == round(xf86ModeVRefresh(p))) break; } if (p) continue; /* HDTV hack, because you can't say 1366 */ if (refresh == 60 && hsize == 1366 && vsize == 768) { Mode = xf86CVTMode(1366, 768, 60, FALSE, FALSE); Mode->HDisplay = 1366; Mode->HSyncStart--; Mode->HSyncEnd--; } else if (hsize && vsize && refresh) { Mode = FindDMTMode(hsize, vsize, refresh, rb); if (!Mode) { if (timing_level == LEVEL_CVT) /* pass rb here too? */ Mode = xf86CVTMode(hsize, vsize, refresh, FALSE, FALSE); else if (timing_level == LEVEL_GTF) Mode = xf86GTFMode(hsize, vsize, refresh, FALSE, FALSE); } } if (Mode) { Mode->type = M_T_DRIVER; Modes = xf86ModesAdd(Modes, Mode); } Mode = NULL; } return Modes; } static void DDCModeDoInterlaceQuirks(DisplayModePtr mode) { /* * EDID is delightfully ambiguous about how interlaced modes are to be * encoded. X's internal representation is of frame height, but some * HDTV detailed timings are encoded as field height. * * The format list here is from CEA, in frame size. Technically we * should be checking refresh rate too. Whatever. */ static const struct { int w, h; } cea_interlaced[] = { {1920, 1080}, {720, 480}, {1440, 480}, {2880, 480}, {720, 576}, {1440, 576}, {2880, 576}, }; int i; for (i = 0; i < ARRAY_SIZE(cea_interlaced); i++) { if ((mode->HDisplay == cea_interlaced[i].w) && (mode->VDisplay == cea_interlaced[i].h / 2)) { mode->VDisplay *= 2; mode->VSyncStart *= 2; mode->VSyncEnd *= 2; mode->VTotal *= 2; mode->VTotal |= 1; } } mode->Flags |= V_INTERLACE; } /* * */ static DisplayModePtr DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, Bool preferred, ddc_quirk_t quirks) { DisplayModePtr Mode; /* * Refuse to create modes that are insufficiently large. 64 is a random * number, maybe the spec says something about what the minimum is. In * particular I see this frequently with _old_ EDID, 1.0 or so, so maybe * our parser is just being too aggresive there. */ if (timing->h_active < 64 || timing->v_active < 64) { xf86DrvMsg(scrnIndex, X_INFO, "%s: Ignoring tiny %dx%d mode\n", __func__, timing->h_active, timing->v_active); return NULL; } /* We don't do stereo */ if (timing->stereo) { xf86DrvMsg(scrnIndex, X_INFO, "%s: Ignoring: We don't handle stereo.\n", __func__); return NULL; } /* We only do seperate sync currently */ if (timing->sync != 0x03) { xf86DrvMsg(scrnIndex, X_INFO, "%s: %dx%d Warning: We only handle separate" " sync.\n", __func__, timing->h_active, timing->v_active); } Mode = xnfcalloc(1, sizeof(DisplayModeRec)); Mode->type = M_T_DRIVER; if (preferred) Mode->type |= M_T_PREFERRED; if ((quirks & DDC_QUIRK_135_CLOCK_TOO_HIGH) && timing->clock == 135000000) Mode->Clock = 108880; else Mode->Clock = timing->clock / 1000.0; Mode->HDisplay = timing->h_active; Mode->HSyncStart = timing->h_active + timing->h_sync_off; Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width; Mode->HTotal = timing->h_active + timing->h_blanking; Mode->VDisplay = timing->v_active; Mode->VSyncStart = timing->v_active + timing->v_sync_off; Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width; Mode->VTotal = timing->v_active + timing->v_blanking; /* perform basic check on the detail timing */ if (Mode->HSyncEnd > Mode->HTotal || Mode->VSyncEnd > Mode->VTotal) { free(Mode); return NULL; } /* We ignore h/v_size and h/v_border for now. */ if (timing->interlaced) DDCModeDoInterlaceQuirks(Mode); if (quirks & DDC_QUIRK_DETAILED_SYNC_PP) Mode->Flags |= V_PVSYNC | V_PHSYNC; else { if (timing->misc & 0x02) Mode->Flags |= V_PVSYNC; else Mode->Flags |= V_NVSYNC; if (timing->misc & 0x01) Mode->Flags |= V_PHSYNC; else Mode->Flags |= V_NHSYNC; } xf86SetModeDefaultName(Mode); return Mode; } static DisplayModePtr DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) { DisplayModePtr modes = NULL; int i; for (i = 0; i < 4; i++) { if (t[i].height) { if (t[i].rates & 0x10) modes = xf86ModesAdd(modes, xf86CVTMode(t[i].width, t[i].height, 50, 0, 0)); if (t[i].rates & 0x08) modes = xf86ModesAdd(modes, xf86CVTMode(t[i].width, t[i].height, 60, 0, 0)); if (t[i].rates & 0x04) modes = xf86ModesAdd(modes, xf86CVTMode(t[i].width, t[i].height, 75, 0, 0)); if (t[i].rates & 0x02) modes = xf86ModesAdd(modes, xf86CVTMode(t[i].width, t[i].height, 85, 0, 0)); if (t[i].rates & 0x01) modes = xf86ModesAdd(modes, xf86CVTMode(t[i].width, t[i].height, 60, 1, 0)); } else break; } return modes; } static const struct { short w; short h; short r; short rb; } EstIIIModes[] = { /* byte 6 */ {640, 350, 85, 0}, {640, 400, 85, 0}, {720, 400, 85, 0}, {640, 480, 85, 0}, {848, 480, 60, 0}, {800, 600, 85, 0}, {1024, 768, 85, 0}, {1152, 864, 75, 0}, /* byte 7 */ {1280, 768, 60, 1}, {1280, 768, 60, 0}, {1280, 768, 75, 0}, {1280, 768, 85, 0}, {1280, 960, 60, 0}, {1280, 960, 85, 0}, {1280, 1024, 60, 0}, {1280, 1024, 85, 0}, /* byte 8 */ {1360, 768, 60, 0}, {1440, 900, 60, 1}, {1440, 900, 60, 0}, {1440, 900, 75, 0}, {1440, 900, 85, 0}, {1400, 1050, 60, 1}, {1400, 1050, 60, 0}, {1400, 1050, 75, 0}, /* byte 9 */ {1400, 1050, 85, 0}, {1680, 1050, 60, 1}, {1680, 1050, 60, 0}, {1680, 1050, 75, 0}, {1680, 1050, 85, 0}, {1600, 1200, 60, 0}, {1600, 1200, 65, 0}, {1600, 1200, 70, 0}, /* byte 10 */ {1600, 1200, 75, 0}, {1600, 1200, 85, 0}, {1792, 1344, 60, 0}, {1792, 1344, 75, 0}, {1856, 1392, 60, 0}, {1856, 1392, 75, 0}, {1920, 1200, 60, 1}, {1920, 1200, 60, 0}, /* byte 11 */ {1920, 1200, 75, 0}, {1920, 1200, 85, 0}, {1920, 1440, 60, 0}, {1920, 1440, 75, 0}, /* fill up last byte */ {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, }; static DisplayModePtr DDCModesFromEstIII(unsigned char *est) { DisplayModePtr modes = NULL; int i, j, m; for (i = 0; i < 6; i++) { for (j = 7; j >= 0; j--) { if (est[i] & (1 << j)) { m = (i * 8) + (7 - j); if (EstIIIModes[m].w) modes = xf86ModesAdd(modes, FindDMTMode(EstIIIModes[m].w, EstIIIModes[m].h, EstIIIModes[m].r, EstIIIModes[m].rb)); } } } return modes; } /* * This is only valid when the sink claims to be continuous-frequency * but does not supply a detailed range descriptor. Such sinks are * arguably broken. Currently the mode validation code isn't aware of * this; the non-RANDR code even punts the decision of optional sync * range checking to the driver. Loss. */ static void DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes) { DisplayModePtr Mode = Modes; if (!Monitor || !Modes) return; /* set up the ranges for scanning through the modes */ Monitor->nHsync = 1; Monitor->hsync[0].lo = 1024.0; Monitor->hsync[0].hi = 0.0; Monitor->nVrefresh = 1; Monitor->vrefresh[0].lo = 1024.0; Monitor->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 < Monitor->hsync[0].lo) Monitor->hsync[0].lo = Mode->HSync; if (Mode->HSync > Monitor->hsync[0].hi) Monitor->hsync[0].hi = Mode->HSync; if (Mode->VRefresh < Monitor->vrefresh[0].lo) Monitor->vrefresh[0].lo = Mode->VRefresh; if (Mode->VRefresh > Monitor->vrefresh[0].hi) Monitor->vrefresh[0].hi = Mode->VRefresh; Mode = Mode->next; } } ddc_quirk_t xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose) { ddc_quirk_t quirks; int i; quirks = DDC_QUIRK_NONE; for (i = 0; ddc_quirks[i].detect; i++) { if (ddc_quirks[i].detect(scrnIndex, DDC)) { if (verbose) { xf86DrvMsg(scrnIndex, X_INFO, " EDID quirk: %s\n", ddc_quirks[i].description); } quirks |= ddc_quirks[i].quirk; } } return quirks; } void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon, ddc_quirk_t quirks, int hsize, int vsize) { if (det_mon->type != DT) return; if (quirks & DDC_QUIRK_DETAILED_H_IN_CM) det_mon->section.d_timings.h_size *= 10; if (quirks & DDC_QUIRK_DETAILED_V_IN_CM) det_mon->section.d_timings.v_size *= 10; if (quirks & DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE) { det_mon->section.d_timings.h_size = 10 * hsize; det_mon->section.d_timings.v_size = 10 * vsize; } } /** * Applies monitor-specific quirks to the decoded EDID information. * * Note that some quirks applying to the mode list are still implemented in * xf86DDCGetModes. */ void xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC) { ddc_quirk_t quirks = xf86DDCDetectQuirks(scrnIndex, DDC, FALSE); int i; for (i = 0; i < DET_TIMINGS; i++) { xf86DetTimingApplyQuirks(DDC->det_mon + i, quirks, DDC->features.hsize, DDC->features.vsize); } } /** * Walks the modes list, finding the mode with the largest area which is * closest to the target refresh rate, and marks it as the only preferred mode. */ static void xf86DDCSetPreferredRefresh(int scrnIndex, DisplayModePtr modes, float target_refresh) { DisplayModePtr mode, best = modes; for (mode = modes; mode; mode = mode->next) { mode->type &= ~M_T_PREFERRED; if (mode == best) continue; if (mode->HDisplay * mode->VDisplay > best->HDisplay * best->VDisplay) { best = mode; continue; } if (mode->HDisplay * mode->VDisplay == best->HDisplay * best->VDisplay) { double mode_refresh = xf86ModeVRefresh(mode); double best_refresh = xf86ModeVRefresh(best); double mode_dist = fabs(mode_refresh - target_refresh); double best_dist = fabs(best_refresh - target_refresh); if (mode_dist < best_dist) { best = mode; continue; } } } if (best) best->type |= M_T_PREFERRED; } #define CEA_VIDEO_MODES_NUM 64 static const DisplayModeRec CEAVideoModes[CEA_VIDEO_MODES_NUM] = { {MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 1:640x480@60Hz */ {MODEPREFIX, 27000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 2:720x480@60Hz */ {MODEPREFIX, 27000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 3:720x480@60Hz */ {MODEPREFIX, 74250, 1280, 1390, 1430, 1650, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 4: 1280x720@60Hz */ {MODEPREFIX, 74250, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 5:1920x1080i@60Hz */ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 6:1440x480i@60Hz */ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 7:1440x480i@60Hz */ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 8:1440x240@60Hz */ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 9:1440x240@60Hz */ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 10:2880x480i@60Hz */ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 11:2880x480i@60Hz */ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 12:2880x240@60Hz */ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 13:2880x240@60Hz */ {MODEPREFIX, 54000, 1440, 1472, 1596, 1716, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 14:1440x480@60Hz */ {MODEPREFIX, 54000, 1440, 1472, 1596, 1716, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 15:1440x480@60Hz */ {MODEPREFIX, 148500, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 16:1920x1080@60Hz */ {MODEPREFIX, 27000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 17:720x576@50Hz */ {MODEPREFIX, 27000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 18:720x576@50Hz */ {MODEPREFIX, 74250, 1280, 1720, 1760, 1980, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 19: 1280x720@50Hz */ {MODEPREFIX, 74250, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 20:1920x1080i@50Hz */ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 21:1440x576i@50Hz */ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 22:1440x576i@50Hz */ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 23:1440x288@50Hz */ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 24:1440x288@50Hz */ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 25:2880x576i@50Hz */ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 26:2880x576i@50Hz */ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 27:2880x288@50Hz */ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 28:2880x288@50Hz */ {MODEPREFIX, 54000, 1440, 1464, 1592, 1728, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 29:1440x576@50Hz */ {MODEPREFIX, 54000, 1440, 1464, 1592, 1728, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 30:1440x576@50Hz */ {MODEPREFIX, 148500, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 31:1920x1080@50Hz */ {MODEPREFIX, 74250, 1920, 2558, 2602, 2750, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 32:1920x1080@24Hz */ {MODEPREFIX, 74250, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 33:1920x1080@25Hz */ {MODEPREFIX, 74250, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 34:1920x1080@30Hz */ {MODEPREFIX, 108000, 2880, 2944, 3192, 3432, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 35:2880x480@60Hz */ {MODEPREFIX, 108000, 2880, 2944, 3192, 3432, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 36:2880x480@60Hz */ {MODEPREFIX, 108000, 2880, 2928, 3184, 3456, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 37:2880x576@50Hz */ {MODEPREFIX, 108000, 2880, 2928, 3184, 3456, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 38:2880x576@50Hz */ {MODEPREFIX, 72000, 1920, 1952, 2120, 2304, 0, 1080, 1126, 1136, 1250, 0, V_PHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 39:1920x1080i@50Hz */ {MODEPREFIX, 148500, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 40:1920x1080i@100Hz */ {MODEPREFIX, 148500, 1280, 1720, 1760, 1980, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 41:1280x720@100Hz */ {MODEPREFIX, 54000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 42:720x576@100Hz */ {MODEPREFIX, 54000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 43:720x576@100Hz */ {MODEPREFIX, 54000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 44:1440x576i@100Hz */ {MODEPREFIX, 54000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 45:1440x576i@100Hz */ {MODEPREFIX, 148500, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 46:1920x1080i@120Hz */ {MODEPREFIX, 148500, 1280, 1390, 1430, 1650, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 47:1280x720@120Hz */ {MODEPREFIX, 54000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 48:720x480@120Hz */ {MODEPREFIX, 54000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 49:720x480@120Hz */ {MODEPREFIX, 54000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 50:1440x480i@120Hz */ {MODEPREFIX, 54000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 51:1440x480i@120Hz */ {MODEPREFIX, 108000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 52:720x576@200Hz */ {MODEPREFIX, 108000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 53:720x576@200Hz */ {MODEPREFIX, 108000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 54:1440x576i@200Hz */ {MODEPREFIX, 108000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 55:1440x576i@200Hz */ {MODEPREFIX, 108000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 56:720x480@240Hz */ {MODEPREFIX, 108000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 57:720x480@240Hz */ {MODEPREFIX, 108000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 58:1440x480i@240 */ {MODEPREFIX, 108000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 59:1440x480i@240 */ {MODEPREFIX, 59400, 1280, 3040, 3080, 3300, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 60: 1280x720@24Hz */ {MODEPREFIX, 74250, 1280, 3700, 3740, 3960, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 61: 1280x720@25Hz */ {MODEPREFIX, 74250, 1280, 3040, 3080, 3300, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 62: 1280x720@30Hz */ {MODEPREFIX, 297000, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 63: 1920x1080@120Hz */ {MODEPREFIX, 297000, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 64:1920x1080@100Hz */ }; /* chose mode line by cea short video descriptor*/ static void handle_cea_svd(struct cea_video_block *video, void *data) { DisplayModePtr Mode; DisplayModePtr *Modes = (DisplayModePtr *) data; int vid; vid = video->video_code & 0x7f; if (vid >= 1 && vid <= CEA_VIDEO_MODES_NUM) { Mode = xf86DuplicateMode(CEAVideoModes + (vid - 1)); *Modes = xf86ModesAdd(*Modes, Mode); } } static DisplayModePtr DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr mon_ptr) { DisplayModePtr Modes = NULL; xf86ForEachVideoBlock(mon_ptr, handle_cea_svd, &Modes); return Modes; } struct det_modes_parameter { xf86MonPtr DDC; ddc_quirk_t quirks; DisplayModePtr Modes; Bool rb; Bool preferred; int timing_level; }; static void handle_detailed_modes(struct detailed_monitor_section *det_mon, void *data) { DisplayModePtr Mode; struct det_modes_parameter *p = (struct det_modes_parameter *) data; xf86DetTimingApplyQuirks(det_mon, p->quirks, p->DDC->features.hsize, p->DDC->features.vsize); switch (det_mon->type) { case DT: Mode = DDCModeFromDetailedTiming(p->DDC->scrnIndex, &det_mon->section.d_timings, p->preferred, p->quirks); p->preferred = FALSE; p->Modes = xf86ModesAdd(p->Modes, Mode); break; case DS_STD_TIMINGS: Mode = DDCModesFromStandardTiming(p->Modes, det_mon->section.std_t, p->quirks, p->timing_level, p->rb); p->Modes = xf86ModesAdd(p->Modes, Mode); break; case DS_CVT: Mode = DDCModesFromCVT(p->DDC->scrnIndex, det_mon->section.cvt); p->Modes = xf86ModesAdd(p->Modes, Mode); break; case DS_EST_III: Mode = DDCModesFromEstIII(det_mon->section.est_iii); p->Modes = xf86ModesAdd(p->Modes, Mode); break; default: break; } } DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) { DisplayModePtr Modes = NULL, Mode; ddc_quirk_t quirks; Bool preferred, rb; int timing_level; struct det_modes_parameter p; xf86DrvMsg(scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n", DDC->vendor.name, DDC->vendor.prod_id); quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE); preferred = PREFERRED_TIMING_MODE(DDC->features.msc); if (DDC->ver.revision >= 4) preferred = TRUE; if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED) preferred = TRUE; if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75)) preferred = FALSE; rb = xf86MonitorSupportsReducedBlanking(DDC); timing_level = MonitorStandardTimingLevel(DDC); p.quirks = quirks; p.DDC = DDC; p.Modes = Modes; p.rb = rb; p.preferred = preferred; p.timing_level = timing_level; xf86ForEachDetailedBlock(DDC, handle_detailed_modes, &p); Modes = p.Modes; /* Add cea-extension mode timings */ Mode = DDCModesFromCEAExtension(scrnIndex, DDC); Modes = xf86ModesAdd(Modes, Mode); /* Add established timings */ Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1, quirks); Modes = xf86ModesAdd(Modes, Mode); /* Add standard timings */ Mode = DDCModesFromStandardTiming(Modes, DDC->timings2, quirks, timing_level, rb); Modes = xf86ModesAdd(Modes, Mode); if (quirks & DDC_QUIRK_PREFER_LARGE_60) xf86DDCSetPreferredRefresh(scrnIndex, Modes, 60); if (quirks & DDC_QUIRK_PREFER_LARGE_75) xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75); Modes = xf86PruneDuplicateModes(Modes); return Modes; } struct det_mon_parameter { MonPtr Monitor; ddc_quirk_t quirks; Bool have_hsync; Bool have_vrefresh; Bool have_maxpixclock; }; static void handle_detailed_monset(struct detailed_monitor_section *det_mon, void *data) { int clock; struct det_mon_parameter *p = (struct det_mon_parameter *) data; int scrnIndex = ((xf86MonPtr) (p->Monitor->DDC))->scrnIndex; switch (det_mon->type) { case DS_RANGES: if (!p->have_hsync) { if (!p->Monitor->nHsync) xf86DrvMsg(scrnIndex, X_INFO, "Using EDID range info for horizontal sync\n"); p->Monitor->hsync[p->Monitor->nHsync].lo = det_mon->section.ranges.min_h; p->Monitor->hsync[p->Monitor->nHsync].hi = det_mon->section.ranges.max_h; p->Monitor->nHsync++; } else { xf86DrvMsg(scrnIndex, X_INFO, "Using hsync ranges from config file\n"); } if (!p->have_vrefresh) { if (!p->Monitor->nVrefresh) xf86DrvMsg(scrnIndex, X_INFO, "Using EDID range info for vertical refresh\n"); p->Monitor->vrefresh[p->Monitor->nVrefresh].lo = det_mon->section.ranges.min_v; p->Monitor->vrefresh[p->Monitor->nVrefresh].hi = det_mon->section.ranges.max_v; p->Monitor->nVrefresh++; } else { xf86DrvMsg(scrnIndex, X_INFO, "Using vrefresh ranges from config file\n"); } clock = det_mon->section.ranges.max_clock * 1000; if (p->quirks & DDC_QUIRK_DVI_SINGLE_LINK) clock = min(clock, 165000); if (!p->have_maxpixclock && clock > p->Monitor->maxPixClock) p->Monitor->maxPixClock = clock; break; default: break; } } /* * Fill out MonPtr with xf86MonPtr information. */ void xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC) { DisplayModePtr Modes = NULL, Mode; struct det_mon_parameter p; if (!Monitor || !DDC) return; Monitor->DDC = DDC; if (Monitor->widthmm <= 0 || Monitor->heightmm <= 0) { Monitor->widthmm = 10 * DDC->features.hsize; Monitor->heightmm = 10 * DDC->features.vsize; } Monitor->reducedblanking = xf86MonitorSupportsReducedBlanking(DDC); Modes = xf86DDCGetModes(scrnIndex, DDC); /* Go through the detailed monitor sections */ p.Monitor = Monitor; p.quirks = xf86DDCDetectQuirks(scrnIndex, Monitor->DDC, FALSE); p.have_hsync = (Monitor->nHsync != 0); p.have_vrefresh = (Monitor->nVrefresh != 0); p.have_maxpixclock = (Monitor->maxPixClock != 0); xf86ForEachDetailedBlock(DDC, handle_detailed_monset, &p); if (Modes) { /* Print Modes */ xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n"); Mode = Modes; while (Mode) { xf86PrintModeline(scrnIndex, Mode); Mode = Mode->next; } /* Do we still need ranges to be filled in? */ if (!Monitor->nHsync || !Monitor->nVrefresh) DDCGuessRangesFromModes(scrnIndex, Monitor, Modes); /* add to MonPtr */ if (Monitor->Modes) { Monitor->Last->next = Modes; Modes->prev = Monitor->Last; } else { Monitor->Modes = Modes; } Monitor->Modes = xf86PruneDuplicateModes(Monitor->Modes); /* Update pointer to last mode */ for (Mode = Monitor->Modes; Mode && Mode->next; Mode = Mode->next) {} Monitor->Last = Mode; } } xorg-server-1.20.8/hw/xfree86/modes/Makefile.in0000644000175000017500000007453613640201513016101 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/modes ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libxf86modes_la_LIBADD = am__libxf86modes_la_SOURCES_DIST = xf86Crtc.c xf86Crtc.h xf86Cursors.c \ xf86cvt.c xf86gtf.c xf86EdidModes.c xf86Modes.c xf86Modes.h \ xf86RandR12.c xf86RandR12.h xf86Rotate.c xf86DiDGA.c @DGA_TRUE@am__objects_1 = xf86DiDGA.lo am_libxf86modes_la_OBJECTS = xf86Crtc.lo xf86Cursors.lo xf86cvt.lo \ xf86gtf.lo xf86EdidModes.lo xf86Modes.lo xf86RandR12.lo \ xf86Rotate.lo $(am__objects_1) libxf86modes_la_OBJECTS = $(am_libxf86modes_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/xf86Crtc.Plo \ ./$(DEPDIR)/xf86Cursors.Plo ./$(DEPDIR)/xf86DiDGA.Plo \ ./$(DEPDIR)/xf86EdidModes.Plo ./$(DEPDIR)/xf86Modes.Plo \ ./$(DEPDIR)/xf86RandR12.Plo ./$(DEPDIR)/xf86Rotate.Plo \ ./$(DEPDIR)/xf86cvt.Plo ./$(DEPDIR)/xf86gtf.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libxf86modes_la_SOURCES) DIST_SOURCES = $(am__libxf86modes_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libxf86modes.la @DGA_TRUE@DGA_SRCS = xf86DiDGA.c libxf86modes_la_SOURCES = \ xf86Crtc.c \ xf86Crtc.h \ xf86Cursors.c \ xf86cvt.c \ xf86gtf.c \ xf86EdidModes.c \ xf86Modes.c \ xf86Modes.h \ xf86RandR12.c \ xf86RandR12.h \ xf86Rotate.c \ $(DGA_SRCS) AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \ -I$(srcdir)/../dixmods/extmod sdk_HEADERS = \ xf86Crtc.h \ xf86Modes.h \ xf86RandR12.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/modes/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/modes/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libxf86modes.la: $(libxf86modes_la_OBJECTS) $(libxf86modes_la_DEPENDENCIES) $(EXTRA_libxf86modes_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libxf86modes_la_OBJECTS) $(libxf86modes_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Crtc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursors.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DiDGA.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86EdidModes.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Modes.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR12.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Rotate.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cvt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86gtf.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/xf86Crtc.Plo -rm -f ./$(DEPDIR)/xf86Cursors.Plo -rm -f ./$(DEPDIR)/xf86DiDGA.Plo -rm -f ./$(DEPDIR)/xf86EdidModes.Plo -rm -f ./$(DEPDIR)/xf86Modes.Plo -rm -f ./$(DEPDIR)/xf86RandR12.Plo -rm -f ./$(DEPDIR)/xf86Rotate.Plo -rm -f ./$(DEPDIR)/xf86cvt.Plo -rm -f ./$(DEPDIR)/xf86gtf.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/xf86Crtc.Plo -rm -f ./$(DEPDIR)/xf86Cursors.Plo -rm -f ./$(DEPDIR)/xf86DiDGA.Plo -rm -f ./$(DEPDIR)/xf86EdidModes.Plo -rm -f ./$(DEPDIR)/xf86Modes.Plo -rm -f ./$(DEPDIR)/xf86RandR12.Plo -rm -f ./$(DEPDIR)/xf86Rotate.Plo -rm -f ./$(DEPDIR)/xf86cvt.Plo -rm -f ./$(DEPDIR)/xf86gtf.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/modes/xf86gtf.c0000644000175000017500000003173313640201473015471 00000000000000/* * gtf.c Generate mode timings using the GTF Timing Standard * * gcc gtf.c -o gtf -lm -Wall * * Copyright (c) 2001, Andy Ritger aritger@nvidia.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * o Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * o Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * o Neither the name of NVIDIA nor the names of its contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * This program is based on the Generalized Timing Formula(GTF TM) * Standard Version: 1.0, Revision: 1.0 * * The GTF Document contains the following Copyright information: * * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards * Association. Duplication of this document within VESA member * companies for review purposes is permitted. All other rights * reserved. * * While every precaution has been taken in the preparation * of this standard, the Video Electronics Standards Association and * its contributors assume no responsibility for errors or omissions, * and make no warranties, expressed or implied, of functionality * of suitability for any purpose. The sample code contained within * this standard may be used without restriction. * * * * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive) * implementation of the GTF Timing Standard, is available at: * * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls */ /* Ruthlessly converted to server code by Adam Jackson */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86Modes.h" #include #define MARGIN_PERCENT 1.8 /* % of active vertical image */ #define CELL_GRAN 8.0 /* assumed character cell granularity */ #define MIN_PORCH 1 /* minimum front porch */ #define V_SYNC_RQD 3 /* width of vsync in lines */ #define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */ #define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */ #define M 600.0 /* blanking formula gradient */ #define C 40.0 /* blanking formula offset */ #define K 128.0 /* blanking formula scaling factor */ #define J 20.0 /* blanking formula scaling factor */ /* C' and M' are part of the Blanking Duty Cycle computation */ #define C_PRIME (((C - J) * K/256.0) + J) #define M_PRIME (K/256.0 * M) /* * xf86GTFMode() - as defined by the GTF Timing Standard, compute the * Stage 1 Parameters using the vertical refresh frequency. In other * words: input a desired resolution and desired refresh rate, and * output the GTF mode timings. * * XXX All the code is in place to compute interlaced modes, but I don't * feel like testing it right now. * * XXX margin computations are implemented but not tested (nor used by * XServer of fbset mode descriptions, from what I can tell). */ DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins) { DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec)); float h_pixels_rnd; float v_lines_rnd; float v_field_rate_rqd; float top_margin; float bottom_margin; float interlace; float h_period_est; float vsync_plus_bp; float v_back_porch; float total_v_lines; float v_field_rate_est; float h_period; float v_field_rate; float v_frame_rate; float left_margin; float right_margin; float total_active_pixels; float ideal_duty_cycle; float h_blank; float total_pixels; float pixel_freq; float h_freq; float h_sync; float h_front_porch; float v_odd_front_porch_lines; /* 1. In order to give correct results, the number of horizontal * pixels requested is first processed to ensure that it is divisible * by the character size, by rounding it to the nearest character * cell boundary: * * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND]) */ h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN; /* 2. If interlace is requested, the number of vertical lines assumed * by the calculation must be halved, as the computation calculates * the number of vertical lines per field. In either case, the * number of lines is rounded to the nearest integer. * * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0), * ROUND([V LINES],0)) */ v_lines_rnd = interlaced ? rint((float) v_lines) / 2.0 : rint((float) v_lines); /* 3. Find the frame rate required: * * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2, * [I/P FREQ RQD]) */ v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq); /* 4. Find number of lines in Top margin: * * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y", * ROUND(([MARGIN%]/100*[V LINES RND]),0), * 0) */ top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0); /* 5. Find number of lines in Bottom margin: * * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y", * ROUND(([MARGIN%]/100*[V LINES RND]),0), * 0) */ bottom_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0); /* 6. If interlace is required, then set variable [INTERLACE]=0.5: * * [INTERLACE]=(IF([INT RQD?]="y",0.5,0)) */ interlace = interlaced ? 0.5 : 0.0; /* 7. Estimate the Horizontal period * * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) / * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) + * [MIN PORCH RND]+[INTERLACE]) * 1000000 */ h_period_est = (((1.0 / v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP / 1000000.0)) / (v_lines_rnd + (2 * top_margin) + MIN_PORCH + interlace) * 1000000.0); /* 8. Find the number of lines in V sync + back porch: * * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0) */ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP / h_period_est); /* 9. Find the number of lines in V back porch alone: * * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND] * * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]? */ v_back_porch = vsync_plus_bp - V_SYNC_RQD; (void) v_back_porch; /* 10. Find the total number of lines in Vertical field period: * * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] + * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] + * [MIN PORCH RND] */ total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp + interlace + MIN_PORCH; /* 11. Estimate the Vertical field frequency: * * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000 */ v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0; /* 12. Find the actual horizontal period: * * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST]) */ h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est); /* 13. Find the actual Vertical field frequency: * * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000 */ v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0; /* 14. Find the Vertical frame frequency: * * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE])) */ v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate; (void) v_frame_rate; /* 15. Find number of pixels in left margin: * * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / * [CELL GRAN RND]),0)) * [CELL GRAN RND], * 0)) */ left_margin = margins ? rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : 0.0; /* 16. Find number of pixels in right margin: * * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / * [CELL GRAN RND]),0)) * [CELL GRAN RND], * 0)) */ right_margin = margins ? rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : 0.0; /* 17. Find total number of active pixels in image and left and right * margins: * * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] + * [RIGHT MARGIN (PIXELS)] */ total_active_pixels = h_pixels_rnd + left_margin + right_margin; /* 18. Find the ideal blanking duty cycle from the blanking duty cycle * equation: * * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000) */ ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0); /* 19. Find the number of pixels in the blanking time to the nearest * double character cell: * * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] * * [IDEAL DUTY CYCLE] / * (100-[IDEAL DUTY CYCLE]) / * (2*[CELL GRAN RND])), 0)) * * (2*[CELL GRAN RND]) */ h_blank = rint(total_active_pixels * ideal_duty_cycle / (100.0 - ideal_duty_cycle) / (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN); /* 20. Find total number of pixels: * * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)] */ total_pixels = total_active_pixels + h_blank; /* 21. Find pixel clock frequency: * * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD] */ pixel_freq = total_pixels / h_period; /* 22. Find horizontal frequency: * * [H FREQ] = 1000 / [H PERIOD] */ h_freq = 1000.0 / h_period; /* Stage 1 computations are now complete; I should really pass the results to another function and do the Stage 2 computations, but I only need a few more values so I'll just append the computations here for now */ /* 17. Find the number of pixels in the horizontal sync period: * * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] / * [CELL GRAN RND]),0))*[CELL GRAN RND] */ h_sync = rint(H_SYNC_PERCENT / 100.0 * total_pixels / CELL_GRAN) * CELL_GRAN; /* 18. Find the number of pixels in the horizontal front porch period: * * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)] */ h_front_porch = (h_blank / 2.0) - h_sync; /* 36. Find the number of lines in the odd front porch period: * * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE]) */ v_odd_front_porch_lines = MIN_PORCH + interlace; /* finally, pack the results in the mode struct */ mode->HDisplay = (int) (h_pixels_rnd); mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch); mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync); mode->HTotal = (int) (total_pixels); mode->VDisplay = (int) (v_lines_rnd); mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines); mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD); mode->VTotal = (int) (total_v_lines); mode->Clock = (int) (pixel_freq * 1000.0); mode->HSync = h_freq; mode->VRefresh = freq; xf86SetModeDefaultName(mode); mode->Flags = V_NHSYNC | V_PVSYNC; if (interlaced) { mode->VTotal *= 2; mode->Flags |= V_INTERLACE; } return mode; } xorg-server-1.20.8/hw/xfree86/modes/xf86RandR12.c0000644000175000017500000022144413640201473016062 00000000000000/* * 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 #endif #include "xf86.h" #include "os.h" #include "globals.h" #include "xf86Modes.h" #include "xf86Priv.h" #include "xf86DDC.h" #include "mipointer.h" #include "windowstr.h" #include "inputstr.h" #include #include #include "xf86cmap.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 */ /* Compatibility with colormaps and XF86VidMode's gamma */ int palette_red_size; int palette_green_size; int palette_blue_size; int palette_size; LOCO *palette; /* 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; Bool panning; ConstrainCursorHarderProcPtr orig_ConstrainCursorHarder; } 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 = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; 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; } 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 = xf86ScreenToScrn(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) (scrp, 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) (scrp, TRUE); return ret; } Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int pos[MAXDEVICES][2]; Bool useVirtual = FALSE; int maxX = 0, maxY = 0; Rotation oldRotation = randrp->rotation; DeviceIntPtr dev; Bool view_adjusted = FALSE; randrp->rotation = rotation; if (randrp->virtualX == -1 || randrp->virtualY == -1) { randrp->virtualX = scrp->virtualX; randrp->virtualY = scrp->virtualY; } for (dev = inputInfo.devices; dev; dev = dev->next) { if (!IsMaster(dev) && !IsFloating(dev)) continue; miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]); } 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 * FIXME: duplicated code, see modes/xf86RandR12.c */ for (dev = inputInfo.devices; dev; dev = dev->next) { if (!IsMaster(dev) && !IsFloating(dev)) continue; if (pScreen == miPointerGetScreen(dev)) { int px = pos[dev->id][0]; int py = pos[dev->id][1]; px = (px >= pScreen->width ? (pScreen->width - 1) : px); py = (py >= pScreen->height ? (pScreen->height - 1) : py); /* Setting the viewpoint makes only sense on one device */ if (!view_adjusted && IsMaster(dev)) { xf86SetViewport(pScreen, px, py); view_adjusted = TRUE; } (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE); } } return TRUE; } #define PANNING_ENABLED(crtc) \ ((crtc)->panningTotalArea.x2 > (crtc)->panningTotalArea.x1 || \ (crtc)->panningTotalArea.y2 > (crtc)->panningTotalArea.y1) static Bool xf86RandR12ScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); WindowPtr pRoot = pScreen->root; PixmapPtr pScrnPix; Bool ret = FALSE; int c; if (randrp->virtualX == -1 || randrp->virtualY == -1) { randrp->virtualX = pScrn->virtualX; randrp->virtualY = pScrn->virtualY; } if (pRoot && pScrn->vtSema) (*pScrn->EnableDisableFBAccess) (pScrn, 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 (PANNING_ENABLED (crtc)) { 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: update_desktop_dimensions(); if (pRoot && pScrn->vtSema) (*pScrn->EnableDisableFBAccess) (pScrn, TRUE); #if RANDR_12_INTERFACE if (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 = xf86ScreenToScrn(pScreen); 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 (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; randrp->palette_size = 0; randrp->palette = NULL; 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 xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT; pScreen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder; #endif free(randrp->palette); free(randrp); } void xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations) { XF86RandRInfoPtr randrp; #if RANDR_12_INTERFACE ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 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) { #if RANDR_13_INTERFACE ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int c; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif if (xf86RandR12Key == NULL) return; #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 = xf86ScrnToScreen(pScrn); 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 = xf86ScreenToScrn(pScreen); 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 = xallocarray(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 = xf86ScreenToScrn(pScreen); 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 = xallocarray(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; if (crtc->current_scanout != randr_crtc->scanout_pixmap || crtc->current_scanout_back != randr_crtc->scanout_pixmap_back) changed = TRUE; transform = RRCrtcGetTransform(randr_crtc); if ((transform != NULL) != crtc->transformPresent) changed = TRUE; else if (transform && !RRTransformEqual(transform, &crtc->transform)) 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; 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); randrp->panning = PANNING_ENABLED (crtc); /* * Save the last successful setting for EnterVT */ xf86SaveModeContents(&crtc->desiredMode, &mode); crtc->desiredRotation = rotation; crtc->current_scanout = randr_crtc->scanout_pixmap; crtc->current_scanout_back = randr_crtc->scanout_pixmap_back; 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 void xf86RandR12CrtcComputeGamma(xf86CrtcPtr crtc, LOCO *palette, int palette_red_size, int palette_green_size, int palette_blue_size, CARD16 *gamma_red, CARD16 *gamma_green, CARD16 *gamma_blue, int gamma_size) { int gamma_slots; unsigned shift; CARD32 value; int i, j; for (shift = 0; (gamma_size << shift) < (1 << 16); shift++); if (crtc->gamma_size >= palette_red_size) { /* Upsampling of smaller palette to larger hw lut size */ gamma_slots = crtc->gamma_size / palette_red_size; for (i = 0; i < palette_red_size; i++) { value = palette[i].red; if (gamma_red) value = gamma_red[value]; else value <<= shift; for (j = 0; j < gamma_slots; j++) crtc->gamma_red[i * gamma_slots + j] = value; } } else { /* Downsampling of larger palette to smaller hw lut size */ for (i = 0; i < crtc->gamma_size; i++) { value = palette[i * (palette_red_size - 1) / (crtc->gamma_size - 1)].red; if (gamma_red) value = gamma_red[value]; else value <<= shift; crtc->gamma_red[i] = value; } } if (crtc->gamma_size >= palette_green_size) { /* Upsampling of smaller palette to larger hw lut size */ gamma_slots = crtc->gamma_size / palette_green_size; for (i = 0; i < palette_green_size; i++) { value = palette[i].green; if (gamma_green) value = gamma_green[value]; else value <<= shift; for (j = 0; j < gamma_slots; j++) crtc->gamma_green[i * gamma_slots + j] = value; } } else { /* Downsampling of larger palette to smaller hw lut size */ for (i = 0; i < crtc->gamma_size; i++) { value = palette[i * (palette_green_size - 1) / (crtc->gamma_size - 1)].green; if (gamma_green) value = gamma_green[value]; else value <<= shift; crtc->gamma_green[i] = value; } } if (crtc->gamma_size >= palette_blue_size) { /* Upsampling of smaller palette to larger hw lut size */ gamma_slots = crtc->gamma_size / palette_blue_size; for (i = 0; i < palette_blue_size; i++) { value = palette[i].blue; if (gamma_blue) value = gamma_blue[value]; else value <<= shift; for (j = 0; j < gamma_slots; j++) crtc->gamma_blue[i * gamma_slots + j] = value; } } else { /* Downsampling of larger palette to smaller hw lut size */ for (i = 0; i < crtc->gamma_size; i++) { value = palette[i * (palette_blue_size - 1) / (crtc->gamma_size - 1)].blue; if (gamma_blue) value = gamma_blue[value]; else value <<= shift; crtc->gamma_blue[i] = value; } } } static void xf86RandR12CrtcReloadGamma(xf86CrtcPtr crtc) { if (!crtc->scrn->vtSema || !crtc->funcs->gamma_set) return; /* 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); } static Bool xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); xf86CrtcPtr crtc = randr_crtc->devPrivate; if (crtc->funcs->gamma_set == NULL) return FALSE; if (randrp->palette_size) { xf86RandR12CrtcComputeGamma(crtc, randrp->palette, randrp->palette_red_size, randrp->palette_green_size, randrp->palette_blue_size, randr_crtc->gammaRed, randr_crtc->gammaGreen, randr_crtc->gammaBlue, randr_crtc->gammaSize); } else { memcpy(crtc->gamma_red, randr_crtc->gammaRed, crtc->gamma_size * sizeof(crtc->gamma_red[0])); memcpy(crtc->gamma_green, randr_crtc->gammaGreen, crtc->gamma_size * sizeof(crtc->gamma_green[0])); memcpy(crtc->gamma_blue, randr_crtc->gammaBlue, crtc->gamma_size * sizeof(crtc->gamma_blue[0])); } xf86RandR12CrtcReloadGamma(crtc); return TRUE; } static void init_one_component(CARD16 *comp, unsigned size, float gamma) { int i; unsigned shift; for (shift = 0; (size << shift) < (1 << 16); shift++); if (gamma == 1.0) { for (i = 0; i < size; i++) comp[i] = i << shift; } else { for (i = 0; i < size; i++) comp[i] = (CARD16) (pow((double) i / (double) (size - 1), 1. / (double) gamma) * (double) (size - 1) * (1 << shift)); } } static Bool xf86RandR12CrtcInitGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green, float gamma_blue) { unsigned size = crtc->randr_crtc->gammaSize; CARD16 *red, *green, *blue; if (!crtc->funcs->gamma_set && (gamma_red != 1.0f || gamma_green != 1.0f || gamma_blue != 1.0f)) return FALSE; red = xallocarray(size, 3 * sizeof(CARD16)); if (!red) return FALSE; green = red + size; blue = green + size; init_one_component(red, size, gamma_red); init_one_component(green, size, gamma_green); init_one_component(blue, size, gamma_blue); RRCrtcGammaSet(crtc->randr_crtc, red, green, blue); free(red); return TRUE; } static Bool xf86RandR12OutputInitGamma(xf86OutputPtr output) { XF86ConfMonitorPtr mon = output->conf_monitor; float gamma_red = 1.0, gamma_green = 1.0, gamma_blue = 1.0; if (!mon) return TRUE; /* 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; /* Don't set gamma 1.0 if another cloned output on this CRTC already set a * different gamma */ if (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0) { if (!output->crtc->randr_crtc) { xf86DrvMsg(output->scrn->scrnIndex, X_WARNING, "Gamma correction for output %s not possible because " "RandR is disabled\n", output->name); return TRUE; } xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "Output %s wants gamma correction (%.1f, %.1f, %.1f)\n", output->name, gamma_red, gamma_green, gamma_blue); return xf86RandR12CrtcInitGamma(output->crtc, gamma_red, gamma_green, gamma_blue); } return TRUE; } Bool xf86RandR12InitGamma(ScrnInfoPtr pScrn, unsigned gammaSize) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int o, c; /* Set default gamma for all CRTCs * This is done to avoid problems later on with cloned outputs */ for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; if (!crtc->randr_crtc) continue; if (!RRCrtcGammaSetSize(crtc->randr_crtc, gammaSize) || !xf86RandR12CrtcInitGamma(crtc, 1.0f, 1.0f, 1.0f)) return FALSE; } /* Set initial gamma per monitor configuration */ for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; if (output->crtc && !xf86RandR12OutputInitGamma(output)) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Initial gamma correction for output %s: failed.\n", output->name); } 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 = xf86ScreenToScrn(pScreen); 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 = xallocarray(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 = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); RROutputPtr *clones; RRCrtcPtr *crtcs; int ncrtc; int o, c, l; int nclone; clones = xallocarray(config->num_output, sizeof(RROutputPtr)); crtcs = xallocarray(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 (!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 = xf86ScreenToScrn(pScreen); if (!pScrn->vtSema) return TRUE; xf86ProbeOutputModes(pScrn, 0, 0); xf86SetScrnInfoModes(pScrn); return xf86RandR12SetInfo12(pScreen); } static Bool xf86RandR12CreateObjects12(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 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); } /* * 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); } if (config->name) { config->randr_provider = RRProviderCreate(pScreen, config->name, strlen(config->name)); RRProviderSetCapabilities(config->randr_provider, pScrn->capabilities); } return TRUE; } static void xf86RandR12CreateMonitors(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int o, ot; int ht, vt; int ret; char buf[25]; for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; struct xf86CrtcTileInfo *tile_info = &output->tile_info, *this_tile; RRMonitorPtr monitor; int output_num, num_outputs; if (!tile_info->group_id) continue; if (tile_info->tile_h_loc || tile_info->tile_v_loc) continue; num_outputs = tile_info->num_h_tile * tile_info->num_v_tile; monitor = RRMonitorAlloc(num_outputs); if (!monitor) return; monitor->pScreen = pScreen; snprintf(buf, 25, "Auto-Monitor-%d", tile_info->group_id); monitor->name = MakeAtom(buf, strlen(buf), TRUE); monitor->primary = 0; monitor->automatic = TRUE; memset(&monitor->geometry.box, 0, sizeof(monitor->geometry.box)); output_num = 0; for (ht = 0; ht < tile_info->num_h_tile; ht++) { for (vt = 0; vt < tile_info->num_v_tile; vt++) { for (ot = 0; ot < config->num_output; ot++) { this_tile = &config->output[ot]->tile_info; if (this_tile->group_id != tile_info->group_id) continue; if (this_tile->tile_h_loc != ht || this_tile->tile_v_loc != vt) continue; monitor->outputs[output_num] = config->output[ot]->randr_output->id; output_num++; } } } ret = RRMonitorAdd(serverClient, pScreen, monitor); if (ret) { RRMonitorFree(monitor); return; } } } static Bool xf86RandR12CreateScreenResources12(ScreenPtr pScreen) { int c; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); 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); xf86RandR12CreateMonitors(pScreen); if (!pScreen->isGPU) { rp->primaryOutput = config->output[0]->randr_output; RROutputChanged(rp->primaryOutput, FALSE); rp->layoutChanged = TRUE; } return TRUE; } /* * Something happened within the screen configuration due * to DGA, VidMode or hot key. Tell RandR */ void xf86RandR12TellChanged(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 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(ScrnInfoPtr pScrn, int x, int y) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 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]; Bool oldPanning = randrp->panning; 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); randrp->panning = PANNING_ENABLED (crtc); 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)); randrp->panning = oldPanning; return FALSE; } } /* * Compatibility with colormaps and XF86VidMode's gamma */ void xf86RandR12LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) { ScreenPtr pScreen = pScrn->pScreen; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int reds, greens, blues, index, palette_size; int c, i; if (pVisual->class == TrueColor || pVisual->class == DirectColor) { reds = (pVisual->redMask >> pVisual->offsetRed) + 1; greens = (pVisual->greenMask >> pVisual->offsetGreen) + 1; blues = (pVisual->blueMask >> pVisual->offsetBlue) + 1; } else { reds = greens = blues = pVisual->ColormapEntries; } palette_size = max(reds, max(greens, blues)); if (dixPrivateKeyRegistered(rrPrivKey)) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); if (randrp->palette_size != palette_size) { randrp->palette = reallocarray(randrp->palette, palette_size, sizeof(colors[0])); if (!randrp->palette) { randrp->palette_size = 0; return; } randrp->palette_size = palette_size; } randrp->palette_red_size = reds; randrp->palette_green_size = greens; randrp->palette_blue_size = blues; for (i = 0; i < numColors; i++) { index = indices[i]; if (index < reds) randrp->palette[index].red = colors[index].red; if (index < greens) randrp->palette[index].green = colors[index].green; if (index < blues) randrp->palette[index].blue = colors[index].blue; } } for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; RRCrtcPtr randr_crtc = crtc->randr_crtc; if (randr_crtc) { xf86RandR12CrtcComputeGamma(crtc, colors, reds, greens, blues, randr_crtc->gammaRed, randr_crtc->gammaGreen, randr_crtc->gammaBlue, randr_crtc->gammaSize); } else { xf86RandR12CrtcComputeGamma(crtc, colors, reds, greens, blues, NULL, NULL, NULL, xf86GetGammaRampSize(pScreen)); } xf86RandR12CrtcReloadGamma(crtc); } } /* * Compatibility pScrn->ChangeGamma provider for ddx drivers which do not call * xf86HandleColormaps(). Note such drivers really should be fixed to call * xf86HandleColormaps() as this clobbers the per-CRTC gamma ramp of the CRTC * assigned to the RandR compatibility output. */ static int xf86RandR12ChangeGamma(ScrnInfoPtr pScrn, Gamma gamma) { RRCrtcPtr randr_crtc = xf86CompatRRCrtc(pScrn); int size; if (!randr_crtc || pScrn->LoadPalette == xf86RandR12LoadPalette) return Success; size = max(0, randr_crtc->gammaSize); if (!size) return Success; init_one_component(randr_crtc->gammaRed, size, gamma.red); init_one_component(randr_crtc->gammaGreen, size, gamma.green); init_one_component(randr_crtc->gammaBlue, size, gamma.blue); xf86RandR12CrtcSetGamma(xf86ScrnToScreen(pScrn), randr_crtc); pScrn->gamma = gamma; return Success; } static Bool xf86RandR12EnterVT(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); Bool ret; int i; if (randrp->orig_EnterVT) { pScrn->EnterVT = randrp->orig_EnterVT; ret = pScrn->EnterVT(pScrn); randrp->orig_EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86RandR12EnterVT; if (!ret) return FALSE; } /* reload gamma */ for (i = 0; i < rp->numCrtcs; i++) xf86RandR12CrtcReloadGamma(rp->crtcs[i]->devPrivate); return RRGetInfo(pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */ } static void xf86DetachOutputGPU(ScreenPtr pScreen) { rrScrPrivPtr rp = rrGetScrPriv(pScreen); int i; /* make sure there are no attached shared scanout pixmaps first */ for (i = 0; i < rp->numCrtcs; i++) RRCrtcDetachScanoutPixmap(rp->crtcs[i]); DetachOutputGPU(pScreen); } static Bool xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen, RRProviderPtr provider, RRProviderPtr source_provider) { if (!source_provider) { if (provider->output_source) { xf86DetachOutputGPU(pScreen); } provider->output_source = NULL; return TRUE; } if (provider->output_source == source_provider) return TRUE; SetRootClip(source_provider->pScreen, ROOT_CLIP_NONE); AttachOutputGPU(source_provider->pScreen, pScreen); provider->output_source = source_provider; SetRootClip(source_provider->pScreen, ROOT_CLIP_FULL); return TRUE; } static Bool xf86RandR14ProviderSetOffloadSink(ScreenPtr pScreen, RRProviderPtr provider, RRProviderPtr sink_provider) { if (!sink_provider) { if (provider->offload_sink) { xf86DetachOutputGPU(pScreen); } provider->offload_sink = NULL; return TRUE; } if (provider->offload_sink == sink_provider) return TRUE; AttachOffloadGPU(sink_provider->pScreen, pScreen); provider->offload_sink = sink_provider; return TRUE; } static Bool xf86RandR14ProviderSetProperty(ScreenPtr pScreen, RRProviderPtr randr_provider, Atom property, RRPropertyValuePtr value) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); /* If we don't have any property handler, then we don't care what the * user is setting properties to. */ if (config->provider_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 config->provider_funcs->set_property(pScrn, property, value); } static Bool xf86RandR14ProviderGetProperty(ScreenPtr pScreen, RRProviderPtr randr_provider, Atom property) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); if (config->provider_funcs->get_property == NULL) return TRUE; /* Should be safe even w/o vtSema */ return config->provider_funcs->get_property(pScrn, property); } static Bool xf86CrtcSetScanoutPixmap(RRCrtcPtr randr_crtc, PixmapPtr pixmap) { xf86CrtcPtr crtc = randr_crtc->devPrivate; if (!crtc->funcs->set_scanout_pixmap) return FALSE; return crtc->funcs->set_scanout_pixmap(crtc, pixmap); } static void xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y) { XF86RandRInfoPtr randrp = XF86RANDRINFO(screen); if (randrp->panning) return; if (randrp->orig_ConstrainCursorHarder) { screen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder; screen->ConstrainCursorHarder(dev, screen, mode, x, y); screen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder; } } static void xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); if (config->randr_provider == provider) { if (config->randr_provider->offload_sink) { DetachOffloadGPU(screen); config->randr_provider->offload_sink = NULL; RRSetChanged(screen); } if (config->randr_provider->output_source) { xf86DetachOutputGPU(screen); config->randr_provider->output_source = NULL; RRSetChanged(screen); } if (screen->current_master) DetachUnboundGPU(screen); } config->randr_provider = NULL; } static void xf86CrtcCheckReset(xf86CrtcPtr crtc) { if (xf86CrtcInUse(crtc)) { RRTransformPtr transform; if (crtc->desiredTransformPresent) transform = &crtc->desiredTransform; else transform = NULL; xf86CrtcSetModeTransform(crtc, &crtc->desiredMode, crtc->desiredRotation, transform, crtc->desiredX, crtc->desiredY); xf86_crtc_show_cursor(crtc); } } void xf86CrtcLeaseTerminated(RRLeasePtr lease) { int c; int o; ScrnInfoPtr scrn = xf86ScreenToScrn(lease->screen); RRLeaseTerminated(lease); /* * Force a full mode set on any crtc in the expiring lease which * was running before the lease started */ for (c = 0; c < lease->numCrtcs; c++) { RRCrtcPtr randr_crtc = lease->crtcs[c]; xf86CrtcPtr crtc = randr_crtc->devPrivate; xf86CrtcCheckReset(crtc); } /* Check to see if any leased output is using a crtc which * was not reset in the above loop */ for (o = 0; o < lease->numOutputs; o++) { RROutputPtr randr_output = lease->outputs[o]; xf86OutputPtr output = randr_output->devPrivate; xf86CrtcPtr crtc = output->crtc; if (crtc) { for (c = 0; c < lease->numCrtcs; c++) if (lease->crtcs[c] == crtc->randr_crtc) break; if (c != lease->numCrtcs) continue; xf86CrtcCheckReset(crtc); } } /* Power off if necessary */ xf86DisableUnusedFunctions(scrn); RRLeaseFree(lease); } static Bool xf86CrtcSoleOutput(xf86CrtcPtr crtc, xf86OutputPtr output) { ScrnInfoPtr scrn = crtc->scrn; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o; for (o = 0; o < config->num_output; o++) { xf86OutputPtr other = config->output[o]; if (other != output && other->crtc == crtc) return FALSE; } return TRUE; } void xf86CrtcLeaseStarted(RRLeasePtr lease) { int c; int o; for (c = 0; c < lease->numCrtcs; c++) { RRCrtcPtr randr_crtc = lease->crtcs[c]; xf86CrtcPtr crtc = randr_crtc->devPrivate; if (crtc->enabled) { /* * Leave the primary plane enabled so we can * flip without blanking the screen. Hide * the cursor so it doesn't remain on the screen * while the lease is active */ xf86_crtc_hide_cursor(crtc); crtc->enabled = FALSE; } } for (o = 0; o < lease->numOutputs; o++) { RROutputPtr randr_output = lease->outputs[o]; xf86OutputPtr output = randr_output->devPrivate; xf86CrtcPtr crtc = output->crtc; if (crtc) if (xf86CrtcSoleOutput(crtc, output)) crtc->enabled = FALSE; } } static int xf86RandR16CreateLease(ScreenPtr screen, RRLeasePtr randr_lease, int *fd) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); if (config->funcs->create_lease) return config->funcs->create_lease(randr_lease, fd); else return BadMatch; } static void xf86RandR16TerminateLease(ScreenPtr screen, RRLeasePtr randr_lease) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); if (config->funcs->terminate_lease) config->funcs->terminate_lease(randr_lease); } static Bool xf86RandR12Init12(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); rp->rrGetInfo = xf86RandR12GetInfo12; rp->rrScreenSetSize = xf86RandR12ScreenSetSize; rp->rrCrtcSet = xf86RandR12CrtcSet; rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma; 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; rp->rrProviderSetOutputSource = xf86RandR14ProviderSetOutputSource; rp->rrProviderSetOffloadSink = xf86RandR14ProviderSetOffloadSink; rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty; rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty; rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap; rp->rrProviderDestroy = xf86RandR14ProviderDestroy; rp->rrCreateLease = xf86RandR16CreateLease; rp->rrTerminateLease = xf86RandR16TerminateLease; pScrn->PointerMoved = xf86RandR12PointerMoved; pScrn->ChangeGamma = xf86RandR12ChangeGamma; randrp->orig_EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86RandR12EnterVT; randrp->panning = FALSE; randrp->orig_ConstrainCursorHarder = pScreen->ConstrainCursorHarder; pScreen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder; if (!xf86RandR12CreateObjects12(pScreen)) return FALSE; /* * Configure output modes */ if (!xf86RandR12SetInfo12(pScreen)) return FALSE; if (!xf86RandR12InitGamma(pScrn, 256)) return FALSE; return TRUE; } #endif Bool xf86RandR12PreInit(ScrnInfoPtr pScrn) { return TRUE; } xorg-server-1.20.8/hw/xfree86/modes/xf86cvt.c0000644000175000017500000002354513640201473015507 00000000000000/* * Copyright 2005-2006 Luc Verhaegen. * * 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. */ /* * The reason for having this function in a file of its own is * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode * code is shared directly. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86Modes.h" #include /* * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh. * * These calculations are stolen from the CVT calculation spreadsheet written * by Graham Loveridge. He seems to be claiming no copyright and there seems to * be no license attached to this. He apparently just wants to see his name * mentioned. * * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls * * Comments and structure corresponds to the comments and structure of the xls. * This should ease importing of future changes to the standard (not very * likely though). * * About margins; i'm sure that they are to be the bit between HDisplay and * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking * outside sync "margin" for some reason. Since we prefer seeing proper * blanking instead of the overscan colour, and since the Crtc* values will * probably get altered after us, we will disable margins altogether. With * these calculations, Margins will plainly expand H/VDisplay, and we don't * want that. -- libv * */ DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced) { DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); /* 1) top/bottom margin size (% of height) - default: 1.8 */ #define CVT_MARGIN_PERCENTAGE 1.8 /* 2) character cell horizontal granularity (pixels) - default 8 */ #define CVT_H_GRANULARITY 8 /* 4) Minimum vertical porch (lines) - default 3 */ #define CVT_MIN_V_PORCH 3 /* 4) Minimum number of vertical back porch lines - default 6 */ #define CVT_MIN_V_BPORCH 6 /* Pixel Clock step (kHz) */ #define CVT_CLOCK_STEP 250 Bool Margins = FALSE; float VFieldRate, HPeriod; int HDisplayRnd, HMargin; int VDisplayRnd, VMargin, VSync; float Interlace; /* Please rename this */ char *tmp; /* CVT default is 60.0Hz */ if (!VRefresh) VRefresh = 60.0; /* 1. Required field rate */ if (Interlaced) VFieldRate = VRefresh * 2; else VFieldRate = VRefresh; /* 2. Horizontal pixels */ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY); /* 3. Determine left and right borders */ if (Margins) { /* right margin is actually exactly the same as left */ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); HMargin -= HMargin % CVT_H_GRANULARITY; } else HMargin = 0; /* 4. Find total active pixels */ Mode->HDisplay = HDisplayRnd + 2 * HMargin; /* 5. Find number of lines per field */ if (Interlaced) VDisplayRnd = VDisplay / 2; else VDisplayRnd = VDisplay; /* 6. Find top and bottom margins */ /* nope. */ if (Margins) /* top and bottom margins are equal again. */ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); else VMargin = 0; Mode->VDisplay = VDisplay + 2 * VMargin; /* 7. Interlace */ if (Interlaced) Interlace = 0.5; else Interlace = 0.0; /* Determine VSync Width from aspect ratio */ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) VSync = 4; else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) VSync = 5; else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) VSync = 6; else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) VSync = 7; else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)) VSync = 7; else /* Custom */ VSync = 10; if (!Reduced) { /* simplified GTF calculation */ /* 4) Minimum time of vertical sync + back porch interval (µs) * default 550.0 */ #define CVT_MIN_VSYNC_BP 550.0 /* 3) Nominal HSync width (% of line period) - default 8 */ #define CVT_HSYNC_PERCENTAGE 8 float HBlankPercentage; int VSyncAndBackPorch, VBackPorch; int HBlank; /* 8. Estimated Horizontal period */ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) / (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace); /* 9. Find number of lines in sync + backporch */ if (((int) (CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH)) VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH; else VSyncAndBackPorch = (int) (CVT_MIN_VSYNC_BP / HPeriod) + 1; /* 10. Find number of lines in back porch */ VBackPorch = VSyncAndBackPorch - VSync; (void) VBackPorch; /* 11. Find total number of lines in vertical field */ Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace + CVT_MIN_V_PORCH; /* 5) Definition of Horizontal blanking time limitation */ /* Gradient (%/kHz) - default 600 */ #define CVT_M_FACTOR 600 /* Offset (%) - default 40 */ #define CVT_C_FACTOR 40 /* Blanking time scaling factor - default 128 */ #define CVT_K_FACTOR 128 /* Scaling factor weighting - default 20 */ #define CVT_J_FACTOR 20 #define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256 #define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \ CVT_J_FACTOR /* 12. Find ideal blanking duty cycle from formula */ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod / 1000.0; /* 13. Blanking time */ if (HBlankPercentage < 20) HBlankPercentage = 20; HBlank = Mode->HDisplay * HBlankPercentage / (100.0 - HBlankPercentage); HBlank -= HBlank % (2 * CVT_H_GRANULARITY); /* 14. Find total number of pixels in a line. */ Mode->HTotal = Mode->HDisplay + HBlank; /* Fill in HSync values */ Mode->HSyncEnd = Mode->HDisplay + HBlank / 2; Mode->HSyncStart = Mode->HSyncEnd - (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100; Mode->HSyncStart += CVT_H_GRANULARITY - Mode->HSyncStart % CVT_H_GRANULARITY; /* Fill in VSync values */ Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH; Mode->VSyncEnd = Mode->VSyncStart + VSync; } else { /* Reduced blanking */ /* Minimum vertical blanking interval time (µs) - default 460 */ #define CVT_RB_MIN_VBLANK 460.0 /* Fixed number of clocks for horizontal sync */ #define CVT_RB_H_SYNC 32.0 /* Fixed number of clocks for horizontal blanking */ #define CVT_RB_H_BLANK 160.0 /* Fixed number of lines for vertical front porch - default 3 */ #define CVT_RB_VFPORCH 3 int VBILines; /* 8. Estimate Horizontal period. */ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) / (VDisplayRnd + 2 * VMargin); /* 9. Find number of lines in vertical blanking */ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1; /* 10. Check if vertical blanking is sufficient */ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH)) VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH; /* 11. Find total number of lines in vertical field */ Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines; /* 12. Find total number of pixels in a line */ Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK; /* Fill in HSync values */ Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2; Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC; /* Fill in VSync values */ Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH; Mode->VSyncEnd = Mode->VSyncStart + VSync; } /* 15/13. Find pixel clock frequency (kHz for xf86) */ Mode->Clock = Mode->HTotal * 1000.0 / HPeriod; Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP; /* 16/14. Find actual Horizontal Frequency (kHz) */ Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal); /* 17/15. Find actual Field rate */ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) / ((float) (Mode->HTotal * Mode->VTotal)); /* 18/16. Find actual vertical frame frequency */ /* ignore - just set the mode flag for interlaced */ if (Interlaced) Mode->VTotal *= 2; XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay); Mode->name = tmp; if (Reduced) Mode->Flags |= V_PHSYNC | V_NVSYNC; else Mode->Flags |= V_NHSYNC | V_PVSYNC; if (Interlaced) Mode->Flags |= V_INTERLACE; return Mode; } xorg-server-1.20.8/hw/xfree86/modes/xf86Cursors.c0000644000175000017500000005067313640201473016355 00000000000000/* * Copyright © 2007 Keith Packard * Copyright © 2010-2011 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 #endif #include #include #include #include #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" /* * Returns the rotation being performed by the server. If the driver indicates * that it's handling the screen transform, then this returns RR_Rotate_0. */ static Rotation xf86_crtc_cursor_rotation(xf86CrtcPtr crtc) { if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorImage) return RR_Rotate_0; return crtc->rotation; } /* * 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 = width - 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 = height - 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; } /* * Wrappers to deal with API compatibility with drivers that don't expose * *_cursor_*_check */ static inline Bool xf86_driver_has_show_cursor(xf86CrtcPtr crtc) { return crtc->funcs->show_cursor_check || crtc->funcs->show_cursor; } static inline Bool xf86_driver_has_load_cursor_image(xf86CrtcPtr crtc) { return crtc->funcs->load_cursor_image_check || crtc->funcs->load_cursor_image; } static inline Bool xf86_driver_has_load_cursor_argb(xf86CrtcPtr crtc) { return crtc->funcs->load_cursor_argb_check || crtc->funcs->load_cursor_argb; } static inline Bool xf86_driver_show_cursor(xf86CrtcPtr crtc) { if (crtc->funcs->show_cursor_check) return crtc->funcs->show_cursor_check(crtc); crtc->funcs->show_cursor(crtc); return TRUE; } static inline Bool xf86_driver_load_cursor_image(xf86CrtcPtr crtc, CARD8 *cursor_image) { if (crtc->funcs->load_cursor_image_check) return crtc->funcs->load_cursor_image_check(crtc, cursor_image); crtc->funcs->load_cursor_image(crtc, cursor_image); return TRUE; } static inline Bool xf86_driver_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *cursor_argb) { if (crtc->funcs->load_cursor_argb_check) return crtc->funcs->load_cursor_argb_check(crtc, cursor_argb); crtc->funcs->load_cursor_argb(crtc, cursor_argb); return TRUE; } /* * Load a two color cursor into a driver that supports only ARGB cursors */ static Bool 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; const Rotation rotation = xf86_crtc_cursor_rotation(crtc); crtc->cursor_argb = FALSE; for (y = 0; y < cursor_info->MaxHeight; y++) for (x = 0; x < cursor_info->MaxWidth; x++) { xf86_crtc_rotate_coord(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; } return xf86_driver_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 = xf86CurrentCursor(screen); int c; CARD8 *bits = cursor ? dixLookupScreenPrivate(&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 (xf86_driver_has_load_cursor_image(crtc)) crtc->funcs->set_cursor_colors(crtc, bg, fg); else if (bits) xf86_crtc_convert_cursor_to_argb(crtc, bits); } } } 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); } } Bool xf86_crtc_show_cursor(xf86CrtcPtr crtc) { if (!crtc->cursor_in_range) { crtc->funcs->hide_cursor(crtc); return TRUE; } if (!crtc->cursor_shown) crtc->cursor_shown = xf86_driver_show_cursor(crtc); return crtc->cursor_shown; } Bool 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)) return FALSE; } return TRUE; } static void xf86_crtc_transform_cursor_position(xf86CrtcPtr crtc, int *x, int *y) { ScrnInfoPtr scrn = crtc->scrn; ScreenPtr screen = scrn->pScreen; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&screen->devPrivates, xf86CursorScreenKey); int dx, dy, t; Bool swap_reflection = FALSE; *x = *x - crtc->x + ScreenPriv->HotX; *y = *y - crtc->y + ScreenPriv->HotY; switch (crtc->rotation & 0xf) { case RR_Rotate_0: break; case RR_Rotate_90: t = *x; *x = *y; *y = crtc->mode.VDisplay - t - 1; swap_reflection = TRUE; break; case RR_Rotate_180: *x = crtc->mode.HDisplay - *x - 1; *y = crtc->mode.VDisplay - *y - 1; break; case RR_Rotate_270: t = *x; *x = crtc->mode.HDisplay - *y - 1; *y = t; swap_reflection = TRUE; break; } if (swap_reflection) { if (crtc->rotation & RR_Reflect_Y) *x = crtc->mode.HDisplay - *x - 1; if (crtc->rotation & RR_Reflect_X) *y = crtc->mode.VDisplay - *y - 1; } else { if (crtc->rotation & RR_Reflect_X) *x = crtc->mode.HDisplay - *x - 1; if (crtc->rotation & RR_Reflect_Y) *y = crtc->mode.VDisplay - *y - 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; } 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; int crtc_x = x, crtc_y = y; /* * Transform position of cursor on screen */ if (crtc->rotation != RR_Rotate_0) xf86_crtc_transform_cursor_position(crtc, &crtc_x, &crtc_y); else { crtc_x -= crtc->x; crtc_y -= crtc->y; } /* * Disable the cursor when it is outside the viewport */ if (crtc_x >= mode->HDisplay || crtc_y >= mode->VDisplay || crtc_x <= -cursor_info->MaxWidth || crtc_y <= -cursor_info->MaxHeight) { crtc->cursor_in_range = FALSE; xf86_crtc_hide_cursor(crtc); } else { crtc->cursor_in_range = TRUE; if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition) crtc->funcs->set_cursor_position(crtc, x, y); else crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y); xf86_crtc_show_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 Bool 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; const Rotation rotation = xf86_crtc_cursor_rotation(crtc); crtc->cursor_argb = FALSE; if (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(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); } } return xf86_driver_load_cursor_image(crtc, cursor_image); } /* * Load a cursor image into all active CRTCs */ static Bool xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c; xf86_config->cursor = xf86CurrentCursor(scrn->pScreen); for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; if (crtc->enabled) { if (xf86_driver_has_load_cursor_image(crtc)) { if (!xf86_crtc_load_cursor_image(crtc, src)) return FALSE; } else if (xf86_driver_has_load_cursor_argb(crtc)) { if (!xf86_crtc_convert_cursor_to_argb(crtc, src)) return FALSE; } else return FALSE; } } return TRUE; } static Bool xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; int c; if (cursor->bits->width > cursor_info->MaxWidth || cursor->bits->height > cursor_info->MaxHeight) return FALSE; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; if (!crtc->enabled) continue; if (crtc->transformPresent) return FALSE; } return TRUE; } static Bool xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; if (!xf86_use_hw_cursor(screen, cursor)) return FALSE; /* Make sure ARGB support is available */ if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0) return FALSE; return TRUE; } static Bool 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; const Rotation rotation = xf86_crtc_cursor_rotation(crtc); for (y = 0; y < image_height; y++) for (x = 0; x < image_width; x++) { xf86_crtc_rotate_coord(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; } return xf86_driver_load_cursor_argb(crtc, cursor_image); } static Bool xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c; xf86_config->cursor = cursor; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; if (crtc->enabled) if (!xf86_crtc_load_cursor_argb(crtc, cursor)) return FALSE; } return TRUE; } Bool xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); 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->LoadCursorImageCheck = xf86_load_cursor_image; cursor_info->HideCursor = xf86_hide_cursors; cursor_info->ShowCursorCheck = xf86_show_cursors; cursor_info->UseHWCursor = xf86_use_hw_cursor; if (flags & HARDWARE_CURSOR_ARGB) { cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb; cursor_info->LoadCursorARGBCheck = xf86_load_cursor_argb; } xf86_hide_cursors(scrn); return xf86InitCursor(screen, cursor_info); } /** * Clean up CRTC-based cursor code */ void xf86_cursors_fini(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); 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; xf86_config->cursor = NULL; } xorg-server-1.20.8/hw/xfree86/modes/xf86Crtc.h0000644000175000017500000006773213640201473015621 00000000000000/* * Copyright © 2006 Keith Packard * Copyright © 2011 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. */ #ifndef _XF86CRTC_H_ #define _XF86CRTC_H_ #include #include "randrstr.h" #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; typedef struct _xf86Lease xf86LeaseRec, *xf86LeasePtr; /* 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 _xf86DriverTransforms { XF86DriverTransformNone = 0, XF86DriverTransformOutput = 1 << 0, XF86DriverTransformCursorImage = 1 << 1, XF86DriverTransformCursorPosition = 1 << 2, } xf86DriverTransforms; struct xf86CrtcTileInfo { uint32_t group_id; uint32_t flags; uint32_t num_h_tile; uint32_t num_v_tile; uint32_t tile_h_loc; uint32_t tile_v_loc; uint32_t tile_h_size; uint32_t tile_v_size; }; 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); Bool (*show_cursor_check) (xf86CrtcPtr crtc); /** * Hide cursor */ void (*hide_cursor) (xf86CrtcPtr crtc); /** * Load monochrome image */ void (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image); Bool (*load_cursor_image_check) (xf86CrtcPtr crtc, CARD8 *image); /** * Load ARGB image */ void (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image); Bool (*load_cursor_argb_check) (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); /** */ Bool (*set_scanout_pixmap)(xf86CrtcPtr crtc, PixmapPtr pixmap); } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; #define XF86_CRTC_VERSION 8 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; /** * Indicates that the driver is handling some or all transforms: * * XF86DriverTransformOutput: The driver handles the output transform, so * the shadow surface should be disabled. The driver writes this field * before calling xf86CrtcRotate to indicate that it is handling the * transform (including rotation and reflection). * * XF86DriverTransformCursorImage: Setting this flag causes the server to * pass the untransformed cursor image to the driver hook. * * XF86DriverTransformCursorPosition: Setting this flag causes the server * to pass the untransformed cursor position to the driver hook. * * Added in ABI version 4, changed to xf86DriverTransforms in ABI version 7 */ xf86DriverTransforms driverIsPerformingTransform; /* Added in ABI version 5 */ PixmapPtr current_scanout; /* Added in ABI version 6 */ PixmapPtr current_scanout_back; }; 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 3 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; /** For pre-init, whether the output should be excluded from the * desktop when there are other viable outputs to use */ Bool non_desktop; #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]; struct xf86CrtcTileInfo tile_info; }; typedef struct _xf86ProviderFuncs { /** * Called to allow the provider a chance to create properties after the * RandR objects have been created. */ void (*create_resources) (ScrnInfoPtr scrn); /** * Callback when an provider's property has changed. */ Bool (*set_property) (ScrnInfoPtr scrn, Atom property, RRPropertyValuePtr value); /** * Callback to get an updated property value */ Bool (*get_property) (ScrnInfoPtr provider, Atom property); } xf86ProviderFuncsRec, *xf86ProviderFuncsPtr; #define XF86_LEASE_VERSION 1 struct _xf86Lease { /** * ABI versioning */ int version; /** * Associated ScrnInfo */ ScrnInfoPtr scrn; /** * Driver private */ void *driver_private; /** * RandR lease */ RRLeasePtr randr_lease; /* * Contents of the lease */ /** * Number of leased CRTCs */ int num_crtc; /** * Number of leased outputs */ int num_output; /** * Array of pointers to leased CRTCs */ RRCrtcPtr *crtcs; /** * Array of pointers to leased outputs */ RROutputPtr *outputs; }; 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); /** * Requests that the driver create a lease */ int (*create_lease)(RRLeasePtr lease, int *fd); /** * Ask the driver to terminate a lease, freeing all * driver resources */ void (*terminate_lease)(RRLeasePtr lease); } xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr; /* * The driver calls this when it detects that a lease * has been terminated */ extern _X_EXPORT void xf86CrtcLeaseTerminated(RRLeasePtr lease); extern _X_EXPORT void xf86CrtcLeaseStarted(RRLeasePtr lease); 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; char *name; const xf86ProviderFuncsRec *provider_funcs; #ifdef RANDR_12_INTERFACE RRProviderPtr randr_provider; #else void *randr_provider; #endif } 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); if (config->compat_output < 0) return NULL; 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); /** * Set the TILE information for the specified output */ extern _X_EXPORT void xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info); extern _X_EXPORT Bool xf86OutputParseKMSTile(const char *tile_data, int tile_length, struct xf86CrtcTileInfo *tile_info); /** * 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 const 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); /** * Superseeded by xf86CursorResetCursor, which is getting called * automatically when necessary. */ static _X_INLINE _X_DEPRECATED void xf86_reload_cursors(ScreenPtr screen) {} /** * Called from EnterVT to turn the cursors back on */ extern _X_EXPORT Bool xf86_show_cursors(ScrnInfoPtr scrn); /** * Called by the driver to turn a single crtc's cursor off */ extern _X_EXPORT void xf86_crtc_hide_cursor(xf86CrtcPtr crtc); /** * Called by the driver to turn a single crtc's cursor on */ extern _X_EXPORT Bool xf86_crtc_show_cursor(xf86CrtcPtr crtc); /** * 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); #ifdef XV /* * 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); #endif 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); extern _X_EXPORT void xf86ProviderSetup(ScrnInfoPtr scrn, const xf86ProviderFuncsRec * funcs, const char *name); extern _X_EXPORT void xf86DetachAllCrtc(ScrnInfoPtr scrn); #endif /* _XF86CRTC_H_ */ xorg-server-1.20.8/hw/xfree86/modes/xf86Modes.c0000644000175000017500000005400713640201473015757 00000000000000/* * 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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Modes.h" #include "xf86Priv.h" extern XF86ConfigPtr xf86configptr; /** * Calculates the horizontal sync rate of a mode. */ double xf86ModeHSync(const DisplayModeRec * mode) { double hsync = 0.0; if (mode->HSync > 0.0) hsync = mode->HSync; else if (mode->HTotal > 0) hsync = (float) mode->Clock / (float) mode->HTotal; return hsync; } /** * Calculates the vertical refresh rate of a mode. */ double xf86ModeVRefresh(const DisplayModeRec * mode) { double refresh = 0.0; if (mode->VRefresh > 0.0) refresh = mode->VRefresh; else if (mode->HTotal > 0 && mode->VTotal > 0) { refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal; if (mode->Flags & V_INTERLACE) refresh *= 2.0; if (mode->Flags & V_DBLSCAN) refresh /= 2.0; if (mode->VScan > 1) refresh /= (float) (mode->VScan); } return refresh; } int xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation) { switch (rotation & 0xf) { case RR_Rotate_0: case RR_Rotate_180: return mode->HDisplay; case RR_Rotate_90: case RR_Rotate_270: return mode->VDisplay; default: return 0; } } int xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation) { switch (rotation & 0xf) { case RR_Rotate_0: case RR_Rotate_180: return mode->VDisplay; case RR_Rotate_90: case RR_Rotate_270: return mode->HDisplay; default: return 0; } } /** Calculates the memory bandwidth (in MiB/sec) of a mode. */ unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth) { float a_active, a_total, active_percent, pixels_per_second; int bytes_per_pixel = bits_to_bytes(depth); if (!mode->HTotal || !mode->VTotal || !mode->Clock) return 0; a_active = mode->HDisplay * mode->VDisplay; a_total = mode->HTotal * mode->VTotal; active_percent = a_active / a_total; pixels_per_second = active_percent * mode->Clock * 1000.0; return (unsigned int) (pixels_per_second * bytes_per_pixel / (1024 * 1024)); } /** Sets a default mode name of x on a mode. */ void xf86SetModeDefaultName(DisplayModePtr mode) { Bool interlaced = ! !(mode->Flags & V_INTERLACE); char *tmp; free((void *) mode->name); XNFasprintf(&tmp, "%dx%d%s", mode->HDisplay, mode->VDisplay, interlaced ? "i" : ""); mode->name = tmp; } /* * xf86SetModeCrtc * * Initialises the Crtc parameters for a mode. The initialisation includes * adjustments for interlaced and double scan modes. */ void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) { if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN)) return; p->CrtcHDisplay = p->HDisplay; p->CrtcHSyncStart = p->HSyncStart; p->CrtcHSyncEnd = p->HSyncEnd; p->CrtcHTotal = p->HTotal; p->CrtcHSkew = p->HSkew; p->CrtcVDisplay = p->VDisplay; p->CrtcVSyncStart = p->VSyncStart; p->CrtcVSyncEnd = p->VSyncEnd; p->CrtcVTotal = p->VTotal; if (p->Flags & V_INTERLACE) { if (adjustFlags & INTERLACE_HALVE_V) { p->CrtcVDisplay /= 2; p->CrtcVSyncStart /= 2; p->CrtcVSyncEnd /= 2; p->CrtcVTotal /= 2; } /* Force interlaced modes to have an odd VTotal */ /* maybe we should only do this when INTERLACE_HALVE_V is set? */ p->CrtcVTotal |= 1; } if (p->Flags & V_DBLSCAN) { p->CrtcVDisplay *= 2; p->CrtcVSyncStart *= 2; p->CrtcVSyncEnd *= 2; p->CrtcVTotal *= 2; } if (p->VScan > 1) { p->CrtcVDisplay *= p->VScan; p->CrtcVSyncStart *= p->VScan; p->CrtcVSyncEnd *= p->VScan; p->CrtcVTotal *= p->VScan; } p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay); p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal); p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay); p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal); p->CrtcHAdjusted = FALSE; p->CrtcVAdjusted = FALSE; } /** * Fills in a copy of mode, removing all stale pointer references. * xf86ModesEqual will return true when comparing with original mode. */ void xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode) { *intern = *mode; intern->prev = intern->next = NULL; intern->name = NULL; intern->PrivSize = 0; intern->PrivFlags = 0; intern->Private = NULL; } /** * Allocates and returns a copy of pMode, including pointers within pMode. */ DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode) { DisplayModePtr pNew; pNew = xnfalloc(sizeof(DisplayModeRec)); *pNew = *pMode; pNew->next = NULL; pNew->prev = NULL; if (pMode->name == NULL) xf86SetModeDefaultName(pNew); else pNew->name = xnfstrdup(pMode->name); return pNew; } /** * Duplicates every mode in the given list and returns a pointer to the first * mode. * * \param modeList doubly-linked mode list */ DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList) { DisplayModePtr first = NULL, last = NULL; DisplayModePtr mode; for (mode = modeList; mode != NULL; mode = mode->next) { DisplayModePtr new; new = xf86DuplicateMode(mode); /* Insert pNew into modeList */ if (last) { last->next = new; new->prev = last; } else { first = new; new->prev = NULL; } new->next = NULL; last = new; } return first; } /** * Returns true if the given modes should program to the same timings. * * This doesn't use Crtc values, as it might be used on ModeRecs without the * Crtc values set. So, it's assumed that the other numbers are enough. */ Bool xf86ModesEqual(const DisplayModeRec * pMode1, const DisplayModeRec * pMode2) { if (pMode1->Clock == pMode2->Clock && pMode1->HDisplay == pMode2->HDisplay && pMode1->HSyncStart == pMode2->HSyncStart && pMode1->HSyncEnd == pMode2->HSyncEnd && pMode1->HTotal == pMode2->HTotal && pMode1->HSkew == pMode2->HSkew && pMode1->VDisplay == pMode2->VDisplay && pMode1->VSyncStart == pMode2->VSyncStart && pMode1->VSyncEnd == pMode2->VSyncEnd && pMode1->VTotal == pMode2->VTotal && pMode1->VScan == pMode2->VScan && pMode1->Flags == pMode2->Flags) { return TRUE; } else { return FALSE; } } static void add(char **p, const char *new) { *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2); strcat(*p, " "); strcat(*p, new); } /** * Print out a modeline. * * The mode type bits are informational except for the capitalized U * and P bits which give sort order priority. Letter map: * * USERPREF, U, user preferred is set from the xorg.conf Monitor * Option "PreferredMode" or from the Screen Display Modes statement. * This unique modeline is moved to the head of the list after sorting. * * DRIVER, e, is set by the video driver, EDID or flat panel native. * * USERDEF, z, a configured zoom mode Ctrl+Alt+Keypad-{Plus,Minus}. * * DEFAULT, d, a compiled-in default. * * PREFERRED, P, driver preferred is set by the video device driver, * e.g. the EDID detailed timing modeline. This is a true sort * priority and multiple P modes form a sorted sublist at the list * head. * * BUILTIN, b, a hardware fixed CRTC mode. * * See modes/xf86Crtc.c: xf86ProbeOutputModes(). */ void xf86PrintModeline(int scrnIndex, DisplayModePtr mode) { char tmp[256]; char *flags = xnfcalloc(1, 1); #define TBITS 6 const char tchar[TBITS + 1] = "UezdPb"; int tbit[TBITS] = { M_T_USERPREF, M_T_DRIVER, M_T_USERDEF, M_T_DEFAULT, M_T_PREFERRED, M_T_BUILTIN }; char type[TBITS + 2]; /* +1 for leading space */ #undef TBITS int tlen = 0; if (mode->type) { int i; type[tlen++] = ' '; for (i = 0; tchar[i]; i++) if (mode->type & tbit[i]) type[tlen++] = tchar[i]; } type[tlen] = '\0'; if (mode->HSkew) { snprintf(tmp, 256, "hskew %i", mode->HSkew); add(&flags, tmp); } if (mode->VScan) { snprintf(tmp, 256, "vscan %i", mode->VScan); add(&flags, tmp); } if (mode->Flags & V_INTERLACE) add(&flags, "interlace"); if (mode->Flags & V_CSYNC) add(&flags, "composite"); if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan"); if (mode->Flags & V_BCAST) add(&flags, "bcast"); if (mode->Flags & V_PHSYNC) add(&flags, "+hsync"); if (mode->Flags & V_NHSYNC) add(&flags, "-hsync"); if (mode->Flags & V_PVSYNC) add(&flags, "+vsync"); if (mode->Flags & V_NVSYNC) add(&flags, "-vsync"); if (mode->Flags & V_PCSYNC) add(&flags, "+csync"); if (mode->Flags & V_NCSYNC) add(&flags, "-csync"); #if 0 if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2"); #endif xf86DrvMsg(scrnIndex, X_INFO, "Modeline \"%s\"x%.01f %6.2f %i %i %i %i %i %i %i %i%s" " (%.01f kHz%s)\n", mode->name, mode->VRefresh, mode->Clock / 1000., mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal, mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal, flags, xf86ModeHSync(mode), type); free(flags); } /** * Marks as bad any modes with unsupported flags. * * \param modeList doubly-linked list of modes. * \param flags flags supported by the driver. * * \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough? */ void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags) { DisplayModePtr mode; if (flags == (V_INTERLACE | V_DBLSCAN)) return; for (mode = modeList; mode != NULL; mode = mode->next) { if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE)) mode->status = MODE_NO_INTERLACE; if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN)) mode->status = MODE_NO_DBLESCAN; } } /** * Marks as bad any modes extending beyond the given max X, Y, or pitch. * * \param modeList doubly-linked list of modes. */ void xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, int maxX, int maxY, int maxPitch) { DisplayModePtr mode; if (maxPitch <= 0) maxPitch = MAXINT; if (maxX <= 0) maxX = MAXINT; if (maxY <= 0) maxY = MAXINT; for (mode = modeList; mode != NULL; mode = mode->next) { if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch || xf86ModeWidth(mode, RR_Rotate_0) > maxX || xf86ModeHeight(mode, RR_Rotate_0) > maxY) && (xf86ModeWidth(mode, RR_Rotate_90) > maxPitch || xf86ModeWidth(mode, RR_Rotate_90) > maxX || xf86ModeHeight(mode, RR_Rotate_90) > maxY)) { if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch || xf86ModeWidth(mode, RR_Rotate_90) > maxPitch) mode->status = MODE_BAD_WIDTH; if (xf86ModeWidth(mode, RR_Rotate_0) > maxX || xf86ModeWidth(mode, RR_Rotate_90) > maxX) mode->status = MODE_VIRTUAL_X; if (xf86ModeHeight(mode, RR_Rotate_0) > maxY || xf86ModeHeight(mode, RR_Rotate_90) > maxY) mode->status = MODE_VIRTUAL_Y; } if (mode->next == modeList) break; } } /** * Marks as bad any modes that aren't supported by the given monitor's * hsync and vrefresh ranges. * * \param modeList doubly-linked list of modes. */ void xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon) { DisplayModePtr mode; for (mode = modeList; mode != NULL; mode = mode->next) { Bool bad; int i; bad = TRUE; for (i = 0; i < mon->nHsync; i++) { if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1 - SYNC_TOLERANCE) && xf86ModeHSync(mode) <= mon->hsync[i].hi * (1 + SYNC_TOLERANCE)) { bad = FALSE; } } if (bad) mode->status = MODE_HSYNC; bad = TRUE; for (i = 0; i < mon->nVrefresh; i++) { if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo * (1 - SYNC_TOLERANCE) && xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi * (1 + SYNC_TOLERANCE)) { bad = FALSE; } } if (bad) mode->status = MODE_VSYNC; if (mode->next == modeList) break; } } /** * Marks as bad any modes extending beyond outside of the given clock ranges. * * \param modeList doubly-linked list of modes. * \param min pointer to minimums of clock ranges * \param max pointer to maximums of clock ranges * \param n_ranges number of ranges. */ void xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, int *min, int *max, int n_ranges) { DisplayModePtr mode; int i; for (mode = modeList; mode != NULL; mode = mode->next) { Bool good = FALSE; for (i = 0; i < n_ranges; i++) { if (mode->Clock >= min[i] * (1 - SYNC_TOLERANCE) && mode->Clock <= max[i] * (1 + SYNC_TOLERANCE)) { good = TRUE; break; } } if (!good) mode->status = MODE_CLOCK_RANGE; } } /** * If the user has specified a set of mode names to use, mark as bad any modes * not listed. * * The user mode names specified are prefixes to names of modes, so "1024x768" * will match modes named "1024x768", "1024x768x75", "1024x768-good", but * "1024x768x75" would only match "1024x768x75" from that list. * * MODE_BAD is used as the rejection flag, for lack of a better flag. * * \param modeList doubly-linked list of modes. */ void xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList) { DisplayModePtr mode; if (pScrn->display->modes[0] == NULL) return; for (mode = modeList; mode != NULL; mode = mode->next) { int i; Bool good = FALSE; for (i = 0; pScrn->display->modes[i] != NULL; i++) { if (strncmp(pScrn->display->modes[i], mode->name, strlen(pScrn->display->modes[i])) == 0) { good = TRUE; break; } } if (!good) mode->status = MODE_BAD; } } /** * Marks as bad any modes exceeding the given bandwidth. * * \param modeList doubly-linked list of modes. * \param bandwidth bandwidth in MHz. * \param depth color depth. */ void xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, unsigned int bandwidth, int depth) { DisplayModePtr mode; for (mode = modeList; mode != NULL; mode = mode->next) { if (xf86ModeBandwidth(mode, depth) > bandwidth) mode->status = MODE_BANDWIDTH; } } Bool xf86ModeIsReduced(const DisplayModeRec * mode) { if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) && ((mode->HTotal - mode->HDisplay) == 160) && ((mode->HSyncEnd - mode->HDisplay) == 80) && ((mode->HSyncEnd - mode->HSyncStart) == 32) && ((mode->VSyncStart - mode->VDisplay) == 3)) return TRUE; return FALSE; } /** * Marks as bad any reduced-blanking modes. * * \param modeList doubly-linked list of modes. */ void xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList) { for (; modeList != NULL; modeList = modeList->next) if (xf86ModeIsReduced(modeList)) modeList->status = MODE_NO_REDUCED; } /** * Frees any modes from the list with a status other than MODE_OK. * * \param modeList pointer to a doubly-linked or circular list of modes. * \param verbose determines whether the reason for mode invalidation is * printed. */ void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList, Bool verbose) { DisplayModePtr mode; for (mode = *modeList; mode != NULL;) { DisplayModePtr next = mode->next, first = *modeList; if (mode->status != MODE_OK) { if (verbose) { const char *type = ""; if (mode->type & M_T_BUILTIN) type = "built-in "; else if (mode->type & M_T_DEFAULT) type = "default "; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not using %smode \"%s\" (%s)\n", type, mode->name, xf86ModeStatusToString(mode->status)); } xf86DeleteMode(modeList, mode); } if (next == first) break; mode = next; } } /** * Adds the new mode into the mode list, and returns the new list * * \param modes doubly-linked mode list. */ DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new) { if (modes == NULL) return new; if (new) { DisplayModePtr mode = modes; while (mode->next) mode = mode->next; mode->next = new; new->prev = mode; } return modes; } /** * Build a mode list from a list of config file modes */ static DisplayModePtr xf86GetConfigModes(XF86ConfModeLinePtr conf_mode) { DisplayModePtr head = NULL, prev = NULL, mode; for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next) { mode = calloc(1, sizeof(DisplayModeRec)); if (!mode) continue; mode->name = xstrdup(conf_mode->ml_identifier); if (!mode->name) { free(mode); continue; } mode->type = 0; mode->Clock = conf_mode->ml_clock; mode->HDisplay = conf_mode->ml_hdisplay; mode->HSyncStart = conf_mode->ml_hsyncstart; mode->HSyncEnd = conf_mode->ml_hsyncend; mode->HTotal = conf_mode->ml_htotal; mode->VDisplay = conf_mode->ml_vdisplay; mode->VSyncStart = conf_mode->ml_vsyncstart; mode->VSyncEnd = conf_mode->ml_vsyncend; mode->VTotal = conf_mode->ml_vtotal; mode->Flags = conf_mode->ml_flags; mode->HSkew = conf_mode->ml_hskew; mode->VScan = conf_mode->ml_vscan; mode->prev = prev; mode->next = NULL; if (prev) prev->next = mode; else head = mode; prev = mode; } return head; } /** * Build a mode list from a monitor configuration */ DisplayModePtr xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor) { DisplayModePtr modes = NULL; XF86ConfModesLinkPtr modes_link; if (!conf_monitor) return NULL; /* * first we collect the mode lines from the UseModes directive */ for (modes_link = conf_monitor->mon_modes_sect_lst; modes_link; modes_link = modes_link->list.next) { /* If this modes link hasn't been resolved, go look it up now */ if (!modes_link->ml_modes) modes_link->ml_modes = xf86findModes(modes_link->ml_modes_str, xf86configptr->conf_modes_lst); if (modes_link->ml_modes) modes = xf86ModesAdd(modes, xf86GetConfigModes(modes_link->ml_modes-> mon_modeline_lst)); } return xf86ModesAdd(modes, xf86GetConfigModes(conf_monitor->mon_modeline_lst)); } /** * Build a mode list containing all of the default modes */ DisplayModePtr xf86GetDefaultModes(void) { DisplayModePtr head = NULL, mode; int i; for (i = 0; i < xf86NumDefaultModes; i++) { const DisplayModeRec *defMode = &xf86DefaultModes[i]; mode = xf86DuplicateMode(defMode); head = xf86ModesAdd(head, mode); } return head; } /* * Walk a mode list and prune out duplicates. Will preserve the preferred * mode of an otherwise-duplicate pair. * * Probably best to call this on lists that are all of a single class * (driver, default, user, etc.), otherwise, which mode gets deleted is * not especially well defined. * * Returns the new list. */ DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes) { DisplayModePtr m, n, o; top: for (m = modes; m; m = m->next) { for (n = m->next; n; n = o) { o = n->next; if (xf86ModesEqual(m, n)) { if (n->type & M_T_PREFERRED) { xf86DeleteMode(&modes, m); goto top; } else xf86DeleteMode(&modes, n); } } } return modes; } xorg-server-1.20.8/hw/xfree86/modes/xf86Rotate.c0000644000175000017500000004025013640201473016141 00000000000000/* * Copyright © 2006 Keith Packard * Copyright © 2011 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 #endif #include #include #include #include "mi.h" #include "xf86.h" #include "xf86DDC.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" 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 = PictureWindowFormat(screen->root); int error; PicturePtr src, dst; int n = RegionNumRects(region); BoxPtr b = RegionRects(region); XID include_inferiors = IncludeInferiors; if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput) return; 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 = xf86ScrnToScreen(pScrn); 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 = xf86ScreenToScrn(pScreen); 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->root->drawable, xf86_config->rotation_damage); xf86_config->rotation_damage_registered = TRUE; EnableLimitedSchedulingLatency(); } xf86CrtcDamageShadow(crtc); } } } static Bool xf86RotateRedisplay(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); DamagePtr damage = xf86_config->rotation_damage; RegionPtr region; if (!damage || !pScreen->root) 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 = miSourceValidate; 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(ScreenPtr pScreen, void *pTimeout) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); /* Unwrap before redisplay in case the software * cursor layer wants to add its block handler to the * chain */ pScreen->BlockHandler = xf86_config->BlockHandler; xf86RotateRedisplay(pScreen); (*pScreen->BlockHandler) (pScreen, pTimeout); /* Re-wrap if we still need this hook */ if (xf86_config->rotation_damage != NULL) { xf86_config->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = xf86RotateBlockHandler; } else xf86_config->BlockHandler = NULL; } void xf86RotateDestroy(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; 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]->rotatedData) return; /* * Clean up damage structures when no crtcs are rotated */ if (xf86_config->rotation_damage) { /* Free damage structure */ if (xf86_config->rotation_damage_registered) { 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 = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c; /* This has already been destroyed when the root window was destroyed */ xf86_config->rotation_damage = NULL; 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->is_gpu) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); if (pScreen->current_master) pScrn = xf86ScreenToScrn(pScreen->current_master); } 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); ScreenPtr pScreen = xf86ScrnToScreen(pScrn); 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 (pScreen->isGPU) return TRUE; 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 { if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput) { xf86RotateDestroy(crtc); } 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; } } 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; } } #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 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); else if (crtc->rotatedData && !crtc->rotatedPixmap) /* Make sure the new rotate buffer has valid transformed contents */ xf86RotateRedisplay(pScreen); /* All done */ return TRUE; } xorg-server-1.20.8/hw/xfree86/modes/meson.build0000644000175000017500000000101713640201473016163 00000000000000srcs_xorg_modes = [ 'xf86Crtc.c', 'xf86Cursors.c', 'xf86cvt.c', 'xf86gtf.c', 'xf86EdidModes.c', 'xf86Modes.c', 'xf86RandR12.c', 'xf86Rotate.c', ] if build_dga srcs_xorg_modes += 'xf86DiDGA.c' endif xorg_modes = static_library('xorg_modes', srcs_xorg_modes, include_directories: [inc, xorg_inc], dependencies: common_dep, c_args: xorg_c_args, ) install_data( [ 'xf86Crtc.h', 'xf86Modes.h', 'xf86RandR12.h', ], install_dir: xorgsdkdir, ) xorg-server-1.20.8/hw/xfree86/xkb/0000755000175000017500000000000013640201534013555 500000000000000xorg-server-1.20.8/hw/xfree86/xkb/Makefile.am0000644000175000017500000000024013640201473015527 00000000000000noinst_LTLIBRARIES = libxorgxkb.la AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ AM_CPPFLAGS = @XORG_INCS@ libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c xorg-server-1.20.8/hw/xfree86/xkb/xkbPrivate.c0000644000175000017500000000276113640201473015770 00000000000000 #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS #include #include "dixgrabs.h" #include "os.h" #include "xf86.h" int XkbDDXPrivate(DeviceIntPtr dev, KeyCode key, XkbAction *act) { XkbAnyAction *xf86act = &(act->any); char msgbuf[XkbAnyActionDataSize + 1]; if (xf86act->type == XkbSA_XFree86Private) { memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize); msgbuf[XkbAnyActionDataSize] = '\0'; if (strcasecmp(msgbuf, "-vmode") == 0) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); else if (strcasecmp(msgbuf, "+vmode") == 0) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); else if (strcasecmp(msgbuf, "prgrbs") == 0) { DeviceIntPtr tmp; xf86Msg(X_INFO, "Printing all currently active device grabs:\n"); for (tmp = inputInfo.devices; tmp; tmp = tmp->next) if (tmp->deviceGrab.grab) PrintDeviceGrabInfo(tmp); xf86Msg(X_INFO, "End list of active device grabs\n"); PrintPassiveGrabs(); } else if (strcasecmp(msgbuf, "ungrab") == 0) UngrabAllDevices(FALSE); else if (strcasecmp(msgbuf, "clsgrb") == 0) UngrabAllDevices(TRUE); else if (strcasecmp(msgbuf, "prwins") == 0) PrintWindowTree(); } return 0; } xorg-server-1.20.8/hw/xfree86/xkb/xkbKillSrv.c0000644000175000017500000000342313640201473015740 00000000000000/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. 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 Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS 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_DIX_CONFIG_H #include #endif #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include #include "xf86.h" int XkbDDXTerminateServer(DeviceIntPtr dev, KeyCode key, XkbAction *act) { if (dev != inputInfo.keyboard) xf86ProcessActionEvent(ACTION_TERMINATE, NULL); return 0; } xorg-server-1.20.8/hw/xfree86/xkb/Makefile.in0000644000175000017500000006430513640201514015550 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/xkb ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libxorgxkb_la_LIBADD = am_libxorgxkb_la_OBJECTS = xkbVT.lo xkbPrivate.lo xkbKillSrv.lo libxorgxkb_la_OBJECTS = $(am_libxorgxkb_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/xkbKillSrv.Plo \ ./$(DEPDIR)/xkbPrivate.Plo ./$(DEPDIR)/xkbVT.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libxorgxkb_la_SOURCES) DIST_SOURCES = $(libxorgxkb_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libxorgxkb.la AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ AM_CPPFLAGS = @XORG_INCS@ libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xkb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/xkb/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libxorgxkb.la: $(libxorgxkb_la_OBJECTS) $(libxorgxkb_la_DEPENDENCIES) $(EXTRA_libxorgxkb_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libxorgxkb_la_OBJECTS) $(libxorgxkb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbKillSrv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbPrivate.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbVT.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/xkbKillSrv.Plo -rm -f ./$(DEPDIR)/xkbPrivate.Plo -rm -f ./$(DEPDIR)/xkbVT.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/xkbKillSrv.Plo -rm -f ./$(DEPDIR)/xkbPrivate.Plo -rm -f ./$(DEPDIR)/xkbVT.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/xkb/xkbVT.c0000644000175000017500000000417113640201473014704 00000000000000/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. 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 Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS 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_DIX_CONFIG_H #include #endif #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include #include "xf86.h" int XkbDDXSwitchScreen(DeviceIntPtr dev, KeyCode key, XkbAction *act) { int scrnnum = XkbSAScreen(&act->screen); if (act->screen.flags & XkbSA_SwitchApplication) { if (act->screen.flags & XkbSA_SwitchAbsolute) xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &scrnnum); else { if (scrnnum < 0) xf86ProcessActionEvent(ACTION_SWITCHSCREEN_PREV, NULL); else xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); } } return 1; } xorg-server-1.20.8/hw/xfree86/xkb/meson.build0000644000175000017500000000035013640201473015637 00000000000000srcs_xorg_xkb = [ 'xkbVT.c', 'xkbPrivate.c', 'xkbKillSrv.c', ] xorg_xkb = static_library('xorg_xkb', srcs_xorg_xkb, include_directories: [inc, xorg_inc], dependencies: common_dep, c_args: xorg_c_args, ) xorg-server-1.20.8/hw/xfree86/shadowfb/0000755000175000017500000000000013640201534014566 500000000000000xorg-server-1.20.8/hw/xfree86/shadowfb/shadowfb.h0000644000175000017500000000231713640201473016461 00000000000000 #ifndef _SHADOWFB_H #define _SHADOWFB_H #include "xf86str.h" /* * User defined callback function. Passed a pointer to the ScrnInfo struct, * the number of dirty rectangles, and a pointer to the first dirty rectangle * in the array. */ typedef void (*RefreshAreaFuncPtr) (ScrnInfoPtr, int, BoxPtr); /* * ShadowFBInit initializes the shadowfb subsystem. refreshArea is a pointer * to a user supplied callback function. This function will be called after * any operation that modifies the framebuffer. The newly dirtied rectangles * are passed to the callback. * * Returns FALSE in the event of an error. */ extern _X_EXPORT Bool ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea); /* * ShadowFBInit2 is a more featureful refinement of the original shadowfb. * ShadowFBInit2 allows you to specify two callbacks, one to be called * immediately before an operation that modifies the framebuffer, and another * to be called immediately after. * * Returns FALSE in the event of an error */ extern _X_EXPORT Bool ShadowFBInit2(ScreenPtr pScreen, RefreshAreaFuncPtr preRefreshArea, RefreshAreaFuncPtr postRefreshArea); #endif /* _SHADOWFB_H */ xorg-server-1.20.8/hw/xfree86/shadowfb/Makefile.am0000644000175000017500000000044313640201473016545 00000000000000module_LTLIBRARIES = libshadowfb.la libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadowfb_la_SOURCES = sfbmodule.c shadowfb.c libshadowfb_la_LIBADD = $(PIXMAN_LIBS) sdk_HEADERS = shadowfb.h AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) xorg-server-1.20.8/hw/xfree86/shadowfb/sfbmodule.c0000644000175000017500000000100213640201473016625 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Module.h" static XF86ModuleVersionInfo VersRec = { "shadowfb", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_ANSIC, /* Only need the ansic layer */ ABI_ANSIC_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ }; _X_EXPORT XF86ModuleData shadowfbModuleData = { &VersRec, NULL, NULL }; xorg-server-1.20.8/hw/xfree86/shadowfb/Makefile.in0000644000175000017500000007340413640201513016560 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/shadowfb ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) am__DEPENDENCIES_1 = libshadowfb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libshadowfb_la_OBJECTS = sfbmodule.lo shadowfb.lo libshadowfb_la_OBJECTS = $(am_libshadowfb_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libshadowfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libshadowfb_la_LDFLAGS) $(LDFLAGS) -o \ $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/sfbmodule.Plo \ ./$(DEPDIR)/shadowfb.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libshadowfb_la_SOURCES) DIST_SOURCES = $(libshadowfb_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libshadowfb.la libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadowfb_la_SOURCES = sfbmodule.c shadowfb.c libshadowfb_la_LIBADD = $(PIXMAN_LIBS) sdk_HEADERS = shadowfb.h AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/shadowfb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/shadowfb/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libshadowfb.la: $(libshadowfb_la_OBJECTS) $(libshadowfb_la_DEPENDENCIES) $(EXTRA_libshadowfb_la_DEPENDENCIES) $(AM_V_CCLD)$(libshadowfb_la_LINK) -rpath $(moduledir) $(libshadowfb_la_OBJECTS) $(libshadowfb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfbmodule.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadowfb.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/sfbmodule.Plo -rm -f ./$(DEPDIR)/shadowfb.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/sfbmodule.Plo -rm -f ./$(DEPDIR)/shadowfb.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-moduleLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/shadowfb/shadowfb.c0000644000175000017500000001071513640201473016455 00000000000000/* Copyright (C) 1999. The XFree86 Project Inc. Copyright 2014 Red Hat, Inc. Written by Mark Vojkovich (mvojkovi@ucsd.edu) Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com) */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "misc.h" #include "pixmapstr.h" #include "input.h" #include #include "mi.h" #include "scrnintstr.h" #include "windowstr.h" #include "gcstruct.h" #include "dixfontstr.h" #include #include "xf86.h" #include "xf86str.h" #include "shadowfb.h" #include "picturestr.h" static Bool ShadowCloseScreen(ScreenPtr pScreen); static Bool ShadowCreateRootWindow(WindowPtr pWin); typedef struct { ScrnInfoPtr pScrn; RefreshAreaFuncPtr preRefresh; RefreshAreaFuncPtr postRefresh; CloseScreenProcPtr CloseScreen; CreateWindowProcPtr CreateWindow; } ShadowScreenRec, *ShadowScreenPtr; static DevPrivateKeyRec ShadowScreenKeyRec; static ShadowScreenPtr shadowfbGetScreenPrivate(ScreenPtr pScreen) { return dixLookupPrivate(&(pScreen)->devPrivates, &ShadowScreenKeyRec); } Bool ShadowFBInit2(ScreenPtr pScreen, RefreshAreaFuncPtr preRefreshArea, RefreshAreaFuncPtr postRefreshArea) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv; if (!preRefreshArea && !postRefreshArea) return FALSE; if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!(pPriv = (ShadowScreenPtr) malloc(sizeof(ShadowScreenRec)))) return FALSE; dixSetPrivate(&pScreen->devPrivates, &ShadowScreenKeyRec, pPriv); pPriv->pScrn = pScrn; pPriv->preRefresh = preRefreshArea; pPriv->postRefresh = postRefreshArea; pPriv->CloseScreen = pScreen->CloseScreen; pPriv->CreateWindow = pScreen->CreateWindow; pScreen->CloseScreen = ShadowCloseScreen; pScreen->CreateWindow = ShadowCreateRootWindow; return TRUE; } Bool ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea) { return ShadowFBInit2(pScreen, NULL, refreshArea); } /* * Note that we don't do DamageEmpty, or indeed look at the region inside the * DamagePtr at all. This is an optimization, believe it or not. The * incoming RegionPtr is the new damage, and if we were to empty the region * miext/damage would just have to waste time reallocating and re-unioning * it every time, whereas if we leave it around the union gets fast-pathed * away. */ static void shadowfbReportPre(DamagePtr damage, RegionPtr reg, void *closure) { ShadowScreenPtr pPriv = closure; if (!pPriv->pScrn->vtSema) return; pPriv->preRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg)); } static void shadowfbReportPost(DamagePtr damage, RegionPtr reg, void *closure) { ShadowScreenPtr pPriv = closure; if (!pPriv->pScrn->vtSema) return; pPriv->postRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg)); } static Bool ShadowCreateRootWindow(WindowPtr pWin) { Bool ret; ScreenPtr pScreen = pWin->drawable.pScreen; ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen); /* paranoia */ if (pWin != pScreen->root) ErrorF("ShadowCreateRootWindow called unexpectedly\n"); /* call down, but don't hook ourselves back in; we know the first time * we're called it's for the root window. */ pScreen->CreateWindow = pPriv->CreateWindow; ret = pScreen->CreateWindow(pWin); /* this might look like it leaks, but the damage code reaps listeners * when their drawable disappears. */ if (ret) { DamagePtr damage; if (pPriv->preRefresh) { damage = DamageCreate(shadowfbReportPre, NULL, DamageReportRawRegion, TRUE, pScreen, pPriv); DamageRegister(&pWin->drawable, damage); } if (pPriv->postRefresh) { damage = DamageCreate(shadowfbReportPost, NULL, DamageReportRawRegion, TRUE, pScreen, pPriv); DamageSetReportAfterOp(damage, TRUE); DamageRegister(&pWin->drawable, damage); } } return ret; } static Bool ShadowCloseScreen(ScreenPtr pScreen) { ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen); pScreen->CloseScreen = pPriv->CloseScreen; free(pPriv); return (*pScreen->CloseScreen) (pScreen); } xorg-server-1.20.8/hw/xfree86/shadowfb/meson.build0000644000175000017500000000043213640201473016651 00000000000000shared_module('shadowfb', [ 'shadowfb.c', 'sfbmodule.c'], include_directories: [ inc, xorg_inc ], dependencies: common_dep, c_args: xorg_c_args, install: true, install_dir: module_dir, link_with: e, ) install_data('shadowfb.h', install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/doc/0000755000175000017500000000000013640201534013536 500000000000000xorg-server-1.20.8/hw/xfree86/doc/exa-driver.txt0000644000175000017500000000601313640201473016267 00000000000000Adding EXA support to your X.Org video driver --------------------------------------------- EXA (for EXcellent Architecture or Ex-kaa aXeleration Architecture or whatever) aims to extend the life of the venerable XFree86 video drivers by introducing a new set of acceleration hooks that efficiently accelerate the X Render extension, including solid fills, blits within screen memory and to and from system memory, and Porter-Duff compositing and transform operations. Configuration ------------- Some drivers implement a per-instance useEXA flag to track whether EXA is active or not. Setting the flag can be done in the driver's Options parsing routine. Loading EXA ------------ EXA drivers in the XFree86 DDX should use the loadable module loader to load the EXA core. Careful versioning allows the EXA API to be extended without breaking the ABI for older versions of drivers. Example code for loading EXA: static const char *exaSymbols[] = { "exaDriverAlloc", "exaDriverInit", "exaDriverFini", "exaOffscreenAlloc", "exaOffscreenFree", "exaGetPixmapOffset", "exaGetPixmapPitch", "exaGetPixmapSize", "exaMarkSync", "exaWaitSync", NULL }; if (info->useEXA) { info->exaReq.majorversion = 2; info->exaReq.minorversion = 0; if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &info->exaReq, &errmaj, &errmin)) { LoaderErrorMsg(NULL, "exa", errmaj, errmin); return FALSE; } xf86LoaderReqSymLists(exaSymbols, NULL); } EXA is then initialized using exaDriverAlloc and exaDriverInit. See doxygen documentation for getting started there. Further documentation ------------ The EXA driver interface and public API is documented using doxygen in xserver/xorg/exa/. To build the documentation, run: doxygen -g doxygen Doxyfile The resulting documentation will appear an html/index.html under the current directory. EXA initialization ------------------ Your driver's AccelInit routine must initialize an ExaDriverRec structure if EXA support is enabled, with appropriate error handling (i.e. NoAccel and NoXvideo should be set to true if EXA fails to initialize for whatever reason). The AccelInit routine also needs to make sure that there's enough offscreen memory for certain operations to function, like Xvideo, which should advertise a maximum size no larger than can be dealt with given the amount of offscreen memory available. EXA and Xv ---------- Video support becomes easier with EXA since AllocateFBMemory can use exaOffscreenAlloc directly, freeing a previous area if necessary and allocating a new one. Likewise, FreeFBMemory can call exaOffscreenFree. EXA teardown ------------ At screen close time, EXA drivers should call exaDriverFini with their screen pointer, free their EXADriver structure, and do any other necessary teardown. EXA misc. --------- In many drivers, DGA support will need to be changed to be aware of the new EXA support. Send updates and corrections to Jesse Barnes or just check them in if you have permission. xorg-server-1.20.8/hw/xfree86/doc/Makefile.am0000644000175000017500000000046013640201473015514 00000000000000 if ENABLE_DEVEL_DOCS if HAVE_XMLTO # Main DocBook/XML files (DOCTYPE book) docbook = ddxDesign.xml # Generate DocBook/XML output formats with or without stylesheets include $(top_srcdir)/devbook.am endif HAVE_XMLTO endif ENABLE_DEVEL_DOCS EXTRA_DIST = \ Registry \ exa-driver.txt \ README.modes xorg-server-1.20.8/hw/xfree86/doc/Registry0000644000175000017500000002657513640201473015232 00000000000000This is the XFree86 driver/module registry. To avoid name space clashes and to maintain some consistency between drivers the important name spaces are maintained here. 1. Module Names. Each module is required to have a unique name. Registered names are: GLcore acecad afb apm ark ati atimisc bitmap bt8xx calcomp cfb cfb16 cfb24 cfb32 chips cirrus citron cyrix dbe ddc digitaledge dmc dri drm dynapro elo2300 elographics extmod fb fbdev fbdevhw fi12x6 freetype glide glint glx hyperpen i128 i2c i740 i810 imstt int10 joystick keyboard layer magellan magictouch mfb mga microtouch mouse msp34xx mutouch neomagic newport nv pcidata penmount pex5 r128 radeon rac ramdac record rendition s3 s3virge savage shadow shadowfb siliconmotion sis spaceorb speedo summa sunbw2 suncg14 suncg3 suncg6 sunffb sunleo suntcx tdfx tga trident tseng type1 v4l vbe vesa vga vgahw vmware void wacom xaa xf1bpp xf24_32bpp xf4bpp xf8_16bpp xf8_32bpp xf8_32wid xie xtrap xtt 2. External Module Object Symbols. Each module is required to use a unique prefix or prefixes for all of its externally visible symbols. They should be unique without regard to case. Registered prefixes are: ati bt8xx cfb chips fi12x6 glide glint mfb mga msp34xx neo permedia tseng vga vgahw vmware xaa xf1bpp xf4bpp 3. Chipset Names. Each video driver is required to use a unique set of chipset names. Case, white space and underscore characters are ignored when comparing chipset names. All names listed here are in lower case with all white space and underscores removed. Registered chipset names are: ati ativga ct64200 ct64300 ct65520 ct65525 ct65530 ct65535 ct65540 ct65545 ct65546 ct65548 ct65550 ct65554 ct65555 ct68554 ct69000 et4000 et4000w32 et4000w32i et4000w32p et6000 et6100 generic ibmvga ibm8514 mach32 mach64 mach8 mga2064w mga1064sg mga2164w mga2164wagp neo2070 neo2090 neo2093 neo2097 neo2160 neo2200 tipm2 vgawonder voodoo 4. Option Names. Option names and their usage should be consistent between drivers. Case, white space and underscore characters are ignored when comparing option names. The prefix "no" may be added or removed from boolean option names. All names listed here are in their preferred user-visible form. Some registered option names are: Types are: B = boolean, O = set/unset (no value), I = integer, S = string, A = optional string, F = floating point number Q = frequency Scopes are: F = global flags, V = video driver, C = common (per screen), I = input drivers, X = XAA, Xv = Xv extension, M = misc. Names currently in use: Name Type Scope Description ---------------------------------------------------------------------------- AllowMouseOpenFail B F ignore mouse dev open failure AllowNonLocalModInDev B F allow non-local mod of input devs AllowNonLocalXvidtune B F allow non-local VidMode connections BlankTime I F Screen saver timeout (min) DisableModInDev B F disallow changing input devs DisableVidModeExtension B F disable VidMode extension DontVTSwitch B F disable Ctrl-Alt-Fn DontZap B F disable Ctrl-Alt-BS sequence DontZoom B F disable Ctrl-Alt-+/- NoTrapSignals B F don't trap signals OffTime I F Time before DPMS off mode active (min) PciProbe1 O F use PCI probe algorithm 1 PciProbe2 O F use PCI probe algorithm 2 PciForceConfig1 O F force PCI config type 1 PciForceConfig2 O F force PCI config type 2 Pixmap I F depth 24 pixmap size (24 or 32) StandbyTime I F Time before DPMS standby active (min) SuspendTime I F Time before DPMS suspend mode active (min) BackingStore B C Enable backing store DDC B C Enable/disable DDC DDC1 B C Enable/disable DDC1 DDC2 B C Enable/disable DDC2 DPMS O C Enable DPMS BaudRate I I Serial port baud rate ButtonNumber I I Button number (for touch screen?) ButtonThreshold I I ?? ClearDTR O I Clear serial port DTR ClearRTS O I Clear serial port RTS DataBits I I Serial port data bits DemandLoad O I ?? Device S I Device file name DeviceName S I Input device name FlowControl S I Serial flow control ("xon", "none") Floating B I Device initialised as floating HistorySize I I ?? MaxX I I Maximum X coordinate MaxY I I Maximum Y coordinate MinX I I Minimum X coordinate MinY I I Minimum Y coordinate Parity S I Serial port parity ("odd", "even", "none") ReportDelay I I ?? ReportingMode S I may be "raw" or "scaled" ScreenNumber I I Screen number (for touch screen) SendCoreEvents B I Send core events StopBits I I Serial port stop bits SwapXY B I Swap the X and Y axes UntouchDelay I I ?? Vmin I I Tty VMIN Vtime I I Tty VTIME 18BitBus B V ?? 8Plus16 B V Enable depth 8 + depth 16 with overlay 8Plus24 B V Enable depth 8 + depth 24 with overlay BlockWrite B V Enable/disable block write ColorKey I V Set the color key for overlay modes CompositeSync B V Composite sync CRTDisplay B V Force display on CRT, not LCD CRTScreen B V Display on CRT, not LCD (Obsolete) EarlyRasPrecharge O V Early RAS pre-charge FastDRAM O V Fast DRAM FifoAggressive O V Aggressive FIFO setting FifoConservative O V Conservative FIFO setting FifoModerate O V Moderate FIFO setting FireGL3000 B V Card is Diamond FireGL3000 FixPanelSize B V ?? FPClock8 Q V Flat panel clock for 8bpp fb (MHz) FPClock16 Q V Flat panel clock for 16bpp fb (MHz) FPClock24 Q V Flat panel clock for 24bpp fb (MHz) FPClock32 Q V Flat panel clock for 32bpp fb (MHz) FPMVRAM O V Fast page mode VRAM FramebufferWC B V Enable/disable WC for the framebuffer GlideDevice I V Selects which Voodoo board to use HiBitHigh O V High clock bit default to set HiBitLow O V High clock bit default to cleared HWClocks B V Enable/disable HW clocks HWCursor B V Enable/disable HW cursor LateRasPrecharge O V Late RAS pre-charge Legend O V Card is Legend ET4000 LCDCenter B V Enable/disable centering for LCD displays Linear B V Enable/disable linear framebuffer MCLK Q V Specify the current MCLK value (MHz) MedDRAM B V Medium speed DRAM MemCfg1 I V ?? MemCfg2 I V ?? MGASDRAM B V Mga card has SDRAM MMIO B V Enable/disable memory mapped I/O MMIOCache B V Enable/Disable MMIO cache MuxThreshold I V Multiplexing threshold (kHz) NoAccel B V Disable/enable acceleration NoClockChip B V ?? NoStretch B V Disable/enable stretching for LCD displays OnAtExit B V Leave video signal on when exiting server OverclockMem B V Enable memory overclocking Overlay A V Enable multi-depth/overlay. An optional string "M,N" may be specified, where M, N are the depths. PanelDisplay B V Force display on LCD PciBurst B V Enable/disable PCI burst mode PciRetry B V Enable/disable PCI retries ProbeClocks B V Force probe for non-programmable clocks ReferenceClock Q V Clock generator reference frequency RGBbits I V Number of significant bits per rgb Rotate S V Rotate the virtual display (CW or CCW) SetLCDClk Q V Set LCD clock (MHz) SetMclk Q V Set Memory Clock (MHz) ShadowFB B V Enable shadow framebuffer layer ShowCache B V Enable viewing of offscreen memory ShowOverscan O V Set the overscan area to a visible colour SlowDRAM O V Slow DRAM SlowEDODRAM O V Slow EDO DRAM STN B V STN screen type (??) SWCursor B V Enable/disable SW cursor SuspendHack B V ?? SyncOnGreen B V Enable/disable sync on green TurboQueue B V Enable/disable turbo queue UseFBDev B V Use the fbdev driver interface UseModeLine B V Use Modeline (??) W32Interleave B V ?? Buffers I Xv Number of buffers Device S Xv Device file name Expose B Xv Disable occlusion clipping (see DESIGN) FramesPerSec I Xv Max. refresh frequency XAA options. All are of type "O" and scope "X", and are self-explanatory XaaNoColor8x8PatternFillRect XaaNoColor8x8PatternFillTrap XaaNoCPUToScreenColorExpandFill XaaNoDashedBresenhamLine XaaNoDashedTwoPointLine XaaNoScreenToScreenCopy XaaNoImageReadRect XaaNoImageWriteRect XaaNoMono8x8PatternFillRect XaaNoMono8x8PatternFillTrap XaaNoOffscreenPixmaps XaaNoPixmapCache XaaNoScanlineCPUToScreenColorExpandFill XaaNoScanlineImageWriteRect XaaNoScreenToScreenColorExpandFill XaaNoSolidBresenhamLine XaaNoSolidFillRect XaaNoSolidFillTrap XaaNoSolidHorVertLine XaaNoSolidTwoPointLine Names used in previous versions: 16Clocks 8Clocks ClkDiv2 EDO VRAM ExternDisp ExtFramBuf FastVRAM FavorBitBlt InternDisp NoBitBlt NoFontCache NoImageBlt NoMemAccess NoPciDisconnect NoPixmapCache NoProgramClocks NoSplitXfer OverrideBIOS OverrideValidateMode ProgLcdModeRegs ProgLcdModeStretch SlowDRAMrefresh SlowVRAM SwapHiBit 5. Ramdac Names. Ramdac names should be consistent between drivers. Case, white space and underscore characters are ignored when comparing ramdac names. All names listed here are in lower case with all white space and underscores removed. 6. Clock Chip Names. Clock chip names should be consistent between drivers. Case, white space and underscore characters are ignored when comparing clock chip names. All names listed here are in lower case with all white space and underscores removed. $XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $ xorg-server-1.20.8/hw/xfree86/doc/README.modes0000644000175000017500000004077413640201473015462 00000000000000 Multi-monitor Mode Setting APIs Keith Packard, SaveScreen and the core X screen saver will be implemented by disabling outputs and crtcs using their dpms functions. void xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) Pass this function to xf86DPMSInit and all DPMS mode switching will be managed by using the dpms functions provided by the Outputs and CRTCs. Bool xf86CrtcScreenInit (ScreenPtr screen) This function completes the screen initialization process for the crtc and output objects. Call it near the end of the ScreenInit function, after the frame buffer and acceleration layers have been added. 3.3 EnterVT functions Functions used during EnterVT, or whenever the current configuration needs to be applied to the hardware. Bool xf86SetDesiredModes (ScrnInfoPtr scrn) xf86InitialConfiguration selects the desired configuration at PreInit time; when the server finally hits ScreenInit, xf86SetDesiredModes is used by the driver to take that configuration and apply it to the hardware. In addition, successful mode selection at other times updates the configuration that will be used by this function, so LeaveVT/EnterVT pairs can simply invoke this and return to the previous configuration. 3.4 SwitchMode functions Functions called from the pScrn->SwitchMode hook, which is used by the XFree86-VidModeExtension and the keypad mode switch commands. Bool xf86SetSingleMode (ScrnInfoPtr scrn, DisplayModePtr desired, Rotation rotation) This function applies the specified mode to all active outputs. Which is to say, it picks reasonable modes for all active outputs, attempting to get the screen to the specified size while not breaking anything that is currently working. 3.7 get_modes functions Functions called during output->get_modes to help build lists of modes xf86MonPtr xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) This returns the EDID data structure for the 'output' using the I2C bus 'pDDCBus'. This has no effect on 'output' itself. void xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon) Once the EDID data has been fetched, this call applies the EDID data to the output object, setting the physical size and also various properties, like the DDC root window property (when output is the 'compat' output), and the RandR 1.2 EDID output properties. DisplayModePtr xf86OutputGetEDIDModes (xf86OutputPtr output) Given an EDID data structure, this function computes a list of suitable modes. This function also applies a sequence of 'quirks' during this process so that the returned modes may not actually match the mode data present in the EDID data. 3.6 Other functions These remaining functions in the API can be used by the driver as needed. Bool xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y) Applies a mode to a CRTC. All of the outputs which are currently using the specified CRTC are included in the mode setting process. 'x' and 'y' are the offset within the frame buffer that the crtc is placed at. No checking is done in this function to ensure that the mode is usable by the active outputs. void xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY) This discards the mode lists for all outputs, re-detects monitor presence and then acquires new mode lists for all monitors which are not disconnected. Monitor configuration data is used to modify the mode lists returned by the outputs. 'maxX' and 'maxY' limit the maximum size modes that will be returned. void xf86SetScrnInfoModes (ScrnInfoPtr pScrn) This copies the 'compat' output mode list into the pScrn modes list which is used by the XFree86-VidModeExtension and the keypad mode switching operations. The current 'desired' mode for the CRTC associated with the 'compat' output is placed first in this list to indicate the current mode. Usually, the driver won't need to call this function as xf86InitialConfiguration will do so automatically, as well as any RandR functions which reprobe for modes. However, if the driver reprobes for modes at other times using xf86ProbeOutputModes, this function needs to be called. Bool xf86DiDGAReInit (ScreenPtr pScreen) This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output mode list to the set of modes advertised by the DGA extension; it needs to be called whenever xf86ProbeOutputModes is invoked. void xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) After any sequence of calls using xf86CrtcSetMode, this function cleans up any leftover Output and CRTC objects by disabling them, saving power. It is safe to call this whenever the server is running as it only disables objects which are not currently in use. 4. CRTC operations 4.1 CRTC functions These functions provide an abstract interface for the CRTC object; most manipulation of the CRTC object is done through these functions. void crtc->funcs->dpms (xf86CrtcPtr crtc, int mode) Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or DPMSModeOn. This requests that the crtc go to the specified power state. When changing power states, the output dpms functions are invoked before the crtc dpms functions. void crtc->funcs->save (xf86CrtcPtr crtc) void crtc->funcs->restore (xf86CrtcPtr crtc) Preserve/restore any register contents related to the CRTC. These are strictly a convenience for the driver writer; if the existing driver has fully operation save/restore functions, you need not place any additional code here. In particular, the server itself never uses this function. Bool crtc->funcs->lock (xf86CrtcPtr crtc) void crtc->funcs->unlock (xf86CrtcPtr crtc) These functions are invoked around mode setting operations; the intent is that DRI locking be done here to prevent DRI applications from manipulating the hardware while the server is busy changing the output configuration. If the lock function returns FALSE, the unlock function will not be invoked. Bool crtc->funcs->mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode) This call gives the CRTC a chance to see what mode will be set and to comment on the mode by changing 'adjusted_mode' as needed. This function shall not modify the state of the crtc hardware at all. If the CRTC cannot accept this mode, this function may return FALSE. void crtc->funcs->prepare (xf86CrtcPtr crtc) This call is made just before the mode is set to make the hardware ready for the operation. A usual function to perform here is to disable the crtc so that mode setting can occur with clocks turned off and outputs deactivated. void crtc->funcs->mode_set (xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode) This function applies the specified mode (possibly adjusted by the CRTC and/or Outputs). void crtc->funcs->commit (xf86CrtcPtr crtc) Once the mode has been applied to the CRTC and Outputs, this function is invoked to let the hardware turn things back on. void crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size) This function adjusts the gamma ramps for the specified crtc. void * crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height) This function allocates frame buffer space for a shadow frame buffer. When allocated, the crtc must scan from the shadow instead of the main frame buffer. This is used for rotation. The address returned is passed to the shadow_create function. This function should return NULL on failure. PixmapPtr crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data, int width, int height) This function creates a pixmap object that will be used as a shadow of the main frame buffer for CRTCs which are rotated or reflected. 'data' is the value returned by shadow_allocate. void crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data) Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap was not created, but 'data' may still be non-NULL indicating that the shadow had been allocated. void crtc->funcs->destroy (xf86CrtcPtr crtc) When a CRTC is destroyed (which only happens in error cases), this function can clean up any driver-specific data. 4.2 CRTC fields The CRTC object is not opaque; there are several fields of interest to the driver writer. struct _xf86Crtc { /** * Associated ScrnInfo */ ScrnInfoPtr scrn; /** * Active state of this CRTC * * Set when this CRTC is driving one or more outputs */ Bool enabled; /** Track whether cursor is within CRTC range */ Bool cursorInRange; /** Track state of cursor associated with this CRTC */ Bool cursorShown; /** * 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 }; 5. Output functions. 6. Configuration Because the configuration file syntax is fixed, this was done by creating new "Driver" section options that hook specific outputs to specific "Monitor" sections in the file. The option: section of the form: Option "monitor-VGA" "My VGA Monitor" connects the VGA output of this driver to the "Monitor" section with Identifier "My VGA Monitor". All of the usual monitor options can now be placed in that "Monitor" section and will be applied to the VGA output configuration. xorg-server-1.20.8/hw/xfree86/doc/Makefile.in0000644000175000017500000006002713640201512015524 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Generate output formats for a single DocBook/XML with/without chapters # # Variables set by the calling Makefile: # noinst_DATA: developers docs are not installed # docbook: the main DocBook/XML file, no chapters, appendix or image files # chapters: all files pulled in by an XInclude statement and images. # # # This makefile is intended for Developers Documentation and is not installed. # Do not use for Users docs or Specs which need to be installed and require olink support # Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393 # for an explanation on documents classification. # VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@am__append_1 = $(docbook:.xml=.html) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TEXT_TRUE@@HAVE_XMLTO_TRUE@am__append_2 = $(docbook:.xml=.txt) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@am__append_3 = $(docbook:.xml=.pdf) $(docbook:.xml=.ps) subdir = hw/xfree86/doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_noinst_DATA_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__dist_noinst_DATA_DIST = ddxDesign.xml DATA = $(dist_noinst_DATA) $(noinst_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/devbook.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Main DocBook/XML files (DOCTYPE book) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@docbook = ddxDesign.xml # Developers documnetation is not installed @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@noinst_DATA = \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@ $(am__append_1) \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@ $(am__append_2) \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@ $(am__append_3) # DocBook/XML file with chapters, appendix and images it includes @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@dist_noinst_DATA = $(docbook) $(chapters) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@FILTER_XMLTO = $(SHELL) $(top_srcdir)/doc/filter-xmlto.sh $(XMLTO) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@XMLTO_HTML_FLAGS = \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ --searchpath "$(XORG_SGML_PATH)/X11" \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ --searchpath "$(abs_top_builddir)" \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@XMLTO_FO_FLAGS = \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ --searchpath "$(XORG_SGML_PATH)/X11" \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ --searchpath "$(abs_top_builddir)" \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ --stringparam img.src.path=$(abs_builddir)/ \ @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl @ENABLE_DEVEL_DOCS_TRUE@@HAVE_XMLTO_TRUE@CLEANFILES = $(noinst_DATA) # Generate DocBook/XML output formats with or without stylesheets EXTRA_DIST = \ Registry \ exa-driver.txt \ README.modes all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/devbook.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/devbook.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@%.html: %.xml $(chapters) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ $(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $< @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TEXT_TRUE@@HAVE_XMLTO_TRUE@%.txt: %.xml $(chapters) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TEXT_TRUE@@HAVE_XMLTO_TRUE@ $(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_HTML_FLAGS) txt $< @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@%.pdf: %.xml $(chapters) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ $(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $< @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@%.ps: %.xml $(chapters) @ENABLE_DEVEL_DOCS_TRUE@@HAVE_FOP_TRUE@@HAVE_STYLESHEETS_TRUE@@HAVE_XMLTO_TRUE@ $(AM_V_GEN)$(FILTER_XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $< # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/doc/ddxDesign.xml0000644000175000017500000112632213640201473016122 00000000000000 %xorg-defs; %defs; Device"> Monitor"> Display"> InputDevice"> Screen"> ServerLayout"> Driver"> Module"> Identifier"> ServerFlags"> ] >
XFree86 DDX Design The XFree86 Project The X.Org Foundation JimGettys Updates for X11R6.7 &xserver.reldate; X Version 11, Release &fullrelvers; X Server Version &xserver.version; This document describes software undergoing continual evolution, and the interfaces described here are subject to change without notice. This document is intended to cover the interfaces as found in the xorg-server-&xserver.version; release, but is probably not completely in sync with the code base. Preface This document was originally the design spec for the DDX layer of the XFree86 4.0 X server. The X.Org Foundation adopted the XFree86 4.4rc2 version of that server as the basis of the Xorg server project, and has evolved the XFree86 DDX layer greatly since forking. This document thus covers only the current implementation of the XFree86 DDX as found in the Xorg server &xserver.version; release, and no longer matches the XFree86 server itself. The XFree86 Project's broad design principles for XFree86 4.0 were: keep it reasonable We cannot rewrite the complete server We don't want to re-invent the wheel keep it modular As many things as possible should go into modules The basic loader binary should be minimal A clean design with well defined layering is important DDX specific global variables are a nono The structure should be flexible enough to allow future extensions The structure should minimize duplication of common code keep important features in mind multiple screens, including multiple instances of drivers mixing different color depths and visuals on different and ideally even on the same screen better control of the PCI device used better config file parser get rid of all VGA compatibility assumptions While the XFree86 project had a goal of avoiding changes to the DIX layer unless they found major deficiencies there, to avoid divergence from the X.Org sample implementation they were integrating changes from, the X.Org developers now maintain both sides, and make changes where they are most appropriate. This document concentrates on the XFree86 DDX layer used in the Xorg server itself (the code found in hw/xfree86 in the source tree), and developers will also want to refer to the Xserver-spec documentation that covers the DIX layer routines common to all the X servers in the sample implementation. The xorg.conf File The xorg.conf file format is based on the XF86Config format from XFree86 4.4, which is in turn similar to the old XFree86 3.x XF86Config format, with the following changes: &k.device; section The &k.device; sections are similar to what they used to be, and describe hardware-specific information for a single video card. &k.device; Some new keywords are added: Driver "drivername" Specifies the name of the driver to be used for the card. This is mandatory. BusID "busslot" Specifies uniquely the location of the card on the bus. The purpose is to identify particular cards in a multi-headed configuration. The format of the argument is intentionally vague, and may be architecture dependent. For a PCI bus, it is something like "bus@domain:slot:func". The "@domain" part can be left out for domain 0. A &k.device; section is considered active if there is a reference to it in an active &k.screen; section. &k.screen; section The &k.screen; sections are similar to what they used to be. They no longer have a &k.driver; keyword, but an &k.identifier; keyword is added. (The &k.driver; keyword may be accepted in place of the &k.identifier; keyword for compatibility purposes.) The identifier can be used to identify which screen is to be active when multiple &k.screen; sections are present. It is possible to specify the active screen from the command line. A default is chosen in the absence of one being specified. A &k.screen; section is considered active if there is a reference to it either from the command line, or from an active &k.serverlayout; section. &k.inputdevice; section The &k.inputdevice; section is a new section that describes configuration information for input devices. It replaces the old Keyboard, Pointer and XInput sections. Like the &k.device; section, it has two mandatory keywords: &k.identifier; and &k.driver;. For compatibility purposes the old Keyboard and Pointer sections are converted by the parser into &k.inputdevice; sections as follows: Keyboard &k.identifier; "Implicit Core Keyboard" &k.driver; "kbd" Pointer &k.identifier; "Implicit Core Pointer" &k.driver; "mouse" An &k.inputdevice; section is considered active if there is a reference to it in an active &k.serverlayout; section. An &k.inputdevice; section may also be referenced implicitly if there is no &k.serverlayout; section, if the command line options is used, or if the &k.serverlayout; section doesn't reference any &k.inputdevice; sections. In this case, the first sections with drivers "kbd" and "mouse" are used as the core keyboard and pointer respectively. &k.serverlayout; section The &k.serverlayout; section is a new section that is used to identify which &k.screen; sections are to be used in a multi-headed configuration, and the relative layout of those screens. It also identifies which &k.inputdevice; sections are to be used. Each &k.serverlayout; section has an identifier, a list of &k.screen; section identifiers, and a list of &k.inputdevice; section identifiers. &k.serverflags; options may also be included in a &k.serverlayout; section, making it possible to override the global values in the &k.serverflags; section. A &k.serverlayout; section can be made active by being referenced on the command line. In the absence of this, a default will be chosen (the first one found). The screen names may optionally be followed by a number specifying the preferred screen number, and optionally by information specifying the physical positioning of the screen, either in absolute terms or relative to another screen (or screens). When no screen number is specified, they are numbered according to the order in which they are listed. The old (now obsolete) method of providing the positioning information is to give the names of the four adjacent screens. The order of these is top, bottom, left, right. Here is an example of a &k.serverlayout; section for two screens using the old method, with the second located to the right of the first: Section "ServerLayout" Identifier "Main Layout" Screen 0 "Screen 1" "" "" "" "Screen 2" Screen 1 "Screen 2" Screen "Screen 3" EndSection The preferred way of specifying the layout is to explicitly specify the screen's location in absolute terms or relative to another screen. In the absolute case, the upper left corner's coordinates are given after the Absolute keyword. If the coordinates are omitted, a value of (0,0) is assumed. An example of absolute positioning follows: Section "ServerLayout" Identifier "Main Layout" Screen 0 "Screen 1" Absolute 0 0 Screen 1 "Screen 2" Absolute 1024 0 Screen "Screen 3" Absolute 2048 0 EndSection In the relative case, the position is specified by either using one of the following keywords followed by the name of the reference screen: RightOf LeftOf Above Below Relative When the Relative keyword is used, the reference screen name is followed by the coordinates of the new screen's origin relative to reference screen. The following example shows how to use some of the relative positioning options. Section "ServerLayout" Identifier "Main Layout" Screen 0 "Screen 1" Screen 1 "Screen 2" RightOf "Screen 1" Screen "Screen 3" Relative "Screen 1" 2048 0 EndSection Options Options are used more extensively. They may appear in most sections now. Options related to drivers can be present in the &k.screen;, &k.device; and &k.monitor; sections and the &k.display; subsections. The order of precedence is &k.display;, &k.screen;, &k.monitor;, &k.device;. Options have been extended to allow an optional value to be specified in addition to the option name. For more details about options, see the Options section for details. Driver Interface The driver interface consists of a minimal set of entry points that are required based on the external events that the driver must react to. No non-essential structure is imposed on the way they are used beyond that. This is a significant difference compared with the old design. The entry points for drawing operations are already taken care of by the framebuffer code. Extensions and enhancements to framebuffer code are outside the scope of this document. This approach to the driver interface provides good flexibility, but does increase the complexity of drivers. To help address this, the XFree86 common layer provides a set of helper functions to take care of things that most drivers need. These helpers help minimise the amount of code duplication between drivers. The use of helper functions by drivers is however optional, though encouraged. The basic philosophy behind the helper functions is that they should be useful to many drivers, that they should balance this against the complexity of their interface. It is inevitable that some drivers may find some helpers unsuitable and need to provide their own code. Events that a driver needs to react to are: ScreenInit An initialisation function is called from the DIX layer for each screen at the start of each server generation. Enter VT The server takes control of the console. Leave VT The server releases control of the console. Mode Switch Change video mode. ViewPort change Change the origin of the physical view port. ScreenSaver state change Screen saver activation/deactivation. CloseScreen A close screen function is called from the DIX layer for each screen at the end of each server generation. In addition to these events, the following functions are required by the XFree86 common layer: Identify Print a driver identifying message. Probe This is how a driver identifies if there is any hardware present that it knows how to drive. PreInit Process information from the xorg.conf file, determine the full characteristics of the hardware, and determine if a valid configuration is present. The VidMode extension also requires: ValidMode Identify if a new mode is usable with the current configuration. The PreInit function (and/or helpers it calls) may also make use of the ValidMode function or something similar. Other extensions may require other entry points. The drivers will inform the common layer of these in such cases. Resource Access Control Introduction Graphics devices are accessed through ranges in I/O or memory space. While most modern graphics devices allow relocation of such ranges many of them still require the use of well established interfaces such as VGA memory and IO ranges or 8514/A IO ranges. With modern buses (like PCI) it is possible for multiple video devices to share access to these resources. The RAC (Resource Access Control) subsystem provides a mechanism for this. Terms and Definitions Bus Bus is ambiguous as it is used for different things: it may refer to physical incompatible extension connectors in a computer system. The RAC system knows two such systems: The ISA bus and the PCI bus. (On the software level EISA, MCA and VL buses are currently treated like ISA buses). Bus may also refer to logically different entities on a single bus system which are connected via bridges. A PCI system may have several distinct PCI buses connecting each other by PCI-PCI bridges or to the host CPU by HOST-PCI bridges. Systems that host more than one bus system link these together using bridges. Bridges are a concern to RAC as they might block or pass specific resources. PCI-PCI bridges may be set up to pass VGA resources to the secondary bus. PCI-ISA buses pass any resources not decoded on the primary PCI bus to the ISA bus. This way VGA resources (although exclusive on the ISA bus) can be shared by ISA and PCI cards. Currently HOST-PCI bridges are not yet handled by RAC as they require specific drivers. Entity The smallest independently addressable unit on a system bus is referred to as an entity. So far we know ISA and PCI entities. PCI entities can be located on the PCI bus by an unique ID consisting of the bus, card and function number. Resource Resource refers to a range of memory or I/O addresses an entity can decode. If a device is capable of disabling this decoding the resource is called sharable. For PCI devices a generic method is provided to control resource decoding. Other devices will have to provide a device specific function to control decoding. If the entity is capable of decoding this range at a different location this resource is considered relocatable. Resources which start at a specific address and occupy a single continuous range are called block resources. Alternatively resource addresses can be decoded in a way that they satisfy the conditions: address & mask == base and base & mask == base Resources addressed in such a way are called sparse resources. Server States The resource access control system knows two server states: the SETUP and the OPERATING state. The SETUP state is entered whenever a mode change takes place or the server exits or does VT switching. During this state all entity resources are under resource access control. During OPERATING state only those entities are controlled which actually have shared resources that conflict with others. Control Flow in the Server and Mandatory Driver Functions At the start of each server generation, main() (dix/main.c) calls the DDX function InitOutput(). This is the first place that the DDX gets control. InitOutput() is expected to fill in the global screenInfo struct, and one screenInfo.screen[] entry for each screen present. Here is what InitOutput() does: Parse the xorg.conf file This is done at the start of the first server generation only. The xorg.conf file is read in full, and the resulting information stored in data structures. None of the parsed information is processed at this point. The parser data structures are opaque to the video drivers and to most of the common layer code. The entire file is parsed first to remove any section ordering requirements. Initial processing of parsed information and command line options This is done at the start of the first server generation only. The initial processing is to determine paths like the ModulePath, etc, and to determine which &k.serverlayout;, &k.screen; and &k.device; sections are active. Enable port I/O access Port I/O access is controlled from the XFree86 common layer, and is all or nothing. It is enabled prior to calling driver probes, at the start of subsequent server generations, and when VT switching back to the Xserver. It is disabled at the end of server generations, and when VT switching away from the Xserver. The implementation details of this may vary on different platforms. General bus probe This is done at the start of the first server generation only. In the case of ix86 machines, this will be a general PCI probe. The full information obtained here will be available to the drivers. This information persists for the life of the Xserver. In the PCI case, the PCI information for all video cards found is available by calling xf86GetPciVideoInfo().
pciVideoPtr *xf86GetPciVideoInfo(void);
returns a pointer to a list of pointers to pciVideoRec entries, of which there is one for each detected PCI video card. The list is terminated with a NULL pointer. If no PCI video cards were detected, the return value is NULL.
After the bus probe, the resource broker is initialised.
Load initial set of modules This is done at the start of the first server generation only. The next set of modules loaded are those specified explicitly in the &k.module; section of the config file. The final set of initial modules are the driver modules referenced by the active &k.device; and &k.inputdevice; sections in the config file. Each of these modules is loaded exactly once. Register Video and Input Drivers This is done at the start of the first server generation only. When a driver module is loaded, the loader calls its Setup function. For video drivers, this function calls xf86AddDriver() to register the driver's DriverRec, which contains a small set of essential details and driver entry points required during the early phase of InitOutput(). xf86AddDriver() adds it to the global xf86DriverList[] array. The DriverRec contains the driver canonical name, the Identify(), Probe() and AvailableOptions() function entry points as well as a pointer to the driver's module (as returned from the loader when the driver was loaded) and a reference count which keeps track of how many screens are using the driver. The entry driver entry points are those required prior to the driver allocating and filling in its ScrnInfoRec. For a static server, the xf86DriverList[] array is initialised at build time, and the loading of modules is not done. A similar procedure is used for input drivers. The input driver's Setup function calls xf86AddInputDriver() to register the driver's InputDriverRec, which contains a small set of essential details and driver entry points required during the early phase of InitInput(). xf86AddInputDriver() adds it to the global xf86InputDriverList[] array. For a static server, the xf86InputDriverList[] array is initialised at build time. Both the xf86DriverList[] and xf86InputDriverList[] arrays have been initialised by the end of this stage. Once all the drivers are registered, their ChipIdentify() functions are called.
void ChipIdentify(int flags);
This is expected to print a message indicating the driver name, a short summary of what it supports, and a list of the chipset names that it supports. It may use the xf86PrintChipsets() helper to do this.
void xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips);
This function provides an easy way for a driver's ChipIdentify function to format the identification message.
Initialise Access Control This is done at the start of the first server generation only. The Resource Access Control (RAC) subsystem is initialised before calling any driver functions that may access hardware. All generic bus information is probed and saved (for restoration later). All (shared resource) video devices are disabled at the generic bus level, and a probe is done to find the primary video device. These devices remain disabled for the next step. Video Driver Probe This is done at the start of the first server generation only. The ChipProbe() function of each registered video driver is called.
Bool ChipProbe(DriverPtr drv, int flags);
The purpose of this is to identify all instances of hardware supported by the driver. The flags value is currently either 0, PROBE_DEFAULT or PROBE_DETECT. PROBE_DETECT is used if "-configure" or "-probe" command line arguments are given and indicates to the Probe() function that it should not configure the bus entities and that no xorg.conf information is available. The probe must find the active device sections that match the driver by calling xf86MatchDevice(). The number of matches found limits the maximum number of instances for this driver. If no matches are found, the function should return FALSE immediately. Devices that cannot be identified by using device-independent methods should be probed at this stage (keeping in mind that access to all resources that can be disabled in a device-independent way are disabled during this phase). The probe must be a minimal probe. It should just determine if there is a card present that the driver can drive. It should use the least intrusive probe methods possible. It must not do anything that is not essential, like probing for other details such as the amount of memory installed, etc. It is recommended that the xf86MatchPciInstances() helper function be used for identifying matching PCI devices (see the RAC section). These helpers also checks and claims the appropriate entity. When not using the helper, that should be done with xf86CheckPciSlot() and xf86ClaimPciSlot() for PCI devices (see the RAC section). The probe must register all non-relocatable resources at this stage. If a resource conflict is found between exclusive resources the driver will fail immediately. This is usually best done with the xf86ConfigPciEntity() helper function for PCI. If a chipset is specified in an active device section which the driver considers relevant (ie it has no driver specified, or the driver specified matches the driver doing the probe), the Probe must return FALSE if the chipset doesn't match one supported by the driver. If there are no active device sections that the driver considers relevant, it must return FALSE. Allocate a ScrnInfoRec for each active instance of the hardware found, and fill in the basic information, including the other driver entry points. This is best done with the xf86ConfigPciEntity() for PCI instances. These functions allocate a ScrnInfoRec for active entities. Optionally xf86AllocateScreen() function may also be used to allocate the ScrnInfoRec. Any of these functions take care of initialising fields to defined unused values. Claim the entities for each instance of the hardware found. This prevents other drivers from claiming the same hardware. Must leave hardware in the same state it found it in, and must not do any hardware initialisation. All detection can be overridden via the config file, and that parsed information is available to the driver at this stage. Returns TRUE if one or more instances are found, and FALSE otherwise.
int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist)
This function takes the name of the driver and returns via driversectlist a list of device sections that match the driver name. The function return value is the number of matches found. If a fatal error is encountered the return value is -1. The caller should use xfree() to free *driversectlist when it is no longer needed.
ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags)
This function allocates a new ScrnInfoRec in the xf86Screens[] array. This function is normally called by the video driver ChipProbe() functions. The return value is a pointer to the newly allocated ScrnInfoRec. The scrnIndex, origIndex, module and drv fields are initialised. The reference count in drv is incremented. The storage for any currently allocated privates pointers is also allocated and the privates field initialised (the privates data is of course not allocated or initialised). This function never returns on failure. If the allocation fails, the server exits with a fatal error. The flags value is not currently used, and should be set to zero.
At the completion of this, a list of ScrnInfoRecs have been allocated in the xf86Screens[] array, and the associated entities and fixed resources have been claimed. The following ScrnInfoRec fields must be initialised at this point: driverVersion driverName scrnIndex(*) origIndex(*) drv(*) module(*) name Probe PreInit ScreenInit EnterVT LeaveVT numEntities entityList access (*) These are initialised when the ScrnInfoRec is allocated, and not explicitly by the driver. The following ScrnInfoRec fields must be initialised if the driver is going to use them: SwitchMode AdjustFrame FreeScreen ValidMode
Matching Screens This is done at the start of the first server generation only. After the Probe phase is finished, there will be some number of ScrnInfoRecs. These are then matched with the active &k.screen; sections in the xorg.conf, and those not having an active &k.screen; section are deleted. If the number of remaining screens is 0, InitOutput() sets screenInfo.numScreens to 0 and returns. At this point the following fields of the ScrnInfoRecs must be initialised: confScreen Allocate non-conflicting resources This is done at the start of the first server generation only. Before calling the drivers again, the resource information collected from the Probe phase is processed. This includes checking the extent of PCI resources for the probed devices, and resolving any conflicts in the relocatable PCI resources. It also reports conflicts, checks bus routing issues, and anything else that is needed to enable the entities for the next phase. If any drivers registered an EntityInit() function during the Probe phase, then they are called here. Sort the Screens and pre-check Monitor Information This is done at the start of the first server generation only. The list of screens is sorted to match the ordering requested in the config file. The list of modes for each active monitor is checked against the monitor's parameters. Invalid modes are pruned. PreInit This is done at the start of the first server generation only. For each ScrnInfoRec, enable access to the screens entities and call the ChipPreInit() function.
Bool ChipPreInit(ScrnInfoRec screen, int flags);
The purpose of this function is to find out all the information required to determine if the configuration is usable, and to initialise those parts of the ScrnInfoRec that can be set once at the beginning of the first server generation. The number of entities registered for the screen should be checked against the expected number (most drivers expect only one). The entity information for each of them should be retrieved (with xf86GetEntityInfo()) and checked for the correct bus type and that none of the sharable resources registered during the Probe phase was rejected. Access to resources for the entities that can be controlled in a device-independent way are enabled before this function is called. If the driver needs to access any resources that it has disabled in an EntityInit() function that it registered, then it may enable them here providing that it disables them before this function returns. This includes probing for video memory, clocks, ramdac, and all other HW info that is needed. It includes determining the depth/bpp/visual and related info. It includes validating and determining the set of video modes that will be used (and anything that is required to determine that). This information should be determined in the least intrusive way possible. The state of the HW must remain unchanged by this function. Although video memory (including MMIO) may be mapped within this function, it must be unmapped before returning. Driver specific information should be stored in a structure hooked into the ScrnInfoRec's driverPrivate field. Any other modules which require persistent data (ie data that persists across server generations) should be initialised in this function, and they should allocate a privates index to hook their data into by calling xf86AllocateScrnInfoPrivateIndex(). The privates data is persistent. Helper functions for some of these things are provided at the XFree86 common level, and the driver can choose to make use of them. Modules may be loaded at any point in this function, and all modules that the driver will need must be loaded before the end of this function. Either the xf86LoadSubModule() or the xf86LoadDrvSubModule() function should be used to load modules depending on whether a ScrnInfoRec has been set up. A driver may unload a module within this function if it was only needed temporarily, and the xf86UnloadSubModule() function should be used to do that. Otherwise there is no need to explicitly unload modules because the loader takes care of module dependencies and will unload submodules automatically if/when the driver module is unloaded. The bulk of the ScrnInfoRec fields should be filled out in this function. ChipPreInit() returns FALSE when the configuration is unusable in some way (unsupported depth, no valid modes, not enough video memory, etc), and TRUE if it is usable. It is expected that if the ChipPreInit() function returns TRUE, then the only reasons that subsequent stages in the driver might fail are lack or resources (like xalloc failures). All other possible reasons for failure should be determined by the ChipPreInit() function.
The ScrnInfoRecs for screens where the ChipPreInit() fails are removed. If none remain, InitOutput() sets screenInfo.numScreens to 0 and returns. At this point, further fields of the ScrnInfoRecs would normally be filled in. Most are not strictly mandatory, but many are required by other layers and/or helper functions that the driver may choose to use. The documentation for those layers and helper functions indicates which they require. The following fields of the ScrnInfoRecs should be filled in if the driver is going to use them: monitor display depth pixmapBPP bitsPerPixel weight (>8bpp only) mask (>8bpp only) offset (>8bpp only) rgbBits (8bpp only) gamma defaultVisual virtualX virtualY displayWidth frameX0 frameY0 frameX1 frameY1 zoomLocked modePool modes currentMode progClock (TRUE if clock is programmable) chipset ramdac clockchip numClocks (if not programmable) clock[] (if not programmable) videoRam memBase driverPrivate chipID chipRev
pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); and pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
Load a module that a driver depends on. This function loads the module name as a sub module of the driver. The return value is a handle identifying the new module. If the load fails, the return value will be NULL. If a driver needs to explicitly unload a module it has loaded in this way, the return value must be saved and passed to xf86UnloadSubModule() when unloading.
void xf86UnloadSubModule(pointer module);
Unloads the module referenced by module. module should be a pointer returned previously by xf86LoadSubModule() or xf86LoadDrvSubModule() .
Cleaning up Unused Drivers At this point it is known which screens will be in use, and which drivers are being used. Unreferenced drivers (and modules they may have loaded) are unloaded here. Consistency Checks The parameters that must be global to the server, like pixmap formats, bitmap bit order, bitmap scanline unit and image byte order are compared for each of the screens. If a mismatch is found, the server exits with an appropriate message. Check if Resource Control is Needed Determine if resource access control is needed. This is the case if more than one screen is used. If necessary the RAC wrapper module is loaded. AddScreen (ScreenInit) At this point, the valid screens are known. AddScreen() is called for each of them, passing ChipScreenInit() as the argument. AddScreen() is a DIX function that allocates a new screenInfo.screen[] entry (aka pScreen), and does some basic initialisation of it. It then calls the ChipScreenInit() function, with pScreen as one of its arguments. If ChipScreenInit() returns FALSE, AddScreen() returns -1. Otherwise it returns the index of the screen. AddScreen() should only fail because of programming errors or failure to allocate resources (like memory). All configuration problems should be detected BEFORE this point.
Bool ChipScreenInit(ScreenPtr pScreen, int argc, char **argv);
This is called at the start of each server generation. Fill in all of pScreen, possibly doing some of this by calling ScreenInit functions from other layers like mi, framebuffers (cfb, etc), and extensions. Decide which operations need to be placed under resource access control. The classes of operations are the frame buffer operations (RAC_FB), the pointer operations (RAC_CURSOR), the viewport change operations (RAC_VIEWPORT) and the colormap operations (RAC_COLORMAP). Any operation that requires resources which might be disabled during OPERATING state should be set to use RAC. This can be specified separately for memory and IO resources (the racMemFlags and racIoFlags fields of the ScrnInfoRec respectively). Map any video memory or other memory regions. Save the video card state. Enough state must be saved so that the original state can later be restored. Initialise the initial video mode. The ScrnInfoRec's vtSema field should be set to TRUE just prior to changing the video hardware's state.
The ChipScreenInit() function (or functions from other layers that it calls) should allocate entries in the ScreenRec's devPrivates area by calling AllocateScreenPrivateIndex() if it needs per-generation storage. Since the ScreenRec's devPrivates information is cleared for each server generation, this is the correct place to initialise it. After AddScreen() has successfully returned, the following ScrnInfoRec fields are initialised: pScreen racMemFlags racIoFlags The ChipScreenInit() function should initialise the CloseScreen and SaveScreen fields of pScreen. The old value of pScreen->CloseScreen should be saved as part of the driver's per-screen private data, allowing it to be called from ChipCloseScreen(). This means that the existing CloseScreen() function is wrapped.
Finalising RAC Initialisation After all the ChipScreenInit() functions have been called, each screen has registered its RAC requirements. This information is used to determine which shared resources are requested by more than one driver and set the access functions accordingly. This is done following these rules: The sharable resources registered by each entity are compared. If a resource is registered by more than one entity the entity will be marked to indicate that it needs to share this resources type (IO or MEM). A resource marked disabled during OPERATING state will be ignored entirely. A resource marked unused will only conflict with an overlapping resource of an other entity if the second is actually in use during OPERATING state. If an unused resource was found to conflict but the entity does not use any other resource of this type the entire resource type will be disabled for that entity. Finishing InitOutput() At this point InitOutput() is finished, and all the screens have been setup in their initial video mode. Mode Switching When a SwitchMode event is received, ChipSwitchMode() is called (when it exists):
Bool ChipSwitchMode(int index, DisplayModePtr mode);
Initialises the new mode for the screen identified by index;. The viewport may need to be adjusted also.
Changing Viewport When a Change Viewport event is received, ChipAdjustFrame() is called (when it exists):
void ChipAdjustFrame(int index, int x, int y);
Changes the viewport for the screen identified by index;. It should be noted that many chipsets impose restrictions on where the viewport may be placed in the virtual resolution, either for alignment reasons, or to prevent the start of the viewport from being positioned within a pixel (as can happen in a 24bpp mode). After calculating the value the chipset's panning registers need to be set to for non-DGA modes, this function should recalculate the ScrnInfoRec's frameX0, frameY0, frameX1 and frameY1 fields to correspond to that value. If this is not done, switching to another mode might cause the position of a hardware cursor to change.
VT Switching When a VT switch event is received, xf86VTSwitch() is called. xf86VTSwitch() does the following: On ENTER: enable port I/O access save and initialise the bus/resource state enter the SETUP server state calls ChipEnterVT() for each screen enter the OPERATING server state validate GCs Restore fb from saved pixmap for each screen Enable all input devices On LEAVE: Save fb to pixmap for each screen validate GCs enter the SETUP server state calls ChipLeaveVT() for each screen disable all input devices restore bus/resource state disables port I/O access
Bool ChipEnterVT(ScrnInfoPtr pScrn);
This function should initialise the current video mode and initialise the viewport, turn on the HW cursor if appropriate, etc. Should it re-save the video state before initialising the video mode?
void ChipLeaveVT(ScrnInfoPtr pScrn);
This function should restore the saved video state. If appropriate it should also turn off the HW cursor, and invalidate any pixmap/font caches.
Optionally, ChipLeaveVT() may also unmap memory regions. If so, ChipEnterVT() will need to remap them. Additionally, if an aperture used to access video memory is unmapped and remapped in this fashion, ChipEnterVT() will also need to notify the framebuffer layers of the aperture's new location in virtual memory. This is done with a call to the screen's ModifyPixmapHeader() function, as follows
(*pScreen->ModifyPixmapHeader)(pScrn->ppix, -1, -1, -1, -1, -1, NewApertureAddress);
where the ppix field in a ScrnInfoRec points to the pixmap used by the screen's SaveRestoreImage() function to hold the screen's contents while switched out.
Other layers may wrap the ChipEnterVT() and ChipLeaveVT() functions if they need to take some action when these events are received.
End of server generation At the end of each server generation, the DIX layer calls ChipCloseScreen() for each screen:
Bool ChipCloseScreen(int index, ScreenPtr pScreen);
This function should restore the saved video state and unmap the memory regions. It should also free per-screen data structures allocated by the driver. Note that the persistent data held in the ScrnInfoRec's driverPrivate field should not be freed here because it is needed by subsequent server generations. The ScrnInfoRec's vtSema field should be set to FALSE once the video HW state has been restored. Before freeing the per-screen driver data the saved CloseScreen value should be restored to pScreen->CloseScreen, and that function should be called after freeing the data.
Optional Driver Functions The functions outlined here can be called from the XFree86 common layer, but their presence is optional. Mode Validation When a mode validation helper supplied by the XFree86-common layer is being used, it can be useful to provide a function to check for hw specific mode constraints:
ModeStatus ChipValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags);
Check the passed mode for hw-specific constraints, and return the appropriate status value.
This function may also modify the effective timings and clock of the passed mode. These have been stored in the mode's Crtc* and SynthClock elements, and have already been adjusted for interlacing, doublescanning, multiscanning and clock multipliers and dividers. The function should not modify any other mode field, unless it wants to modify the mode timings reported to the user by xf86PrintModes(). The function is called once for every mode in the xorg.conf Monitor section assigned to the screen, with flags set to MODECHECK_INITIAL. It is subsequently called for every mode in the xorg.conf Display subsection assigned to the screen, with flags set to MODECHECK_FINAL. In the second case, the mode will have successfully passed all other tests. In addition, the ScrnInfoRec's virtualX, virtualY and displayWidth fields will have been set as if the mode to be validated were to be the last mode accepted. In effect, calls with MODECHECK_INITIAL are intended for checks that do not depend on any mode other than the one being validated, while calls with MODECHECK_FINAL are intended for checks that may involve more than one mode.
Free screen data When a screen is deleted prior to the completion of the ScreenInit phase the ChipFreeScreen() function is called when defined.
void ChipFreeScreen(ScrnInfoPtr pScrn);
Free any driver-allocated data that may have been allocated up to and including an unsuccessful ChipScreenInit() call. This would predominantly be data allocated by ChipPreInit() that persists across server generations. It would include the driverPrivate, and any privates entries that modules may have allocated.
Recommended driver functions The functions outlined here are for internal use by the driver only. They are entirely optional, and are never accessed directly from higher layers. The sample function declarations shown here are just examples. The interface (if any) used is up to the driver. Save Save the video state. This could be called from ChipScreenInit() and (possibly) ChipEnterVT().
void ChipSave(ScrnInfoPtr pScrn);
Saves the current state. This will only be saving pre-server states or states before returning to the server. There is only one current saved state per screen and it is stored in private storage in the screen.
Restore Restore the original video state. This could be called from the ChipLeaveVT() and ChipCloseScreen() functions.
void ChipRestore(ScrnInfoPtr pScrn);
Restores the saved state from the private storage. Usually only used for restoring text modes.
Initialise Mode Initialise a video mode. This could be called from the ChipScreenInit(), ChipSwitchMode() and ChipEnterVT() functions.
Bool ChipModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
Programs the hardware for the given video mode.
Data and Data Structures Command line data Command line options are typically global, and are stored in global variables. These variables are read-only and are available to drivers via a function call interface. Most of these command line values are processed via helper functions to ensure that they are treated consistently by all drivers. The other means of access is provided for cases where the supplied helper functions might not be appropriate. Some of them are: xf86Verbose verbosity level xf86Bpp -bpp from the command line xf86Depth -depth from the command line xf86Weight -weight from the command line xf86Gamma -{r,g,b,}gamma from the command line xf86FlipPixels -flippixels from the command line xf86ProbeOnly -probeonly from the command line defaultColorVisualClass -cc from the command line If we ever do allow for screen-specific command line options, we may need to rethink this. These can be accessed in a read-only manner by drivers with the following functions:
int xf86GetVerbosity();
Returns the value of xf86Verbose.
int xf86GetDepth();
Returns the command line setting. If not set on the command line, -1 is returned.
rgb xf86GetWeight();
Returns the command line setting. If not set on the command line, {0, 0, 0} is returned.
Gamma xf86GetGamma();
Returns the or , , command line settings. If not set on the command line, {0.0, 0.0, 0.0} is returned.
Bool xf86GetFlipPixels();
Returns TRUE if is present on the command line, and FALSE otherwise.
const char *xf86GetServerName();
Returns the name of the X server from the command line.
Data handling Config file data contains parts that are global, and parts that are Screen specific. All of it is parsed into data structures that neither the drivers or most other parts of the server need to know about. The global data is typically not required by drivers, and as such, most of it is stored in the private xf86InfoRec. The screen-specific data collected from the config file is stored in screen, device, display, monitor-specific data structures that are separate from the ScrnInfoRecs, with the appropriate elements/fields hooked into the ScrnInfoRecs as required. The screen config data is held in confScreenRec, device data in the GDevRec, monitor data in the MonRec, and display data in the DispRec. The XFree86 common layer's screen specific data (the actual data in use for each screen) is held in the ScrnInfoRecs. As has been outlined above, the ScrnInfoRecs are allocated at probe time, and it is the responsibility of the Drivers' Probe() and PreInit() functions to finish filling them in based on both data provided on the command line and data provided from the Config file. The precedence for this is:
command line -> config file -> probed/default data
For most things in this category there are helper functions that the drivers can use to ensure that the above precedence is consistently used. As well as containing screen-specific data that the XFree86 common layer (including essential parts of the server infrastructure as well as helper functions) needs to access, it also contains some data that drivers use internally. When considering whether to add a new field to the ScrnInfoRec, consider the balance between the convenience of things that lots of drivers need and the size/obscurity of the ScrnInfoRec. Per-screen driver specific data that cannot be accommodated with the static ScrnInfoRec fields is held in a driver-defined data structure, a pointer to which is assigned to the ScrnInfoRec's driverPrivate field. This is per-screen data that persists across server generations (as does the bulk of the static ScrnInfoRec data). It would typically also include the video card's saved state. Per-screen data for other modules that the driver uses that is reset for each server generation is hooked into the ScrnInfoRec through its privates field. Once it has stabilised, the data structures and variables accessible to video drivers will be documented here. In the meantime, those things defined in the xf86.h and xf86str.h files are visible to video drivers. Things defined in xf86Priv.h and xf86Privstr.h are NOT intended to be visible to video drivers, and it is an error for a driver to include those files.
Accessing global data Some other global state information that the drivers may access via functions is as follows:
Bool xf86ServerIsExiting();
Returns TRUE if the server is at the end of a generation and is in the process of exiting, and FALSE otherwise.
Bool xf86ServerIsResetting();
Returns TRUE if the server is at the end of a generation and is in the process of resetting, and FALSE otherwise.
Bool xf86ServerIsOnlyProbing();
Returns TRUE if the -probeonly command line flag was specified, and FALSE otherwise.
Allocating private data A driver and any module it uses may allocate per-screen private storage in either the ScreenRec (DIX level) or ScrnInfoRec (XFree86 common layer level). ScreenRec storage persists only for a single server generation, and ScrnInfoRec storage persists across generations for the lifetime of the server. The ScreenRec devPrivates data must be reallocated/initialised at the start of each new generation. This is normally done from the ChipScreenInit() function, and Init functions for other modules that it calls. Data allocated in this way should be freed by the driver's ChipCloseScreen() functions, and Close functions for other modules that it calls. A new devPrivates entry is allocated by calling the AllocateScreenPrivateIndex() function.
int AllocateScreenPrivateIndex();
This function allocates a new element in the devPrivates field of all currently existing ScreenRecs. The return value is the index of this new element in the devPrivates array. The devPrivates field is of type DevUnion: typedef union _DevUnion { pointer ptr; long val; unsigned long uval; pointer (*fptr)(void); } DevUnion; which allows the element to be used for any of the above types. It is commonly used as a pointer to data that the caller allocates after the new index has been allocated. This function will return -1 when there is an error allocating the new index.
The ScrnInfoRec privates data persists for the life of the server, so only needs to be allocated once. This should be done from the ChipPreInit() function, and Init functions for other modules that it calls. Data allocated in this way should be freed by the driver's ChipFreeScreen() functions, and Free functions for other modules that it calls. A new privates entry is allocated by calling the xf86AllocateScrnInfoPrivateIndex() function.
int xf86AllocateScrnInfoPrivateIndex();
This function allocates a new element in the privates field of all currently existing ScrnInfoRecs. The return value is the index of this new element in the privates array. The privates field is of type DevUnion: typedef union _DevUnion { pointer ptr; long val; unsigned long uval; pointer (*fptr)(void); } DevUnion; which allows the element to be used for any of the above types. It is commonly used as a pointer to data that the caller allocates after the new index has been allocated. This function will not return when there is an error allocating the new index. When there is an error it will cause the server to exit with a fatal error. The similar function for allocation privates in the ScreenRec (AllocateScreenPrivateIndex()) differs in this respect by returning -1 when the allocation fails.
Keeping Track of Bus Resources Theory of Operation The XFree86 common layer has knowledge of generic access control mechanisms for devices on certain bus systems (currently the PCI bus) as well as of methods to enable or disable access to the buses itself. Furthermore it can access information on resources decoded by these devices and if necessary modify it. When first starting the Xserver collects all this information, saves it for restoration, checks it for consistency, and if necessary, corrects it. Finally it disables all resources on a generic level prior to calling any driver function. When the Probe() function of each driver is called the device sections are matched against the devices found in the system. The driver may probe devices at this stage that cannot be identified by using device independent methods. Access to all resources that can be controlled in a device independent way is disabled. The Probe() function should register all non-relocatable resources at this stage. If a resource conflict is found between exclusive resources the driver will fail immediately. Optionally the driver might specify an EntityInit(), EntityLeave() and EntityEnter() function. EntityInit() can be used to disable any shared resources that are not controlled by the generic access control functions. It is called prior to the PreInit phase regardless if an entity is active or not. When calling the EntityInit(), EntityEnter() and EntityLeave() functions the common level will disable access to all other entities on a generic level. Since the common level has no knowledge of device specific methods to disable access to resources it cannot be guaranteed that certain resources are not decoded by any other entity until the EntityInit() or EntityEnter() phase is finished. Device drivers should therefore register all those resources which they are going to disable. If these resources are never to be used by any driver function they may be flagged ResInit so that they can be removed from the resource list after processing all EntityInit() functions. EntityEnter() should disable decoding of all resources which are not registered as exclusive and which are not handled by the generic access control in the common level. The difference to EntityInit() is that the latter one is only called once during lifetime of the server. It can therefore be used to set up variables prior to disabling resources. EntityLeave() should restore the original state when exiting the server or switching to a different VT. It also needs to disable device specific access functions if they need to be disabled on server exit or VT switch. The default state is to enable them before giving up the VT. In PreInit() phase each driver should check if any sharable resources it has registered during Probe() has been denied and take appropriate action which could simply be to fail. If it needs to access resources it has disabled during EntitySetup() it can do so provided it has registered these and will disable them before returning from PreInit(). This also applies to all other driver functions. Several functions are provided to request resource ranges, register these, correct PCI config space and add replacements for the generic access functions. Resources may be marked disabled or unused during OPERATING stage. Although these steps could also be performed in ScreenInit(), this is not desirable. Following PreInit() phase the common level determines if resource access control is needed. This is the case if more than one screen is used. If necessary the RAC wrapper module is loaded. In ScreenInit() the drivers can decide which operations need to be placed under RAC. Available are the frame buffer operations, the pointer operations and the colormap operations. Any operation that requires resources which might be disabled during OPERATING state should be set to use RAC. This can be specified separately for memory and IO resources. When ScreenInit() phase is done the common level will determine which shared resources are requested by more than one driver and set the access functions accordingly. This is done following these rules: The sharable resources registered by each entity are compared. If a resource is registered by more than one entity the entity will be marked to need to share this resources type (IO or MEM). A resource marked disabled during OPERATING state will be ignored entirely. A resource marked unused will only conflicts with an overlapping resource of an other entity if the second is actually in use during OPERATING state. If an unused resource was found to conflict however the entity does not use any other resource of this type the entire resource type will be disabled for that entity. The driver has the choice among different ways to control access to certain resources: It can rely on the generic access functions. This is probably the most common case. Here the driver only needs to register any resource it is going to use. It can replace the generic access functions by driver specific ones. This will mostly be used in cases where no generic access functions are available. In this case the driver has to make sure these resources are disabled when entering the PreInit() stage. Since the replacement functions are registered in PreInit() the driver will have to enable these resources itself if it needs to access them during this state. The driver can specify if the replacement functions can control memory and/or I/O resources separately. The driver can enable resources itself when it needs them. Each driver function enabling them needs to disable them before it will return. This should be used if a resource which can be controlled in a device dependent way is only required during SETUP state. This way it can be marked unused during OPERATING state. A resource which is decoded during OPERATING state however never accessed by the driver should be marked unused. Since access switching latencies are an issue during Xserver operation, the common level attempts to minimize the number of entities that need to be placed under RAC control. When a wrapped operation is called, the EnableAccess() function is called before control is passed on. EnableAccess() checks if a screen is under access control. If not it just establishes bus routing and returns. If the screen needs to be under access control, EnableAccess() determines which resource types (MEM, IO) are required. Then it tests if this access is already established. If so it simply returns. If not it disables the currently established access, fixes bus routing and enables access to all entities registered for this screen. Whenever a mode switch or a VT-switch is performed the common level will return to SETUP state. Resource Types Resource have certain properties. When registering resources each range is accompanied by a flag consisting of the ORed flags of the different properties the resource has. Each resource range may be classified according to its physical properties i.e., if it addresses memory (ResMem) or I/O space (ResIo), if it addresses a block (ResBlock) or sparse (ResSparse) range, its access properties. There are two known access properties: ResExclusive for resources which may not be shared with any other device and ResShared for resources which can be disabled and therefore can be shared. If it is necessary to test a resource against any type a generic access type ResAny is provided. If this is set the resource will conflict with any resource of a different entity intersecting its range. Further it can be specified that a resource is decoded however never used during any stage (ResUnused) or during OPERATING state (ResUnusedOpr). A resource only visible during the init functions (ie. EntityInit(), EntityEnter() and EntityLeave() should be registered with the flag ResInit. A resource that might conflict with background resource ranges may be flagged with ResBios. This might be useful when registering resources ranges that were assigned by the system Bios. Several predefined resource lists are available for VGA and 8514/A resources in common/xf86Resources.h. Available Functions The functions provided for resource management are listed in their order of use in the driver. Probe Phase In this phase each driver detects those resources it is able to drive, creates an entity record for each of them, registers non-relocatable resources and allocates screens and adds the resources to screens. Two helper functions are provided for matching device sections in the xorg.conf file to the devices:
int xf86MatchPciInstances(const char *driverName, int vendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets, GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities);
This function finds matches between PCI cards that a driver supports and config file device sections. It is intended for use in the ChipProbe() function of drivers for PCI cards. Only probed PCI devices with a vendor ID matching vendorID are considered. devList and numDevs are typically those found from calling xf86MatchDevice(), and represent the active config file device sections relevant to the driver. PCIchipsets is a table that provides a mapping between the PCI device IDs, the driver's internal chipset tokens and a list of fixed resources. When a device section doesn't have a BusID entry it can only match the primary video device. Secondary devices are only matched with device sections that have a matching BusID entry. Once the preliminary matches have been found, a final match is confirmed by checking if the chipset override, ChipID override or probed PCI chipset type match one of those given in the chipsets and PCIchipsets lists. The PCIchipsets list includes a list of the PCI device IDs supported by the driver. The list should be terminated with an entry with PCI ID -1". The chipsets list is a table mapping the driver's internal chipset tokens to names, and should be terminated with a NULL entry. Only those entries with a corresponding entry in the PCIchipsets list are considered. The order of precedence is: config file chipset, config file ChipID, probed PCI device ID. In cases where a driver handles PCI chipsets with more than one vendor ID, it may set vendorID to 0, and OR each devID in the list with (the vendor ID << 16). Entity index numbers for confirmed matches are returned as an array via foundEntities. The PCI information, chipset token and device section for each match are found in the EntityInfoRec referenced by the indices. The function return value is the number of confirmed matches. A return value of -1 indicates an internal error. The returned foundEntities array should be freed by the driver with xfree() when it is no longer needed in cases where the return value is greater than zero.
These two helper functions make use of several core functions that are available at the driver level:
Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func);
Takes a BusID string, and if it is in the correct format, returns the PCI bus, device, func values that it indicates. The format of the string is expected to be "PCI:bus:device:func" where each of bus, device and func are decimal integers. The ":func" part may be omitted, and the func value assumed to be zero, but this isn't encouraged. The "PCI" prefix may also be omitted. The prefix "AGP" is currently equivalent to the "PCI" prefix. If the string isn't a valid PCI BusID, the return value is FALSE.
Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
Compares a BusID string with PCI bus, device, func values. If they match TRUE is returned, and FALSE if they don't.
Bool xf86CheckPciSlot(int bus, int device, int func);
Checks if the PCI slot bus:device:func has been claimed. If so, it returns FALSE, and otherwise TRUE.
int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
This function is used to claim a PCI slot, allocate the associated entity record and initialise their data structures. The return value is the index of the newly allocated entity record, or -1 if the claim fails. This function should always succeed if xf86CheckPciSlot() returned TRUE for the same PCI slot.
Bool xf86IsPrimaryPci(void);
This function returns TRUE if the primary card is a PCI device, and FALSE otherwise.
Two helper functions are provided to aid configuring entities:
ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, PciChipsets *p_chip, void *res, EntityProc init, EntityProc enter, EntityProc leave, pointer private);
This functions is used to register the entity. The res, init, enter, and leave arguments are unused, and should be NULL. For active entities a ScrnInfoRec is allocated if the pScrn argument is NULL. The return value is TRUE when successful.
These two helper functions make use of several core functions that are available at the driver level:
void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
This function associates the entity referenced by entityIndex with the screen.
PreInit Phase During this phase the remaining resources should be registered. PreInit() should call xf86GetEntityInfo() to obtain a pointer to an EntityInfoRec for each entity it is able to drive and check if any resource are listed in its resources field. If resources registered in the Probe phase have been rejected in the post-Probe phase (resources is non-NULL), then the driver should decide if it can continue without using these or if it should fail.
EntityInfoPtr xf86GetEntityInfo(int entityIndex);
This function returns a pointer to the EntityInfoRec referenced by entityIndex. The returned EntityInfoRec should be freed with xfree() when no longer needed.
Several functions are provided to simplify resource registration:
Bool xf86IsEntityPrimary(int entityIndex);
This function returns TRUE if the entity referenced by entityIndex is the primary display device (i.e., the one initialised at boot time and used in text mode).
Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn);
This function returns TRUE if the primary entity is registered with the screen referenced by pScrn.
pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
This function returns a pointer to the pciVideoRec for the specified entity. If the entity is not a PCI device, NULL is returned.
Two functions are provided to obtain a resource range of a given type:
resRange xf86GetBlock(long type, memType size, memType window_start, memType window_end, memType align_mask, resPtr avoid);
This function tries to find a block range of size size and type type in a window bound by window_start and window_end with the alignment specified in align_mask. Optionally a list of resource ranges which should be avoided within the window can be supplied. On failure a zero-length range of type ResEnd will be returned.
resRange xf86GetSparse(long type, memType fixed_bits, memType decode_mask, memType address_mask, resPtr avoid);
This function is like the previous one, but attempts to find a sparse range instead of a block range. Here three values have to be specified: the address_mask which marks all bits of the mask part of the address, the decode_mask which masks out the bits which are hardcoded and are therefore not available for relocation and the values of the fixed bits. The function tries to find a base that satisfies the given condition. If the function fails it will return a zero range of type ResEnd. Optionally it might be passed a list of resource ranges to avoid.
Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base);
This function checks that the memory base address specified matches one of the PCI base address register values for the given PCI device. This is mostly used to check that an externally provided base address (e.g., from a config file) matches an actual value allocated to a device.
The following two functions are provided for special cases:
void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
This function may be used to remove an entity from a screen. This only makes sense if a screen has more than one entity assigned or the screen is to be deleted. No test is made if the screen has any entities left.
ScreenInit Phase All that is required in this phase is to setup the RAC flags. Note that it is also permissible to set these flags up in the PreInit phase. The RAC flags are held in the racIoFlags and racMemFlags fields of the ScrnInfoRec for each screen. They specify which graphics operations might require the use of shared resources. This can be specified separately for memory and I/O resources. The available flags are defined in rac/xf86RAC.h. They are: RAC_FB for framebuffer operations (including hw acceleration) RAC_CURSOR for Cursor operations (??? I'm not sure if we need this for SW cursor it depends on which level the sw cursor is drawn) RAC_COLORMAP for colormap operations RAC_VIEWPORT for the call to ChipAdjustFrame() The flags are ORed together.
Config file <quote>Option</quote> entries Option entries are permitted in most sections and subsections of the config file. There are two forms of option entries: Option "option-name" A boolean option. Option "option-name" "option-value" An option with an arbitrary value. The option entries are handled by the parser, and a list of the parsed options is included with each of the appropriate data structures that the drivers have access to. The data structures used to hold the option information are opaque to the driver, and a driver must not access the option data directly. Instead, the common layer provides a set of functions that may be used to access, check and manipulate the option data. First, the low level option handling functions. In most cases drivers would not need to use these directly.
XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
Takes a list of options and an option name, and returns a handle for the first option entry in the list matching the name. Returns NULL if no match is found.
const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
Takes a list of options and an option name, and returns the value associated with the first option entry in the list matching the name. If the matching option has no value, an empty string ("") is returned. Returns NULL if no match is found.
void xf86MarkOptionUsed(XF86OptionPtr option);
Takes a handle for an option, and marks that option as used.
void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
Takes a list of options and an option name and marks the first option entry in the list matching the name as used.
Next, the higher level functions that most drivers would use.
void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
Collect the options from each of the config file sections used by the screen (pScrn) and return the merged list as pScrn->options. This function requires that pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities, and pScrn->entityList are initialised. extraOpts may optionally be set to an additional list of options to be combined with the others. The order of precedence for options is extraOpts, display, confScreen, monitor, device.
void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo);
Processes a list of options according to the information in the array of OptionInfoRecs (optinfo). The resulting information is stored in the value fields of the appropriate optinfo entries. The found fields are set to TRUE when an option with a value of the correct type if found, and FALSE otherwise. The type field is used to determine the expected value type for each option. Each option in the list of options for which there is a name match (but not necessarily a value type match) is marked as used. Warning messages are printed when option values don't match the types specified in the optinfo data. NOTE: If this function is called before a driver's screen number is known (e.g., from the ChipProbe() function) a scrnIndex value of -1 should be used. NOTE 2: Given that this function stores into the OptionInfoRecs pointed to by optinfo, the caller should ensure the OptionInfoRecs are (re-)initialised before the call, especially if the caller expects to use the predefined option values as defaults. The OptionInfoRec is defined as follows: typedef struct { double freq; int units; } OptFrequency; typedef union { unsigned long num; char * str; double realnum; Bool bool; OptFrequency freq; } ValueUnion; typedef enum { OPTV_NONE = 0, OPTV_INTEGER, OPTV_STRING, /* a non-empty string */ OPTV_ANYSTR, /* Any string, including an empty one */ OPTV_REAL, OPTV_BOOLEAN, OPTV_PERCENT, OPTV_FREQ } OptionValueType; typedef enum { OPTUNITS_HZ = 1, OPTUNITS_KHZ, OPTUNITS_MHZ } OptFreqUnits; typedef struct { int token; const char* name; OptionValueType type; ValueUnion value; Bool found; } OptionInfoRec, *OptionInfoPtr; OPTV_FREQ can be used for options values that are frequencies. These values are a floating point number with an optional unit name appended. The unit name can be one of "Hz", "kHz", "k", "MHz", "M". The multiplier associated with the unit is stored in freq.units, and the scaled frequency is stored in freq.freq. When no unit is specified, freq.units is set to 0, and freq.freq is unscaled. OPTV_PERCENT can be used for option values that are specified in percent (e.g. "20%"). These values are a floating point number with a percent sign appended. If the percent sign is missing, the parser will fail to match the value. Typical usage is to setup an array of OptionInfoRecs with all fields initialised. The value and found fields get set by xf86ProcessOptions(). For cases where the value parsing is more complex, the driver should specify OPTV_STRING, and parse the string itself. An example of using this option handling is included in the Sample Driver section.
void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
Prints out warning messages for each option in the list of options that isn't marked as used. This is intended to show options that the driver hasn't recognised. It would normally be called near the end of the ChipScreenInit() function, but only when serverGeneration == 1
OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
Returns a pointer to the OptionInfoRec in table with a token field matching token. Returns NULL if no match is found.
Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
Returns the found field of the OptionInfoRec in table with a token field matching token. This can be used for options of all types. Note that for options of type OPTV_BOOLEAN, it isn't sufficient to check this to determine the value of the option. Returns FALSE if no match is found.
char *xf86GetOptValString(const OptionInfoRec *table, int token);
Returns the value.str field of the OptionInfoRec in table with a token field matching token. Returns NULL if no match is found.
Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
Returns via *value the value.num field of the OptionInfoRec in table with a token field matching token. *value is only changed when a match is found so it can be safely initialised with a default prior to calling this function. The function return value is as for xf86IsOptionSet().
Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
Like xf86GetOptValInteger(), except the value is treated as an unsigned long.
Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
Like xf86GetOptValInteger(), except that value.realnum is used.
Bool xf86GetOptValFreq(const OptionInfoRec *table, int token, OptFreqUnits expectedUnits, double *value);
Like xf86GetOptValInteger(), except that the value.freq data is returned. The frequency value is scaled to the units indicated by expectedUnits. The scaling is exact when the units were specified explicitly in the option's value. Otherwise, the expectedUnits field is used as a hint when doing the scaling. In this case, values larger than 1000 are assumed to have be specified in the next smallest units. For example, if the Option value is "10000" and expectedUnits is OPTUNITS_MHZ, the value returned is 10.
Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
This function is used to check boolean options (OPTV_BOOLEAN). If the function return value is FALSE, it means the option wasn't set. Otherwise *value is set to the boolean value indicated by the option's value. No option value is interpreted as TRUE. Option values meaning TRUE are "1", "yes", "on", "true", and option values meaning FALSE are "0", "no", "off", "false". Option names both with the "no" prefix in their names, and with that prefix removed are also checked and handled in the obvious way. *value is not changed when the option isn't present. It should normally be set to a default value before calling this function.
Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
This function is used to check boolean options (OPTV_BOOLEAN). If the option is set, its value is returned. If the options is not set, the default value specified by def is returned. The option interpretation is the same as for xf86GetOptValBool().
int xf86NameCmp(const char *s1, const char *s2);
This function should be used when comparing strings from the config file with expected values. It works like strcmp(), but is not case sensitive and space, tab, and _ characters are ignored in the comparison. The use of this function isn't restricted to parsing option values. It may be used anywhere where this functionality required.
Modules, Drivers, Include Files and Interface Issues NOTE: this section is incomplete. Include files The following include files are typically required by video drivers:
All drivers should include these: "xf86.h" "xf86_OSproc.h" "xf86_ansic.h" "xf86Resources.h" Wherever inb/outb (and related things) are used the following should be included: "compiler.h" Note: in drivers, this must be included after "xf86_ansic.h". Drivers that need to access the PCI config space need this: "xf86Pci.h" Drivers that initialise a SW cursor need this: "mipointer.h" All drivers using the mi colourmap code need this: "micmap.h" If a driver uses the vgahw module, it needs this: "vgaHW.h" Drivers supporting VGA or Hercules monochrome screens need: "xf1bpp.h" Drivers supporting VGA or EGC 16-colour screens need: "xf4bpp.h" Drivers using cfb need: #define PSZ 8 #include "cfb.h" #undef PSZ Drivers supporting bpp 16, 24 or 32 with cfb need one or more of: "cfb16.h" "cfb24.h" "cfb32.h" If a driver uses the fb manager, it needs this: "xf86fbman.h"
Non-driver modules should include "xf86_ansic.h" to get the correct wrapping of ANSI C/libc functions. All modules must NOT include any system include files, or the following: "xf86Priv.h" "xf86Privstr.h" "xf86_OSlib.h" "Xos.h" In addition, "xf86_libc.h" must not be included explicitly. It is included implicitly by "xf86_ansic.h".
Offscreen Memory Manager Management of offscreen video memory may be handled by the XFree86 framebuffer manager. Once the offscreen memory manager is running, drivers or extensions may allocate, free or resize areas of offscreen video memory using the following functions (definitions taken from xf86fbman.h): typedef struct _FBArea { ScreenPtr pScreen; BoxRec box; int granularity; void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*) void (*RemoveAreaCallback)(struct _FBArea*) DevUnion devPrivate; } FBArea, *FBAreaPtr; typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr from, FBAreaPtr to) typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr) FBAreaPtr xf86AllocateOffscreenArea ( ScreenPtr pScreen, int width, int height, int granularity, MoveAreaCallbackProcPtr MoveAreaCallback, RemoveAreaCallbackProcPtr RemoveAreaCallback, pointer privData ) void xf86FreeOffscreenArea (FBAreaPtr area) Bool xf86ResizeOffscreenArea ( FBAreaPtr area int w, int h ) The function: Bool xf86FBManagerRunning(ScreenPtr pScreen); can be used by an extension to check if the driver has initialized the memory manager. The manager is not available if this returns FALSE and the functions above will all fail. xf86AllocateOffscreenArea() can be used to request a rectangle of dimensions width × height (in pixels) from unused offscreen memory. granularity specifies that the leftmost edge of the rectangle must lie on some multiple of granularity pixels. A granularity of zero means the same thing as a granularity of one - no alignment preference. A MoveAreaCallback can be provided to notify the requester when the offscreen area is moved. If no MoveAreaCallback is supplied then the area is considered to be immovable. The privData field will be stored in the manager's internal structure for that allocated area and will be returned to the requester in the FBArea passed via the MoveAreaCallback. An optional RemoveAreaCallback is provided. If the driver provides this it indicates that the area should be allocated with a lower priority. Such an area may be removed when a higher priority request (one that doesn't have a RemoveAreaCallback) is made. When this function is called, the driver will have an opportunity to do whatever cleanup it needs to do to deal with the loss of the area, but it must finish its cleanup before the function exits since the offscreen memory manager will free the area immediately after. xf86AllocateOffscreenArea() returns NULL if it was unable to allocate the requested area. When no longer needed, areas should be freed with xf86FreeOffscreenArea(). xf86ResizeOffscreenArea() resizes an existing FBArea. xf86ResizeOffscreenArea() returns TRUE if the resize was successful. If xf86ResizeOffscreenArea() returns FALSE, the original FBArea is left unmodified. Resizing an area maintains the area's original granularity, devPrivate, and MoveAreaCallback. xf86ResizeOffscreenArea() has considerably less overhead than freeing the old area then reallocating the new size, so it should be used whenever possible. The function: Bool xf86QueryLargestOffscreenArea( ScreenPtr pScreen, int *width, int *height, int granularity, int preferences, int priority ); is provided to query the width and height of the largest single FBArea allocatable given a particular priority. preferences can be one of the following to indicate whether width, height or area should be considered when determining which is the largest single FBArea available. FAVOR_AREA_THEN_WIDTH FAVOR_AREA_THEN_HEIGHT FAVOR_WIDTH_THEN_AREA FAVOR_HEIGHT_THEN_AREA priority is one of the following:
PRIORITY_LOW
Return the largest block available without stealing anyone else's space. This corresponds to the priority of allocating a FBArea when a RemoveAreaCallback is provided.
PRIORITY_NORMAL
Return the largest block available if it is acceptable to steal a lower priority area from someone. This corresponds to the priority of allocating a FBArea without providing a RemoveAreaCallback.
PRIORITY_EXTREME
Return the largest block available if all FBAreas that aren't locked down were expunged from memory first. This corresponds to any allocation made directly after a call to xf86PurgeUnlockedOffscreenAreas().
The function: Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen); is provided as an extreme method to free up offscreen memory. This will remove all removable FBArea allocations. Initialization of the XFree86 framebuffer manager is done via Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox); FullBox represents the area of the framebuffer that the manager is allowed to manage. This is typically a box with a width of pScrn->displayWidth and a height of as many lines as can be fit within the total video memory, however, the driver can reserve areas at the extremities by passing a smaller area to the manager.
Colormap Handling A generic colormap handling layer is provided within the XFree86 common layer. This layer takes care of most of the details, and only requires a function from the driver that loads the hardware palette when required. To use the colormap layer, a driver calls the xf86HandleColormaps() function.
Bool xf86HandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits, LoadPaletteFuncPtr loadPalette, SetOverscanFuncPtr setOverscan, unsigned int flags);
This function must be called after the default colormap has been initialised. The pScrn->gamma field must also be initialised, preferably by calling xf86SetGamma(). maxColors is the number of entries in the palette. sigRGBbits is the size in bits of each color component in the DAC's palette. loadPalette is a driver-provided function for loading a colormap into the hardware, and is described below. setOverscan is an optional function that may be provided when the overscan color is an index from the standard LUT and when it needs to be adjusted to keep it as close to black as possible. The setOverscan function programs the overscan index. It shouldn't normally be used for depths other than 8. setOverscan should be set to NULL when it isn't needed. flags may be set to the following (which may be ORed together): CMAP_PALETTED_TRUECOLOR the TrueColor visual is paletted and is just a special case of DirectColor. This flag is only valid for bpp > 8. CMAP_RELOAD_ON_MODE_SWITCH reload the colormap automatically after mode switches. This is useful for when the driver is resetting the hardware during mode switches and corrupting or erasing the hardware palette. CMAP_LOAD_EVEN_IF_OFFSCREEN reload the colormap even if the screen is switched out of the server's VC. The palette is not reloaded when the screen is switched back in, nor after mode switches. This is useful when the driver needs to keep track of palette changes. The colormap layer normally reloads the palette after VT enters so it is not necessary for the driver to save and restore the palette when switching VTs. The driver must, however, still save the initial palette during server start up and restore it during server exit.
void LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual);
LoadPalette() is a driver-provided function for loading a colormap into hardware. colors is the array of RGB values that represent the full colormap. indices is a list of index values into the colors array. These indices indicate the entries that need to be updated. numColors is the number of the indices to be updated.
void SetOverscan(ScrnInfoPtr pScrn, int overscan);
SetOverscan() is a driver-provided function for programming the overscan index. As described above, it is normally only appropriate for LUT modes where all colormap entries are available for the display, but where one of them is also used for the overscan (typically 8bpp for VGA compatible LUTs). It isn't required in cases where the overscan area is never visible.
DPMS Extension Support code for the DPMS extension is included in the XFree86 common layer. This code provides an interface between the main extension code, and a means for drivers to initialise DPMS when they support it. One function is available to drivers to do this initialisation, and it is always available, even when the DPMS extension is not supported by the core server (in which case it returns a failure result).
Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
This function registers a driver's DPMS level programming function set. It also checks pScrn->options for the "dpms" option, and when present marks DPMS as being enabled for that screen. The set function is called whenever the DPMS level changes, and is used to program the requested level. flags is currently not used, and should be 0. If the initialisation fails for any reason, including when there is no DPMS support in the core server, the function returns FALSE.
Drivers that implement DPMS support must provide the following function, that gets called when the DPMS level is changed:
void ChipDPMSSet(ScrnInfoPtr pScrn, int level, int flags);
Program the DPMS level specified by level. Valid values of level are DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, DPMSModeOff. These values are defined in "extensions/dpms.h".
DGA Extension Drivers can support the XFree86 Direct Graphics Architecture (DGA) by filling out a structure of function pointers and a list of modes and passing them to DGAInit.
Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num); /** The DGAModeRec **/ typedef struct { int num; DisplayModePtr mode; int flags; int imageWidth; int imageHeight; int pixmapWidth; int pixmapHeight; int bytesPerScanline; int byteOrder; int depth; int bitsPerPixel; unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask; int viewportWidth; int viewportHeight; int xViewportStep; int yViewportStep; int maxViewportX; int maxViewportY; int viewportFlags; int offset; unsigned char *address; int reserved1; int reserved2; } DGAModeRec, *DGAModePtr; num Can be ignored. The DGA DDX will assign these numbers. mode A pointer to the DisplayModeRec for this mode. flags The following flags are defined and may be OR'd together: DGA_CONCURRENT_ACCESS Indicates that the driver supports concurrent graphics accelerator and linear framebuffer access. DGA_FILL_RECT DGA_BLIT_RECT DGA_BLIT_RECT_TRANS Indicates that the driver supports the FillRect, BlitRect or BlitTransRect functions in this mode. DGA_PIXMAP_AVAILABLE Indicates that Xlib may be used on the framebuffer. This flag will usually be set unless the driver wishes to prohibit this for some reason. DGA_INTERLACED DGA_DOUBLESCAN Indicates that these are interlaced or double scan modes. imageWidth imageHeight These are the dimensions of the linear framebuffer accessible by the client. pixmapWidth pixmapHeight These are the dimensions of the area of the framebuffer accessible by the graphics accelerator. bytesPerScanline Pitch of the framebuffer in bytes. byteOrder Usually the same as pScrn->imageByteOrder. depth The depth of the framebuffer in this mode. bitsPerPixel The number of bits per pixel in this mode. red_mask green_mask blue_mask The RGB masks for this mode, if applicable. viewportWidth viewportHeight Dimensions of the visible part of the framebuffer. Usually mode->HDisplay and mode->VDisplay. xViewportStep yViewportStep The granularity of x and y viewport positions that the driver supports in this mode. maxViewportX maxViewportY The maximum viewport position supported by the driver in this mode. viewportFlags The following may be OR'd together: DGA_FLIP_IMMEDIATE The driver supports immediate viewport changes. DGA_FLIP_RETRACE The driver supports viewport changes at retrace. offset The offset into the linear framebuffer that corresponds to pixel (0,0) for this mode. address The virtual address of the framebuffer as mapped by the driver. This is needed when DGA_PIXMAP_AVAILABLE is set. /** The DGAFunctionRec **/ typedef struct { Bool (*OpenFramebuffer)( ScrnInfoPtr pScrn, char **name, unsigned char **mem, int *size, int *offset, int *extra ); void (*CloseFramebuffer)(ScrnInfoPtr pScrn); Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode); void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags); int (*GetViewport)(ScrnInfoPtr pScrn); void (*Sync)(ScrnInfoPtr); void (*FillRect)( ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color ); void (*BlitRect)( ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty ); void (*BlitTransRect)( ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color ); } DGAFunctionRec, *DGAFunctionPtr;
Bool OpenFramebuffer (pScrn, name, mem, size, offset, extra);
OpenFramebuffer() should pass the client everything it needs to know to be able to open the framebuffer. These parameters are OS specific and their meanings are to be interpreted by an OS specific client library. name The name of the device to open or NULL if there is no special device to open. A NULL name tells the client that it should open whatever device one would usually open to access physical memory. mem The physical address of the start of the framebuffer. size The size of the framebuffer in bytes. offset Any offset into the device, if applicable. flags Any additional information that the client may need. Currently, only the DGA_NEED_ROOT flag is defined.
void CloseFramebuffer (pScrn);
CloseFramebuffer() merely informs the driver (if it even cares) that client no longer needs to access the framebuffer directly. This function is optional.
Bool SetMode (pScrn, pMode);
SetMode() tells the driver to initialize the mode passed to it. If pMode is NULL, then the driver should restore the original pre-DGA mode.
void SetViewport (pScrn, x, y, flags);
SetViewport() tells the driver to make the upper left-hand corner of the visible screen correspond to coordinate (x,y) on the framebuffer. flags currently defined are: DGA_FLIP_IMMEDIATE The viewport change should occur immediately. DGA_FLIP_RETRACE The viewport change should occur at the vertical retrace, but this function should return sooner if possible. The (x,y) locations will be passed as the client specified them, however, the driver is expected to round these locations down to the next supported location as specified by the xViewportStep and yViewportStep for the current mode.
int GetViewport (pScrn);
GetViewport() gets the current page flip status. Set bits in the returned int correspond to viewport change requests still pending. For instance, set bit zero if the last SetViewport request is still pending, bit one if the one before that is still pending, etc.
void Sync (pScrn);
This function should ensure that any graphics accelerator operations have finished. This function should not return until the graphics accelerator is idle.
void FillRect (pScrn, x, y, w, h, color);
This optional function should fill a rectangle w × h located at (x,y) in the given color.
void BlitRect (pScrn, srcx, srcy, w, h, dstx, dsty);
This optional function should copy an area w × h located at (srcx,srcy) to location (dstx,dsty). This function will need to handle copy directions as appropriate.
void BlitTransRect (pScrn, srcx, srcy, w, h, dstx, dsty, color);
This optional function is the same as BlitRect except that pixels in the source corresponding to the color key color should be skipped.
The XFree86 X Video Extension (Xv) Device Dependent Layer XFree86 offers the X Video Extension which allows clients to treat video as any another primitive and Put video into drawables. By default, the extension reports no video adaptors as being available since the DDX layer has not been initialized. The driver can initialize the DDX layer by filling out one or more XF86VideoAdaptorRecs as described later in this document and passing a list of XF86VideoAdaptorPtr pointers to the following function: Bool xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr *adaptPtrs, int num); After doing this, the extension will report video adaptors as being available, providing the data in their respective XF86VideoAdaptorRecs was valid. xf86XVScreenInit() copies data from the structure passed to it so the driver may free it after the initialization. At the moment, the DDX only supports rendering into Window drawables. Pixmap rendering will be supported after a sufficient survey of suitable hardware is completed. The XF86VideoAdaptorRec: typedef struct { unsigned int type; int flags; char *name; int nEncodings; XF86VideoEncodingPtr pEncodings; int nFormats; XF86VideoFormatPtr pFormats; int nPorts; DevUnion *pPortPrivates; int nAttributes; XF86AttributePtr pAttributes; int nImages; XF86ImagePtr pImages; PutVideoFuncPtr PutVideo; PutStillFuncPtr PutStill; GetVideoFuncPtr GetVideo; GetStillFuncPtr GetStill; StopVideoFuncPtr StopVideo; SetPortAttributeFuncPtr SetPortAttribute; GetPortAttributeFuncPtr GetPortAttribute; QueryBestSizeFuncPtr QueryBestSize; PutImageFuncPtr PutImage; QueryImageAttributesFuncPtr QueryImageAttributes; } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; Each adaptor will have its own XF86VideoAdaptorRec. The fields are as follows: type This can be any of the following flags OR'd together. XvInputMask XvOutputMask These refer to the target drawable and are similar to a Window's class. XvInputMask indicates that the adaptor can put video into a drawable. XvOutputMask indicates that the adaptor can get video from a drawable. XvVideoMask XvStillMask XvImageMask These indicate that the adaptor supports video, still or image primitives respectively. XvWindowMask XvPixmapMask These indicate the types of drawables the adaptor is capable of rendering into. At the moment, Pixmap rendering is not supported and the XvPixmapMask flag is ignored. flags Currently, the following flags are defined: VIDEO_OVERLAID_STILLS Implementing PutStill for hardware that does video as an overlay can be awkward since it's unclear how long to leave the video up for. When this flag is set, StopVideo will be called whenever the destination gets clipped or moved so that the still can be left up until then. VIDEO_OVERLAID_IMAGES Same as VIDEO_OVERLAID_STILLS but for images. VIDEO_CLIP_TO_VIEWPORT Indicates that the clip region passed to the driver functions should be clipped to the visible portion of the screen in the case where the viewport is smaller than the virtual desktop. name The name of the adaptor. nEncodings pEncodings The number of encodings the adaptor is capable of and pointer to the XF86VideoEncodingRec array. The XF86VideoEncodingRec is described later on. For drivers that only support XvImages there should be an encoding named "XV_IMAGE" and the width and height should specify the maximum size source image supported. nFormats pFormats The number of formats the adaptor is capable of and pointer to the XF86VideoFormatRec array. The XF86VideoFormatRec is described later on. nPorts pPortPrivates The number of ports is the number of separate data streams which the adaptor can handle simultaneously. If you have more than one port, the adaptor is expected to be able to render into more than one window at a time. pPortPrivates is an array of pointers or ints - one for each port. A port's private data will be passed to the driver any time the port is requested to do something like put the video or stop the video. In the case where there may be many ports, this enables the driver to know which port the request is intended for. Most commonly, this will contain a pointer to the data structure containing information about the port. In Xv, all ports on a particular adaptor are expected to be identical in their functionality. nAttributes pAttributes The number of attributes recognized by the adaptor and a pointer to the array of XF86AttributeRecs. The XF86AttributeRec is described later on. nImages pImages The number of XF86ImageRecs supported by the adaptor and a pointer to the array of XF86ImageRecs. The XF86ImageRec is described later on. PutVideo PutStill GetVideo GetStill StopVideo SetPortAttribute GetPortAttribute QueryBestSize PutImage QueryImageAttributes These functions define the DDX->driver interface. In each case, the pointer data is passed to the driver. This is the port private for that port as described above. All fields are required except under the following conditions: PutVideo, PutStill and the image routines PutImage and QueryImageAttributes are not required when the adaptor type does not contain XvInputMask. GetVideo and GetStill are not required when the adaptor type does not contain XvOutputMask. GetVideo and PutVideo are not required when the adaptor type does not contain XvVideoMask. GetStill and PutStill are not required when the adaptor type does not contain XvStillMask. PutImage and QueryImageAttributes are not required when the adaptor type does not contain XvImageMask. With the exception of QueryImageAttributes, these functions should return Success if the operation was completed successfully. They can return XvBadAlloc otherwise. QueryImageAttributes returns the size of the XvImage queried. ClipBoxes is an X-Y banded region identical to those used throughout the server. The clipBoxes represent the visible portions of the area determined by drw_x, drw_y, drw_w and drw_h in the Get/Put function. The boxes are in screen coordinates, are guaranteed not to overlap and an empty region will never be passed.
typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data );
This indicates that the driver should take a subsection vid_w by vid_h at location (vid_x,vid_y) from the video stream and direct it into the rectangle drw_w by drw_h at location (drw_x,drw_y) on the screen, scaling as necessary. Due to the large variations in capabilities of the various hardware expected to be used with this extension, it is not expected that all hardware will be able to do this exactly as described. In that case the driver should just do the best it can, scaling as closely to the target rectangle as it can without rendering outside of it. In the worst case, the driver can opt to just not turn on the video.
typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data );
This is same as PutVideo except that the driver should place only one frame from the stream on the screen.
typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data );
This is same as PutVideo except that the driver gets video from the screen and outputs it. The driver should do the best it can to get the requested dimensions correct without reading from an area larger than requested.
typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data );
This is the same as GetVideo except that the driver should place only one frame from the screen into the output stream.
typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool cleanup);
This indicates the driver should stop displaying the video. This is used to stop both input and output video. The cleanup field indicates that the video is being stopped because the client requested it to stop or because the server is exiting the current VT. In that case the driver should deallocate any offscreen memory areas (if there are any) being used to put the video to the screen. If cleanup is not set, the video is being stopped temporarily due to clipping or moving of the window, etc... and video will likely be restarted soon so the driver should not deallocate any offscreen areas associated with that port.
typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,INT32 value, pointer data); typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,INT32 *value, pointer data);
A port may have particular attributes such as hue, saturation, brightness or contrast. Xv clients set and get these attribute values by sending attribute strings (Atoms) to the server. Such requests end up at these driver functions. It is recommended that the driver provide at least the following attributes mentioned in the Xv client library docs: XV_ENCODING XV_HUE XV_SATURATION XV_BRIGHTNESS XV_CONTRAST but the driver may recognize as many atoms as it wishes. If a requested attribute is unknown by the driver it should return BadMatch. XV_ENCODING is the attribute intended to let the client specify which video encoding the particular port should be using (see the description of XF86VideoEncodingRec below). If the requested encoding is unsupported, the driver should return XvBadEncoding. If the value lies outside the advertised range BadValue may be returned. Success should be returned otherwise.
typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, pointer data);
QueryBestSize provides the client with a way to query what the destination dimensions would end up being if they were to request that an area vid_w by vid_h from the video stream be scaled to rectangle of drw_w by drw_h on the screen. Since it is not expected that all hardware will be able to get the target dimensions exactly, it is important that the driver provide this function.
typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int image, char *buf, short width, short height, Bool sync, RegionPtr clipBoxes, pointer data );
This is similar to PutStill except that the source of the video is not a port but the data stored in a system memory buffer at buf. The data is in the format indicated by the image descriptor and represents a source of size width by height. If sync is TRUE the driver should not return from this function until it is through reading the data from buf. Returning when sync is TRUE indicates that it is safe for the data at buf to be replaced, freed, or modified.
typedef int (* QueryImageAttributesFuncPtr)( ScrnInfoPtr pScrn, int image, short *width, short *height, int *pitches, int *offsets);
This function is called to let the driver specify how data for a particular image of size width by height should be stored. Sometimes only the size and corrected width and height are needed. In that case pitches and offsets are NULL. The size of the memory required for the image is returned by this function. The width and height of the requested image can be altered by the driver to reflect format limitations (such as component sampling periods that are larger than one). If pitches and offsets are not NULL, these will be arrays with as many elements in them as there are planes in the image format. The driver should specify the pitch (in bytes) of each scanline in the particular plane as well as the offset to that plane (in bytes) from the beginning of the image.
The XF86VideoEncodingRec:
typedef struct { int id; char *name; unsigned short width, height; XvRationalRec rate; } XF86VideoEncodingRec, *XF86VideoEncodingPtr;
The XF86VideoEncodingRec specifies what encodings the adaptor can support. Most of this data is just informational and for the client's benefit, and is what will be reported by XvQueryEncodings. The id field is expected to be a unique identifier to allow the client to request a certain encoding via the XV_ENCODING attribute string.
The XF86VideoFormatRec:
typedef struct { char depth; short class; } XF86VideoFormatRec, *XF86VideoFormatPtr;
This specifies what visuals the video is viewable in. depth is the depth of the visual (not bpp). class is the visual class such as TrueColor, DirectColor or PseudoColor. Initialization of an adaptor will fail if none of the visuals on that screen are supported.
The XF86AttributeRec:
typedef struct { int flags; int min_value; int max_value; char *name; } XF86AttributeListRec, *XF86AttributeListPtr;
Each adaptor may have an array of these advertising the attributes for its ports. Currently defined flags are XvGettable and XvSettable which may be OR'd together indicating that attribute is gettable or settable by the client. The min and max field specify the valid range for the value. Name is a text string describing the attribute by name.
The XF86ImageRec:
typedef struct { int id; int type; int byte_order; char guid[16]; int bits_per_pixel; int format; int num_planes; /* for RGB formats */ int depth; unsigned int red_mask; unsigned int green_mask; unsigned int blue_mask; /* for YUV formats */ unsigned int y_sample_bits; unsigned int u_sample_bits; unsigned int v_sample_bits; unsigned int horz_y_period; unsigned int horz_u_period; unsigned int horz_v_period; unsigned int vert_y_period; unsigned int vert_u_period; unsigned int vert_v_period; char component_order[32]; int scanline_order; } XF86ImageRec, *XF86ImagePtr;
XF86ImageRec describes how video source data is laid out in memory. The fields are as follows: id This is a unique descriptor for the format. It is often good to set this value to the FOURCC for the format when applicable. type This is XvRGB or XvYUV. byte_order This is LSBFirst or MSBFirst. guid This is the Globally Unique IDentifier for the format. When not applicable, all characters should be NULL. bits_per_pixel The number of bits taken up (but not necessarily used) by each pixel. Note that for some planar formats which have fractional bits per pixel (such as IF09) this number may be rounded _down_. format This is XvPlanar or XvPacked. num_planes The number of planes in planar formats. This should be set to one for packed formats. depth The significant bits per pixel in RGB formats (analgous to the depth of a pixmap format). red_mask green_mask blue_mask The red, green and blue bitmasks for packed RGB formats. y_sample_bits u_sample_bits v_sample_bits The y, u and v sample sizes (in bits). horz_y_period horz_u_period horz_v_period The y, u and v sampling periods in the horizontal direction. vert_y_period vert_u_period vert_v_period The y, u and v sampling periods in the vertical direction. component_order Uppercase ascii characters representing the order that samples are stored within packed formats. For planar formats this represents the ordering of the planes. Unused characters in the 32 byte string should be set to NULL. scanline_order This is XvTopToBottom or XvBottomToTop. Since some formats (particular some planar YUV formats) may not be completely defined by the parameters above, the guid, when available, should provide the most accurate description of the format.
The Loader This section describes the interfaces to the module loader. The loader interfaces can be divided into two groups: those that are only available to the XFree86 common layer, and those that are also available to modules. Loader Overview The loader is capable of loading modules in a range of object formats, and knowledge of these formats is built in to the loader. Knowledge of new object formats can be added to the loader in a straightforward manner. This makes it possible to provide OS-independent modules (for a given CPU architecture type). In addition to this, the loader can load modules via the OS-provided dlopen(3) service where available. Such modules are not platform independent, and the semantics of dlopen() on most systems results in significant limitations in the use of modules of this type. Support for dlopen() modules in the loader is primarily for experimental and development purposes. Symbols exported by the loader (on behalf of the core X server) to modules are determined at compile time. Only those symbols explicitly exported are available to modules. All external symbols of loaded modules are exported to other modules, and to the core X server. The loader can be requested to check for unresolved symbols at any time, and the action to be taken for unresolved symbols can be controlled by the caller of the loader. Typically the caller identifies which symbols can safely remain unresolved and which cannot. NOTE: Now that ISO-C allows pointers to functions and pointers to data to have different internal representations, some of the following interfaces will need to be revisited. Semi-private Loader Interface The following is the semi-private loader interface that is available to the XFree86 common layer.
void LoaderInit(void);
The LoaderInit() function initialises the loader, and it must be called once before calling any other loader functions. This function initialises the tables of exported symbols, and anything else that might need to be initialised.
void LoaderSetPath(const char *path);
The LoaderSetPath() function initialises a default module search path. This must be called if calls to other functions are to be made without explicitly specifying a module search path. The search path path must be a string of one or more comma separated absolute paths. Modules are expected to be located below these paths, possibly in subdirectories of these paths.
pointer LoadModule(const char *module, pointer options, const XF86ModReqInfo * modreq, int *errmaj);
The LoadModule() function loads the module called module. The return value is a module handle, and may be used in future calls to the loader that require a reference to a loaded module. The module name module is normally the module's canonical name, which doesn't contain any directory path information, or any object/library file prefixes of suffixes. Currently a full pathname and/or filename is also accepted. This might change. The other parameters are: options An optional parameter that is passed to the newly loaded module's SetupProc function (if it has one). This argument is normally a NULL terminated list of Options, and must be interpreted that way by modules loaded directly by the XFree86 common layer. However, it may be used for application-specific parameter passing in other situations. modreq An optional XF86ModReqInfo* containing version/ABI/vendor information to requirements to check the newly loaded module against. The main purpose of this is to allow the loader to verify that a module of the correct type/version before running its SetupProc function. The XF86ModReqInfo struct is defined as follows: typedef struct { CARD8 majorversion; CARD8 minorversion; CARD16 patchlevel; const char * abiclass; CARD32 abiversion; const char * moduleclass; } XF86ModReqInfo; The information here is compared against the equivalent information in the module's XF86ModuleVersionInfo record (which is described below). The values in comments above indicate don't care settings for each of the fields. The comparisons made are as follows: majorversion Must match the module's majorversion exactly. minorversion The module's minor version must be no less than this value. This comparison is only made if majorversion matches. patchlevel The module's patchlevel must be no less than this value. This comparison is only made if minorversion matches. abiclass String must match the module's abiclass string. abiversion Must be consistent with the module's abiversion (major equal, minor no older). moduleclass String must match the module's moduleclass string. errmaj An optional pointer to a variable holding the major part or the error code. When provided, *errmaj is filled in when LoadModule() fails.
void UnloadModule(pointer mod);
This function unloads the module referred to by the handle mod. All child modules are also unloaded recursively. This function must not be used to directly unload modules that are child modules (i.e., those that have been loaded with the LoadSubModule() described below).
Module Requirements Modules must provide information about themselves to the loader, and may optionally provide entry points for "setup" and "teardown" functions (those two functions are referred to here as SetupProc and TearDownProc). The module information is contained in the XF86ModuleVersionInfo struct, which is defined as follows: typedef struct { const char * modname; /* name of module, e.g. "foo" */ const char * vendor; /* vendor specific string */ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */ CARD32 _modinfo2_; /* infoarea with a binary editor/sign tool */ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */ CARD8 majorversion; /* module-specific major version */ CARD8 minorversion; /* module-specific minor version */ CARD16 patchlevel; /* module-specific patch level */ const char * abiclass; /* ABI class that the module uses */ CARD32 abiversion; /* ABI version */ const char * moduleclass; /* module class */ CARD32 checksum[4]; /* contains a digital signature of the */ /* version info structure */ } XF86ModuleVersionInfo; The fields are used as follows: modname The module's name. This field is currently only for informational purposes, but the loader may be modified in future to require it to match the module's canonical name. vendor The module vendor. This field is for informational purposes only. _modinfo1_ This field holds the first part of a signature that can be used to locate this structure in the binary. It should always be initialised to MODINFOSTRING1. _modinfo2_ This field holds the second part of a signature that can be used to locate this structure in the binary. It should always be initialised to MODINFOSTRING2. xf86version The XFree86 version against which the module was compiled. This is mostly for informational/diagnostic purposes. It should be initialised to XF86_VERSION_CURRENT, which is defined in xf86Version.h. majorversion The module-specific major version. For modules where this version is used for more than simply informational purposes, the major version should only change (be incremented) when ABI incompatibilities are introduced, or ABI components are removed. minorversion The module-specific minor version. For modules where this version is used for more than simply informational purposes, the minor version should only change (be incremented) when ABI additions are made in a backward compatible way. It should be reset to zero when the major version is increased. patchlevel The module-specific patch level. The patch level should increase with new revisions of the module where there are no ABI changes, and it should be reset to zero when the minor version is increased. abiclass The ABI class that the module requires. The class is specified as a string for easy extensibility. It should indicate which (if any) of the X server's built-in ABI classes that the module relies on, or a third-party ABI if appropriate. Built-in ABI classes currently defined are: ABI_CLASS_NONE no class ABI_CLASS_ANSIC only requires the ANSI C interfaces ABI_CLASS_VIDEODRV requires the video driver ABI ABI_CLASS_XINPUT requires the XInput driver ABI ABI_CLASS_EXTENSION requires the extension module ABI abiversion The version of abiclass that the module requires. The version consists of major and minor components. The major version must match and the minor version must be no newer than that provided by the server or parent module. Version identifiers for the built-in classes currently defined are: ABI_ANSIC_VERSION ABI_VIDEODRV_VERSION ABI_XINPUT_VERSION ABI_EXTENSION_VERSION moduleclass This is similar to the abiclass field, except that it defines the type of module rather than the ABI it requires. For example, although all video drivers require the video driver ABI, not all modules that require the video driver ABI are video drivers. This distinction can be made with the moduleclass. Currently pre-defined module classes are: MOD_CLASS_NONE MOD_CLASS_VIDEODRV MOD_CLASS_XINPUT MOD_CLASS_EXTENSION checksum Not currently used. The module version information, and the optional SetupProc and TearDownProc entry points are found by the loader by locating a data object in the module called "modnameModuleData", where "modname" is the canonical name of the module. Modules must contain such a data object, and it must be declared with global scope, be compile-time initialised, and is of the following type: typedef struct { XF86ModuleVersionInfo * vers; ModuleSetupProc setup; ModuleTearDownProc teardown; } XF86ModuleData; The vers parameter must be initialised to a pointer to a correctly initialised XF86ModuleVersionInfo struct. The other two parameter are optional, and should be initialised to NULL when not required. The other parameters are defined as
typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *); typedef void (*ModuleTearDownProc)(pointer); pointer SetupProc(pointer module, pointer options, int *errmaj, int *errmin);
When defined, this function is called by the loader after successfully loading a module. module is a handle for the newly loaded module, and maybe used by the SetupProc if it calls other loader functions that require a reference to it. The remaining arguments are those that were passed to the LoadModule() (or LoadSubModule()), and are described above. When the SetupProc is successful it must return a non-NULL value. The loader checks this, and if it is NULL it unloads the module and reports the failure to the caller of LoadModule(). If the SetupProc does things that need to be undone when the module is unloaded, it should define a TearDownProc, and return a pointer that the TearDownProc can use to undo what has been done. When a module is loaded multiple times, the SetupProc is called once for each time it is loaded.
void TearDownProc(pointer tearDownData);
When defined, this function is called when the loader unloads a module. The tearDownData parameter is the return value of the SetupProc() that was called when the module was loaded. The purpose of this function is to clean up before the module is unloaded (for example, by freeing allocated resources).
Public Loader Interface The following is the Loader interface that is available to any part of the server, and may also be used from within modules.
pointer LoadSubModule(pointer parent, const char *module, const char **subdirlist, const char **patternlist, pointer options, const XF86ModReqInfo * modreq, int *errmaj, int *errmin);
This function is like the LoadModule() function described above, except that the module loaded is registered as a child of the calling module. The parent parameter is the calling module's handle. Modules loaded with this function are automatically unloaded when the parent module is unloaded.
void UnloadSubModule(pointer module);
This function unloads the module with handle module. If that module itself has children, they are also unloaded. It is like UnloadModule(), except that it is safe to use for unloading child modules.
pointer LoaderSymbol(const char *symbol);
This function returns the address of the symbol with name symbol. This may be used to locate a module entry point with a known name.
char **LoaderlistDirs(const char **subdirlist, const char **patternlist);
This function returns a NULL terminated list of canonical modules names for modules found in the default module search path. The subdirlist and patternlist parameters are as described above, and can be used to control the locations and names that are searched. If no modules are found, the return value is NULL. The returned list should be freed by calling LoaderFreeDirList() when it is no longer needed.
void LoaderFreeDirList(char **list);
This function frees a module list created by LoaderlistDirs().
void LoaderReqSymLists(const char **list0, ...);
This function allows the registration of required symbols with the loader. It is normally used by a caller of LoadSubModule(). If any symbols registered in this way are found to be unresolved when LoaderCheckUnresolved() is called then LoaderCheckUnresolved() will report a failure. The function takes one or more NULL terminated lists of symbols. The end of the argument list is indicated by a NULL argument.
void LoaderReqSymbols(const char *sym0, ...);
This function is like LoaderReqSymLists() except that its arguments are symbols rather than lists of symbols. This function is more convenient when single functions are to be registered, especially when the single function might depend on runtime factors. The end of the argument list is indicated by a NULL argument.
void LoaderRefSymLists(const char **list0, ...);
This function allows the registration of possibly unresolved symbols with the loader. When LoaderCheckUnresolved() is run it won't generate warnings for symbols registered in this way unless they were also registered as required symbols. The function takes one or more NULL terminated lists of symbols. The end of the argument list is indicated by a NULL argument.
void LoaderRefSymbols(const char *sym0, ...);
This function is like LoaderRefSymLists() except that its arguments are symbols rather than lists of symbols. This function is more convenient when single functions are to be registered, especially when the single function might depend on runtime factors. The end of the argument list is indicated by a NULL argument.
int LoaderCheckUnresolved(int delayflag);
This function checks for unresolved symbols. It generates warnings for unresolved symbols that have not been registered with LoaderRefSymLists(), and maps them to a dummy function. This behaviour may change in future. If unresolved symbols are found that have been registered with LoaderReqSymLists() or LoaderReqSymbols() then this function returns a non-zero value. If none of these symbols are unresolved the return value is zero, indicating success. The delayflag parameter should normally be set to LD_RESOLV_IFDONE.
LoaderErrorMsg(const char *name, const char *modname, int errmaj, int errmin);
This function prints an error message that includes the text Failed to load module, the module name modname, a message specific to the errmaj value, and the value if errmin. If name is non-NULL, it is printed as an identifying prefix to the message (followed by a :).
Special Registration Functions The loader contains some functions for registering some classes of modules. These may be moved out of the loader at some point.
void LoadExtensionList(const ExtensionModule ext[], int size, Bool builtin);
This registers the entry points for the extension array identified by ext. The ExtensionModule struct is defined as: typedef struct { InitExtension initFunc; char * name; Bool *disablePtr; } ExtensionModule;
Helper Functions This section describe helper functions that video driver might find useful. While video drivers are not required to use any of these to be considered compliant, the use of appropriate helpers is strongly encouraged to improve the consistency of driver behaviour. Functions for printing messages
ErrorF(const char *format, ...);
This is the basic function for writing to the error log (typically stderr and/or a log file). Video drivers should usually avoid using this directly in favour of the more specialised functions described below. This function is useful for printing messages while debugging a driver.
FatalError(const char *format, ...);
This prints a message and causes the Xserver to abort. It should rarely be used within a video driver, as most error conditions should be flagged by the return values of the driver functions. This allows the higher layers to decide how to proceed. In rare cases, this can be used within a driver if a fatal unexpected condition is found.
xf86ErrorF(const char *format, ...);
This is like ErrorF(), except that the message is only printed when the Xserver's verbosity level is set to the default (1) or higher. It means that the messages are not printed when the server is started with the flag. Typically this function would only be used for continuing messages started with one of the more specialised functions described below.
xf86ErrorFVerb(int verb, const char *format, ...);
Like xf86ErrorF(), except the minimum verbosity level for which the message is to be printed is given explicitly. Passing a verb value of zero means the message is always printed. A value higher than 1 can be used for information would normally not be needed, but which might be useful when diagnosing problems.
xf86Msg(MessageType type, const char *format, ...);
This is like xf86ErrorF(), except that the message is prefixed with a marker determined by the value of type. The marker is used to indicate the type of message (warning, error, probed value, config value, etc). Note the xf86Verbose value is ignored for messages of type X_ERROR. The marker values are: X_PROBED Value was probed. X_CONFIG Value was given in the config file. X_DEFAULT Value is a default. X_CMDLINE Value was given on the command line. X_NOTICE Notice. X_ERROR Error message. X_WARNING Warning message. X_INFO Informational message. X_NONE No prefix. X_NOT_IMPLEMENTED The message relates to functionality that is not yetimplemented.
xf86MsgVerb(MessageType type, int verb, const char *format, ...);
Like xf86Msg(), but with the verbosity level given explicitly.
xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...);
This is like xf86Msg() except that the driver's name (the name field of the ScrnInfoRec) followed by the scrnIndex in parentheses is printed following the prefix. This should be used by video drivers in most cases as it clearly indicates which driver/screen the message is for. If scrnIndex is negative, this function behaves exactly like xf86Msg(). NOTE: This function can only be used after the ScrnInfoRec and its name field have been allocated. Normally, this means that it can not be used before the END of the ChipProbe() function. Prior to that, use xf86Msg(), providing the driver's name explicitly. No screen number can be supplied at that point.
xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, ...);
Like xf86DrvMsg(), but with the verbosity level given explicitly.
Functions for setting values based on command line and config file
Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp, int depth24flags);
This function sets the depth, pixmapBPP and bitsPerPixel fields of the ScrnInfoRec. It also determines the defaults for display-wide attributes and pixmap formats the screen will support, and finds the Display subsection that matches the depth/bpp. This function should normally be called very early from the ChipPreInit() function. It requires that the confScreen field of the ScrnInfoRec be initialised prior to calling it. This is done by the XFree86 common layer prior to calling ChipPreInit(). The parameters passed are: depth driver's preferred default depth if no other is given. If zero, use the overall server default. bpp Same, but for the pixmap bpp. fbbpp Same, but for the framebuffer bpp. depth24flags Flags that indicate the level of 24/32bpp support and whether conversion between different framebuffer and pixmap formats is supported. The flags for this argument are defined as follows, and multiple flags may be ORed together: NoDepth24Support No depth 24 formats supported Support24bppFb 24bpp framebuffer supported Support32bppFb 32bpp framebuffer supported SupportConvert24to32 Can convert 24bpp pixmap to 32bpp fb SupportConvert32to24 Can convert 32bpp pixmap to 24bpp fb ForceConvert24to32 Force 24bpp pixmap to 32bpp fb conversion ForceConvert32to24 Force 32bpp pixmap to 24bpp fb conversion It uses the command line, config file, and default values in the correct order of precedence to determine the depth and bpp values. It is up to the driver to check the results to see that it supports them. If not the ChipPreInit() function should return FALSE. If only one of depth/bpp is given, the other is set to a reasonable (and consistent) default. If a driver finds that the initial depth24flags it uses later results in a fb format that requires more video memory than is available it may call this function a second time with a different depth24flags setting. On success, the return value is TRUE. On failure it prints an error message and returns FALSE. The following fields of the ScrnInfoRec are initialised by this function:
depth, bitsPerPixel, display, imageByteOrder, bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats, formats, fbFormat.
void xf86PrintDepthBpp(scrnInfoPtr scrp);
This function can be used to print out the depth and bpp settings. It should be called after the final call to xf86SetDepthBpp().
Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
This function sets the weight, mask, offset and rgbBits fields of the ScrnInfoRec. It would normally be called fairly early in the ChipPreInit() function for depths > 8bpp. It requires that the depth and display fields of the ScrnInfoRec be initialised prior to calling it. The parameters passed are: weight driver's preferred default weight if no other is given. If zero, use the overall server default. mask Same, but for mask. It uses the command line, config file, and default values in the correct order of precedence to determine the weight value. It derives the mask and offset values from the weight and the defaults. It is up to the driver to check the results to see that it supports them. If not the ChipPreInit() function should return FALSE. On success, this function prints a message showing the weight values selected, and returns TRUE. On failure it prints an error message and returns FALSE. The following fields of the ScrnInfoRec are initialised by this function:
weight, mask, offset.
Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
This function sets the defaultVisual field of the ScrnInfoRec. It would normally be called fairly early from the ChipPreInit() function. It requires that the depth and display fields of the ScrnInfoRec be initialised prior to calling it. The parameters passed are: visual driver's preferred default visual if no other is given. If -1, use the overall server default. It uses the command line, config file, and default values in the correct order of precedence to determine the default visual value. It is up to the driver to check the result to see that it supports it. If not the ChipPreInit() function should return FALSE. On success, this function prints a message showing the default visual selected, and returns TRUE. On failure it prints an error message and returns FALSE.
Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma);
This function sets the gamma field of the ScrnInfoRec. It would normally be called fairly early from the ChipPreInit() function in cases where the driver supports gamma correction. It requires that the monitor field of the ScrnInfoRec be initialised prior to calling it. The parameters passed are: gamma driver's preferred default gamma if no other is given. If zero (< 0.01), use the overall server default. It uses the command line, config file, and default values in the correct order of precedence to determine the gamma value. It is up to the driver to check the results to see that it supports them. If not the ChipPreInit() function should return FALSE. On success, this function prints a message showing the gamma value selected, and returns TRUE. On failure it prints an error message and returns FALSE.
void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
This function sets the xDpi and yDpi fields of the ScrnInfoRec. The driver can specify preferred defaults by setting x and y to non-zero values. The command line option overrides all other settings. Otherwise, if the DisplaySize entry is present in the screen's &k.monitor; config file section, it is used together with the virtual size to calculate the dpi values. This function should be called after all the mode resolution has been done.
void xf86SetBlackWhitePixels(ScrnInfoPtr pScrn);
This functions sets the blackPixel and whitePixel fields of the ScrnInfoRec according to whether or not the command line options is present.
const char *xf86GetVisualName(int visual);
Returns a printable string with the visual name matching the numerical visual class provided. If the value is outside the range of valid visual classes, NULL is returned.
Primary Mode functions The primary mode helper functions are those which would normally be used by a driver, unless it has unusual requirements which cannot be catered for the by the helpers.
int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, int maxHeight, int virtualX, int virtualY, unsigned long apertureSize, LookupModeFlags strategy);
This function basically selects the set of modes to use based on those available and the various constraints. It also sets some other related parameters. It is normally called near the end of the ChipPreInit() function. The parameters passed to the function are: availModes List of modes available for the monitor. modeNames List of mode names that the screen is requesting. clockRanges A list of clock ranges allowed by the driver. Each range includes whether interlaced or multiscan modes are supported for that range. See below for more on clockRanges. linePitches List of line pitches supported by the driver. This is optional and should be NULL when not used. minPitch Minimum line pitch supported by the driver. This must be supplied when linePitches is NULL, and is ignored otherwise. maxPitch Maximum line pitch supported by the driver. This is required when minPitch is required. pitchInc Granularity of horizontal pitch values as supported by the chipset. This is expressed in bits. This must be supplied. minHeight minimum virtual height allowed. If zero, no limit is imposed. maxHeight maximum virtual height allowed. If zero, no limit is imposed. virtualX If greater than zero, this is the virtual width value that will be used. Otherwise, the virtual width is chosen to be the smallest that can accommodate the modes selected. virtualY If greater than zero, this is the virtual height value that will be used. Otherwise, the virtual height is chosen to be the smallest that can accommodate the modes selected. apertureSize The size (in bytes) of the aperture used to access video memory. strategy The strategy to use when choosing from multiple modes with the same name. The options are: LOOKUP_DEFAULT ??? LOOKUP_BEST_REFRESH mode with best refresh rate LOOKUP_CLOSEST_CLOCK mode with closest matching clock LOOKUP_LIST_ORDER first usable mode in list The following options can also be combined (OR'ed) with one of the above: LOOKUP_CLKDIV2 Allow halved clocks LOOKUP_OPTIONAL_TOLERANCES Allow missing horizontal sync and/or vertical refresh ranges in the xorg.conf Monitor section LOOKUP_OPTIONAL_TOLERANCES should only be specified when the driver can ensure all modes it generates can sync on, or at least not damage, the monitor or digital flat panel. Horizontal sync and/or vertical refresh ranges specified by the user will still be honoured (and acted upon). This function requires that the following fields of the ScrnInfoRec are initialised prior to calling it: clock[] List of discrete clocks (when non-programmable) numClocks Number of discrete clocks (when non-programmable) progClock Whether the clock is programmable or not monitor Pointer to the applicable xorg.conf monitor section fdFormat Format of the screen buffer videoRam total video memory size (in bytes) xInc Horizontal timing increment in pixels (defaults to 8) This function fills in the following ScrnInfoRec fields: modePool A subset of the modes available to the monitor which are compatible with the driver. modes One mode entry for each of the requested modes, with the status field of each filled in to indicate if the mode has been accepted or not. This list of modes is a circular list. virtualX The resulting virtual width. virtualY The resulting virtual height. displayWidth The resulting line pitch. The first stage of this function checks that the virtualX and virtualY values supplied (if greater than zero) are consistent with the line pitch and maxHeight limitations. If not, an error message is printed, and the return value is -1. The second stage sets up the mode pool, eliminating immediately any modes that exceed the driver's line pitch limits, and also the virtual width and height limits (if greater than zero). For each mode removed an informational message is printed at verbosity level 2. If the mode pool ends up being empty, a warning message is printed, and the return value is 0. The final stage is to lookup each mode name, and fill in the remaining parameters. If an error condition is encountered, a message is printed, and the return value is -1. Otherwise, the return value is the number of valid modes found (0 if none are found). Even if the supplied mode names include duplicates, no two names will ever match the same mode. Furthermore, if the supplied mode names do not yield a valid mode (including the case where no names are passed at all), the function will continue looking through the mode pool until it finds a mode that survives all checks, or until the mode pool is exhausted. A message is only printed by this function when a fundamental problem is found. It is intended that this function may be called more than once if there is more than one set of constraints that the driver can work within. If this function returns -1, the ChipPreInit() function should return FALSE. clockRanges is a linked list of clock ranges allowed by the driver. If a mode doesn't fit in any of the defined clockRanges, it is rejected. The first clockRange that matches all requirements is used. This structure needs to be initialized to NULL when allocated. clockRanges contains the following fields: minClock maxClock The lower and upper mode clock bounds for which the rest of the clockRange parameters apply. Since these are the mode clocks, they are not scaled with the ClockMulFactor and ClockDivFactor. It is up to the driver to adjust these values if they depend on the clock scaling factors. clockIndex (not used yet) -1 for programmable clocks interlaceAllowed TRUE if interlacing is allowed for this range doubleScanAllowed TRUE if doublescan or multiscan is allowed for this range ClockMulFactor ClockDivFactor Scaling factors that are applied to the mode clocks ONLY before selecting a clock index (when there is no programmable clock) or a SynthClock value. This is useful for drivers that support pixel multiplexing or that need to scale the clocks because of hardware restrictions (like sending 24bpp data to an 8 bit RAMDAC using a tripled clock). Note that these parameters describe what must be done to the mode clock to achieve the data transport clock between graphics controller and RAMDAC. For example for 2:1 pixel multiplexing, two pixels are sent to the RAMDAC on each clock. This allows the RAMDAC clock to be half of the actual pixel clock. Hence, ClockMulFactor=1 and ClockDivFactor=2. This means that the clock used for clock selection (ie, determining the correct clock index from the list of discrete clocks) or for the SynthClock field in case of a programmable clock is: (mode->Clock * ClockMulFactor) / ClockDivFactor. PrivFlags This field is copied into the mode->PrivFlags field when this clockRange is selected by xf86ValidateModes(). It allows the driver to find out what clock range was selected, so it knows it needs to set up pixel multiplexing or any other range-dependent feature. This field is purely driver-defined: it may contain flag bits, an index or anything else (as long as it is an INT). Note that the mode->SynthClock field is always filled in by xf86ValidateModes(): it will contain the data transport clock, which is the clock that will have to be programmed in the chip when it has a programmable clock, or the clock that will be picked from the clocks list when it is not a programmable one. Thus: mode->SynthClock = (mode->Clock * ClockMulFactor) / ClockDivFactor
void xf86PruneDriverModes(ScrnInfoPtr scrp);
This function deletes modes in the modes field of the ScrnInfoRec that have been marked as invalid. This is normally run after having run xf86ValidateModes() for the last time. For each mode that is deleted, a warning message is printed out indicating the reason for it being deleted.
void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
This function fills in the Crtc* fields for all the modes in the modes field of the ScrnInfoRec. The adjustFlags parameter determines how the vertical CRTC values are scaled for interlaced modes. They are halved if it is INTERLACE_HALVE_V. The vertical CRTC values are doubled for doublescan modes, and are further multiplied by the VScan value. This function is normally called after calling xf86PruneDriverModes().
void xf86PrintModes(ScrnInfoPtr scrp);
This function prints out the virtual size setting, and the line pitch being used. It also prints out two lines for each mode being used. The first line includes the mode's pixel clock, horizontal sync rate, refresh rate, and whether it is interlaced, doublescanned and/or multi-scanned. The second line is the mode's Modeline. This function is normally called after calling xf86SetCrtcForModes().
Secondary Mode functions The secondary mode helper functions are functions which are normally used by the primary mode helper functions, and which are not normally called directly by a driver. If a driver has unusual requirements and needs to do its own mode validation, it might be able to make use of some of these secondary mode helper functions.
const char *xf86ModeStatusToString(ModeStatus status);
This function converts the status value to a descriptive printable string.
void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
This function deletes the mode given from the modeList. It never prints any messages, so it is up to the caller to print a message if required.
Functions for handling strings and tokens Tables associating strings and numerical tokens combined with the following functions provide a compact way of handling strings from the config file, and for converting tokens into printable strings. The table data structure is: typedef struct { int token; const char * name; } SymTabRec, *SymTabPtr; A table is an initialised array of SymTabRec. The tokens must be non-negative integers. Multiple names may be mapped to a single token. The table is terminated with an element with a token value of -1 and NULL for the name.
const char *xf86TokenToString(SymTabPtr table, int token);
This function returns the first string in table that matches token. If no match is found, NULL is returned (NOTE, older versions of this function would return the string "unknown" when no match is found).
int xf86StringToToken(SymTabPtr table, const char *string);
This function returns the first token in table that matches string. The xf86NameCmp() function is used to determine the match. If no match is found, -1 is returned.
Functions for finding which config file entries to use These functions can be used to select the appropriate config file entries that match the detected hardware. They are described above in the Probe and Available Functions sections. Probing discrete clocks on old hardware The xf86GetClocks() function may be used to assist in finding the discrete pixel clock values on older hardware.
void xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), void (*ProtectRegs)(ScrnInfoPtr, Bool), void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg, int maskval, int knownclkindex, int knownclkvalue);
This function uses a comparative sampling method to measure the discrete pixel clock values. The number of discrete clocks to measure is given by num. clockFunc is a function that selects the n'th clock. It should also save or restore any state affected by programming the clocks when the index passed is CLK_REG_SAVE or CLK_REG_RESTORE. ProtectRegs is a function that does whatever is required to protect the hardware state while selecting a new clock. BlankScreen is a function that blanks the screen. vertsyncreg and maskval are the register and bitmask to check for the presence of vertical sync pulses. knownclkindex and knownclkvalue are the index and value of a known clock. These are the known references on which the comparative measurements are based. The number of clocks probed is set in pScrn->numClocks, and the probed clocks are set in the pScrn->clock[] array. All of the clock values are in units of kHz.
void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
Print out the pixel clocks scrp->clock[]. from indicates whether the clocks were probed or from the config file.
Other helper functions
Bool xf86IsUnblank(int mode);
Returns TRUE when the screen saver mode specified by mode requires the screen be unblanked, and FALSE otherwise. The screen saver modes that require blanking are SCREEN_SAVER_ON and SCREEN_SAVER_CYCLE, and the screen saver modes that require unblanking are SCREEN_SAVER_OFF and SCREEN_SAVER_FORCER. Drivers may call this helper from their SaveScreen() function to interpret the screen saver modes.
The vgahw module The vgahw modules provides an interface for saving, restoring and programming the standard VGA registers, and for handling VGA colourmaps. Data Structures The public data structures used by the vgahw module are vgaRegRec and vgaHWRec. They are defined in vgaHW.h. General vgahw Functions
Bool vgaHWGetHWRec(ScrnInfoPtr pScrn);
This function allocates a vgaHWRec structure, and hooks it into the ScrnInfoRec's privates. Like all information hooked into the privates, it is persistent, and only needs to be allocated once per screen. This function should normally be called from the driver's ChipPreInit() function. The vgaHWRec is zero-allocated, and the following fields are explicitly initialised: ModeReg.DAC[] initialised with a default colourmap ModeReg.Attribute[0x11] initialised with the default overscan index ShowOverscan initialised according to the "ShowOverscan" option paletteEnabled initialised to FALSE cmapSaved initialised to FALSE pScrn initialised to pScrn In addition to the above, vgaHWSetStdFuncs() is called to initialise the register access function fields with the standard VGA set of functions. Once allocated, a pointer to the vgaHWRec can be obtained from the ScrnInfoPtr with the VGAHWPTR(pScrn) macro.
void vgaHWFreeHWRec(ScrnInfoPtr pScrn);
This function frees a vgaHWRec structure. It should be called from a driver's ChipFreeScreen() function.
Bool vgaHWSetRegCounts(ScrnInfoPtr pScrn, int numCRTC, int numSequencer, int numGraphics, int numAttribute);
This function allows the number of CRTC, Sequencer, Graphics and Attribute registers to be changed. This makes it possible for extended registers to be saved and restored with vgaHWSave() and vgaHWRestore(). This function should be called after a vgaHWRec has been allocated with vgaHWGetHWRec(). The default values are defined in vgaHW.h as follows: #define VGA_NUM_CRTC 25 #define VGA_NUM_SEQ 5 #define VGA_NUM_GFX 9 #define VGA_NUM_ATTR 21
Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src);
This function copies the contents of the VGA saved registers in src to dst. Note that it isn't possible to simply do this with memcpy() (or similar). This function returns TRUE unless there is a problem allocating space for the CRTC and related fields in dst.
void vgaHWSetStdFuncs(vgaHWPtr hwp);
This function initialises the register access function fields of hwp with the standard VGA set of functions. This is called by vgaHWGetHWRec(), so there is usually no need to call this explicitly. The register access functions are described below. If the registers are shadowed in some other port I/O space (for example a PCI I/O region), these functions can be used to access the shadowed registers if hwp->PIOOffset is initialised with offset, calculated in such a way that when the standard VGA I/O port value is added to it the correct offset into the PIO area results. This value is initialised to zero in vgaHWGetHWRec(). (Note: the PIOOffset functionality is present in XFree86 4.1.0 and later.)
void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset);
This function initialised the register access function fields of hwp with a generic MMIO set of functions. hwp->MMIOBase is initialised with base, which must be the virtual address that the start of MMIO area is mapped to. hwp->MMIOOffset is initialised with offset, which must be calculated in such a way that when the standard VGA I/O port value is added to it the correct offset into the MMIO area results. That means that these functions are only suitable when the VGA I/O ports are made available in a direct mapping to the MMIO space. If that is not the case, the driver will need to provide its own register access functions. The register access functions are described below.
Bool vgaHWMapMem(ScrnInfoPtr pScrn);
This function maps the VGA memory window. It requires that the vgaHWRec be allocated. If a driver requires non-default MapPhys or MapSize settings (the physical location and size of the VGA memory window) then those fields of the vgaHWRec must be initialised before calling this function. Otherwise, this function initialiases the default values of 0xA0000 for MapPhys and (64 * 1024) for MapSize. This function must be called before attempting to save or restore the VGA state. If the driver doesn't call it explicitly, the vgaHWSave() and vgaHWRestore() functions may call it if they need to access the VGA memory (in which case they will also call vgaHWUnmapMem() to unmap the VGA memory before exiting).
void vgaHWUnmapMem(ScrnInfoPtr pScrn);
This function unmaps the VGA memory window. It must only be called after the memory has been mapped. The Base field of the vgaHWRec field is set to NULL to indicate that the memory is no longer mapped.
void vgaHWGetIOBase(vgaHWPtr hwp);
This function initialises the IOBase field of the vgaHWRec. This function must be called before using any other functions that access the video hardware. A macro VGAHW_GET_IOBASE() is also available in vgaHW.h that returns the I/O base, and this may be used when the vgahw module is not loaded (for example, in the ChipProbe() function).
void vgaHWUnlock(vgaHWPtr hwp);
This function unlocks the VGA CRTC[0-7] registers, and must be called before attempting to write to those registers.
void vgaHWLock(vgaHWPtr hwp);
This function locks the VGA CRTC[0-7] registers.
void vgaHWEnable(vgaHWPtr hwp);
This function enables the VGA subsystem. (Note, this function is present in XFree86 4.1.0 and later.).
void vgaHWDisable(vgaHWPtr hwp);
This function disables the VGA subsystem. (Note, this function is present in XFree86 4.1.0 and later.).
void vgaHWSave(ScrnInfoPtr pScrn, vgaRegPtr save, int flags);
This function saves the VGA state. The state is written to the vgaRegRec pointed to by save. flags is set to one or more of the following flags ORed together: VGA_SR_MODE the mode setting registers are saved VGA_SR_FONTS the text mode font/text data is saved VGA_SR_CMAP the colourmap (LUT) is saved VGA_SR_ALL all of the above are saved The vgaHWRec and its IOBase fields must be initialised before this function is called. If VGA_SR_FONTS is set in flags, the VGA memory window must be mapped. If it isn't then vgaHWMapMem() will be called to map it, and vgaHWUnmapMem() will be called to unmap it afterwards. vgaHWSave() uses the three functions below in the order vgaHWSaveColormap(), vgaHWSaveMode(), vgaHWSaveFonts() to carry out the different save phases. It is undecided at this stage whether they will remain part of the vgahw module's public interface or not.
void vgaHWSaveMode(ScrnInfoPtr pScrn, vgaRegPtr save);
This function saves the VGA mode registers. They are saved to the vgaRegRec pointed to by save. The registers saved are: MiscOut CRTC[0-0x18] Attribute[0-0x14] Graphics[0-8] Sequencer[0-4] The number of registers actually saved may be modified by a prior call to vgaHWSetRegCounts().
void vgaHWSaveFonts(ScrnInfoPtr pScrn, vgaRegPtr save);
This function saves the text mode font and text data held in the video memory. If called while in a graphics mode, no save is done. The VGA memory window must be mapped with vgaHWMapMem() before to calling this function. On some platforms, one or more of the font/text plane saves may be no-ops. This is the case when the platform's VC driver already takes care of this.
void vgaHWSaveColormap(ScrnInfoPtr pScrn, vgaRegPtr save);
This function saves the VGA colourmap (LUT). Before saving it, it attempts to verify that the colourmap is readable. In rare cases where it isn't readable, a default colourmap is saved instead.
void vgaHWRestore(ScrnInfoPtr pScrn, vgaRegPtr restore, int flags);
This function programs the VGA state. The state programmed is that contained in the vgaRegRec pointed to by restore. flags is the same as described above for the vgaHWSave() function. The vgaHWRec and its IOBase fields must be initialised before this function is called. If VGA_SR_FONTS is set in flags, the VGA memory window must be mapped. If it isn't then vgaHWMapMem() will be called to map it, and vgaHWUnmapMem() will be called to unmap it afterwards. vgaHWRestore() uses the three functions below in the order vgaHWRestoreFonts(), vgaHWRestoreMode(), vgaHWRestoreColormap() to carry out the different restore phases. It is undecided at this stage whether they will remain part of the vgahw module's public interface or not.
void vgaHWRestoreMode(ScrnInfoPtr pScrn, vgaRegPtr restore);
This function restores the VGA mode registers. They are restored from the data in the vgaRegRec pointed to by restore. The registers restored are: MiscOut CRTC[0-0x18] Attribute[0-0x14] Graphics[0-8] Sequencer[0-4] The number of registers actually restored may be modified by a prior call to vgaHWSetRegCounts().
void vgaHWRestoreFonts(ScrnInfoPtr pScrn, vgaRegPtr restore);
This function restores the text mode font and text data to the video memory. The VGA memory window must be mapped with vgaHWMapMem() before to calling this function. On some platforms, one or more of the font/text plane restores may be no-ops. This is the case when the platform's VC driver already takes care of this.
void vgaHWRestoreColormap(ScrnInfoPtr pScrn, vgaRegPtr restore);
This function restores the VGA colourmap (LUT).
void vgaHWInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
This function fills in the vgaHWRec's ModeReg field with the values appropriate for programming the given video mode. It requires that the ScrnInfoRec's depth field is initialised, which determines how the registers are programmed.
void vgaHWSeqReset(vgaHWPtr hwp, Bool start);
Do a VGA sequencer reset. If start is TRUE, the reset is started. If start is FALSE, the reset is ended.
void vgaHWProtect(ScrnInfoPtr pScrn, Bool on);
This function protects VGA registers and memory from corruption during loads. It is typically called with on set to TRUE before programming, and with on set to FALSE after programming.
Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode);
This function blanks and unblanks the screen. It is blanked when mode is SCREEN_SAVER_ON or SCREEN_SAVER_CYCLE, and unblanked when mode is SCREEN_SAVER_OFF or SCREEN_SAVER_FORCER.
void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on);
This function blanks and unblanks the screen. It is blanked when on is FALSE, and unblanked when on is TRUE. This function is provided for use in cases where the ScrnInfoRec can't be derived from the ScreenRec (while probing for clocks, for example).
VGA Colormap Functions The vgahw module uses the standard colormap support (see the Colormap Handling section. This is initialised with the following function:
Bool vgaHWHandleColormaps(ScreenPtr pScreen);
VGA Register Access Functions The vgahw module abstracts access to the standard VGA registers by using a set of functions held in the vgaHWRec. When the vgaHWRec is created these function pointers are initialised with the set of standard VGA I/O register access functions. In addition to these, the vgahw module includes a basic set of MMIO register access functions, and the vgaHWRec function pointers can be initialised to these by calling the vgaHWSetMmioFuncs() function described above. Some drivers/platforms may require a different set of functions for VGA access. The access functions are described here.
void writeCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value);
Write value to CRTC register index.
CARD8 readCrtc(vgaHWPtr hwp, CARD8 index);
Return the value read from CRTC register index.
void writeGr(vgaHWPtr hwp, CARD8 index, CARD8 value);
Write value to Graphics Controller register index.
CARD8 readGR(vgaHWPtr hwp, CARD8 index);
Return the value read from Graphics Controller register index.
void writeSeq(vgaHWPtr hwp, CARD8 index, CARD8, value);
Write value to Sequencer register index.
CARD8 readSeq(vgaHWPtr hwp, CARD8 index);
Return the value read from Sequencer register index.
void writeAttr(vgaHWPtr hwp, CARD8 index, CARD8, value);
Write value to Attribute Controller register index. When writing out the index value this function should set bit 5 (0x20) according to the setting of hwp->paletteEnabled in order to preserve the palette access state. It should be cleared when hwp->paletteEnabled is TRUE and set when it is FALSE.
CARD8 readAttr(vgaHWPtr hwp, CARD8 index);
Return the value read from Attribute Controller register index. When writing out the index value this function should set bit 5 (0x20) according to the setting of hwp->paletteEnabled in order to preserve the palette access state. It should be cleared when hwp->paletteEnabled is TRUE and set when it is FALSE.
void writeMiscOut(vgaHWPtr hwp, CARD8 value);
Write value to the Miscellaneous Output register.
CARD8 readMiscOut(vgwHWPtr hwp);
Return the value read from the Miscellaneous Output register.
void enablePalette(vgaHWPtr hwp);
Clear the palette address source bit in the Attribute Controller index register and set hwp->paletteEnabled to TRUE.
void disablePalette(vgaHWPtr hwp);
Set the palette address source bit in the Attribute Controller index register and set hwp->paletteEnabled to FALSE.
void writeDacMask(vgaHWPtr hwp, CARD8 value);
Write value to the DAC Mask register.
CARD8 readDacMask(vgaHWptr hwp);
Return the value read from the DAC Mask register.
void writeDacReadAddress(vgaHWPtr hwp, CARD8 value);
Write value to the DAC Read Address register.
void writeDacWriteAddress(vgaHWPtr hwp, CARD8 value);
Write value to the DAC Write Address register.
void writeDacData(vgaHWPtr hwp, CARD8 value);
Write value to the DAC Data register.
CARD8 readDacData(vgaHWptr hwp);
Return the value read from the DAC Data register.
CARD8 readEnable(vgaHWptr hwp);
Return the value read from the VGA Enable register. (Note: This function is present in XFree86 4.1.0 and later.)
void writeEnable(vgaHWPtr hwp, CARD8 value);
Write value to the VGA Enable register. (Note: This function is present in XFree86 4.1.0 and later.)
Some notes about writing a driver NOTE: some parts of this are not up to date The following is an outline for writing a basic unaccelerated driver for a PCI video card with a linear mapped framebuffer, and which has a VGA core. It is includes some general information that is relevant to most drivers (even those which don't fit that basic description). The information here is based on the initial conversion of the Matrox Millennium driver to the new design. For a fleshing out and sample implementation of some of the bits outlined here, refer to that driver. Note that this is an example only. The approach used here will not be appropriate for all drivers. Each driver must reserve a unique driver name, and a string that is used to prefix all of its externally visible symbols. This is to avoid name space clashes when loading multiple drivers. The examples here are for the ZZZ driver, which uses the ZZZ or zzz prefix for its externally visible symbols. Include files All drivers normally include the following headers: "xf86.h" "xf86_OSproc.h" "xf86_ansic.h" "xf86Resources.h" Wherever inb/outb (and related things) are used the following should be included: "compiler.h" Note: in drivers, this must be included after "xf86_ansic.h". Drivers that need to access PCI vendor/device definitions need this: "xf86PciInfo.h" Drivers that need to access the PCI config space need this: "xf86Pci.h" Drivers using the mi banking wrapper need: "mibank.h" Drivers that initialise a SW cursor need this: "mipointer.h" All drivers using the mi colourmap code need this: "micmap.h" If a driver uses the vgahw module, it needs this: "vgaHW.h" Drivers supporting VGA or Hercules monochrome screens need: "xf1bpp.h" Drivers supporting VGA or EGC 16-colour screens need: "xf4bpp.h" Drivers using cfb need: #define PSZ 8 #include "cfb.h" #undef PSZ Drivers supporting bpp 16, 24 or 32 with cfb need one or more of: "cfb16.h" "cfb24.h" "cfb32.h" The driver's own header file: "zzz.h" Drivers must NOT include the following: "xf86Priv.h" "xf86Privstr.h" "xf86_libc.h" "xf86_OSlib.h" "Xos.h" any OS header Data structures and initialisation The following macros should be defined: #define VERSION <version-as-an-int> #define ZZZ_NAME "ZZZ" /* the name used to prefix messages */ #define ZZZ_DRIVER_NAME "zzz" /* the driver name as used in config file */ #define ZZZ_MAJOR_VERSION <int> #define ZZZ_MINOR_VERSION <int> #define ZZZ_PATCHLEVEL <int> NOTE: ZZZ_DRIVER_NAME should match the name of the driver module without things like the "lib" prefix, the "_drv" suffix or filename extensions. A DriverRec must be defined, which includes the functions required at the pre-probe phase. The name of this DriverRec must be an upper-case version of ZZZ_DRIVER_NAME (for the purposes of static linking). DriverRec ZZZ = { VERSION, ZZZ_DRIVER_NAME, ZZZIdentify, ZZZProbe, ZZZAvailableOptions, NULL, 0 }; Define list of supported chips and their matching ID: static SymTabRec ZZZChipsets[] = { { PCI_CHIP_ZZZ1234, "zzz1234a" }, { PCI_CHIP_ZZZ5678, "zzz5678a" }, { -1, NULL } }; The token field may be any integer value that the driver may use to uniquely identify the supported chipsets. For drivers that support only PCI devices using the PCI device IDs might be a natural choice, but this isn't mandatory. For drivers that support both PCI and other devices (like ISA), some other ID should probably used. When other IDs are used as the tokens it is recommended that the names be defined as an enum type. If the driver uses the xf86MatchPciInstances() helper (recommended for drivers that support PCI cards) a list that maps PCI IDs to chip IDs and fixed resources must be defined: static PciChipsets ZZZPciChipsets[] = { { PCI_CHIP_ZZZ1234, PCI_CHIP_ZZZ1234, RES_SHARED_VGA }, { PCI_CHIP_ZZZ5678, PCI_CHIP_ZZZ5678, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } } Define the XF86ModuleVersionInfo struct for the driver. This is required for the dynamically loaded version: static XF86ModuleVersionInfo zzzVersRec = { "zzz", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XF86_VERSION_CURRENT, ZZZ_MAJOR_VERSION, ZZZ_MINOR_VERSION, ZZZ_PATCHLEVEL, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, MOD_CLASS_VIDEODRV, {0,0,0,0} }; Define a data structure to hold the driver's screen-specific data. This must be used instead of global variables. This would be defined in the "zzz.h" file, something like: typedef struct { type1 field1; type2 field2; int fooHack; Bool pciRetry; Bool noAccel; Bool hwCursor; CloseScreenProcPtr CloseScreen; OptionInfoPtr Options; ... } ZZZRec, *ZZZPtr; Define the list of config file Options that the driver accepts. For consistency between drivers those in the list of standard options should be used where appropriate before inventing new options. typedef enum { OPTION_FOO_HACK, OPTION_PCI_RETRY, OPTION_HW_CURSOR, OPTION_NOACCEL } ZZZOpts; static const OptionInfoRec ZZZOptions[] = { { OPTION_FOO_HACK, "FooHack", OPTV_INTEGER, {0}, FALSE }, { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; Functions SetupProc For dynamically loaded modules, a ModuleData variable is required. It is should be the name of the driver prepended to "ModuleData". A Setup() function is also required, which calls xf86AddDriver() to add the driver to the main list of drivers. static MODULESETUPPROTO(zzzSetup); XF86ModuleData zzzModuleData = { &zzzVersRec, zzzSetup, NULL }; static pointer zzzSetup(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; /* This module should be loaded only once, but check to be sure. */ if (!setupDone) { /* * Modules that this driver always requires may be loaded * here by calling LoadSubModule(). */ setupDone = TRUE; xf86AddDriver(&MGA, module, 0); /* * The return value must be non-NULL on success even though * there is no TearDownProc. */ return (pointer)1; } else { if (errmaj) *errmaj = LDR_ONCEONLY; return NULL; } } GetRec, FreeRec A function is usually required to allocate the driver's screen-specific data structure and hook it into the ScrnInfoRec's driverPrivate field. The ScrnInfoRec's driverPrivate is initialised to NULL, so it is easy to check if the initialisation has already been done. After allocating it, initialise the fields. By using xnfcalloc() to do the allocation it is zeroed, and if the allocation fails the server exits. NOTE: When allocating structures from inside the driver which are defined on the common level it is important to initialize the structure to zero. Only this guarantees that the server remains source compatible to future changes in common level structures. static Bool ZZZGetRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate != NULL) return TRUE; pScrn->driverPrivate = xnfcalloc(sizeof(ZZZRec), 1); /* Initialise as required */ ... return TRUE; } Define a macro in "zzz.h" which gets a pointer to the ZZZRec when given pScrn: #define ZZZPTR(p) ((ZZZPtr)((p)->driverPrivate)) Define a function to free the above, setting it to NULL once it has been freed: static void ZZZFreeRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate == NULL) return; xfree(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } Identify Define the Identify() function. It is run before the Probe, and typically prints out an identifying message, which might include the chipsets it supports. This function is mandatory: static void ZZZIdentify(int flags) { xf86PrintChipsets(ZZZ_NAME, "driver for ZZZ Tech chipsets", ZZZChipsets); } Probe Define the Probe() function. The purpose of this is to find all instances of the hardware that the driver supports, and for the ones not already claimed by another driver, claim the slot, and allocate a ScrnInfoRec. This should be a minimal probe, and it should under no circumstances leave the state of the hardware changed. Because a device is found, don't assume that it will be used. Don't do any initialisations other than the required ScrnInfoRec initialisations. Don't allocate any new data structures. This function is mandatory. NOTE: The xf86DrvMsg() functions cannot be used from the Probe. static Bool ZZZProbe(DriverPtr drv, int flags) { Bool foundScreen = FALSE; int numDevSections, numUsed; GDevPtr *devSections; int *usedChips; int i; /* * Find the config file Device sections that match this * driver, and return if there are none. */ if ((numDevSections = xf86MatchDevice(ZZZ_DRIVER_NAME, &devSections)) <= 0) { return FALSE; } /* * Since this is a PCI card, "probing" just amounts to checking * the PCI data that the server has already collected. If there * is none, return. * * Although the config file is allowed to override things, it * is reasonable to not allow it to override the detection * of no PCI video cards. * * The provided xf86MatchPciInstances() helper takes care of * the details. */ /* test if PCI bus present */ if (xf86GetPciVideoInfo()) { numUsed = xf86MatchPciInstances(ZZZ_NAME, PCI_VENDOR_ZZZ, ZZZChipsets, ZZZPciChipsets, devSections, numDevSections, drv, &usedChips); for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; if ((pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i], ZZZPciChipsets, NULL, NULL, NULL, NULL, NULL))) { /* Allocate a ScrnInfoRec */ pScrn->driverVersion = VERSION; pScrn->driverName = ZZZ_DRIVER_NAME; pScrn->name = ZZZ_NAME; pScrn->Probe = ZZZProbe; pScrn->PreInit = ZZZPreInit; pScrn->ScreenInit = ZZZScreenInit; pScrn->SwitchMode = ZZZSwitchMode; pScrn->AdjustFrame = ZZZAdjustFrame; pScrn->EnterVT = ZZZEnterVT; pScrn->LeaveVT = ZZZLeaveVT; pScrn->FreeScreen = ZZZFreeScreen; pScrn->ValidMode = ZZZValidMode; foundScreen = TRUE; /* add screen to entity */ } } xfree(usedChips); } xfree(devSections); return foundScreen; AvailableOptions Define the AvailableOptions() function. The purpose of this is to return the available driver options back to the -configure option, so that an xorg.conf file can be built and the user can see which options are available for them to use. PreInit Define the PreInit() function. The purpose of this is to find all the information required to determine if the configuration is usable, and to initialise those parts of the ScrnInfoRec that can be set once at the beginning of the first server generation. The information should be found in the least intrusive way possible. This function is mandatory. NOTES: The PreInit() function is only called once during the life of the X server (at the start of the first generation). Data allocated here must be of the type that persists for the life of the X server. This means that data that hooks into the ScrnInfoRec's privates field should be allocated here, but data that hooks into the ScreenRec's devPrivates field should not be allocated here. The driverPrivate field should also be allocated here. Although the ScrnInfoRec has been allocated before this function is called, the ScreenRec has not been allocated. That means that things requiring it cannot be used in this function. Very little of the ScrnInfoRec has been initialised when this function is called. It is important to get the order of doing things right in this function. static Bool ZZZPreInit(ScrnInfoPtr pScrn, int flags) { /* Fill in the monitor field */ pScrn->monitor = pScrn->confScreen->monitor; /* * If using the vgahw module, it will typically be loaded * here by calling xf86LoadSubModule(pScrn, "vgahw"); */ /* * Set the depth/bpp. Use the globally preferred depth/bpp. If the * driver has special default depth/bpp requirements, the defaults should * be specified here explicitly. * We support both 24bpp and 32bpp framebuffer layouts. * This sets pScrn->display also. */ if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb)) { return FALSE; } else { if (depth/bpp isn't one we support) { print error message; return FALSE; } } /* Print out the depth/bpp that was set */ xf86PrintDepthBpp(pScrn); /* Set bits per RGB for 8bpp */ if (pScrn->depth <= 8) { /* Take into account a dac_6_bit option here */ pScrn->rgbBits = 6 or 8; } /* * xf86SetWeight() and xf86SetDefaultVisual() must be called * after pScrn->display is initialised. */ /* Set weight/mask/offset for depth > 8 */ if (pScrn->depth > 8) { if (!xf86SetWeight(pScrn, defaultWeight, defaultMask)) { return FALSE; } else { if (weight isn't one we support) { print error message; return FALSE; } } } /* Set the default visual. */ if (!xf86SetDefaultVisual(pScrn, -1)) { return FALSE; } else { if (visual isn't one we support) { print error message; return FALSE; } } /* If the driver supports gamma correction, set the gamma. */ if (!xf86SetGamma(pScrn, default_gamma)) { return FALSE; } /* This driver uses a programmable clock */ pScrn->progClock = TRUE; /* Allocate the ZZZRec driverPrivate */ if (!ZZZGetRec(pScrn)) { return FALSE; } pZzz = ZZZPTR(pScrn); /* Collect all of the option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* * Process the options based on the information in ZZZOptions. * The results are written to pZzz->Options. If all of the options * processing is done within this function a local variable "options" * can be used instead of pZzz->Options. */ if (!(pZzz->Options = xalloc(sizeof(ZZZOptions)))) return FALSE; (void)memcpy(pZzz->Options, ZZZOptions, sizeof(ZZZOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pZzz->Options); /* * Set various fields of ScrnInfoRec and/or ZZZRec based on * the options found. */ from = X_DEFAULT; pZzz->hwCursor = FALSE; if (xf86IsOptionSet(pZzz->Options, OPTION_HW_CURSOR)) { from = X_CONFIG; pZzz->hwCursor = TRUE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pZzz->hwCursor ? "HW" : "SW"); if (xf86IsOptionSet(pZzz->Options, OPTION_NOACCEL)) { pZzz->noAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } else { pZzz->noAccel = FALSE; } if (xf86IsOptionSet(pZzz->Options, OPTION_PCI_RETRY)) { pZzz->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } pZzz->fooHack = 0; if (xf86GetOptValInteger(pZzz->Options, OPTION_FOO_HACK, &pZzz->fooHack)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Foo Hack set to %d\n", pZzz->fooHack); } /* * Find the PCI slot(s) that this screen claimed in the probe. * In this case, exactly one is expected, so complain otherwise. * Note in this case we're not interested in the card types so * that parameter is set to NULL. */ if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL)) != 1) { print error message; ZZZFreeRec(pScrn); if (i > 0) xfree(pciList); return FALSE; } /* Note that pciList should be freed below when no longer needed */ /* * Determine the chipset, allowing config file chipset and * chipid values to override the probed information. The config * chipset value has precedence over its chipid value if both * are present. * * It isn't necessary to fill in pScrn->chipset if the driver * keeps track of the chipset in its ZZZRec. */ ... /* * Determine video memory, fb base address, I/O addresses, etc, * allowing the config file to override probed values. * * Set the appropriate pScrn fields (videoRam is probably the * most important one that other code might require), and * print out the settings. */ ... /* Initialise a clockRanges list. */ ... /* Set any other chipset specific things in the ZZZRec */ ... /* Select valid modes from those available */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, minPitch, maxPitch, rounding, minHeight, maxHeight, pScrn->display->virtualX, pScrn->display->virtualY, pScrn->videoRam * 1024, LOOKUP_BEST_REFRESH); if (i == -1) { ZZZFreeRec(pScrn); return FALSE; } /* Prune the modes marked as invalid */ xf86PruneDriverModes(pScrn); /* If no valid modes, return */ if (i == 0 || pScrn->modes == NULL) { print error message; ZZZFreeRec(pScrn); return FALSE; } /* * Initialise the CRTC fields for the modes. This driver expects * vertical values to be halved for interlaced modes. */ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); /* Set the current mode to the first in the list. */ pScrn->currentMode = pScrn->modes; /* Print the list of modes being used. */ xf86PrintModes(pScrn); /* Set the DPI */ xf86SetDpi(pScrn, 0, 0); /* Load bpp-specific modules */ switch (pScrn->bitsPerPixel) { case 1: mod = "xf1bpp"; break; case 4: mod = "xf4bpp"; break; case 8: mod = "cfb"; break; case 16: mod = "cfb16"; break; case 24: mod = "cfb24"; break; case 32: mod = "cfb32"; break; } if (mod && !xf86LoadSubModule(pScrn, mod)) ZZZFreeRec(pScrn); return FALSE; /* Done */ return TRUE; } MapMem, UnmapMem Define functions to map and unmap the video memory and any other memory apertures required. These functions are not mandatory, but it is often useful to have such functions. static Bool ZZZMapMem(ScrnInfoPtr pScrn) { /* Call xf86MapPciMem() to map each PCI memory area */ ... return TRUE or FALSE; } static Bool ZZZUnmapMem(ScrnInfoPtr pScrn) { /* Call xf86UnMapVidMem() to unmap each memory area */ ... return TRUE or FALSE; } Save, Restore Define functions to save and restore the original video state. These functions are not mandatory, but are often useful. static void ZZZSave(ScrnInfoPtr pScrn) { /* * Save state into per-screen data structures. * If using the vgahw module, vgaHWSave will typically be * called here. */ ... } static void ZZZRestore(ScrnInfoPtr pScrn) { /* * Restore state from per-screen data structures. * If using the vgahw module, vgaHWRestore will typically be * called here. */ ... } ModeInit Define a function to initialise a new video mode. This function isn't mandatory, but is often useful. static Bool ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { /* * Program a video mode. If using the vgahw module, * vgaHWInit and vgaRestore will typically be called here. * Once up to the point where there can't be a failure * set pScrn->vtSema to TRUE. */ ... } ScreenInit Define the ScreenInit() function. This is called at the start of each server generation, and should fill in as much of the ScreenRec as possible as well as any other data that is initialised once per generation. It should initialise the framebuffer layers it is using, and initialise the initial video mode. This function is mandatory. NOTE: The ScreenRec (pScreen) is passed to this driver, but it and the ScrnInfoRecs are not yet hooked into each other. This means that in this function, and functions it calls, one cannot be found from the other. static Bool ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv) { /* Get the ScrnInfoRec */ pScrn = xf86ScreenToScrn(pScreen); /* * If using the vgahw module, its data structures and related * things are typically initialised/mapped here. */ /* Save the current video state */ ZZZSave(pScrn); /* Initialise the first mode */ ZZZModeInit(pScrn, pScrn->currentMode); /* Set the viewport if supported */ ZZZAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0); /* * Setup the screen's visuals, and initialise the framebuffer * code. */ /* Reset the visual list */ miClearVisualTypes(); /* * Setup the visuals supported. This driver only supports * TrueColor for bpp > 8, so the default set of visuals isn't * acceptable. To deal with this, call miSetVisualTypes with * the appropriate visual mask. */ if (pScrn->bitsPerPixel > 8) { if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; } /* * Initialise the framebuffer. */ switch (pScrn->bitsPerPixel) { case 1: ret = xf1bppScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; case 4: ret = xf4bppScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; case 8: ret = cfbScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; case 16: ret = cfb16ScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; case 24: ret = cfb24ScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; case 32: ret = cfb32ScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; default: print a message about an internal error; ret = FALSE; break; } if (!ret) return FALSE; /* Override the default mask/offset settings */ if (pScrn->bitsPerPixel > 8) { for (i = 0, visual = pScreen->visuals; i < pScreen->numVisuals; i++, visual++) { if ((visual->class | DynamicClass) == DirectColor) { visual->offsetRed = pScrn->offset.red; visual->offsetGreen = pScrn->offset.green; visual->offsetBlue = pScrn->offset.blue; visual->redMask = pScrn->mask.red; visual->greenMask = pScrn->mask.green; visual->blueMask = pScrn->mask.blue; } } } /* * If banking is needed, initialise an miBankInfoRec (defined in * "mibank.h"), and call miInitializeBanking(). */ if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY, pScrn->displayWidth, pBankInfo)) return FALSE; /* * Set initial black & white colourmap indices. */ xf86SetBlackWhitePixels(pScreen); /* * Install colourmap functions. */ ... /* * Initialise cursor functions. This example is for the mi * software cursor. */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); /* Initialise the default colourmap */ switch (pScrn->depth) { case 1: if (!xf1bppCreateDefColormap(pScreen)) return FALSE; break; case 4: if (!xf4bppCreateDefColormap(pScreen)) return FALSE; break; default: if (!cfbCreateDefColormap(pScreen)) return FALSE; break; } /* * Wrap the CloseScreen vector and set SaveScreen. */ ZZZPTR(pScrn)->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = ZZZCloseScreen; pScreen->SaveScreen = ZZZSaveScreen; /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } /* Done */ return TRUE; } SwitchMode Define the SwitchMode() function if mode switching is supported by the driver. static Bool ZZZSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { return ZZZModeInit(pScrn, mode); } AdjustFrame Define the AdjustFrame() function if the driver supports this. static void ZZZAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { /* Adjust the viewport */ } EnterVT, LeaveVT Define the EnterVT() and LeaveVT() functions. These functions are mandatory. static Bool ZZZEnterVT(ScrnInfoPtr pScrn) { return ZZZModeInit(pScrn, pScrn->currentMode); } static void ZZZLeaveVT(ScrnInfoPtr pScrn) { ZZZRestore(pScrn); } CloseScreen Define the CloseScreen() function: This function is mandatory. Note that it unwraps the previously wrapped pScreen->CloseScreen, and finishes by calling it. static Bool ZZZCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->vtSema) { ZZZRestore(pScrn); ZZZUnmapMem(pScrn); } pScrn->vtSema = FALSE; pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen; return (*pScreen->CloseScreen)(pScreen); } SaveScreen Define the SaveScreen() function (the screen blanking function). When using the vgahw module, this will typically be: static Bool ZZZSaveScreen(ScreenPtr pScreen, int mode) { return vgaHWSaveScreen(pScreen, mode); } This function is mandatory. Before modifying any hardware register directly this function needs to make sure that the Xserver is active by checking if pScrn is non-NULL and for pScrn->vtSema == TRUE. FreeScreen Define the FreeScreen() function. This function is optional. It should be defined if the ScrnInfoRec driverPrivate field is used so that it can be freed when a screen is deleted by the common layer for reasons possibly beyond the driver's control. This function is not used in during normal (error free) operation. The per-generation data is freed by the CloseScreen() function. static void ZZZFreeScreen(ScrnInfoPtr pScrn) { /* * If the vgahw module is used vgaHWFreeHWRec() would be called * here. */ ZZZFreeRec(pScrn); }
xorg-server-1.20.8/hw/xfree86/dri/0000755000175000017500000000000013640201534013547 500000000000000xorg-server-1.20.8/hw/xfree86/dri/Makefile.am0000644000175000017500000000120613640201473015524 00000000000000noinst_LTLIBRARIES = libdri.la AM_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support \ -I$(top_srcdir)/hw/xfree86/modes \ -I$(top_srcdir)/hw/xfree86/ddc \ -I$(top_srcdir)/hw/xfree86/i2c \ -I$(top_srcdir)/hw/xfree86/parser \ -I$(top_srcdir)/hw/xfree86/ramdac \ -I$(top_srcdir)/hw/xfree86/os-support/bus \ -I$(top_srcdir)/glx \ -DHAVE_XORG_CONFIG_H \ @DIX_CFLAGS@ @XORG_CFLAGS@ libdri_la_SOURCES = \ dri.c \ dri.h \ dristruct.h \ sarea.h \ xf86dri.c sdk_HEADERS = dri.h sarea.h dristruct.h xorg-server-1.20.8/hw/xfree86/dri/dri.c0000644000175000017500000022474413640201473014430 00000000000000/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. Copyright 2000 VA Linux Systems, 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Jens Owen * Rickard E. (Rik) Faith * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include #include #include #include #include #include #include #include #include "xf86drm.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "extinit.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "servermd.h" #define _XF86DRI_SERVER_ #include #include "swaprep.h" #include "xf86str.h" #include "dri.h" #include "sarea.h" #include "dristruct.h" #include "mi.h" #include "mipointer.h" #include "xf86_OSproc.h" #include "inputstr.h" #include "xf86VGAarbiter.h" #include "xf86Extensions.h" static int DRIEntPrivIndex = -1; static DevPrivateKeyRec DRIScreenPrivKeyRec; #define DRIScreenPrivKey (&DRIScreenPrivKeyRec) static DevPrivateKeyRec DRIWindowPrivKeyRec; #define DRIWindowPrivKey (&DRIWindowPrivKeyRec) static unsigned long DRIGeneration = 0; static unsigned int DRIDrawableValidationStamp = 0; static RESTYPE DRIDrawablePrivResType; static RESTYPE DRIContextPrivResType; static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv); drmServerInfo DRIDRMServerInfo; /* Wrapper just like xf86DrvMsg, but without the verbosity level checking. This will make it easy to turn off some messages later, based on verbosity level. */ /* * Since we're already referencing things from the XFree86 common layer in * this file, we'd might as well just call xf86VDrvMsgVerb, and have * consistent message formatting. The verbosity of these messages can be * easily changed here. */ #define DRI_MSG_VERBOSITY 1 static void DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4); static void DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) { va_list ap; va_start(ap, format); xf86VDrvMsgVerb(scrnIndex, type, DRI_MSG_VERBOSITY, format, ap); va_end(ap); } static void DRIOpenDRMCleanup(DRIEntPrivPtr pDRIEntPriv) { if (pDRIEntPriv->pLSAREA != NULL) { drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize); pDRIEntPriv->pLSAREA = NULL; } if (pDRIEntPriv->hLSAREA != 0) { drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA); } if (pDRIEntPriv->drmFD >= 0) { drmClose(pDRIEntPriv->drmFD); pDRIEntPriv->drmFD = 0; } } int DRIMasterFD(ScrnInfoPtr pScrn) { return DRI_ENT_PRIV(pScrn)->drmFD; } void * DRIMasterSareaPointer(ScrnInfoPtr pScrn) { return DRI_ENT_PRIV(pScrn)->pLSAREA; } drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn) { return DRI_ENT_PRIV(pScrn)->hLSAREA; } Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize, const char *busID, const char *drmDriverName) { drmSetVersion saveSv, sv; Bool drmWasAvailable; DRIEntPrivPtr pDRIEntPriv; DRIEntPrivRec tmp; int count; int err; if (DRIEntPrivIndex == -1) DRIEntPrivIndex = xf86AllocateEntityPrivateIndex(); pDRIEntPriv = DRI_ENT_PRIV(pScrn); if (pDRIEntPriv && pDRIEntPriv->drmFD != -1) return TRUE; drmWasAvailable = drmAvailable(); memset(&tmp, 0, sizeof(tmp)); tmp.drmFD = -1; sv.drm_di_major = 1; sv.drm_di_minor = 1; sv.drm_dd_major = -1; saveSv = sv; count = 10; while (count--) { tmp.drmFD = drmOpen(drmDriverName, busID); if (tmp.drmFD < 0) { DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n"); goto out_err; } err = drmSetInterfaceVersion(tmp.drmFD, &sv); if (err != -EPERM) break; sv = saveSv; drmClose(tmp.drmFD); tmp.drmFD = -1; usleep(100000); } if (tmp.drmFD <= 0) { DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n"); goto out_err; } if (!drmWasAvailable) { DRIDrvMsg(-1, X_INFO, "[drm] loaded kernel module for \"%s\" driver.\n", drmDriverName); } if (err != 0) { sv.drm_di_major = 1; sv.drm_di_minor = 0; } DRIDrvMsg(-1, X_INFO, "[drm] DRM interface version %d.%d\n", sv.drm_di_major, sv.drm_di_minor); if (sv.drm_di_major == 1 && sv.drm_di_minor >= 1) err = 0; else err = drmSetBusid(tmp.drmFD, busID); if (err) { DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n"); goto out_err; } /* * Create a lock-containing sarea. */ if (drmAddMap(tmp.drmFD, 0, sAreaSize, DRM_SHM, DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) { DRIDrvMsg(-1, X_INFO, "[drm] Could not create SAREA for DRM lock.\n"); tmp.hLSAREA = 0; goto out_err; } if (drmMap(tmp.drmFD, tmp.hLSAREA, sAreaSize, (drmAddressPtr) (&tmp.pLSAREA)) < 0) { DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n"); tmp.pLSAREA = NULL; goto out_err; } memset(tmp.pLSAREA, 0, sAreaSize); /* * Reserved contexts are handled by the first opened screen. */ tmp.resOwner = NULL; if (!pDRIEntPriv) pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1); if (!pDRIEntPriv) { DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for " "DRM device.\n"); goto out_err; } *pDRIEntPriv = tmp; xf86GetEntityPrivate((pScrn)->entityList[0], DRIEntPrivIndex)->ptr = pDRIEntPriv; DRIDrvMsg(-1, X_INFO, "[drm] DRM open master succeeded.\n"); return TRUE; out_err: DRIOpenDRMCleanup(&tmp); return FALSE; } static void DRIClipNotifyAllDrawables(ScreenPtr pScreen); static void dri_crtc_notify(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIClipNotifyAllDrawables(pScreen); xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify); xf86_crtc_notify(pScreen); pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen, dri_crtc_notify); } static void drmSIGIOHandler(int interrupt, void *closure) { unsigned long key; void *value; ssize_t count; drm_ctx_t ctx; typedef void (*_drmCallback) (int, void *, void *); char buf[256]; drm_context_t old; drm_context_t new; void *oldctx; void *newctx; char *pt; drmHashEntry *entry; void *hash_table; hash_table = drmGetHashTable(); if (!hash_table) return; if (drmHashFirst(hash_table, &key, &value)) { entry = value; do { if ((count = read(entry->fd, buf, sizeof(buf) - 1)) > 0) { buf[count] = '\0'; for (pt = buf; *pt != ' '; ++pt); /* Find first space */ ++pt; old = strtol(pt, &pt, 0); new = strtol(pt, NULL, 0); oldctx = drmGetContextTag(entry->fd, old); newctx = drmGetContextTag(entry->fd, new); ((_drmCallback) entry->f) (entry->fd, oldctx, newctx); ctx.handle = new; ioctl(entry->fd, DRM_IOCTL_NEW_CTX, &ctx); } } while (drmHashNext(hash_table, &key, &value)); } } static int drmInstallSIGIOHandler(int fd, void (*f) (int, void *, void *)) { drmHashEntry *entry; entry = drmGetEntry(fd); entry->f = f; return xf86InstallSIGIOHandler(fd, drmSIGIOHandler, 0); } static int drmRemoveSIGIOHandler(int fd) { drmHashEntry *entry = drmGetEntry(fd); entry->f = NULL; return xf86RemoveSIGIOHandler(fd); } Bool DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) { DRIScreenPrivPtr pDRIPriv; drm_context_t *reserved; int reserved_count; int i; DRIEntPrivPtr pDRIEntPriv; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DRIContextFlags flags = 0; DRIContextPrivPtr pDRIContextPriv; static Bool drm_server_inited; /* If the DRI extension is disabled, do not initialize the DRI */ if (noXFree86DRIExtension) { DRIDrvMsg(pScreen->myNum, X_WARNING, "Direct rendering has been disabled.\n"); return FALSE; } if (!xf86VGAarbiterAllowDRI(pScreen)) { DRIDrvMsg(pScreen->myNum, X_WARNING, "Direct rendering is not supported when VGA arb is necessary for the device\n"); return FALSE; } #ifdef PANORAMIX /* * If Xinerama is on, don't allow DRI to initialise. It won't be usable * anyway. */ if (!noPanoramiXExtension) { DRIDrvMsg(pScreen->myNum, X_WARNING, "Direct rendering is not supported when Xinerama is enabled\n"); return FALSE; } #endif if (drm_server_inited == FALSE) { drmSetServerInfo(&DRIDRMServerInfo); drm_server_inited = TRUE; } if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize, pDRIInfo->busIdString, pDRIInfo->drmDriverName)) return FALSE; pDRIEntPriv = DRI_ENT_PRIV(pScrn); if (DRIGeneration != serverGeneration) DRIGeneration = serverGeneration; if (!dixRegisterPrivateKey(&DRIScreenPrivKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&DRIWindowPrivKeyRec, PRIVATE_WINDOW, 0)) return FALSE; pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec)); if (!pDRIPriv) { dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); return FALSE; } dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv); pDRIPriv->drmFD = pDRIEntPriv->drmFD; pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->pDriverInfo = pDRIInfo; pDRIPriv->nrWindows = 0; pDRIPriv->nrWindowsVisible = 0; pDRIPriv->fullscreen = NULL; pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx; pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv; pDRIPriv->grabbedDRILock = FALSE; pDRIPriv->drmSIGIOHandlerInstalled = FALSE; *pDRMFD = pDRIPriv->drmFD; if (pDRIEntPriv->sAreaGrabbed || pDRIInfo->allocSarea) { if (drmAddMap(pDRIPriv->drmFD, 0, pDRIPriv->pDriverInfo->SAREASize, DRM_SHM, 0, &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmAddMap failed\n"); return FALSE; } DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] added %d byte SAREA at %p\n", (int) pDRIPriv->pDriverInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA); /* Backwards compat. */ if (drmMap(pDRIPriv->drmFD, pDRIPriv->hSAREA, pDRIPriv->pDriverInfo->SAREASize, (drmAddressPtr) (&pDRIPriv->pSAREA)) < 0) { pDRIPriv->directRenderingSupport = FALSE; dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmMap failed\n"); return FALSE; } DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n", (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA); memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); } else { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock " "SAREA also for drawables.\n"); pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA; pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA; pDRIEntPriv->sAreaGrabbed = TRUE; } pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA; pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA; if (!pDRIPriv->pDriverInfo->dontMapFrameBuffer) { if (drmAddMap(pDRIPriv->drmFD, (uintptr_t) pDRIPriv->pDriverInfo-> frameBufferPhysicalAddress, pDRIPriv->pDriverInfo->frameBufferSize, DRM_FRAME_BUFFER, 0, &pDRIPriv->pDriverInfo->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmAddMap failed\n"); return FALSE; } DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", (void *) (uintptr_t) pDRIPriv->pDriverInfo->hFrameBuffer); } else { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer mapped by ddx driver\n"); } if (pDRIEntPriv->resOwner == NULL) { pDRIEntPriv->resOwner = pScreen; /* Add tags for reserved contexts */ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, &reserved_count))) { int r; void *tag; for (r = 0; r < reserved_count; r++) { tag = DRICreateContextPrivFromHandle(pScreen, reserved[r], DRI_CONTEXT_RESERVED); drmAddContextTag(pDRIPriv->drmFD, reserved[r], tag); } drmFreeReservedContextList(reserved); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] added %d reserved context%s for kernel\n", reserved_count, reserved_count > 1 ? "s" : ""); } } /* validate max drawable table entry set by driver */ if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) || (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "Invalid max drawable table size set by driver: %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); } /* Initialize drawable tables (screen private and SAREA) */ for (i = 0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->DRIDrawables[i] = NULL; pDRIPriv->pSAREA->drawableTable[i].stamp = 0; pDRIPriv->pSAREA->drawableTable[i].flags = 0; } pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount; pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext; if (!pDRIEntPriv->keepFDOpen) pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen; pDRIEntPriv->refCount++; /* Set up flags for DRICreateContextPriv */ switch (pDRIInfo->driverSwapMethod) { case DRI_KERNEL_SWAP: flags = DRI_CONTEXT_2DONLY; break; case DRI_HIDE_X_CONTEXT: flags = DRI_CONTEXT_PRESERVED; break; } if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, &pDRIPriv->myContext, flags))) { DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to create server context\n"); return FALSE; } pDRIPriv->myContextPriv = pDRIContextPriv; DRIDrvMsg(pScreen->myNum, X_INFO, "X context handle = %p\n", (void *) (uintptr_t) pDRIPriv->myContext); /* Now that we have created the X server's context, we can grab the * hardware lock for the X server. */ DRILock(pScreen, 0); pDRIPriv->grabbedDRILock = TRUE; /* pointers so that we can prevent memory leaks later */ pDRIPriv->hiddenContextStore = NULL; pDRIPriv->partial3DContextStore = NULL; switch (pDRIInfo->driverSwapMethod) { case DRI_HIDE_X_CONTEXT: /* Server will handle 3D swaps, and hide 2D swaps from kernel. * Register server context as a preserved context. */ /* allocate memory for hidden context store */ pDRIPriv->hiddenContextStore = (void *) calloc(1, pDRIInfo->contextSize); if (!pDRIPriv->hiddenContextStore) { DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to allocate hidden context\n"); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } /* allocate memory for partial 3D context store */ pDRIPriv->partial3DContextStore = (void *) calloc(1, pDRIInfo->contextSize); if (!pDRIPriv->partial3DContextStore) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] failed to allocate partial 3D context\n"); free(pDRIPriv->hiddenContextStore); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } /* save initial context store */ if (pDRIInfo->SwapContext) { (*pDRIInfo->SwapContext) (pScreen, DRI_NO_SYNC, DRI_2D_CONTEXT, pDRIPriv->hiddenContextStore, DRI_NO_CONTEXT, NULL); } /* fall through */ case DRI_SERVER_SWAP: /* For swap methods of DRI_SERVER_SWAP and DRI_HIDE_X_CONTEXT * setup signal handler for receiving swap requests from kernel */ if (!(pDRIPriv->drmSIGIOHandlerInstalled = drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to setup DRM signal handler\n"); free(pDRIPriv->hiddenContextStore); free(pDRIPriv->partial3DContextStore); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } else { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] installed DRM signal handler\n"); } default: break; } return TRUE; } Bool DRIFinishScreenInit(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; /* Wrap DRI support */ if (pDRIInfo->wrap.WindowExposures) { pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures; pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures; } pDRIPriv->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = DRIDestroyWindow; pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen, dri_crtc_notify); if (pDRIInfo->wrap.CopyWindow) { pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow; } if (pDRIInfo->wrap.ClipNotify) { pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify; pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify; } if (pDRIInfo->wrap.AdjustFrame) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; } pDRIPriv->wrapped = TRUE; DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); return TRUE; } void DRICloseScreen(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo; drm_context_t *reserved; int reserved_count; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn); Bool closeMaster; if (pDRIPriv) { pDRIInfo = pDRIPriv->pDriverInfo; if (pDRIPriv->wrapped) { /* Unwrap DRI Functions */ if (pDRIInfo->wrap.WindowExposures) { pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures; pDRIPriv->wrap.WindowExposures = NULL; } if (pDRIPriv->DestroyWindow) { pScreen->DestroyWindow = pDRIPriv->DestroyWindow; pDRIPriv->DestroyWindow = NULL; } xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify); if (pDRIInfo->wrap.CopyWindow) { pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow; pDRIPriv->wrap.CopyWindow = NULL; } if (pDRIInfo->wrap.ClipNotify) { pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify; pDRIPriv->wrap.ClipNotify = NULL; } if (pDRIInfo->wrap.AdjustFrame) { ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); scrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; pDRIPriv->wrap.AdjustFrame = NULL; } pDRIPriv->wrapped = FALSE; } if (pDRIPriv->drmSIGIOHandlerInstalled) { if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to remove DRM signal handler\n"); } } if (pDRIPriv->dummyCtxPriv && pDRIPriv->createDummyCtx) { DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv); } if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to destroy server context\n"); } /* Remove tags for reserved contexts */ if (pDRIEntPriv->resOwner == pScreen) { pDRIEntPriv->resOwner = NULL; if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, &reserved_count))) { int i; for (i = 0; i < reserved_count; i++) { DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD, reserved[i])); } drmFreeReservedContextList(reserved); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] removed %d reserved context%s for kernel\n", reserved_count, reserved_count > 1 ? "s" : ""); } } /* Make sure signals get unblocked etc. */ drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext); pDRIPriv->pLockRefCount = NULL; closeMaster = (--pDRIEntPriv->refCount == 0) && !pDRIEntPriv->keepFDOpen; if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] unmapping %d bytes of SAREA %p at %p\n", (int) pDRIInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA); if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] unable to unmap %d bytes" " of SAREA %p at %p\n", (int) pDRIInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA); } } else { pDRIEntPriv->sAreaGrabbed = FALSE; } if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) { drmClose(pDRIPriv->drmFD); if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Closed DRM master.\n"); pDRIEntPriv->drmFD = -1; } } free(pDRIPriv); dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); } } #define DRM_MSG_VERBOSITY 3 static int dri_drm_debug_print(const char *format, va_list ap) _X_ATTRIBUTE_PRINTF(1,0); static int dri_drm_debug_print(const char *format, va_list ap) { xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap); return 0; } static void dri_drm_get_perms(gid_t * group, mode_t * mode) { *group = xf86ConfigDRI.group; *mode = xf86ConfigDRI.mode; } drmServerInfo DRIDRMServerInfo = { dri_drm_debug_print, xf86LoadKernelModule, dri_drm_get_perms, }; Bool DRIExtensionInit(void) { if (DRIGeneration != serverGeneration) { return FALSE; } DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete, "DRIDrawable"); DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete, "DRIContext"); if (!DRIDrawablePrivResType || !DRIContextPrivResType) return FALSE; RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL); return TRUE; } void DRIReset(void) { /* * This stub routine is called when the X Server recycles, resources * allocated by DRIExtensionInit need to be managed here. * * Currently this routine is a stub because all the interesting resources * are managed via the screen init process. */ } Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv) *isCapable = pDRIPriv->directRenderingSupport; else *isCapable = FALSE; return TRUE; } Bool DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); *hSAREA = pDRIPriv->hSAREA; *busIdString = pDRIPriv->pDriverInfo->busIdString; return TRUE; } Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE; return TRUE; } Bool DRICloseConnection(ScreenPtr pScreen) { return TRUE; } Bool DRIGetClientDriverName(ScreenPtr pScreen, int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, int *ddxDriverPatchVersion, char **clientDriverName) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); *ddxDriverMajorVersion = pDRIPriv->pDriverInfo->ddxDriverMajorVersion; *ddxDriverMinorVersion = pDRIPriv->pDriverInfo->ddxDriverMinorVersion; *ddxDriverPatchVersion = pDRIPriv->pDriverInfo->ddxDriverPatchVersion; *clientDriverName = pDRIPriv->pDriverInfo->clientDriverName; return TRUE; } /* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper functions that layer on drmCreateContext and drmAddContextTag. DRICreateContextPriv always creates a kernel drm_context_t and then calls DRICreateContextPrivFromHandle to create a DRIContextPriv structure for DRI tracking. For the SIGIO handler, the drm_context_t is associated with DRIContextPrivPtr. Any special flags are stored in the DRIContextPriv area and are passed to the kernel (if necessary). DRICreateContextPriv returns a pointer to newly allocated DRIContextPriv, and returns the kernel drm_context_t in pHWContext. */ DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, drm_context_t * pHWContext, DRIContextFlags flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (drmCreateContext(pDRIPriv->drmFD, pHWContext)) { return NULL; } return DRICreateContextPrivFromHandle(pScreen, *pHWContext, flags); } DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, drm_context_t hHWContext, DRIContextFlags flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIContextPrivPtr pDRIContextPriv; int contextPrivSize; contextPrivSize = sizeof(DRIContextPrivRec) + pDRIPriv->pDriverInfo->contextSize; if (!(pDRIContextPriv = calloc(1, contextPrivSize))) { return NULL; } pDRIContextPriv->pContextStore = (void *) (pDRIContextPriv + 1); drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv); pDRIContextPriv->hwContext = hHWContext; pDRIContextPriv->pScreen = pScreen; pDRIContextPriv->flags = flags; pDRIContextPriv->valid3D = FALSE; if (flags & DRI_CONTEXT_2DONLY) { if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_2DONLY)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set 2D context flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; } } if (flags & DRI_CONTEXT_PRESERVED) { if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_PRESERVED)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set preserved flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; } } return pDRIContextPriv; } Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) { DRIScreenPrivPtr pDRIPriv; if (!pDRIContextPriv) return TRUE; pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) { /* Don't delete reserved contexts from kernel area -- the kernel manages its reserved contexts itself. */ if (drmDestroyContext(pDRIPriv->drmFD, pDRIContextPriv->hwContext)) return FALSE; } /* Remove the tag last to prevent a race condition where the context has pending buffers. The context can't be re-used while in this thread, but buffers can be dispatched asynchronously. */ drmDelContextTag(pDRIPriv->drmFD, pDRIContextPriv->hwContext); free(pDRIContextPriv); return TRUE; } static Bool DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIContextPrivPtr pDRIContextPriv; void *contextStore; if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, &pDRIPriv->pSAREA->dummy_context, 0))) { return FALSE; } contextStore = DRIGetContextStore(pDRIContextPriv); if (pDRIPriv->pDriverInfo->CreateContext && needCtxPriv) { if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, NULL, pDRIPriv->pSAREA-> dummy_context, NULL, (DRIContextType) (long) contextStore)) { DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } } pDRIPriv->dummyCtxPriv = pDRIContextPriv; return TRUE; } static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummyCtxPriv; void *contextStore; if (!pDRIContextPriv) return; if (pDRIPriv->pDriverInfo->DestroyContext && hasCtxPriv) { contextStore = DRIGetContextStore(pDRIContextPriv); pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, pDRIContextPriv->hwContext, (DRIContextType) (long) contextStore); } DRIDestroyContextPriv(pDRIPriv->dummyCtxPriv); pDRIPriv->dummyCtxPriv = NULL; } Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, XID context, drm_context_t * pHWContext) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIContextPrivPtr pDRIContextPriv; void *contextStore; if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) { if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Could not create dummy context\n"); return FALSE; } } if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) { return FALSE; } contextStore = DRIGetContextStore(pDRIContextPriv); if (pDRIPriv->pDriverInfo->CreateContext) { if (!((*pDRIPriv->pDriverInfo->CreateContext) (pScreen, NULL, *pHWContext, NULL, (DRIContextType) (long) contextStore))) { DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } } /* track this in case the client dies before cleanup */ if (!AddResource(context, DRIContextPrivResType, (void *) pDRIContextPriv)) return FALSE; return TRUE; } Bool DRIDestroyContext(ScreenPtr pScreen, XID context) { FreeResourceByType(context, DRIContextPrivResType, FALSE); return TRUE; } /* DRIContextPrivDelete is called by the resource manager. */ Bool DRIContextPrivDelete(void *pResource, XID id) { DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr) pResource; DRIScreenPrivPtr pDRIPriv; void *contextStore; pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (pDRIPriv->pDriverInfo->DestroyContext) { contextStore = DRIGetContextStore(pDRIContextPriv); pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, pDRIContextPriv->hwContext, (DRIContextType) (long) contextStore); } return DRIDestroyContextPriv(pDRIContextPriv); } /* This walks the drawable timestamp array and invalidates all of them * in the case of transition from private to shared backbuffers. It's * not necessary for correctness, because DRIClipNotify gets called in * time to prevent any conflict, but the transition from * shared->private is sometimes missed if we don't do this. */ static void DRIClipNotifyAllDrawables(ScreenPtr pScreen) { int i; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); for (i = 0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; } } static void DRITransitionToSharedBuffers(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; DRIClipNotifyAllDrawables(pScreen); if (pDRIInfo->TransitionSingleToMulti3D) pDRIInfo->TransitionSingleToMulti3D(pScreen); } static void DRITransitionToPrivateBuffers(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; DRIClipNotifyAllDrawables(pScreen); if (pDRIInfo->TransitionMultiToSingle3D) pDRIInfo->TransitionMultiToSingle3D(pScreen); } static void DRITransitionTo3d(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; DRIClipNotifyAllDrawables(pScreen); if (pDRIInfo->TransitionTo3d) pDRIInfo->TransitionTo3d(pScreen); } static void DRITransitionTo2d(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; DRIClipNotifyAllDrawables(pScreen); if (pDRIInfo->TransitionTo2d) pDRIInfo->TransitionTo2d(pScreen); } static int DRIDCNTreeTraversal(WindowPtr pWin, void *data) { DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); if (pDRIDrawablePriv) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (RegionNumRects(&pWin->clipList) > 0) { WindowPtr *pDRIWindows = (WindowPtr *) data; int i = 0; while (pDRIWindows[i]) i++; pDRIWindows[i] = pWin; pDRIPriv->nrWalked++; } if (pDRIPriv->nrWindows == pDRIPriv->nrWalked) return WT_STOPWALKING; } return WT_WALKCHILDREN; } static void DRIDriverClipNotify(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv->pDriverInfo->ClipNotify) { WindowPtr *pDRIWindows = calloc(sizeof(WindowPtr), pDRIPriv->nrWindows); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; if (pDRIPriv->nrWindows > 0) { pDRIPriv->nrWalked = 0; TraverseTree(pScreen->root, DRIDCNTreeTraversal, (void *) pDRIWindows); } pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows); free(pDRIWindows); } } static void DRIIncreaseNumberVisible(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); switch (++pDRIPriv->nrWindowsVisible) { case 1: DRITransitionTo3d(pScreen); break; case 2: DRITransitionToSharedBuffers(pScreen); break; default: break; } DRIDriverClipNotify(pScreen); } static void DRIDecreaseNumberVisible(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); switch (--pDRIPriv->nrWindowsVisible) { case 0: DRITransitionTo2d(pScreen); break; case 1: DRITransitionToPrivateBuffers(pScreen); break; default: break; } DRIDriverClipNotify(pScreen); } Bool DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable, drm_drawable_t * hHWDrawable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv; WindowPtr pWin; if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDrawable; if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { pDRIDrawablePriv->refCount++; if (!pDRIDrawablePriv->hwDrawable) { drmCreateDrawable(pDRIPriv->drmFD, &pDRIDrawablePriv->hwDrawable); } } else { /* allocate a DRI Window Private record */ if (!(pDRIDrawablePriv = malloc(sizeof(DRIDrawablePrivRec)))) { return FALSE; } /* Only create a drm_drawable_t once */ if (drmCreateDrawable(pDRIPriv->drmFD, &pDRIDrawablePriv->hwDrawable)) { free(pDRIDrawablePriv); return FALSE; } /* add it to the list of DRI drawables for this screen */ pDRIDrawablePriv->pScreen = pScreen; pDRIDrawablePriv->refCount = 1; pDRIDrawablePriv->drawableIndex = -1; pDRIDrawablePriv->nrects = RegionNumRects(&pWin->clipList); /* save private off of preallocated index */ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, pDRIDrawablePriv); pDRIPriv->nrWindows++; if (pDRIDrawablePriv->nrects) DRIIncreaseNumberVisible(pScreen); } /* track this in case the client dies */ if (!AddResource(FakeClientID(client->index), DRIDrawablePrivResType, (void *) (intptr_t) pDrawable->id)) return FALSE; if (pDRIDrawablePriv->hwDrawable) { drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable, DRM_DRAWABLE_CLIPRECTS, RegionNumRects(&pWin->clipList), RegionRects(&pWin->clipList)); *hHWDrawable = pDRIDrawablePriv->hwDrawable; } } else if (pDrawable->type != DRAWABLE_PIXMAP) { /* PBuffer */ /* NOT_DONE */ return FALSE; } return TRUE; } static void DRIDrawablePrivDestroy(WindowPtr pWin) { DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); ScreenPtr pScreen; DRIScreenPrivPtr pDRIPriv; if (!pDRIDrawablePriv) return; pScreen = pWin->drawable.pScreen; pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIDrawablePriv->drawableIndex != -1) { /* bump stamp to force outstanding 3D requests to resync */ pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp = DRIDrawableValidationStamp++; /* release drawable table entry */ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } pDRIPriv->nrWindows--; if (pDRIDrawablePriv->nrects) DRIDecreaseNumberVisible(pScreen); drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable); free(pDRIDrawablePriv); dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } static Bool DRIDestroyDrawableCB(void *value, XID id, void *data) { if (value == data) { /* This calls back DRIDrawablePrivDelete which frees private area */ FreeResourceByType(id, DRIDrawablePrivResType, FALSE); return TRUE; } return FALSE; } Bool DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable) { if (pDrawable->type == DRAWABLE_WINDOW) { LookupClientResourceComplex(client, DRIDrawablePrivResType, DRIDestroyDrawableCB, (void *) (intptr_t) pDrawable->id); } else { /* pixmap (or for GLX 1.3, a PBuffer) */ /* NOT_DONE */ return FALSE; } return TRUE; } Bool DRIDrawablePrivDelete(void *pResource, XID id) { WindowPtr pWin; int rc; /* For DRIDrawablePrivResType, the XID is the client's fake ID. The * important XID is the value in pResource. */ id = (XID) (intptr_t) pResource; rc = dixLookupWindow(&pWin, id, serverClient, DixGetAttrAccess); if (rc == Success) { DRIDrawablePrivPtr pDRIDrwPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); if (!pDRIDrwPriv) return FALSE; if (--pDRIDrwPriv->refCount == 0) DRIDrawablePrivDestroy(pWin); return TRUE; } else { /* pixmap (or for GLX 1.3, a PBuffer) */ /* NOT_DONE */ return FALSE; } } Bool DRIGetDrawableInfo(ScreenPtr pScreen, DrawablePtr pDrawable, unsigned int *index, unsigned int *stamp, int *X, int *Y, int *W, int *H, int *numClipRects, drm_clip_rect_t ** pClipRects, int *backX, int *backY, int *numBackClipRects, drm_clip_rect_t ** pBackClipRects) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; WindowPtr pWin, pOldWin; int i; #if 0 printf("maxDrawableTableEntry = %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); #endif if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDrawable; if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { /* Manage drawable table */ if (pDRIDrawablePriv->drawableIndex == -1) { /* load SAREA table */ /* Search table for empty entry */ i = 0; while (i < pDRIPriv->pDriverInfo->maxDrawableTableEntry) { if (!(pDRIPriv->DRIDrawables[i])) { pDRIPriv->DRIDrawables[i] = pDrawable; pDRIDrawablePriv->drawableIndex = i; pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; break; } i++; } /* Search table for oldest entry */ if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) { unsigned int oldestStamp = ~0; int oldestIndex = 0; i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; while (i--) { if (pDRIPriv->pSAREA->drawableTable[i].stamp < oldestStamp) { oldestIndex = i; oldestStamp = pDRIPriv->pSAREA->drawableTable[i].stamp; } } pDRIDrawablePriv->drawableIndex = oldestIndex; /* release oldest drawable table entry */ pOldWin = (WindowPtr) pDRIPriv->DRIDrawables[oldestIndex]; pOldDrawPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pOldWin); pOldDrawPriv->drawableIndex = -1; /* claim drawable table entry */ pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; /* validate SAREA entry */ pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = DRIDrawableValidationStamp++; /* check for stamp wrap around */ if (oldestStamp > DRIDrawableValidationStamp) { /* walk SAREA table and invalidate all drawables */ for (i = 0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; } } } /* If the driver wants to be notified when the index is * set for a drawable, let it know now. */ if (pDRIPriv->pDriverInfo->SetDrawableIndex) pDRIPriv->pDriverInfo->SetDrawableIndex(pWin, pDRIDrawablePriv-> drawableIndex); /* reinit drawable ID if window is visible */ if ((pWin->viewable) && (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) { (*pDRIPriv->pDriverInfo->InitBuffers) (pWin, &pWin->clipList, pDRIDrawablePriv-> drawableIndex); } } *index = pDRIDrawablePriv->drawableIndex; *stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp; *X = (int) (pWin->drawable.x); *Y = (int) (pWin->drawable.y); *W = (int) (pWin->drawable.width); *H = (int) (pWin->drawable.height); *numClipRects = RegionNumRects(&pWin->clipList); *pClipRects = (drm_clip_rect_t *) RegionRects(&pWin->clipList); if (!*numClipRects && pDRIPriv->fullscreen) { /* use fake full-screen clip rect */ pDRIPriv->fullscreen_rect.x1 = *X; pDRIPriv->fullscreen_rect.y1 = *Y; pDRIPriv->fullscreen_rect.x2 = *X + *W; pDRIPriv->fullscreen_rect.y2 = *Y + *H; *numClipRects = 1; *pClipRects = &pDRIPriv->fullscreen_rect; } *backX = *X; *backY = *Y; if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) { /* Use a single cliprect. */ int x0 = *X; int y0 = *Y; int x1 = x0 + *W; int y1 = y0 + *H; if (x0 < 0) x0 = 0; if (y0 < 0) y0 = 0; if (x1 > pScreen->width) x1 = pScreen->width; if (y1 > pScreen->height) y1 = pScreen->height; if (y0 >= y1 || x0 >= x1) { *numBackClipRects = 0; *pBackClipRects = NULL; } else { pDRIPriv->private_buffer_rect.x1 = x0; pDRIPriv->private_buffer_rect.y1 = y0; pDRIPriv->private_buffer_rect.x2 = x1; pDRIPriv->private_buffer_rect.y2 = y1; *numBackClipRects = 1; *pBackClipRects = &(pDRIPriv->private_buffer_rect); } } else { /* Use the frontbuffer cliprects for back buffers. */ *numBackClipRects = 0; *pBackClipRects = 0; } } else { /* Not a DRIDrawable */ return FALSE; } } else { /* pixmap (or for GLX 1.3, a PBuffer) */ /* NOT_DONE */ return FALSE; } return TRUE; } Bool DRIGetDeviceInfo(ScreenPtr pScreen, drm_handle_t * hFrameBuffer, int *fbOrigin, int *fbSize, int *fbStride, int *devPrivateSize, void **pDevPrivate) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); *hFrameBuffer = pDRIPriv->pDriverInfo->hFrameBuffer; *fbOrigin = 0; *fbSize = pDRIPriv->pDriverInfo->frameBufferSize; *fbStride = pDRIPriv->pDriverInfo->frameBufferStride; *devPrivateSize = pDRIPriv->pDriverInfo->devPrivateSize; *pDevPrivate = pDRIPriv->pDriverInfo->devPrivate; return TRUE; } DRIInfoPtr DRICreateInfoRec(void) { DRIInfoPtr inforec = (DRIInfoPtr) calloc(1, sizeof(DRIInfoRec)); if (!inforec) return NULL; /* Initialize defaults */ inforec->busIdString = NULL; /* Wrapped function defaults */ inforec->wrap.WakeupHandler = DRIDoWakeupHandler; inforec->wrap.BlockHandler = DRIDoBlockHandler; inforec->wrap.WindowExposures = DRIWindowExposures; inforec->wrap.CopyWindow = DRICopyWindow; inforec->wrap.ClipNotify = DRIClipNotify; inforec->wrap.AdjustFrame = DRIAdjustFrame; inforec->TransitionTo2d = 0; inforec->TransitionTo3d = 0; inforec->SetDrawableIndex = 0; return inforec; } void DRIDestroyInfoRec(DRIInfoPtr DRIInfo) { free(DRIInfo->busIdString); free((char *) DRIInfo); } void DRIWakeupHandler(void *wakeupData, int result) { int i; for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.WakeupHandler) (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (pScreen, result); } } void DRIBlockHandler(void *blockData, void *pTimeout) { int i; for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.BlockHandler) (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (pScreen, pTimeout); } } void DRIDoWakeupHandler(ScreenPtr pScreen, int result) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRILock(pScreen, 0); if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { /* hide X context by swapping 2D component here */ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen, DRI_3D_SYNC, DRI_2D_CONTEXT, pDRIPriv->partial3DContextStore, DRI_2D_CONTEXT, pDRIPriv->hiddenContextStore); } } void DRIDoBlockHandler(ScreenPtr pScreen, void *timeout) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { /* hide X context by swapping 2D component here */ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen, DRI_2D_SYNC, DRI_NO_CONTEXT, NULL, DRI_2D_CONTEXT, pDRIPriv->partial3DContextStore); } if (pDRIPriv->windowsTouched) DRM_SPINUNLOCK(&pDRIPriv->pSAREA->drawable_lock, 1); pDRIPriv->windowsTouched = FALSE; DRIUnlock(pScreen); } void DRISwapContext(int drmFD, void *oldctx, void *newctx) { DRIContextPrivPtr oldContext = (DRIContextPrivPtr) oldctx; DRIContextPrivPtr newContext = (DRIContextPrivPtr) newctx; ScreenPtr pScreen = newContext->pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); void *oldContextStore = NULL; DRIContextType oldContextType; void *newContextStore = NULL; DRIContextType newContextType; DRISyncType syncType; #ifdef DEBUG static int count = 0; if (!newContext) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] Context Switch Error: oldContext=%p, newContext=%p\n", oldContext, newContext); return; } /* usefull for debugging, just print out after n context switches */ if (!count || !(count % 1)) { DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] Context switch %5d from %p/0x%08x (%d)\n", count, oldContext, oldContext ? oldContext->flags : 0, oldContext ? oldContext->hwContext : -1); DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] Context switch %5d to %p/0x%08x (%d)\n", count, newContext, newContext ? newContext->flags : 0, newContext ? newContext->hwContext : -1); } ++count; #endif if (!pDRIPriv->pDriverInfo->SwapContext) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] DDX driver missing context swap call back\n"); return; } if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { /* only 3D contexts are swapped in this case */ if (oldContext) { oldContextStore = DRIGetContextStore(oldContext); oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; } else { oldContextType = DRI_NO_CONTEXT; } newContextStore = DRIGetContextStore(newContext); if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } else { newContextType = DRI_2D_CONTEXT; } syncType = DRI_3D_SYNC; } else { /* default: driverSwapMethod == DRI_SERVER_SWAP */ /* optimize 2D context swaps */ if (newContext->flags & DRI_CONTEXT_2DONLY) { /* go from 3D context to 2D context and only save 2D * subset of 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; newContextStore = DRIGetContextStore(newContext); newContextType = DRI_2D_CONTEXT; syncType = DRI_3D_SYNC; pDRIPriv->lastPartial3DContext = oldContext; } else if (oldContext->flags & DRI_CONTEXT_2DONLY) { if (pDRIPriv->lastPartial3DContext == newContext) { /* go from 2D context back to previous 3D context and * only restore 2D subset of previous 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; newContextStore = DRIGetContextStore(newContext); newContextType = DRI_2D_CONTEXT; syncType = DRI_2D_SYNC; } else { /* go from 2D context to a different 3D context */ /* call DDX driver to do partial restore */ oldContextStore = DRIGetContextStore(oldContext); newContextStore = DRIGetContextStore(pDRIPriv->lastPartial3DContext); (*pDRIPriv->pDriverInfo->SwapContext) (pScreen, DRI_2D_SYNC, DRI_2D_CONTEXT, oldContextStore, DRI_2D_CONTEXT, newContextStore); /* now setup for a complete 3D swap */ oldContextStore = newContextStore; oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } else { newContextType = DRI_2D_CONTEXT; } syncType = DRI_NO_SYNC; } } else { /* now setup for a complete 3D swap */ oldContextStore = newContextStore; oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } else { newContextType = DRI_2D_CONTEXT; } syncType = DRI_3D_SYNC; } } /* call DDX driver to perform the swap */ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen, syncType, oldContextType, oldContextStore, newContextType, newContextStore); } void * DRIGetContextStore(DRIContextPrivPtr context) { return ((void *) context->pContextStore); } void DRIWindowExposures(WindowPtr pWin, RegionPtr prgn) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); if (pDRIDrawablePriv) { (*pDRIPriv->pDriverInfo->InitBuffers) (pWin, prgn, pDRIDrawablePriv->drawableIndex); } /* call lower wrapped functions */ if (pDRIPriv && pDRIPriv->wrap.WindowExposures) { /* unwrap */ pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures; /* call lower layers */ (*pScreen->WindowExposures) (pWin, prgn); /* rewrap */ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures; pScreen->WindowExposures = DRIWindowExposures; } } static int DRITreeTraversal(WindowPtr pWin, void *data) { DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); if (pDRIDrawablePriv) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (RegionNumRects(&(pWin->clipList)) > 0) { RegionPtr reg = (RegionPtr) data; RegionUnion(reg, reg, &(pWin->clipList)); pDRIPriv->nrWalked++; } if (pDRIPriv->nrWindows == pDRIPriv->nrWalked) return WT_STOPWALKING; } return WT_WALKCHILDREN; } Bool DRIDestroyWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); Bool retval = TRUE; DRIDrawablePrivDestroy(pWin); /* call lower wrapped functions */ if (pDRIPriv->DestroyWindow) { /* unwrap */ pScreen->DestroyWindow = pDRIPriv->DestroyWindow; /* call lower layers */ retval = (*pScreen->DestroyWindow) (pWin); /* rewrap */ pDRIPriv->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = DRIDestroyWindow; } return retval; } void DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return; if (pDRIPriv->nrWindowsVisible > 0) { RegionRec reg; RegionNull(®); pDRIPriv->nrWalked = 0; TraverseTree(pWin, DRITreeTraversal, (void *) (®)); if (RegionNotEmpty(®)) { RegionTranslate(®, ptOldOrg.x - pWin->drawable.x, ptOldOrg.y - pWin->drawable.y); RegionIntersect(®, ®, prgnSrc); /* The MoveBuffers interface is not ideal */ (*pDRIPriv->pDriverInfo->MoveBuffers) (pWin, ptOldOrg, ®, pDRIPriv->pDriverInfo-> ddxDrawableTableEntry); } RegionUninit(®); } /* call lower wrapped functions */ if (pDRIPriv->wrap.CopyWindow) { /* unwrap */ pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow; /* call lower layers */ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); /* rewrap */ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = DRICopyWindow; } } static void DRIGetSecs(long *secs, long *usecs) { struct timeval tv; gettimeofday(&tv, NULL); *secs = tv.tv_sec; *usecs = tv.tv_usec; } static unsigned long DRIComputeMilliSeconds(unsigned long s_secs, unsigned long s_usecs, unsigned long f_secs, unsigned long f_usecs) { if (f_usecs < s_usecs) { --f_secs; f_usecs += 1000000; } return (f_secs - s_secs) * 1000 + (f_usecs - s_usecs) / 1000; } static void DRISpinLockTimeout(drmLock * lock, int val, unsigned long timeout /* in mS */ ) { int count = 10000; #if !defined(__alpha__) && !defined(__powerpc__) char ret; #else int ret; #endif long s_secs, s_usecs; long f_secs, f_usecs; long msecs; long prev = 0; DRIGetSecs(&s_secs, &s_usecs); do { DRM_SPINLOCK_COUNT(lock, val, count, ret); if (!ret) return; /* Got lock */ DRIGetSecs(&f_secs, &f_usecs); msecs = DRIComputeMilliSeconds(s_secs, s_usecs, f_secs, f_usecs); if (msecs - prev < 250) count *= 2; /* Not more than 0.5S */ } while (msecs < timeout); /* Didn't get lock, so take it. The worst that can happen is that there is some garbage written to the wrong part of the framebuffer that a refresh will repair. That's undesirable, but better than locking the server. This should be a very rare event. */ DRM_SPINLOCK_TAKE(lock, val); } static void DRILockTree(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return; /* Restore the last known 3D context if the X context is hidden */ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { (*pDRIPriv->pDriverInfo->SwapContext) (pScreen, DRI_2D_SYNC, DRI_NO_CONTEXT, NULL, DRI_2D_CONTEXT, pDRIPriv->partial3DContextStore); } /* Call kernel to release lock */ DRIUnlock(pScreen); /* Grab drawable spin lock: a time out between 10 and 30 seconds is appropriate, since this should never time out except in the case of client death while the lock is being held. The timeout must be greater than any reasonable rendering time. */ DRISpinLockTimeout(&pDRIPriv->pSAREA->drawable_lock, 1, 10000); /*10 secs */ /* Call kernel flush outstanding buffers and relock */ DRILock(pScreen, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH_ALL); /* Switch back to our 2D context if the X context is hidden */ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { /* hide X context by swapping 2D component here */ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen, DRI_3D_SYNC, DRI_2D_CONTEXT, pDRIPriv->partial3DContextStore, DRI_2D_CONTEXT, pDRIPriv->hiddenContextStore); } } void DRIClipNotify(WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv; if (!pDRIPriv) return; if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { int nrects = RegionNumRects(&pWin->clipList); if (!pDRIPriv->windowsTouched) { DRILockTree(pScreen); pDRIPriv->windowsTouched = TRUE; } if (nrects && !pDRIDrawablePriv->nrects) DRIIncreaseNumberVisible(pScreen); else if (!nrects && pDRIDrawablePriv->nrects) DRIDecreaseNumberVisible(pScreen); else DRIDriverClipNotify(pScreen); pDRIDrawablePriv->nrects = nrects; pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp = DRIDrawableValidationStamp++; drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable, DRM_DRAWABLE_CLIPRECTS, nrects, RegionRects(&pWin->clipList)); } /* call lower wrapped functions */ if (pDRIPriv->wrap.ClipNotify) { /* unwrap */ pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify; /* call lower layers */ (*pScreen->ClipNotify) (pWin, dx, dy); /* rewrap */ pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify; pScreen->ClipNotify = DRIClipNotify; } } CARD32 DRIGetDrawableIndex(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); CARD32 index; if (pDRIDrawablePriv) { index = pDRIDrawablePriv->drawableIndex; } else { index = pDRIPriv->pDriverInfo->ddxDrawableTableEntry; } return index; } unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); return pDRIPriv->pSAREA->drawableTable[drawable_index].stamp; } void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock); } void DRILock(ScreenPtr pScreen, int flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv || !pDRIPriv->pLockRefCount) return; if (!*pDRIPriv->pLockRefCount) { DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext, flags); *pDRIPriv->pLockingContext = pDRIPriv->myContext; } else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] Locking deadlock.\n" "\tAlready locked with context %p,\n" "\ttrying to lock with context %p.\n", pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext); } (*pDRIPriv->pLockRefCount)++; } void DRIUnlock(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv || !pDRIPriv->pLockRefCount) return; if (*pDRIPriv->pLockRefCount > 0) { if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] Unlocking inconsistency:\n" "\tContext %p trying to unlock lock held by context %p\n", pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext); } (*pDRIPriv->pLockRefCount)--; } else { DRIDrvMsg(pScreen->myNum, X_ERROR, "DRIUnlock called when not locked.\n"); return; } if (!*pDRIPriv->pLockRefCount) DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext); } void * DRIGetSAREAPrivate(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return 0; return (void *) (((char *) pDRIPriv->pSAREA) + sizeof(XF86DRISAREARec)); } drm_context_t DRIGetContext(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return 0; return pDRIPriv->myContext; } void DRIGetTexOffsetFuncs(ScreenPtr pScreen, DRITexOffsetStartProcPtr * texOffsetStartFunc, DRITexOffsetFinishProcPtr * texOffsetFinishFunc) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return; *texOffsetStartFunc = pDRIPriv->pDriverInfo->texOffsetStart; *texOffsetFinishFunc = pDRIPriv->pDriverInfo->texOffsetFinish; } /* This lets get at the unwrapped functions so that they can correctly * call the lowerlevel functions, and choose whether they will be * called at every level of recursion (eg in validatetree). */ DRIWrappedFuncsRec * DRIGetWrappedFuncs(ScreenPtr pScreen) { return &(DRI_SCREEN_PRIV(pScreen)->wrap); } /* note that this returns the library version, not the protocol version */ void DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion) { *majorVersion = DRIINFO_MAJOR_VERSION; *minorVersion = DRIINFO_MINOR_VERSION; *patchVersion = DRIINFO_PATCH_VERSION; } static void _DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y) { pDRIPriv->pSAREA->frame.x = x; pDRIPriv->pSAREA->frame.y = y; pDRIPriv->pSAREA->frame.width = pScrn->frameX1 - x + 1; pDRIPriv->pSAREA->frame.height = pScrn->frameY1 - y + 1; } void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); int px, py; if (!pDRIPriv || !pDRIPriv->pSAREA) { DRIDrvMsg(pScrn->scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL); return; } if (pDRIPriv->fullscreen) { /* Fix up frame */ pScrn->frameX0 = pDRIPriv->pSAREA->frame.x; pScrn->frameY0 = pDRIPriv->pSAREA->frame.y; pScrn->frameX1 = pScrn->frameX0 + pDRIPriv->pSAREA->frame.width - 1; pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1; /* Fix up cursor */ miPointerGetPosition(inputInfo.pointer, &px, &py); if (px < pScrn->frameX0) px = pScrn->frameX0; if (px > pScrn->frameX1) px = pScrn->frameX1; if (py < pScrn->frameY0) py = pScrn->frameY0; if (py > pScrn->frameY1) py = pScrn->frameY1; pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE); return; } if (pDRIPriv->wrap.AdjustFrame) { /* unwrap */ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; /* call lower layers */ (*pScrn->AdjustFrame) (pScrn, x, y); /* rewrap */ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = DRIAdjustFrame; } _DRIAdjustFrame(pScrn, pDRIPriv, x, y); } /* * DRIMoveBuffersHelper swaps the regions rects in place leaving you * a region with the rects in the order that you need to blit them, * but it is possibly (likely) an invalid region afterwards. If you * need to use the region again for anything you have to call * REGION_VALIDATE on it, or better yet, save a copy first. */ void DRIMoveBuffersHelper(ScreenPtr pScreen, int dx, int dy, int *xdir, int *ydir, RegionPtr reg) { BoxPtr extents, pbox, firstBox, lastBox; BoxRec tmpBox; int y, nbox; extents = RegionExtents(reg); nbox = RegionNumRects(reg); pbox = RegionRects(reg); if ((dy > 0) && (dy < (extents->y2 - extents->y1))) { *ydir = -1; if (nbox > 1) { firstBox = pbox; lastBox = pbox + nbox - 1; while ((unsigned long) firstBox < (unsigned long) lastBox) { tmpBox = *firstBox; *firstBox = *lastBox; *lastBox = tmpBox; firstBox++; lastBox--; } } } else *ydir = 1; if ((dx > 0) && (dx < (extents->x2 - extents->x1))) { *xdir = -1; if (nbox > 1) { firstBox = lastBox = pbox; y = pbox->y1; while (--nbox) { pbox++; if (pbox->y1 == y) lastBox++; else { while ((unsigned long) firstBox < (unsigned long) lastBox) { tmpBox = *firstBox; *firstBox = *lastBox; *lastBox = tmpBox; firstBox++; lastBox--; } firstBox = lastBox = pbox; y = pbox->y1; } } while ((unsigned long) firstBox < (unsigned long) lastBox) { tmpBox = *firstBox; *firstBox = *lastBox; *lastBox = tmpBox; firstBox++; lastBox--; } } } else *xdir = 1; } xorg-server-1.20.8/hw/xfree86/dri/xf86dri.c0000644000175000017500000004340613640201473015136 00000000000000/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. Copyright 2000 VA Linux Systems, 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * Jens Owen * Rickard E. (Rik) Faith * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include #include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "extinit.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "servermd.h" #define _XF86DRI_SERVER_ #include #include "swaprep.h" #include "xf86str.h" #include "dri.h" #include "sarea.h" #include "dristruct.h" #include "xf86drm.h" #include "protocol-versions.h" #include "xf86Extensions.h" static int DRIErrorBase; static void XF86DRIResetProc(ExtensionEntry *extEntry); static unsigned char DRIReqCode = 0; /*ARGSUSED*/ static void XF86DRIResetProc(ExtensionEntry *extEntry) { DRIReset(); } static int ProcXF86DRIQueryVersion(register ClientPtr client) { xXF86DRIQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_XF86DRI_MAJOR_VERSION, .minorVersion = SERVER_XF86DRI_MINOR_VERSION, .patchVersion = SERVER_XF86DRI_PATCH_VERSION }; REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); swapl(&rep.patchVersion); } WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep); return Success; } static int ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) { xXF86DRIQueryDirectRenderingCapableReply rep; Bool isCapable; REQUEST(xXF86DRIQueryDirectRenderingCapableReq); REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen], &isCapable)) { return BadValue; } if (!client->local || client->swapped) isCapable = 0; rep = (xXF86DRIQueryDirectRenderingCapableReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .isCapable = isCapable }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply), &rep); return Success; } static int ProcXF86DRIOpenConnection(register ClientPtr client) { xXF86DRIOpenConnectionReply rep; drm_handle_t hSAREA; char *busIdString; CARD32 busIdStringLength = 0; REQUEST(xXF86DRIOpenConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } if (!DRIOpenConnection(screenInfo.screens[stuff->screen], &hSAREA, &busIdString)) { return BadValue; } if (busIdString) busIdStringLength = strlen(busIdString); rep = (xXF86DRIOpenConnectionReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) + pad_to_int32(busIdStringLength)), .busIdStringLength = busIdStringLength, .hSAREALow = (CARD32) (hSAREA & 0xffffffff), #if defined(LONG64) && !defined(__linux__) .hSAREAHigh = (CARD32) (hSAREA >> 32), #else .hSAREAHigh = 0 #endif }; WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep); if (busIdStringLength) WriteToClient(client, busIdStringLength, busIdString); return Success; } static int ProcXF86DRIAuthConnection(register ClientPtr client) { xXF86DRIAuthConnectionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .authenticated = 1 }; REQUEST(xXF86DRIAuthConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) { ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic); rep.authenticated = 0; } WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep); return Success; } static int ProcXF86DRICloseConnection(register ClientPtr client) { REQUEST(xXF86DRICloseConnectionReq); REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } DRICloseConnection(screenInfo.screens[stuff->screen]); return Success; } static int ProcXF86DRIGetClientDriverName(register ClientPtr client) { xXF86DRIGetClientDriverNameReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .clientDriverNameLength = 0 }; char *clientDriverName; REQUEST(xXF86DRIGetClientDriverNameReq); REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } DRIGetClientDriverName(screenInfo.screens[stuff->screen], (int *) &rep.ddxDriverMajorVersion, (int *) &rep.ddxDriverMinorVersion, (int *) &rep.ddxDriverPatchVersion, &clientDriverName); if (clientDriverName) rep.clientDriverNameLength = strlen(clientDriverName); rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.clientDriverNameLength)); WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep); if (rep.clientDriverNameLength) WriteToClient(client, rep.clientDriverNameLength, clientDriverName); return Success; } static int ProcXF86DRICreateContext(register ClientPtr client) { xXF86DRICreateContextReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; ScreenPtr pScreen; REQUEST(xXF86DRICreateContextReq); REQUEST_SIZE_MATCH(xXF86DRICreateContextReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } pScreen = screenInfo.screens[stuff->screen]; if (!DRICreateContext(pScreen, NULL, stuff->context, (drm_context_t *) &rep.hHWContext)) { return BadValue; } WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep); return Success; } static int ProcXF86DRIDestroyContext(register ClientPtr client) { REQUEST(xXF86DRIDestroyContextReq); REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } if (!DRIDestroyContext(screenInfo.screens[stuff->screen], stuff->context)) { return BadValue; } return Success; } static int ProcXF86DRICreateDrawable(ClientPtr client) { xXF86DRICreateDrawableReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; DrawablePtr pDrawable; int rc; REQUEST(xXF86DRICreateDrawableReq); REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success) return rc; if (!DRICreateDrawable(screenInfo.screens[stuff->screen], client, pDrawable, (drm_drawable_t *) &rep.hHWDrawable)) { return BadValue; } WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep); return Success; } static int ProcXF86DRIDestroyDrawable(register ClientPtr client) { REQUEST(xXF86DRIDestroyDrawableReq); DrawablePtr pDrawable; int rc; REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success) return rc; if (!DRIDestroyDrawable(screenInfo.screens[stuff->screen], client, pDrawable)) { return BadValue; } return Success; } static int ProcXF86DRIGetDrawableInfo(register ClientPtr client) { xXF86DRIGetDrawableInfoReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; DrawablePtr pDrawable; int X, Y, W, H; drm_clip_rect_t *pClipRects, *pClippedRects; drm_clip_rect_t *pBackClipRects; int backX, backY, rc; REQUEST(xXF86DRIGetDrawableInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success) return rc; if (!DRIGetDrawableInfo(screenInfo.screens[stuff->screen], pDrawable, (unsigned int *) &rep.drawableTableIndex, (unsigned int *) &rep.drawableTableStamp, (int *) &X, (int *) &Y, (int *) &W, (int *) &H, (int *) &rep.numClipRects, &pClipRects, &backX, &backY, (int *) &rep.numBackClipRects, &pBackClipRects)) { return BadValue; } rep.drawableX = X; rep.drawableY = Y; rep.drawableWidth = W; rep.drawableHeight = H; rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply)); rep.backX = backX; rep.backY = backY; if (rep.numBackClipRects) rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects; pClippedRects = pClipRects; if (rep.numClipRects) { /* Clip cliprects to screen dimensions (redirected windows) */ pClippedRects = xallocarray(rep.numClipRects, sizeof(drm_clip_rect_t)); if (pClippedRects) { ScreenPtr pScreen = screenInfo.screens[stuff->screen]; int i, j; for (i = 0, j = 0; i < rep.numClipRects; i++) { pClippedRects[j].x1 = max(pClipRects[i].x1, 0); pClippedRects[j].y1 = max(pClipRects[i].y1, 0); pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width); pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height); if (pClippedRects[j].x1 < pClippedRects[j].x2 && pClippedRects[j].y1 < pClippedRects[j].y2) { j++; } } rep.numClipRects = j; } else { rep.numClipRects = 0; } rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects; } rep.length = bytes_to_int32(rep.length); WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep); if (rep.numClipRects) { WriteToClient(client, sizeof(drm_clip_rect_t) * rep.numClipRects, pClippedRects); free(pClippedRects); } if (rep.numBackClipRects) { WriteToClient(client, sizeof(drm_clip_rect_t) * rep.numBackClipRects, pBackClipRects); } return Success; } static int ProcXF86DRIGetDeviceInfo(register ClientPtr client) { xXF86DRIGetDeviceInfoReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; drm_handle_t hFrameBuffer; void *pDevPrivate; REQUEST(xXF86DRIGetDeviceInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen], &hFrameBuffer, (int *) &rep.framebufferOrigin, (int *) &rep.framebufferSize, (int *) &rep.framebufferStride, (int *) &rep.devPrivateSize, &pDevPrivate)) { return BadValue; } rep.hFrameBufferLow = (CARD32) (hFrameBuffer & 0xffffffff); #if defined(LONG64) && !defined(__linux__) rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32); #else rep.hFrameBufferHigh = 0; #endif if (rep.devPrivateSize) { rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.devPrivateSize)); } WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep); if (rep.length) { WriteToClient(client, rep.devPrivateSize, pDevPrivate); } return Success; } static int ProcXF86DRIDispatch(register ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_XF86DRIQueryVersion: return ProcXF86DRIQueryVersion(client); case X_XF86DRIQueryDirectRenderingCapable: return ProcXF86DRIQueryDirectRenderingCapable(client); } if (!client->local) return DRIErrorBase + XF86DRIClientNotLocal; switch (stuff->data) { case X_XF86DRIOpenConnection: return ProcXF86DRIOpenConnection(client); case X_XF86DRICloseConnection: return ProcXF86DRICloseConnection(client); case X_XF86DRIGetClientDriverName: return ProcXF86DRIGetClientDriverName(client); case X_XF86DRICreateContext: return ProcXF86DRICreateContext(client); case X_XF86DRIDestroyContext: return ProcXF86DRIDestroyContext(client); case X_XF86DRICreateDrawable: return ProcXF86DRICreateDrawable(client); case X_XF86DRIDestroyDrawable: return ProcXF86DRIDestroyDrawable(client); case X_XF86DRIGetDrawableInfo: return ProcXF86DRIGetDrawableInfo(client); case X_XF86DRIGetDeviceInfo: return ProcXF86DRIGetDeviceInfo(client); case X_XF86DRIAuthConnection: return ProcXF86DRIAuthConnection(client); /* {Open,Close}FullScreen are deprecated now */ default: return BadRequest; } } static int _X_COLD SProcXF86DRIQueryVersion(register ClientPtr client) { REQUEST(xXF86DRIQueryVersionReq); swaps(&stuff->length); return ProcXF86DRIQueryVersion(client); } static int _X_COLD SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) { REQUEST(xXF86DRIQueryDirectRenderingCapableReq); REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq); swaps(&stuff->length); swapl(&stuff->screen); return ProcXF86DRIQueryDirectRenderingCapable(client); } static int _X_COLD SProcXF86DRIDispatch(register ClientPtr client) { REQUEST(xReq); /* * Only local clients are allowed DRI access, but remote clients still need * these requests to find out cleanly. */ switch (stuff->data) { case X_XF86DRIQueryVersion: return SProcXF86DRIQueryVersion(client); case X_XF86DRIQueryDirectRenderingCapable: return SProcXF86DRIQueryDirectRenderingCapable(client); default: return DRIErrorBase + XF86DRIClientNotLocal; } } void XFree86DRIExtensionInit(void) { ExtensionEntry *extEntry; if (DRIExtensionInit() && (extEntry = AddExtension(XF86DRINAME, XF86DRINumberEvents, XF86DRINumberErrors, ProcXF86DRIDispatch, SProcXF86DRIDispatch, XF86DRIResetProc, StandardMinorOpcode))) { DRIReqCode = (unsigned char) extEntry->base; DRIErrorBase = extEntry->errorBase; } } xorg-server-1.20.8/hw/xfree86/dri/sarea.h0000644000175000017500000000544113640201473014741 00000000000000/** * \file sarea.h * SAREA definitions. * * \author Kevin E. Martin * \author Jens Owen * \author Rickard E. (Rik) Faith */ /* * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, 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, sub license, 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 NON-INFRINGEMENT. * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _SAREA_H_ #define _SAREA_H_ #include "xf86drm.h" /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000 #elif defined(__ia64__) #define SAREA_MAX 0x10000 /* 64kB */ #else /* Intel 830M driver needs at least 8k SAREA */ #define SAREA_MAX 0x2000 #endif #define SAREA_MAX_DRAWABLES 256 #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 /** * SAREA per drawable information. * * \sa _XF86DRISAREA. */ typedef struct _XF86DRISAREADrawable { unsigned int stamp; unsigned int flags; } XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr; /** * SAREA frame information. * * \sa _XF86DRISAREA. */ typedef struct _XF86DRISAREAFrame { unsigned int x; unsigned int y; unsigned int width; unsigned int height; unsigned int fullscreen; } XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr; /** * SAREA definition. */ typedef struct _XF86DRISAREA { /** first thing is always the DRM locking structure */ drmLock lock; /** \todo Use readers/writer lock for drawable_lock */ drmLock drawable_lock; XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; XF86DRISAREAFrameRec frame; drm_context_t dummy_context; } XF86DRISAREARec, *XF86DRISAREAPtr; typedef struct _XF86DRILSAREA { drmLock lock; drmLock otherLocks[31]; } XF86DRILSAREARec, *XF86DRILSAREAPtr; #endif xorg-server-1.20.8/hw/xfree86/dri/dristruct.h0000644000175000017500000001100513640201473015662 00000000000000/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Jens Owen * */ #ifndef DRI_STRUCT_H #define DRI_STRUCT_H #include "xf86drm.h" #include "xf86Crtc.h" #define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey)) #define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey)) typedef struct _DRIDrawablePrivRec { drm_drawable_t hwDrawable; int drawableIndex; ScreenPtr pScreen; int refCount; int nrects; } DRIDrawablePrivRec, *DRIDrawablePrivPtr; struct _DRIContextPrivRec { drm_context_t hwContext; ScreenPtr pScreen; Bool valid3D; DRIContextFlags flags; void **pContextStore; }; #define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ (dixPrivateKeyRegistered(DRIScreenPrivKey) ? \ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL)) #define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \ DRIScreenPrivKey)) #define DRI_ENT_PRIV(pScrn) \ ((DRIEntPrivIndex < 0) ? \ NULL: \ ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \ DRIEntPrivIndex)->ptr))) typedef struct _DRIScreenPrivRec { Bool directRenderingSupport; int drmFD; /* File descriptor for /dev/video/? */ drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ drm_context_t myContext; /* DDX Driver's context */ DRIContextPrivPtr myContextPriv; /* Pointer to server's private area */ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ void **hiddenContextStore; /* hidden X context */ void **partial3DContextStore; /* parital 3D context */ DRIInfoPtr pDriverInfo; int nrWindows; int nrWindowsVisible; int nrWalked; drm_clip_rect_t private_buffer_rect; /* management of private buffers */ DrawablePtr fullscreen; /* pointer to fullscreen drawable */ drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ DRIWrappedFuncsRec wrap; DestroyWindowProcPtr DestroyWindow; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ Bool createDummyCtx; Bool createDummyCtxPriv; Bool grabbedDRILock; Bool drmSIGIOHandlerInstalled; Bool wrapped; Bool windowsTouched; int lockRefCount; drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */ XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */ int *pLockRefCount; int *pLockingContext; xf86_crtc_notify_proc_ptr xf86_crtc_notify; } DRIScreenPrivRec, *DRIScreenPrivPtr; typedef struct _DRIEntPrivRec { int drmFD; Bool drmOpened; Bool sAreaGrabbed; drm_handle_t hLSAREA; XF86DRILSAREAPtr pLSAREA; unsigned long sAreaSize; int lockRefCount; int lockingContext; ScreenPtr resOwner; Bool keepFDOpen; int refCount; } DRIEntPrivRec, *DRIEntPrivPtr; #endif /* DRI_STRUCT_H */ xorg-server-1.20.8/hw/xfree86/dri/Makefile.in0000644000175000017500000007110013640201512015527 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/dri ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdri_la_LIBADD = am_libdri_la_OBJECTS = dri.lo xf86dri.lo libdri_la_OBJECTS = $(am_libdri_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dri.Plo ./$(DEPDIR)/xf86dri.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdri_la_SOURCES) DIST_SOURCES = $(libdri_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdri.la AM_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support \ -I$(top_srcdir)/hw/xfree86/modes \ -I$(top_srcdir)/hw/xfree86/ddc \ -I$(top_srcdir)/hw/xfree86/i2c \ -I$(top_srcdir)/hw/xfree86/parser \ -I$(top_srcdir)/hw/xfree86/ramdac \ -I$(top_srcdir)/hw/xfree86/os-support/bus \ -I$(top_srcdir)/glx \ -DHAVE_XORG_CONFIG_H \ @DIX_CFLAGS@ @XORG_CFLAGS@ libdri_la_SOURCES = \ dri.c \ dri.h \ dristruct.h \ sarea.h \ xf86dri.c sdk_HEADERS = dri.h sarea.h dristruct.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dri/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/dri/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdri.la: $(libdri_la_OBJECTS) $(libdri_la_DEPENDENCIES) $(EXTRA_libdri_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libdri_la_OBJECTS) $(libdri_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86dri.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/dri.Plo -rm -f ./$(DEPDIR)/xf86dri.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/dri.Plo -rm -f ./$(DEPDIR)/xf86dri.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/dri/dri.h0000644000175000017500000003161013640201473014421 00000000000000/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Jens Owen * */ /* Prototypes for DRI functions */ #ifndef _DRI_H_ #include #include "scrnintstr.h" #include "xf86dri.h" typedef int DRISyncType; #define DRI_NO_SYNC 0 #define DRI_2D_SYNC 1 #define DRI_3D_SYNC 2 typedef int DRIContextType; typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr; typedef enum _DRIContextFlags { DRI_CONTEXT_2DONLY = 0x01, DRI_CONTEXT_PRESERVED = 0x02, DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */ } DRIContextFlags; #define DRI_NO_CONTEXT 0 #define DRI_2D_CONTEXT 1 #define DRI_3D_CONTEXT 2 typedef int DRISwapMethod; #define DRI_HIDE_X_CONTEXT 0 #define DRI_SERVER_SWAP 1 #define DRI_KERNEL_SWAP 2 typedef int DRIWindowRequests; #define DRI_NO_WINDOWS 0 #define DRI_3D_WINDOWS_ONLY 1 #define DRI_ALL_WINDOWS 2 typedef void (*ClipNotifyPtr) (WindowPtr, int, int); typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y); /* * These functions can be wrapped by the DRI. Each of these have * generic default funcs (initialized in DRICreateInfoRec) and can be * overridden by the driver in its [driver]DRIScreenInit function. */ typedef struct { ScreenWakeupHandlerProcPtr WakeupHandler; ScreenBlockHandlerProcPtr BlockHandler; WindowExposuresProcPtr WindowExposures; CopyWindowProcPtr CopyWindow; ClipNotifyProcPtr ClipNotify; AdjustFramePtr AdjustFrame; } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; /* * Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned * by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also * being used to version the XFree86-DRI protocol. Bugs #3066 and #3163 * showed that this was inadequate. The DRIInfoRec structure is now versioned * by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18. * * Revision history: * 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION. * 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION. * 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer. */ #define DRIINFO_MAJOR_VERSION 5 #define DRIINFO_MINOR_VERSION 4 #define DRIINFO_PATCH_VERSION 0 typedef unsigned long long (*DRITexOffsetStartProcPtr) (PixmapPtr pPix); typedef void (*DRITexOffsetFinishProcPtr) (PixmapPtr pPix); typedef struct { /* driver call back functions * * New fields should be added at the end for backwards compatibility. * Bump the DRIINFO patch number to indicate bugfixes. * Bump the DRIINFO minor number to indicate new fields. * Bump the DRIINFO major number to indicate binary-incompatible changes. */ Bool (*CreateContext) (ScreenPtr pScreen, VisualPtr visual, drm_context_t hHWContext, void *pVisualConfigPriv, DRIContextType context); void (*DestroyContext) (ScreenPtr pScreen, drm_context_t hHWContext, DRIContextType context); void (*SwapContext) (ScreenPtr pScreen, DRISyncType syncType, DRIContextType readContextType, void *readContextStore, DRIContextType writeContextType, void *writeContextStore); void (*InitBuffers) (WindowPtr pWin, RegionPtr prgn, CARD32 indx); void (*MoveBuffers) (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 indx); void (*TransitionTo3d) (ScreenPtr pScreen); void (*TransitionTo2d) (ScreenPtr pScreen); void (*SetDrawableIndex) (WindowPtr pWin, CARD32 indx); Bool (*OpenFullScreen) (ScreenPtr pScreen); Bool (*CloseFullScreen) (ScreenPtr pScreen); /* wrapped functions */ DRIWrappedFuncsRec wrap; /* device info */ char *drmDriverName; char *clientDriverName; char *busIdString; int ddxDriverMajorVersion; int ddxDriverMinorVersion; int ddxDriverPatchVersion; void *frameBufferPhysicalAddress; long frameBufferSize; long frameBufferStride; long SAREASize; int maxDrawableTableEntry; int ddxDrawableTableEntry; long contextSize; DRISwapMethod driverSwapMethod; DRIWindowRequests bufferRequests; int devPrivateSize; void *devPrivate; Bool createDummyCtx; Bool createDummyCtxPriv; /* New with DRI version 4.1.0 */ void (*TransitionSingleToMulti3D) (ScreenPtr pScreen); void (*TransitionMultiToSingle3D) (ScreenPtr pScreen); /* New with DRI version 5.1.0 */ void (*ClipNotify) (ScreenPtr pScreen, WindowPtr *ppWin, int num); /* New with DRI version 5.2.0 */ Bool allocSarea; Bool keepFDOpen; /* New with DRI version 5.3.0 */ DRITexOffsetStartProcPtr texOffsetStart; DRITexOffsetFinishProcPtr texOffsetFinish; /* New with DRI version 5.4.0 */ int dontMapFrameBuffer; drm_handle_t hFrameBuffer; /* Handle to framebuffer, either * mapped by DDX driver or DRI */ } DRIInfoRec, *DRIInfoPtr; extern _X_EXPORT Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize, const char *busID, const char *drmDriverName); extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD); extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen); extern Bool DRIExtensionInit(void); extern _X_EXPORT void DRIReset(void); extern _X_EXPORT Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable); extern _X_EXPORT Bool DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString); extern _X_EXPORT Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic); extern _X_EXPORT Bool DRICloseConnection(ScreenPtr pScreen); extern _X_EXPORT Bool DRIGetClientDriverName(ScreenPtr pScreen, int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, int *ddxDriverPatchVersion, char **clientDriverName); extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, XID context, drm_context_t * pHWContext); extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context); extern _X_EXPORT Bool DRIContextPrivDelete(void *pResource, XID id); extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable, drm_drawable_t * hHWDrawable); extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable); extern _X_EXPORT Bool DRIDrawablePrivDelete(void *pResource, XID id); extern _X_EXPORT Bool DRIGetDrawableInfo(ScreenPtr pScreen, DrawablePtr pDrawable, unsigned int *indx, unsigned int *stamp, int *X, int *Y, int *W, int *H, int *numClipRects, drm_clip_rect_t ** pClipRects, int *backX, int *backY, int *numBackClipRects, drm_clip_rect_t ** pBackClipRects); extern _X_EXPORT Bool DRIGetDeviceInfo(ScreenPtr pScreen, drm_handle_t * hFrameBuffer, int *fbOrigin, int *fbSize, int *fbStride, int *devPrivateSize, void **pDevPrivate); extern _X_EXPORT DRIInfoPtr DRICreateInfoRec(void); extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen); extern _X_EXPORT void DRIWakeupHandler(void *wakeupData, int result); extern _X_EXPORT void DRIBlockHandler(void *blockData, void *timeout); extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, int result); extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen, void *timeout); extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx); extern _X_EXPORT void *DRIGetContextStore(DRIContextPrivPtr context); extern _X_EXPORT void DRIWindowExposures(WindowPtr pWin, RegionPtr prgn); extern _X_EXPORT Bool DRIDestroyWindow(WindowPtr pWin); extern _X_EXPORT void DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); extern _X_EXPORT void DRIClipNotify(WindowPtr pWin, int dx, int dy); extern _X_EXPORT CARD32 DRIGetDrawableIndex(WindowPtr pWin); extern _X_EXPORT void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg); extern _X_EXPORT void DRILock(ScreenPtr pScreen, int flags); extern _X_EXPORT void DRIUnlock(ScreenPtr pScreen); extern _X_EXPORT DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); extern _X_EXPORT void *DRIGetSAREAPrivate(ScreenPtr pScreen); extern _X_EXPORT unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index); extern _X_EXPORT DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, drm_context_t * pHWContext, DRIContextFlags flags); extern _X_EXPORT DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, drm_context_t hHWContext, DRIContextFlags flags); extern _X_EXPORT Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen); extern _X_EXPORT void DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion); extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen, int dx, int dy, int *xdir, int *ydir, RegionPtr reg); extern _X_EXPORT int DRIMasterFD(ScrnInfoPtr pScrn); extern _X_EXPORT void *DRIMasterSareaPointer(ScrnInfoPtr pScrn); extern _X_EXPORT drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn); extern _X_EXPORT void DRIGetTexOffsetFuncs(ScreenPtr pScreen, DRITexOffsetStartProcPtr * texOffsetStartFunc, DRITexOffsetFinishProcPtr * texOffsetFinishFunc); #define _DRI_H_ #endif xorg-server-1.20.8/hw/xfree86/dri/meson.build0000644000175000017500000000055213640201473015635 00000000000000srcs_xorg_dri = [ 'dri.c', 'xf86dri.c', ] xorg_dri = static_library('xorg_dri', srcs_xorg_dri, include_directories: [inc, xorg_inc], dependencies: [ common_dep, libdrm_dep, ], c_args: xorg_c_args, ) install_data( [ 'dri.h', 'sarea.h', 'dristruct.h', ], install_dir: xorgsdkdir, ) xorg-server-1.20.8/hw/xfree86/exa/0000755000175000017500000000000013640201534013546 500000000000000xorg-server-1.20.8/hw/xfree86/exa/Makefile.am0000644000175000017500000000047013640201473015525 00000000000000SUBDIRS = man module_LTLIBRARIES = libexa.la libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) AM_CPPFLAGS = \ $(XORG_INCS) \ -I$(srcdir)/../../../exa AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) libexa_la_SOURCES = \ examodule.c libexa_la_LIBADD = \ ../../../exa/libexa.la $(PIXMAN_LIBS) xorg-server-1.20.8/hw/xfree86/exa/examodule.c0000644000175000017500000001512713640201473015625 00000000000000/* * Copyright © 2006 Intel Corporation * * 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. * * Authors: * Eric Anholt * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "exa_priv.h" #include "xf86str.h" #include "xf86.h" typedef struct _ExaXorgScreenPrivRec { CloseScreenProcPtr SavedCloseScreen; xf86EnableDisableFBAccessProc *SavedEnableDisableFBAccess; OptionInfoPtr options; } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr; static DevPrivateKeyRec exaXorgScreenPrivateKeyRec; #define exaXorgScreenPrivateKey (&exaXorgScreenPrivateKeyRec) typedef enum { EXAOPT_MIGRATION_HEURISTIC, EXAOPT_NO_COMPOSITE, EXAOPT_NO_UTS, EXAOPT_NO_DFS, EXAOPT_OPTIMIZE_MIGRATION } EXAOpts; static const OptionInfoRec EXAOptions[] = { {EXAOPT_MIGRATION_HEURISTIC, "MigrationHeuristic", OPTV_ANYSTR, {0}, FALSE}, {EXAOPT_NO_COMPOSITE, "EXANoComposite", OPTV_BOOLEAN, {0}, FALSE}, {EXAOPT_NO_UTS, "EXANoUploadToScreen", OPTV_BOOLEAN, {0}, FALSE}, {EXAOPT_NO_DFS, "EXANoDownloadFromScreen", OPTV_BOOLEAN, {0}, FALSE}, {EXAOPT_OPTIMIZE_MIGRATION, "EXAOptimizeMigration", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; static Bool exaXorgCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); pScreen->CloseScreen = pScreenPriv->SavedCloseScreen; pScrn->EnableDisableFBAccess = pScreenPriv->SavedEnableDisableFBAccess; free(pScreenPriv->options); free(pScreenPriv); return pScreen->CloseScreen(pScreen); } static void exaXorgEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); if (!enable) exaEnableDisableFBAccess(pScreen, enable); if (pScreenPriv->SavedEnableDisableFBAccess) pScreenPriv->SavedEnableDisableFBAccess(pScrn, enable); if (enable) exaEnableDisableFBAccess(pScreen, enable); } /** * This will be called during exaDriverInit, giving us the chance to set options * and hook in our EnableDisableFBAccess. */ void exaDDXDriverInit(ScreenPtr pScreen) { ExaScreenPriv(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv; if (!dixRegisterPrivateKey(&exaXorgScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return; pScreenPriv = calloc(1, sizeof(ExaXorgScreenPrivRec)); if (pScreenPriv == NULL) return; pScreenPriv->options = xnfalloc(sizeof(EXAOptions)); memcpy(pScreenPriv->options, EXAOptions, sizeof(EXAOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pScreenPriv->options); if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) { if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) && pExaScr->info->offScreenBase < pExaScr->info->memorySize) { const char *heuristicName; heuristicName = xf86GetOptValString(pScreenPriv->options, EXAOPT_MIGRATION_HEURISTIC); if (heuristicName != NULL) { if (strcmp(heuristicName, "greedy") == 0) pExaScr->migration = ExaMigrationGreedy; else if (strcmp(heuristicName, "always") == 0) pExaScr->migration = ExaMigrationAlways; else if (strcmp(heuristicName, "smart") == 0) pExaScr->migration = ExaMigrationSmart; else { xf86DrvMsg(pScreen->myNum, X_WARNING, "EXA: unknown migration heuristic %s\n", heuristicName); } } } pExaScr->optimize_migration = xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_OPTIMIZE_MIGRATION, TRUE); } if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_COMPOSITE, FALSE)) { xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling Composite operation " "(RENDER acceleration)\n"); pExaScr->info->CheckComposite = NULL; pExaScr->info->PrepareComposite = NULL; } if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) { xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling UploadToScreen\n"); pExaScr->info->UploadToScreen = NULL; } if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) { xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling DownloadFromScreen\n"); pExaScr->info->DownloadFromScreen = NULL; } dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, pScreenPriv); pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess; pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess; pScreenPriv->SavedCloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = exaXorgCloseScreen; } static XF86ModuleVersionInfo exaVersRec = { "exa", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, EXA_VERSION_MAJOR, EXA_VERSION_MINOR, EXA_VERSION_RELEASE, ABI_CLASS_VIDEODRV, /* requires the video driver ABI */ ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} }; _X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, NULL, NULL }; xorg-server-1.20.8/hw/xfree86/exa/Makefile.in0000644000175000017500000010152613640201512015534 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/exa ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" LTLIBRARIES = $(module_LTLIBRARIES) am__DEPENDENCIES_1 = libexa_la_DEPENDENCIES = ../../../exa/libexa.la $(am__DEPENDENCIES_1) am_libexa_la_OBJECTS = examodule.lo libexa_la_OBJECTS = $(am_libexa_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libexa_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libexa_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/examodule.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libexa_la_SOURCES) DIST_SOURCES = $(libexa_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man module_LTLIBRARIES = libexa.la libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) AM_CPPFLAGS = \ $(XORG_INCS) \ -I$(srcdir)/../../../exa AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) libexa_la_SOURCES = \ examodule.c libexa_la_LIBADD = \ ../../../exa/libexa.la $(PIXMAN_LIBS) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/exa/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/exa/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libexa.la: $(libexa_la_OBJECTS) $(libexa_la_DEPENDENCIES) $(EXTRA_libexa_la_DEPENDENCIES) $(AM_V_CCLD)$(libexa_la_LINK) -rpath $(moduledir) $(libexa_la_OBJECTS) $(libexa_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/examodule.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(moduledir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/examodule.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-moduleLTLIBRARIES install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/examodule.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-moduleLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic clean-libtool \ clean-moduleLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/exa/man/0000755000175000017500000000000013640201534014321 500000000000000xorg-server-1.20.8/hw/xfree86/exa/man/Makefile.am0000644000175000017500000000007213640201473016276 00000000000000include $(top_srcdir)/manpages.am driverman_PRE = exa.man xorg-server-1.20.8/hw/xfree86/exa/man/Makefile.in0000644000175000017500000006561313640201512016315 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/exa/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man driverman_PRE = exa.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/exa/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/exa/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/exa/man/exa.man0000644000175000017500000000337313640201473015523 00000000000000.\" shorthand for double quote that works everywhere. .ds q \N'34' .TH EXA @drivermansuffix@ @vendorversion@ .SH NAME exa \- new 2D acceleration architecture for X.Org .SH DESCRIPTION .B EXA provides a simple API for video drivers to implement for 2D acceleration. It is a module loaded by drivers, and is not intended to be loaded on its own. See your driver's manual page for how to enable .BR EXA . .PP The .B EXA architecture is designed to make accelerating the Render extension simple and efficient, and results in various performance tradeoffs compared to XAA. Some xorg.conf options are available for debugging performance issues or driver rendering problems. They are not intended for general use. .TP .BI "Option \*qEXANoComposite\*q \*q" boolean \*q Disables acceleration of the Composite operation, which is at the heart of the Render extension. Not related to the Composite extension. Default: No. .TP .BI "Option \*qEXANoUploadToScreen\*q \*q" boolean \*q Disables acceleration of uploading pixmap data to the framebuffer. Default: No. .TP .BI "Option \*qEXANoDownloadFromScreen\*q \*q" boolean \*q Disables acceleration of downloading of pixmap data from the framebuffer. .B NOTE: Not usable with drivers which rely on DownloadFromScreen succeeding. Default: No. .TP .BI "Option \*qMigrationHeuristic\*q \*q" anystr \*q Chooses an alternate pixmap migration heuristic, for debugging purposes. The default is intended to be the best performing one for general use, though others may help with specific use cases. Available options include \*qalways\*q, \*qgreedy\*q, and \*qsmart\*q. Default: always. .SH "SEE ALSO" .BR Xorg (@appmansuffix@), .BR xorg.conf(@filemansuffix@). .SH AUTHORS Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel D\(:anzer xorg-server-1.20.8/hw/xfree86/exa/meson.build0000644000175000017500000000053413640201473015634 00000000000000xorg_exa = shared_module('exa', 'examodule.c', include_directories: [inc, xorg_inc], dependencies: common_dep, link_with: [libxserver_exa, e], c_args: xorg_c_args, install: true, install_dir: module_dir, ) install_man(configure_file( input: 'man/exa.man', output: 'exa.4', configuration: manpage_config, )) xorg-server-1.20.8/hw/xfree86/Makefile.in0000644000175000017500000011742413640201512014763 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = Xorg$(EXEEXT) @SUID_WRAPPER_TRUE@wrapexec_PROGRAMS = Xorg.wrap$(EXEEXT) subdir = hw/xfree86 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = Xorg.sh CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wrapexecdir)" PROGRAMS = $(bin_PROGRAMS) $(wrapexec_PROGRAMS) nodist_Xorg_OBJECTS = sdksyms.$(OBJEXT) Xorg_OBJECTS = $(nodist_Xorg_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ loader/libloader.la common/libcommon.la \ os-support/libxorgos.la parser/libxf86config.la \ dixmods/libdixmods.la modes/libxf86modes.la \ ramdac/libramdac.la ddc/libddc.la i2c/libi2c.la \ $(am__DEPENDENCIES_1) xkb/libxorgxkb.la $(DRI_LIB) $(DRI2_LIB) \ $(DRI3_LIB) $(GLXVND_LIB) \ $(top_builddir)/miext/sync/libsync.la \ $(top_builddir)/mi/libmi.la $(top_builddir)/os/libos.la \ $(top_builddir)/Xext/libXvidmode.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = Xorg_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(Xorg_LDFLAGS) $(LDFLAGS) -o $@ am__Xorg_wrap_SOURCES_DIST = xorg-wrapper.c @SUID_WRAPPER_TRUE@am_Xorg_wrap_OBJECTS = xorg-wrapper.$(OBJEXT) Xorg_wrap_OBJECTS = $(am_Xorg_wrap_OBJECTS) Xorg_wrap_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/sdksyms.Po \ ./$(DEPDIR)/xorg-wrapper.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(nodist_Xorg_SOURCES) $(Xorg_wrap_SOURCES) DIST_SOURCES = $(am__Xorg_wrap_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Xorg.sh.in \ $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @DRI_TRUE@DRI_SUBDIR = dri @DRI_TRUE@DRI_LIB = dri/libdri.la @DRI2_TRUE@DRI2_SUBDIR = dri2 @DRI2_TRUE@DRI2_LIB = dri2/libdri2.la @DRI3_TRUE@DRI3_BUILDDIR = $(top_builddir)/dri3 @DRI3_TRUE@DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la @GLX_TRUE@GLXVND_LIB = $(top_builddir)/glx/libglxvnd.la @GLAMOR_EGL_TRUE@GLAMOR_EGL_SUBDIR = glamor_egl @XF86UTILS_TRUE@XF86UTILS_SUBDIR = utils @VGAHW_TRUE@VGAHW_SUBDIR = vgahw @VBE_TRUE@VBE_SUBDIR = vbe @INT10MODULE_TRUE@INT10_SUBDIR = int10 SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods xkb \ fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ $(GLAMOR_EGL_SUBDIR) drivers DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ parser ramdac shadowfb vbe vgahw \ loader dixmods xkb dri dri2 exa modes \ utils doc man glamor_egl drivers nodist_Xorg_SOURCES = sdksyms.c AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/parser \ -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \ -I$(srcdir)/dri -I$(srcdir)/dri2 -I$(top_srcdir)/dri3 LOCAL_LIBS = \ $(MAIN_LIB) \ $(XSERVER_LIBS) \ loader/libloader.la \ common/libcommon.la \ os-support/libxorgos.la \ parser/libxf86config.la \ dixmods/libdixmods.la \ modes/libxf86modes.la \ ramdac/libramdac.la \ ddc/libddc.la \ i2c/libi2c.la \ $(XORG_LIBS) \ xkb/libxorgxkb.la \ $(DRI_LIB) \ $(DRI2_LIB) \ $(DRI3_LIB) \ $(GLXVND_LIB) \ $(top_builddir)/miext/sync/libsync.la \ $(top_builddir)/mi/libmi.la \ $(top_builddir)/os/libos.la \ $(top_builddir)/Xext/libXvidmode.la Xorg_LDADD = \ $(LOCAL_LIBS) \ $(XORG_SYS_LIBS) \ $(XSERVER_SYS_LIBS) Xorg_DEPENDENCIES = $(LOCAL_LIBS) Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) @SUID_WRAPPER_TRUE@wrapexecdir = $(SUID_WRAPPER_DIR) @SUID_WRAPPER_TRUE@Xorg_wrap_SOURCES = xorg-wrapper.c BUILT_SOURCES = xorg.conf.example DISTCLEANFILES = xorg.conf.example EXTRA_DIST = xorgconf.cpp sdksyms.sh # Use variables from XORG_MANPAGE_SECTIONS and X Server configuration # Do not include manpages.am as values are not appropriate for rc files CONF_SUBSTS = -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \ -e 's|MODULEPATH|$(DEFAULT_MODULE_PATH)|g' \ -e 's|DEFAULTFONTPATH|$(COMPILEDDEFAULTFONTPATH)|g' CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh SDKSYMS_DEP = sdksyms.dep all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): Xorg.sh: $(top_builddir)/config.status $(srcdir)/Xorg.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list install-wrapexecPROGRAMS: $(wrapexec_PROGRAMS) @$(NORMAL_INSTALL) @list='$(wrapexec_PROGRAMS)'; test -n "$(wrapexecdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(wrapexecdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(wrapexecdir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(wrapexecdir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(wrapexecdir)$$dir" || exit $$?; \ } \ ; done uninstall-wrapexecPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(wrapexec_PROGRAMS)'; test -n "$(wrapexecdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(wrapexecdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(wrapexecdir)" && rm -f $$files clean-wrapexecPROGRAMS: @list='$(wrapexec_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list Xorg$(EXEEXT): $(Xorg_OBJECTS) $(Xorg_DEPENDENCIES) $(EXTRA_Xorg_DEPENDENCIES) @rm -f Xorg$(EXEEXT) $(AM_V_CCLD)$(Xorg_LINK) $(Xorg_OBJECTS) $(Xorg_LDADD) $(LIBS) Xorg.wrap$(EXEEXT): $(Xorg_wrap_OBJECTS) $(Xorg_wrap_DEPENDENCIES) $(EXTRA_Xorg_wrap_DEPENDENCIES) @rm -f Xorg.wrap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(Xorg_wrap_OBJECTS) $(Xorg_wrap_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdksyms.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorg-wrapper.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wrapexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-wrapexecPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/sdksyms.Po -rm -f ./$(DEPDIR)/xorg-wrapper.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-wrapexecPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/sdksyms.Po -rm -f ./$(DEPDIR)/xorg-wrapper.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-local \ uninstall-wrapexecPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: $(am__recursive_targets) all check install install-am \ install-exec-am install-strip uninstall-am .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-wrapexecPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-exec-hook install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ install-wrapexecPROGRAMS installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-hook uninstall-local uninstall-wrapexecPROGRAMS .PRECIOUS: Makefile # Without logdir, X will post an error on the terminal and will not start install-data-local: $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir) @CYGWIN_TRUE@ $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a install-exec-hook: (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg$(EXEEXT) X) @INSTALL_SETUID_TRUE@ chown 0 $(DESTDIR)$(bindir)/Xorg @INSTALL_SETUID_TRUE@ chmod u+s $(DESTDIR)$(bindir)/Xorg @SUID_WRAPPER_TRUE@ $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) @SUID_WRAPPER_TRUE@ mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg @SUID_WRAPPER_TRUE@ ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg @SUID_WRAPPER_TRUE@ -chown 0 $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap uninstall-local: @CYGWIN_TRUE@ $(AM_V_at)rm -f $(DESTDIR)$(libdir)/libXorg.exe.a uninstall-hook: $(AM_V_at)rm -f $(DESTDIR)$(bindir)/X xorg.conf.example: xorgconf.cpp $(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $(srcdir)/xorgconf.cpp > $@ relink: $(AM_V_at)rm -f Xorg$(EXEEXT) && $(MAKE) Xorg$(EXEEXT) sdksyms.dep sdksyms.c: sdksyms.sh $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) -include $(SDKSYMS_DEP) i2c/libi2c.la: $(AM_V_at)cd i2c && $(MAKE) libi2c.la dixmods/libdixmods.la: $(AM_V_at)cd dixmods && $(MAKE) libdixmods.la xkb/libxorgxkb.la: $(AM_V_at)cd xkb && $(MAKE) libxorgxkb.la # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/vgahw/0000755000175000017500000000000013640201534014105 500000000000000xorg-server-1.20.8/hw/xfree86/vgahw/Makefile.am0000644000175000017500000000043213640201473016062 00000000000000module_LTLIBRARIES = libvgahw.la libvgahw_la_LDFLAGS = -avoid-version libvgahw_la_LIBADD = $(PCIACCESS_LIBS) libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = vgaHW.h xorg-server-1.20.8/hw/xfree86/vgahw/vgaHWmodule.c0000644000175000017500000000070713640201473016421 00000000000000/* * Copyright 1998 by The XFree86 Project, Inc */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Module.h" static XF86ModuleVersionInfo VersRec = { "vgahw", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 0, 1, 0, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} }; _X_EXPORT XF86ModuleData vgahwModuleData = { &VersRec, NULL, NULL }; xorg-server-1.20.8/hw/xfree86/vgahw/vgaHW.c0000644000175000017500000016022013640201473015210 00000000000000 /* * * Copyright 1991-1999 by The XFree86 Project, Inc. * * Loosely based on code bearing the following copyright: * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * */ #define _NEED_SYSI86 #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include "vgaHW.h" #include "compiler.h" #include "xf86cmap.h" #include "Pci.h" #ifndef SAVE_FONT1 #define SAVE_FONT1 1 #endif /* * These used to be OS-specific, which made this module have an undesirable * OS dependency. Define them by default for all platforms. */ #ifndef NEED_SAVED_CMAP #define NEED_SAVED_CMAP #endif #ifndef SAVE_TEXT #define SAVE_TEXT 1 #endif #ifndef SAVE_FONT2 #define SAVE_FONT2 1 #endif /* bytes per plane to save for text */ #define TEXT_AMOUNT 16384 /* bytes per plane to save for font data */ #define FONT_AMOUNT (8*8192) #if 0 /* Override all of these for now */ #undef SAVE_FONT1 #define SAVE_FONT1 1 #undef SAVE_FONT2 #define SAVE_FONT2 1 #undef SAVE_TEST #define SAVE_TEST 1 #undef FONT_AMOUNT #define FONT_AMOUNT 65536 #undef TEXT_AMOUNT #define TEXT_AMOUNT 65536 #endif /* DAC indices for white and black */ #define WHITE_VALUE 0x3F #define BLACK_VALUE 0x00 #define OVERSCAN_VALUE 0x01 /* Use a private definition of this here */ #undef VGAHWPTR #define VGAHWPTRLVAL(p) (p)->privates[vgaHWPrivateIndex].ptr #define VGAHWPTR(p) ((vgaHWPtr)(VGAHWPTRLVAL(p))) static int vgaHWPrivateIndex = -1; #define DAC_TEST_MASK 0x3F #ifdef NEED_SAVED_CMAP /* This default colourmap is used only when it can't be read from the VGA */ static CARD8 defaultDAC[768] = { 0, 0, 0, 0, 0, 42, 0, 42, 0, 0, 42, 42, 42, 0, 0, 42, 0, 42, 42, 21, 0, 42, 42, 42, 21, 21, 21, 21, 21, 63, 21, 63, 21, 21, 63, 63, 63, 21, 21, 63, 21, 63, 63, 63, 21, 63, 63, 63, 0, 0, 0, 5, 5, 5, 8, 8, 8, 11, 11, 11, 14, 14, 14, 17, 17, 17, 20, 20, 20, 24, 24, 24, 28, 28, 28, 32, 32, 32, 36, 36, 36, 40, 40, 40, 45, 45, 45, 50, 50, 50, 56, 56, 56, 63, 63, 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0, 63, 63, 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63, 0, 0, 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31, 63, 63, 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63, 31, 31, 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45, 63, 63, 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63, 45, 45, 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0, 28, 28, 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28, 0, 0, 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14, 28, 28, 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28, 14, 14, 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20, 28, 28, 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28, 20, 20, 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0, 16, 16, 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16, 0, 0, 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8, 16, 16, 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16, 8, 8, 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11, 16, 16, 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16, 11, 11, 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #endif /* NEED_SAVED_CMAP */ /* * Standard VGA versions of the register access functions. */ static void stdWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value) { pci_io_write8(hwp->io, hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); pci_io_write8(hwp->io, hwp->IOBase + VGA_CRTC_DATA_OFFSET, value); } static CARD8 stdReadCrtc(vgaHWPtr hwp, CARD8 index) { pci_io_write8(hwp->io, hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); return pci_io_read8(hwp->io, hwp->IOBase + VGA_CRTC_DATA_OFFSET); } static void stdWriteGr(vgaHWPtr hwp, CARD8 index, CARD8 value) { pci_io_write8(hwp->io, VGA_GRAPH_INDEX, index); pci_io_write8(hwp->io, VGA_GRAPH_DATA, value); } static CARD8 stdReadGr(vgaHWPtr hwp, CARD8 index) { pci_io_write8(hwp->io, VGA_GRAPH_INDEX, index); return pci_io_read8(hwp->io, VGA_GRAPH_DATA); } static void stdWriteSeq(vgaHWPtr hwp, CARD8 index, CARD8 value) { pci_io_write8(hwp->io, VGA_SEQ_INDEX, index); pci_io_write8(hwp->io, VGA_SEQ_DATA, value); } static CARD8 stdReadSeq(vgaHWPtr hwp, CARD8 index) { pci_io_write8(hwp->io, VGA_SEQ_INDEX, index); return pci_io_read8(hwp->io, VGA_SEQ_DATA); } static CARD8 stdReadST00(vgaHWPtr hwp) { return pci_io_read8(hwp->io, VGA_IN_STAT_0); } static CARD8 stdReadST01(vgaHWPtr hwp) { return pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET); } static CARD8 stdReadFCR(vgaHWPtr hwp) { return pci_io_read8(hwp->io, VGA_FEATURE_R); } static void stdWriteFCR(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, hwp->IOBase + VGA_FEATURE_W_OFFSET, value); } static void stdWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value) { if (hwp->paletteEnabled) index &= ~0x20; else index |= 0x20; (void) pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET); pci_io_write8(hwp->io, VGA_ATTR_INDEX, index); pci_io_write8(hwp->io, VGA_ATTR_DATA_W, value); } static CARD8 stdReadAttr(vgaHWPtr hwp, CARD8 index) { if (hwp->paletteEnabled) index &= ~0x20; else index |= 0x20; (void) pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET); pci_io_write8(hwp->io, VGA_ATTR_INDEX, index); return pci_io_read8(hwp->io, VGA_ATTR_DATA_R); } static void stdWriteMiscOut(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, VGA_MISC_OUT_W, value); } static CARD8 stdReadMiscOut(vgaHWPtr hwp) { return pci_io_read8(hwp->io, VGA_MISC_OUT_R); } static void stdEnablePalette(vgaHWPtr hwp) { (void) pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET); pci_io_write8(hwp->io, VGA_ATTR_INDEX, 0x00); hwp->paletteEnabled = TRUE; } static void stdDisablePalette(vgaHWPtr hwp) { (void) pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET); pci_io_write8(hwp->io, VGA_ATTR_INDEX, 0x20); hwp->paletteEnabled = FALSE; } static void stdWriteDacMask(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, VGA_DAC_MASK, value); } static CARD8 stdReadDacMask(vgaHWPtr hwp) { return pci_io_read8(hwp->io, VGA_DAC_MASK); } static void stdWriteDacReadAddr(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, VGA_DAC_READ_ADDR, value); } static void stdWriteDacWriteAddr(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, VGA_DAC_WRITE_ADDR, value); } static void stdWriteDacData(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, VGA_DAC_DATA, value); } static CARD8 stdReadDacData(vgaHWPtr hwp) { return pci_io_read8(hwp->io, VGA_DAC_DATA); } static CARD8 stdReadEnable(vgaHWPtr hwp) { return pci_io_read8(hwp->io, VGA_ENABLE); } static void stdWriteEnable(vgaHWPtr hwp, CARD8 value) { pci_io_write8(hwp->io, VGA_ENABLE, value); } void vgaHWSetStdFuncs(vgaHWPtr hwp) { hwp->writeCrtc = stdWriteCrtc; hwp->readCrtc = stdReadCrtc; hwp->writeGr = stdWriteGr; hwp->readGr = stdReadGr; hwp->readST00 = stdReadST00; hwp->readST01 = stdReadST01; hwp->readFCR = stdReadFCR; hwp->writeFCR = stdWriteFCR; hwp->writeAttr = stdWriteAttr; hwp->readAttr = stdReadAttr; hwp->writeSeq = stdWriteSeq; hwp->readSeq = stdReadSeq; hwp->writeMiscOut = stdWriteMiscOut; hwp->readMiscOut = stdReadMiscOut; hwp->enablePalette = stdEnablePalette; hwp->disablePalette = stdDisablePalette; hwp->writeDacMask = stdWriteDacMask; hwp->readDacMask = stdReadDacMask; hwp->writeDacWriteAddr = stdWriteDacWriteAddr; hwp->writeDacReadAddr = stdWriteDacReadAddr; hwp->writeDacData = stdWriteDacData; hwp->readDacData = stdReadDacData; hwp->readEnable = stdReadEnable; hwp->writeEnable = stdWriteEnable; hwp->io = pci_legacy_open_io(hwp->dev, 0, 64 * 1024); } /* * MMIO versions of the register access functions. These require * hwp->MemBase to be set in such a way that when the standard VGA port * adderss is added the correct memory address results. */ #define minb(p) MMIO_IN8(hwp->MMIOBase, (hwp->MMIOOffset + (p))) #define moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v)) static void mmioWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value) { moutb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); moutb(hwp->IOBase + VGA_CRTC_DATA_OFFSET, value); } static CARD8 mmioReadCrtc(vgaHWPtr hwp, CARD8 index) { moutb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); return minb(hwp->IOBase + VGA_CRTC_DATA_OFFSET); } static void mmioWriteGr(vgaHWPtr hwp, CARD8 index, CARD8 value) { moutb(VGA_GRAPH_INDEX, index); moutb(VGA_GRAPH_DATA, value); } static CARD8 mmioReadGr(vgaHWPtr hwp, CARD8 index) { moutb(VGA_GRAPH_INDEX, index); return minb(VGA_GRAPH_DATA); } static void mmioWriteSeq(vgaHWPtr hwp, CARD8 index, CARD8 value) { moutb(VGA_SEQ_INDEX, index); moutb(VGA_SEQ_DATA, value); } static CARD8 mmioReadSeq(vgaHWPtr hwp, CARD8 index) { moutb(VGA_SEQ_INDEX, index); return minb(VGA_SEQ_DATA); } static CARD8 mmioReadST00(vgaHWPtr hwp) { return minb(VGA_IN_STAT_0); } static CARD8 mmioReadST01(vgaHWPtr hwp) { return minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); } static CARD8 mmioReadFCR(vgaHWPtr hwp) { return minb(VGA_FEATURE_R); } static void mmioWriteFCR(vgaHWPtr hwp, CARD8 value) { moutb(hwp->IOBase + VGA_FEATURE_W_OFFSET, value); } static void mmioWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value) { if (hwp->paletteEnabled) index &= ~0x20; else index |= 0x20; (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); moutb(VGA_ATTR_INDEX, index); moutb(VGA_ATTR_DATA_W, value); } static CARD8 mmioReadAttr(vgaHWPtr hwp, CARD8 index) { if (hwp->paletteEnabled) index &= ~0x20; else index |= 0x20; (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); moutb(VGA_ATTR_INDEX, index); return minb(VGA_ATTR_DATA_R); } static void mmioWriteMiscOut(vgaHWPtr hwp, CARD8 value) { moutb(VGA_MISC_OUT_W, value); } static CARD8 mmioReadMiscOut(vgaHWPtr hwp) { return minb(VGA_MISC_OUT_R); } static void mmioEnablePalette(vgaHWPtr hwp) { (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); moutb(VGA_ATTR_INDEX, 0x00); hwp->paletteEnabled = TRUE; } static void mmioDisablePalette(vgaHWPtr hwp) { (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); moutb(VGA_ATTR_INDEX, 0x20); hwp->paletteEnabled = FALSE; } static void mmioWriteDacMask(vgaHWPtr hwp, CARD8 value) { moutb(VGA_DAC_MASK, value); } static CARD8 mmioReadDacMask(vgaHWPtr hwp) { return minb(VGA_DAC_MASK); } static void mmioWriteDacReadAddr(vgaHWPtr hwp, CARD8 value) { moutb(VGA_DAC_READ_ADDR, value); } static void mmioWriteDacWriteAddr(vgaHWPtr hwp, CARD8 value) { moutb(VGA_DAC_WRITE_ADDR, value); } static void mmioWriteDacData(vgaHWPtr hwp, CARD8 value) { moutb(VGA_DAC_DATA, value); } static CARD8 mmioReadDacData(vgaHWPtr hwp) { return minb(VGA_DAC_DATA); } static CARD8 mmioReadEnable(vgaHWPtr hwp) { return minb(VGA_ENABLE); } static void mmioWriteEnable(vgaHWPtr hwp, CARD8 value) { moutb(VGA_ENABLE, value); } void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset) { hwp->writeCrtc = mmioWriteCrtc; hwp->readCrtc = mmioReadCrtc; hwp->writeGr = mmioWriteGr; hwp->readGr = mmioReadGr; hwp->readST00 = mmioReadST00; hwp->readST01 = mmioReadST01; hwp->readFCR = mmioReadFCR; hwp->writeFCR = mmioWriteFCR; hwp->writeAttr = mmioWriteAttr; hwp->readAttr = mmioReadAttr; hwp->writeSeq = mmioWriteSeq; hwp->readSeq = mmioReadSeq; hwp->writeMiscOut = mmioWriteMiscOut; hwp->readMiscOut = mmioReadMiscOut; hwp->enablePalette = mmioEnablePalette; hwp->disablePalette = mmioDisablePalette; hwp->writeDacMask = mmioWriteDacMask; hwp->readDacMask = mmioReadDacMask; hwp->writeDacWriteAddr = mmioWriteDacWriteAddr; hwp->writeDacReadAddr = mmioWriteDacReadAddr; hwp->writeDacData = mmioWriteDacData; hwp->readDacData = mmioReadDacData; hwp->MMIOBase = base; hwp->MMIOOffset = offset; hwp->readEnable = mmioReadEnable; hwp->writeEnable = mmioWriteEnable; } /* * vgaHWProtect -- * Protect VGA registers and memory from corruption during loads. */ void vgaHWProtect(ScrnInfoPtr pScrn, Bool on) { vgaHWPtr hwp = VGAHWPTR(pScrn); unsigned char tmp; if (pScrn->vtSema) { if (on) { /* * Turn off screen and disable sequencer. */ tmp = hwp->readSeq(hwp, 0x01); vgaHWSeqReset(hwp, TRUE); /* start synchronous reset */ hwp->writeSeq(hwp, 0x01, tmp | 0x20); /* disable the display */ hwp->enablePalette(hwp); } else { /* * Reenable sequencer, then turn on screen. */ tmp = hwp->readSeq(hwp, 0x01); hwp->writeSeq(hwp, 0x01, tmp & ~0x20); /* reenable display */ vgaHWSeqReset(hwp, FALSE); /* clear synchronousreset */ hwp->disablePalette(hwp); } } } vgaHWProtectProc * vgaHWProtectWeak(void) { return vgaHWProtect; } /* * vgaHWBlankScreen -- blank the screen. */ void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on) { vgaHWPtr hwp = VGAHWPTR(pScrn); unsigned char scrn; scrn = hwp->readSeq(hwp, 0x01); if (on) { scrn &= ~0x20; /* enable screen */ } else { scrn |= 0x20; /* blank screen */ } vgaHWSeqReset(hwp, TRUE); hwp->writeSeq(hwp, 0x01, scrn); /* change mode */ vgaHWSeqReset(hwp, FALSE); } vgaHWBlankScreenProc * vgaHWBlankScreenWeak(void) { return vgaHWBlankScreen; } /* * vgaHWSaveScreen -- blank the screen. */ Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = NULL; Bool on; if (pScreen != NULL) pScrn = xf86ScreenToScrn(pScreen); on = xf86IsUnblank(mode); #if 0 if (on) SetTimeSinceLastInputEvent(); #endif if ((pScrn != NULL) && pScrn->vtSema) { vgaHWBlankScreen(pScrn, on); } return TRUE; } /* * vgaHWDPMSSet -- Sets VESA Display Power Management Signaling (DPMS) Mode * * This generic VGA function can only set the Off and On modes. If the * Standby and Suspend modes are to be supported, a chip specific replacement * for this function must be written. */ void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { unsigned char seq1 = 0, crtc17 = 0; vgaHWPtr hwp = VGAHWPTR(pScrn); if (!pScrn->vtSema) return; switch (PowerManagementMode) { case DPMSModeOn: /* Screen: On; HSync: On, VSync: On */ seq1 = 0x00; crtc17 = 0x80; break; case DPMSModeStandby: /* Screen: Off; HSync: Off, VSync: On -- Not Supported */ seq1 = 0x20; crtc17 = 0x80; break; case DPMSModeSuspend: /* Screen: Off; HSync: On, VSync: Off -- Not Supported */ seq1 = 0x20; crtc17 = 0x80; break; case DPMSModeOff: /* Screen: Off; HSync: Off, VSync: Off */ seq1 = 0x20; crtc17 = 0x00; break; } hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */ seq1 |= hwp->readSeq(hwp, 0x01) & ~0x20; hwp->writeSeq(hwp, 0x01, seq1); crtc17 |= hwp->readCrtc(hwp, 0x17) & ~0x80; usleep(10000); hwp->writeCrtc(hwp, 0x17, crtc17); hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */ } /* * vgaHWSeqReset * perform a sequencer reset. */ void vgaHWSeqReset(vgaHWPtr hwp, Bool start) { if (start) hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */ else hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */ } void vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore) { #if SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 vgaHWPtr hwp = VGAHWPTR(scrninfp); int savedIOBase; unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4; Bool doMap = FALSE; /* If nothing to do, return now */ if (!hwp->FontInfo1 && !hwp->FontInfo2 && !hwp->TextInfo) return; if (hwp->Base == NULL) { doMap = TRUE; if (!vgaHWMapMem(scrninfp)) { xf86DrvMsg(scrninfp->scrnIndex, X_ERROR, "vgaHWRestoreFonts: vgaHWMapMem() failed\n"); return; } } /* save the registers that are needed here */ miscOut = hwp->readMiscOut(hwp); attr10 = hwp->readAttr(hwp, 0x10); gr1 = hwp->readGr(hwp, 0x01); gr3 = hwp->readGr(hwp, 0x03); gr4 = hwp->readGr(hwp, 0x04); gr5 = hwp->readGr(hwp, 0x05); gr6 = hwp->readGr(hwp, 0x06); gr8 = hwp->readGr(hwp, 0x08); seq2 = hwp->readSeq(hwp, 0x02); seq4 = hwp->readSeq(hwp, 0x04); /* save hwp->IOBase and temporarily set it for colour mode */ savedIOBase = hwp->IOBase; hwp->IOBase = VGA_IOBASE_COLOR; /* Force into colour mode */ hwp->writeMiscOut(hwp, miscOut | 0x01); vgaHWBlankScreen(scrninfp, FALSE); /* * here we temporarily switch to 16 colour planar mode, to simply * copy the font-info and saved text. * * BUG ALERT: The (S)VGA's segment-select register MUST be set correctly! */ #if 0 hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */ #endif hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */ hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */ hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */ if (scrninfp->depth == 4) { /* GJA */ hwp->writeGr(hwp, 0x03, 0x00); /* don't rotate, write unmodified */ hwp->writeGr(hwp, 0x08, 0xFF); /* write all bits in a byte */ hwp->writeGr(hwp, 0x01, 0x00); /* all planes come from CPU */ } #if SAVE_FONT1 if (hwp->FontInfo1) { hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */ slowbcopy_tobus(hwp->FontInfo1, hwp->Base, FONT_AMOUNT); } #endif #if SAVE_FONT2 if (hwp->FontInfo2) { hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */ slowbcopy_tobus(hwp->FontInfo2, hwp->Base, FONT_AMOUNT); } #endif #if SAVE_TEXT if (hwp->TextInfo) { hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */ slowbcopy_tobus(hwp->TextInfo, hwp->Base, TEXT_AMOUNT); hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */ slowbcopy_tobus((unsigned char *) hwp->TextInfo + TEXT_AMOUNT, hwp->Base, TEXT_AMOUNT); } #endif vgaHWBlankScreen(scrninfp, TRUE); /* restore the registers that were changed */ hwp->writeMiscOut(hwp, miscOut); hwp->writeAttr(hwp, 0x10, attr10); hwp->writeGr(hwp, 0x01, gr1); hwp->writeGr(hwp, 0x03, gr3); hwp->writeGr(hwp, 0x04, gr4); hwp->writeGr(hwp, 0x05, gr5); hwp->writeGr(hwp, 0x06, gr6); hwp->writeGr(hwp, 0x08, gr8); hwp->writeSeq(hwp, 0x02, seq2); hwp->writeSeq(hwp, 0x04, seq4); hwp->IOBase = savedIOBase; if (doMap) vgaHWUnmapMem(scrninfp); #endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */ } void vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore) { vgaHWPtr hwp = VGAHWPTR(scrninfp); int i; if (restore->MiscOutReg & 0x01) hwp->IOBase = VGA_IOBASE_COLOR; else hwp->IOBase = VGA_IOBASE_MONO; hwp->writeMiscOut(hwp, restore->MiscOutReg); for (i = 1; i < restore->numSequencer; i++) hwp->writeSeq(hwp, i, restore->Sequencer[i]); /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 of CRTC[17] */ hwp->writeCrtc(hwp, 17, restore->CRTC[17] & ~0x80); for (i = 0; i < restore->numCRTC; i++) hwp->writeCrtc(hwp, i, restore->CRTC[i]); for (i = 0; i < restore->numGraphics; i++) hwp->writeGr(hwp, i, restore->Graphics[i]); hwp->enablePalette(hwp); for (i = 0; i < restore->numAttribute; i++) hwp->writeAttr(hwp, i, restore->Attribute[i]); hwp->disablePalette(hwp); } void vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore) { vgaHWPtr hwp = VGAHWPTR(scrninfp); int i; #if 0 hwp->enablePalette(hwp); #endif hwp->writeDacMask(hwp, 0xFF); hwp->writeDacWriteAddr(hwp, 0x00); for (i = 0; i < 768; i++) { hwp->writeDacData(hwp, restore->DAC[i]); DACDelay(hwp); } hwp->disablePalette(hwp); } /* * vgaHWRestore -- * restore the VGA state */ void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags) { if (flags & VGA_SR_MODE) vgaHWRestoreMode(scrninfp, restore); if (flags & VGA_SR_FONTS) vgaHWRestoreFonts(scrninfp, restore); if (flags & VGA_SR_CMAP) vgaHWRestoreColormap(scrninfp, restore); } void vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save) { #if SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 vgaHWPtr hwp = VGAHWPTR(scrninfp); int savedIOBase; unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4; Bool doMap = FALSE; if (hwp->Base == NULL) { doMap = TRUE; if (!vgaHWMapMem(scrninfp)) { xf86DrvMsg(scrninfp->scrnIndex, X_ERROR, "vgaHWSaveFonts: vgaHWMapMem() failed\n"); return; } } /* If in graphics mode, don't save anything */ attr10 = hwp->readAttr(hwp, 0x10); if (attr10 & 0x01) return; /* save the registers that are needed here */ miscOut = hwp->readMiscOut(hwp); gr4 = hwp->readGr(hwp, 0x04); gr5 = hwp->readGr(hwp, 0x05); gr6 = hwp->readGr(hwp, 0x06); seq2 = hwp->readSeq(hwp, 0x02); seq4 = hwp->readSeq(hwp, 0x04); /* save hwp->IOBase and temporarily set it for colour mode */ savedIOBase = hwp->IOBase; hwp->IOBase = VGA_IOBASE_COLOR; /* Force into colour mode */ hwp->writeMiscOut(hwp, miscOut | 0x01); vgaHWBlankScreen(scrninfp, FALSE); /* * get the character sets, and text screen if required */ /* * Here we temporarily switch to 16 colour planar mode, to simply * copy the font-info * * BUG ALERT: The (S)VGA's segment-select register MUST be set correctly! */ #if 0 hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */ #endif hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */ hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */ hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */ #if SAVE_FONT1 if (hwp->FontInfo1 || (hwp->FontInfo1 = malloc(FONT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */ slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT); } #endif /* SAVE_FONT1 */ #if SAVE_FONT2 if (hwp->FontInfo2 || (hwp->FontInfo2 = malloc(FONT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */ slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT); } #endif /* SAVE_FONT2 */ #if SAVE_TEXT if (hwp->TextInfo || (hwp->TextInfo = malloc(2 * TEXT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */ slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT); hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */ slowbcopy_frombus(hwp->Base, (unsigned char *) hwp->TextInfo + TEXT_AMOUNT, TEXT_AMOUNT); } #endif /* SAVE_TEXT */ /* Restore clobbered registers */ hwp->writeAttr(hwp, 0x10, attr10); hwp->writeSeq(hwp, 0x02, seq2); hwp->writeSeq(hwp, 0x04, seq4); hwp->writeGr(hwp, 0x04, gr4); hwp->writeGr(hwp, 0x05, gr5); hwp->writeGr(hwp, 0x06, gr6); hwp->writeMiscOut(hwp, miscOut); hwp->IOBase = savedIOBase; vgaHWBlankScreen(scrninfp, TRUE); if (doMap) vgaHWUnmapMem(scrninfp); #endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */ } void vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save) { vgaHWPtr hwp = VGAHWPTR(scrninfp); int i; save->MiscOutReg = hwp->readMiscOut(hwp); if (save->MiscOutReg & 0x01) hwp->IOBase = VGA_IOBASE_COLOR; else hwp->IOBase = VGA_IOBASE_MONO; for (i = 0; i < save->numCRTC; i++) { save->CRTC[i] = hwp->readCrtc(hwp, i); DebugF("CRTC[0x%02x] = 0x%02x\n", i, save->CRTC[i]); } hwp->enablePalette(hwp); for (i = 0; i < save->numAttribute; i++) { save->Attribute[i] = hwp->readAttr(hwp, i); DebugF("Attribute[0x%02x] = 0x%02x\n", i, save->Attribute[i]); } hwp->disablePalette(hwp); for (i = 0; i < save->numGraphics; i++) { save->Graphics[i] = hwp->readGr(hwp, i); DebugF("Graphics[0x%02x] = 0x%02x\n", i, save->Graphics[i]); } for (i = 1; i < save->numSequencer; i++) { save->Sequencer[i] = hwp->readSeq(hwp, i); DebugF("Sequencer[0x%02x] = 0x%02x\n", i, save->Sequencer[i]); } } void vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save) { vgaHWPtr hwp = VGAHWPTR(scrninfp); Bool readError = FALSE; int i; #ifdef NEED_SAVED_CMAP /* * Some ET4000 chips from 1991 have a HW bug that prevents the reading * of the color lookup table. Mask rev 9042EAI is known to have this bug. * * If the colourmap is not readable, we set the saved map to a default * map (taken from Ferraro's "Programmer's Guide to the EGA and VGA * Cards" 2nd ed). */ /* Only save it once */ if (hwp->cmapSaved) return; #if 0 hwp->enablePalette(hwp); #endif hwp->writeDacMask(hwp, 0xFF); /* * check if we can read the lookup table */ hwp->writeDacReadAddr(hwp, 0x00); for (i = 0; i < 6; i++) { save->DAC[i] = hwp->readDacData(hwp); switch (i % 3) { case 0: DebugF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]); break; case 1: DebugF("0x%02x, ", save->DAC[i]); break; case 2: DebugF("0x%02x\n", save->DAC[i]); } } /* * Check if we can read the palette - * use foreground color to prevent flashing. */ hwp->writeDacWriteAddr(hwp, 0x01); for (i = 3; i < 6; i++) hwp->writeDacData(hwp, ~save->DAC[i] & DAC_TEST_MASK); hwp->writeDacReadAddr(hwp, 0x01); for (i = 3; i < 6; i++) { if (hwp->readDacData(hwp) != (~save->DAC[i] & DAC_TEST_MASK)) readError = TRUE; } hwp->writeDacWriteAddr(hwp, 0x01); for (i = 3; i < 6; i++) hwp->writeDacData(hwp, save->DAC[i]); if (readError) { /* * save the default lookup table */ memmove(save->DAC, defaultDAC, 768); xf86DrvMsg(scrninfp->scrnIndex, X_WARNING, "Cannot read colourmap from VGA. Will restore with default\n"); } else { /* save the colourmap */ hwp->writeDacReadAddr(hwp, 0x02); for (i = 6; i < 768; i++) { save->DAC[i] = hwp->readDacData(hwp); DACDelay(hwp); switch (i % 3) { case 0: DebugF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]); break; case 1: DebugF("0x%02x, ", save->DAC[i]); break; case 2: DebugF("0x%02x\n", save->DAC[i]); } } } hwp->disablePalette(hwp); hwp->cmapSaved = TRUE; #endif } /* * vgaHWSave -- * save the current VGA state */ void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags) { if (save == NULL) return; if (flags & VGA_SR_CMAP) vgaHWSaveColormap(scrninfp, save); if (flags & VGA_SR_MODE) vgaHWSaveMode(scrninfp, save); if (flags & VGA_SR_FONTS) vgaHWSaveFonts(scrninfp, save); } /* * vgaHWInit -- * Handle the initialization, etc. of a screen. * Return FALSE on failure. */ Bool vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode) { unsigned int i; vgaHWPtr hwp; vgaRegPtr regp; int depth = scrninfp->depth; /* * make sure the vgaHWRec is allocated */ if (!vgaHWGetHWRec(scrninfp)) return FALSE; hwp = VGAHWPTR(scrninfp); regp = &hwp->ModeReg; /* * compute correct Hsync & Vsync polarity */ if ((mode->Flags & (V_PHSYNC | V_NHSYNC)) && (mode->Flags & (V_PVSYNC | V_NVSYNC))) { regp->MiscOutReg = 0x23; if (mode->Flags & V_NHSYNC) regp->MiscOutReg |= 0x40; if (mode->Flags & V_NVSYNC) regp->MiscOutReg |= 0x80; } else { int VDisplay = mode->VDisplay; if (mode->Flags & V_DBLSCAN) VDisplay *= 2; if (mode->VScan > 1) VDisplay *= mode->VScan; if (VDisplay < 400) regp->MiscOutReg = 0xA3; /* +hsync -vsync */ else if (VDisplay < 480) regp->MiscOutReg = 0x63; /* -hsync +vsync */ else if (VDisplay < 768) regp->MiscOutReg = 0xE3; /* -hsync -vsync */ else regp->MiscOutReg = 0x23; /* +hsync +vsync */ } regp->MiscOutReg |= (mode->ClockIndex & 0x03) << 2; /* * Time Sequencer */ if (depth == 4) regp->Sequencer[0] = 0x02; else regp->Sequencer[0] = 0x00; if (mode->Flags & V_CLKDIV2) regp->Sequencer[1] = 0x09; else regp->Sequencer[1] = 0x01; if (depth == 1) regp->Sequencer[2] = 1 << BIT_PLANE; else regp->Sequencer[2] = 0x0F; regp->Sequencer[3] = 0x00; /* Font select */ if (depth < 8) regp->Sequencer[4] = 0x06; /* Misc */ else regp->Sequencer[4] = 0x0E; /* Misc */ /* * CRTC Controller */ regp->CRTC[0] = (mode->CrtcHTotal >> 3) - 5; regp->CRTC[1] = (mode->CrtcHDisplay >> 3) - 1; regp->CRTC[2] = (mode->CrtcHBlankStart >> 3) - 1; regp->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80; i = (((mode->CrtcHSkew << 2) + 0x10) & ~0x1F); if (i < 0x80) regp->CRTC[3] |= i; regp->CRTC[4] = (mode->CrtcHSyncStart >> 3); regp->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2) | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); regp->CRTC[6] = (mode->CrtcVTotal - 2) & 0xFF; regp->CRTC[7] = (((mode->CrtcVTotal - 2) & 0x100) >> 8) | (((mode->CrtcVDisplay - 1) & 0x100) >> 7) | ((mode->CrtcVSyncStart & 0x100) >> 6) | (((mode->CrtcVBlankStart - 1) & 0x100) >> 5) | 0x10 | (((mode->CrtcVTotal - 2) & 0x200) >> 4) | (((mode->CrtcVDisplay - 1) & 0x200) >> 3) | ((mode->CrtcVSyncStart & 0x200) >> 2); regp->CRTC[8] = 0x00; regp->CRTC[9] = (((mode->CrtcVBlankStart - 1) & 0x200) >> 4) | 0x40; if (mode->Flags & V_DBLSCAN) regp->CRTC[9] |= 0x80; if (mode->VScan >= 32) regp->CRTC[9] |= 0x1F; else if (mode->VScan > 1) regp->CRTC[9] |= mode->VScan - 1; regp->CRTC[10] = 0x00; regp->CRTC[11] = 0x00; regp->CRTC[12] = 0x00; regp->CRTC[13] = 0x00; regp->CRTC[14] = 0x00; regp->CRTC[15] = 0x00; regp->CRTC[16] = mode->CrtcVSyncStart & 0xFF; regp->CRTC[17] = (mode->CrtcVSyncEnd & 0x0F) | 0x20; regp->CRTC[18] = (mode->CrtcVDisplay - 1) & 0xFF; regp->CRTC[19] = scrninfp->displayWidth >> 4; /* just a guess */ regp->CRTC[20] = 0x00; regp->CRTC[21] = (mode->CrtcVBlankStart - 1) & 0xFF; regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; if (depth < 8) regp->CRTC[23] = 0xE3; else regp->CRTC[23] = 0xC3; regp->CRTC[24] = 0xFF; vgaHWHBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO); vgaHWVBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO); /* * Theory resumes here.... */ /* * Graphics Display Controller */ regp->Graphics[0] = 0x00; regp->Graphics[1] = 0x00; regp->Graphics[2] = 0x00; regp->Graphics[3] = 0x00; if (depth == 1) { regp->Graphics[4] = BIT_PLANE; regp->Graphics[5] = 0x00; } else { regp->Graphics[4] = 0x00; if (depth == 4) regp->Graphics[5] = 0x02; else regp->Graphics[5] = 0x40; } regp->Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */ regp->Graphics[7] = 0x0F; regp->Graphics[8] = 0xFF; if (depth == 1) { /* Initialise the Mono map according to which bit-plane gets used */ Bool flipPixels = xf86GetFlipPixels(); for (i = 0; i < 16; i++) if (((i & (1 << BIT_PLANE)) != 0) != flipPixels) regp->Attribute[i] = WHITE_VALUE; else regp->Attribute[i] = BLACK_VALUE; regp->Attribute[16] = 0x01; /* -VGA2- *//* wrong for the ET4000 */ if (!hwp->ShowOverscan) regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */ } else { regp->Attribute[0] = 0x00; /* standard colormap translation */ regp->Attribute[1] = 0x01; regp->Attribute[2] = 0x02; regp->Attribute[3] = 0x03; regp->Attribute[4] = 0x04; regp->Attribute[5] = 0x05; regp->Attribute[6] = 0x06; regp->Attribute[7] = 0x07; regp->Attribute[8] = 0x08; regp->Attribute[9] = 0x09; regp->Attribute[10] = 0x0A; regp->Attribute[11] = 0x0B; regp->Attribute[12] = 0x0C; regp->Attribute[13] = 0x0D; regp->Attribute[14] = 0x0E; regp->Attribute[15] = 0x0F; if (depth == 4) regp->Attribute[16] = 0x81; /* wrong for the ET4000 */ else regp->Attribute[16] = 0x41; /* wrong for the ET4000 */ /* Attribute[17] (overscan) initialised in vgaHWGetHWRec() */ } regp->Attribute[18] = 0x0F; regp->Attribute[19] = 0x00; regp->Attribute[20] = 0x00; return TRUE; } /* * OK, so much for theory. Now, let's deal with the >real< world... * * The above CRTC settings are precise in theory, except that many, if not * most, VGA clones fail to reset the blanking signal when the character or * line counter reaches [HV]Total. In this case, the signal is only * unblanked when the counter reaches [HV]BlankEnd (mod 64, 128 or 256 as * the case may be) at the start of the >next< scanline or frame, which * means only part of the screen shows. This affects how null overscans * are to be implemented on such adapters. * * Henceforth, VGA cores that implement this broken, but unfortunately * common, behaviour are to be designated as KGA's, in honour of Koen * Gadeyne, whose zeal to eliminate overscans (read: fury) set in motion * a series of events that led to the discovery of this problem. * * Some VGA's are KGA's only in the horizontal, or only in the vertical, * some in both, others in neither. Don't let anyone tell you there is * such a thing as a VGA "standard"... And, thank the Creator for the fact * that Hilbert spaces are not yet implemented in this industry. * * The following implements a trick suggested by David Dawes. This sets * [HV]BlankEnd to zero if the blanking interval does not already contain a * 0-point, and decrements it by one otherwise. In the latter case, this * will produce a left and/or top overscan which the colourmap code will * (still) need to ensure is as close to black as possible. This will make * the behaviour consistent across all chipsets, while allowing all * chipsets to display the entire screen. Non-KGA drivers can ignore the * following in their own copy of this code. * * -- TSI @ UQV, 1998.08.21 */ CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, unsigned int Flags) { int nExtBits = (nBits < 6) ? 0 : nBits - 6; CARD32 ExtBits; CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6; regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F); regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2); ExtBits = ((mode->CrtcHBlankEnd >> 3) - 1) & ExtBitMask; /* First the horizontal case */ if ((Flags & KGA_FIX_OVERSCAN) && ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3))) { int i = (regp->CRTC[3] & 0x1F) | ((regp->CRTC[5] & 0x80) >> 2) | ExtBits; if (Flags & KGA_ENABLE_ON_ZERO) { if ((i-- > (((mode->CrtcHBlankStart >> 3) - 1) & (0x3F | ExtBitMask))) && (mode->CrtcHBlankEnd == mode->CrtcHTotal)) i = 0; } else if (Flags & KGA_BE_TOT_DEC) i--; regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F); regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80); ExtBits = i & ExtBitMask; } return ExtBits >> 6; } /* * The vertical case is a little trickier. Some VGA's ignore bit 0x80 of * CRTC[22]. Also, in some cases, a zero CRTC[22] will still blank the * very first scanline in a double- or multi-scanned mode. This last case * needs further investigation. */ CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, unsigned int Flags) { CARD32 ExtBits; CARD32 nExtBits = (nBits < 8) ? 0 : (nBits - 8); CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 8; /* If width is not known nBits should be 0. In this * case BitMask is set to 0 so we can check for it. */ CARD32 BitMask = (nBits < 7) ? 0 : ((1 << nExtBits) - 1); int VBlankStart = (mode->CrtcVBlankStart - 1) & 0xFF; regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; ExtBits = (mode->CrtcVBlankEnd - 1) & ExtBitMask; if ((Flags & KGA_FIX_OVERSCAN) && (mode->CrtcVBlankEnd == mode->CrtcVTotal)) /* Null top overscan */ { int i = regp->CRTC[22] | ExtBits; if (Flags & KGA_ENABLE_ON_ZERO) { if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) || ((i > VBlankStart) && /* 8-bit case */ ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */ !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */ i = 0; else i = (i - 1); } else if (Flags & KGA_BE_TOT_DEC) i = (i - 1); regp->CRTC[22] = i & 0xFF; ExtBits = i & 0xFF00; } return ExtBits >> 8; } /* * these are some more hardware specific helpers, formerly in vga.c */ static void vgaHWGetHWRecPrivate(void) { if (vgaHWPrivateIndex < 0) vgaHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); return; } static void vgaHWFreeRegs(vgaRegPtr regp) { free(regp->CRTC); regp->CRTC = regp->Sequencer = regp->Graphics = regp->Attribute = NULL; regp->numCRTC = regp->numSequencer = regp->numGraphics = regp->numAttribute = 0; } static Bool vgaHWAllocRegs(vgaRegPtr regp) { unsigned char *buf; if ((regp->numCRTC + regp->numSequencer + regp->numGraphics + regp->numAttribute) == 0) return FALSE; buf = calloc(regp->numCRTC + regp->numSequencer + regp->numGraphics + regp->numAttribute, 1); if (!buf) return FALSE; regp->CRTC = buf; regp->Sequencer = regp->CRTC + regp->numCRTC; regp->Graphics = regp->Sequencer + regp->numSequencer; regp->Attribute = regp->Graphics + regp->numGraphics; return TRUE; } Bool vgaHWAllocDefaultRegs(vgaRegPtr regp) { regp->numCRTC = VGA_NUM_CRTC; regp->numSequencer = VGA_NUM_SEQ; regp->numGraphics = VGA_NUM_GFX; regp->numAttribute = VGA_NUM_ATTR; return vgaHWAllocRegs(regp); } Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer, int numGraphics, int numAttribute) { #define VGAHWMINNUM(regtype) \ ((newMode.num##regtype < regp->num##regtype) ? \ (newMode.num##regtype) : (regp->num##regtype)) #define VGAHWCOPYREGSET(regtype) \ memcpy (newMode.regtype, regp->regtype, VGAHWMINNUM(regtype)) vgaRegRec newMode, newSaved; vgaRegPtr regp; regp = &VGAHWPTR(scrp)->ModeReg; memcpy(&newMode, regp, sizeof(vgaRegRec)); /* allocate space for new registers */ regp = &newMode; regp->numCRTC = numCRTC; regp->numSequencer = numSequencer; regp->numGraphics = numGraphics; regp->numAttribute = numAttribute; if (!vgaHWAllocRegs(regp)) return FALSE; regp = &VGAHWPTR(scrp)->SavedReg; memcpy(&newSaved, regp, sizeof(vgaRegRec)); regp = &newSaved; regp->numCRTC = numCRTC; regp->numSequencer = numSequencer; regp->numGraphics = numGraphics; regp->numAttribute = numAttribute; if (!vgaHWAllocRegs(regp)) { vgaHWFreeRegs(&newMode); return FALSE; } /* allocations succeeded, copy register data into new space */ regp = &VGAHWPTR(scrp)->ModeReg; VGAHWCOPYREGSET(CRTC); VGAHWCOPYREGSET(Sequencer); VGAHWCOPYREGSET(Graphics); VGAHWCOPYREGSET(Attribute); regp = &VGAHWPTR(scrp)->SavedReg; VGAHWCOPYREGSET(CRTC); VGAHWCOPYREGSET(Sequencer); VGAHWCOPYREGSET(Graphics); VGAHWCOPYREGSET(Attribute); /* free old register arrays */ regp = &VGAHWPTR(scrp)->ModeReg; vgaHWFreeRegs(regp); memcpy(regp, &newMode, sizeof(vgaRegRec)); regp = &VGAHWPTR(scrp)->SavedReg; vgaHWFreeRegs(regp); memcpy(regp, &newSaved, sizeof(vgaRegRec)); return TRUE; #undef VGAHWMINNUM #undef VGAHWCOPYREGSET } Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src) { vgaHWFreeRegs(dst); memcpy(dst, src, sizeof(vgaRegRec)); if (!vgaHWAllocRegs(dst)) return FALSE; memcpy(dst->CRTC, src->CRTC, src->numCRTC); memcpy(dst->Sequencer, src->Sequencer, src->numSequencer); memcpy(dst->Graphics, src->Graphics, src->numGraphics); memcpy(dst->Attribute, src->Attribute, src->numAttribute); return TRUE; } Bool vgaHWGetHWRec(ScrnInfoPtr scrp) { vgaRegPtr regp; vgaHWPtr hwp; int i; /* * Let's make sure that the private exists and allocate one. */ vgaHWGetHWRecPrivate(); /* * New privates are always set to NULL, so we can check if the allocation * has already been done. */ if (VGAHWPTR(scrp)) return TRUE; hwp = VGAHWPTRLVAL(scrp) = xnfcalloc(sizeof(vgaHWRec), 1); regp = &VGAHWPTR(scrp)->ModeReg; if ((!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->SavedReg)) || (!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->ModeReg))) { free(hwp); return FALSE; } if (scrp->bitsPerPixel == 1) { rgb blackColour = scrp->display->blackColour, whiteColour = scrp->display->whiteColour; if (blackColour.red > 0x3F) blackColour.red = 0x3F; if (blackColour.green > 0x3F) blackColour.green = 0x3F; if (blackColour.blue > 0x3F) blackColour.blue = 0x3F; if (whiteColour.red > 0x3F) whiteColour.red = 0x3F; if (whiteColour.green > 0x3F) whiteColour.green = 0x3F; if (whiteColour.blue > 0x3F) whiteColour.blue = 0x3F; if ((blackColour.red == whiteColour.red) && (blackColour.green == whiteColour.green) && (blackColour.blue == whiteColour.blue)) { blackColour.red ^= 0x3F; blackColour.green ^= 0x3F; blackColour.blue ^= 0x3F; } /* * initialize default colormap for monochrome */ for (i = 0; i < 3; i++) regp->DAC[i] = 0x00; for (i = 3; i < 768; i++) regp->DAC[i] = 0x3F; i = BLACK_VALUE * 3; regp->DAC[i++] = blackColour.red; regp->DAC[i++] = blackColour.green; regp->DAC[i] = blackColour.blue; i = WHITE_VALUE * 3; regp->DAC[i++] = whiteColour.red; regp->DAC[i++] = whiteColour.green; regp->DAC[i] = whiteColour.blue; i = OVERSCAN_VALUE * 3; regp->DAC[i++] = 0x00; regp->DAC[i++] = 0x00; regp->DAC[i] = 0x00; } else { /* Set all colours to black */ for (i = 0; i < 768; i++) regp->DAC[i] = 0x00; /* ... and the overscan */ if (scrp->depth >= 4) regp->Attribute[OVERSCAN] = 0xFF; } if (xf86FindOption(scrp->confScreen->options, "ShowOverscan")) { xf86MarkOptionUsedByName(scrp->confScreen->options, "ShowOverscan"); xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "Showing overscan area\n"); regp->DAC[765] = 0x3F; regp->DAC[766] = 0x00; regp->DAC[767] = 0x3F; regp->Attribute[OVERSCAN] = 0xFF; hwp->ShowOverscan = TRUE; } else hwp->ShowOverscan = FALSE; hwp->paletteEnabled = FALSE; hwp->cmapSaved = FALSE; hwp->MapSize = 0; hwp->pScrn = scrp; hwp->dev = xf86GetPciInfoForEntity(scrp->entityList[0]); return TRUE; } void vgaHWFreeHWRec(ScrnInfoPtr scrp) { if (vgaHWPrivateIndex >= 0) { vgaHWPtr hwp = VGAHWPTR(scrp); if (!hwp) return; pci_device_close_io(hwp->dev, hwp->io); free(hwp->FontInfo1); free(hwp->FontInfo2); free(hwp->TextInfo); vgaHWFreeRegs(&hwp->ModeReg); vgaHWFreeRegs(&hwp->SavedReg); free(hwp); VGAHWPTRLVAL(scrp) = NULL; } } Bool vgaHWMapMem(ScrnInfoPtr scrp) { vgaHWPtr hwp = VGAHWPTR(scrp); if (hwp->Base) return TRUE; /* If not set, initialise with the defaults */ if (hwp->MapSize == 0) hwp->MapSize = VGA_DEFAULT_MEM_SIZE; if (hwp->MapPhys == 0) hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR; /* * Map as VIDMEM_MMIO_32BIT because WC * is bad when there is page flipping. * XXX This is not correct but we do it * for now. */ DebugF("Mapping VGAMem\n"); pci_device_map_legacy(hwp->dev, hwp->MapPhys, hwp->MapSize, PCI_DEV_MAP_FLAG_WRITABLE, &hwp->Base); return hwp->Base != NULL; } void vgaHWUnmapMem(ScrnInfoPtr scrp) { vgaHWPtr hwp = VGAHWPTR(scrp); if (hwp->Base == NULL) return; DebugF("Unmapping VGAMem\n"); pci_device_unmap_legacy(hwp->dev, hwp->Base, hwp->MapSize); hwp->Base = NULL; } int vgaHWGetIndex(void) { return vgaHWPrivateIndex; } void vgaHWGetIOBase(vgaHWPtr hwp) { hwp->IOBase = (hwp->readMiscOut(hwp) & 0x01) ? VGA_IOBASE_COLOR : VGA_IOBASE_MONO; xf86DrvMsgVerb(hwp->pScrn->scrnIndex, X_INFO, 3, "vgaHWGetIOBase: hwp->IOBase is 0x%04x\n", hwp->IOBase); } void vgaHWLock(vgaHWPtr hwp) { /* Protect CRTC[0-7] */ hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) | 0x80); } void vgaHWUnlock(vgaHWPtr hwp) { /* Unprotect CRTC[0-7] */ hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) & ~0x80); } void vgaHWEnable(vgaHWPtr hwp) { hwp->writeEnable(hwp, hwp->readEnable(hwp) | 0x01); } void vgaHWDisable(vgaHWPtr hwp) { hwp->writeEnable(hwp, hwp->readEnable(hwp) & ~0x01); } static void vgaHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual) { vgaHWPtr hwp = VGAHWPTR(pScrn); int i, index; for (i = 0; i < numColors; i++) { index = indices[i]; hwp->writeDacWriteAddr(hwp, index); DACDelay(hwp); hwp->writeDacData(hwp, colors[index].red); DACDelay(hwp); hwp->writeDacData(hwp, colors[index].green); DACDelay(hwp); hwp->writeDacData(hwp, colors[index].blue); DACDelay(hwp); } /* This shouldn't be necessary, but we'll play safe. */ hwp->disablePalette(hwp); } static void vgaHWSetOverscan(ScrnInfoPtr pScrn, int overscan) { vgaHWPtr hwp = VGAHWPTR(pScrn); if (overscan < 0 || overscan > 255) return; hwp->enablePalette(hwp); hwp->writeAttr(hwp, OVERSCAN, overscan); #ifdef DEBUGOVERSCAN { int ov = hwp->readAttr(hwp, OVERSCAN); int red, green, blue; hwp->writeDacReadAddr(hwp, ov); red = hwp->readDacData(hwp); green = hwp->readDacData(hwp); blue = hwp->readDacData(hwp); ErrorF("Overscan index is 0x%02x, colours are #%02x%02x%02x\n", ov, red, green, blue); } #endif hwp->disablePalette(hwp); } Bool vgaHWHandleColormaps(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->depth > 1 && pScrn->depth <= 8) { return xf86HandleColormaps(pScreen, 1 << pScrn->depth, pScrn->rgbBits, vgaHWLoadPalette, pScrn->depth > 4 ? vgaHWSetOverscan : NULL, CMAP_RELOAD_ON_MODE_SWITCH); } return TRUE; } /* ----------------------- DDC support ------------------------*/ /* * Adjust v_active, v_blank, v_sync, v_sync_end, v_blank_end, v_total * to read out EDID at a faster rate. Allowed maximum is 25kHz with * 20 usec v_sync active. Set positive v_sync polarity, turn off lightpen * readback, enable access to cr00-cr07. */ /* vertical timings */ #define DISPLAY_END 0x04 #define BLANK_START DISPLAY_END #define SYNC_START BLANK_START #define SYNC_END 0x09 #define BLANK_END SYNC_END #define V_TOTAL BLANK_END /* this function doesn't have to be reentrant for our purposes */ struct _vgaDdcSave { unsigned char cr03; unsigned char cr06; unsigned char cr07; unsigned char cr09; unsigned char cr10; unsigned char cr11; unsigned char cr12; unsigned char cr15; unsigned char cr16; unsigned char msr; }; void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed) { vgaHWPtr hwp = VGAHWPTR(pScrn); unsigned char tmp; struct _vgaDdcSave *save; switch (speed) { case DDC_FAST: if (hwp->ddc != NULL) break; hwp->ddc = xnfcalloc(sizeof(struct _vgaDdcSave), 1); save = (struct _vgaDdcSave *) hwp->ddc; /* Lightpen register disable - allow access to cr10 & 11; just in case */ save->cr03 = hwp->readCrtc(hwp, 0x03); hwp->writeCrtc(hwp, 0x03, (save->cr03 | 0x80)); save->cr12 = hwp->readCrtc(hwp, 0x12); hwp->writeCrtc(hwp, 0x12, DISPLAY_END); save->cr15 = hwp->readCrtc(hwp, 0x15); hwp->writeCrtc(hwp, 0x15, BLANK_START); save->cr10 = hwp->readCrtc(hwp, 0x10); hwp->writeCrtc(hwp, 0x10, SYNC_START); save->cr11 = hwp->readCrtc(hwp, 0x11); /* unprotect group 1 registers; just in case ... */ hwp->writeCrtc(hwp, 0x11, ((save->cr11 & 0x70) | SYNC_END)); save->cr16 = hwp->readCrtc(hwp, 0x16); hwp->writeCrtc(hwp, 0x16, BLANK_END); save->cr06 = hwp->readCrtc(hwp, 0x06); hwp->writeCrtc(hwp, 0x06, V_TOTAL); /* all values have less than 8 bit - mask out 9th and 10th bits */ save->cr09 = hwp->readCrtc(hwp, 0x09); hwp->writeCrtc(hwp, 0x09, (save->cr09 & 0xDF)); save->cr07 = hwp->readCrtc(hwp, 0x07); hwp->writeCrtc(hwp, 0x07, (save->cr07 & 0x10)); /* vsync polarity negativ & ensure a 25MHz clock */ save->msr = hwp->readMiscOut(hwp); hwp->writeMiscOut(hwp, ((save->msr & 0xF3) | 0x80)); break; case DDC_SLOW: if (hwp->ddc == NULL) break; save = (struct _vgaDdcSave *) hwp->ddc; hwp->writeMiscOut(hwp, save->msr); hwp->writeCrtc(hwp, 0x07, save->cr07); tmp = hwp->readCrtc(hwp, 0x09); hwp->writeCrtc(hwp, 0x09, ((save->cr09 & 0x20) | (tmp & 0xDF))); hwp->writeCrtc(hwp, 0x06, save->cr06); hwp->writeCrtc(hwp, 0x16, save->cr16); hwp->writeCrtc(hwp, 0x11, save->cr11); hwp->writeCrtc(hwp, 0x10, save->cr10); hwp->writeCrtc(hwp, 0x15, save->cr15); hwp->writeCrtc(hwp, 0x12, save->cr12); hwp->writeCrtc(hwp, 0x03, save->cr03); free(save); hwp->ddc = NULL; break; default: break; } } DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void) { return vgaHWddc1SetSpeed; } SaveScreenProcPtr vgaHWSaveScreenWeak(void) { return vgaHWSaveScreen; } /* * 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), unsigned long vertsyncreg, int maskval, int knownclkindex, int knownclkvalue) { register int status = vertsyncreg; unsigned long i, cnt, rcnt, sync; vgaHWPtr hwp = VGAHWPTR(pScrn); /* 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 ((pci_io_read8(hwp->io, status) & maskval) == 0x00) if (sync-- == 0) goto finish; /* Something appears to be happening, so reset sync count */ sync = 200000; while ((pci_io_read8(hwp->io, status) & maskval) == maskval) if (sync-- == 0) goto finish; /* Something appears to be happening, so reset sync count */ sync = 200000; while ((pci_io_read8(hwp->io, status) & maskval) == 0x00) if (sync-- == 0) goto finish; for (rcnt = 0; rcnt < 5; rcnt++) { while (!(pci_io_read8(hwp->io, status) & maskval)) cnt++; while ((pci_io_read8(hwp->io, 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); } xorg-server-1.20.8/hw/xfree86/vgahw/vgaHW.h0000644000175000017500000002237213640201473015222 00000000000000 /* * Copyright (c) 1997,1998 The XFree86 Project, Inc. * * Loosely based on code bearing the following copyright: * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * Author: Dirk Hohndel */ #ifndef _VGAHW_H #define _VGAHW_H #include #include "misc.h" #include "input.h" #include "scrnintstr.h" #include "colormapst.h" #include "xf86str.h" #include "xf86Pci.h" #include "xf86DDC.h" #include "globals.h" #include extern _X_EXPORT int vgaHWGetIndex(void); /* * access macro */ #define VGAHWPTR(p) ((vgaHWPtr)((p)->privates[vgaHWGetIndex()].ptr)) /* Standard VGA registers */ #define VGA_ATTR_INDEX 0x3C0 #define VGA_ATTR_DATA_W 0x3C0 #define VGA_ATTR_DATA_R 0x3C1 #define VGA_IN_STAT_0 0x3C2 /* read */ #define VGA_MISC_OUT_W 0x3C2 /* write */ #define VGA_ENABLE 0x3C3 #define VGA_SEQ_INDEX 0x3C4 #define VGA_SEQ_DATA 0x3C5 #define VGA_DAC_MASK 0x3C6 #define VGA_DAC_READ_ADDR 0x3C7 #define VGA_DAC_WRITE_ADDR 0x3C8 #define VGA_DAC_DATA 0x3C9 #define VGA_FEATURE_R 0x3CA /* read */ #define VGA_MISC_OUT_R 0x3CC /* read */ #define VGA_GRAPH_INDEX 0x3CE #define VGA_GRAPH_DATA 0x3CF #define VGA_IOBASE_MONO 0x3B0 #define VGA_IOBASE_COLOR 0x3D0 #define VGA_CRTC_INDEX_OFFSET 0x04 #define VGA_CRTC_DATA_OFFSET 0x05 #define VGA_IN_STAT_1_OFFSET 0x0A /* read */ #define VGA_FEATURE_W_OFFSET 0x0A /* write */ /* default number of VGA registers stored internally */ #define VGA_NUM_CRTC 25 #define VGA_NUM_SEQ 5 #define VGA_NUM_GFX 9 #define VGA_NUM_ATTR 21 /* Flags for vgaHWSave() and vgaHWRestore() */ #define VGA_SR_MODE 0x01 #define VGA_SR_FONTS 0x02 #define VGA_SR_CMAP 0x04 #define VGA_SR_ALL (VGA_SR_MODE | VGA_SR_FONTS | VGA_SR_CMAP) /* Defaults for the VGA memory window */ #define VGA_DEFAULT_PHYS_ADDR 0xA0000 #define VGA_DEFAULT_MEM_SIZE (64 * 1024) /* * vgaRegRec contains settings of standard VGA registers. */ typedef struct { unsigned char MiscOutReg; /* */ unsigned char *CRTC; /* Crtc Controller */ unsigned char *Sequencer; /* Video Sequencer */ unsigned char *Graphics; /* Video Graphics */ unsigned char *Attribute; /* Video Atribute */ unsigned char DAC[768]; /* Internal Colorlookuptable */ unsigned char numCRTC; /* number of CRTC registers, def=VGA_NUM_CRTC */ unsigned char numSequencer; /* number of seq registers, def=VGA_NUM_SEQ */ unsigned char numGraphics; /* number of gfx registers, def=VGA_NUM_GFX */ unsigned char numAttribute; /* number of attr registers, def=VGA_NUM_ATTR */ } vgaRegRec, *vgaRegPtr; typedef struct _vgaHWRec *vgaHWPtr; typedef void (*vgaHWWriteIndexProcPtr) (vgaHWPtr hwp, CARD8 indx, CARD8 value); typedef CARD8 (*vgaHWReadIndexProcPtr) (vgaHWPtr hwp, CARD8 indx); typedef void (*vgaHWWriteProcPtr) (vgaHWPtr hwp, CARD8 value); typedef CARD8 (*vgaHWReadProcPtr) (vgaHWPtr hwp); typedef void (*vgaHWMiscProcPtr) (vgaHWPtr hwp); /* * vgaHWRec contains per-screen information required by the vgahw module. * * Note, the palette referred to by the paletteEnabled, enablePalette and * disablePalette is the 16-entry (+overscan) EGA-compatible palette accessed * via the first 17 attribute registers and not the main 8-bit palette. */ typedef struct _vgaHWRec { void *Base; /* Address of "VGA" memory */ int MapSize; /* Size of "VGA" memory */ unsigned long MapPhys; /* phys location of VGA mem */ int IOBase; /* I/O Base address */ CARD8 *MMIOBase; /* Pointer to MMIO start */ int MMIOOffset; /* base + offset + vgareg = mmioreg */ void *FontInfo1; /* save area for fonts in plane 2 */ void *FontInfo2; /* save area for fonts in plane 3 */ void *TextInfo; /* save area for text */ vgaRegRec SavedReg; /* saved registers */ vgaRegRec ModeReg; /* register settings for current mode */ Bool ShowOverscan; Bool paletteEnabled; Bool cmapSaved; ScrnInfoPtr pScrn; vgaHWWriteIndexProcPtr writeCrtc; vgaHWReadIndexProcPtr readCrtc; vgaHWWriteIndexProcPtr writeGr; vgaHWReadIndexProcPtr readGr; vgaHWReadProcPtr readST00; vgaHWReadProcPtr readST01; vgaHWReadProcPtr readFCR; vgaHWWriteProcPtr writeFCR; vgaHWWriteIndexProcPtr writeAttr; vgaHWReadIndexProcPtr readAttr; vgaHWWriteIndexProcPtr writeSeq; vgaHWReadIndexProcPtr readSeq; vgaHWWriteProcPtr writeMiscOut; vgaHWReadProcPtr readMiscOut; vgaHWMiscProcPtr enablePalette; vgaHWMiscProcPtr disablePalette; vgaHWWriteProcPtr writeDacMask; vgaHWReadProcPtr readDacMask; vgaHWWriteProcPtr writeDacWriteAddr; vgaHWWriteProcPtr writeDacReadAddr; vgaHWWriteProcPtr writeDacData; vgaHWReadProcPtr readDacData; void *ddc; struct pci_io_handle *io; vgaHWReadProcPtr readEnable; vgaHWWriteProcPtr writeEnable; struct pci_device *dev; } vgaHWRec; /* Some macros that VGA drivers can use in their ChipProbe() function */ #define OVERSCAN 0x11 /* Index of OverScan register */ /* Flags that define how overscan correction should take place */ #define KGA_FIX_OVERSCAN 1 /* overcan correction required */ #define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */ /* of next scanline/frame */ #define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */ /* to total - 1 */ #define BIT_PLANE 3 /* Which plane we write to in mono mode */ #define BITS_PER_GUN 6 #define COLORMAP_SIZE 256 #define DACDelay(hw) \ do { \ (hw)->readST01((hw)); \ (hw)->readST01((hw)); \ } while (0) /* Function Prototypes */ /* vgaHW.c */ typedef void vgaHWProtectProc(ScrnInfoPtr, Bool); typedef void vgaHWBlankScreenProc(ScrnInfoPtr, Bool); extern _X_EXPORT void vgaHWSetStdFuncs(vgaHWPtr hwp); extern _X_EXPORT void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset); extern _X_EXPORT void vgaHWProtect(ScrnInfoPtr pScrn, Bool on); extern _X_EXPORT vgaHWProtectProc *vgaHWProtectWeak(void); extern _X_EXPORT Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode); extern _X_EXPORT void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on); extern _X_EXPORT vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void); extern _X_EXPORT void vgaHWSeqReset(vgaHWPtr hwp, Bool start); extern _X_EXPORT void vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore); extern _X_EXPORT void vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore); extern _X_EXPORT void vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore); extern _X_EXPORT void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags); extern _X_EXPORT void vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save); extern _X_EXPORT void vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save); extern _X_EXPORT void vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save); extern _X_EXPORT void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags); extern _X_EXPORT Bool vgaHWInit(ScrnInfoPtr scrnp, DisplayModePtr mode); extern _X_EXPORT Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer, int numGraphics, int numAttribute); extern _X_EXPORT Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src); extern _X_EXPORT Bool vgaHWGetHWRec(ScrnInfoPtr scrp); extern _X_EXPORT void vgaHWFreeHWRec(ScrnInfoPtr scrp); extern _X_EXPORT Bool vgaHWMapMem(ScrnInfoPtr scrp); extern _X_EXPORT void vgaHWUnmapMem(ScrnInfoPtr scrp); extern _X_EXPORT void vgaHWGetIOBase(vgaHWPtr hwp); extern _X_EXPORT void vgaHWLock(vgaHWPtr hwp); extern _X_EXPORT void vgaHWUnlock(vgaHWPtr hwp); extern _X_EXPORT void vgaHWEnable(vgaHWPtr hwp); extern _X_EXPORT void vgaHWDisable(vgaHWPtr hwp); extern _X_EXPORT void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); extern _X_EXPORT Bool vgaHWHandleColormaps(ScreenPtr pScreen); extern _X_EXPORT void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed); extern _X_EXPORT CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, unsigned int Flags); extern _X_EXPORT CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, unsigned int Flags); extern _X_EXPORT Bool vgaHWAllocDefaultRegs(vgaRegPtr regp); extern _X_EXPORT DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void); extern _X_EXPORT SaveScreenProcPtr vgaHWSaveScreenWeak(void); extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc) (ScrnInfoPtr, int), void (*ProtectRegs) (ScrnInfoPtr, Bool), void (*BlankScreen) (ScrnInfoPtr, Bool), unsigned long vertsyncreg, int maskval, int knownclkindex, int knownclkvalue); #endif /* _VGAHW_H */ xorg-server-1.20.8/hw/xfree86/vgahw/Makefile.in0000644000175000017500000007327713640201514016110 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/vgahw ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) am__DEPENDENCIES_1 = libvgahw_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libvgahw_la_OBJECTS = vgaHW.lo vgaHWmodule.lo libvgahw_la_OBJECTS = $(am_libvgahw_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libvgahw_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libvgahw_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/vgaHW.Plo \ ./$(DEPDIR)/vgaHWmodule.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libvgahw_la_SOURCES) DIST_SOURCES = $(libvgahw_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libvgahw.la libvgahw_la_LDFLAGS = -avoid-version libvgahw_la_LIBADD = $(PCIACCESS_LIBS) libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = vgaHW.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/vgahw/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/vgahw/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libvgahw.la: $(libvgahw_la_OBJECTS) $(libvgahw_la_DEPENDENCIES) $(EXTRA_libvgahw_la_DEPENDENCIES) $(AM_V_CCLD)$(libvgahw_la_LINK) -rpath $(moduledir) $(libvgahw_la_OBJECTS) $(libvgahw_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaHW.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaHWmodule.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/vgaHW.Plo -rm -f ./$(DEPDIR)/vgaHWmodule.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/vgaHW.Plo -rm -f ./$(DEPDIR)/vgaHWmodule.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-moduleLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/vgahw/meson.build0000644000175000017500000000040113640201473016164 00000000000000shared_module('vgahw', [ 'vgaHW.c', 'vgaHWmodule.c'], include_directories: [ inc, xorg_inc ], dependencies: common_dep, c_args: xorg_c_args, install: true, install_dir: module_dir, ) install_data('vgaHW.h', install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/os-support/0000755000175000017500000000000013640201534015124 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/linux/0000755000175000017500000000000013640201534016263 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/linux/Makefile.am0000644000175000017500000000152213640201473020241 00000000000000noinst_LTLIBRARIES = liblinux.la if LNXACPI ACPI_SRCS = lnx_acpi.c if !LNXAPM ACPI_SRCS += lnx_apm.c endif XORG_CFLAGS += -DHAVE_ACPI endif if LNXAPM APM_SRCS = lnx_apm.c XORG_CFLAGS += -DHAVE_APM endif if SYSTEMD_LOGIND LOGIND_SRCS = systemd-logind.c XORG_CFLAGS += $(DBUS_CFLAGS) endif liblinux_la_SOURCES = linux.h lnx_init.c lnx_video.c \ lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/VTsw_usl.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/sigio.c \ $(ACPI_SRCS) \ $(APM_SRCS) \ $(LOGIND_SRCS) AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES) AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS) xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_init.c0000644000175000017500000002763013640201473020205 00000000000000/* * Copyright 1992 by Orest Zborowski * Copyright 1993 by David Wexelblat * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Orest Zborowski and David Wexelblat * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Orest Zborowski * and David Wexelblat make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "compiler.h" #include "linux.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include #ifdef HAVE_SYS_SYSMACROS_H #include #endif #ifndef K_OFF #define K_OFF 0x4 #endif static Bool KeepTty = FALSE; static int activeVT = -1; static char vtname[11]; static struct termios tty_attr; /* tty state to restore */ static int tty_mode; /* kbd mode to restore */ static void drain_console(int fd, void *closure) { errno = 0; if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) { xf86SetConsoleHandler(NULL, NULL); } } static int switch_to(int vt, const char *from) { int ret; SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt)); if (ret < 0) { xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); return 0; } SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt)); if (ret < 0) { xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); return 0; } return 1; } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" int linux_parse_vt_settings(int may_fail) { int i, fd = -1, ret, current_vt = -1; struct vt_stat vts; struct stat st; MessageType from = X_PROBED; /* Only do this once */ static int vt_settings_parsed = 0; if (vt_settings_parsed) return 1; /* * setup the virtual terminal manager */ if (xf86Info.vtno != -1) { from = X_CMDLINE; } else { fd = open("/dev/tty0", O_WRONLY, 0); if (fd < 0) { if (may_fail) return 0; FatalError("parse_vt_settings: Cannot open /dev/tty0 (%s)\n", strerror(errno)); } if (xf86Info.ShareVTs) { SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts)); if (ret < 0) { if (may_fail) return 0; FatalError("parse_vt_settings: Cannot find the current" " VT (%s)\n", strerror(errno)); } xf86Info.vtno = vts.v_active; } else { SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno)); if (ret < 0) { if (may_fail) return 0; FatalError("parse_vt_settings: Cannot find a free VT: " "%s\n", strerror(errno)); } if (xf86Info.vtno == -1) { if (may_fail) return 0; FatalError("parse_vt_settings: Cannot find a free VT\n"); } } close(fd); } xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); /* Some of stdin / stdout / stderr maybe redirected to a file */ for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) { ret = fstat(i, &st); if (ret == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4) { current_vt = minor(st.st_rdev); break; } } if (!KeepTty && current_vt == xf86Info.vtno) { xf86Msg(X_PROBED, "controlling tty is VT number %d, auto-enabling KeepTty\n", current_vt); KeepTty = TRUE; } vt_settings_parsed = 1; return 1; } int linux_get_keeptty(void) { return KeepTty; } void xf86OpenConsole(void) { int i, ret; struct vt_stat vts; struct vt_mode VT; const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL }; if (serverGeneration == 1) { linux_parse_vt_settings(FALSE); if (!KeepTty) { pid_t ppid = getppid(); pid_t ppgid; ppgid = getpgid(ppid); /* * change to parent process group that pgid != pid so * that setsid() doesn't fail and we become process * group leader */ if (setpgid(0, ppgid) < 0) xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n", strerror(errno)); /* become process group leader */ if ((setsid() < 0)) xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n", strerror(errno)); } i = 0; while (vcs[i] != NULL) { snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */ if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0) break; i++; } if (xf86Info.consoleFd < 0) FatalError("xf86OpenConsole: Cannot open virtual console" " %d (%s)\n", xf86Info.vtno, strerror(errno)); /* * Linux doesn't switch to an active vt after the last close of a vt, * so we do this ourselves by remembering which is active now. */ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts)); if (ret < 0) xf86Msg(X_WARNING, "xf86OpenConsole: VT_GETSTATE failed: %s\n", strerror(errno)); else activeVT = vts.v_active; if (!xf86Info.ShareVTs) { struct termios nTty; /* * now get the VT. This _must_ succeed, or else fail completely. */ if (!switch_to(xf86Info.vtno, "xf86OpenConsole")) FatalError("xf86OpenConsole: Switching VT failed\n"); SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT)); if (ret < 0) FatalError("xf86OpenConsole: VT_GETMODE failed %s\n", strerror(errno)); OsSignal(SIGUSR1, xf86VTRequest); VT.mode = VT_PROCESS; VT.relsig = SIGUSR1; VT.acqsig = SIGUSR1; SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT)); if (ret < 0) FatalError ("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n", strerror(errno)); SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS)); if (ret < 0) FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n", strerror(errno)); tcgetattr(xf86Info.consoleFd, &tty_attr); SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode)); /* disable kernel special keys and buffering */ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF)); if (ret < 0) { /* fine, just disable special keys */ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW)); if (ret < 0) FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n", strerror(errno)); /* ... and drain events, else the kernel gets angry */ xf86SetConsoleHandler(drain_console, NULL); } nTty = tty_attr; nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); nTty.c_oflag = 0; nTty.c_cflag = CREAD | CS8; nTty.c_lflag = 0; nTty.c_cc[VTIME] = 0; nTty.c_cc[VMIN] = 1; cfsetispeed(&nTty, 9600); cfsetospeed(&nTty, 9600); tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); } } else { /* serverGeneration != 1 */ if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) { /* now get the VT */ if (!switch_to(xf86Info.vtno, "xf86OpenConsole")) FatalError("xf86OpenConsole: Switching VT failed\n"); } } } #pragma GCC diagnostic pop void xf86CloseConsole(void) { struct vt_mode VT; int ret; if (xf86Info.ShareVTs) { close(xf86Info.consoleFd); return; } /* * unregister the drain_console handler * - what to do if someone else changed it in the meantime? */ xf86SetConsoleHandler(NULL, NULL); /* Back to text mode ... */ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT)); if (ret < 0) xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n", strerror(errno)); SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode)); tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr); SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT)); if (ret < 0) xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n", strerror(errno)); else { /* set dflt vt handling */ VT.mode = VT_AUTO; SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT)); if (ret < 0) xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n", strerror(errno)); } if (xf86Info.autoVTSwitch) { /* * Perform a switch back to the active VT when we were started */ if (activeVT >= 0) { switch_to(activeVT, "xf86CloseConsole"); activeVT = -1; } } close(xf86Info.consoleFd); /* make the vt-manager happy */ } #define CHECK_FOR_REQUIRED_ARGUMENT() \ if (((i + 1) >= argc) || (!argv[i + 1])) { \ ErrorF("Required argument to %s not specified\n", argv[i]); \ UseMsg(); \ FatalError("Required argument to %s not specified\n", argv[i]); \ } 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 ((argv[i][0] == 'v') && (argv[i][1] == 't')) { if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0) { UseMsg(); xf86Info.vtno = -1; return 0; } return 1; } if (!strcmp(argv[i], "-masterfd")) { CHECK_FOR_REQUIRED_ARGUMENT(); if (xf86PrivsElevated()) FatalError("\nCannot specify -masterfd when server is setuid/setgid\n"); if (sscanf(argv[++i], "%d", &xf86DRMMasterFd) != 1) { UseMsg(); xf86DRMMasterFd = -1; return 0; } return 2; } return 0; } void xf86UseMsg(void) { ErrorF("vtXX use the specified VT number\n"); ErrorF("-keeptty "); ErrorF("don't detach controlling tty (for debugging only)\n"); ErrorF("-masterfd use the specified fd as the DRM master fd (not if setuid/gid)\n"); } void xf86OSInputThreadInit(void) { return; } xorg-server-1.20.8/hw/xfree86/os-support/linux/linux.h0000644000175000017500000000245613640201473017524 00000000000000/* * Copyright © 2015 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. * * Author: Hans de Goede */ #ifndef XF86_LINUX_H #define XF86_LINUX_H int linux_parse_vt_settings(int may_fail); int linux_get_keeptty(void); #endif xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_acpi.c0000644000175000017500000001041413640201473020146 00000000000000#ifdef HAVE_XORG_CONFIG_H #include "xorg-config.h" #endif #include "os.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #include #include #include #include #include #include #include #define ACPI_SOCKET "/var/run/acpid.socket" #define ACPI_VIDEO_NOTIFY_SWITCH 0x80 #define ACPI_VIDEO_NOTIFY_PROBE 0x81 #define ACPI_VIDEO_NOTIFY_CYCLE 0x82 #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85 #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86 #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) #define ACPI_VIDEO_HEAD_END (~0u) static void lnxCloseACPI(void); static void *ACPIihPtr = NULL; PMClose lnxACPIOpen(void); /* in milliseconds */ #define ACPI_REOPEN_DELAY 1000 static CARD32 lnxACPIReopen(OsTimerPtr timer, CARD32 time, void *arg) { if (lnxACPIOpen()) { TimerFree(timer); return 0; } return ACPI_REOPEN_DELAY; } #define LINE_LENGTH 80 static int lnxACPIGetEventFromOs(int fd, pmEvent * events, int num) { char ev[LINE_LENGTH]; int n; memset(ev, 0, LINE_LENGTH); do { n = read(fd, ev, LINE_LENGTH); } while ((n == -1) && (errno == EAGAIN || errno == EINTR)); if (n <= 0) { lnxCloseACPI(); TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL); return 0; } /* FIXME: this only processes the first read ACPI event & might break * with interrupted reads. */ /* Check that we have a video event */ if (!strncmp(ev, "video", 5)) { char *GFX = NULL; char *notify = NULL; char *data = NULL; /* doesn't appear to be used in the kernel */ unsigned long int notify_l; strtok(ev, " "); if (!(GFX = strtok(NULL, " "))) return 0; #if 0 ErrorF("GFX: %s\n", GFX); #endif if (!(notify = strtok(NULL, " "))) return 0; notify_l = strtoul(notify, NULL, 16); #if 0 ErrorF("notify: 0x%lx\n", notify_l); #endif if (!(data = strtok(NULL, " "))) return 0; #if 0 data_l = strtoul(data, NULL, 16); ErrorF("data: 0x%lx\n", data_l); #endif /* Differentiate between events */ switch (notify_l) { case ACPI_VIDEO_NOTIFY_SWITCH: case ACPI_VIDEO_NOTIFY_CYCLE: case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: events[0] = XF86_APM_CAPABILITY_CHANGED; return 1; case ACPI_VIDEO_NOTIFY_PROBE: return 0; default: return 0; } } return 0; } static pmWait lnxACPIConfirmEventToOs(int fd, pmEvent event) { /* No ability to send back to the kernel in ACPI */ switch (event) { default: return PM_NONE; } } PMClose lnxACPIOpen(void) { int fd; struct sockaddr_un addr; int r = -1; static int warned = 0; DebugF("ACPI: OSPMOpen called\n"); if (ACPIihPtr || !xf86Info.pmFlag) return NULL; DebugF("ACPI: Opening device\n"); if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) { memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, ACPI_SOCKET); if ((r = connect(fd, (struct sockaddr *) &addr, sizeof(addr))) == -1) { if (!warned) xf86MsgVerb(X_WARNING, 3, "Open ACPI failed (%s) (%s)\n", ACPI_SOCKET, strerror(errno)); warned = 1; shutdown(fd, 2); close(fd); return NULL; } } xf86PMGetEventFromOs = lnxACPIGetEventFromOs; xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs; ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL); xf86MsgVerb(X_INFO, 3, "Open ACPI successful (%s)\n", ACPI_SOCKET); warned = 0; return lnxCloseACPI; } static void lnxCloseACPI(void) { int fd; DebugF("ACPI: Closing device\n"); if (ACPIihPtr) { fd = xf86RemoveGeneralHandler(ACPIihPtr); shutdown(fd, 2); close(fd); ACPIihPtr = NULL; } } xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_kmod.c0000644000175000017500000000566613640201473020201 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include "xf86_OSlib.h" #include "xf86.h" #define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" #define MAX_PATH 1024 #if 0 /* XFree86 #defines execl to be the xf86execl() function which does * a fork AND exec. We don't want that. We want the regular, * standard execl(). */ #ifdef execl #undef execl #endif #endif /* * Load a Linux kernel module. * This is used by the DRI/DRM to load a DRM kernel module when * the X server starts. It could be used for other purposes in the future. * Input: * modName - name of the kernel module (Ex: "tdfx") * Return: * 0 for failure, 1 for success */ int xf86LoadKernelModule(const char *modName) { char mpPath[MAX_PATH] = ""; int fd = -1, status; pid_t pid; /* get the path to the modprobe program */ fd = open(MODPROBE_PATH_FILE, O_RDONLY); if (fd >= 0) { int count = read(fd, mpPath, MAX_PATH - 1); if (count <= 0) { mpPath[0] = 0; } else if (mpPath[count - 1] == '\n') { mpPath[count - 1] = 0; /* replaces \n with \0 */ } close(fd); /* if this worked, mpPath will be "/sbin/modprobe" or similar. */ } if (mpPath[0] == 0) { /* we failed to get the path from the system, use a default */ strcpy(mpPath, "/sbin/modprobe"); } /* now fork/exec the modprobe command */ /* * It would be good to capture stdout/stderr so that it can be directed * to the log file. modprobe errors currently are missing from the log * file. */ switch (pid = fork()) { case 0: /* child */ /* change real/effective user ID to 0/0 as we need to * preinstall agpgart module for some DRM modules */ if (setreuid(0, 0)) { xf86Msg(X_WARNING, "LoadKernelModule: " "Setting of real/effective user Id to 0/0 failed"); } setenv("PATH", "/sbin", 1); execl(mpPath, "modprobe", modName, NULL); xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno)); exit(EXIT_FAILURE); /* if we get here the child's exec failed */ break; case -1: /* fork failed */ return 0; default: /* fork worked */ { /* XXX we loop over waitpid() because it sometimes fails on * the first attempt. Don't know why! */ int count = 0, p; do { p = waitpid(pid, &status, 0); } while (p == -1 && count++ < 4); if (p == -1) { return 0; } if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { return 1; /* success! */ } else { return 0; } } } /* never get here */ return 0; } xorg-server-1.20.8/hw/xfree86/os-support/linux/int10/0000755000175000017500000000000013640201534017216 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/linux/int10/linux.c0000644000175000017500000003741713640201473020457 00000000000000/* * linux specific part of the int10 module * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2008 Egbert Eich */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Pci.h" #include "compiler.h" #define _INT10_PRIVATE #include "xf86int10.h" #ifdef __sparc__ #define DEV_MEM "/dev/fb" #else #define DEV_MEM "/dev/mem" #endif #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) #define SHMERRORPTR (void *)(-1) #include #include #include #include #include #include #include static int counter = 0; static unsigned long int10Generation = 0; static CARD8 read_b(xf86Int10InfoPtr pInt, int addr); static CARD16 read_w(xf86Int10InfoPtr pInt, int addr); static CARD32 read_l(xf86Int10InfoPtr pInt, int addr); static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val); static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val); static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val); int10MemRec linuxMem = { read_b, read_w, read_l, write_b, write_w, write_l }; typedef struct { int lowMem; int highMem; char *base; char *base_high; char *alloc; } linuxInt10Priv; #if defined DoSubModules typedef enum { INT10_NOT_LOADED, INT10_LOADED_VM86, INT10_LOADED_X86EMU, INT10_LOAD_FAILED } Int10LinuxSubModuleState; static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED; static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn); #endif /* DoSubModules */ static Bool readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len) { void *map; if (pci_device_map_legacy(dev, base, len, 0, &map)) return FALSE; memcpy(buf, map, len); pci_device_unmap_legacy(dev, man, len); return TRUE; } xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags) { xf86Int10InfoPtr pInt = NULL; int screen; int fd; static void *vidMem = NULL; static void *sysMem = NULL; void *vMem = NULL; void *options = NULL; int low_mem; int high_mem = -1; char *base = SHMERRORPTR; char *base_high = SHMERRORPTR; int pagesize; memType cs; legacyVGARec vga; Bool videoBiosMapped = FALSE; ScrnInfoPtr pScrn; if (int10Generation != serverGeneration) { counter = 0; int10Generation = serverGeneration; } pScrn = xf86FindScreenForEntity(entityIndex); screen = pScrn->scrnIndex; options = xf86HandleInt10Options(pScrn, entityIndex); if (int10skip(options)) { free(options); return NULL; } #if defined DoSubModules if (loadedSubModule == INT10_NOT_LOADED) loadedSubModule = int10LinuxLoadSubModule(pScrn); if (loadedSubModule == INT10_LOAD_FAILED) return NULL; #endif if ((!vidMem) || (!sysMem)) { if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { if (!sysMem) { DebugF("Mapping sys bios area\n"); if ((sysMem = mmap((void *) (SYS_BIOS), BIOS_SIZE, PROT_READ | PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, SYS_BIOS)) == MAP_FAILED) { xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n"); close(fd); goto error0; } } if (!vidMem) { DebugF("Mapping VRAM area\n"); if ((vidMem = mmap((void *) (V_RAM), VRAM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, V_RAM)) == MAP_FAILED) { xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n"); close(fd); goto error0; } } close(fd); } else { xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM); goto error0; } } pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec)); pInt->pScrn = pScrn; pInt->entityIndex = entityIndex; pInt->dev = xf86GetPciInfoForEntity(entityIndex); if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &linuxMem; pagesize = getpagesize(); pInt->private = (void *) xnfcalloc(1, sizeof(linuxInt10Priv)); ((linuxInt10Priv *) pInt->private)->alloc = (void *) xnfcalloc(1, ALLOC_ENTRIES(pagesize)); if (!xf86IsEntityPrimary(entityIndex)) { DebugF("Mapping high memory area\n"); if ((high_mem = shmget(counter++, HIGH_MEM_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { if (errno == ENOSYS) xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure" " your kernel to include System V IPC support\n"); else xf86DrvMsg(screen, X_ERROR, "shmget(highmem) error: %s\n", strerror(errno)); goto error1; } } else { DebugF("Mapping Video BIOS\n"); videoBiosMapped = TRUE; if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { if ((vMem = mmap((void *) (V_BIOS), SYS_BIOS - V_BIOS, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, V_BIOS)) == MAP_FAILED) { xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n"); close(fd); goto error1; } close(fd); } else goto error1; } ((linuxInt10Priv *) pInt->private)->highMem = high_mem; DebugF("Mapping 640kB area\n"); if ((low_mem = shmget(counter++, V_RAM, IPC_CREAT | SHM_R | SHM_W)) == -1) { xf86DrvMsg(screen, X_ERROR, "shmget(lowmem) error: %s\n", strerror(errno)); goto error2; } ((linuxInt10Priv *) pInt->private)->lowMem = low_mem; base = shmat(low_mem, 0, 0); if (base == SHMERRORPTR) { xf86DrvMsg(screen, X_ERROR, "shmat(low_mem) error: %s\n", strerror(errno)); goto error3; } ((linuxInt10Priv *) pInt->private)->base = base; if (high_mem > -1) { base_high = shmat(high_mem, 0, 0); if (base_high == SHMERRORPTR) { xf86DrvMsg(screen, X_ERROR, "shmat(high_mem) error: %s\n", strerror(errno)); goto error3; } ((linuxInt10Priv *) pInt->private)->base_high = base_high; } else ((linuxInt10Priv *) pInt->private)->base_high = NULL; if (!MapCurrentInt10(pInt)) goto error3; Int10Current = pInt; DebugF("Mapping int area\n"); /* note: yes, we really are writing the 0 page here */ if (!readLegacy(pInt->dev, (unsigned char *) 0, 0, LOW_PAGE_SIZE)) { xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); goto error3; } DebugF("done\n"); /* * Read in everything between V_BIOS and SYS_BIOS as some system BIOSes * have executable code there. Note that xf86ReadBIOS() can only bring in * 64K bytes at a time. */ if (!videoBiosMapped) { memset((void *) V_BIOS, 0, SYS_BIOS - V_BIOS); DebugF("Reading BIOS\n"); for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) if (!readLegacy(pInt->dev, (void *)cs, cs, V_BIOS_SIZE)) xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x%06lX.\n", (long) cs); DebugF("done\n"); } if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) { if (!xf86int10GetBiosSegment(pInt, NULL)) goto error3; set_return_trap(pInt); #ifdef _PC pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); if (!(pInt->Flags & SET_BIOS_SCRATCH)) pInt->Flags &= ~RESTORE_BIOS_SCRATCH; xf86Int10SaveRestoreBIOSVars(pInt, TRUE); #endif } else { const BusType location_type = xf86int10GetBiosLocationType(pInt); switch (location_type) { case BUS_PCI:{ int err; struct pci_device *rom_device = xf86GetPciInfoForEntity(pInt->entityIndex); pci_device_enable(rom_device); err = pci_device_read_rom(rom_device, (unsigned char *) (V_BIOS)); if (err) { xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (%s)\n", strerror(err)); goto error3; } pInt->BIOSseg = V_BIOS >> 4; break; } default: goto error3; } pInt->num = 0xe6; reset_int_vect(pInt); set_return_trap(pInt); LockLegacyVGA(pInt, &vga); xf86ExecX86int10(pInt); UnlockLegacyVGA(pInt, &vga); } #ifdef DEBUG dprint(0xc0000, 0x20); #endif free(options); return pInt; error3: if (base_high) shmdt(base_high); shmdt(base); shmdt(0); if (base_high) shmdt((char *) HIGH_MEM); shmctl(low_mem, IPC_RMID, NULL); Int10Current = NULL; error2: if (high_mem > -1) shmctl(high_mem, IPC_RMID, NULL); error1: if (vMem) munmap(vMem, SYS_BIOS - V_BIOS); free(((linuxInt10Priv *) pInt->private)->alloc); free(pInt->private); error0: free(options); free(pInt); return NULL; } Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { void *addr; int fd = -1; if (Int10Current) { shmdt(0); if (((linuxInt10Priv *) Int10Current->private)->highMem >= 0) shmdt((char *) HIGH_MEM); else munmap((void *) V_BIOS, (SYS_BIOS - V_BIOS)); } addr = shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND); if (addr == SHMERRORPTR) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "shmat(low_mem) error: %s\n", strerror(errno)); return FALSE; } if (mprotect((void *) 0, V_RAM, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot set EXEC bit on low memory: %s\n", strerror(errno)); if (((linuxInt10Priv *) pInt->private)->highMem >= 0) { addr = shmat(((linuxInt10Priv *) pInt->private)->highMem, (char *) HIGH_MEM, 0); if (addr == SHMERRORPTR) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() high memory\n"); xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "shmget error: %s\n", strerror(errno)); return FALSE; } if (mprotect((void *) HIGH_MEM, HIGH_MEM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot set EXEC bit on high memory: %s\n", strerror(errno)); } else { if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { if (mmap((void *) (V_BIOS), SYS_BIOS - V_BIOS, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, V_BIOS) == MAP_FAILED) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot map V_BIOS\n"); close(fd); return FALSE; } } else { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM); return FALSE; } close(fd); } return TRUE; } void xf86FreeInt10(xf86Int10InfoPtr pInt) { if (!pInt) return; #ifdef _PC xf86Int10SaveRestoreBIOSVars(pInt, FALSE); #endif if (Int10Current == pInt) { shmdt(0); if (((linuxInt10Priv *) pInt->private)->highMem >= 0) shmdt((char *) HIGH_MEM); else munmap((void *) V_BIOS, (SYS_BIOS - V_BIOS)); Int10Current = NULL; } if (((linuxInt10Priv *) pInt->private)->base_high) shmdt(((linuxInt10Priv *) pInt->private)->base_high); shmdt(((linuxInt10Priv *) pInt->private)->base); shmctl(((linuxInt10Priv *) pInt->private)->lowMem, IPC_RMID, NULL); if (((linuxInt10Priv *) pInt->private)->highMem >= 0) shmctl(((linuxInt10Priv *) pInt->private)->highMem, IPC_RMID, NULL); free(((linuxInt10Priv *) pInt->private)->alloc); free(pInt->private); free(pInt); } void * xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) { int pagesize = getpagesize(); int num_pages = ALLOC_ENTRIES(pagesize); int i, j; for (i = 0; i < (num_pages - num); i++) { if (((linuxInt10Priv *) pInt->private)->alloc[i] == 0) { for (j = i; j < (num + i); j++) if ((((linuxInt10Priv *) pInt->private)->alloc[j] != 0)) break; if (j == (num + i)) break; else i = i + num; } } if (i == (num_pages - num)) return NULL; for (j = i; j < (i + num); j++) ((linuxInt10Priv *) pInt->private)->alloc[j] = 1; *off = (i + 1) * pagesize; return ((linuxInt10Priv *) pInt->private)->base + ((i + 1) * pagesize); } void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) { int pagesize = getpagesize(); int first = (((unsigned long) pbase - (unsigned long) ((linuxInt10Priv *) pInt->private)->base) / pagesize) - 1; int i; for (i = first; i < (first + num); i++) ((linuxInt10Priv *) pInt->private)->alloc[i] = 0; } static CARD8 read_b(xf86Int10InfoPtr pInt, int addr) { return *((CARD8 *) (memType) addr); } static CARD16 read_w(xf86Int10InfoPtr pInt, int addr) { return *((CARD16 *) (memType) addr); } static CARD32 read_l(xf86Int10InfoPtr pInt, int addr) { return *((CARD32 *) (memType) addr); } static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) { *((CARD8 *) (memType) addr) = val; } static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) { *((CARD16 *) (memType) addr) = val; } static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) { *((CARD32 *) (memType) addr) = val; } void * xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) { if (addr < V_RAM) return ((linuxInt10Priv *) pInt->private)->base + addr; else if (addr < V_BIOS) return (void *) (memType) addr; else if (addr < SYS_BIOS) { if (((linuxInt10Priv *) pInt->private)->base_high) return (void *) (((linuxInt10Priv *) pInt->private)->base_high - V_BIOS + addr); else return (void *) (memType) addr; } else return (void *) (memType) addr; } #if defined DoSubModules static Bool vm86_tst(void) { int __res; #ifdef __PIC__ /* When compiling with -fPIC, we can't use asm constraint "b" because %ebx is already taken by gcc. */ __asm__ __volatile__("pushl %%ebx\n\t" "movl %2,%%ebx\n\t" "movl %1,%%eax\n\t" "int $0x80\n\t" "popl %%ebx":"=a"(__res) :"n"((int) 113), "r"(NULL)); #else __asm__ __volatile__("int $0x80\n\t":"=a"(__res):"a"((int) 113), "b"((struct vm86_struct *) NULL)); #endif if (__res < 0 && __res == -ENOSYS) return FALSE; return TRUE; } static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn) { if (vm86_tst()) { if (xf86LoadSubModule(pScrn, "vm86")) return INT10_LOADED_VM86; } if (xf86LoadSubModule(pScrn, "x86emu")) return INT10_LOADED_X86EMU; return INT10_LOAD_FAILED; } #endif /* DoSubModules */ xorg-server-1.20.8/hw/xfree86/os-support/linux/int10/vm86/0000755000175000017500000000000013640201534020016 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c0000644000175000017500000002124413640201473022126 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Pci.h" #include "compiler.h" #define _INT10_PRIVATE #include "xf86int10.h" #define REG pInt #ifdef _VM86_LINUX #include "int10Defines.h" static int vm86_rep(struct vm86_struct *ptr); static struct vm86_struct vm86_s; Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt) { #define VM86S ((struct vm86_struct *)pInt->cpuRegs) pInt->cpuRegs = &vm86_s; VM86S->flags = 0; VM86S->screen_bitmap = 0; VM86S->cpu_type = CPU_586; memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored)); memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored)); return TRUE; } /* get the linear address */ #define LIN_PREF_SI ((pref_seg << 4) + X86_SI) #define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX) #define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} #define DF (1 << 10) /* vm86 fault handling */ static Bool vm86_GP_fault(xf86Int10InfoPtr pInt) { unsigned char *csp, *lina; CARD32 org_eip; int pref_seg; int done, is_rep, prefix66, prefix67; csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); is_rep = 0; prefix66 = prefix67 = 0; pref_seg = -1; /* eat up prefixes */ done = 0; do { switch (MEM_RB(pInt, (int) csp++)) { case 0x66: /* operand prefix */ prefix66 = 1; break; case 0x67: /* address prefix */ prefix67 = 1; break; case 0x2e: /* CS */ pref_seg = X86_CS; break; case 0x3e: /* DS */ pref_seg = X86_DS; break; case 0x26: /* ES */ pref_seg = X86_ES; break; case 0x36: /* SS */ pref_seg = X86_SS; break; case 0x65: /* GS */ pref_seg = X86_GS; break; case 0x64: /* FS */ pref_seg = X86_FS; break; case 0xf0: /* lock */ break; case 0xf2: /* repnz */ case 0xf3: /* rep */ is_rep = 1; break; default: done = 1; } } while (!done); csp--; /* oops one too many */ org_eip = X86_EIP; X86_IP += (csp - lina); switch (MEM_RB(pInt, (int) csp)) { case 0x6c: /* insb */ /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx * but is anyone using extended regs in real mode? */ /* WARNING: no test for DI wrapping! */ X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI), X86_FLAGS & DF, is_rep ? LWECX : 1); if (is_rep) LWECX_ZERO; X86_IP++; break; case 0x6d: /* (rep) insw / insd */ /* NOTE: ES can't be overwritten */ /* WARNING: no test for _DI wrapping! */ if (prefix66) { X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), X86_EFLAGS & DF, is_rep ? LWECX : 1); } else { X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), X86_FLAGS & DF, is_rep ? LWECX : 1); } if (is_rep) LWECX_ZERO; X86_IP++; break; case 0x6e: /* (rep) outsb */ if (pref_seg < 0) pref_seg = X86_DS; /* WARNING: no test for _SI wrapping! */ X86_SI += port_rep_outb(pInt, X86_DX, (CARD32) LIN_PREF_SI, X86_FLAGS & DF, is_rep ? LWECX : 1); if (is_rep) LWECX_ZERO; X86_IP++; break; case 0x6f: /* (rep) outsw / outsd */ if (pref_seg < 0) pref_seg = X86_DS; /* WARNING: no test for _SI wrapping! */ if (prefix66) { X86_SI += port_rep_outl(pInt, X86_DX, (CARD32) LIN_PREF_SI, X86_EFLAGS & DF, is_rep ? LWECX : 1); } else { X86_SI += port_rep_outw(pInt, X86_DX, (CARD32) LIN_PREF_SI, X86_FLAGS & DF, is_rep ? LWECX : 1); } if (is_rep) LWECX_ZERO; X86_IP++; break; case 0xe5: /* inw xx, inl xx */ if (prefix66) X86_EAX = x_inl(csp[1]); else X86_AX = x_inw(csp[1]); X86_IP += 2; break; case 0xe4: /* inb xx */ X86_AL = x_inb(csp[1]); X86_IP += 2; break; case 0xed: /* inw dx, inl dx */ if (prefix66) X86_EAX = x_inl(X86_DX); else X86_AX = x_inw(X86_DX); X86_IP += 1; break; case 0xec: /* inb dx */ X86_AL = x_inb(X86_DX); X86_IP += 1; break; case 0xe7: /* outw xx */ if (prefix66) x_outl(csp[1], X86_EAX); else x_outw(csp[1], X86_AX); X86_IP += 2; break; case 0xe6: /* outb xx */ x_outb(csp[1], X86_AL); X86_IP += 2; break; case 0xef: /* outw dx */ if (prefix66) x_outl(X86_DX, X86_EAX); else x_outw(X86_DX, X86_AX); X86_IP += 1; break; case 0xee: /* outb dx */ x_outb(X86_DX, X86_AL); X86_IP += 1; break; case 0xf4: DebugF("hlt at %p\n", lina); return FALSE; case 0x0f: xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP); goto op0ferr; default: xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown reason for exception\n"); op0ferr: dump_registers(pInt); stack_trace(pInt); dump_code(pInt); xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "cannot continue\n"); return FALSE; } /* end of switch() */ return TRUE; } static int do_vm86(xf86Int10InfoPtr pInt) { int retval; retval = vm86_rep(VM86S); switch (VM86_TYPE(retval)) { case VM86_UNKNOWN: if (!vm86_GP_fault(pInt)) return 0; break; case VM86_STI: xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "vm86_sti :-((\n"); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); return 0; case VM86_INTx: pInt->num = VM86_ARG(retval); if (!int_handler(pInt)) { xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); return 0; } /* I'm not sure yet what to do if we can handle ints */ break; case VM86_SIGNAL: return 1; /* * we used to warn here and bail out - but now the sigio stuff * always fires signals at us. So we just ignore them for now. */ xf86DrvMsg(pInt->pScrn->scrnIndex, X_WARNING, "received signal\n"); return 0; default: xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", VM86_ARG(retval), VM86_TYPE(retval)); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); return 0; } return 1; } void xf86ExecX86int10(xf86Int10InfoPtr pInt) { int sig = setup_int(pInt); if (int_handler(pInt)) while (do_vm86(pInt)) { }; finish_int(pInt, sig); } static int vm86_rep(struct vm86_struct *ptr) { int __res; #ifdef __PIC__ /* When compiling with -fPIC, we can't use asm constraint "b" because %ebx is already taken by gcc. */ __asm__ __volatile__("pushl %%ebx\n\t" "push %%gs\n\t" "movl %2,%%ebx\n\t" "movl %1,%%eax\n\t" "int $0x80\n\t" "pop %%gs\n\t" "popl %%ebx":"=a"(__res) :"n"((int) 113), "r"((struct vm86_struct *) ptr)); #else __asm__ __volatile__("push %%gs\n\t" "int $0x80\n\t" "pop %%gs":"=a"(__res):"a"((int) 113), "b"((struct vm86_struct *) ptr)); #endif if (__res < 0) { errno = -__res; __res = -1; } else errno = 0; return __res; } #endif xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_video.c0000644000175000017500000001047113640201473020343 00000000000000/* * Copyright 1992 by Orest Zborowski * Copyright 1993 by David Wexelblat * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Orest Zborowski and David Wexelblat * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Orest Zborowski * and David Wexelblat make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include "input.h" #include "scrnintstr.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" static Bool ExtendedEnabled = FALSE; #ifdef __ia64__ #include "compiler.h" #include #elif !defined(__powerpc__) && \ !defined(__mc68000__) && \ !defined(__sparc__) && \ !defined(__mips__) && \ !defined(__nds32__) && \ !defined(__arm__) && \ !defined(__aarch64__) && \ !defined(__arc__) && \ !defined(__xtensa__) /* * Due to conflicts with "compiler.h", don't rely on to declare * these. */ extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on); extern int iopl(int __level); #endif /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; } /***************************************************************************/ /* I/O Permissions section */ /***************************************************************************/ #if defined(__powerpc__) volatile unsigned char *ioBase = NULL; #ifndef __NR_pciconfig_iobase #define __NR_pciconfig_iobase 200 #endif static Bool hwEnableIO(void) { int fd; unsigned int ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0); fd = open("/dev/mem", O_RDWR); if (ioBase == NULL) { ioBase = (volatile unsigned char *) mmap(0, 0x20000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, ioBase_phys); } close(fd); return ioBase != MAP_FAILED; } static void hwDisableIO(void) { munmap(ioBase, 0x20000); ioBase = NULL; } #elif defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || \ defined(__alpha__) static Bool hwEnableIO(void) { if (ioperm(0, 1024, 1) || iopl(3)) { ErrorF("xf86EnableIOPorts: failed to set IOPL for I/O (%s)\n", strerror(errno)); return FALSE; } #if !defined(__alpha__) /* XXX: this is actually not trapping anything because of iopl(3) * above */ ioperm(0x40, 4, 0); /* trap access to the timer chip */ ioperm(0x60, 4, 0); /* trap access to the keyboard controller */ #endif return TRUE; } static void hwDisableIO(void) { iopl(0); ioperm(0, 1024, 0); } #else /* non-IO architectures */ #define hwEnableIO() TRUE #define hwDisableIO() do {} while (0) #endif Bool xf86EnableIO(void) { if (ExtendedEnabled) return TRUE; ExtendedEnabled = hwEnableIO(); return ExtendedEnabled; } void xf86DisableIO(void) { if (!ExtendedEnabled) return; hwDisableIO(); ExtendedEnabled = FALSE; } xorg-server-1.20.8/hw/xfree86/os-support/linux/systemd-logind.c0000644000175000017500000005034713640201473021324 00000000000000/* * Copyright © 2013 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. * * Author: Hans de Goede */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "os.h" #include "dbus-core.h" #include "linux.h" #include "xf86.h" #include "xf86platformBus.h" #include "xf86Xinput.h" #include "globals.h" #include "systemd-logind.h" struct systemd_logind_info { DBusConnection *conn; char *session; Bool active; Bool vt_active; }; static struct systemd_logind_info logind_info; static InputInfoPtr systemd_logind_find_info_ptr_by_devnum(InputInfoPtr start, int major, int minor) { InputInfoPtr pInfo; for (pInfo = start; pInfo; pInfo = pInfo->next) if (pInfo->major == major && pInfo->minor == minor && (pInfo->flags & XI86_SERVER_FD)) return pInfo; return NULL; } static void systemd_logind_set_input_fd_for_all_devs(int major, int minor, int fd, Bool enable) { InputInfoPtr pInfo; pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); while (pInfo) { pInfo->fd = fd; pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd); if (enable) xf86EnableInputDeviceForVTSwitch(pInfo); pInfo = systemd_logind_find_info_ptr_by_devnum(pInfo->next, major, minor); } } int systemd_logind_take_fd(int _major, int _minor, const char *path, Bool *paused_ret) { struct systemd_logind_info *info = &logind_info; InputInfoPtr pInfo; DBusError error; DBusMessage *msg = NULL; DBusMessage *reply = NULL; dbus_int32_t major = _major; dbus_int32_t minor = _minor; dbus_bool_t paused; int fd = -1; if (!info->session || major == 0) return -1; /* logind does not support mouse devs (with evdev we don't need them) */ if (strstr(path, "mouse")) return -1; /* Check if we already have an InputInfo entry with this major, minor * (shared device-nodes happen ie with Wacom tablets). */ pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); if (pInfo) { LogMessage(X_INFO, "systemd-logind: returning pre-existing fd for %s %u:%u\n", path, major, minor); *paused_ret = FALSE; return pInfo->fd; } dbus_error_init(&error); msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, "org.freedesktop.login1.Session", "TakeDevice"); if (!msg) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major, DBUS_TYPE_UINT32, &minor, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n", path, error.message); goto cleanup; } if (!dbus_message_get_args(reply, &error, DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_BOOLEAN, &paused, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: TakeDevice %s: %s\n", path, error.message); goto cleanup; } *paused_ret = paused; LogMessage(X_INFO, "systemd-logind: got fd for %s %u:%u fd %d paused %d\n", path, major, minor, fd, paused); cleanup: if (msg) dbus_message_unref(msg); if (reply) dbus_message_unref(reply); dbus_error_free(&error); return fd; } void systemd_logind_release_fd(int _major, int _minor, int fd) { struct systemd_logind_info *info = &logind_info; InputInfoPtr pInfo; DBusError error; DBusMessage *msg = NULL; DBusMessage *reply = NULL; dbus_int32_t major = _major; dbus_int32_t minor = _minor; int matches = 0; if (!info->session || major == 0) goto close; /* Only release the fd if there is only 1 InputInfo left for this major * and minor, otherwise other InputInfo's are still referencing the fd. */ pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); while (pInfo) { matches++; pInfo = systemd_logind_find_info_ptr_by_devnum(pInfo->next, major, minor); } if (matches > 1) { LogMessage(X_INFO, "systemd-logind: not releasing fd for %u:%u, still in use\n", major, minor); return; } LogMessage(X_INFO, "systemd-logind: releasing fd for %u:%u\n", major, minor); dbus_error_init(&error); msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, "org.freedesktop.login1.Session", "ReleaseDevice"); if (!msg) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major, DBUS_TYPE_UINT32, &minor, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n", error.message); cleanup: if (msg) dbus_message_unref(msg); if (reply) dbus_message_unref(reply); dbus_error_free(&error); close: if (fd != -1) close(fd); } int systemd_logind_controls_session(void) { return logind_info.session ? 1 : 0; } void systemd_logind_vtenter(void) { struct systemd_logind_info *info = &logind_info; InputInfoPtr pInfo; int i; if (!info->session) return; /* Not using systemd-logind */ if (!info->active) return; /* Session not active */ if (info->vt_active) return; /* Already did vtenter */ for (i = 0; i < xf86_num_platform_devices; i++) { if (xf86_platform_devices[i].flags & XF86_PDEV_PAUSED) break; } if (i != xf86_num_platform_devices) return; /* Some drm nodes are still paused wait for resume */ xf86VTEnter(); info->vt_active = TRUE; /* Activate any input devices which were resumed before the drm nodes */ for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) if ((pInfo->flags & XI86_SERVER_FD) && pInfo->fd != -1) xf86EnableInputDeviceForVTSwitch(pInfo); /* Do delayed input probing, this must be done after the above enabling */ xf86InputEnableVTProbe(); } static void systemd_logind_ack_pause(struct systemd_logind_info *info, dbus_int32_t minor, dbus_int32_t major) { DBusError error; DBusMessage *msg = NULL; DBusMessage *reply = NULL; dbus_error_init(&error); msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, "org.freedesktop.login1.Session", "PauseDeviceComplete"); if (!msg) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major, DBUS_TYPE_UINT32, &minor, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n", error.message); cleanup: if (msg) dbus_message_unref(msg); if (reply) dbus_message_unref(reply); dbus_error_free(&error); } static DBusHandlerResult message_filter(DBusConnection * connection, DBusMessage * message, void *data) { struct systemd_logind_info *info = data; struct xf86_platform_device *pdev = NULL; InputInfoPtr pInfo = NULL; int ack = 0, pause = 0, fd = -1; DBusError error; dbus_int32_t major, minor; char *pause_str; if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; dbus_error_init(&error); if (dbus_message_is_signal(message, "org.freedesktop.DBus", "NameOwnerChanged")) { char *name, *old_owner, *new_owner; dbus_message_get_args(message, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old_owner, DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID); if (dbus_error_is_set(&error)) { LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n", error.message); dbus_error_free(&error); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } if (name && strcmp(name, "org.freedesktop.login1") == 0) FatalError("systemd-logind disappeared (stopped/restarted?)\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } if (strcmp(dbus_message_get_path(message), info->session) != 0) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; if (dbus_message_is_signal(message, "org.freedesktop.login1.Session", "PauseDevice")) { if (!dbus_message_get_args(message, &error, DBUS_TYPE_UINT32, &major, DBUS_TYPE_UINT32, &minor, DBUS_TYPE_STRING, &pause_str, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: PauseDevice: %s\n", error.message); dbus_error_free(&error); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } if (strcmp(pause_str, "pause") == 0) { pause = 1; ack = 1; } else if (strcmp(pause_str, "force") == 0) { pause = 1; } else if (strcmp(pause_str, "gone") == 0) { /* Device removal is handled through udev */ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } else { LogMessage(X_WARNING, "systemd-logind: unknown pause type: %s\n", pause_str); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } else if (dbus_message_is_signal(message, "org.freedesktop.login1.Session", "ResumeDevice")) { if (!dbus_message_get_args(message, &error, DBUS_TYPE_UINT32, &major, DBUS_TYPE_UINT32, &minor, DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: ResumeDevice: %s\n", error.message); dbus_error_free(&error); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } else return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; LogMessage(X_INFO, "systemd-logind: got %s for %u:%u\n", pause ? "pause" : "resume", major, minor); pdev = xf86_find_platform_device_by_devnum(major, minor); if (!pdev) pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); if (!pdev && !pInfo) { LogMessage(X_WARNING, "systemd-logind: could not find dev %u:%u\n", major, minor); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } if (pause) { /* Our VT_PROCESS usage guarantees we've already given up the vt */ info->active = info->vt_active = FALSE; /* Note the actual vtleave has already been handled by xf86Events.c */ if (pdev) pdev->flags |= XF86_PDEV_PAUSED; else { close(pInfo->fd); systemd_logind_set_input_fd_for_all_devs(major, minor, -1, FALSE); } if (ack) systemd_logind_ack_pause(info, major, minor); } else { /* info->vt_active gets set by systemd_logind_vtenter() */ info->active = TRUE; if (pdev) pdev->flags &= ~XF86_PDEV_PAUSED; else systemd_logind_set_input_fd_for_all_devs(major, minor, fd, info->vt_active); /* Always call vtenter(), in case there are only legacy video devs */ systemd_logind_vtenter(); } return DBUS_HANDLER_RESULT_HANDLED; } static void connect_hook(DBusConnection *connection, void *data) { struct systemd_logind_info *info = data; DBusError error; DBusMessage *msg = NULL; DBusMessage *reply = NULL; dbus_int32_t arg; char *session = NULL; dbus_error_init(&error); msg = dbus_message_new_method_call("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "GetSessionByPID"); if (!msg) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } arg = getpid(); if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &arg, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } reply = dbus_connection_send_with_reply_and_block(connection, msg, DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n", error.message); goto cleanup; } dbus_message_unref(msg); if (!dbus_message_get_args(reply, &error, DBUS_TYPE_OBJECT_PATH, &session, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: GetSessionByPID: %s\n", error.message); goto cleanup; } session = XNFstrdup(session); dbus_message_unref(reply); reply = NULL; msg = dbus_message_new_method_call("org.freedesktop.login1", session, "org.freedesktop.login1.Session", "TakeControl"); if (!msg) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } arg = FALSE; /* Don't forcibly take over over the session */ if (!dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &arg, DBUS_TYPE_INVALID)) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } reply = dbus_connection_send_with_reply_and_block(connection, msg, DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n", error.message); goto cleanup; } dbus_bus_add_match(connection, "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'", &error); if (dbus_error_is_set(&error)) { LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", error.message); goto cleanup; } dbus_bus_add_match(connection, "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.login1.Session',member='PauseDevice'", &error); if (dbus_error_is_set(&error)) { LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", error.message); goto cleanup; } dbus_bus_add_match(connection, "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.login1.Session',member='ResumeDevice'", &error); if (dbus_error_is_set(&error)) { LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", error.message); goto cleanup; } /* * HdG: This is not useful with systemd <= 208 since the signal only * contains invalidated property names there, rather than property, val * pairs as it should. Instead we just use the first resume / pause now. */ #if 0 snprintf(match, sizeof(match), "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path='%s'", session); dbus_bus_add_match(connection, match, &error); if (dbus_error_is_set(&error)) { LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", error.message); goto cleanup; } #endif if (!dbus_connection_add_filter(connection, message_filter, info, NULL)) { LogMessage(X_ERROR, "systemd-logind: could not add filter: %s\n", error.message); goto cleanup; } LogMessage(X_INFO, "systemd-logind: took control of session %s\n", session); info->conn = connection; info->session = session; info->vt_active = info->active = TRUE; /* The server owns the vt during init */ session = NULL; cleanup: free(session); if (msg) dbus_message_unref(msg); if (reply) dbus_message_unref(reply); dbus_error_free(&error); } static void systemd_logind_release_control(struct systemd_logind_info *info) { DBusError error; DBusMessage *msg = NULL; DBusMessage *reply = NULL; dbus_error_init(&error); msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, "org.freedesktop.login1.Session", "ReleaseControl"); if (!msg) { LogMessage(X_ERROR, "systemd-logind: out of memory\n"); goto cleanup; } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n", error.message); goto cleanup; } cleanup: if (msg) dbus_message_unref(msg); if (reply) dbus_message_unref(reply); dbus_error_free(&error); } static void disconnect_hook(void *data) { struct systemd_logind_info *info = data; free(info->session); info->session = NULL; info->conn = NULL; } static struct dbus_core_hook core_hook = { .connect = connect_hook, .disconnect = disconnect_hook, .data = &logind_info, }; int systemd_logind_init(void) { if (!ServerIsNotSeat0() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) { LogMessage(X_INFO, "systemd-logind: logind integration requires -keeptty and " "-keeptty was not provided, disabling logind integration\n"); return 1; } return dbus_core_add_hook(&core_hook); } void systemd_logind_fini(void) { if (logind_info.session) systemd_logind_release_control(&logind_info); dbus_core_remove_hook(&core_hook); } xorg-server-1.20.8/hw/xfree86/os-support/linux/Makefile.in0000644000175000017500000010305713640201513020253 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @LNXACPI_TRUE@@LNXAPM_FALSE@am__append_1 = lnx_apm.c @LNXACPI_TRUE@am__append_2 = -DHAVE_ACPI @LNXAPM_TRUE@am__append_3 = -DHAVE_APM @SYSTEMD_LOGIND_TRUE@am__append_4 = $(DBUS_CFLAGS) subdir = hw/xfree86/os-support/linux ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) liblinux_la_LIBADD = am__liblinux_la_SOURCES_DIST = linux.h lnx_init.c lnx_video.c \ lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/VTsw_usl.c $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/vidmem.c $(srcdir)/../shared/sigio.c \ lnx_acpi.c lnx_apm.c systemd-logind.c @LNXACPI_TRUE@@LNXAPM_FALSE@am__objects_1 = lnx_apm.lo @LNXACPI_TRUE@am__objects_2 = lnx_acpi.lo $(am__objects_1) @LNXAPM_TRUE@am__objects_3 = lnx_apm.lo @SYSTEMD_LOGIND_TRUE@am__objects_4 = systemd-logind.lo am_liblinux_la_OBJECTS = lnx_init.lo lnx_video.lo lnx_agp.lo \ lnx_kmod.lo lnx_bell.lo lnx_platform.lo VTsw_usl.lo \ posix_tty.lo vidmem.lo sigio.lo $(am__objects_2) \ $(am__objects_3) $(am__objects_4) liblinux_la_OBJECTS = $(am_liblinux_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/VTsw_usl.Plo \ ./$(DEPDIR)/lnx_acpi.Plo ./$(DEPDIR)/lnx_agp.Plo \ ./$(DEPDIR)/lnx_apm.Plo ./$(DEPDIR)/lnx_bell.Plo \ ./$(DEPDIR)/lnx_init.Plo ./$(DEPDIR)/lnx_kmod.Plo \ ./$(DEPDIR)/lnx_platform.Plo ./$(DEPDIR)/lnx_video.Plo \ ./$(DEPDIR)/posix_tty.Plo ./$(DEPDIR)/sigio.Plo \ ./$(DEPDIR)/systemd-logind.Plo ./$(DEPDIR)/vidmem.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(liblinux_la_SOURCES) DIST_SOURCES = $(am__liblinux_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_2) $(am__append_3) \ $(am__append_4) XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = liblinux.la @LNXACPI_TRUE@ACPI_SRCS = lnx_acpi.c $(am__append_1) @LNXAPM_TRUE@APM_SRCS = lnx_apm.c @SYSTEMD_LOGIND_TRUE@LOGIND_SRCS = systemd-logind.c liblinux_la_SOURCES = linux.h lnx_init.c lnx_video.c \ lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/VTsw_usl.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/sigio.c \ $(ACPI_SRCS) \ $(APM_SRCS) \ $(LOGIND_SRCS) AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES) AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/linux/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/linux/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } liblinux.la: $(liblinux_la_OBJECTS) $(liblinux_la_DEPENDENCIES) $(EXTRA_liblinux_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(liblinux_la_OBJECTS) $(liblinux_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_usl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_acpi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_agp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_apm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_bell.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_kmod.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_platform.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/systemd-logind.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< VTsw_usl.lo: $(srcdir)/../shared/VTsw_usl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_usl.lo -MD -MP -MF $(DEPDIR)/VTsw_usl.Tpo -c -o VTsw_usl.lo `test -f '$(srcdir)/../shared/VTsw_usl.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_usl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/VTsw_usl.Tpo $(DEPDIR)/VTsw_usl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/VTsw_usl.c' object='VTsw_usl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_usl.lo `test -f '$(srcdir)/../shared/VTsw_usl.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_usl.c posix_tty.lo: $(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c vidmem.lo: $(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c sigio.lo: $(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigio.lo -MD -MP -MF $(DEPDIR)/sigio.Tpo -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sigio.Tpo $(DEPDIR)/sigio.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/sigio.c' object='sigio.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/VTsw_usl.Plo -rm -f ./$(DEPDIR)/lnx_acpi.Plo -rm -f ./$(DEPDIR)/lnx_agp.Plo -rm -f ./$(DEPDIR)/lnx_apm.Plo -rm -f ./$(DEPDIR)/lnx_bell.Plo -rm -f ./$(DEPDIR)/lnx_init.Plo -rm -f ./$(DEPDIR)/lnx_kmod.Plo -rm -f ./$(DEPDIR)/lnx_platform.Plo -rm -f ./$(DEPDIR)/lnx_video.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/systemd-logind.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/VTsw_usl.Plo -rm -f ./$(DEPDIR)/lnx_acpi.Plo -rm -f ./$(DEPDIR)/lnx_agp.Plo -rm -f ./$(DEPDIR)/lnx_apm.Plo -rm -f ./$(DEPDIR)/lnx_bell.Plo -rm -f ./$(DEPDIR)/lnx_init.Plo -rm -f ./$(DEPDIR)/lnx_kmod.Plo -rm -f ./$(DEPDIR)/lnx_platform.Plo -rm -f ./$(DEPDIR)/lnx_video.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/systemd-logind.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_apm.c0000644000175000017500000001154713640201473020017 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #ifdef HAVE_ACPI extern PMClose lnxACPIOpen(void); #endif #ifdef HAVE_APM #include #include #include #include #include #include #include #define APM_PROC "/proc/apm" #define APM_DEVICE "/dev/apm_bios" #ifndef APM_STANDBY_FAILED #define APM_STANDBY_FAILED 0xf000 #endif #ifndef APM_SUSPEND_FAILED #define APM_SUSPEND_FAILED 0xf001 #endif static PMClose lnxAPMOpen(void); static void lnxCloseAPM(void); static void *APMihPtr = NULL; static struct { apm_event_t apmLinux; pmEvent xf86; } LinuxToXF86[] = { {APM_SYS_STANDBY, XF86_APM_SYS_STANDBY}, {APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND}, {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME}, {APM_LOW_BATTERY, XF86_APM_LOW_BATTERY}, {APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND}, {APM_USER_STANDBY, XF86_APM_USER_STANDBY}, {APM_USER_SUSPEND, XF86_APM_USER_SUSPEND}, {APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #if defined(APM_CAPABILITY_CHANGED) {APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED}, #endif #if 0 {APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED}, {APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED} #endif }; /* * APM is still under construction. * I'm not sure if the places where I initialize/deinitialize * apm is correct. Also I don't know what to do in SETUP state. * This depends if wakeup gets called in this situation, too. * Also we need to check if the action that is taken on an * event is reasonable. */ static int lnxPMGetEventFromOs(int fd, pmEvent * events, int num) { int i, j, n; apm_event_t linuxEvents[8]; if ((n = read(fd, linuxEvents, num * sizeof(apm_event_t))) == -1) return 0; n /= sizeof(apm_event_t); if (n > num) n = num; for (i = 0; i < n; i++) { for (j = 0; j < ARRAY_SIZE(LinuxToXF86); j++) if (LinuxToXF86[j].apmLinux == linuxEvents[i]) { events[i] = LinuxToXF86[j].xf86; break; } if (j == ARRAY_SIZE(LinuxToXF86)) events[i] = XF86_APM_UNKNOWN; } return n; } static pmWait lnxPMConfirmEventToOs(int fd, pmEvent event) { switch (event) { case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: if (ioctl(fd, APM_IOC_STANDBY, NULL)) return PM_FAILED; return PM_CONTINUE; case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: if (ioctl(fd, APM_IOC_SUSPEND, NULL)) { /* I believe this is wrong (EE) EBUSY is sent when a device refuses to be suspended. In this case we still need to undo everything we have done to suspend ourselves or we will stay in suspended state forever. */ if (errno == EBUSY) return PM_CONTINUE; else return PM_FAILED; } return PM_CONTINUE; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: case XF86_APM_STANDBY_FAILED: case XF86_APM_SUSPEND_FAILED: return PM_CONTINUE; default: return PM_NONE; } } #endif // HAVE_APM PMClose xf86OSPMOpen(void) { PMClose ret = NULL; #ifdef HAVE_ACPI /* Favour ACPI over APM, but only when enabled */ if (!xf86acpiDisableFlag) ret = lnxACPIOpen(); if (!ret) #endif #ifdef HAVE_APM ret = lnxAPMOpen(); #endif return ret; } #ifdef HAVE_APM static PMClose lnxAPMOpen(void) { int fd, pfd; DebugF("APM: OSPMOpen called\n"); if (APMihPtr || !xf86Info.pmFlag) return NULL; DebugF("APM: Opening device\n"); if ((fd = open(APM_DEVICE, O_RDWR)) > -1) { if (access(APM_PROC, R_OK) || ((pfd = open(APM_PROC, O_RDONLY)) == -1)) { xf86MsgVerb(X_WARNING, 3, "Cannot open APM (%s) (%s)\n", APM_PROC, strerror(errno)); close(fd); return NULL; } else close(pfd); xf86PMGetEventFromOs = lnxPMGetEventFromOs; xf86PMConfirmEventToOs = lnxPMConfirmEventToOs; APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL); xf86MsgVerb(X_INFO, 3, "Open APM successful\n"); return lnxCloseAPM; } return NULL; } static void lnxCloseAPM(void) { int fd; DebugF("APM: Closing device\n"); if (APMihPtr) { fd = xf86RemoveGeneralHandler(APMihPtr); close(fd); APMihPtr = NULL; } } #endif // HAVE_APM xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_agp.c0000644000175000017500000002276413640201473020014 00000000000000/* * Abstraction of the AGP GART interface. * * This version is for Linux and Free/Open/NetBSD. * * Copyright © 2000 VA Linux Systems, Inc. * Copyright © 2001 The XFree86 Project, Inc. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" #if defined(__linux__) #include #include #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include #include #endif #ifndef AGP_DEVICE #define AGP_DEVICE "/dev/agpgart" #endif /* AGP page size is independent of the host page size. */ #ifndef AGP_PAGE_SIZE #define AGP_PAGE_SIZE 4096 #endif #define AGPGART_MAJOR_VERSION 0 #define AGPGART_MINOR_VERSION 99 static int gartFd = -1; static int acquiredScreen = -1; static Bool initDone = FALSE; /* * Close /dev/agpgart. This frees all associated memory allocated during * this server generation. */ Bool xf86GARTCloseScreen(int screenNum) { if (gartFd != -1) { close(gartFd); acquiredScreen = -1; gartFd = -1; initDone = FALSE; } return TRUE; } /* * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called. */ static Bool GARTInit(int screenNum) { struct _agp_info agpinf; if (initDone) return gartFd != -1; initDone = TRUE; if (gartFd == -1) gartFd = open(AGP_DEVICE, O_RDWR, 0); else return FALSE; if (gartFd == -1) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: Unable to open " AGP_DEVICE " (%s)\n", strerror(errno)); return FALSE; } xf86AcquireGART(-1); /* Check the kernel driver version. */ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno)); close(gartFd); gartFd = -1; return FALSE; } xf86ReleaseGART(-1); #if defined(__linux__) /* Per Dave Jones, every effort will be made to keep the * agpgart interface backwards compatible, so allow all * future versions. */ if ( #if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */ agpinf.version.major < AGPGART_MAJOR_VERSION || #endif (agpinf.version.major == AGPGART_MAJOR_VERSION && agpinf.version.minor < AGPGART_MINOR_VERSION)) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: Kernel agpgart driver version is not current" " (%d.%d vs %d.%d)\n", agpinf.version.major, agpinf.version.minor, AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION); close(gartFd); gartFd = -1; return FALSE; } #endif return TRUE; } Bool xf86AgpGARTSupported(void) { return GARTInit(-1); } AgpInfoPtr xf86GetAGPInfo(int screenNum) { struct _agp_info agpinf; AgpInfoPtr info; if (!GARTInit(screenNum)) return NULL; if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); return NULL; } memset((char *) &agpinf, 0, sizeof(agpinf)); if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n", strerror(errno)); return NULL; } info->bridgeId = agpinf.bridge_id; info->agpMode = agpinf.agp_mode; info->base = agpinf.aper_base; info->size = agpinf.aper_size; info->totalPages = agpinf.pg_total; info->systemPages = agpinf.pg_system; info->usedPages = agpinf.pg_used; xf86DrvMsg(screenNum, X_INFO, "Kernel reported %zu total, %zu used\n", agpinf.pg_total, agpinf.pg_used); return info; } /* * XXX If multiple screens can acquire the GART, should we have a reference * count instead of using acquiredScreen? */ Bool xf86AcquireGART(int screenNum) { if (screenNum != -1 && !GARTInit(screenNum)) return FALSE; if (screenNum == -1 || acquiredScreen != screenNum) { if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n", strerror(errno)); return FALSE; } acquiredScreen = screenNum; } return TRUE; } Bool xf86ReleaseGART(int screenNum) { if (screenNum != -1 && !GARTInit(screenNum)) return FALSE; if (acquiredScreen == screenNum) { /* * The FreeBSD agp driver removes allocations on release. * The Linux driver doesn't. xf86ReleaseGART() is expected * to give up access to the GART, but not to remove any * allocations. */ #if !defined(__linux__) if (screenNum == -1) #endif { if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n", strerror(errno)); return FALSE; } acquiredScreen = -1; } return TRUE; } return FALSE; } int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, unsigned long *physical) { struct _agp_allocate alloc; int pages; /* * Allocates "size" bytes of GART memory (rounds up to the next * page multiple) or type "type". A handle (key) for the allocated * memory is returned. On error, the return value is -1. */ if (!GARTInit(screenNum) || acquiredScreen != screenNum) return -1; pages = (size / AGP_PAGE_SIZE); if (size % AGP_PAGE_SIZE != 0) pages++; /* XXX check for pages == 0? */ alloc.pg_count = pages; alloc.type = type; if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: " "allocation of %d pages failed\n\t(%s)\n", pages, strerror(errno)); return -1; } if (physical) *physical = alloc.physical; return alloc.key; } Bool xf86DeallocateGARTMemory(int screenNum, int key) { if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; if (acquiredScreen != screenNum) { xf86DrvMsg(screenNum, X_ERROR, "xf86UnbindGARTMemory: AGP not acquired by this screen\n"); return FALSE; } #ifdef __linux__ if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *) (uintptr_t) key) != 0) { #else if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) { #endif xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: " "deallocation gart memory with key %d failed\n\t(%s)\n", key, strerror(errno)); return FALSE; } return TRUE; } /* Bind GART memory with "key" at "offset" */ Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset) { struct _agp_bind bind; int pageOffset; if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; if (acquiredScreen != screenNum) { xf86DrvMsg(screenNum, X_ERROR, "xf86BindGARTMemory: AGP not acquired by this screen\n"); return FALSE; } if (offset % AGP_PAGE_SIZE != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " "offset (0x%lx) is not page-aligned (%d)\n", offset, AGP_PAGE_SIZE); return FALSE; } pageOffset = offset / AGP_PAGE_SIZE; xf86DrvMsgVerb(screenNum, X_INFO, 3, "xf86BindGARTMemory: bind key %d at 0x%08lx " "(pgoffset %d)\n", key, offset, pageOffset); bind.pg_start = pageOffset; bind.key = key; if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " "binding of gart memory with key %d\n" "\tat offset 0x%lx failed (%s)\n", key, offset, strerror(errno)); return FALSE; } return TRUE; } /* Unbind GART memory with "key" */ Bool xf86UnbindGARTMemory(int screenNum, int key) { struct _agp_unbind unbind; if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; if (acquiredScreen != screenNum) { xf86DrvMsg(screenNum, X_ERROR, "xf86UnbindGARTMemory: AGP not acquired by this screen\n"); return FALSE; } unbind.priority = 0; unbind.key = key; if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: " "unbinding of gart memory with key %d " "failed (%s)\n", key, strerror(errno)); return FALSE; } xf86DrvMsgVerb(screenNum, X_INFO, 3, "xf86UnbindGARTMemory: unbind key %d\n", key); return TRUE; } /* XXX Interface may change. */ Bool xf86EnableAGP(int screenNum, CARD32 mode) { agp_setup setup; if (!GARTInit(screenNum) || acquiredScreen != screenNum) return FALSE; setup.agp_mode = mode; if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: " "AGPIOC_SETUP with mode %ld failed (%s)\n", (unsigned long) mode, strerror(errno)); return FALSE; } return TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_bell.c0000644000175000017500000000316613640201473020156 00000000000000/* * Copyright © 2006 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSproc.h" void xf86OSRingBell(int loudness, int pitch, int duration) { if (xf86Info.consoleFd == -1 || !pitch || !loudness) return; ioctl(xf86Info.consoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) | (((unsigned long) duration * loudness / 50) << 16)); } xorg-server-1.20.8/hw/xfree86/os-support/linux/lnx_platform.c0000644000175000017500000001271213640201473021061 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #ifdef XSERVER_PLATFORM_BUS #include #include #include #include #include /* Linux platform device support */ #include "xf86_OSproc.h" #include "xf86.h" #include "xf86platformBus.h" #include "xf86Bus.h" #include "hotplug.h" #include "systemd-logind.h" static Bool get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) { drmSetVersion sv; drmVersionPtr v; char *buf; int fd; int err = 0; Bool paused, server_fd = FALSE; fd = systemd_logind_take_fd(attribs->major, attribs->minor, path, &paused); if (fd != -1) { if (paused) { LogMessage(X_ERROR, "Error systemd-logind returned paused fd for drm node\n"); systemd_logind_release_fd(attribs->major, attribs->minor, -1); return FALSE; } attribs->fd = fd; server_fd = TRUE; } if (fd == -1) fd = open(path, O_RDWR | O_CLOEXEC, 0); if (fd == -1) return FALSE; sv.drm_di_major = 1; sv.drm_di_minor = 4; sv.drm_dd_major = -1; /* Don't care */ sv.drm_dd_minor = -1; /* Don't care */ err = drmSetInterfaceVersion(fd, &sv); if (err) { xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n", path, strerror(-err)); goto out; } /* for a delayed probe we've already added the device */ if (delayed_index == -1) { xf86_add_platform_device(attribs, FALSE); delayed_index = xf86_num_platform_devices - 1; } if (server_fd) xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD; buf = drmGetBusid(fd); xf86_platform_odev_attributes(delayed_index)->busid = XNFstrdup(buf); drmFreeBusid(buf); v = drmGetVersion(fd); if (!v) { xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path); goto out; } xf86_platform_odev_attributes(delayed_index)->driver = XNFstrdup(v->name); drmFreeVersion(v); out: if (!server_fd) close(fd); return (err == 0); } Bool xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid) { const char *syspath = device->attribs->syspath; BusType bustype; const char *id; if (!syspath) return FALSE; bustype = StringToBusType(busid, &id); if (bustype == BUS_PCI) { struct pci_device *pPci = device->pdev; if (xf86ComparePciBusString(busid, ((pPci->domain << 8) | pPci->bus), pPci->dev, pPci->func)) { return TRUE; } } else if (bustype == BUS_PLATFORM) { /* match on the minimum string */ int len = strlen(id); if (strlen(syspath) < strlen(id)) len = strlen(syspath); if (strncmp(id, syspath, len)) return FALSE; return TRUE; } return FALSE; } void xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs) { Bool ret; char *dpath = attribs->path; ret = get_drm_info(attribs, dpath, index); if (ret == FALSE) { xf86_remove_platform_device(index); return; } ret = xf86platformAddDevice(index); if (ret == -1) xf86_remove_platform_device(index); } void xf86PlatformDeviceProbe(struct OdevAttributes *attribs) { int i; char *path = attribs->path; Bool ret; if (!path) goto out_free; for (i = 0; i < xf86_num_platform_devices; i++) { char *dpath = xf86_platform_odev_attributes(i)->path; if (dpath && !strcmp(path, dpath)) break; } if (i != xf86_num_platform_devices) goto out_free; LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path); if (!xf86VTOwner()) { /* if we don't currently own the VT then don't probe the device, just mark it as unowned for later use */ xf86_add_platform_device(attribs, TRUE); return; } ret = get_drm_info(attribs, path, -1); if (ret == FALSE) goto out_free; return; out_free: config_odev_free_attributes(attribs); } void NewGPUDeviceRequest(struct OdevAttributes *attribs) { int old_num = xf86_num_platform_devices; int ret; xf86PlatformDeviceProbe(attribs); if (old_num == xf86_num_platform_devices) return; if (xf86_get_platform_device_unowned(xf86_num_platform_devices - 1) == TRUE) return; ret = xf86platformAddDevice(xf86_num_platform_devices-1); if (ret == -1) xf86_remove_platform_device(xf86_num_platform_devices-1); ErrorF("xf86: found device %d\n", xf86_num_platform_devices); return; } void DeleteGPUDeviceRequest(struct OdevAttributes *attribs) { int index; char *syspath = attribs->syspath; if (!syspath) goto out; for (index = 0; index < xf86_num_platform_devices; index++) { char *dspath = xf86_platform_odev_attributes(index)->syspath; if (dspath && !strcmp(syspath, dspath)) break; } if (index == xf86_num_platform_devices) goto out; ErrorF("xf86: remove device %d %s\n", index, syspath); if (xf86_get_platform_device_unowned(index) == TRUE) xf86_remove_platform_device(index); else xf86platformRemoveDevice(index); out: config_odev_free_attributes(attribs); } #endif xorg-server-1.20.8/hw/xfree86/os-support/Makefile.am0000644000175000017500000000114213640201473017100 00000000000000SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) DIST_SUBDIRS = bsd bus misc linux solaris stub hurd sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h EXTRA_DIST = int10Defines.h xf86OSpriv.h # to get the grouping semantics right, you have to glom these three together # as one library, otherwise libtool will actively defeat your attempts to # list them multiple times on the link line. noinst_LTLIBRARIES = libxorgos.la libxorgos_la_SOURCES = libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \ bus/libbus.la \ misc/libmisc.la AM_CFLAGS = $(DIX_CFLAGS) xorg-server-1.20.8/hw/xfree86/os-support/bus/0000755000175000017500000000000013640201534015715 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/bus/Makefile.am0000644000175000017500000000063213640201473017674 00000000000000noinst_LTLIBRARIES = libbus.la sdk_HEADERS = xf86Pci.h PCI_SOURCES = if XORG_BUS_PCI PCI_SOURCES += Pci.c Pci.h endif if XORG_BUS_BSDPCI PCI_SOURCES += bsd_pci.c endif if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h endif libbus_la_SOURCES = $(PCI_SOURCES) $(PLATFORM_SOURCES) nobus.c AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) EXTRA_DIST = $(sdk_HEADERS) xorg-server-1.20.8/hw/xfree86/os-support/bus/Pci.h0000644000175000017500000001477213640201473016536 00000000000000/* * Copyright 1998 by Concurrent Computer 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 Concurrent Computer * Corporation not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Concurrent Computer Corporation makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. * * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION 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. * * Copyright 1998 by Metro Link Incorporated * * 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 Metro Link * Incorporated not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Metro Link Incorporated makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. * * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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. * * This file is derived in part from the original xf86_PCI.h that included * following copyright message: * * Copyright 1995 by Robin Cutshaw * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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. * */ /* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file has the private Pci definitions. The public ones are imported * from xf86Pci.h. Drivers should not use this file. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _PCI_H #define _PCI_H 1 #include "xf86Pci.h" /* * Global Definitions */ #if (defined(__alpha__) || defined(__ia64__)) && defined (__linux__) #define PCI_DOM_MASK 0x01fful #else #define PCI_DOM_MASK 0x0ffu #endif #ifndef PCI_DOM_MASK #define PCI_DOM_MASK 0x0ffu #endif #define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu) /* * "b" contains an optional domain number. */ #define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \ (((d) & 0x00001fu) << 11) | \ (((f) & 0x000007u) << 8)) #define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu)) #define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK)) #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu) #define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u) #if defined(__linux__) #define osPciInit(x) do {} while (0) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ defined(__OpenBSD__) || defined(__NetBSD__) || \ defined(__DragonFly__) || defined(__sun) || defined(__GNU__) extern void osPciInit(void); #else #error No PCI support available for this architecture/OS combination #endif #endif /* _PCI_H */ xorg-server-1.20.8/hw/xfree86/os-support/bus/bsd_pci.c0000644000175000017500000000331313640201473017406 00000000000000/* * Copyright © 2007 Intel Corporation * * 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. * * Authors: * Eric Anholt * */ /** * @file bsd_pci.c * * This is a trivial implementation of the remaining PCI support hooks in the * X Server that is unaware of domains. * * Most of even this should go away once drivers are converted and the * old interfaces are confirmed to all be obsolete. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "compiler.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "Pci.h" #include "pciaccess.h" void osPciInit(void) { xf86InitVidMem(); } xorg-server-1.20.8/hw/xfree86/os-support/bus/Makefile.in0000644000175000017500000007213013640201513017702 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @XORG_BUS_PCI_TRUE@am__append_1 = Pci.c Pci.h @XORG_BUS_BSDPCI_TRUE@am__append_2 = bsd_pci.c @XORG_BUS_SPARC_TRUE@am__append_3 = xf86Sbus.h subdir = hw/xfree86/os-support/bus ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbus_la_LIBADD = am__libbus_la_SOURCES_DIST = Pci.c Pci.h bsd_pci.c Sbus.c nobus.c @XORG_BUS_PCI_TRUE@am__objects_1 = Pci.lo @XORG_BUS_BSDPCI_TRUE@am__objects_2 = bsd_pci.lo am__objects_3 = $(am__objects_1) $(am__objects_2) @XORG_BUS_SPARC_TRUE@am__objects_4 = Sbus.lo am_libbus_la_OBJECTS = $(am__objects_3) $(am__objects_4) nobus.lo libbus_la_OBJECTS = $(am_libbus_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/Pci.Plo ./$(DEPDIR)/Sbus.Plo \ ./$(DEPDIR)/bsd_pci.Plo ./$(DEPDIR)/nobus.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libbus_la_SOURCES) DIST_SOURCES = $(am__libbus_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__sdk_HEADERS_DIST = xf86Pci.h xf86Sbus.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libbus.la sdk_HEADERS = xf86Pci.h $(am__append_3) PCI_SOURCES = $(am__append_1) $(am__append_2) @XORG_BUS_SPARC_TRUE@PLATFORM_SOURCES = Sbus.c libbus_la_SOURCES = $(PCI_SOURCES) $(PLATFORM_SOURCES) nobus.c AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) EXTRA_DIST = $(sdk_HEADERS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/bus/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/bus/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libbus.la: $(libbus_la_OBJECTS) $(libbus_la_DEPENDENCIES) $(EXTRA_libbus_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libbus_la_OBJECTS) $(libbus_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pci.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sbus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_pci.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nobus.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/Pci.Plo -rm -f ./$(DEPDIR)/Sbus.Plo -rm -f ./$(DEPDIR)/bsd_pci.Plo -rm -f ./$(DEPDIR)/nobus.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/Pci.Plo -rm -f ./$(DEPDIR)/Sbus.Plo -rm -f ./$(DEPDIR)/bsd_pci.Plo -rm -f ./$(DEPDIR)/nobus.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/bus/Sbus.c0000644000175000017500000005042513640201473016725 00000000000000/* * SBUS and OpenPROM access functions. * * 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 #endif #include #include #include #include #include #include #ifdef __sun #include #endif #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86sbusBus.h" #include "xf86Sbus.h" int promRootNode; static int promFd = -1; static int promCurrentNode; static int promOpenCount = 0; static int promP1275 = -1; #define MAX_PROP 128 #define MAX_VAL (4096-128-4) static struct openpromio *promOpio; sbusDevicePtr *xf86SbusInfo = NULL; struct sbus_devtable sbusDeviceTable[] = { {SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "sunbw2", "Sun Monochrome (bwtwo)"}, {SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", NULL, "Sun Color2 (cgtwo)"}, {SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "suncg3", "Sun Color3 (cgthree)"}, {SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", NULL, "Sun Color4 (cgfour)"}, {SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "suncg6", "Sun GX"}, {SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", NULL, "Sun CG8/RasterOps"}, {SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", NULL, "Sun GS (cgtwelve)"}, {SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "suncg14", "Sun SX"}, {SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", NULL, "Sun Graphics Tower"}, {SBUS_DEVICE_MGX, -1, "mgx", NULL, "Quantum 3D MGXplus"}, {SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "sunleo", "Sun ZX or Turbo ZX"}, {SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX"}, {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "sunffb", "Sun FFB"}, {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "sunffb", "Sun Elite3D"}, {0, 0, NULL} }; int promGetSibling(int node) { promOpio->oprom_size = sizeof(int); if (node == -1) return 0; *(int *) promOpio->oprom_array = node; if (ioctl(promFd, OPROMNEXT, promOpio) < 0) return 0; promCurrentNode = *(int *) promOpio->oprom_array; return *(int *) promOpio->oprom_array; } int promGetChild(int node) { promOpio->oprom_size = sizeof(int); if (!node || node == -1) return 0; *(int *) promOpio->oprom_array = node; if (ioctl(promFd, OPROMCHILD, promOpio) < 0) return 0; promCurrentNode = *(int *) promOpio->oprom_array; return *(int *) promOpio->oprom_array; } char * promGetProperty(const char *prop, int *lenp) { promOpio->oprom_size = MAX_VAL; strcpy(promOpio->oprom_array, prop); if (ioctl(promFd, OPROMGETPROP, promOpio) < 0) return 0; if (lenp) *lenp = promOpio->oprom_size; return promOpio->oprom_array; } int promGetBool(const char *prop) { promOpio->oprom_size = 0; *(int *) promOpio->oprom_array = 0; for (;;) { promOpio->oprom_size = MAX_PROP; if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0) return 0; if (!promOpio->oprom_size) return 0; if (!strcmp(promOpio->oprom_array, prop)) return 1; } } #define PROM_NODE_SIBLING 0x01 #define PROM_NODE_PREF 0x02 #define PROM_NODE_SBUS 0x04 #define PROM_NODE_EBUS 0x08 #define PROM_NODE_PCI 0x10 static int promSetNode(sbusPromNodePtr pnode) { int node; if (!pnode->node || pnode->node == -1) return -1; if (pnode->cookie[0] & PROM_NODE_SIBLING) node = promGetSibling(pnode->cookie[1]); else node = promGetChild(pnode->cookie[1]); if (pnode->node != node) return -1; return 0; } static void promIsP1275(void) { #ifdef __linux__ FILE *f; char buffer[1024]; if (promP1275 != -1) return; promP1275 = 0; f = fopen("/proc/cpuinfo", "r"); if (!f) return; while (fgets(buffer, 1024, f) != NULL) if (!strncmp(buffer, "type", 4) && strstr(buffer, "sun4u")) { promP1275 = 1; break; } fclose(f); #elif defined(__sun) struct utsname buffer; if ((uname(&buffer) >= 0) && !strcmp(buffer.machine, "sun4u")) promP1275 = TRUE; else promP1275 = FALSE; #elif defined(__FreeBSD__) promP1275 = TRUE; #else #error Missing promIsP1275() function for this OS #endif } void sparcPromClose(void) { if (promOpenCount > 1) { promOpenCount--; return; } if (promFd != -1) { close(promFd); promFd = -1; } free(promOpio); promOpio = NULL; promOpenCount = 0; } int sparcPromInit(void) { if (promOpenCount) { promOpenCount++; return 0; } promFd = open("/dev/openprom", O_RDONLY, 0); if (promFd == -1) return -1; promOpio = (struct openpromio *) malloc(4096); if (!promOpio) { sparcPromClose(); return -1; } promRootNode = promGetSibling(0); if (!promRootNode) { sparcPromClose(); return -1; } promIsP1275(); promOpenCount++; return 0; } char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp) { if (promSetNode(pnode)) return NULL; return promGetProperty(prop, lenp); } int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop) { if (promSetNode(pnode)) return 0; return promGetBool(prop); } static char * promWalkGetDriverName(int node, int oldnode) { int nextnode; int len; char *prop; int devId, i; prop = promGetProperty("device_type", &len); if (prop && (len > 0)) do { if (!strcmp(prop, "display")) { prop = promGetProperty("name", &len); if (!prop || len <= 0) break; while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',') prop++; for (i = 0; sbusDeviceTable[i].devId; i++) if (!strcmp(prop, sbusDeviceTable[i].promName)) break; devId = sbusDeviceTable[i].devId; if (!devId) break; if (sbusDeviceTable[i].driverName) return sbusDeviceTable[i].driverName; } } while (0); nextnode = promGetChild(node); if (nextnode) { char *name; name = promWalkGetDriverName(nextnode, node); if (name) return name; } nextnode = promGetSibling(node); if (nextnode) return promWalkGetDriverName(nextnode, node); return NULL; } char * sparcDriverName(void) { char *name; if (sparcPromInit() < 0) return NULL; promGetSibling(0); name = promWalkGetDriverName(promRootNode, 0); sparcPromClose(); return name; } static void promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr * devicePtrs) { int nextnode; int len, sbus = flags & PROM_NODE_SBUS; char *prop; int devId, i, j; sbusPromNode pNode, pNode2; prop = promGetProperty("device_type", &len); if (prop && (len > 0)) do { if (!strcmp(prop, "display")) { prop = promGetProperty("name", &len); if (!prop || len <= 0) break; while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',') prop++; for (i = 0; sbusDeviceTable[i].devId; i++) if (!strcmp(prop, sbusDeviceTable[i].promName)) break; devId = sbusDeviceTable[i].devId; if (!devId) break; if (!sbus) { if (devId == SBUS_DEVICE_FFB) { /* * All /SUNW,ffb outside of SBUS tree come before all * /SUNW,afb outside of SBUS tree in Linux. */ if (!strcmp(prop, "afb")) flags |= PROM_NODE_PREF; } else if (devId != SBUS_DEVICE_CG14) break; } for (i = 0; i < 32; i++) { if (!devicePtrs[i] || devicePtrs[i]->devId != devId) continue; if (devicePtrs[i]->node.node) { if ((devicePtrs[i]->node. cookie[0] & ~PROM_NODE_SIBLING) <= (flags & ~PROM_NODE_SIBLING)) continue; for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) { if (!devicePtrs[j] || devicePtrs[j]->devId != devId) continue; pNode2 = devicePtrs[j]->node; devicePtrs[j]->node = pNode; pNode = pNode2; } } devicePtrs[i]->node.node = node; devicePtrs[i]->node.cookie[0] = flags; devicePtrs[i]->node.cookie[1] = oldnode; break; } break; } } while (0); prop = promGetProperty("name", &len); if (prop && len > 0) { if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) sbus = PROM_NODE_SBUS; } nextnode = promGetChild(node); if (nextnode) promWalkAssignNodes(nextnode, node, sbus, devicePtrs); nextnode = promGetSibling(node); if (nextnode) promWalkAssignNodes(nextnode, node, PROM_NODE_SIBLING | sbus, devicePtrs); } void sparcPromAssignNodes(void) { sbusDevicePtr psdp, *psdpp; int n, holes = 0, i, j; FILE *f; sbusDevicePtr devicePtrs[32]; memset(devicePtrs, 0, sizeof(devicePtrs)); for (psdpp = xf86SbusInfo, n = 0; (psdp = *psdpp); psdpp++, n++) { if (psdp->fbNum != n) holes = 1; devicePtrs[psdp->fbNum] = psdp; } if (holes && (f = fopen("/proc/fb", "r")) != NULL) { /* We could not open one of fb devices, check /proc/fb to see what * were the types of the cards missed. */ char buffer[64]; int fbNum, devId; static struct { int devId; char *prefix; } procFbPrefixes[] = { {SBUS_DEVICE_BW2, "BWtwo"}, {SBUS_DEVICE_CG14, "CGfourteen"}, {SBUS_DEVICE_CG6, "CGsix"}, {SBUS_DEVICE_CG3, "CGthree"}, {SBUS_DEVICE_FFB, "Creator"}, {SBUS_DEVICE_FFB, "Elite 3D"}, {SBUS_DEVICE_LEO, "Leo"}, {SBUS_DEVICE_TCX, "TCX"}, {0, NULL}, }; while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) { for (i = 0; procFbPrefixes[i].devId; i++) if (!strncmp(procFbPrefixes[i].prefix, buffer, strlen(procFbPrefixes[i].prefix))) break; devId = procFbPrefixes[i].devId; if (!devId) continue; if (devicePtrs[fbNum]) { if (devicePtrs[fbNum]->devId != devId) xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n"); } else if (!devicePtrs[fbNum]) { devicePtrs[fbNum] = psdp = xnfcalloc(sizeof(sbusDevice), 1); psdp->devId = devId; psdp->fbNum = fbNum; psdp->fd = -2; } } fclose(f); } promGetSibling(0); promWalkAssignNodes(promRootNode, 0, PROM_NODE_PREF, devicePtrs); for (i = 0, j = 0; i < 32; i++) if (devicePtrs[i] && devicePtrs[i]->fbNum == -1) j++; xf86SbusInfo = xnfreallocarray(xf86SbusInfo, n + j + 1, sizeof(psdp)); for (i = 0, psdpp = xf86SbusInfo; i < 32; i++) if (devicePtrs[i]) { if (devicePtrs[i]->fbNum == -1) { memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1)); *psdpp = devicePtrs[i]; } else n--; } } static char * promGetReg(int type) { char *prop; int len; static char regstr[40]; regstr[0] = 0; prop = promGetProperty("reg", &len); if (prop && len >= 4) { unsigned int *reg = (unsigned int *) prop; if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS)) snprintf(regstr, sizeof(regstr), "@%x,%x", reg[0], reg[1]); else if (type == PROM_NODE_PCI) { if ((reg[0] >> 8) & 7) snprintf(regstr, sizeof(regstr), "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7); else snprintf(regstr, sizeof(regstr), "@%x", (reg[0] >> 11) & 0x1f); } else if (len == 4) snprintf(regstr, sizeof(regstr), "@%x", reg[0]); else { unsigned int regs[2]; /* Things get more complicated on UPA. If upa-portid exists, then address is @upa-portid,second-int-in-reg, otherwise it is @first-int-in-reg/16,second-int-in-reg (well, probably upa-portid always exists, but just to be safe). */ memcpy(regs, reg, sizeof(regs)); prop = promGetProperty("upa-portid", &len); if (prop && len == 4) { reg = (unsigned int *) prop; snprintf(regstr, sizeof(regstr), "@%x,%x", reg[0], regs[1]); } else snprintf(regstr, sizeof(regstr), "@%x,%x", regs[0] >> 4, regs[1]); } } return regstr; } static int promWalkNode2Pathname(char *path, int parent, int node, int searchNode, int type) { int nextnode; int len, ntype = type; char *prop, *p; prop = promGetProperty("name", &len); *path = '/'; if (!prop || len <= 0) return 0; if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) ntype = PROM_NODE_SBUS; else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) ntype = PROM_NODE_EBUS; else if (!strcmp(prop, "pci") && !type) ntype = PROM_NODE_PCI; strcpy(path + 1, prop); p = promGetReg(type); if (*p) strcat(path, p); if (node == searchNode) return 1; nextnode = promGetChild(node); if (nextnode && promWalkNode2Pathname(strchr(path, 0), node, nextnode, searchNode, ntype)) return 1; nextnode = promGetSibling(node); if (nextnode && promWalkNode2Pathname(path, parent, nextnode, searchNode, type)) return 1; return 0; } char * sparcPromNode2Pathname(sbusPromNodePtr pnode) { char *ret; if (!pnode->node) return NULL; ret = malloc(4096); if (!ret) return NULL; if (promWalkNode2Pathname (ret, promRootNode, promGetChild(promRootNode), pnode->node, 0)) return ret; free(ret); return NULL; } static int promWalkPathname2Node(char *name, char *regstr, int parent, int type) { int len, node, ret; char *prop, *p; for (;;) { prop = promGetProperty("name", &len); if (!prop || len <= 0) return 0; if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) type = PROM_NODE_SBUS; else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) type = PROM_NODE_EBUS; else if (!strcmp(prop, "pci") && !type) type = PROM_NODE_PCI; for (node = promGetChild(parent); node; node = promGetSibling(node)) { prop = promGetProperty("name", &len); if (!prop || len <= 0) continue; if (*name && strcmp(name, prop)) continue; if (*regstr) { p = promGetReg(type); if (!*p || strcmp(p + 1, regstr)) continue; } break; } if (!node) { for (node = promGetChild(parent); node; node = promGetSibling(node)) { ret = promWalkPathname2Node(name, regstr, node, type); if (ret) return ret; } return 0; } name = strchr(regstr, 0) + 1; if (!*name) return node; p = strchr(name, '/'); if (p) *p = 0; else p = strchr(name, 0); regstr = strchr(name, '@'); if (regstr) *regstr++ = 0; else regstr = p; if (name == regstr) return 0; parent = node; } } int sparcPromPathname2Node(const char *pathName) { int i; char *name, *regstr, *p; i = strlen(pathName); name = malloc(i + 2); if (!name) return 0; strcpy(name, pathName); name[i + 1] = 0; if (name[0] != '/') { free(name); return 0; } p = strchr(name + 1, '/'); if (p) *p = 0; else p = strchr(name, 0); regstr = strchr(name, '@'); if (regstr) *regstr++ = 0; else regstr = p; if (name + 1 == regstr) { free(name); return 0; } promGetSibling(0); i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0); free(name); return i; } void * xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) { void *ret; unsigned long pagemask = getpagesize() - 1; unsigned long off = offset & ~pagemask; unsigned long len = ((offset + size + pagemask) & ~pagemask) - off; if (psdp->fd == -1) { psdp->fd = open(psdp->device, O_RDWR); if (psdp->fd == -1) return NULL; } else if (psdp->fd < 0) return NULL; ret = (void *) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, psdp->fd, off); if (ret == (void *) -1) { ret = (void *) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, psdp->fd, off); } if (ret == (void *) -1) return NULL; return (char *) ret + (offset - off); } void xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr, unsigned long size) { unsigned long mask = getpagesize() - 1; unsigned long base = (unsigned long) addr & ~mask; unsigned long len = (((unsigned long) addr + size + mask) & ~mask) - base; munmap((void *) base, len); } /* Tell OS that we are driving the HW cursor ourselves. */ void xf86SbusHideOsHwCursor(sbusDevicePtr psdp) { struct fbcursor fbcursor; unsigned char zeros[8]; memset(&fbcursor, 0, sizeof(fbcursor)); memset(&zeros, 0, sizeof(zeros)); fbcursor.cmap.count = 2; fbcursor.cmap.red = zeros; fbcursor.cmap.green = zeros; fbcursor.cmap.blue = zeros; fbcursor.image = (char *) zeros; fbcursor.mask = (char *) zeros; fbcursor.size.x = 32; fbcursor.size.y = 1; fbcursor.set = FB_CUR_SETALL; ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); } /* Set HW cursor colormap. */ void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg) { struct fbcursor fbcursor; unsigned char red[2], green[2], blue[2]; memset(&fbcursor, 0, sizeof(fbcursor)); red[0] = bg >> 16; green[0] = bg >> 8; blue[0] = bg; red[1] = fg >> 16; green[1] = fg >> 8; blue[1] = fg; fbcursor.cmap.count = 2; fbcursor.cmap.red = red; fbcursor.cmap.green = green; fbcursor.cmap.blue = blue; fbcursor.set = FB_CUR_SETCMAP; ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); } xorg-server-1.20.8/hw/xfree86/os-support/bus/nobus.c0000644000175000017500000000012613640201473017130 00000000000000void __noop_to_appease_ar__(void); void __noop_to_appease_ar__(void) { return; } xorg-server-1.20.8/hw/xfree86/os-support/bus/Pci.c0000644000175000017500000001573413640201473016530 00000000000000/* * Copyright 1998 by Concurrent Computer 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 Concurrent Computer * Corporation not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Concurrent Computer Corporation makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. * * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION 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. * * Copyright 1998 by Metro Link Incorporated * * 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 Metro Link * Incorporated not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Metro Link Incorporated makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. * * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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. * * This software is derived from the original XFree86 PCI code * which includes the following copyright notices as well: * * Copyright 1995 by Robin Cutshaw * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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. * * This code is also based heavily on the code in FreeBSD-current, which was * written by Wolfgang Stanglmeier, and contains the following copyright: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "Pci.h" Bool xf86scanpci(void) { Bool success = FALSE; success = (pci_system_init() == 0); /* choose correct platform/OS specific PCI init routine */ osPciInit(); return success; } xorg-server-1.20.8/hw/xfree86/os-support/bus/xf86Pci.h0000644000175000017500000002246713640201473017252 00000000000000/* * Copyright 1998 by Concurrent Computer 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 Concurrent Computer * Corporation not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Concurrent Computer Corporation makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. * * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION 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. * * Copyright 1998 by Metro Link Incorporated * * 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 Metro Link * Incorporated not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Metro Link Incorporated makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. * * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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. * * This file is derived in part from the original xf86_PCI.h that included * following copyright message: * * Copyright 1995 by Robin Cutshaw * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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. * */ /* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains just the public interface to the PCI code. * Drivers should use this file rather than Pci.h. */ #ifndef _XF86PCI_H #define _XF86PCI_H 1 #include #include #include "misc.h" #include /* * PCI cfg space definitions (e.g. stuff right out of the PCI spec) */ /* Device identification register */ #define PCI_ID_REG 0x00 /* Command and status register */ #define PCI_CMD_STAT_REG 0x04 #define PCI_CMD_BASE_REG 0x10 #define PCI_CMD_BIOS_REG 0x30 #define PCI_CMD_MASK 0xffff #define PCI_CMD_IO_ENABLE 0x01 #define PCI_CMD_MEM_ENABLE 0x02 #define PCI_CMD_MASTER_ENABLE 0x04 #define PCI_CMD_SPECIAL_ENABLE 0x08 #define PCI_CMD_INVALIDATE_ENABLE 0x10 #define PCI_CMD_PALETTE_ENABLE 0x20 #define PCI_CMD_PARITY_ENABLE 0x40 #define PCI_CMD_STEPPING_ENABLE 0x80 #define PCI_CMD_SERR_ENABLE 0x100 #define PCI_CMD_BACKTOBACK_ENABLE 0x200 #define PCI_CMD_BIOS_ENABLE 0x01 /* base class */ #define PCI_CLASS_REG 0x08 #define PCI_CLASS_MASK 0xff000000 #define PCI_CLASS_SHIFT 24 #define PCI_CLASS_EXTRACT(x) \ (((x) & PCI_CLASS_MASK) >> PCI_CLASS_SHIFT) /* base class values */ #define PCI_CLASS_PREHISTORIC 0x00 #define PCI_CLASS_MASS_STORAGE 0x01 #define PCI_CLASS_NETWORK 0x02 #define PCI_CLASS_DISPLAY 0x03 #define PCI_CLASS_MULTIMEDIA 0x04 #define PCI_CLASS_MEMORY 0x05 #define PCI_CLASS_BRIDGE 0x06 #define PCI_CLASS_COMMUNICATIONS 0x07 #define PCI_CLASS_SYSPERIPH 0x08 #define PCI_CLASS_INPUT 0x09 #define PCI_CLASS_DOCKING 0x0a #define PCI_CLASS_PROCESSOR 0x0b #define PCI_CLASS_SERIALBUS 0x0c #define PCI_CLASS_WIRELESS 0x0d #define PCI_CLASS_I2O 0x0e #define PCI_CLASS_SATELLITE 0x0f #define PCI_CLASS_CRYPT 0x10 #define PCI_CLASS_DATA_ACQUISTION 0x11 #define PCI_CLASS_UNDEFINED 0xff /* sub class */ #define PCI_SUBCLASS_MASK 0x00ff0000 #define PCI_SUBCLASS_SHIFT 16 #define PCI_SUBCLASS_EXTRACT(x) \ (((x) & PCI_SUBCLASS_MASK) >> PCI_SUBCLASS_SHIFT) /* Sub class values */ /* 0x00 prehistoric subclasses */ #define PCI_SUBCLASS_PREHISTORIC_MISC 0x00 #define PCI_SUBCLASS_PREHISTORIC_VGA 0x01 /* 0x03 display subclasses */ #define PCI_SUBCLASS_DISPLAY_VGA 0x00 #define PCI_SUBCLASS_DISPLAY_XGA 0x01 #define PCI_SUBCLASS_DISPLAY_MISC 0x80 /* 0x04 multimedia subclasses */ #define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00 #define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x01 #define PCI_SUBCLASS_MULTIMEDIA_MISC 0x80 /* 0x06 bridge subclasses */ #define PCI_SUBCLASS_BRIDGE_HOST 0x00 #define PCI_SUBCLASS_BRIDGE_ISA 0x01 #define PCI_SUBCLASS_BRIDGE_EISA 0x02 #define PCI_SUBCLASS_BRIDGE_MC 0x03 #define PCI_SUBCLASS_BRIDGE_PCI 0x04 #define PCI_SUBCLASS_BRIDGE_PCMCIA 0x05 #define PCI_SUBCLASS_BRIDGE_NUBUS 0x06 #define PCI_SUBCLASS_BRIDGE_CARDBUS 0x07 #define PCI_SUBCLASS_BRIDGE_RACEWAY 0x08 #define PCI_SUBCLASS_BRIDGE_MISC 0x80 #define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01 /* 0x0b processor subclasses */ #define PCI_SUBCLASS_PROCESSOR_386 0x00 #define PCI_SUBCLASS_PROCESSOR_486 0x01 #define PCI_SUBCLASS_PROCESSOR_PENTIUM 0x02 #define PCI_SUBCLASS_PROCESSOR_ALPHA 0x10 #define PCI_SUBCLASS_PROCESSOR_POWERPC 0x20 #define PCI_SUBCLASS_PROCESSOR_MIPS 0x30 #define PCI_SUBCLASS_PROCESSOR_COPROC 0x40 /* PCI-PCI bridge mapping registers */ #define PCI_PCI_BRIDGE_BUS_REG 0x18 #define PCI_SUBORDINATE_BUS_MASK 0x00ff0000 #define PCI_SECONDARY_BUS_MASK 0x0000ff00 #define PCI_PRIMARY_BUS_MASK 0x000000ff #define PCI_PCI_BRIDGE_IO_REG 0x1c #define PCI_PCI_BRIDGE_MEM_REG 0x20 #define PCI_PCI_BRIDGE_PMEM_REG 0x24 #define PCI_PCI_BRIDGE_CONTROL_REG 0x3E #define PCI_PCI_BRIDGE_PARITY_EN 0x01 #define PCI_PCI_BRIDGE_SERR_EN 0x02 #define PCI_PCI_BRIDGE_ISA_EN 0x04 #define PCI_PCI_BRIDGE_VGA_EN 0x08 #define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 #define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 #define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 /* Subsystem identification register */ #define PCI_SUBSYSTEM_ID_REG 0x2c /* User defined cfg space regs */ #define PCI_REG_USERCONFIG 0x40 #define PCI_OPTION_REG 0x40 /* * Typedefs, etc... */ /* Public PCI access functions */ extern _X_EXPORT Bool xf86scanpci(void); extern _X_EXPORT char *DRICreatePCIBusID(const struct pci_device *dev); #endif /* _XF86PCI_H */ xorg-server-1.20.8/hw/xfree86/os-support/bus/xf86Sbus.h0000644000175000017500000000402213640201473017436 00000000000000/* * Platform specific SBUS and OpenPROM access declarations. * * 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 #endif #ifndef _XF86_SBUS_H #define _XF86_SBUS_H #if defined(__linux__) #include #include #include #include #elif defined(SVR4) #include #include #elif defined(__OpenBSD__) && defined(__sparc64__) /* XXX */ #elif defined(CSRG_BASED) #if defined(__FreeBSD__) #include #include #include #else #include #endif #else #include #endif #ifndef FBTYPE_SUNGP3 #define FBTYPE_SUNGP3 -1 #endif #ifndef FBTYPE_MDICOLOR #define FBTYPE_MDICOLOR -1 #endif #ifndef FBTYPE_SUNLEO #define FBTYPE_SUNLEO -1 #endif #ifndef FBTYPE_TCXCOLOR #define FBTYPE_TCXCOLOR -1 #endif #ifndef FBTYPE_CREATOR #define FBTYPE_CREATOR -1 #endif #endif /* _XF86_SBUS_H */ xorg-server-1.20.8/hw/xfree86/os-support/int10Defines.h0000644000175000017500000000552413640201473017456 00000000000000/* * Copyright (c) 2000-2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _INT10DEFINES_H_ #define _INT10DEFINES_H_ 1 #ifdef _VM86_LINUX #include #define CPU_R(type,name,num) \ (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num]) #define CPU_RD(name,num) CPU_R(CARD32,name,num) #define CPU_RW(name,num) CPU_R(CARD16,name,num) #define CPU_RB(name,num) CPU_R(CARD8,name,num) #define X86_EAX CPU_RD(eax,0) #define X86_EBX CPU_RD(ebx,0) #define X86_ECX CPU_RD(ecx,0) #define X86_EDX CPU_RD(edx,0) #define X86_ESI CPU_RD(esi,0) #define X86_EDI CPU_RD(edi,0) #define X86_EBP CPU_RD(ebp,0) #define X86_EIP CPU_RD(eip,0) #define X86_ESP CPU_RD(esp,0) #define X86_EFLAGS CPU_RD(eflags,0) #define X86_FLAGS CPU_RW(eflags,0) #define X86_AX CPU_RW(eax,0) #define X86_BX CPU_RW(ebx,0) #define X86_CX CPU_RW(ecx,0) #define X86_DX CPU_RW(edx,0) #define X86_SI CPU_RW(esi,0) #define X86_DI CPU_RW(edi,0) #define X86_BP CPU_RW(ebp,0) #define X86_IP CPU_RW(eip,0) #define X86_SP CPU_RW(esp,0) #define X86_CS CPU_RW(cs,0) #define X86_DS CPU_RW(ds,0) #define X86_ES CPU_RW(es,0) #define X86_SS CPU_RW(ss,0) #define X86_FS CPU_RW(fs,0) #define X86_GS CPU_RW(gs,0) #define X86_AL CPU_RB(eax,0) #define X86_BL CPU_RB(ebx,0) #define X86_CL CPU_RB(ecx,0) #define X86_DL CPU_RB(edx,0) #define X86_AH CPU_RB(eax,1) #define X86_BH CPU_RB(ebx,1) #define X86_CH CPU_RB(ecx,1) #define X86_DH CPU_RB(edx,1) #elif defined(_X86EMU) #include "xf86x86emu.h" #endif #endif xorg-server-1.20.8/hw/xfree86/os-support/stub/0000755000175000017500000000000013640201534016101 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/stub/Makefile.am0000644000175000017500000000067213640201473020064 00000000000000noinst_LTLIBRARIES = libstub.la AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) libstub_la_SOURCES = \ $(srcdir)/../shared/VTsw_noop.c \ $(srcdir)/../shared/agp_noop.c \ $(srcdir)/../shared/ioperm_noop.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/pm_noop.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ stub_bell.c \ stub_init.c \ stub_video.c xorg-server-1.20.8/hw/xfree86/os-support/stub/stub_video.c0000644000175000017500000000031213640201473020326 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86_OSlib.h" #include "xf86OSpriv.h" void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; return; } xorg-server-1.20.8/hw/xfree86/os-support/stub/stub_init.c0000644000175000017500000000045313640201473020171 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86_OSlib.h" void xf86OpenConsole(void) { } void xf86CloseConsole(void) { } int xf86ProcessArgument(int argc, char *argv[], int i) { return 0; } void xf86UseMsg(void) { } void xf86OSInputThreadInit(void) { return; } xorg-server-1.20.8/hw/xfree86/os-support/stub/Makefile.in0000644000175000017500000011052013640201513020062 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/os-support/stub ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libstub_la_LIBADD = am_libstub_la_OBJECTS = VTsw_noop.lo agp_noop.lo ioperm_noop.lo \ kmod_noop.lo pm_noop.lo vidmem.lo posix_tty.lo sigio.lo \ stub_bell.lo stub_init.lo stub_video.lo libstub_la_OBJECTS = $(am_libstub_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/VTsw_noop.Plo \ ./$(DEPDIR)/agp_noop.Plo ./$(DEPDIR)/ioperm_noop.Plo \ ./$(DEPDIR)/kmod_noop.Plo ./$(DEPDIR)/pm_noop.Plo \ ./$(DEPDIR)/posix_tty.Plo ./$(DEPDIR)/sigio.Plo \ ./$(DEPDIR)/stub_bell.Plo ./$(DEPDIR)/stub_init.Plo \ ./$(DEPDIR)/stub_video.Plo ./$(DEPDIR)/vidmem.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libstub_la_SOURCES) DIST_SOURCES = $(libstub_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libstub.la AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) libstub_la_SOURCES = \ $(srcdir)/../shared/VTsw_noop.c \ $(srcdir)/../shared/agp_noop.c \ $(srcdir)/../shared/ioperm_noop.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/pm_noop.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ stub_bell.c \ stub_init.c \ stub_video.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/stub/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/stub/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libstub.la: $(libstub_la_OBJECTS) $(libstub_la_DEPENDENCIES) $(EXTRA_libstub_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libstub_la_OBJECTS) $(libstub_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioperm_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub_bell.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< VTsw_noop.lo: $(srcdir)/../shared/VTsw_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_noop.lo -MD -MP -MF $(DEPDIR)/VTsw_noop.Tpo -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/VTsw_noop.Tpo $(DEPDIR)/VTsw_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/VTsw_noop.c' object='VTsw_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c agp_noop.lo: $(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT agp_noop.lo -MD -MP -MF $(DEPDIR)/agp_noop.Tpo -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/agp_noop.Tpo $(DEPDIR)/agp_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/agp_noop.c' object='agp_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c ioperm_noop.lo: $(srcdir)/../shared/ioperm_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ioperm_noop.lo -MD -MP -MF $(DEPDIR)/ioperm_noop.Tpo -c -o ioperm_noop.lo `test -f '$(srcdir)/../shared/ioperm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ioperm_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ioperm_noop.Tpo $(DEPDIR)/ioperm_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/ioperm_noop.c' object='ioperm_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ioperm_noop.lo `test -f '$(srcdir)/../shared/ioperm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ioperm_noop.c kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c pm_noop.lo: $(srcdir)/../shared/pm_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pm_noop.lo -MD -MP -MF $(DEPDIR)/pm_noop.Tpo -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pm_noop.Tpo $(DEPDIR)/pm_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/pm_noop.c' object='pm_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c vidmem.lo: $(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c posix_tty.lo: $(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c sigio.lo: $(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigio.lo -MD -MP -MF $(DEPDIR)/sigio.Tpo -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sigio.Tpo $(DEPDIR)/sigio.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/sigio.c' object='sigio.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/VTsw_noop.Plo -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/ioperm_noop.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/pm_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/stub_bell.Plo -rm -f ./$(DEPDIR)/stub_init.Plo -rm -f ./$(DEPDIR)/stub_video.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/VTsw_noop.Plo -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/ioperm_noop.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/pm_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/stub_bell.Plo -rm -f ./$(DEPDIR)/stub_init.Plo -rm -f ./$(DEPDIR)/stub_video.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/stub/stub_bell.c0000644000175000017500000000022313640201473020137 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86_OSlib.h" void xf86OSRingBell(int loudness, int pitch, int duration) { } xorg-server-1.20.8/hw/xfree86/os-support/shared/0000755000175000017500000000000013640201534016372 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/shared/sigiostubs.c0000644000175000017500000000327213640201473020657 00000000000000/* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) { return 0; } int xf86RemoveSIGIOHandler(int fd) { return 0; } xorg-server-1.20.8/hw/xfree86/os-support/shared/kmod_noop.c0000644000175000017500000000313513640201473020447 00000000000000/* * Copyright (c) 2000 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86_OSproc.h" int xf86LoadKernelModule(const char *pathname) { (void) pathname; return 0; /* failure */ } xorg-server-1.20.8/hw/xfree86/os-support/shared/ioperm_noop.c0000644000175000017500000000302213640201473021003 00000000000000/* * Copyright 1993 by David Wexelblat * * 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 David Wexelblat not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. David Wexelblat makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL 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. * */ /* * Some platforms don't bother with I/O permissions, * or the permissions are implicit with opening/enabling the console. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" Bool xf86EnableIO(void) { return TRUE; } void xf86DisableIO(void) { return; } xorg-server-1.20.8/hw/xfree86/os-support/shared/agp_noop.c0000644000175000017500000000462113640201473020265 00000000000000/* * Copyright (c) 2000-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). */ /* * Abstraction of the AGP GART interface. Stubs for platforms without * AGP GART support. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" Bool xf86GARTCloseScreen(int screenNum) { return FALSE; } Bool xf86AgpGARTSupported(void) { return FALSE; } AgpInfoPtr xf86GetAGPInfo(int screenNum) { return NULL; } Bool xf86AcquireGART(int screenNum) { return FALSE; } Bool xf86ReleaseGART(int screenNum) { return FALSE; } int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, unsigned long *physical) { return -1; } Bool xf86DeallocateGARTMemory(int screenNum, int key) { return FALSE; } Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset) { return FALSE; } Bool xf86UnbindGARTMemory(int screenNum, int key) { return FALSE; } Bool xf86EnableAGP(int screenNum, CARD32 mode) { return FALSE; } xorg-server-1.20.8/hw/xfree86/os-support/shared/posix_tty.c0000644000175000017500000003355413640201473020534 00000000000000/* * Copyright 1993-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 XFREE86 PROJECT 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 XFree86 Project 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 * XFree86 Project. */ /* * * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" static int GetBaud(int baudrate) { #ifdef B300 if (baudrate == 300) return B300; #endif #ifdef B1200 if (baudrate == 1200) return B1200; #endif #ifdef B2400 if (baudrate == 2400) return B2400; #endif #ifdef B4800 if (baudrate == 4800) return B4800; #endif #ifdef B9600 if (baudrate == 9600) return B9600; #endif #ifdef B19200 if (baudrate == 19200) return B19200; #endif #ifdef B38400 if (baudrate == 38400) return B38400; #endif #ifdef B57600 if (baudrate == 57600) return B57600; #endif #ifdef B115200 if (baudrate == 115200) return B115200; #endif #ifdef B230400 if (baudrate == 230400) return B230400; #endif #ifdef B460800 if (baudrate == 460800) return B460800; #endif return 0; } int xf86OpenSerial(XF86OptionPtr options) { struct termios t; int fd, i; char *dev; dev = xf86SetStrOption(options, "Device", NULL); if (!dev) { xf86Msg(X_ERROR, "xf86OpenSerial: No Device specified.\n"); return -1; } fd = xf86CheckIntOption(options, "fd", -1); if (fd == -1) SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK)); if (fd == -1) { xf86Msg(X_ERROR, "xf86OpenSerial: Cannot open device %s\n\t%s.\n", dev, strerror(errno)); free(dev); return -1; } if (!isatty(fd)) { /* Allow non-tty devices to be opened. */ free(dev); return fd; } /* set up default port parameters */ SYSCALL(tcgetattr(fd, &t)); t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); t.c_oflag &= ~OPOST; t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); t.c_cflag &= ~(CSIZE | PARENB); t.c_cflag |= CS8 | CLOCAL; cfsetispeed(&t, B9600); cfsetospeed(&t, B9600); t.c_cc[VMIN] = 1; t.c_cc[VTIME] = 0; SYSCALL(tcsetattr(fd, TCSANOW, &t)); if (xf86SetSerial(fd, options) == -1) { SYSCALL(close(fd)); free(dev); return -1; } SYSCALL(i = fcntl(fd, F_GETFL, 0)); if (i == -1) { SYSCALL(close(fd)); free(dev); return -1; } i &= ~O_NONBLOCK; SYSCALL(i = fcntl(fd, F_SETFL, i)); if (i == -1) { SYSCALL(close(fd)); free(dev); return -1; } free(dev); return fd; } int xf86SetSerial(int fd, XF86OptionPtr options) { struct termios t; int val; char *s; int baud, r; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; SYSCALL(tcgetattr(fd, &t)); if ((val = xf86SetIntOption(options, "BaudRate", 0))) { if ((baud = GetBaud(val))) { cfsetispeed(&t, baud); cfsetospeed(&t, baud); } else { xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", val); return -1; } } if ((val = xf86SetIntOption(options, "StopBits", 0))) { switch (val) { case 1: t.c_cflag &= ~(CSTOPB); break; case 2: t.c_cflag |= CSTOPB; break; default: xf86Msg(X_ERROR, "Invalid Option StopBits value: %d\n", val); return -1; break; } } if ((val = xf86SetIntOption(options, "DataBits", 0))) { switch (val) { case 5: t.c_cflag &= ~(CSIZE); t.c_cflag |= CS5; break; case 6: t.c_cflag &= ~(CSIZE); t.c_cflag |= CS6; break; case 7: t.c_cflag &= ~(CSIZE); t.c_cflag |= CS7; break; case 8: t.c_cflag &= ~(CSIZE); t.c_cflag |= CS8; break; default: xf86Msg(X_ERROR, "Invalid Option DataBits value: %d\n", val); return -1; break; } } if ((s = xf86SetStrOption(options, "Parity", NULL))) { if (xf86NameCmp(s, "Odd") == 0) { t.c_cflag |= PARENB | PARODD; } else if (xf86NameCmp(s, "Even") == 0) { t.c_cflag |= PARENB; t.c_cflag &= ~(PARODD); } else if (xf86NameCmp(s, "None") == 0) { t.c_cflag &= ~(PARENB); } else { xf86Msg(X_ERROR, "Invalid Option Parity value: %s\n", s); free(s); return -1; } free(s); } if ((val = xf86SetIntOption(options, "Vmin", -1)) != -1) { t.c_cc[VMIN] = val; } if ((val = xf86SetIntOption(options, "Vtime", -1)) != -1) { t.c_cc[VTIME] = val; } if ((s = xf86SetStrOption(options, "FlowControl", NULL))) { xf86MarkOptionUsedByName(options, "FlowControl"); if (xf86NameCmp(s, "Xoff") == 0) { t.c_iflag |= IXOFF; } else if (xf86NameCmp(s, "Xon") == 0) { t.c_iflag |= IXON; } else if (xf86NameCmp(s, "XonXoff") == 0) { t.c_iflag |= IXON | IXOFF; } else if (xf86NameCmp(s, "None") == 0) { t.c_iflag &= ~(IXON | IXOFF); } else { xf86Msg(X_ERROR, "Invalid Option FlowControl value: %s\n", s); free(s); return -1; } free(s); } if ((xf86SetBoolOption(options, "ClearDTR", FALSE))) { #ifdef CLEARDTR_SUPPORT #if defined(TIOCMBIC) val = TIOCM_DTR; SYSCALL(ioctl(fd, TIOCMBIC, &val)); #else SYSCALL(ioctl(fd, TIOCCDTR, NULL)); #endif #else xf86Msg(X_WARNING, "Option ClearDTR not supported on this OS\n"); return -1; #endif xf86MarkOptionUsedByName(options, "ClearDTR"); } if ((xf86SetBoolOption(options, "ClearRTS", FALSE))) { xf86Msg(X_WARNING, "Option ClearRTS not supported on this OS\n"); return -1; xf86MarkOptionUsedByName(options, "ClearRTS"); } SYSCALL(r = tcsetattr(fd, TCSANOW, &t)); return r; } int xf86SetSerialSpeed(int fd, int speed) { struct termios t; int baud, r; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; SYSCALL(tcgetattr(fd, &t)); if ((baud = GetBaud(speed))) { cfsetispeed(&t, baud); cfsetospeed(&t, baud); } else { xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", speed); return -1; } SYSCALL(r = tcsetattr(fd, TCSANOW, &t)); return r; } int xf86ReadSerial(int fd, void *buf, int count) { int r; int i; SYSCALL(r = read(fd, buf, count)); DebugF("ReadingSerial: 0x%x", (unsigned char) *(((unsigned char *) buf))); for (i = 1; i < r; i++) DebugF(", 0x%x", (unsigned char) *(((unsigned char *) buf) + i)); DebugF("\n"); return r; } int xf86WriteSerial(int fd, const void *buf, int count) { int r; int i; DebugF("WritingSerial: 0x%x", (unsigned char) *(((unsigned char *) buf))); for (i = 1; i < count; i++) DebugF(", 0x%x", (unsigned char) *(((unsigned char *) buf) + i)); DebugF("\n"); SYSCALL(r = write(fd, buf, count)); return r; } int xf86CloseSerial(int fd) { int r; SYSCALL(r = close(fd)); return r; } int xf86WaitForInput(int fd, int timeout) { int r; struct pollfd poll_fd; poll_fd.fd = fd; poll_fd.events = POLLIN; /* convert microseconds to milliseconds */ timeout = (timeout + 999) / 1000; if (fd >= 0) { SYSCALL(r = xserver_poll(&poll_fd, 1, timeout)); } else { SYSCALL(r = xserver_poll(&poll_fd, 0, timeout)); } xf86ErrorFVerb(9, "poll returned %d\n", r); return r; } int xf86SerialSendBreak(int fd, int duration) { int r; SYSCALL(r = tcsendbreak(fd, duration)); return r; } int xf86FlushInput(int fd) { struct pollfd poll_fd; /* this needs to be big enough to flush an evdev event. */ char c[256]; DebugF("FlushingSerial\n"); if (tcflush(fd, TCIFLUSH) == 0) return 0; poll_fd.fd = fd; poll_fd.events = POLLIN; while (xserver_poll(&poll_fd, 1, 0) > 0) { if (read(fd, &c, sizeof(c)) < 1) return 0; } return 0; } static struct states { int xf; int os; } modemStates[] = { #ifdef TIOCM_LE { XF86_M_LE, TIOCM_LE}, #endif #ifdef TIOCM_DTR { XF86_M_DTR, TIOCM_DTR}, #endif #ifdef TIOCM_RTS { XF86_M_RTS, TIOCM_RTS}, #endif #ifdef TIOCM_ST { XF86_M_ST, TIOCM_ST}, #endif #ifdef TIOCM_SR { XF86_M_SR, TIOCM_SR}, #endif #ifdef TIOCM_CTS { XF86_M_CTS, TIOCM_CTS}, #endif #ifdef TIOCM_CAR { XF86_M_CAR, TIOCM_CAR}, #elif defined(TIOCM_CD) { XF86_M_CAR, TIOCM_CD}, #endif #ifdef TIOCM_RNG { XF86_M_RNG, TIOCM_RNG}, #elif defined(TIOCM_RI) { XF86_M_CAR, TIOCM_RI}, #endif #ifdef TIOCM_DSR { XF86_M_DSR, TIOCM_DSR}, #endif }; static int numStates = ARRAY_SIZE(modemStates); static int xf2osState(int state) { int i; int ret = 0; for (i = 0; i < numStates; i++) if (state & modemStates[i].xf) ret |= modemStates[i].os; return ret; } static int os2xfState(int state) { int i; int ret = 0; for (i = 0; i < numStates; i++) if (state & modemStates[i].os) ret |= modemStates[i].xf; return ret; } static int getOsStateMask(void) { int i; int ret = 0; for (i = 0; i < numStates; i++) ret |= modemStates[i].os; return ret; } static int osStateMask = 0; int xf86SetSerialModemState(int fd, int state) { int ret; int s; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; #ifndef TIOCMGET return -1; #else if (!osStateMask) osStateMask = getOsStateMask(); state = xf2osState(state); SYSCALL((ret = ioctl(fd, TIOCMGET, &s))); if (ret < 0) return -1; s &= ~osStateMask; s |= state; SYSCALL((ret = ioctl(fd, TIOCMSET, &s))); if (ret < 0) return -1; else return 0; #endif } int xf86GetSerialModemState(int fd) { int ret; int s; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; #ifndef TIOCMGET return -1; #else SYSCALL((ret = ioctl(fd, TIOCMGET, &s))); if (ret < 0) return -1; return os2xfState(s); #endif } int xf86SerialModemSetBits(int fd, int bits) { int ret; int s; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; #ifndef TIOCMGET return -1; #else s = xf2osState(bits); SYSCALL((ret = ioctl(fd, TIOCMBIS, &s))); return ret; #endif } int xf86SerialModemClearBits(int fd, int bits) { int ret; int s; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; #ifndef TIOCMGET return -1; #else s = xf2osState(bits); SYSCALL((ret = ioctl(fd, TIOCMBIC, &s))); return ret; #endif } xorg-server-1.20.8/hw/xfree86/os-support/shared/VTsw_noop.c0000644000175000017500000000306413640201473020421 00000000000000/* * Copyright 1993 by David Wexelblat * * 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 David Wexelblat not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. David Wexelblat makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" /* * No-op functions for OSs without VTs */ Bool xf86VTSwitchPending(void) { return FALSE; } Bool xf86VTSwitchAway(void) { return FALSE; } Bool xf86VTSwitchTo(void) { return TRUE; } Bool xf86VTActivate(int vtno) { return TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/shared/vidmem.c0000644000175000017500000000361413640201473017745 00000000000000/* * Copyright (c) 1993-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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "input.h" #include "scrnintstr.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" /* * This file contains the common part of the video memory mapping functions */ static VidMemInfo vidMemInfo = { FALSE, }; void xf86InitVidMem(void) { if (!vidMemInfo.initialised) { memset(&vidMemInfo, 0, sizeof(VidMemInfo)); xf86OSInitVidMem(&vidMemInfo); } } xorg-server-1.20.8/hw/xfree86/os-support/shared/pm_noop.c0000644000175000017500000000327213640201473020133 00000000000000/* * Copyright (c) 2000 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). */ /* Stubs for the OS-support layer power-management functions. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" PMClose xf86OSPMOpen(void) { return NULL; } xorg-server-1.20.8/hw/xfree86/os-support/shared/sigio.c0000644000175000017500000002131313640201473017572 00000000000000/* sigio.c -- Support for SIGIO handler installation and removal * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: Rickard E. (Rik) Faith */ /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "inputstr.h" #ifdef HAVE_STROPTS_H #include #endif #ifdef MAXDEVICES /* MAXDEVICES represents the maximimum number of input devices usable * at the same time plus one entry for DRM support. */ #define MAX_FUNCS (MAXDEVICES + 1) #else #define MAX_FUNCS 16 #endif typedef struct _xf86SigIOFunc { void (*f) (int, void *); int fd; void *closure; } Xf86SigIOFunc; static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS]; static int xf86SigIOMax; static struct pollfd *xf86SigIOFds; static int xf86SigIONum; static Bool xf86SigIOAdd(int fd) { struct pollfd *n; n = realloc(xf86SigIOFds, (xf86SigIONum + 1) * sizeof (struct pollfd)); if (!n) return FALSE; n[xf86SigIONum].fd = fd; n[xf86SigIONum].events = POLLIN; xf86SigIONum++; xf86SigIOFds = n; return TRUE; } static void xf86SigIORemove(int fd) { int i; for (i = 0; i < xf86SigIONum; i++) if (xf86SigIOFds[i].fd == fd) { memmove(&xf86SigIOFds[i], &xf86SigIOFds[i+1], (xf86SigIONum - i - 1) * sizeof (struct pollfd)); xf86SigIONum--; break; } } /* * SIGIO gives no way of discovering which fd signalled, select * to discover */ static void xf86SIGIO(int sig) { int i, f; int save_errno = errno; /* do not clobber the global errno */ int r; inSignalContext = TRUE; SYSCALL(r = xserver_poll(xf86SigIOFds, xf86SigIONum, 0)); for (f = 0; r > 0 && f < xf86SigIONum; f++) { if (xf86SigIOFds[f].revents & POLLIN) { for (i = 0; i < xf86SigIOMax; i++) if (xf86SigIOFuncs[i].f && xf86SigIOFuncs[i].fd == xf86SigIOFds[f].fd) (*xf86SigIOFuncs[i].f) (xf86SigIOFuncs[i].fd, xf86SigIOFuncs[i].closure); r--; } } if (r > 0) { xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r); } /* restore global errno */ errno = save_errno; inSignalContext = FALSE; } static int xf86IsPipe(int fd) { struct stat buf; if (fstat(fd, &buf) < 0) return 0; return S_ISFIFO(buf.st_mode); } static void block_sigio(void) { sigset_t set; sigemptyset(&set); sigaddset(&set, SIGIO); xthread_sigmask(SIG_BLOCK, &set, NULL); } static void release_sigio(void) { sigset_t set; sigemptyset(&set); sigaddset(&set, SIGIO); xthread_sigmask(SIG_UNBLOCK, &set, NULL); } int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) { struct sigaction sa; struct sigaction osa; int i; int installed = FALSE; if (!xf86Info.useSIGIO) return 0; for (i = 0; i < MAX_FUNCS; i++) { if (!xf86SigIOFuncs[i].f) { if (xf86IsPipe(fd)) return 0; block_sigio(); #ifdef O_ASYNC if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", fd, strerror(errno)); } else { if (fcntl(fd, F_SETOWN, getpid()) == -1) { xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", fd, strerror(errno)); } else { installed = TRUE; } } #endif #if defined(I_SETSIG) && defined(HAVE_ISASTREAM) /* System V Streams - used on Solaris for input devices */ if (!installed && isastream(fd)) { if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) { xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n", fd, strerror(errno)); } else { installed = TRUE; } } #endif if (!installed) { release_sigio(); return 0; } sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask, SIGIO); sa.sa_flags = SA_RESTART; sa.sa_handler = xf86SIGIO; sigaction(SIGIO, &sa, &osa); xf86SigIOFuncs[i].fd = fd; xf86SigIOFuncs[i].closure = closure; xf86SigIOFuncs[i].f = f; if (i >= xf86SigIOMax) xf86SigIOMax = i + 1; xf86SigIOAdd(fd); release_sigio(); return 1; } /* Allow overwriting of the closure and callback */ else if (xf86SigIOFuncs[i].fd == fd) { xf86SigIOFuncs[i].closure = closure; xf86SigIOFuncs[i].f = f; return 1; } } return 0; } int xf86RemoveSIGIOHandler(int fd) { struct sigaction sa; struct sigaction osa; int i; int max; int ret; if (!xf86Info.useSIGIO) return 0; max = 0; ret = 0; for (i = 0; i < MAX_FUNCS; i++) { if (xf86SigIOFuncs[i].f) { if (xf86SigIOFuncs[i].fd == fd) { xf86SigIOFuncs[i].f = 0; xf86SigIOFuncs[i].fd = 0; xf86SigIOFuncs[i].closure = 0; xf86SigIORemove(fd); ret = 1; } else { max = i + 1; } } } if (ret) { #ifdef O_ASYNC fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC); #endif #if defined(I_SETSIG) && defined(HAVE_ISASTREAM) if (isastream(fd)) { if (ioctl(fd, I_SETSIG, 0) == -1) { xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n", fd, strerror(errno)); } } #endif xf86SigIOMax = max; if (!max) { sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask, SIGIO); sa.sa_flags = 0; sa.sa_handler = SIG_IGN; sigaction(SIGIO, &sa, &osa); } } return ret; } xorg-server-1.20.8/hw/xfree86/os-support/shared/VTsw_usl.c0000644000175000017500000000444413640201473020254 00000000000000/* * Copyright 1993 by David Wexelblat * * 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 David Wexelblat not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. David Wexelblat makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" /* * Handle the VT-switching interface for OSs that use USL-style ioctl()s * (the sysv, sco, and linux subdirs). */ /* * This function is the signal handler for the VT-switching signal. It * is only referenced inside the OS-support layer. */ void xf86VTRequest(int sig) { OsSignal(sig, (void (*)(int)) xf86VTRequest); xf86Info.vtRequestsPending = TRUE; return; } Bool xf86VTSwitchPending(void) { return xf86Info.vtRequestsPending ? TRUE : FALSE; } Bool xf86VTSwitchAway(void) { xf86Info.vtRequestsPending = FALSE; if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) return FALSE; else return TRUE; } Bool xf86VTSwitchTo(void) { xf86Info.vtRequestsPending = FALSE; if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) return FALSE; else return TRUE; } Bool xf86VTActivate(int vtno) { #ifdef VT_ACTIVATE if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { return FALSE; } #endif return TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/xf86OSpriv.h0000644000175000017500000000324013640201473017154 00000000000000/* * Copyright (c) 1999-2000 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _XF86OSPRIV_H #define _XF86OSPRIV_H typedef struct { Bool initialised; } VidMemInfo, *VidMemInfoPtr; void xf86OSInitVidMem(VidMemInfoPtr); #endif /* _XF86OSPRIV_H */ xorg-server-1.20.8/hw/xfree86/os-support/misc/0000755000175000017500000000000013640201534016057 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/misc/Makefile.am0000644000175000017500000000030513640201473020033 00000000000000 noinst_LTLIBRARIES = libmisc.la libmisc_la_SOURCES = SlowBcopy.c #AM_LDFLAGS = -r AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) xorg-server-1.20.8/hw/xfree86/os-support/misc/Makefile.in0000644000175000017500000006353213640201513020052 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/os-support/misc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmisc_la_LIBADD = am_libmisc_la_OBJECTS = SlowBcopy.lo libmisc_la_OBJECTS = $(am_libmisc_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/SlowBcopy.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmisc_la_SOURCES) DIST_SOURCES = $(libmisc_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libmisc.la libmisc_la_SOURCES = SlowBcopy.c #AM_LDFLAGS = -r AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/misc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/misc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libmisc.la: $(libmisc_la_OBJECTS) $(libmisc_la_DEPENDENCIES) $(EXTRA_libmisc_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libmisc_la_OBJECTS) $(libmisc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SlowBcopy.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/SlowBcopy.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/SlowBcopy.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/misc/SlowBcopy.c0000644000175000017500000000464413640201473020076 00000000000000/******************************************************************************* for Alpha Linux *******************************************************************************/ /* * Create a dependency that should be immune from the effect of register * renaming as is commonly seen in superscalar processors. This should * insert a minimum of 100-ns delays between reads/writes at clock rates * up to 100 MHz---GGL * * Slowbcopy(char *src, char *dst, int count) * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "compiler.h" static int really_slow_bcopy; void xf86SetReallySlowBcopy(void) { really_slow_bcopy = 1; } #if defined(__i386__) || defined(__amd64__) static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len) { while (len--) { *dst++ = *src++; outb(0x80, 0x00); } } #endif /* The outb() isn't needed on my machine, but who knows ... -- ost */ void xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) { #if defined(__i386__) || defined(__amd64__) if (really_slow_bcopy) { xf86_really_slow_bcopy(src, dst, len); return; } #endif while (len--) *dst++ = *src++; } #ifdef __alpha__ #ifdef __linux__ unsigned long _bus_base(void); #define useSparse() (!_bus_base()) #define SPARSE (7) #else #define useSparse() 0 #define SPARSE 0 #endif void xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count) { if (useSparse()) { unsigned long addr; long result; addr = (unsigned long) src; while (count) { result = *(volatile int *) addr; result >>= ((addr >> SPARSE) & 3) * 8; *dst++ = (unsigned char) (0xffUL & result); addr += 1 << SPARSE; count--; outb(0x80, 0x00); } } else xf86SlowBcopy(src, dst, count); } void xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count) { if (useSparse()) { unsigned long addr; addr = (unsigned long) dst; while (count) { *(volatile unsigned int *) addr = (unsigned short) (*src) * 0x01010101; src++; addr += 1 << SPARSE; count--; outb(0x80, 0x00); } } else xf86SlowBcopy(src, dst, count); } #endif xorg-server-1.20.8/hw/xfree86/os-support/Makefile.in0000644000175000017500000007566713640201513017133 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/os-support ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libxorgos_la_DEPENDENCIES = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \ bus/libbus.la misc/libmisc.la am_libxorgos_la_OBJECTS = libxorgos_la_OBJECTS = $(am_libxorgos_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libxorgos_la_SOURCES) DIST_SOURCES = $(libxorgos_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) DIST_SUBDIRS = bsd bus misc linux solaris stub hurd sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h EXTRA_DIST = int10Defines.h xf86OSpriv.h # to get the grouping semantics right, you have to glom these three together # as one library, otherwise libtool will actively defeat your attempts to # list them multiple times on the link line. noinst_LTLIBRARIES = libxorgos.la libxorgos_la_SOURCES = libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \ bus/libbus.la \ misc/libmisc.la AM_CFLAGS = $(DIX_CFLAGS) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libxorgos.la: $(libxorgos_la_OBJECTS) $(libxorgos_la_DEPENDENCIES) $(EXTRA_libxorgos_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libxorgos_la_OBJECTS) $(libxorgos_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-sdkHEADERS install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/xf86_OSlib.h0000644000175000017500000002676313640201473017120 00000000000000/* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes * Copyright 1992 by Jim Tsillas * Copyright 1992 by Rich Murphey * Copyright 1992 by Robert Baron * Copyright 1992 by Orest Zborowski * Copyright 1993 by Vrije Universiteit, The Netherlands * Copyright 1993 by David Wexelblat * Copyright 1994, 1996 by Holger Veit * Copyright 1997 by Takis Psarogiannakopoulos * Copyright 1994-2003 by The XFree86 Project, Inc * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holders * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holders make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* * The ARM32 code here carries the following copyright: * * Copyright 1997 * Digital Equipment Corporation. All rights reserved. * This software is furnished under license and may be used and copied only in * accordance with the following terms and conditions. Subject to these * conditions, you may download, copy, install, use, modify and distribute * this software in source and/or binary form. No title or ownership is * transferred hereby. * * 1) Any source code used, modified or distributed must reproduce and retain * this copyright notice and list of conditions as they appear in the * source file. * * 2) No right is granted to use any trade name, trademark, or logo of Digital * Equipment Corporation. Neither the "Digital Equipment Corporation" * name nor any trademark or logo of Digital Equipment Corporation may be * used to endorse or promote products derived from this software without * the prior written permission of Digital Equipment Corporation. * * 3) This software is provided "AS-IS" and any express or implied warranties, * including but not limited to, any implied warranties of merchantability, * fitness for a particular purpose, or non-infringement are disclaimed. * In no event shall DIGITAL be liable for any damages whatsoever, and in * particular, DIGITAL shall not be liable for special, indirect, * consequential, or incidental damages or damages for lost profits, loss * of revenue or loss of use, whether such damages arise in contract, * negligence, tort, under statute, in equity, at law or otherwise, even * if advised of the possibility of such damage. * */ /* * This is private, and should not be included by any drivers. Drivers * may include xf86_OSproc.h to get prototypes for public interfaces. */ #ifndef _XF86_OSLIB_H #define _XF86_OSLIB_H #include #include #include #include #include /**************************************************************************/ /* SYSV386 (SVR3, SVR4), including Solaris */ /**************************************************************************/ #if (defined(SYSV) || defined(SVR4)) && \ (defined(__sun) || defined(__i386__)) #include #include #include #include #include #include #if defined(_NEED_SYSI86) #if !(defined (__sun) && defined (SVR4)) #include #include #include #endif #include #include #if defined(SVR4) && !defined(__sun) #include #endif /* SVR4 && !__sun */ /* V86SC_IOPL was moved to on Solaris 7 and later */ #if !defined(V86SC_IOPL) /* Solaris 7 or later? */ #include /* Nope */ #endif #if defined(__sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4) #include #endif #endif /* _NEED_SYSI86 */ #if defined(HAS_SVR3_MMAPDRV) #include #if !defined(_NEED_SYSI86) #include #include #endif #include /* MMAP driver header */ #endif #if !defined(__sun) || defined(HAVE_SYS_VT_H) #define HAS_USL_VTS #endif #if !defined(__sun) #include #endif #if defined(HAS_USL_VTS) #if !defined(__sun) #include #endif #include #include extern _X_HIDDEN void xf86VTAcquire(int); extern _X_HIDDEN void xf86VTRelease(int); #endif #if defined(__sun) #include extern _X_HIDDEN char xf86SolarisFbDev[PATH_MAX]; #include #include /* undefine symbols from we don't need that conflict with enum definitions in parser/xf86tokens.h */ #undef STRING #undef LEFTALT #undef RIGHTALT #define LED_CAP LED_CAPS_LOCK #define LED_NUM LED_NUM_LOCK #define LED_SCR LED_SCROLL_LOCK #define LED_COMP LED_COMPOSE #endif /* __sun */ #if !defined(VT_ACKACQ) #define VT_ACKACQ 2 #endif /* !VT_ACKACQ */ #if defined(SVR4) #include #if !(defined(__sun) && defined (SVR4)) #define DEV_MEM "/dev/pmem" #endif #define CLEARDTR_SUPPORT #define POSIX_TTY #endif /* SVR4 */ #endif /* (SYSV || SVR4) */ /**************************************************************************/ /* Linux or Glibc-based system */ /**************************************************************************/ #if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__) #include #include #include #include #include #include #ifdef __sparc__ #include #endif #include #include #include #ifdef __linux__ #define HAS_USL_VTS #include #include #define LDGMAP GIO_SCRNMAP #define LDSMAP PIO_SCRNMAP #define LDNMAP LDSMAP #define CLEARDTR_SUPPORT #endif #define POSIX_TTY #endif /* __linux__ || __GLIBC__ */ /**************************************************************************/ /* System is BSD-like */ /**************************************************************************/ #ifdef CSRG_BASED #include #include #include #define termio termios #define POSIX_TTY #include #include #include #include #endif /* CSRG_BASED */ /**************************************************************************/ /* Kernel of *BSD */ /**************************************************************************/ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include #if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version) #define __FreeBSD_kernel_version __FreeBSD_version #endif #ifdef SYSCONS_SUPPORT #define COMPAT_SYSCONS #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000) #include #include #else #include #endif /* FreeBSD 4.1 RELEASE or lator */ #else #include #endif #endif /* SYSCONS_SUPPORT */ #if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__) #if !defined(SYSCONS_SUPPORT) /* no syscons, so include pcvt specific header file */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #else #include #endif /* __FreeBSD_kernel__ */ #else /* pcvt and syscons: hard-code the ID magic */ #define VGAPCVTID _IOWR('V',113, struct pcvtid) struct pcvtid { char name[16]; int rmajor, rminor; }; #endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */ #endif /* PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT #include #include #endif /* WSCONS_SUPPORT */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #include #endif /* Include these definitions in case ioctl_pc.h didn't get included */ #ifndef CONSOLE_X_MODE_ON #define CONSOLE_X_MODE_ON _IO('t',121) #endif #ifndef CONSOLE_X_MODE_OFF #define CONSOLE_X_MODE_OFF _IO('t',122) #endif #ifndef CONSOLE_X_BELL #define CONSOLE_X_BELL _IOW('t',123,int[2]) #endif #ifndef CONSOLE_X_TV_ON #define CONSOLE_X_TV_ON _IOW('t',155,int) #define XMODE_RGB 0 #define XMODE_NTSC 1 #define XMODE_PAL 2 #define XMODE_SECAM 3 #endif #ifndef CONSOLE_X_TV_OFF #define CONSOLE_X_TV_OFF _IO('t',156) #endif #ifndef CONSOLE_GET_LINEAR_INFO #define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info) #endif #ifndef CONSOLE_GET_IO_INFO #define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info) #endif #ifndef CONSOLE_GET_MEM_INFO #define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info) #endif #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) #include #endif #define CLEARDTR_SUPPORT #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ /**************************************************************************/ /* IRIX */ /**************************************************************************/ /**************************************************************************/ /* Generic */ /**************************************************************************/ #include /* May need to adjust this for other OSs */ /* For PATH_MAX */ #include "misc.h" /* * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere, * and it's safe, so just do it. */ #if !defined(O_NDELAY) && defined(O_NONBLOCK) #define O_NDELAY O_NONBLOCK #endif /* !O_NDELAY && O_NONBLOCK */ #if !defined(MAXHOSTNAMELEN) #define MAXHOSTNAMELEN 32 #endif /* !MAXHOSTNAMELEN */ #include #ifndef DEV_MEM #define DEV_MEM "/dev/mem" #endif #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) #endif #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) #define XF86_OS_PRIVS #include "xf86_OSproc.h" #endif /* _XF86_OSLIB_H */ xorg-server-1.20.8/hw/xfree86/os-support/solaris/0000755000175000017500000000000013640201534016600 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_agp.c0000644000175000017500000002136013640201473020324 00000000000000/* * Abstraction of the AGP GART interface. * * This version is for Solaris. * * Copyright © 2000 VA Linux Systems, Inc. * Copyright © 2001 The XFree86 Project, Inc. */ /* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86_OSproc.h" #include #include #include #include #include /* AGP page size is independent of the host page size. */ #ifndef AGP_PAGE_SIZE #define AGP_PAGE_SIZE 4096 #endif static int gartFd = -1; static int acquiredScreen = -1; static Bool initDone = FALSE; /* * Close /dev/agpgart. This frees all associated memory allocated during * this server generation. */ Bool xf86GARTCloseScreen(int screenNum) { if (gartFd != -1) { close(gartFd); acquiredScreen = -1; gartFd = -1; initDone = FALSE; xf86DrvMsg(screenNum, X_INFO, "xf86GARTCloseScreen: device closed successfully\n"); } return TRUE; } /* * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called. */ static Bool GARTInit(int screenNum) { if (initDone) return gartFd != -1; if (gartFd == -1) gartFd = open(AGP_DEVICE, O_RDWR); else return FALSE; if (gartFd == -1) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: Unable to open " AGP_DEVICE " (%s)\n", strerror(errno)); return FALSE; } initDone = TRUE; xf86DrvMsg(screenNum, X_INFO, "GARTInit: " AGP_DEVICE " opened successfully\n"); return TRUE; } Bool xf86AgpGARTSupported(void) { return (GARTInit(-1)); } AgpInfoPtr xf86GetAGPInfo(int screenNum) { agp_info_t agpinf; AgpInfoPtr info; if (!GARTInit(screenNum)) return NULL; if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n", strerror(errno)); return NULL; } if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); return NULL; } info->bridgeId = agpinf.agpi_devid; info->agpMode = agpinf.agpi_mode; info->base = agpinf.agpi_aperbase; info->size = agpinf.agpi_apersize; info->totalPages = (unsigned long) agpinf.agpi_pgtotal; info->systemPages = (unsigned long) agpinf.agpi_pgsystem; info->usedPages = (unsigned long) agpinf.agpi_pgused; return info; } Bool xf86AcquireGART(int screenNum) { if (!GARTInit(screenNum)) return FALSE; if (acquiredScreen != screenNum) { if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n", strerror(errno)); return FALSE; } acquiredScreen = screenNum; xf86DrvMsg(screenNum, X_INFO, "xf86AcquireGART: AGPIOC_ACQUIRE succeeded\n"); } return TRUE; } Bool xf86ReleaseGART(int screenNum) { if (!GARTInit(screenNum)) return FALSE; if (acquiredScreen == screenNum) { /* * The FreeBSD agp driver removes allocations on release. * The Solaris driver doesn't. xf86ReleaseGART() is expected * to give up access to the GART, but not to remove any * allocations. */ if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n", strerror(errno)); return FALSE; } acquiredScreen = -1; xf86DrvMsg(screenNum, X_INFO, "xf86ReleaseGART: AGPIOC_RELEASE succeeded\n"); return TRUE; } return FALSE; } int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, unsigned long *physical) { agp_allocate_t alloc; int pages; /* * Allocates "size" bytes of GART memory (rounds up to the next * page multiple) or type "type". A handle (key) for the allocated * memory is returned. On error, the return value is -1. * "size" should be larger than 0, or AGPIOC_ALLOCATE ioctl will * return error. */ if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) return -1; pages = (size / AGP_PAGE_SIZE); if (size % AGP_PAGE_SIZE != 0) pages++; alloc.agpa_pgcount = pages; alloc.agpa_type = type; if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: " "allocation of %d pages failed\n\t(%s)\n", pages, strerror(errno)); return -1; } if (physical) *physical = (unsigned long) alloc.agpa_physical; return alloc.agpa_key; } Bool xf86DeallocateGARTMemory(int screenNum, int key) { if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) return FALSE; if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *) (uintptr_t) key) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: " "deallocation of gart memory with key %d failed\n" "\t(%s)\n", key, strerror(errno)); return FALSE; } return TRUE; } /* Bind GART memory with "key" at "offset" */ Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset) { agp_bind_t bind; int pageOffset; if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) return FALSE; if (offset % AGP_PAGE_SIZE != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " "offset (0x%lx) is not page-aligned (%d)\n", offset, AGP_PAGE_SIZE); return FALSE; } pageOffset = offset / AGP_PAGE_SIZE; xf86DrvMsgVerb(screenNum, X_INFO, 3, "xf86BindGARTMemory: bind key %d at 0x%08lx " "(pgoffset %d)\n", key, offset, pageOffset); bind.agpb_pgstart = pageOffset; bind.agpb_key = key; if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " "binding of gart memory with key %d\n" "\tat offset 0x%lx failed (%s)\n", key, offset, strerror(errno)); return FALSE; } return TRUE; } /* Unbind GART memory with "key" */ Bool xf86UnbindGARTMemory(int screenNum, int key) { agp_unbind_t unbind; if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) return FALSE; unbind.agpu_pri = 0; unbind.agpu_key = key; if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: " "unbinding of gart memory with key %d " "failed (%s)\n", key, strerror(errno)); return FALSE; } xf86DrvMsgVerb(screenNum, X_INFO, 3, "xf86UnbindGARTMemory: unbind key %d\n", key); return TRUE; } /* XXX Interface may change. */ Bool xf86EnableAGP(int screenNum, CARD32 mode) { agp_setup_t setup; if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) return FALSE; setup.agps_mode = mode; if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: " "AGPIOC_SETUP with mode %x failed (%s)\n", (unsigned int) mode, strerror(errno)); return FALSE; } return TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_VTsw.c0000644000175000017500000000621013640201473020455 00000000000000/* * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include #include /* * Handle the VT-switching interface for Solaris/OpenSolaris */ static int xf86VTPruneDoor = 0; void xf86VTRelease(int sig) { if (xf86Info.vtPendingNum == -1) { xf86VTPruneDoor = 1; xf86Info.vtRequestsPending = TRUE; return; } ioctl(xf86Info.consoleFd, VT_RELDISP, 1); xf86Info.vtPendingNum = -1; return; } void xf86VTAcquire(int sig) { xf86Info.vtRequestsPending = TRUE; return; } Bool xf86VTSwitchPending(void) { return xf86Info.vtRequestsPending ? TRUE : FALSE; } Bool xf86VTSwitchAway(void) { int door_fd; vt_cmd_arg_t vt_door_arg; door_arg_t door_arg; xf86Info.vtRequestsPending = FALSE; if (xf86VTPruneDoor) { xf86VTPruneDoor = 0; ioctl(xf86Info.consoleFd, VT_RELDISP, 1); return TRUE; } vt_door_arg.vt_ev = VT_EV_HOTKEYS; vt_door_arg.vt_num = xf86Info.vtPendingNum; door_arg.data_ptr = (char *) &vt_door_arg; door_arg.data_size = sizeof(vt_cmd_arg_t); door_arg.rbuf = NULL; door_arg.rsize = 0; door_arg.desc_ptr = NULL; door_arg.desc_num = 0; if ((door_fd = open(VT_DAEMON_DOOR_FILE, O_RDONLY)) < 0) return FALSE; if (door_call(door_fd, &door_arg) != 0) { close(door_fd); return FALSE; } close(door_fd); return TRUE; } Bool xf86VTSwitchTo(void) { xf86Info.vtRequestsPending = FALSE; if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) { return FALSE; } else { return TRUE; } } Bool xf86VTActivate(int vtno) { struct vt_stat state; if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0) return FALSE; if ((state.v_state & (1 << vtno)) == 0) return FALSE; xf86Info.vtRequestsPending = TRUE; xf86Info.vtPendingNum = vtno; return TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/solaris/Makefile.am0000644000175000017500000000171013640201473020555 00000000000000if SOLARIS_VT VTSW_SRC = sun_VTsw.c else VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c endif if AGP AGP_SRC = sun_agp.c else AGP_SRC = $(srcdir)/../shared/agp_noop.c endif SOLARIS_INOUT_SRC = solaris-@SOLARIS_INOUT_ARCH@.S DISTCLEANFILES = solaris-@SOLARIS_INOUT_ARCH@.il solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S $(CPP) -P -DINLINE_ASM $(srcdir)/solaris-@SOLARIS_INOUT_ARCH@.S > $@ noinst_LTLIBRARIES = libsolaris.la libsolaris_la_SOURCES = sun_init.c \ sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c \ $(VTSW_SRC) nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC) sdk_HEADERS = nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S sun_inout.s xorg-server-1.20.8/hw/xfree86/os-support/solaris/solaris-amd64.S0000644000175000017500000000363013640201473021235 00000000000000/ Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. / / Permission is hereby granted, free of charge, to any person obtaining a / copy of this software and associated documentation files (the "Software"), / to deal in the Software without restriction, including without limitation / the rights to use, copy, modify, merge, publish, distribute, sublicense, / and/or sell copies of the Software, and to permit persons to whom the / Software is furnished to do so, subject to the following conditions: / / The above copyright notice and this permission notice (including the next / paragraph) shall be included in all copies or substantial portions of the / Software. / / THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR / IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, / FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL / 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 INLINE_ASM #define FUNCTION_START(f,n) .inline f,n #define FUNCTION_END(f) .end #else #define _ASM #include #define FUNCTION_START(f,n) ENTRY(f) #define FUNCTION_END(f) ret; SET_SIZE(f) #endif FUNCTION_START(inb,4) movq %rdi, %rdx xorq %rax, %rax inb (%dx) FUNCTION_END(inb) FUNCTION_START(inw,4) movq %rdi, %rdx xorq %rax, %rax inw (%dx) FUNCTION_END(inw) FUNCTION_START(inl,4) movq %rdi, %rdx xorq %rax, %rax inl (%dx) FUNCTION_END(inl) FUNCTION_START(outb,8) movq %rdi, %rdx movq %rsi, %rax outb (%dx) FUNCTION_END(outb) FUNCTION_START(outw,8) movq %rdi, %rdx movq %rsi, %rax outw (%dx) FUNCTION_END(outw) FUNCTION_START(outl,8) movq %rdi, %rdx movq %rsi, %rax outl (%dx) FUNCTION_END(outl) xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_inout.s0000644000175000017500000000603613640201473020736 00000000000000/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s,v 1.1 2001/05/28 02:42:31 tsi Exp $ / / Copyright 1994-2001 The XFree86 Project, 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 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 / XFREE86 PROJECT 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 XFree86 Project 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 / XFree86 Project. / / / File: sun_inout.s / / Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions / for Solaris x86 using the ProWorks compiler by SunPro / / Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) / Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) / / Synopsis: (c callable external declarations) / extern unsigned char inb(int port); / extern unsigned short inw(int port); / extern unsigned long inl(int port); / extern void outb(int port, unsigned char value); / extern void outw(int port, unsigned short value); / extern void outl(int port, unsigned long value); / .file "sunos_inout.s" .text .globl inb .globl inw .globl inl .globl outb .globl outw .globl outl / / unsigned char inb(int port); / .align 4 inb: movl 4(%esp),%edx subl %eax,%eax inb (%dx) ret .type inb,@function .size inb,.-inb / / unsigned short inw(int port); / .align 4 inw: movl 4(%esp),%edx subl %eax,%eax inw (%dx) ret .type inw,@function .size inw,.-inw / / unsigned long inl(int port); / .align 4 inl: movl 4(%esp),%edx inl (%dx) ret .type inl,@function .size inl,.-inl / / void outb(int port, unsigned char value); / .align 4 outb: movl 4(%esp),%edx movl 8(%esp),%eax outb (%dx) ret .type outb,@function .size outb,.-outb / / void outw(int port, unsigned short value); / .align 4 outw: movl 4(%esp),%edx movl 8(%esp),%eax outw (%dx) ret .type outw,@function .size outw,.-outw / / void outl(int port, unsigned long value); / .align 4 outl: movl 4(%esp),%edx movl 8(%esp),%eax outl (%dx) ret .type outl,@function .size outl,.-outl xorg-server-1.20.8/hw/xfree86/os-support/solaris/solaris-ia32.S0000644000175000017500000000365513640201473021067 00000000000000/ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. / / Permission is hereby granted, free of charge, to any person obtaining a / copy of this software and associated documentation files (the "Software"), / to deal in the Software without restriction, including without limitation / the rights to use, copy, modify, merge, publish, distribute, sublicense, / and/or sell copies of the Software, and to permit persons to whom the / Software is furnished to do so, subject to the following conditions: / / The above copyright notice and this permission notice (including the next / paragraph) shall be included in all copies or substantial portions of the / Software. / / THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR / IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, / FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL / 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 INLINE_ASM #define FUNCTION_START(f,n) .inline f,n #define FUNCTION_END(f) .end #else #define _ASM #include #define FUNCTION_START(f,n) ENTRY(f) #define FUNCTION_END(f) ret; SET_SIZE(f) #endif FUNCTION_START(inb,4) movl (%esp), %edx xorl %eax, %eax inb (%dx) FUNCTION_END(inb) FUNCTION_START(inw,4) movl (%esp), %edx xorl %eax, %eax inw (%dx) FUNCTION_END(inw) FUNCTION_START(inl,4) movl (%esp), %edx xorl %eax, %eax inl (%dx) FUNCTION_END(inl) FUNCTION_START(outb,8) movl (%esp), %edx movl 4(%esp), %eax outb (%dx) FUNCTION_END(outb) FUNCTION_START(outw,8) movl (%esp), %edx movl 4(%esp), %eax outw (%dx) FUNCTION_END(outw) FUNCTION_START(outl,8) movl (%esp), %edx movl 4(%esp), %eax outl (%dx) FUNCTION_END(outl) xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_bell.c0000644000175000017500000001322413640201473020473 00000000000000/* Copyright (c) 2004-2005, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #define BELL_RATE 48000 /* Samples per second */ #define BELL_HZ 50 /* Fraction of a second i.e. 1/x */ #define BELL_MS (1000/BELL_HZ) /* MS */ #define BELL_SAMPLES (BELL_RATE / BELL_HZ) #define BELL_MIN 3 /* Min # of repeats */ #define AUDIO_DEVICE "/dev/audio" void xf86OSRingBell(int loudness, int pitch, int duration) { static short samples[BELL_SAMPLES]; static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */ static int lastFreq; int cnt; int i; int written; int repeats; int freq; audio_info_t audioInfo; struct iovec iov[IOV_MAX]; int iovcnt; double ampl, cyclen, phase; int audioFD; if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) { return; } lastFreq = 0; memset(silence, 0, sizeof(silence)); audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK); if (audioFD == -1) { xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n", AUDIO_DEVICE, strerror(errno)); return; } freq = pitch; freq = min(freq, (BELL_RATE / 2) - 1); freq = max(freq, 2 * BELL_HZ); /* * Ensure full waves per buffer */ freq -= freq % BELL_HZ; if (freq != lastFreq) { lastFreq = freq; ampl = 16384.0; cyclen = (double) freq / (double) BELL_RATE; phase = 0.0; for (i = 0; i < BELL_SAMPLES; i++) { samples[i] = (short) (ampl * sin(2.0 * M_PI * phase)); phase += cyclen; if (phase >= 1.0) phase -= 1.0; } } repeats = (duration + (BELL_MS / 2)) / BELL_MS; repeats = max(repeats, BELL_MIN); loudness = max(0, loudness); loudness = min(loudness, 100); #ifdef DEBUG ErrorF("BELL : freq %d volume %d duration %d repeats %d\n", freq, loudness, duration, repeats); #endif AUDIO_INITINFO(&audioInfo); audioInfo.play.encoding = AUDIO_ENCODING_LINEAR; audioInfo.play.sample_rate = BELL_RATE; audioInfo.play.channels = 2; audioInfo.play.precision = 16; audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100); if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0) { xf86Msg(X_ERROR, "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n", AUDIO_DEVICE, strerror(errno)); close(audioFD); return; } iovcnt = 0; for (cnt = 0; cnt <= repeats; cnt++) { if (cnt == repeats) { /* Insert a bit of silence so that multiple beeps are distinct and * not compressed into a single tone. */ iov[iovcnt].iov_base = (char *) silence; iov[iovcnt++].iov_len = sizeof(silence); } else { iov[iovcnt].iov_base = (char *) samples; iov[iovcnt++].iov_len = sizeof(samples); } if ((iovcnt >= IOV_MAX) || (cnt == repeats)) { written = writev(audioFD, iov, iovcnt); if ((written < ((int) (sizeof(samples) * iovcnt)))) { /* audio buffer was full! */ int naptime; if (written == -1) { if (errno != EAGAIN) { xf86Msg(X_ERROR, "Bell: writev failed on audio device \"%s\": %s\n", AUDIO_DEVICE, strerror(errno)); close(audioFD); return; } i = iovcnt; } else { i = ((sizeof(samples) * iovcnt) - written) / sizeof(samples); } cnt -= i; /* sleep a little to allow audio buffer to drain */ naptime = BELL_MS * i; xserver_poll(NULL, 0, naptime); i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples); iovcnt = 0; if ((written != -1) && (i > 0)) { iov[iovcnt].iov_base = ((char *) samples) + i; iov[iovcnt++].iov_len = sizeof(samples) - i; } } else { iovcnt = 0; } } } close(audioFD); return; } xorg-server-1.20.8/hw/xfree86/os-support/solaris/Makefile.in0000644000175000017500000012152013640201513020563 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/os-support/solaris ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libsolaris_la_LIBADD = am__libsolaris_la_SOURCES_DIST = sun_init.c sun_vid.c sun_bell.c \ $(srcdir)/../shared/agp_noop.c sun_agp.c sun_apm.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c $(srcdir)/../shared/VTsw_noop.c \ sun_VTsw.c @AGP_FALSE@am__objects_1 = agp_noop.lo @AGP_TRUE@am__objects_1 = sun_agp.lo @SOLARIS_VT_FALSE@am__objects_2 = VTsw_noop.lo @SOLARIS_VT_TRUE@am__objects_2 = sun_VTsw.lo am_libsolaris_la_OBJECTS = sun_init.lo sun_vid.lo sun_bell.lo \ $(am__objects_1) sun_apm.lo kmod_noop.lo posix_tty.lo sigio.lo \ vidmem.lo $(am__objects_2) am__objects_3 = solaris-@SOLARIS_INOUT_ARCH@.lo nodist_libsolaris_la_OBJECTS = $(am__objects_3) libsolaris_la_OBJECTS = $(am_libsolaris_la_OBJECTS) \ $(nodist_libsolaris_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/VTsw_noop.Plo \ ./$(DEPDIR)/agp_noop.Plo ./$(DEPDIR)/kmod_noop.Plo \ ./$(DEPDIR)/posix_tty.Plo ./$(DEPDIR)/sigio.Plo \ ./$(DEPDIR)/solaris-@SOLARIS_INOUT_ARCH@.Plo \ ./$(DEPDIR)/sun_VTsw.Plo ./$(DEPDIR)/sun_agp.Plo \ ./$(DEPDIR)/sun_apm.Plo ./$(DEPDIR)/sun_bell.Plo \ ./$(DEPDIR)/sun_init.Plo ./$(DEPDIR)/sun_vid.Plo \ ./$(DEPDIR)/vidmem.Plo am__mv = mv -f CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CCASFLAGS) $(CCASFLAGS) AM_V_CPPAS = $(am__v_CPPAS_@AM_V@) am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@) am__v_CPPAS_0 = @echo " CPPAS " $@; am__v_CPPAS_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libsolaris_la_SOURCES) $(nodist_libsolaris_la_SOURCES) DIST_SOURCES = $(am__libsolaris_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" "$(DESTDIR)$(sdkdir)" HEADERS = $(nodist_sdk_HEADERS) $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @SOLARIS_VT_FALSE@VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c @SOLARIS_VT_TRUE@VTSW_SRC = sun_VTsw.c @AGP_FALSE@AGP_SRC = $(srcdir)/../shared/agp_noop.c @AGP_TRUE@AGP_SRC = sun_agp.c SOLARIS_INOUT_SRC = solaris-@SOLARIS_INOUT_ARCH@.S DISTCLEANFILES = solaris-@SOLARIS_INOUT_ARCH@.il noinst_LTLIBRARIES = libsolaris.la libsolaris_la_SOURCES = sun_init.c \ sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c \ $(VTSW_SRC) nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC) sdk_HEADERS = nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S sun_inout.s all: all-am .SUFFIXES: .SUFFIXES: .S .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/solaris/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/solaris/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libsolaris.la: $(libsolaris_la_OBJECTS) $(libsolaris_la_DEPENDENCIES) $(EXTRA_libsolaris_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libsolaris_la_OBJECTS) $(libsolaris_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solaris-@SOLARIS_INOUT_ARCH@.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_VTsw.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_agp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_apm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_bell.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_vid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .S.o: @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(CPPASCOMPILE) -c -o $@ $< .S.obj: @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .S.lo: @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LTCPPASCOMPILE) -c -o $@ $< .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< agp_noop.lo: $(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT agp_noop.lo -MD -MP -MF $(DEPDIR)/agp_noop.Tpo -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/agp_noop.Tpo $(DEPDIR)/agp_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/agp_noop.c' object='agp_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c posix_tty.lo: $(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c sigio.lo: $(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigio.lo -MD -MP -MF $(DEPDIR)/sigio.Tpo -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sigio.Tpo $(DEPDIR)/sigio.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/sigio.c' object='sigio.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c vidmem.lo: $(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c VTsw_noop.lo: $(srcdir)/../shared/VTsw_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_noop.lo -MD -MP -MF $(DEPDIR)/VTsw_noop.Tpo -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/VTsw_noop.Tpo $(DEPDIR)/VTsw_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/VTsw_noop.c' object='VTsw_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nodist_sdkHEADERS: $(nodist_sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-nodist_sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/VTsw_noop.Plo -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/solaris-@SOLARIS_INOUT_ARCH@.Plo -rm -f ./$(DEPDIR)/sun_VTsw.Plo -rm -f ./$(DEPDIR)/sun_agp.Plo -rm -f ./$(DEPDIR)/sun_apm.Plo -rm -f ./$(DEPDIR)/sun_bell.Plo -rm -f ./$(DEPDIR)/sun_init.Plo -rm -f ./$(DEPDIR)/sun_vid.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nodist_sdkHEADERS install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/VTsw_noop.Plo -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/solaris-@SOLARIS_INOUT_ARCH@.Plo -rm -f ./$(DEPDIR)/sun_VTsw.Plo -rm -f ./$(DEPDIR)/sun_agp.Plo -rm -f ./$(DEPDIR)/sun_apm.Plo -rm -f ./$(DEPDIR)/sun_bell.Plo -rm -f ./$(DEPDIR)/sun_init.Plo -rm -f ./$(DEPDIR)/sun_vid.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nodist_sdkHEADERS uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man \ install-nodist_sdkHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-nodist_sdkHEADERS uninstall-sdkHEADERS .PRECIOUS: Makefile solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S $(CPP) -P -DINLINE_ASM $(srcdir)/solaris-@SOLARIS_INOUT_ARCH@.S > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_vid.c0000644000175000017500000000770613640201473020347 00000000000000/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Wexelblat * Copyright 1999 by David Holland * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the names of the 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. * */ /* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include /* get __x86 definition if not set by compiler */ #if defined(__i386__) || defined(__i386) || defined(__x86) #define _NEED_SYSI86 #endif #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" #include /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ _X_HIDDEN void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; } /***************************************************************************/ /* I/O Permissions section */ /***************************************************************************/ void xf86OSInputThreadInit(void) { /* * Need to enable in input thread as well, as Solaris kernel tracks * IOPL per-thread and doesn't inherit when creating a new thread. */ xf86EnableIO(); } Bool xf86EnableIO(void) { #if defined(__i386__) || defined(__i386) || defined(__x86) if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) { xf86Msg(X_WARNING, "xf86EnableIOPorts: Failed to set IOPL for I/O\n"); return FALSE; } #endif /* i386 */ return TRUE; } void xf86DisableIO(void) { #if defined(__i386__) || defined(__i386) || defined(__x86) sysi86(SI86V86, V86SC_IOPL, 0); #endif /* i386 */ } xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_apm.c0000644000175000017500000001573213640201473020340 00000000000000/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit * copyright notice, so is covered by the following notice: * * Copyright (C) 1994-2003 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project 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 * XFree86 Project. */ /* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #include "xf86_OSlib.h" #ifndef PLEASE_FIX_THIS #define APM_STANDBY_REQ 0xa01 #define APM_SUSPEND_REQ 0xa02 #define APM_NORMAL_RESUME 0xa03 #define APM_CRIT_RESUME 0xa04 #define APM_BATTERY_LOW 0xa05 #define APM_POWER_CHANGE 0xa06 #define APM_UPDATE_TIME 0xa07 #define APM_CRIT_SUSPEND_REQ 0xa08 #define APM_USER_STANDBY_REQ 0xa09 #define APM_USER_SUSPEND_REQ 0xa0a #define APM_SYS_STANDBY_RESUME 0xa0b #define APM_IOC_NEXTEVENT 0xa0c #define APM_IOC_RESUME 0xa0d #define APM_IOC_SUSPEND 0xa0e #define APM_IOC_STANDBY 0xa0f #endif typedef struct apm_event_info { int type; } apm_event_info; /* This may be replaced with a better device name very soon... */ #define APM_DEVICE "/dev/srn" #define APM_DEVICE1 "/dev/apm" static void *APMihPtr = NULL; static void sunCloseAPM(void); static struct { u_int apmBsd; pmEvent xf86; } sunToXF86Array[] = { {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; static pmEvent sunToXF86(int type) { int i; for (i = 0; i < ARRAY_SIZE(sunToXF86Array); i++) { if (type == sunToXF86Array[i].apmBsd) { return sunToXF86Array[i].xf86; } } return XF86_APM_UNKNOWN; } /* * APM events can be requested direclty from /dev/apm */ static int sunPMGetEventFromOS(int fd, pmEvent * events, int num) { struct apm_event_info sunEvent; int i; for (i = 0; i < num; i++) { if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) { if (errno != EAGAIN) { xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT" " %s\n", strerror(errno)); } break; } events[i] = sunToXF86(sunEvent.type); } xf86Msg(X_WARNING, "Got some events\n"); return i; } static pmWait sunPMConfirmEventToOs(int fd, pmEvent event) { switch (event) { /* XXX: NOT CURRENTLY RETURNED FROM OS */ case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: if (ioctl(fd, APM_IOC_STANDBY, NULL) == 0) return PM_WAIT; /* should we stop the Xserver in standby, too? */ else return PM_NONE; case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: xf86Msg(X_WARNING, "Got SUSPENDED\n"); if (ioctl(fd, APM_IOC_SUSPEND, NULL) == 0) return PM_CONTINUE; else { xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND" " %s\n", strerror(errno)); return PM_FAILED; } case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: case XF86_APM_STANDBY_FAILED: case XF86_APM_SUSPEND_FAILED: xf86Msg(X_WARNING, "Got RESUME\n"); if (ioctl(fd, APM_IOC_RESUME, NULL) == 0) return PM_CONTINUE; else { xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME" " %s\n", strerror(errno)); return PM_FAILED; } default: return PM_NONE; } } PMClose xf86OSPMOpen(void) { int fd; if (APMihPtr || !xf86Info.pmFlag) { return NULL; } if ((fd = open(APM_DEVICE, O_RDWR)) == -1) { if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) { return NULL; } } xf86PMGetEventFromOs = sunPMGetEventFromOS; xf86PMConfirmEventToOs = sunPMConfirmEventToOs; APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL); return sunCloseAPM; } static void sunCloseAPM(void) { int fd; if (APMihPtr) { fd = xf86RemoveGeneralHandler(APMihPtr); close(fd); APMihPtr = NULL; } } xorg-server-1.20.8/hw/xfree86/os-support/solaris/sun_init.c0000644000175000017500000002725213640201473020526 00000000000000/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Wexelblat * Copyright 1999 by David Holland * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the names of the 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, AND 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 #endif #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #ifdef HAVE_SYS_KD_H #include #endif /* * Applications see VT number as consecutive integers starting from 1. * VT number VT device * ------------------------------------------------------- * 1 : /dev/vt/0 (Alt + Ctrl + F1) * 2 : /dev/vt/2 (Alt + Ctrl + F2) * 3 : /dev/vt/3 (Alt + Ctrl + F3) * ... ... */ #define CONSOLE_VTNO 1 #define SOL_CONSOLE_DEV "/dev/console" static Bool KeepTty = FALSE; static Bool UseConsole = FALSE; #ifdef HAS_USL_VTS static int VTnum = -1; static int xf86StartVT = -1; static int vtEnabled = 0; #endif /* Device to open as xf86Info.consoleFd */ static char consoleDev[PATH_MAX] = "/dev/fb"; /* Set by -dev argument on CLI Used by hw/xfree86/common/xf86AutoConfig.c for VIS_GETIDENTIFIER */ _X_HIDDEN char xf86SolarisFbDev[PATH_MAX] = "/dev/fb"; static void switch_to(int vt, const char *from) { int ret; SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt)); if (ret != 0) xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt)); if (ret != 0) xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); } void xf86OpenConsole(void) { int i; #ifdef HAS_USL_VTS int fd; struct vt_mode VT; struct vt_stat vtinfo; MessageType from = X_PROBED; #endif if (serverGeneration == 1) { /* Check if we're run with euid==0 */ if (geteuid() != 0) FatalError("xf86OpenConsole: Server must be suid root\n"); #ifdef HAS_USL_VTS /* * Setup the virtual terminal manager */ if ((fd = open("/dev/vt/0", O_RDWR, 0)) == -1) { xf86ErrorF("xf86OpenConsole: Cannot open /dev/vt/0 (%s)\n", strerror(errno)); vtEnabled = 0; } else { if (ioctl(fd, VT_ENABLED, &vtEnabled) < 0) { xf86ErrorF("xf86OpenConsole: VT_ENABLED failed (%s)\n", strerror(errno)); vtEnabled = 0; } } #endif /* HAS_USL_VTS */ if (UseConsole) { strlcpy(consoleDev, SOL_CONSOLE_DEV, sizeof(consoleDev)); #ifdef HAS_USL_VTS xf86Info.vtno = CONSOLE_VTNO; if (vtEnabled == 0) { xf86StartVT = 0; } else { if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) FatalError ("xf86OpenConsole: Cannot determine current VT\n"); xf86StartVT = vtinfo.v_active; } #endif /* HAS_USL_VTS */ goto OPENCONSOLE; } #ifdef HAS_USL_VTS if (vtEnabled == 0) { /* VT not enabled - kernel too old or Sparc platforms without visual_io support */ xf86Msg(from, "VT infrastructure is not available\n"); xf86StartVT = 0; xf86Info.vtno = 0; strlcpy(consoleDev, xf86SolarisFbDev, sizeof(consoleDev)); goto OPENCONSOLE; } if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) FatalError("xf86OpenConsole: Cannot determine current VT\n"); xf86StartVT = vtinfo.v_active; if (VTnum != -1) { xf86Info.vtno = VTnum; from = X_CMDLINE; } else if (xf86Info.ShareVTs) { xf86Info.vtno = vtinfo.v_active; from = X_CMDLINE; } else { if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || (xf86Info.vtno == -1)) { FatalError("xf86OpenConsole: Cannot find a free VT\n"); } } xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno); if (fd != -1) { close(fd); } #endif /* HAS_USL_VTS */ OPENCONSOLE: if (!KeepTty) setpgrp(); if (((xf86Info.consoleFd = open(consoleDev, O_RDWR | O_NDELAY, 0)) < 0)) FatalError("xf86OpenConsole: Cannot open %s (%s)\n", consoleDev, strerror(errno)); /* Change ownership of the vt or console */ chown(consoleDev, getuid(), getgid()); #ifdef HAS_USL_VTS if (xf86Info.ShareVTs) return; if (vtEnabled) { /* * Now get the VT */ switch_to(xf86Info.vtno, "xf86OpenConsole"); #ifdef VT_SET_CONSUSER /* added in snv_139 */ if (strcmp(display, "0") == 0) if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0) xf86Msg(X_WARNING, "xf86OpenConsole: VT_SET_CONSUSER failed\n"); #endif if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_GETMODE failed\n"); OsSignal(SIGUSR1, xf86VTAcquire); OsSignal(SIGUSR2, xf86VTRelease); VT.mode = VT_PROCESS; VT.acqsig = SIGUSR1; VT.relsig = SIGUSR2; if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0) xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n"); } #endif #ifdef KDSETMODE SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS)); if (i < 0) { xf86Msg(X_WARNING, "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n", consoleDev, strerror(errno)); } #endif } else { /* serverGeneration != 1 */ #ifdef HAS_USL_VTS if (vtEnabled && !xf86Info.ShareVTs) { /* * Now re-get the VT */ if (xf86Info.autoVTSwitch) switch_to(xf86Info.vtno, "xf86OpenConsole"); #ifdef VT_SET_CONSUSER /* added in snv_139 */ if (strcmp(display, "0") == 0) if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0) xf86Msg(X_WARNING, "xf86OpenConsole: VT_SET_CONSUSER failed\n"); #endif /* * If the server doesn't have the VT when the reset occurs, * this is to make sure we don't continue until the activate * signal is received. */ if (!xf86VTOwner()) sleep(5); } #endif /* HAS_USL_VTS */ } } void xf86CloseConsole(void) { #ifdef HAS_USL_VTS struct vt_mode VT; #endif #if !defined(__i386__) && !defined(__i386) && !defined(__x86) if (!xf86DoConfigure) { int fd; /* * Wipe out framebuffer just like the non-SI Xsun server does. This * could be improved by saving framebuffer contents in * xf86OpenConsole() above and restoring them here. Also, it's unclear * at this point whether this should be done for all framebuffers in * the system, rather than only the console. */ if ((fd = open(xf86SolarisFbDev, O_RDWR, 0)) < 0) { xf86Msg(X_WARNING, "xf86CloseConsole(): unable to open framebuffer (%s)\n", strerror(errno)); } else { struct fbgattr fbattr; if ((ioctl(fd, FBIOGATTR, &fbattr) < 0) && (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0)) { xf86Msg(X_WARNING, "xf86CloseConsole(): unable to retrieve framebuffer" " attributes (%s)\n", strerror(errno)); } else { void *fbdata; fbdata = mmap(NULL, fbattr.fbtype.fb_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (fbdata == MAP_FAILED) { xf86Msg(X_WARNING, "xf86CloseConsole(): unable to mmap framebuffer" " (%s)\n", strerror(errno)); } else { memset(fbdata, 0, fbattr.fbtype.fb_size); munmap(fbdata, fbattr.fbtype.fb_size); } } close(fd); } } #endif #ifdef KDSETMODE /* Reset the display back to text mode */ SYSCALL(ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT)); #endif #ifdef HAS_USL_VTS if (vtEnabled) { if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) { VT.mode = VT_AUTO; /* Set default vt handling */ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); } /* Activate the VT that X was started on */ if (xf86Info.autoVTSwitch) switch_to(xf86StartVT, "xf86CloseConsole"); } #endif /* HAS_USL_VTS */ close(xf86Info.consoleFd); } 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; } /* * Use /dev/console as the console device. */ if (!strcmp(argv[i], "-C")) { UseConsole = TRUE; return 1; } #ifdef HAS_USL_VTS if ((argv[i][0] == 'v') && (argv[i][1] == 't')) { if (sscanf(argv[i], "vt%d", &VTnum) == 0) { UseMsg(); VTnum = -1; return 0; } return 1; } #endif /* HAS_USL_VTS */ if ((i + 1) < argc) { if (!strcmp(argv[i], "-dev")) { strlcpy(xf86SolarisFbDev, argv[i + 1], sizeof(xf86SolarisFbDev)); return 2; } } return 0; } void xf86UseMsg(void) { #ifdef HAS_USL_VTS ErrorF("vtX Use the specified VT number\n"); #endif ErrorF("-dev Framebuffer device\n"); ErrorF("-keeptty Don't detach controlling tty\n"); ErrorF(" (for debugging only)\n"); ErrorF("-C Use /dev/console as the console device\n"); } xorg-server-1.20.8/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S0000644000175000017500000000757713640201473022632 00000000000000/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 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 INLINE_ASM #define FUNCTION_START(f,n) .inline f,n #define FUNCTION_END(f) .end #else #define _ASM #include #define FUNCTION_START(f,n) ENTRY(f) #define FUNCTION_END(f) retl; nop; SET_SIZE(f) #endif /* Converted from common/compiler.h gcc inline format to Sun cc inline * format by Kenjiro Tsuji * * The value 0x88 means ASI_PRIMARY_LITTLE. * The store or load to/from the address space will be done * as little-endian. In the original xrog code, the value * is defined as the macro ASI_PL. * * In the original xorg code, "membar #StoreStore|#StoreLoad" * is directly implemented as an instruction "0x8143e00a". * */ FUNCTION_START(outb, 0) stba %o1, [%o0] 0x88 membar #StoreStore|#StoreLoad FUNCTION_END(outb) FUNCTION_START(outw, 0) stha %o1, [%o0] 0x88 membar #StoreStore|#StoreLoad FUNCTION_END(outw) FUNCTION_START(outl, 0) sta %o1, [%o0] 0x88 membar #StoreStore|#StoreLoad FUNCTION_END(outl) FUNCTION_START(inb, 0) lduba [%o0] 0x88, %o0 FUNCTION_END(inb) FUNCTION_START(inw, 0) lduha [%o0] 0x88, %o0 FUNCTION_END(inw) FUNCTION_START(inl, 0) lda [%o0] 0x88, %o0 FUNCTION_END(inl) FUNCTION_START(xf86ReadMmio8, 0) lduba [%o0 + %o1] 0x88, %o0 FUNCTION_END(xf86ReadMmio8) FUNCTION_START(xf86ReadMmio16Be, 0) lduh [%o0 + %o1], %o0 FUNCTION_END(xf86ReadMmio16Be) FUNCTION_START(xf86ReadMmio16Le, 0) lduha [%o0 + %o1] 0x88, %o0 FUNCTION_END(xf86ReadMmio16Le) FUNCTION_START(xf86ReadMmio32Be, 0) ld [%o0 + %o1], %o0 FUNCTION_END(xf86ReadMmio32Be) FUNCTION_START(xf86ReadMmio32Le, 0) lda [%o0 + %o1] 0x88, %o0 FUNCTION_END(xf86ReadMmio32Le) FUNCTION_START(xf86WriteMmio8, 0) stba %o2, [%o0 + %o1] 0x88 membar #StoreStore|#StoreLoad FUNCTION_END(xf86WriteMmio8) FUNCTION_START(xf86WriteMmio16Be, 0) sth %o2, [%o0 + %o1] membar #StoreStore|#StoreLoad FUNCTION_END(xf86WriteMmio16Be) FUNCTION_START(xf86WriteMmio16Le, 0) stha %o2, [%o0 + %o1] 0x88 membar #StoreStore|#StoreLoad FUNCTION_END(xf86WriteMmio16Le) FUNCTION_START(xf86WriteMmio32Be, 0) st %o2, [%o0 + %o1] membar #StoreStore|#StoreLoad FUNCTION_END(xf86WriteMmio32Be) FUNCTION_START(xf86WriteMmio32Le, 0) sta %o2, [%o0 + %o1] 0x88 membar #StoreStore|#StoreLoad FUNCTION_END(xf86WriteMmio32Le) FUNCTION_START(xf86WriteMmio8NB, 0) add %o0, %o1, %o0 stba %o2, [%o0] 0x88 FUNCTION_END(xf86WriteMmio8NB) FUNCTION_START(xf86WriteMmio16BeNB, 0) sth %o2, [%o0 + %o1] FUNCTION_END(xf86WriteMmio16BeNB) FUNCTION_START(xf86WriteMmio16LeNB, 0) stha %o2, [%o0 + %o1] 0x88 FUNCTION_END(xf86WriteMmio16LeNB) FUNCTION_START(xf86WriteMmio32BeNB, 0) st %o2, [%o0 + %o1] FUNCTION_END(xf86WriteMmio32BeNB) FUNCTION_START(xf86WriteMmio32LeNB, 0) sta %o2, [%o0 + %o1] 0x88 FUNCTION_END(xf86WriteMmio32LeNB) xorg-server-1.20.8/hw/xfree86/os-support/bsd/0000755000175000017500000000000013640201534015674 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/bsd/Makefile.am0000644000175000017500000000247413640201473017661 00000000000000noinst_LTLIBRARIES = libbsd.la # APM support. if BSD_KQUEUE_APM APM_SOURCES = $(srcdir)/bsd_kqueue_apm.c else if BSD_APM APM_SOURCES = $(srcdir)/bsd_apm.c else APM_SOURCES = $(srcdir)/../shared/pm_noop.c endif endif if FREEBSD_KLDLOAD KMOD_SOURCES = bsd_kmod.c else KMOD_SOURCES = $(srcdir)/../shared/kmod_noop.c endif if AGP AGP_SOURCES = $(srcdir)/../linux/lnx_agp.c else AGP_SOURCES = $(srcdir)/../shared/agp_noop.c endif if ALPHA_VIDEO # Cheat here and piggyback other alpha bits on ALPHA_VIDEO. ARCH_SOURCES = \ alpha_video.c endif if ARM_VIDEO ARCH_SOURCES = arm_video.c endif if I386_VIDEO ARCH_SOURCES = i386_video.c endif if PPC_VIDEO ARCH_SOURCES = ppc_video.c endif if SPARC64_VIDEO # Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO. ARCH_SOURCES = \ sparc64_video.c \ $(srcdir)/../shared/ioperm_noop.c endif # FIXME: NetBSD Aperture defines (configure.ac) AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) libbsd_la_SOURCES = \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c \ bsd_VTsw.c \ bsd_init.c \ bsd_bell.c \ $(ARCH_SOURCES) \ $(AGP_SOURCES) \ $(APM_SOURCES) \ $(AXP_SOURCES) \ $(DRI_SOURCES) \ $(KMOD_SOURCES) \ $(RES_SOURCES) # FIXME: Add these files to the build as needed EXTRA_DIST = \ memrange.h xorg-server-1.20.8/hw/xfree86/os-support/bsd/arm_video.c0000644000175000017500000001367013640201473017736 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Wexelblat * * 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. * */ /* * The ARM32 code here carries the following copyright: * * Copyright 1997 * Digital Equipment Corporation. All rights reserved. * This software is furnished under license and may be used and copied only in * accordance with the following terms and conditions. Subject to these * conditions, you may download, copy, install, use, modify and distribute * this software in source and/or binary form. No title or ownership is * transferred hereby. * * 1) Any source code used, modified or distributed must reproduce and retain * this copyright notice and list of conditions as they appear in the * source file. * * 2) No right is granted to use any trade name, trademark, or logo of Digital * Equipment Corporation. Neither the "Digital Equipment Corporation" * name nor any trademark or logo of Digital Equipment Corporation may be * used to endorse or promote products derived from this software without * the prior written permission of Digital Equipment Corporation. * * 3) This software is provided "AS-IS" and any express or implied warranties, * including but not limited to, any implied warranties of merchantability, * fitness for a particular purpose, or non-infringement are disclaimed. * In no event shall DIGITAL be liable for any damages whatsoever, and in * particular, DIGITAL shall not be liable for special, indirect, * consequential, or incidental damages or damages for lost profits, loss * of revenue or loss of use, whether such damages arise in contract, * negligence, tort, under statute, in equity, at law or otherwise, even * if advised of the possibility of such damage. * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" #if defined(__NetBSD__) && !defined(MAP_FILE) #define MAP_FLAGS MAP_SHARED #else #define MAP_FLAGS (MAP_FILE | MAP_SHARED) #endif #define BUS_BASE 0L #define BUS_BASE_BWX 0L /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ static int devMemFd = -1; /* * Check if /dev/mem can be mmap'd. If it can't print a warning when * "warn" is TRUE. */ static void checkDevMem(Bool warn) { static Bool devMemChecked = FALSE; int fd; void *base; if (devMemChecked) return; devMemChecked = TRUE; if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { munmap((caddr_t) base, 4096); devMemFd = fd; return; } else { /* This should not happen */ if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", DEV_MEM, strerror(errno)); } return; } } if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", DEV_MEM, strerror(errno)); } return; } void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { checkDevMem(TRUE); pVidMem->initialised = TRUE; } #ifdef USE_DEV_IO static int IoFd = -1; Bool xf86EnableIO() { if (IoFd >= 0) return TRUE; if ((IoFd = open("/dev/io", O_RDWR)) == -1) { xf86Msg(X_WARNING, "xf86EnableIO: " "Failed to open /dev/io for extended I/O\n"); return FALSE; } return TRUE; } void xf86DisableIO() { if (IoFd < 0) return; close(IoFd); IoFd = -1; return; } #endif #if defined(USE_ARC_MMAP) || defined(__arm32__) Bool xf86EnableIO() { int fd; void *base; if (ExtendedEnabled) return TRUE; if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { /* Try to map a page at the pccons I/O space */ base = (void *) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t) 0x0000); if (base != (void *) -1) { IOPortBase = base; } else { xf86Msg(X_WARNING, "EnableIO: failed to mmap %s (%s)\n", "/dev/ttyC0", strerror(errno)); return FALSE; } } else { xf86Msg("EnableIO: failed to open %s (%s)\n", "/dev/ttyC0", strerror(errno)); return FALSE; } ExtendedEnabled = TRUE; return TRUE; } void xf86DisableIO() { return; } #endif /* USE_ARC_MMAP */ xorg-server-1.20.8/hw/xfree86/os-support/bsd/i386_video.c0000644000175000017500000002062413640201473017645 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Wexelblat * * 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include #include #include "xf86_OSlib.h" #include "xf86OSpriv.h" #if defined(__NetBSD__) && !defined(MAP_FILE) #define MAP_FLAGS MAP_SHARED #else #define MAP_FLAGS (MAP_FILE | MAP_SHARED) #endif #ifdef __OpenBSD__ #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ "\tin /etc/sysctl.conf and reboot your machine\n" \ "\trefer to xf86(4) for details" #define SYSCTL_MSG2 \ "Check that you have set 'machdep.allowaperture=2'\n" \ "\tin /etc/sysctl.conf and reboot your machine\n" \ "\trefer to xf86(4) for details" #endif /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ static Bool useDevMem = FALSE; static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE "/dev/xf86" #endif /* * Check if /dev/mem can be mmap'd. If it can't print a warning when * "warn" is TRUE. */ static void checkDevMem(Bool warn) { static Bool devMemChecked = FALSE; int fd; void *base; if (devMemChecked) return; devMemChecked = TRUE; if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t) 0xA0000); if (base != MAP_FAILED) { munmap((caddr_t) base, 4096); devMemFd = fd; useDevMem = TRUE; return; } else { /* This should not happen */ if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", DEV_MEM, strerror(errno)); } useDevMem = FALSE; return; } } #ifndef HAS_APERTURE_DRV if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", DEV_MEM, strerror(errno)); } useDevMem = FALSE; return; #else /* Failed to open /dev/mem, try the aperture driver */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t) 0xA0000); if (base != MAP_FAILED) { munmap((caddr_t) base, 4096); devMemFd = fd; useDevMem = TRUE; xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", DEV_APERTURE); return; } else { if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", DEV_APERTURE, strerror(errno)); } } } else { if (warn) { #ifndef __OpenBSD__ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno)); #else /* __OpenBSD__ */ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno), SYSCTL_MSG); #endif /* __OpenBSD__ */ } } useDevMem = FALSE; return; #endif } void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { checkDevMem(TRUE); pci_system_init_dev_mem(devMemFd); pVidMem->initialised = TRUE; } #ifdef USE_I386_IOPL /***************************************************************************/ /* I/O Permissions section */ /***************************************************************************/ static Bool ExtendedEnabled = FALSE; Bool xf86EnableIO() { if (ExtendedEnabled) return TRUE; if (i386_iopl(TRUE) < 0) { #ifndef __OpenBSD__ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; } ExtendedEnabled = TRUE; return TRUE; } void xf86DisableIO() { if (!ExtendedEnabled) return; i386_iopl(FALSE); ExtendedEnabled = FALSE; return; } #endif /* USE_I386_IOPL */ #ifdef USE_AMD64_IOPL /***************************************************************************/ /* I/O Permissions section */ /***************************************************************************/ static Bool ExtendedEnabled = FALSE; Bool xf86EnableIO() { if (ExtendedEnabled) return TRUE; if (amd64_iopl(TRUE) < 0) { #ifndef __OpenBSD__ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; } ExtendedEnabled = TRUE; return TRUE; } void xf86DisableIO() { if (!ExtendedEnabled) return; if (amd64_iopl(FALSE) == 0) { ExtendedEnabled = FALSE; } /* Otherwise, the X server has revoqued its root uid, and thus cannot give up IO privileges any more */ return; } #endif /* USE_AMD64_IOPL */ #ifdef USE_DEV_IO static int IoFd = -1; Bool xf86EnableIO() { if (IoFd >= 0) return TRUE; if ((IoFd = open("/dev/io", O_RDWR)) == -1) { xf86Msg(X_WARNING, "xf86EnableIO: " "Failed to open /dev/io for extended I/O"); return FALSE; } return TRUE; } void xf86DisableIO() { if (IoFd < 0) return; close(IoFd); IoFd = -1; return; } #endif #ifdef __NetBSD__ /***************************************************************************/ /* Set TV output mode */ /***************************************************************************/ void xf86SetTVOut(int mode) { switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS:{ if (ioctl(xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) { xf86Msg(X_WARNING, "xf86SetTVOut: Could not set console to TV output, %s\n", strerror(errno)); } } break; #endif /* PCCONS_SUPPORT */ default: FatalError("Xf86SetTVOut: Unsupported console"); break; } return; } void xf86SetRGBOut() { switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS:{ if (ioctl(xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) { xf86Msg(X_WARNING, "xf86SetTVOut: Could not set console to RGB output, %s\n", strerror(errno)); } } break; #endif /* PCCONS_SUPPORT */ default: FatalError("Xf86SetTVOut: Unsupported console"); break; } return; } #endif xorg-server-1.20.8/hw/xfree86/os-support/bsd/ppc_video.c0000644000175000017500000000506613640201473017741 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Wexelblat * * 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" #include "bus/Pci.h" /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ #ifdef __OpenBSD__ #define DEV_MEM "/dev/xf86" #endif Bool xf86EnableIO(void); void xf86DisableIO(void); void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; xf86EnableIO(); } volatile unsigned char *ioBase = MAP_FAILED; Bool xf86EnableIO() { int fd = xf86Info.consoleFd; xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); if (ioBase == MAP_FAILED) { ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xf2000000); xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase); if (ioBase == MAP_FAILED) { xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n"); return FALSE; } } return TRUE; } void xf86DisableIO() { if (ioBase != MAP_FAILED) { munmap(__UNVOLATILE(ioBase), 0x10000); ioBase = MAP_FAILED; } } xorg-server-1.20.8/hw/xfree86/os-support/bsd/bsd_init.c0000644000175000017500000005056213640201473017565 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Wexelblat * * 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 #endif #include #include "compiler.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include #include #include #include static Bool KeepTty = FALSE; #ifdef PCCONS_SUPPORT static int devConsoleFd = -1; #endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) static int VTnum = -1; static int initialVT = -1; #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 < ARRAY_SIZE(supported_drivers); 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); } xf86Info.consoleFd = 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 (!xf86Info.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"); } OsSignal(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(__OpenBSD__) && !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 { /* xf86Info.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 (!xf86Info.ShareVTs && (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]; 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 (xf86Info.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. */ if (initialVT != -1) { xf86Info.vtno = initialVT; } 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); snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1); 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 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. */ if (initialVT != -1) { xf86Info.vtno = initialVT; } else { FatalError("%s: Cannot find a free VT", "xf86OpenPcvt"); } } } close(fd); snprintf(vtname, sizeof(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; snprintf(vtname, sizeof(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__) snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i); #elif defined(__OpenBSD__) snprintf(ttyname, sizeof(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 (xf86Info.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.consoleFd, WSDISPLAYIO_SMODE, &mode); break; } #endif } close(xf86Info.consoleFd); #ifdef PCCONS_SUPPORT if (devConsoleFd >= 0) close(devConsoleFd); #endif 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 ((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"); #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ ErrorF("-keeptty "); ErrorF("don't detach controlling tty (for debugging only)\n"); return; } void xf86OSInputThreadInit(void) { return; } xorg-server-1.20.8/hw/xfree86/os-support/bsd/alpha_video.c0000644000175000017500000001527313640201473020245 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Wexelblat * * 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include #ifndef __NetBSD__ #include #endif #include "xf86_OSlib.h" #include "xf86OSpriv.h" #if defined(__NetBSD__) && !defined(MAP_FILE) #define MAP_FLAGS MAP_SHARED #else #define MAP_FLAGS (MAP_FILE | MAP_SHARED) #endif #ifndef __NetBSD__ extern unsigned long dense_base(void); #else /* __NetBSD__ */ static struct alpha_bus_window *abw; static int abw_count = -1; static void init_abw(void) { if (abw_count < 0) { abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw); if (abw_count <= 0) FatalError("init_abw: alpha_bus_getwindows failed\n"); } } static unsigned long dense_base(void) { if (abw_count < 0) init_abw(); /* XXX check abst_flags for ABST_DENSE just to be safe? */ xf86Msg(X_INFO, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */ return abw[0].abw_abst.abst_sys_start; } #endif /* __NetBSD__ */ #define BUS_BASE dense_base() /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ #ifdef __OpenBSD__ #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ "\tin /etc/sysctl.conf and reboot your machine\n" \ "\trefer to xf86(4) for details" #endif static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE "/dev/xf86" #endif /* * Check if /dev/mem can be mmap'd. If it can't print a warning when * "warn" is TRUE. */ static void checkDevMem(Bool warn) { static Bool devMemChecked = FALSE; int fd; void *base; if (devMemChecked) return; devMemChecked = TRUE; #ifdef HAS_APERTURE_DRV /* Try the aperture driver first */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { munmap((caddr_t) base, 4096); devMemFd = fd; xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", DEV_APERTURE); return; } else { if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", DEV_APERTURE, strerror(errno)); } } } #endif if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { munmap((caddr_t) base, 4096); devMemFd = fd; return; } else { if (warn) { xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", DEV_MEM, strerror(errno)); } } } if (warn) { #ifndef HAS_APERTURE_DRV xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n", DEV_MEM, strerror(errno)); #else #ifndef __OpenBSD__ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); #else /* __OpenBSD__ */ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), SYSCTL_MSG); #endif /* __OpenBSD__ */ #endif xf86ErrorF("\tlinear framebuffer access unavailable\n"); } return; } void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { checkDevMem(TRUE); pVidMem->initialised = TRUE; } #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) extern int ioperm(unsigned long from, unsigned long num, int on); Bool xf86EnableIO() { if (!ioperm(0, 65536, TRUE)) return TRUE; return FALSE; } void xf86DisableIO() { return; } #endif /* __FreeBSD_kernel__ || __OpenBSD__ */ #ifdef USE_ALPHA_PIO Bool xf86EnableIO() { alpha_pci_io_enable(1); return TRUE; } void xf86DisableIO() { alpha_pci_io_enable(0); } #endif /* USE_ALPHA_PIO */ extern int readDense8(void *Base, register unsigned long Offset); extern int readDense16(void *Base, register unsigned long Offset); extern int readDense32(void *Base, register unsigned long Offset); extern void writeDense8(int Value, void *Base, register unsigned long Offset); extern void writeDense16(int Value, void *Base, register unsigned long Offset); extern void writeDense32(int Value, void *Base, register unsigned long Offset); void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset) = writeDense8; void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset) = writeDense16; void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset) = writeDense32; int (*xf86ReadMmio8) (void *Base, unsigned long Offset) = readDense8; int (*xf86ReadMmio16) (void *Base, unsigned long Offset) = readDense16; int (*xf86ReadMmio32) (void *Base, unsigned long Offset) = readDense32; xorg-server-1.20.8/hw/xfree86/os-support/bsd/bsd_bell.c0000644000175000017500000000475713640201473017545 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Dawes * * 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 Dawes * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Rich Murphey and * David Dawes 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 DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES 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 #endif #if defined (SYSCONS_SUPPORT) #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" void xf86OSRingBell(int loudness, int pitch, int duration) { #ifdef WSCONS_SUPPORT struct wskbd_bell_data wsb; #endif if (loudness && pitch) { #ifdef PCCONS_SUPPORT int data[2]; #endif switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS: data[0] = pitch; data[1] = (duration * loudness) / 50; ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data); break; #endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) case SYSCONS: case PCVT: ioctl(xf86Info.consoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) | (((unsigned long) duration * loudness / 50) << 16)); break; #endif #if defined (WSCONS_SUPPORT) case WSCONS: wsb.which = WSKBD_BELL_DOALL; wsb.pitch = pitch; wsb.period = duration; wsb.volume = loudness; ioctl(xf86Info.consoleFd, WSKBDIO_COMPLEXBELL, &wsb); break; #endif } } } xorg-server-1.20.8/hw/xfree86/os-support/bsd/bsd_apm.c0000644000175000017500000000641113640201473017371 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #include "xf86_OSlib.h" #include #define APM_DEVICE "/dev/apm" static void *APMihPtr = NULL; static void bsdCloseAPM(void); static struct { u_int apmBsd; pmEvent xf86; } bsdToXF86Array[] = { {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; static pmEvent bsdToXF86(int type) { int i; for (i = 0; i < ARRAY_SIZE(bsdToXF86Array); i++) { if (type == bsdToXF86Array[i].apmBsd) { return bsdToXF86Array[i].xf86; } } return XF86_APM_UNKNOWN; } /* * APM events can be requested direclty from /dev/apm */ static int bsdPMGetEventFromOS(int fd, pmEvent * events, int num) { struct apm_event_info bsdEvent; int i; for (i = 0; i < num; i++) { if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) { if (errno != EAGAIN) { xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT" " %s\n", strerror(errno)); } break; } events[i] = bsdToXF86(bsdEvent.type); } return i; } /* * XXX This won't work on /dev/apm ! * We should either use /dev/apm_ctl (and kill apmd(8)) * or talk to apmd (but its protocol is not publically available)... */ static pmWait bsdPMConfirmEventToOs(int fd, pmEvent event) { switch (event) { case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: if (ioctl(fd, APM_IOC_STANDBY, NULL) == 0) return PM_WAIT; /* should we stop the Xserver in standby, too? */ else return PM_NONE; case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: if (ioctl(fd, APM_IOC_SUSPEND, NULL) == 0) return PM_WAIT; else return PM_NONE; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: case XF86_APM_STANDBY_FAILED: case XF86_APM_SUSPEND_FAILED: return PM_CONTINUE; default: return PM_NONE; } } PMClose xf86OSPMOpen(void) { int fd; if (APMihPtr || !xf86Info.pmFlag) { return NULL; } if ((fd = open(APM_DEVICE, O_RDWR)) == -1) { return NULL; } xf86PMGetEventFromOs = bsdPMGetEventFromOS; xf86PMConfirmEventToOs = bsdPMConfirmEventToOs; APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL); return bsdCloseAPM; } static void bsdCloseAPM(void) { int fd; if (APMihPtr) { fd = xf86RemoveGeneralHandler(APMihPtr); close(fd); APMihPtr = NULL; } } xorg-server-1.20.8/hw/xfree86/os-support/bsd/sparc64_video.c0000644000175000017500000000340413640201473020433 00000000000000/* * Copyright 1992 by Rich Murphey * Copyright 1993 by David Wexelblat * * 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/bsd/Makefile.in0000644000175000017500000012415013640201513017661 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/os-support/bsd ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbsd_la_LIBADD = am__libbsd_la_SOURCES_DIST = $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c $(srcdir)/../shared/vidmem.c \ bsd_VTsw.c bsd_init.c bsd_bell.c alpha_video.c arm_video.c \ i386_video.c ppc_video.c sparc64_video.c \ $(srcdir)/../shared/ioperm_noop.c \ $(srcdir)/../shared/agp_noop.c $(srcdir)/../linux/lnx_agp.c \ $(srcdir)/../shared/pm_noop.c $(srcdir)/bsd_apm.c \ $(srcdir)/bsd_kqueue_apm.c $(srcdir)/../shared/kmod_noop.c \ bsd_kmod.c @ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@am__objects_1 = sparc64_video.lo \ @ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@ ioperm_noop.lo @ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_TRUE@am__objects_1 = ppc_video.lo @ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_TRUE@am__objects_1 = i386_video.lo @ALPHA_VIDEO_FALSE@@ARM_VIDEO_TRUE@am__objects_1 = arm_video.lo @ALPHA_VIDEO_TRUE@am__objects_1 = alpha_video.lo @AGP_FALSE@am__objects_2 = agp_noop.lo @AGP_TRUE@am__objects_2 = lnx_agp.lo @BSD_APM_FALSE@@BSD_KQUEUE_APM_FALSE@am__objects_3 = pm_noop.lo @BSD_APM_TRUE@@BSD_KQUEUE_APM_FALSE@am__objects_3 = bsd_apm.lo @BSD_KQUEUE_APM_TRUE@am__objects_3 = bsd_kqueue_apm.lo @FREEBSD_KLDLOAD_FALSE@am__objects_4 = kmod_noop.lo @FREEBSD_KLDLOAD_TRUE@am__objects_4 = bsd_kmod.lo am_libbsd_la_OBJECTS = posix_tty.lo sigio.lo vidmem.lo bsd_VTsw.lo \ bsd_init.lo bsd_bell.lo $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) libbsd_la_OBJECTS = $(am_libbsd_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/agp_noop.Plo \ ./$(DEPDIR)/alpha_video.Plo ./$(DEPDIR)/arm_video.Plo \ ./$(DEPDIR)/bsd_VTsw.Plo ./$(DEPDIR)/bsd_apm.Plo \ ./$(DEPDIR)/bsd_bell.Plo ./$(DEPDIR)/bsd_init.Plo \ ./$(DEPDIR)/bsd_kmod.Plo ./$(DEPDIR)/bsd_kqueue_apm.Plo \ ./$(DEPDIR)/i386_video.Plo ./$(DEPDIR)/ioperm_noop.Plo \ ./$(DEPDIR)/kmod_noop.Plo ./$(DEPDIR)/lnx_agp.Plo \ ./$(DEPDIR)/pm_noop.Plo ./$(DEPDIR)/posix_tty.Plo \ ./$(DEPDIR)/ppc_video.Plo ./$(DEPDIR)/sigio.Plo \ ./$(DEPDIR)/sparc64_video.Plo ./$(DEPDIR)/vidmem.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libbsd_la_SOURCES) DIST_SOURCES = $(am__libbsd_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libbsd.la @BSD_APM_FALSE@@BSD_KQUEUE_APM_FALSE@APM_SOURCES = $(srcdir)/../shared/pm_noop.c @BSD_APM_TRUE@@BSD_KQUEUE_APM_FALSE@APM_SOURCES = $(srcdir)/bsd_apm.c # APM support. @BSD_KQUEUE_APM_TRUE@APM_SOURCES = $(srcdir)/bsd_kqueue_apm.c @FREEBSD_KLDLOAD_FALSE@KMOD_SOURCES = $(srcdir)/../shared/kmod_noop.c @FREEBSD_KLDLOAD_TRUE@KMOD_SOURCES = bsd_kmod.c @AGP_FALSE@AGP_SOURCES = $(srcdir)/../shared/agp_noop.c @AGP_TRUE@AGP_SOURCES = $(srcdir)/../linux/lnx_agp.c # Cheat here and piggyback other alpha bits on ALPHA_VIDEO. @ALPHA_VIDEO_TRUE@ARCH_SOURCES = \ @ALPHA_VIDEO_TRUE@ alpha_video.c @ARM_VIDEO_TRUE@ARCH_SOURCES = arm_video.c @I386_VIDEO_TRUE@ARCH_SOURCES = i386_video.c @PPC_VIDEO_TRUE@ARCH_SOURCES = ppc_video.c # Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO. @SPARC64_VIDEO_TRUE@ARCH_SOURCES = \ @SPARC64_VIDEO_TRUE@ sparc64_video.c \ @SPARC64_VIDEO_TRUE@ $(srcdir)/../shared/ioperm_noop.c # FIXME: NetBSD Aperture defines (configure.ac) AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) libbsd_la_SOURCES = \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c \ bsd_VTsw.c \ bsd_init.c \ bsd_bell.c \ $(ARCH_SOURCES) \ $(AGP_SOURCES) \ $(APM_SOURCES) \ $(AXP_SOURCES) \ $(DRI_SOURCES) \ $(KMOD_SOURCES) \ $(RES_SOURCES) # FIXME: Add these files to the build as needed EXTRA_DIST = \ memrange.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/bsd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/bsd/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libbsd.la: $(libbsd_la_OBJECTS) $(libbsd_la_DEPENDENCIES) $(EXTRA_libbsd_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libbsd_la_OBJECTS) $(libbsd_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_VTsw.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_apm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_bell.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_kmod.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_kqueue_apm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioperm_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_agp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc64_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< posix_tty.lo: $(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c sigio.lo: $(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigio.lo -MD -MP -MF $(DEPDIR)/sigio.Tpo -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sigio.Tpo $(DEPDIR)/sigio.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/sigio.c' object='sigio.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c vidmem.lo: $(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c ioperm_noop.lo: $(srcdir)/../shared/ioperm_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ioperm_noop.lo -MD -MP -MF $(DEPDIR)/ioperm_noop.Tpo -c -o ioperm_noop.lo `test -f '$(srcdir)/../shared/ioperm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ioperm_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ioperm_noop.Tpo $(DEPDIR)/ioperm_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/ioperm_noop.c' object='ioperm_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ioperm_noop.lo `test -f '$(srcdir)/../shared/ioperm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ioperm_noop.c agp_noop.lo: $(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT agp_noop.lo -MD -MP -MF $(DEPDIR)/agp_noop.Tpo -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/agp_noop.Tpo $(DEPDIR)/agp_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/agp_noop.c' object='agp_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c lnx_agp.lo: $(srcdir)/../linux/lnx_agp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lnx_agp.lo -MD -MP -MF $(DEPDIR)/lnx_agp.Tpo -c -o lnx_agp.lo `test -f '$(srcdir)/../linux/lnx_agp.c' || echo '$(srcdir)/'`$(srcdir)/../linux/lnx_agp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lnx_agp.Tpo $(DEPDIR)/lnx_agp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../linux/lnx_agp.c' object='lnx_agp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lnx_agp.lo `test -f '$(srcdir)/../linux/lnx_agp.c' || echo '$(srcdir)/'`$(srcdir)/../linux/lnx_agp.c pm_noop.lo: $(srcdir)/../shared/pm_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pm_noop.lo -MD -MP -MF $(DEPDIR)/pm_noop.Tpo -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pm_noop.Tpo $(DEPDIR)/pm_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/pm_noop.c' object='pm_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c bsd_apm.lo: $(srcdir)/bsd_apm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bsd_apm.lo -MD -MP -MF $(DEPDIR)/bsd_apm.Tpo -c -o bsd_apm.lo `test -f '$(srcdir)/bsd_apm.c' || echo '$(srcdir)/'`$(srcdir)/bsd_apm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bsd_apm.Tpo $(DEPDIR)/bsd_apm.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/bsd_apm.c' object='bsd_apm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsd_apm.lo `test -f '$(srcdir)/bsd_apm.c' || echo '$(srcdir)/'`$(srcdir)/bsd_apm.c bsd_kqueue_apm.lo: $(srcdir)/bsd_kqueue_apm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bsd_kqueue_apm.lo -MD -MP -MF $(DEPDIR)/bsd_kqueue_apm.Tpo -c -o bsd_kqueue_apm.lo `test -f '$(srcdir)/bsd_kqueue_apm.c' || echo '$(srcdir)/'`$(srcdir)/bsd_kqueue_apm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bsd_kqueue_apm.Tpo $(DEPDIR)/bsd_kqueue_apm.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/bsd_kqueue_apm.c' object='bsd_kqueue_apm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsd_kqueue_apm.lo `test -f '$(srcdir)/bsd_kqueue_apm.c' || echo '$(srcdir)/'`$(srcdir)/bsd_kqueue_apm.c kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/alpha_video.Plo -rm -f ./$(DEPDIR)/arm_video.Plo -rm -f ./$(DEPDIR)/bsd_VTsw.Plo -rm -f ./$(DEPDIR)/bsd_apm.Plo -rm -f ./$(DEPDIR)/bsd_bell.Plo -rm -f ./$(DEPDIR)/bsd_init.Plo -rm -f ./$(DEPDIR)/bsd_kmod.Plo -rm -f ./$(DEPDIR)/bsd_kqueue_apm.Plo -rm -f ./$(DEPDIR)/i386_video.Plo -rm -f ./$(DEPDIR)/ioperm_noop.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/lnx_agp.Plo -rm -f ./$(DEPDIR)/pm_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/ppc_video.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/sparc64_video.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/alpha_video.Plo -rm -f ./$(DEPDIR)/arm_video.Plo -rm -f ./$(DEPDIR)/bsd_VTsw.Plo -rm -f ./$(DEPDIR)/bsd_apm.Plo -rm -f ./$(DEPDIR)/bsd_bell.Plo -rm -f ./$(DEPDIR)/bsd_init.Plo -rm -f ./$(DEPDIR)/bsd_kmod.Plo -rm -f ./$(DEPDIR)/bsd_kqueue_apm.Plo -rm -f ./$(DEPDIR)/i386_video.Plo -rm -f ./$(DEPDIR)/ioperm_noop.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/lnx_agp.Plo -rm -f ./$(DEPDIR)/pm_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/ppc_video.Plo -rm -f ./$(DEPDIR)/sigio.Plo -rm -f ./$(DEPDIR)/sparc64_video.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c0000644000175000017500000001303613640201473020751 00000000000000/* * Copyright (C) 2001 The XFree86 Project, 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 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 XFREE86 PROJECT 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 XFree86 Project * 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 XFree86 Project. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #include "xf86_OSlib.h" #include #include #define _PATH_APM_SOCKET "/var/run/apmdev" #define _PATH_APM_DEV "/dev/apm" #define _PATH_APM_CTLDEV "/dev/apmctl" static void *APMihPtr = NULL; static int devFd = -1; static int ctlFd = -1; static void bsdCloseAPM(void); static struct { u_int apmBsd; pmEvent xf86; } bsdToXF86Array[] = { {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; static pmEvent bsdToXF86(int type) { int i; for (i = 0; i < ARRAY_SIZE(bsdToXF86Array); i++) { if (type == bsdToXF86Array[i].apmBsd) { return bsdToXF86Array[i].xf86; } } return XF86_APM_UNKNOWN; } /* * APM events can be requested direclty from /dev/apm */ static int bsdPMGetEventFromOS(int kq, pmEvent * events, int num) { struct kevent ev; int i, result; struct timespec ts = { 0, 0 }; for (i = 0; i < num; i++) { result = kevent(kq, NULL, 0, &ev, 1, &ts); if (result == 0 || APM_EVENT_TYPE(ev.data) == APM_NOEVENT) { /* no event */ break; } else if (result < 0) { xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns" " %s\n", strerror(errno)); break; } events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data)); } return i; } /* * If apmd(8) is running, he will get the events and handle them, * so, we've nothing to do here. * Otherwise, opening /dev/apmctl will succeed and we have to send the * confirmations to /dev/apmctl. */ static pmWait bsdPMConfirmEventToOs(int dummyfd, pmEvent event) { if (ctlFd < 0) { if ((ctlFd = open(_PATH_APM_CTLDEV, O_RDWR)) < 0) { return PM_NONE; } } /* apmctl open succeedeed */ switch (event) { case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: if (ioctl(ctlFd, APM_IOC_STANDBY, NULL) == 0) return PM_WAIT; /* should we stop the Xserver in standby, too? */ else return PM_NONE; case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: case XF86_APM_USER_SUSPEND: if (ioctl(ctlFd, APM_IOC_SUSPEND, NULL) == 0) return PM_WAIT; else return PM_NONE; break; case XF86_APM_STANDBY_RESUME: case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: case XF86_APM_STANDBY_FAILED: case XF86_APM_SUSPEND_FAILED: return PM_CONTINUE; break; default: return PM_NONE; } } PMClose xf86OSPMOpen(void) { int kq; struct kevent ev; if (APMihPtr || !xf86Info.pmFlag) { return NULL; } if ((devFd = open(_PATH_APM_DEV, O_RDONLY)) == -1) { return NULL; } if ((kq = kqueue()) <= 0) { close(devFd); return NULL; } EV_SET(&ev, devFd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, NULL); if (kevent(kq, &ev, 1, NULL, 0, NULL) < 0) { close(devFd); return NULL; } xf86PMGetEventFromOs = bsdPMGetEventFromOS; xf86PMConfirmEventToOs = bsdPMConfirmEventToOs; APMihPtr = xf86AddGeneralHandler(kq, xf86HandlePMEvents, NULL); return bsdCloseAPM; } static void bsdCloseAPM(void) { int kq; if (APMihPtr) { kq = xf86RemoveGeneralHandler(APMihPtr); close(devFd); devFd = -1; close(kq); if (ctlFd >= 0) { close(ctlFd); ctlFd = -1; } APMihPtr = NULL; } } xorg-server-1.20.8/hw/xfree86/os-support/bsd/bsd_VTsw.c0000644000175000017500000000565113640201473017524 00000000000000/* * Derived from VTsw_usl.c which is * Copyright 1993 by David Wexelblat * by S_ren Schmidt (sos@login.dkuug.dk) * * 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 David Wexelblat not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. David Wexelblat makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL 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 #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" /* * Handle the VT-switching interface for OSs that use USL-style ioctl()s * (the bsd, sysv, sco, and linux subdirs). */ /* * This function is the signal handler for the VT-switching signal. It * is only referenced inside the OS-support layer. */ void xf86VTRequest(int sig) { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { xf86Info.vtRequestsPending = TRUE; } #endif return; } Bool xf86VTSwitchPending() { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { return xf86Info.vtRequestsPending ? TRUE : FALSE; } #endif return FALSE; } Bool xf86VTSwitchAway() { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { xf86Info.vtRequestsPending = FALSE; if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) return FALSE; else return TRUE; } #endif return FALSE; } Bool xf86VTSwitchTo() { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { xf86Info.vtRequestsPending = FALSE; if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) return FALSE; else return TRUE; } #endif return TRUE; } Bool xf86VTActivate(int vtno) { if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { return FALSE; } return TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/bsd/bsd_kmod.c0000644000175000017500000000114113640201473017541 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include "xf86_OSproc.h" /* * Load a FreeBSD kernel module. * This is used by the DRI/DRM to load a DRM kernel module when * the X server starts. It could be used for other purposes in the future. * Input: * modName - name of the kernel module (Ex: "tdfx") * Return: * 0 for failure, 1 for success */ int xf86LoadKernelModule(const char *modName) { if (kldload(modName) != -1) return 1; else return 0; } xorg-server-1.20.8/hw/xfree86/os-support/bsd/memrange.h0000644000175000017500000000401313640201473017560 00000000000000/* * Memory range attribute operations, peformed on /dev/mem */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _MEMRANGE_H #define _MEMRANGE_H /* Memory range attributes */ #define MDF_UNCACHEABLE (1<<0) /* region not cached */ #define MDF_WRITECOMBINE (1<<1) /* region supports "write combine" * action */ #define MDF_WRITETHROUGH (1<<2) /* write-through cached */ #define MDF_WRITEBACK (1<<3) /* write-back cached */ #define MDF_WRITEPROTECT (1<<4) /* read-only region */ #define MDF_ATTRMASK (0x00ffffff) #define MDF_FIXBASE (1<<24) /* fixed base */ #define MDF_FIXLEN (1<<25) /* fixed length */ #define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */ #define MDF_ACTIVE (1<<27) /* currently active */ #define MDF_BOGUS (1<<28) /* we don't like it */ #define MDF_FIXACTIVE (1<<29) /* can't be turned off */ #define MDF_BUSY (1<<30) /* range is in use */ struct mem_range_desc { u_int64_t mr_base; u_int64_t mr_len; int mr_flags; char mr_owner[8]; }; struct mem_range_op { struct mem_range_desc *mo_desc; int mo_arg[2]; #define MEMRANGE_SET_UPDATE 0 #define MEMRANGE_SET_REMOVE 1 /* XXX want a flag that says "set and undo when I exit" */ }; #define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op) #define MEMRANGE_SET _IOW('m', 51, struct mem_range_op) #ifdef _KERNEL struct mem_range_softc; struct mem_range_ops { void (*init) __P((struct mem_range_softc * sc)); int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg)); void (*initAP) __P((struct mem_range_softc * sc)); }; struct mem_range_softc { struct mem_range_ops *mr_op; int mr_cap; int mr_ndesc; struct mem_range_desc *mr_desc; }; extern struct mem_range_softc mem_range_softc; extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg)); extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg)); extern void mem_range_AP_init __P((void)); #endif #endif xorg-server-1.20.8/hw/xfree86/os-support/meson.build0000644000175000017500000000773113640201473017220 00000000000000srcs_xorg_os_support = [ 'bus/nobus.c', 'shared/posix_tty.c', 'shared/sigio.c', 'shared/vidmem.c', ] hdrs_xorg_os_support = [ 'bus/xf86Pci.h', 'xf86_OSlib.h', 'xf86_OSproc.h' ] os_support_flags = ['-DUSESTDRES'] if get_option('pciaccess') srcs_xorg_os_support += 'bus/Pci.c' if host_machine.system() != 'linux' and host_machine.system() != 'solaris' srcs_xorg_os_support += 'bus/bsd_pci.c' endif if host_machine.cpu() == 'sparc' srcs_xorg_os_support += 'bus/Sbus.c' install_data('bus/xf86Sbus.h', install_dir: xorgsdkdir) endif endif if host_machine.system() == 'linux' srcs_xorg_os_support += [ 'linux/lnx_agp.c', 'linux/lnx_bell.c', 'linux/lnx_init.c', 'linux/lnx_kmod.c', 'linux/lnx_platform.c', 'linux/lnx_video.c', 'misc/SlowBcopy.c', 'shared/VTsw_usl.c', ] if build_systemd_logind srcs_xorg_os_support += 'linux/systemd-logind.c' endif # this is ugly because the code is also if build_apm or build_acpi srcs_xorg_os_support += 'linux/lnx_apm.c' if build_acpi srcs_xorg_os_support += 'linux/lnx_acpi.c' endif endif elif host_machine.system() == 'solaris' srcs_xorg_os_support += [ 'solaris/sun_apm.c', 'solaris/sun_bell.c', 'solaris/sun_init.c', 'solaris/sun_vid.c', 'shared/kmod_noop.c', ] if cc.has_header('sys/vt.h') srcs_xorg_os_support += 'solaris/sun_VTsw.c' else srcs_xorg_os_support += 'shared/VTsw_noop.c' endif if cc.has_header('sys/agpio.h') or cc.has_header('sys/agpgart.h') srcs_xorg_os_support += 'solaris/sun_agp.c' else srcs_xorg_os_support += 'shared/agp_noop.c' endif if host_machine.cpu_family() == 'sparc' srcs_xorg_os_support += 'solaris/solaris-sparcv8plus.S' elif host_machine.cpu_family() == 'x86_64' srcs_xorg_os_support += 'solaris/solaris-amd64.S' elif host_machine.cpu_family() == 'x86' srcs_xorg_os_support += 'solaris/solaris-ia32.S' else error('Unknown CPU family for Solaris build') endif elif host_machine.system().endswith('bsd') srcs_xorg_os_support += [ 'bsd/bsd_VTsw.c', 'bsd/bsd_bell.c', 'bsd/bsd_init.c', ] # XXX: APM if host_machine.cpu_family() == 'x86_64' srcs_xorg_os_support += 'bsd/i386_video.c' elif host_machine.cpu_family() == 'x86' srcs_xorg_os_support += 'bsd/i386_video.c' elif host_machine.cpu_family() == 'arm' srcs_xorg_os_support += 'bsd/arm_video.c' elif host_machine.cpu_family() == 'powerpc' srcs_xorg_os_support += 'bsd/ppc_video.c' elif host_machine.cpu_family() == 'sparc64' srcs_xorg_os_support += 'bsd/sparc64_video.c' srcs_xorg_os_support += 'shared/ioperm_noop.c' elif host_machine.cpu_family() == 'alpha' srcs_xorg_os_support += 'bsd/alpha_video.c' endif if host_machine.system() == 'freebsd' srcs_xorg_os_support += 'bsd/bsd_kmod.c' else srcs_xorg_os_support += 'shared/kmod_noop.c' endif if cc.has_header('sys/agpio.h') or cc.has_header('sys/agpgart.h') srcs_xorg_os_support += 'linux/lnx_agp.c' else srcs_xorg_os_support += 'shared/agp_noop.c' endif else # stub ossupport srcs_xorg_os_support += [ 'shared/VTsw_noop.c', 'shared/agp_noop.c', 'shared/ioperm_noop.c', 'shared/kmod_noop.c', 'shared/pm_noop.c', 'shared/vidmem.c', 'shared/posix_tty.c', 'shared/sigio.c', 'stub/stub_bell.c', 'stub/stub_init.c', 'stub/stub_video.c', ] endif xorg_os_support = static_library('xorg_os_support', srcs_xorg_os_support, include_directories: [inc, xorg_inc], dependencies: [ common_dep, dbus_dep, libdrm_dep, ], c_args: xorg_c_args, ) install_data(hdrs_xorg_os_support, install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/os-support/hurd/0000755000175000017500000000000013640201534016066 500000000000000xorg-server-1.20.8/hw/xfree86/os-support/hurd/Makefile.am0000644000175000017500000000067013640201473020047 00000000000000noinst_LTLIBRARIES = libhurd.la libhurd_la_SOURCES = hurd_bell.c hurd_init.c \ hurd_video.c \ $(srcdir)/../shared/VTsw_noop.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/sigiostubs.c \ $(srcdir)/../shared/pm_noop.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/agp_noop.c AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) xorg-server-1.20.8/hw/xfree86/os-support/hurd/hurd_video.c0000644000175000017500000000545313640201473020313 00000000000000/* * Copyright 1997, 1998 by UCHIYAMA Yasushi * * 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 UCHIYAMA Yasushi not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. UCHIYAMA Yasushi makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL UCHIYAMA YASUSHI 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 #endif #include #include #include #include #include #include "input.h" #include "scrnintstr.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" /************************************************************************** * Video Memory Mapping section ***************************************************************************/ /************************************************************************** * I/O Permissions section ***************************************************************************/ /* * Due to conflicts with "compiler.h", don't rely on to declare * this. */ extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on); Bool xf86EnableIO() { if (ioperm(0, 0x10000, 1)) { FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno)); return FALSE; } #if 0 /* * Trapping disabled for now, as some VBIOSes (mga-g450 notably) use these * ports, and the int10 wrapper is not emulating them. (Note that it's * effectively what happens in the Linux variant too, as iopl() is used * there, making the ioperm() meaningless.) * * Reenable this when int10 gets fixed. */ ioperm(0x40, 4, 0); /* trap access to the timer chip */ ioperm(0x60, 4, 0); /* trap access to the keyboard controller */ #endif return TRUE; } void xf86DisableIO() { ioperm(0, 0x10000, 0); return; } void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; } xorg-server-1.20.8/hw/xfree86/os-support/hurd/hurd_bell.c0000644000175000017500000000254113640201473020116 00000000000000/* * Copyright © 2006 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86Priv.h" void xf86OSRingBell(int loudness, int pitch, int duration) { return; } xorg-server-1.20.8/hw/xfree86/os-support/hurd/Makefile.in0000644000175000017500000010621213640201513020052 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/os-support/hurd ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libhurd_la_LIBADD = am_libhurd_la_OBJECTS = hurd_bell.lo hurd_init.lo hurd_video.lo \ VTsw_noop.lo posix_tty.lo vidmem.lo sigiostubs.lo pm_noop.lo \ kmod_noop.lo agp_noop.lo libhurd_la_OBJECTS = $(am_libhurd_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/VTsw_noop.Plo \ ./$(DEPDIR)/agp_noop.Plo ./$(DEPDIR)/hurd_bell.Plo \ ./$(DEPDIR)/hurd_init.Plo ./$(DEPDIR)/hurd_video.Plo \ ./$(DEPDIR)/kmod_noop.Plo ./$(DEPDIR)/pm_noop.Plo \ ./$(DEPDIR)/posix_tty.Plo ./$(DEPDIR)/sigiostubs.Plo \ ./$(DEPDIR)/vidmem.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libhurd_la_SOURCES) DIST_SOURCES = $(libhurd_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libhurd.la libhurd_la_SOURCES = hurd_bell.c hurd_init.c \ hurd_video.c \ $(srcdir)/../shared/VTsw_noop.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/sigiostubs.c \ $(srcdir)/../shared/pm_noop.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/agp_noop.c AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/hurd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/os-support/hurd/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libhurd.la: $(libhurd_la_OBJECTS) $(libhurd_la_DEPENDENCIES) $(EXTRA_libhurd_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libhurd_la_OBJECTS) $(libhurd_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_bell.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_video.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm_noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigiostubs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< VTsw_noop.lo: $(srcdir)/../shared/VTsw_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_noop.lo -MD -MP -MF $(DEPDIR)/VTsw_noop.Tpo -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/VTsw_noop.Tpo $(DEPDIR)/VTsw_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/VTsw_noop.c' object='VTsw_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c posix_tty.lo: $(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c vidmem.lo: $(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c sigiostubs.lo: $(srcdir)/../shared/sigiostubs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigiostubs.lo -MD -MP -MF $(DEPDIR)/sigiostubs.Tpo -c -o sigiostubs.lo `test -f '$(srcdir)/../shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigiostubs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sigiostubs.Tpo $(DEPDIR)/sigiostubs.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/sigiostubs.c' object='sigiostubs.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigiostubs.lo `test -f '$(srcdir)/../shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigiostubs.c pm_noop.lo: $(srcdir)/../shared/pm_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pm_noop.lo -MD -MP -MF $(DEPDIR)/pm_noop.Tpo -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pm_noop.Tpo $(DEPDIR)/pm_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/pm_noop.c' object='pm_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c agp_noop.lo: $(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT agp_noop.lo -MD -MP -MF $(DEPDIR)/agp_noop.Tpo -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/agp_noop.Tpo $(DEPDIR)/agp_noop.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../shared/agp_noop.c' object='agp_noop.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/VTsw_noop.Plo -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/hurd_bell.Plo -rm -f ./$(DEPDIR)/hurd_init.Plo -rm -f ./$(DEPDIR)/hurd_video.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/pm_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigiostubs.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/VTsw_noop.Plo -rm -f ./$(DEPDIR)/agp_noop.Plo -rm -f ./$(DEPDIR)/hurd_bell.Plo -rm -f ./$(DEPDIR)/hurd_init.Plo -rm -f ./$(DEPDIR)/hurd_video.Plo -rm -f ./$(DEPDIR)/kmod_noop.Plo -rm -f ./$(DEPDIR)/pm_noop.Plo -rm -f ./$(DEPDIR)/posix_tty.Plo -rm -f ./$(DEPDIR)/sigiostubs.Plo -rm -f ./$(DEPDIR)/vidmem.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/os-support/hurd/hurd_init.c0000644000175000017500000000453513640201473020150 00000000000000/* * Copyright 1997,1998 by UCHIYAMA Yasushi * * 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 UCHIYAMA Yasushi not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. UCHIYAMA Yasushi makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL UCHIYAMA YASUSHI 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 #endif #include #include "input.h" #include "scrnintstr.h" #include "compiler.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include #include #include #include #include #include #include int xf86ProcessArgument(int argc, char **argv, int i) { return 0; } void xf86UseMsg() { return; } void xf86OpenConsole() { if (serverGeneration == 1) { kern_return_t err; mach_port_t device; int fd; err = get_privileged_ports(NULL, &device); if (err) { errno = err; FatalError("xf86KbdInit can't get_privileged_ports. (%s)\n", strerror(errno)); } mach_port_deallocate(mach_task_self(), device); if ((fd = open("/dev/kbd", O_RDONLY | O_NONBLOCK)) < 0) { fprintf(stderr, "Cannot open keyboard (%s)\n", strerror(errno)); exit(1); } xf86Info.consoleFd = fd; } return; } void xf86CloseConsole() { close(xf86Info.consoleFd); return; } void xf86OSInputThreadInit(void) { return; } xorg-server-1.20.8/hw/xfree86/os-support/xf86_OSproc.h0000644000175000017500000002100613640201473017276 00000000000000/* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes * Copyright 1992 by Jim Tsillas * Copyright 1992 by Rich Murphey * Copyright 1992 by Robert Baron * Copyright 1992 by Orest Zborowski * Copyright 1993 by Vrije Universiteit, The Netherlands * Copyright 1993 by David Wexelblat * Copyright 1994, 1996 by Holger Veit * Copyright 1994-2003 by The XFree86 Project, Inc * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holders * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holders make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* * The ARM32 code here carries the following copyright: * * Copyright 1997 * Digital Equipment Corporation. All rights reserved. * This software is furnished under license and may be used and copied only in * accordance with the following terms and conditions. Subject to these * conditions, you may download, copy, install, use, modify and distribute * this software in source and/or binary form. No title or ownership is * transferred hereby. * * 1) Any source code used, modified or distributed must reproduce and retain * this copyright notice and list of conditions as they appear in the * source file. * * 2) No right is granted to use any trade name, trademark, or logo of Digital * Equipment Corporation. Neither the "Digital Equipment Corporation" * name nor any trademark or logo of Digital Equipment Corporation may be * used to endorse or promote products derived from this software without * the prior written permission of Digital Equipment Corporation. * * 3) This software is provided "AS-IS" and any express or implied warranties, * including but not limited to, any implied warranties of merchantability, * fitness for a particular purpose, or non-infringement are disclaimed. * In no event shall DIGITAL be liable for any damages whatsoever, and in * particular, DIGITAL shall not be liable for special, indirect, * consequential, or incidental damages or damages for lost profits, loss * of revenue or loss of use, whether such damages arise in contract, * negligence, tort, under statute, in equity, at law or otherwise, even * if advised of the possibility of such damage. * */ #ifndef _XF86_OSPROC_H #define _XF86_OSPROC_H /* * The actual prototypes have been pulled into this seperate file so * that they can can be used without pulling in all of the OS specific * stuff like sys/stat.h, etc. This casues problem for loadable modules. */ /* * OS-independent modem state flags for xf86SetSerialModemState() and * xf86GetSerialModemState(). */ #define XF86_M_LE 0x001 /* line enable */ #define XF86_M_DTR 0x002 /* data terminal ready */ #define XF86_M_RTS 0x004 /* request to send */ #define XF86_M_ST 0x008 /* secondary transmit */ #define XF86_M_SR 0x010 /* secondary receive */ #define XF86_M_CTS 0x020 /* clear to send */ #define XF86_M_CAR 0x040 /* carrier detect */ #define XF86_M_RNG 0x080 /* ring */ #define XF86_M_DSR 0x100 /* data set ready */ #ifndef NO_OSLIB_PROTOTYPES /* * This is to prevent re-entrancy to FatalError() when aborting. * Anything that can be called as a result of AbortDDX() should use this * instead of FatalError(). */ #define xf86FatalError(a, b) \ if (dispatchException & DE_TERMINATE) { \ ErrorF(a, b); \ ErrorF("\n"); \ return; \ } else FatalError(a, b) /***************************************************************************/ /* Prototypes */ /***************************************************************************/ #include #include "opaque.h" #include "xf86Optionstr.h" _XFUNCPROTOBEGIN /* public functions */ extern _X_EXPORT Bool xf86EnableIO(void); extern _X_EXPORT void xf86DisableIO(void); #ifdef __NetBSD__ extern _X_EXPORT void xf86SetTVOut(int); extern _X_EXPORT void xf86SetRGBOut(void); #endif extern _X_EXPORT void xf86OSRingBell(int, int, int); extern _X_EXPORT void xf86SetReallySlowBcopy(void); extern _X_EXPORT void xf86SlowBcopy(unsigned char *, unsigned char *, int); extern _X_EXPORT int xf86OpenSerial(XF86OptionPtr options); extern _X_EXPORT int xf86SetSerial(int fd, XF86OptionPtr options); extern _X_EXPORT int xf86SetSerialSpeed(int fd, int speed); extern _X_EXPORT int xf86ReadSerial(int fd, void *buf, int count); extern _X_EXPORT int xf86WriteSerial(int fd, const void *buf, int count); extern _X_EXPORT int xf86CloseSerial(int fd); extern _X_EXPORT int xf86FlushInput(int fd); extern _X_EXPORT int xf86WaitForInput(int fd, int timeout); extern _X_EXPORT int xf86SerialSendBreak(int fd, int duration); extern _X_EXPORT int xf86SetSerialModemState(int fd, int state); extern _X_EXPORT int xf86GetSerialModemState(int fd); extern _X_EXPORT int xf86SerialModemSetBits(int fd, int bits); extern _X_EXPORT int xf86SerialModemClearBits(int fd, int bits); extern _X_EXPORT int xf86LoadKernelModule(const char *pathname); extern _X_EXPORT void xf86OSInputThreadInit(void); /* AGP GART interface */ typedef struct _AgpInfo { CARD32 bridgeId; CARD32 agpMode; unsigned long base; unsigned long size; unsigned long totalPages; unsigned long systemPages; unsigned long usedPages; } AgpInfo, *AgpInfoPtr; extern _X_EXPORT Bool xf86AgpGARTSupported(void); extern _X_EXPORT AgpInfoPtr xf86GetAGPInfo(int screenNum); extern _X_EXPORT Bool xf86AcquireGART(int screenNum); extern _X_EXPORT Bool xf86ReleaseGART(int screenNum); extern _X_EXPORT int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, unsigned long *physical); extern _X_EXPORT Bool xf86DeallocateGARTMemory(int screenNum, int key); extern _X_EXPORT Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset); extern _X_EXPORT Bool xf86UnbindGARTMemory(int screenNum, int key); extern _X_EXPORT Bool xf86EnableAGP(int screenNum, CARD32 mode); extern _X_EXPORT Bool xf86GARTCloseScreen(int screenNum); /* These routines are in shared/sigio.c and are not loaded as part of the module. These routines are small, and the code if very POSIX-signal (or OS-signal) specific, so it seemed better to provide more complex wrappers than to wrap each individual function called. */ extern _X_EXPORT int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *); extern _X_EXPORT int xf86RemoveSIGIOHandler(int fd); #ifdef XF86_OS_PRIVS typedef void (*PMClose) (void); extern _X_EXPORT void xf86OpenConsole(void); extern _X_EXPORT void xf86CloseConsole(void); extern _X_HIDDEN Bool xf86VTActivate(int vtno); extern _X_EXPORT Bool xf86VTSwitchPending(void); extern _X_EXPORT Bool xf86VTSwitchAway(void); extern _X_EXPORT Bool xf86VTSwitchTo(void); extern _X_EXPORT void xf86VTRequest(int sig); extern _X_EXPORT int xf86ProcessArgument(int, char **, int); extern _X_EXPORT void xf86UseMsg(void); extern _X_EXPORT PMClose xf86OSPMOpen(void); extern _X_EXPORT void xf86InitVidMem(void); #endif /* XF86_OS_PRIVS */ #ifdef XSERVER_PLATFORM_BUS #include "hotplug.h" void xf86PlatformDeviceProbe(struct OdevAttributes *attribs); void xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs); #endif _XFUNCPROTOEND #endif /* NO_OSLIB_PROTOTYPES */ #endif /* _XF86_OSPROC_H */ xorg-server-1.20.8/hw/xfree86/common/0000755000175000017500000000000013640201534014261 500000000000000xorg-server-1.20.8/hw/xfree86/common/xf86xv.c0000644000175000017500000016610613640201473015532 00000000000000/* * XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) */ /* * Copyright (c) 1998-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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include #include #include "scrnintstr.h" #include "regionstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "mivalidate.h" #include "validate.h" #include "resource.h" #include "gcstruct.h" #include "dixstruct.h" #include #include #include "xvdix.h" #include "xf86xvpriv.h" /* XvAdaptorRec fields */ static int xf86XVPutVideo(DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVPutStill(DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVGetVideo(DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVGetStill(DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVStopVideo(XvPortPtr, DrawablePtr); static int xf86XVSetPortAttribute(XvPortPtr, Atom, INT32); static int xf86XVGetPortAttribute(XvPortPtr, Atom, INT32 *); static int xf86XVQueryBestSize(XvPortPtr, CARD8, CARD16, CARD16, CARD16, CARD16, unsigned int *, unsigned int *); static int xf86XVPutImage(DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char *, Bool, CARD16, CARD16); static int xf86XVQueryImageAttributes(XvPortPtr, XvImagePtr, CARD16 *, CARD16 *, int *, int *); /* ScreenRec fields */ static Bool xf86XVDestroyWindow(WindowPtr pWin); static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1); static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind); static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); static Bool xf86XVCloseScreen(ScreenPtr); #define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1) /* ScrnInfoRec functions */ static Bool xf86XVEnterVT(ScrnInfoPtr); static void xf86XVLeaveVT(ScrnInfoPtr); static void xf86XVAdjustFrame(ScrnInfoPtr, int x, int y); static void xf86XVModeSet(ScrnInfoPtr pScrn); /* misc */ static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr *, int); static DevPrivateKeyRec XF86XVWindowKeyRec; #define XF86XVWindowKey (&XF86XVWindowKeyRec) /* dixmain.c XvScreenPtr screen private */ DevPrivateKey XF86XvScreenKey; /** xf86xv.c XF86XVScreenPtr screen private */ static DevPrivateKeyRec XF86XVScreenPrivateKey; static unsigned long PortResource = 0; #define GET_XV_SCREEN(pScreen) \ ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey)) #define GET_XF86XV_SCREEN(pScreen) \ ((XF86XVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey))) #define GET_XF86XV_WINDOW(pWin) \ ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey)) static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL; static int NumGenDrivers = 0; int xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc) { xf86XVInitGenericAdaptorPtr *newdrivers; newdrivers = reallocarray(GenDrivers, 1 + NumGenDrivers, sizeof(xf86XVInitGenericAdaptorPtr)); if (!newdrivers) return 0; GenDrivers = newdrivers; GenDrivers[NumGenDrivers++] = InitFunc; return 1; } int xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** adaptors) { int i, j, n, num; XF86VideoAdaptorPtr *DrivAdap, *new; num = 0; *adaptors = NULL; /* * The v4l driver registers itself first, but can use surfaces registered * by other drivers. So, call the v4l driver last. */ for (i = NumGenDrivers; --i >= 0;) { DrivAdap = NULL; n = (*GenDrivers[i]) (pScrn, &DrivAdap); if (0 == n) continue; new = reallocarray(*adaptors, num + n, sizeof(XF86VideoAdaptorPtr)); if (NULL == new) continue; *adaptors = new; for (j = 0; j < n; j++, num++) (*adaptors)[num] = DrivAdap[j]; } return num; } /**************** Offscreen surface stuff *******************/ typedef struct { XF86OffscreenImagePtr images; int num; } OffscreenImageRec; static DevPrivateKeyRec OffscreenPrivateKeyRec; #define OffscreenPrivateKey (&OffscreenPrivateKeyRec) #define GetOffscreenImage(pScreen) ((OffscreenImageRec *) dixLookupPrivate(&(pScreen)->devPrivates, OffscreenPrivateKey)) Bool xf86XVRegisterOffscreenImages(ScreenPtr pScreen, XF86OffscreenImagePtr images, int num) { OffscreenImageRec *OffscreenImage; /* This function may be called before xf86XVScreenInit, so there's * no better place than this to call dixRegisterPrivateKey to ensure we * have space reserved. After the first call it is a no-op. */ if (!dixRegisterPrivateKey (OffscreenPrivateKey, PRIVATE_SCREEN, sizeof(OffscreenImageRec)) || !(OffscreenImage = GetOffscreenImage(pScreen))) /* Every X.org driver assumes this function always succeeds, so * just die on allocation failure. */ FatalError ("Could not allocate private storage for XV offscreen images.\n"); OffscreenImage->num = num; OffscreenImage->images = images; return TRUE; } XF86OffscreenImagePtr xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num) { OffscreenImageRec *OffscreenImage = GetOffscreenImage(pScreen); *num = OffscreenImage->num; return OffscreenImage->images; } XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn) { return calloc(1, sizeof(XF86VideoAdaptorRec)); } void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr) { free(ptr); } Bool xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) { ScrnInfoPtr pScrn; XF86XVScreenPtr ScreenPriv; if (num <= 0 || noXvExtension) return FALSE; if (Success != XvScreenInit(pScreen)) return FALSE; if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0)) return FALSE; if (!dixRegisterPrivateKey(&XF86XVScreenPrivateKey, PRIVATE_SCREEN, 0)) return FALSE; XF86XvScreenKey = XvGetScreenKey(); PortResource = XvGetRTPort(); ScreenPriv = malloc(sizeof(XF86XVScreenRec)); dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv); if (!ScreenPriv) return FALSE; pScrn = xf86ScreenToScrn(pScreen); ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->WindowExposures = pScreen->WindowExposures; ScreenPriv->PostValidateTree = PostValidateTreeUndefined; ScreenPriv->ClipNotify = pScreen->ClipNotify; ScreenPriv->CloseScreen = pScreen->CloseScreen; ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->AdjustFrame = pScrn->AdjustFrame; ScreenPriv->ModeSet = pScrn->ModeSet; pScreen->DestroyWindow = xf86XVDestroyWindow; pScreen->WindowExposures = xf86XVWindowExposures; pScreen->ClipNotify = xf86XVClipNotify; pScreen->CloseScreen = xf86XVCloseScreen; pScrn->EnterVT = xf86XVEnterVT; pScrn->LeaveVT = xf86XVLeaveVT; if (pScrn->AdjustFrame) pScrn->AdjustFrame = xf86XVAdjustFrame; pScrn->ModeSet = xf86XVModeSet; if (!xf86XVInitAdaptors(pScreen, adaptors, num)) return FALSE; return TRUE; } static void xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) { int i; if (pAdaptor->pPorts) { XvPortPtr pPort = pAdaptor->pPorts; XvPortRecPrivatePtr pPriv; for (i = 0; i < pAdaptor->nPorts; i++, pPort++) { pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr; if (pPriv) { if (pPriv->clientClip) RegionDestroy(pPriv->clientClip); if (pPriv->pCompositeClip && pPriv->FreeCompositeClip) RegionDestroy(pPriv->pCompositeClip); if (pPriv->ckeyFilled) RegionDestroy(pPriv->ckeyFilled); free(pPriv); } } } XvFreeAdaptor(pAdaptor); } static Bool xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number) { XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XF86VideoAdaptorPtr adaptorPtr; XvAdaptorPtr pAdaptor, pa; XvAdaptorRecPrivatePtr adaptorPriv; int na, numAdaptor; XvPortRecPrivatePtr portPriv; XvPortPtr pPort, pp; int numPort; XF86VideoFormatPtr formatPtr; XvFormatPtr pFormat, pf; int numFormat, totFormat; XF86VideoEncodingPtr encodingPtr; XvEncodingPtr pEncode, pe; int numVisuals; VisualPtr pVisual; int i; pxvs->nAdaptors = 0; pxvs->pAdaptors = NULL; if (!(pAdaptor = calloc(number, sizeof(XvAdaptorRec)))) return FALSE; for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { adaptorPtr = infoPtr[na]; if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute || !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize) continue; /* client libs expect at least one encoding */ if (!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) continue; pa->type = adaptorPtr->type; if (!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) pa->type &= ~XvVideoMask; if (!adaptorPtr->PutStill && !adaptorPtr->GetStill) pa->type &= ~XvStillMask; if (!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) pa->type &= ~XvImageMask; if (!adaptorPtr->PutVideo && !adaptorPtr->PutImage && !adaptorPtr->PutStill) pa->type &= ~XvInputMask; if (!adaptorPtr->GetVideo && !adaptorPtr->GetStill) pa->type &= ~XvOutputMask; if (!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) continue; if (!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) continue; pa->pScreen = pScreen; pa->ddPutVideo = xf86XVPutVideo; pa->ddPutStill = xf86XVPutStill; pa->ddGetVideo = xf86XVGetVideo; pa->ddGetStill = xf86XVGetStill; pa->ddStopVideo = xf86XVStopVideo; pa->ddPutImage = xf86XVPutImage; pa->ddSetPortAttribute = xf86XVSetPortAttribute; pa->ddGetPortAttribute = xf86XVGetPortAttribute; pa->ddQueryBestSize = xf86XVQueryBestSize; pa->ddQueryImageAttributes = xf86XVQueryImageAttributes; pa->name = strdup(adaptorPtr->name); if (adaptorPtr->nEncodings && (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { for (pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) { pe->id = encodingPtr->id; pe->pScreen = pScreen; pe->name = strdup(encodingPtr->name); pe->width = encodingPtr->width; pe->height = encodingPtr->height; pe->rate.numerator = encodingPtr->rate.numerator; pe->rate.denominator = encodingPtr->rate.denominator; } pa->nEncodings = adaptorPtr->nEncodings; pa->pEncodings = pEncode; } if (adaptorPtr->nImages && (pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { memcpy(pa->pImages, adaptorPtr->pImages, adaptorPtr->nImages * sizeof(XvImageRec)); pa->nImages = adaptorPtr->nImages; } if (adaptorPtr->nAttributes && (pa->pAttributes = calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { memcpy(pa->pAttributes, adaptorPtr->pAttributes, adaptorPtr->nAttributes * sizeof(XvAttributeRec)); for (i = 0; i < adaptorPtr->nAttributes; i++) { pa->pAttributes[i].name = strdup(adaptorPtr->pAttributes[i].name); } pa->nAttributes = adaptorPtr->nAttributes; } totFormat = adaptorPtr->nFormats; if (!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) { xf86XVFreeAdaptor(pa); continue; } for (pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; i < adaptorPtr->nFormats; i++, formatPtr++) { numVisuals = pScreen->numVisuals; pVisual = pScreen->visuals; while (numVisuals--) { if ((pVisual->class == formatPtr->class) && (pVisual->nplanes == formatPtr->depth)) { if (numFormat >= totFormat) { void *moreSpace; totFormat *= 2; moreSpace = reallocarray(pFormat, totFormat, sizeof(XvFormatRec)); if (!moreSpace) break; pFormat = moreSpace; pf = pFormat + numFormat; } pf->visual = pVisual->vid; pf->depth = formatPtr->depth; pf++; numFormat++; } pVisual++; } } pa->nFormats = numFormat; pa->pFormats = pFormat; if (!numFormat) { xf86XVFreeAdaptor(pa); continue; } if (!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) { xf86XVFreeAdaptor(pa); continue; } adaptorPriv->flags = adaptorPtr->flags; adaptorPriv->PutVideo = adaptorPtr->PutVideo; adaptorPriv->PutStill = adaptorPtr->PutStill; adaptorPriv->GetVideo = adaptorPtr->GetVideo; adaptorPriv->GetStill = adaptorPtr->GetStill; adaptorPriv->StopVideo = adaptorPtr->StopVideo; adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute; adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute; adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize; adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes; adaptorPriv->PutImage = adaptorPtr->PutImage; adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */ pa->devPriv.ptr = (void *) adaptorPriv; if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) { xf86XVFreeAdaptor(pa); continue; } for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) { if (!(pp->id = FakeClientID(0))) continue; if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate)))) continue; if (!AddResource(pp->id, PortResource, pp)) { free(portPriv); continue; } pp->pAdaptor = pa; pp->pNotify = (XvPortNotifyPtr) NULL; pp->pDraw = (DrawablePtr) NULL; pp->client = (ClientPtr) NULL; pp->grab.client = (ClientPtr) NULL; pp->time = currentTime; pp->devPriv.ptr = portPriv; portPriv->pScrn = pScrn; portPriv->AdaptorRec = adaptorPriv; portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; pp++; numPort++; } pa->nPorts = numPort; pa->pPorts = pPort; if (!numPort) { xf86XVFreeAdaptor(pa); continue; } pa->base_id = pPort->id; pa++; numAdaptor++; } if (numAdaptor) { pxvs->nAdaptors = numAdaptor; pxvs->pAdaptors = pAdaptor; } else { free(pAdaptor); return FALSE; } return TRUE; } /* Video should be clipped to the intersection of the window cliplist and the client cliplist specified in the GC for which the video was initialized. When we need to reclip a window, the GC that started the video may not even be around anymore. That's why we save the client clip from the GC when the video is initialized. We then use xf86XVUpdateCompositeClip to calculate the new composite clip when we need it. This is different from what DEC did. They saved the GC and used it's clip list when they needed to reclip the window, even if the client clip was different from the one the video was initialized with. If the original GC was destroyed, they had to stop the video. I like the new method better (MArk). This function only works for windows. Will need to rewrite when (if) we support pixmap rendering. */ static void xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) { RegionPtr pregWin, pCompositeClip; WindowPtr pWin; Bool freeCompClip = FALSE; if (portPriv->pCompositeClip) return; pWin = (WindowPtr) portPriv->pDraw; /* get window clip list */ if (portPriv->subWindowMode == IncludeInferiors) { pregWin = NotClippedByChildren(pWin); freeCompClip = TRUE; } else pregWin = &pWin->clipList; if (!portPriv->clientClip) { portPriv->pCompositeClip = pregWin; portPriv->FreeCompositeClip = freeCompClip; return; } pCompositeClip = RegionCreate(NullBox, 1); RegionCopy(pCompositeClip, portPriv->clientClip); RegionTranslate(pCompositeClip, portPriv->pDraw->x, portPriv->pDraw->y); RegionIntersect(pCompositeClip, pregWin, pCompositeClip); portPriv->pCompositeClip = pCompositeClip; portPriv->FreeCompositeClip = TRUE; if (freeCompClip) { RegionDestroy(pregWin); } } /* Save the current clientClip and update the CompositeClip whenever we have a fresh GC */ static void xf86XVCopyClip(XvPortRecPrivatePtr portPriv, GCPtr pGC) { /* copy the new clip if it exists */ if (pGC->clientClip) { if (!portPriv->clientClip) portPriv->clientClip = RegionCreate(NullBox, 1); /* Note: this is in window coordinates */ RegionCopy(portPriv->clientClip, pGC->clientClip); RegionTranslate(portPriv->clientClip, pGC->clipOrg.x, pGC->clipOrg.y); } else if (portPriv->clientClip) { /* free the old clientClip */ RegionDestroy(portPriv->clientClip); portPriv->clientClip = NULL; } /* get rid of the old clip list */ if (portPriv->pCompositeClip && portPriv->FreeCompositeClip) { RegionDestroy(portPriv->pCompositeClip); } portPriv->pCompositeClip = pGC->pCompositeClip; portPriv->FreeCompositeClip = FALSE; portPriv->subWindowMode = pGC->subWindowMode; } static void xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv, GCPtr pGC, DrawablePtr pDraw) { if (!portPriv->clientClip) portPriv->clientClip = RegionCreate(NullBox, 1); /* Keep the original GC composite clip around for ReputImage */ RegionCopy(portPriv->clientClip, pGC->pCompositeClip); RegionTranslate(portPriv->clientClip, -pDraw->x, -pDraw->y); /* get rid of the old clip list */ if (portPriv->pCompositeClip && portPriv->FreeCompositeClip) RegionDestroy(portPriv->pCompositeClip); portPriv->pCompositeClip = pGC->pCompositeClip; portPriv->FreeCompositeClip = FALSE; portPriv->subWindowMode = pGC->subWindowMode; } static int xf86XVRegetVideo(XvPortRecPrivatePtr portPriv) { RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE; xf86XVUpdateCompositeClip(portPriv); /* translate the video region to the screen */ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; /* clip to the window composite clip */ RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip); /* that's all if it's totally obscured */ if (!RegionNotEmpty(&ClipRegion)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; } ret = (*portPriv->AdaptorRec->GetVideo) (portPriv->pScrn, portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, portPriv->vid_w, portPriv->vid_h, portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr, portPriv->pDraw); if (ret == Success) portPriv->isOn = XV_ON; CLIP_VIDEO_BAILOUT: if ((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ if (!portPriv->FreeCompositeClip) portPriv->pCompositeClip = NULL; RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } static int xf86XVReputVideo(XvPortRecPrivatePtr portPriv) { RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE; xf86XVUpdateCompositeClip(portPriv); /* translate the video region to the screen */ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; /* clip to the window composite clip */ RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; VPBox.x2 = portPriv->pScrn->frameX1 + 1; VPBox.y2 = portPriv->pScrn->frameY1 + 1; RegionInit(&VPReg, &VPBox, 1); RegionIntersect(&ClipRegion, &ClipRegion, &VPReg); RegionUninit(&VPReg); } /* that's all if it's totally obscured */ if (!RegionNotEmpty(&ClipRegion)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; } ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->pScrn, portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, portPriv->vid_w, portPriv->vid_h, portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr, portPriv->pDraw); if (ret == Success) portPriv->isOn = XV_ON; CLIP_VIDEO_BAILOUT: if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ if (!portPriv->FreeCompositeClip) portPriv->pCompositeClip = NULL; RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } /* Reput image/still */ static int xf86XVReputImage(XvPortRecPrivatePtr portPriv) { RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE; xf86XVUpdateCompositeClip(portPriv); /* the clip can get smaller over time */ RegionCopy(portPriv->clientClip, portPriv->pCompositeClip); RegionTranslate(portPriv->clientClip, -portPriv->pDraw->x, -portPriv->pDraw->y); /* translate the video region to the screen */ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; /* clip to the window composite clip */ RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; VPBox.x2 = portPriv->pScrn->frameX1 + 1; VPBox.y2 = portPriv->pScrn->frameY1 + 1; RegionInit(&VPReg, &VPBox, 1); RegionIntersect(&ClipRegion, &ClipRegion, &VPReg); RegionUninit(&VPReg); } /* that's all if it's totally obscured */ if (!RegionNotEmpty(&ClipRegion)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; } ret = (*portPriv->AdaptorRec->ReputImage) (portPriv->pScrn, portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, portPriv->vid_w, portPriv->vid_h, portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr, portPriv->pDraw); portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF; CLIP_VIDEO_BAILOUT: if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ if (!portPriv->FreeCompositeClip) portPriv->pCompositeClip = NULL; RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } static int xf86XVReputAllVideo(WindowPtr pWin, void *data) { XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); while (WinPriv) { if (WinPriv->PortRec->type == XvInputMask) xf86XVReputVideo(WinPriv->PortRec); else xf86XVRegetVideo(WinPriv->PortRec); WinPriv = WinPriv->next; } return WT_WALKCHILDREN; } static int xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { XF86XVWindowPtr winPriv, PrivRoot; winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin); /* Enlist our port in the window private */ while (winPriv) { if (winPriv->PortRec == portPriv) /* we're already listed */ break; winPriv = winPriv->next; } if (!winPriv) { winPriv = calloc(1, sizeof(XF86XVWindowRec)); if (!winPriv) return BadAlloc; winPriv->PortRec = portPriv; winPriv->next = PrivRoot; dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv); } portPriv->pDraw = (DrawablePtr) pWin; return Success; } static void xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { XF86XVWindowPtr winPriv, prevPriv = NULL; winPriv = GET_XF86XV_WINDOW(pWin); while (winPriv) { if (winPriv->PortRec == portPriv) { if (prevPriv) prevPriv->next = winPriv->next; else dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv->next); free(winPriv); break; } prevPriv = winPriv; winPriv = winPriv->next; } portPriv->pDraw = NULL; if (portPriv->ckeyFilled) { RegionDestroy(portPriv->ckeyFilled); portPriv->ckeyFilled = NULL; } portPriv->clipChanged = FALSE; } static void xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible) { if (!visible) { if (pPriv->isOn == XV_ON) { (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); pPriv->isOn = XV_PENDING; } if (!pPriv->type) /* overlaid still/image */ xf86XVRemovePortFromWindow(pWin, pPriv); return; } switch (pPriv->type) { case XvInputMask: xf86XVReputVideo(pPriv); break; case XvOutputMask: xf86XVRegetVideo(pPriv); break; default: /* overlaid still/image */ if (pPriv->AdaptorRec->ReputImage) xf86XVReputImage(pPriv); break; } } static void xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XvAdaptorPtr pa; int c, i; for (c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { XvPortPtr pPort = pa->pPorts; for (i = pa->nPorts; i > 0; i--, pPort++) { XvPortRecPrivatePtr pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr; WindowPtr pWin = (WindowPtr) pPriv->pDraw; Bool visible; if (pPriv->isOn == XV_OFF || !pWin) continue; if (onlyChanged && !pPriv->clipChanged) continue; visible = pWin->visibility == VisibilityUnobscured || pWin->visibility == VisibilityPartiallyObscured; /* * Stop and remove still/images if * ReputImage isn't supported. */ if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) visible = FALSE; xf86XVReputOrStopPort(pPriv, pWin, visible); pPriv->clipChanged = FALSE; } } } /**** ScreenRec fields ****/ static Bool xf86XVDestroyWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin); int ret; while (WinPriv) { XvPortRecPrivatePtr pPriv = WinPriv->PortRec; if (pPriv->isOn > XV_OFF) { (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn, pPriv->DevPriv.ptr, TRUE); pPriv->isOn = XV_OFF; } pPriv->pDraw = NULL; tmp = WinPriv; WinPriv = WinPriv->next; free(tmp); } dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL); pScreen->DestroyWindow = ScreenPriv->DestroyWindow; ret = (*pScreen->DestroyWindow) (pWin); pScreen->DestroyWindow = xf86XVDestroyWindow; return ret; } static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind) { ScreenPtr pScreen; XF86XVScreenPtr ScreenPriv; ScrnInfoPtr pScrn; if (pWin) pScreen = pWin->drawable.pScreen; else pScreen = pLayerWin->drawable.pScreen; ScreenPriv = GET_XF86XV_SCREEN(pScreen); pScrn = xf86ScreenToScrn(pScreen); xf86XVReputOrStopAllPorts(pScrn, TRUE); pScreen->PostValidateTree = ScreenPriv->PostValidateTree; if (pScreen->PostValidateTree) { (*pScreen->PostValidateTree) (pWin, pLayerWin, kind); } ScreenPriv->PostValidateTree = PostValidateTreeUndefined; } static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1) { ScreenPtr pScreen = pWin->drawable.pScreen; XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); XvPortRecPrivatePtr pPriv; Bool AreasExposed; AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1)); pScreen->WindowExposures = ScreenPriv->WindowExposures; (*pScreen->WindowExposures) (pWin, reg1); pScreen->WindowExposures = xf86XVWindowExposures; /* filter out XClearWindow/Area */ if (!pWin->valdata) return; while (WinPriv) { Bool visible = TRUE; pPriv = WinPriv->PortRec; /* * Stop and remove still/images if areas were exposed and * ReputImage isn't supported. */ if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) visible = !AreasExposed; /* * Subtract exposed areas from overlaid image to match textured video * behavior. */ if (!pPriv->type && pPriv->clientClip) RegionSubtract(pPriv->clientClip, pPriv->clientClip, reg1); if (visible && pPriv->ckeyFilled) { RegionRec tmp; RegionNull(&tmp); RegionCopy(&tmp, reg1); RegionTranslate(&tmp, pWin->drawable.x, pWin->drawable.y); RegionSubtract(pPriv->ckeyFilled, pPriv->ckeyFilled, &tmp); } WinPriv = WinPriv->next; xf86XVReputOrStopPort(pPriv, pWin, visible); pPriv->clipChanged = FALSE; } } static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); XvPortRecPrivatePtr pPriv; while (WinPriv) { pPriv = WinPriv->PortRec; if (pPriv->pCompositeClip && pPriv->FreeCompositeClip) RegionDestroy(pPriv->pCompositeClip); pPriv->pCompositeClip = NULL; pPriv->clipChanged = TRUE; if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) { ScreenPriv->PostValidateTree = pScreen->PostValidateTree; pScreen->PostValidateTree = xf86XVPostValidateTree; } WinPriv = WinPriv->next; } if (ScreenPriv->ClipNotify) { pScreen->ClipNotify = ScreenPriv->ClipNotify; (*pScreen->ClipNotify) (pWin, dx, dy); pScreen->ClipNotify = xf86XVClipNotify; } } /**** Required XvScreenRec fields ****/ static Bool xf86XVCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XvAdaptorPtr pa; int c; if (!ScreenPriv) return TRUE; pScreen->DestroyWindow = ScreenPriv->DestroyWindow; pScreen->WindowExposures = ScreenPriv->WindowExposures; pScreen->ClipNotify = ScreenPriv->ClipNotify; pScreen->CloseScreen = ScreenPriv->CloseScreen; pScrn->EnterVT = ScreenPriv->EnterVT; pScrn->LeaveVT = ScreenPriv->LeaveVT; pScrn->AdjustFrame = ScreenPriv->AdjustFrame; pScrn->ModeSet = ScreenPriv->ModeSet; for (c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { xf86XVFreeAdaptor(pa); } free(pxvs->pAdaptors); free(ScreenPriv); return pScreen->CloseScreen(pScreen); } /**** ScrnInfoRec fields ****/ static Bool xf86XVEnterVT(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); Bool ret; pScrn->EnterVT = ScreenPriv->EnterVT; ret = (*ScreenPriv->EnterVT) (pScrn); ScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86XVEnterVT; if (ret) WalkTree(pScreen, xf86XVReputAllVideo, 0); return ret; } static void xf86XVLeaveVT(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XvAdaptorPtr pAdaptor; XvPortPtr pPort; XvPortRecPrivatePtr pPriv; int i, j; for (i = 0; i < pxvs->nAdaptors; i++) { pAdaptor = &pxvs->pAdaptors[i]; for (j = 0; j < pAdaptor->nPorts; j++) { pPort = &pAdaptor->pPorts[j]; pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr; if (pPriv->isOn > XV_OFF) { (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn, pPriv->DevPriv.ptr, TRUE); pPriv->isOn = XV_OFF; if (pPriv->pCompositeClip && pPriv->FreeCompositeClip) RegionDestroy(pPriv->pCompositeClip); pPriv->pCompositeClip = NULL; if (!pPriv->type && pPriv->pDraw) { /* still */ xf86XVRemovePortFromWindow((WindowPtr) pPriv->pDraw, pPriv); } } } } pScrn->LeaveVT = ScreenPriv->LeaveVT; (*ScreenPriv->LeaveVT) (pScrn); ScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = xf86XVLeaveVT; } static void xf86XVAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); if (ScreenPriv->AdjustFrame) { pScrn->AdjustFrame = ScreenPriv->AdjustFrame; (*pScrn->AdjustFrame) (pScrn, x, y); pScrn->AdjustFrame = xf86XVAdjustFrame; } xf86XVReputOrStopAllPorts(pScrn, FALSE); } static void xf86XVModeSet(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv; /* Can be called before pScrn->pScreen is set */ if (!pScreen) return; ScreenPriv = GET_XF86XV_SCREEN(pScreen); if (ScreenPriv->ModeSet) { pScrn->ModeSet = ScreenPriv->ModeSet; (*pScrn->ModeSet) (pScrn); pScrn->ModeSet = xf86XVModeSet; } xf86XVReputOrStopAllPorts(pScrn, FALSE); } /**** XvAdaptorRec fields ****/ static int xf86XVPutVideo(DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); int result; /* No dumping video to pixmaps... For now anyhow */ if (pDraw->type != DRAWABLE_WINDOW) { pPort->pDraw = (DrawablePtr) NULL; return BadAlloc; } /* If we are changing windows, unregister our port in the old window */ if (portPriv->pDraw && (portPriv->pDraw != pDraw)) xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv); /* Register our port with the new window */ result = xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv); if (result != Success) return result; portPriv->type = XvInputMask; /* save a copy of these parameters */ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; /* make sure we have the most recent copy of the clientClip */ xf86XVCopyClip(portPriv, pGC); /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; if (!portPriv->pScrn->vtSema) return Success; /* Success ? */ return (xf86XVReputVideo(portPriv)); } static int xf86XVPutStill(DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE; if (pDraw->type != DRAWABLE_WINDOW) return BadAlloc; if (!portPriv->pScrn->vtSema) return Success; /* Success ? */ WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; xf86XVCopyCompositeClip(portPriv, pGC, pDraw); RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip); if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; VPBox.x2 = portPriv->pScrn->frameX1 + 1; VPBox.y2 = portPriv->pScrn->frameY1 + 1; RegionInit(&VPReg, &VPBox, 1); RegionIntersect(&ClipRegion, &ClipRegion, &VPReg); RegionUninit(&VPReg); } if (portPriv->pDraw) { xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv); } if (!RegionNotEmpty(&ClipRegion)) { clippedAway = TRUE; goto PUT_STILL_BAILOUT; } ret = (*portPriv->AdaptorRec->PutStill) (portPriv->pScrn, vid_x, vid_y, WinBox.x1, WinBox.y1, vid_w, vid_h, drw_w, drw_h, &ClipRegion, portPriv->DevPriv.ptr, pDraw); if ((ret == Success) && (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) { xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv); portPriv->isOn = XV_ON; portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; portPriv->type = 0; /* no mask means it's transient and should not be reput once it's removed */ pPort->pDraw = pDraw; /* make sure we can get stop requests */ } PUT_STILL_BAILOUT: if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ if (!portPriv->FreeCompositeClip) portPriv->pCompositeClip = NULL; RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } static int xf86XVGetVideo(DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); int result; /* No pixmaps... For now anyhow */ if (pDraw->type != DRAWABLE_WINDOW) { pPort->pDraw = (DrawablePtr) NULL; return BadAlloc; } /* If we are changing windows, unregister our port in the old window */ if (portPriv->pDraw && (portPriv->pDraw != pDraw)) xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv); /* Register our port with the new window */ result = xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv); if (result != Success) return result; portPriv->type = XvOutputMask; /* save a copy of these parameters */ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; /* make sure we have the most recent copy of the clientClip */ xf86XVCopyClip(portPriv, pGC); /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; if (!portPriv->pScrn->vtSema) return Success; /* Success ? */ return (xf86XVRegetVideo(portPriv)); } static int xf86XVGetStill(DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE; if (pDraw->type != DRAWABLE_WINDOW) return BadAlloc; if (!portPriv->pScrn->vtSema) return Success; /* Success ? */ WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip); if (portPriv->pDraw) { xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv); } if (!RegionNotEmpty(&ClipRegion)) { clippedAway = TRUE; goto GET_STILL_BAILOUT; } ret = (*portPriv->AdaptorRec->GetStill) (portPriv->pScrn, vid_x, vid_y, WinBox.x1, WinBox.y1, vid_w, vid_h, drw_w, drw_h, &ClipRegion, portPriv->DevPriv.ptr, pDraw); GET_STILL_BAILOUT: if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); portPriv->isOn = XV_PENDING; } RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } static int xf86XVStopVideo(XvPortPtr pPort, DrawablePtr pDraw) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); if (pDraw->type != DRAWABLE_WINDOW) return BadAlloc; xf86XVRemovePortFromWindow((WindowPtr) pDraw, portPriv); if (!portPriv->pScrn->vtSema) return Success; /* Success ? */ /* Must free resources. */ if (portPriv->isOn > XV_OFF) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, TRUE); portPriv->isOn = XV_OFF; } return Success; } static int xf86XVSetPortAttribute(XvPortPtr pPort, Atom attribute, INT32 value) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); return ((*portPriv->AdaptorRec->SetPortAttribute) (portPriv->pScrn, attribute, value, portPriv->DevPriv.ptr)); } static int xf86XVGetPortAttribute(XvPortPtr pPort, Atom attribute, INT32 *p_value) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); return ((*portPriv->AdaptorRec->GetPortAttribute) (portPriv->pScrn, attribute, p_value, portPriv->DevPriv.ptr)); } static int xf86XVQueryBestSize(XvPortPtr pPort, CARD8 motion, CARD16 vid_w, CARD16 vid_h, CARD16 drw_w, CARD16 drw_h, unsigned int *p_w, unsigned int *p_h) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); (*portPriv->AdaptorRec->QueryBestSize) (portPriv->pScrn, (Bool) motion, vid_w, vid_h, drw_w, drw_h, p_w, p_h, portPriv->DevPriv.ptr); return Success; } static int xf86XVPutImage(DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, unsigned char *data, Bool sync, CARD16 width, CARD16 height) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE; if (pDraw->type != DRAWABLE_WINDOW) return BadAlloc; if (!portPriv->pScrn->vtSema) return Success; /* Success ? */ xf86XVCopyCompositeClip(portPriv, pGC, pDraw); WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip); if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; VPBox.x2 = portPriv->pScrn->frameX1 + 1; VPBox.y2 = portPriv->pScrn->frameY1 + 1; RegionInit(&VPReg, &VPBox, 1); RegionIntersect(&ClipRegion, &ClipRegion, &VPReg); RegionUninit(&VPReg); } /* If we are changing windows, unregister our port in the old window */ if (portPriv->pDraw && (portPriv->pDraw != pDraw)) xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv); /* Register our port with the new window */ ret = xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv); if (ret != Success) goto PUT_IMAGE_BAILOUT; if (!RegionNotEmpty(&ClipRegion)) { clippedAway = TRUE; goto PUT_IMAGE_BAILOUT; } ret = (*portPriv->AdaptorRec->PutImage) (portPriv->pScrn, src_x, src_y, WinBox.x1, WinBox.y1, src_w, src_h, drw_w, drw_h, format->id, data, width, height, sync, &ClipRegion, portPriv->DevPriv.ptr, pDraw); if ((ret == Success) && (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) { portPriv->isOn = XV_ON; portPriv->vid_x = src_x; portPriv->vid_y = src_y; portPriv->vid_w = src_w; portPriv->vid_h = src_h; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; portPriv->type = 0; /* no mask means it's transient and should not be reput once it's removed */ pPort->pDraw = pDraw; /* make sure we can get stop requests */ } PUT_IMAGE_BAILOUT: if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); portPriv->isOn = XV_PENDING; } /* This clip was copied and only good for one shot */ if (!portPriv->FreeCompositeClip) portPriv->pCompositeClip = NULL; RegionUninit(&WinRegion); RegionUninit(&ClipRegion); return ret; } static int xf86XVQueryImageAttributes(XvPortPtr pPort, XvImagePtr format, CARD16 *width, CARD16 *height, int *pitches, int *offsets) { XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); return (*portPriv->AdaptorRec->QueryImageAttributes) (portPriv->pScrn, format->id, width, height, pitches, offsets); } void xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes) { ScreenPtr pScreen = pDraw->pScreen; if (!xf86ScreenToScrn(pScreen)->vtSema) return; XvFillColorKey(pDraw, key, fillboxes); } void xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes) { xf86XVFillKeyHelperDrawable(&pScreen->root->drawable, key, fillboxes); } void xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key, RegionPtr clipboxes, Bool fillEverything) { WindowPtr pWin = (WindowPtr) pDraw; XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); XvPortRecPrivatePtr portPriv = NULL; RegionRec reg; RegionPtr fillboxes; while (WinPriv) { XvPortRecPrivatePtr pPriv = WinPriv->PortRec; if (data == pPriv->DevPriv.ptr) { portPriv = pPriv; break; } WinPriv = WinPriv->next; } if (!portPriv) return; if (!portPriv->ckeyFilled) portPriv->ckeyFilled = RegionCreate(NULL, 0); if (!fillEverything) { RegionNull(®); fillboxes = ® RegionSubtract(fillboxes, clipboxes, portPriv->ckeyFilled); if (!RegionNotEmpty(fillboxes)) goto out; } else fillboxes = clipboxes; RegionCopy(portPriv->ckeyFilled, clipboxes); xf86XVFillKeyHelperDrawable(pDraw, key, fillboxes); out: if (!fillEverything) RegionUninit(®); } /* xf86XVClipVideoHelper - Takes the dst box in standard X BoxRec form (top and left edges inclusive, bottom and right exclusive). The new dst box is returned. The source boundaries are given (x1, y1 inclusive, x2, y2 exclusive) and returned are the new source boundaries in 16.16 fixed point. */ Bool xf86XVClipVideoHelper(BoxPtr dst, INT32 *xa, INT32 *xb, INT32 *ya, INT32 *yb, RegionPtr reg, INT32 width, INT32 height) { double xsw, xdw, ysw, ydw; INT32 delta; BoxPtr extents = RegionExtents(reg); int diff; xsw = (*xb - *xa) << 16; xdw = dst->x2 - dst->x1; ysw = (*yb - *ya) << 16; ydw = dst->y2 - dst->y1; *xa <<= 16; *xb <<= 16; *ya <<= 16; *yb <<= 16; diff = extents->x1 - dst->x1; if (diff > 0) { dst->x1 = extents->x1; *xa += (diff * xsw) / xdw; } diff = dst->x2 - extents->x2; if (diff > 0) { dst->x2 = extents->x2; *xb -= (diff * xsw) / xdw; } diff = extents->y1 - dst->y1; if (diff > 0) { dst->y1 = extents->y1; *ya += (diff * ysw) / ydw; } diff = dst->y2 - extents->y2; if (diff > 0) { dst->y2 = extents->y2; *yb -= (diff * ysw) / ydw; } if (*xa < 0) { diff = (((-*xa) * xdw) + xsw - 1) / xsw; dst->x1 += diff; *xa += (diff * xsw) / xdw; } delta = *xb - (width << 16); if (delta > 0) { diff = ((delta * xdw) + xsw - 1) / xsw; dst->x2 -= diff; *xb -= (diff * xsw) / xdw; } if (*xa >= *xb) return FALSE; if (*ya < 0) { diff = (((-*ya) * ydw) + ysw - 1) / ysw; dst->y1 += diff; *ya += (diff * ysw) / ydw; } delta = *yb - (height << 16); if (delta > 0) { diff = ((delta * ydw) + ysw - 1) / ysw; dst->y2 -= diff; *yb -= (diff * ysw) / ydw; } if (*ya >= *yb) return FALSE; if ((dst->x1 > extents->x1) || (dst->x2 < extents->x2) || (dst->y1 > extents->y1) || (dst->y2 < extents->y2)) { RegionRec clipReg; RegionInit(&clipReg, dst, 1); RegionIntersect(reg, reg, &clipReg); RegionUninit(&clipReg); } return TRUE; } void xf86XVCopyYUV12ToPacked(const void *srcy, const void *srcv, const void *srcu, void *dst, int srcPitchy, int srcPitchuv, int dstPitch, int h, int w) { CARD32 *Dst; const CARD8 *Y, *U, *V; int i, j; w >>= 1; for (j = 0; j < h; j++) { Dst = dst; Y = srcy; V = srcv; U = srcu; i = w; while (i >= 4) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24); Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24); Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24); Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24); #else /* This assumes a little-endian framebuffer */ Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0]; Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | V[1]; Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | V[2]; Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | V[3]; #endif Dst += 4; Y += 8; V += 4; U += 4; i -= 4; } while (i--) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24); #else /* This assumes a little-endian framebuffer */ Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0]; #endif Dst++; Y += 2; V++; U++; } dst = (CARD8 *) dst + dstPitch; srcy = (const CARD8 *) srcy + srcPitchy; if (j & 1) { srcu = (const CARD8 *) srcu + srcPitchuv; srcv = (const CARD8 *) srcv + srcPitchuv; } } } void xf86XVCopyPacked(const void *src, void *dst, int srcPitch, int dstPitch, int h, int w) { const CARD32 *Src; CARD32 *Dst; int i; w >>= 1; while (--h >= 0) { do { Dst = dst; Src = src; i = w; while (i >= 4) { Dst[0] = Src[0]; Dst[1] = Src[1]; Dst[2] = Src[2]; Dst[3] = Src[3]; Dst += 4; Src += 4; i -= 4; } if (!i) break; Dst[0] = Src[0]; if (i == 1) break; Dst[1] = Src[1]; if (i == 2) break; Dst[2] = Src[2]; } while (0); src = (const CARD8 *) src + srcPitch; dst = (CARD8 *) dst + dstPitch; } } xorg-server-1.20.8/hw/xfree86/common/xf86Option.c0000644000175000017500000005750313640201473016345 00000000000000/* * Copyright (c) 1998-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). */ /* * Author: David Dawes * * This file includes public option handling functions. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include "os.h" #include "xf86.h" #include "xf86Opt.h" #include "xf86Xinput.h" #include "xf86Optrec.h" #include "xf86Parser.h" #include "xf86platformBus.h" /* For OutputClass functions */ #include "optionstr.h" static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p, Bool markUsed); /* * xf86CollectOptions collects the options from each of the config file * sections used by the screen and puts the combined list in pScrn->options. * This function requires that the following have been initialised: * * pScrn->confScreen * pScrn->Entities[i]->device * pScrn->display * pScrn->monitor * * The extraOpts parameter may optionally contain a list of additional options * to include. * * The order of precedence for options is: * * extraOpts, display, confScreen, monitor, device, outputClassOptions */ void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts) { XF86OptionPtr tmp; XF86OptionPtr extras = (XF86OptionPtr) extraOpts; GDevPtr device; int i; pScrn->options = NULL; for (i = pScrn->numEntities - 1; i >= 0; i--) { xf86MergeOutputClassOptions(pScrn->entityList[i], &pScrn->options); device = xf86GetDevFromEntity(pScrn->entityList[i], pScrn->entityInstanceList[i]); if (device && device->options) { tmp = xf86optionListDup(device->options); if (pScrn->options) pScrn->options = xf86optionListMerge(pScrn->options, tmp); else pScrn->options = tmp; } } if (pScrn->monitor->options) { tmp = xf86optionListDup(pScrn->monitor->options); if (pScrn->options) pScrn->options = xf86optionListMerge(pScrn->options, tmp); else pScrn->options = tmp; } if (pScrn->confScreen->options) { tmp = xf86optionListDup(pScrn->confScreen->options); if (pScrn->options) pScrn->options = xf86optionListMerge(pScrn->options, tmp); else pScrn->options = tmp; } if (pScrn->display->options) { tmp = xf86optionListDup(pScrn->display->options); if (pScrn->options) pScrn->options = xf86optionListMerge(pScrn->options, tmp); else pScrn->options = tmp; } if (extras) { tmp = xf86optionListDup(extras); if (pScrn->options) pScrn->options = xf86optionListMerge(pScrn->options, tmp); else pScrn->options = tmp; } } /* * xf86CollectInputOptions collects extra options for an InputDevice (other * than those added by the config backend). * The options are merged into the existing ones and thus take precedence * over the others. */ void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts) { if (defaultOpts) { XF86OptionPtr tmp = xf86optionListCreate(defaultOpts, -1, 0); if (pInfo->options) pInfo->options = xf86optionListMerge(tmp, pInfo->options); else pInfo->options = tmp; } } /** * Duplicate the option list passed in. The returned pointer will be a newly * allocated option list and must be freed by the caller. */ XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr options) { XF86OptionPtr o = NULL; while (options) { o = xf86AddNewOption(o, xf86OptionName(options), xf86OptionValue(options)); options = xf86nextOption(options); } return o; } /* Created for new XInput stuff -- essentially extensions to the parser */ static int LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_INTEGER; if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.num; return deflt; } static double LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_REAL; if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.realnum; return deflt; } static char * LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_STRING; if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.str; if (deflt) return strdup(deflt); else return NULL; } static int LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_BOOLEAN; if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.bool; return deflt; } static double LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_PERCENT; if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.realnum; return deflt; } /* These xf86Set* functions are intended for use by non-screen specific code */ int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt) { return LookupIntOption(optlist, name, deflt, TRUE); } double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt) { return LookupRealOption(optlist, name, deflt, TRUE); } char * xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt) { return LookupStrOption(optlist, name, deflt, TRUE); } int xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt) { return LookupBoolOption(optlist, name, deflt, TRUE); } double xf86SetPercentOption(XF86OptionPtr optlist, const char *name, double deflt) { return LookupPercentOption(optlist, name, deflt, TRUE); } /* * These are like the Set*Option functions, but they don't mark the options * as used. */ int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt) { return LookupIntOption(optlist, name, deflt, FALSE); } double xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt) { return LookupRealOption(optlist, name, deflt, FALSE); } char * xf86CheckStrOption(XF86OptionPtr optlist, const char *name, const char *deflt) { return LookupStrOption(optlist, name, deflt, FALSE); } int xf86CheckBoolOption(XF86OptionPtr optlist, const char *name, int deflt) { return LookupBoolOption(optlist, name, deflt, FALSE); } double xf86CheckPercentOption(XF86OptionPtr optlist, const char *name, double deflt) { return LookupPercentOption(optlist, name, deflt, FALSE); } /* * xf86AddNewOption() has the required property of replacing the option value * if the option is already present. */ XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val) { char tmp[16]; snprintf(tmp, sizeof(tmp), "%i", val); return xf86AddNewOption(optlist, name, tmp); } XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val) { char tmp[32]; snprintf(tmp, sizeof(tmp), "%f", val); return xf86AddNewOption(optlist, name, tmp); } XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val) { return xf86AddNewOption(optlist, name, val ? "True" : "False"); } XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val) { char tmp[16]; snprintf(tmp, sizeof(tmp), "%lf%%", val); return xf86AddNewOption(optlist, name, tmp); } XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char *val) { return xf86AddNewOption(optlist, name, val); } XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val) { /* XXX These should actually be allocated in the parser library. */ char *tmp = val ? strdup(val) : NULL; char *tmp_name = strdup(name); return xf86addNewOption(head, tmp_name, tmp); } XF86OptionPtr xf86NewOption(char *name, char *value) { return xf86newOption(name, value); } XF86OptionPtr xf86NextOption(XF86OptionPtr list) { return xf86nextOption(list); } XF86OptionPtr xf86OptionListCreate(const char **options, int count, int used) { return xf86optionListCreate(options, count, used); } XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail) { return xf86optionListMerge(head, tail); } void xf86OptionListFree(XF86OptionPtr opt) { xf86optionListFree(opt); } char * xf86OptionName(XF86OptionPtr opt) { return xf86optionName(opt); } char * xf86OptionValue(XF86OptionPtr opt) { return xf86optionValue(opt); } void xf86OptionListReport(XF86OptionPtr parm) { XF86OptionPtr opts = parm; while (opts) { if (xf86optionValue(opts)) xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n", xf86optionName(opts), xf86optionValue(opts)); else xf86ErrorFVerb(5, "\tOption \"%s\"\n", xf86optionName(opts)); opts = xf86nextOption(opts); } } /* End of XInput-caused section */ XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name) { return xf86findOption(options, name); } const char * xf86FindOptionValue(XF86OptionPtr options, const char *name) { return xf86findOptionValue(options, name); } void xf86MarkOptionUsed(XF86OptionPtr option) { if (option != NULL) option->opt_used = TRUE; } void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name) { XF86OptionPtr opt; opt = xf86findOption(options, name); if (opt != NULL) opt->opt_used = TRUE; } Bool xf86CheckIfOptionUsed(XF86OptionPtr option) { if (option != NULL) return option->opt_used; else return FALSE; } Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name) { XF86OptionPtr opt; opt = xf86findOption(options, name); if (opt != NULL) return opt->opt_used; else return FALSE; } void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt) { while (opt) { if (opt->opt_name && !opt->opt_used) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n", opt->opt_name); } opt = opt->list.next; } } static Bool GetBoolValue(OptionInfoPtr p, const char *s) { return xf86getBoolValue(&p->value.bool, s); } static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p, Bool markUsed) { const char *s; char *end; Bool wasUsed = FALSE; if ((s = xf86findOptionValue(options, p->name)) != NULL) { if (markUsed) { wasUsed = xf86CheckIfOptionUsedByName(options, p->name); xf86MarkOptionUsedByName(options, p->name); } switch (p->type) { case OPTV_INTEGER: if (*s == '\0') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires an integer value\n", p->name); } p->found = FALSE; } else { p->value.num = strtoul(s, &end, 0); if (*end == '\0') { p->found = TRUE; } else { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires an integer value\n", p->name); } p->found = FALSE; } } break; case OPTV_STRING: if (*s == '\0') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a string value\n", p->name); } p->found = FALSE; } else { p->value.str = s; p->found = TRUE; } break; case OPTV_ANYSTR: p->value.str = s; p->found = TRUE; break; case OPTV_REAL: if (*s == '\0') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a floating point " "value\n", p->name); } p->found = FALSE; } else { p->value.realnum = strtod(s, &end); if (*end == '\0') { p->found = TRUE; } else { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a floating point " "value\n", p->name); } p->found = FALSE; } } break; case OPTV_BOOLEAN: if (GetBoolValue(p, s)) { p->found = TRUE; } else { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a boolean value\n", p->name); } p->found = FALSE; } break; case OPTV_PERCENT: { char tmp = 0; /* awkward match, but %% doesn't increase the match counter, * hence 100 looks the same as 100% to the caller of sccanf */ if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a percent value\n", p->name); } p->found = FALSE; } else { p->found = TRUE; } } break; case OPTV_FREQ: if (*s == '\0') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); } p->found = FALSE; } else { double freq = strtod(s, &end); int units = 0; if (end != s) { p->found = TRUE; if (!xf86NameCmp(end, "Hz")) units = 1; else if (!xf86NameCmp(end, "kHz") || !xf86NameCmp(end, "k")) units = 1000; else if (!xf86NameCmp(end, "MHz") || !xf86NameCmp(end, "M")) units = 1000000; else { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); } p->found = FALSE; } if (p->found) freq *= (double) units; } else { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a frequency value\n", p->name); } p->found = FALSE; } if (p->found) { p->value.freq.freq = freq; p->value.freq.units = units; } } break; case OPTV_NONE: /* Should never get here */ p->found = FALSE; break; } if (p->found && markUsed) { int verb = 2; if (wasUsed) verb = 4; xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name); if (!(p->type == OPTV_BOOLEAN && *s == 0)) { xf86ErrorFVerb(verb, " \"%s\"", s); } xf86ErrorFVerb(verb, "\n"); } } else if (p->type == OPTV_BOOLEAN) { /* Look for matches with options with or without a "No" prefix. */ char *n, *newn; OptionInfoRec opt; n = xf86NormalizeName(p->name); if (!n) { p->found = FALSE; return FALSE; } if (strncmp(n, "no", 2) == 0) { newn = n + 2; } else { free(n); if (asprintf(&n, "No%s", p->name) == -1) { p->found = FALSE; return FALSE; } newn = n; } if ((s = xf86findOptionValue(options, newn)) != NULL) { if (markUsed) xf86MarkOptionUsedByName(options, newn); if (GetBoolValue(&opt, s)) { p->value.bool = !opt.value.bool; p->found = TRUE; } else { xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a boolean value\n", newn); p->found = FALSE; } } else { p->found = FALSE; } if (p->found && markUsed) { xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn); if (*s != 0) { xf86ErrorFVerb(2, " \"%s\"", s); } xf86ErrorFVerb(2, "\n"); } free(n); } else { p->found = FALSE; } return p->found; } void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo) { OptionInfoPtr p; for (p = optinfo; p->name != NULL; p++) { ParseOptionValue(scrnIndex, options, p, TRUE); } } OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table, int token) { const OptionInfoRec *p, *match = NULL, *set = NULL; if (!table) { ErrorF("xf86TokenToOptinfo: table is NULL\n"); return NULL; } for (p = table; p->token >= 0; p++) { if (p->token == token) { match = p; if (p->found) set = p; } } if (set) return (OptionInfoPtr) set; else if (match) return (OptionInfoPtr) match; else return NULL; } const char * xf86TokenToOptName(const OptionInfoRec * table, int token) { const OptionInfoRec *p; p = xf86TokenToOptinfo(table, token); return p ? p->name : NULL; } Bool xf86IsOptionSet(const OptionInfoRec * table, int token) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); return p && p->found; } const char * xf86GetOptValString(const OptionInfoRec * table, int token) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) return p->value.str; else return NULL; } Bool xf86GetOptValInteger(const OptionInfoRec * table, int token, int *value) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) { *value = p->value.num; return TRUE; } else return FALSE; } Bool xf86GetOptValULong(const OptionInfoRec * table, int token, unsigned long *value) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) { *value = p->value.num; return TRUE; } else return FALSE; } Bool xf86GetOptValReal(const OptionInfoRec * table, int token, double *value) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) { *value = p->value.realnum; return TRUE; } else return FALSE; } Bool xf86GetOptValFreq(const OptionInfoRec * table, int token, OptFreqUnits expectedUnits, double *value) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) { if (p->value.freq.units > 0) { /* Units give, so the scaling is known. */ switch (expectedUnits) { case OPTUNITS_HZ: *value = p->value.freq.freq; break; case OPTUNITS_KHZ: *value = p->value.freq.freq / 1000.0; break; case OPTUNITS_MHZ: *value = p->value.freq.freq / 1000000.0; break; } } else { /* No units given, so try to guess the scaling. */ switch (expectedUnits) { case OPTUNITS_HZ: *value = p->value.freq.freq; break; case OPTUNITS_KHZ: if (p->value.freq.freq > 1000.0) *value = p->value.freq.freq / 1000.0; else *value = p->value.freq.freq; break; case OPTUNITS_MHZ: if (p->value.freq.freq > 1000000.0) *value = p->value.freq.freq / 1000000.0; else if (p->value.freq.freq > 1000.0) *value = p->value.freq.freq / 1000.0; else *value = p->value.freq.freq; } } return TRUE; } else return FALSE; } Bool xf86GetOptValBool(const OptionInfoRec * table, int token, Bool *value) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) { *value = p->value.bool; return TRUE; } else return FALSE; } Bool xf86ReturnOptValBool(const OptionInfoRec * table, int token, Bool def) { OptionInfoPtr p; p = xf86TokenToOptinfo(table, token); if (p && p->found) { return p->value.bool; } else return def; } int xf86NameCmp(const char *s1, const char *s2) { return xf86nameCompare(s1, s2); } char * xf86NormalizeName(const char *s) { char *ret, *q; const char *p; if (s == NULL) return NULL; ret = malloc(strlen(s) + 1); for (p = s, q = ret; *p != 0; p++) { switch (*p) { case '_': case ' ': case '\t': continue; default: if (isupper(*p)) *q++ = tolower(*p); else *q++ = *p; } } *q = '\0'; return ret; } xorg-server-1.20.8/hw/xfree86/common/xf86Privstr.h0000644000175000017500000001041013640201473016535 00000000000000 /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains definitions of the private XFree86 data structures/types. * None of the data structures here should be used by video drivers. */ #ifndef _XF86PRIVSTR_H #define _XF86PRIVSTR_H #include "xf86str.h" typedef enum { XF86_GlxVisualsMinimal, XF86_GlxVisualsTypical, XF86_GlxVisualsAll, } XF86_GlxVisuals; /* * xf86InfoRec contains global parameters which the video drivers never * need to access. Global parameters which the video drivers do need * should be individual globals. */ typedef struct { int consoleFd; int vtno; /* event handler part */ int lastEventTime; Bool vtRequestsPending; #ifdef __sun int vtPendingNum; #endif Bool dontVTSwitch; Bool autoVTSwitch; Bool ShareVTs; Bool dontZap; Bool dontZoom; Bool notrapSignals; /* don't exit cleanly - die at fault */ /* graphics part */ ScreenPtr currentScreen; #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) int consType; /* Which console driver? */ #endif /* Other things */ Bool allowMouseOpenFail; Bool vidModeEnabled; /* VidMode extension enabled */ Bool vidModeAllowNonLocal; /* allow non-local VidMode * connections */ Bool miscModInDevEnabled; /* Allow input devices to be * changed */ Bool miscModInDevAllowNonLocal; Bool useSIGIO; /* Use SIGIO for handling DRI1 swaps */ Bool pmFlag; MessageType iglxFrom; XF86_GlxVisuals glxVisuals; MessageType glxVisualsFrom; Bool useDefaultFontPath; Bool ignoreABI; Bool forceInputDevices; /* force xorg.conf or built-in input devices */ Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */ Bool autoEnableDevices; /* Whether to enable, or let the client * control. */ Bool dri2; MessageType dri2From; Bool autoAddGPU; const char *debug; } xf86InfoRec, *xf86InfoPtr; /* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */ #define XLED1 ((unsigned long) 0x00000001) #define XLED2 ((unsigned long) 0x00000002) #define XLED3 ((unsigned long) 0x00000004) #define XLED4 ((unsigned long) 0x00000008) #define XCAPS ((unsigned long) 0x20000000) #define XNUM ((unsigned long) 0x40000000) #define XSCR ((unsigned long) 0x80000000) #define XCOMP ((unsigned long) 0x00008000) /* BSD console driver types (consType) */ #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) #define PCCONS 0 #define CODRV011 1 #define CODRV01X 2 #define SYSCONS 8 #define PCVT 16 #define WSCONS 32 #endif /* Root window property to tell clients whether our VT is currently active. * Name chosen to match the "XFree86_VT" property. */ #define HAS_VT_ATOM_NAME "XFree86_has_VT" #endif /* _XF86PRIVSTR_H */ xorg-server-1.20.8/hw/xfree86/common/Makefile.am0000644000175000017500000000534413640201473016245 00000000000000noinst_LTLIBRARIES = libcommon.la if XORG_BUS_PCI PCI_SOURCES = xf86pciBus.c xf86VGAarbiter.c xf86VGAarbiter.h \ xf86VGAarbiterPriv.h endif if XORG_BUS_SPARC SBUS_SOURCES = xf86sbusBus.c endif if XV XVSOURCES = xf86xv.c xf86xvmc.c XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h endif if DGA DGASOURCES = xf86DGA.c DGA_SDK = dgaproc.h endif if XORG_BUS_PLATFORM PLATSOURCES = xf86platformBus.c endif RANDRSOURCES = xf86RandR.c BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES) $(PLATSOURCES) MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES) $(AM_V_GEN)cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@ $(AM_V_GEN)echo >> $@ BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Cursor.c $(DGASOURCES) xf86DPMS.c \ xf86Events.c xf86Globals.c xf86AutoConfig.c \ xf86Option.c xf86Init.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ xf86Mode.c xorgHelper.c xf86Extensions.h \ xf86Extensions.c $(XF86VMODESOURCES) \ $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../parser \ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \ -I$(srcdir)/../modes -I$(srcdir)/../ramdac -I$(srcdir)/../dri2 sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h \ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \ xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h \ xf86platformBus.h xf86MatchDrivers.h \ xaarop.h DISTCLEANFILES = xf86Build.h CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = \ compiler.h \ fourcc.h \ xf86.h \ xf86Bus.h \ xf86Config.h \ xf86InPriv.h \ xf86Module.h \ xf86Opt.h \ xf86PciInfo.h \ xf86Priv.h \ xf86Privstr.h \ xf86Xinput.h \ xf86cmap.h \ xf86fbman.h \ xf86pciBus.h \ xf86str.h \ xf86xv.h \ xf86xvmc.h \ xf86xvpriv.h \ xisb.h \ xorgVersion.h \ $(MODEDEFSOURCES) \ modeline2c.awk \ xf86VGAarbiter.h \ xf86VGAarbiterPriv.h \ $(DISTKBDSOURCES) \ xaarop.h if LNXACPI XORG_CFLAGS += -DHAVE_ACPI endif if NEED_DBUS XORG_CFLAGS += $(DBUS_CFLAGS) endif AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) xorg-server-1.20.8/hw/xfree86/common/xf86PciInfo.h0000644000175000017500000006124213640201473016424 00000000000000 /* * Copyright (c) 1995-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains macros for the PCI Vendor and Device IDs for video * cards plus a few other things that are needed in drivers or elsewhere. * This information is used in several ways: * 1. It is used by drivers and/or other code. * 2. It is used by the pciid2c.pl script to determine what vendor data to * include in the pcidata module that the X server loads. * 3. A side-effect of 2. affects how config-generation works for * otherwise "unknown" cards. * * Don't add entries here for vendors that don't make video cards, * or for non-video devices unless they're needed by a driver or elsewhere. * A comprehensive set of PCI vendor, device and subsystem data is * auto-generated from the ../etc/pci.ids file using the pciids2c.pl script, * and is used in scanpci utility. Don't modify the pci.ids file. If * new/corrected entries are required, add them to ../etc/extrapci.ids. */ #ifndef _XF86_PCIINFO_H #define _XF86_PCIINFO_H #warning "xf86PciInfo.h is deprecated. For greater compatibility, drivers should include necessary PCI IDs locally rather than relying on this file from xorg-server." /* PCI Pseudo Vendor */ #define PCI_VENDOR_GENERIC 0x00FF #define PCI_VENDOR_REAL3D 0x003D #define PCI_VENDOR_COMPAQ 0x0E11 #define PCI_VENDOR_ATI 0x1002 #define PCI_VENDOR_AVANCE 0x1005 #define PCI_VENDOR_TSENG 0x100C #define PCI_VENDOR_NS 0x100B #define PCI_VENDOR_WEITEK 0x100E #define PCI_VENDOR_VIDEOLOGIC 0x1010 #define PCI_VENDOR_DIGITAL 0x1011 #define PCI_VENDOR_CIRRUS 0x1013 #define PCI_VENDOR_AMD 0x1022 #define PCI_VENDOR_TRIDENT 0x1023 #define PCI_VENDOR_ALI 0x1025 #define PCI_VENDOR_DELL 0x1028 #define PCI_VENDOR_MATROX 0x102B #define PCI_VENDOR_CHIPSTECH 0x102C #define PCI_VENDOR_MIRO 0x1031 #define PCI_VENDOR_NEC 0x1033 #define PCI_VENDOR_SIS 0x1039 #define PCI_VENDOR_HP 0x103C #define PCI_VENDOR_SGS 0x104A #define PCI_VENDOR_TI 0x104C #define PCI_VENDOR_SONY 0x104D #define PCI_VENDOR_OAK 0x104E #define PCI_VENDOR_MOTOROLA 0x1057 #define PCI_VENDOR_NUMNINE 0x105D #define PCI_VENDOR_CYRIX 0x1078 #define PCI_VENDOR_SUN 0x108E #define PCI_VENDOR_DIAMOND 0x1092 #define PCI_VENDOR_BROOKTREE 0x109E #define PCI_VENDOR_NEOMAGIC 0x10C8 #define PCI_VENDOR_NVIDIA 0x10DE #define PCI_VENDOR_IMS 0x10E0 #define PCI_VENDOR_INTEGRAPHICS 0x10EA #define PCI_VENDOR_ALLIANCE 0x1142 #define PCI_VENDOR_RENDITION 0x1163 #define PCI_VENDOR_3DFX 0x121A #define PCI_VENDOR_SMI 0x126F #define PCI_VENDOR_TRITECH 0x1292 #define PCI_VENDOR_NVIDIA_SGS 0x12D2 #define PCI_VENDOR_VMWARE 0x15AD #define PCI_VENDOR_AST 0x1A03 #define PCI_VENDOR_3DLABS 0x3D3D #define PCI_VENDOR_AVANCE_2 0x4005 #define PCI_VENDOR_HERCULES 0x4843 #define PCI_VENDOR_S3 0x5333 #define PCI_VENDOR_INTEL 0x8086 #define PCI_VENDOR_ARK 0xEDD8 /* Generic */ #define PCI_CHIP_VGA 0x0000 #define PCI_CHIP_8514 0x0001 /* Real 3D */ #define PCI_CHIP_I740_PCI 0x00D1 /* Compaq */ #define PCI_CHIP_QV1280 0x3033 /* ATI */ #define PCI_CHIP_RV380_3150 0x3150 #define PCI_CHIP_RV380_3151 0x3151 #define PCI_CHIP_RV380_3152 0x3152 #define PCI_CHIP_RV380_3153 0x3153 #define PCI_CHIP_RV380_3154 0x3154 #define PCI_CHIP_RV380_3156 0x3156 #define PCI_CHIP_RV380_3E50 0x3E50 #define PCI_CHIP_RV380_3E51 0x3E51 #define PCI_CHIP_RV380_3E52 0x3E52 #define PCI_CHIP_RV380_3E53 0x3E53 #define PCI_CHIP_RV380_3E54 0x3E54 #define PCI_CHIP_RV380_3E56 0x3E56 #define PCI_CHIP_RS100_4136 0x4136 #define PCI_CHIP_RS200_4137 0x4137 #define PCI_CHIP_R300_AD 0x4144 #define PCI_CHIP_R300_AE 0x4145 #define PCI_CHIP_R300_AF 0x4146 #define PCI_CHIP_R300_AG 0x4147 #define PCI_CHIP_R350_AH 0x4148 #define PCI_CHIP_R350_AI 0x4149 #define PCI_CHIP_R350_AJ 0x414A #define PCI_CHIP_R350_AK 0x414B #define PCI_CHIP_RV350_AP 0x4150 #define PCI_CHIP_RV350_AQ 0x4151 #define PCI_CHIP_RV360_AR 0x4152 #define PCI_CHIP_RV350_AS 0x4153 #define PCI_CHIP_RV350_AT 0x4154 #define PCI_CHIP_RV350_4155 0x4155 #define PCI_CHIP_RV350_AV 0x4156 #define PCI_CHIP_MACH32 0x4158 #define PCI_CHIP_RS250_4237 0x4237 #define PCI_CHIP_R200_BB 0x4242 #define PCI_CHIP_R200_BC 0x4243 #define PCI_CHIP_RS100_4336 0x4336 #define PCI_CHIP_RS200_4337 0x4337 #define PCI_CHIP_MACH64CT 0x4354 #define PCI_CHIP_MACH64CX 0x4358 #define PCI_CHIP_RS250_4437 0x4437 #define PCI_CHIP_MACH64ET 0x4554 #define PCI_CHIP_MACH64GB 0x4742 #define PCI_CHIP_MACH64GD 0x4744 #define PCI_CHIP_MACH64GI 0x4749 #define PCI_CHIP_MACH64GL 0x474C #define PCI_CHIP_MACH64GM 0x474D #define PCI_CHIP_MACH64GN 0x474E #define PCI_CHIP_MACH64GO 0x474F #define PCI_CHIP_MACH64GP 0x4750 #define PCI_CHIP_MACH64GQ 0x4751 #define PCI_CHIP_MACH64GR 0x4752 #define PCI_CHIP_MACH64GS 0x4753 #define PCI_CHIP_MACH64GT 0x4754 #define PCI_CHIP_MACH64GU 0x4755 #define PCI_CHIP_MACH64GV 0x4756 #define PCI_CHIP_MACH64GW 0x4757 #define PCI_CHIP_MACH64GX 0x4758 #define PCI_CHIP_MACH64GY 0x4759 #define PCI_CHIP_MACH64GZ 0x475A #define PCI_CHIP_RV250_Id 0x4964 #define PCI_CHIP_RV250_Ie 0x4965 #define PCI_CHIP_RV250_If 0x4966 #define PCI_CHIP_RV250_Ig 0x4967 #define PCI_CHIP_R420_JH 0x4A48 #define PCI_CHIP_R420_JI 0x4A49 #define PCI_CHIP_R420_JJ 0x4A4A #define PCI_CHIP_R420_JK 0x4A4B #define PCI_CHIP_R420_JL 0x4A4C #define PCI_CHIP_R420_JM 0x4A4D #define PCI_CHIP_R420_JN 0x4A4E #define PCI_CHIP_R420_4A4F 0x4A4F #define PCI_CHIP_R420_JP 0x4A50 #define PCI_CHIP_R420_4A54 0x4A54 #define PCI_CHIP_R481_4B49 0x4B49 #define PCI_CHIP_R481_4B4A 0x4B4A #define PCI_CHIP_R481_4B4B 0x4B4B #define PCI_CHIP_R481_4B4C 0x4B4C #define PCI_CHIP_MACH64LB 0x4C42 #define PCI_CHIP_MACH64LD 0x4C44 #define PCI_CHIP_RAGE128LE 0x4C45 #define PCI_CHIP_RAGE128LF 0x4C46 #define PCI_CHIP_MACH64LG 0x4C47 #define PCI_CHIP_MACH64LI 0x4C49 #define PCI_CHIP_MACH64LM 0x4C4D #define PCI_CHIP_MACH64LN 0x4C4E #define PCI_CHIP_MACH64LP 0x4C50 #define PCI_CHIP_MACH64LQ 0x4C51 #define PCI_CHIP_MACH64LR 0x4C52 #define PCI_CHIP_MACH64LS 0x4C53 #define PCI_CHIP_RADEON_LW 0x4C57 #define PCI_CHIP_RADEON_LX 0x4C58 #define PCI_CHIP_RADEON_LY 0x4C59 #define PCI_CHIP_RADEON_LZ 0x4C5A #define PCI_CHIP_RV250_Ld 0x4C64 #define PCI_CHIP_RV250_Le 0x4C65 #define PCI_CHIP_RV250_Lf 0x4C66 #define PCI_CHIP_RV250_Lg 0x4C67 #define PCI_CHIP_RV250_Ln 0x4C6E #define PCI_CHIP_RAGE128MF 0x4D46 #define PCI_CHIP_RAGE128ML 0x4D4C #define PCI_CHIP_R300_ND 0x4E44 #define PCI_CHIP_R300_NE 0x4E45 #define PCI_CHIP_R300_NF 0x4E46 #define PCI_CHIP_R300_NG 0x4E47 #define PCI_CHIP_R350_NH 0x4E48 #define PCI_CHIP_R350_NI 0x4E49 #define PCI_CHIP_R360_NJ 0x4E4A #define PCI_CHIP_R350_NK 0x4E4B #define PCI_CHIP_RV350_NP 0x4E50 #define PCI_CHIP_RV350_NQ 0x4E51 #define PCI_CHIP_RV350_NR 0x4E52 #define PCI_CHIP_RV350_NS 0x4E53 #define PCI_CHIP_RV350_NT 0x4E54 #define PCI_CHIP_RV350_NV 0x4E56 #define PCI_CHIP_RAGE128PA 0x5041 #define PCI_CHIP_RAGE128PB 0x5042 #define PCI_CHIP_RAGE128PC 0x5043 #define PCI_CHIP_RAGE128PD 0x5044 #define PCI_CHIP_RAGE128PE 0x5045 #define PCI_CHIP_RAGE128PF 0x5046 #define PCI_CHIP_RAGE128PG 0x5047 #define PCI_CHIP_RAGE128PH 0x5048 #define PCI_CHIP_RAGE128PI 0x5049 #define PCI_CHIP_RAGE128PJ 0x504A #define PCI_CHIP_RAGE128PK 0x504B #define PCI_CHIP_RAGE128PL 0x504C #define PCI_CHIP_RAGE128PM 0x504D #define PCI_CHIP_RAGE128PN 0x504E #define PCI_CHIP_RAGE128PO 0x504F #define PCI_CHIP_RAGE128PP 0x5050 #define PCI_CHIP_RAGE128PQ 0x5051 #define PCI_CHIP_RAGE128PR 0x5052 #define PCI_CHIP_RAGE128PS 0x5053 #define PCI_CHIP_RAGE128PT 0x5054 #define PCI_CHIP_RAGE128PU 0x5055 #define PCI_CHIP_RAGE128PV 0x5056 #define PCI_CHIP_RAGE128PW 0x5057 #define PCI_CHIP_RAGE128PX 0x5058 #define PCI_CHIP_RADEON_QD 0x5144 #define PCI_CHIP_RADEON_QE 0x5145 #define PCI_CHIP_RADEON_QF 0x5146 #define PCI_CHIP_RADEON_QG 0x5147 #define PCI_CHIP_R200_QH 0x5148 #define PCI_CHIP_R200_QI 0x5149 #define PCI_CHIP_R200_QJ 0x514A #define PCI_CHIP_R200_QK 0x514B #define PCI_CHIP_R200_QL 0x514C #define PCI_CHIP_R200_QM 0x514D #define PCI_CHIP_R200_QN 0x514E #define PCI_CHIP_R200_QO 0x514F #define PCI_CHIP_RV200_QW 0x5157 #define PCI_CHIP_RV200_QX 0x5158 #define PCI_CHIP_RV100_QY 0x5159 #define PCI_CHIP_RV100_QZ 0x515A #define PCI_CHIP_RN50_515E 0x515E #define PCI_CHIP_RAGE128RE 0x5245 #define PCI_CHIP_RAGE128RF 0x5246 #define PCI_CHIP_RAGE128RG 0x5247 #define PCI_CHIP_RAGE128RK 0x524B #define PCI_CHIP_RAGE128RL 0x524C #define PCI_CHIP_RAGE128SE 0x5345 #define PCI_CHIP_RAGE128SF 0x5346 #define PCI_CHIP_RAGE128SG 0x5347 #define PCI_CHIP_RAGE128SH 0x5348 #define PCI_CHIP_RAGE128SK 0x534B #define PCI_CHIP_RAGE128SL 0x534C #define PCI_CHIP_RAGE128SM 0x534D #define PCI_CHIP_RAGE128SN 0x534E #define PCI_CHIP_RAGE128TF 0x5446 #define PCI_CHIP_RAGE128TL 0x544C #define PCI_CHIP_RAGE128TR 0x5452 #define PCI_CHIP_RAGE128TS 0x5453 #define PCI_CHIP_RAGE128TT 0x5454 #define PCI_CHIP_RAGE128TU 0x5455 #define PCI_CHIP_RV370_5460 0x5460 #define PCI_CHIP_RV370_5461 0x5461 #define PCI_CHIP_RV370_5462 0x5462 #define PCI_CHIP_RV370_5463 0x5463 #define PCI_CHIP_RV370_5464 0x5464 #define PCI_CHIP_RV370_5465 0x5465 #define PCI_CHIP_RV370_5466 0x5466 #define PCI_CHIP_RV370_5467 0x5467 #define PCI_CHIP_R423_UH 0x5548 #define PCI_CHIP_R423_UI 0x5549 #define PCI_CHIP_R423_UJ 0x554A #define PCI_CHIP_R423_UK 0x554B #define PCI_CHIP_R430_554C 0x554C #define PCI_CHIP_R430_554D 0x554D #define PCI_CHIP_R430_554E 0x554E #define PCI_CHIP_R430_554F 0x554F #define PCI_CHIP_R423_5550 0x5550 #define PCI_CHIP_R423_UQ 0x5551 #define PCI_CHIP_R423_UR 0x5552 #define PCI_CHIP_R423_UT 0x5554 #define PCI_CHIP_RV410_564A 0x564A #define PCI_CHIP_RV410_564B 0x564B #define PCI_CHIP_RV410_564F 0x564F #define PCI_CHIP_RV410_5652 0x5652 #define PCI_CHIP_RV410_5653 0x5653 #define PCI_CHIP_MACH64VT 0x5654 #define PCI_CHIP_MACH64VU 0x5655 #define PCI_CHIP_MACH64VV 0x5656 #define PCI_CHIP_RS300_5834 0x5834 #define PCI_CHIP_RS300_5835 0x5835 #define PCI_CHIP_RS300_5836 0x5836 #define PCI_CHIP_RS300_5837 0x5837 #define PCI_CHIP_RS480_5954 0x5954 #define PCI_CHIP_RS480_5955 0x5955 #define PCI_CHIP_RV280_5960 0x5960 #define PCI_CHIP_RV280_5961 0x5961 #define PCI_CHIP_RV280_5962 0x5962 #define PCI_CHIP_RV280_5964 0x5964 #define PCI_CHIP_RV280_5965 0x5965 #define PCI_CHIP_RN50_5969 0x5969 #define PCI_CHIP_RS482_5974 0x5974 #define PCI_CHIP_RS482_5975 0x5975 #define PCI_CHIP_RS400_5A41 0x5A41 #define PCI_CHIP_RS400_5A42 0x5A42 #define PCI_CHIP_RC410_5A61 0x5A61 #define PCI_CHIP_RC410_5A62 0x5A62 #define PCI_CHIP_RV370_5B60 0x5B60 #define PCI_CHIP_RV370_5B61 0x5B61 #define PCI_CHIP_RV370_5B62 0x5B62 #define PCI_CHIP_RV370_5B63 0x5B63 #define PCI_CHIP_RV370_5B64 0x5B64 #define PCI_CHIP_RV370_5B65 0x5B65 #define PCI_CHIP_RV370_5B66 0x5B66 #define PCI_CHIP_RV370_5B67 0x5B67 #define PCI_CHIP_RV280_5C61 0x5C61 #define PCI_CHIP_RV280_5C63 0x5C63 #define PCI_CHIP_R430_5D48 0x5D48 #define PCI_CHIP_R430_5D49 0x5D49 #define PCI_CHIP_R430_5D4A 0x5D4A #define PCI_CHIP_R480_5D4C 0x5D4C #define PCI_CHIP_R480_5D4D 0x5D4D #define PCI_CHIP_R480_5D4E 0x5D4E #define PCI_CHIP_R480_5D4F 0x5D4F #define PCI_CHIP_R480_5D50 0x5D50 #define PCI_CHIP_R480_5D52 0x5D52 #define PCI_CHIP_R423_5D57 0x5D57 #define PCI_CHIP_RV410_5E48 0x5E48 #define PCI_CHIP_RV410_5E4A 0x5E4A #define PCI_CHIP_RV410_5E4B 0x5E4B #define PCI_CHIP_RV410_5E4C 0x5E4C #define PCI_CHIP_RV410_5E4D 0x5E4D #define PCI_CHIP_RV410_5E4F 0x5E4F #define PCI_CHIP_RS350_7834 0x7834 #define PCI_CHIP_RS350_7835 0x7835 /* ASPEED Technology (AST) */ #define PCI_CHIP_AST2000 0x2000 /* Avance Logic */ #define PCI_CHIP_ALG2064 0x2064 #define PCI_CHIP_ALG2301 0x2301 #define PCI_CHIP_ALG2501 0x2501 /* Tseng */ #define PCI_CHIP_ET4000_W32P_A 0x3202 #define PCI_CHIP_ET4000_W32P_B 0x3205 #define PCI_CHIP_ET4000_W32P_D 0x3206 #define PCI_CHIP_ET4000_W32P_C 0x3207 #define PCI_CHIP_ET6000 0x3208 #define PCI_CHIP_ET6300 0x4702 /* Weitek */ #define PCI_CHIP_P9000 0x9001 #define PCI_CHIP_P9100 0x9100 /* Digital */ #define PCI_CHIP_DC21050 0x0001 #define PCI_CHIP_DEC21030 0x0004 #define PCI_CHIP_TGA2 0x000D /* Cirrus Logic */ #define PCI_CHIP_GD7548 0x0038 #define PCI_CHIP_GD7555 0x0040 #define PCI_CHIP_GD5430 0x00A0 #define PCI_CHIP_GD5434_4 0x00A4 #define PCI_CHIP_GD5434_8 0x00A8 #define PCI_CHIP_GD5436 0x00AC #define PCI_CHIP_GD5446 0x00B8 #define PCI_CHIP_GD5480 0x00BC #define PCI_CHIP_GD5462 0x00D0 #define PCI_CHIP_GD5464 0x00D4 #define PCI_CHIP_GD5464BD 0x00D5 #define PCI_CHIP_GD5465 0x00D6 #define PCI_CHIP_6729 0x1100 #define PCI_CHIP_6832 0x1110 #define PCI_CHIP_GD7542 0x1200 #define PCI_CHIP_GD7543 0x1202 #define PCI_CHIP_GD7541 0x1204 /* AMD */ #define PCI_CHIP_AMD761 0x700E /* Trident */ #define PCI_CHIP_2100 0x2100 #define PCI_CHIP_8400 0x8400 #define PCI_CHIP_8420 0x8420 #define PCI_CHIP_8500 0x8500 #define PCI_CHIP_8520 0x8520 #define PCI_CHIP_8600 0x8600 #define PCI_CHIP_8620 0x8620 #define PCI_CHIP_8820 0x8820 #define PCI_CHIP_9320 0x9320 #define PCI_CHIP_9388 0x9388 #define PCI_CHIP_9397 0x9397 #define PCI_CHIP_939A 0x939A #define PCI_CHIP_9420 0x9420 #define PCI_CHIP_9440 0x9440 #define PCI_CHIP_9520 0x9520 #define PCI_CHIP_9525 0x9525 #define PCI_CHIP_9540 0x9540 #define PCI_CHIP_9660 0x9660 #define PCI_CHIP_9750 0x9750 #define PCI_CHIP_9850 0x9850 #define PCI_CHIP_9880 0x9880 #define PCI_CHIP_9910 0x9910 /* ALI */ #define PCI_CHIP_M1435 0x1435 /* Matrox */ #define PCI_CHIP_MGA2085 0x0518 #define PCI_CHIP_MGA2064 0x0519 #define PCI_CHIP_MGA1064 0x051A #define PCI_CHIP_MGA2164 0x051B #define PCI_CHIP_MGA2164_AGP 0x051F #define PCI_CHIP_MGAG200_PCI 0x0520 #define PCI_CHIP_MGAG200 0x0521 #define PCI_CHIP_MGAG400 0x0525 #define PCI_CHIP_MGAG550 0x2527 #define PCI_CHIP_IMPRESSION 0x0D10 #define PCI_CHIP_MGAG100_PCI 0x1000 #define PCI_CHIP_MGAG100 0x1001 #define PCI_CARD_G400_TH 0x2179 #define PCI_CARD_MILL_G200_SD 0xFF00 #define PCI_CARD_PROD_G100_SD 0xFF01 #define PCI_CARD_MYST_G200_SD 0xFF02 #define PCI_CARD_MILL_G200_SG 0xFF03 #define PCI_CARD_MARV_G200_SD 0xFF04 /* Chips & Tech */ #define PCI_CHIP_65545 0x00D8 #define PCI_CHIP_65548 0x00DC #define PCI_CHIP_65550 0x00E0 #define PCI_CHIP_65554 0x00E4 #define PCI_CHIP_65555 0x00E5 #define PCI_CHIP_68554 0x00F4 #define PCI_CHIP_69000 0x00C0 #define PCI_CHIP_69030 0x0C30 /* Miro */ #define PCI_CHIP_ZR36050 0x5601 /* NEC */ #define PCI_CHIP_POWER_VR 0x0046 /* SiS */ #define PCI_CHIP_SG86C201 0x0001 #define PCI_CHIP_SG86C202 0x0002 #define PCI_CHIP_SG85C503 0x0008 #define PCI_CHIP_SIS5597 0x0200 /* Agregado por Carlos Duclos & Manuel Jander */ #define PCI_CHIP_SIS82C204 0x0204 #define PCI_CHIP_SG86C205 0x0205 #define PCI_CHIP_SG86C215 0x0215 #define PCI_CHIP_SG86C225 0x0225 #define PCI_CHIP_85C501 0x0406 #define PCI_CHIP_85C496 0x0496 #define PCI_CHIP_85C601 0x0601 #define PCI_CHIP_85C5107 0x5107 #define PCI_CHIP_85C5511 0x5511 #define PCI_CHIP_85C5513 0x5513 #define PCI_CHIP_SIS5571 0x5571 #define PCI_CHIP_SIS5597_2 0x5597 #define PCI_CHIP_SIS530 0x6306 #define PCI_CHIP_SIS6326 0x6326 #define PCI_CHIP_SIS7001 0x7001 #define PCI_CHIP_SIS300 0x0300 #define PCI_CHIP_SIS315H 0x0310 #define PCI_CHIP_SIS315PRO 0x0325 #define PCI_CHIP_SIS330 0x0330 #define PCI_CHIP_SIS630 0x6300 #define PCI_CHIP_SIS540 0x5300 #define PCI_CHIP_SIS550 0x5315 #define PCI_CHIP_SIS650 0x6325 #define PCI_CHIP_SIS730 0x7300 /* Hewlett-Packard */ #define PCI_CHIP_ELROY 0x1054 #define PCI_CHIP_ZX1_SBA 0x1229 #define PCI_CHIP_ZX1_IOC 0x122A #define PCI_CHIP_ZX1_LBA 0x122E /* a.k.a. Mercury */ #define PCI_CHIP_ZX1_AGP8 0x12B4 /* a.k.a. QuickSilver */ #define PCI_CHIP_ZX2_LBA 0x12EE #define PCI_CHIP_ZX2_SBA 0x4030 #define PCI_CHIP_ZX2_IOC 0x4031 #define PCI_CHIP_ZX2_PCIE 0x4037 /* SGS */ #define PCI_CHIP_STG2000 0x0008 #define PCI_CHIP_STG1764 0x0009 #define PCI_CHIP_KYROII 0x0010 /* Texas Instruments */ #define PCI_CHIP_TI_PERMEDIA 0x3D04 #define PCI_CHIP_TI_PERMEDIA2 0x3D07 /* Oak */ #define PCI_CHIP_OTI107 0x0107 /* Number Nine */ #define PCI_CHIP_I128 0x2309 #define PCI_CHIP_I128_2 0x2339 #define PCI_CHIP_I128_T2R 0x493D #define PCI_CHIP_I128_T2R4 0x5348 /* Sun */ #define PCI_CHIP_EBUS 0x1000 #define PCI_CHIP_HAPPY_MEAL 0x1001 #define PCI_CHIP_SIMBA 0x5000 #define PCI_CHIP_PSYCHO 0x8000 #define PCI_CHIP_SCHIZO 0x8001 #define PCI_CHIP_SABRE 0xA000 #define PCI_CHIP_HUMMINGBIRD 0xA001 /* BrookTree */ #define PCI_CHIP_BT848 0x0350 #define PCI_CHIP_BT849 0x0351 /* NVIDIA */ #define PCI_CHIP_NV1 0x0008 #define PCI_CHIP_DAC64 0x0009 #define PCI_CHIP_TNT 0x0020 #define PCI_CHIP_TNT2 0x0028 #define PCI_CHIP_UTNT2 0x0029 #define PCI_CHIP_VTNT2 0x002C #define PCI_CHIP_UVTNT2 0x002D #define PCI_CHIP_ITNT2 0x00A0 #define PCI_CHIP_GEFORCE_256 0x0100 #define PCI_CHIP_GEFORCE_DDR 0x0101 #define PCI_CHIP_QUADRO 0x0103 #define PCI_CHIP_GEFORCE2_MX 0x0110 #define PCI_CHIP_GEFORCE2_MX_100 0x0111 #define PCI_CHIP_GEFORCE2_GO 0x0112 #define PCI_CHIP_QUADRO2_MXR 0x0113 #define PCI_CHIP_GEFORCE2_GTS 0x0150 #define PCI_CHIP_GEFORCE2_TI 0x0151 #define PCI_CHIP_GEFORCE2_ULTRA 0x0152 #define PCI_CHIP_QUADRO2_PRO 0x0153 #define PCI_CHIP_GEFORCE4_MX_460 0x0170 #define PCI_CHIP_GEFORCE4_MX_440 0x0171 #define PCI_CHIP_GEFORCE4_MX_420 0x0172 #define PCI_CHIP_GEFORCE4_440_GO 0x0174 #define PCI_CHIP_GEFORCE4_420_GO 0x0175 #define PCI_CHIP_GEFORCE4_420_GO_M32 0x0176 #define PCI_CHIP_QUADRO4_500XGL 0x0178 #define PCI_CHIP_GEFORCE4_440_GO_M64 0x0179 #define PCI_CHIP_QUADRO4_200 0x017A #define PCI_CHIP_QUADRO4_550XGL 0x017B #define PCI_CHIP_QUADRO4_500_GOGL 0x017C #define PCI_CHIP_IGEFORCE2 0x01A0 #define PCI_CHIP_GEFORCE3 0x0200 #define PCI_CHIP_GEFORCE3_TI_200 0x0201 #define PCI_CHIP_GEFORCE3_TI_500 0x0202 #define PCI_CHIP_QUADRO_DCC 0x0203 #define PCI_CHIP_GEFORCE4_TI_4600 0x0250 #define PCI_CHIP_GEFORCE4_TI_4400 0x0251 #define PCI_CHIP_GEFORCE4_TI_4200 0x0253 #define PCI_CHIP_QUADRO4_900XGL 0x0258 #define PCI_CHIP_QUADRO4_750XGL 0x0259 #define PCI_CHIP_QUADRO4_700XGL 0x025B /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 /* IMS */ #define PCI_CHIP_IMSTT128 0x9128 #define PCI_CHIP_IMSTT3D 0x9135 /* Alliance Semiconductor */ #define PCI_CHIP_AP6410 0x3210 #define PCI_CHIP_AP6422 0x6422 #define PCI_CHIP_AT24 0x6424 #define PCI_CHIP_AT3D 0x643D /* 3dfx Interactive */ #define PCI_CHIP_VOODOO_GRAPHICS 0x0001 #define PCI_CHIP_VOODOO2 0x0002 #define PCI_CHIP_BANSHEE 0x0003 #define PCI_CHIP_VOODOO3 0x0005 #define PCI_CHIP_VOODOO5 0x0009 #define PCI_CARD_VOODOO3_2000 0x0036 #define PCI_CARD_VOODOO3_3000 0x003A /* Rendition */ #define PCI_CHIP_V1000 0x0001 #define PCI_CHIP_V2x00 0x2000 /* 3Dlabs */ #define PCI_CHIP_300SX 0x0001 #define PCI_CHIP_500TX 0x0002 #define PCI_CHIP_DELTA 0x0003 #define PCI_CHIP_PERMEDIA 0x0004 #define PCI_CHIP_MX 0x0006 #define PCI_CHIP_PERMEDIA2 0x0007 #define PCI_CHIP_GAMMA 0x0008 #define PCI_CHIP_PERMEDIA2V 0x0009 #define PCI_CHIP_PERMEDIA3 0x000A #define PCI_CHIP_PERMEDIA4 0x000C #define PCI_CHIP_R4 0x000D #define PCI_CHIP_GAMMA2 0x000E #define PCI_CHIP_R4ALT 0x0011 /* S3 */ #define PCI_CHIP_PLATO 0x0551 #define PCI_CHIP_VIRGE 0x5631 #define PCI_CHIP_TRIO 0x8811 #define PCI_CHIP_AURORA64VP 0x8812 #define PCI_CHIP_TRIO64UVP 0x8814 #define PCI_CHIP_VIRGE_VX 0x883D #define PCI_CHIP_868 0x8880 #define PCI_CHIP_928 0x88B0 #define PCI_CHIP_864_0 0x88C0 #define PCI_CHIP_864_1 0x88C1 #define PCI_CHIP_964_0 0x88D0 #define PCI_CHIP_964_1 0x88D1 #define PCI_CHIP_968 0x88F0 #define PCI_CHIP_TRIO64V2_DXGX 0x8901 #define PCI_CHIP_PLATO_PX 0x8902 #define PCI_CHIP_Trio3D 0x8904 #define PCI_CHIP_VIRGE_DXGX 0x8A01 #define PCI_CHIP_VIRGE_GX2 0x8A10 #define PCI_CHIP_Trio3D_2X 0x8A13 #define PCI_CHIP_SAVAGE3D 0x8A20 #define PCI_CHIP_SAVAGE3D_MV 0x8A21 #define PCI_CHIP_SAVAGE4 0x8A22 #define PCI_CHIP_PROSAVAGE_PM 0x8A25 #define PCI_CHIP_PROSAVAGE_KM 0x8A26 #define PCI_CHIP_VIRGE_MX 0x8C01 #define PCI_CHIP_VIRGE_MXPLUS 0x8C02 #define PCI_CHIP_VIRGE_MXP 0x8C03 #define PCI_CHIP_SAVAGE_MX_MV 0x8C10 #define PCI_CHIP_SAVAGE_MX 0x8C11 #define PCI_CHIP_SAVAGE_IX_MV 0x8C12 #define PCI_CHIP_SAVAGE_IX 0x8C13 #define PCI_CHIP_SUPSAV_MX128 0x8C22 #define PCI_CHIP_SUPSAV_MX64 0x8C24 #define PCI_CHIP_SUPSAV_MX64C 0x8C26 #define PCI_CHIP_SUPSAV_IX128SDR 0x8C2A #define PCI_CHIP_SUPSAV_IX128DDR 0x8C2B #define PCI_CHIP_SUPSAV_IX64SDR 0x8C2C #define PCI_CHIP_SUPSAV_IX64DDR 0x8C2D #define PCI_CHIP_SUPSAV_IXCSDR 0x8C2E #define PCI_CHIP_SUPSAV_IXCDDR 0x8C2F #define PCI_CHIP_S3TWISTER_P 0x8D01 #define PCI_CHIP_S3TWISTER_K 0x8D02 #define PCI_CHIP_PROSAVAGE_DDR 0x8D03 #define PCI_CHIP_PROSAVAGE_DDRK 0x8D04 #define PCI_CHIP_SAVAGE2000 0x9102 /* ARK Logic */ #define PCI_CHIP_1000PV 0xA091 #define PCI_CHIP_2000PV 0xA099 #define PCI_CHIP_2000MT 0xA0A1 #define PCI_CHIP_2000MI 0xA0A9 /* Tritech Microelectronics */ #define PCI_CHIP_TR25202 0xFC02 /* Neomagic */ #define PCI_CHIP_NM2070 0x0001 #define PCI_CHIP_NM2090 0x0002 #define PCI_CHIP_NM2093 0x0003 #define PCI_CHIP_NM2097 0x0083 #define PCI_CHIP_NM2160 0x0004 #define PCI_CHIP_NM2200 0x0005 #define PCI_CHIP_NM2230 0x0025 #define PCI_CHIP_NM2360 0x0006 #define PCI_CHIP_NM2380 0x0016 /* Intel */ #define PCI_CHIP_I815_BRIDGE 0x1130 #define PCI_CHIP_I815 0x1132 #define PCI_CHIP_82801_P2P 0x244E #define PCI_CHIP_845_G_BRIDGE 0x2560 #define PCI_CHIP_845_G 0x2562 #define PCI_CHIP_I830_M_BRIDGE 0x3575 #define PCI_CHIP_I830_M 0x3577 #define PCI_CHIP_I810_BRIDGE 0x7120 #define PCI_CHIP_I810 0x7121 #define PCI_CHIP_I810_DC100_BRIDGE 0x7122 #define PCI_CHIP_I810_DC100 0x7123 #define PCI_CHIP_I810_E_BRIDGE 0x7124 #define PCI_CHIP_I810_E 0x7125 #define PCI_CHIP_I740_AGP 0x7800 #define PCI_CHIP_460GX_PXB 0x84CB #define PCI_CHIP_460GX_SAC 0x84E0 #define PCI_CHIP_460GX_GXB_2 0x84E2 /* PCI function 2 */ #define PCI_CHIP_460GX_WXB 0x84E6 #define PCI_CHIP_460GX_GXB_1 0x84EA /* PCI function 1 */ /* Silicon Motion Inc. */ #define PCI_CHIP_SMI910 0x0910 #define PCI_CHIP_SMI810 0x0810 #define PCI_CHIP_SMI820 0x0820 #define PCI_CHIP_SMI710 0x0710 #define PCI_CHIP_SMI712 0x0712 #define PCI_CHIP_SMI720 0x0720 #define PCI_CHIP_SMI731 0x0730 /* VMware */ #define PCI_CHIP_VMWARE0405 0x0405 #define PCI_CHIP_VMWARE0710 0x0710 #endif /* _XF86_PCIINFO_H */ xorg-server-1.20.8/hw/xfree86/common/xf86Mode.c0000644000175000017500000021725213640201473015760 00000000000000/* * 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). */ /* * LCM() and scanLineWidth() are: * * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.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 name of Marc Aurele La France not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Marc Aurele La France makes no representations * about the suitability of this software for any purpose. It is provided * "as-is" without express or implied warranty. * * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO * EVENT SHALL MARC AURELE LA FRANCE 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. * * Copyright 1990,91,92,93 by Thomas Roell, Germany. * Copyright 1991,92,93 by SGCS (Snitily Graphics Consulting Services), USA. * * 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 Thomas Roell nor * SGCS be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * Thomas Roell nor SGCS makes no representations about the suitability * of this software for any purpose. It is provided "as is" without * express or implied warranty. * * THOMAS ROELL AND SGCS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR SGCS 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. */ /* * Authors: Dirk Hohndel * David Dawes * Marc La France * ... and others * * This file includes helper functions for mode related things. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86Modes.h" #include "xf86Crtc.h" #include "os.h" #include "servermd.h" #include "globals.h" #include "xf86.h" #include "xf86Priv.h" #include "edid.h" static void printModeRejectMessage(int index, DisplayModePtr p, int status) { const char *type; if (p->type & M_T_BUILTIN) type = "built-in "; else if (p->type & M_T_DEFAULT) type = "default "; else if (p->type & M_T_DRIVER) type = "driver "; else type = ""; xf86DrvMsg(index, X_INFO, "Not using %smode \"%s\" (%s)\n", type, p->name, xf86ModeStatusToString(status)); } /* * Find closest clock to given frequency (in kHz). This assumes the * number of clocks is greater than zero. */ static int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2, int DivFactor, int MulFactor, int *divider) { int nearestClock = 0, nearestDiv = 1; int minimumGap = abs(freq - scrp->clock[0]); int i, j, k, gap; if (allowDiv2) k = 2; else k = 1; /* Must set this here in case the best match is scrp->clock[0] */ if (divider != NULL) *divider = 0; for (i = 0; i < scrp->numClocks; i++) { for (j = 1; j <= k; j++) { gap = abs((freq * j) - ((scrp->clock[i] * DivFactor) / MulFactor)); if ((gap < minimumGap) || ((gap == minimumGap) && (j < nearestDiv))) { minimumGap = gap; nearestClock = i; nearestDiv = j; if (divider != NULL) *divider = (j - 1) * V_CLKDIV2; } } } return nearestClock; } /* * xf86ModeStatusToString * * Convert a ModeStatus value to a printable message */ const char * xf86ModeStatusToString(ModeStatus status) { switch (status) { case MODE_OK: return "Mode OK"; case MODE_HSYNC: return "hsync out of range"; case MODE_VSYNC: return "vrefresh out of range"; case MODE_H_ILLEGAL: return "illegal horizontal timings"; case MODE_V_ILLEGAL: return "illegal vertical timings"; case MODE_BAD_WIDTH: return "width requires unsupported line pitch"; case MODE_NOMODE: return "no mode of this name"; case MODE_NO_INTERLACE: return "interlace mode not supported"; case MODE_NO_DBLESCAN: return "doublescan mode not supported"; case MODE_NO_VSCAN: return "multiscan mode not supported"; case MODE_MEM: return "insufficient memory for mode"; case MODE_VIRTUAL_X: return "width too large for virtual size"; case MODE_VIRTUAL_Y: return "height too large for virtual size"; case MODE_MEM_VIRT: return "insufficient memory given virtual size"; case MODE_NOCLOCK: return "no clock available for mode"; case MODE_CLOCK_HIGH: return "mode clock too high"; case MODE_CLOCK_LOW: return "mode clock too low"; case MODE_CLOCK_RANGE: return "bad mode clock/interlace/doublescan"; case MODE_BAD_HVALUE: return "horizontal timing out of range"; case MODE_BAD_VVALUE: return "vertical timing out of range"; case MODE_BAD_VSCAN: return "VScan value out of range"; case MODE_HSYNC_NARROW: return "horizontal sync too narrow"; case MODE_HSYNC_WIDE: return "horizontal sync too wide"; case MODE_HBLANK_NARROW: return "horizontal blanking too narrow"; case MODE_HBLANK_WIDE: return "horizontal blanking too wide"; case MODE_VSYNC_NARROW: return "vertical sync too narrow"; case MODE_VSYNC_WIDE: return "vertical sync too wide"; case MODE_VBLANK_NARROW: return "vertical blanking too narrow"; case MODE_VBLANK_WIDE: return "vertical blanking too wide"; case MODE_PANEL: return "exceeds panel dimensions"; case MODE_INTERLACE_WIDTH: return "width too large for interlaced mode"; case MODE_ONE_WIDTH: return "all modes must have the same width"; case MODE_ONE_HEIGHT: return "all modes must have the same height"; case MODE_ONE_SIZE: return "all modes must have the same resolution"; case MODE_NO_REDUCED: return "monitor doesn't support reduced blanking"; case MODE_BANDWIDTH: return "mode requires too much memory bandwidth"; case MODE_BAD: return "unknown reason"; case MODE_ERROR: return "internal error"; default: return "unknown"; } } /* * xf86ShowClockRanges() -- Print the clock ranges allowed * and the clock values scaled by ClockMulFactor and ClockDivFactor */ void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges) { ClockRangePtr cp; int MulFactor = 1; int DivFactor = 1; int i, j; int scaledClock; for (cp = clockRanges; cp != NULL; cp = cp->next) { DivFactor = max(1, cp->ClockDivFactor); MulFactor = max(1, cp->ClockMulFactor); if (scrp->progClock) { if (cp->minClock) { if (cp->maxClock) { xf86DrvMsg(scrp->scrnIndex, X_INFO, "Clock range: %6.2f to %6.2f MHz\n", (double) cp->minClock / 1000.0, (double) cp->maxClock / 1000.0); } else { xf86DrvMsg(scrp->scrnIndex, X_INFO, "Minimum clock: %6.2f MHz\n", (double) cp->minClock / 1000.0); } } else { if (cp->maxClock) { xf86DrvMsg(scrp->scrnIndex, X_INFO, "Maximum clock: %6.2f MHz\n", (double) cp->maxClock / 1000.0); } } } else if (DivFactor > 1 || MulFactor > 1) { j = 0; for (i = 0; i < scrp->numClocks; i++) { scaledClock = (scrp->clock[i] * DivFactor) / MulFactor; if (scaledClock >= cp->minClock && scaledClock <= cp->maxClock) { if ((j % 8) == 0) { if (j > 0) xf86ErrorF("\n"); xf86DrvMsg(scrp->scrnIndex, X_INFO, "scaled clocks:"); } xf86ErrorF(" %6.2f", (double) scaledClock / 1000.0); j++; } } xf86ErrorF("\n"); } } } static Bool modeInClockRange(ClockRangePtr cp, DisplayModePtr p) { return ((p->Clock >= cp->minClock) && (p->Clock <= cp->maxClock) && (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) && (cp->doubleScanAllowed || ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN)))); } /* * xf86FindClockRangeForMode() [... like the name says ...] */ static ClockRangePtr xf86FindClockRangeForMode(ClockRangePtr clockRanges, DisplayModePtr p) { ClockRangePtr cp; for (cp = clockRanges;; cp = cp->next) if (!cp || modeInClockRange(cp, p)) return cp; } /* * xf86HandleBuiltinMode() - handles built-in modes */ static ModeStatus xf86HandleBuiltinMode(ScrnInfoPtr scrp, DisplayModePtr p, DisplayModePtr modep, ClockRangePtr clockRanges, Bool allowDiv2) { ClockRangePtr cp; int extraFlags = 0; int MulFactor = 1; int DivFactor = 1; int clockIndex; /* Reject previously rejected modes */ if (p->status != MODE_OK) return p->status; /* Reject previously considered modes */ if (p->prev) return MODE_NOMODE; if ((p->type & M_T_CLOCK_C) == M_T_CLOCK_C) { /* Check clock is in range */ cp = xf86FindClockRangeForMode(clockRanges, p); if (cp == NULL) { modep->type = p->type; p->status = MODE_CLOCK_RANGE; return MODE_CLOCK_RANGE; } DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; if (!scrp->progClock) { clockIndex = xf86GetNearestClock(scrp, p->Clock, allowDiv2, cp->ClockDivFactor, cp->ClockMulFactor, &extraFlags); modep->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor; modep->ClockIndex = clockIndex; modep->SynthClock = scrp->clock[clockIndex]; if (extraFlags & V_CLKDIV2) { modep->Clock /= 2; modep->SynthClock /= 2; } } else { modep->Clock = p->Clock; modep->ClockIndex = -1; modep->SynthClock = (modep->Clock * MulFactor) / DivFactor; } modep->PrivFlags = cp->PrivFlags; } else { if (!scrp->progClock) { modep->Clock = p->Clock; modep->ClockIndex = p->ClockIndex; modep->SynthClock = p->SynthClock; } else { modep->Clock = p->Clock; modep->ClockIndex = -1; modep->SynthClock = p->SynthClock; } modep->PrivFlags = p->PrivFlags; } modep->type = p->type; modep->HDisplay = p->HDisplay; modep->HSyncStart = p->HSyncStart; modep->HSyncEnd = p->HSyncEnd; modep->HTotal = p->HTotal; modep->HSkew = p->HSkew; modep->VDisplay = p->VDisplay; modep->VSyncStart = p->VSyncStart; modep->VSyncEnd = p->VSyncEnd; modep->VTotal = p->VTotal; modep->VScan = p->VScan; modep->Flags = p->Flags | extraFlags; modep->CrtcHDisplay = p->CrtcHDisplay; modep->CrtcHBlankStart = p->CrtcHBlankStart; modep->CrtcHSyncStart = p->CrtcHSyncStart; modep->CrtcHSyncEnd = p->CrtcHSyncEnd; modep->CrtcHBlankEnd = p->CrtcHBlankEnd; modep->CrtcHTotal = p->CrtcHTotal; modep->CrtcHSkew = p->CrtcHSkew; modep->CrtcVDisplay = p->CrtcVDisplay; modep->CrtcVBlankStart = p->CrtcVBlankStart; modep->CrtcVSyncStart = p->CrtcVSyncStart; modep->CrtcVSyncEnd = p->CrtcVSyncEnd; modep->CrtcVBlankEnd = p->CrtcVBlankEnd; modep->CrtcVTotal = p->CrtcVTotal; modep->CrtcHAdjusted = p->CrtcHAdjusted; modep->CrtcVAdjusted = p->CrtcVAdjusted; modep->HSync = p->HSync; modep->VRefresh = p->VRefresh; modep->Private = p->Private; modep->PrivSize = p->PrivSize; p->prev = modep; return MODE_OK; } /* * xf86LookupMode * * This function returns a mode from the given list which matches the * given name. When multiple modes with the same name are available, * the method of picking the matching mode is determined by the * strategy selected. * * This function takes the following parameters: * scrp ScrnInfoPtr * modep pointer to the returned mode, which must have the name * field filled in. * clockRanges a list of clock ranges. This is optional when all the * modes are built-in modes. * strategy how to decide which mode to use from multiple modes with * the same name * * In addition, the following fields from the ScrnInfoRec are used: * modePool the list of monitor modes compatible with the driver * clocks a list of discrete clocks * numClocks number of discrete clocks * progClock clock is programmable * * If a mode was found, its values are filled in to the area pointed to * by modep, If a mode was not found the return value indicates the * reason. */ static ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, ClockRangePtr clockRanges, LookupModeFlags strategy) { DisplayModePtr p, bestMode = NULL; ClockRangePtr cp; int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1; double refresh, bestRefresh = 0.0; Bool found = FALSE; int extraFlags = 0; int clockIndex = -1; int MulFactor = 1; int DivFactor = 1; int ModePrivFlags = 0; ModeStatus status = MODE_NOMODE; Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0; int n; const int types[] = { M_T_BUILTIN | M_T_PREFERRED, M_T_BUILTIN, M_T_USERDEF | M_T_PREFERRED, M_T_USERDEF, M_T_DRIVER | M_T_PREFERRED, M_T_DRIVER, 0 }; const int ntypes = ARRAY_SIZE(types); strategy &= ~(LOOKUP_CLKDIV2 | LOOKUP_OPTIONAL_TOLERANCES); /* Some sanity checking */ if (scrp == NULL || scrp->modePool == NULL || (!scrp->progClock && scrp->numClocks == 0)) { ErrorF("xf86LookupMode: called with invalid scrnInfoRec\n"); return MODE_ERROR; } if (modep == NULL || modep->name == NULL) { ErrorF("xf86LookupMode: called with invalid modep\n"); return MODE_ERROR; } for (cp = clockRanges; cp != NULL; cp = cp->next) { /* DivFactor and MulFactor must be > 0 */ cp->ClockDivFactor = max(1, cp->ClockDivFactor); cp->ClockMulFactor = max(1, cp->ClockMulFactor); } /* Scan the mode pool for matching names */ for (n = 0; n < ntypes; n++) { int type = types[n]; for (p = scrp->modePool; p != NULL; p = p->next) { /* scan through the modes in the sort order above */ if ((p->type & type) != type) continue; if (strcmp(p->name, modep->name) == 0) { /* Skip over previously rejected modes */ if (p->status != MODE_OK) { if (!found) status = p->status; continue; } /* Skip over previously considered modes */ if (p->prev) continue; if (p->type & M_T_BUILTIN) { return xf86HandleBuiltinMode(scrp, p, modep, clockRanges, allowDiv2); } /* Check clock is in range */ cp = xf86FindClockRangeForMode(clockRanges, p); if (cp == NULL) { /* * XXX Could do more here to provide a more detailed * reason for not finding a mode. */ p->status = MODE_CLOCK_RANGE; if (!found) status = MODE_CLOCK_RANGE; continue; } /* * If programmable clock and strategy is not * LOOKUP_BEST_REFRESH, the required mode has been found, * otherwise record the refresh and continue looking. */ if (scrp->progClock) { found = TRUE; if (strategy != LOOKUP_BEST_REFRESH) { bestMode = p; DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; break; } refresh = xf86ModeVRefresh(p); if (p->Flags & V_INTERLACE) refresh /= INTERLACE_REFRESH_WEIGHT; if (refresh > bestRefresh) { bestMode = p; DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; bestRefresh = refresh; } continue; } /* * Clock is in range, so if it is not a programmable clock, find * a matching clock. */ i = xf86GetNearestClock(scrp, p->Clock, allowDiv2, cp->ClockDivFactor, cp->ClockMulFactor, &k); /* * If the clock is too far from the requested clock, this * mode is no good. */ if (k & V_CLKDIV2) gap = abs((p->Clock * 2) - ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor)); else gap = abs(p->Clock - ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor)); if (gap > minimumGap) { p->status = MODE_NOCLOCK; if (!found) status = MODE_NOCLOCK; continue; } found = TRUE; if (strategy == LOOKUP_BEST_REFRESH) { refresh = xf86ModeVRefresh(p); if (p->Flags & V_INTERLACE) refresh /= INTERLACE_REFRESH_WEIGHT; if (refresh > bestRefresh) { bestMode = p; DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; extraFlags = k; clockIndex = i; bestRefresh = refresh; } continue; } if (strategy == LOOKUP_CLOSEST_CLOCK) { if (gap < minimumGap) { bestMode = p; DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; extraFlags = k; clockIndex = i; minimumGap = gap; } continue; } /* * If strategy is neither LOOKUP_BEST_REFRESH or * LOOKUP_CLOSEST_CLOCK the required mode has been found. */ bestMode = p; DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; extraFlags = k; clockIndex = i; break; } } if (found) break; } if (!found || bestMode == NULL) return status; /* Fill in the mode parameters */ if (scrp->progClock) { modep->Clock = bestMode->Clock; modep->ClockIndex = -1; modep->SynthClock = (modep->Clock * MulFactor) / DivFactor; } else { modep->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor; modep->ClockIndex = clockIndex; modep->SynthClock = scrp->clock[clockIndex]; if (extraFlags & V_CLKDIV2) { modep->Clock /= 2; modep->SynthClock /= 2; } } modep->type = bestMode->type; modep->PrivFlags = ModePrivFlags; modep->HDisplay = bestMode->HDisplay; modep->HSyncStart = bestMode->HSyncStart; modep->HSyncEnd = bestMode->HSyncEnd; modep->HTotal = bestMode->HTotal; modep->HSkew = bestMode->HSkew; modep->VDisplay = bestMode->VDisplay; modep->VSyncStart = bestMode->VSyncStart; modep->VSyncEnd = bestMode->VSyncEnd; modep->VTotal = bestMode->VTotal; modep->VScan = bestMode->VScan; modep->Flags = bestMode->Flags | extraFlags; modep->CrtcHDisplay = bestMode->CrtcHDisplay; modep->CrtcHBlankStart = bestMode->CrtcHBlankStart; modep->CrtcHSyncStart = bestMode->CrtcHSyncStart; modep->CrtcHSyncEnd = bestMode->CrtcHSyncEnd; modep->CrtcHBlankEnd = bestMode->CrtcHBlankEnd; modep->CrtcHTotal = bestMode->CrtcHTotal; modep->CrtcHSkew = bestMode->CrtcHSkew; modep->CrtcVDisplay = bestMode->CrtcVDisplay; modep->CrtcVBlankStart = bestMode->CrtcVBlankStart; modep->CrtcVSyncStart = bestMode->CrtcVSyncStart; modep->CrtcVSyncEnd = bestMode->CrtcVSyncEnd; modep->CrtcVBlankEnd = bestMode->CrtcVBlankEnd; modep->CrtcVTotal = bestMode->CrtcVTotal; modep->CrtcHAdjusted = bestMode->CrtcHAdjusted; modep->CrtcVAdjusted = bestMode->CrtcVAdjusted; modep->HSync = bestMode->HSync; modep->VRefresh = bestMode->VRefresh; modep->Private = bestMode->Private; modep->PrivSize = bestMode->PrivSize; bestMode->prev = modep; return MODE_OK; } /* * xf86CheckModeForMonitor * * This function takes a mode and monitor description, and determines * if the mode is valid for the monitor. */ ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor) { int i; /* Sanity checks */ if (mode == NULL || monitor == NULL) { ErrorF("xf86CheckModeForMonitor: called with invalid parameters\n"); return MODE_ERROR; } DebugF("xf86CheckModeForMonitor(%p %s, %p %s)\n", mode, mode->name, monitor, monitor->id); /* Some basic mode validity checks */ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart || mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal) return MODE_H_ILLEGAL; if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart || mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal) return MODE_V_ILLEGAL; if (monitor->nHsync > 0) { /* Check hsync against the allowed ranges */ float hsync = xf86ModeHSync(mode); for (i = 0; i < monitor->nHsync; i++) if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) && (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE))) break; /* Now see whether we ran out of sync ranges without finding a match */ if (i == monitor->nHsync) return MODE_HSYNC; } if (monitor->nVrefresh > 0) { /* Check vrefresh against the allowed ranges */ float vrefrsh = xf86ModeVRefresh(mode); for (i = 0; i < monitor->nVrefresh; i++) if ((vrefrsh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) && (vrefrsh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE))) break; /* Now see whether we ran out of refresh ranges without finding a match */ if (i == monitor->nVrefresh) return MODE_VSYNC; } /* Force interlaced modes to have an odd VTotal */ if (mode->Flags & V_INTERLACE) mode->CrtcVTotal = mode->VTotal |= 1; /* * This code stops cvt -r modes, and only cvt -r modes, from hitting 15y+ * old CRTs which might, when there is a lot of solar flare activity and * when the celestial bodies are unfavourably aligned, implode trying to * sync to it. It's called "Protecting the user from doing anything stupid". * -- libv */ if (xf86ModeIsReduced(mode)) { if (!monitor->reducedblanking && !(mode->type & M_T_DRIVER)) return MODE_NO_REDUCED; } if ((monitor->maxPixClock) && (mode->Clock > monitor->maxPixClock)) return MODE_CLOCK_HIGH; return MODE_OK; } /* * xf86CheckModeSize * * An internal routine to check if a mode fits in video memory. This tries to * avoid overflows that would otherwise occur when video memory size is greater * than 256MB. */ static Bool xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y) { int bpp = scrp->fbFormat.bitsPerPixel, pad = scrp->fbFormat.scanlinePad; int lineWidth, lastWidth; if (scrp->depth == 4) pad *= 4; /* 4 planes */ /* Sanity check */ if ((w < 0) || (x < 0) || (y <= 0)) return FALSE; lineWidth = (((w * bpp) + pad - 1) / pad) * pad; lastWidth = x * bpp; /* * At this point, we need to compare * * (lineWidth * (y - 1)) + lastWidth * * against * * scrp->videoRam * (1024 * 8) * * These are bit quantities. To avoid overflows, do the comparison in * terms of BITMAP_SCANLINE_PAD units. This assumes BITMAP_SCANLINE_PAD * is a power of 2. We currently use 32, which limits us to a video * memory size of 8GB. */ lineWidth = (lineWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD; lastWidth = (lastWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD; if ((lineWidth * (y - 1) + lastWidth) > (scrp->videoRam * ((1024 * 8) / BITMAP_SCANLINE_PAD))) return FALSE; return TRUE; } /* * xf86InitialCheckModeForDriver * * This function checks if a mode satisfies a driver's initial requirements: * - mode size fits within the available pixel area (memory) * - width lies within the range of supported line pitches * - mode size fits within virtual size (if fixed) * - horizontal timings are in range * * This function takes the following parameters: * scrp ScrnInfoPtr * mode mode to check * maxPitch (optional) maximum line pitch * virtualX (optional) virtual width requested * virtualY (optional) virtual height requested * * In addition, the following fields from the ScrnInfoRec are used: * monitor pointer to structure for monitor section * fbFormat pixel format for the framebuffer * videoRam video memory size (in kB) */ static ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, ClockRangePtr clockRanges, LookupModeFlags strategy, int maxPitch, int virtualX, int virtualY) { ClockRangePtr cp; ModeStatus status; Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0; int i, needDiv2; /* Sanity checks */ if (!scrp || !mode || !clockRanges) { ErrorF("xf86InitialCheckModeForDriver: " "called with invalid parameters\n"); return MODE_ERROR; } DebugF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n", scrp, mode, mode->name, clockRanges, strategy, maxPitch, virtualX, virtualY); /* Some basic mode validity checks */ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart || mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal) return MODE_H_ILLEGAL; if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart || mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal) return MODE_V_ILLEGAL; if (!xf86CheckModeSize(scrp, mode->HDisplay, mode->HDisplay, mode->VDisplay)) return MODE_MEM; if (maxPitch > 0 && mode->HDisplay > maxPitch) return MODE_BAD_WIDTH; if (virtualX > 0 && mode->HDisplay > virtualX) return MODE_VIRTUAL_X; if (virtualY > 0 && mode->VDisplay > virtualY) return MODE_VIRTUAL_Y; /* * The use of the DisplayModeRec's Crtc* and SynthClock elements below is * provisional, in that they are later reused by the driver at mode-set * time. Here, they are temporarily enlisted to contain the mode timings * as seen by the CRT or panel (rather than the CRTC). The driver's * ValidMode() is allowed to modify these so it can deal with such things * as mode stretching and/or centering. The driver should >NOT< modify the * user-supplied values as these are reported back when mode validation is * said and done. */ /* * NOTE: We (ab)use the mode->Crtc* values here to store timing * information for the calculation of Hsync and Vrefresh. Before * these values are calculated the driver is given the opportunity * to either set these HSync and VRefresh itself or modify the timing * values. * The difference to the final calculation is small but imortand: * here we pass the flag INTERLACE_HALVE_V regardless if the driver * sets it or not. This way our calculation of VRefresh has the same * effect as if we do if (flags & V_INTERLACE) refresh *= 2.0 * This dual use of the mode->Crtc* values will certainly create * confusion and is bad software design. However since it's part of * the driver API it's hard to change. */ if (scrp->ValidMode) { xf86SetModeCrtc(mode, INTERLACE_HALVE_V); cp = xf86FindClockRangeForMode(clockRanges, mode); if (!cp) return MODE_CLOCK_RANGE; if (cp->ClockMulFactor < 1) cp->ClockMulFactor = 1; if (cp->ClockDivFactor < 1) cp->ClockDivFactor = 1; /* * XXX The effect of clock dividers and multipliers on the monitor's * pixel clock needs to be verified. */ if (scrp->progClock) { mode->SynthClock = mode->Clock; } else { i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2, cp->ClockDivFactor, cp->ClockMulFactor, &needDiv2); mode->SynthClock = (scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor; if (needDiv2 & V_CLKDIV2) mode->SynthClock /= 2; } status = (*scrp->ValidMode) (scrp, mode, FALSE, MODECHECK_INITIAL); if (status != MODE_OK) return status; if (mode->HSync <= 0.0) mode->HSync = (float) mode->SynthClock / (float) mode->CrtcHTotal; if (mode->VRefresh <= 0.0) mode->VRefresh = (mode->SynthClock * 1000.0) / (mode->CrtcHTotal * mode->CrtcVTotal); } mode->HSync = xf86ModeHSync(mode); mode->VRefresh = xf86ModeVRefresh(mode); /* Assume it is OK */ return MODE_OK; } /* * xf86CheckModeForDriver * * This function is for checking modes while the server is running (for * use mainly by the VidMode extension). * * This function checks if a mode satisfies a driver's requirements: * - width lies within the line pitch * - mode size fits within virtual size * - horizontal/vertical timings are in range * * This function takes the following parameters: * scrp ScrnInfoPtr * mode mode to check * flags not (currently) used * * In addition, the following fields from the ScrnInfoRec are used: * virtualX virtual width * virtualY virtual height * clockRanges allowable clock ranges */ ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags) { ClockRangePtr cp; int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1; int extraFlags = 0; int clockIndex = -1; int MulFactor = 1; int DivFactor = 1; int ModePrivFlags = 0; ModeStatus status = MODE_NOMODE; /* Some sanity checking */ if (scrp == NULL || (!scrp->progClock && scrp->numClocks == 0)) { ErrorF("xf86CheckModeForDriver: called with invalid scrnInfoRec\n"); return MODE_ERROR; } if (mode == NULL) { ErrorF("xf86CheckModeForDriver: called with invalid modep\n"); return MODE_ERROR; } /* Check the mode size */ if (mode->HDisplay > scrp->virtualX) return MODE_VIRTUAL_X; if (mode->VDisplay > scrp->virtualY) return MODE_VIRTUAL_Y; for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) { /* DivFactor and MulFactor must be > 0 */ cp->ClockDivFactor = max(1, cp->ClockDivFactor); cp->ClockMulFactor = max(1, cp->ClockMulFactor); } if (scrp->progClock) { /* Check clock is in range */ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) { if (modeInClockRange(cp, mode)) break; } if (cp == NULL) { return MODE_CLOCK_RANGE; } /* * If programmable clock the required mode has been found */ DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; } else { status = MODE_CLOCK_RANGE; /* Check clock is in range */ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) { if (modeInClockRange(cp, mode)) { /* * Clock is in range, so if it is not a programmable clock, * find a matching clock. */ i = xf86GetNearestClock(scrp, mode->Clock, 0, cp->ClockDivFactor, cp->ClockMulFactor, &k); /* * If the clock is too far from the requested clock, this * mode is no good. */ if (k & V_CLKDIV2) gap = abs((mode->Clock * 2) - ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor)); else gap = abs(mode->Clock - ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor)); if (gap > minimumGap) { status = MODE_NOCLOCK; continue; } DivFactor = cp->ClockDivFactor; MulFactor = cp->ClockMulFactor; ModePrivFlags = cp->PrivFlags; extraFlags = k; clockIndex = i; break; } } if (cp == NULL) return status; } /* Fill in the mode parameters */ if (scrp->progClock) { mode->ClockIndex = -1; mode->SynthClock = (mode->Clock * MulFactor) / DivFactor; } else { mode->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor; mode->ClockIndex = clockIndex; mode->SynthClock = scrp->clock[clockIndex]; if (extraFlags & V_CLKDIV2) { mode->Clock /= 2; mode->SynthClock /= 2; } } mode->PrivFlags = ModePrivFlags; return MODE_OK; } static int inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy) { float aspect = 0.0; MonPtr mon = scrp->monitor; xf86MonPtr DDC; int x = 0, y = 0; DisplayModePtr mode; if (!mon) return 0; DDC = mon->DDC; if (DDC && DDC->ver.revision >= 4) { /* For 1.4, we might actually get native pixel format. How novel. */ if (PREFERRED_TIMING_MODE(DDC->features.msc)) { for (mode = modes; mode; mode = mode->next) { if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) { x = mode->HDisplay; y = mode->VDisplay; goto found; } } } /* * Even if we don't, we might get aspect ratio from extra CVT info * or from the monitor size fields. TODO. */ } /* * Technically this triggers if either is zero. That wasn't legal * before EDID 1.4, but right now we'll get that wrong. TODO. */ if (!aspect) { if (!mon->widthmm || !mon->heightmm) aspect = 4.0 / 3.0; else aspect = (float) mon->widthmm / (float) mon->heightmm; } /* find the largest M_T_DRIVER mode with that aspect ratio */ for (mode = modes; mode; mode = mode->next) { float mode_aspect, metaspect; if (!(mode->type & (M_T_DRIVER | M_T_USERDEF))) continue; mode_aspect = (float) mode->HDisplay / (float) mode->VDisplay; metaspect = aspect / mode_aspect; /* 5% slop or so, since we only get size in centimeters */ if (fabs(1.0 - metaspect) < 0.05) { if ((mode->HDisplay > x) && (mode->VDisplay > y)) { x = mode->HDisplay; y = mode->VDisplay; } } } if (!x || !y) { xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Unable to estimate virtual size\n"); return 0; } found: *vx = x; *vy = y; xf86DrvMsg(scrp->scrnIndex, X_INFO, "Estimated virtual size for aspect ratio %.4f is %dx%d\n", aspect, *vx, *vy); return 1; } /* Least common multiple */ static unsigned int LCM(unsigned int x, unsigned int y) { unsigned int m = x, n = y, o; while ((o = m % n)) { m = n; n = o; } return (x / n) * y; } /* * Given various screen attributes, determine the minimum scanline width such * that each scanline is server and DDX padded and any pixels with imbedded * bank boundaries are off-screen. This function returns -1 if such a width * cannot exist. */ static int scanLineWidth(unsigned int xsize, /* pixels */ unsigned int ysize, /* pixels */ unsigned int width, /* pixels */ unsigned long BankSize, /* char's */ PixmapFormatRec * pBankFormat, unsigned int nWidthUnit /* bits */ ) { unsigned long nBitsPerBank, nBitsPerScanline, nBitsPerScanlinePadUnit; unsigned long minBitsPerScanline, maxBitsPerScanline; /* Sanity checks */ if (!nWidthUnit || !pBankFormat) return -1; nBitsPerBank = BankSize * 8; if (nBitsPerBank % pBankFormat->scanlinePad) return -1; if (xsize > width) width = xsize; nBitsPerScanlinePadUnit = LCM(pBankFormat->scanlinePad, nWidthUnit); nBitsPerScanline = (((width * pBankFormat->bitsPerPixel) + nBitsPerScanlinePadUnit - 1) / nBitsPerScanlinePadUnit) * nBitsPerScanlinePadUnit; width = nBitsPerScanline / pBankFormat->bitsPerPixel; if (!xsize || !(nBitsPerBank % pBankFormat->bitsPerPixel)) return (int) width; /* * Scanlines will be server-pad aligned at this point. They will also be * a multiple of nWidthUnit bits long. Ensure that pixels with imbedded * bank boundaries are off-screen. * * It seems reasonable to limit total frame buffer size to 1/16 of the * theoretical maximum address space size. On a machine with 32-bit * addresses (to 8-bit quantities) this turns out to be 256MB. Not only * does this provide a simple limiting condition for the loops below, but * it also prevents unsigned long wraparounds. */ if (!ysize) return -1; minBitsPerScanline = xsize * pBankFormat->bitsPerPixel; if (minBitsPerScanline > nBitsPerBank) return -1; if (ysize == 1) return (int) width; maxBitsPerScanline = (((unsigned long) (-1) >> 1) - minBitsPerScanline) / (ysize - 1); while (nBitsPerScanline <= maxBitsPerScanline) { unsigned long BankBase, BankUnit; BankUnit = ((nBitsPerBank + nBitsPerScanline - 1) / nBitsPerBank) * nBitsPerBank; if (!(BankUnit % nBitsPerScanline)) return (int) width; for (BankBase = BankUnit;; BankBase += nBitsPerBank) { unsigned long x, y; y = BankBase / nBitsPerScanline; if (y >= ysize) return (int) width; x = BankBase % nBitsPerScanline; if (!(x % pBankFormat->bitsPerPixel)) continue; if (x < minBitsPerScanline) { /* * Skip ahead certain widths by dividing the excess scanline * amongst the y's. */ y *= nBitsPerScanlinePadUnit; nBitsPerScanline += ((x + y - 1) / y) * nBitsPerScanlinePadUnit; width = nBitsPerScanline / pBankFormat->bitsPerPixel; break; } if (BankBase != BankUnit) continue; if (!(nBitsPerScanline % x)) return (int) width; BankBase = ((nBitsPerScanline - minBitsPerScanline) / (nBitsPerScanline - x)) * BankUnit; } } return -1; } /* * xf86ValidateModes * * This function takes a set of mode names, modes and limiting conditions, * and selects a set of modes and parameters based on those conditions. * * This function takes the following parameters: * scrp ScrnInfoPtr * availModes the list of modes available for the monitor * modeNames (optional) list of mode names that the screen is requesting * clockRanges a list of clock ranges * linePitches (optional) a list of line pitches * minPitch (optional) minimum line pitch (in pixels) * maxPitch (optional) maximum line pitch (in pixels) * pitchInc (mandatory) pitch increment (in bits) * minHeight (optional) minimum virtual height (in pixels) * maxHeight (optional) maximum virtual height (in pixels) * virtualX (optional) virtual width requested (in pixels) * virtualY (optional) virtual height requested (in pixels) * apertureSize size of video aperture (in bytes) * strategy how to decide which mode to use from multiple modes with * the same name * * In addition, the following fields from the ScrnInfoRec are used: * clocks a list of discrete clocks * numClocks number of discrete clocks * progClock clock is programmable * monitor pointer to structure for monitor section * fbFormat format of the framebuffer * videoRam video memory size * xInc horizontal timing increment (defaults to 8 pixels) * * The function fills in the following ScrnInfoRec fields: * modePool A subset of the modes available to the monitor which * are compatible with the driver. * modes one mode entry for each of the requested modes, with the * status field filled in to indicate if the mode has been * accepted or not. * virtualX the resulting virtual width * virtualY the resulting virtual height * displayWidth the resulting line pitch * * The function's return value is the number of matching modes found, or -1 * if an unrecoverable error was encountered. */ int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, int maxHeight, int virtualX, int virtualY, int apertureSize, LookupModeFlags strategy) { DisplayModePtr p, q, r, new, last, *endp; int i, numModes = 0; ModeStatus status; int linePitch = -1, virtX = 0, virtY = 0; int newLinePitch, newVirtX, newVirtY; int modeSize; /* in pixels */ Bool validateAllDefaultModes = FALSE; Bool userModes = FALSE; int saveType; PixmapFormatRec *BankFormat; ClockRangePtr cp; int numTimings = 0; range hsync[MAX_HSYNC]; range vrefresh[MAX_VREFRESH]; Bool inferred_virtual = FALSE; DebugF ("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n", scrp, availModes, modeNames, clockRanges, linePitches, minPitch, maxPitch, pitchInc, minHeight, maxHeight, virtualX, virtualY, apertureSize, strategy); /* Some sanity checking */ if (scrp == NULL || scrp->name == NULL || !scrp->monitor || (!scrp->progClock && scrp->numClocks == 0)) { ErrorF("xf86ValidateModes: called with invalid scrnInfoRec\n"); return -1; } if (linePitches != NULL && linePitches[0] <= 0) { ErrorF("xf86ValidateModes: called with invalid linePitches\n"); return -1; } if (pitchInc <= 0) { ErrorF("xf86ValidateModes: called with invalid pitchInc\n"); return -1; } if ((virtualX > 0) != (virtualY > 0)) { ErrorF("xf86ValidateModes: called with invalid virtual resolution\n"); return -1; } /* * If requested by the driver, allow missing hsync and/or vrefresh ranges * in the monitor section. */ if (strategy & LOOKUP_OPTIONAL_TOLERANCES) { strategy &= ~LOOKUP_OPTIONAL_TOLERANCES; } else { const char *type = ""; Bool specified = FALSE; if (scrp->monitor->nHsync <= 0) { if (numTimings > 0) { scrp->monitor->nHsync = numTimings; for (i = 0; i < numTimings; i++) { scrp->monitor->hsync[i].lo = hsync[i].lo; scrp->monitor->hsync[i].hi = hsync[i].hi; } } else { scrp->monitor->hsync[0].lo = 31.5; scrp->monitor->hsync[0].hi = 48.0; scrp->monitor->nHsync = 1; } type = "default "; } else { specified = TRUE; } for (i = 0; i < scrp->monitor->nHsync; i++) { if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi) xf86DrvMsg(scrp->scrnIndex, X_INFO, "%s: Using %shsync value of %.2f kHz\n", scrp->monitor->id, type, scrp->monitor->hsync[i].lo); else xf86DrvMsg(scrp->scrnIndex, X_INFO, "%s: Using %shsync range of %.2f-%.2f kHz\n", scrp->monitor->id, type, scrp->monitor->hsync[i].lo, scrp->monitor->hsync[i].hi); } type = ""; if (scrp->monitor->nVrefresh <= 0) { if (numTimings > 0) { scrp->monitor->nVrefresh = numTimings; for (i = 0; i < numTimings; i++) { scrp->monitor->vrefresh[i].lo = vrefresh[i].lo; scrp->monitor->vrefresh[i].hi = vrefresh[i].hi; } } else { scrp->monitor->vrefresh[0].lo = 50; scrp->monitor->vrefresh[0].hi = 70; scrp->monitor->nVrefresh = 1; } type = "default "; } else { specified = TRUE; } for (i = 0; i < scrp->monitor->nVrefresh; i++) { if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi) xf86DrvMsg(scrp->scrnIndex, X_INFO, "%s: Using %svrefresh value of %.2f Hz\n", scrp->monitor->id, type, scrp->monitor->vrefresh[i].lo); else xf86DrvMsg(scrp->scrnIndex, X_INFO, "%s: Using %svrefresh range of %.2f-%.2f Hz\n", scrp->monitor->id, type, scrp->monitor->vrefresh[i].lo, scrp->monitor->vrefresh[i].hi); } type = ""; if (!scrp->monitor->maxPixClock && !specified) { type = "default "; scrp->monitor->maxPixClock = 65000.0; } if (scrp->monitor->maxPixClock) { xf86DrvMsg(scrp->scrnIndex, X_INFO, "%s: Using %smaximum pixel clock of %.2f MHz\n", scrp->monitor->id, type, (float) scrp->monitor->maxPixClock / 1000.0); } } /* * Store the clockRanges for later use by the VidMode extension. */ nt_list_for_each_entry(cp, clockRanges, next) { ClockRangePtr newCR = xnfalloc(sizeof(ClockRange)); memcpy(newCR, cp, sizeof(ClockRange)); newCR->next = NULL; if (scrp->clockRanges == NULL) scrp->clockRanges = newCR; else nt_list_append(newCR, scrp->clockRanges, ClockRange, next); } /* Determine which pixmap format to pass to scanLineWidth() */ if (scrp->depth > 4) BankFormat = &scrp->fbFormat; else BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */ if (scrp->xInc <= 0) scrp->xInc = 8; /* Suitable for VGA and others */ #define _VIRTUALX(x) ((((x) + scrp->xInc - 1) / scrp->xInc) * scrp->xInc) /* * Determine maxPitch if it wasn't given explicitly. Note linePitches * always takes precedence if is non-NULL. In that case the minPitch and * maxPitch values passed are ignored. */ if (linePitches) { minPitch = maxPitch = linePitches[0]; for (i = 1; linePitches[i] > 0; i++) { if (linePitches[i] > maxPitch) maxPitch = linePitches[i]; if (linePitches[i] < minPitch) minPitch = linePitches[i]; } } /* * Initialise virtX and virtY if the values are fixed. */ if (virtualY > 0) { if (maxHeight > 0 && virtualY > maxHeight) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Virtual height (%d) is too large for the hardware " "(max %d)\n", virtualY, maxHeight); return -1; } if (minHeight > 0 && virtualY < minHeight) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Virtual height (%d) is too small for the hardware " "(min %d)\n", virtualY, minHeight); return -1; } virtualX = _VIRTUALX(virtualX); if (linePitches != NULL) { for (i = 0; linePitches[i] != 0; i++) { if ((linePitches[i] >= virtualX) && (linePitches[i] == scanLineWidth(virtualX, virtualY, linePitches[i], apertureSize, BankFormat, pitchInc))) { linePitch = linePitches[i]; break; } } } else { linePitch = scanLineWidth(virtualX, virtualY, minPitch, apertureSize, BankFormat, pitchInc); } if ((linePitch < minPitch) || (linePitch > maxPitch)) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Virtual width (%d) is too large for the hardware " "(max %d)\n", virtualX, maxPitch); return -1; } if (!xf86CheckModeSize(scrp, linePitch, virtualX, virtualY)) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Virtual size (%dx%d) (pitch %d) exceeds video memory\n", virtualX, virtualY, linePitch); return -1; } virtX = virtualX; virtY = virtualY; } else if (!modeNames || !*modeNames) { /* No virtual size given in the config, try to infer */ /* XXX this doesn't take m{in,ax}Pitch into account; oh well */ inferred_virtual = inferVirtualSize(scrp, availModes, &virtX, &virtY); if (inferred_virtual) linePitch = scanLineWidth(virtX, virtY, minPitch, apertureSize, BankFormat, pitchInc); } /* Print clock ranges and scaled clocks */ xf86ShowClockRanges(scrp, clockRanges); /* * If scrp->modePool hasn't been setup yet, set it up now. This allows the * modes that the driver definitely can't use to be weeded out early. Note * that a modePool mode's prev field is used to hold a pointer to the * member of the scrp->modes list for which a match was considered. */ if (scrp->modePool == NULL) { q = NULL; for (p = availModes; p != NULL; p = p->next) { status = xf86InitialCheckModeForDriver(scrp, p, clockRanges, strategy, maxPitch, virtX, virtY); if (status == MODE_OK) { status = xf86CheckModeForMonitor(p, scrp->monitor); } if (status == MODE_OK) { new = xnfalloc(sizeof(DisplayModeRec)); *new = *p; new->next = NULL; if (!q) { scrp->modePool = new; } else { q->next = new; } new->prev = NULL; q = new; q->name = xnfstrdup(p->name); q->status = MODE_OK; } else { printModeRejectMessage(scrp->scrnIndex, p, status); } } if (scrp->modePool == NULL) { xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Mode pool is empty\n"); return 0; } } else { for (p = scrp->modePool; p != NULL; p = p->next) { p->prev = NULL; p->status = MODE_OK; } } /* * Allocate one entry in scrp->modes for each named mode. */ while (scrp->modes) xf86DeleteMode(&scrp->modes, scrp->modes); endp = &scrp->modes; last = NULL; if (modeNames != NULL) { for (i = 0; modeNames[i] != NULL; i++) { userModes = TRUE; new = xnfcalloc(1, sizeof(DisplayModeRec)); new->prev = last; new->type = M_T_USERDEF; new->name = xnfstrdup(modeNames[i]); if (new->prev) new->prev->next = new; *endp = last = new; endp = &new->next; } } /* Lookup each mode */ #ifdef PANORAMIX if (noPanoramiXExtension) validateAllDefaultModes = TRUE; #endif for (p = scrp->modes;; p = p->next) { Bool repeat; /* * If the supplied mode names don't produce a valid mode, scan through * unconsidered modePool members until one survives validation. This * is done in decreasing order by mode pixel area. */ if (p == NULL) { if ((numModes > 0) && !validateAllDefaultModes) break; validateAllDefaultModes = TRUE; r = NULL; modeSize = 0; for (q = scrp->modePool; q != NULL; q = q->next) { if ((q->prev == NULL) && (q->status == MODE_OK)) { /* * Deal with the case where this mode wasn't considered * because of a builtin mode of the same name. */ for (p = scrp->modes; p != NULL; p = p->next) { if ((p->status != MODE_OK) && !strcmp(p->name, q->name)) break; } if (p != NULL) q->prev = p; else { /* * A quick check to not allow default modes with * horizontal timing parameters that CRTs may have * problems with. */ if (!scrp->monitor->reducedblanking && (q->type & M_T_DEFAULT) && ((double) q->HTotal / (double) q->HDisplay) < 1.15) continue; if (modeSize < (q->HDisplay * q->VDisplay)) { r = q; modeSize = q->HDisplay * q->VDisplay; } } } } if (r == NULL) break; p = xnfcalloc(1, sizeof(DisplayModeRec)); p->prev = last; p->name = xnfstrdup(r->name); if (!userModes) p->type = M_T_USERDEF; if (p->prev) p->prev->next = p; *endp = last = p; endp = &p->next; } repeat = FALSE; lookupNext: if (repeat && ((status = p->status) != MODE_OK)) printModeRejectMessage(scrp->scrnIndex, p, status); saveType = p->type; status = xf86LookupMode(scrp, p, clockRanges, strategy); if (repeat && status == MODE_NOMODE) continue; if (status != MODE_OK) printModeRejectMessage(scrp->scrnIndex, p, status); if (status == MODE_ERROR) { ErrorF("xf86ValidateModes: " "unexpected result from xf86LookupMode()\n"); return -1; } if (status != MODE_OK) { if (p->status == MODE_OK) p->status = status; continue; } p->type |= saveType; repeat = TRUE; newLinePitch = linePitch; newVirtX = virtX; newVirtY = virtY; /* * Don't let non-user defined modes increase the virtual size */ if (!(p->type & M_T_USERDEF) && (numModes > 0)) { if (p->HDisplay > virtX) { p->status = MODE_VIRTUAL_X; goto lookupNext; } if (p->VDisplay > virtY) { p->status = MODE_VIRTUAL_Y; goto lookupNext; } } /* * Adjust virtual width and height if the mode is too large for the * current values and if they are not fixed. */ if (virtualX <= 0 && p->HDisplay > newVirtX) newVirtX = _VIRTUALX(p->HDisplay); if (virtualY <= 0 && p->VDisplay > newVirtY) { if (maxHeight > 0 && p->VDisplay > maxHeight) { p->status = MODE_VIRTUAL_Y; /* ? */ goto lookupNext; } newVirtY = p->VDisplay; } /* * If virtual resolution is to be increased, revalidate it. */ if ((virtX != newVirtX) || (virtY != newVirtY)) { if (linePitches != NULL) { newLinePitch = -1; for (i = 0; linePitches[i] != 0; i++) { if ((linePitches[i] >= newVirtX) && (linePitches[i] >= linePitch) && (linePitches[i] == scanLineWidth(newVirtX, newVirtY, linePitches[i], apertureSize, BankFormat, pitchInc))) { newLinePitch = linePitches[i]; break; } } } else { if (linePitch < minPitch) linePitch = minPitch; newLinePitch = scanLineWidth(newVirtX, newVirtY, linePitch, apertureSize, BankFormat, pitchInc); } if ((newLinePitch < minPitch) || (newLinePitch > maxPitch)) { p->status = MODE_BAD_WIDTH; goto lookupNext; } /* * Check that the pixel area required by the new virtual height * and line pitch isn't too large. */ if (!xf86CheckModeSize(scrp, newLinePitch, newVirtX, newVirtY)) { p->status = MODE_MEM_VIRT; goto lookupNext; } } if (scrp->ValidMode) { /* * Give the driver a final say, passing it the proposed virtual * geometry. */ scrp->virtualX = newVirtX; scrp->virtualY = newVirtY; scrp->displayWidth = newLinePitch; p->status = (scrp->ValidMode) (scrp, p, FALSE, MODECHECK_FINAL); if (p->status != MODE_OK) { goto lookupNext; } } /* Mode has passed all the tests */ virtX = newVirtX; virtY = newVirtY; linePitch = newLinePitch; p->status = MODE_OK; numModes++; } /* * If we estimated the virtual size above, we may have filtered away all * the modes that maximally match that size; scan again to find out and * fix up if so. */ if (inferred_virtual) { int vx = 0, vy = 0; for (p = scrp->modes; p; p = p->next) { if (p->HDisplay > vx && p->VDisplay > vy) { vx = p->HDisplay; vy = p->VDisplay; } } if (vx < virtX || vy < virtY) { const int types[] = { M_T_BUILTIN | M_T_PREFERRED, M_T_BUILTIN, M_T_DRIVER | M_T_PREFERRED, M_T_DRIVER, 0 }; const int ntypes = ARRAY_SIZE(types); int n; /* * We did not find the estimated virtual size. So now we want to * find the largest mode available, but we want to search in the * modes in the order of "types" listed above. */ for (n = 0; n < ntypes; n++) { int type = types[n]; vx = 0; vy = 0; for (p = scrp->modes; p; p = p->next) { /* scan through the modes in the sort order above */ if ((p->type & type) != type) continue; if (p->HDisplay > vx && p->VDisplay > vy) { vx = p->HDisplay; vy = p->VDisplay; } } if (vx && vy) /* Found one */ break; } xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Shrinking virtual size estimate from %dx%d to %dx%d\n", virtX, virtY, vx, vy); virtX = _VIRTUALX(vx); virtY = vy; for (p = scrp->modes; p; p = p->next) { if (numModes > 0) { if (p->HDisplay > virtX) p->status = MODE_VIRTUAL_X; if (p->VDisplay > virtY) p->status = MODE_VIRTUAL_Y; if (p->status != MODE_OK) { numModes--; printModeRejectMessage(scrp->scrnIndex, p, p->status); } } } if (linePitches != NULL) { for (i = 0; linePitches[i] != 0; i++) { if ((linePitches[i] >= virtX) && (linePitches[i] == scanLineWidth(virtX, virtY, linePitches[i], apertureSize, BankFormat, pitchInc))) { linePitch = linePitches[i]; break; } } } else { linePitch = scanLineWidth(virtX, virtY, minPitch, apertureSize, BankFormat, pitchInc); } } } /* Update the ScrnInfoRec parameters */ scrp->virtualX = virtX; scrp->virtualY = virtY; scrp->displayWidth = linePitch; if (numModes <= 0) return 0; /* Make the mode list into a circular list by joining up the ends */ p = scrp->modes; while (p->next != NULL) p = p->next; /* p is now the last mode on the list */ p->next = scrp->modes; scrp->modes->prev = p; if (minHeight > 0 && virtY < minHeight) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Virtual height (%d) is too small for the hardware " "(min %d)\n", virtY, minHeight); return -1; } return numModes; } /* * xf86DeleteMode * * This function removes a mode from a list of modes. * * There are different types of mode lists: * * - singly linked linear lists, ending in NULL * - doubly linked linear lists, starting and ending in NULL * - doubly linked circular lists * */ void xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode) { /* Catch the easy/insane cases */ if (modeList == NULL || *modeList == NULL || mode == NULL) return; /* If the mode is at the start of the list, move the start of the list */ if (*modeList == mode) *modeList = mode->next; /* If mode is the only one on the list, set the list to NULL */ if ((mode == mode->prev) && (mode == mode->next)) { *modeList = NULL; } else { if ((mode->prev != NULL) && (mode->prev->next == mode)) mode->prev->next = mode->next; if ((mode->next != NULL) && (mode->next->prev == mode)) mode->next->prev = mode->prev; } free((void *) mode->name); free(mode); } /* * xf86PruneDriverModes * * Remove modes from the driver's mode list which have been marked as * invalid. */ void xf86PruneDriverModes(ScrnInfoPtr scrp) { DisplayModePtr first, p, n; p = scrp->modes; if (p == NULL) return; do { if (!(first = scrp->modes)) return; n = p->next; if (p->status != MODE_OK) { xf86DeleteMode(&(scrp->modes), p); } p = n; } while (p != NULL && p != first); /* modePool is no longer needed, turf it */ while (scrp->modePool) { /* * A modePool mode's prev field is used to hold a pointer to the * member of the scrp->modes list for which a match was considered. * Clear that pointer first, otherwise xf86DeleteMode might get * confused */ scrp->modePool->prev = NULL; xf86DeleteMode(&scrp->modePool, scrp->modePool); } } /* * xf86SetCrtcForModes * * Goes through the screen's mode list, and initialises the Crtc * parameters for each mode. The initialisation includes adjustments * for interlaced and double scan modes. */ void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags) { DisplayModePtr p; /* * Store adjustFlags for use with the VidMode extension. There is an * implicit assumption here that SetCrtcForModes is called once. */ scrp->adjustFlags = adjustFlags; p = scrp->modes; if (p == NULL) return; do { xf86SetModeCrtc(p, adjustFlags); DebugF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n", (p->type & M_T_DEFAULT) ? "Default " : "", p->name, p->CrtcHDisplay, p->CrtcHBlankStart, p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd, p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart, p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd, p->CrtcVTotal); p = p->next; } while (p != NULL && p != scrp->modes); } void xf86PrintModes(ScrnInfoPtr scrp) { DisplayModePtr p; float hsync, refresh = 0; const char *desc, *desc2, *prefix, *uprefix; if (scrp == NULL) return; xf86DrvMsg(scrp->scrnIndex, X_INFO, "Virtual size is %dx%d (pitch %d)\n", scrp->virtualX, scrp->virtualY, scrp->displayWidth); p = scrp->modes; if (p == NULL) return; do { desc = desc2 = ""; hsync = xf86ModeHSync(p); refresh = xf86ModeVRefresh(p); if (p->Flags & V_INTERLACE) { desc = " (I)"; } if (p->Flags & V_DBLSCAN) { desc = " (D)"; } if (p->VScan > 1) { desc2 = " (VScan)"; } if (p->type & M_T_BUILTIN) prefix = "Built-in mode"; else if (p->type & M_T_DEFAULT) prefix = "Default mode"; else if (p->type & M_T_DRIVER) prefix = "Driver mode"; else prefix = "Mode"; if (p->type & M_T_USERDEF) uprefix = "*"; else uprefix = " "; if (hsync == 0 || refresh == 0) { if (p->name) xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "%s%s \"%s\"\n", uprefix, prefix, p->name); else xf86DrvMsg(scrp->scrnIndex, X_PROBED, "%s%s %dx%d (unnamed)\n", uprefix, prefix, p->HDisplay, p->VDisplay); } else if (p->Clock == p->SynthClock) { xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "%s%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n", uprefix, prefix, p->name, p->Clock / 1000.0, hsync, refresh, desc, desc2); } else { xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "%s%s \"%s\": %.1f MHz (scaled from %.1f MHz), " "%.1f kHz, %.1f Hz%s%s\n", uprefix, prefix, p->name, p->Clock / 1000.0, p->SynthClock / 1000.0, hsync, refresh, desc, desc2); } if (hsync != 0 && refresh != 0) xf86PrintModeline(scrp->scrnIndex, p); p = p->next; } while (p != NULL && p != scrp->modes); } xorg-server-1.20.8/hw/xfree86/common/xf86Extensions.h0000644000175000017500000000353513640201473017235 00000000000000/* * Copyright © 2011 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifndef XF86EXTENSIONS_H #define XF86EXTENSIONS_H #include "extnsionst.h" #ifdef XF86DRI extern _X_EXPORT Bool noXFree86DRIExtension; extern void XFree86DRIExtensionInit(void); #endif #ifdef DRI2 #include extern _X_EXPORT Bool noDRI2Extension; extern void DRI2ExtensionInit(void); #endif #ifdef XF86VIDMODE #include extern _X_EXPORT Bool noXFree86VidModeExtension; extern void XFree86VidModeExtensionInit(void); #endif #ifdef XFreeXDGA #include extern _X_EXPORT Bool noXFree86DGAExtension; extern void XFree86DGAExtensionInit(void); extern void XFree86DGARegister(void); #endif #endif xorg-server-1.20.8/hw/xfree86/common/xf86Globals.c0000644000175000017500000001474513640201473016461 00000000000000 /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains all the XFree86 global variables. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "windowstr.h" #include "propertyst.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86Parser.h" #include "xf86Xinput.h" #include "xf86InPriv.h" #include "xf86Config.h" /* Globals that video drivers may access */ DevPrivateKeyRec xf86CreateRootWindowKeyRec; DevPrivateKeyRec xf86ScreenKeyRec; ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */ ScrnInfoPtr *xf86GPUScreens = NULL; /* List of ScrnInfos */ int xf86DRMMasterFd = -1; /* Command line argument for DRM master file descriptor */ const unsigned char byte_reversed[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, }; /* Globals that input drivers may access */ InputInfoPtr xf86InputDevs = NULL; /* Globals that video drivers may not access */ xf86InfoRec xf86Info = { .consoleFd = -1, .vtno = -1, .lastEventTime = -1, .vtRequestsPending = FALSE, #ifdef __sun .vtPendingNum = -1, #endif .dontVTSwitch = FALSE, .autoVTSwitch = TRUE, .ShareVTs = FALSE, .dontZap = FALSE, .dontZoom = FALSE, .notrapSignals = FALSE, .currentScreen = NULL, #ifdef CSRG_BASED .consType = -1, #endif .allowMouseOpenFail = FALSE, .vidModeEnabled = TRUE, .vidModeAllowNonLocal = FALSE, .miscModInDevEnabled = TRUE, .miscModInDevAllowNonLocal = FALSE, .pmFlag = TRUE, #if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) .forceInputDevices = FALSE, .autoAddDevices = TRUE, .autoEnableDevices = TRUE, #else .forceInputDevices = TRUE, .autoAddDevices = FALSE, .autoEnableDevices = FALSE, #endif #if defined(CONFIG_UDEV_KMS) .autoAddGPU = TRUE, #else .autoAddGPU = FALSE, #endif }; const char *xf86ConfigFile = NULL; const char *xf86ConfigDir = NULL; const char *xf86ModulePath = DEFAULT_MODULE_PATH; MessageType xf86ModPathFrom = X_DEFAULT; const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX; MessageType xf86LogFileFrom = X_DEFAULT; Bool xf86LogFileWasOpened = FALSE; serverLayoutRec xf86ConfigLayout = { NULL, }; confDRIRec xf86ConfigDRI = { 0, }; XF86ConfigPtr xf86configptr = NULL; Bool xf86Resetting = FALSE; Bool xf86Initialising = FALSE; Bool xf86DoConfigure = FALSE; Bool xf86ProbeIgnorePrimary = FALSE; Bool xf86DoShowOptions = FALSE; DriverPtr *xf86DriverList = NULL; int xf86NumDrivers = 0; InputDriverPtr *xf86InputDriverList = NULL; int xf86NumInputDrivers = 0; int xf86NumScreens = 0; int xf86NumGPUScreens = 0; const char *xf86VisualNames[] = { "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" }; /* Parameters set only from the command line */ const char *xf86ServerName = "no-name"; Bool xf86fpFlag = FALSE; Bool xf86sFlag = FALSE; Bool xf86bsEnableFlag = FALSE; Bool xf86bsDisableFlag = FALSE; Bool xf86silkenMouseDisableFlag = FALSE; Bool xf86xkbdirFlag = FALSE; #ifdef HAVE_ACPI Bool xf86acpiDisableFlag = FALSE; #endif char *xf86LayoutName = NULL; char *xf86ScreenName = NULL; char *xf86PointerName = NULL; char *xf86KeyboardName = NULL; int xf86Verbose = DEFAULT_VERBOSE; int xf86LogVerbose = DEFAULT_LOG_VERBOSE; int xf86FbBpp = -1; int xf86Depth = -1; rgb xf86Weight = { 0, 0, 0 }; Bool xf86FlipPixels = FALSE; Gamma xf86Gamma = { 0.0, 0.0, 0.0 }; Bool xf86AllowMouseOpenFail = FALSE; #ifdef XF86VIDMODE Bool xf86VidModeDisabled = FALSE; Bool xf86VidModeAllowNonLocal = FALSE; #endif Bool xorgHWAccess = FALSE; xorg-server-1.20.8/hw/xfree86/common/xf86noBus.c0000644000175000017500000000406513640201473016156 00000000000000/* * Copyright (c) 2000-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the interfaces to the bus-specific code */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86Bus.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) { EntityPtr p; int num; num = xf86AllocateEntity(); p = xf86Entities[num]; p->driver = drvp; p->chipset = 0; p->bus.type = BUS_NONE; p->active = active; p->inUse = FALSE; xf86AddDevToEntity(num, dev); return num; } xorg-server-1.20.8/hw/xfree86/common/xf86xvmc.h0000644000175000017500000001316213640201473016050 00000000000000 /* * Copyright (c) 2001 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). */ #ifndef _XF86XVMC_H #define _XF86XVMC_H #include "xvmcext.h" #include "xf86xv.h" typedef struct { int num_xvimages; int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */ } XF86MCImageIDList; typedef struct { int surface_type_id; /* Driver generated. Must be unique on the port */ int chroma_format; int color_description; /* no longer used */ unsigned short max_width; unsigned short max_height; unsigned short subpicture_max_width; unsigned short subpicture_max_height; int mc_type; int flags; XF86MCImageIDList *compatible_subpictures; /* can be null, if none */ } XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr; /* xf86XvMCCreateContextProc DIX will fill everything out in the context except the driver_priv. The port_priv holds the private data specified for the port when Xv was initialized by the driver. The driver may store whatever it wants in driver_priv and edit the width, height and flags. If the driver wants to return something to the client it can allocate space in priv and specify the number of 32 bit words in num_priv. This must be dynamically allocated space because DIX will free it after it passes it to the client. */ typedef int (*xf86XvMCCreateContextProcPtr) (ScrnInfoPtr pScrn, XvMCContextPtr context, int *num_priv, CARD32 **priv); typedef void (*xf86XvMCDestroyContextProcPtr) (ScrnInfoPtr pScrn, XvMCContextPtr context); /* xf86XvMCCreateSurfaceProc DIX will fill everything out in the surface except the driver_priv. The driver may store whatever it wants in driver_priv. The driver may pass data back to the client in the same manner as the xf86XvMCCreateContextProc. */ typedef int (*xf86XvMCCreateSurfaceProcPtr) (ScrnInfoPtr pScrn, XvMCSurfacePtr surface, int *num_priv, CARD32 **priv); typedef void (*xf86XvMCDestroySurfaceProcPtr) (ScrnInfoPtr pScrn, XvMCSurfacePtr surface); /* xf86XvMCCreateSubpictureProc DIX will fill everything out in the subpicture except the driver_priv, num_palette_entries, entry_bytes and component_order. The driver may store whatever it wants in driver_priv and edit the width and height. If it is a paletted subpicture the driver needs to fill out the num_palette_entries, entry_bytes and component_order. These are not communicated to the client until the time the surface is created. The driver may pass data back to the client in the same manner as the xf86XvMCCreateContextProc. */ typedef int (*xf86XvMCCreateSubpictureProcPtr) (ScrnInfoPtr pScrn, XvMCSubpicturePtr subpicture, int *num_priv, CARD32 **priv); typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn, XvMCSubpicturePtr subpicture); typedef struct { const char *name; int num_surfaces; XF86MCSurfaceInfoPtr *surfaces; int num_subpictures; XF86ImagePtr *subpictures; xf86XvMCCreateContextProcPtr CreateContext; xf86XvMCDestroyContextProcPtr DestroyContext; xf86XvMCCreateSurfaceProcPtr CreateSurface; xf86XvMCDestroySurfaceProcPtr DestroySurface; xf86XvMCCreateSubpictureProcPtr CreateSubpicture; xf86XvMCDestroySubpictureProcPtr DestroySubpicture; } XF86MCAdaptorRec, *XF86MCAdaptorPtr; /* xf86XvMCScreenInit Unlike Xv, the adaptor data is not copied from this structure. This structure's data is used so it must stick around for the life of the server. Note that it's an array of pointers not an array of structures. */ extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen, int num_adaptors, XF86MCAdaptorPtr * adaptors); extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void); extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor); #endif /* _XF86XVMC_H */ xorg-server-1.20.8/hw/xfree86/common/xf86Extensions.c0000644000175000017500000000731613640201473017231 00000000000000/* * Copyright © 2011 Daniel Stone * * 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. * * Author: Daniel Stone */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "extension.h" #include "extinit.h" #include "globals.h" #include "xf86.h" #include "xf86Config.h" #include "xf86Module.h" #include "xf86Extensions.h" #include "xf86Opt.h" #include "optionstr.h" #ifdef XSELINUX #include "xselinux.h" #endif #ifdef XFreeXDGA #include #endif #ifdef XF86VIDMODE #include #include "vidmodestr.h" #endif /* * DDX-specific extensions. */ static const ExtensionModule extensionModules[] = { #ifdef XF86VIDMODE { XFree86VidModeExtensionInit, XF86VIDMODENAME, &noXFree86VidModeExtension }, #endif #ifdef XFreeXDGA { XFree86DGAExtensionInit, XF86DGANAME, &noXFree86DGAExtension }, #endif #ifdef XF86DRI { XFree86DRIExtensionInit, "XFree86-DRI", &noXFree86DRIExtension }, #endif #ifdef DRI2 { DRI2ExtensionInit, DRI2_NAME, &noDRI2Extension } #endif }; static void load_extension_config(void) { XF86ConfModulePtr mod_con = xf86configptr->conf_modules; XF86LoadPtr modp; /* Only the best. */ if (!mod_con) return; nt_list_for_each_entry(modp, mod_con->mod_load_lst, list.next) { InputOption *opt; if (strcasecmp(modp->load_name, "extmod") != 0) continue; /* extmod options are of the form "omit " */ nt_list_for_each_entry(opt, modp->load_opt, list.next) { const char *key = input_option_get_key(opt); if (strncasecmp(key, "omit", 4) != 0 || strlen(key) < 5) continue; if (EnableDisableExtension(key + 4, FALSE)) xf86MarkOptionUsed(opt); } #ifdef XSELINUX if ((opt = xf86FindOption(modp->load_opt, "SELinux mode disabled"))) { xf86MarkOptionUsed(opt); selinuxEnforcingState = SELINUX_MODE_DISABLED; } if ((opt = xf86FindOption(modp->load_opt, "SELinux mode permissive"))) { xf86MarkOptionUsed(opt); selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; } if ((opt = xf86FindOption(modp->load_opt, "SELinux mode enforcing"))) { xf86MarkOptionUsed(opt); selinuxEnforcingState = SELINUX_MODE_ENFORCING; } #endif } } void xf86ExtensionInit(void) { load_extension_config(); LoadExtensionList(extensionModules, ARRAY_SIZE(extensionModules), TRUE); } xorg-server-1.20.8/hw/xfree86/common/xf86Xinput.c0000644000175000017500000013367313640201473016367 00000000000000/* * Copyright 1995-1999 by Frederic Lepied, France. * * 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 Frederic Lepied not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Frederic Lepied makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL FREDERIC LEPIED 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. * */ /* * Copyright (c) 2000-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include "xf86.h" #include "xf86Priv.h" #include "xf86Config.h" #include "xf86Xinput.h" #include "xf86Optrec.h" #include "mipointer.h" #include "extinit.h" #include "loaderProcs.h" #include "systemd-logind.h" #include "exevents.h" /* AddInputDevice */ #include "exglobals.h" #include "eventstr.h" #include "inpututils.h" #include "optionstr.h" #include /* InputClassMatches */ #ifdef HAVE_FNMATCH_H #include #endif #ifdef HAVE_SYS_UTSNAME_H #include #endif #include #include /* for int64_t */ #include #include #include #ifdef HAVE_SYS_SYSMACROS_H #include #endif #ifdef HAVE_SYS_MKDEV_H #include /* for major() & minor() on Solaris */ #endif #include "mi.h" #include /* dix pointer acceleration */ #include #ifdef XFreeXDGA #include "dgaproc.h" #endif #include "xkbsrv.h" /* Valuator verification macro */ #define XI_VERIFY_VALUATORS(num_valuators) \ if (num_valuators > MAX_VALUATORS) { \ xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \ " MAX_VALUATORS\n", __FUNCTION__, num_valuators); \ return; \ } static int xf86InputDevicePostInit(DeviceIntPtr dev); typedef struct { struct xorg_list node; InputInfoPtr pInfo; } PausedInputDeviceRec; typedef PausedInputDeviceRec *PausedInputDevicePtr; static struct xorg_list new_input_devices_list = { .next = &new_input_devices_list, .prev = &new_input_devices_list, }; /** * Eval config and modify DeviceVelocityRec accordingly */ static void ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list, DeviceVelocityPtr s) { int tempi; float tempf; Atom float_prop = XIGetKnownProperty(XATOM_FLOAT); Atom prop; if (!s) return; /* common settings (available via device properties) */ tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0); if (tempf != 1.0) { xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n", devname, tempf); prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION); XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); } tempf = xf86SetRealOption(list, "AdaptiveDeceleration", 1.0); if (tempf > 1.0) { xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n", devname, tempf); prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION); XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); } /* select profile by number */ tempi = xf86SetIntOption(list, "AccelerationProfile", s->statistics.profile_number); prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER); if (XIChangeDeviceProperty(pDev, prop, XA_INTEGER, 32, PropModeReplace, 1, &tempi, FALSE) == Success) { xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i\n", devname, tempi); } else { xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n", devname, tempi); } /* set scaling */ tempf = xf86SetRealOption(list, "ExpectedRate", 0); prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING); if (tempf > 0) { tempf = 1000.0 / tempf; XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); } else { tempf = xf86SetRealOption(list, "VelocityScale", s->corr_mul); XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); } tempi = xf86SetIntOption(list, "VelocityTrackerCount", -1); if (tempi > 1) InitTrackers(s, tempi); s->initial_range = xf86SetIntOption(list, "VelocityInitialRange", s->initial_range); s->max_diff = xf86SetRealOption(list, "VelocityAbsDiff", s->max_diff); tempf = xf86SetRealOption(list, "VelocityRelDiff", -1); if (tempf >= 0) { xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n", devname, tempf * 100.0); s->max_rel_diff = tempf; } /* Configure softening. If const deceleration is used, this is expected * to provide better subpixel information so we enable * softening by default only if ConstantDeceleration is not used */ s->use_softening = xf86SetBoolOption(list, "Softening", s->const_acceleration == 1.0); s->average_accel = xf86SetBoolOption(list, "AccelerationProfileAveraging", s->average_accel); s->reset_time = xf86SetIntOption(list, "VelocityReset", s->reset_time); } static void ApplyAccelerationSettings(DeviceIntPtr dev) { int scheme, i; DeviceVelocityPtr pVel; InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; char *schemeStr; if (dev->valuator && dev->ptrfeed) { schemeStr = xf86SetStrOption(pInfo->options, "AccelerationScheme", ""); scheme = dev->valuator->accelScheme.number; if (!xf86NameCmp(schemeStr, "predictable")) scheme = PtrAccelPredictable; if (!xf86NameCmp(schemeStr, "lightweight")) scheme = PtrAccelLightweight; if (!xf86NameCmp(schemeStr, "none")) scheme = PtrAccelNoOp; /* reinit scheme if needed */ if (dev->valuator->accelScheme.number != scheme) { if (dev->valuator->accelScheme.AccelCleanupProc) { dev->valuator->accelScheme.AccelCleanupProc(dev); } if (InitPointerAccelerationScheme(dev, scheme)) { xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n", pInfo->name, schemeStr, scheme); } else { xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n", pInfo->name, schemeStr); scheme = dev->valuator->accelScheme.number; } } else { xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n", pInfo->name, scheme); } free(schemeStr); /* process special configuration */ switch (scheme) { case PtrAccelPredictable: pVel = GetDevicePredictableAccelData(dev); ProcessVelocityConfiguration(dev, pInfo->name, pInfo->options, pVel); break; } i = xf86SetIntOption(pInfo->options, "AccelerationNumerator", dev->ptrfeed->ctrl.num); if (i >= 0) dev->ptrfeed->ctrl.num = i; i = xf86SetIntOption(pInfo->options, "AccelerationDenominator", dev->ptrfeed->ctrl.den); if (i > 0) dev->ptrfeed->ctrl.den = i; i = xf86SetIntOption(pInfo->options, "AccelerationThreshold", dev->ptrfeed->ctrl.threshold); if (i >= 0) dev->ptrfeed->ctrl.threshold = i; xf86Msg(X_CONFIG, "%s: (accel) acceleration factor: %.3f\n", pInfo->name, ((float) dev->ptrfeed->ctrl.num) / ((float) dev->ptrfeed->ctrl.den)); xf86Msg(X_CONFIG, "%s: (accel) acceleration threshold: %i\n", pInfo->name, dev->ptrfeed->ctrl.threshold); } } static void ApplyTransformationMatrix(DeviceIntPtr dev) { InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; char *str; int rc; float matrix[9] = { 0 }; if (!dev->valuator) return; str = xf86SetStrOption(pInfo->options, "TransformationMatrix", NULL); if (!str) return; rc = sscanf(str, "%f %f %f %f %f %f %f %f %f", &matrix[0], &matrix[1], &matrix[2], &matrix[3], &matrix[4], &matrix[5], &matrix[6], &matrix[7], &matrix[8]); if (rc != 9) { xf86Msg(X_ERROR, "%s: invalid format for transformation matrix. Ignoring configuration.\n", pInfo->name); return; } XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM), XIGetKnownProperty(XATOM_FLOAT), 32, PropModeReplace, 9, matrix, FALSE); } /*********************************************************************** * * xf86ProcessCommonOptions -- * * Process global options. * *********************************************************************** */ void xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr list) { if (xf86SetBoolOption(list, "Floating", 0) || !xf86SetBoolOption(list, "AlwaysCore", 1) || !xf86SetBoolOption(list, "SendCoreEvents", 1) || !xf86SetBoolOption(list, "CorePointer", 1) || !xf86SetBoolOption(list, "CoreKeyboard", 1)) { xf86Msg(X_CONFIG, "%s: doesn't report core events\n", pInfo->name); } else { pInfo->flags |= XI86_ALWAYS_CORE; xf86Msg(X_CONFIG, "%s: always reports core events\n", pInfo->name); } } /*********************************************************************** * * xf86ActivateDevice -- * * Initialize an input device. * * Returns TRUE on success, or FALSE otherwise. *********************************************************************** */ static DeviceIntPtr xf86ActivateDevice(InputInfoPtr pInfo) { DeviceIntPtr dev; Atom atom; dev = AddInputDevice(serverClient, pInfo->device_control, TRUE); if (dev == NULL) { xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n", pInfo->name); pInfo->dev = NULL; return NULL; } atom = MakeAtom(pInfo->type_name, strlen(pInfo->type_name), TRUE); AssignTypeAndName(dev, atom, pInfo->name); dev->public.devicePrivate = pInfo; pInfo->dev = dev; dev->coreEvents = pInfo->flags & XI86_ALWAYS_CORE; dev->type = SLAVE; dev->spriteInfo->spriteOwner = FALSE; dev->config_info = xf86SetStrOption(pInfo->options, "config_info", NULL); if (serverGeneration == 1) xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s, id %d)\n", pInfo->name, pInfo->type_name, dev->id); return dev; } /**************************************************************************** * * Caller: ProcXSetDeviceMode * * Change the mode of an extension device. * This function is used to change the mode of a device from reporting * relative motion to reporting absolute positional information, and * vice versa. * The default implementation below is that no such devices are supported. * *********************************************************************** */ int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) { InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; if (pInfo->switch_mode) { return (*pInfo->switch_mode) (client, dev, mode); } else return BadMatch; } /*********************************************************************** * * Caller: ProcXSetDeviceValuators * * Set the value of valuators on an extension input device. * This function is used to set the initial value of valuators on * those input devices that are capable of reporting either relative * motion or an absolute position, and allow an initial position to be set. * The default implementation below is that no such devices are supported. * *********************************************************************** */ int SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; if (pInfo->set_device_valuators) return (*pInfo->set_device_valuators) (pInfo, valuators, first_valuator, num_valuators); return BadMatch; } /*********************************************************************** * * Caller: ProcXChangeDeviceControl * * Change the specified device controls on an extension input device. * *********************************************************************** */ int ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate; if (!pInfo->control_proc) { switch (control->control) { case DEVICE_CORE: case DEVICE_ABS_CALIB: case DEVICE_ABS_AREA: return BadMatch; case DEVICE_RESOLUTION: case DEVICE_ENABLE: return Success; default: return BadMatch; } } else { return (*pInfo->control_proc) (pInfo, control); } } /* * Get the operating system name from uname and store it statically to avoid * repeating the system call each time MatchOS is checked. */ static const char * HostOS(void) { #ifdef HAVE_SYS_UTSNAME_H struct utsname name; static char host_os[sizeof(name.sysname)] = ""; if (*host_os == '\0') { if (uname(&name) >= 0) strlcpy(host_os, name.sysname, sizeof(host_os)); else { strlcpy(host_os, "unknown", sizeof(host_os)); } } return host_os; #else return ""; #endif } static int match_substring(const char *attr, const char *pattern) { return (strstr(attr, pattern)) ? 0 : -1; } #ifdef HAVE_FNMATCH_H static int match_pattern(const char *attr, const char *pattern) { return fnmatch(pattern, attr, 0); } #else #define match_pattern match_substring #endif #ifdef HAVE_FNMATCH_H static int match_path_pattern(const char *attr, const char *pattern) { return fnmatch(pattern, attr, FNM_PATHNAME); } #else #define match_path_pattern match_substring #endif /* * If no Layout section is found, xf86ServerLayout.id becomes "(implicit)" * It is convenient that "" in patterns means "no explicit layout" */ static int match_string_implicit(const char *attr, const char *pattern) { if (strlen(pattern)) { return strcmp(attr, pattern); } else { return strcmp(attr, "(implicit)"); } } /* * Match an attribute against a list of NULL terminated arrays of patterns. * If a pattern in each list entry is matched, return TRUE. */ static Bool MatchAttrToken(const char *attr, struct xorg_list *patterns, int (*compare) (const char *attr, const char *pattern)) { const xf86MatchGroup *group; /* If there are no patterns, accept the match */ if (xorg_list_is_empty(patterns)) return TRUE; /* * Iterate the list of patterns ensuring each entry has a * match. Each list entry is a separate Match line of the same type. */ xorg_list_for_each_entry(group, patterns, entry) { char *const *cur; Bool is_negated = group->is_negated; Bool match = is_negated; /* If there's a pattern but no attribute, we reject the match for a * MatchFoo directive, and accept it for a NoMatchFoo directive */ if (!attr) return is_negated; for (cur = group->values; *cur; cur++) if ((*compare) (attr, *cur) == 0) { match = !is_negated; break; } if (!match) return FALSE; } /* All the entries in the list matched the attribute */ return TRUE; } /* * Classes without any Match statements match all devices. Otherwise, all * statements must match. */ static Bool InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev, const InputAttributes * attrs) { /* MatchProduct substring */ if (!MatchAttrToken (attrs->product, &iclass->match_product, match_substring)) return FALSE; /* MatchVendor substring */ if (!MatchAttrToken(attrs->vendor, &iclass->match_vendor, match_substring)) return FALSE; /* MatchDevicePath pattern */ if (!MatchAttrToken (attrs->device, &iclass->match_device, match_path_pattern)) return FALSE; /* MatchOS case-insensitive string */ if (!MatchAttrToken(HostOS(), &iclass->match_os, strcasecmp)) return FALSE; /* MatchPnPID pattern */ if (!MatchAttrToken(attrs->pnp_id, &iclass->match_pnpid, match_pattern)) return FALSE; /* MatchUSBID pattern */ if (!MatchAttrToken(attrs->usb_id, &iclass->match_usbid, match_pattern)) return FALSE; /* MatchDriver string */ if (!MatchAttrToken(idev->driver, &iclass->match_driver, strcmp)) return FALSE; /* * MatchTag string * See if any of the device's tags match any of the MatchTag tokens. */ if (!xorg_list_is_empty(&iclass->match_tag)) { char *const *tag; Bool match; if (!attrs->tags) return FALSE; for (tag = attrs->tags, match = FALSE; *tag; tag++) { if (MatchAttrToken(*tag, &iclass->match_tag, strcmp)) { match = TRUE; break; } } if (!match) return FALSE; } /* MatchLayout string */ if (!xorg_list_is_empty(&iclass->match_layout)) { if (!MatchAttrToken(xf86ConfigLayout.id, &iclass->match_layout, match_string_implicit)) return FALSE; } /* MatchIs* booleans */ if (iclass->is_keyboard.set && iclass->is_keyboard.val != ! !(attrs->flags & (ATTR_KEY|ATTR_KEYBOARD))) return FALSE; if (iclass->is_pointer.set && iclass->is_pointer.val != ! !(attrs->flags & ATTR_POINTER)) return FALSE; if (iclass->is_joystick.set && iclass->is_joystick.val != ! !(attrs->flags & ATTR_JOYSTICK)) return FALSE; if (iclass->is_tablet.set && iclass->is_tablet.val != ! !(attrs->flags & ATTR_TABLET)) return FALSE; if (iclass->is_tablet_pad.set && iclass->is_tablet_pad.val != ! !(attrs->flags & ATTR_TABLET_PAD)) return FALSE; if (iclass->is_touchpad.set && iclass->is_touchpad.val != ! !(attrs->flags & ATTR_TOUCHPAD)) return FALSE; if (iclass->is_touchscreen.set && iclass->is_touchscreen.val != ! !(attrs->flags & ATTR_TOUCHSCREEN)) return FALSE; return TRUE; } /* * Merge in any InputClass configurations. Options in each InputClass * section have more priority than the original device configuration as * well as any previous InputClass sections. */ static int MergeInputClasses(const InputInfoPtr idev, const InputAttributes * attrs) { XF86ConfInputClassPtr cl; XF86OptionPtr classopts; for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) { if (!InputClassMatches(cl, idev, attrs)) continue; /* Collect class options and driver settings */ classopts = xf86optionListDup(cl->option_lst); if (cl->driver) { free((void *) idev->driver); idev->driver = xstrdup(cl->driver); if (!idev->driver) { xf86Msg(X_ERROR, "Failed to allocate memory while merging " "InputClass configuration"); return BadAlloc; } classopts = xf86ReplaceStrOption(classopts, "driver", idev->driver); } /* Apply options to device with InputClass settings preferred. */ xf86Msg(X_CONFIG, "%s: Applying InputClass \"%s\"\n", idev->name, cl->identifier); idev->options = xf86optionListMerge(idev->options, classopts); } return Success; } /* * Iterate the list of classes and look for Option "Ignore". Return the * value of the last matching class and holler when returning TRUE. */ static Bool IgnoreInputClass(const InputInfoPtr idev, const InputAttributes * attrs) { XF86ConfInputClassPtr cl; Bool ignore = FALSE; const char *ignore_class; for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) { if (!InputClassMatches(cl, idev, attrs)) continue; if (xf86findOption(cl->option_lst, "Ignore")) { ignore = xf86CheckBoolOption(cl->option_lst, "Ignore", FALSE); ignore_class = cl->identifier; } } if (ignore) xf86Msg(X_CONFIG, "%s: Ignoring device from InputClass \"%s\"\n", idev->name, ignore_class); return ignore; } InputInfoPtr xf86AllocateInput(void) { InputInfoPtr pInfo; pInfo = calloc(sizeof(*pInfo), 1); if (!pInfo) return NULL; pInfo->fd = -1; pInfo->type_name = "UNKNOWN"; return pInfo; } /* Append InputInfoRec to the tail of xf86InputDevs. */ static void xf86AddInput(InputDriverPtr drv, InputInfoPtr pInfo) { InputInfoPtr *prev = NULL; pInfo->drv = drv; pInfo->module = DuplicateModule(drv->module, NULL); for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next); *prev = pInfo; pInfo->next = NULL; xf86CollectInputOptions(pInfo, (const char **) drv->default_options); xf86OptionListReport(pInfo->options); xf86ProcessCommonOptions(pInfo, pInfo->options); } /* * Remove an entry from xf86InputDevs and free all the device's information. */ void xf86DeleteInput(InputInfoPtr pInp, int flags) { /* First check if the inputdev is valid. */ if (pInp == NULL) return; if (pInp->module) UnloadModule(pInp->module); /* This should *really* be handled in drv->UnInit(dev) call instead, but * if the driver forgets about it make sure we free it or at least crash * with flying colors */ free(pInp->private); FreeInputAttributes(pInp->attrs); if (pInp->flags & XI86_SERVER_FD) systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd); /* Remove the entry from the list. */ if (pInp == xf86InputDevs) xf86InputDevs = pInp->next; else { InputInfoPtr p = xf86InputDevs; while (p && p->next != pInp) p = p->next; if (p) p->next = pInp->next; /* Else the entry wasn't in the xf86InputDevs list (ignore this). */ } free((void *) pInp->driver); free((void *) pInp->name); xf86optionListFree(pInp->options); free(pInp); } /* * Apply backend-specific initialization. Invoked after ActivateDevice(), * i.e. after the driver successfully completed DEVICE_INIT and the device * is advertised. * @param dev the device * @return Success or an error code */ static int xf86InputDevicePostInit(DeviceIntPtr dev) { ApplyAccelerationSettings(dev); ApplyTransformationMatrix(dev); return Success; } static void xf86stat(const char *path, int *maj, int *min) { struct stat st; if (stat(path, &st) == -1) return; *maj = major(st.st_rdev); *min = minor(st.st_rdev); } static inline InputDriverPtr xf86LoadInputDriver(const char *driver_name) { InputDriverPtr drv = NULL; /* Memory leak for every attached device if we don't * test if the module is already loaded first */ drv = xf86LookupInputDriver(driver_name); if (!drv) { if (xf86LoadOneModule(driver_name, NULL)) drv = xf86LookupInputDriver(driver_name); } return drv; } /** * Create a new input device, activate and enable it. * * Possible return codes: * BadName .. a bad driver name was supplied. * BadImplementation ... The driver does not have a PreInit function. This * is a driver bug. * BadMatch .. device initialization failed. * BadAlloc .. too many input devices * * @param idev The device, already set up with identifier, driver, and the * options. * @param pdev Pointer to the new device, if Success was reported. * @param enable Enable the device after activating it. * * @return Success or an error code */ _X_INTERNAL int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) { InputDriverPtr drv = NULL; DeviceIntPtr dev = NULL; Bool paused; int rval; char *path = NULL; drv = xf86LoadInputDriver(pInfo->driver); if (!drv) { xf86Msg(X_ERROR, "No input driver matching `%s'\n", pInfo->driver); if (strlen(FALLBACK_INPUT_DRIVER) > 0) { xf86Msg(X_INFO, "Falling back to input driver `%s'\n", FALLBACK_INPUT_DRIVER); drv = xf86LoadInputDriver(FALLBACK_INPUT_DRIVER); if (drv) { free(pInfo->driver); pInfo->driver = strdup(FALLBACK_INPUT_DRIVER); } } if (!drv) { rval = BadName; goto unwind; } } xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName, pInfo->name); if (!drv->PreInit) { xf86Msg(X_ERROR, "Input driver `%s' has no PreInit function (ignoring)\n", drv->driverName); rval = BadImplementation; goto unwind; } path = xf86CheckStrOption(pInfo->options, "Device", NULL); if (path && pInfo->major == 0 && pInfo->minor == 0) xf86stat(path, &pInfo->major, &pInfo->minor); if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){ int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor, path, &paused); if (fd != -1) { if (paused) { /* Put on new_input_devices list for delayed probe */ PausedInputDevicePtr new_device = xnfalloc(sizeof *new_device); new_device->pInfo = pInfo; xorg_list_append(&new_device->node, &new_input_devices_list); systemd_logind_release_fd(pInfo->major, pInfo->minor, fd); free(path); return BadMatch; } pInfo->fd = fd; pInfo->flags |= XI86_SERVER_FD; pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd); } } free(path); xf86AddInput(drv, pInfo); input_lock(); rval = drv->PreInit(drv, pInfo, 0); input_unlock(); if (rval != Success) { xf86Msg(X_ERROR, "PreInit returned %d for \"%s\"\n", rval, pInfo->name); goto unwind; } if (!(dev = xf86ActivateDevice(pInfo))) { rval = BadAlloc; goto unwind; } rval = ActivateDevice(dev, TRUE); if (rval != Success) { xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name); RemoveDevice(dev, TRUE); goto unwind; } rval = xf86InputDevicePostInit(dev); if (rval != Success) { xf86Msg(X_ERROR, "Couldn't post-init device \"%s\"\n", pInfo->name); RemoveDevice(dev, TRUE); goto unwind; } /* Enable it if it's properly initialised and we're currently in the VT */ if (enable && dev->inited && dev->startup && xf86VTOwner()) { input_lock(); EnableDevice(dev, TRUE); if (!dev->enabled) { xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name); RemoveDevice(dev, TRUE); rval = BadMatch; input_unlock(); goto unwind; } /* send enter/leave event, update sprite window */ CheckMotion(NULL, dev); input_unlock(); } *pdev = dev; return Success; unwind: if (pInfo) { if (drv && drv->UnInit) drv->UnInit(drv, pInfo, 0); else xf86DeleteInput(pInfo, 0); } return rval; } int NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, DeviceIntPtr *pdev) { InputInfoPtr pInfo = NULL; InputOption *option = NULL; int rval = Success; int is_auto = 0; pInfo = xf86AllocateInput(); if (!pInfo) return BadAlloc; nt_list_for_each_entry(option, options, list.next) { const char *key = input_option_get_key(option); const char *value = input_option_get_value(option); if (strcasecmp(key, "driver") == 0) { if (pInfo->driver) { rval = BadRequest; goto unwind; } pInfo->driver = xstrdup(value); if (!pInfo->driver) { rval = BadAlloc; goto unwind; } } if (strcasecmp(key, "name") == 0 || strcasecmp(key, "identifier") == 0) { if (pInfo->name) { rval = BadRequest; goto unwind; } pInfo->name = xstrdup(value); if (!pInfo->name) { rval = BadAlloc; goto unwind; } } if (strcmp(key, "_source") == 0 && (strcmp(value, "server/hal") == 0 || strcmp(value, "server/udev") == 0 || strcmp(value, "server/wscons") == 0)) { is_auto = 1; if (!xf86Info.autoAddDevices) { rval = BadMatch; goto unwind; } } if (strcmp(key, "major") == 0) pInfo->major = atoi(value); if (strcmp(key, "minor") == 0) pInfo->minor = atoi(value); } nt_list_for_each_entry(option, options, list.next) { /* Copy option key/value strings from the provided list */ pInfo->options = xf86AddNewOption(pInfo->options, input_option_get_key(option), input_option_get_value(option)); } /* Apply InputClass settings */ if (attrs) { if (IgnoreInputClass(pInfo, attrs)) { rval = BadIDChoice; goto unwind; } rval = MergeInputClasses(pInfo, attrs); if (rval != Success) goto unwind; pInfo->attrs = DuplicateInputAttributes(attrs); } if (!pInfo->name) { xf86Msg(X_INFO, "No identifier specified, ignoring this device.\n"); rval = BadRequest; goto unwind; } if (!pInfo->driver) { xf86Msg(X_INFO, "No input driver specified, ignoring this device.\n"); xf86Msg(X_INFO, "This device may have been added with another device file.\n"); rval = BadRequest; goto unwind; } rval = xf86NewInputDevice(pInfo, pdev, (!is_auto || (is_auto && xf86Info.autoEnableDevices))); return rval; unwind: if (is_auto && !xf86Info.autoAddDevices) xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n"); xf86DeleteInput(pInfo, 0); return rval; } void DeleteInputDeviceRequest(DeviceIntPtr pDev) { InputInfoPtr pInfo = (InputInfoPtr) pDev->public.devicePrivate; InputDriverPtr drv = NULL; Bool isMaster = IsMaster(pDev); if (pInfo) /* need to get these before RemoveDevice */ drv = pInfo->drv; input_lock(); RemoveDevice(pDev, TRUE); if (!isMaster && pInfo != NULL) { if (drv->UnInit) drv->UnInit(drv, pInfo, 0); else xf86DeleteInput(pInfo, 0); } input_unlock(); } void RemoveInputDeviceTraces(const char *config_info) { PausedInputDevicePtr d, tmp; xorg_list_for_each_entry_safe(d, tmp, &new_input_devices_list, node) { const char *ci = xf86findOptionValue(d->pInfo->options, "config_info"); if (!ci || strcmp(ci, config_info) != 0) continue; xorg_list_del(&d->node); free(d); } } /* * convenient functions to post events */ void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute, int first_valuator, int num_valuators, ...) { va_list var; int i = 0; ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); valuator_mask_zero(&mask); va_start(var, num_valuators); for (i = 0; i < num_valuators; i++) valuator_mask_set(&mask, first_valuator + i, va_arg(var, int)); va_end(var); xf86PostMotionEventM(device, is_absolute, &mask); } void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute, int first_valuator, int num_valuators, const int *valuators) { ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); xf86PostMotionEventM(device, is_absolute, &mask); } static int xf86CheckMotionEvent4DGA(DeviceIntPtr device, int is_absolute, const ValuatorMask *mask) { int stolen = 0; #ifdef XFreeXDGA ScreenPtr scr = NULL; int idx = 0, i; /* The evdev driver may not always send all axes across. */ if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1)) { scr = miPointerGetScreen(device); if (scr) { int dx = 0, dy = 0; idx = scr->myNum; if (valuator_mask_isset(mask, 0)) { dx = valuator_mask_get(mask, 0); if (is_absolute) dx -= device->last.valuators[0]; else if (valuator_mask_has_unaccelerated(mask)) dx = valuator_mask_get_unaccelerated(mask, 0); } if (valuator_mask_isset(mask, 1)) { dy = valuator_mask_get(mask, 1); if (is_absolute) dy -= device->last.valuators[1]; else if (valuator_mask_has_unaccelerated(mask)) dy = valuator_mask_get_unaccelerated(mask, 1); } if (DGAStealMotionEvent(device, idx, dx, dy)) stolen = 1; } } for (i = 2; i < valuator_mask_size(mask); i++) { AxisInfoPtr ax; double incr; int val, button; if (i >= device->valuator->numAxes) break; if (!valuator_mask_isset(mask, i)) continue; ax = &device->valuator->axes[i]; if (ax->scroll.type == SCROLL_TYPE_NONE) continue; if (!scr) { scr = miPointerGetScreen(device); if (!scr) break; idx = scr->myNum; } incr = ax->scroll.increment; val = valuator_mask_get(mask, i); if (ax->scroll.type == SCROLL_TYPE_VERTICAL) { if (incr * val < 0) button = 4; /* up */ else button = 5; /* down */ } else { /* SCROLL_TYPE_HORIZONTAL */ if (incr * val < 0) button = 6; /* left */ else button = 7; /* right */ } if (DGAStealButtonEvent(device, idx, button, 1) && DGAStealButtonEvent(device, idx, button, 0)) stolen = 1; } #endif return stolen; } void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute, const ValuatorMask *mask) { int flags = 0; if (xf86CheckMotionEvent4DGA(device, is_absolute, mask)) return; if (valuator_mask_num_valuators(mask) > 0) { if (is_absolute) flags = POINTER_ABSOLUTE; else flags = POINTER_RELATIVE | POINTER_ACCELERATE; } QueuePointerEvents(device, MotionNotify, 0, flags, mask); } void xf86PostProximityEvent(DeviceIntPtr device, int is_in, int first_valuator, int num_valuators, ...) { va_list var; int i; ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); valuator_mask_zero(&mask); va_start(var, num_valuators); for (i = 0; i < num_valuators; i++) valuator_mask_set(&mask, first_valuator + i, va_arg(var, int)); va_end(var); xf86PostProximityEventM(device, is_in, &mask); } void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator, int num_valuators, const int *valuators) { ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); xf86PostProximityEventM(device, is_in, &mask); } void xf86PostProximityEventM(DeviceIntPtr device, int is_in, const ValuatorMask *mask) { QueueProximityEvents(device, is_in ? ProximityIn : ProximityOut, mask); } void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button, int is_down, int first_valuator, int num_valuators, ...) { va_list var; ValuatorMask mask; int i = 0; XI_VERIFY_VALUATORS(num_valuators); valuator_mask_zero(&mask); va_start(var, num_valuators); for (i = 0; i < num_valuators; i++) valuator_mask_set(&mask, first_valuator + i, va_arg(var, int)); va_end(var); xf86PostButtonEventM(device, is_absolute, button, is_down, &mask); } void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button, int is_down, int first_valuator, int num_valuators, const int *valuators) { ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); xf86PostButtonEventM(device, is_absolute, button, is_down, &mask); } void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button, int is_down, const ValuatorMask *mask) { int flags = 0; if (valuator_mask_num_valuators(mask) > 0) { if (is_absolute) flags = POINTER_ABSOLUTE; else flags = POINTER_RELATIVE | POINTER_ACCELERATE; } #ifdef XFreeXDGA if (miPointerGetScreen(device)) { int index = miPointerGetScreen(device)->myNum; if (DGAStealButtonEvent(device, index, button, is_down)) return; } #endif QueuePointerEvents(device, is_down ? ButtonPress : ButtonRelease, button, flags, mask); } void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down) { xf86PostKeyEventM(device, key_code, is_down); } void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down) { xf86PostKeyEventM(device, key_code, is_down); } void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down) { #ifdef XFreeXDGA DeviceIntPtr pointer; /* Some pointers send key events, paired device is wrong then. */ pointer = GetMaster(device, POINTER_OR_FLOAT); if (miPointerGetScreen(pointer)) { int index = miPointerGetScreen(pointer)->myNum; if (DGAStealKeyEvent(device, index, key_code, is_down)) return; } #endif QueueKeyboardEvents(device, is_down ? KeyPress : KeyRelease, key_code); } void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down) { ValuatorMask mask; valuator_mask_zero(&mask); xf86PostKeyEventM(device, key_code, is_down); } InputInfoPtr xf86FirstLocalDevice(void) { return xf86InputDevs; } /* * Cx - raw data from touch screen * to_max - scaled highest dimension * (remember, this is of rows - 1 because of 0 origin) * to_min - scaled lowest dimension * from_max - highest raw value from touch screen calibration * from_min - lowest raw value from touch screen calibration * * This function is the same for X or Y coordinates. * You may have to reverse the high and low values to compensate for * different orgins on the touch screen vs X. * * e.g. to scale from device coordinates into screen coordinates, call * xf86ScaleAxis(x, 0, screen_width, dev_min, dev_max); */ int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min) { int X; int64_t to_width = to_max - to_min; int64_t from_width = from_max - from_min; if (from_width) { X = (int) (((to_width * (Cx - from_min)) / from_width) + to_min); } else { X = 0; ErrorF("Divide by Zero in xf86ScaleAxis\n"); } if (X > to_max) X = to_max; if (X < to_min) X = to_min; return X; } Bool xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval, int resolution, int min_res, int max_res, int mode) { if (!dev || !dev->valuator) return FALSE; return InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution, min_res, max_res, mode); } /* * Set the valuator values to be in sync with dix/event.c * DefineInitialRootWindow(). */ void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) { if (axnum == 0) { dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2; dev->last.valuators[0] = dev->valuator->axisVal[0]; } else if (axnum == 1) { dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2; dev->last.valuators[1] = dev->valuator->axisVal[1]; } } /** * Deactivate a device. Call this function from the driver if you receive a * read error or something else that spoils your day. * Device will be moved to the off_devices list, but it will still be there * until you really clean up after it. * Notifies the client about an inactive device. * * @param panic True if device is unrecoverable and needs to be removed. */ void xf86DisableDevice(DeviceIntPtr dev, Bool panic) { if (!panic) { DisableDevice(dev, TRUE); } else { SendDevicePresenceEvent(dev->id, DeviceUnrecoverable); DeleteInputDeviceRequest(dev); } } /** * Reactivate a device. Call this function from the driver if you just found * out that the read error wasn't quite that bad after all. * Device will be re-activated, and an event sent to the client. */ void xf86EnableDevice(DeviceIntPtr dev) { EnableDevice(dev, TRUE); } /** * Post a touch event with optional valuators. If this is the first touch in * the sequence, at least x & y valuators must be provided. The driver is * responsible for maintaining the correct event sequence (TouchBegin, TouchUpdate, * TouchEnd). Submitting an update or end event for a unregistered touchid will * result in errors. * Touch IDs may be reused by the driver but only after a TouchEnd has been * submitted for that touch ID. * * @param dev The device to post the event for * @param touchid The touchid of the current touch event. Must be an * existing ID for TouchUpdate or TouchEnd events * @param type One of XI_TouchBegin, XI_TouchUpdate, XI_TouchEnd * @param flags Flags for this event * @param The valuator mask with all valuators set for this event. */ void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type, uint32_t flags, const ValuatorMask *mask) { QueueTouchEvents(dev, type, touchid, flags, mask); } void xf86InputEnableVTProbe(void) { int is_auto = 0; DeviceIntPtr pdev; PausedInputDevicePtr d, tmp; xorg_list_for_each_entry_safe(d, tmp, &new_input_devices_list, node) { InputInfoPtr pInfo = d->pInfo; const char *value = xf86findOptionValue(pInfo->options, "_source"); is_auto = 0; if (value && (strcmp(value, "server/hal") == 0 || strcmp(value, "server/udev") == 0 || strcmp(value, "server/wscons") == 0)) is_auto = 1; xf86NewInputDevice(pInfo, &pdev, (!is_auto || (is_auto && xf86Info.autoEnableDevices))); xorg_list_del(&d->node); free(d); } } /* end of xf86Xinput.c */ xorg-server-1.20.8/hw/xfree86/common/xf86sbusBus.h0000644000175000017500000001062213640201473016517 00000000000000/* * SBUS bus-specific declarations * * 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. */ #ifndef _XF86_SBUSBUS_H #define _XF86_SBUSBUS_H #include "xf86str.h" #define SBUS_DEVICE_BW2 0x0001 #define SBUS_DEVICE_CG2 0x0002 #define SBUS_DEVICE_CG3 0x0003 #define SBUS_DEVICE_CG4 0x0004 #define SBUS_DEVICE_CG6 0x0005 #define SBUS_DEVICE_CG8 0x0006 #define SBUS_DEVICE_CG12 0x0007 #define SBUS_DEVICE_CG14 0x0008 #define SBUS_DEVICE_LEO 0x0009 #define SBUS_DEVICE_TCX 0x000a #define SBUS_DEVICE_FFB 0x000b #define SBUS_DEVICE_GT 0x000c #define SBUS_DEVICE_MGX 0x000d typedef struct sbus_prom_node { int node; /* Because of misdesigned openpromio */ int cookie[2]; } sbusPromNode, *sbusPromNodePtr; typedef struct sbus_device { int devId; int fbNum; int fd; int width, height; sbusPromNode node; const char *descr; const char *device; } sbusDevice, *sbusDevicePtr; struct sbus_devtable { int devId; int fbType; const char *promName; const char *driverName; const char *descr; }; extern _X_EXPORT void xf86SbusProbe(void); extern _X_EXPORT sbusDevicePtr *xf86SbusInfo; extern _X_EXPORT struct sbus_devtable sbusDeviceTable[]; extern _X_EXPORT int xf86MatchSbusInstances(const char *driverName, int sbusDevId, GDevPtr * devList, int numDevs, DriverPtr drvp, int **foundEntities); extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex); extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp); extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp); extern _X_EXPORT void *xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size); extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr, unsigned long size); extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp); extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg); extern _X_EXPORT Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp); extern _X_EXPORT int promRootNode; extern _X_EXPORT int promGetSibling(int node); extern _X_EXPORT int promGetChild(int node); extern _X_EXPORT char *promGetProperty(const char *prop, int *lenp); extern _X_EXPORT int promGetBool(const char *prop); extern _X_EXPORT int sparcPromInit(void); extern _X_EXPORT void sparcPromClose(void); extern _X_EXPORT char *sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp); extern _X_EXPORT int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop); extern _X_EXPORT void sparcPromAssignNodes(void); extern _X_EXPORT char *sparcPromNode2Pathname(sbusPromNodePtr pnode); extern _X_EXPORT int sparcPromPathname2Node(const char *pathName); extern _X_EXPORT char *sparcDriverName(void); extern Bool xf86SbusConfigure(void *busData, sbusDevicePtr sBus); extern void xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec * GDev); #endif /* _XF86_SBUSBUS_H */ xorg-server-1.20.8/hw/xfree86/common/xisb.c0000644000175000017500000001206713640201473015322 00000000000000/* * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ /* X Input Serial Buffer routines for use in any XInput driver that accesses a serial device. */ /***************************************************************************** * Standard Headers ****************************************************************************/ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include "xisb.h" /***************************************************************************** * Local Headers ****************************************************************************/ /***************************************************************************** * Variables without includable headers ****************************************************************************/ /***************************************************************************** * Local Variables ****************************************************************************/ /***************************************************************************** * Function Definitions ****************************************************************************/ XISBuffer * XisbNew(int fd, ssize_t size) { XISBuffer *b; b = malloc(sizeof(XISBuffer)); if (!b) return NULL; b->buf = malloc((sizeof(unsigned char) * size)); if (!b->buf) { free(b); return NULL; } b->fd = fd; b->trace = 0; b->block_duration = 0; b->current = 1; /* force it to be past the end to trigger initial read */ b->end = 0; b->buffer_size = size; return b; } void XisbFree(XISBuffer * b) { free(b->buf); free(b); } int XisbRead(XISBuffer * b) { int ret; if (b->current >= b->end) { if (b->block_duration >= 0) { if (xf86WaitForInput(b->fd, b->block_duration) < 1) return -1; } else { /* * automatically clear it so if XisbRead is called in a loop * the next call will make sure there is data with select and * thus prevent a blocking read */ b->block_duration = 0; } ret = xf86ReadSerial(b->fd, b->buf, b->buffer_size); switch (ret) { case 0: return -1; /* timeout */ case -1: return -2; /* error */ default: b->end = ret; b->current = 0; break; } } if (b->trace) ErrorF("read 0x%02x (%c)\n", b->buf[b->current], isprint(b->buf[b->current]) ? b->buf[b->current] : '.'); return b->buf[b->current++]; } /* the only purpose of this function is to provide output tracing */ ssize_t XisbWrite(XISBuffer * b, unsigned char *msg, ssize_t len) { if (b->trace) { int i = 0; for (i = 0; i < len; i++) ErrorF("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]); } return (xf86WriteSerial(b->fd, msg, len)); } /* turn tracing of this buffer on (1) or off (0) */ void XisbTrace(XISBuffer * b, int trace) { b->trace = trace; } /* * specify a block_duration of -1 when you know the buffer's fd is ready to * read. After a read, it is automatically set to 0 so that the next read * will use check to select for data and prevent a block. * It is the caller's responsibility to set the block_duration to -1 if it * knows that there is data to read (because the main select loop triggered * the read) and want's to avoid the unnecessary overhead of the select call * * a zero or positive block duration will cause the select to block for the * give duration in usecs. */ void XisbBlockDuration(XISBuffer * b, int block_duration) { b->block_duration = block_duration; } xorg-server-1.20.8/hw/xfree86/common/xf86VidMode.c0000644000175000017500000002756013640201473016424 00000000000000/* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the VidMode functions required by the extension. * These have been added to avoid the need for the higher level extension * code to access the private XFree86 data structures directly. Wherever * possible this code uses the functions in xf86Mode.c to do the work, * so that two version of code that do similar things don't have to be * maintained. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #include "extinit.h" #ifdef XF86VIDMODE #include "vidmodestr.h" #include "xf86Privstr.h" #include "xf86Extensions.h" #include "xf86cmap.h" static vidMonitorValue xf86VidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx) { vidMonitorValue ret = { NULL, }; MonPtr monitor; ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); monitor = pScrn->monitor; switch (valtyp) { case VIDMODE_MON_VENDOR: ret.ptr = monitor->vendor; break; case VIDMODE_MON_MODEL: ret.ptr = monitor->model; break; case VIDMODE_MON_NHSYNC: ret.i = monitor->nHsync; break; case VIDMODE_MON_NVREFRESH: ret.i = monitor->nVrefresh; break; case VIDMODE_MON_HSYNC_LO: ret.f = (100.0 * monitor->hsync[indx].lo); break; case VIDMODE_MON_HSYNC_HI: ret.f = (100.0 * monitor->hsync[indx].hi); break; case VIDMODE_MON_VREFRESH_LO: ret.f = (100.0 * monitor->vrefresh[indx].lo); break; case VIDMODE_MON_VREFRESH_HI: ret.f = (100.0 * monitor->vrefresh[indx].hi); break; } return ret; } static Bool xf86VidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock) { ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); if (pScrn->currentMode) { *mode = pScrn->currentMode; *dotClock = pScrn->currentMode->Clock; return TRUE; } return FALSE; } static int xf86VidModeGetDotClock(ScreenPtr pScreen, int Clock) { ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); if ((pScrn->progClock) || (Clock >= MAXCLOCKS)) return Clock; else return pScrn->clock[Clock]; } static int xf86VidModeGetNumOfClocks(ScreenPtr pScreen, Bool *progClock) { ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); if (pScrn->progClock) { *progClock = TRUE; return 0; } else { *progClock = FALSE; return pScrn->numClocks; } } static Bool xf86VidModeGetClocks(ScreenPtr pScreen, int *Clocks) { ScrnInfoPtr pScrn; int i; pScrn = xf86ScreenToScrn(pScreen); if (pScrn->progClock) return FALSE; for (i = 0; i < pScrn->numClocks; i++) *Clocks++ = pScrn->clock[i]; return TRUE; } static Bool xf86VidModeGetNextModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock) { VidModePtr pVidMode; DisplayModePtr p; pVidMode = VidModeGetPtr(pScreen); for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) { if (p->status == MODE_OK) { pVidMode->Next = p->next; *mode = p; *dotClock = xf86VidModeGetDotClock(pScreen, p->Clock); return TRUE; } } return FALSE; } static Bool xf86VidModeGetFirstModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock) { ScrnInfoPtr pScrn; VidModePtr pVidMode; pScrn = xf86ScreenToScrn(pScreen); if (pScrn->modes == NULL) return FALSE; pVidMode = VidModeGetPtr(pScreen); pVidMode->First = pScrn->modes; pVidMode->Next = pVidMode->First->next; if (pVidMode->First->status == MODE_OK) { *mode = pVidMode->First; *dotClock = xf86VidModeGetDotClock(pScreen, pVidMode->First->Clock); return TRUE; } return xf86VidModeGetNextModeline(pScreen, mode, dotClock); } static Bool xf86VidModeDeleteModeline(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; if (mode == NULL) return FALSE; pScrn = xf86ScreenToScrn(pScreen); xf86DeleteMode(&(pScrn->modes), mode); return TRUE; } static Bool xf86VidModeZoomViewport(ScreenPtr pScreen, int zoom) { xf86ZoomViewport(pScreen, zoom); return TRUE; } static Bool xf86VidModeSetViewPort(ScreenPtr pScreen, int x, int y) { ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); pScrn->frameX0 = min(max(x, 0), pScrn->virtualX - pScrn->currentMode->HDisplay); pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1; pScrn->frameY0 = min(max(y, 0), pScrn->virtualY - pScrn->currentMode->VDisplay); pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1; if (pScrn->AdjustFrame != NULL) (pScrn->AdjustFrame) (pScrn, pScrn->frameX0, pScrn->frameY0); return TRUE; } static Bool xf86VidModeGetViewPort(ScreenPtr pScreen, int *x, int *y) { ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); *x = pScrn->frameX0; *y = pScrn->frameY0; return TRUE; } static Bool xf86VidModeSwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; DisplayModePtr pTmpMode; Bool retval; pScrn = xf86ScreenToScrn(pScreen); /* save in case we fail */ pTmpMode = pScrn->currentMode; /* Force a mode switch */ pScrn->currentMode = NULL; retval = xf86SwitchMode(pScrn->pScreen, mode); /* we failed: restore it */ if (retval == FALSE) pScrn->currentMode = pTmpMode; return retval; } static Bool xf86VidModeLockZoom(ScreenPtr pScreen, Bool lock) { if (xf86Info.dontZoom) return FALSE; xf86LockZoom(pScreen, lock); return TRUE; } static ModeStatus xf86VidModeCheckModeForMonitor(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; if (mode == NULL) return MODE_ERROR; pScrn = xf86ScreenToScrn(pScreen); return xf86CheckModeForMonitor(mode, pScrn->monitor); } static ModeStatus xf86VidModeCheckModeForDriver(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; if (mode == NULL) return MODE_ERROR; pScrn = xf86ScreenToScrn(pScreen); return xf86CheckModeForDriver(pScrn, mode, 0); } static void xf86VidModeSetCrtcForMode(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; DisplayModePtr ScreenModes; if (mode == NULL) return; /* Ugly hack so that the xf86Mode.c function can be used without change */ pScrn = xf86ScreenToScrn(pScreen); ScreenModes = pScrn->modes; pScrn->modes = mode; xf86SetCrtcForModes(pScrn, pScrn->adjustFlags); pScrn->modes = ScreenModes; return; } static Bool xf86VidModeAddModeline(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; if (mode == NULL) return FALSE; pScrn = xf86ScreenToScrn(pScreen); mode->name = strdup(""); /* freed by deletemode */ mode->status = MODE_OK; mode->next = pScrn->modes->next; mode->prev = pScrn->modes; pScrn->modes->next = mode; if (mode->next != NULL) mode->next->prev = mode; return TRUE; } static int xf86VidModeGetNumOfModes(ScreenPtr pScreen) { DisplayModePtr mode = NULL; int dotClock = 0, nummodes = 0; if (!xf86VidModeGetFirstModeline(pScreen, &mode, &dotClock)) return nummodes; do { nummodes++; if (!xf86VidModeGetNextModeline(pScreen, &mode, &dotClock)) return nummodes; } while (TRUE); } static Bool xf86VidModeSetGamma(ScreenPtr pScreen, float red, float green, float blue) { Gamma gamma; gamma.red = red; gamma.green = green; gamma.blue = blue; if (xf86ChangeGamma(pScreen, gamma) != Success) return FALSE; else return TRUE; } static Bool xf86VidModeGetGamma(ScreenPtr pScreen, float *red, float *green, float *blue) { ScrnInfoPtr pScrn; pScrn = xf86ScreenToScrn(pScreen); *red = pScrn->gamma.red; *green = pScrn->gamma.green; *blue = pScrn->gamma.blue; return TRUE; } static Bool xf86VidModeSetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b) { xf86ChangeGammaRamp(pScreen, size, r, g, b); return TRUE; } static Bool xf86VidModeGetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b) { xf86GetGammaRamp(pScreen, size, r, g, b); return TRUE; } static Bool xf86VidModeInit(ScreenPtr pScreen) { VidModePtr pVidMode; if (!xf86GetVidModeEnabled()) { DebugF("!xf86GetVidModeEnabled()\n"); return FALSE; } pVidMode = VidModeInit(pScreen); if (!pVidMode) return FALSE; pVidMode->Flags = 0; pVidMode->Next = NULL; pVidMode->GetMonitorValue = xf86VidModeGetMonitorValue; pVidMode->GetCurrentModeline = xf86VidModeGetCurrentModeline; pVidMode->GetFirstModeline = xf86VidModeGetFirstModeline; pVidMode->GetNextModeline = xf86VidModeGetNextModeline; pVidMode->DeleteModeline = xf86VidModeDeleteModeline; pVidMode->ZoomViewport = xf86VidModeZoomViewport; pVidMode->GetViewPort = xf86VidModeGetViewPort; pVidMode->SetViewPort = xf86VidModeSetViewPort; pVidMode->SwitchMode = xf86VidModeSwitchMode; pVidMode->LockZoom = xf86VidModeLockZoom; pVidMode->GetNumOfClocks = xf86VidModeGetNumOfClocks; pVidMode->GetClocks = xf86VidModeGetClocks; pVidMode->CheckModeForMonitor = xf86VidModeCheckModeForMonitor; pVidMode->CheckModeForDriver = xf86VidModeCheckModeForDriver; pVidMode->SetCrtcForMode = xf86VidModeSetCrtcForMode; pVidMode->AddModeline = xf86VidModeAddModeline; pVidMode->GetDotClock = xf86VidModeGetDotClock; pVidMode->GetNumOfModes = xf86VidModeGetNumOfModes; pVidMode->SetGamma = xf86VidModeSetGamma; pVidMode->GetGamma = xf86VidModeGetGamma; pVidMode->SetGammaRamp = xf86VidModeSetGammaRamp; pVidMode->GetGammaRamp = xf86VidModeGetGammaRamp; pVidMode->GetGammaRampSize = xf86GetGammaRampSize; /* use xf86cmap API directly */ return TRUE; } void XFree86VidModeExtensionInit(void) { int i; Bool enabled = FALSE; DebugF("XFree86VidModeExtensionInit"); /* This means that the DDX doesn't want the vidmode extension enabled */ if (!xf86GetVidModeEnabled()) return; for (i = 0; i < screenInfo.numScreens; i++) { if (xf86VidModeInit (screenInfo.screens[i])) enabled = TRUE; } /* This means that the DDX doesn't want the vidmode extension enabled */ if (!enabled) return; VidModeAddExtension(xf86GetVidModeAllowNonLocal()); } #endif /* XF86VIDMODE */ xorg-server-1.20.8/hw/xfree86/common/xf86fbman.h0000644000175000017500000001526713640201473016166 00000000000000 /* * Copyright (c) 1998-2001 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). */ #ifndef _XF86FBMAN_H #define _XF86FBMAN_H #include "scrnintstr.h" #include "regionstr.h" #define FAVOR_AREA_THEN_WIDTH 0 #define FAVOR_AREA_THEN_HEIGHT 1 #define FAVOR_WIDTH_THEN_AREA 2 #define FAVOR_HEIGHT_THEN_AREA 3 #define PRIORITY_LOW 0 #define PRIORITY_NORMAL 1 #define PRIORITY_EXTREME 2 typedef struct _FBArea { ScreenPtr pScreen; BoxRec box; int granularity; void (*MoveAreaCallback) (struct _FBArea *, struct _FBArea *); void (*RemoveAreaCallback) (struct _FBArea *); DevUnion devPrivate; } FBArea, *FBAreaPtr; typedef struct _FBLinear { ScreenPtr pScreen; int size; int offset; int granularity; void (*MoveLinearCallback) (struct _FBLinear *, struct _FBLinear *); void (*RemoveLinearCallback) (struct _FBLinear *); DevUnion devPrivate; } FBLinear, *FBLinearPtr; typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, void *); typedef void (*MoveAreaCallbackProcPtr) (FBAreaPtr, FBAreaPtr); typedef void (*RemoveAreaCallbackProcPtr) (FBAreaPtr); typedef void (*MoveLinearCallbackProcPtr) (FBLinearPtr, FBLinearPtr); typedef void (*RemoveLinearCallbackProcPtr) (FBLinearPtr); typedef struct { FBAreaPtr(*AllocateOffscreenArea) (ScreenPtr pScreen, int w, int h, int granularity, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData); void (*FreeOffscreenArea) (FBAreaPtr area); Bool (*ResizeOffscreenArea) (FBAreaPtr area, int w, int h); Bool (*QueryLargestOffscreenArea) (ScreenPtr pScreen, int *width, int *height, int granularity, int preferences, int priority); Bool (*RegisterFreeBoxCallback) (ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, void *devPriv); /* linear functions */ FBLinearPtr(*AllocateOffscreenLinear) (ScreenPtr pScreen, int size, int granularity, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, void *privData); void (*FreeOffscreenLinear) (FBLinearPtr area); Bool (*ResizeOffscreenLinear) (FBLinearPtr area, int size); Bool (*QueryLargestOffscreenLinear) (ScreenPtr pScreen, int *size, int granularity, int priority); Bool (*PurgeOffscreenAreas) (ScreenPtr); } FBManagerFuncs, *FBManagerFuncsPtr; extern _X_EXPORT Bool xf86RegisterOffscreenManager(ScreenPtr pScreen, FBManagerFuncsPtr funcs); extern _X_EXPORT Bool xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr ScreenRegion); extern _X_EXPORT Bool xf86InitFBManagerArea(ScreenPtr pScreen, int PixalArea, int Verbosity); extern _X_EXPORT Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox); extern _X_EXPORT Bool xf86InitFBManagerLinear(ScreenPtr pScreen, int offset, int size); extern _X_EXPORT Bool xf86FBManagerRunning(ScreenPtr pScreen); extern _X_EXPORT FBAreaPtr xf86AllocateOffscreenArea(ScreenPtr pScreen, int w, int h, int granularity, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData); extern _X_EXPORT FBAreaPtr xf86AllocateLinearOffscreenArea(ScreenPtr pScreen, int length, int granularity, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData); extern _X_EXPORT FBLinearPtr xf86AllocateOffscreenLinear(ScreenPtr pScreen, int length, int granularity, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, void *privData); extern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area); extern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area); extern _X_EXPORT Bool xf86ResizeOffscreenArea(FBAreaPtr resize, int w, int h); extern _X_EXPORT Bool xf86ResizeOffscreenLinear(FBLinearPtr resize, int size); extern _X_EXPORT Bool xf86RegisterFreeBoxCallback(ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, void *devPriv); extern _X_EXPORT Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen); extern _X_EXPORT Bool xf86QueryLargestOffscreenArea(ScreenPtr pScreen, int *width, int *height, int granularity, int preferences, int priority); extern _X_EXPORT Bool xf86QueryLargestOffscreenLinear(ScreenPtr pScreen, int *size, int granularity, int priority); #endif /* _XF86FBMAN_H */ xorg-server-1.20.8/hw/xfree86/common/xf86VGAarbiter.c0000644000175000017500000006560013640201473017060 00000000000000/* * This code was stolen from RAC and adapted to control the legacy vga * interface. * * * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #include "xorg-config.h" #include "xf86VGAarbiter.h" #include "xf86VGAarbiterPriv.h" #include "xf86Bus.h" #include "xf86Priv.h" #include "pciaccess.h" static GCFuncs VGAarbiterGCFuncs = { VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC, VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip, VGAarbiterCopyClip }; static GCOps VGAarbiterGCOps = { VGAarbiterFillSpans, VGAarbiterSetSpans, VGAarbiterPutImage, VGAarbiterCopyArea, VGAarbiterCopyPlane, VGAarbiterPolyPoint, VGAarbiterPolylines, VGAarbiterPolySegment, VGAarbiterPolyRectangle, VGAarbiterPolyArc, VGAarbiterFillPolygon, VGAarbiterPolyFillRect, VGAarbiterPolyFillArc, VGAarbiterPolyText8, VGAarbiterPolyText16, VGAarbiterImageText8, VGAarbiterImageText16, VGAarbiterImageGlyphBlt, VGAarbiterPolyGlyphBlt, VGAarbiterPushPixels, }; static miPointerSpriteFuncRec VGAarbiterSpriteFuncs = { VGAarbiterSpriteRealizeCursor, VGAarbiterSpriteUnrealizeCursor, VGAarbiterSpriteSetCursor, VGAarbiterSpriteMoveCursor, VGAarbiterDeviceCursorInitialize, VGAarbiterDeviceCursorCleanup }; static DevPrivateKeyRec VGAarbiterScreenKeyRec; #define VGAarbiterScreenKey (&VGAarbiterScreenKeyRec) static DevPrivateKeyRec VGAarbiterGCKeyRec; #define VGAarbiterGCKey (&VGAarbiterGCKeyRec) static int vga_no_arb = 0; void xf86VGAarbiterInit(void) { if (pci_device_vgaarb_init() != 0) { vga_no_arb = 1; xf86Msg(X_WARNING, "VGA arbiter: cannot open kernel arbiter, no multi-card support\n"); } } void xf86VGAarbiterFini(void) { if (vga_no_arb) return; pci_device_vgaarb_fini(); } void xf86VGAarbiterLock(ScrnInfoPtr pScrn) { if (vga_no_arb) return; pci_device_vgaarb_set_target(pScrn->vgaDev); pci_device_vgaarb_lock(); } void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) { if (vga_no_arb) return; pci_device_vgaarb_unlock(); } Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { int vga_count; int rsrc_decodes = 0; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (vga_no_arb) return TRUE; pci_device_vgaarb_get_info(pScrn->vgaDev, &vga_count, &rsrc_decodes); if (vga_count > 1) { if (rsrc_decodes) { return FALSE; } } return TRUE; } void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) { struct pci_device *dev; EntityPtr pEnt; if (vga_no_arb) return; pEnt = xf86Entities[pScrn->entityList[0]]; if (pEnt->bus.type != BUS_PCI) return; dev = pEnt->bus.id.pci; pScrn->vgaDev = dev; } void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc) { if (vga_no_arb) return; pci_device_vgaarb_set_target(pScrn->vgaDev); pci_device_vgaarb_decodes(rsrc); } Bool xf86VGAarbiterWrapFunctions(void) { ScrnInfoPtr pScrn; VGAarbiterScreenPtr pScreenPriv; miPointerScreenPtr PointPriv; PictureScreenPtr ps; ScreenPtr pScreen; int vga_count, i; if (vga_no_arb) return FALSE; /* * we need to wrap the arbiter if we have more than * one VGA card - hotplug cries. */ pci_device_vgaarb_get_info(NULL, &vga_count, NULL); if (vga_count < 2 || !xf86Screens) return FALSE; xf86Msg(X_INFO, "Found %d VGA devices: arbiter wrapping enabled\n", vga_count); for (i = 0; i < xf86NumScreens; i++) { pScreen = xf86Screens[i]->pScreen; ps = GetPictureScreenIfSet(pScreen); pScrn = xf86ScreenToScrn(pScreen); PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); if (!dixRegisterPrivateKey (&VGAarbiterGCKeyRec, PRIVATE_GC, sizeof(VGAarbiterGCRec))) return FALSE; if (!dixRegisterPrivateKey(&VGAarbiterScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!(pScreenPriv = malloc(sizeof(VGAarbiterScreenRec)))) return FALSE; dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv); WRAP_SCREEN(CloseScreen, VGAarbiterCloseScreen); WRAP_SCREEN(SaveScreen, VGAarbiterSaveScreen); WRAP_SCREEN(WakeupHandler, VGAarbiterWakeupHandler); WRAP_SCREEN(BlockHandler, VGAarbiterBlockHandler); WRAP_SCREEN(CreateGC, VGAarbiterCreateGC); WRAP_SCREEN(GetImage, VGAarbiterGetImage); WRAP_SCREEN(GetSpans, VGAarbiterGetSpans); WRAP_SCREEN(SourceValidate, VGAarbiterSourceValidate); WRAP_SCREEN(CopyWindow, VGAarbiterCopyWindow); WRAP_SCREEN(ClearToBackground, VGAarbiterClearToBackground); WRAP_SCREEN(CreatePixmap, VGAarbiterCreatePixmap); WRAP_SCREEN(StoreColors, VGAarbiterStoreColors); WRAP_SCREEN(DisplayCursor, VGAarbiterDisplayCursor); WRAP_SCREEN(RealizeCursor, VGAarbiterRealizeCursor); WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor); WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor); WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition); WRAP_PICT(Composite, VGAarbiterComposite); WRAP_PICT(Glyphs, VGAarbiterGlyphs); WRAP_PICT(CompositeRects, VGAarbiterCompositeRects); WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame); WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode); WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT); WRAP_SCREEN_INFO(LeaveVT, VGAarbiterLeaveVT); WRAP_SCREEN_INFO(FreeScreen, VGAarbiterFreeScreen); WRAP_SPRITE; } return TRUE; } /* Screen funcs */ static Bool VGAarbiterCloseScreen(ScreenPtr pScreen) { Bool val; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); miPointerScreenPtr PointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); UNWRAP_SCREEN(CreateGC); UNWRAP_SCREEN(CloseScreen); UNWRAP_SCREEN(GetImage); UNWRAP_SCREEN(GetSpans); UNWRAP_SCREEN(SourceValidate); UNWRAP_SCREEN(CopyWindow); UNWRAP_SCREEN(ClearToBackground); UNWRAP_SCREEN(SaveScreen); UNWRAP_SCREEN(StoreColors); UNWRAP_SCREEN(DisplayCursor); UNWRAP_SCREEN(RealizeCursor); UNWRAP_SCREEN(UnrealizeCursor); UNWRAP_SCREEN(RecolorCursor); UNWRAP_SCREEN(SetCursorPosition); UNWRAP_PICT(Composite); UNWRAP_PICT(Glyphs); UNWRAP_PICT(CompositeRects); UNWRAP_SCREEN_INFO(AdjustFrame); UNWRAP_SCREEN_INFO(SwitchMode); UNWRAP_SCREEN_INFO(EnterVT); UNWRAP_SCREEN_INFO(LeaveVT); UNWRAP_SCREEN_INFO(FreeScreen); UNWRAP_SPRITE; free((void *) pScreenPriv); xf86VGAarbiterLock(xf86ScreenToScrn(pScreen)); val = (*pScreen->CloseScreen) (pScreen); xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen)); return val; } static void VGAarbiterBlockHandler(ScreenPtr pScreen, void *pTimeout) { SCREEN_PROLOG(BlockHandler); VGAGet(pScreen); pScreen->BlockHandler(pScreen, pTimeout); VGAPut(); SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler); } static void VGAarbiterWakeupHandler(ScreenPtr pScreen, int result) { SCREEN_PROLOG(WakeupHandler); VGAGet(pScreen); pScreen->WakeupHandler(pScreen, result); VGAPut(); SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler); } static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine) { ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG(GetImage); VGAGet(pScreen); (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); VGAPut(); SCREEN_EPILOG(GetImage, VGAarbiterGetImage); } static void VGAarbiterGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) { ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG(GetSpans); VGAGet(pScreen); (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); VGAPut(); SCREEN_EPILOG(GetSpans, VGAarbiterGetSpans); } static void VGAarbiterSourceValidate(DrawablePtr pDrawable, int x, int y, int width, int height, unsigned int subWindowMode) { ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG(SourceValidate); VGAGet(pScreen); if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode); VGAPut(); SCREEN_EPILOG(SourceValidate, VGAarbiterSourceValidate); } static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOG(CopyWindow); VGAGet(pScreen); (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); VGAPut(); SCREEN_EPILOG(CopyWindow, VGAarbiterCopyWindow); } static void VGAarbiterClearToBackground(WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOG(ClearToBackground); VGAGet(pScreen); (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); VGAPut(); SCREEN_EPILOG(ClearToBackground, VGAarbiterClearToBackground); } static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint) { PixmapPtr pPix; SCREEN_PROLOG(CreatePixmap); VGAGet(pScreen); pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint); VGAPut(); SCREEN_EPILOG(CreatePixmap, VGAarbiterCreatePixmap); return pPix; } static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank) { Bool val; SCREEN_PROLOG(SaveScreen); VGAGet(pScreen); val = (*pScreen->SaveScreen) (pScreen, unblank); VGAPut(); SCREEN_EPILOG(SaveScreen, VGAarbiterSaveScreen); return val; } static void VGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs) { ScreenPtr pScreen = pmap->pScreen; SCREEN_PROLOG(StoreColors); VGAGet(pScreen); (*pScreen->StoreColors) (pmap, ndef, pdefs); VGAPut(); SCREEN_EPILOG(StoreColors, VGAarbiterStoreColors); } static void VGAarbiterRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) { SCREEN_PROLOG(RecolorCursor); VGAGet(pScreen); (*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed); VGAPut(); SCREEN_EPILOG(RecolorCursor, VGAarbiterRecolorCursor); } static Bool VGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { Bool val; SCREEN_PROLOG(RealizeCursor); VGAGet(pScreen); val = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor); VGAPut(); SCREEN_EPILOG(RealizeCursor, VGAarbiterRealizeCursor); return val; } static Bool VGAarbiterUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { Bool val; SCREEN_PROLOG(UnrealizeCursor); VGAGet(pScreen); val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor); VGAPut(); SCREEN_EPILOG(UnrealizeCursor, VGAarbiterUnrealizeCursor); return val; } static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { Bool val; SCREEN_PROLOG(DisplayCursor); VGAGet(pScreen); val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); VGAPut(); SCREEN_EPILOG(DisplayCursor, VGAarbiterDisplayCursor); return val; } static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) { Bool val; SCREEN_PROLOG(SetCursorPosition); VGAGet(pScreen); val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); VGAPut(); SCREEN_EPILOG(SetCursorPosition, VGAarbiterSetCursorPosition); return val; } static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); (*pScreenPriv->AdjustFrame) (pScrn, x, y); VGAPut(); } static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool val; ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); val = (*pScreenPriv->SwitchMode) (pScrn, mode); VGAPut(); return val; } static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn) { Bool val; ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); pScrn->EnterVT = pScreenPriv->EnterVT; val = (*pScrn->EnterVT) (pScrn); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = VGAarbiterEnterVT; VGAPut(); return val; } static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); pScrn->LeaveVT = pScreenPriv->LeaveVT; (*pScreenPriv->LeaveVT) (pScrn); pScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = VGAarbiterLeaveVT; VGAPut(); } static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); (*pScreenPriv->FreeScreen) (pScrn); VGAPut(); } static Bool VGAarbiterCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; VGAarbiterGCPtr pGCPriv = (VGAarbiterGCPtr) dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey); Bool ret; SCREEN_PROLOG(CreateGC); ret = (*pScreen->CreateGC) (pGC); GC_WRAP(pGC); SCREEN_EPILOG(CreateGC, VGAarbiterCreateGC); return ret; } /* GC funcs */ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) { GC_UNWRAP(pGC); (*pGC->funcs->ValidateGC) (pGC, changes, pDraw); GC_WRAP(pGC); } static void VGAarbiterDestroyGC(GCPtr pGC) { GC_UNWRAP(pGC); (*pGC->funcs->DestroyGC) (pGC); GC_WRAP(pGC); } static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask) { GC_UNWRAP(pGC); (*pGC->funcs->ChangeGC) (pGC, mask); GC_WRAP(pGC); } static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) { GC_UNWRAP(pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); GC_WRAP(pGCDst); } static void VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { GC_UNWRAP(pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); GC_WRAP(pGC); } static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc) { GC_UNWRAP(pgcDst); (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc); GC_WRAP(pgcDst); } static void VGAarbiterDestroyClip(GCPtr pGC) { GC_UNWRAP(pGC); (*pGC->funcs->DestroyClip) (pGC); GC_WRAP(pGC); } /* GC Ops */ static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage); VGAPut(); GC_WRAP(pGC); } static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GC * pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { RegionPtr ret; ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); ret = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); VGAPut(); GC_WRAP(pGC); return ret; } static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) { RegionPtr ret; ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); ret = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); VGAPut(); GC_WRAP(pGC); return ret; } static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, xPoint * pptInit) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape, int mode, int count, DDXPointPtr ptsIn) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill, xRectangle *prectInit) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs); VGAPut(); GC_WRAP(pGC); } static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars) { int ret; ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars); VGAPut(); GC_WRAP(pGC); return ret; } static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars) { int ret; ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars); VGAPut(); GC_WRAP(pGC); return ret; } static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase); VGAPut(); GC_WRAP(pGC); } static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg) { ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); VGAGet(pScreen); (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); VGAPut(); GC_WRAP(pGC); } /* miSpriteFuncs */ static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur) { Bool val; SPRITE_PROLOG; VGAGet(pScreen); val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur); VGAPut(); SPRITE_EPILOG; return val; } static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur) { Bool val; SPRITE_PROLOG; VGAGet(pScreen); val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur); VGAPut(); SPRITE_EPILOG; return val; } static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y) { SPRITE_PROLOG; VGAGet(pScreen); PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y); VGAPut(); SPRITE_EPILOG; } static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { SPRITE_PROLOG; VGAGet(pScreen); PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y); VGAPut(); SPRITE_EPILOG; } static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { Bool val; SPRITE_PROLOG; VGAGet(pScreen); val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen); VGAPut(); SPRITE_EPILOG; return val; } static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { SPRITE_PROLOG; VGAGet(pScreen); PointPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen); VGAPut(); SPRITE_EPILOG; } static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); PICTURE_PROLOGUE(Composite); VGAGet(pScreen); (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); VGAPut(); PICTURE_EPILOGUE(Composite, VGAarbiterComposite); } static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); PICTURE_PROLOGUE(Glyphs); VGAGet(pScreen); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); VGAPut(); PICTURE_EPILOGUE(Glyphs, VGAarbiterGlyphs); } static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); PICTURE_PROLOGUE(CompositeRects); VGAGet(pScreen); (*ps->CompositeRects) (op, pDst, color, nRect, rects); VGAPut(); PICTURE_EPILOGUE(CompositeRects, VGAarbiterCompositeRects); } xorg-server-1.20.8/hw/xfree86/common/xf86cmap.c0000644000175000017500000010700113640201473016002 00000000000000/* * Copyright (c) 1998-2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #if defined(_XOPEN_SOURCE) || defined(__sun) && defined(__SVR4) #include #else #define _XOPEN_SOURCE /* to get prototype for pow on some systems */ #include #undef _XOPEN_SOURCE #endif #include #include "misc.h" #include #include "colormapst.h" #include "scrnintstr.h" #include "resource.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86str.h" #include "micmap.h" #include "xf86RandR12.h" #include "xf86Crtc.h" #ifdef XFreeXDGA #include #include "dgaproc.h" #endif #include "xf86cmap.h" #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) #define LOAD_PALETTE(pmap) \ ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \ xf86ScreenToScrn(pmap->pScreen)->vtSema || pScreenPriv->isDGAmode)) typedef struct _CMapLink { ColormapPtr cmap; struct _CMapLink *next; } CMapLink, *CMapLinkPtr; typedef struct { CloseScreenProcPtr CloseScreen; CreateColormapProcPtr CreateColormap; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; Bool (*EnterVT) (ScrnInfoPtr); Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr); xf86ChangeGammaProc *ChangeGamma; int maxColors; int sigRGBbits; int gammaElements; LOCO *gamma; int *PreAllocIndices; CMapLinkPtr maps; unsigned int flags; Bool isDGAmode; } CMapScreenRec, *CMapScreenPtr; typedef struct { int numColors; LOCO *colors; Bool recalculate; int overscan; } CMapColormapRec, *CMapColormapPtr; static DevPrivateKeyRec CMapScreenKeyRec; #define CMapScreenKeyRegistered dixPrivateKeyRegistered(&CMapScreenKeyRec) #define CMapScreenKey (&CMapScreenKeyRec) static DevPrivateKeyRec CMapColormapKeyRec; #define CMapColormapKey (&CMapColormapKeyRec) static void CMapInstallColormap(ColormapPtr); static void CMapStoreColors(ColormapPtr, int, xColorItem *); static Bool CMapCloseScreen(ScreenPtr); static Bool CMapCreateColormap(ColormapPtr); static void CMapDestroyColormap(ColormapPtr); static Bool CMapEnterVT(ScrnInfoPtr); static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr); #ifdef XFreeXDGA static int CMapSetDGAMode(ScrnInfoPtr, int, DGADevicePtr); #endif static int CMapChangeGamma(ScrnInfoPtr, Gamma); static void ComputeGamma(ScrnInfoPtr, CMapScreenPtr); static Bool CMapAllocateColormapPrivate(ColormapPtr); static void CMapRefreshColors(ColormapPtr, int, int *); static void CMapSetOverscan(ColormapPtr, int, int *); static void CMapReinstallMap(ColormapPtr); static void CMapUnwrapScreen(ScreenPtr pScreen); Bool xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn) { if (!dixRegisterPrivateKey(&CMapScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&CMapColormapKeyRec, PRIVATE_COLORMAP, 0)) return FALSE; return TRUE; } Bool xf86HandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits, xf86LoadPaletteProc * loadPalette, xf86SetOverscanProc * setOverscan, unsigned int flags) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ColormapPtr pDefMap = NULL; CMapScreenPtr pScreenPriv; LOCO *gamma; int *indices; int elements; if (!maxColors || !sigRGBbits || (!loadPalette && !xf86_crtc_supports_gamma(pScrn))) return FALSE; elements = 1 << sigRGBbits; if (!(gamma = xallocarray(elements, sizeof(LOCO)))) return FALSE; if (!(indices = xallocarray(maxColors, sizeof(int)))) { free(gamma); return FALSE; } if (!(pScreenPriv = malloc(sizeof(CMapScreenRec)))) { free(gamma); free(indices); return FALSE; } dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->CreateColormap = pScreen->CreateColormap; pScreenPriv->DestroyColormap = pScreen->DestroyColormap; pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreenPriv->StoreColors = pScreen->StoreColors; pScreen->CloseScreen = CMapCloseScreen; pScreen->CreateColormap = CMapCreateColormap; pScreen->DestroyColormap = CMapDestroyColormap; pScreen->InstallColormap = CMapInstallColormap; pScreen->StoreColors = CMapStoreColors; pScrn->LoadPalette = loadPalette; pScrn->SetOverscan = setOverscan; pScreenPriv->maxColors = maxColors; pScreenPriv->sigRGBbits = sigRGBbits; pScreenPriv->gammaElements = elements; pScreenPriv->gamma = gamma; pScreenPriv->PreAllocIndices = indices; pScreenPriv->maps = NULL; pScreenPriv->flags = flags; pScreenPriv->isDGAmode = FALSE; pScreenPriv->EnterVT = pScrn->EnterVT; pScreenPriv->SwitchMode = pScrn->SwitchMode; pScreenPriv->SetDGAMode = pScrn->SetDGAMode; pScreenPriv->ChangeGamma = pScrn->ChangeGamma; if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) { pScrn->EnterVT = CMapEnterVT; if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode) pScrn->SwitchMode = CMapSwitchMode; } #ifdef XFreeXDGA pScrn->SetDGAMode = CMapSetDGAMode; #endif pScrn->ChangeGamma = CMapChangeGamma; ComputeGamma(pScrn, pScreenPriv); /* get the default map */ dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap, RT_COLORMAP, serverClient, DixInstallAccess); if (!CMapAllocateColormapPrivate(pDefMap)) { CMapUnwrapScreen(pScreen); return FALSE; } if (xf86_crtc_supports_gamma(pScrn)) { pScrn->LoadPalette = xf86RandR12LoadPalette; if (!xf86RandR12InitGamma(pScrn, elements)) { CMapUnwrapScreen(pScreen); return FALSE; } } /* Force the initial map to be loaded */ SetInstalledmiColormap(pScreen, NULL); CMapInstallColormap(pDefMap); return TRUE; } /**** Screen functions ****/ static Bool CMapCloseScreen(ScreenPtr pScreen) { CMapUnwrapScreen(pScreen); return (*pScreen->CloseScreen) (pScreen); } static Bool CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv) { if (pVisual->nplanes > 16) return TRUE; return ((1 << pVisual->nplanes) > pScreenPriv->maxColors); } static Bool CMapAllocateColormapPrivate(ColormapPtr pmap) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates, CMapScreenKey); CMapColormapPtr pColPriv; CMapLinkPtr pLink; int numColors; LOCO *colors; if (CMapColormapUseMax(pmap->pVisual, pScreenPriv)) numColors = pmap->pVisual->ColormapEntries; else numColors = 1 << pmap->pVisual->nplanes; if (!(colors = xallocarray(numColors, sizeof(LOCO)))) return FALSE; if (!(pColPriv = malloc(sizeof(CMapColormapRec)))) { free(colors); return FALSE; } dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv); pColPriv->numColors = numColors; pColPriv->colors = colors; pColPriv->recalculate = TRUE; pColPriv->overscan = -1; /* add map to list */ pLink = malloc(sizeof(CMapLink)); if (pLink) { pLink->cmap = pmap; pLink->next = pScreenPriv->maps; pScreenPriv->maps = pLink; } return TRUE; } static Bool CMapCreateColormap(ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); Bool ret = FALSE; pScreen->CreateColormap = pScreenPriv->CreateColormap; if ((*pScreen->CreateColormap) (pmap)) { if (CMapAllocateColormapPrivate(pmap)) ret = TRUE; } pScreen->CreateColormap = CMapCreateColormap; return ret; } static void CMapDestroyColormap(ColormapPtr cmap) { ScreenPtr pScreen = cmap->pScreen; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&cmap->devPrivates, CMapColormapKey); CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps; if (pColPriv) { free(pColPriv->colors); free(pColPriv); } /* remove map from list */ while (pLink) { if (pLink->cmap == cmap) { if (prevLink) prevLink->next = pLink->next; else pScreenPriv->maps = pLink->next; free(pLink); break; } prevLink = pLink; pLink = pLink->next; } if (pScreenPriv->DestroyColormap) { pScreen->DestroyColormap = pScreenPriv->DestroyColormap; (*pScreen->DestroyColormap) (cmap); pScreen->DestroyColormap = CMapDestroyColormap; } } static void CMapStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs) { ScreenPtr pScreen = pmap->pScreen; VisualPtr pVisual = pmap->pVisual; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); int *indices = pScreenPriv->PreAllocIndices; int num = ndef; /* At the moment this isn't necessary since there's nobody below us */ pScreen->StoreColors = pScreenPriv->StoreColors; (*pScreen->StoreColors) (pmap, ndef, pdefs); pScreen->StoreColors = CMapStoreColors; /* should never get here for these */ if ((pVisual->class == TrueColor) || (pVisual->class == StaticColor) || (pVisual->class == StaticGray)) return; if (pVisual->class == DirectColor) { CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); int i; if (CMapColormapUseMax(pVisual, pScreenPriv)) { int index; num = 0; while (ndef--) { if (pdefs[ndef].flags & DoRed) { index = (pdefs[ndef].pixel & pVisual->redMask) >> pVisual->offsetRed; i = num; while (i--) if (indices[i] == index) break; if (i == -1) indices[num++] = index; } if (pdefs[ndef].flags & DoGreen) { index = (pdefs[ndef].pixel & pVisual->greenMask) >> pVisual->offsetGreen; i = num; while (i--) if (indices[i] == index) break; if (i == -1) indices[num++] = index; } if (pdefs[ndef].flags & DoBlue) { index = (pdefs[ndef].pixel & pVisual->blueMask) >> pVisual->offsetBlue; i = num; while (i--) if (indices[i] == index) break; if (i == -1) indices[num++] = index; } } } else { /* not really as overkill as it seems */ num = pColPriv->numColors; for (i = 0; i < pColPriv->numColors; i++) indices[i] = i; } } else { while (ndef--) indices[ndef] = pdefs[ndef].pixel; } CMapRefreshColors(pmap, num, indices); } static void CMapInstallColormap(ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); if (pmap == GetInstalledmiColormap(pmap->pScreen)) return; pScreen->InstallColormap = pScreenPriv->InstallColormap; (*pScreen->InstallColormap) (pmap); pScreen->InstallColormap = CMapInstallColormap; /* Important. We let the lower layers, namely DGA, overwrite the choice of Colormap to install */ if (GetInstalledmiColormap(pmap->pScreen)) pmap = GetInstalledmiColormap(pmap->pScreen); if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && (pmap->pVisual->class == TrueColor) && CMapColormapUseMax(pmap->pVisual, pScreenPriv)) return; if (LOAD_PALETTE(pmap)) CMapReinstallMap(pmap); } /**** ScrnInfoRec functions ****/ static Bool CMapEnterVT(ScrnInfoPtr pScrn) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); Bool ret; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); pScrn->EnterVT = pScreenPriv->EnterVT; ret = (*pScreenPriv->EnterVT) (pScrn); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = CMapEnterVT; if (ret) { if (GetInstalledmiColormap(pScreen)) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return TRUE; } return FALSE; } static Bool CMapSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); if ((*pScreenPriv->SwitchMode) (pScrn, mode)) { if (GetInstalledmiColormap(pScreen)) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return TRUE; } return FALSE; } #ifdef XFreeXDGA static int CMapSetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr dev) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); int ret; ret = (*pScreenPriv->SetDGAMode) (pScrn, num, dev); pScreenPriv->isDGAmode = DGAActive(pScrn->scrnIndex); if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen) && xf86ScreenToScrn(pScreen)->vtSema) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return ret; } #endif /**** Utilities ****/ static void CMapReinstallMap(ColormapPtr pmap) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates, CMapScreenKey); CMapColormapPtr cmapPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); int i = cmapPriv->numColors; int *indices = pScreenPriv->PreAllocIndices; while (i--) indices[i] = i; if (cmapPriv->recalculate) CMapRefreshColors(pmap, cmapPriv->numColors, indices); else { (*pScrn->LoadPalette) (pScrn, cmapPriv->numColors, indices, cmapPriv->colors, pmap->pVisual); if (pScrn->SetOverscan) { #ifdef DEBUGOVERSCAN ErrorF("SetOverscan() called from CMapReinstallMap\n"); #endif pScrn->SetOverscan(pScrn, cmapPriv->overscan); } } cmapPriv->recalculate = FALSE; } static void CMapRefreshColors(ColormapPtr pmap, int defs, int *indices) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates, CMapScreenKey); CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); VisualPtr pVisual = pmap->pVisual; ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); int numColors, i; LOCO *gamma, *colors; EntryPtr entry; int reds, greens, blues, maxValue, index, shift; numColors = pColPriv->numColors; shift = 16 - pScreenPriv->sigRGBbits; maxValue = (1 << pScreenPriv->sigRGBbits) - 1; gamma = pScreenPriv->gamma; colors = pColPriv->colors; reds = pVisual->redMask >> pVisual->offsetRed; greens = pVisual->greenMask >> pVisual->offsetGreen; blues = pVisual->blueMask >> pVisual->offsetBlue; switch (pVisual->class) { case StaticGray: for (i = 0; i < numColors; i++) { index = (i + 1) * maxValue / numColors; colors[i].red = gamma[index].red; colors[i].green = gamma[index].green; colors[i].blue = gamma[index].blue; } break; case TrueColor: if (CMapColormapUseMax(pVisual, pScreenPriv)) { for (i = 0; i <= reds; i++) colors[i].red = gamma[i * maxValue / reds].red; for (i = 0; i <= greens; i++) colors[i].green = gamma[i * maxValue / greens].green; for (i = 0; i <= blues; i++) colors[i].blue = gamma[i * maxValue / blues].blue; break; } for (i = 0; i < numColors; i++) { colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) * maxValue / reds].red; colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) * maxValue / greens].green; colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) * maxValue / blues].blue; } break; case StaticColor: case PseudoColor: case GrayScale: for (i = 0; i < defs; i++) { index = indices[i]; entry = (EntryPtr) &pmap->red[index]; if (entry->fShared) { colors[index].red = gamma[entry->co.shco.red->color >> shift].red; colors[index].green = gamma[entry->co.shco.green->color >> shift].green; colors[index].blue = gamma[entry->co.shco.blue->color >> shift].blue; } else { colors[index].red = gamma[entry->co.local.red >> shift].red; colors[index].green = gamma[entry->co.local.green >> shift].green; colors[index].blue = gamma[entry->co.local.blue >> shift].blue; } } break; case DirectColor: if (CMapColormapUseMax(pVisual, pScreenPriv)) { for (i = 0; i < defs; i++) { index = indices[i]; if (index <= reds) colors[index].red = gamma[pmap->red[index].co.local.red >> shift].red; if (index <= greens) colors[index].green = gamma[pmap->green[index].co.local.green >> shift].green; if (index <= blues) colors[index].blue = gamma[pmap->blue[index].co.local.blue >> shift].blue; } break; } for (i = 0; i < defs; i++) { index = indices[i]; colors[index].red = gamma[pmap->red[(index >> pVisual-> offsetRed) & reds].co.local. red >> shift].red; colors[index].green = gamma[pmap->green[(index >> pVisual->offsetGreen) & greens].co. local.green >> shift].green; colors[index].blue = gamma[pmap->blue[(index >> pVisual->offsetBlue) & blues].co. local.blue >> shift].blue; } break; } if (LOAD_PALETTE(pmap)) (*pScrn->LoadPalette) (pScrn, defs, indices, colors, pmap->pVisual); if (pScrn->SetOverscan) CMapSetOverscan(pmap, defs, indices); } static Bool CMapCompareColors(LOCO * color1, LOCO * color2) { /* return TRUE if the color1 is "closer" to black than color2 */ #ifdef DEBUGOVERSCAN ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n", color1->red, color1->green, color1->blue, color2->red, color2->green, color2->blue, color1->red + color1->green + color1->blue, color2->red + color2->green + color2->blue); #endif return (color1->red + color1->green + color1->blue < color2->red + color2->green + color2->blue); } static void CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates, CMapScreenKey); CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); VisualPtr pVisual = pmap->pVisual; int i; LOCO *colors; int index; Bool newOverscan = FALSE; int overscan, tmpOverscan; colors = pColPriv->colors; overscan = pColPriv->overscan; /* * Search for a new overscan index in the following cases: * * - The index hasn't yet been initialised.  In this case search * for an index that is black or a close match to black. * * - The colour of the old index is changed. In this case search * all indices for a black or close match to black. * * - The colour of the old index wasn't black. In this case only * search the indices that were changed for a better match to black. */ switch (pVisual->class) { case StaticGray: case TrueColor: /* Should only come here once. Initialise the overscan index to 0 */ overscan = 0; newOverscan = TRUE; break; case StaticColor: /* * Only come here once, but search for the overscan in the same way * as for the other cases. */ case DirectColor: case PseudoColor: case GrayScale: if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) { /* Uninitialised */ newOverscan = TRUE; } else { /* Check if the overscan was changed */ for (i = 0; i < defs; i++) { index = indices[i]; if (index == overscan) { newOverscan = TRUE; break; } } } if (newOverscan) { /* The overscan is either uninitialised or it has been changed */ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) tmpOverscan = pScreenPriv->maxColors - 1; else tmpOverscan = overscan; /* search all entries for a close match to black */ for (i = pScreenPriv->maxColors - 1; i >= 0; i--) { if (colors[i].red == 0 && colors[i].green == 0 && colors[i].blue == 0) { overscan = i; #ifdef DEBUGOVERSCAN ErrorF("Black found at index 0x%02x\n", i); #endif break; } else { #ifdef DEBUGOVERSCAN ErrorF("0x%02x: ", i); #endif if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) { tmpOverscan = i; #ifdef DEBUGOVERSCAN ErrorF("possible \"Black\" at index 0x%02x\n", i); #endif } } } if (i < 0) overscan = tmpOverscan; } else { /* Check of the old overscan wasn't black */ if (colors[overscan].red != 0 || colors[overscan].green != 0 || colors[overscan].blue != 0) { int oldOverscan = tmpOverscan = overscan; /* See of there is now a better match */ for (i = 0; i < defs; i++) { index = indices[i]; if (colors[index].red == 0 && colors[index].green == 0 && colors[index].blue == 0) { overscan = index; #ifdef DEBUGOVERSCAN ErrorF("Black found at index 0x%02x\n", index); #endif break; } else { #ifdef DEBUGOVERSCAN ErrorF("0x%02x: ", index); #endif if (CMapCompareColors(&colors[index], &colors[tmpOverscan])) { tmpOverscan = index; #ifdef DEBUGOVERSCAN ErrorF("possible \"Black\" at index 0x%02x\n", index); #endif } } } if (i == defs) overscan = tmpOverscan; if (overscan != oldOverscan) newOverscan = TRUE; } } break; } if (newOverscan) { pColPriv->overscan = overscan; if (LOAD_PALETTE(pmap)) { #ifdef DEBUGOVERSCAN ErrorF("SetOverscan() called from CmapSetOverscan\n"); #endif pScrn->SetOverscan(pScrn, overscan); } } } static void CMapUnwrapScreen(ScreenPtr pScreen) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateColormap = pScreenPriv->CreateColormap; pScreen->DestroyColormap = pScreenPriv->DestroyColormap; pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->StoreColors = pScreenPriv->StoreColors; pScrn->EnterVT = pScreenPriv->EnterVT; pScrn->SwitchMode = pScreenPriv->SwitchMode; pScrn->SetDGAMode = pScreenPriv->SetDGAMode; pScrn->ChangeGamma = pScreenPriv->ChangeGamma; free(pScreenPriv->gamma); free(pScreenPriv->PreAllocIndices); free(pScreenPriv); } static void ComputeGamma(ScrnInfoPtr pScrn, CMapScreenPtr priv) { int elements = priv->gammaElements - 1; double RedGamma, GreenGamma, BlueGamma; int i; #ifndef DONT_CHECK_GAMMA /* This check is to catch drivers that are not initialising pScrn->gamma */ if (pScrn->gamma.red < GAMMA_MIN || pScrn->gamma.red > GAMMA_MAX || pScrn->gamma.green < GAMMA_MIN || pScrn->gamma.green > GAMMA_MAX || pScrn->gamma.blue < GAMMA_MIN || pScrn->gamma.blue > GAMMA_MAX) { xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0, "The %s driver didn't call xf86SetGamma() to initialise\n" "\tthe gamma values.\n", pScrn->driverName); xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0, "PLEASE FIX THE `%s' DRIVER!\n", pScrn->driverName); pScrn->gamma.red = 1.0; pScrn->gamma.green = 1.0; pScrn->gamma.blue = 1.0; } #endif RedGamma = 1.0 / (double) pScrn->gamma.red; GreenGamma = 1.0 / (double) pScrn->gamma.green; BlueGamma = 1.0 / (double) pScrn->gamma.blue; for (i = 0; i <= elements; i++) { if (RedGamma == 1.0) priv->gamma[i].red = i; else priv->gamma[i].red = (CARD16) (pow((double) i / (double) elements, RedGamma) * (double) elements + 0.5); if (GreenGamma == 1.0) priv->gamma[i].green = i; else priv->gamma[i].green = (CARD16) (pow((double) i / (double) elements, GreenGamma) * (double) elements + 0.5); if (BlueGamma == 1.0) priv->gamma[i].blue = i; else priv->gamma[i].blue = (CARD16) (pow((double) i / (double) elements, BlueGamma) * (double) elements + 0.5); } } int CMapChangeGamma(ScrnInfoPtr pScrn, Gamma gamma) { int ret = Success; ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapColormapPtr pColPriv; CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; /* Is this sufficient checking ? */ if (!CMapScreenKeyRegistered) return BadImplementation; pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); if (!pScreenPriv) return BadImplementation; if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX || gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX || gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX) return BadValue; pScrn->gamma.red = gamma.red; pScrn->gamma.green = gamma.green; pScrn->gamma.blue = gamma.blue; ComputeGamma(pScrn, pScreenPriv); /* mark all colormaps on this screen */ pLink = pScreenPriv->maps; while (pLink) { pColPriv = (CMapColormapPtr) dixLookupPrivate(&pLink->cmap->devPrivates, CMapColormapKey); pColPriv->recalculate = TRUE; pLink = pLink->next; } if (GetInstalledmiColormap(pScreen) && ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || pScrn->vtSema || pScreenPriv->isDGAmode)) { ColormapPtr pMap = GetInstalledmiColormap(pScreen); if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && (pMap->pVisual->class == TrueColor) && CMapColormapUseMax(pMap->pVisual, pScreenPriv)) { /* if the current map doesn't have a palette look for another map to change the gamma on. */ pLink = pScreenPriv->maps; while (pLink) { if (pLink->cmap->pVisual->class == PseudoColor) break; pLink = pLink->next; } if (pLink) { /* need to trick CMapRefreshColors() into thinking this is the currently installed map */ SetInstalledmiColormap(pScreen, pLink->cmap); CMapReinstallMap(pLink->cmap); SetInstalledmiColormap(pScreen, pMap); } } else CMapReinstallMap(pMap); } pScrn->ChangeGamma = pScreenPriv->ChangeGamma; if (pScrn->ChangeGamma) ret = pScrn->ChangeGamma(pScrn, gamma); pScrn->ChangeGamma = CMapChangeGamma; return ret; } static void ComputeGammaRamp(CMapScreenPtr priv, unsigned short *red, unsigned short *green, unsigned short *blue) { int elements = priv->gammaElements; LOCO *entry = priv->gamma; int shift = 16 - priv->sigRGBbits; while (elements--) { entry->red = *(red++) >> shift; entry->green = *(green++) >> shift; entry->blue = *(blue++) >> shift; entry++; } } int xf86ChangeGammaRamp(ScreenPtr pScreen, int size, unsigned short *red, unsigned short *green, unsigned short *blue) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapColormapPtr pColPriv; CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; if (!CMapScreenKeyRegistered) return BadImplementation; pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); if (!pScreenPriv) return BadImplementation; if (pScreenPriv->gammaElements != size) return BadValue; ComputeGammaRamp(pScreenPriv, red, green, blue); /* mark all colormaps on this screen */ pLink = pScreenPriv->maps; while (pLink) { pColPriv = (CMapColormapPtr) dixLookupPrivate(&pLink->cmap->devPrivates, CMapColormapKey); pColPriv->recalculate = TRUE; pLink = pLink->next; } if (GetInstalledmiColormap(pScreen) && ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || pScrn->vtSema || pScreenPriv->isDGAmode)) { ColormapPtr pMap = GetInstalledmiColormap(pScreen); if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && (pMap->pVisual->class == TrueColor) && CMapColormapUseMax(pMap->pVisual, pScreenPriv)) { /* if the current map doesn't have a palette look for another map to change the gamma on. */ pLink = pScreenPriv->maps; while (pLink) { if (pLink->cmap->pVisual->class == PseudoColor) break; pLink = pLink->next; } if (pLink) { /* need to trick CMapRefreshColors() into thinking this is the currently installed map */ SetInstalledmiColormap(pScreen, pLink->cmap); CMapReinstallMap(pLink->cmap); SetInstalledmiColormap(pScreen, pMap); } } else CMapReinstallMap(pMap); } return Success; } int xf86GetGammaRampSize(ScreenPtr pScreen) { CMapScreenPtr pScreenPriv; if (!CMapScreenKeyRegistered) return 0; pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); if (!pScreenPriv) return 0; return pScreenPriv->gammaElements; } int xf86GetGammaRamp(ScreenPtr pScreen, int size, unsigned short *red, unsigned short *green, unsigned short *blue) { CMapScreenPtr pScreenPriv; LOCO *entry; int shift, sigbits; if (!CMapScreenKeyRegistered) return BadImplementation; pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); if (!pScreenPriv) return BadImplementation; if (size > pScreenPriv->gammaElements) return BadValue; entry = pScreenPriv->gamma; sigbits = pScreenPriv->sigRGBbits; while (size--) { *red = entry->red << (16 - sigbits); *green = entry->green << (16 - sigbits); *blue = entry->blue << (16 - sigbits); shift = sigbits; while (shift < 16) { *red |= *red >> shift; *green |= *green >> shift; *blue |= *blue >> shift; shift += sigbits; } red++; green++; blue++; entry++; } return Success; } int xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->ChangeGamma) return (*pScrn->ChangeGamma) (pScrn, gamma); return BadImplementation; } xorg-server-1.20.8/hw/xfree86/common/xf86Module.h0000644000175000017500000001643013640201473016321 00000000000000/* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the parts of the loader interface that are visible * to modules. This is the only loader-related header that modules should * include. * * It should include a bare minimum of other headers. * * Longer term, the module/loader code should probably live directly under * Xserver/. * * XXX This file arguably belongs in xfree86/loader/. */ #ifndef _XF86MODULE_H #define _XF86MODULE_H #include #include #include #ifndef NULL #define NULL ((void *)0) #endif #define DEFAULT_LIST ((char *)-1) /* Built-in ABI classes. These definitions must not be changed. */ #define ABI_CLASS_NONE NULL #define ABI_CLASS_ANSIC "X.Org ANSI C Emulation" #define ABI_CLASS_VIDEODRV "X.Org Video Driver" #define ABI_CLASS_XINPUT "X.Org XInput driver" #define ABI_CLASS_EXTENSION "X.Org Server Extension" #define ABI_MINOR_MASK 0x0000FFFF #define ABI_MAJOR_MASK 0xFFFF0000 #define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK) #define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16) #define SET_ABI_VERSION(maj, min) \ ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK)) /* * ABI versions. Each version has a major and minor revision. Modules * using lower minor revisions must work with servers of a higher minor * revision. There is no compatibility between different major revisions. * Whenever the ABI_ANSIC_VERSION is changed, the others must also be * changed. The minor revision mask is 0x0000FFFF and the major revision * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(24, 1) #define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 1) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(10, 0) #define MODINFOSTRING1 0xef23fdc5 #define MODINFOSTRING2 0x10dc023a #ifndef MODULEVENDORSTRING #define MODULEVENDORSTRING "X.Org Foundation" #endif /* Error return codes for errmaj */ typedef enum { LDR_NOERROR = 0, LDR_NOMEM, /* memory allocation failed */ LDR_NOENT, /* Module file does not exist */ LDR_NOLOAD, /* type specific loader failed */ LDR_ONCEONLY, /* Module should only be loaded once (not an error) */ LDR_MISMATCH, /* the module didn't match the spec'd requirments */ LDR_BADUSAGE, /* LoadModule is called with bad arguments */ LDR_INVALID, /* The module doesn't have a valid ModuleData object */ LDR_BADOS, /* The module doesn't support the OS */ LDR_MODSPECIFIC /* A module-specific error in the SetupProc */ } LoaderErrorCode; /* * Some common module classes. The moduleclass can be used to identify * that modules loaded are of the correct type. This is a finer * classification than the ABI classes even though the default set of * classes have the same names. For example, not all modules that require * the video driver ABI are themselves video drivers. */ #define MOD_CLASS_NONE NULL #define MOD_CLASS_VIDEODRV "X.Org Video Driver" #define MOD_CLASS_XINPUT "X.Org XInput Driver" #define MOD_CLASS_EXTENSION "X.Org Server Extension" /* This structure is expected to be returned by the initfunc */ typedef struct { const char *modname; /* name of module, e.g. "foo" */ const char *vendor; /* vendor specific string */ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */ CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */ CARD8 majorversion; /* module-specific major version */ CARD8 minorversion; /* module-specific minor version */ CARD16 patchlevel; /* module-specific patch level */ const char *abiclass; /* ABI class that the module uses */ CARD32 abiversion; /* ABI version */ const char *moduleclass; /* module class description */ CARD32 checksum[4]; /* contains a digital signature of the */ /* version info structure */ } XF86ModuleVersionInfo; /* * This structure can be used to callers of LoadModule and LoadSubModule to * specify version and/or ABI requirements. */ typedef struct { CARD8 majorversion; /* module-specific major version */ CARD8 minorversion; /* moudle-specific minor version */ CARD16 patchlevel; /* module-specific patch level */ const char *abiclass; /* ABI class that the module uses */ CARD32 abiversion; /* ABI version */ const char *moduleclass; /* module class */ } XF86ModReqInfo; #define MODULE_VERSION_NUMERIC(maj, min, patch) \ ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) #define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) #define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF) #define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF) #define INITARGS void /* Prototypes for Loader functions that are exported to modules */ extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **, const char **, void *, const XF86ModReqInfo *, int *, int *); extern _X_EXPORT void UnloadSubModule(void *); extern _X_EXPORT void UnloadModule(void *); extern _X_EXPORT void *LoaderSymbol(const char *); extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int); extern _X_EXPORT Bool LoaderShouldIgnoreABI(void); extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass); typedef void *(*ModuleSetupProc) (void *, void *, int *, int *); typedef void (*ModuleTearDownProc) (void *); #define MODULESETUPPROTO(func) void *func(void *, void *, int*, int*) #define MODULETEARDOWNPROTO(func) void func(void *) typedef struct { XF86ModuleVersionInfo *vers; ModuleSetupProc setup; ModuleTearDownProc teardown; } XF86ModuleData; #endif /* _XF86STR_H */ xorg-server-1.20.8/hw/xfree86/common/xf86Build.sh0000755000175000017500000000107613640201473016321 00000000000000DATE_FMT="%Y%m%d" TIME_FMT="1%H%M%S" BUILD_DATE="`date "+$DATE_FMT"`" BUILD_TIME="`date "+$TIME_FMT"`" if test "x$SOURCE_DATE_EPOCH" != "x"; then BUILD_DATE="`date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT"`" BUILD_TIME="`date -u -d "@$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u "+$TIME_FMT"`" fi output=$1 echo "#define BUILD_DATE $BUILD_DATE" > $output echo "#define BUILD_TIME $BUILD_TIME" >> $output xorg-server-1.20.8/hw/xfree86/common/xf86Build.h.in0000644000175000017500000000010013640201473016523 00000000000000#define BUILD_DATE @BUILD_DATE@ #define BUILD_TIME @BUILD_TIME@ xorg-server-1.20.8/hw/xfree86/common/modeline2c.awk0000644000175000017500000000656713640201473016746 00000000000000#!/usr/bin/awk -f # # Copyright (c) 2007 Joerg Sonnenberger . # All rights reserved. # # Based on Perl script by Dirk Hohndel. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # Usage: modeline2c.awk < modefile > xf86DefModeSet.c # BEGIN { flagsdict[""] = "0" flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC" flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC" flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC" flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC" flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE" flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE" flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE" flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE" print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at" print " * modeline2c.awk */" print "" print "/*" print " * Author: Joerg Sonnenberger " print " * Based on Perl script from Dirk Hohndel " print " */" print "" print "#ifdef HAVE_XORG_CONFIG_H" print "#include " print "#endif" print "" print "#include \"xf86.h\"" print "#include \"xf86Config.h\"" print "#include \"xf86Priv.h\"" print "#include \"xf86_OSlib.h\"" print "" print "#include \"globals.h\"" print "" print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT" print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0" print "" print "const DisplayModeRec xf86DefaultModes [] = {" modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n" modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+" } /^[mM][oO][dD][eE][lL][iI][nN][eE]/ { flags = $0 gsub(modeline_data, "", flags) flags = tolower(flags) printf(modeline, $3 * 1000, $4, $5, $6, $7, $8, $9, $10, $11, flagsdict[flags]) # Half-width double scanned modes printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2, $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN") } /^#/ { print "/*" substr($0, 2) " */" } END { print "};" printf "const int xf86NumDefaultModes = ARRAY_SIZE(xf86DefaultModes);" } xorg-server-1.20.8/hw/xfree86/common/xf86Config.h0000644000175000017500000000450013640201473016274 00000000000000 /* * Copyright (c) 1997-2000 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _xf86_config_h #define _xf86_config_h #include "xf86Optrec.h" #include "xf86Parser.h" #include "xf86str.h" #ifdef HAVE_PARSER_DECLS /* * global structure that holds the result of parsing the config file */ extern _X_EXPORT XF86ConfigPtr xf86configptr; #endif typedef enum _ConfigStatus { CONFIG_OK = 0, CONFIG_PARSE_ERROR, CONFIG_NOFILE } ConfigStatus; typedef struct _ModuleDefault { const char *name; Bool toLoad; XF86OptionPtr load_opt; } ModuleDefault; /* * prototypes */ const char **xf86ModulelistFromConfig(void ***); const char **xf86DriverlistFromConfig(void); const char **xf86InputDriverlistFromConfig(void); Bool xf86BuiltinInputDriver(const char *); ConfigStatus xf86HandleConfigFile(Bool); Bool xf86AutoConfig(void); GDevPtr autoConfigDevice(GDevPtr preconf_device); #endif /* _xf86_config_h */ xorg-server-1.20.8/hw/xfree86/common/xf86cmap.h0000644000175000017500000000520313640201473016010 00000000000000 /* * Copyright (c) 1998-2001 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). */ #ifndef _XF86CMAP_H #define _XF86CMAP_H #include "xf86str.h" #include "colormapst.h" #define CMAP_PALETTED_TRUECOLOR 0x0000001 #define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002 #define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004 extern _X_EXPORT Bool xf86HandleColormaps(ScreenPtr pScreen, int maxCol, int sigRGBbits, xf86LoadPaletteProc * loadPalette, xf86SetOverscanProc * setOverscan, unsigned int flags); extern _X_EXPORT Bool xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86ChangeGamma(ScreenPtr pScreen, Gamma newGamma); extern _X_EXPORT int xf86ChangeGammaRamp(ScreenPtr pScreen, int size, unsigned short *red, unsigned short *green, unsigned short *blue); extern _X_EXPORT int xf86GetGammaRampSize(ScreenPtr pScreen); extern _X_EXPORT int xf86GetGammaRamp(ScreenPtr pScreen, int size, unsigned short *red, unsigned short *green, unsigned short *blue); #endif /* _XF86CMAP_H */ xorg-server-1.20.8/hw/xfree86/common/xf86pciBus.h0000644000175000017500000000471213640201473016321 00000000000000 /* * Copyright (c) 1999-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _XF86_PCI_BUS_H #define _XF86_PCI_BUS_H #include "xf86MatchDrivers.h" void xf86PciProbe(void); Bool xf86PciAddMatchingDev(DriverPtr drvp); Bool xf86PciProbeDev(DriverPtr drvp); void xf86PciIsolateDevice(const char *argument); void xf86PciMatchDriver(XF86MatchedDrivers *md); Bool xf86PciConfigure(void *busData, struct pci_device *pDev); void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, GDevRec * GDev, int *chipset); #define MATCH_PCI_DEVICES(x, y) (((x)->domain == (y)->domain) && \ ((x)->bus == (y)->bus) && \ ((x)->func == (y)->func) && \ ((x)->dev == (y)->dev)) void xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip, XF86MatchedDrivers *md); void xf86VideoPtrToDriverList(struct pci_device *dev, XF86MatchedDrivers *md); #endif /* _XF86_PCI_BUS_H */ xorg-server-1.20.8/hw/xfree86/common/xf86platformBus.h0000644000175000017500000001347313640201473017376 00000000000000/* * Copyright © 2012 Red Hat. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Author: Dave Airlie */ #ifndef XF86_PLATFORM_BUS_H #define XF86_PLATFORM_BUS_H #include "hotplug.h" #include "xf86MatchDrivers.h" struct xf86_platform_device { struct OdevAttributes *attribs; /* for PCI devices */ struct pci_device *pdev; int flags; }; /* xf86_platform_device flags */ #define XF86_PDEV_UNOWNED 0x01 #define XF86_PDEV_SERVER_FD 0x02 #define XF86_PDEV_PAUSED 0x04 #ifdef XSERVER_PLATFORM_BUS int xf86platformProbe(void); int xf86platformProbeDev(DriverPtr drvp); int xf86platformAddGPUDevices(DriverPtr drvp); void xf86MergeOutputClassOptions(int entityIndex, void **options); extern int xf86_num_platform_devices; extern struct xf86_platform_device *xf86_platform_devices; extern int xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned); extern int xf86_remove_platform_device(int dev_index); extern Bool xf86_get_platform_device_unowned(int index); extern int xf86platformAddDevice(int index); extern void xf86platformRemoveDevice(int index); static inline struct OdevAttributes * xf86_platform_device_odev_attributes(struct xf86_platform_device *device) { return device->attribs; } static inline struct OdevAttributes * xf86_platform_odev_attributes(int index) { struct xf86_platform_device *device = &xf86_platform_devices[index]; return device->attribs; } #ifndef _XORG_CONFIG_H_ /* * Define the legacy API only for external builds */ /* path to kernel device node - Linux e.g. /dev/dri/card0 */ #define ODEV_ATTRIB_PATH 1 /* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */ #define ODEV_ATTRIB_SYSPATH 2 /* DRI-style bus id */ #define ODEV_ATTRIB_BUSID 3 /* Server managed FD */ #define ODEV_ATTRIB_FD 4 /* Major number of the device node pointed to by ODEV_ATTRIB_PATH */ #define ODEV_ATTRIB_MAJOR 5 /* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */ #define ODEV_ATTRIB_MINOR 6 /* kernel driver name */ #define ODEV_ATTRIB_DRIVER 7 /* Protect against a mismatch attribute type by generating a compiler * error using a negative array size when an incorrect attribute is * passed */ #define _ODEV_ATTRIB_IS_STRING(x) ((x) == ODEV_ATTRIB_PATH || \ (x) == ODEV_ATTRIB_SYSPATH || \ (x) == ODEV_ATTRIB_BUSID || \ (x) == ODEV_ATTRIB_DRIVER) #define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0) static inline char * _xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]) { switch (attrib) { case ODEV_ATTRIB_PATH: return xf86_platform_device_odev_attributes(device)->path; case ODEV_ATTRIB_SYSPATH: return xf86_platform_device_odev_attributes(device)->syspath; case ODEV_ATTRIB_BUSID: return xf86_platform_device_odev_attributes(device)->busid; case ODEV_ATTRIB_DRIVER: return xf86_platform_device_odev_attributes(device)->driver; default: assert(FALSE); return NULL; } } #define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib)) #define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR) #define _ODEV_ATTRIB_INT_DEFAULT(x) ((x) == ODEV_ATTRIB_FD ? -1 : 0) #define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def)) #define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0) static inline int _xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]) { switch (attrib) { case ODEV_ATTRIB_FD: return xf86_platform_device_odev_attributes(device)->fd; case ODEV_ATTRIB_MAJOR: return xf86_platform_device_odev_attributes(device)->major; case ODEV_ATTRIB_MINOR: return xf86_platform_device_odev_attributes(device)->minor; default: assert(FALSE); return 0; } } #define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def)) #endif extern _X_EXPORT Bool xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid); extern _X_EXPORT void xf86PlatformMatchDriver(XF86MatchedDrivers *); extern void xf86platformVTProbe(void); extern void xf86platformPrimary(void); #else static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; } static inline void xf86MergeOutputClassOptions(int index, void **options) {} #endif #endif xorg-server-1.20.8/hw/xfree86/common/xf86Config.c0000644000175000017500000023306313640201473016277 00000000000000/* * Loosely based on code bearing the following copyright: * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. */ /* * Copyright 1992-2003 by The XFree86 Project, Inc. * Copyright 1997 by Metro Link, 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 * David Dawes * Marc La France * Egbert Eich * ... and others */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86Modes.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "xf86Config.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "configProcs.h" #include "globals.h" #include "extension.h" #include "xf86pciBus.h" #include "xf86Xinput.h" #include "loaderProcs.h" #include "xkbsrv.h" #include "picture.h" #ifdef DPMSExtension #include "dpmsproc.h" #endif /* * These paths define the way the config file search is done. The escape * sequences are documented in parser/scan.c. */ #ifndef ALL_CONFIGPATH #define ALL_CONFIGPATH "%A," "%R," \ "/etc/X11/%R," "%P/etc/X11/%R," \ "%E," "%F," \ "/etc/X11/%F," "%P/etc/X11/%F," \ "/etc/X11/%X," "/etc/%X," \ "%P/etc/X11/%X.%H," \ "%P/etc/X11/%X," \ "%P/lib/X11/%X.%H," \ "%P/lib/X11/%X" #endif #ifndef RESTRICTED_CONFIGPATH #define RESTRICTED_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \ "/etc/X11/%G," "%P/etc/X11/%G," \ "/etc/X11/%X," "/etc/%X," \ "%P/etc/X11/%X.%H," \ "%P/etc/X11/%X," \ "%P/lib/X11/%X.%H," \ "%P/lib/X11/%X" #endif #ifndef ALL_CONFIGDIRPATH #define ALL_CONFIGDIRPATH "%A," "%R," \ "/etc/X11/%R," "%C/X11/%R," \ "/etc/X11/%X," "%C/X11/%X" #endif #ifndef RESTRICTED_CONFIGDIRPATH #define RESTRICTED_CONFIGDIRPATH "/etc/X11/%R," "%C/X11/%R," \ "/etc/X11/%X," "%C/X11/%X" #endif #ifndef SYS_CONFIGDIRPATH #define SYS_CONFIGDIRPATH "%D/X11/%X" #endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif static ModuleDefault ModuleDefaults[] = { #ifdef GLXEXT {.name = "glx",.toLoad = TRUE,.load_opt = NULL}, #endif #ifdef __CYGWIN__ /* load DIX modules used by drivers first */ {.name = "fb",.toLoad = TRUE,.load_opt = NULL}, {.name = "shadow",.toLoad = TRUE,.load_opt = NULL}, #endif {.name = NULL,.toLoad = FALSE,.load_opt = NULL} }; /* Forward declarations */ static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, MessageType from, Bool auto_gpu_device); static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor); static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active, Bool gpu); static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input, MessageType from); static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display); static Bool addDefaultModes(MonPtr monitorp); static void configDRI(XF86ConfDRIPtr drip); static void configExtensions(XF86ConfExtensionsPtr conf_ext); /* * xf86GetPathElem -- * Extract a single element from the font path string starting at * pnt. The font path element will be returned, and pnt will be * updated to point to the start of the next element, or set to * NULL if there are no more. */ static char * xf86GetPathElem(char **pnt) { char *p1; p1 = *pnt; *pnt = index(*pnt, ','); if (*pnt != NULL) { **pnt = '\0'; *pnt += 1; } return p1; } /* * xf86ValidateFontPath -- * Validates the user-specified font path. Each element that * begins with a '/' is checked to make sure the directory exists. * If the directory exists, the existence of a file named 'fonts.dir' * is checked. If either check fails, an error is printed and the * element is removed from the font path. */ #define DIR_FILE "/fonts.dir" static char * xf86ValidateFontPath(char *path) { char *next, *tmp_path, *out_pnt, *path_elem, *p1, *dir_elem; struct stat stat_buf; int flag; int dirlen; tmp_path = calloc(1, strlen(path) + 1); out_pnt = tmp_path; path_elem = NULL; next = path; while (next != NULL) { path_elem = xf86GetPathElem(&next); if (*path_elem == '/') { dir_elem = xnfcalloc(1, strlen(path_elem) + 1); if ((p1 = strchr(path_elem, ':')) != 0) dirlen = p1 - path_elem; else dirlen = strlen(path_elem); strlcpy(dir_elem, path_elem, dirlen + 1); flag = stat(dir_elem, &stat_buf); if (flag == 0) if (!S_ISDIR(stat_buf.st_mode)) flag = -1; if (flag != 0) { xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem); xf86ErrorF("\tEntry deleted from font path.\n"); free(dir_elem); continue; } else { XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE); flag = stat(p1, &stat_buf); if (flag == 0) if (!S_ISREG(stat_buf.st_mode)) flag = -1; free(p1); if (flag != 0) { xf86Msg(X_WARNING, "`fonts.dir' not found (or not valid) in \"%s\".\n", dir_elem); xf86ErrorF("\tEntry deleted from font path.\n"); xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem); free(dir_elem); continue; } } free(dir_elem); } /* * Either an OK directory, or a font server name. So add it to * the path. */ if (out_pnt != tmp_path) *out_pnt++ = ','; strcat(out_pnt, path_elem); out_pnt += strlen(path_elem); } return tmp_path; } #define FIND_SUITABLE(pointertype, listhead, ptr) \ do { \ pointertype _l, _p; \ \ for (_l = (listhead), _p = NULL; !_p && _l; _l = (pointertype)_l->list.next) { \ if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) \ _p = _l; \ } \ \ (ptr) = _p; \ } while(0) /* * use the datastructure that the parser provides and pick out the parts * that we need at this point */ const char ** xf86ModulelistFromConfig(void ***optlist) { int count = 0, i = 0; const char **modulearray; const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm", "freetype", "type1", NULL }; void **optarray; XF86LoadPtr modp; Bool found; /* * make sure the config file has been parsed and that we have a * ModulePath set; if no ModulePath was given, use the default * ModulePath */ if (xf86configptr == NULL) { xf86Msg(X_ERROR, "Cannot access global config data structure\n"); return NULL; } if (xf86configptr->conf_modules) { /* Walk the disable list and let people know what we've parsed to * not be loaded */ modp = xf86configptr->conf_modules->mod_disable_lst; while (modp) { xf86Msg(X_WARNING, "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n", modp->load_name); modp = (XF86LoadPtr) modp->list.next; } /* * Walk the default settings table. For each module listed to be * loaded, make sure it's in the mod_load_lst. If it's not, make * sure it's not in the mod_no_load_lst. If it's not disabled, * append it to mod_load_lst */ for (i = 0; ModuleDefaults[i].name != NULL; i++) { if (ModuleDefaults[i].toLoad == FALSE) { xf86Msg(X_WARNING, "\"%s\" is not to be loaded by default. Skipping.\n", ModuleDefaults[i].name); continue; } found = FALSE; modp = xf86configptr->conf_modules->mod_load_lst; while (modp) { if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) { xf86Msg(X_INFO, "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n", ModuleDefaults[i].name); found = TRUE; break; } modp = (XF86LoadPtr) modp->list.next; } if (found == FALSE) { modp = xf86configptr->conf_modules->mod_disable_lst; while (modp) { if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) { xf86Msg(X_INFO, "\"%s\" will be loaded even though the default is to disable it.\n", ModuleDefaults[i].name); found = TRUE; break; } modp = (XF86LoadPtr) modp->list.next; } } if (found == FALSE) { XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules; xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt); xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name); } } } else { xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec)); for (i = 0; ModuleDefaults[i].name != NULL; i++) { if (ModuleDefaults[i].toLoad == TRUE) { XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules; xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt); } } } /* * Walk the list of modules in the "Module" section to determine how * many we have. */ modp = xf86configptr->conf_modules->mod_load_lst; while (modp) { for (i = 0; ignore[i]; i++) { if (strcmp(modp->load_name, ignore[i]) == 0) modp->ignore = 1; } if (!modp->ignore) count++; modp = (XF86LoadPtr) modp->list.next; } /* * allocate the memory and walk the list again to fill in the pointers */ modulearray = xnfallocarray(count + 1, sizeof(char *)); optarray = xnfallocarray(count + 1, sizeof(void *)); count = 0; if (xf86configptr->conf_modules) { modp = xf86configptr->conf_modules->mod_load_lst; while (modp) { if (!modp->ignore) { modulearray[count] = modp->load_name; optarray[count] = modp->load_opt; count++; } modp = (XF86LoadPtr) modp->list.next; } } modulearray[count] = NULL; optarray[count] = NULL; if (optlist) *optlist = optarray; else free(optarray); return modulearray; } const char ** xf86DriverlistFromConfig(void) { int count = 0; int j, k; const char **modulearray; screenLayoutPtr slp; /* * make sure the config file has been parsed and that we have a * ModulePath set; if no ModulePath was given, use the default * ModulePath */ if (xf86configptr == NULL) { xf86Msg(X_ERROR, "Cannot access global config data structure\n"); return NULL; } /* * Walk the list of driver lines in active "Device" sections to * determine now many implicitly loaded modules there are. * */ if (xf86ConfigLayout.screens) { slp = xf86ConfigLayout.screens; while (slp->screen) { count++; count += slp->screen->num_gpu_devices; slp++; } } /* * Handle the set of inactive "Device" sections. */ j = 0; while (xf86ConfigLayout.inactives[j++].identifier) count++; if (count == 0) return NULL; /* * allocate the memory and walk the list again to fill in the pointers */ modulearray = xnfallocarray(count + 1, sizeof(char *)); count = 0; slp = xf86ConfigLayout.screens; while (slp->screen) { modulearray[count] = slp->screen->device->driver; count++; for (k = 0; k < slp->screen->num_gpu_devices; k++) { modulearray[count] = slp->screen->gpu_devices[k]->driver; count++; } slp++; } j = 0; while (xf86ConfigLayout.inactives[j].identifier) modulearray[count++] = xf86ConfigLayout.inactives[j++].driver; modulearray[count] = NULL; /* Remove duplicates */ for (count = 0; modulearray[count] != NULL; count++) { int i; for (i = 0; i < count; i++) if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) { modulearray[count] = ""; break; } } return modulearray; } const char ** xf86InputDriverlistFromConfig(void) { int count = 0; const char **modulearray; InputInfoPtr *idp; /* * make sure the config file has been parsed and that we have a * ModulePath set; if no ModulePath was given, use the default * ModulePath */ if (xf86configptr == NULL) { xf86Msg(X_ERROR, "Cannot access global config data structure\n"); return NULL; } /* * Walk the list of driver lines in active "InputDevice" sections to * determine now many implicitly loaded modules there are. */ if (xf86ConfigLayout.inputs) { idp = xf86ConfigLayout.inputs; while (*idp) { count++; idp++; } } if (count == 0) return NULL; /* * allocate the memory and walk the list again to fill in the pointers */ modulearray = xnfallocarray(count + 1, sizeof(char *)); count = 0; idp = xf86ConfigLayout.inputs; while (idp && *idp) { modulearray[count] = (*idp)->driver; count++; idp++; } modulearray[count] = NULL; /* Remove duplicates */ for (count = 0; modulearray[count] != NULL; count++) { int i; for (i = 0; i < count; i++) if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) { modulearray[count] = ""; break; } } return modulearray; } static void configFiles(XF86ConfFilesPtr fileconf) { MessageType pathFrom; Bool must_copy; int size, countDirs; char *temp_path, *log_buf, *start, *end; /* FontPath */ must_copy = TRUE; temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; if (xf86fpFlag) pathFrom = X_CMDLINE; else if (fileconf && fileconf->file_fontpath) { pathFrom = X_CONFIG; if (xf86Info.useDefaultFontPath) { char *new_font_path; if (asprintf(&new_font_path, "%s%s%s", fileconf->file_fontpath, *temp_path ? "," : "", temp_path) == -1) new_font_path = NULL; else must_copy = FALSE; defaultFontPath = new_font_path; } else defaultFontPath = fileconf->file_fontpath; } else pathFrom = X_DEFAULT; temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ temp_path = must_copy ? xnfstrdup(defaultFontPath) : (char *) defaultFontPath; defaultFontPath = xf86ValidateFontPath(temp_path); free(temp_path); /* make fontpath more readable in the logfiles */ countDirs = 1; temp_path = (char *) defaultFontPath; while ((temp_path = index(temp_path, ',')) != NULL) { countDirs++; temp_path++; } log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1); temp_path = log_buf; start = (char *) defaultFontPath; while ((end = index(start, ',')) != NULL) { size = (end - start) + 1; *(temp_path++) = '\t'; strncpy(temp_path, start, size); temp_path += size; *(temp_path++) = '\n'; start += size; } /* copy last entry */ *(temp_path++) = '\t'; strcpy(temp_path, start); xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf); free(log_buf); /* ModulePath */ if (fileconf) { if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { xf86ModulePath = fileconf->file_modulepath; xf86ModPathFrom = X_CONFIG; } } xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath); if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) { XkbBaseDirectory = fileconf->file_xkbdir; xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n", XkbBaseDirectory); } #if 0 /* LogFile */ /* * XXX The problem with this is that the log file is already open. * One option might be to copy the exiting contents to the new location. * and re-open it. The down side is that the default location would * already have been overwritten. Another option would be to start with * unique temporary location, then copy it once the correct name is known. * A problem with this is what happens if the server exits before that * happens. */ if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) { xf86LogFile = fileconf->file_logfile; xf86LogFileFrom = X_CONFIG; } #endif return; } typedef enum { FLAG_NOTRAPSIGNALS, FLAG_DONTVTSWITCH, FLAG_DONTZAP, FLAG_DONTZOOM, FLAG_DISABLEVIDMODE, FLAG_ALLOWNONLOCAL, FLAG_ALLOWMOUSEOPENFAIL, FLAG_SAVER_BLANKTIME, FLAG_DPMS_STANDBYTIME, FLAG_DPMS_SUSPENDTIME, FLAG_DPMS_OFFTIME, FLAG_NOPM, FLAG_XINERAMA, FLAG_LOG, FLAG_RENDER_COLORMAP_MODE, FLAG_IGNORE_ABI, FLAG_ALLOW_EMPTY_INPUT, FLAG_USE_DEFAULT_FONT_PATH, FLAG_AUTO_ADD_DEVICES, FLAG_AUTO_ENABLE_DEVICES, FLAG_GLX_VISUALS, FLAG_DRI2, FLAG_USE_SIGIO, FLAG_AUTO_ADD_GPU, FLAG_MAX_CLIENTS, FLAG_IGLX, FLAG_DEBUG, } FlagValues; /** * NOTE: the last value for each entry is NOT the default. It is set to TRUE * if the parser found the option in the config file. */ static OptionInfoRec FlagOptions[] = { {FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_SAVER_BLANKTIME, "BlankTime", OPTV_INTEGER, {0}, FALSE}, {FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER, {0}, FALSE}, {FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER, {0}, FALSE}, {FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER, {0}, FALSE}, {FLAG_NOPM, "NoPM", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_LOG, "Log", OPTV_STRING, {0}, FALSE}, {FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING, {0}, FALSE}, {FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING, {0}, FALSE}, {FLAG_DRI2, "DRI2", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER, {0}, FALSE }, {FLAG_IGLX, "IndirectGLX", OPTV_BOOLEAN, {0}, FALSE}, {FLAG_DEBUG, "Debug", OPTV_STRING, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; static void configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) { XF86OptionPtr optp, tmp; int i; Bool value; MessageType from; const char *s; XkbRMLVOSet set; const char *rules; /* * Merge the ServerLayout and ServerFlags options. The former have * precedence over the latter. */ optp = NULL; if (flagsconf && flagsconf->flg_option_lst) optp = xf86optionListDup(flagsconf->flg_option_lst); if (layoutopts) { tmp = xf86optionListDup(layoutopts); if (optp) optp = xf86optionListMerge(optp, tmp); else optp = tmp; } xf86ProcessOptions(-1, optp, FlagOptions); xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals); xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch); xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI); if (xf86Info.ignoreABI) { xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); } if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) { xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES, &xf86Info.autoAddDevices); from = X_CONFIG; } else { from = X_DEFAULT; } xf86Msg(from, "%sutomatically adding devices\n", xf86Info.autoAddDevices ? "A" : "Not a"); if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ENABLE_DEVICES)) { xf86GetOptValBool(FlagOptions, FLAG_AUTO_ENABLE_DEVICES, &xf86Info.autoEnableDevices); from = X_CONFIG; } else { from = X_DEFAULT; } xf86Msg(from, "%sutomatically enabling devices\n", xf86Info.autoEnableDevices ? "A" : "Not a"); if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_GPU)) { xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_GPU, &xf86Info.autoAddGPU); from = X_CONFIG; } else { from = X_DEFAULT; } xf86Msg(from, "%sutomatically adding GPU devices\n", xf86Info.autoAddGPU ? "A" : "Not a"); /* * Set things up based on the config file information. Some of these * settings may be overridden later when the command line options are * checked. */ #ifdef XF86VIDMODE if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value)) xf86Info.vidModeEnabled = !value; if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value)) xf86Info.vidModeAllowNonLocal = value; #endif if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value)) xf86Info.allowMouseOpenFail = value; xf86Info.pmFlag = TRUE; if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) xf86Info.pmFlag = !value; { if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) { if (!xf86NameCmp(s, "flush")) { xf86Msg(X_CONFIG, "Flushing logfile enabled\n"); LogSetParameter(XLOG_FLUSH, TRUE); } else if (!xf86NameCmp(s, "sync")) { xf86Msg(X_CONFIG, "Syncing logfile enabled\n"); LogSetParameter(XLOG_FLUSH, TRUE); LogSetParameter(XLOG_SYNC, TRUE); } else { xf86Msg(X_WARNING, "Unknown Log option\n"); } } } { if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))) { int policy = PictureParseCmapPolicy(s); if (policy == PictureCmapPolicyInvalid) xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s); else { xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s); PictureCmapPolicy = policy; } } } #ifdef GLXEXT xf86Info.glxVisuals = XF86_GlxVisualsTypical; xf86Info.glxVisualsFrom = X_DEFAULT; if ((s = xf86GetOptValString(FlagOptions, FLAG_GLX_VISUALS))) { if (!xf86NameCmp(s, "minimal")) { xf86Info.glxVisuals = XF86_GlxVisualsMinimal; } else if (!xf86NameCmp(s, "typical")) { xf86Info.glxVisuals = XF86_GlxVisualsTypical; } else if (!xf86NameCmp(s, "all")) { xf86Info.glxVisuals = XF86_GlxVisualsAll; } else { xf86Msg(X_WARNING, "Unknown GlxVisuals option\n"); } } if (xf86Info.iglxFrom != X_CMDLINE) { if (xf86GetOptValBool(FlagOptions, FLAG_IGLX, &value)) { enableIndirectGLX = value; xf86Info.iglxFrom = X_CONFIG; } } #endif xf86Info.debug = xf86GetOptValString(FlagOptions, FLAG_DEBUG); /* if we're not hotplugging, force some input devices to exist */ xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices); /* when forcing input devices, we use kbd. otherwise evdev, so use the * evdev rules set. */ #if defined(__linux__) if (!xf86Info.forceInputDevices) rules = "evdev"; else #endif rules = "base"; /* Xkb default options. */ XkbInitRules(&set, rules, "pc105", "us", NULL, NULL); XkbSetRulesDflts(&set); XkbFreeRMLVOSet(&set, FALSE); xf86Info.useDefaultFontPath = TRUE; if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) { xf86Info.useDefaultFontPath = value; } /* Make sure that timers don't overflow CARD32's after multiplying */ #define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN) i = -1; xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i); if ((i >= 0) && (i < MAX_TIME_IN_MIN)) ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN; else if (i != -1) ErrorF("BlankTime value %d outside legal range of 0 - %d minutes\n", i, MAX_TIME_IN_MIN); #ifdef DPMSExtension i = -1; xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i); if ((i >= 0) && (i < MAX_TIME_IN_MIN)) DPMSStandbyTime = i * MILLI_PER_MIN; else if (i != -1) ErrorF("StandbyTime value %d outside legal range of 0 - %d minutes\n", i, MAX_TIME_IN_MIN); i = -1; xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i); if ((i >= 0) && (i < MAX_TIME_IN_MIN)) DPMSSuspendTime = i * MILLI_PER_MIN; else if (i != -1) ErrorF("SuspendTime value %d outside legal range of 0 - %d minutes\n", i, MAX_TIME_IN_MIN); i = -1; xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i); if ((i >= 0) && (i < MAX_TIME_IN_MIN)) DPMSOffTime = i * MILLI_PER_MIN; else if (i != -1) ErrorF("OffTime value %d outside legal range of 0 - %d minutes\n", i, MAX_TIME_IN_MIN); #endif #ifdef PANORAMIX from = X_DEFAULT; if (!noPanoramiXExtension) from = X_CMDLINE; else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) { noPanoramiXExtension = !value; from = X_CONFIG; } if (!noPanoramiXExtension) xf86Msg(from, "Xinerama: enabled\n"); #endif #ifdef DRI2 xf86Info.dri2 = FALSE; xf86Info.dri2From = X_DEFAULT; if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) { xf86Info.dri2 = value; xf86Info.dri2From = X_CONFIG; } #endif from = X_DEFAULT; if (LimitClients != LIMITCLIENTS) from = X_CMDLINE; i = -1; if (xf86GetOptValInteger(FlagOptions, FLAG_MAX_CLIENTS, &i)) { if (Ones(i) != 1 || i < 64 || i > 2048) { ErrorF("MaxClients must be one of 64, 128, 256, 512, 1024, or 2048\n"); } else { from = X_CONFIG; LimitClients = i; } } xf86Msg(from, "Max clients allowed: %i, resource mask: 0x%x\n", LimitClients, RESOURCE_ID_MASK); } Bool xf86DRI2Enabled(void) { return xf86Info.dri2; } /** * Search for the pInfo in the null-terminated list given and remove (and * free) it if present. All other devices are moved forward. */ static void freeDevice(InputInfoPtr * list, InputInfoPtr pInfo) { InputInfoPtr *devs; for (devs = list; devs && *devs; devs++) { if (*devs == pInfo) { free(*devs); for (; devs && *devs; devs++) devs[0] = devs[1]; break; } } } /** * Append pInfo to the null-terminated list, allocating space as necessary. * pInfo is used as the last element. */ static InputInfoPtr * addDevice(InputInfoPtr * list, InputInfoPtr pInfo) { InputInfoPtr *devs; int count = 1; for (devs = list; devs && *devs; devs++) count++; list = xnfreallocarray(list, count + 1, sizeof(InputInfoPtr)); list[count] = NULL; list[count - 1] = pInfo; return list; } /* * Locate the core input devices. These can be specified/located in * the following ways, in order of priority: * * 1. The InputDevices named by the -pointer and -keyboard command line * options. * 2. The "CorePointer" and "CoreKeyboard" InputDevices referred to by * the active ServerLayout. * 3. The first InputDevices marked as "CorePointer" and "CoreKeyboard". * 4. The first InputDevices that use 'keyboard' or 'kbd' and a valid mouse * driver (mouse, synaptics, evdev, vmmouse, void) * 5. Default devices with an empty (default) configuration. These defaults * will reference the 'mouse' and 'keyboard' drivers. */ static Bool checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) { InputInfoPtr corePointer = NULL, coreKeyboard = NULL; Bool foundPointer = FALSE, foundKeyboard = FALSE; const char *pointerMsg = NULL, *keyboardMsg = NULL; InputInfoPtr *devs, /* iterator */ indp; InputInfoPtr Pointer, Keyboard; XF86ConfInputPtr confInput; XF86ConfInputRec defPtr, defKbd; MessageType from = X_DEFAULT; const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse", "void", NULL }; /* * First check if a core pointer or core keyboard have been specified * in the active ServerLayout. If more than one is specified for either, * remove the core attribute from the later ones. */ for (devs = servlayoutp->inputs; devs && *devs; devs++) { indp = *devs; if (indp->options && xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) { if (!corePointer) { corePointer = indp; } } if (indp->options && xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) { if (!coreKeyboard) { coreKeyboard = indp; } } } confInput = NULL; /* 1. Check for the -pointer command line option. */ if (xf86PointerName) { confInput = xf86findInput(xf86PointerName, xf86configptr->conf_input_lst); if (!confInput) { xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", xf86PointerName); return FALSE; } from = X_CMDLINE; /* * If one was already specified in the ServerLayout, it needs to be * removed. */ if (corePointer) { freeDevice(servlayoutp->inputs, corePointer); corePointer = NULL; } foundPointer = TRUE; } /* 2. ServerLayout-specified core pointer. */ if (corePointer) { foundPointer = TRUE; from = X_CONFIG; } /* 3. First core pointer device. */ if (!foundPointer && (xf86Info.forceInputDevices || implicitLayout)) { XF86ConfInputPtr p; for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { if (p->inp_option_lst && xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) { confInput = p; foundPointer = TRUE; from = X_DEFAULT; pointerMsg = "first core pointer device"; break; } } } /* 4. First pointer with an allowed mouse driver. */ if (!foundPointer && xf86Info.forceInputDevices) { const char **driver = mousedrivers; confInput = xf86findInput(CONF_IMPLICIT_POINTER, xf86configptr->conf_input_lst); while (*driver && !confInput) { confInput = xf86findInputByDriver(*driver, xf86configptr->conf_input_lst); driver++; } if (confInput) { foundPointer = TRUE; from = X_DEFAULT; pointerMsg = "first mouse device"; } } /* 5. Built-in default. */ if (!foundPointer && xf86Info.forceInputDevices) { memset(&defPtr, 0, sizeof(defPtr)); defPtr.inp_identifier = strdup(""); defPtr.inp_driver = strdup("mouse"); confInput = &defPtr; foundPointer = TRUE; from = X_DEFAULT; pointerMsg = "default mouse configuration"; } /* Add the core pointer device to the layout, and set it to Core. */ if (foundPointer && confInput) { Pointer = xf86AllocateInput(); if (Pointer) foundPointer = configInput(Pointer, confInput, from); if (foundPointer) { Pointer->options = xf86AddNewOption(Pointer->options, "CorePointer", "on"); Pointer->options = xf86AddNewOption(Pointer->options, "driver", confInput->inp_driver); Pointer->options = xf86AddNewOption(Pointer->options, "identifier", confInput->inp_identifier); servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer); } } if (!foundPointer && xf86Info.forceInputDevices) { /* This shouldn't happen. */ xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n"); xf86DeleteInput(Pointer, 0); return FALSE; } confInput = NULL; /* 1. Check for the -keyboard command line option. */ if (xf86KeyboardName) { confInput = xf86findInput(xf86KeyboardName, xf86configptr->conf_input_lst); if (!confInput) { xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", xf86KeyboardName); return FALSE; } from = X_CMDLINE; /* * If one was already specified in the ServerLayout, it needs to be * removed. */ if (coreKeyboard) { freeDevice(servlayoutp->inputs, coreKeyboard); coreKeyboard = NULL; } foundKeyboard = TRUE; } /* 2. ServerLayout-specified core keyboard. */ if (coreKeyboard) { foundKeyboard = TRUE; from = X_CONFIG; } /* 3. First core keyboard device. */ if (!foundKeyboard && (xf86Info.forceInputDevices || implicitLayout)) { XF86ConfInputPtr p; for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { if (p->inp_option_lst && xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) { confInput = p; foundKeyboard = TRUE; from = X_DEFAULT; keyboardMsg = "first core keyboard device"; break; } } } /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */ if (!foundKeyboard && xf86Info.forceInputDevices) { confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD, xf86configptr->conf_input_lst); if (!confInput) { confInput = xf86findInputByDriver("kbd", xf86configptr->conf_input_lst); } if (confInput) { foundKeyboard = TRUE; from = X_DEFAULT; keyboardMsg = "first keyboard device"; } } /* 5. Built-in default. */ if (!foundKeyboard && xf86Info.forceInputDevices) { memset(&defKbd, 0, sizeof(defKbd)); defKbd.inp_identifier = strdup(""); defKbd.inp_driver = strdup("kbd"); confInput = &defKbd; foundKeyboard = TRUE; keyboardMsg = "default keyboard configuration"; from = X_DEFAULT; } /* Add the core keyboard device to the layout, and set it to Core. */ if (foundKeyboard && confInput) { Keyboard = xf86AllocateInput(); if (Keyboard) foundKeyboard = configInput(Keyboard, confInput, from); if (foundKeyboard) { Keyboard->options = xf86AddNewOption(Keyboard->options, "CoreKeyboard", "on"); Keyboard->options = xf86AddNewOption(Keyboard->options, "driver", confInput->inp_driver); Keyboard->options = xf86AddNewOption(Keyboard->options, "identifier", confInput->inp_identifier); servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard); } } if (!foundKeyboard && xf86Info.forceInputDevices) { /* This shouldn't happen. */ xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n"); xf86DeleteInput(Keyboard, 0); return FALSE; } if (pointerMsg) { if (implicitLayout) xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n", pointerMsg); else xf86Msg(X_DEFAULT, "The core pointer device wasn't specified " "explicitly in the layout.\n" "\tUsing the %s.\n", pointerMsg); } if (keyboardMsg) { if (implicitLayout) xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n", keyboardMsg); else xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified " "explicitly in the layout.\n" "\tUsing the %s.\n", keyboardMsg); } if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) { #if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) const char *config_backend; #if defined(CONFIG_HAL) config_backend = "HAL"; #elif defined(CONFIG_UDEV) config_backend = "udev"; #else config_backend = "wscons"; #endif xf86Msg(X_INFO, "The server relies on %s to provide the list of " "input devices.\n\tIf no devices become available, " "reconfigure %s or disable AutoAddDevices.\n", config_backend, config_backend); #else xf86Msg(X_WARNING, "Hotplugging requested but the server was " "compiled without a config backend. " "No input devices were configured, the server " "will start without any input devices.\n"); #endif } return TRUE; } typedef enum { LAYOUT_ISOLATEDEVICE, LAYOUT_SINGLECARD } LayoutValues; static OptionInfoRec LayoutOptions[] = { {LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING, {0}, FALSE}, {LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; static Bool configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp) { XF86ConfInputrefPtr irp; InputInfoPtr *indp; int count = 0; /* * Count the number of input devices. */ irp = layout->lay_input_lst; while (irp) { count++; irp = (XF86ConfInputrefPtr) irp->list.next; } DebugF("Found %d input devices in the layout section %s\n", count, layout->lay_identifier); indp = xnfcalloc((count + 1), sizeof(InputInfoPtr)); indp[count] = NULL; irp = layout->lay_input_lst; count = 0; while (irp) { indp[count] = xf86AllocateInput(); if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) { do { free(indp[count]); } while (count--); free(indp); return FALSE; } indp[count]->options = xf86OptionListMerge(indp[count]->options, irp->iref_option_lst); count++; irp = (XF86ConfInputrefPtr) irp->list.next; } servlayoutp->inputs = indp; return TRUE; } /* * figure out which layout is active, which screens are used in that layout, * which drivers and monitors are used in these screens */ static Bool configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, char *default_layout) { XF86ConfAdjacencyPtr adjp; XF86ConfInactivePtr idp; int saved_count, count = 0; int scrnum; XF86ConfLayoutPtr l; MessageType from; screenLayoutPtr slp; GDevPtr gdp; int i = 0, j; if (!servlayoutp) return FALSE; /* * which layout section is the active one? * * If there is a -layout command line option, use that one, otherwise * pick the first one. */ from = X_DEFAULT; if (xf86LayoutName != NULL) from = X_CMDLINE; else if (default_layout) { xf86LayoutName = default_layout; from = X_CONFIG; } if (xf86LayoutName != NULL) { if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) { xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n", xf86LayoutName); return FALSE; } conf_layout = l; } xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier); adjp = conf_layout->lay_adjacency_lst; /* * we know that each screen is referenced exactly once on the left side * of a layout statement in the Layout section. So to allocate the right * size for the array we do a quick walk of the list to figure out how * many sections we have */ while (adjp) { count++; adjp = (XF86ConfAdjacencyPtr) adjp->list.next; } DebugF("Found %d screens in the layout section %s", count, conf_layout->lay_identifier); if (!count) /* alloc enough storage even if no screen is specified */ count = 1; slp = xnfcalloc((count + 1), sizeof(screenLayoutRec)); slp[count].screen = NULL; /* * now that we have storage, loop over the list again and fill in our * data structure; at this point we do not fill in the adjacency * information as it is not clear if we need it at all */ adjp = conf_layout->lay_adjacency_lst; count = 0; while (adjp) { slp[count].screen = xnfcalloc(1, sizeof(confScreenRec)); if (adjp->adj_scrnum < 0) scrnum = count; else scrnum = adjp->adj_scrnum; if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum, X_CONFIG, (scrnum == 0 && !adjp->list.next))) { do { free(slp[count].screen); } while (count--); free(slp); return FALSE; } slp[count].x = adjp->adj_x; slp[count].y = adjp->adj_y; slp[count].refname = adjp->adj_refscreen; switch (adjp->adj_where) { case CONF_ADJ_OBSOLETE: slp[count].where = PosObsolete; slp[count].topname = adjp->adj_top_str; slp[count].bottomname = adjp->adj_bottom_str; slp[count].leftname = adjp->adj_left_str; slp[count].rightname = adjp->adj_right_str; break; case CONF_ADJ_ABSOLUTE: slp[count].where = PosAbsolute; break; case CONF_ADJ_RIGHTOF: slp[count].where = PosRightOf; break; case CONF_ADJ_LEFTOF: slp[count].where = PosLeftOf; break; case CONF_ADJ_ABOVE: slp[count].where = PosAbove; break; case CONF_ADJ_BELOW: slp[count].where = PosBelow; break; case CONF_ADJ_RELATIVE: slp[count].where = PosRelative; break; } count++; adjp = (XF86ConfAdjacencyPtr) adjp->list.next; } /* No screen was specified in the layout. take the first one from the * config file, or - if it is NULL - configScreen autogenerates one for * us */ if (!count) { XF86ConfScreenPtr screen; FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen); slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); if (!configScreen(slp[0].screen, screen, 0, X_CONFIG, TRUE)) { free(slp[0].screen); free(slp); return FALSE; } } /* XXX Need to tie down the upper left screen. */ /* Fill in the refscreen and top/bottom/left/right values */ for (i = 0; i < count; i++) { for (j = 0; j < count; j++) { if (slp[i].refname && strcmp(slp[i].refname, slp[j].screen->id) == 0) { slp[i].refscreen = slp[j].screen; } if (slp[i].topname && strcmp(slp[i].topname, slp[j].screen->id) == 0) { slp[i].top = slp[j].screen; } if (slp[i].bottomname && strcmp(slp[i].bottomname, slp[j].screen->id) == 0) { slp[i].bottom = slp[j].screen; } if (slp[i].leftname && strcmp(slp[i].leftname, slp[j].screen->id) == 0) { slp[i].left = slp[j].screen; } if (slp[i].rightname && strcmp(slp[i].rightname, slp[j].screen->id) == 0) { slp[i].right = slp[j].screen; } } if (slp[i].where != PosObsolete && slp[i].where != PosAbsolute && !slp[i].refscreen) { xf86Msg(X_ERROR, "Screen %s doesn't exist: deleting placement\n", slp[i].refname); slp[i].where = PosAbsolute; slp[i].x = 0; slp[i].y = 0; } } if (!count) saved_count = 1; else saved_count = count; /* * Count the number of inactive devices. */ count = 0; idp = conf_layout->lay_inactive_lst; while (idp) { count++; idp = (XF86ConfInactivePtr) idp->list.next; } DebugF("Found %d inactive devices in the layout section %s\n", count, conf_layout->lay_identifier); gdp = xnfallocarray(count + 1, sizeof(GDevRec)); gdp[count].identifier = NULL; idp = conf_layout->lay_inactive_lst; count = 0; while (idp) { if (!configDevice(&gdp[count], idp->inactive_device, FALSE, FALSE)) goto bail; count++; idp = (XF86ConfInactivePtr) idp->list.next; } if (!configInputDevices(conf_layout, servlayoutp)) goto bail; servlayoutp->id = conf_layout->lay_identifier; servlayoutp->screens = slp; servlayoutp->inactives = gdp; servlayoutp->options = conf_layout->lay_option_lst; from = X_DEFAULT; return TRUE; bail: do { free(slp[saved_count].screen); } while (saved_count--); free(slp); free(gdp); return FALSE; } /* * No layout section, so find the first Screen section and set that up as * the only active screen. */ static Bool configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, XF86ConfigPtr conf_ptr) { MessageType from; XF86ConfScreenPtr s; screenLayoutPtr slp; InputInfoPtr *indp; XF86ConfLayoutRec layout; if (!servlayoutp) return FALSE; /* * which screen section is the active one? * * If there is a -screen option, use that one, otherwise use the first * one. */ from = X_CONFIG; if (xf86ScreenName != NULL) { if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) { xf86Msg(X_ERROR, "No Screen section called \"%s\"\n", xf86ScreenName); return FALSE; } conf_screen = s; from = X_CMDLINE; } /* We have exactly one screen */ slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec)); slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); slp[1].screen = NULL; if (!configScreen(slp[0].screen, conf_screen, 0, from, TRUE)) { free(slp); return FALSE; } servlayoutp->id = "(implicit)"; servlayoutp->screens = slp; servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec)); servlayoutp->options = NULL; memset(&layout, 0, sizeof(layout)); layout.lay_identifier = servlayoutp->id; if (xf86layoutAddInputDevices(conf_ptr, &layout) > 0) { if (!configInputDevices(&layout, servlayoutp)) return FALSE; from = X_DEFAULT; } else { /* Set up an empty input device list, then look for some core devices. */ indp = xnfalloc(sizeof(InputInfoPtr)); *indp = NULL; servlayoutp->inputs = indp; } return TRUE; } static Bool configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor) { int count = 0; XF86ConfVideoPortPtr conf_port; xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n", conf_adaptor->va_identifier); adaptor->identifier = conf_adaptor->va_identifier; adaptor->options = conf_adaptor->va_option_lst; if (conf_adaptor->va_busid || conf_adaptor->va_driver) { xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n"); return FALSE; } /* * figure out how many videoport subsections there are and fill them in */ conf_port = conf_adaptor->va_port_lst; while (conf_port) { count++; conf_port = (XF86ConfVideoPortPtr) conf_port->list.next; } adaptor->ports = xnfallocarray(count, sizeof(confXvPortRec)); adaptor->numports = count; count = 0; conf_port = conf_adaptor->va_port_lst; while (conf_port) { adaptor->ports[count].identifier = conf_port->vp_identifier; adaptor->ports[count].options = conf_port->vp_option_lst; count++; conf_port = (XF86ConfVideoPortPtr) conf_port->list.next; } return TRUE; } static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, MessageType from, Bool auto_gpu_device) { int count = 0; XF86ConfDisplayPtr dispptr; XF86ConfAdaptorLinkPtr conf_adaptor; Bool defaultMonitor = FALSE; XF86ConfScreenRec local_conf_screen; int i; if (!conf_screen) { memset(&local_conf_screen, 0, sizeof(local_conf_screen)); conf_screen = &local_conf_screen; conf_screen->scrn_identifier = "Default Screen Section"; xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n"); } xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier, scrnum); /* * now we fill in the elements of the screen */ screenp->id = conf_screen->scrn_identifier; screenp->screennum = scrnum; screenp->defaultdepth = conf_screen->scrn_defaultdepth; screenp->defaultbpp = conf_screen->scrn_defaultbpp; screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp; screenp->monitor = xnfcalloc(1, sizeof(MonRec)); /* If no monitor is specified, create a default one. */ if (!conf_screen->scrn_monitor) { XF86ConfMonitorRec defMon; memset(&defMon, 0, sizeof(defMon)); defMon.mon_identifier = ""; if (!configMonitor(screenp->monitor, &defMon)) return FALSE; defaultMonitor = TRUE; } else { if (!configMonitor(screenp->monitor, conf_screen->scrn_monitor)) return FALSE; } /* Configure the device. If there isn't one configured, attach to the * first inactive one that we can configure. If there's none that work, * set it to NULL so that the section can be autoconfigured later */ screenp->device = xnfcalloc(1, sizeof(GDevRec)); if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) { FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_lst, conf_screen->scrn_device); xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n" "\tUsing the first device section listed.\n", screenp->id); } if (configDevice(screenp->device, conf_screen->scrn_device, TRUE, FALSE)) { screenp->device->myScreenSection = screenp; } else { screenp->device = NULL; } if (auto_gpu_device && conf_screen->num_gpu_devices == 0 && xf86configptr->conf_device_lst) { XF86ConfDevicePtr sdevice = xf86configptr->conf_device_lst->list.next; for (i = 0; i < MAX_GPUDEVICES; i++) { if (!sdevice) break; FIND_SUITABLE (XF86ConfDevicePtr, sdevice, conf_screen->scrn_gpu_devices[i]); if (!conf_screen->scrn_gpu_devices[i]) break; screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec)); if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) { screenp->gpu_devices[i]->myScreenSection = screenp; } sdevice = conf_screen->scrn_gpu_devices[i]->list.next; } screenp->num_gpu_devices = i; } else { for (i = 0; i < conf_screen->num_gpu_devices; i++) { screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec)); if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) { screenp->gpu_devices[i]->myScreenSection = screenp; } } screenp->num_gpu_devices = conf_screen->num_gpu_devices; } screenp->options = conf_screen->scrn_option_lst; /* * figure out how many display subsections there are and fill them in */ dispptr = conf_screen->scrn_display_lst; while (dispptr) { count++; dispptr = (XF86ConfDisplayPtr) dispptr->list.next; } screenp->displays = xnfallocarray(count, sizeof(DispRec)); screenp->numdisplays = count; /* Fill in the default Virtual size, if any */ if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) { for (count = 0, dispptr = conf_screen->scrn_display_lst; dispptr; dispptr = (XF86ConfDisplayPtr) dispptr->list.next, count++) { screenp->displays[count].virtualX = conf_screen->scrn_virtualX; screenp->displays[count].virtualY = conf_screen->scrn_virtualY; } } /* Now do the per-Display Virtual sizes */ count = 0; dispptr = conf_screen->scrn_display_lst; while (dispptr) { configDisplay(&(screenp->displays[count]), dispptr); count++; dispptr = (XF86ConfDisplayPtr) dispptr->list.next; } /* * figure out how many videoadaptor references there are and fill them in */ conf_adaptor = conf_screen->scrn_adaptor_lst; while (conf_adaptor) { count++; conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next; } screenp->xvadaptors = xnfallocarray(count, sizeof(confXvAdaptorRec)); screenp->numxvadaptors = 0; conf_adaptor = conf_screen->scrn_adaptor_lst; while (conf_adaptor) { if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]), conf_adaptor->al_adaptor)) screenp->numxvadaptors++; conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next; } if (defaultMonitor) { xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n" "\tUsing a default monitor configuration.\n", screenp->id); } return TRUE; } typedef enum { MON_REDUCEDBLANKING, MON_MAX_PIX_CLOCK, } MonitorValues; static OptionInfoRec MonitorOptions[] = { {MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN, {0}, FALSE}, {MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) { int count; DisplayModePtr mode, last = NULL; XF86ConfModeLinePtr cmodep; XF86ConfModesPtr modes; XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst; Gamma zeros = { 0.0, 0.0, 0.0 }; float badgamma = 0.0; double maxPixClock; xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier); monitorp->id = conf_monitor->mon_identifier; monitorp->vendor = conf_monitor->mon_vendor; monitorp->model = conf_monitor->mon_modelname; monitorp->Modes = NULL; monitorp->Last = NULL; monitorp->gamma = zeros; monitorp->widthmm = conf_monitor->mon_width; monitorp->heightmm = conf_monitor->mon_height; monitorp->reducedblanking = FALSE; monitorp->maxPixClock = 0; monitorp->options = conf_monitor->mon_option_lst; /* * fill in the monitor structure */ for (count = 0; count < conf_monitor->mon_n_hsync && count < MAX_HSYNC; count++) { monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi; monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo; } monitorp->nHsync = count; for (count = 0; count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH; count++) { monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi; monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo; } monitorp->nVrefresh = count; /* * first we collect the mode lines from the UseModes directive */ while (modeslnk) { modes = xf86findModes(modeslnk->ml_modes_str, xf86configptr->conf_modes_lst); modeslnk->ml_modes = modes; /* now add the modes found in the modes section to the list of modes for this monitor unless it has been added before because we are reusing the same section for another screen */ if (xf86itemNotSublist((GenericListPtr) conf_monitor->mon_modeline_lst, (GenericListPtr) modes->mon_modeline_lst)) { conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr) xf86addListItem((GenericListPtr) conf_monitor->mon_modeline_lst, (GenericListPtr) modes->mon_modeline_lst); } modeslnk = modeslnk->list.next; } /* * we need to hook in the mode lines now * here both data structures use lists, only our internal one * is double linked */ cmodep = conf_monitor->mon_modeline_lst; while (cmodep) { mode = xnfcalloc(1, sizeof(DisplayModeRec)); mode->type = 0; mode->Clock = cmodep->ml_clock; mode->HDisplay = cmodep->ml_hdisplay; mode->HSyncStart = cmodep->ml_hsyncstart; mode->HSyncEnd = cmodep->ml_hsyncend; mode->HTotal = cmodep->ml_htotal; mode->VDisplay = cmodep->ml_vdisplay; mode->VSyncStart = cmodep->ml_vsyncstart; mode->VSyncEnd = cmodep->ml_vsyncend; mode->VTotal = cmodep->ml_vtotal; mode->Flags = cmodep->ml_flags; mode->HSkew = cmodep->ml_hskew; mode->VScan = cmodep->ml_vscan; mode->name = xnfstrdup(cmodep->ml_identifier); if (last) { mode->prev = last; last->next = mode; } else { /* * this is the first mode */ monitorp->Modes = mode; mode->prev = NULL; } last = mode; cmodep = (XF86ConfModeLinePtr) cmodep->list.next; } if (last) { last->next = NULL; } monitorp->Last = last; /* add the (VESA) default modes */ if (!addDefaultModes(monitorp)) return FALSE; if (conf_monitor->mon_gamma_red > GAMMA_ZERO) monitorp->gamma.red = conf_monitor->mon_gamma_red; if (conf_monitor->mon_gamma_green > GAMMA_ZERO) monitorp->gamma.green = conf_monitor->mon_gamma_green; if (conf_monitor->mon_gamma_blue > GAMMA_ZERO) monitorp->gamma.blue = conf_monitor->mon_gamma_blue; /* Check that the gamma values are within range */ if (monitorp->gamma.red > GAMMA_ZERO && (monitorp->gamma.red < GAMMA_MIN || monitorp->gamma.red > GAMMA_MAX)) { badgamma = monitorp->gamma.red; } else if (monitorp->gamma.green > GAMMA_ZERO && (monitorp->gamma.green < GAMMA_MIN || monitorp->gamma.green > GAMMA_MAX)) { badgamma = monitorp->gamma.green; } else if (monitorp->gamma.blue > GAMMA_ZERO && (monitorp->gamma.blue < GAMMA_MIN || monitorp->gamma.blue > GAMMA_MAX)) { badgamma = monitorp->gamma.blue; } if (badgamma > GAMMA_ZERO) { ErrorF("Gamma value %.f is out of range (%.2f - %.1f)\n", badgamma, GAMMA_MIN, GAMMA_MAX); return FALSE; } xf86ProcessOptions(-1, monitorp->options, MonitorOptions); xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING, &monitorp->reducedblanking); if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ, &maxPixClock) == TRUE) { monitorp->maxPixClock = (int) maxPixClock; } return TRUE; } static int lookupVisual(const char *visname) { int i; if (!visname || !*visname) return -1; for (i = 0; i <= DirectColor; i++) { if (!xf86nameCompare(visname, xf86VisualNames[i])) break; } if (i <= DirectColor) return i; return -1; } static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display) { int count = 0; XF86ModePtr modep; displayp->frameX0 = conf_display->disp_frameX0; displayp->frameY0 = conf_display->disp_frameY0; displayp->virtualX = conf_display->disp_virtualX; displayp->virtualY = conf_display->disp_virtualY; displayp->depth = conf_display->disp_depth; displayp->fbbpp = conf_display->disp_bpp; displayp->weight.red = conf_display->disp_weight.red; displayp->weight.green = conf_display->disp_weight.green; displayp->weight.blue = conf_display->disp_weight.blue; displayp->blackColour.red = conf_display->disp_black.red; displayp->blackColour.green = conf_display->disp_black.green; displayp->blackColour.blue = conf_display->disp_black.blue; displayp->whiteColour.red = conf_display->disp_white.red; displayp->whiteColour.green = conf_display->disp_white.green; displayp->whiteColour.blue = conf_display->disp_white.blue; displayp->options = conf_display->disp_option_lst; if (conf_display->disp_visual) { displayp->defaultVisual = lookupVisual(conf_display->disp_visual); if (displayp->defaultVisual == -1) { ErrorF("Invalid visual name: \"%s\"\n", conf_display->disp_visual); return FALSE; } } else { displayp->defaultVisual = -1; } /* * now hook in the modes */ modep = conf_display->disp_mode_lst; while (modep) { count++; modep = (XF86ModePtr) modep->list.next; } displayp->modes = xnfallocarray(count + 1, sizeof(char *)); modep = conf_display->disp_mode_lst; count = 0; while (modep) { displayp->modes[count] = modep->mode_name; count++; modep = (XF86ModePtr) modep->list.next; } displayp->modes[count] = NULL; return TRUE; } static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active, Bool gpu) { int i; if (!conf_device) { return FALSE; } if (active) { if (gpu) xf86Msg(X_CONFIG, "| |-->GPUDevice \"%s\"\n", conf_device->dev_identifier); else xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n", conf_device->dev_identifier); } else xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n", conf_device->dev_identifier); devicep->identifier = conf_device->dev_identifier; devicep->vendor = conf_device->dev_vendor; devicep->board = conf_device->dev_board; devicep->chipset = conf_device->dev_chipset; devicep->ramdac = conf_device->dev_ramdac; devicep->driver = conf_device->dev_driver; devicep->active = active; devicep->videoRam = conf_device->dev_videoram; devicep->MemBase = conf_device->dev_mem_base; devicep->IOBase = conf_device->dev_io_base; devicep->clockchip = conf_device->dev_clockchip; devicep->busID = conf_device->dev_busid; devicep->chipID = conf_device->dev_chipid; devicep->chipRev = conf_device->dev_chiprev; devicep->options = conf_device->dev_option_lst; devicep->irq = conf_device->dev_irq; devicep->screen = conf_device->dev_screen; for (i = 0; i < MAXDACSPEEDS; i++) { if (i < CONF_MAXDACSPEEDS) devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i]; else devicep->dacSpeeds[i] = 0; } devicep->numclocks = conf_device->dev_clocks; if (devicep->numclocks > MAXCLOCKS) devicep->numclocks = MAXCLOCKS; for (i = 0; i < devicep->numclocks; i++) { devicep->clock[i] = conf_device->dev_clock[i]; } devicep->claimed = FALSE; return TRUE; } static void configDRI(XF86ConfDRIPtr drip) { struct group *grp; xf86ConfigDRI.group = -1; xf86ConfigDRI.mode = 0; if (drip) { if (drip->dri_group_name) { if ((grp = getgrnam(drip->dri_group_name))) xf86ConfigDRI.group = grp->gr_gid; } else { if (drip->dri_group >= 0) xf86ConfigDRI.group = drip->dri_group; } xf86ConfigDRI.mode = drip->dri_mode; } } static void configExtensions(XF86ConfExtensionsPtr conf_ext) { XF86OptionPtr o; if (conf_ext && conf_ext->ext_option_lst) { for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) { char *name = xf86OptionName(o); char *val = xf86OptionValue(o); char *n; Bool enable = TRUE; /* Handle "No" */ n = xf86NormalizeName(name); if (strncmp(n, "no", 2) == 0) { name += 2; enable = FALSE; } if (!val || xf86NameCmp(val, "enable") == 0 || xf86NameCmp(val, "enabled") == 0 || xf86NameCmp(val, "on") == 0 || xf86NameCmp(val, "1") == 0 || xf86NameCmp(val, "yes") == 0 || xf86NameCmp(val, "true") == 0) { /* NOTHING NEEDED -- enabling is handled below */ } else if (xf86NameCmp(val, "disable") == 0 || xf86NameCmp(val, "disabled") == 0 || xf86NameCmp(val, "off") == 0 || xf86NameCmp(val, "0") == 0 || xf86NameCmp(val, "no") == 0 || xf86NameCmp(val, "false") == 0) { enable = !enable; } else { xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val); free(n); continue; } if (EnableDisableExtension(name, enable)) { xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n", name, enable ? "enabled" : "disabled"); } else { xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n", name); } free(n); } } } static Bool configInput(InputInfoPtr inputp, XF86ConfInputPtr conf_input, MessageType from) { xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier); inputp->name = conf_input->inp_identifier; inputp->driver = conf_input->inp_driver; inputp->options = conf_input->inp_option_lst; inputp->attrs = NULL; return TRUE; } static Bool modeIsPresent(DisplayModePtr mode, MonPtr monitorp) { DisplayModePtr knownmodes = monitorp->Modes; /* all I can think of is a linear search... */ while (knownmodes != NULL) { if (!strcmp(mode->name, knownmodes->name) && !(knownmodes->type & M_T_DEFAULT)) return TRUE; knownmodes = knownmodes->next; } return FALSE; } static Bool addDefaultModes(MonPtr monitorp) { DisplayModePtr mode; DisplayModePtr last = monitorp->Last; int i = 0; for (i = 0; i < xf86NumDefaultModes; i++) { mode = xf86DuplicateMode(&xf86DefaultModes[i]); if (!modeIsPresent(mode, monitorp)) { monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode); last = mode; } else { free(mode); } } monitorp->Last = last; return TRUE; } static void checkInput(serverLayoutPtr layout, Bool implicit_layout) { checkCoreInputDevices(layout, implicit_layout); /* Unless we're forcing input devices, disable mouse/kbd devices in the * config. Otherwise the same physical device is added multiple times, * leading to duplicate events. */ if (!xf86Info.forceInputDevices && layout->inputs) { InputInfoPtr *dev = layout->inputs; BOOL warned = FALSE; while (*dev) { if (strcmp((*dev)->driver, "kbd") == 0 || strcmp((*dev)->driver, "mouse") == 0 || strcmp((*dev)->driver, "vmmouse") == 0) { InputInfoPtr *current; if (!warned) { xf86Msg(X_WARNING, "Hotplugging is on, devices using " "drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n"); warned = TRUE; } xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->name); current = dev; free(*dev); *dev = NULL; do { *current = *(current + 1); current++; } while (*current); } else dev++; } } } /* * load the config file and fill the global data structure */ ConfigStatus xf86HandleConfigFile(Bool autoconfig) { #ifdef XSERVER_LIBPCIACCESS const char *scanptr; Bool singlecard = 0; #endif Bool implicit_layout = FALSE; XF86ConfLayoutPtr layout; if (!autoconfig) { char *filename, *dirname, *sysdirname; const char *filesearch, *dirsearch; MessageType filefrom = X_DEFAULT; MessageType dirfrom = X_DEFAULT; if (!PrivsElevated()) { filesearch = ALL_CONFIGPATH; dirsearch = ALL_CONFIGDIRPATH; } else { filesearch = RESTRICTED_CONFIGPATH; dirsearch = RESTRICTED_CONFIGDIRPATH; } if (xf86ConfigFile) filefrom = X_CMDLINE; if (xf86ConfigDir) dirfrom = X_CMDLINE; xf86initConfigFiles(); sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH, NULL, PROJECTROOT); dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT); filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT); if (filename) { xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename); xf86ConfigFile = xnfstrdup(filename); } else { if (xf86ConfigFile) xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n", xf86ConfigFile); } if (dirname) { xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n", dirname); xf86ConfigDir = xnfstrdup(dirname); } else { if (xf86ConfigDir) xf86Msg(X_ERROR, "Unable to locate/open config directory: \"%s\"\n", xf86ConfigDir); } if (sysdirname) xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n", sysdirname); if (!filename && !dirname && !sysdirname) return CONFIG_NOFILE; free(filename); free(dirname); free(sysdirname); } if ((xf86configptr = xf86readConfigFile()) == NULL) { xf86Msg(X_ERROR, "Problem parsing the config file\n"); return CONFIG_PARSE_ERROR; } xf86closeConfigFile(); /* Initialise a few things. */ /* * now we convert part of the information contained in the parser * structures into our own structures. * The important part here is to figure out which Screen Sections * in the XF86Config file are active so that we can piece together * the modes that we need later down the road. * And while we are at it, we'll decode the rest of the stuff as well */ /* First check if a layout section is present, and if it is valid. */ FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr->conf_layout_lst, layout); if (layout == NULL || xf86ScreenName != NULL) { XF86ConfScreenPtr screen; if (xf86ScreenName == NULL) { xf86Msg(X_DEFAULT, "No Layout section. Using the first Screen section.\n"); } FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen); if (!configImpliedLayout(&xf86ConfigLayout, screen, xf86configptr)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } implicit_layout = TRUE; } else { if (xf86configptr->conf_flags != NULL) { char *dfltlayout = NULL; void *optlist = xf86configptr->conf_flags->flg_option_lst; if (optlist && xf86FindOption(optlist, "defaultserverlayout")) dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL); if (!configLayout(&xf86ConfigLayout, layout, dfltlayout)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } } else { if (!configLayout(&xf86ConfigLayout, layout, NULL)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } } } xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions); #ifdef XSERVER_LIBPCIACCESS if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) { ; /* IsolateDevice specified; overrides SingleCard */ } else { xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard); if (singlecard) scanptr = xf86ConfigLayout.screens->screen->device->busID; } if (scanptr) { if (strncmp(scanptr, "PCI:", 4) != 0) { xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n" "\tIgnoring IsolateDevice option.\n"); } else xf86PciIsolateDevice(scanptr); } #endif /* Now process everything else */ configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options); configFiles(xf86configptr->conf_files); configExtensions(xf86configptr->conf_extensions); configDRI(xf86configptr->conf_dri); checkInput(&xf86ConfigLayout, implicit_layout); /* * Handle some command line options that can override some of the * ServerFlags settings. */ #ifdef XF86VIDMODE if (xf86VidModeDisabled) xf86Info.vidModeEnabled = FALSE; if (xf86VidModeAllowNonLocal) xf86Info.vidModeAllowNonLocal = TRUE; #endif if (xf86AllowMouseOpenFail) xf86Info.allowMouseOpenFail = TRUE; return CONFIG_OK; } Bool xf86PathIsSafe(const char *path) { return (xf86pathIsSafe(path) != 0); } xorg-server-1.20.8/hw/xfree86/common/xorgVersion.h0000644000175000017500000000420013640201473016675 00000000000000 /* * Copyright (c) 2004, X.Org Foundation * * 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). */ #ifndef XORG_VERSION_H #define XORG_VERSION_H #ifndef XORG_VERSION_CURRENT #error #endif #define XORG_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap) #define XORG_GET_MAJOR_VERSION(vers) ((vers) / 10000000) #define XORG_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000) #define XORG_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000) #define XORG_GET_SNAP_VERSION(vers) ((vers) % 1000) #define XORG_VERSION_MAJOR XORG_GET_MAJOR_VERSION(XORG_VERSION_CURRENT) #define XORG_VERSION_MINOR XORG_GET_MINOR_VERSION(XORG_VERSION_CURRENT) #define XORG_VERSION_PATCH XORG_GET_PATCH_VERSION(XORG_VERSION_CURRENT) #define XORG_VERSION_SNAP XORG_GET_SNAP_VERSION(XORG_VERSION_CURRENT) #endif xorg-server-1.20.8/hw/xfree86/common/xaarop.h0000644000175000017500000001465013640201473015654 00000000000000#ifndef _XAAROP_H #define _XAAROP_H #define ROP_DST 0x00000001 #define ROP_SRC 0x00000002 #define ROP_PAT 0x00000004 #define ROP_0 0x00 #define ROP_DPSoon 0x01 #define ROP_DPSona 0x02 #define ROP_PSon 0x03 #define ROP_SDPona 0x04 #define ROP_DPon 0x05 #define ROP_PDSxnon 0x06 #define ROP_PDSaon 0x07 #define ROP_SDPnaa 0x08 #define ROP_PDSxon 0x09 #define ROP_DPna 0x0A #define ROP_PSDnaon 0x0B #define ROP_SPna 0x0C #define ROP_PDSnaon 0x0D #define ROP_PDSonon 0x0E #define ROP_Pn 0x0F #define ROP_PDSona 0x10 #define ROP_DSon 0x11 #define ROP_SDPxnon 0x12 #define ROP_SDPaon 0x13 #define ROP_DPSxnon 0x14 #define ROP_DPSaon 0x15 #define ROP_PSDPSanaxx 0x16 #define ROP_SSPxDSxaxn 0x17 #define ROP_SPxPDxa 0x18 #define ROP_SDPSanaxn 0x19 #define ROP_PDSPaox 0x1A #define ROP_SDPSxaxn 0x1B #define ROP_PSDPaox 0x1C #define ROP_DSPDxaxn 0x1D #define ROP_PDSox 0x1E #define ROP_PDSoan 0x1F #define ROP_DPSnaa 0x20 #define ROP_SDPxon 0x21 #define ROP_DSna 0x22 #define ROP_SPDnaon 0x23 #define ROP_SPxDSxa 0x24 #define ROP_PDSPanaxn 0x25 #define ROP_SDPSaox 0x26 #define ROP_SDPSxnox 0x27 #define ROP_DPSxa 0x28 #define ROP_PSDPSaoxxn 0x29 #define ROP_DPSana 0x2A #define ROP_SSPxPDxaxn 0x2B #define ROP_SPDSoax 0x2C #define ROP_PSDnox 0x2D #define ROP_PSDPxox 0x2E #define ROP_PSDnoan 0x2F #define ROP_PSna 0x30 #define ROP_SDPnaon 0x31 #define ROP_SDPSoox 0x32 #define ROP_Sn 0x33 #define ROP_SPDSaox 0x34 #define ROP_SPDSxnox 0x35 #define ROP_SDPox 0x36 #define ROP_SDPoan 0x37 #define ROP_PSDPoax 0x38 #define ROP_SPDnox 0x39 #define ROP_SPDSxox 0x3A #define ROP_SPDnoan 0x3B #define ROP_PSx 0x3C #define ROP_SPDSonox 0x3D #define ROP_SPDSnaox 0x3E #define ROP_PSan 0x3F #define ROP_PSDnaa 0x40 #define ROP_DPSxon 0x41 #define ROP_SDxPDxa 0x42 #define ROP_SPDSanaxn 0x43 #define ROP_SDna 0x44 #define ROP_DPSnaon 0x45 #define ROP_DSPDaox 0x46 #define ROP_PSDPxaxn 0x47 #define ROP_SDPxa 0x48 #define ROP_PDSPDaoxxn 0x49 #define ROP_DPSDoax 0x4A #define ROP_PDSnox 0x4B #define ROP_SDPana 0x4C #define ROP_SSPxDSxoxn 0x4D #define ROP_PDSPxox 0x4E #define ROP_PDSnoan 0x4F #define ROP_PDna 0x50 #define ROP_DSPnaon 0x51 #define ROP_DPSDaox 0x52 #define ROP_SPDSxaxn 0x53 #define ROP_DPSonon 0x54 #define ROP_Dn 0x55 #define ROP_DPSox 0x56 #define ROP_DPSoan 0x57 #define ROP_PDSPoax 0x58 #define ROP_DPSnox 0x59 #define ROP_DPx 0x5A #define ROP_DPSDonox 0x5B #define ROP_DPSDxox 0x5C #define ROP_DPSnoan 0x5D #define ROP_DPSDnaox 0x5E #define ROP_DPan 0x5F #define ROP_PDSxa 0x60 #define ROP_DSPDSaoxxn 0x61 #define ROP_DSPDoax 0x62 #define ROP_SDPnox 0x63 #define ROP_SDPSoax 0x64 #define ROP_DSPnox 0x65 #define ROP_DSx 0x66 #define ROP_SDPSonox 0x67 #define ROP_DSPDSonoxxn 0x68 #define ROP_PDSxxn 0x69 #define ROP_DPSax 0x6A #define ROP_PSDPSoaxxn 0x6B #define ROP_SDPax 0x6C #define ROP_PDSPDoaxxn 0x6D #define ROP_SDPSnoax 0x6E #define ROP_PDSxnan 0x6F #define ROP_PDSana 0x70 #define ROP_SSDxPDxaxn 0x71 #define ROP_SDPSxox 0x72 #define ROP_SDPnoan 0x73 #define ROP_DSPDxox 0x74 #define ROP_DSPnoan 0x75 #define ROP_SDPSnaox 0x76 #define ROP_DSan 0x77 #define ROP_PDSax 0x78 #define ROP_DSPDSoaxxn 0x79 #define ROP_DPSDnoax 0x7A #define ROP_SDPxnan 0x7B #define ROP_SPDSnoax 0x7C #define ROP_DPSxnan 0x7D #define ROP_SPxDSxo 0x7E #define ROP_DPSaan 0x7F #define ROP_DPSaa 0x80 #define ROP_SPxDSxon 0x81 #define ROP_DPSxna 0x82 #define ROP_SPDSnoaxn 0x83 #define ROP_SDPxna 0x84 #define ROP_PDSPnoaxn 0x85 #define ROP_DSPDSoaxx 0x86 #define ROP_PDSaxn 0x87 #define ROP_DSa 0x88 #define ROP_SDPSnaoxn 0x89 #define ROP_DSPnoa 0x8A #define ROP_DSPDxoxn 0x8B #define ROP_SDPnoa 0x8C #define ROP_SDPSxoxn 0x8D #define ROP_SSDxPDxax 0x8E #define ROP_PDSanan 0x8F #define ROP_PDSxna 0x90 #define ROP_SDPSnoaxn 0x91 #define ROP_DPSDPoaxx 0x92 #define ROP_SPDaxn 0x93 #define ROP_PSDPSoaxx 0x94 #define ROP_DPSaxn 0x95 #define ROP_DPSxx 0x96 #define ROP_PSDPSonoxx 0x97 #define ROP_SDPSonoxn 0x98 #define ROP_DSxn 0x99 #define ROP_DPSnax 0x9A #define ROP_SDPSoaxn 0x9B #define ROP_SPDnax 0x9C #define ROP_DSPDoaxn 0x9D #define ROP_DSPDSaoxx 0x9E #define ROP_PDSxan 0x9F #define ROP_DPa 0xA0 #define ROP_PDSPnaoxn 0xA1 #define ROP_DPSnoa 0xA2 #define ROP_DPSDxoxn 0xA3 #define ROP_PDSPonoxn 0xA4 #define ROP_PDxn 0xA5 #define ROP_DSPnax 0xA6 #define ROP_PDSPoaxn 0xA7 #define ROP_DPSoa 0xA8 #define ROP_DPSoxn 0xA9 #define ROP_D 0xAA #define ROP_DPSono 0xAB #define ROP_SPDSxax 0xAC #define ROP_DPSDaoxn 0xAD #define ROP_DSPnao 0xAE #define ROP_DPno 0xAF #define ROP_PDSnoa 0xB0 #define ROP_PDSPxoxn 0xB1 #define ROP_SSPxDSxox 0xB2 #define ROP_SDPanan 0xB3 #define ROP_PSDnax 0xB4 #define ROP_DPSDoaxn 0xB5 #define ROP_DPSDPaoxx 0xB6 #define ROP_SDPxan 0xB7 #define ROP_PSDPxax 0xB8 #define ROP_DSPDaoxn 0xB9 #define ROP_DPSnao 0xBA #define ROP_DSno 0xBB #define ROP_SPDSanax 0xBC #define ROP_SDxPDxan 0xBD #define ROP_DPSxo 0xBE #define ROP_DPSano 0xBF #define ROP_Psa 0xC0 #define ROP_SPDSnaoxn 0xC1 #define ROP_SPDSonoxn 0xC2 #define ROP_PSxn 0xC3 #define ROP_SPDnoa 0xC4 #define ROP_SPDSxoxn 0xC5 #define ROP_SDPnax 0xC6 #define ROP_PSDPoaxn 0xC7 #define ROP_SDPoa 0xC8 #define ROP_SPDoxn 0xC9 #define ROP_DPSDxax 0xCA #define ROP_SPDSaoxn 0xCB #define ROP_S 0xCC #define ROP_SDPono 0xCD #define ROP_SDPnao 0xCE #define ROP_SPno 0xCF #define ROP_PSDnoa 0xD0 #define ROP_PSDPxoxn 0xD1 #define ROP_PDSnax 0xD2 #define ROP_SPDSoaxn 0xD3 #define ROP_SSPxPDxax 0xD4 #define ROP_DPSanan 0xD5 #define ROP_PSDPSaoxx 0xD6 #define ROP_DPSxan 0xD7 #define ROP_PDSPxax 0xD8 #define ROP_SDPSaoxn 0xD9 #define ROP_DPSDanax 0xDA #define ROP_SPxDSxan 0xDB #define ROP_SPDnao 0xDC #define ROP_SDno 0xDD #define ROP_SDPxo 0xDE #define ROP_SDPano 0xDF #define ROP_PDSoa 0xE0 #define ROP_PDSoxn 0xE1 #define ROP_DSPDxax 0xE2 #define ROP_PSDPaoxn 0xE3 #define ROP_SDPSxax 0xE4 #define ROP_PDSPaoxn 0xE5 #define ROP_SDPSanax 0xE6 #define ROP_SPxPDxan 0xE7 #define ROP_SSPxDSxax 0xE8 #define ROP_DSPDSanaxxn 0xE9 #define ROP_DPSao 0xEA #define ROP_DPSxno 0xEB #define ROP_SDPao 0xEC #define ROP_SDPxno 0xED #define ROP_DSo 0xEE #define ROP_SDPnoo 0xEF #define ROP_P 0xF0 #define ROP_PDSono 0xF1 #define ROP_PDSnao 0xF2 #define ROP_PSno 0xF3 #define ROP_PSDnao 0xF4 #define ROP_PDno 0xF5 #define ROP_PDSxo 0xF6 #define ROP_PDSano 0xF7 #define ROP_PDSao 0xF8 #define ROP_PDSxno 0xF9 #define ROP_DPo 0xFA #define ROP_DPSnoo 0xFB #define ROP_PSo 0xFC #define ROP_PSDnoo 0xFD #define ROP_DPSoo 0xFE #define ROP_1 0xFF #define NO_SRC_ROP(rop) \ ((rop == GXnoop) || (rop == GXset) || (rop == GXclear) || (rop == GXinvert)) #endif /* _XAAROP_H */ xorg-server-1.20.8/hw/xfree86/common/xf86xvmc.c0000644000175000017500000001711613640201473016046 00000000000000 /* * Copyright (c) 2001-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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include #include #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" #include "xf86xvpriv.h" #include "xf86xvmc.h" typedef struct { CloseScreenProcPtr CloseScreen; int num_adaptors; XF86MCAdaptorPtr *adaptors; XvMCAdaptorPtr dixinfo; } xf86XvMCScreenRec, *xf86XvMCScreenPtr; static DevPrivateKeyRec XF86XvMCScreenKeyRec; #define XF86XvMCScreenKey (&XF86XvMCScreenKeyRec) #define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey) static int xf86XvMCCreateContext(XvPortPtr pPort, XvMCContextPtr pContext, int *num_priv, CARD32 **priv) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext) (pScrn, pContext, num_priv, priv); } static void xf86XvMCDestroyContext(XvMCContextPtr pContext) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn, pContext); } static int xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv) { XvMCContextPtr pContext = pSurface->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn, pSurface, num_priv, priv); } static void xf86XvMCDestroySurface(XvMCSurfacePtr pSurface) { XvMCContextPtr pContext = pSurface->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn, pSurface); } static int xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture, int *num_priv, CARD32 **priv) { XvMCContextPtr pContext = pSubpicture->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); return (*pScreenPriv->adaptors[pContext->adapt_num]-> CreateSubpicture) (pScrn, pSubpicture, num_priv, priv); } static void xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture) { XvMCContextPtr pContext = pSubpicture->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn, pSubpicture); } static Bool xf86XvMCCloseScreen(ScreenPtr pScreen) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; free(pScreenPriv->dixinfo); free(pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } Bool xf86XvMCScreenInit(ScreenPtr pScreen, int num_adaptors, XF86MCAdaptorPtr * adaptors) { XvMCAdaptorPtr pAdapt; xf86XvMCScreenPtr pScreenPriv; XvScreenPtr pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XF86XvScreenKey); int i, j; if (noXvExtension) return FALSE; if (!(pAdapt = xallocarray(num_adaptors, sizeof(XvMCAdaptorRec)))) return FALSE; if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0)) { free(pAdapt); return FALSE; } if (!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) { free(pAdapt); return FALSE; } dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86XvMCCloseScreen; pScreenPriv->num_adaptors = num_adaptors; pScreenPriv->adaptors = adaptors; pScreenPriv->dixinfo = pAdapt; for (i = 0; i < num_adaptors; i++) { pAdapt[i].xv_adaptor = NULL; for (j = 0; j < pxvs->nAdaptors; j++) { if (!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) { pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]); break; } } if (!pAdapt[i].xv_adaptor) { /* no adaptor by that name */ pScreenPriv->dixinfo = FALSE; free(pAdapt); return FALSE; } pAdapt[i].num_surfaces = (*adaptors)->num_surfaces; pAdapt[i].surfaces = (XvMCSurfaceInfoPtr *) ((*adaptors)->surfaces); pAdapt[i].num_subpictures = (*adaptors)->num_subpictures; pAdapt[i].subpictures = (XvImagePtr *) ((*adaptors)->subpictures); pAdapt[i].CreateContext = xf86XvMCCreateContext; pAdapt[i].DestroyContext = xf86XvMCDestroyContext; pAdapt[i].CreateSurface = xf86XvMCCreateSurface; pAdapt[i].DestroySurface = xf86XvMCDestroySurface; pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture; pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture; adaptors++; } if (Success != XvMCScreenInit(pScreen, num_adaptors, pAdapt)) return FALSE; return TRUE; } XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void) { return calloc(1, sizeof(XF86MCAdaptorRec)); } void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor) { free(adaptor); } xorg-server-1.20.8/hw/xfree86/common/xf86.h0000644000175000017500000004030513640201473015151 00000000000000/* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains declarations for public XFree86 functions and variables, * and definitions of public macros. * * "public" means available to video drivers. */ #ifndef _XF86_H #define _XF86_H #ifdef HAVE_XORG_CONFIG_H #include #elif HAVE_DIX_CONFIG_H #include #endif #include "xf86str.h" #include "xf86Opt.h" #include #include #ifdef RANDR #include #endif #include "propertyst.h" /* General parameters */ extern _X_EXPORT int xf86DoConfigure; extern _X_EXPORT int xf86DoShowOptions; extern _X_EXPORT Bool xf86DoConfigurePass1; extern _X_EXPORT Bool xf86ProbeIgnorePrimary; extern _X_EXPORT Bool xorgHWAccess; extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec; #define xf86ScreenKey (&xf86ScreenKeyRec) extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern _X_EXPORT const unsigned char byte_reversed[256]; extern _X_EXPORT Bool fbSlotClaimed; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) extern _X_EXPORT Bool sbusSlotClaimed; #endif #if defined(XSERVER_PLATFORM_BUS) extern _X_EXPORT int platformSlotClaimed; #endif extern _X_EXPORT confDRIRec xf86ConfigDRI; extern _X_EXPORT Bool xf86DRI2Enabled(void); #define XF86SCRNINFO(p) xf86ScreenToScrn(p) #define XF86FLIP_PIXELS() \ do { \ if (xf86GetFlipPixels()) { \ pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \ pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \ } \ while (0) #define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE") /* Compatibility functions for pre-input-thread drivers */ static inline _X_DEPRECATED int xf86BlockSIGIO(void) { input_lock(); return 0; } static inline _X_DEPRECATED void xf86UnblockSIGIO(int wasset) { input_unlock(); } /* Function Prototypes */ #ifndef _NO_XF86_PROTOTYPES /* PCI related */ #ifdef XSERVER_LIBPCIACCESS #include extern _X_EXPORT int pciSlotClaimed; extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *); extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp, int chipset, GDevPtr dev, Bool active); extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *, GDevPtr dev); extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func); extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func); extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device *pPci); extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device *pPci, memType base); extern _X_EXPORT struct pci_device *xf86GetPciInfoForEntity(int entityIndex); extern _X_EXPORT int xf86MatchPciInstances(const char *driverName, int vendorID, SymTabPtr chipsets, PciChipsets * PCIchipsets, GDevPtr * devList, int numDevs, DriverPtr drvp, int **foundEntities); extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, PciChipsets * p_chip, void *dummy, EntityProc init, EntityProc enter, EntityProc leave, void *private); #else #define xf86VGAarbiterInit() do {} while (0) #define xf86VGAarbiterFini() do {} while (0) #define xf86VGAarbiterLock(x) do {} while (0) #define xf86VGAarbiterUnlock(x) do {} while (0) #define xf86VGAarbiterScrnInit(x) do {} while (0) #define xf86VGAarbiterDeviceDecodes() do {} while (0) #define xf86VGAarbiterWrapFunctions() do {} while (0) #endif /* xf86Bus.c */ extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex); extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp); extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance); extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex); extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance); extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex); extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex); extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); extern _X_EXPORT int xf86GetLastScrnFlag(int entityIndex); extern _X_EXPORT void xf86SetLastScrnFlag(int entityIndex, int scrnIndex); extern _X_EXPORT Bool xf86IsEntityShared(int entityIndex); extern _X_EXPORT void xf86SetEntityShared(int entityIndex); extern _X_EXPORT Bool xf86IsEntitySharable(int entityIndex); extern _X_EXPORT void xf86SetEntitySharable(int entityIndex); extern _X_EXPORT Bool xf86IsPrimInitDone(int entityIndex); extern _X_EXPORT void xf86SetPrimInitDone(int entityIndex); extern _X_EXPORT void xf86ClearPrimInitDone(int entityIndex); extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void); extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); /* xf86Configure.c */ extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset); /* xf86Cursor.c */ extern _X_EXPORT void xf86LockZoom(ScreenPtr pScreen, int lock); extern _X_EXPORT void xf86InitViewport(ScrnInfoPtr pScr); extern _X_EXPORT void xf86SetViewport(ScreenPtr pScreen, int x, int y); extern _X_EXPORT void xf86ZoomViewport(ScreenPtr pScreen, int zoom); extern _X_EXPORT Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode); extern _X_EXPORT void *xf86GetPointerScreenFuncs(void); extern _X_EXPORT void xf86InitOrigins(void); extern _X_EXPORT void xf86ReconfigureLayout(void); /* xf86DPMS.c */ extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags); /* xf86DGA.c */ #ifdef XFreeXDGA extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num); extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num); extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode; #endif /* xf86Events.c */ typedef struct _InputInfoRec *InputInfoPtr; extern _X_EXPORT void SetTimeSinceLastInputEvent(void); extern _X_EXPORT void *xf86AddInputHandler(int fd, InputHandlerProc proc, void *data); extern _X_EXPORT int xf86RemoveInputHandler(void *handler); extern _X_EXPORT void xf86DisableInputHandler(void *handler); extern _X_EXPORT void xf86EnableInputHandler(void *handler); extern _X_EXPORT void *xf86AddGeneralHandler(int fd, InputHandlerProc proc, void *data); extern _X_EXPORT int xf86RemoveGeneralHandler(void *handler); extern _X_EXPORT void xf86DisableGeneralHandler(void *handler); extern _X_EXPORT void xf86EnableGeneralHandler(void *handler); extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc handler, void *data); extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg); extern _X_EXPORT void xf86PrintBacktrace(void); extern _X_EXPORT Bool xf86VTOwner(void); extern _X_EXPORT void xf86VTLeave(void); extern _X_EXPORT void xf86VTEnter(void); extern _X_EXPORT void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo); extern _X_EXPORT void xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo); /* xf86Helper.c */ extern _X_EXPORT void xf86AddDriver(DriverPtr driver, void *module, int flags); extern _X_EXPORT void xf86DeleteDriver(int drvIndex); extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); extern _X_EXPORT void xf86DeleteScreen(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void); extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad); extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp, int depth24flags); extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp); extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask); extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen); extern _X_EXPORT void xf86EnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable); extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args) _X_ATTRIBUTE_PRINTF(4, 0); extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(4, 5); extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(3, 4); extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(3, 4); extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT void xf86ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern _X_EXPORT const char * xf86TokenToString(SymTabPtr table, int token); extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string); extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from); extern _X_EXPORT void xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips); extern _X_EXPORT int xf86MatchDevice(const char *drivername, GDevPtr ** driversectlist); extern _X_EXPORT const char * xf86GetVisualName(int visual); extern _X_EXPORT int xf86GetVerbosity(void); extern _X_EXPORT int xf86GetDepth(void); extern _X_EXPORT rgb xf86GetWeight(void); extern _X_EXPORT Gamma xf86GetGamma(void); extern _X_EXPORT Bool xf86GetFlipPixels(void); extern _X_EXPORT const char * xf86GetServerName(void); extern _X_EXPORT Bool xf86ServerIsExiting(void); extern _X_EXPORT Bool xf86ServerIsResetting(void); extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void); extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void); extern _X_EXPORT Bool xf86GetVidModeEnabled(void); extern _X_EXPORT Bool xf86GetModInDevAllowNonLocal(void); extern _X_EXPORT Bool xf86GetModInDevEnabled(void); extern _X_EXPORT Bool xf86GetAllowMouseOpenFail(void); extern _X_EXPORT CARD32 xorgGetVersion(void); extern _X_EXPORT CARD32 xf86GetModuleVersion(void *module); extern _X_EXPORT void * xf86LoadDrvSubModule(DriverPtr drv, const char *name); extern _X_EXPORT void * xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); extern _X_EXPORT void * xf86LoadOneModule(const char *name, void *optlist); extern _X_EXPORT void xf86UnloadSubModule(void *mod); extern _X_EXPORT Bool xf86LoaderCheckSymbol(const char *name); extern _X_EXPORT void xf86SetBackingStore(ScreenPtr pScreen); extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen); extern _X_EXPORT void * xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, const char *port_name, const char **adaptor_name, void **adaptor_options); extern _X_EXPORT ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, void *private); extern _X_EXPORT Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn); extern _X_EXPORT Bool xf86IsUnblank(int mode); /* xf86Init.c */ extern _X_EXPORT PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth); extern _X_EXPORT int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth); /* xf86Mode.c */ extern _X_EXPORT const char * xf86ModeStatusToString(ModeStatus status); extern _X_EXPORT ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor); extern _X_EXPORT ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags); extern _X_EXPORT int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int minHeight, int maxHeight, int pitchInc, int virtualX, int virtualY, int apertureSize, LookupModeFlags strategy); extern _X_EXPORT void xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode); extern _X_EXPORT void xf86PruneDriverModes(ScrnInfoPtr scrp); extern _X_EXPORT void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); extern _X_EXPORT void xf86PrintModes(ScrnInfoPtr scrp); extern _X_EXPORT void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); /* xf86Option.c */ extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts); /* xf86RandR.c */ #ifdef RANDR extern _X_EXPORT Bool xf86RandRInit(ScreenPtr pScreen); extern _X_EXPORT Rotation xf86GetRotation(ScreenPtr pScreen); extern _X_EXPORT Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, int newvirtX, int newvirtY, int newmmWidth, int newmmHeight, Bool resetMode); #endif /* xf86Extensions.c */ extern void xf86ExtensionInit(void); /* convert ScreenPtr to ScrnInfoPtr */ extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen); /* convert ScrnInfoPtr to ScreenPtr */ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn); #endif /* _NO_XF86_PROTOTYPES */ #define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */ #define XF86_SCRN_INTERFACE 1 /* define for drivers to use in api compat */ /* flags passed to xf86 allocate screen */ #define XF86_ALLOCATE_GPU_SCREEN 1 /* Update the internal total dimensions of all ScreenRecs together */ extern _X_EXPORT void xf86UpdateDesktopDimensions(void); #endif /* _XF86_H */ xorg-server-1.20.8/hw/xfree86/common/xf86VGAarbiterPriv.h0000644000175000017500000003151013640201473017717 00000000000000/* * Copyright (c) 2009 Tiago Vignatti * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" #include #include "colormapst.h" #include "scrnintstr.h" #include "screenint.h" #include "gcstruct.h" #include "pixmapstr.h" #include "pixmap.h" #include "windowstr.h" #include "window.h" #include "xf86str.h" #include "mipointer.h" #include "mipointrst.h" #include "picturestr.h" #define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;} #define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x #define SCREEN_PRIV() ((VGAarbiterScreenPtr) dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey)) #define SCREEN_PROLOG(x) (pScreen->x = SCREEN_PRIV()->x) #define SCREEN_EPILOG(x,y) do { \ SCREEN_PRIV()->x = pScreen->x; \ pScreen->x = y; \ } while (0) #define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\ ps->x = y;} #define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;} #define PICTURE_PROLOGUE(field) ps->field = \ ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ VGAarbiterScreenKey))->field #define PICTURE_EPILOGUE(field, wrap) ps->field = wrap #define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0) #define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x #define SPRITE_PROLOG \ miPointerScreenPtr PointPriv; \ VGAarbiterScreenPtr pScreenPriv; \ input_lock(); \ PointPriv = dixLookupPrivate(&pScreen->devPrivates, \ miPointerScreenKey); \ pScreenPriv = dixLookupPrivate(&(pScreen)->devPrivates, \ VGAarbiterScreenKey); \ PointPriv->spriteFuncs = pScreenPriv->miSprite; \ #define SPRITE_EPILOG \ pScreenPriv->miSprite = PointPriv->spriteFuncs; \ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \ input_unlock(); #define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \ } while (0) #define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite #define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\ pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\ (x)->funcs = &VGAarbiterGCFuncs; #define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \ (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\ (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs; static inline void VGAGet(ScreenPtr pScreen) { pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev); pci_device_vgaarb_lock(); } static inline void VGAPut(void) { pci_device_vgaarb_unlock(); } typedef struct _VGAarbiterScreen { CreateGCProcPtr CreateGC; CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; ScreenWakeupHandlerProcPtr WakeupHandler; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; CreatePixmapProcPtr CreatePixmap; SaveScreenProcPtr SaveScreen; /* Colormap */ StoreColorsProcPtr StoreColors; /* Cursor */ DisplayCursorProcPtr DisplayCursor; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; void (*AdjustFrame) (ScrnInfoPtr, int, int); Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); Bool (*EnterVT) (ScrnInfoPtr); void (*LeaveVT) (ScrnInfoPtr); void (*FreeScreen) (ScrnInfoPtr); miPointerSpriteFuncPtr miSprite; CompositeProcPtr Composite; GlyphsProcPtr Glyphs; CompositeRectsProcPtr CompositeRects; } VGAarbiterScreenRec, *VGAarbiterScreenPtr; typedef struct _VGAarbiterGC { const GCOps *wrapOps; const GCFuncs *wrapFuncs; } VGAarbiterGCRec, *VGAarbiterGCPtr; /* Screen funcs */ static void VGAarbiterBlockHandler(ScreenPtr pScreen, void *pTimeout); static void VGAarbiterWakeupHandler(ScreenPtr pScreen, int result); static Bool VGAarbiterCloseScreen(ScreenPtr pScreen); static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); static void VGAarbiterGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); static void VGAarbiterSourceValidate(DrawablePtr pDrawable, int x, int y, int width, int height, unsigned int subWindowMode); static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); static void VGAarbiterClearToBackground(WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures); static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned int usage_hint); static Bool VGAarbiterCreateGC(GCPtr pGC); static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank); static void VGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs); static void VGAarbiterRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); static Bool VGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static Bool VGAarbiterUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent); static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y); static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn); static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn); static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn); /* GC funcs */ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask); static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void VGAarbiterDestroyGC(GCPtr pGC); static void VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); static void VGAarbiterDestroyClip(GCPtr pGC); static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc); /* GC ops */ static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage); static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GC * pGC, int srcx, int srcy, int width, int height, int dstx, int dsty); static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane); static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, xPoint * pptInit); static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit); static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg); static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nRectsInit, xRectangle *pRectsInit); static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs); static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape, int mode, int count, DDXPointPtr ptsIn); static void VGAarbiterPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill, xRectangle *prectInit); static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs); static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars); static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars); static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase); static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase); static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg); /* miSpriteFuncs */ static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur); static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur); static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y); static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs); static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects); xorg-server-1.20.8/hw/xfree86/common/xf86fbBus.c0000644000175000017500000000534213640201473016130 00000000000000/* * Copyright (c) 2000-2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the interfaces to the bus-specific code */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86Bus.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" Bool fbSlotClaimed = FALSE; int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) { EntityPtr p; int num; #ifdef XSERVER_PLATFORM_BUS if (platformSlotClaimed) return -1; #endif #ifdef XSERVER_LIBPCIACCESS if (pciSlotClaimed) return -1; #endif #if defined(__sparc__) || defined (__sparc64__) if (sbusSlotClaimed) return -1; #endif num = xf86AllocateEntity(); p = xf86Entities[num]; p->driver = drvp; p->chipset = 0; p->bus.type = BUS_NONE; p->active = active; p->inUse = FALSE; xf86AddDevToEntity(num, dev); fbSlotClaimed = TRUE; return num; } /* * Get the list of FB "slots" claimed by a screen */ int xf86GetFbInfoForScreen(int scrnIndex) { int num = 0; int i; EntityPtr p; for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) { p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]; if (p->bus.type == BUS_NONE) { num++; } } return num; } xorg-server-1.20.8/hw/xfree86/common/xf86fbman.c0000644000175000017500000011735013640201473016155 00000000000000 /* * Copyright (c) 1998-2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "misc.h" #include "xf86.h" #include #include "scrnintstr.h" #include "regionstr.h" #include "xf86fbman.h" /* #define DEBUG */ static DevPrivateKeyRec xf86FBManagerKeyRec; static DevPrivateKey xf86FBManagerKey; Bool xf86RegisterOffscreenManager(ScreenPtr pScreen, FBManagerFuncsPtr funcs) { xf86FBManagerKey = &xf86FBManagerKeyRec; if (!dixRegisterPrivateKey(&xf86FBManagerKeyRec, PRIVATE_SCREEN, 0)) return FALSE; dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs); return TRUE; } Bool xf86FBManagerRunning(ScreenPtr pScreen) { if (xf86FBManagerKey == NULL) return FALSE; if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey)) return FALSE; return TRUE; } Bool xf86RegisterFreeBoxCallback(ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, void *devPriv) { FBManagerFuncsPtr funcs; if (xf86FBManagerKey == NULL) return FALSE; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->RegisterFreeBoxCallback) (pScreen, FreeBoxCallback, devPriv); } FBAreaPtr xf86AllocateOffscreenArea(ScreenPtr pScreen, int w, int h, int gran, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData) { FBManagerFuncsPtr funcs; if (xf86FBManagerKey == NULL) return NULL; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return NULL; return (*funcs->AllocateOffscreenArea) (pScreen, w, h, gran, moveCB, removeCB, privData); } FBLinearPtr xf86AllocateOffscreenLinear(ScreenPtr pScreen, int length, int gran, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, void *privData) { FBManagerFuncsPtr funcs; if (xf86FBManagerKey == NULL) return NULL; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return NULL; return (*funcs->AllocateOffscreenLinear) (pScreen, length, gran, moveCB, removeCB, privData); } void xf86FreeOffscreenArea(FBAreaPtr area) { FBManagerFuncsPtr funcs; if (!area) return; if (xf86FBManagerKey == NULL) return; if (! (funcs = (FBManagerFuncsPtr) dixLookupPrivate(&area->pScreen->devPrivates, xf86FBManagerKey))) return; (*funcs->FreeOffscreenArea) (area); return; } void xf86FreeOffscreenLinear(FBLinearPtr linear) { FBManagerFuncsPtr funcs; if (!linear) return; if (xf86FBManagerKey == NULL) return; if (! (funcs = (FBManagerFuncsPtr) dixLookupPrivate(&linear->pScreen->devPrivates, xf86FBManagerKey))) return; (*funcs->FreeOffscreenLinear) (linear); return; } Bool xf86ResizeOffscreenArea(FBAreaPtr resize, int w, int h) { FBManagerFuncsPtr funcs; if (!resize) return FALSE; if (xf86FBManagerKey == NULL) return FALSE; if (! (funcs = (FBManagerFuncsPtr) dixLookupPrivate(&resize->pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->ResizeOffscreenArea) (resize, w, h); } Bool xf86ResizeOffscreenLinear(FBLinearPtr resize, int size) { FBManagerFuncsPtr funcs; if (!resize) return FALSE; if (xf86FBManagerKey == NULL) return FALSE; if (! (funcs = (FBManagerFuncsPtr) dixLookupPrivate(&resize->pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->ResizeOffscreenLinear) (resize, size); } Bool xf86QueryLargestOffscreenArea(ScreenPtr pScreen, int *w, int *h, int gran, int preferences, int severity) { FBManagerFuncsPtr funcs; *w = 0; *h = 0; if (xf86FBManagerKey == NULL) return FALSE; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->QueryLargestOffscreenArea) (pScreen, w, h, gran, preferences, severity); } Bool xf86QueryLargestOffscreenLinear(ScreenPtr pScreen, int *size, int gran, int severity) { FBManagerFuncsPtr funcs; *size = 0; if (xf86FBManagerKey == NULL) return FALSE; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->QueryLargestOffscreenLinear) (pScreen, size, gran, severity); } Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen) { FBManagerFuncsPtr funcs; if (xf86FBManagerKey == NULL) return FALSE; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->PurgeOffscreenAreas) (pScreen); } /************************************************************\ Below is a specific implementation of an offscreen manager. \************************************************************/ static DevPrivateKeyRec xf86FBScreenKeyRec; #define xf86FBScreenKey (&xf86FBScreenKeyRec) typedef struct _FBLink { FBArea area; struct _FBLink *next; } FBLink, *FBLinkPtr; typedef struct _FBLinearLink { FBLinear linear; int free; /* need to add free here as FBLinear is publicly accessible */ FBAreaPtr area; /* only used if allocation came from XY area */ struct _FBLinearLink *next; } FBLinearLink, *FBLinearLinkPtr; typedef struct { ScreenPtr pScreen; RegionPtr InitialBoxes; RegionPtr FreeBoxes; FBLinkPtr UsedAreas; int NumUsedAreas; FBLinearLinkPtr LinearAreas; CloseScreenProcPtr CloseScreen; int NumCallbacks; FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback; DevUnion *devPrivates; } FBManager, *FBManagerPtr; static void SendCallFreeBoxCallbacks(FBManagerPtr offman) { int i = offman->NumCallbacks; while (i--) { (*offman->FreeBoxesUpdateCallback[i]) (offman->pScreen, offman->FreeBoxes, offman->devPrivates[i].ptr); } } static Bool localRegisterFreeBoxCallback(ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, void *devPriv) { FBManagerPtr offman; FreeBoxCallbackProcPtr *newCallbacks; DevUnion *newPrivates; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); newCallbacks = reallocarray(offman->FreeBoxesUpdateCallback, offman->NumCallbacks + 1, sizeof(FreeBoxCallbackProcPtr)); if (!newCallbacks) return FALSE; else offman->FreeBoxesUpdateCallback = newCallbacks; newPrivates = reallocarray(offman->devPrivates, offman->NumCallbacks + 1, sizeof(DevUnion)); if (!newPrivates) return FALSE; else offman->devPrivates = newPrivates; offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback; offman->devPrivates[offman->NumCallbacks].ptr = devPriv; offman->NumCallbacks++; SendCallFreeBoxCallbacks(offman); return TRUE; } static FBAreaPtr AllocateArea(FBManagerPtr offman, int w, int h, int granularity, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData) { ScreenPtr pScreen = offman->pScreen; FBLinkPtr link = NULL; FBAreaPtr area = NULL; RegionRec NewReg; int i, x = 0, num; BoxPtr boxp; if (granularity <= 1) granularity = 0; boxp = RegionRects(offman->FreeBoxes); num = RegionNumRects(offman->FreeBoxes); /* look through the free boxes */ for (i = 0; i < num; i++, boxp++) { x = boxp->x1; if (granularity > 1) x = ((x + granularity - 1) / granularity) * granularity; if (((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) continue; link = malloc(sizeof(FBLink)); if (!link) return NULL; area = &(link->area); link->next = offman->UsedAreas; offman->UsedAreas = link; offman->NumUsedAreas++; break; } /* try to boot a removeable one out if we are not expendable ourselves */ if (!area && !removeCB) { link = offman->UsedAreas; while (link) { if (!link->area.RemoveAreaCallback) { link = link->next; continue; } boxp = &(link->area.box); x = boxp->x1; if (granularity > 1) x = ((x + granularity - 1) / granularity) * granularity; if (((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) { link = link->next; continue; } /* bye, bye */ (*link->area.RemoveAreaCallback) (&link->area); RegionInit(&NewReg, &(link->area.box), 1); RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &NewReg); RegionUninit(&NewReg); area = &(link->area); break; } } if (area) { area->pScreen = pScreen; area->granularity = granularity; area->box.x1 = x; area->box.x2 = x + w; area->box.y1 = boxp->y1; area->box.y2 = boxp->y1 + h; area->MoveAreaCallback = moveCB; area->RemoveAreaCallback = removeCB; area->devPrivate.ptr = privData; RegionInit(&NewReg, &(area->box), 1); RegionSubtract(offman->FreeBoxes, offman->FreeBoxes, &NewReg); RegionUninit(&NewReg); } return area; } static FBAreaPtr localAllocateOffscreenArea(ScreenPtr pScreen, int w, int h, int gran, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData) { FBManagerPtr offman; FBAreaPtr area = NULL; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); if ((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData))) SendCallFreeBoxCallbacks(offman); return area; } static void localFreeOffscreenArea(FBAreaPtr area) { FBManagerPtr offman; FBLinkPtr pLink, pLinkPrev = NULL; RegionRec FreedRegion; ScreenPtr pScreen; pScreen = area->pScreen; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pLink = offman->UsedAreas; if (!pLink) return; while (&(pLink->area) != area) { pLinkPrev = pLink; pLink = pLink->next; if (!pLink) return; } /* put the area back into the pool */ RegionInit(&FreedRegion, &(pLink->area.box), 1); RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedRegion); RegionUninit(&FreedRegion); if (pLinkPrev) pLinkPrev->next = pLink->next; else offman->UsedAreas = pLink->next; free(pLink); offman->NumUsedAreas--; SendCallFreeBoxCallbacks(offman); } static Bool localResizeOffscreenArea(FBAreaPtr resize, int w, int h) { FBManagerPtr offman; ScreenPtr pScreen; BoxRec OrigArea; RegionRec FreedReg; FBAreaPtr area = NULL; FBLinkPtr pLink, newLink, pLinkPrev = NULL; pScreen = resize->pScreen; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); /* find this link */ if (!(pLink = offman->UsedAreas)) return FALSE; while (&(pLink->area) != resize) { pLinkPrev = pLink; pLink = pLink->next; if (!pLink) return FALSE; } OrigArea.x1 = resize->box.x1; OrigArea.x2 = resize->box.x2; OrigArea.y1 = resize->box.y1; OrigArea.y2 = resize->box.y2; /* if it's smaller, this is easy */ if ((w <= (resize->box.x2 - resize->box.x1)) && (h <= (resize->box.y2 - resize->box.y1))) { RegionRec NewReg; resize->box.x2 = resize->box.x1 + w; resize->box.y2 = resize->box.y1 + h; if ((resize->box.y2 == OrigArea.y2) && (resize->box.x2 == OrigArea.x2)) return TRUE; RegionInit(&FreedReg, &OrigArea, 1); RegionInit(&NewReg, &(resize->box), 1); RegionSubtract(&FreedReg, &FreedReg, &NewReg); RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedReg); RegionUninit(&FreedReg); RegionUninit(&NewReg); SendCallFreeBoxCallbacks(offman); return TRUE; } /* otherwise we remove the old region */ RegionInit(&FreedReg, &OrigArea, 1); RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedReg); /* remove the old link */ if (pLinkPrev) pLinkPrev->next = pLink->next; else offman->UsedAreas = pLink->next; /* and try to add a new one */ if ((area = AllocateArea(offman, w, h, resize->granularity, resize->MoveAreaCallback, resize->RemoveAreaCallback, resize->devPrivate.ptr))) { /* copy data over to our link and replace the new with old */ memcpy(resize, area, sizeof(FBArea)); pLinkPrev = NULL; newLink = offman->UsedAreas; while (&(newLink->area) != area) { pLinkPrev = newLink; newLink = newLink->next; } if (pLinkPrev) pLinkPrev->next = newLink->next; else offman->UsedAreas = newLink->next; pLink->next = offman->UsedAreas; offman->UsedAreas = pLink; free(newLink); /* AllocateArea added one but we really only exchanged one */ offman->NumUsedAreas--; } else { /* reinstate the old region */ RegionSubtract(offman->FreeBoxes, offman->FreeBoxes, &FreedReg); RegionUninit(&FreedReg); pLink->next = offman->UsedAreas; offman->UsedAreas = pLink; return FALSE; } RegionUninit(&FreedReg); SendCallFreeBoxCallbacks(offman); return TRUE; } static Bool localQueryLargestOffscreenArea(ScreenPtr pScreen, int *width, int *height, int granularity, int preferences, int severity) { FBManagerPtr offman; RegionPtr newRegion = NULL; BoxPtr pbox; int nbox; int x, w, h, area, oldArea; *width = *height = oldArea = 0; if (granularity <= 1) granularity = 0; if ((preferences < 0) || (preferences > 3)) return FALSE; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); if (severity < 0) severity = 0; if (severity > 2) severity = 2; switch (severity) { case 2: if (offman->NumUsedAreas) { FBLinkPtr pLink; RegionRec tmpRegion; newRegion = RegionCreate(NULL, 1); RegionCopy(newRegion, offman->InitialBoxes); pLink = offman->UsedAreas; while (pLink) { if (!pLink->area.RemoveAreaCallback) { RegionInit(&tmpRegion, &(pLink->area.box), 1); RegionSubtract(newRegion, newRegion, &tmpRegion); RegionUninit(&tmpRegion); } pLink = pLink->next; } nbox = RegionNumRects(newRegion); pbox = RegionRects(newRegion); break; } case 1: if (offman->NumUsedAreas) { FBLinkPtr pLink; RegionRec tmpRegion; newRegion = RegionCreate(NULL, 1); RegionCopy(newRegion, offman->FreeBoxes); pLink = offman->UsedAreas; while (pLink) { if (pLink->area.RemoveAreaCallback) { RegionInit(&tmpRegion, &(pLink->area.box), 1); RegionAppend(newRegion, &tmpRegion); RegionUninit(&tmpRegion); } pLink = pLink->next; } nbox = RegionNumRects(newRegion); pbox = RegionRects(newRegion); break; } default: nbox = RegionNumRects(offman->FreeBoxes); pbox = RegionRects(offman->FreeBoxes); break; } while (nbox--) { x = pbox->x1; if (granularity > 1) x = ((x + granularity - 1) / granularity) * granularity; w = pbox->x2 - x; h = pbox->y2 - pbox->y1; area = w * h; if (w > 0) { Bool gotIt = FALSE; switch (preferences) { case FAVOR_AREA_THEN_WIDTH: if ((area > oldArea) || ((area == oldArea) && (w > *width))) gotIt = TRUE; break; case FAVOR_AREA_THEN_HEIGHT: if ((area > oldArea) || ((area == oldArea) && (h > *height))) gotIt = TRUE; break; case FAVOR_WIDTH_THEN_AREA: if ((w > *width) || ((w == *width) && (area > oldArea))) gotIt = TRUE; break; case FAVOR_HEIGHT_THEN_AREA: if ((h > *height) || ((h == *height) && (area > oldArea))) gotIt = TRUE; break; } if (gotIt) { *width = w; *height = h; oldArea = area; } } pbox++; } if (newRegion) RegionDestroy(newRegion); return TRUE; } static Bool localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen) { FBManagerPtr offman; FBLinkPtr pLink, tmp, pPrev = NULL; RegionRec FreedRegion; Bool anyUsed = FALSE; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pLink = offman->UsedAreas; if (!pLink) return TRUE; while (pLink) { if (pLink->area.RemoveAreaCallback) { (*pLink->area.RemoveAreaCallback) (&pLink->area); RegionInit(&FreedRegion, &(pLink->area.box), 1); RegionAppend(offman->FreeBoxes, &FreedRegion); RegionUninit(&FreedRegion); if (pPrev) pPrev->next = pLink->next; else offman->UsedAreas = pLink->next; tmp = pLink; pLink = pLink->next; free(tmp); offman->NumUsedAreas--; anyUsed = TRUE; } else { pPrev = pLink; pLink = pLink->next; } } if (anyUsed) { RegionValidate(offman->FreeBoxes, &anyUsed); SendCallFreeBoxCallbacks(offman); } return TRUE; } static void LinearMoveCBWrapper(FBAreaPtr from, FBAreaPtr to) { /* this will never get called */ } static void LinearRemoveCBWrapper(FBAreaPtr area) { FBManagerPtr offman; FBLinearLinkPtr pLink, pLinkPrev = NULL; ScreenPtr pScreen = area->pScreen; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pLink = offman->LinearAreas; if (!pLink) return; while (pLink->area != area) { pLinkPrev = pLink; pLink = pLink->next; if (!pLink) return; } /* give the user the callback it is expecting */ (*pLink->linear.RemoveLinearCallback) (&(pLink->linear)); if (pLinkPrev) pLinkPrev->next = pLink->next; else offman->LinearAreas = pLink->next; free(pLink); } static void DumpDebug(FBLinearLinkPtr pLink) { #ifdef DEBUG if (!pLink) ErrorF("MMmm, PLINK IS NULL!\n"); while (pLink) { ErrorF(" Offset:%08x, Size:%08x, %s,%s\n", pLink->linear.offset, pLink->linear.size, pLink->free ? "Free" : "Used", pLink->area ? "Area" : "Linear"); pLink = pLink->next; } #endif } static FBLinearPtr AllocateLinear(FBManagerPtr offman, int size, int granularity, void *privData) { ScreenPtr pScreen = offman->pScreen; FBLinearLinkPtr linear = NULL; FBLinearLinkPtr newlink = NULL; int offset, end; if (size <= 0) return NULL; if (!offman->LinearAreas) return NULL; linear = offman->LinearAreas; while (linear) { /* Make sure we get a free area that's not an XY fallback case */ if (!linear->area && linear->free) { offset = linear->linear.offset; if (granularity > 1) offset = ((offset + granularity - 1) / granularity) * granularity; end = offset + size; if (end <= (linear->linear.offset + linear->linear.size)) break; } linear = linear->next; } if (!linear) return NULL; /* break left */ if (offset > linear->linear.offset) { newlink = malloc(sizeof(FBLinearLink)); if (!newlink) return NULL; newlink->area = NULL; newlink->linear.offset = offset; newlink->linear.size = linear->linear.size - (offset - linear->linear.offset); newlink->free = 1; newlink->next = linear->next; linear->linear.size -= newlink->linear.size; linear->next = newlink; linear = newlink; } /* break right */ if (size < linear->linear.size) { newlink = malloc(sizeof(FBLinearLink)); if (!newlink) return NULL; newlink->area = NULL; newlink->linear.offset = offset + size; newlink->linear.size = linear->linear.size - size; newlink->free = 1; newlink->next = linear->next; linear->linear.size = size; linear->next = newlink; } /* p = middle block */ linear->linear.granularity = granularity; linear->free = 0; linear->linear.pScreen = pScreen; linear->linear.MoveLinearCallback = NULL; linear->linear.RemoveLinearCallback = NULL; linear->linear.devPrivate.ptr = NULL; DumpDebug(offman->LinearAreas); return &(linear->linear); } static FBLinearPtr localAllocateOffscreenLinear(ScreenPtr pScreen, int length, int gran, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, void *privData) { FBManagerPtr offman; FBLinearLinkPtr link; FBAreaPtr area; FBLinearPtr linear = NULL; BoxPtr extents; int w, h, pitch; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); /* Try to allocate from linear memory first...... */ DebugF("ALLOCATING LINEAR\n"); if ((linear = AllocateLinear(offman, length, gran, privData))) return linear; DebugF("NOPE, ALLOCATING AREA\n"); if (!(link = malloc(sizeof(FBLinearLink)))) return NULL; /* No linear available, so try and pinch some from the XY areas */ extents = RegionExtents(offman->InitialBoxes); pitch = extents->x2 - extents->x1; if (gran > 1) { if (gran > pitch) { /* we can't match the specified alignment with XY allocations */ free(link); return NULL; } if (pitch % gran) { /* pitch and granularity aren't a perfect match, let's allocate * a bit more so we can align later on */ length += gran - 1; } } if (length < pitch) { /* special case */ w = length; h = 1; } else { w = pitch; h = (length + pitch - 1) / pitch; } if ((area = localAllocateOffscreenArea(pScreen, w, h, gran, moveCB ? LinearMoveCBWrapper : NULL, removeCB ? LinearRemoveCBWrapper : NULL, privData))) { link->area = area; link->free = 0; link->next = offman->LinearAreas; offman->LinearAreas = link; linear = &(link->linear); linear->pScreen = pScreen; linear->size = h * w; linear->offset = (pitch * area->box.y1) + area->box.x1; if (gran > 1) linear->offset = ((linear->offset + gran - 1) / gran) * gran; linear->granularity = gran; linear->MoveLinearCallback = moveCB; linear->RemoveLinearCallback = removeCB; linear->devPrivate.ptr = privData; } else free(link); DumpDebug(offman->LinearAreas); return linear; } static void localFreeOffscreenLinear(FBLinearPtr linear) { FBManagerPtr offman; FBLinearLinkPtr pLink, pLinkPrev = NULL; ScreenPtr pScreen = linear->pScreen; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pLink = offman->LinearAreas; if (!pLink) return; while (&(pLink->linear) != linear) { pLinkPrev = pLink; pLink = pLink->next; if (!pLink) return; } if (pLink->area) { /* really an XY area */ DebugF("FREEING AREA\n"); localFreeOffscreenArea(pLink->area); if (pLinkPrev) pLinkPrev->next = pLink->next; else offman->LinearAreas = pLink->next; free(pLink); DumpDebug(offman->LinearAreas); return; } pLink->free = 1; if (pLink->next && pLink->next->free) { FBLinearLinkPtr p = pLink->next; pLink->linear.size += p->linear.size; pLink->next = p->next; free(p); } if (pLinkPrev) { if (pLinkPrev->next && pLinkPrev->next->free && !pLinkPrev->area) { FBLinearLinkPtr p = pLinkPrev->next; pLinkPrev->linear.size += p->linear.size; pLinkPrev->next = p->next; free(p); } } DebugF("FREEING LINEAR\n"); DumpDebug(offman->LinearAreas); } static Bool localResizeOffscreenLinear(FBLinearPtr resize, int length) { FBManagerPtr offman; FBLinearLinkPtr pLink; ScreenPtr pScreen = resize->pScreen; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pLink = offman->LinearAreas; if (!pLink) return FALSE; while (&(pLink->linear) != resize) { pLink = pLink->next; if (!pLink) return FALSE; } /* This could actually be alot smarter and try to move allocations from XY to linear when available. For now if it was XY, we keep it XY */ if (pLink->area) { /* really an XY area */ BoxPtr extents; int pitch, w, h; extents = RegionExtents(offman->InitialBoxes); pitch = extents->x2 - extents->x1; if (length < pitch) { /* special case */ w = length; h = 1; } else { w = pitch; h = (length + pitch - 1) / pitch; } if (localResizeOffscreenArea(pLink->area, w, h)) { resize->size = h * w; resize->offset = (pitch * pLink->area->box.y1) + pLink->area->box.x1; return TRUE; } } else { /* TODO!!!! resize the linear area */ } return FALSE; } static Bool localQueryLargestOffscreenLinear(ScreenPtr pScreen, int *size, int gran, int priority) { FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); FBLinearLinkPtr pLink; FBLinearLinkPtr pLinkRet; *size = 0; pLink = offman->LinearAreas; if (pLink && !pLink->area) { pLinkRet = pLink; while (pLink) { if (pLink->free) { if (pLink->linear.size > pLinkRet->linear.size) pLinkRet = pLink; } pLink = pLink->next; } if (pLinkRet->free) { *size = pLinkRet->linear.size; return TRUE; } } else { int w, h; if (localQueryLargestOffscreenArea(pScreen, &w, &h, gran, FAVOR_WIDTH_THEN_AREA, priority)) { BoxPtr extents; extents = RegionExtents(offman->InitialBoxes); if ((extents->x2 - extents->x1) == w) *size = w * h; return TRUE; } } return FALSE; } static FBManagerFuncs xf86FBManFuncs = { localAllocateOffscreenArea, localFreeOffscreenArea, localResizeOffscreenArea, localQueryLargestOffscreenArea, localRegisterFreeBoxCallback, localAllocateOffscreenLinear, localFreeOffscreenLinear, localResizeOffscreenLinear, localQueryLargestOffscreenLinear, localPurgeUnlockedOffscreenAreas }; static Bool xf86FBCloseScreen(ScreenPtr pScreen) { FBLinkPtr pLink, tmp; FBLinearLinkPtr pLinearLink, tmp2; FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pScreen->CloseScreen = offman->CloseScreen; pLink = offman->UsedAreas; while (pLink) { tmp = pLink; pLink = pLink->next; free(tmp); } pLinearLink = offman->LinearAreas; while (pLinearLink) { tmp2 = pLinearLink; pLinearLink = pLinearLink->next; free(tmp2); } RegionDestroy(offman->InitialBoxes); RegionDestroy(offman->FreeBoxes); free(offman->FreeBoxesUpdateCallback); free(offman->devPrivates); free(offman); dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL); return (*pScreen->CloseScreen) (pScreen); } Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RegionRec ScreenRegion; RegionRec FullRegion; BoxRec ScreenBox; Bool ret; ScreenBox.x1 = 0; ScreenBox.y1 = 0; ScreenBox.x2 = pScrn->virtualX; ScreenBox.y2 = pScrn->virtualY; if ((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) || (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) { return FALSE; } if (FullBox->y2 < FullBox->y1) return FALSE; if (FullBox->x2 < FullBox->x1) return FALSE; RegionInit(&ScreenRegion, &ScreenBox, 1); RegionInit(&FullRegion, FullBox, 1); RegionSubtract(&FullRegion, &FullRegion, &ScreenRegion); ret = xf86InitFBManagerRegion(pScreen, &FullRegion); RegionUninit(&ScreenRegion); RegionUninit(&FullRegion); return ret; } Bool xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xRectangle Rect[3]; RegionPtr pRegion, pScreenRegion; int nRect; Bool ret = FALSE; if (PixelArea < (pScrn->displayWidth * pScrn->virtualY)) return FALSE; Rect[0].x = Rect[0].y = 0; Rect[0].width = pScrn->displayWidth; Rect[0].height = PixelArea / pScrn->displayWidth; nRect = 1; /* Add a possible partial scanline */ if ((Rect[1].height = Rect[1].width = PixelArea % pScrn->displayWidth)) { Rect[1].x = 0; Rect[1].y = Rect[0].height; Rect[1].height = 1; nRect++; } /* Factor out virtual resolution */ pRegion = RegionFromRects(nRect, Rect, 0); if (pRegion) { if (!RegionNar(pRegion)) { Rect[2].x = Rect[2].y = 0; Rect[2].width = pScrn->virtualX; Rect[2].height = pScrn->virtualY; pScreenRegion = RegionFromRects(1, &Rect[2], 0); if (pScreenRegion) { if (!RegionNar(pScreenRegion)) { RegionSubtract(pRegion, pRegion, pScreenRegion); ret = xf86InitFBManagerRegion(pScreen, pRegion); if (ret && xf86GetVerbosity() >= Verbosity) { int scrnIndex = pScrn->scrnIndex; xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, "Largest offscreen areas (with overlaps):\n"); if (Rect[2].width < Rect[0].width) { xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, "\t%d x %d rectangle at %d,0\n", Rect[0].width - Rect[2].width, Rect[0].height, Rect[2].width); } if (Rect[2].width < Rect[1].width) { xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, "\t%d x %d rectangle at %d,0\n", Rect[1].width - Rect[2].width, Rect[0].height + Rect[1].height, Rect[2].width); } if (Rect[2].height < Rect[0].height) { xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, "\t%d x %d rectangle at 0,%d\n", Rect[0].width, Rect[0].height - Rect[2].height, Rect[2].height); } if (Rect[1].height) { xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, "\t%d x %d rectangle at 0,%d\n", Rect[1].width, Rect[0].height - Rect[2].height + Rect[1].height, Rect[2].height); } } } RegionDestroy(pScreenRegion); } } RegionDestroy(pRegion); } return ret; } Bool xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr FullRegion) { FBManagerPtr offman; if (RegionNil(FullRegion)) return FALSE; if (!dixRegisterPrivateKey(&xf86FBScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs)) return FALSE; offman = malloc(sizeof(FBManager)); if (!offman) return FALSE; dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman); offman->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86FBCloseScreen; offman->InitialBoxes = RegionCreate(NULL, 1); offman->FreeBoxes = RegionCreate(NULL, 1); RegionCopy(offman->InitialBoxes, FullRegion); RegionCopy(offman->FreeBoxes, FullRegion); offman->pScreen = pScreen; offman->UsedAreas = NULL; offman->LinearAreas = NULL; offman->NumUsedAreas = 0; offman->NumCallbacks = 0; offman->FreeBoxesUpdateCallback = NULL; offman->devPrivates = NULL; return TRUE; } Bool xf86InitFBManagerLinear(ScreenPtr pScreen, int offset, int size) { FBManagerPtr offman; FBLinearLinkPtr link; FBLinearPtr linear; if (size <= 0) return FALSE; /* we expect people to have called the Area setup first for pixmap cache */ if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey)) return FALSE; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); offman->LinearAreas = malloc(sizeof(FBLinearLink)); if (!offman->LinearAreas) return FALSE; link = offman->LinearAreas; link->area = NULL; link->next = NULL; link->free = 1; linear = &(link->linear); linear->pScreen = pScreen; linear->size = size; linear->offset = offset; linear->granularity = 0; linear->MoveLinearCallback = NULL; linear->RemoveLinearCallback = NULL; linear->devPrivate.ptr = NULL; return TRUE; } /* This is an implementation specific function and should disappear after the next release. People should use the real linear functions instead */ FBAreaPtr xf86AllocateLinearOffscreenArea(ScreenPtr pScreen, int length, int gran, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, void *privData) { FBManagerFuncsPtr funcs; FBManagerPtr offman; BoxPtr extents; int w, h; if (xf86FBManagerKey == NULL) return NULL; if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))) return NULL; offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); extents = RegionExtents(offman->InitialBoxes); w = extents->x2 - extents->x1; if (gran > 1) { if (gran > w) return NULL; if (w % gran) length += gran - 1; } if (length <= w) { /* special case */ h = 1; w = length; } else { h = (length + w - 1) / w; } return (*funcs->AllocateOffscreenArea) (pScreen, w, h, gran, moveCB, removeCB, privData); } xorg-server-1.20.8/hw/xfree86/common/Makefile.in0000644000175000017500000011463113640201512016250 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @LNXACPI_TRUE@am__append_1 = -DHAVE_ACPI @NEED_DBUS_TRUE@am__append_2 = $(DBUS_CFLAGS) subdir = hw/xfree86/common ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__sdk_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = xf86Build.h CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcommon_la_DEPENDENCIES = $(top_builddir)/config/libconfig.la am__libcommon_la_SOURCES_DIST = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Cursor.c xf86DGA.c xf86DPMS.c xf86Events.c xf86Globals.c \ xf86AutoConfig.c xf86Option.c xf86Init.c xf86VidMode.c \ xf86fbman.c xf86cmap.c xf86Helper.c xf86PM.c xf86Xinput.c \ xisb.c xf86Mode.c xorgHelper.c xf86Extensions.h \ xf86Extensions.c xf86xv.c xf86xvmc.c xf86fbBus.c xf86noBus.c \ xf86pciBus.c xf86VGAarbiter.c xf86VGAarbiter.h \ xf86VGAarbiterPriv.h xf86sbusBus.c xf86platformBus.c \ xf86RandR.c @DGA_TRUE@am__objects_1 = xf86DGA.lo @XV_TRUE@am__objects_2 = xf86xv.lo xf86xvmc.lo @XORG_BUS_PCI_TRUE@am__objects_3 = xf86pciBus.lo xf86VGAarbiter.lo @XORG_BUS_SPARC_TRUE@am__objects_4 = xf86sbusBus.lo @XORG_BUS_PLATFORM_TRUE@am__objects_5 = xf86platformBus.lo am__objects_6 = xf86fbBus.lo xf86noBus.lo $(am__objects_3) \ $(am__objects_4) $(am__objects_5) am__objects_7 = xf86RandR.lo am_libcommon_la_OBJECTS = xf86Configure.lo xf86Bus.lo xf86Config.lo \ xf86Cursor.lo $(am__objects_1) xf86DPMS.lo xf86Events.lo \ xf86Globals.lo xf86AutoConfig.lo xf86Option.lo xf86Init.lo \ xf86VidMode.lo xf86fbman.lo xf86cmap.lo xf86Helper.lo \ xf86PM.lo xf86Xinput.lo xisb.lo xf86Mode.lo xorgHelper.lo \ xf86Extensions.lo $(am__objects_2) $(am__objects_6) \ $(am__objects_7) nodist_libcommon_la_OBJECTS = xf86DefModeSet.lo libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) \ $(nodist_libcommon_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/xf86AutoConfig.Plo \ ./$(DEPDIR)/xf86Bus.Plo ./$(DEPDIR)/xf86Config.Plo \ ./$(DEPDIR)/xf86Configure.Plo ./$(DEPDIR)/xf86Cursor.Plo \ ./$(DEPDIR)/xf86DGA.Plo ./$(DEPDIR)/xf86DPMS.Plo \ ./$(DEPDIR)/xf86DefModeSet.Plo ./$(DEPDIR)/xf86Events.Plo \ ./$(DEPDIR)/xf86Extensions.Plo ./$(DEPDIR)/xf86Globals.Plo \ ./$(DEPDIR)/xf86Helper.Plo ./$(DEPDIR)/xf86Init.Plo \ ./$(DEPDIR)/xf86Mode.Plo ./$(DEPDIR)/xf86Option.Plo \ ./$(DEPDIR)/xf86PM.Plo ./$(DEPDIR)/xf86RandR.Plo \ ./$(DEPDIR)/xf86VGAarbiter.Plo ./$(DEPDIR)/xf86VidMode.Plo \ ./$(DEPDIR)/xf86Xinput.Plo ./$(DEPDIR)/xf86cmap.Plo \ ./$(DEPDIR)/xf86fbBus.Plo ./$(DEPDIR)/xf86fbman.Plo \ ./$(DEPDIR)/xf86noBus.Plo ./$(DEPDIR)/xf86pciBus.Plo \ ./$(DEPDIR)/xf86platformBus.Plo ./$(DEPDIR)/xf86sbusBus.Plo \ ./$(DEPDIR)/xf86xv.Plo ./$(DEPDIR)/xf86xvmc.Plo \ ./$(DEPDIR)/xisb.Plo ./$(DEPDIR)/xorgHelper.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcommon_la_SOURCES) $(nodist_libcommon_la_SOURCES) DIST_SOURCES = $(am__libcommon_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__sdk_HEADERS_DIST = compiler.h fourcc.h xf86.h xf86Module.h \ xf86Opt.h xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86cmap.h \ xf86fbman.h xf86str.h xf86Xinput.h xisb.h xf86xv.h xf86xvmc.h \ xf86xvpriv.h dgaproc.h xorgVersion.h xf86sbusBus.h \ xf86VGAarbiter.h xf86Optionstr.h xf86platformBus.h \ xf86MatchDrivers.h xaarop.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sdkdir)" HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/xf86Build.h.in \ $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_1) $(am__append_2) XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libcommon.la @XORG_BUS_PCI_TRUE@PCI_SOURCES = xf86pciBus.c xf86VGAarbiter.c xf86VGAarbiter.h \ @XORG_BUS_PCI_TRUE@ xf86VGAarbiterPriv.h @XORG_BUS_SPARC_TRUE@SBUS_SOURCES = xf86sbusBus.c @XV_TRUE@XVSOURCES = xf86xv.c xf86xvmc.c @XV_TRUE@XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h @DGA_TRUE@DGASOURCES = xf86DGA.c @DGA_TRUE@DGA_SDK = dgaproc.h @XORG_BUS_PLATFORM_TRUE@PLATSOURCES = xf86platformBus.c RANDRSOURCES = xf86RandR.c BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES) $(PLATSOURCES) MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Cursor.c $(DGASOURCES) xf86DPMS.c \ xf86Events.c xf86Globals.c xf86AutoConfig.c \ xf86Option.c xf86Init.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ xf86Mode.c xorgHelper.c xf86Extensions.h \ xf86Extensions.c $(XF86VMODESOURCES) \ $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../parser \ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \ -I$(srcdir)/../modes -I$(srcdir)/../ramdac -I$(srcdir)/../dri2 sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h \ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \ xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h \ xf86platformBus.h xf86MatchDrivers.h \ xaarop.h DISTCLEANFILES = xf86Build.h CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = \ compiler.h \ fourcc.h \ xf86.h \ xf86Bus.h \ xf86Config.h \ xf86InPriv.h \ xf86Module.h \ xf86Opt.h \ xf86PciInfo.h \ xf86Priv.h \ xf86Privstr.h \ xf86Xinput.h \ xf86cmap.h \ xf86fbman.h \ xf86pciBus.h \ xf86str.h \ xf86xv.h \ xf86xvmc.h \ xf86xvpriv.h \ xisb.h \ xorgVersion.h \ $(MODEDEFSOURCES) \ modeline2c.awk \ xf86VGAarbiter.h \ xf86VGAarbiterPriv.h \ $(DISTKBDSOURCES) \ xaarop.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/common/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/common/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): xf86Build.h: $(top_builddir)/config.status $(srcdir)/xf86Build.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) $(EXTRA_libcommon_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86AutoConfig.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Bus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Config.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Configure.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DGA.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DPMS.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DefModeSet.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Events.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Extensions.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Globals.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Helper.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Mode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Option.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86PM.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86VGAarbiter.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86VidMode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Xinput.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cmap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86fbBus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86fbman.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86noBus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86pciBus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86platformBus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86sbusBus.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86xv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86xvmc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xisb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgHelper.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/xf86AutoConfig.Plo -rm -f ./$(DEPDIR)/xf86Bus.Plo -rm -f ./$(DEPDIR)/xf86Config.Plo -rm -f ./$(DEPDIR)/xf86Configure.Plo -rm -f ./$(DEPDIR)/xf86Cursor.Plo -rm -f ./$(DEPDIR)/xf86DGA.Plo -rm -f ./$(DEPDIR)/xf86DPMS.Plo -rm -f ./$(DEPDIR)/xf86DefModeSet.Plo -rm -f ./$(DEPDIR)/xf86Events.Plo -rm -f ./$(DEPDIR)/xf86Extensions.Plo -rm -f ./$(DEPDIR)/xf86Globals.Plo -rm -f ./$(DEPDIR)/xf86Helper.Plo -rm -f ./$(DEPDIR)/xf86Init.Plo -rm -f ./$(DEPDIR)/xf86Mode.Plo -rm -f ./$(DEPDIR)/xf86Option.Plo -rm -f ./$(DEPDIR)/xf86PM.Plo -rm -f ./$(DEPDIR)/xf86RandR.Plo -rm -f ./$(DEPDIR)/xf86VGAarbiter.Plo -rm -f ./$(DEPDIR)/xf86VidMode.Plo -rm -f ./$(DEPDIR)/xf86Xinput.Plo -rm -f ./$(DEPDIR)/xf86cmap.Plo -rm -f ./$(DEPDIR)/xf86fbBus.Plo -rm -f ./$(DEPDIR)/xf86fbman.Plo -rm -f ./$(DEPDIR)/xf86noBus.Plo -rm -f ./$(DEPDIR)/xf86pciBus.Plo -rm -f ./$(DEPDIR)/xf86platformBus.Plo -rm -f ./$(DEPDIR)/xf86sbusBus.Plo -rm -f ./$(DEPDIR)/xf86xv.Plo -rm -f ./$(DEPDIR)/xf86xvmc.Plo -rm -f ./$(DEPDIR)/xisb.Plo -rm -f ./$(DEPDIR)/xorgHelper.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/xf86AutoConfig.Plo -rm -f ./$(DEPDIR)/xf86Bus.Plo -rm -f ./$(DEPDIR)/xf86Config.Plo -rm -f ./$(DEPDIR)/xf86Configure.Plo -rm -f ./$(DEPDIR)/xf86Cursor.Plo -rm -f ./$(DEPDIR)/xf86DGA.Plo -rm -f ./$(DEPDIR)/xf86DPMS.Plo -rm -f ./$(DEPDIR)/xf86DefModeSet.Plo -rm -f ./$(DEPDIR)/xf86Events.Plo -rm -f ./$(DEPDIR)/xf86Extensions.Plo -rm -f ./$(DEPDIR)/xf86Globals.Plo -rm -f ./$(DEPDIR)/xf86Helper.Plo -rm -f ./$(DEPDIR)/xf86Init.Plo -rm -f ./$(DEPDIR)/xf86Mode.Plo -rm -f ./$(DEPDIR)/xf86Option.Plo -rm -f ./$(DEPDIR)/xf86PM.Plo -rm -f ./$(DEPDIR)/xf86RandR.Plo -rm -f ./$(DEPDIR)/xf86VGAarbiter.Plo -rm -f ./$(DEPDIR)/xf86VidMode.Plo -rm -f ./$(DEPDIR)/xf86Xinput.Plo -rm -f ./$(DEPDIR)/xf86cmap.Plo -rm -f ./$(DEPDIR)/xf86fbBus.Plo -rm -f ./$(DEPDIR)/xf86fbman.Plo -rm -f ./$(DEPDIR)/xf86noBus.Plo -rm -f ./$(DEPDIR)/xf86pciBus.Plo -rm -f ./$(DEPDIR)/xf86platformBus.Plo -rm -f ./$(DEPDIR)/xf86sbusBus.Plo -rm -f ./$(DEPDIR)/xf86xv.Plo -rm -f ./$(DEPDIR)/xf86xvmc.Plo -rm -f ./$(DEPDIR)/xisb.Plo -rm -f ./$(DEPDIR)/xorgHelper.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sdkHEADERS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sdkHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-sdkHEADERS .PRECIOUS: Makefile xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES) $(AM_V_GEN)cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@ $(AM_V_GEN)echo >> $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/common/compiler.h0000644000175000017500000007711413640201473016200 00000000000000/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * 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 Thomas Roell not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Thomas Roell makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THOMAS ROELL 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. * */ /* * Copyright (c) 1994-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). */ #ifndef _COMPILER_H #define _COMPILER_H #if defined(__SUNPRO_C) #define DO_PROTOTYPES #endif /* Map Sun compiler platform defines to gcc-style used in the code */ #if defined(__amd64) && !defined(__amd64__) #define __amd64__ #endif #if defined(__i386) && !defined(__i386__) #define __i386__ #endif #if defined(__sparc) && !defined(__sparc__) #define __sparc__ #endif #if defined(__sparcv9) && !defined(__sparc64__) #define __sparc64__ #endif #ifndef _X_EXPORT #include #endif #include /* for uint*_t types */ /* Allow drivers to use the GCC-supported __inline__ and/or __inline. */ #ifndef __inline__ #if defined(__GNUC__) /* gcc has __inline__ */ #else #define __inline__ /**/ #endif #endif /* __inline__ */ #ifndef __inline #if defined(__GNUC__) /* gcc has __inline */ #else #define __inline /**/ #endif #endif /* __inline */ /* Support gcc's __FUNCTION__ for people using other compilers */ #if !defined(__GNUC__) && !defined(__FUNCTION__) #define __FUNCTION__ __func__ /* C99 */ #endif #if defined(DO_PROTOTYPES) #if !defined(__arm__) #if !defined(__sparc__) && !defined(__arm32__) && !defined(__nds32__) \ && !(defined(__alpha__) && defined(__linux__)) \ && !(defined(__ia64__) && defined(__linux__)) \ && !(defined(__mips64) && defined(__linux__)) \ extern _X_EXPORT void outb(unsigned short, unsigned char); extern _X_EXPORT void outw(unsigned short, unsigned short); extern _X_EXPORT void outl(unsigned short, unsigned int); extern _X_EXPORT unsigned int inb(unsigned short); extern _X_EXPORT unsigned int inw(unsigned short); extern _X_EXPORT unsigned int inl(unsigned short); #else /* __sparc__, __arm32__, __alpha__, __nds32__ */ extern _X_EXPORT void outb(unsigned long, unsigned char); extern _X_EXPORT void outw(unsigned long, unsigned short); extern _X_EXPORT void outl(unsigned long, unsigned int); extern _X_EXPORT unsigned int inb(unsigned long); extern _X_EXPORT unsigned int inw(unsigned long); extern _X_EXPORT unsigned int inl(unsigned long); #ifdef __SUNPRO_C extern _X_EXPORT unsigned char xf86ReadMmio8 (void *, unsigned long); extern _X_EXPORT unsigned short xf86ReadMmio16Be (void *, unsigned long); extern _X_EXPORT unsigned short xf86ReadMmio16Le (void *, unsigned long); extern _X_EXPORT unsigned int xf86ReadMmio32Be (void *, unsigned long); extern _X_EXPORT unsigned int xf86ReadMmio32Le (void *, unsigned long); extern _X_EXPORT void xf86WriteMmio8 (void *, unsigned long, unsigned int); extern _X_EXPORT void xf86WriteMmio16Be (void *, unsigned long, unsigned int); extern _X_EXPORT void xf86WriteMmio16Le (void *, unsigned long, unsigned int); extern _X_EXPORT void xf86WriteMmio32Be (void *, unsigned long, unsigned int); extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int); #endif /* _SUNPRO_C */ #endif /* __sparc__, __arm32__, __alpha__, __nds32__ */ #endif /* __arm__ */ #endif /* NO_INLINE || DO_PROTOTYPES */ #ifdef __GNUC__ #ifdef __i386__ #ifdef __SSE__ #define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory") #else #define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory") #endif #ifdef __SSE2__ #define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory") #else #define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory") #endif #elif defined __alpha__ #define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory") #define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory") #elif defined __amd64__ #define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory") #define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory") #elif defined __ia64__ #ifndef __INTEL_COMPILER #define mem_barrier() __asm__ __volatile__ ("mf" : : : "memory") #define write_mem_barrier() __asm__ __volatile__ ("mf" : : : "memory") #else #include "ia64intrin.h" #define mem_barrier() __mf() #define write_mem_barrier() __mf() #endif #elif defined __mips__ /* Note: sync instruction requires MIPS II instruction set */ #define mem_barrier() \ __asm__ __volatile__( \ ".set push\n\t" \ ".set noreorder\n\t" \ ".set mips2\n\t" \ "sync\n\t" \ ".set pop" \ : /* no output */ \ : /* no input */ \ : "memory") #define write_mem_barrier() mem_barrier() #elif defined __powerpc__ #ifndef eieio #define eieio() __asm__ __volatile__ ("eieio" ::: "memory") #endif /* eieio */ #define mem_barrier() eieio() #define write_mem_barrier() eieio() #elif defined __sparc__ #define barrier() __asm__ __volatile__ (".word 0x8143e00a" : : : "memory") #define mem_barrier() /* XXX: nop for now */ #define write_mem_barrier() /* XXX: nop for now */ #endif #endif /* __GNUC__ */ #ifndef barrier #define barrier() #endif #ifndef mem_barrier #define mem_barrier() /* NOP */ #endif #ifndef write_mem_barrier #define write_mem_barrier() /* NOP */ #endif #ifdef __GNUC__ #if defined(__alpha__) #ifdef __linux__ /* for Linux on Alpha, we use the LIBC _inx/_outx routines */ /* note that the appropriate setup via "ioperm" needs to be done */ /* *before* any inx/outx is done. */ extern _X_EXPORT void _outb(unsigned char val, unsigned long port); extern _X_EXPORT void _outw(unsigned short val, unsigned long port); extern _X_EXPORT void _outl(unsigned int val, unsigned long port); extern _X_EXPORT unsigned int _inb(unsigned long port); extern _X_EXPORT unsigned int _inw(unsigned long port); extern _X_EXPORT unsigned int _inl(unsigned long port); static __inline__ void outb(unsigned long port, unsigned char val) { _outb(val, port); } static __inline__ void outw(unsigned long port, unsigned short val) { _outw(val, port); } static __inline__ void outl(unsigned long port, unsigned int val) { _outl(val, port); } static __inline__ unsigned int inb(unsigned long port) { return _inb(port); } static __inline__ unsigned int inw(unsigned long port) { return _inw(port); } static __inline__ unsigned int inl(unsigned long port) { return _inl(port); } #endif /* __linux__ */ #if (defined(__FreeBSD__) || defined(__OpenBSD__)) \ && !defined(DO_PROTOTYPES) /* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */ /* inx/outx routines */ /* note that the appropriate setup via "ioperm" needs to be done */ /* *before* any inx/outx is done. */ extern _X_EXPORT void outb(unsigned int port, unsigned char val); extern _X_EXPORT void outw(unsigned int port, unsigned short val); extern _X_EXPORT void outl(unsigned int port, unsigned int val); extern _X_EXPORT unsigned char inb(unsigned int port); extern _X_EXPORT unsigned short inw(unsigned int port); extern _X_EXPORT unsigned int inl(unsigned int port); #endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */ #if defined(__NetBSD__) #include #endif /* __NetBSD__ */ #elif defined(__amd64__) || defined(__i386__) || defined(__ia64__) #include static __inline__ void outb(unsigned short port, unsigned char val) { __asm__ __volatile__("outb %0,%1"::"a"(val), "d"(port)); } static __inline__ void outw(unsigned short port, unsigned short val) { __asm__ __volatile__("outw %0,%1"::"a"(val), "d"(port)); } static __inline__ void outl(unsigned short port, unsigned int val) { __asm__ __volatile__("outl %0,%1"::"a"(val), "d"(port)); } static __inline__ unsigned int inb(unsigned short port) { unsigned char ret; __asm__ __volatile__("inb %1,%0":"=a"(ret):"d"(port)); return ret; } static __inline__ unsigned int inw(unsigned short port) { unsigned short ret; __asm__ __volatile__("inw %1,%0":"=a"(ret):"d"(port)); return ret; } static __inline__ unsigned int inl(unsigned short port) { unsigned int ret; __asm__ __volatile__("inl %1,%0":"=a"(ret):"d"(port)); return ret; } #elif defined(__sparc__) #ifndef ASI_PL #define ASI_PL 0x88 #endif static __inline__ void outb(unsigned long port, unsigned char val) { __asm__ __volatile__("stba %0, [%1] %2": /* No outputs */ :"r"(val), "r"(port), "i"(ASI_PL)); barrier(); } static __inline__ void outw(unsigned long port, unsigned short val) { __asm__ __volatile__("stha %0, [%1] %2": /* No outputs */ :"r"(val), "r"(port), "i"(ASI_PL)); barrier(); } static __inline__ void outl(unsigned long port, unsigned int val) { __asm__ __volatile__("sta %0, [%1] %2": /* No outputs */ :"r"(val), "r"(port), "i"(ASI_PL)); barrier(); } static __inline__ unsigned int inb(unsigned long port) { unsigned int ret; __asm__ __volatile__("lduba [%1] %2, %0":"=r"(ret) :"r"(port), "i"(ASI_PL)); return ret; } static __inline__ unsigned int inw(unsigned long port) { unsigned int ret; __asm__ __volatile__("lduha [%1] %2, %0":"=r"(ret) :"r"(port), "i"(ASI_PL)); return ret; } static __inline__ unsigned int inl(unsigned long port) { unsigned int ret; __asm__ __volatile__("lda [%1] %2, %0":"=r"(ret) :"r"(port), "i"(ASI_PL)); return ret; } static __inline__ unsigned char xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned char ret; __asm__ __volatile__("lduba [%1] %2, %0":"=r"(ret) :"r"(addr), "i"(ASI_PL)); return ret; } static __inline__ unsigned short xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned short ret; __asm__ __volatile__("lduh [%1], %0":"=r"(ret) :"r"(addr)); return ret; } static __inline__ unsigned short xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned short ret; __asm__ __volatile__("lduha [%1] %2, %0":"=r"(ret) :"r"(addr), "i"(ASI_PL)); return ret; } static __inline__ unsigned int xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned int ret; __asm__ __volatile__("ld [%1], %0":"=r"(ret) :"r"(addr)); return ret; } static __inline__ unsigned int xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned int ret; __asm__ __volatile__("lda [%1] %2, %0":"=r"(ret) :"r"(addr), "i"(ASI_PL)); return ret; } static __inline__ void xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("stba %0, [%1] %2": /* No outputs */ :"r"(val), "r"(addr), "i"(ASI_PL)); barrier(); } static __inline__ void xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("sth %0, [%1]": /* No outputs */ :"r"(val), "r"(addr)); barrier(); } static __inline__ void xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("stha %0, [%1] %2": /* No outputs */ :"r"(val), "r"(addr), "i"(ASI_PL)); barrier(); } static __inline__ void xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("st %0, [%1]": /* No outputs */ :"r"(val), "r"(addr)); barrier(); } static __inline__ void xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("sta %0, [%1] %2": /* No outputs */ :"r"(val), "r"(addr), "i"(ASI_PL)); barrier(); } #elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__)) #if defined(__arm32__) || defined(__mips64) #define PORT_SIZE long #else #define PORT_SIZE short #endif _X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */ static __inline__ void outb(unsigned PORT_SIZE port, unsigned char val) { *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) + IOPortBase) = val; } static __inline__ void outw(unsigned PORT_SIZE port, unsigned short val) { *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) + IOPortBase) = val; } static __inline__ void outl(unsigned PORT_SIZE port, unsigned int val) { *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) + IOPortBase) = val; } static __inline__ unsigned int inb(unsigned PORT_SIZE port) { return *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) + IOPortBase); } static __inline__ unsigned int inw(unsigned PORT_SIZE port) { return *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) + IOPortBase); } static __inline__ unsigned int inl(unsigned PORT_SIZE port) { return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) + IOPortBase); } #if defined(__mips__) #ifdef __linux__ /* don't mess with other OSs */ #if X_BYTE_ORDER == X_BIG_ENDIAN static __inline__ unsigned int xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned int ret; __asm__ __volatile__("lw %0, 0(%1)":"=r"(ret) :"r"(addr)); return ret; } static __inline__ void xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("sw %0, 0(%1)": /* No outputs */ :"r"(val), "r"(addr)); } #endif #endif /* !__linux__ */ #endif /* __mips__ */ #elif defined(__powerpc__) #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) #endif extern _X_EXPORT volatile unsigned char *ioBase; static __inline__ unsigned char xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) { register unsigned char val; __asm__ __volatile__("lbzx %0,%1,%2\n\t" "eieio":"=r"(val) :"b"(base), "r"(offset), "m"(*((volatile unsigned char *) base + offset))); return val; } static __inline__ unsigned short xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset) { register unsigned short val; __asm__ __volatile__("lhzx %0,%1,%2\n\t" "eieio":"=r"(val) :"b"(base), "r"(offset), "m"(*((volatile unsigned char *) base + offset))); return val; } static __inline__ unsigned short xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset) { register unsigned short val; __asm__ __volatile__("lhbrx %0,%1,%2\n\t" "eieio":"=r"(val) :"b"(base), "r"(offset), "m"(*((volatile unsigned char *) base + offset))); return val; } static __inline__ unsigned int xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) { register unsigned int val; __asm__ __volatile__("lwzx %0,%1,%2\n\t" "eieio":"=r"(val) :"b"(base), "r"(offset), "m"(*((volatile unsigned char *) base + offset))); return val; } static __inline__ unsigned int xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset) { register unsigned int val; __asm__ __volatile__("lwbrx %0,%1,%2\n\t" "eieio":"=r"(val) :"b"(base), "r"(offset), "m"(*((volatile unsigned char *) base + offset))); return val; } static __inline__ void xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, const unsigned char val) { __asm__ __volatile__("stbx %1,%2,%3\n\t":"=m" (*((volatile unsigned char *) base + offset)) :"r"(val), "b"(base), "r"(offset)); eieio(); } static __inline__ void xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset, const unsigned short val) { __asm__ __volatile__("sthbrx %1,%2,%3\n\t":"=m" (*((volatile unsigned char *) base + offset)) :"r"(val), "b"(base), "r"(offset)); eieio(); } static __inline__ void xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset, const unsigned short val) { __asm__ __volatile__("sthx %1,%2,%3\n\t":"=m" (*((volatile unsigned char *) base + offset)) :"r"(val), "b"(base), "r"(offset)); eieio(); } static __inline__ void xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, const unsigned int val) { __asm__ __volatile__("stwbrx %1,%2,%3\n\t":"=m" (*((volatile unsigned char *) base + offset)) :"r"(val), "b"(base), "r"(offset)); eieio(); } static __inline__ void xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, const unsigned int val) { __asm__ __volatile__("stwx %1,%2,%3\n\t":"=m" (*((volatile unsigned char *) base + offset)) :"r"(val), "b"(base), "r"(offset)); eieio(); } static __inline__ void outb(unsigned short port, unsigned char value) { if (ioBase == MAP_FAILED) return; xf86WriteMmio8((void *) ioBase, port, value); } static __inline__ void outw(unsigned short port, unsigned short value) { if (ioBase == MAP_FAILED) return; xf86WriteMmio16Le((void *) ioBase, port, value); } static __inline__ void outl(unsigned short port, unsigned int value) { if (ioBase == MAP_FAILED) return; xf86WriteMmio32Le((void *) ioBase, port, value); } static __inline__ unsigned int inb(unsigned short port) { if (ioBase == MAP_FAILED) return 0; return xf86ReadMmio8((void *) ioBase, port); } static __inline__ unsigned int inw(unsigned short port) { if (ioBase == MAP_FAILED) return 0; return xf86ReadMmio16Le((void *) ioBase, port); } static __inline__ unsigned int inl(unsigned short port) { if (ioBase == MAP_FAILED) return 0; return xf86ReadMmio32Le((void *) ioBase, port); } #elif defined(__nds32__) /* * Assume all port access are aligned. We need to revise this implementation * if there is unaligned port access. */ #define PORT_SIZE long static __inline__ unsigned char xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) { return *(volatile unsigned char *) ((unsigned char *) base + offset); } static __inline__ void xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, const unsigned int val) { *(volatile unsigned char *) ((unsigned char *) base + offset) = val; barrier(); } static __inline__ unsigned short xf86ReadMmio16Swap(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned short ret; __asm__ __volatile__("lhi %0, [%1];\n\t" "wsbh %0, %0;\n\t":"=r"(ret) :"r"(addr)); return ret; } static __inline__ unsigned short xf86ReadMmio16(__volatile__ void *base, const unsigned long offset) { return *(volatile unsigned short *) ((char *) base + offset); } static __inline__ void xf86WriteMmio16Swap(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("wsbh %0, %0;\n\t" "shi %0, [%1];\n\t": /* No outputs */ :"r"(val), "r"(addr)); barrier(); } static __inline__ void xf86WriteMmio16(__volatile__ void *base, const unsigned long offset, const unsigned int val) { *(volatile unsigned short *) ((unsigned char *) base + offset) = val; barrier(); } static __inline__ unsigned int xf86ReadMmio32Swap(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long) base) + offset; unsigned int ret; __asm__ __volatile__("lwi %0, [%1];\n\t" "wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t":"=r"(ret) :"r"(addr)); return ret; } static __inline__ unsigned int xf86ReadMmio32(__volatile__ void *base, const unsigned long offset) { return *(volatile unsigned int *) ((unsigned char *) base + offset); } static __inline__ void xf86WriteMmio32Swap(__volatile__ void *base, const unsigned long offset, const unsigned int val) { unsigned long addr = ((unsigned long) base) + offset; __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "swi %0, [%1];\n\t": /* No outputs */ :"r"(val), "r"(addr)); barrier(); } static __inline__ void xf86WriteMmio32(__volatile__ void *base, const unsigned long offset, const unsigned int val) { *(volatile unsigned int *) ((unsigned char *) base + offset) = val; barrier(); } #if defined(NDS32_MMIO_SWAP) static __inline__ void outb(unsigned PORT_SIZE port, unsigned char val) { xf86WriteMmio8(IOPortBase, port, val); } static __inline__ void outw(unsigned PORT_SIZE port, unsigned short val) { xf86WriteMmio16Swap(IOPortBase, port, val); } static __inline__ void outl(unsigned PORT_SIZE port, unsigned int val) { xf86WriteMmio32Swap(IOPortBase, port, val); } static __inline__ unsigned int inb(unsigned PORT_SIZE port) { return xf86ReadMmio8(IOPortBase, port); } static __inline__ unsigned int inw(unsigned PORT_SIZE port) { return xf86ReadMmio16Swap(IOPortBase, port); } static __inline__ unsigned int inl(unsigned PORT_SIZE port) { return xf86ReadMmio32Swap(IOPortBase, port); } #else /* !NDS32_MMIO_SWAP */ static __inline__ void outb(unsigned PORT_SIZE port, unsigned char val) { *(volatile unsigned char *) (((unsigned PORT_SIZE) (port))) = val; barrier(); } static __inline__ void outw(unsigned PORT_SIZE port, unsigned short val) { *(volatile unsigned short *) (((unsigned PORT_SIZE) (port))) = val; barrier(); } static __inline__ void outl(unsigned PORT_SIZE port, unsigned int val) { *(volatile unsigned int *) (((unsigned PORT_SIZE) (port))) = val; barrier(); } static __inline__ unsigned int inb(unsigned PORT_SIZE port) { return *(volatile unsigned char *) (((unsigned PORT_SIZE) (port))); } static __inline__ unsigned int inw(unsigned PORT_SIZE port) { return *(volatile unsigned short *) (((unsigned PORT_SIZE) (port))); } static __inline__ unsigned int inl(unsigned PORT_SIZE port) { return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port))); } #endif /* NDS32_MMIO_SWAP */ #endif /* arch madness */ #else /* !GNUC */ #if defined(__STDC__) && (__STDC__ == 1) #ifndef asm #define asm __asm #endif #endif #if !defined(__SUNPRO_C) #include #endif #endif /* __GNUC__ */ #if !defined(MMIO_IS_BE) && \ (defined(SPARC_MMIO_IS_BE) || defined(PPC_MMIO_IS_BE)) #define MMIO_IS_BE #endif #ifdef __alpha__ static inline int xf86ReadMmio8(void *Base, unsigned long Offset) { mem_barrier(); return *(CARD8 *) ((unsigned long) Base + (Offset)); } static inline int xf86ReadMmio16(void *Base, unsigned long Offset) { mem_barrier(); return *(CARD16 *) ((unsigned long) Base + (Offset)); } static inline int xf86ReadMmio32(void *Base, unsigned long Offset) { mem_barrier(); return *(CARD32 *) ((unsigned long) Base + (Offset)); } static inline void xf86WriteMmio8(int Value, void *Base, unsigned long Offset) { write_mem_barrier(); *(CARD8 *) ((unsigned long) Base + (Offset)) = Value; } static inline void xf86WriteMmio16(int Value, void *Base, unsigned long Offset) { write_mem_barrier(); *(CARD16 *) ((unsigned long) Base + (Offset)) = Value; } static inline void xf86WriteMmio32(int Value, void *Base, unsigned long Offset) { write_mem_barrier(); *(CARD32 *) ((unsigned long) Base + (Offset)) = Value; } extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); /* Some macros to hide the system dependencies for MMIO accesses */ /* Changed to kill noise generated by gcc's -Wcast-align */ #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) #define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset) #define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset) #define MMIO_OUT8(base, offset, val) \ xf86WriteMmio8((CARD8)(val), base, offset) #define MMIO_OUT16(base, offset, val) \ xf86WriteMmio16((CARD16)(val), base, offset) #define MMIO_OUT32(base, offset, val) \ xf86WriteMmio32((CARD32)(val), base, offset) #elif defined(__powerpc__) || defined(__sparc__) /* * we provide byteswapping and no byteswapping functions here * with byteswapping as default, * drivers that don't need byteswapping should define MMIO_IS_BE */ #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) #define MMIO_OUT8(base, offset, val) \ xf86WriteMmio8(base, offset, (CARD8)(val)) #if defined(MMIO_IS_BE) /* No byteswapping */ #define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) #define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) #define MMIO_OUT16(base, offset, val) \ xf86WriteMmio16Be(base, offset, (CARD16)(val)) #define MMIO_OUT32(base, offset, val) \ xf86WriteMmio32Be(base, offset, (CARD32)(val)) #else /* byteswapping is the default */ #define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) #define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) #define MMIO_OUT16(base, offset, val) \ xf86WriteMmio16Le(base, offset, (CARD16)(val)) #define MMIO_OUT32(base, offset, val) \ xf86WriteMmio32Le(base, offset, (CARD32)(val)) #endif #elif defined(__nds32__) /* * we provide byteswapping and no byteswapping functions here * with no byteswapping as default; when endianness of CPU core * and I/O devices don't match, byte swapping is necessary * drivers that need byteswapping should define NDS32_MMIO_SWAP */ #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) #define MMIO_OUT8(base, offset, val) \ xf86WriteMmio8(base, offset, (CARD8)(val)) #if defined(NDS32_MMIO_SWAP) /* byteswapping */ #define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset) #define MMIO_IN32(base, offset) xf86ReadMmio32Swap(base, offset) #define MMIO_OUT16(base, offset, val) \ xf86WriteMmio16Swap(base, offset, (CARD16)(val)) #define MMIO_OUT32(base, offset, val) \ xf86WriteMmio32Swap(base, offset, (CARD32)(val)) #else /* no byteswapping is the default */ #define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset) #define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset) #define MMIO_OUT16(base, offset, val) \ xf86WriteMmio16(base, offset, (CARD16)(val)) #define MMIO_OUT32(base, offset, val) \ xf86WriteMmio32(base, offset, (CARD32)(val)) #endif #else /* !__alpha__ && !__powerpc__ && !__sparc__ */ #define MMIO_IN8(base, offset) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) #define MMIO_IN16(base, offset) \ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) #define MMIO_IN32(base, offset) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) #define MMIO_OUT8(base, offset, val) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val) #define MMIO_OUT16(base, offset, val) \ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val) #define MMIO_OUT32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) #endif /* __alpha__ */ /* * With Intel, the version in os-support/misc/SlowBcopy.s is used. * This avoids port I/O during the copy (which causes problems with * some hardware). */ #ifdef __alpha__ #define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count) #define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count) #else /* __alpha__ */ #define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count) #define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count) #endif /* __alpha__ */ #endif /* _COMPILER_H */ xorg-server-1.20.8/hw/xfree86/common/xf86Priv.h0000644000175000017500000001266413640201473016021 00000000000000/* * Copyright (c) 1997-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains declarations for private XFree86 functions and variables, * and definitions of private macros. * * "private" means not available to video drivers. */ #ifndef _XF86PRIV_H #define _XF86PRIV_H #include "xf86Privstr.h" #include "propertyst.h" #include "input.h" /* * Parameters set ONLY from the command line options * The global state of these things is held in xf86InfoRec (when appropriate). */ extern _X_EXPORT const char *xf86ConfigFile; extern _X_EXPORT const char *xf86ConfigDir; extern _X_EXPORT Bool xf86AllowMouseOpenFail; #ifdef XF86VIDMODE extern _X_EXPORT Bool xf86VidModeDisabled; extern _X_EXPORT Bool xf86VidModeAllowNonLocal; #endif extern _X_EXPORT Bool xf86fpFlag; extern _X_EXPORT Bool xf86sFlag; extern _X_EXPORT Bool xf86bsEnableFlag; extern _X_EXPORT Bool xf86bsDisableFlag; extern _X_EXPORT Bool xf86silkenMouseDisableFlag; extern _X_EXPORT Bool xf86xkbdirFlag; #ifdef HAVE_ACPI extern _X_EXPORT Bool xf86acpiDisableFlag; #endif extern _X_EXPORT char *xf86LayoutName; extern _X_EXPORT char *xf86ScreenName; extern _X_EXPORT char *xf86PointerName; extern _X_EXPORT char *xf86KeyboardName; extern _X_EXPORT int xf86FbBpp; extern _X_EXPORT int xf86Depth; extern _X_EXPORT rgb xf86Weight; extern _X_EXPORT Bool xf86FlipPixels; extern _X_EXPORT Gamma xf86Gamma; extern _X_EXPORT const char *xf86ServerName; /* Other parameters */ extern _X_EXPORT xf86InfoRec xf86Info; extern _X_EXPORT const char *xf86ModulePath; extern _X_EXPORT MessageType xf86ModPathFrom; extern _X_EXPORT const char *xf86LogFile; extern _X_EXPORT MessageType xf86LogFileFrom; extern _X_EXPORT Bool xf86LogFileWasOpened; extern _X_EXPORT serverLayoutRec xf86ConfigLayout; extern _X_EXPORT DriverPtr *xf86DriverList; extern _X_EXPORT int xf86NumDrivers; extern _X_EXPORT Bool xf86Resetting; extern Bool xf86Initialising; extern _X_EXPORT int xf86NumScreens; extern _X_EXPORT const char *xf86VisualNames[]; extern _X_EXPORT int xf86Verbose; /* verbosity level */ extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */ extern ScrnInfoPtr *xf86GPUScreens; /* List of pointers to ScrnInfoRecs */ extern int xf86NumGPUScreens; extern _X_EXPORT int xf86DRMMasterFd; /* Command line argument for DRM master file descriptor */ #ifndef DEFAULT_VERBOSE #define DEFAULT_VERBOSE 0 #endif #ifndef DEFAULT_LOG_VERBOSE #define DEFAULT_LOG_VERBOSE 3 #endif #ifndef DEFAULT_DPI #define DEFAULT_DPI 96 #endif /* Function Prototypes */ #ifndef _NO_XF86_PROTOTYPES /* xf86Bus.c */ extern _X_EXPORT Bool xf86BusConfig(void); extern _X_EXPORT void xf86BusProbe(void); extern _X_EXPORT void xf86PostProbe(void); extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn); extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev); extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev); /* xf86Config.c */ extern _X_EXPORT Bool xf86PathIsSafe(const char *path); /* xf86DefaultModes */ extern _X_EXPORT const DisplayModeRec xf86DefaultModes[]; extern _X_EXPORT const int xf86NumDefaultModes; /* xf86Configure.c */ extern _X_EXPORT void DoConfigure(void) _X_NORETURN; extern _X_EXPORT void DoShowOptions(void) _X_NORETURN; /* xf86Events.c */ extern _X_EXPORT void xf86Wakeup(void *blockData, int err); extern _X_EXPORT void xf86HandlePMEvents(int fd, void *data); extern _X_EXPORT int (*xf86PMGetEventFromOs) (int fd, pmEvent * events, int num); extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event); /* xf86Helper.c */ extern _X_EXPORT void xf86LogInit(void); extern _X_EXPORT void xf86CloseLog(enum ExitCode error); /* xf86Init.c */ extern _X_EXPORT Bool xf86LoadModules(const char **list, void **optlist); extern _X_EXPORT int xf86SetVerbosity(int verb); extern _X_EXPORT int xf86SetLogVerbosity(int verb); extern _X_EXPORT Bool xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only); extern _X_EXPORT Bool xf86PrivsElevated(void); #endif /* _NO_XF86_PROTOTYPES */ #endif /* _XF86PRIV_H */ xorg-server-1.20.8/hw/xfree86/common/vesamodes0000644000175000017500000001070513640201473016117 00000000000000// // Default modes distilled from // "VESA and Industry Standards and Guide for Computer Display Monitor // Timing", version 1.0, revision 0.8, adopted September 17, 1998. // // $XFree86: xc/programs/Xserver/hw/xfree86/etc/vesamodes,v 1.3 1999/11/16 03:28:03 tsi Exp $ # 640x350 @ 85Hz (VESA) hsync: 37.9kHz ModeLine "640x350" 31.5 640 672 736 832 350 382 385 445 +hsync -vsync # 640x400 @ 85Hz (VESA) hsync: 37.9kHz ModeLine "640x400" 31.5 640 672 736 832 400 401 404 445 -hsync +vsync # 720x400 @ 85Hz (VESA) hsync: 37.9kHz ModeLine "720x400" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync # 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync # 640x480 @ 72Hz (VESA) hsync: 37.9kHz ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520 -hsync -vsync # 640x480 @ 75Hz (VESA) hsync: 37.5kHz ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync # 640x480 @ 85Hz (VESA) hsync: 43.3kHz ModeLine "640x480" 36.0 640 696 752 832 480 481 484 509 -hsync -vsync # 800x600 @ 56Hz (VESA) hsync: 35.2kHz ModeLine "800x600" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync # 800x600 @ 60Hz (VESA) hsync: 37.9kHz ModeLine "800x600" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync # 800x600 @ 72Hz (VESA) hsync: 48.1kHz ModeLine "800x600" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync # 800x600 @ 75Hz (VESA) hsync: 46.9kHz ModeLine "800x600" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync # 800x600 @ 85Hz (VESA) hsync: 53.7kHz ModeLine "800x600" 56.3 800 832 896 1048 600 601 604 631 +hsync +vsync # 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz ModeLine "1024x768" 44.9 1024 1032 1208 1264 768 768 776 817 +hsync +vsync Interlace # 1024x768 @ 60Hz (VESA) hsync: 48.4kHz ModeLine "1024x768" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync # 1024x768 @ 70Hz (VESA) hsync: 56.5kHz ModeLine "1024x768" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync # 1024x768 @ 75Hz (VESA) hsync: 60.0kHz ModeLine "1024x768" 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync # 1024x768 @ 85Hz (VESA) hsync: 68.7kHz ModeLine "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync # 1152x864 @ 75Hz (VESA) hsync: 67.5kHz ModeLine "1152x864" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync # 1280x960 @ 60Hz (VESA) hsync: 60.0kHz ModeLine "1280x960" 108.0 1280 1376 1488 1800 960 961 964 1000 +hsync +vsync # 1280x960 @ 85Hz (VESA) hsync: 85.9kHz ModeLine "1280x960" 148.5 1280 1344 1504 1728 960 961 964 1011 +hsync +vsync # 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz ModeLine "1280x1024" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync # 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz ModeLine "1280x1024" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync # 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz ModeLine "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync # 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz ModeLine "1600x1200" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync # 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz ModeLine "1600x1200" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync # 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz ModeLine "1600x1200" 189.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync # 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz ModeLine "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync # 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz ModeLine "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync # 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz ModeLine "1792x1344" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync # 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz ModeLine "1792x1344" 261.0 1792 1888 2104 2456 1344 1345 1348 1417 -hsync +vsync # 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz ModeLine "1856x1392" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync # 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz ModeLine "1856x1392" 288.0 1856 1984 2208 2560 1392 1393 1396 1500 -hsync +vsync # 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz ModeLine "1920x1440" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync # 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz ModeLine "1920x1440" 297.0 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync xorg-server-1.20.8/hw/xfree86/common/xf86pciBus.c0000644000175000017500000013167313640201473016323 00000000000000/* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the interfaces to the bus-specific code */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include #include "os.h" #include "Pci.h" #include "xf86.h" #include "xf86Priv.h" #include "dirent.h" /* DIR, FILE type definitions */ /* Bus-specific headers */ #include "xf86Bus.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #define PCI_VENDOR_GENERIC 0x00FF /* Bus-specific globals */ int pciSlotClaimed = 0; #define PCIINFOCLASSES(c) \ ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \ || (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \ || ((((c) & 0x00ffff00) \ == ((PCI_CLASS_MULTIMEDIA << 16) | (PCI_SUBCLASS_MULTIMEDIA_VIDEO << 8)))) \ || ((((c) & 0x00ffff00) \ == ((PCI_CLASS_PROCESSOR << 16) | (PCI_SUBCLASS_PROCESSOR_COPROC << 8)))) ) /* * PCI classes that have messages printed always. The others are only * have a message printed when the vendor/dev IDs are recognised. */ #define PCIALWAYSPRINTCLASSES(c) \ ( (((c) & 0x00ffff00) \ == ((PCI_CLASS_PREHISTORIC << 16) | (PCI_SUBCLASS_PREHISTORIC_VGA << 8))) \ || (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \ || ((((c) & 0x00ffff00) \ == ((PCI_CLASS_MULTIMEDIA << 16) | (PCI_SUBCLASS_MULTIMEDIA_VIDEO << 8)))) ) #define IS_VGA(c) \ (((c) & 0x00ffff00) \ == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8))) static struct pci_slot_match xf86IsolateDevice = { PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0 }; /* * xf86Bus.c interface */ void xf86PciProbe(void) { int i = 0, k; int num = 0; struct pci_device *info; struct pci_device_iterator *iter; struct pci_device **xf86PciVideoInfo = NULL; if (!xf86scanpci()) { xf86PciVideoInfo = NULL; return; } iter = pci_slot_match_iterator_create(&xf86IsolateDevice); while ((info = pci_device_next(iter)) != NULL) { if (PCIINFOCLASSES(info->device_class)) { num++; xf86PciVideoInfo = xnfreallocarray(xf86PciVideoInfo, num + 1, sizeof(struct pci_device *)); xf86PciVideoInfo[num] = NULL; xf86PciVideoInfo[num - 1] = info; pci_device_probe(info); if (primaryBus.type == BUS_NONE && pci_device_is_boot_vga(info)) { primaryBus.type = BUS_PCI; primaryBus.id.pci = info; } info->user_data = 0; } } free(iter); /* If we haven't found a primary device try a different heuristic */ if (primaryBus.type == BUS_NONE && num) { for (i = 0; i < num; i++) { uint16_t command; info = xf86PciVideoInfo[i]; pci_device_cfg_read_u16(info, &command, 4); if ((command & PCI_CMD_MEM_ENABLE) && ((num == 1) || IS_VGA(info->device_class))) { if (primaryBus.type == BUS_NONE) { primaryBus.type = BUS_PCI; primaryBus.id.pci = info; } else { xf86Msg(X_NOTICE, "More than one possible primary device found\n"); primaryBus.type ^= (BusType) (-1); } } } } /* Print a summary of the video devices found */ for (k = 0; k < num; k++) { const char *prim = " "; Bool memdone = FALSE, iodone = FALSE; info = xf86PciVideoInfo[k]; if (!PCIALWAYSPRINTCLASSES(info->device_class)) continue; if (xf86IsPrimaryPci(info)) prim = "*"; xf86Msg(X_PROBED, "PCI:%s(%u@%u:%u:%u) %04x:%04x:%04x:%04x ", prim, info->bus, info->domain, info->dev, info->func, info->vendor_id, info->device_id, info->subvendor_id, info->subdevice_id); xf86ErrorF("rev %d", info->revision); for (i = 0; i < 6; i++) { struct pci_mem_region *r = &info->regions[i]; if (r->size && !r->is_IO) { if (!memdone) { xf86ErrorF(", Mem @ "); memdone = TRUE; } else xf86ErrorF(", "); xf86ErrorF("0x%08lx/%ld", (long) r->base_addr, (long) r->size); } } for (i = 0; i < 6; i++) { struct pci_mem_region *r = &info->regions[i]; if (r->size && r->is_IO) { if (!iodone) { xf86ErrorF(", I/O @ "); iodone = TRUE; } else xf86ErrorF(", "); xf86ErrorF("0x%08lx/%ld", (long) r->base_addr, (long) r->size); } } if (info->rom_size) { xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", (long) info->rom_size); } xf86ErrorF("\n"); } free(xf86PciVideoInfo); } /* * If the slot requested is already in use, return -1. * Otherwise, claim the slot for the screen requesting it. */ int xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp, int chipset, GDevPtr dev, Bool active) { EntityPtr p = NULL; int num; if (xf86CheckPciSlot(d)) { num = xf86AllocateEntity(); p = xf86Entities[num]; p->driver = drvp; p->chipset = chipset; p->bus.type = BUS_PCI; p->bus.id.pci = d; p->active = active; p->inUse = FALSE; if (dev) xf86AddDevToEntity(num, dev); pciSlotClaimed++; return num; } else return -1; } /* * Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim. */ void xf86UnclaimPciSlot(struct pci_device *d, GDevPtr dev) { int i; for (i = 0; i < xf86NumEntities; i++) { const EntityPtr p = xf86Entities[i]; if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) { /* Probably the slot should be deallocated? */ xf86RemoveDevFromEntity(i, dev); pciSlotClaimed--; p->bus.type = BUS_NONE; return; } } } /* * Parse a BUS ID string, and return the PCI bus parameters if it was * in the correct format for a PCI bus id. */ Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func) { /* * The format is assumed to be "bus[@domain]:device[:func]", where domain, * bus, device and func are decimal integers. domain and func may be * omitted and assumed to be zero, although doing this isn't encouraged. */ char *p, *s, *d; const char *id; int i; if (StringToBusType(busID, &id) != BUS_PCI) return FALSE; s = xstrdup(id); p = strtok(s, ":"); if (p == NULL || *p == 0) { free(s); return FALSE; } d = strpbrk(p, "@"); if (d != NULL) { *(d++) = 0; for (i = 0; d[i] != 0; i++) { if (!isdigit(d[i])) { free(s); return FALSE; } } } for (i = 0; p[i] != 0; i++) { if (!isdigit(p[i])) { free(s); return FALSE; } } *bus = atoi(p); if (d != NULL && *d != 0) *bus += atoi(d) << 8; p = strtok(NULL, ":"); if (p == NULL || *p == 0) { free(s); return FALSE; } for (i = 0; p[i] != 0; i++) { if (!isdigit(p[i])) { free(s); return FALSE; } } *device = atoi(p); *func = 0; p = strtok(NULL, ":"); if (p == NULL || *p == 0) { free(s); return TRUE; } for (i = 0; p[i] != 0; i++) { if (!isdigit(p[i])) { free(s); return FALSE; } } *func = atoi(p); free(s); return TRUE; } /* * Compare a BUS ID string with a PCI bus id. Return TRUE if they match. */ Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func) { int ibus, idevice, ifunc; if (xf86ParsePciBusString(busID, &ibus, &idevice, &ifunc)) { return bus == ibus && device == idevice && func == ifunc; } else { return FALSE; } } /* * xf86IsPrimaryPci() -- return TRUE if primary device * is PCI and bus, dev and func numbers match. */ Bool xf86IsPrimaryPci(struct pci_device *pPci) { /* Add max. 1 screen for the IgnorePrimary fallback path */ if (xf86ProbeIgnorePrimary && xf86NumScreens == 0) return TRUE; if (primaryBus.type == BUS_PCI) return pPci == primaryBus.id.pci; #ifdef XSERVER_PLATFORM_BUS if (primaryBus.type == BUS_PLATFORM) if (primaryBus.id.plat->pdev) if (MATCH_PCI_DEVICES(primaryBus.id.plat->pdev, pPci)) return TRUE; #endif return FALSE; } /* * xf86GetPciInfoForEntity() -- Get the pciVideoRec of entity. */ struct pci_device * xf86GetPciInfoForEntity(int entityIndex) { EntityPtr p; if (entityIndex >= xf86NumEntities) return NULL; p = xf86Entities[entityIndex]; switch (p->bus.type) { case BUS_PCI: return p->bus.id.pci; case BUS_PLATFORM: return p->bus.id.plat->pdev; default: break; } return NULL; } /* * xf86CheckPciMemBase() checks that the memory base value matches one of the * PCI base address register values for the given PCI device. */ Bool xf86CheckPciMemBase(struct pci_device *pPci, memType base) { int i; for (i = 0; i < 6; i++) if (base == pPci->regions[i].base_addr) return TRUE; return FALSE; } /* * Check if the slot requested is free. If it is already in use, return FALSE. */ Bool xf86CheckPciSlot(const struct pci_device *d) { int i; for (i = 0; i < xf86NumEntities; i++) { const EntityPtr p = xf86Entities[i]; if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) { return FALSE; } #ifdef XSERVER_PLATFORM_BUS if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat->pdev)) { struct pci_device *ud = p->bus.id.plat->pdev; if (MATCH_PCI_DEVICES(ud, d)) return FALSE; } #endif } return TRUE; } #define END_OF_MATCHES(m) \ (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0)) Bool xf86PciAddMatchingDev(DriverPtr drvp) { const struct pci_id_match *const devices = drvp->supported_devices; int j; struct pci_device *pPci; struct pci_device_iterator *iter; int numFound = 0; iter = pci_id_match_iterator_create(NULL); while ((pPci = pci_device_next(iter)) != NULL) { /* Determine if this device is supported by the driver. If it is, * add it to the list of devices to configure. */ for (j = 0; !END_OF_MATCHES(devices[j]); j++) { if (PCI_ID_COMPARE(devices[j].vendor_id, pPci->vendor_id) && PCI_ID_COMPARE(devices[j].device_id, pPci->device_id) && ((devices[j].device_class_mask & pPci->device_class) == devices[j].device_class)) { if (xf86CheckPciSlot(pPci)) { GDevPtr pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_PCI, pPci, -1); if (pGDev != NULL) { /* After configure pass 1, chipID and chipRev are * treated as over-rides, so clobber them here. */ pGDev->chipID = -1; pGDev->chipRev = -1; } numFound++; } break; } } } pci_iterator_destroy(iter); return numFound != 0; } Bool xf86PciProbeDev(DriverPtr drvp) { int i, j; struct pci_device *pPci; Bool foundScreen = FALSE; const struct pci_id_match *const devices = drvp->supported_devices; GDevPtr *devList; const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList); for (i = 0; i < numDevs; i++) { struct pci_device_iterator *iter; unsigned device_id; /* Find the pciVideoRec associated with this device section. */ iter = pci_id_match_iterator_create(NULL); while ((pPci = pci_device_next(iter)) != NULL) { if (devList[i]->busID && *devList[i]->busID) { if (xf86ComparePciBusString(devList[i]->busID, ((pPci->domain << 8) | pPci->bus), pPci->dev, pPci->func)) { break; } } else if (xf86IsPrimaryPci(pPci)) { break; } } pci_iterator_destroy(iter); if (pPci == NULL) { continue; } device_id = (devList[i]->chipID > 0) ? devList[i]->chipID : pPci->device_id; /* Once the pciVideoRec is found, determine if the device is supported * by the driver. If it is, probe it! */ for (j = 0; !END_OF_MATCHES(devices[j]); j++) { if (PCI_ID_COMPARE(devices[j].vendor_id, pPci->vendor_id) && PCI_ID_COMPARE(devices[j].device_id, device_id) && ((devices[j].device_class_mask & pPci->device_class) == devices[j].device_class)) { int entry; /* Allow the same entity to be used more than once for * devices with multiple screens per entity. This assumes * implicitly that there will be a screen == 0 instance. * * FIXME Need to make sure that two different drivers don't * FIXME claim the same screen > 0 instance. */ if ((devList[i]->screen == 0) && !xf86CheckPciSlot(pPci)) continue; DebugF("%s: card at %d:%d:%d is claimed by a Device section\n", drvp->driverName, pPci->bus, pPci->dev, pPci->func); /* Allocate an entry in the lists to be returned */ entry = xf86ClaimPciSlot(pPci, drvp, device_id, devList[i], devList[i]->active); if ((entry == -1) && (devList[i]->screen > 0)) { unsigned k; for (k = 0; k < xf86NumEntities; k++) { EntityPtr pEnt = xf86Entities[k]; if (pEnt->bus.type != BUS_PCI) continue; if (pEnt->bus.id.pci == pPci) { entry = k; xf86AddDevToEntity(k, devList[i]); break; } } } if (entry != -1) { if ((*drvp->PciProbe) (drvp, entry, pPci, devices[j].match_data)) { foundScreen = TRUE; } else xf86UnclaimPciSlot(pPci, devList[i]); } break; } } } free(devList); return foundScreen; } void xf86PciIsolateDevice(const char *argument) { int bus, device, func; if (sscanf(argument, "PCI:%d:%d:%d", &bus, &device, &func) == 3) { xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus); xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus); xf86IsolateDevice.dev = device; xf86IsolateDevice.func = func; } else FatalError("Invalid isolated device specification\n"); } static Bool pciDeviceHasBars(struct pci_device *pci) { int i; for (i = 0; i < 6; i++) if (pci->regions[i].size) return TRUE; if (pci->rom_size) return TRUE; return FALSE; } struct Inst { struct pci_device *pci; GDevPtr dev; Bool foundHW; /* PCIid in list of supported chipsets */ Bool claimed; /* BusID matches with a device section */ int chip; int screen; }; /** * Find set of unclaimed devices matching a given vendor ID. * * Used by drivers to find as yet unclaimed devices matching the specified * vendor ID. * * \param driverName Name of the driver. This is used to find Device * sections in the config file. * \param vendorID PCI vendor ID of associated devices. If zero, then * the true vendor ID must be encoded in the \c PCIid * fields of the \c PCIchipsets entries. * \param chipsets Symbol table used to associate chipset names with * PCI IDs. * \param devList List of Device sections parsed from the config file. * \param numDevs Number of entries in \c devList. * \param drvp Pointer the driver's control structure. * \param foundEntities Returned list of entity indicies associated with the * driver. * * \returns * The number of elements in returned in \c foundEntities on success or zero * on failure. * * \todo * This function does a bit more than short description says. Fill in some * more of the details of its operation. * * \todo * The \c driverName parameter is redundant. It is the same as * \c DriverRec::driverName. In a future version of this function, remove * that parameter. */ int xf86MatchPciInstances(const char *driverName, int vendorID, SymTabPtr chipsets, PciChipsets * PCIchipsets, GDevPtr * devList, int numDevs, DriverPtr drvp, int **foundEntities) { int i, j; struct pci_device *pPci; struct pci_device_iterator *iter; struct Inst *instances = NULL; int numClaimedInstances = 0; int allocatedInstances = 0; int numFound = 0; SymTabRec *c; PciChipsets *id; int *retEntities = NULL; *foundEntities = NULL; /* Each PCI device will contribute at least one entry. Each device * section can contribute at most one entry. The sum of the two is * guaranteed to be larger than the maximum possible number of entries. * Do this calculation and memory allocation once now to eliminate the * need for realloc calls inside the loop. */ if (!(xf86DoConfigure && xf86DoConfigurePass1)) { unsigned max_entries = numDevs; iter = pci_slot_match_iterator_create(NULL); while ((pPci = pci_device_next(iter)) != NULL) { max_entries++; } pci_iterator_destroy(iter); instances = xnfallocarray(max_entries, sizeof(struct Inst)); } iter = pci_slot_match_iterator_create(NULL); while ((pPci = pci_device_next(iter)) != NULL) { unsigned device_class = pPci->device_class; Bool foundVendor = FALSE; /* Convert the pre-PCI 2.0 device class for a VGA adapter to the * 2.0 version of the same class. */ if (device_class == 0x00000101) { device_class = 0x00030000; } /* Find PCI devices that match the given vendor ID. The vendor ID is * either specified explicitly as a parameter to the function or * implicitly encoded in the high bits of id->PCIid. * * The first device with a matching vendor is recorded, even if the * device ID doesn't match. This is done because the Device section * in the xorg.conf file can over-ride the device ID. A matching PCI * ID might not be found now, but after the device ID over-ride is * applied there /might/ be a match. */ for (id = PCIchipsets; id->PCIid != -1; id++) { const unsigned vendor_id = ((id->PCIid & 0xFFFF0000) >> 16) | vendorID; const unsigned device_id = (id->PCIid & 0x0000FFFF); const unsigned match_class = 0x00030000 | id->PCIid; if ((vendor_id == pPci->vendor_id) || ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class))) { if (!foundVendor && (instances != NULL)) { ++allocatedInstances; instances[allocatedInstances - 1].pci = pPci; instances[allocatedInstances - 1].dev = NULL; instances[allocatedInstances - 1].claimed = FALSE; instances[allocatedInstances - 1].foundHW = FALSE; instances[allocatedInstances - 1].screen = 0; } foundVendor = TRUE; if ((device_id == pPci->device_id) || ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class))) { if (instances != NULL) { instances[allocatedInstances - 1].foundHW = TRUE; instances[allocatedInstances - 1].chip = id->numChipset; } if (xf86DoConfigure && xf86DoConfigurePass1) { if (xf86CheckPciSlot(pPci)) { GDevPtr pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_PCI, pPci, -1); if (pGDev) { /* After configure pass 1, chipID and chipRev * are treated as over-rides, so clobber them * here. */ pGDev->chipID = -1; pGDev->chipRev = -1; } numFound++; } } else { numFound++; } break; } } } } pci_iterator_destroy(iter); /* In "probe only" or "configure" mode (signaled by instances being NULL), * our work is done. Return the number of detected devices. */ if (instances == NULL) { return numFound; } /* * This may be debatable, but if no PCI 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; } DebugF("%s instances found: %d\n", driverName, allocatedInstances); /* * Check for devices that need duplicated instances. This is required * when there is more than one screen per entity. * * XXX This currently doesn't work for cases where the BusID isn't * specified explicitly in the config file. */ for (j = 0; j < numDevs; j++) { if (devList[j]->screen > 0 && devList[j]->busID && *devList[j]->busID) { for (i = 0; i < allocatedInstances; i++) { pPci = instances[i].pci; if (xf86ComparePciBusString(devList[j]->busID, PCI_MAKE_BUS(pPci->domain, pPci->bus), pPci->dev, pPci->func)) { allocatedInstances++; instances[allocatedInstances - 1] = instances[i]; instances[allocatedInstances - 1].screen = devList[j]->screen; numFound++; break; } } } } for (i = 0; i < allocatedInstances; i++) { GDevPtr dev = NULL; GDevPtr devBus = NULL; pPci = instances[i].pci; for (j = 0; j < numDevs; j++) { if (devList[j]->busID && *devList[j]->busID) { if (xf86ComparePciBusString(devList[j]->busID, PCI_MAKE_BUS(pPci->domain, pPci->bus), pPci->dev, pPci->func) && devList[j]->screen == instances[i].screen) { if (devBus) xf86MsgVerb(X_WARNING, 0, "%s: More than one matching Device section for " "instances\n\t(BusID: %s) found: %s\n", driverName, devList[j]->busID, devList[j]->identifier); else devBus = devList[j]; } } else { /* * if device section without BusID is found * only assign to it to the primary device. */ if (xf86IsPrimaryPci(pPci)) { xf86Msg(X_PROBED, "Assigning device section with no busID" " to primary device\n"); if (dev || devBus) xf86MsgVerb(X_WARNING, 0, "%s: More than one matching Device section " "found: %s\n", driverName, devList[j]->identifier); else dev = devList[j]; } } } if (devBus) dev = devBus; /* busID preferred */ if (!dev) { if (xf86CheckPciSlot(pPci) && pciDeviceHasBars(pPci)) { xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " "for instance (BusID PCI:%u@%u:%u:%u) found\n", driverName, pPci->bus, pPci->domain, pPci->dev, pPci->func); } } else { numClaimedInstances++; instances[i].claimed = TRUE; instances[i].dev = dev; } } DebugF("%s instances found: %d\n", driverName, numClaimedInstances); /* * Now check that a chipset or chipID override in the device section * is valid. Chipset has precedence over chipID. * If chipset is not valid ignore BusSlot completely. */ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) { MessageType from = X_PROBED; if (!instances[i].claimed) { continue; } if (instances[i].dev->chipset) { for (c = chipsets; c->token >= 0; c++) { if (xf86NameCmp(c->name, instances[i].dev->chipset) == 0) break; } if (c->token == -1) { instances[i].claimed = FALSE; numClaimedInstances--; xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device " "section \"%s\" isn't valid for this driver\n", driverName, instances[i].dev->chipset, instances[i].dev->identifier); } else { instances[i].chip = c->token; for (id = PCIchipsets; id->numChipset >= 0; id++) { if (id->numChipset == instances[i].chip) break; } if (id->numChipset >= 0) { xf86Msg(X_CONFIG, "Chipset override: %s\n", instances[i].dev->chipset); from = X_CONFIG; } else { instances[i].claimed = FALSE; numClaimedInstances--; xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device " "section \"%s\" isn't a valid PCI chipset\n", driverName, instances[i].dev->chipset, instances[i].dev->identifier); } } } else if (instances[i].dev->chipID > 0) { for (id = PCIchipsets; id->numChipset >= 0; id++) { if (id->PCIid == instances[i].dev->chipID) break; } if (id->numChipset == -1) { instances[i].claimed = FALSE; numClaimedInstances--; xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device " "section \"%s\" isn't valid for this driver\n", driverName, instances[i].dev->chipID, instances[i].dev->identifier); } else { instances[i].chip = id->numChipset; xf86Msg(X_CONFIG, "ChipID override: 0x%04X\n", instances[i].dev->chipID); from = X_CONFIG; } } else if (!instances[i].foundHW) { /* * This means that there was no override and the PCI chipType * doesn't match one that is supported */ instances[i].claimed = FALSE; numClaimedInstances--; } if (instances[i].claimed == TRUE) { for (c = chipsets; c->token >= 0; c++) { if (c->token == instances[i].chip) break; } xf86Msg(from, "Chipset %s found\n", c->name); } } /* * 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; pPci = instances[i].pci; /* * Allow the same entity to be used more than once for devices with * multiple screens per entity. This assumes implicitly that there * will be a screen == 0 instance. * * XXX Need to make sure that two different drivers don't claim * the same screen > 0 instance. */ if (instances[i].screen == 0 && !xf86CheckPciSlot(pPci)) continue; DebugF("%s: card at %d:%d:%d is claimed by a Device section\n", driverName, pPci->bus, pPci->dev, pPci->func); /* Allocate an entry in the lists to be returned */ numFound++; retEntities = xnfreallocarray(retEntities, numFound, sizeof(int)); retEntities[numFound - 1] = xf86ClaimPciSlot(pPci, drvp, instances[i].chip, instances[i].dev, instances[i].dev->active); if (retEntities[numFound - 1] == -1 && instances[i].screen > 0) { for (j = 0; j < xf86NumEntities; j++) { EntityPtr pEnt = xf86Entities[j]; if (pEnt->bus.type != BUS_PCI) continue; if (pEnt->bus.id.pci == pPci) { retEntities[numFound - 1] = j; xf86AddDevToEntity(j, instances[i].dev); break; } } } } free(instances); if (numFound > 0) { *foundEntities = retEntities; } return numFound; } /* * xf86ConfigPciEntityInactive() -- This function can be used * to configure an inactive entity as well as to reconfigure an * previously active entity inactive. If the entity has been * assigned to a screen before it will be removed. If p_chip is * non-NULL all static resources listed there will be registered. */ static void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip, EntityProc init, EntityProc enter, EntityProc leave, void *private) { ScrnInfoPtr pScrn; if ((pScrn = xf86FindScreenForEntity(pEnt->index))) xf86RemoveEntityFromScreen(pScrn, pEnt->index); } ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, PciChipsets * p_chip, void *dummy, EntityProc init, EntityProc enter, EntityProc leave, void *private) { EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); if (dummy || init || enter || leave) FatalError("Legacy entity access functions are unsupported\n"); if (!pEnt) return pScrn; if (!(pEnt->location.type == BUS_PCI) || !xf86GetPciInfoForEntity(entityIndex)) { free(pEnt); return pScrn; } if (!pEnt->active) { xf86ConfigPciEntityInactive(pEnt, p_chip, init, enter, leave, private); free(pEnt); return pScrn; } if (!pScrn) pScrn = xf86AllocateScreen(pEnt->driver, scrnFlag); if (xf86IsEntitySharable(entityIndex)) { xf86SetEntityShared(entityIndex); } xf86AddEntityToScreen(pScrn, entityIndex); if (xf86IsEntityShared(entityIndex)) { return pScrn; } free(pEnt); return pScrn; } void xf86VideoPtrToDriverList(struct pci_device *dev, XF86MatchedDrivers *md) { int i; /* Add more entries here if we ever return more than 4 drivers for any device */ const char *driverList[5] = { NULL, NULL, NULL, NULL, NULL }; switch (dev->vendor_id) { /* AMD Geode LX */ case 0x1022: if (dev->device_id == 0x2081) driverList[0] = "geode"; break; /* older Geode products acquired by AMD still carry an NSC vendor_id */ case 0x100b: if (dev->device_id == 0x0030) { /* NSC Geode GX2 specifically */ driverList[0] = "geode"; /* GX2 support started its life in the NSC tree and was later forked by AMD for GEODE so we keep it as a backup */ driverList[1] = "nsc"; } else /* other NSC variant e.g. 0x0104 (SC1400), 0x0504 (SCx200) */ driverList[0] = "nsc"; break; /* Cyrix Geode GX1 */ case 0x1078: if (dev->device_id == 0x0104) driverList[0] = "cyrix"; break; case 0x1142: driverList[0] = "apm"; break; case 0xedd8: driverList[0] = "ark"; break; case 0x1a03: driverList[0] = "ast"; break; case 0x1002: driverList[0] = "ati"; break; case 0x102c: driverList[0] = "chips"; break; case 0x1013: driverList[0] = "cirrus"; break; case 0x3d3d: driverList[0] = "glint"; break; case 0x105d: driverList[0] = "i128"; break; case 0x8086: switch (dev->device_id) { /* Intel i740 */ case 0x00d1: case 0x7800: driverList[0] = "i740"; break; /* GMA500/Poulsbo */ case 0x8108: case 0x8109: /* Try psb driver on Poulsbo - if available */ driverList[0] = "psb"; driverList[1] = "psb_drv"; break; /* GMA600/Oaktrail */ case 0x4100: case 0x4101: case 0x4102: case 0x4103: case 0x4104: case 0x4105: case 0x4106: case 0x4107: /* Atom E620/Oaktrail */ case 0x4108: /* Medfield */ case 0x0130: case 0x0131: case 0x0132: case 0x0133: case 0x0134: case 0x0135: case 0x0136: case 0x0137: /* GMA 3600/CDV */ case 0x0be0: case 0x0be1: case 0x0be2: case 0x0be3: case 0x0be4: case 0x0be5: case 0x0be6: case 0x0be7: case 0x0be8: case 0x0be9: case 0x0bea: case 0x0beb: case 0x0bec: case 0x0bed: case 0x0bee: case 0x0bef: /* Use fbdev/vesa driver on Oaktrail, Medfield, CDV */ break; default: driverList[0] = "intel"; break; } break; case 0x102b: driverList[0] = "mga"; break; case 0x10c8: driverList[0] = "neomagic"; break; case 0x10de: case 0x12d2: { int idx = 0; #if defined(__linux__) || defined(__NetBSD__) driverList[idx++] = "nouveau"; #endif driverList[idx++] = "nv"; break; } case 0x1106: driverList[0] = "openchrome"; break; case 0x1b36: driverList[0] = "qxl"; break; case 0x1163: driverList[0] = "rendition"; break; case 0x5333: switch (dev->device_id) { case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811: case 0x8812: case 0x8814: case 0x8901: driverList[0] = "s3"; break; case 0x5631: case 0x883d: case 0x8a01: case 0x8a10: case 0x8c01: case 0x8c03: case 0x8904: case 0x8a13: driverList[0] = "s3virge"; break; default: driverList[0] = "savage"; break; } break; case 0x1039: driverList[0] = "sis"; break; case 0x126f: driverList[0] = "siliconmotion"; break; case 0x121a: if (dev->device_id < 0x0003) driverList[0] = "voodoo"; else driverList[0] = "tdfx"; break; case 0x1011: driverList[0] = "tga"; break; case 0x1023: driverList[0] = "trident"; break; case 0x100c: driverList[0] = "tseng"; break; case 0x80ee: driverList[0] = "vboxvideo"; break; case 0x15ad: driverList[0] = "vmware"; break; case 0x18ca: if (dev->device_id == 0x47) driverList[0] = "xgixp"; else driverList[0] = "xgi"; break; default: break; } for (i = 0; driverList[i] != NULL; i++) { xf86AddMatchedDriver(md, driverList[i]); } } #ifdef __linux__ static int xchomp(char *line) { size_t len = 0; if (!line) { return 1; } len = strlen(line); if (line[len - 1] == '\n' && len > 0) { line[len - 1] = '\0'; } return 0; } /* This function is used to provide a workaround for binary drivers that * don't export their PCI ID's properly. If distros don't end up using this * feature it can and should be removed because the symbol-based resolution * scheme should be the primary one */ void xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip, XF86MatchedDrivers *md) { DIR *idsdir; FILE *fp; struct dirent *direntry; char *line = NULL, *tmpMatch; size_t len; ssize_t read; char path_name[512], vendor_str[5], chip_str[5]; uint16_t vendor, chip; int j; idsdir = opendir(PCI_TXT_IDS_PATH); if (!idsdir) return; xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCI_TXT_IDS_PATH); direntry = readdir(idsdir); /* Read the directory */ while (direntry) { if (direntry->d_name[0] == '.') { direntry = readdir(idsdir); continue; } len = strlen(direntry->d_name); /* A tiny bit of sanity checking. We should probably do better */ if (strncmp(&(direntry->d_name[len - 4]), ".ids", 4) == 0) { /* We need the full path name to open the file */ snprintf(path_name, sizeof(path_name), "%s/%s", PCI_TXT_IDS_PATH, direntry->d_name); fp = fopen(path_name, "r"); if (fp == NULL) { xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name); goto end; } /* Read the file */ #ifdef __GLIBC__ while ((read = getline(&line, &len, fp)) != -1) { #else while ((line = fgetln(fp, &len)) != (char *) NULL) { #endif /* __GLIBC __ */ xchomp(line); if (isdigit(line[0])) { strlcpy(vendor_str, line, sizeof(vendor_str)); vendor = (int) strtol(vendor_str, NULL, 16); if ((strlen(&line[4])) == 0) { chip_str[0] = '\0'; chip = -1; } else { /* Handle trailing whitespace */ if (isspace(line[4])) { chip_str[0] = '\0'; chip = -1; } else { /* Ok, it's a real ID */ strlcpy(chip_str, &line[4], sizeof(chip_str)); chip = (int) strtol(chip_str, NULL, 16); } } if (vendor == match_vendor && chip == match_chip) { tmpMatch = (char *) malloc(sizeof(char) * strlen(direntry->d_name) - 3); if (!tmpMatch) { xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n"); goto end; } /* hack off the .ids suffix. This should guard * against other problems, but it will end up * taking off anything after the first '.' */ for (j = 0; j < (strlen(direntry->d_name) - 3); j++) { if (direntry->d_name[j] == '.') { tmpMatch[j] = '\0'; break; } else { tmpMatch[j] = direntry->d_name[j]; } } xf86AddMatchedDriver(md, tmpMatch); xf86Msg(X_INFO, "Matched %s from file name %s\n", tmpMatch, direntry->d_name); free(tmpMatch); } } else { /* TODO Handle driver overrides here */ } } fclose(fp); } direntry = readdir(idsdir); } end: free(line); closedir(idsdir); } #endif /* __linux__ */ void xf86PciMatchDriver(XF86MatchedDrivers *md) { struct pci_device *info = NULL; struct pci_device_iterator *iter; /* Find the primary device, and get some information about it. */ iter = pci_slot_match_iterator_create(NULL); while ((info = pci_device_next(iter)) != NULL) { if (xf86IsPrimaryPci(info)) { break; } } pci_iterator_destroy(iter); #ifdef __linux__ if (info) xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md); #endif if (info != NULL) { xf86VideoPtrToDriverList(info, md); } } Bool xf86PciConfigure(void *busData, struct pci_device *pDev) { struct pci_device *pVideo = NULL; pVideo = (struct pci_device *) busData; if (pDev && (pDev->domain == pVideo->domain) && (pDev->bus == pVideo->bus) && (pDev->dev == pVideo->dev) && (pDev->func == pVideo->func)) return 0; return 1; } void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, GDevRec * GDev, int *chipset) { char busnum[8]; char *tmp; pVideo = (struct pci_device *) busData; snprintf(busnum, sizeof(busnum), "%d", pVideo->bus); XNFasprintf(&tmp, "PCI:%s:%d:%d", busnum, pVideo->dev, pVideo->func); GDev->busID = tmp; GDev->chipID = pVideo->device_id; GDev->chipRev = pVideo->revision; if (*chipset < 0) *chipset = (pVideo->vendor_id << 16) | pVideo->device_id; } char * DRICreatePCIBusID(const struct pci_device *dev) { char *busID; if (asprintf(&busID, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus, dev->dev, dev->func) == -1) return NULL; return busID; } xorg-server-1.20.8/hw/xfree86/common/xf86PM.c0000644000175000017500000001530413640201473015402 00000000000000/* * Copyright (c) 2000-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Priv.h" #include "xf86Xinput.h" #include "xf86_OSproc.h" int (*xf86PMGetEventFromOs) (int fd, pmEvent * events, int num) = NULL; pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event) = NULL; static Bool suspended = FALSE; static int eventName(pmEvent event, const char **str) { switch (event) { case XF86_APM_SYS_STANDBY: *str = "System Standby Request"; return 0; case XF86_APM_SYS_SUSPEND: *str = "System Suspend Request"; return 0; case XF86_APM_CRITICAL_SUSPEND: *str = "Critical Suspend"; return 0; case XF86_APM_USER_STANDBY: *str = "User System Standby Request"; return 0; case XF86_APM_USER_SUSPEND: *str = "User System Suspend Request"; return 0; case XF86_APM_STANDBY_RESUME: *str = "System Standby Resume"; return 0; case XF86_APM_NORMAL_RESUME: *str = "Normal Resume System"; return 0; case XF86_APM_CRITICAL_RESUME: *str = "Critical Resume System"; return 0; case XF86_APM_LOW_BATTERY: *str = "Battery Low"; return 3; case XF86_APM_POWER_STATUS_CHANGE: *str = "Power Status Change"; return 3; case XF86_APM_UPDATE_TIME: *str = "Update Time"; return 3; case XF86_APM_CAPABILITY_CHANGED: *str = "Capability Changed"; return 3; case XF86_APM_STANDBY_FAILED: *str = "Standby Request Failed"; return 0; case XF86_APM_SUSPEND_FAILED: *str = "Suspend Request Failed"; return 0; default: *str = "Unknown Event"; return 0; } } static void suspend(pmEvent event, Bool undo) { int i; InputInfoPtr pInfo; for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); } pInfo = xf86InputDevs; while (pInfo) { DisableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } input_lock(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); else { xf86Screens[i]->LeaveVT(xf86Screens[i]); xf86Screens[i]->vtSema = FALSE; } } } static void resume(pmEvent event, Bool undo) { int i; InputInfoPtr pInfo; for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); else { xf86Screens[i]->vtSema = TRUE; xf86Screens[i]->EnterVT(xf86Screens[i]); } } input_unlock(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } } static void DoApmEvent(pmEvent event, Bool undo) { int i; switch (event) { #if 0 case XF86_APM_SYS_STANDBY: case XF86_APM_USER_STANDBY: #endif case XF86_APM_SYS_SUSPEND: case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend? */ case XF86_APM_USER_SUSPEND: /* should we do this ? */ if (!undo && !suspended) { suspend(event, undo); suspended = TRUE; } else if (undo && suspended) { resume(event, undo); suspended = FALSE; } break; #if 0 case XF86_APM_STANDBY_RESUME: #endif case XF86_APM_NORMAL_RESUME: case XF86_APM_CRITICAL_RESUME: if (suspended) { resume(event, undo); suspended = FALSE; } break; default: input_lock(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) { xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); } } input_unlock(); break; } } #define MAX_NO_EVENTS 8 void xf86HandlePMEvents(int fd, void *data) { pmEvent events[MAX_NO_EVENTS]; int i, n; Bool wait = FALSE; if (!xf86PMGetEventFromOs) return; if ((n = xf86PMGetEventFromOs(fd, events, MAX_NO_EVENTS))) { do { for (i = 0; i < n; i++) { const char *str = NULL; int verb = eventName(events[i], &str); xf86MsgVerb(X_INFO, verb, "PM Event received: %s\n", str); DoApmEvent(events[i], FALSE); switch (xf86PMConfirmEventToOs(fd, events[i])) { case PM_WAIT: wait = TRUE; break; case PM_CONTINUE: wait = FALSE; break; case PM_FAILED: DoApmEvent(events[i], TRUE); wait = FALSE; break; default: break; } } if (wait) n = xf86PMGetEventFromOs(fd, events, MAX_NO_EVENTS); else break; } while (1); } } xorg-server-1.20.8/hw/xfree86/common/xf86Events.c0000644000175000017500000004354013640201473016335 00000000000000/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * 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 Thomas Roell not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Thomas Roell makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THOMAS ROELL 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. * */ /* * Copyright (c) 1994-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). */ /* [JCH-96/01/21] Extended std reverse map to four buttons. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" #include #ifdef XFreeXDGA #include "dgaproc.h" #endif #include #include #include "inputstr.h" #include "xf86Xinput.h" #include "mi.h" #include "mipointer.h" #include "xkbsrv.h" #include "xkbstr.h" #ifdef DPMSExtension #include #include "dpmsproc.h" #endif #include "xf86platformBus.h" #include "systemd-logind.h" #ifdef XF86PM extern void (*xf86OSPMClose) (void); #endif static void xf86VTSwitch(void); /* * Allow arbitrary drivers or other XFree86 code to register with our main * Wakeup handler. */ typedef struct x_IHRec { int fd; InputHandlerProc ihproc; void *data; Bool enabled; Bool is_input; struct x_IHRec *next; } IHRec, *IHPtr; static IHPtr InputHandlers = NULL; Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) { return TRUE; } /* * TimeSinceLastInputEvent -- * Function used for screensaver purposes by the os module. Returns the * time in milliseconds since there last was any input. */ int TimeSinceLastInputEvent(void) { if (xf86Info.lastEventTime == 0) { xf86Info.lastEventTime = GetTimeInMillis(); } return GetTimeInMillis() - xf86Info.lastEventTime; } /* * SetTimeSinceLastInputEvent -- * Set the lastEventTime to now. */ void SetTimeSinceLastInputEvent(void) { xf86Info.lastEventTime = GetTimeInMillis(); } /* * ProcessInputEvents -- * Retrieve all waiting input events and pass them to DIX in their * correct chronological order. Only reads from the system pointer * and keyboard. */ void ProcessInputEvents(void) { int x, y; mieqProcessInputEvents(); /* FIXME: This is a problem if we have multiple pointers */ miPointerGetPosition(inputInfo.pointer, &x, &y); xf86SetViewport(xf86Info.currentScreen, x, y); } /* * Handle keyboard events that cause some kind of "action" * (i.e., server termination, video mode changes, VT switches, etc.) */ void xf86ProcessActionEvent(ActionEvent action, void *arg) { DebugF("ProcessActionEvent(%d,%p)\n", (int) action, arg); switch (action) { case ACTION_TERMINATE: if (!xf86Info.dontZap) { xf86Msg(X_INFO, "Server zapped. Shutting down.\n"); #ifdef XFreeXDGA DGAShutdown(); #endif GiveUp(0); } break; case ACTION_NEXT_MODE: if (!xf86Info.dontZoom) xf86ZoomViewport(xf86Info.currentScreen, 1); break; case ACTION_PREV_MODE: if (!xf86Info.dontZoom) xf86ZoomViewport(xf86Info.currentScreen, -1); break; case ACTION_SWITCHSCREEN: if (!xf86Info.dontVTSwitch && arg) { int vtno = *((int *) arg); if (vtno != xf86Info.vtno) { if (!xf86VTActivate(vtno)) { ErrorF("Failed to switch from vt%02d to vt%02d: %s\n", xf86Info.vtno, vtno, strerror(errno)); } } } break; case ACTION_SWITCHSCREEN_NEXT: if (!xf86Info.dontVTSwitch) { if (!xf86VTActivate(xf86Info.vtno + 1)) { /* If first try failed, assume this is the last VT and * try wrapping around to the first vt. */ if (!xf86VTActivate(1)) { ErrorF("Failed to switch from vt%02d to next vt: %s\n", xf86Info.vtno, strerror(errno)); } } } break; case ACTION_SWITCHSCREEN_PREV: if (!xf86Info.dontVTSwitch && xf86Info.vtno > 0) { if (!xf86VTActivate(xf86Info.vtno - 1)) { /* Don't know what the maximum VT is, so can't wrap around */ ErrorF("Failed to switch from vt%02d to previous vt: %s\n", xf86Info.vtno, strerror(errno)); } } break; default: break; } } /* * xf86Wakeup -- * Os wakeup handler. */ /* ARGSUSED */ void xf86Wakeup(void *blockData, int err) { if (xf86VTSwitchPending()) xf86VTSwitch(); } /* * xf86ReadInput -- * input thread handler */ static void xf86ReadInput(int fd, int ready, void *closure) { InputInfoPtr pInfo = closure; pInfo->read_input(pInfo); } /* * xf86AddEnabledDevice -- * */ void xf86AddEnabledDevice(InputInfoPtr pInfo) { InputThreadRegisterDev(pInfo->fd, xf86ReadInput, pInfo); } /* * xf86RemoveEnabledDevice -- * */ void xf86RemoveEnabledDevice(InputInfoPtr pInfo) { InputThreadUnregisterDev(pInfo->fd); } /* * xf86PrintBacktrace -- * Print a stack backtrace for debugging purposes. */ void xf86PrintBacktrace(void) { xorg_backtrace(); } static void xf86ReleaseKeys(DeviceIntPtr pDev) { KeyClassPtr keyc; int i; if (!pDev || !pDev->key) return; keyc = pDev->key; /* * Hmm... here is the biggest hack of every time ! * It may be possible that a switch-vt procedure has finished BEFORE * you released all keys neccessary to do this. That peculiar behavior * can fool the X-server pretty much, cause it assumes that some keys * were not released. TWM may stuck alsmost completly.... * OK, what we are doing here is after returning from the vt-switch * exeplicitely unrelease all keyboard keys before the input-devices * are reenabled. */ for (i = keyc->xkbInfo->desc->min_key_code; i < keyc->xkbInfo->desc->max_key_code; i++) { if (key_is_down(pDev, i, KEY_POSTED)) { input_lock(); QueueKeyboardEvents(pDev, KeyRelease, i); input_unlock(); } } } void xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo) { if (!pInfo->dev) return; if (!pInfo->dev->enabled) pInfo->flags |= XI86_DEVICE_DISABLED; xf86ReleaseKeys(pInfo->dev); ProcessInputEvents(); DisableDevice(pInfo->dev, TRUE); } void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo) { if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0) EnableDevice(pInfo->dev, TRUE); pInfo->flags &= ~XI86_DEVICE_DISABLED; } /* * xf86UpdateHasVTProperty -- * Update a flag property on the root window to say whether the server VT * is currently the active one as some clients need to know this. */ static void xf86UpdateHasVTProperty(Bool hasVT) { Atom property_name; int32_t value = hasVT ? 1 : 0; int i; property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1, FALSE); if (property_name == BAD_RESOURCE) FatalError("Failed to retrieve \"HAS_VT\" atom\n"); for (i = 0; i < xf86NumScreens; i++) { dixChangeWindowProperty(serverClient, xf86ScrnToScreen(xf86Screens[i])->root, property_name, XA_INTEGER, 32, PropModeReplace, 1, &value, TRUE); } } void xf86VTLeave(void) { int i; InputInfoPtr pInfo; IHPtr ih; DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); #ifdef DPMSExtension if (DPMSPowerLevel != DPMSModeOn) DPMSSet(serverClient, DPMSModeOn); #endif for (i = 0; i < xf86NumScreens; i++) { if (!(dispatchException & DE_TERMINATE)) if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); } /* * Keep the order: Disable Device > LeaveVT * EnterVT > EnableDevice */ for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input) xf86DisableInputHandler(ih); else xf86DisableGeneralHandler(ih); } for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) xf86DisableInputDeviceForVTSwitch(pInfo); input_lock(); for (i = 0; i < xf86NumScreens; i++) xf86Screens[i]->LeaveVT(xf86Screens[i]); for (i = 0; i < xf86NumGPUScreens; i++) xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); if (!xf86VTSwitchAway()) goto switch_failed; #ifdef XF86PM if (xf86OSPMClose) xf86OSPMClose(); xf86OSPMClose = NULL; #endif for (i = 0; i < xf86NumScreens; i++) { /* * zero all access functions to * trap calls when switched away. */ xf86Screens[i]->vtSema = FALSE; } if (xorgHWAccess) xf86DisableIO(); xf86UpdateHasVTProperty(FALSE); return; switch_failed: DebugF("xf86VTSwitch: Leave failed\n"); for (i = 0; i < xf86NumScreens; i++) { if (!xf86Screens[i]->EnterVT(xf86Screens[i])) FatalError("EnterVT failed for screen %d\n", i); } for (i = 0; i < xf86NumGPUScreens; i++) { if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) FatalError("EnterVT failed for gpu screen %d\n", i); } if (!(dispatchException & DE_TERMINATE)) { for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } } dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) xf86EnableInputDeviceForVTSwitch(pInfo); for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input) xf86EnableInputHandler(ih); else xf86EnableGeneralHandler(ih); } input_unlock(); } void xf86VTEnter(void) { int i; InputInfoPtr pInfo; IHPtr ih; DebugF("xf86VTSwitch: Entering\n"); if (!xf86VTSwitchTo()) return; #ifdef XF86PM xf86OSPMClose = xf86OSPMOpen(); #endif if (xorgHWAccess) xf86EnableIO(); for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->vtSema = TRUE; if (!xf86Screens[i]->EnterVT(xf86Screens[i])) FatalError("EnterVT failed for screen %d\n", i); } for (i = 0; i < xf86NumGPUScreens; i++) { xf86GPUScreens[i]->vtSema = TRUE; if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) FatalError("EnterVT failed for gpu screen %d\n", i); } for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } /* Turn screen saver off when switching back */ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) { /* Devices with server managed fds get enabled on logind resume */ if (!(pInfo->flags & XI86_SERVER_FD)) xf86EnableInputDeviceForVTSwitch(pInfo); } for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input) xf86EnableInputHandler(ih); else xf86EnableGeneralHandler(ih); } #ifdef XSERVER_PLATFORM_BUS /* check for any new output devices */ xf86platformVTProbe(); #endif xf86UpdateHasVTProperty(TRUE); input_unlock(); } /* * xf86VTSwitch -- * Handle requests for switching the vt. */ static void xf86VTSwitch(void) { DebugF("xf86VTSwitch()\n"); #ifdef XFreeXDGA if (!DGAVTSwitch()) return; #endif /* * Since all screens are currently all in the same state it is sufficient * check the first. This might change in future. * * VTLeave is always handled here (VT_PROCESS guarantees this is safe), * if we use systemd_logind xf86VTEnter() gets called by systemd-logind.c * once it has resumed all drm nodes. */ if (xf86VTOwner()) xf86VTLeave(); else if (!systemd_logind_controls_session()) xf86VTEnter(); } /* Input handler registration */ static void xf86InputHandlerNotify(int fd, int ready, void *data) { IHPtr ih = data; if (ih->enabled && ih->fd >= 0 && ih->ihproc) { ih->ihproc(ih->fd, ih->data); } } static void * addInputHandler(int fd, InputHandlerProc proc, void *data) { IHPtr ih; if (fd < 0 || !proc) return NULL; ih = calloc(sizeof(*ih), 1); if (!ih) return NULL; ih->fd = fd; ih->ihproc = proc; ih->data = data; ih->enabled = TRUE; if (!SetNotifyFd(fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih)) { free(ih); return NULL; } ih->next = InputHandlers; InputHandlers = ih; return ih; } void * xf86AddInputHandler(int fd, InputHandlerProc proc, void *data) { IHPtr ih = addInputHandler(fd, proc, data); if (ih) ih->is_input = TRUE; return ih; } void * xf86AddGeneralHandler(int fd, InputHandlerProc proc, void *data) { IHPtr ih = addInputHandler(fd, proc, data); return ih; } /** * Set the handler for the console's fd. Replaces (and returns) the previous * handler or NULL, whichever appropriate. * proc may be NULL if the server should not handle events on the console. */ InputHandlerProc xf86SetConsoleHandler(InputHandlerProc proc, void *data) { static IHPtr handler = NULL; InputHandlerProc old_proc = NULL; if (handler) { old_proc = handler->ihproc; xf86RemoveGeneralHandler(handler); } handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data); return old_proc; } static void removeInputHandler(IHPtr ih) { IHPtr p; if (ih->fd >= 0) RemoveNotifyFd(ih->fd); if (ih == InputHandlers) InputHandlers = ih->next; else { p = InputHandlers; while (p && p->next != ih) p = p->next; if (ih) p->next = ih->next; } free(ih); } int xf86RemoveInputHandler(void *handler) { IHPtr ih; int fd; if (!handler) return -1; ih = handler; fd = ih->fd; removeInputHandler(ih); return fd; } int xf86RemoveGeneralHandler(void *handler) { IHPtr ih; int fd; if (!handler) return -1; ih = handler; fd = ih->fd; removeInputHandler(ih); return fd; } void xf86DisableInputHandler(void *handler) { IHPtr ih; if (!handler) return; ih = handler; ih->enabled = FALSE; if (ih->fd >= 0) RemoveNotifyFd(ih->fd); } void xf86DisableGeneralHandler(void *handler) { IHPtr ih; if (!handler) return; ih = handler; ih->enabled = FALSE; if (ih->fd >= 0) RemoveNotifyFd(ih->fd); } void xf86EnableInputHandler(void *handler) { IHPtr ih; if (!handler) return; ih = handler; ih->enabled = TRUE; if (ih->fd >= 0) SetNotifyFd(ih->fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih); } void xf86EnableGeneralHandler(void *handler) { IHPtr ih; if (!handler) return; ih = handler; ih->enabled = TRUE; if (ih->fd >= 0) SetNotifyFd(ih->fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih); } void DDXRingBell(int volume, int pitch, int duration) { xf86OSRingBell(volume, pitch, duration); } Bool xf86VTOwner(void) { /* at system startup xf86Screens[0] won't be set - but we will own the VT */ if (xf86NumScreens == 0) return TRUE; return xf86Screens[0]->vtSema; } xorg-server-1.20.8/hw/xfree86/common/xf86Bus.h0000644000175000017500000000460413640201473015625 00000000000000/* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains definitions of the bus-related data structures/types. * Everything contained here is private to xf86Bus.c. In particular the * video drivers must not include this file. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _XF86_BUS_H #define _XF86_BUS_H #include "xf86pciBus.h" #if defined(__sparc__) || defined(__sparc) #include "xf86sbusBus.h" #endif #include "xf86platformBus.h" typedef struct { DriverPtr driver; int chipset; int entityProp; Bool active; Bool inUse; BusRec bus; int lastScrnFlag; DevUnion *entityPrivates; int numInstances; GDevPtr *devices; } EntityRec, *EntityPtr; #define ACCEL_IS_SHARABLE 0x100 #define IS_SHARED_ACCEL 0x200 #define SA_PRIM_INIT_DONE 0x400 extern EntityPtr *xf86Entities; extern int xf86NumEntities; extern BusRec primaryBus; int xf86AllocateEntity(void); BusType StringToBusType(const char *busID, const char **retID); #endif /* _XF86_BUS_H */ xorg-server-1.20.8/hw/xfree86/common/xf86xvpriv.h0000644000175000017500000000607413640201473016435 00000000000000 /* * Copyright (c) 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). */ #ifndef _XF86XVPRIV_H_ #define _XF86XVPRIV_H_ #include "xf86xv.h" #include "privates.h" /*** These are DDX layer privates ***/ extern _X_EXPORT DevPrivateKey XF86XvScreenKey; typedef struct { DestroyWindowProcPtr DestroyWindow; ClipNotifyProcPtr ClipNotify; WindowExposuresProcPtr WindowExposures; PostValidateTreeProcPtr PostValidateTree; void (*AdjustFrame) (ScrnInfoPtr, int, int); Bool (*EnterVT) (ScrnInfoPtr); void (*LeaveVT) (ScrnInfoPtr); xf86ModeSetProc *ModeSet; CloseScreenProcPtr CloseScreen; } XF86XVScreenRec, *XF86XVScreenPtr; typedef struct { int flags; PutVideoFuncPtr PutVideo; PutStillFuncPtr PutStill; GetVideoFuncPtr GetVideo; GetStillFuncPtr GetStill; StopVideoFuncPtr StopVideo; SetPortAttributeFuncPtr SetPortAttribute; GetPortAttributeFuncPtr GetPortAttribute; QueryBestSizeFuncPtr QueryBestSize; PutImageFuncPtr PutImage; ReputImageFuncPtr ReputImage; QueryImageAttributesFuncPtr QueryImageAttributes; } XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; typedef struct { ScrnInfoPtr pScrn; DrawablePtr pDraw; unsigned char type; unsigned int subWindowMode; RegionPtr clientClip; RegionPtr ckeyFilled; RegionPtr pCompositeClip; Bool FreeCompositeClip; XvAdaptorRecPrivatePtr AdaptorRec; XvStatus isOn; Bool clipChanged; int vid_x, vid_y, vid_w, vid_h; int drw_x, drw_y, drw_w, drw_h; DevUnion DevPriv; } XvPortRecPrivate, *XvPortRecPrivatePtr; typedef struct _XF86XVWindowRec { XvPortRecPrivatePtr PortRec; struct _XF86XVWindowRec *next; } XF86XVWindowRec, *XF86XVWindowPtr; #endif /* _XF86XVPRIV_H_ */ xorg-server-1.20.8/hw/xfree86/common/xf86Bus.c0000644000175000017500000004340713640201473015624 00000000000000/* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the interfaces to the bus-specific code */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include #include #include "os.h" #include "xf86.h" #include "xf86Priv.h" /* Bus-specific headers */ #include "xf86Bus.h" #define XF86_OS_PRIVS #include "xf86_OSproc.h" #ifdef XSERVER_LIBPCIACCESS #include "xf86VGAarbiter.h" #endif /* Entity data */ EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */ int xf86NumEntities = 0; static int xf86EntityPrivateCount = 0; BusRec primaryBus = { BUS_NONE, {0} }; /** * Call the driver's correct probe function. * * If the driver implements the \c DriverRec::PciProbe entry-point and an * appropriate PCI device (with matching Device section in the xorg.conf file) * is found, it is called. If \c DriverRec::PciProbe or no devices can be * successfully probed with it (e.g., only non-PCI devices are available), * the driver's \c DriverRec::Probe function is called. * * \param drv Driver to probe * * \return * If a device can be successfully probed by the driver, \c TRUE is * returned. Otherwise, \c FALSE is returned. */ Bool xf86CallDriverProbe(DriverPtr drv, Bool detect_only) { Bool foundScreen = FALSE; #ifdef XSERVER_PLATFORM_BUS /* xf86platformBus.c does not support Xorg -configure */ if (!xf86DoConfigure && drv->platformProbe != NULL) { foundScreen = xf86platformProbeDev(drv); } #endif #ifdef XSERVER_LIBPCIACCESS if (!foundScreen && (drv->PciProbe != NULL)) { if (xf86DoConfigure && xf86DoConfigurePass1) { assert(detect_only); foundScreen = xf86PciAddMatchingDev(drv); } else { assert(!detect_only); foundScreen = xf86PciProbeDev(drv); } } #endif if (!foundScreen && (drv->Probe != NULL)) { xf86Msg(X_WARNING, "Falling back to old probe method for %s\n", drv->driverName); foundScreen = (*drv->Probe) (drv, (detect_only) ? PROBE_DETECT : PROBE_DEFAULT); } return foundScreen; } /** * @return TRUE if all buses are configured and set up correctly and FALSE * otherwise. */ Bool xf86BusConfig(void) { screenLayoutPtr layout; int i, j; /* * 3 step probe to (hopefully) ensure that we always find at least 1 * (non GPU) screen: * * 1. Call each drivers probe function normally, * Each successful probe will result in an extra entry added to the * xf86Screens[] list for each instance of the hardware found. */ for (i = 0; i < xf86NumDrivers; i++) { xf86CallDriverProbe(xf86DriverList[i], FALSE); } /* * 2. If no Screens were found, call each drivers probe function with * ignorePrimary = TRUE, to ensure that we do actually get a * Screen if there is atleast one supported video card. */ if (xf86NumScreens == 0) { xf86ProbeIgnorePrimary = TRUE; for (i = 0; i < xf86NumDrivers && xf86NumScreens == 0; i++) { xf86CallDriverProbe(xf86DriverList[i], FALSE); } xf86ProbeIgnorePrimary = FALSE; } /* * 3. Call xf86platformAddGPUDevices() to add any additional video cards as * GPUScreens (GPUScreens are only supported by platformBus drivers). */ for (i = 0; i < xf86NumDrivers; i++) { xf86platformAddGPUDevices(xf86DriverList[i]); } /* If nothing was detected, return now */ if (xf86NumScreens == 0) { xf86Msg(X_ERROR, "No devices detected.\n"); return FALSE; } xf86VGAarbiterInit(); /* * Match up the screens found by the probes against those specified * in the config file. Remove the ones that won't be used. Sort * them in the order specified. * * What is the best way to do this? * * For now, go through the screens allocated by the probes, and * look for screen config entry which refers to the same device * section as picked out by the probe. * */ for (i = 0; i < xf86NumScreens; i++) { for (layout = xf86ConfigLayout.screens; layout->screen != NULL; layout++) { Bool found = FALSE; for (j = 0; j < xf86Screens[i]->numEntities; j++) { GDevPtr dev = xf86GetDevFromEntity(xf86Screens[i]->entityList[j], xf86Screens[i]->entityInstanceList[j]); if (dev == layout->screen->device) { /* A match has been found */ xf86Screens[i]->confScreen = layout->screen; found = TRUE; break; } } if (found) break; } if (layout->screen == NULL) { /* No match found */ xf86Msg(X_ERROR, "Screen %d deleted because of no matching config section.\n", i); xf86DeleteScreen(xf86Screens[i--]); } } /* bind GPU conf screen to protocol screen 0 */ for (i = 0; i < xf86NumGPUScreens; i++) xf86GPUScreens[i]->confScreen = xf86Screens[0]->confScreen; /* If no screens left, return now. */ if (xf86NumScreens == 0) { xf86Msg(X_ERROR, "Device(s) detected, but none match those in the config file.\n"); return FALSE; } return TRUE; } /* * Call the bus probes relevant to the architecture. * * The only one available so far is for PCI and SBUS. */ void xf86BusProbe(void) { #ifdef XSERVER_PLATFORM_BUS xf86platformProbe(); if (ServerIsNotSeat0() && xf86_num_platform_devices > 0) return; #endif #ifdef XSERVER_LIBPCIACCESS xf86PciProbe(); #endif #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) xf86SbusProbe(); #endif #ifdef XSERVER_PLATFORM_BUS xf86platformPrimary(); #endif } /* * Determine what bus type the busID string represents. The start of the * bus-dependent part of the string is returned as retID. */ BusType StringToBusType(const char *busID, const char **retID) { char *p, *s; BusType ret = BUS_NONE; /* If no type field, Default to PCI */ if (isdigit(busID[0])) { if (retID) *retID = busID; return BUS_PCI; } s = xstrdup(busID); p = strtok(s, ":"); if (p == NULL || *p == 0) { free(s); return BUS_NONE; } if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp")) ret = BUS_PCI; if (!xf86NameCmp(p, "sbus")) ret = BUS_SBUS; if (!xf86NameCmp(p, "platform")) ret = BUS_PLATFORM; if (ret != BUS_NONE) if (retID) *retID = busID + strlen(p) + 1; free(s); return ret; } int xf86AllocateEntity(void) { xf86NumEntities++; xf86Entities = xnfreallocarray(xf86Entities, xf86NumEntities, sizeof(EntityPtr)); xf86Entities[xf86NumEntities - 1] = xnfcalloc(1, sizeof(EntityRec)); xf86Entities[xf86NumEntities - 1]->entityPrivates = xnfcalloc(xf86EntityPrivateCount, sizeof(DevUnion)); return xf86NumEntities - 1; } Bool xf86IsEntityPrimary(int entityIndex) { EntityPtr pEnt = xf86Entities[entityIndex]; #ifdef XSERVER_LIBPCIACCESS if (primaryBus.type == BUS_PLATFORM && pEnt->bus.type == BUS_PCI) return MATCH_PCI_DEVICES(pEnt->bus.id.pci, primaryBus.id.plat->pdev); #endif if (primaryBus.type != pEnt->bus.type) return FALSE; switch (pEnt->bus.type) { case BUS_PCI: return pEnt->bus.id.pci == primaryBus.id.pci; case BUS_SBUS: return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum; case BUS_PLATFORM: return pEnt->bus.id.plat == primaryBus.id.plat; default: return FALSE; } } Bool xf86DriverHasEntities(DriverPtr drvp) { int i; for (i = 0; i < xf86NumEntities; i++) { if (xf86Entities[i]->driver == drvp) return TRUE; } return FALSE; } void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex) { if (entityIndex == -1) return; if (xf86Entities[entityIndex]->inUse && !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) { ErrorF("Requested Entity already in use!\n"); return; } pScrn->numEntities++; pScrn->entityList = xnfreallocarray(pScrn->entityList, pScrn->numEntities, sizeof(int)); pScrn->entityList[pScrn->numEntities - 1] = entityIndex; xf86Entities[entityIndex]->inUse = TRUE; pScrn->entityInstanceList = xnfreallocarray(pScrn->entityInstanceList, pScrn->numEntities, sizeof(int)); pScrn->entityInstanceList[pScrn->numEntities - 1] = 0; } void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance) { int i; if (entityIndex == -1 || entityIndex >= xf86NumEntities) return; for (i = 0; i < pScrn->numEntities; i++) { if (pScrn->entityList[i] == entityIndex) { pScrn->entityInstanceList[i] = instance; break; } } } /* * XXX This needs to be updated for the case where a single entity may have * instances associated with more than one screen. */ ScrnInfoPtr xf86FindScreenForEntity(int entityIndex) { int i, j; if (entityIndex == -1) return NULL; if (xf86Screens) { for (i = 0; i < xf86NumScreens; i++) { for (j = 0; j < xf86Screens[i]->numEntities; j++) { if (xf86Screens[i]->entityList[j] == entityIndex) return xf86Screens[i]; } } } return NULL; } void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex) { int i; for (i = 0; i < pScrn->numEntities; i++) { if (pScrn->entityList[i] == entityIndex) { for (i++; i < pScrn->numEntities; i++) pScrn->entityList[i - 1] = pScrn->entityList[i]; pScrn->numEntities--; xf86Entities[entityIndex]->inUse = FALSE; break; } } } /* * xf86ClearEntityListForScreen() - called when a screen is deleted * to mark it's entities unused. Called by xf86DeleteScreen(). */ void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn) { int i, entityIndex; if (pScrn->entityList == NULL || pScrn->numEntities == 0) return; for (i = 0; i < pScrn->numEntities; i++) { entityIndex = pScrn->entityList[i]; xf86Entities[entityIndex]->inUse = FALSE; /* disable resource: call the disable function */ } free(pScrn->entityList); free(pScrn->entityInstanceList); pScrn->entityList = NULL; pScrn->entityInstanceList = NULL; } /* * Add an extra device section (GDevPtr) to an entity. */ void xf86AddDevToEntity(int entityIndex, GDevPtr dev) { EntityPtr pEnt; if (entityIndex >= xf86NumEntities) return; pEnt = xf86Entities[entityIndex]; pEnt->numInstances++; pEnt->devices = xnfreallocarray(pEnt->devices, pEnt->numInstances, sizeof(GDevPtr)); pEnt->devices[pEnt->numInstances - 1] = dev; dev->claimed = TRUE; } void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev) { EntityPtr pEnt; int i, j; if (entityIndex >= xf86NumEntities) return; pEnt = xf86Entities[entityIndex]; for (i = 0; i < pEnt->numInstances; i++) { if (pEnt->devices[i] == dev) { for (j = i; j < pEnt->numInstances - 1; j++) pEnt->devices[j] = pEnt->devices[j + 1]; break; } } pEnt->numInstances--; dev->claimed = FALSE; } /* * xf86GetEntityInfo() -- This function hands information from the * EntityRec struct to the drivers. The EntityRec structure itself * remains invisible to the driver. */ EntityInfoPtr xf86GetEntityInfo(int entityIndex) { EntityInfoPtr pEnt; int i; if (entityIndex == -1) return NULL; if (entityIndex >= xf86NumEntities) return NULL; pEnt = xnfcalloc(1, sizeof(EntityInfoRec)); pEnt->index = entityIndex; pEnt->location = xf86Entities[entityIndex]->bus; pEnt->active = xf86Entities[entityIndex]->active; pEnt->chipset = xf86Entities[entityIndex]->chipset; pEnt->driver = xf86Entities[entityIndex]->driver; if ((xf86Entities[entityIndex]->devices) && (xf86Entities[entityIndex]->devices[0])) { for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++) if (xf86Entities[entityIndex]->devices[i]->screen == 0) break; pEnt->device = xf86Entities[entityIndex]->devices[i]; } else pEnt->device = NULL; return pEnt; } int xf86GetNumEntityInstances(int entityIndex) { if (entityIndex >= xf86NumEntities) return -1; return xf86Entities[entityIndex]->numInstances; } GDevPtr xf86GetDevFromEntity(int entityIndex, int instance) { int i; /* We might not use AddDevtoEntity */ if ((!xf86Entities[entityIndex]->devices) || (!xf86Entities[entityIndex]->devices[0])) return NULL; if (entityIndex >= xf86NumEntities || instance >= xf86Entities[entityIndex]->numInstances) return NULL; for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++) if (xf86Entities[entityIndex]->devices[i]->screen == instance) break; return xf86Entities[entityIndex]->devices[i]; } /* * xf86PostProbe() -- Allocate all non conflicting resources * This function gets called by xf86Init(). */ void xf86PostProbe(void) { if (fbSlotClaimed && ( #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) sbusSlotClaimed || #endif #ifdef XSERVER_PLATFORM_BUS platformSlotClaimed || #endif #ifdef XSERVER_LIBPCIACCESS pciSlotClaimed #else TRUE #endif )) FatalError("Cannot run in framebuffer mode. Please specify busIDs " " for all framebuffer devices\n"); } int xf86GetLastScrnFlag(int entityIndex) { if (entityIndex < xf86NumEntities) { return xf86Entities[entityIndex]->lastScrnFlag; } else { return -1; } } void xf86SetLastScrnFlag(int entityIndex, int scrnIndex) { if (entityIndex < xf86NumEntities) { xf86Entities[entityIndex]->lastScrnFlag = scrnIndex; } } Bool xf86IsEntityShared(int entityIndex) { if (entityIndex < xf86NumEntities) { if (xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) { return TRUE; } } return FALSE; } void xf86SetEntityShared(int entityIndex) { if (entityIndex < xf86NumEntities) { xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL; } } Bool xf86IsEntitySharable(int entityIndex) { if (entityIndex < xf86NumEntities) { if (xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) { return TRUE; } } return FALSE; } void xf86SetEntitySharable(int entityIndex) { if (entityIndex < xf86NumEntities) { xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE; } } Bool xf86IsPrimInitDone(int entityIndex) { if (entityIndex < xf86NumEntities) { if (xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) { return TRUE; } } return FALSE; } void xf86SetPrimInitDone(int entityIndex) { if (entityIndex < xf86NumEntities) { xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE; } } void xf86ClearPrimInitDone(int entityIndex) { if (entityIndex < xf86NumEntities) { xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE; } } /* * Allocate a private in the entities. */ int xf86AllocateEntityPrivateIndex(void) { int idx, i; EntityPtr pEnt; DevUnion *nprivs; idx = xf86EntityPrivateCount++; for (i = 0; i < xf86NumEntities; i++) { pEnt = xf86Entities[i]; nprivs = xnfreallocarray(pEnt->entityPrivates, xf86EntityPrivateCount, sizeof(DevUnion)); /* Zero the new private */ memset(&nprivs[idx], 0, sizeof(DevUnion)); pEnt->entityPrivates = nprivs; } return idx; } DevUnion * xf86GetEntityPrivate(int entityIndex, int privIndex) { if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount) return NULL; return &(xf86Entities[entityIndex]->entityPrivates[privIndex]); } xorg-server-1.20.8/hw/xfree86/common/xf86RandR.c0000644000175000017500000003220713640201473016075 00000000000000/* * * 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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 #endif #include #include "os.h" #include "globals.h" #include "xf86.h" #include "xf86str.h" #include "xf86Priv.h" #include "xf86DDC.h" #include "mipointer.h" #include #include "inputstr.h" typedef struct _xf86RandRInfo { CloseScreenProcPtr CloseScreen; int virtualX; int virtualY; int mmWidth; int mmHeight; Rotation rotation; } XF86RandRInfoRec, *XF86RandRInfoPtr; static DevPrivateKeyRec xf86RandRKeyRec; static DevPrivateKey xf86RandRKey; #define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey)) static int xf86RandRModeRefresh(DisplayModePtr mode) { if (mode->VRefresh) return (int) (mode->VRefresh + 0.5); else if (mode->Clock == 0) return 0; else return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5); } static Bool xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations) { RRScreenSizePtr pSize; ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int refresh0 = 60; xorgRRModeMM RRModeMM; *rotations = RR_Rotate_0; for (mode = scrp->modes; mode != NULL; mode = mode->next) { int refresh = xf86RandRModeRefresh(mode); if (mode == scrp->modes) refresh0 = refresh; RRModeMM.mode = mode; RRModeMM.virtX = randrp->virtualX; RRModeMM.virtY = randrp->virtualY; RRModeMM.mmWidth = randrp->mmWidth; RRModeMM.mmHeight = randrp->mmHeight; if (scrp->DriverFunc) { (*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM); } pSize = RRRegisterSize(pScreen, mode->HDisplay, mode->VDisplay, RRModeMM.mmWidth, RRModeMM.mmHeight); if (!pSize) return FALSE; RRRegisterRate(pScreen, pSize, refresh); if (mode == scrp->currentMode && mode->HDisplay == scrp->virtualX && mode->VDisplay == scrp->virtualY) RRSetCurrentConfig(pScreen, randrp->rotation, refresh, pSize); if (mode->next == scrp->modes) break; } if (scrp->currentMode->HDisplay != randrp->virtualX || scrp->currentMode->VDisplay != randrp->virtualY) { mode = scrp->modes; RRModeMM.mode = NULL; RRModeMM.virtX = randrp->virtualX; RRModeMM.virtY = randrp->virtualY; RRModeMM.mmWidth = randrp->mmWidth; RRModeMM.mmHeight = randrp->mmHeight; if (scrp->DriverFunc) { (*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM); } pSize = RRRegisterSize(pScreen, randrp->virtualX, randrp->virtualY, RRModeMM.mmWidth, RRModeMM.mmHeight); if (!pSize) return FALSE; RRRegisterRate(pScreen, pSize, refresh0); if (scrp->virtualX == randrp->virtualX && scrp->virtualY == randrp->virtualY) { RRSetCurrentConfig(pScreen, randrp->rotation, refresh0, pSize); } } /* If there is driver support for randr, let it set our supported rotations */ if (scrp->DriverFunc) { xorgRRRotation RRRotation; RRRotation.RRRotations = *rotations; if (!(*scrp->DriverFunc) (scrp, RR_GET_INFO, &RRRotation)) return TRUE; *rotations = RRRotation.RRRotations; } return TRUE; } static Bool xf86RandRSetMode(ScreenPtr pScreen, DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) { ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int oldWidth = pScreen->width; int oldHeight = pScreen->height; int oldmmWidth = pScreen->mmWidth; int oldmmHeight = pScreen->mmHeight; int oldVirtualX = scrp->virtualX; int oldVirtualY = scrp->virtualY; WindowPtr pRoot = pScreen->root; Bool ret = TRUE; if (pRoot && scrp->vtSema) (*scrp->EnableDisableFBAccess) (scrp, FALSE); if (useVirtual) { scrp->virtualX = randrp->virtualX; scrp->virtualY = randrp->virtualY; } else { scrp->virtualX = mode->HDisplay; scrp->virtualY = mode->VDisplay; } /* * The DIX forgets the physical dimensions we passed into RRRegisterSize, so * reconstruct them if possible. */ if (scrp->DriverFunc) { xorgRRModeMM RRModeMM; RRModeMM.mode = mode; RRModeMM.virtX = scrp->virtualX; RRModeMM.virtY = scrp->virtualY; RRModeMM.mmWidth = mmWidth; RRModeMM.mmHeight = mmHeight; (*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM); mmWidth = RRModeMM.mmWidth; mmHeight = RRModeMM.mmHeight; } 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 (!xf86SwitchMode(pScreen, mode)) { pScreen->width = oldWidth; pScreen->height = oldHeight; pScreen->mmWidth = oldmmWidth; pScreen->mmHeight = oldmmHeight; scrp->virtualX = oldVirtualX; scrp->virtualY = oldVirtualY; ret = FALSE; } /* * Make sure the layout is correct */ xf86ReconfigureLayout(); if (scrp->vtSema) { /* * Make sure the whole screen is visible */ xf86SetViewport (pScreen, pScreen->width, pScreen->height); xf86SetViewport (pScreen, 0, 0); if (pRoot) (*scrp->EnableDisableFBAccess) (scrp, TRUE); } return ret; } static Bool xf86RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int pos[MAXDEVICES][2]; Bool useVirtual = FALSE; Rotation oldRotation = randrp->rotation; DeviceIntPtr dev; Bool view_adjusted = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (!IsMaster(dev) && !IsFloating(dev)) continue; miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]); } for (mode = scrp->modes;; mode = mode->next) { if (mode->HDisplay == pSize->width && mode->VDisplay == pSize->height && (rate == 0 || xf86RandRModeRefresh(mode) == rate)) break; if (mode->next == scrp->modes) { if (pSize->width == randrp->virtualX && pSize->height == randrp->virtualY) { mode = scrp->modes; useVirtual = TRUE; break; } return FALSE; } } if (randrp->rotation != rotation) { /* Have the driver do its thing. */ if (scrp->DriverFunc) { xorgRRRotation RRRotation; RRRotation.RRConfig.rotation = rotation; RRRotation.RRConfig.rate = rate; RRRotation.RRConfig.width = pSize->width; RRRotation.RRConfig.height = pSize->height; /* * Currently we need to rely on HW support for rotation. */ if (!(*scrp->DriverFunc) (scrp, RR_SET_CONFIG, &RRRotation)) return FALSE; } else return FALSE; randrp->rotation = rotation; } if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) { if (randrp->rotation != oldRotation) { /* Have the driver undo its thing. */ if (scrp->DriverFunc) { xorgRRRotation RRRotation; RRRotation.RRConfig.rotation = oldRotation; RRRotation.RRConfig.rate = xf86RandRModeRefresh(scrp->currentMode); RRRotation.RRConfig.width = scrp->virtualX; RRRotation.RRConfig.height = scrp->virtualY; (*scrp->DriverFunc) (scrp, RR_SET_CONFIG, &RRRotation); } randrp->rotation = oldRotation; } return FALSE; } update_desktop_dimensions(); /* * Move the cursor back where it belongs; SwitchMode repositions it * FIXME: duplicated code, see modes/xf86RandR12.c */ for (dev = inputInfo.devices; dev; dev = dev->next) { if (!IsMaster(dev) && !IsFloating(dev)) continue; if (pScreen == miPointerGetScreen(dev)) { int px = pos[dev->id][0]; int py = pos[dev->id][1]; px = (px >= pScreen->width ? (pScreen->width - 1) : px); py = (py >= pScreen->height ? (pScreen->height - 1) : py); /* Setting the viewpoint makes only sense on one device */ if (!view_adjusted && IsMaster(dev)) { xf86SetViewport(pScreen, px, py); view_adjusted = TRUE; } (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE); } } return TRUE; } /* * Reset size back to original */ static Bool xf86RandRCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); scrp->virtualX = pScreen->width = randrp->virtualX; scrp->virtualY = pScreen->height = randrp->virtualY; scrp->currentMode = scrp->modes; pScreen->CloseScreen = randrp->CloseScreen; free(randrp); dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL); return (*pScreen->CloseScreen) (pScreen); } Rotation xf86GetRotation(ScreenPtr pScreen) { if (xf86RandRKey == NULL) return RR_Rotate_0; return XF86RANDRINFO(pScreen)->rotation; } /* Function to change RandR's idea of the virtual screen size */ Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, int newvirtX, int newvirtY, int newmmWidth, int newmmHeight, Bool resetMode) { XF86RandRInfoPtr randrp; if (xf86RandRKey == NULL) return FALSE; randrp = XF86RANDRINFO(pScreen); if (randrp == NULL) return FALSE; if (newvirtX > 0) randrp->virtualX = newvirtX; if (newvirtY > 0) randrp->virtualY = newvirtY; if (newmmWidth > 0) randrp->mmWidth = newmmWidth; if (newmmHeight > 0) randrp->mmHeight = newmmHeight; /* This is only for during server start */ if (resetMode) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); return (xf86RandRSetMode(pScreen, pScrn->currentMode, TRUE, pScreen->mmWidth, pScreen->mmHeight)); } return TRUE; } Bool xf86RandRInit(ScreenPtr pScreen) { rrScrPrivPtr rp; XF86RandRInfoPtr randrp; ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); #ifdef PANORAMIX /* XXX disable RandR when using Xinerama */ if (!noPanoramiXExtension) return TRUE; #endif xf86RandRKey = &xf86RandRKeyRec; if (!dixRegisterPrivateKey(&xf86RandRKeyRec, 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 = xf86RandRGetInfo; rp->rrSetConfig = xf86RandRSetConfig; randrp->virtualX = scrp->virtualX; randrp->virtualY = scrp->virtualY; randrp->mmWidth = pScreen->mmWidth; randrp->mmHeight = pScreen->mmHeight; randrp->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86RandRCloseScreen; randrp->rotation = RR_Rotate_0; dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp); return TRUE; } xorg-server-1.20.8/hw/xfree86/common/xf86Optionstr.h0000644000175000017500000000273713640201473017102 00000000000000/* * Copyright © 2011 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. * */ #ifndef XF86OPTIONSTR_H #define XF86OPTIONSTR_H #include "list.h" /* * All options are stored using this data type. */ typedef struct _XF86OptionRec { GenericListRec list; const char *opt_name; const char *opt_val; int opt_used; const char *opt_comment; } XF86OptionRec; typedef struct _InputOption *XF86OptionPtr; #endif xorg-server-1.20.8/hw/xfree86/common/xf86Opt.h0000644000175000017500000001773713640201473015651 00000000000000 /* * Copyright (c) 1998-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). */ /* Option handling things that ModuleSetup procs can use */ #ifndef _XF86_OPT_H_ #define _XF86_OPT_H_ #include "xf86Optionstr.h" typedef struct { double freq; int units; } OptFrequency; typedef union { unsigned long num; const char *str; double realnum; Bool bool; OptFrequency freq; } ValueUnion; typedef enum { OPTV_NONE = 0, OPTV_INTEGER, OPTV_STRING, /* a non-empty string */ OPTV_ANYSTR, /* Any string, including an empty one */ OPTV_REAL, OPTV_BOOLEAN, OPTV_PERCENT, OPTV_FREQ } OptionValueType; typedef enum { OPTUNITS_HZ = 1, OPTUNITS_KHZ, OPTUNITS_MHZ } OptFreqUnits; typedef struct { int token; const char *name; OptionValueType type; ValueUnion value; Bool found; } OptionInfoRec, *OptionInfoPtr; extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt); extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt); extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt); extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt); extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt); extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt); extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt); extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, const char *deflt); extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name, int deflt); extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list, const char *name, double deflt); extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val); extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value); extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list); extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options, int count, int used); extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail); extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list); extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt); extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt); extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt); extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm); extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name); extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options, const char *name); extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option); extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name); extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option); extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name); extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options); extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo); extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table, int token); extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table, int token); extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token); extern _X_EXPORT const char *xf86GetOptValString(const OptionInfoRec * table, int token); extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table, int token, int *value); extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec * table, int token, unsigned long *value); extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec * table, int token, double *value); extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec * table, int token, OptFreqUnits expectedUnits, double *value); extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec * table, int token, Bool *value); extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec * table, int token, Bool def); extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2); extern _X_EXPORT char *xf86NormalizeName(const char *s); extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val); extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val); extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val); extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val); extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char *val); #endif xorg-server-1.20.8/hw/xfree86/common/xf86str.h0000644000175000017500000005641213640201473015710 00000000000000 /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains definitions of the public XFree86 data structures/types. * Any data structures that video drivers need to access should go here. */ #ifndef _XF86STR_H #define _XF86STR_H #include "misc.h" #include "input.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "colormapst.h" #include "xf86Module.h" #include "xf86Opt.h" #include "displaymode.h" /** * Integer type that is of the size of the addressable memory (machine size). * On most platforms \c uintptr_t will suffice. However, on some mixed * 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this * must be 64-bits. */ #include #if defined(__powerpc__) typedef uint64_t memType; #else typedef uintptr_t memType; #endif /* Video mode flags */ typedef enum { V_PHSYNC = 0x0001, V_NHSYNC = 0x0002, V_PVSYNC = 0x0004, V_NVSYNC = 0x0008, V_INTERLACE = 0x0010, V_DBLSCAN = 0x0020, V_CSYNC = 0x0040, V_PCSYNC = 0x0080, V_NCSYNC = 0x0100, V_HSKEW = 0x0200, /* hskew provided */ V_BCAST = 0x0400, V_PIXMUX = 0x1000, V_DBLCLK = 0x2000, V_CLKDIV2 = 0x4000 } ModeFlags; typedef enum { INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */ } CrtcAdjustFlags; /* Flags passed to ChipValidMode() */ typedef enum { MODECHECK_INITIAL = 0, MODECHECK_FINAL = 1 } ModeCheckFlags; /* * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN. * Preferred will bubble a mode to the top within a set. */ #define M_T_BUILTIN 0x01 /* built-in mode */ #define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */ #define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */ #define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C) /* built-in mode - configure CRTC and clock */ #define M_T_PREFERRED 0x08 /* preferred mode within a set */ #define M_T_DEFAULT 0x10 /* (VESA) default modes */ #define M_T_USERDEF 0x20 /* One of the modes from the config file */ #define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ #define M_T_USERPREF 0x80 /* mode preferred by the user config */ /* The monitor description */ #define MAX_HSYNC 8 #define MAX_VREFRESH 8 typedef struct { float hi, lo; } range; typedef struct { CARD32 red, green, blue; } rgb; typedef struct { float red, green, blue; } Gamma; /* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */ #define GAMMA_MAX 10.0 #define GAMMA_MIN (1.0 / GAMMA_MAX) #define GAMMA_ZERO (GAMMA_MIN / 100.0) typedef struct { const char *id; const char *vendor; const char *model; int nHsync; range hsync[MAX_HSYNC]; int nVrefresh; range vrefresh[MAX_VREFRESH]; DisplayModePtr Modes; /* Start of the monitor's mode list */ DisplayModePtr Last; /* End of the monitor's mode list */ Gamma gamma; /* Gamma of the monitor */ int widthmm; int heightmm; void *options; void *DDC; Bool reducedblanking; /* Allow CVT reduced blanking modes? */ int maxPixClock; /* in kHz, like mode->Clock */ } MonRec, *MonPtr; /* the list of clock ranges */ typedef struct x_ClockRange { struct x_ClockRange *next; int minClock; /* (kHz) */ int maxClock; /* (kHz) */ int clockIndex; /* -1 for programmable clocks */ Bool interlaceAllowed; Bool doubleScanAllowed; int ClockMulFactor; int ClockDivFactor; int PrivFlags; } ClockRange, *ClockRangePtr; /* * The driverFunc. xorgDriverFuncOp specifies the action driver should * perform. If requested option is not supported function should return * FALSE. pointer can be used to pass arguments to the function or * to return data to the caller. */ typedef struct _ScrnInfoRec *ScrnInfoPtr; /* do not change order */ typedef enum { RR_GET_INFO, RR_SET_CONFIG, RR_GET_MODE_MM, GET_REQUIRED_HW_INTERFACES = 10, SUPPORTS_SERVER_FDS = 11, } xorgDriverFuncOp; typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *); /* RR_GET_INFO, RR_SET_CONFIG */ typedef struct { int rotation; int rate; int width; int height; } xorgRRConfig; typedef union { short RRRotations; xorgRRConfig RRConfig; } xorgRRRotation, *xorgRRRotationPtr; /* RR_GET_MODE_MM */ typedef struct { DisplayModePtr mode; int virtX; int virtY; int mmWidth; int mmHeight; } xorgRRModeMM, *xorgRRModeMMPtr; /* GET_REQUIRED_HW_INTERFACES */ #define HW_IO 1 #define HW_MMIO 2 #define HW_SKIP_CONSOLE 4 #define NEED_IO_ENABLED(x) (x & HW_IO) typedef CARD32 xorgHWFlags; /* * The driver list struct. This contains the information required for each * driver before a ScrnInfoRec has been allocated. */ struct _DriverRec; struct _SymTabRec; struct _PciChipsets; struct pci_device; struct xf86_platform_device; typedef struct _DriverRec { int driverVersion; const char *driverName; void (*Identify) (int flags); Bool (*Probe) (struct _DriverRec * drv, int flags); const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype); void *module; int refCount; xorgDriverFuncProc *driverFunc; const struct pci_id_match *supported_devices; Bool (*PciProbe) (struct _DriverRec * drv, int entity_num, struct pci_device * dev, intptr_t match_data); Bool (*platformProbe) (struct _DriverRec * drv, int entity_num, int flags, struct xf86_platform_device * dev, intptr_t match_data); } DriverRec, *DriverPtr; /* * platform probe flags */ #define PLATFORM_PROBE_GPU_SCREEN 1 /* * AddDriver flags */ #define HaveDriverFuncs 1 /* * These are the private bus types. New types can be added here. Types * required for the public interface should be added to xf86str.h, with * function prototypes added to xf86.h. */ /* Tolerate prior #include */ #if defined(__linux__) #undef BUS_NONE #undef BUS_PCI #undef BUS_SBUS #undef BUS_PLATFORM #undef BUS_last #endif typedef enum { BUS_NONE, BUS_PCI, BUS_SBUS, BUS_PLATFORM, BUS_last /* Keep last */ } BusType; typedef struct { int fbNum; } SbusBusId; typedef struct _bus { BusType type; union { struct pci_device *pci; SbusBusId sbus; struct xf86_platform_device *plat; } id; } BusRec, *BusPtr; typedef enum { DAC_BPP8 = 0, DAC_BPP16, DAC_BPP24, DAC_BPP32, MAXDACSPEEDS } DacSpeedIndex; typedef struct { const char *identifier; const char *vendor; const char *board; const char *chipset; const char *ramdac; const char *driver; struct _confscreenrec *myScreenSection; Bool claimed; int dacSpeeds[MAXDACSPEEDS]; int numclocks; int clock[MAXCLOCKS]; const char *clockchip; const char *busID; Bool active; Bool inUse; int videoRam; unsigned long MemBase; /* Frame buffer base address */ unsigned long IOBase; int chipID; int chipRev; void *options; int irq; int screen; /* For multi-CRTC cards */ } GDevRec, *GDevPtr; typedef struct { int frameX0; int frameY0; int virtualX; int virtualY; int depth; int fbbpp; rgb weight; rgb blackColour; rgb whiteColour; int defaultVisual; const char **modes; void *options; } DispRec, *DispPtr; typedef struct _confxvportrec { const char *identifier; void *options; } confXvPortRec, *confXvPortPtr; typedef struct _confxvadaptrec { const char *identifier; int numports; confXvPortPtr ports; void *options; } confXvAdaptorRec, *confXvAdaptorPtr; #define MAX_GPUDEVICES 4 typedef struct _confscreenrec { const char *id; int screennum; int defaultdepth; int defaultbpp; int defaultfbbpp; MonPtr monitor; GDevPtr device; int numdisplays; DispPtr displays; int numxvadaptors; confXvAdaptorPtr xvadaptors; void *options; int num_gpu_devices; GDevPtr gpu_devices[MAX_GPUDEVICES]; } confScreenRec, *confScreenPtr; typedef enum { PosObsolete = -1, PosAbsolute = 0, PosRightOf, PosLeftOf, PosAbove, PosBelow, PosRelative } PositionType; typedef struct _screenlayoutrec { confScreenPtr screen; const char *topname; confScreenPtr top; const char *bottomname; confScreenPtr bottom; const char *leftname; confScreenPtr left; const char *rightname; confScreenPtr right; PositionType where; int x; int y; const char *refname; confScreenPtr refscreen; } screenLayoutRec, *screenLayoutPtr; typedef struct _InputInfoRec InputInfoRec; typedef struct _serverlayoutrec { const char *id; screenLayoutPtr screens; GDevPtr inactives; InputInfoRec **inputs; /* NULL terminated */ void *options; } serverLayoutRec, *serverLayoutPtr; typedef struct _confdribufferrec { int count; int size; enum { XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */ } flags; } confDRIBufferRec, *confDRIBufferPtr; typedef struct _confdrirec { int group; int mode; int bufs_count; confDRIBufferRec *bufs; } confDRIRec, *confDRIPtr; #define NUM_RESERVED_INTS 4 #define NUM_RESERVED_POINTERS 4 #define NUM_RESERVED_FUNCS 4 /* let clients know they can use this */ #define XF86_SCRN_HAS_PREFER_CLONE 1 typedef void *(*funcPointer) (void); /* Power management events: so far we only support APM */ typedef enum { XF86_APM_UNKNOWN = -1, XF86_APM_SYS_STANDBY, XF86_APM_SYS_SUSPEND, XF86_APM_CRITICAL_SUSPEND, XF86_APM_USER_STANDBY, XF86_APM_USER_SUSPEND, XF86_APM_STANDBY_RESUME, XF86_APM_NORMAL_RESUME, XF86_APM_CRITICAL_RESUME, XF86_APM_LOW_BATTERY, XF86_APM_POWER_STATUS_CHANGE, XF86_APM_UPDATE_TIME, XF86_APM_CAPABILITY_CHANGED, XF86_APM_STANDBY_FAILED, XF86_APM_SUSPEND_FAILED } pmEvent; typedef enum { PM_WAIT, PM_CONTINUE, PM_FAILED, PM_NONE } pmWait; typedef struct _PciChipsets { /** * Key used to match this device with its name in an array of * \c SymTabRec. */ int numChipset; /** * This value is quirky. Depending on the driver, it can take on one of * three meanings. In drivers that have exactly one vendor ID (e.g., * radeon, mga, i810) the low 16-bits are the device ID. * * In drivers that can have multiple vendor IDs (e.g., the glint driver * can have either 3dlabs' ID or TI's ID, the i740 driver can have either * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and * the high 16-bits are the vendor ID. * * In drivers that don't have a specific vendor (e.g., vga) contains the * device ID for either the generic VGA or generic 8514 devices. This * turns out to be the same as the subclass and programming interface * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or * 0x000101) and for 8514 is 0x030001). */ int PCIid; /* dummy place holders for drivers to build against old/new servers */ #define RES_UNDEFINED NULL #define RES_EXCLUSIVE_VGA NULL #define RES_SHARED_VGA NULL void *dummy; } PciChipsets; /* Entity properties */ typedef void (*EntityProc) (int entityIndex, void *private); typedef struct _entityInfo { int index; BusRec location; int chipset; Bool active; GDevPtr device; DriverPtr driver; } EntityInfoRec, *EntityInfoPtr; /* DGA */ typedef struct { int num; /* A unique identifier for the mode (num > 0) */ DisplayModePtr mode; int flags; /* DGA_CONCURRENT_ACCESS, etc... */ int imageWidth; /* linear accessible portion (pixels) */ int imageHeight; int pixmapWidth; /* Xlib accessible portion (pixels) */ int pixmapHeight; /* both fields ignored if no concurrent access */ int bytesPerScanline; int byteOrder; /* MSBFirst, LSBFirst */ int depth; int bitsPerPixel; unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask; short visualClass; int viewportWidth; int viewportHeight; int xViewportStep; /* viewport position granularity */ int yViewportStep; int maxViewportX; /* max viewport origin */ int maxViewportY; int viewportFlags; /* types of page flipping possible */ int offset; /* offset into physical memory */ unsigned char *address; /* server's mapped framebuffer */ int reserved1; int reserved2; } DGAModeRec, *DGAModePtr; typedef struct { DGAModePtr mode; PixmapPtr pPix; } DGADeviceRec, *DGADevicePtr; /* * Flags for driver Probe() functions. */ #define PROBE_DEFAULT 0x00 #define PROBE_DETECT 0x01 #define PROBE_TRYHARD 0x02 /* * Driver entry point types */ typedef Bool xf86ProbeProc(DriverPtr, int); typedef Bool xf86PreInitProc(ScrnInfoPtr, int); typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **); typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr); typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int); typedef Bool xf86EnterVTProc(ScrnInfoPtr); typedef void xf86LeaveVTProc(ScrnInfoPtr); typedef void xf86FreeScreenProc(ScrnInfoPtr); typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int); typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool); typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr); typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma); typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int); typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool); typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int); typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr); typedef void xf86SetOverscanProc(ScrnInfoPtr, int); typedef void xf86ModeSetProc(ScrnInfoPtr); /* * ScrnInfoRec * * There is one of these for each screen, and it holds all the screen-specific * information. Note: No fields are to be dependent on compile-time defines. */ typedef struct _ScrnInfoRec { int driverVersion; const char *driverName; /* canonical name used in */ /* the config file */ ScreenPtr pScreen; /* Pointer to the ScreenRec */ int scrnIndex; /* Number of this screen */ Bool configured; /* Is this screen valid */ int origIndex; /* initial number assigned to * this screen before * finalising the number of * available screens */ /* Display-wide screenInfo values needed by this screen */ int imageByteOrder; int bitmapScanlineUnit; int bitmapScanlinePad; int bitmapBitOrder; int numFormats; PixmapFormatRec formats[MAXFORMATS]; PixmapFormatRec fbFormat; int bitsPerPixel; /* fb bpp */ int depth; /* depth of default visual */ MessageType depthFrom; /* set from config? */ MessageType bitsPerPixelFrom; /* set from config? */ rgb weight; /* r/g/b weights */ rgb mask; /* rgb masks */ rgb offset; /* rgb offsets */ int rgbBits; /* Number of bits in r/g/b */ Gamma gamma; /* Gamma of the monitor */ int defaultVisual; /* default visual class */ int virtualX; /* Virtual width */ int virtualY; /* Virtual height */ int xInc; /* Horizontal timing increment */ int displayWidth; /* memory pitch */ int frameX0; /* viewport position */ int frameY0; int frameX1; int frameY1; int zoomLocked; /* Disallow mode changes */ DisplayModePtr modePool; /* list of compatible modes */ DisplayModePtr modes; /* list of actual modes */ DisplayModePtr currentMode; /* current mode * This was previously * overloaded with the modes * field, which is a pointer * into a circular list */ confScreenPtr confScreen; /* Screen config info */ MonPtr monitor; /* Monitor information */ DispPtr display; /* Display information */ int *entityList; /* List of device entities */ int numEntities; int widthmm; /* physical display dimensions * in mm */ int heightmm; int xDpi; /* width DPI */ int yDpi; /* height DPI */ const char *name; /* Name to prefix messages */ void *driverPrivate; /* Driver private area */ DevUnion *privates; /* Other privates can hook in * here */ DriverPtr drv; /* xf86DriverList[] entry */ void *module; /* Pointer to module head */ int colorKey; int overlayFlags; /* Some of these may be moved out of here into the driver private area */ const char *chipset; /* chipset name */ const char *ramdac; /* ramdac name */ const char *clockchip; /* clock name */ Bool progClock; /* clock is programmable */ int numClocks; /* number of clocks */ int clock[MAXCLOCKS]; /* list of clock frequencies */ int videoRam; /* amount of video ram (kb) */ unsigned long memPhysBase; /* Physical address of FB */ unsigned long fbOffset; /* Offset of FB in the above */ Bool flipPixels; /* swap default black/white */ void *options; /* Allow screens to be enabled/disabled individually */ Bool vtSema; /* hw cursor moves from input thread */ Bool silkenMouse; /* Storage for clockRanges and adjustFlags for use with the VidMode ext */ ClockRangePtr clockRanges; int adjustFlags; /* initial rightof support disable */ int preferClone; Bool is_gpu; uint32_t capabilities; int *entityInstanceList; struct pci_device *vgaDev; /* * Driver entry points. * */ xf86ProbeProc *Probe; xf86PreInitProc *PreInit; xf86ScreenInitProc *ScreenInit; xf86SwitchModeProc *SwitchMode; xf86AdjustFrameProc *AdjustFrame; xf86EnterVTProc *EnterVT; xf86LeaveVTProc *LeaveVT; xf86FreeScreenProc *FreeScreen; xf86ValidModeProc *ValidMode; xf86EnableDisableFBAccessProc *EnableDisableFBAccess; xf86SetDGAModeProc *SetDGAMode; xf86ChangeGammaProc *ChangeGamma; xf86PointerMovedProc *PointerMoved; xf86PMEventProc *PMEvent; xf86DPMSSetProc *DPMSSet; xf86LoadPaletteProc *LoadPalette; xf86SetOverscanProc *SetOverscan; xorgDriverFuncProc *DriverFunc; xf86ModeSetProc *ModeSet; int reservedInt[NUM_RESERVED_INTS]; void *reservedPtr[NUM_RESERVED_POINTERS]; funcPointer reservedFuncs[NUM_RESERVED_FUNCS]; } ScrnInfoRec; typedef struct { Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn, char **name, unsigned char **mem, int *size, int *offset, int *extra); void (*CloseFramebuffer) (ScrnInfoPtr pScrn); Bool (*SetMode) (ScrnInfoPtr pScrn, DGAModePtr pMode); void (*SetViewport) (ScrnInfoPtr pScrn, int x, int y, int flags); int (*GetViewport) (ScrnInfoPtr pScrn); void (*Sync) (ScrnInfoPtr); void (*FillRect) (ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color); void (*BlitRect) (ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty); void (*BlitTransRect) (ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color); } DGAFunctionRec, *DGAFunctionPtr; typedef struct _SymTabRec { int token; /* id of the token */ const char *name; /* token name */ } SymTabRec, *SymTabPtr; /* flags for xf86LookupMode */ typedef enum { LOOKUP_DEFAULT = 0, /* Use default mode lookup method */ LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */ LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */ LOOKUP_LIST_ORDER, /* Pick first useful mode in list */ LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */ LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */ } LookupModeFlags; #define NoDepth24Support 0x00 #define Support24bppFb 0x01 /* 24bpp framebuffer supported */ #define Support32bppFb 0x02 /* 32bpp framebuffer supported */ #define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */ #define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */ #define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */ #define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */ /* For DPMS */ typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int); /* Input handler proc */ typedef void (*InputHandlerProc) (int fd, void *data); /* These are used by xf86GetClocks */ #define CLK_REG_SAVE -1 #define CLK_REG_RESTORE -2 /* * misc constants */ #define INTERLACE_REFRESH_WEIGHT 1.5 #define SYNC_TOLERANCE 0.01 /* 1 percent */ #define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */ #define OVERLAY_8_32_DUALFB 0x00000001 #define OVERLAY_8_24_DUALFB 0x00000002 #define OVERLAY_8_16_DUALFB 0x00000004 #define OVERLAY_8_32_PLANAR 0x00000008 /* Values of xf86Info.mouseFlags */ #define MF_CLEAR_DTR 1 #define MF_CLEAR_RTS 2 /* Action Events */ typedef enum { ACTION_TERMINATE = 0, /* Terminate Server */ ACTION_NEXT_MODE = 10, /* Switch to next video mode */ ACTION_PREV_MODE, ACTION_SWITCHSCREEN = 100, /* VT switch */ ACTION_SWITCHSCREEN_NEXT, ACTION_SWITCHSCREEN_PREV, } ActionEvent; #endif /* _XF86STR_H */ xorg-server-1.20.8/hw/xfree86/common/dgaproc.h0000644000175000017500000000421013640201473015770 00000000000000 #ifndef __DGAPROC_H #define __DGAPROC_H #include #include "pixmap.h" #define DGA_CONCURRENT_ACCESS 0x00000001 #define DGA_FILL_RECT 0x00000002 #define DGA_BLIT_RECT 0x00000004 #define DGA_BLIT_RECT_TRANS 0x00000008 #define DGA_PIXMAP_AVAILABLE 0x00000010 #define DGA_INTERLACED 0x00010000 #define DGA_DOUBLESCAN 0x00020000 #define DGA_FLIP_IMMEDIATE 0x00000001 #define DGA_FLIP_RETRACE 0x00000002 #define DGA_COMPLETED 0x00000000 #define DGA_PENDING 0x00000001 #define DGA_NEED_ROOT 0x00000001 typedef struct { int num; /* A unique identifier for the mode (num > 0) */ const char *name; /* name of mode given in the XF86Config */ int VSync_num; int VSync_den; int flags; /* DGA_CONCURRENT_ACCESS, etc... */ int imageWidth; /* linear accessible portion (pixels) */ int imageHeight; int pixmapWidth; /* Xlib accessible portion (pixels) */ int pixmapHeight; /* both fields ignored if no concurrent access */ int bytesPerScanline; int byteOrder; /* MSBFirst, LSBFirst */ int depth; int bitsPerPixel; unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask; short visualClass; int viewportWidth; int viewportHeight; int xViewportStep; /* viewport position granularity */ int yViewportStep; int maxViewportX; /* max viewport origin */ int maxViewportY; int viewportFlags; /* types of page flipping possible */ int offset; int reserved1; int reserved2; } XDGAModeRec, *XDGAModePtr; /* DDX interface */ extern Bool DGAScreenAvailable(ScreenPtr pScreen); extern Bool DGAActive(int Index); extern void DGAShutdown(void); extern Bool DGAVTSwitch(void); extern Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, int button, int is_down); extern Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy); extern Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index, int key_code, int is_down); #endif /* __DGAPROC_H */ xorg-server-1.20.8/hw/xfree86/common/xf86Xinput.h0000644000175000017500000002341313640201473016362 00000000000000/* * Copyright 1995-1999 by Frederic Lepied, France. * * 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 Frederic Lepied not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Frederic Lepied makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL FREDERIC LEPIED 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. * */ /* * Copyright (c) 2000-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifndef _xf86Xinput_h #define _xf86Xinput_h #include "xf86.h" #include "xf86str.h" #include "inputstr.h" #include #include #include "XIstubs.h" /* Input device flags */ #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */ /* the device sends Xinput and core pointer events */ #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE /* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */ /* server-internal only */ #define XI86_DEVICE_DISABLED 0x10 /* device was disabled before vt switch */ #define XI86_SERVER_FD 0x20 /* fd is managed by xserver */ /* Input device driver capabilities */ #define XI86_DRV_CAP_SERVER_FD 0x01 /* This holds the input driver entry and module information. */ typedef struct _InputDriverRec { int driverVersion; const char *driverName; void (*Identify) (int flags); int (*PreInit) (struct _InputDriverRec * drv, struct _InputInfoRec * pInfo, int flags); void (*UnInit) (struct _InputDriverRec * drv, struct _InputInfoRec * pInfo, int flags); void *module; const char **default_options; int capabilities; } InputDriverRec, *InputDriverPtr; /* This is to input devices what the ScrnInfoRec is to screens. */ struct _InputInfoRec { struct _InputInfoRec *next; char *name; char *driver; int flags; Bool (*device_control) (DeviceIntPtr device, int what); void (*read_input) (struct _InputInfoRec * local); int (*control_proc) (struct _InputInfoRec * local, xDeviceCtl * control); int (*switch_mode) (ClientPtr client, DeviceIntPtr dev, int mode); int (*set_device_valuators) (struct _InputInfoRec * local, int *valuators, int first_valuator, int num_valuators); int fd; int major; int minor; DeviceIntPtr dev; void *private; const char *type_name; InputDriverPtr drv; void *module; XF86OptionPtr options; InputAttributes *attrs; }; /* xf86Globals.c */ extern InputInfoPtr xf86InputDevs; /* xf86Xinput.c */ extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute, int first_valuator, int num_valuators, ...); extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute, int first_valuator, int num_valuators, const int *valuators); extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute, const ValuatorMask *mask); extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in, int first_valuator, int num_valuators, ...); extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator, int num_valuators, const int *valuators); extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in, const ValuatorMask *mask); extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button, int is_down, int first_valuator, int num_valuators, ...); extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button, int is_down, int first_valuator, int num_valuators, const int *valuators); extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button, int is_down, const ValuatorMask *mask); extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down); extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down); extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down); extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down); extern _X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type, uint32_t flags, const ValuatorMask *mask); extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void); extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min); extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr options); extern _X_EXPORT Bool xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval, int resolution, int min_res, int max_res, int mode); extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum); extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo); extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo); extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic); extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev); extern _X_EXPORT void xf86InputEnableVTProbe(void); /* not exported */ int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto); InputInfoPtr xf86AllocateInput(void); /* xf86Helper.c */ extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, void *module, int flags); extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex); extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name); extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name); extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags); extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo); extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(4, 5); extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(3, 4); extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format, va_list args) _X_ATTRIBUTE_PRINTF(4, 0); /* xf86Option.c */ extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts); #endif /* _xf86Xinput_h */ xorg-server-1.20.8/hw/xfree86/common/fourcc.h0000644000175000017500000001027713640201473015644 00000000000000 /* * Copyright (c) 2000-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* This header file contains listings of STANDARD guids for video formats. Please do not place non-registered, or incomplete entries in this file. A list of some popular fourcc's are at: http://www.webartz.com/fourcc/ For an explanation of fourcc <-> guid mappings see RFC2361. */ #ifndef _XF86_FOURCC_H_ #define _XF86_FOURCC_H_ 1 #define FOURCC_YUY2 0x32595559 #define XVIMAGE_YUY2 \ { \ FOURCC_YUY2, \ XvYUV, \ LSBFirst, \ {'Y','U','Y','2', \ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ 16, \ XvPacked, \ 1, \ 0, 0, 0, 0, \ 8, 8, 8, \ 1, 2, 2, \ 1, 1, 1, \ {'Y','U','Y','V', \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ XvTopToBottom \ } #define FOURCC_YV12 0x32315659 #define XVIMAGE_YV12 \ { \ FOURCC_YV12, \ XvYUV, \ LSBFirst, \ {'Y','V','1','2', \ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ 12, \ XvPlanar, \ 3, \ 0, 0, 0, 0, \ 8, 8, 8, \ 1, 2, 2, \ 1, 2, 2, \ {'Y','V','U', \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ XvTopToBottom \ } #define FOURCC_I420 0x30323449 #define XVIMAGE_I420 \ { \ FOURCC_I420, \ XvYUV, \ LSBFirst, \ {'I','4','2','0', \ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ 12, \ XvPlanar, \ 3, \ 0, 0, 0, 0, \ 8, 8, 8, \ 1, 2, 2, \ 1, 2, 2, \ {'Y','U','V', \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ XvTopToBottom \ } #define FOURCC_UYVY 0x59565955 #define XVIMAGE_UYVY \ { \ FOURCC_UYVY, \ XvYUV, \ LSBFirst, \ {'U','Y','V','Y', \ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ 16, \ XvPacked, \ 1, \ 0, 0, 0, 0, \ 8, 8, 8, \ 1, 2, 2, \ 1, 1, 1, \ {'U','Y','V','Y', \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ XvTopToBottom \ } #define FOURCC_IA44 0x34344149 #define XVIMAGE_IA44 \ { \ FOURCC_IA44, \ XvYUV, \ LSBFirst, \ {'I','A','4','4', \ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ 8, \ XvPacked, \ 1, \ 0, 0, 0, 0, \ 8, 8, 8, \ 1, 1, 1, \ 1, 1, 1, \ {'A','I', \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ XvTopToBottom \ } #define FOURCC_AI44 0x34344941 #define XVIMAGE_AI44 \ { \ FOURCC_AI44, \ XvYUV, \ LSBFirst, \ {'A','I','4','4', \ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ 8, \ XvPacked, \ 1, \ 0, 0, 0, 0, \ 8, 8, 8, \ 1, 1, 1, \ 1, 1, 1, \ {'I','A', \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ XvTopToBottom \ } #endif /* _XF86_FOURCC_H_ */ xorg-server-1.20.8/hw/xfree86/common/xorgHelper.c0000644000175000017500000000055513640201473016473 00000000000000 #ifdef HAVE_XORG_CONFIG_H #include #endif #include #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 "xorgVersion.h" CARD32 xorgGetVersion(void) { return XORG_VERSION_CURRENT; } xorg-server-1.20.8/hw/xfree86/common/xisb.h0000644000175000017500000000503113640201473015320 00000000000000/* * Copyright (c) 1997 Metro Link Incorporated * * 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 X CONSORTIUM 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 Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * */ #ifndef _xisb_H_ #define _xisb_H_ #include /****************************************************************************** * Definitions * structs, typedefs, #defines, enums *****************************************************************************/ typedef struct _XISBuffer { int fd; int trace; int block_duration; ssize_t current; /* bytes read */ ssize_t end; ssize_t buffer_size; unsigned char *buf; } XISBuffer; /****************************************************************************** * Declarations * variables: use xisb_LOC in front * of globals. * put locals in the .c file. *****************************************************************************/ extern _X_EXPORT XISBuffer *XisbNew(int fd, ssize_t size); extern _X_EXPORT void XisbFree(XISBuffer * b); extern _X_EXPORT int XisbRead(XISBuffer * b); extern _X_EXPORT ssize_t XisbWrite(XISBuffer * b, unsigned char *msg, ssize_t len); extern _X_EXPORT void XisbTrace(XISBuffer * b, int trace); extern _X_EXPORT void XisbBlockDuration(XISBuffer * b, int block_duration); /* * DO NOT PUT ANYTHING AFTER THIS ENDIF */ #endif xorg-server-1.20.8/hw/xfree86/common/xf86platformBus.c0000644000175000017500000005210313640201473017362 00000000000000/* * Copyright © 2012 Red Hat. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Author: Dave Airlie */ /* * This file contains the interfaces to the bus-specific code */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifdef XSERVER_PLATFORM_BUS #include #include #include #include #include "os.h" #include "hotplug.h" #include "systemd-logind.h" #include "loaderProcs.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Priv.h" #include "xf86str.h" #include "xf86Bus.h" #include "Pci.h" #include "xf86platformBus.h" #include "xf86Config.h" #include "randrstr.h" int platformSlotClaimed; int xf86_num_platform_devices; struct xf86_platform_device *xf86_platform_devices; int xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned) { xf86_platform_devices = xnfreallocarray(xf86_platform_devices, xf86_num_platform_devices + 1, sizeof(struct xf86_platform_device)); xf86_platform_devices[xf86_num_platform_devices].attribs = attribs; xf86_platform_devices[xf86_num_platform_devices].pdev = NULL; xf86_platform_devices[xf86_num_platform_devices].flags = unowned ? XF86_PDEV_UNOWNED : 0; xf86_num_platform_devices++; return 0; } int xf86_remove_platform_device(int dev_index) { int j; config_odev_free_attributes(xf86_platform_devices[dev_index].attribs); for (j = dev_index; j < xf86_num_platform_devices - 1; j++) memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device)); xf86_num_platform_devices--; return 0; } Bool xf86_get_platform_device_unowned(int index) { return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ? TRUE : FALSE; } struct xf86_platform_device * xf86_find_platform_device_by_devnum(int major, int minor) { int i, attr_major, attr_minor; for (i = 0; i < xf86_num_platform_devices; i++) { attr_major = xf86_platform_odev_attributes(i)->major; attr_minor = xf86_platform_odev_attributes(i)->minor; if (attr_major == major && attr_minor == minor) return &xf86_platform_devices[i]; } return NULL; } /* * xf86IsPrimaryPlatform() -- return TRUE if primary device * is a platform device and it matches this one. */ static Bool xf86IsPrimaryPlatform(struct xf86_platform_device *plat) { /* Add max. 1 screen for the IgnorePrimary fallback path */ if (xf86ProbeIgnorePrimary && xf86NumScreens == 0) return TRUE; if (primaryBus.type == BUS_PLATFORM) return plat == primaryBus.id.plat; #ifdef XSERVER_LIBPCIACCESS if (primaryBus.type == BUS_PCI) if (plat->pdev) if (MATCH_PCI_DEVICES(primaryBus.id.pci, plat->pdev)) return TRUE; #endif return FALSE; } static void platform_find_pci_info(struct xf86_platform_device *pd, char *busid) { struct pci_slot_match devmatch; struct pci_device *info; struct pci_device_iterator *iter; int ret; ret = sscanf(busid, "pci:%04x:%02x:%02x.%u", &devmatch.domain, &devmatch.bus, &devmatch.dev, &devmatch.func); if (ret != 4) return; iter = pci_slot_match_iterator_create(&devmatch); info = pci_device_next(iter); if (info) pd->pdev = info; pci_iterator_destroy(iter); } static Bool xf86_check_platform_slot(const struct xf86_platform_device *pd) { int i; for (i = 0; i < xf86NumEntities; i++) { const EntityPtr u = xf86Entities[i]; if (pd->pdev && u->bus.type == BUS_PCI && MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) { return FALSE; } if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) { return FALSE; } } return TRUE; } static Bool MatchToken(const char *value, struct xorg_list *patterns, int (*compare)(const char *, const char *)) { const xf86MatchGroup *group; /* If there are no patterns, accept the match */ if (xorg_list_is_empty(patterns)) return TRUE; /* If there are patterns but no attribute, reject the match */ if (!value) return FALSE; /* * Otherwise, iterate the list of patterns ensuring each entry has a * match. Each list entry is a separate Match line of the same type. */ xorg_list_for_each_entry(group, patterns, entry) { Bool match = FALSE; char *const *cur; for (cur = group->values; *cur; cur++) { if ((*compare)(value, *cur) == 0) { match = TRUE; break; } } if (!match) return FALSE; } /* All the entries in the list matched the attribute */ return TRUE; } static Bool OutputClassMatches(const XF86ConfOutputClassPtr oclass, struct xf86_platform_device *dev) { char *driver = dev->attribs->driver; if (!MatchToken(driver, &oclass->match_driver, strcmp)) return FALSE; return TRUE; } static void xf86OutputClassDriverList(int index, XF86MatchedDrivers *md) { XF86ConfOutputClassPtr cl; for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) { if (OutputClassMatches(cl, &xf86_platform_devices[index])) { char *path = xf86_platform_odev_attributes(index)->path; xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n", cl->identifier, path); xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver); xf86AddMatchedDriver(md, cl->driver); } } } /** * @return The numbers of found devices that match with the current system * drivers. */ void xf86PlatformMatchDriver(XF86MatchedDrivers *md) { int i; struct pci_device *info = NULL; int pass = 0; for (pass = 0; pass < 2; pass++) { for (i = 0; i < xf86_num_platform_devices; i++) { if (xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 1)) continue; else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0)) continue; xf86OutputClassDriverList(i, md); info = xf86_platform_devices[i].pdev; #ifdef __linux__ if (info) xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md); #endif if (info != NULL) { xf86VideoPtrToDriverList(info, md); } } } } int xf86platformProbe(void) { int i; Bool pci = TRUE; XF86ConfOutputClassPtr cl, cl_head = (xf86configptr) ? xf86configptr->conf_outputclass_lst : NULL; char *old_path, *path = NULL; config_odev_probe(xf86PlatformDeviceProbe); if (!xf86scanpci()) { pci = FALSE; } for (i = 0; i < xf86_num_platform_devices; i++) { char *busid = xf86_platform_odev_attributes(i)->busid; if (pci && (strncmp(busid, "pci:", 4) == 0)) { platform_find_pci_info(&xf86_platform_devices[i], busid); } /* * Deal with OutputClass ModulePath directives, these must be * processed before we do any module loading. */ for (cl = cl_head; cl; cl = cl->list.next) { if (!OutputClassMatches(cl, &xf86_platform_devices[i])) continue; if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) { old_path = path; XNFasprintf(&path, "%s,%s", cl->modulepath, path ? path : xf86ModulePath); free(old_path); xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to \"%s\"\n", cl->identifier, path); LoaderSetPath(path); } } } free(path); /* First see if there is an OutputClass match marking a device as primary */ for (i = 0; i < xf86_num_platform_devices; i++) { struct xf86_platform_device *dev = &xf86_platform_devices[i]; for (cl = cl_head; cl; cl = cl->list.next) { if (!OutputClassMatches(cl, dev)) continue; if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) { xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as PrimaryGPU\n", cl->identifier, dev->attribs->path); primaryBus.type = BUS_PLATFORM; primaryBus.id.plat = dev; return 0; } } } /* Then check for pci_device_is_boot_vga() */ for (i = 0; i < xf86_num_platform_devices; i++) { struct xf86_platform_device *dev = &xf86_platform_devices[i]; if (!dev->pdev) continue; pci_device_probe(dev->pdev); if (pci_device_is_boot_vga(dev->pdev)) { primaryBus.type = BUS_PLATFORM; primaryBus.id.plat = dev; } } return 0; } void xf86MergeOutputClassOptions(int entityIndex, void **options) { const EntityPtr entity = xf86Entities[entityIndex]; struct xf86_platform_device *dev = NULL; XF86ConfOutputClassPtr cl; XF86OptionPtr classopts; int i = 0; switch (entity->bus.type) { case BUS_PLATFORM: dev = entity->bus.id.plat; break; case BUS_PCI: for (i = 0; i < xf86_num_platform_devices; i++) { if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev, entity->bus.id.pci)) { dev = &xf86_platform_devices[i]; break; } } break; default: xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n", entity->bus.type); } if (!dev) return; for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) { if (!OutputClassMatches(cl, dev) || !cl->option_lst) continue; xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n", cl->identifier, dev->attribs->path); classopts = xf86optionListDup(cl->option_lst); *options = xf86optionListMerge(*options, classopts); } } static int xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp, int chipset, GDevPtr dev, Bool active) { EntityPtr p = NULL; int num; if (xf86_check_platform_slot(d)) { num = xf86AllocateEntity(); p = xf86Entities[num]; p->driver = drvp; p->chipset = chipset; p->bus.type = BUS_PLATFORM; p->bus.id.plat = d; p->active = active; p->inUse = FALSE; if (dev) xf86AddDevToEntity(num, dev); platformSlotClaimed++; return num; } else return -1; } static int xf86UnclaimPlatformSlot(struct xf86_platform_device *d, GDevPtr dev) { int i; for (i = 0; i < xf86NumEntities; i++) { const EntityPtr p = xf86Entities[i]; if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat == d)) { if (dev) xf86RemoveDevFromEntity(i, dev); platformSlotClaimed--; p->bus.type = BUS_NONE; return 0; } } return 0; } #define END_OF_MATCHES(m) \ (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0)) static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags, intptr_t match_data) { Bool foundScreen = FALSE; int entity; if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev)) return FALSE; entity = xf86ClaimPlatformSlot(dev, drvp, 0, gdev, gdev ? gdev->active : 0); if ((entity == -1) && gdev && (gdev->screen > 0)) { unsigned nent; for (nent = 0; nent < xf86NumEntities; nent++) { EntityPtr pEnt = xf86Entities[nent]; if (pEnt->bus.type != BUS_PLATFORM) continue; if (pEnt->bus.id.plat == dev) { entity = nent; xf86AddDevToEntity(nent, gdev); break; } } } if (entity != -1) { if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc || !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) { systemd_logind_release_fd(dev->attribs->major, dev->attribs->minor, dev->attribs->fd); dev->attribs->fd = -1; dev->flags &= ~XF86_PDEV_SERVER_FD; } if (drvp->platformProbe(drvp, entity, flags, dev, match_data)) foundScreen = TRUE; else xf86UnclaimPlatformSlot(dev, gdev); } return foundScreen; } static Bool probeSingleDevice(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags) { int k; Bool foundScreen = FALSE; struct pci_device *pPci; const struct pci_id_match *const devices = drvp->supported_devices; if (dev->pdev && devices) { int device_id = dev->pdev->device_id; pPci = dev->pdev; for (k = 0; !END_OF_MATCHES(devices[k]); k++) { if (PCI_ID_COMPARE(devices[k].vendor_id, pPci->vendor_id) && PCI_ID_COMPARE(devices[k].device_id, device_id) && ((devices[k].device_class_mask & pPci->device_class) == devices[k].device_class)) { foundScreen = doPlatformProbe(dev, drvp, gdev, flags, devices[k].match_data); if (foundScreen) break; } } } else if (dev->pdev && !devices) return FALSE; else foundScreen = doPlatformProbe(dev, drvp, gdev, flags, 0); return foundScreen; } static Bool isGPUDevice(GDevPtr gdev) { int i; for (i = 0; i < gdev->myScreenSection->num_gpu_devices; i++) { if (gdev == gdev->myScreenSection->gpu_devices[i]) return TRUE; } return FALSE; } int xf86platformProbeDev(DriverPtr drvp) { Bool foundScreen = FALSE; GDevPtr *devList; const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList); int i, j; /* find the main device or any device specificed in xorg.conf */ for (i = 0; i < numDevs; i++) { /* skip inactive devices */ if (!devList[i]->active) continue; for (j = 0; j < xf86_num_platform_devices; j++) { if (devList[i]->busID && *devList[i]->busID) { if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID)) break; } else { /* for non-seat0 servers assume first device is the master */ if (ServerIsNotSeat0()) break; if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) break; } } if (j == xf86_num_platform_devices) continue; foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0); } free(devList); return foundScreen; } int xf86platformAddGPUDevices(DriverPtr drvp) { Bool foundScreen = FALSE; GDevPtr *devList; int j; if (!drvp->platformProbe) return FALSE; xf86MatchDevice(drvp->driverName, &devList); /* if autoaddgpu devices is enabled then go find any unclaimed platform * devices and add them as GPU screens */ if (xf86Info.autoAddGPU) { for (j = 0; j < xf86_num_platform_devices; j++) { if (probeSingleDevice(&xf86_platform_devices[j], drvp, devList ? devList[0] : NULL, PLATFORM_PROBE_GPU_SCREEN)) foundScreen = TRUE; } } free(devList); return foundScreen; } int xf86platformAddDevice(int index) { int i, old_screens, scr_index; DriverPtr drvp = NULL; screenLayoutPtr layout; static const char *hotplug_driver_name = "modesetting"; if (!xf86Info.autoAddGPU) return -1; /* force load the driver for now */ xf86LoadOneModule(hotplug_driver_name, NULL); for (i = 0; i < xf86NumDrivers; i++) { if (!xf86DriverList[i]) continue; if (!strcmp(xf86DriverList[i]->driverName, hotplug_driver_name)) { drvp = xf86DriverList[i]; break; } } if (i == xf86NumDrivers) return -1; old_screens = xf86NumGPUScreens; doPlatformProbe(&xf86_platform_devices[index], drvp, NULL, PLATFORM_PROBE_GPU_SCREEN, 0); if (old_screens == xf86NumGPUScreens) return -1; i = old_screens; for (layout = xf86ConfigLayout.screens; layout->screen != NULL; layout++) { xf86GPUScreens[i]->confScreen = layout->screen; break; } if (xf86GPUScreens[i]->PreInit && xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0)) xf86GPUScreens[i]->configured = TRUE; if (!xf86GPUScreens[i]->configured) { ErrorF("hotplugged device %d didn't configure\n", i); xf86DeleteScreen(xf86GPUScreens[i]); return -1; } scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL); if (scr_index == -1) { xf86DeleteScreen(xf86GPUScreens[i]); xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); xf86NumGPUScreens = old_screens; return -1; } dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates, xf86ScreenKey, xf86GPUScreens[i]); CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen); if (xf86GPUScreens[i]->pScreen->CreateScreenResources && !(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) { RemoveGPUScreen(xf86GPUScreens[i]->pScreen); xf86DeleteScreen(xf86GPUScreens[i]); xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); xf86NumGPUScreens = old_screens; return -1; } /* attach unbound to 0 protocol screen */ AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); RRResourcesChanged(xf86Screens[0]->pScreen); RRTellChanged(xf86Screens[0]->pScreen); return 0; } void xf86platformRemoveDevice(int index) { EntityPtr entity; int ent_num, i, j; Bool found; for (ent_num = 0; ent_num < xf86NumEntities; ent_num++) { entity = xf86Entities[ent_num]; if (entity->bus.type == BUS_PLATFORM && entity->bus.id.plat == &xf86_platform_devices[index]) break; } if (ent_num == xf86NumEntities) goto out; found = FALSE; for (i = 0; i < xf86NumGPUScreens; i++) { for (j = 0; j < xf86GPUScreens[i]->numEntities; j++) if (xf86GPUScreens[i]->entityList[j] == ent_num) { found = TRUE; break; } if (found) break; } if (!found) { ErrorF("failed to find screen to remove\n"); goto out; } xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen); RemoveGPUScreen(xf86GPUScreens[i]->pScreen); xf86DeleteScreen(xf86GPUScreens[i]); xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); xf86_remove_platform_device(index); RRResourcesChanged(xf86Screens[0]->pScreen); RRTellChanged(xf86Screens[0]->pScreen); out: return; } /* called on return from VT switch to find any new devices */ void xf86platformVTProbe(void) { int i; for (i = 0; i < xf86_num_platform_devices; i++) { if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED)) continue; xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED; xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs); } } void xf86platformPrimary(void) { /* use the first platform device as a fallback */ if (primaryBus.type == BUS_NONE) { xf86Msg(X_INFO, "no primary bus or device found\n"); if (xf86_num_platform_devices > 0) { primaryBus.id.plat = &xf86_platform_devices[0]; primaryBus.type = BUS_PLATFORM; xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath); } } } #endif xorg-server-1.20.8/hw/xfree86/common/xf86VGAarbiter.h0000644000175000017500000000365113640201473017063 00000000000000/* * Copyright (c) 2009 Tiago Vignatti * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __XF86VGAARBITER_H #define __XF86VGAARBITER_H #include "screenint.h" #include "misc.h" #include "xf86.h" /* Functions */ extern void xf86VGAarbiterInit(void); extern void xf86VGAarbiterFini(void); void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn); extern Bool xf86VGAarbiterWrapFunctions(void); extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn); extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn); /* allow a driver to remove itself from arbiter - really should be * done in the kernel though */ extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc); /* DRI and arbiter are really not possible together, * you really want to remove the card from arbitration if you can */ extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen); #endif /* __XF86VGAARBITER_H */ xorg-server-1.20.8/hw/xfree86/common/xf86Init.c0000644000175000017500000012756513640201473016006 00000000000000/* * Loosely based on code bearing the following copyright: * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. */ /* * Copyright (c) 1992-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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #undef HAS_UTSNAME #if !defined(WIN32) #define HAS_UTSNAME 1 #include #endif #include #include #include #include #include "input.h" #include "servermd.h" #include "windowstr.h" #include "scrnintstr.h" #include "site.h" #include "mi.h" #include "dbus-core.h" #include "systemd-logind.h" #include "loaderProcs.h" #ifdef XFreeXDGA #include "dgaproc.h" #endif #define XF86_OS_PRIVS #include "xf86.h" #include "xf86Priv.h" #include "xf86Config.h" #include "xf86_OSlib.h" #include "xf86cmap.h" #include "xorgVersion.h" #include "xf86Build.h" #include "mipointer.h" #include #include #include "xf86Extensions.h" #include "xf86DDC.h" #include "xf86Xinput.h" #include "xf86InPriv.h" #include "picturestr.h" #include "randrstr.h" #include "glxvndabi.h" #include "xf86Bus.h" #ifdef XSERVER_LIBPCIACCESS #include "xf86VGAarbiter.h" #endif #include "globals.h" #include "xserver-properties.h" #ifdef DPMSExtension #include #include "dpmsproc.h" #endif #include #ifdef XF86PM void (*xf86OSPMClose) (void) = NULL; #endif static Bool xorgHWOpenConsole = FALSE; /* Common pixmap formats */ static PixmapFormatRec formats[MAXFORMATS] = { {1, 1, BITMAP_SCANLINE_PAD}, {4, 8, BITMAP_SCANLINE_PAD}, {8, 8, BITMAP_SCANLINE_PAD}, {15, 16, BITMAP_SCANLINE_PAD}, {16, 16, BITMAP_SCANLINE_PAD}, {24, 32, BITMAP_SCANLINE_PAD}, {32, 32, BITMAP_SCANLINE_PAD}, }; static int numFormats = 7; static Bool formatsDone = FALSE; #ifndef OSNAME #define OSNAME " unknown" #endif #ifndef OSVENDOR #define OSVENDOR "" #endif #ifndef PRE_RELEASE #define PRE_RELEASE XORG_VERSION_SNAP #endif static void xf86PrintBanner(void) { #if PRE_RELEASE xf86ErrorFVerb(0, "\n" "This is a pre-release version of the X server from " XVENDORNAME ".\n" "It is not supported in any way.\n" "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" "Select the \"xorg\" product for bugs you find in this release.\n" "Before reporting bugs in pre-release versions please check the\n" "latest version in the X.Org Foundation git repository.\n" "See http://wiki.x.org/wiki/GitPage for git access instructions.\n"); #endif xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH); #if XORG_VERSION_SNAP > 0 xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP); #endif #if XORG_VERSION_SNAP >= 900 /* When the minor number is 99, that signifies that the we are making * a release candidate for a major version. (X.0.0) * When the patch number is 99, that signifies that the we are making * a release candidate for a minor version. (X.Y.0) * When the patch number is < 99, then we are making a release * candidate for the next point release. (X.Y.Z) */ #if XORG_VERSION_MINOR >= 99 xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR + 1, XORG_VERSION_SNAP - 900); #elif XORG_VERSION_PATCH == 99 xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900); #else xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900); #endif #endif #ifdef XORG_CUSTOM_VERSION xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION); #endif xf86ErrorFVerb(0, "\nX Protocol Version %d, Revision %d\n", X_PROTOCOL, X_PROTOCOL_REVISION); xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR); #ifdef HAS_UTSNAME { struct utsname name; /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX, and Irix) and Single Unix Spec 3 just say that non-negative is success. All agree that failure is represented by a negative number. */ if (uname(&name) >= 0) { xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n", name.sysname, name.nodename, name.release, name.version, name.machine); #ifdef __linux__ do { char buf[80]; int fd = open("/proc/cmdline", O_RDONLY); if (fd != -1) { xf86ErrorFVerb(0, "Kernel command line: "); memset(buf, 0, 80); while (read(fd, buf, 80) > 0) { xf86ErrorFVerb(0, "%.80s", buf); memset(buf, 0, 80); } close(fd); } } while (0); #endif } } #endif #if defined(BUILD_DATE) && (BUILD_DATE > 19000000) { struct tm t; char buf[100]; memset(&t, 0, sizeof(t)); memset(buf, 0, sizeof(buf)); t.tm_mday = BUILD_DATE % 100; t.tm_mon = (BUILD_DATE / 100) % 100 - 1; t.tm_year = BUILD_DATE / 10000 - 1900; #if defined(BUILD_TIME) t.tm_sec = BUILD_TIME % 100; t.tm_min = (BUILD_TIME / 100) % 100; t.tm_hour = (BUILD_TIME / 10000) % 100; if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t)) xf86ErrorFVerb(0, "Build Date: %s\n", buf); #else if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) xf86ErrorFVerb(0, "Build Date: %s\n", buf); #endif } #endif #if defined(BUILDERSTRING) xf86ErrorFVerb(0, "%s \n", BUILDERSTRING); #endif xf86ErrorFVerb(0, "Current version of pixman: %s\n", pixman_version_string()); xf86ErrorFVerb(0, "\tBefore reporting problems, check " "" __VENDORDWEBSUPPORT__ "\n" "\tto make sure that you have the latest version.\n"); } Bool xf86PrivsElevated(void) { return PrivsElevated(); } static void TrapSignals(void) { if (xf86Info.notrapSignals) { OsSignal(SIGSEGV, SIG_DFL); OsSignal(SIGABRT, SIG_DFL); OsSignal(SIGILL, SIG_DFL); #ifdef SIGEMT OsSignal(SIGEMT, SIG_DFL); #endif OsSignal(SIGFPE, SIG_DFL); OsSignal(SIGBUS, SIG_DFL); OsSignal(SIGSYS, SIG_DFL); OsSignal(SIGXCPU, SIG_DFL); OsSignal(SIGXFSZ, SIG_DFL); } } static void AddSeatId(CallbackListPtr *pcbl, void *data, void *screen) { ScreenPtr pScreen = screen; Atom SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE); int err; err = dixChangeWindowProperty(serverClient, pScreen->root, SeatAtom, XA_STRING, 8, PropModeReplace, strlen(data) + 1, data, FALSE); if (err != Success) xf86DrvMsg(pScreen->myNum, X_WARNING, "Failed to register seat property\n"); } static void AddVTAtoms(CallbackListPtr *pcbl, void *data, void *screen) { #define VT_ATOM_NAME "XFree86_VT" int err, HasVT = 1; ScreenPtr pScreen = screen; Atom VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE); Atom HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1, TRUE); err = dixChangeWindowProperty(serverClient, pScreen->root, VTAtom, XA_INTEGER, 32, PropModeReplace, 1, &xf86Info.vtno, FALSE); err |= dixChangeWindowProperty(serverClient, pScreen->root, HasVTAtom, XA_INTEGER, 32, PropModeReplace, 1, &HasVT, FALSE); if (err != Success) xf86DrvMsg(pScreen->myNum, X_WARNING, "Failed to register VT properties\n"); } static Bool xf86ScreenInit(ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pScrn->pScreen = pScreen; return pScrn->ScreenInit (pScreen, argc, argv); } static void xf86EnsureRANDR(ScreenPtr pScreen) { #ifdef RANDR if (!dixPrivateKeyRegistered(rrPrivKey) || !rrGetScrPriv(pScreen)) xf86RandRInit(pScreen); #endif } /* * InitOutput -- * Initialize screenInfo for all actually accessible framebuffers. * That includes vt-manager setup, querying all possible devices and * collecting the pixmap formats. */ void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) { int i, j, k, scr_index; const char **modulelist; void **optionlist; Bool autoconfig = FALSE; Bool sigio_blocked = FALSE; Bool want_hw_access = FALSE; GDevPtr configured_device; xf86Initialising = TRUE; config_pre_init(); if (serverGeneration == 1) { if ((xf86ServerName = strrchr(argv[0], '/')) != 0) xf86ServerName++; else xf86ServerName = argv[0]; xf86PrintBanner(); LogPrintMarkers(); if (xf86LogFile) { time_t t; const char *ct; t = time(NULL); ct = ctime(&t); xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", xf86LogFile, ct); } /* Read and parse the config file */ if (!xf86DoConfigure && !xf86DoShowOptions) { switch (xf86HandleConfigFile(FALSE)) { case CONFIG_OK: break; case CONFIG_PARSE_ERROR: xf86Msg(X_ERROR, "Error parsing the config file\n"); return; case CONFIG_NOFILE: autoconfig = TRUE; break; } } TrapSignals(); /* Initialise the loader */ LoaderInit(); /* Tell the loader the default module search path */ LoaderSetPath(xf86ModulePath); if (xf86Info.ignoreABI) { LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); } if (xf86DoShowOptions) DoShowOptions(); dbus_core_init(); systemd_logind_init(); /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); if (xf86DoConfigure) DoConfigure(); if (autoconfig) { if (!xf86AutoConfig()) { xf86Msg(X_ERROR, "Auto configuration failed\n"); return; } } #ifdef XF86PM xf86OSPMClose = xf86OSPMOpen(); #endif xf86ExtensionInit(); /* Load all modules specified explicitly in the config file */ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { xf86LoadModules(modulelist, optionlist); free(modulelist); free(optionlist); } /* Load all driver modules specified in the config file */ /* If there aren't any specified in the config file, autoconfig them */ /* FIXME: Does not handle multiple active screen sections, but I'm not * sure if we really want to handle that case*/ configured_device = xf86ConfigLayout.screens->screen->device; if ((!configured_device) || (!configured_device->driver)) { if (!autoConfigDevice(configured_device)) { xf86Msg(X_ERROR, "Automatic driver configuration failed\n"); return; } } if ((modulelist = xf86DriverlistFromConfig())) { xf86LoadModules(modulelist, NULL); free(modulelist); } /* Load all input driver modules specified in the config file. */ if ((modulelist = xf86InputDriverlistFromConfig())) { xf86LoadModules(modulelist, NULL); free(modulelist); } /* * It is expected that xf86AddDriver()/xf86AddInputDriver will be * called for each driver as it is loaded. Those functions save the * module pointers for drivers. * XXX Nothing keeps track of them for other modules. */ /* XXX What do we do if not all of these could be loaded? */ /* * At this point, xf86DriverList[] is all filled in with entries for * each of the drivers to try and xf86NumDrivers has the number of * drivers. If there are none, return now. */ if (xf86NumDrivers == 0) { xf86Msg(X_ERROR, "No drivers available.\n"); return; } /* * Call each of the Identify functions and call the driverFunc to check * if HW access is required. The Identify functions print out some * identifying information, and anything else that might be * needed at this early stage. */ for (i = 0; i < xf86NumDrivers; i++) { xorgHWFlags flags = HW_IO; if (xf86DriverList[i]->Identify != NULL) xf86DriverList[i]->Identify(0); if (xf86DriverList[i]->driverFunc) xf86DriverList[i]->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags); if (NEED_IO_ENABLED(flags)) want_hw_access = TRUE; /* Non-seat0 X servers should not open console */ if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0()) xorgHWOpenConsole = TRUE; } if (xorgHWOpenConsole) xf86OpenConsole(); else xf86Info.dontVTSwitch = TRUE; /* Enable full I/O access */ if (want_hw_access) xorgHWAccess = xf86EnableIO(); if (xf86BusConfig() == FALSE) return; xf86PostProbe(); /* * Sort the drivers to match the requested ording. Using a slow * bubble sort. */ for (j = 0; j < xf86NumScreens - 1; j++) { for (i = 0; i < xf86NumScreens - j - 1; i++) { if (xf86Screens[i + 1]->confScreen->screennum < xf86Screens[i]->confScreen->screennum) { ScrnInfoPtr tmpScrn = xf86Screens[i + 1]; xf86Screens[i + 1] = xf86Screens[i]; xf86Screens[i] = tmpScrn; } } } /* Fix up the indexes */ for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->scrnIndex = i; } /* * Call the driver's PreInit()'s to complete initialisation for the first * generation. */ for (i = 0; i < xf86NumScreens; i++) { xf86VGAarbiterScrnInit(xf86Screens[i]); xf86VGAarbiterLock(xf86Screens[i]); if (xf86Screens[i]->PreInit && xf86Screens[i]->PreInit(xf86Screens[i], 0)) xf86Screens[i]->configured = TRUE; xf86VGAarbiterUnlock(xf86Screens[i]); } for (i = 0; i < xf86NumScreens; i++) if (!xf86Screens[i]->configured) xf86DeleteScreen(xf86Screens[i--]); for (i = 0; i < xf86NumGPUScreens; i++) { xf86VGAarbiterScrnInit(xf86GPUScreens[i]); xf86VGAarbiterLock(xf86GPUScreens[i]); if (xf86GPUScreens[i]->PreInit && xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0)) xf86GPUScreens[i]->configured = TRUE; xf86VGAarbiterUnlock(xf86GPUScreens[i]); } for (i = 0; i < xf86NumGPUScreens; i++) if (!xf86GPUScreens[i]->configured) xf86DeleteScreen(xf86GPUScreens[i--]); /* * If no screens left, return now. */ if (xf86NumScreens == 0) { xf86Msg(X_ERROR, "Screen(s) found, but none have a usable configuration.\n"); return; } for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->name == NULL) { char *tmp; XNFasprintf(&tmp, "screen%d", i); xf86Screens[i]->name = tmp; xf86MsgVerb(X_WARNING, 0, "Screen driver %d has no name set, using `%s'.\n", i, xf86Screens[i]->name); } } /* Remove (unload) drivers that are not required */ for (i = 0; i < xf86NumDrivers; i++) if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0) xf86DeleteDriver(i); /* * At this stage we know how many screens there are. */ for (i = 0; i < xf86NumScreens; i++) xf86InitViewport(xf86Screens[i]); /* * Collect all pixmap formats and check for conflicts at the display * level. Should we die here? Or just delete the offending screens? */ for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->imageByteOrder != xf86Screens[0]->imageByteOrder) FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); if (xf86Screens[i]->bitmapScanlinePad != xf86Screens[0]->bitmapScanlinePad) FatalError ("Inconsistent display bitmapScanlinePad. Exiting\n"); if (xf86Screens[i]->bitmapScanlineUnit != xf86Screens[0]->bitmapScanlineUnit) FatalError ("Inconsistent display bitmapScanlineUnit. Exiting\n"); if (xf86Screens[i]->bitmapBitOrder != xf86Screens[0]->bitmapBitOrder) FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); } /* Collect additional formats */ for (i = 0; i < xf86NumScreens; i++) { for (j = 0; j < xf86Screens[i]->numFormats; j++) { for (k = 0;; k++) { if (k >= numFormats) { if (k >= MAXFORMATS) FatalError("Too many pixmap formats! Exiting\n"); formats[k] = xf86Screens[i]->formats[j]; numFormats++; break; } if (formats[k].depth == xf86Screens[i]->formats[j].depth) { if ((formats[k].bitsPerPixel == xf86Screens[i]->formats[j].bitsPerPixel) && (formats[k].scanlinePad == xf86Screens[i]->formats[j].scanlinePad)) break; FatalError("Inconsistent pixmap format for depth %d." " Exiting\n", formats[k].depth); } } } } formatsDone = TRUE; } else { /* * serverGeneration != 1; some OSs have to do things here, too. */ if (xorgHWOpenConsole) xf86OpenConsole(); #ifdef XF86PM /* should we reopen it here? We need to deal with an already opened device. We could leave this to the OS layer. For now we simply close it here */ if (xf86OSPMClose) xf86OSPMClose(); if ((xf86OSPMClose = xf86OSPMOpen()) != NULL) xf86MsgVerb(X_INFO, 3, "APM registered successfully\n"); #endif /* Make sure full I/O access is enabled */ if (xorgHWAccess) xf86EnableIO(); } if (xf86Info.vtno >= 0) AddCallback(&RootWindowFinalizeCallback, AddVTAtoms, NULL); if (SeatId) AddCallback(&RootWindowFinalizeCallback, AddSeatId, SeatId); /* * Use the previously collected parts to setup pScreenInfo */ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder; pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad; pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit; pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder; pScreenInfo->numPixmapFormats = numFormats; for (i = 0; i < numFormats; i++) pScreenInfo->formats[i] = formats[i]; /* Make sure the server's VT is active */ if (serverGeneration != 1) { xf86Resetting = TRUE; /* All screens are in the same state, so just check the first */ if (!xf86VTOwner()) { #ifdef HAS_USL_VTS ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); #endif input_lock(); sigio_blocked = TRUE; } } for (i = 0; i < xf86NumScreens; i++) if (!xf86ColormapAllocatePrivates(xf86Screens[i])) FatalError("Cannot register DDX private keys"); if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0)) FatalError("Cannot register DDX private keys"); for (i = 0; i < xf86NumScreens; i++) { xf86VGAarbiterLock(xf86Screens[i]); /* * Almost everything uses these defaults, and many of those that * don't, will wrap them. */ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; #ifdef XFreeXDGA xf86Screens[i]->SetDGAMode = xf86SetDGAMode; #endif xf86Screens[i]->DPMSSet = NULL; xf86Screens[i]->LoadPalette = NULL; xf86Screens[i]->SetOverscan = NULL; xf86Screens[i]->DriverFunc = NULL; xf86Screens[i]->pScreen = NULL; scr_index = AddScreen(xf86ScreenInit, argc, argv); xf86VGAarbiterUnlock(xf86Screens[i]); if (scr_index == i) { /* * Hook in our ScrnInfoRec, and initialise some other pScreen * fields. */ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, xf86ScreenKey, xf86Screens[i]); xf86Screens[i]->pScreen = screenInfo.screens[scr_index]; /* The driver should set this, but make sure it is set anyway */ xf86Screens[i]->vtSema = TRUE; } else { /* This shouldn't normally happen */ FatalError("AddScreen/ScreenInit failed for driver %d\n", i); } DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n", i, xf86Screens[i]->pScreen); DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", i, xf86Screens[i]->pScreen->CreateWindow); if (PictureGetSubpixelOrder(xf86Screens[i]->pScreen) == SubPixelUnknown) { xf86MonPtr DDC = (xf86MonPtr) (xf86Screens[i]->monitor->DDC); PictureSetSubpixelOrder(xf86Screens[i]->pScreen, DDC ? (DDC->features.input_type ? SubPixelHorizontalRGB : SubPixelNone) : SubPixelUnknown); } /* * If the driver hasn't set up its own RANDR support, install the * fallback support. */ xf86EnsureRANDR(xf86Screens[i]->pScreen); } for (i = 0; i < xf86NumGPUScreens; i++) { ScrnInfoPtr pScrn = xf86GPUScreens[i]; xf86VGAarbiterLock(pScrn); /* * Almost everything uses these defaults, and many of those that * don't, will wrap them. */ pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess; #ifdef XFreeXDGA pScrn->SetDGAMode = xf86SetDGAMode; #endif pScrn->DPMSSet = NULL; pScrn->LoadPalette = NULL; pScrn->SetOverscan = NULL; pScrn->DriverFunc = NULL; pScrn->pScreen = NULL; scr_index = AddGPUScreen(xf86ScreenInit, argc, argv); xf86VGAarbiterUnlock(pScrn); if (scr_index == i) { dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates, xf86ScreenKey, xf86GPUScreens[i]); pScrn->pScreen = screenInfo.gpuscreens[scr_index]; /* The driver should set this, but make sure it is set anyway */ pScrn->vtSema = TRUE; } else { FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", i, scr_index); } } for (i = 0; i < xf86NumGPUScreens; i++) AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); xf86VGAarbiterWrapFunctions(); if (sigio_blocked) input_unlock(); xf86InitOrigins(); xf86Resetting = FALSE; xf86Initialising = FALSE; RegisterBlockAndWakeupHandlers((ServerBlockHandlerProcPtr) NoopDDA, xf86Wakeup, NULL); } /** * Initialize all supported input devices present and referenced in the * xorg.conf. */ void InitInput(int argc, char **argv) { InputInfoPtr *pInfo; DeviceIntPtr dev; xf86Info.vtRequestsPending = FALSE; /* Enable threaded input */ InputThreadPreInit(); mieqInit(); /* Initialize all configured input devices */ for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) { (*pInfo)->options = xf86AddNewOption((*pInfo)->options, "driver", (*pInfo)->driver); (*pInfo)->options = xf86AddNewOption((*pInfo)->options, "identifier", (*pInfo)->name); /* If one fails, the others will too */ if (NewInputDeviceRequest((*pInfo)->options, NULL, &dev) == BadAlloc) break; } config_init(); } void CloseInput(void) { config_fini(); mieqFini(); } /* * OsVendorInit -- * OS/Vendor-specific initialisations. Called from OsInit(), which * is called by dix before establishing the well known sockets. */ void OsVendorInit(void) { static Bool beenHere = FALSE; OsSignal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ if (!beenHere) { umask(022); xf86LogInit(); } /* Set stderr to non-blocking. */ #ifndef O_NONBLOCK #if defined(FNDELAY) #define O_NONBLOCK FNDELAY #elif defined(O_NDELAY) #define O_NONBLOCK O_NDELAY #endif #ifdef O_NONBLOCK if (!beenHere) { if (PrivsElevated()) { int status; status = fcntl(fileno(stderr), F_GETFL, 0); if (status != -1) { fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK); } } } #endif #endif beenHere = TRUE; } /* * ddxGiveUp -- * Device dependent cleanup. Called by by dix before normal server death. * For SYSV386 we must switch the terminal back to normal mode. No error- * checking here, since there should be restored as much as possible. */ void ddxGiveUp(enum ExitCode error) { int i; xf86VGAarbiterFini(); #ifdef XF86PM if (xf86OSPMClose) xf86OSPMClose(); xf86OSPMClose = NULL; #endif for (i = 0; i < xf86NumScreens; i++) { /* * zero all access functions to * trap calls when switched away. */ xf86Screens[i]->vtSema = FALSE; } #ifdef XFreeXDGA DGAShutdown(); #endif if (xorgHWOpenConsole) xf86CloseConsole(); systemd_logind_fini(); dbus_core_fini(); xf86CloseLog(error); } /* * AbortDDX -- * DDX - specific abort routine. Called by AbortServer(). The attempt is * made to restore all original setting of the displays. Also all devices * are closed. */ void AbortDDX(enum ExitCode error) { int i; input_lock(); /* * try to restore the original video state */ #ifdef DPMSExtension /* Turn screens back on */ if (DPMSPowerLevel != DPMSModeOn) DPMSSet(serverClient, DPMSModeOn); #endif if (xf86Screens) { for (i = 0; i < xf86NumScreens; i++) if (xf86Screens[i]->vtSema) { /* * if we are aborting before ScreenInit() has finished * we might not have been wrapped yet. Therefore enable * screen explicitely. */ xf86VGAarbiterLock(xf86Screens[i]); (xf86Screens[i]->LeaveVT) (xf86Screens[i]); xf86VGAarbiterUnlock(xf86Screens[i]); } } /* * This is needed for an abnormal server exit, since the normal exit stuff * MUST also be performed (i.e. the vt must be left in a defined state) */ ddxGiveUp(error); } void OsVendorFatalError(const char *f, va_list args) { #ifdef VENDORSUPPORT ErrorFSigSafe("\nPlease refer to your Operating System Vendor support " "pages\nat %s for support on this crash.\n", VENDORSUPPORT); #else ErrorFSigSafe("\nPlease consult the " XVENDORNAME " support \n\t at " __VENDORDWEBSUPPORT__ "\n for help. \n"); #endif if (xf86LogFile && xf86LogFileWasOpened) ErrorFSigSafe("Please also check the log file at \"%s\" for additional " "information.\n", xf86LogFile); ErrorFSigSafe("\n"); } int xf86SetVerbosity(int verb) { int save = xf86Verbose; xf86Verbose = verb; LogSetParameter(XLOG_VERBOSITY, verb); return save; } int xf86SetLogVerbosity(int verb) { int save = xf86LogVerbose; xf86LogVerbose = verb; LogSetParameter(XLOG_FILE_VERBOSITY, verb); return save; } static void xf86PrintDefaultModulePath(void) { ErrorF("%s\n", DEFAULT_MODULE_PATH); } static void xf86PrintDefaultLibraryPath(void) { ErrorF("%s\n", DEFAULT_LIBRARY_PATH); } static void xf86CheckPrivs(const char *option, const char *arg) { if (PrivsElevated() && !xf86PathIsSafe(arg)) { FatalError("\nInvalid argument for %s - \"%s\"\n" "\tWith elevated privileges %s must specify a relative path\n" "\twithout any \"..\" elements.\n\n", option, arg, option); } } /* * ddxProcessArgument -- * Process device-dependent command line args. Returns 0 if argument is * not device dependent, otherwise Count of number of elements of argv * that are part of a device dependent commandline option. * */ /* ARGSUSED */ int ddxProcessArgument(int argc, char **argv, int i) { #define CHECK_FOR_REQUIRED_ARGUMENT() \ if (((i + 1) >= argc) || (!argv[i + 1])) { \ ErrorF("Required argument to %s not specified\n", argv[i]); \ UseMsg(); \ FatalError("Required argument to %s not specified\n", argv[i]); \ } /* First the options that are not allowed with elevated privileges */ if (!strcmp(argv[i], "-modulepath")) { CHECK_FOR_REQUIRED_ARGUMENT(); if (xf86PrivsElevated()) FatalError("\nInvalid argument -modulepath " "with elevated privileges\n"); xf86ModulePath = argv[i + 1]; xf86ModPathFrom = X_CMDLINE; return 2; } if (!strcmp(argv[i], "-logfile")) { CHECK_FOR_REQUIRED_ARGUMENT(); if (xf86PrivsElevated()) FatalError("\nInvalid argument -logfile " "with elevated privileges\n"); xf86LogFile = argv[i + 1]; xf86LogFileFrom = X_CMDLINE; return 2; } if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86CheckPrivs(argv[i], argv[i + 1]); xf86ConfigFile = argv[i + 1]; return 2; } if (!strcmp(argv[i], "-configdir")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86CheckPrivs(argv[i], argv[i + 1]); xf86ConfigDir = argv[i + 1]; return 2; } if (!strcmp(argv[i], "-flipPixels")) { xf86FlipPixels = TRUE; return 1; } #ifdef XF86VIDMODE if (!strcmp(argv[i], "-disableVidMode")) { xf86VidModeDisabled = TRUE; return 1; } if (!strcmp(argv[i], "-allowNonLocalXvidtune")) { xf86VidModeAllowNonLocal = TRUE; return 1; } #endif if (!strcmp(argv[i], "-allowMouseOpenFail")) { xf86AllowMouseOpenFail = TRUE; return 1; } if (!strcmp(argv[i], "-ignoreABI")) { LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); return 1; } if (!strcmp(argv[i], "-verbose")) { if (++i < argc && argv[i]) { char *end; long val; val = strtol(argv[i], &end, 0); if (*end == '\0') { xf86SetVerbosity(val); return 2; } } xf86SetVerbosity(++xf86Verbose); return 1; } if (!strcmp(argv[i], "-logverbose")) { if (++i < argc && argv[i]) { char *end; long val; val = strtol(argv[i], &end, 0); if (*end == '\0') { xf86SetLogVerbosity(val); return 2; } } xf86SetLogVerbosity(++xf86LogVerbose); return 1; } if (!strcmp(argv[i], "-quiet")) { xf86SetVerbosity(-1); return 1; } if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) { xf86PrintBanner(); exit(0); } if (!strcmp(argv[i], "-showDefaultModulePath")) { xf86PrintDefaultModulePath(); exit(0); } if (!strcmp(argv[i], "-showDefaultLibPath")) { xf86PrintDefaultLibraryPath(); exit(0); } /* Notice the -fp flag, but allow it to pass to the dix layer */ if (!strcmp(argv[i], "-fp")) { xf86fpFlag = TRUE; return 0; } /* Notice the -bs flag, but allow it to pass to the dix layer */ if (!strcmp(argv[i], "-bs")) { xf86bsDisableFlag = TRUE; return 0; } /* Notice the +bs flag, but allow it to pass to the dix layer */ if (!strcmp(argv[i], "+bs")) { xf86bsEnableFlag = TRUE; return 0; } /* Notice the -s flag, but allow it to pass to the dix layer */ if (!strcmp(argv[i], "-s")) { xf86sFlag = TRUE; return 0; } if (!strcmp(argv[i], "-pixmap32") || !strcmp(argv[i], "-pixmap24")) { /* silently accept */ return 1; } if (!strcmp(argv[i], "-fbbpp")) { int bpp; CHECK_FOR_REQUIRED_ARGUMENT(); if (sscanf(argv[++i], "%d", &bpp) == 1) { xf86FbBpp = bpp; return 2; } else { ErrorF("Invalid fbbpp\n"); return 0; } } if (!strcmp(argv[i], "-depth")) { int depth; CHECK_FOR_REQUIRED_ARGUMENT(); if (sscanf(argv[++i], "%d", &depth) == 1) { xf86Depth = depth; return 2; } else { ErrorF("Invalid depth\n"); return 0; } } if (!strcmp(argv[i], "-weight")) { int red, green, blue; CHECK_FOR_REQUIRED_ARGUMENT(); if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3) { xf86Weight.red = red; xf86Weight.green = green; xf86Weight.blue = blue; return 2; } else { ErrorF("Invalid weighting\n"); return 0; } } if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") || !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) { double gamma; CHECK_FOR_REQUIRED_ARGUMENT(); if (sscanf(argv[++i], "%lf", &gamma) == 1) { if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) { ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f" " is valid\n", GAMMA_MIN, GAMMA_MAX); return 0; } if (!strcmp(argv[i - 1], "-gamma")) xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma; else if (!strcmp(argv[i - 1], "-rgamma")) xf86Gamma.red = gamma; else if (!strcmp(argv[i - 1], "-ggamma")) xf86Gamma.green = gamma; else if (!strcmp(argv[i - 1], "-bgamma")) xf86Gamma.blue = gamma; return 2; } } if (!strcmp(argv[i], "-layout")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86LayoutName = argv[++i]; return 2; } if (!strcmp(argv[i], "-screen")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86ScreenName = argv[++i]; return 2; } if (!strcmp(argv[i], "-pointer")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86PointerName = argv[++i]; return 2; } if (!strcmp(argv[i], "-keyboard")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86KeyboardName = argv[++i]; return 2; } if (!strcmp(argv[i], "-nosilk")) { xf86silkenMouseDisableFlag = TRUE; return 1; } #ifdef HAVE_ACPI if (!strcmp(argv[i], "-noacpi")) { xf86acpiDisableFlag = TRUE; return 1; } #endif if (!strcmp(argv[i], "-configure")) { if (getuid() != 0 && geteuid() == 0) { ErrorF("The '-configure' option can only be used by root.\n"); exit(1); } xf86DoConfigure = TRUE; xf86AllowMouseOpenFail = TRUE; return 1; } if (!strcmp(argv[i], "-showopts")) { if (getuid() != 0 && geteuid() == 0) { ErrorF("The '-showopts' option can only be used by root.\n"); exit(1); } xf86DoShowOptions = TRUE; return 1; } #ifdef XSERVER_LIBPCIACCESS if (!strcmp(argv[i], "-isolateDevice")) { CHECK_FOR_REQUIRED_ARGUMENT(); if (strncmp(argv[++i], "PCI:", 4)) { FatalError("Bus types other than PCI not yet isolable\n"); } xf86PciIsolateDevice(argv[i]); return 2; } #endif /* Notice cmdline xkbdir, but pass to dix as well */ if (!strcmp(argv[i], "-xkbdir")) { xf86xkbdirFlag = TRUE; return 0; } if (!strcmp(argv[i], "-novtswitch")) { xf86Info.autoVTSwitch = FALSE; return 1; } if (!strcmp(argv[i], "-sharevts")) { xf86Info.ShareVTs = TRUE; return 1; } if (!strcmp(argv[i], "-iglx") || !strcmp(argv[i], "+iglx")) { xf86Info.iglxFrom = X_CMDLINE; return 0; } /* OS-specific processing */ return xf86ProcessArgument(argc, argv, i); } /* * ddxUseMsg -- * Print out correct use of device dependent commandline options. * Maybe the user now knows what really to do ... */ void ddxUseMsg(void) { ErrorF("\n"); ErrorF("\n"); ErrorF("Device Dependent Usage\n"); if (!PrivsElevated()) { ErrorF("-modulepath paths specify the module search path\n"); ErrorF("-logfile file specify a log file name\n"); ErrorF("-configure probe for devices and write an " XCONFIGFILE "\n"); ErrorF ("-showopts print available options for all installed drivers\n"); } ErrorF ("-config file specify a configuration file, relative to the\n"); ErrorF(" " XCONFIGFILE " search path, only root can use absolute\n"); ErrorF ("-configdir dir specify a configuration directory, relative to the\n"); ErrorF(" " XCONFIGDIR " search path, only root can use absolute\n"); ErrorF("-verbose [n] verbose startup messages\n"); ErrorF("-logverbose [n] verbose log messages\n"); ErrorF("-quiet minimal startup messages\n"); ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n"); ErrorF("-depth n set colour depth. Default: 8\n"); ErrorF ("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n"); ErrorF("-rgamma f set gamma value for red phase\n"); ErrorF("-ggamma f set gamma value for green phase\n"); ErrorF("-bgamma f set gamma value for blue phase\n"); ErrorF ("-weight nnn set RGB weighting at 16 bpp. Default: 565\n"); ErrorF("-layout name specify the ServerLayout section name\n"); ErrorF("-screen name specify the Screen section name\n"); ErrorF ("-keyboard name specify the core keyboard InputDevice name\n"); ErrorF ("-pointer name specify the core pointer InputDevice name\n"); ErrorF("-nosilk disable Silken Mouse\n"); ErrorF("-flipPixels swap default black/white Pixel values\n"); #ifdef XF86VIDMODE ErrorF("-disableVidMode disable mode adjustments with xvidtune\n"); ErrorF ("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n"); #endif ErrorF ("-allowMouseOpenFail start server even if the mouse can't be initialized\n"); ErrorF("-ignoreABI make module ABI mismatches non-fatal\n"); #ifdef XSERVER_LIBPCIACCESS ErrorF ("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n"); #endif ErrorF("-version show the server version\n"); ErrorF("-showDefaultModulePath show the server default module path\n"); ErrorF("-showDefaultLibPath show the server default library path\n"); ErrorF ("-novtswitch don't automatically switch VT at reset & exit\n"); ErrorF("-sharevts share VTs with another X server\n"); /* OS-specific usage */ xf86UseMsg(); ErrorF("\n"); } /* * xf86LoadModules iterates over a list that is being passed in. */ Bool xf86LoadModules(const char **list, void **optlist) { int errmaj; void *opt; int i; char *name; Bool failed = FALSE; if (!list) return TRUE; for (i = 0; list[i] != NULL; i++) { /* Normalise the module name */ name = xf86NormalizeName(list[i]); /* Skip empty names */ if (name == NULL || *name == '\0') { free(name); continue; } /* Replace obsolete keyboard driver with kbd */ if (!xf86NameCmp(name, "keyboard")) { strcpy(name, "kbd"); } if (optlist) opt = optlist[i]; else opt = NULL; if (!LoadModule(name, opt, NULL, &errmaj)) { LoaderErrorMsg(NULL, name, errmaj, 0); failed = TRUE; } free(name); } return !failed; } /* Pixmap format stuff */ PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth) { int i; for (i = 0; i < numFormats; i++) if (formats[i].depth == depth) break; if (i != numFormats) return &formats[i]; else if (!formatsDone) { /* Check for screen-specified formats */ for (i = 0; i < pScrn->numFormats; i++) if (pScrn->formats[i].depth == depth) break; if (i != pScrn->numFormats) return &pScrn->formats[i]; } return NULL; } int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) { PixmapFormatPtr format; format = xf86GetPixFormat(pScrn, depth); if (format) return format->bitsPerPixel; else return 0; } #ifdef DDXBEFORERESET void ddxBeforeReset(void) { } #endif #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ void ddxInputThreadInit(void) { xf86OSInputThreadInit(); } #endif xorg-server-1.20.8/hw/xfree86/common/xf86DGA.c0000644000175000017500000016624513640201473015474 00000000000000/* * Copyright (c) 1995 Jon Tombs * Copyright (c) 1995, 1996, 1999 XFree86 Inc * Copyright (c) 1998-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). * * Written by Mark Vojkovich */ /* * This is quite literally just two files glued together: * hw/xfree86/common/xf86DGA.c is the first part, and * hw/xfree86/dixmods/extmod/xf86dga2.c is the second part. One day, if * someone actually cares about DGA, it'd be nice to clean this up. But trust * me, I am not that person. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "xf86str.h" #include "xf86Priv.h" #include "dgaproc.h" #include #include "colormapst.h" #include "pixmapstr.h" #include "inputstr.h" #include "globals.h" #include "servermd.h" #include "micmap.h" #include "xkbsrv.h" #include "xf86Xinput.h" #include "exglobals.h" #include "exevents.h" #include "eventstr.h" #include "eventconvert.h" #include "xf86Extensions.h" #include "mi.h" #include "misc.h" #include "dixstruct.h" #include "dixevents.h" #include "extnsionst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "swaprep.h" #include "dgaproc.h" #include "protocol-versions.h" #include #define DGA_PROTOCOL_OLD_SUPPORT 1 static DevPrivateKeyRec DGAScreenKeyRec; #define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec) static Bool mieq_installed; static Bool DGACloseScreen(ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); static void DGAUninstallColormap(ColormapPtr pmap); static void DGAHandleEvent(int screen_num, InternalEvent *event, DeviceIntPtr device); static void DGACopyModeInfo(DGAModePtr mode, XDGAModePtr xmode); static unsigned char DGAReqCode = 0; static int DGAErrorBase; static int DGAEventBase; #define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, &DGAScreenKeyRec)) typedef struct _FakedVisualList { Bool free; VisualPtr pVisual; struct _FakedVisualList *next; } FakedVisualList; typedef struct { ScrnInfoPtr pScrn; int numModes; DGAModePtr modes; CloseScreenProcPtr CloseScreen; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; UninstallColormapProcPtr UninstallColormap; DGADevicePtr current; DGAFunctionPtr funcs; int input; ClientPtr client; int pixmapMode; FakedVisualList *fakedVisuals; ColormapPtr dgaColormap; ColormapPtr savedColormap; Bool grabMouse; Bool grabKeyboard; } DGAScreenRec, *DGAScreenPtr; Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DGAScreenPtr pScreenPriv; int i; if (!funcs || !funcs->SetMode || !funcs->OpenFramebuffer) return FALSE; if (!modes || num <= 0) return FALSE; if (!dixRegisterPrivateKey(&DGAScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (!pScreenPriv) { if (!(pScreenPriv = (DGAScreenPtr) malloc(sizeof(DGAScreenRec)))) return FALSE; dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DGACloseScreen; pScreenPriv->DestroyColormap = pScreen->DestroyColormap; pScreen->DestroyColormap = DGADestroyColormap; pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = DGAInstallColormap; pScreenPriv->UninstallColormap = pScreen->UninstallColormap; pScreen->UninstallColormap = DGAUninstallColormap; } pScreenPriv->pScrn = pScrn; pScreenPriv->numModes = num; pScreenPriv->modes = modes; pScreenPriv->current = NULL; pScreenPriv->funcs = funcs; pScreenPriv->input = 0; pScreenPriv->client = NULL; pScreenPriv->fakedVisuals = NULL; pScreenPriv->dgaColormap = NULL; pScreenPriv->savedColormap = NULL; pScreenPriv->grabMouse = FALSE; pScreenPriv->grabKeyboard = FALSE; for (i = 0; i < num; i++) modes[i].num = i + 1; #ifdef PANORAMIX if (!noPanoramiXExtension) for (i = 0; i < num; i++) modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif return TRUE; } /* DGAReInitModes allows the driver to re-initialize * the DGA mode list. */ Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num) { DGAScreenPtr pScreenPriv; int i; /* No DGA? Ignore call (but don't make it look like it failed) */ if (!DGAScreenKeyRegistered) return TRUE; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); /* Same as above */ if (!pScreenPriv) return TRUE; /* Can't do this while DGA is active */ if (pScreenPriv->current) return FALSE; /* Quick sanity check */ if (!num) modes = NULL; else if (!modes) num = 0; pScreenPriv->numModes = num; pScreenPriv->modes = modes; /* This practically disables DGA. So be it. */ if (!num) return TRUE; for (i = 0; i < num; i++) modes[i].num = i + 1; #ifdef PANORAMIX if (!noPanoramiXExtension) for (i = 0; i < num; i++) modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif return TRUE; } static void FreeMarkedVisuals(ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); FakedVisualList *prev, *curr, *tmp; if (!pScreenPriv->fakedVisuals) return; prev = NULL; curr = pScreenPriv->fakedVisuals; while (curr) { if (curr->free) { tmp = curr; curr = curr->next; if (prev) prev->next = curr; else pScreenPriv->fakedVisuals = curr; free(tmp->pVisual); free(tmp); } else { prev = curr; curr = curr->next; } } } static Bool DGACloseScreen(ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (mieq_installed) { mieqSetHandler(ET_DGAEvent, NULL); mieq_installed = FALSE; } FreeMarkedVisuals(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->DestroyColormap = pScreenPriv->DestroyColormap; pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->UninstallColormap = pScreenPriv->UninstallColormap; /* DGAShutdown() should have ensured that no DGA screen were active by here */ free(pScreenPriv); return ((*pScreen->CloseScreen) (pScreen)); } static void DGADestroyColormap(ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); VisualPtr pVisual = pmap->pVisual; if (pScreenPriv->fakedVisuals) { FakedVisualList *curr = pScreenPriv->fakedVisuals; while (curr) { if (curr->pVisual == pVisual) { /* We can't get rid of them yet since FreeColormap still needs the pVisual during the cleanup */ curr->free = TRUE; break; } curr = curr->next; } } if (pScreenPriv->DestroyColormap) { pScreen->DestroyColormap = pScreenPriv->DestroyColormap; (*pScreen->DestroyColormap) (pmap); pScreen->DestroyColormap = DGADestroyColormap; } } static void DGAInstallColormap(ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (pScreenPriv->current && pScreenPriv->dgaColormap) { if (pmap != pScreenPriv->dgaColormap) { pScreenPriv->savedColormap = pmap; pmap = pScreenPriv->dgaColormap; } } pScreen->InstallColormap = pScreenPriv->InstallColormap; (*pScreen->InstallColormap) (pmap); pScreen->InstallColormap = DGAInstallColormap; } static void DGAUninstallColormap(ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (pScreenPriv->current && pScreenPriv->dgaColormap) { if (pmap == pScreenPriv->dgaColormap) { pScreenPriv->dgaColormap = NULL; } } pScreen->UninstallColormap = pScreenPriv->UninstallColormap; (*pScreen->UninstallColormap) (pmap); pScreen->UninstallColormap = DGAUninstallColormap; } int xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) { ScreenPtr pScreen = xf86ScrnToScreen(pScrn); DGAScreenPtr pScreenPriv; DGADevicePtr device; PixmapPtr pPix = NULL; DGAModePtr pMode = NULL; /* First check if DGAInit was successful on this screen */ if (!DGAScreenKeyRegistered) return BadValue; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (!pScreenPriv) return BadValue; if (!num) { if (pScreenPriv->current) { PixmapPtr oldPix = pScreenPriv->current->pPix; if (oldPix) { if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, RT_NONE); else (*pScreen->DestroyPixmap) (oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; pScrn->vtSema = TRUE; (*pScreenPriv->funcs->SetMode) (pScrn, NULL); if (pScreenPriv->savedColormap) { (*pScreen->InstallColormap) (pScreenPriv->savedColormap); pScreenPriv->savedColormap = NULL; } pScreenPriv->dgaColormap = NULL; (*pScrn->EnableDisableFBAccess) (pScrn, TRUE); FreeMarkedVisuals(pScreen); } pScreenPriv->grabMouse = FALSE; pScreenPriv->grabKeyboard = FALSE; return Success; } if (!pScrn->vtSema && !pScreenPriv->current) /* Really switched away */ return BadAlloc; if ((num > 0) && (num <= pScreenPriv->numModes)) pMode = &(pScreenPriv->modes[num - 1]); else return BadValue; if (!(device = (DGADevicePtr) malloc(sizeof(DGADeviceRec)))) return BadAlloc; if (!pScreenPriv->current) { Bool oldVTSema = pScrn->vtSema; pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */ (*pScrn->EnableDisableFBAccess) (pScrn, FALSE); pScrn->vtSema = oldVTSema; } if (!(*pScreenPriv->funcs->SetMode) (pScrn, pMode)) { free(device); return BadAlloc; } pScrn->currentMode = pMode->mode; if (!pScreenPriv->current && !pScreenPriv->input) { /* if it's multihead we need to warp the cursor off of our screen so it doesn't get trapped */ } pScrn->vtSema = FALSE; if (pScreenPriv->current) { PixmapPtr oldPix = pScreenPriv->current->pPix; if (oldPix) { if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, RT_NONE); else (*pScreen->DestroyPixmap) (oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; } if (pMode->flags & DGA_PIXMAP_AVAILABLE) { if ((pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pMode->depth, 0))) { (*pScreen->ModifyPixmapHeader) (pPix, pMode->pixmapWidth, pMode->pixmapHeight, pMode->depth, pMode->bitsPerPixel, pMode->bytesPerScanline, (void *) (pMode->address)); } } devRet->mode = device->mode = pMode; devRet->pPix = device->pPix = pPix; pScreenPriv->current = device; pScreenPriv->pixmapMode = FALSE; pScreenPriv->grabMouse = TRUE; pScreenPriv->grabKeyboard = TRUE; if (!mieq_installed) { mieqSetHandler(ET_DGAEvent, DGAHandleEvent); mieq_installed = TRUE; } return Success; } /*********** exported ones ***************/ static void DGASetInputMode(int index, Bool keyboard, Bool mouse) { ScreenPtr pScreen = screenInfo.screens[index]; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (pScreenPriv) { pScreenPriv->grabMouse = mouse; pScreenPriv->grabKeyboard = keyboard; if (!mieq_installed) { mieqSetHandler(ET_DGAEvent, DGAHandleEvent); mieq_installed = TRUE; } } } static Bool DGAChangePixmapMode(int index, int *x, int *y, int mode) { DGAScreenPtr pScreenPriv; DGADevicePtr pDev; DGAModePtr pMode; PixmapPtr pPix; if (!DGAScreenKeyRegistered) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); if (!pScreenPriv || !pScreenPriv->current || !pScreenPriv->current->pPix) return FALSE; pDev = pScreenPriv->current; pPix = pDev->pPix; pMode = pDev->mode; if (mode) { int shift = 2; if (*x > (pMode->pixmapWidth - pMode->viewportWidth)) *x = pMode->pixmapWidth - pMode->viewportWidth; if (*y > (pMode->pixmapHeight - pMode->viewportHeight)) *y = pMode->pixmapHeight - pMode->viewportHeight; switch (xf86Screens[index]->bitsPerPixel) { case 16: shift = 1; break; case 32: shift = 0; break; default: break; } if (BITMAP_SCANLINE_PAD == 64) shift++; *x = (*x >> shift) << shift; pPix->drawable.x = *x; pPix->drawable.y = *y; pPix->drawable.width = pMode->viewportWidth; pPix->drawable.height = pMode->viewportHeight; } else { pPix->drawable.x = 0; pPix->drawable.y = 0; pPix->drawable.width = pMode->pixmapWidth; pPix->drawable.height = pMode->pixmapHeight; } pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; pScreenPriv->pixmapMode = mode; return TRUE; } Bool DGAScreenAvailable(ScreenPtr pScreen) { if (!DGAScreenKeyRegistered) return FALSE; if (DGA_GET_SCREEN_PRIV(pScreen)) return TRUE; return FALSE; } static Bool DGAAvailable(int index) { ScreenPtr pScreen; assert(index < MAXSCREENS); pScreen = screenInfo.screens[index]; return DGAScreenAvailable(pScreen); } Bool DGAActive(int index) { DGAScreenPtr pScreenPriv; if (!DGAScreenKeyRegistered) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); if (pScreenPriv && pScreenPriv->current) return TRUE; return FALSE; } /* Called by the event code in case the server is abruptly terminated */ void DGAShutdown(void) { ScrnInfoPtr pScrn; int i; if (!DGAScreenKeyRegistered) return; for (i = 0; i < screenInfo.numScreens; i++) { pScrn = xf86Screens[i]; (void) (*pScrn->SetDGAMode) (pScrn, 0, NULL); } } /* Called by the extension to initialize a mode */ static int DGASetMode(int index, int num, XDGAModePtr mode, PixmapPtr *pPix) { ScrnInfoPtr pScrn = xf86Screens[index]; DGADeviceRec device; int ret; /* We rely on the extension to check that DGA is available */ ret = (*pScrn->SetDGAMode) (pScrn, num, &device); if ((ret == Success) && num) { DGACopyModeInfo(device.mode, mode); *pPix = device.pPix; } return ret; } /* Called from the extension to let the DDX know which events are requested */ static void DGASelectInput(int index, ClientPtr client, long mask) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is available */ pScreenPriv->client = client; pScreenPriv->input = mask; } static int DGAGetViewportStatus(int index) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is active */ if (!pScreenPriv->funcs->GetViewport) return 0; return (*pScreenPriv->funcs->GetViewport) (pScreenPriv->pScrn); } static int DGASetViewport(int index, int x, int y, int mode) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); if (pScreenPriv->funcs->SetViewport) (*pScreenPriv->funcs->SetViewport) (pScreenPriv->pScrn, x, y, mode); return Success; } static int BitsClear(CARD32 data) { int bits = 0; CARD32 mask; for (mask = 1; mask; mask <<= 1) { if (!(data & mask)) bits++; else break; } return bits; } static int DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc) { ScreenPtr pScreen = screenInfo.screens[index]; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); FakedVisualList *fvlp; VisualPtr pVisual; DGAModePtr pMode; ColormapPtr pmap; if (!mode || (mode > pScreenPriv->numModes)) return BadValue; if ((alloc != AllocNone) && (alloc != AllocAll)) return BadValue; pMode = &(pScreenPriv->modes[mode - 1]); if (!(pVisual = malloc(sizeof(VisualRec)))) return BadAlloc; pVisual->vid = FakeClientID(0); pVisual->class = pMode->visualClass; pVisual->nplanes = pMode->depth; pVisual->ColormapEntries = 1 << pMode->depth; pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3; switch (pVisual->class) { case PseudoColor: case GrayScale: case StaticGray: pVisual->bitsPerRGBValue = 8; /* not quite */ pVisual->redMask = 0; pVisual->greenMask = 0; pVisual->blueMask = 0; pVisual->offsetRed = 0; pVisual->offsetGreen = 0; pVisual->offsetBlue = 0; break; case DirectColor: case TrueColor: pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue; /* fall through */ case StaticColor: pVisual->redMask = pMode->red_mask; pVisual->greenMask = pMode->green_mask; pVisual->blueMask = pMode->blue_mask; pVisual->offsetRed = BitsClear(pVisual->redMask); pVisual->offsetGreen = BitsClear(pVisual->greenMask); pVisual->offsetBlue = BitsClear(pVisual->blueMask); } if (!(fvlp = malloc(sizeof(FakedVisualList)))) { free(pVisual); return BadAlloc; } fvlp->free = FALSE; fvlp->pVisual = pVisual; fvlp->next = pScreenPriv->fakedVisuals; pScreenPriv->fakedVisuals = fvlp; LEGAL_NEW_RESOURCE(id, client); return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index); } /* Called by the extension to install a colormap on DGA active screens */ static void DGAInstallCmap(ColormapPtr cmap) { ScreenPtr pScreen = cmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); /* We rely on the extension to check that DGA is active */ if (!pScreenPriv->dgaColormap) pScreenPriv->savedColormap = GetInstalledmiColormap(pScreen); pScreenPriv->dgaColormap = cmap; (*pScreen->InstallColormap) (cmap); } static int DGASync(int index) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is active */ if (pScreenPriv->funcs->Sync) (*pScreenPriv->funcs->Sync) (pScreenPriv->pScrn); return Success; } static int DGAFillRect(int index, int x, int y, int w, int h, unsigned long color) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is active */ if (pScreenPriv->funcs->FillRect && (pScreenPriv->current->mode->flags & DGA_FILL_RECT)) { (*pScreenPriv->funcs->FillRect) (pScreenPriv->pScrn, x, y, w, h, color); return Success; } return BadMatch; } static int DGABlitRect(int index, int srcx, int srcy, int w, int h, int dstx, int dsty) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is active */ if (pScreenPriv->funcs->BlitRect && (pScreenPriv->current->mode->flags & DGA_BLIT_RECT)) { (*pScreenPriv->funcs->BlitRect) (pScreenPriv->pScrn, srcx, srcy, w, h, dstx, dsty); return Success; } return BadMatch; } static int DGABlitTransRect(int index, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is active */ if (pScreenPriv->funcs->BlitTransRect && (pScreenPriv->current->mode->flags & DGA_BLIT_RECT_TRANS)) { (*pScreenPriv->funcs->BlitTransRect) (pScreenPriv->pScrn, srcx, srcy, w, h, dstx, dsty, color); return Success; } return BadMatch; } static int DGAGetModes(int index) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is available */ return pScreenPriv->numModes; } static int DGAGetModeInfo(int index, XDGAModePtr mode, int num) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is available */ if ((num <= 0) || (num > pScreenPriv->numModes)) return BadValue; DGACopyModeInfo(&(pScreenPriv->modes[num - 1]), mode); return Success; } static void DGACopyModeInfo(DGAModePtr mode, XDGAModePtr xmode) { DisplayModePtr dmode = mode->mode; xmode->num = mode->num; xmode->name = dmode->name; xmode->VSync_num = (int) (dmode->VRefresh * 1000.0); xmode->VSync_den = 1000; xmode->flags = mode->flags; xmode->imageWidth = mode->imageWidth; xmode->imageHeight = mode->imageHeight; xmode->pixmapWidth = mode->pixmapWidth; xmode->pixmapHeight = mode->pixmapHeight; xmode->bytesPerScanline = mode->bytesPerScanline; xmode->byteOrder = mode->byteOrder; xmode->depth = mode->depth; xmode->bitsPerPixel = mode->bitsPerPixel; xmode->red_mask = mode->red_mask; xmode->green_mask = mode->green_mask; xmode->blue_mask = mode->blue_mask; xmode->visualClass = mode->visualClass; xmode->viewportWidth = mode->viewportWidth; xmode->viewportHeight = mode->viewportHeight; xmode->xViewportStep = mode->xViewportStep; xmode->yViewportStep = mode->yViewportStep; xmode->maxViewportX = mode->maxViewportX; xmode->maxViewportY = mode->maxViewportY; xmode->viewportFlags = mode->viewportFlags; xmode->reserved1 = mode->reserved1; xmode->reserved2 = mode->reserved2; xmode->offset = mode->offset; if (dmode->Flags & V_INTERLACE) xmode->flags |= DGA_INTERLACED; if (dmode->Flags & V_DBLSCAN) xmode->flags |= DGA_DOUBLESCAN; } Bool DGAVTSwitch(void) { ScreenPtr pScreen; int i; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; /* Alternatively, this could send events to DGA clients */ if (DGAScreenKeyRegistered) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (pScreenPriv && pScreenPriv->current) return FALSE; } } return TRUE; } Bool DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down) { DGAScreenPtr pScreenPriv; DGAEvent event; if (!DGAScreenKeyRegistered) /* no DGA */ return FALSE; if (key_code < 8 || key_code > 255) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); if (!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */ return FALSE; event = (DGAEvent) { .header = ET_Internal, .type = ET_DGAEvent, .length = sizeof(event), .time = GetTimeInMillis(), .subtype = (is_down ? ET_KeyPress : ET_KeyRelease), .detail = key_code, .dx = 0, .dy = 0 }; mieqEnqueue(dev, (InternalEvent *) &event); return TRUE; } Bool DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy) { DGAScreenPtr pScreenPriv; DGAEvent event; if (!DGAScreenKeyRegistered) /* no DGA */ return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); if (!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ return FALSE; event = (DGAEvent) { .header = ET_Internal, .type = ET_DGAEvent, .length = sizeof(event), .time = GetTimeInMillis(), .subtype = ET_Motion, .detail = 0, .dx = dx, .dy = dy }; mieqEnqueue(dev, (InternalEvent *) &event); return TRUE; } Bool DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down) { DGAScreenPtr pScreenPriv; DGAEvent event; if (!DGAScreenKeyRegistered) /* no DGA */ return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); if (!pScreenPriv || !pScreenPriv->grabMouse) return FALSE; event = (DGAEvent) { .header = ET_Internal, .type = ET_DGAEvent, .length = sizeof(event), .time = GetTimeInMillis(), .subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease), .detail = button, .dx = 0, .dy = 0 }; mieqEnqueue(dev, (InternalEvent *) &event); return TRUE; } /* We have the power to steal or modify events that are about to get queued */ #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ static Mask filters[] = { NoSuchEvent, /* 0 */ NoSuchEvent, /* 1 */ KeyPressMask, /* KeyPress */ KeyReleaseMask, /* KeyRelease */ ButtonPressMask, /* ButtonPress */ ButtonReleaseMask, /* ButtonRelease */ PointerMotionMask, /* MotionNotify (initial state) */ }; static void DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd) { KeyClassPtr keyc = keybd->key; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT); DeviceEvent ev = { .header = ET_Internal, .length = sizeof(ev), .detail.key = event->detail, .type = event->subtype, .root_x = 0, .root_y = 0, .corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state) }; ev.corestate |= pointer->button->state; UpdateDeviceState(keybd, &ev); if (!IsMaster(keybd)) return; /* * Deliver the DGA event */ if (pScreenPriv->client) { dgaEvent de = { .u.event.time = event->time, .u.event.dx = event->dx, .u.event.dy = event->dy, .u.event.screen = pScreen->myNum, .u.event.state = ev.corestate }; de.u.u.type = DGAEventBase + GetCoreType(ev.type); de.u.u.detail = event->detail; /* If the DGA client has selected input, then deliver based on the usual filter */ TryClientEvents(pScreenPriv->client, keybd, (xEvent *) &de, 1, filters[ev.type], pScreenPriv->input, 0); } else { /* If the keyboard is actively grabbed, deliver a grabbed core event */ if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab) { ev.detail.key = event->detail; ev.time = event->time; ev.root_x = event->dx; ev.root_y = event->dy; ev.corestate = event->state; ev.deviceid = keybd->id; DeliverGrabbedEvent((InternalEvent *) &ev, keybd, FALSE); } } } static void DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) { ButtonClassPtr butc = mouse->button; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD); DeviceEvent ev = { .header = ET_Internal, .length = sizeof(ev), .detail.key = event->detail, .type = event->subtype, .corestate = butc ? butc->state : 0 }; if (master && master->key) ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state); UpdateDeviceState(mouse, &ev); if (!IsMaster(mouse)) return; /* * Deliver the DGA event */ if (pScreenPriv->client) { int coreEquiv = GetCoreType(ev.type); dgaEvent de = { .u.event.time = event->time, .u.event.dx = event->dx, .u.event.dy = event->dy, .u.event.screen = pScreen->myNum, .u.event.state = ev.corestate }; de.u.u.type = DGAEventBase + coreEquiv; de.u.u.detail = event->detail; /* If the DGA client has selected input, then deliver based on the usual filter */ TryClientEvents(pScreenPriv->client, mouse, (xEvent *) &de, 1, filters[coreEquiv], pScreenPriv->input, 0); } else { /* If the pointer is actively grabbed, deliver a grabbed core event */ if (mouse->deviceGrab.grab && !mouse->deviceGrab.fromPassiveGrab) { ev.detail.button = event->detail; ev.time = event->time; ev.root_x = event->dx; ev.root_y = event->dy; ev.corestate = event->state; /* DGA is core only, so valuators.data doesn't actually matter. * Mask must be set for EventToCore to create motion events. */ SetBit(ev.valuators.mask, 0); SetBit(ev.valuators.mask, 1); DeliverGrabbedEvent((InternalEvent *) &ev, mouse, FALSE); } } } static Bool DGAOpenFramebuffer(int index, char **name, unsigned char **mem, int *size, int *offset, int *flags) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is available */ return (*pScreenPriv->funcs->OpenFramebuffer) (pScreenPriv->pScrn, name, mem, size, offset, flags); } static void DGACloseFramebuffer(int index) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is available */ if (pScreenPriv->funcs->CloseFramebuffer) (*pScreenPriv->funcs->CloseFramebuffer) (pScreenPriv->pScrn); } /* For DGA 1.0 backwards compatibility only */ static int DGAGetOldDGAMode(int index) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); ScrnInfoPtr pScrn = pScreenPriv->pScrn; DGAModePtr mode; int i, w, h, p; /* We rely on the extension to check that DGA is available */ w = pScrn->currentMode->HDisplay; h = pScrn->currentMode->VDisplay; p = pad_to_int32(pScrn->displayWidth * bits_to_bytes(pScrn->bitsPerPixel)); for (i = 0; i < pScreenPriv->numModes; i++) { mode = &(pScreenPriv->modes[i]); if ((mode->viewportWidth == w) && (mode->viewportHeight == h) && (mode->bytesPerScanline == p) && (mode->bitsPerPixel == pScrn->bitsPerPixel) && (mode->depth == pScrn->depth)) { return mode->num; } } return 0; } static void DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) { DGAEvent *event = &ev->dga_event; ScreenPtr pScreen = screenInfo.screens[screen_num]; DGAScreenPtr pScreenPriv; /* no DGA */ if (!DGAScreenKeyRegistered || noXFree86DGAExtension) return; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); /* DGA not initialized on this screen */ if (!pScreenPriv) return; switch (event->subtype) { case KeyPress: case KeyRelease: DGAProcessKeyboardEvent(pScreen, event, device); break; case MotionNotify: case ButtonPress: case ButtonRelease: DGAProcessPointerEvent(pScreen, event, device); break; default: break; } } static void XDGAResetProc(ExtensionEntry * extEntry); static void DGAClientStateChange(CallbackListPtr *, void *, void *); static DevPrivateKeyRec DGAScreenPrivateKeyRec; #define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec) #define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized) static DevPrivateKeyRec DGAClientPrivateKeyRec; #define DGAClientPrivateKey (&DGAClientPrivateKeyRec) static int DGACallbackRefCount = 0; /* This holds the client's version information */ typedef struct { int major; int minor; } DGAPrivRec, *DGAPrivPtr; #define DGA_GETCLIENT(idx) ((ClientPtr) \ dixLookupPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey)) #define DGA_SETCLIENT(idx,p) \ dixSetPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey, p) #define DGA_GETPRIV(c) ((DGAPrivPtr) \ dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey)) #define DGA_SETPRIV(c,p) \ dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p) static void XDGAResetProc(ExtensionEntry * extEntry) { DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); DGACallbackRefCount = 0; } static int ProcXDGAQueryVersion(ClientPtr client) { xXDGAQueryVersionReply rep; REQUEST_SIZE_MATCH(xXDGAQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_XDGA_MAJOR_VERSION; rep.minorVersion = SERVER_XDGA_MINOR_VERSION; WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep); return Success; } static int ProcXDGAOpenFramebuffer(ClientPtr client) { REQUEST(xXDGAOpenFramebufferReq); xXDGAOpenFramebufferReply rep; char *deviceName; int nameSize; REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (!DGAOpenFramebuffer(stuff->screen, &deviceName, (unsigned char **) (&rep.mem1), (int *) &rep.size, (int *) &rep.offset, (int *) &rep.extra)) { return BadAlloc; } nameSize = deviceName ? (strlen(deviceName) + 1) : 0; rep.length = bytes_to_int32(nameSize); WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *) &rep); if (rep.length) WriteToClient(client, nameSize, deviceName); return Success; } static int ProcXDGACloseFramebuffer(ClientPtr client) { REQUEST(xXDGACloseFramebufferReq); REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; DGACloseFramebuffer(stuff->screen); return Success; } static int ProcXDGAQueryModes(ClientPtr client) { int i, num, size; REQUEST(xXDGAQueryModesReq); xXDGAQueryModesReply rep; xXDGAModeInfo info; XDGAModePtr mode; REQUEST_SIZE_MATCH(xXDGAQueryModesReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; rep.type = X_Reply; rep.length = 0; rep.number = 0; rep.sequenceNumber = client->sequence; if (!DGAAvailable(stuff->screen)) { rep.number = 0; rep.length = 0; WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); return Success; } if (!(num = DGAGetModes(stuff->screen))) { WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); return Success; } if (!(mode = xallocarray(num, sizeof(XDGAModeRec)))) return BadAlloc; for (i = 0; i < num; i++) DGAGetModeInfo(stuff->screen, mode + i, i + 1); size = num * sz_xXDGAModeInfo; for (i = 0; i < num; i++) size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */ rep.number = num; rep.length = bytes_to_int32(size); WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); for (i = 0; i < num; i++) { size = strlen(mode[i].name) + 1; info.byte_order = mode[i].byteOrder; info.depth = mode[i].depth; info.num = mode[i].num; info.bpp = mode[i].bitsPerPixel; info.name_size = (size + 3) & ~3L; info.vsync_num = mode[i].VSync_num; info.vsync_den = mode[i].VSync_den; info.flags = mode[i].flags; info.image_width = mode[i].imageWidth; info.image_height = mode[i].imageHeight; info.pixmap_width = mode[i].pixmapWidth; info.pixmap_height = mode[i].pixmapHeight; info.bytes_per_scanline = mode[i].bytesPerScanline; info.red_mask = mode[i].red_mask; info.green_mask = mode[i].green_mask; info.blue_mask = mode[i].blue_mask; info.visual_class = mode[i].visualClass; info.viewport_width = mode[i].viewportWidth; info.viewport_height = mode[i].viewportHeight; info.viewport_xstep = mode[i].xViewportStep; info.viewport_ystep = mode[i].yViewportStep; info.viewport_xmax = mode[i].maxViewportX; info.viewport_ymax = mode[i].maxViewportY; info.viewport_flags = mode[i].viewportFlags; info.reserved1 = mode[i].reserved1; info.reserved2 = mode[i].reserved2; WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info)); WriteToClient(client, size, mode[i].name); } free(mode); return Success; } static void DGAClientStateChange(CallbackListPtr *pcbl, void *nulldata, void *calldata) { NewClientInfoRec *pci = (NewClientInfoRec *) calldata; ClientPtr client = NULL; int i; for (i = 0; i < screenInfo.numScreens; i++) { if (DGA_GETCLIENT(i) == pci->client) { client = pci->client; break; } } if (client && ((client->clientState == ClientStateGone) || (client->clientState == ClientStateRetained))) { XDGAModeRec mode; PixmapPtr pPix; DGA_SETCLIENT(i, NULL); DGASelectInput(i, NULL, 0); DGASetMode(i, 0, &mode, &pPix); if (--DGACallbackRefCount == 0) DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); } } static int ProcXDGASetMode(ClientPtr client) { REQUEST(xXDGASetModeReq); xXDGASetModeReply rep; XDGAModeRec mode; xXDGAModeInfo info; PixmapPtr pPix; ClientPtr owner; int size; REQUEST_SIZE_MATCH(xXDGASetModeReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; owner = DGA_GETCLIENT(stuff->screen); rep.type = X_Reply; rep.length = 0; rep.offset = 0; rep.flags = 0; rep.sequenceNumber = client->sequence; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; if (owner && owner != client) return DGAErrorBase + XF86DGANoDirectVideoMode; if (!stuff->mode) { if (owner) { if (--DGACallbackRefCount == 0) DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); } DGA_SETCLIENT(stuff->screen, NULL); DGASelectInput(stuff->screen, NULL, 0); DGASetMode(stuff->screen, 0, &mode, &pPix); WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep); return Success; } if (Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix)) return BadValue; if (!owner) { if (DGACallbackRefCount++ == 0) AddCallback(&ClientStateCallback, DGAClientStateChange, NULL); } DGA_SETCLIENT(stuff->screen, client); if (pPix) { if (AddResource(stuff->pid, RT_PIXMAP, (void *) (pPix))) { pPix->drawable.id = (int) stuff->pid; rep.flags = DGA_PIXMAP_AVAILABLE; } } size = strlen(mode.name) + 1; info.byte_order = mode.byteOrder; info.depth = mode.depth; info.num = mode.num; info.bpp = mode.bitsPerPixel; info.name_size = (size + 3) & ~3L; info.vsync_num = mode.VSync_num; info.vsync_den = mode.VSync_den; info.flags = mode.flags; info.image_width = mode.imageWidth; info.image_height = mode.imageHeight; info.pixmap_width = mode.pixmapWidth; info.pixmap_height = mode.pixmapHeight; info.bytes_per_scanline = mode.bytesPerScanline; info.red_mask = mode.red_mask; info.green_mask = mode.green_mask; info.blue_mask = mode.blue_mask; info.visual_class = mode.visualClass; info.viewport_width = mode.viewportWidth; info.viewport_height = mode.viewportHeight; info.viewport_xstep = mode.xViewportStep; info.viewport_ystep = mode.yViewportStep; info.viewport_xmax = mode.maxViewportX; info.viewport_ymax = mode.maxViewportY; info.viewport_flags = mode.viewportFlags; info.reserved1 = mode.reserved1; info.reserved2 = mode.reserved2; rep.length = bytes_to_int32(sz_xXDGAModeInfo + info.name_size); WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep); WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info)); WriteToClient(client, size, mode.name); return Success; } static int ProcXDGASetViewport(ClientPtr client) { REQUEST(xXDGASetViewportReq); REQUEST_SIZE_MATCH(xXDGASetViewportReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags); return Success; } static int ProcXDGAInstallColormap(ClientPtr client) { ColormapPtr cmap; int rc; REQUEST(xXDGAInstallColormapReq); REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP, client, DixInstallAccess); if (rc != Success) return rc; DGAInstallCmap(cmap); return Success; } static int ProcXDGASelectInput(ClientPtr client) { REQUEST(xXDGASelectInputReq); REQUEST_SIZE_MATCH(xXDGASelectInputReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (DGA_GETCLIENT(stuff->screen) == client) DGASelectInput(stuff->screen, client, stuff->mask); return Success; } static int ProcXDGAFillRectangle(ClientPtr client) { REQUEST(xXDGAFillRectangleReq); REQUEST_SIZE_MATCH(xXDGAFillRectangleReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y, stuff->width, stuff->height, stuff->color)) return BadMatch; return Success; } static int ProcXDGACopyArea(ClientPtr client) { REQUEST(xXDGACopyAreaReq); REQUEST_SIZE_MATCH(xXDGACopyAreaReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy, stuff->width, stuff->height, stuff->dstx, stuff->dsty)) return BadMatch; return Success; } static int ProcXDGACopyTransparentArea(ClientPtr client) { REQUEST(xXDGACopyTransparentAreaReq); REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy, stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key)) return BadMatch; return Success; } static int ProcXDGAGetViewportStatus(ClientPtr client) { REQUEST(xXDGAGetViewportStatusReq); xXDGAGetViewportStatusReply rep; REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.status = DGAGetViewportStatus(stuff->screen); WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep); return Success; } static int ProcXDGASync(ClientPtr client) { REQUEST(xXDGASyncReq); xXDGASyncReply rep; REQUEST_SIZE_MATCH(xXDGASyncReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; DGASync(stuff->screen); WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep); return Success; } static int ProcXDGASetClientVersion(ClientPtr client) { REQUEST(xXDGASetClientVersionReq); DGAPrivPtr pPriv; REQUEST_SIZE_MATCH(xXDGASetClientVersionReq); if ((pPriv = DGA_GETPRIV(client)) == NULL) { pPriv = malloc(sizeof(DGAPrivRec)); /* XXX Need to look into freeing this */ if (!pPriv) return BadAlloc; DGA_SETPRIV(client, pPriv); } pPriv->major = stuff->major; pPriv->minor = stuff->minor; return Success; } static int ProcXDGAChangePixmapMode(ClientPtr client) { REQUEST(xXDGAChangePixmapModeReq); xXDGAChangePixmapModeReply rep; int x, y; REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; x = stuff->x; y = stuff->y; if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags)) return BadMatch; rep.x = x; rep.y = y; WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep); return Success; } static int ProcXDGACreateColormap(ClientPtr client) { REQUEST(xXDGACreateColormapReq); int result; REQUEST_SIZE_MATCH(xXDGACreateColormapReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (!stuff->mode) return BadValue; result = DGACreateColormap(stuff->screen, client, stuff->id, stuff->mode, stuff->alloc); if (result != Success) return result; return Success; } /* * * Support for the old DGA protocol, used to live in xf86dga.c * */ #ifdef DGA_PROTOCOL_OLD_SUPPORT static int ProcXF86DGAGetVideoLL(ClientPtr client) { REQUEST(xXF86DGAGetVideoLLReq); xXF86DGAGetVideoLLReply rep; XDGAModeRec mode; int num, offset, flags; char *name; REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; if (!(num = DGAGetOldDGAMode(stuff->screen))) return DGAErrorBase + XF86DGANoDirectVideoMode; /* get the parameters for the mode that best matches */ DGAGetModeInfo(stuff->screen, &mode, num); if (!DGAOpenFramebuffer(stuff->screen, &name, (unsigned char **) (&rep.offset), (int *) (&rep.bank_size), &offset, &flags)) return BadAlloc; rep.offset += mode.offset; rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3); rep.ram_size = rep.bank_size >> 10; WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *) &rep); return Success; } static int ProcXF86DGADirectVideo(ClientPtr client) { int num; PixmapPtr pix; XDGAModeRec mode; ClientPtr owner; REQUEST(xXF86DGADirectVideoReq); REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; owner = DGA_GETCLIENT(stuff->screen); if (owner && owner != client) return DGAErrorBase + XF86DGANoDirectVideoMode; if (stuff->enable & XF86DGADirectGraphics) { if (!(num = DGAGetOldDGAMode(stuff->screen))) return DGAErrorBase + XF86DGANoDirectVideoMode; } else num = 0; if (Success != DGASetMode(stuff->screen, num, &mode, &pix)) return DGAErrorBase + XF86DGAScreenNotActive; DGASetInputMode(stuff->screen, (stuff->enable & XF86DGADirectKeyb) != 0, (stuff->enable & XF86DGADirectMouse) != 0); /* We need to track the client and attach the teardown callback */ if (stuff->enable & (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) { if (!owner) { if (DGACallbackRefCount++ == 0) AddCallback(&ClientStateCallback, DGAClientStateChange, NULL); } DGA_SETCLIENT(stuff->screen, client); } else { if (owner) { if (--DGACallbackRefCount == 0) DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); } DGA_SETCLIENT(stuff->screen, NULL); } return Success; } static int ProcXF86DGAGetViewPortSize(ClientPtr client) { int num; XDGAModeRec mode; REQUEST(xXF86DGAGetViewPortSizeReq); xXF86DGAGetViewPortSizeReply rep; REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; if (!(num = DGAGetOldDGAMode(stuff->screen))) return DGAErrorBase + XF86DGANoDirectVideoMode; DGAGetModeInfo(stuff->screen, &mode, num); rep.width = mode.viewportWidth; rep.height = mode.viewportHeight; WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *) &rep); return Success; } static int ProcXF86DGASetViewPort(ClientPtr client) { REQUEST(xXF86DGASetViewPortReq); REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; if (!DGAActive(stuff->screen)) return DGAErrorBase + XF86DGADirectNotActivated; if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE) != Success) return DGAErrorBase + XF86DGADirectNotActivated; return Success; } static int ProcXF86DGAGetVidPage(ClientPtr client) { REQUEST(xXF86DGAGetVidPageReq); xXF86DGAGetVidPageReply rep; REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.vpage = 0; /* silently fail */ WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *) &rep); return Success; } static int ProcXF86DGASetVidPage(ClientPtr client) { REQUEST(xXF86DGASetVidPageReq); REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; /* silently fail */ return Success; } static int ProcXF86DGAInstallColormap(ClientPtr client) { ColormapPtr pcmp; int rc; REQUEST(xXF86DGAInstallColormapReq); REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (!DGAActive(stuff->screen)) return DGAErrorBase + XF86DGADirectNotActivated; rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, client, DixInstallAccess); if (rc == Success) { DGAInstallCmap(pcmp); return Success; } else { return rc; } } static int ProcXF86DGAQueryDirectVideo(ClientPtr client) { REQUEST(xXF86DGAQueryDirectVideoReq); xXF86DGAQueryDirectVideoReply rep; REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.flags = 0; if (DGAAvailable(stuff->screen)) rep.flags = XF86DGADirectPresent; WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *) &rep); return Success; } static int ProcXF86DGAViewPortChanged(ClientPtr client) { REQUEST(xXF86DGAViewPortChangedReq); xXF86DGAViewPortChangedReply rep; REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) return DGAErrorBase + XF86DGADirectNotActivated; if (!DGAActive(stuff->screen)) return DGAErrorBase + XF86DGADirectNotActivated; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.result = 1; WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *) &rep); return Success; } #endif /* DGA_PROTOCOL_OLD_SUPPORT */ static int _X_COLD SProcXDGADispatch(ClientPtr client) { return DGAErrorBase + XF86DGAClientNotLocal; } #if 0 #define DGA_REQ_DEBUG #endif #ifdef DGA_REQ_DEBUG static char *dgaMinor[] = { "QueryVersion", "GetVideoLL", "DirectVideo", "GetViewPortSize", "SetViewPort", "GetVidPage", "SetVidPage", "InstallColormap", "QueryDirectVideo", "ViewPortChanged", "10", "11", "QueryModes", "SetMode", "SetViewport", "InstallColormap", "SelectInput", "FillRectangle", "CopyArea", "CopyTransparentArea", "GetViewportStatus", "Sync", "OpenFramebuffer", "CloseFramebuffer", "SetClientVersion", "ChangePixmapMode", "CreateColormap", }; #endif static int ProcXDGADispatch(ClientPtr client) { REQUEST(xReq); if (!client->local) return DGAErrorBase + XF86DGAClientNotLocal; #ifdef DGA_REQ_DEBUG if (stuff->data <= X_XDGACreateColormap) fprintf(stderr, " DGA %s\n", dgaMinor[stuff->data]); #endif switch (stuff->data) { /* * DGA2 Protocol */ case X_XDGAQueryVersion: return ProcXDGAQueryVersion(client); case X_XDGAQueryModes: return ProcXDGAQueryModes(client); case X_XDGASetMode: return ProcXDGASetMode(client); case X_XDGAOpenFramebuffer: return ProcXDGAOpenFramebuffer(client); case X_XDGACloseFramebuffer: return ProcXDGACloseFramebuffer(client); case X_XDGASetViewport: return ProcXDGASetViewport(client); case X_XDGAInstallColormap: return ProcXDGAInstallColormap(client); case X_XDGASelectInput: return ProcXDGASelectInput(client); case X_XDGAFillRectangle: return ProcXDGAFillRectangle(client); case X_XDGACopyArea: return ProcXDGACopyArea(client); case X_XDGACopyTransparentArea: return ProcXDGACopyTransparentArea(client); case X_XDGAGetViewportStatus: return ProcXDGAGetViewportStatus(client); case X_XDGASync: return ProcXDGASync(client); case X_XDGASetClientVersion: return ProcXDGASetClientVersion(client); case X_XDGAChangePixmapMode: return ProcXDGAChangePixmapMode(client); case X_XDGACreateColormap: return ProcXDGACreateColormap(client); /* * Old DGA Protocol */ #ifdef DGA_PROTOCOL_OLD_SUPPORT case X_XF86DGAGetVideoLL: return ProcXF86DGAGetVideoLL(client); case X_XF86DGADirectVideo: return ProcXF86DGADirectVideo(client); case X_XF86DGAGetViewPortSize: return ProcXF86DGAGetViewPortSize(client); case X_XF86DGASetViewPort: return ProcXF86DGASetViewPort(client); case X_XF86DGAGetVidPage: return ProcXF86DGAGetVidPage(client); case X_XF86DGASetVidPage: return ProcXF86DGASetVidPage(client); case X_XF86DGAInstallColormap: return ProcXF86DGAInstallColormap(client); case X_XF86DGAQueryDirectVideo: return ProcXF86DGAQueryDirectVideo(client); case X_XF86DGAViewPortChanged: return ProcXF86DGAViewPortChanged(client); #endif /* DGA_PROTOCOL_OLD_SUPPORT */ default: return BadRequest; } } void XFree86DGAExtensionInit(void) { ExtensionEntry *extEntry; if (!dixRegisterPrivateKey(&DGAClientPrivateKeyRec, PRIVATE_CLIENT, 0)) return; if (!dixRegisterPrivateKey(&DGAScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return; if ((extEntry = AddExtension(XF86DGANAME, XF86DGANumberEvents, XF86DGANumberErrors, ProcXDGADispatch, SProcXDGADispatch, XDGAResetProc, StandardMinorOpcode))) { int i; DGAReqCode = (unsigned char) extEntry->base; DGAErrorBase = extEntry->errorBase; DGAEventBase = extEntry->eventBase; for (i = KeyPress; i <= MotionNotify; i++) SetCriticalEvent(DGAEventBase + i); } } xorg-server-1.20.8/hw/xfree86/common/xf86DPMS.c0000644000175000017500000000551113640201473015630 00000000000000/* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ /* * This file contains the DPMS functions required by the extension. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "os.h" #include "globals.h" #include "windowstr.h" #include "xf86.h" #include "xf86Priv.h" #ifdef DPMSExtension #include #include "dpmsproc.h" #endif #ifdef XSERVER_LIBPCIACCESS #include "xf86VGAarbiter.h" #endif #ifdef DPMSExtension static void xf86DPMS(ScreenPtr pScreen, int level) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->DPMSSet && pScrn->vtSema) { xf86VGAarbiterLock(pScrn); pScrn->DPMSSet(pScrn, level, 0); xf86VGAarbiterUnlock(pScrn); } } #endif Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) { #ifdef DPMSExtension ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); void *DPMSOpt; MessageType enabled_from = X_DEFAULT; Bool enabled = TRUE; DPMSOpt = xf86FindOption(pScrn->options, "dpms"); if (DPMSDisabledSwitch) { enabled_from = X_CMDLINE; enabled = FALSE; } else if (DPMSOpt) { enabled_from = X_CONFIG; enabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE); xf86MarkOptionUsed(DPMSOpt); } if (enabled) { xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n"); pScrn->DPMSSet = set; pScreen->DPMS = xf86DPMS; } return TRUE; #else return FALSE; #endif } xorg-server-1.20.8/hw/xfree86/common/xf86AutoConfig.c0000644000175000017500000003114413640201473017124 00000000000000/* * Copyright 2003 by David H. Dawes. * Copyright 2003 by X-Oz Technologies. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice 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). * * Author: David Dawes . */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "xf86Config.h" #include "xf86MatchDrivers.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86platformBus.h" #include "xf86pciBus.h" #ifdef __sparc__ #include "xf86sbusBus.h" #endif #ifdef __sun #include #include #endif /* Sections for the default built-in configuration. */ #define BUILTIN_DEVICE_NAME \ "\"Builtin Default %s Device %d\"" #define BUILTIN_DEVICE_SECTION_PRE \ "Section \"Device\"\n" \ "\tIdentifier\t" BUILTIN_DEVICE_NAME "\n" \ "\tDriver\t\"%s\"\n" #define BUILTIN_DEVICE_SECTION_POST \ "EndSection\n\n" #define BUILTIN_DEVICE_SECTION \ BUILTIN_DEVICE_SECTION_PRE \ BUILTIN_DEVICE_SECTION_POST #define BUILTIN_SCREEN_NAME \ "\"Builtin Default %s Screen %d\"" #define BUILTIN_SCREEN_SECTION \ "Section \"Screen\"\n" \ "\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \ "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \ "EndSection\n\n" #define BUILTIN_LAYOUT_SECTION_PRE \ "Section \"ServerLayout\"\n" \ "\tIdentifier\t\"Builtin Default Layout\"\n" #define BUILTIN_LAYOUT_SCREEN_LINE \ "\tScreen\t" BUILTIN_SCREEN_NAME "\n" #define BUILTIN_LAYOUT_SECTION_POST \ "EndSection\n\n" static const char **builtinConfig = NULL; static int builtinLines = 0; static void listPossibleVideoDrivers(XF86MatchedDrivers *md); /* * A built-in config file is stored as an array of strings, with each string * representing a single line. AppendToConfig() breaks up the string "s" * into lines, and appends those lines it to builtinConfig. */ static void AppendToList(const char *s, const char ***list, int *lines) { char *str, *newstr, *p; str = xnfstrdup(s); for (p = strtok(str, "\n"); p; p = strtok(NULL, "\n")) { (*lines)++; *list = xnfreallocarray(*list, *lines + 1, sizeof(**list)); newstr = xnfalloc(strlen(p) + 2); strcpy(newstr, p); strcat(newstr, "\n"); (*list)[*lines - 1] = newstr; (*list)[*lines] = NULL; } free(str); } static void FreeList(const char ***list, int *lines) { int i; for (i = 0; i < *lines; i++) { free((char *) ((*list)[i])); } free(*list); *list = NULL; *lines = 0; } static void FreeConfig(void) { FreeList(&builtinConfig, &builtinLines); } static void AppendToConfig(const char *s) { AppendToList(s, &builtinConfig, &builtinLines); } void xf86AddMatchedDriver(XF86MatchedDrivers *md, const char *driver) { int j; int nmatches = md->nmatches; for (j = 0; j < nmatches; ++j) { if (xf86NameCmp(md->matches[j], driver) == 0) { // Driver already in matched drivers return; } } if (nmatches < MATCH_DRIVERS_LIMIT) { md->matches[nmatches] = xnfstrdup(driver); md->nmatches++; } else { xf86Msg(X_WARNING, "Too many drivers registered, can't add %s\n", driver); } } Bool xf86AutoConfig(void) { XF86MatchedDrivers md; int i; const char **cp; char buf[1024]; ConfigStatus ret; /* Make sure config rec is there */ if (xf86allocateConfig() != NULL) { ret = CONFIG_OK; /* OK so far */ } else { xf86Msg(X_ERROR, "Couldn't allocate Config record.\n"); return FALSE; } listPossibleVideoDrivers(&md); for (i = 0; i < md.nmatches; i++) { snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, md.matches[i], 0, md.matches[i]); AppendToConfig(buf); snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, md.matches[i], 0, md.matches[i], 0); AppendToConfig(buf); } AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE); for (i = 0; i < md.nmatches; i++) { snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, md.matches[i], 0); AppendToConfig(buf); } AppendToConfig(BUILTIN_LAYOUT_SECTION_POST); for (i = 0; i < md.nmatches; i++) { free(md.matches[i]); } xf86MsgVerb(X_DEFAULT, 0, "Using default built-in configuration (%d lines)\n", builtinLines); xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n"); for (cp = builtinConfig; *cp; cp++) xf86ErrorFVerb(3, "\t%s", *cp); xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n"); xf86initConfigFiles(); xf86setBuiltinConfig(builtinConfig); ret = xf86HandleConfigFile(TRUE); FreeConfig(); if (ret != CONFIG_OK) xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n"); return ret == CONFIG_OK; } static void listPossibleVideoDrivers(XF86MatchedDrivers *md) { md->nmatches = 0; #ifdef XSERVER_PLATFORM_BUS xf86PlatformMatchDriver(md); #endif #ifdef __sun /* Check for driver type based on /dev/fb type and if valid, use it instead of PCI bus probe results */ if (xf86Info.consoleFd >= 0) { struct vis_identifier visid; const char *cp; int iret; SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid)); if (iret < 0) { int fbfd; fbfd = open(xf86SolarisFbDev, O_RDONLY); if (fbfd >= 0) { SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid)); close(fbfd); } } if (iret < 0) { xf86Msg(X_WARNING, "could not get frame buffer identifier from %s\n", xf86SolarisFbDev); } else { xf86Msg(X_PROBED, "console driver: %s\n", visid.name); /* Special case from before the general case was set */ if (strcmp(visid.name, "NVDAnvda") == 0) { xf86AddMatchedDriver(md, "nvidia"); } /* General case - split into vendor name (initial all-caps prefix) & driver name (rest of the string). */ if (strcmp(visid.name, "SUNWtext") != 0) { for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) { /* find end of all uppercase vendor section */ } if ((cp != visid.name) && (*cp != '\0')) { char *vendorName = xnfstrdup(visid.name); vendorName[cp - visid.name] = '\0'; xf86AddMatchedDriver(md, vendorName); xf86AddMatchedDriver(md, cp); free(vendorName); } } } } #endif #ifdef __sparc__ char *sbusDriver = sparcDriverName(); if (sbusDriver) xf86AddMatchedDriver(md, sbusDriver); #endif #ifdef XSERVER_LIBPCIACCESS xf86PciMatchDriver(md); #endif #if defined(__linux__) xf86AddMatchedDriver(md, "modesetting"); #endif #if !defined(__sun) /* Fallback to platform default frame buffer driver */ #if !defined(__linux__) && defined(__sparc__) xf86AddMatchedDriver(md, "wsfb"); #else xf86AddMatchedDriver(md, "fbdev"); #endif #endif /* !__sun */ /* Fallback to platform default hardware */ #if defined(__i386__) || defined(__amd64__) || defined(__hurd__) xf86AddMatchedDriver(md, "vesa"); #elif defined(__sparc__) && !defined(__sun) xf86AddMatchedDriver(md, "sunffb"); #endif } /* copy a screen section and enter the desired driver * and insert it at i in the list of screens */ static Bool copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver) { confScreenPtr nscreen; GDevPtr cptr = NULL; char *identifier; nscreen = malloc(sizeof(confScreenRec)); if (!nscreen) return FALSE; memcpy(nscreen, oscreen, sizeof(confScreenRec)); cptr = malloc(sizeof(GDevRec)); if (!cptr) { free(nscreen); return FALSE; } memcpy(cptr, odev, sizeof(GDevRec)); if (asprintf(&identifier, "Autoconfigured Video Device %s", driver) == -1) { free(cptr); free(nscreen); return FALSE; } cptr->driver = driver; cptr->identifier = identifier; xf86ConfigLayout.screens[i].screen = nscreen; /* now associate the new driver entry with the new screen entry */ xf86ConfigLayout.screens[i].screen->device = cptr; cptr->myScreenSection = xf86ConfigLayout.screens[i].screen; return TRUE; } GDevPtr autoConfigDevice(GDevPtr preconf_device) { GDevPtr ptr = NULL; XF86MatchedDrivers md; int num_screens = 0, i; screenLayoutPtr slp; if (!xf86configptr) { return NULL; } /* If there's a configured section with no driver chosen, use it */ if (preconf_device) { ptr = preconf_device; } else { ptr = calloc(1, sizeof(GDevRec)); if (!ptr) { return NULL; } ptr->chipID = -1; ptr->chipRev = -1; ptr->irq = -1; ptr->active = TRUE; ptr->claimed = FALSE; ptr->identifier = "Autoconfigured Video Device"; ptr->driver = NULL; } if (!ptr->driver) { /* get all possible video drivers and count them */ listPossibleVideoDrivers(&md); for (i = 0; i < md.nmatches; i++) { xf86Msg(X_DEFAULT, "Matched %s as autoconfigured driver %d\n", md.matches[i], i); } slp = xf86ConfigLayout.screens; if (slp) { /* count the number of screens and make space for * a new screen for each additional possible driver * minus one for the already existing first one * plus one for the terminating NULL */ for (; slp[num_screens].screen; num_screens++); xf86ConfigLayout.screens = xnfcalloc(num_screens + md.nmatches, sizeof(screenLayoutRec)); xf86ConfigLayout.screens[0] = slp[0]; /* do the first match and set that for the original first screen */ ptr->driver = md.matches[0]; if (!xf86ConfigLayout.screens[0].screen->device) { xf86ConfigLayout.screens[0].screen->device = ptr; ptr->myScreenSection = xf86ConfigLayout.screens[0].screen; } /* for each other driver found, copy the first screen, insert it * into the list of screens and set the driver */ for (i = 1; i < md.nmatches; i++) { if (!copyScreen(slp[0].screen, ptr, i, md.matches[i])) return NULL; } /* shift the rest of the original screen list * to the end of the current screen list * * TODO Handle rest of multiple screen sections */ for (i = 1; i < num_screens; i++) { xf86ConfigLayout.screens[i + md.nmatches] = slp[i]; } xf86ConfigLayout.screens[num_screens + md.nmatches - 1].screen = NULL; free(slp); } else { /* layout does not have any screens, not much to do */ ptr->driver = md.matches[0]; for (i = 1; i < md.nmatches; i++) { free(md.matches[i]); } } } xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n"); return ptr; } xorg-server-1.20.8/hw/xfree86/common/xf86Helper.c0000644000175000017500000014207513640201473016313 00000000000000/* * 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 * David Dawes * ... and others * * This file includes the helper functions that the server provides for * different drivers. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #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" /* For xf86GetClocks */ #if defined(CSRG_BASED) || defined(__GNU__) #define HAS_SETPRIORITY #include #endif static int xf86ScrnInfoPrivateCount = 0; /* Add a pointer to a new DriverRec to xf86DriverList */ void xf86AddDriver(DriverPtr driver, void *module, int flags) { /* Don't add null entries */ if (!driver) return; if (xf86DriverList == NULL) xf86NumDrivers = 0; xf86NumDrivers++; xf86DriverList = xnfreallocarray(xf86DriverList, xf86NumDrivers, sizeof(DriverPtr)); xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec)); *xf86DriverList[xf86NumDrivers - 1] = *driver; 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, void *module, int flags) { /* Don't add null entries */ if (!driver) return; if (xf86InputDriverList == NULL) xf86NumInputDrivers = 0; xf86NumInputDrivers++; xf86InputDriverList = xnfreallocarray(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; ScrnInfoPtr pScrn; if (flags & XF86_ALLOCATE_GPU_SCREEN) { if (xf86GPUScreens == NULL) xf86NumGPUScreens = 0; i = xf86NumGPUScreens++; xf86GPUScreens = xnfreallocarray(xf86GPUScreens, xf86NumGPUScreens, sizeof(ScrnInfoPtr)); xf86GPUScreens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); pScrn = xf86GPUScreens[i]; pScrn->scrnIndex = i + GPU_SCREEN_OFFSET; /* Changes when a screen is removed */ pScrn->is_gpu = TRUE; } else { if (xf86Screens == NULL) xf86NumScreens = 0; i = xf86NumScreens++; xf86Screens = xnfreallocarray(xf86Screens, xf86NumScreens, sizeof(ScrnInfoPtr)); xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); pScrn = xf86Screens[i]; pScrn->scrnIndex = i; /* Changes when a screen is removed */ } pScrn->origIndex = pScrn->scrnIndex; /* This never changes */ pScrn->privates = xnfcalloc(sizeof(DevUnion), xf86ScrnInfoPrivateCount); /* * EnableDisableFBAccess now gets initialized in InitOutput() * pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess; */ pScrn->drv = drv; drv->refCount++; pScrn->module = DuplicateModule(drv->module, NULL); pScrn->DriverFunc = drv->driverFunc; return pScrn; } /* * Remove an entry from xf86Screens. Ideally it should free all allocated * data. To do this properly may require a driver hook. */ void xf86DeleteScreen(ScrnInfoPtr pScrn) { int i; int scrnIndex; Bool is_gpu = FALSE; if (!pScrn) return; if (pScrn->is_gpu) { /* First check if the screen is valid */ if (xf86NumGPUScreens == 0 || xf86GPUScreens == NULL) return; is_gpu = TRUE; } else { /* First check if the screen is valid */ if (xf86NumScreens == 0 || xf86Screens == NULL) return; } scrnIndex = pScrn->scrnIndex; /* If a FreeScreen function is defined, call it here */ if (pScrn->FreeScreen != NULL) pScrn->FreeScreen(pScrn); 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(pScrn); free(pScrn); /* Move the other entries down, updating their scrnIndex fields */ if (is_gpu) { xf86NumGPUScreens--; scrnIndex -= GPU_SCREEN_OFFSET; for (i = scrnIndex; i < xf86NumGPUScreens; i++) { xf86GPUScreens[i] = xf86GPUScreens[i + 1]; xf86GPUScreens[i]->scrnIndex = i + GPU_SCREEN_OFFSET; /* Also need to take care of the screen layout settings */ } } else { 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 = xnfreallocarray(pScr->privates, xf86ScrnInfoPrivateCount, sizeof(DevUnion)); /* Zero the new private */ memset(&nprivs[idx], 0, sizeof(DevUnion)); pScr->privates = nprivs; } for (i = 0; i < xf86NumGPUScreens; i++) { pScr = xf86GPUScreens[i]; nprivs = xnfreallocarray(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, depth, display, imageByteOrder, * bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats, * formats, fbFormat. */ /* Can the screen handle 32 bpp pixmaps */ #define DO_PIX32(f) ((f & Support32bppFb) || \ ((f & Support24bppFb) && (f & SupportConvert32to24))) #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; scrp->bitsPerPixel = -1; scrp->depth = -1; scrp->bitsPerPixelFrom = X_DEFAULT; scrp->depthFrom = X_DEFAULT; if (xf86FbBpp > 0) { if (xf86FbBpp == 24) /* lol no */ xf86FbBpp = 32; 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. */ 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 && DO_PIX32(depth24flags)) { scrp->bitsPerPixel = 32; } else if (scrp->depth <= 32) scrp->bitsPerPixel = 32; else { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "No bpp for depth (%d)\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 ((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 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; } /* * 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 = xnfreallocarray(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; } 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; } } /* * 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(ScrnInfoPtr pScrnInfo, Bool enable) { ScreenPtr pScreen = pScrnInfo->pScreen; if (enable) { /* * Restore all of the clip lists on the screen */ if (!xf86Resetting) SetRootClip(pScreen, ROOT_CLIP_FULL); } else { /* * Empty all of the clip lists on the screen */ SetRootClip(pScreen, ROOT_CLIP_NONE); } } /* Print driver messages in the standard format of () (): */ void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args) { /* Prefix the scrnIndex name to the format string. */ if (scrnIndex >= 0 && scrnIndex < xf86NumScreens && xf86Screens[scrnIndex]->name) LogHdrMessageVerb(type, verb, format, args, "%s(%d): ", xf86Screens[scrnIndex]->name, scrnIndex); else if (scrnIndex >= GPU_SCREEN_OFFSET && scrnIndex < GPU_SCREEN_OFFSET + xf86NumGPUScreens && xf86GPUScreens[scrnIndex - GPU_SCREEN_OFFSET]->name) LogHdrMessageVerb(type, verb, format, args, "%s(G%d): ", xf86GPUScreens[scrnIndex - GPU_SCREEN_OFFSET]->name, scrnIndex - GPU_SCREEN_OFFSET); else LogVMessageVerb(type, verb, format, args); } /* 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 () : : */ void xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format, va_list args) { const char *driverName = NULL; const char *deviceName = NULL; /* Prefix driver and device names to formatted message. */ if (dev) { deviceName = dev->name; if (dev->drv) driverName = dev->drv->driverName; } LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName, deviceName); } /* 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); } /* Note temporarily modifies the passed in buffer! */ static void xf86_mkdir_p(char *path) { char *sep = path; while ((sep = strchr(sep + 1, '/'))) { *sep = 0; (void)mkdir(path, 0777); *sep = '/'; } (void)mkdir(path, 0777); } void xf86LogInit(void) { char *env, *lf = NULL; char buf[PATH_MAX]; #define LOGSUFFIX ".log" #define LOGOLDSUFFIX ".old" /* Get the log file name */ if (xf86LogFileFrom == X_DEFAULT) { /* When not running as root, we won't be able to write to /var/log */ if (geteuid() != 0) { if ((env = getenv("XDG_DATA_HOME"))) snprintf(buf, sizeof(buf), "%s/%s", env, DEFAULT_XDG_DATA_HOME_LOGDIR); else if ((env = getenv("HOME"))) snprintf(buf, sizeof(buf), "%s/%s/%s", env, DEFAULT_XDG_DATA_HOME, DEFAULT_XDG_DATA_HOME_LOGDIR); if (env) { xf86_mkdir_p(buf); strlcat(buf, "/" DEFAULT_LOGPREFIX, sizeof(buf)); xf86LogFile = buf; } } /* 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(enum ExitCode error) { LogClose(error); } /* * 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, k; 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 = xnfreallocarray(pgdp, i + 2, sizeof(GDevPtr)); pgdp[i++] = screensecptr->device; } for (k = 0; k < screensecptr->num_gpu_devices; k++) { if ((screensecptr->gpu_devices[k]->driver != NULL) && (xf86NameCmp(screensecptr->gpu_devices[k]->driver, drivername) == 0) && (!screensecptr->gpu_devices[k]->claimed)) { /* * we have a matching driver that wasn't claimed, yet */ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr)); pgdp[i++] = screensecptr->gpu_devices[k]; } } } /* 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 = xnfreallocarray(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; } const char * xf86GetVisualName(int visual) { if (visual < 0 || visual > DirectColor) return NULL; return xf86VisualNames[visual]; } int xf86GetVerbosity(void) { return max(xf86Verbose, xf86LogVerbose); } 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 xf86ServerIsOnlyDetecting(void) { return xf86DoConfigure; } 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; } CARD32 xf86GetModuleVersion(void *module) { return (CARD32) LoaderGetModuleVersion(module); } void * xf86LoadDrvSubModule(DriverPtr drv, const char *name) { void *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; } void * xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name) { void *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. */ void * xf86LoadOneModule(const char *name, void *opt) { int errmaj; char *Name; void *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, opt, NULL, &errmaj); if (!mod) LoaderErrorMsg(NULL, Name, errmaj, 0); free(Name); return mod; } void xf86UnloadSubModule(void *mod) { UnloadSubModule(mod); } 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 = xf86ScreenToScrn(pScreen); 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; #ifdef COMPOSITE if (from != X_CONFIG) useBS = xf86ReturnOptValBool(options, OPTION_BACKING_STORE, !noCompositeExtension); #endif } free(options); pScreen->backingStoreSupport = useBS ? WhenMapped : 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 = xf86ScreenToScrn(pScreen); 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); /* * Use silken mouse if requested and if we have threaded input */ pScrn->silkenMouse = useSM && InputThreadEnable; if (serverGeneration == 1) xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n", pScrn->silkenMouse ? "enabled" : "disabled"); } /* Wrote this function for the PM2 Xv driver, preliminary. */ void * xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, const char *port_name, const char **adaptor_name, void **adaptor_options) { 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; } static void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, EntityProc enter, EntityProc leave, void *private) { ScrnInfoPtr pScrn; if ((pScrn = xf86FindScreenForEntity(pEnt->index))) xf86RemoveEntityFromScreen(pScrn, pEnt->index); } ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, void *private) { EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); if (init || enter || leave) FatalError("Legacy entity access functions are unsupported\n"); 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); free(pEnt); return pScrn; } Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn) { int i; for (i = 0; i < pScrn->numEntities; i++) { if (xf86IsEntityPrimary(i)) return TRUE; } return FALSE; } 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); } ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen) { if (pScreen->isGPU) { assert(pScreen->myNum - GPU_SCREEN_OFFSET < xf86NumGPUScreens); return xf86GPUScreens[pScreen->myNum - GPU_SCREEN_OFFSET]; } else { assert(pScreen->myNum < xf86NumScreens); return xf86Screens[pScreen->myNum]; } } ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn) { if (pScrn->is_gpu) { assert(pScrn->scrnIndex - GPU_SCREEN_OFFSET < screenInfo.numGPUScreens); return screenInfo.gpuscreens[pScrn->scrnIndex - GPU_SCREEN_OFFSET]; } else { assert(pScrn->scrnIndex < screenInfo.numScreens); return screenInfo.screens[pScrn->scrnIndex]; } } void xf86UpdateDesktopDimensions(void) { update_desktop_dimensions(); } xorg-server-1.20.8/hw/xfree86/common/xf86xv.h0000644000175000017500000002177413640201473015540 00000000000000 /* * Copyright (c) 1998-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). */ #ifndef _XF86XV_H_ #define _XF86XV_H_ #include "xvdix.h" #include "xf86str.h" #define VIDEO_OVERLAID_IMAGES 0x00000004 #define VIDEO_OVERLAID_STILLS 0x00000008 /* * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended. * It can make reput behaviour inconsistent. */ #define VIDEO_CLIP_TO_VIEWPORT 0x00000010 typedef XvImageRec XF86ImageRec, *XF86ImagePtr; typedef struct { ScrnInfoPtr pScrn; int id; unsigned short width, height; int *pitches; /* bytes */ int *offsets; /* in bytes from start of framebuffer */ DevUnion devPrivate; } XF86SurfaceRec, *XF86SurfacePtr; typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, void *data, Bool Exit); typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute, INT32 value, void *data); typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute, INT32 *value, void *data); typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, void *data); typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int image, unsigned char *buf, short width, short height, Bool Sync, RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image, unsigned short *width, unsigned short *height, int *pitches, int *offsets); typedef enum { XV_OFF, XV_PENDING, XV_ON } XvStatus; /*** this is what the driver needs to fill out ***/ typedef struct { int id; const char *name; unsigned short width, height; XvRationalRec rate; } XF86VideoEncodingRec, *XF86VideoEncodingPtr; typedef struct { char depth; short class; } XF86VideoFormatRec, *XF86VideoFormatPtr; typedef XvAttributeRec XF86AttributeRec, *XF86AttributePtr; typedef struct { unsigned int type; int flags; const char *name; int nEncodings; XF86VideoEncodingPtr pEncodings; int nFormats; XF86VideoFormatPtr pFormats; int nPorts; DevUnion *pPortPrivates; int nAttributes; XF86AttributePtr pAttributes; int nImages; XF86ImagePtr pImages; PutVideoFuncPtr PutVideo; PutStillFuncPtr PutStill; GetVideoFuncPtr GetVideo; GetStillFuncPtr GetStill; StopVideoFuncPtr StopVideo; SetPortAttributeFuncPtr SetPortAttribute; GetPortAttributeFuncPtr GetPortAttribute; QueryBestSizeFuncPtr QueryBestSize; PutImageFuncPtr PutImage; ReputImageFuncPtr ReputImage; /* image/still */ QueryImageAttributesFuncPtr QueryImageAttributes; } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; typedef struct { XF86ImagePtr image; int flags; int (*alloc_surface) (ScrnInfoPtr pScrn, int id, unsigned short width, unsigned short height, XF86SurfacePtr surface); int (*free_surface) (XF86SurfacePtr surface); int (*display) (XF86SurfacePtr surface, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes); int (*stop) (XF86SurfacePtr surface); int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value); int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value); int max_width; int max_height; int num_attributes; XF86AttributePtr attributes; } XF86OffscreenImageRec, *XF86OffscreenImagePtr; extern _X_EXPORT Bool xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * Adaptors, int num); typedef int (*xf86XVInitGenericAdaptorPtr) (ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** Adaptors); extern _X_EXPORT int xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc); extern _X_EXPORT int xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** Adaptors); extern _X_EXPORT Bool xf86XVRegisterOffscreenImages(ScreenPtr pScreen, XF86OffscreenImagePtr images, int num); extern _X_EXPORT XF86OffscreenImagePtr xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num); extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn); extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); extern _X_EXPORT void xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); extern _X_EXPORT void xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); extern _X_EXPORT void xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key, RegionPtr clipboxes, Bool fillEverything); extern _X_EXPORT Bool xf86XVClipVideoHelper(BoxPtr dst, INT32 *xa, INT32 *xb, INT32 *ya, INT32 *yb, RegionPtr reg, INT32 width, INT32 height); extern _X_EXPORT void xf86XVCopyYUV12ToPacked(const void *srcy, const void *srcv, const void *srcu, void *dst, int srcPitchy, int srcPitchuv, int dstPitch, int h, int w); extern _X_EXPORT void xf86XVCopyPacked(const void *src, void *dst, int srcPitch, int dstPitch, int h, int w); #endif /* _XF86XV_H_ */ xorg-server-1.20.8/hw/xfree86/common/xf86InPriv.h0000644000175000017500000000322013640201473016274 00000000000000 /* * Copyright (c) 1999 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _xf86InPriv_h #define _xf86InPriv_h /* xf86Globals.c */ extern InputDriverPtr *xf86InputDriverList; extern int xf86NumInputDrivers; #endif /* _xf86InPriv_h */ xorg-server-1.20.8/hw/xfree86/common/xf86MatchDrivers.h0000644000175000017500000000275313640201473017472 00000000000000/* * Copyright © 2015 NVIDIA Corporation * * 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. */ #ifndef _xf86_match_drivers_h #define _xf86_match_drivers_h #define MATCH_DRIVERS_LIMIT 20 typedef struct _XF86MatchedDrivers { char *matches[MATCH_DRIVERS_LIMIT]; int nmatches; } XF86MatchedDrivers; /* * prototypes */ void xf86AddMatchedDriver(XF86MatchedDrivers *, const char *); #endif /* _xf86_match_drivers_h */ xorg-server-1.20.8/hw/xfree86/common/extramodes0000644000175000017500000002004113640201473016276 00000000000000// // Extra modes to include as default modes in the X server. // // $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $ // # 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync # 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync # 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync # 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync # 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz Modeline "2048x1536" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync # 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz Modeline "2048x1536" 340.48 2048 2216 2440 2832 1536 1537 1540 1603 -hsync +vsync # 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz Modeline "2048x1536" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync ### 16:9 modelines generated by cvt # 640x360 59.32 Hz (CVT 0.23M9-R) hsync: 22.19 kHz; pclk: 17.75 MHz Modeline "640x360R" 17.75 640 688 720 800 360 363 368 374 +hsync -vsync # 640x360 59.84 Hz (CVT 0.23M9) hsync: 22.50 kHz; pclk: 18.00 MHz Modeline "640x360" 18.00 640 664 720 800 360 363 368 376 -hsync +vsync # 720x405 58.99 Hz (CVT 0.29M9-R) hsync: 24.72 kHz; pclk: 21.75 MHz Modeline "720x405R" 21.75 720 768 800 880 405 408 413 419 +hsync -vsync # 720x405 59.51 Hz (CVT 0.29M9) hsync: 25.11 kHz; pclk: 22.50 MHz Modeline "720x405" 22.50 720 744 808 896 405 408 413 422 -hsync +vsync # 864x486 59.57 Hz (CVT 0.42M9-R) hsync: 29.79 kHz; pclk: 30.50 MHz Modeline "864x486R" 30.50 864 912 944 1024 486 489 494 500 +hsync -vsync # 864x486 59.92 Hz (CVT 0.42M9) hsync: 30.32 kHz; pclk: 32.50 MHz Modeline "864x486" 32.50 864 888 968 1072 486 489 494 506 -hsync +vsync # 960x540 59.82 Hz (CVT 0.52M9-R) hsync: 33.26 kHz; pclk: 37.25 MHz Modeline "960x540R" 37.25 960 1008 1040 1120 540 543 548 556 +hsync -vsync # 960x540 59.63 Hz (CVT 0.52M9) hsync: 33.51 kHz; pclk: 40.75 MHz Modeline "960x540" 40.75 960 992 1088 1216 540 543 548 562 -hsync +vsync # 1024x576 59.82 Hz (CVT 0.59M9-R) hsync: 35.47 kHz; pclk: 42.00 MHz Modeline "1024x576R" 42.00 1024 1072 1104 1184 576 579 584 593 +hsync -vsync # 1024x576 59.90 Hz (CVT 0.59M9) hsync: 35.88 kHz; pclk: 46.50 MHz Modeline "1024x576" 46.50 1024 1064 1160 1296 576 579 584 599 -hsync +vsync # 1280x720 59.74 Hz (CVT 0.92M9-R) hsync: 44.27 kHz; pclk: 63.75 MHz Modeline "1280x720R" 63.75 1280 1328 1360 1440 720 723 728 741 +hsync -vsync # 1280x720 59.86 Hz (CVT 0.92M9) hsync: 44.77 kHz; pclk: 74.50 MHz Modeline "1280x720" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync # 1368x768 59.85 Hz (CVT) hsync: 47.28 kHz; pclk: 72.25 MHz Modeline "1368x768R" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync # 1368x768 59.88 Hz (CVT) hsync: 47.79 kHz; pclk: 85.25 MHz Modeline "1368x768" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync # 1600x900 59.82 Hz (CVT 1.44M9-R) hsync: 55.40 kHz; pclk: 97.50 MHz Modeline "1600x900R" 97.50 1600 1648 1680 1760 900 903 908 926 +hsync -vsync # 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz Modeline "1600x900" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync # 1920x1080 59.93 Hz (CVT 2.07M9-R) hsync: 66.59 kHz; pclk: 138.50 MHz Modeline "1920x1080R" 138.50 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync # 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync # 2048x1152 59.91 Hz (CVT 2.36M9-R) hsync: 70.99 kHz; pclk: 156.75 MHz Modeline "2048x1152R" 156.75 2048 2096 2128 2208 1152 1155 1160 1185 +hsync -vsync # 2048x1152 59.90 Hz (CVT 2.36M9) hsync: 71.58 kHz; pclk: 197.00 MHz Modeline "2048x1152" 197.00 2048 2184 2400 2752 1152 1155 1160 1195 -hsync +vsync # 2560x1440 59.95 Hz (CVT 3.69M9-R) hsync: 88.79 kHz; pclk: 241.50 MHz Modeline "2560x1440R" 241.50 2560 2608 2640 2720 1440 1443 1448 1481 +hsync -vsync # 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz Modeline "2560x1440" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync # 2880x1620 59.97 Hz (CVT 4.67M9-R) hsync: 99.92 kHz; pclk: 303.75 MHz Modeline "2880x1620R" 303.75 2880 2928 2960 3040 1620 1623 1628 1666 +hsync -vsync # 2880x1620 59.96 Hz (CVT 4.67M9) hsync: 100.67 kHz; pclk: 396.25 MHz Modeline "2880x1620" 396.25 2880 3096 3408 3936 1620 1623 1628 1679 -hsync +vsync # 3200x1800 59.94 Hz (CVT 5.76M9-R) hsync: 111.01 kHz; pclk: 373.00 MHz Modeline "3200x1800R" 373.00 3200 3248 3280 3360 1800 1803 1808 1852 +hsync -vsync # 3200x1800 59.96 Hz (CVT 5.76M9) hsync: 111.82 kHz; pclk: 492.00 MHz Modeline "3200x1800" 492.00 3200 3456 3800 4400 1800 1803 1808 1865 -hsync +vsync # 3840x2160 59.97 Hz (CVT 8.29M9-R) hsync: 133.25 kHz; pclk: 533.00 MHz Modeline "3840x2160R" 533.00 3840 3888 3920 4000 2160 2163 2168 2222 +hsync -vsync # 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz Modeline "3840x2160" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync # 4096x2304 59.98 Hz (CVT 9.44M9-R) hsync: 142.15 kHz; pclk: 605.00 MHz Modeline "4096x2304R" 605.00 4096 4144 4176 4256 2304 2307 2312 2370 +hsync -vsync # 4096x2304 59.99 Hz (CVT 9.44M9) hsync: 143.13 kHz; pclk: 813.00 MHz Modeline "4096x2304" 813.00 4096 4440 4888 5680 2304 2307 2312 2386 -hsync +vsync # 5120x2880 59.99 Hz (CVT 14.75M9-R) hsync: 177.70 kHz; pclk: 938.25 MHz Modeline "5120x2880R" 938.25 5120 5168 5200 5280 2880 2883 2888 2962 +hsync -vsync # 5120x2880 59.99 Hz (CVT 14.75M9) hsync: 178.88 kHz; pclk: 1276.50 MHz Modeline "5120x2880" 1276.50 5120 5560 6128 7136 2880 2883 2888 2982 -hsync +vsync # 7680x4320 59.99 Hz (CVT 33.18M9-R) hsync: 266.55 kHz; pclk: 2089.75 MHz Modeline "7680x4320R" 2089.75 7680 7728 7760 7840 4320 4323 4328 4443 +hsync -vsync # 7680x4320 59.99 Hz (CVT 33.18M9) hsync: 268.22 kHz; pclk: 2892.50 MHz Modeline "7680x4320" 2892.50 7680 8376 9232 10784 4320 4323 4328 4471 -hsync +vsync # 15360x8640 59.99 Hz (CVT 132.71M9-R) hsync: 533.10 kHz; pclk: 8273.75 MHz Modeline "15360x8640R" 8273.75 15360 15408 15440 15520 8640 8643 8648 8886 +hsync -vsync # 15360x8640 60.00 Hz (CVT 132.71M9) hsync: 536.27 kHz; pclk: 11669.25 MHz Modeline "15360x8640" 11669.25 15360 16824 18560 21760 8640 8643 8648 8938 -hsync +vsync ## 16:10 modelines generated by cvt # 1280x800 59.91 Hz (CVT 1.02MA-R) hsync: 49.31 kHz; pclk: 71.00 MHz Modeline "1280x800R" 71.00 1280 1328 1360 1440 800 803 809 823 +hsync -vsync # 1280x800 59.81 Hz (CVT 1.02MA) hsync: 49.70 kHz; pclk: 83.50 MHz Modeline "1280x800" 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync # 1400x900 59.88 Hz (CVT) hsync: 55.45 kHz; pclk: 86.50 MHz Modeline "1400x900R" 86.50 1400 1448 1480 1560 900 903 913 926 +hsync -vsync # 1400x900 59.96 Hz (CVT) hsync: 56.01 kHz; pclk: 103.50 MHz Modeline "1400x900" 103.50 1400 1480 1624 1848 900 903 913 934 -hsync +vsync # 1680x1050 59.88 Hz (CVT 1.76MA-R) hsync: 64.67 kHz; pclk: 119.00 MHz Modeline "1680x1050R" 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz Modeline "1680x1050" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync # 1920x1200 59.95 Hz (CVT 2.30MA-R) hsync: 74.04 kHz; pclk: 154.00 MHz Modeline "1920x1200R" 154.00 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync # 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz Modeline "1920x1200" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync # 2560x1600 59.97 Hz (CVT 4.10MA-R) hsync: 98.71 kHz; pclk: 268.50 MHz Modeline "2560x1600R" 268.50 2560 2608 2640 2720 1600 1603 1609 1646 +hsync -vsync # 2560x1600 59.99 Hz (CVT 4.10MA) hsync: 99.46 kHz; pclk: 348.50 MHz Modeline "2560x1600" 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync xorg-server-1.20.8/hw/xfree86/common/meson.build0000644000175000017500000000367213640201473016355 00000000000000srcs_xorg_common = [ 'xf86fbBus.c', 'xf86noBus.c', 'xf86Configure.c', 'xf86Bus.c', 'xf86Config.c', 'xf86Cursor.c', 'xf86DPMS.c', 'xf86Events.c', 'xf86Globals.c', 'xf86AutoConfig.c', 'xf86Option.c', 'xf86Init.c', 'xf86VidMode.c', 'xf86fbman.c', 'xf86cmap.c', 'xf86Helper.c', 'xf86PM.c', 'xf86RandR.c', 'xf86Xinput.c', 'xisb.c', 'xf86Mode.c', 'xorgHelper.c', 'xf86Extensions.c', ] xorg_sdk_headers = [ 'compiler.h', 'fourcc.h', 'xf86.h', 'xf86Module.h', 'xf86Opt.h', 'xf86PciInfo.h', 'xf86Priv.h', 'xf86Privstr.h', 'xf86cmap.h', 'xf86fbman.h', 'xf86str.h', 'xf86Xinput.h', 'xisb.h', 'xorgVersion.h', 'xf86sbusBus.h', 'xf86VGAarbiter.h', 'xf86Optionstr.h', 'xf86platformBus.h', 'xf86MatchDrivers.h', 'xaarop.h', ] if build_dga srcs_xorg_common += 'xf86DGA.c' xorg_sdk_headers += 'dgaproc.h' endif if build_xv srcs_xorg_common += ['xf86xv.c', 'xf86xvmc.c'] xorg_sdk_headers += ['xf86xv.h', 'xf86xvmc.h', 'xf86xvpriv.h'] endif if build_udev srcs_xorg_common += 'xf86platformBus.c' endif if get_option('pciaccess') srcs_xorg_common += ['xf86pciBus.c', 'xf86VGAarbiter.c'] endif srcs_xorg_common += configure_file( output: 'xf86Build.h', command: ['sh', join_paths(meson.current_source_dir(), 'xf86Build.sh'), '@OUTPUT@'], ) srcs_xorg_common += custom_target( 'xf86DefModeSet.c', output: 'xf86DefModeSet.c', input: ['modeline2c.awk', 'vesamodes', 'extramodes'], command: [find_program('awk'), '-f', '@INPUT0@', '@INPUT1@', '@INPUT2@'], capture: true, ) xorg_common = static_library('xorg_common', srcs_xorg_common, include_directories: [inc, xorg_inc], dependencies: [ common_dep, dbus_dep, pciaccess_dep, libdrm_dep, ], c_args: xorg_c_args, ) install_data(xorg_sdk_headers, install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/common/xf86Configure.c0000644000175000017500000006737513640201473017026 00000000000000/* * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales. * * 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 Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE 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: Alan Hourihane, alanh@fairlite.demon.co.uk * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86Config.h" #include "xf86_OSlib.h" #include "xf86Priv.h" #define IN_XSERVER #include "Configint.h" #include "xf86DDC.h" #include "xf86pciBus.h" #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) #include "xf86Bus.h" #include "xf86Sbus.h" #endif #include "misc.h" #include "loaderProcs.h" typedef struct _DevToConfig { GDevRec GDev; struct pci_device *pVideo; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) sbusDevicePtr sVideo; #endif int iDriver; } DevToConfigRec, *DevToConfigPtr; static DevToConfigPtr DevToConfig = NULL; static int nDevToConfig = 0, CurrentDriver; xf86MonPtr ConfiguredMonitor; Bool xf86DoConfigurePass1 = TRUE; static Bool foundMouse = FALSE; #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) static const char *DFLT_MOUSE_DEV = "/dev/sysmouse"; static const char *DFLT_MOUSE_PROTO = "auto"; #elif defined(__linux__) static const char *DFLT_MOUSE_DEV = "/dev/input/mice"; static const char *DFLT_MOUSE_PROTO = "auto"; #elif defined(WSCONS_SUPPORT) static const char *DFLT_MOUSE_DEV = "/dev/wsmouse"; static const char *DFLT_MOUSE_PROTO = "wsmouse"; #else static const char *DFLT_MOUSE_DEV = "/dev/mouse"; static const char *DFLT_MOUSE_PROTO = "auto"; #endif /* * This is called by the driver, either through xf86Match???Instances() or * directly. We allocate a GDevRec and fill it in as much as we can, letting * the caller fill in the rest and/or change it as it sees fit. */ GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset) { int ret, i, j; char *lower_driver; if (!xf86DoConfigure || !xf86DoConfigurePass1) return NULL; /* Check for duplicates */ for (i = 0; i < nDevToConfig; i++) { switch (bus) { #ifdef XSERVER_LIBPCIACCESS case BUS_PCI: ret = xf86PciConfigure(busData, DevToConfig[i].pVideo); break; #endif #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo); break; #endif default: return NULL; } if (ret == 0) goto out; } /* Allocate new structure occurrence */ i = nDevToConfig++; DevToConfig = xnfreallocarray(DevToConfig, nDevToConfig, sizeof(DevToConfigRec)); memset(DevToConfig + i, 0, sizeof(DevToConfigRec)); DevToConfig[i].GDev.chipID = DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1; DevToConfig[i].iDriver = CurrentDriver; /* Fill in what we know, converting the driver name to lower case */ lower_driver = xnfalloc(strlen(driver) + 1); for (j = 0; (lower_driver[j] = tolower(driver[j])); j++); DevToConfig[i].GDev.driver = lower_driver; switch (bus) { #ifdef XSERVER_LIBPCIACCESS case BUS_PCI: DevToConfig[i].pVideo = busData; xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo, &DevToConfig[i].GDev, &chipset); break; #endif #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: DevToConfig[i].sVideo = busData; xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo, &DevToConfig[i].GDev); break; #endif default: break; } /* Get driver's available options */ if (xf86DriverList[CurrentDriver]->AvailableOptions) DevToConfig[i].GDev.options = (OptionInfoPtr) (*xf86DriverList[CurrentDriver]->AvailableOptions) (chipset, bus); return &DevToConfig[i].GDev; out: return NULL; } static XF86ConfInputPtr configureInputSection(void) { XF86ConfInputPtr mouse = NULL; parsePrologue(XF86ConfInputPtr, XF86ConfInputRec); ptr->inp_identifier = xnfstrdup("Keyboard0"); ptr->inp_driver = xnfstrdup("kbd"); ptr->list.next = NULL; /* Crude mechanism to auto-detect mouse (os dependent) */ { int fd; fd = open(DFLT_MOUSE_DEV, 0); if (fd != -1) { foundMouse = TRUE; close(fd); } } mouse = calloc(1, sizeof(XF86ConfInputRec)); mouse->inp_identifier = xnfstrdup("Mouse0"); mouse->inp_driver = xnfstrdup("mouse"); mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Protocol"), xnfstrdup(DFLT_MOUSE_PROTO)); mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Device"), xnfstrdup(DFLT_MOUSE_DEV)); mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, xnfstrdup("ZAxisMapping"), xnfstrdup("4 5 6 7")); ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse); return ptr; } static XF86ConfScreenPtr configureScreenSection(int screennum) { int i; int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */ }; char *tmp; parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec); XNFasprintf(&tmp, "Screen%d", screennum); ptr->scrn_identifier = tmp; XNFasprintf(&tmp, "Monitor%d", screennum); ptr->scrn_monitor_str = tmp; XNFasprintf(&tmp, "Card%d", screennum); ptr->scrn_device_str = tmp; for (i = 0; i < ARRAY_SIZE(depths); i++) { XF86ConfDisplayPtr conf_display; conf_display = calloc(1, sizeof(XF86ConfDisplayRec)); conf_display->disp_depth = depths[i]; conf_display->disp_black.red = conf_display->disp_white.red = -1; conf_display->disp_black.green = conf_display->disp_white.green = -1; conf_display->disp_black.blue = conf_display->disp_white.blue = -1; ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr-> scrn_display_lst, (glp) conf_display); } return ptr; } static const char * optionTypeToString(OptionValueType type) { switch (type) { case OPTV_NONE: return ""; case OPTV_INTEGER: return ""; case OPTV_STRING: return ""; case OPTV_ANYSTR: return "[]"; case OPTV_REAL: return ""; case OPTV_BOOLEAN: return "[]"; case OPTV_FREQ: return ""; case OPTV_PERCENT: return ""; default: return ""; } } static XF86ConfDevicePtr configureDeviceSection(int screennum) { OptionInfoPtr p; int i = 0; char *identifier; parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec); /* Move device info to parser structure */ if (asprintf(&identifier, "Card%d", screennum) == -1) identifier = NULL; ptr->dev_identifier = identifier; ptr->dev_chipset = DevToConfig[screennum].GDev.chipset; ptr->dev_busid = DevToConfig[screennum].GDev.busID; ptr->dev_driver = DevToConfig[screennum].GDev.driver; ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac; for (i = 0; i < MAXDACSPEEDS; i++) ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i]; ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam; ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase; ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase; ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip; for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++) ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i]; ptr->dev_clocks = i; ptr->dev_chipid = DevToConfig[screennum].GDev.chipID; ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev; ptr->dev_irq = DevToConfig[screennum].GDev.irq; /* Make sure older drivers don't segv */ if (DevToConfig[screennum].GDev.options) { /* Fill in the available driver options for people to use */ const char *descrip = " ### Available Driver options are:-\n" " ### Values: : integer, : float, " ": \"True\"/\"False\",\n" " ### : \"String\", : \" Hz/kHz/MHz\",\n" " ### : \"%\"\n" " ### [arg]: arg optional\n"; ptr->dev_comment = xnfstrdup(descrip); if (ptr->dev_comment) { for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { char *p_e; const char *prefix = " #Option "; const char *middle = " \t# "; const char *suffix = "\n"; const char *opttype = optionTypeToString(p->type); char *optname; int len = strlen(ptr->dev_comment) + strlen(prefix) + strlen(middle) + strlen(suffix) + 1; if (asprintf(&optname, "\"%s\"", p->name) == -1) break; len += max(20, strlen(optname)); len += strlen(opttype); ptr->dev_comment = realloc(ptr->dev_comment, len); if (!ptr->dev_comment) break; p_e = ptr->dev_comment + strlen(ptr->dev_comment); sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, opttype, suffix); free(optname); } } } return ptr; } static XF86ConfLayoutPtr configureLayoutSection(void) { int scrnum = 0; parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec); ptr->lay_identifier = "X.org Configured"; { XF86ConfInputrefPtr iptr; iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; iptr->iref_inputdev_str = xnfstrdup("Mouse0"); iptr->iref_option_lst = xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CorePointer"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); } { XF86ConfInputrefPtr iptr; iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; iptr->iref_inputdev_str = xnfstrdup("Keyboard0"); iptr->iref_option_lst = xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CoreKeyboard"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); } for (scrnum = 0; scrnum < nDevToConfig; scrnum++) { XF86ConfAdjacencyPtr aptr; char *tmp; aptr = malloc(sizeof(XF86ConfAdjacencyRec)); aptr->list.next = NULL; aptr->adj_x = 0; aptr->adj_y = 0; aptr->adj_scrnum = scrnum; XNFasprintf(&tmp, "Screen%d", scrnum); aptr->adj_screen_str = tmp; if (scrnum == 0) { aptr->adj_where = CONF_ADJ_ABSOLUTE; aptr->adj_refscreen = NULL; } else { aptr->adj_where = CONF_ADJ_RIGHTOF; XNFasprintf(&tmp, "Screen%d", scrnum - 1); aptr->adj_refscreen = tmp; } ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst, (glp) aptr); } return ptr; } static XF86ConfFlagsPtr configureFlagsSection(void) { parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec); return ptr; } static XF86ConfModulePtr configureModuleSection(void) { const char **elist, **el; parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec); elist = LoaderListDir("extensions", NULL); if (elist) { for (el = elist; *el; el++) { XF86LoadPtr module; module = calloc(1, sizeof(XF86LoadRec)); module->load_name = *el; ptr->mod_load_lst = (XF86LoadPtr) xf86addListItem((glp) ptr-> mod_load_lst, (glp) module); } free(elist); } return ptr; } static XF86ConfFilesPtr configureFilesSection(void) { parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec); if (xf86ModulePath) ptr->file_modulepath = xnfstrdup(xf86ModulePath); if (defaultFontPath) ptr->file_fontpath = xnfstrdup(defaultFontPath); return ptr; } static XF86ConfMonitorPtr configureMonitorSection(int screennum) { char *tmp; parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec); XNFasprintf(&tmp, "Monitor%d", screennum); ptr->mon_identifier = tmp; ptr->mon_vendor = xnfstrdup("Monitor Vendor"); ptr->mon_modelname = xnfstrdup("Monitor Model"); return ptr; } /* Initialize Configure Monitor from Detailed Timing Block */ static void handle_detailed_input(struct detailed_monitor_section *det_mon, void *data) { XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data; switch (det_mon->type) { case DS_NAME: ptr->mon_modelname = realloc(ptr->mon_modelname, strlen((char *) (det_mon->section.name)) + 1); strcpy(ptr->mon_modelname, (char *) (det_mon->section.name)); break; case DS_RANGES: ptr->mon_hsync[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_h; ptr->mon_hsync[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_h; ptr->mon_n_vrefresh = 1; ptr->mon_vrefresh[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_v; ptr->mon_vrefresh[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_v; ptr->mon_n_hsync++; default: break; } } static XF86ConfMonitorPtr configureDDCMonitorSection(int screennum) { int len, mon_width, mon_height; #define displaySizeMaxLen 80 char displaySize_string[displaySizeMaxLen]; int displaySizeLen; char *tmp; parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec); XNFasprintf(&tmp, "Monitor%d", screennum); ptr->mon_identifier = tmp; ptr->mon_vendor = xnfstrdup(ConfiguredMonitor->vendor.name); XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); /* features in centimetres, we want millimetres */ mon_width = 10 * ConfiguredMonitor->features.hsize; mon_height = 10 * ConfiguredMonitor->features.vsize; #ifdef CONFIGURE_DISPLAYSIZE ptr->mon_width = mon_width; ptr->mon_height = mon_height; #else if (mon_width && mon_height) { /* when values available add DisplaySize option AS A COMMENT */ displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen, "\t#DisplaySize\t%5d %5d\t# mm\n", mon_width, mon_height); if (displaySizeLen > 0 && displaySizeLen < displaySizeMaxLen) { if (ptr->mon_comment) { len = strlen(ptr->mon_comment); } else { len = 0; } if ((ptr->mon_comment = realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) { strcpy(ptr->mon_comment + len, displaySize_string); } } } #endif /* def CONFIGURE_DISPLAYSIZE */ xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input, ptr); if (ConfiguredMonitor->features.dpms) { ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, xnfstrdup("DPMS"), NULL); } return ptr; } static int is_fallback(const char *s) { /* later entries are less preferred */ const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL }; int i; for (i = 0; fallback[i]; i++) if (strstr(s, fallback[i])) return i; return -1; } static int driver_sort(const void *_l, const void *_r) { const char *l = *(const char **)_l; const char *r = *(const char **)_r; int left = is_fallback(l); int right = is_fallback(r); /* neither is a fallback, asciibetize */ if (left == -1 && right == -1) return strcmp(l, r); /* left is a fallback, right is not */ if (left >= 0 && right == -1) return 1; /* right is a fallback, left is not */ if (right >= 0 && left == -1) return -1; /* both are fallbacks, decide which is worse */ return left - right; } static void fixup_video_driver_list(const char **drivers) { const char **end; /* walk to the end of the list */ for (end = drivers; *end && **end; end++); qsort(drivers, end - drivers, sizeof(const char *), driver_sort); } static const char ** GenerateDriverList(void) { const char **ret; static const char *patlist[] = { "(.*)_drv\\.so", NULL }; ret = LoaderListDir("drivers", patlist); /* fix up the probe order for video drivers */ if (ret != NULL) fixup_video_driver_list(ret); return ret; } void DoConfigure(void) { int i, j, screennum = -1; const char *home = NULL; char filename[PATH_MAX]; const char *addslash = ""; XF86ConfigPtr xf86config = NULL; const char **vlist, **vl; int *dev2screen; vlist = GenerateDriverList(); if (!vlist) { ErrorF("Missing output drivers. Configuration failed.\n"); goto bail; } ErrorF("List of video drivers:\n"); for (vl = vlist; *vl; vl++) ErrorF("\t%s\n", *vl); /* Load all the drivers that were found. */ xf86LoadModules(vlist, NULL); free(vlist); xorgHWAccess = xf86EnableIO(); /* Create XF86Config file structure */ xf86config = calloc(1, sizeof(XF86ConfigRec)); /* Call all of the probe functions, reporting the results. */ for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) { Bool found_screen; DriverRec *const drv = xf86DriverList[CurrentDriver]; found_screen = xf86CallDriverProbe(drv, TRUE); if (found_screen && drv->Identify) { (*drv->Identify) (0); } } if (nDevToConfig <= 0) { ErrorF("No devices to configure. Configuration failed.\n"); goto bail; } /* Add device, monitor and screen sections for detected devices */ for (screennum = 0; screennum < nDevToConfig; screennum++) { XF86ConfDevicePtr device_ptr; XF86ConfMonitorPtr monitor_ptr; XF86ConfScreenPtr screen_ptr; device_ptr = configureDeviceSection(screennum); xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp) xf86config-> conf_device_lst, (glp) device_ptr); monitor_ptr = configureMonitorSection(screennum); xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr); screen_ptr = configureScreenSection(screennum); xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) xf86config-> conf_screen_lst, (glp) screen_ptr); } xf86config->conf_files = configureFilesSection(); xf86config->conf_modules = configureModuleSection(); xf86config->conf_flags = configureFlagsSection(); xf86config->conf_videoadaptor_lst = NULL; xf86config->conf_modes_lst = NULL; xf86config->conf_vendor_lst = NULL; xf86config->conf_dri = NULL; xf86config->conf_input_lst = configureInputSection(); xf86config->conf_layout_lst = configureLayoutSection(); home = getenv("HOME"); if ((home == NULL) || (home[0] == '\0')) { home = "/"; } else { /* Determine if trailing slash is present or needed */ int l = strlen(home); if (home[l - 1] != '/') { addslash = "/"; } } snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new", home, addslash); if (xf86writeConfigFile(filename, xf86config) == 0) { xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", filename, strerror(errno)); goto bail; } xf86DoConfigurePass1 = FALSE; /* Try to get DDC information filled in */ xf86ConfigFile = filename; if (xf86HandleConfigFile(FALSE) != CONFIG_OK) { goto bail; } xf86DoConfigurePass1 = FALSE; dev2screen = xnfcalloc(nDevToConfig, sizeof(int)); { Bool *driverProbed = xnfcalloc(xf86NumDrivers, sizeof(Bool)); for (screennum = 0; screennum < nDevToConfig; screennum++) { int k, l, n, oldNumScreens; i = DevToConfig[screennum].iDriver; if (driverProbed[i]) continue; driverProbed[i] = TRUE; oldNumScreens = xf86NumScreens; xf86CallDriverProbe(xf86DriverList[i], FALSE); /* reorder */ k = screennum > 0 ? screennum : 1; for (l = oldNumScreens; l < xf86NumScreens; l++) { /* is screen primary? */ Bool primary = FALSE; for (n = 0; n < xf86Screens[l]->numEntities; n++) { if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) { dev2screen[0] = l; primary = TRUE; break; } } if (primary) continue; /* not primary: assign it to next device of same driver */ /* * NOTE: we assume that devices in DevToConfig * and xf86Screens[] have the same order except * for the primary device which always comes first. */ for (; k < nDevToConfig; k++) { if (DevToConfig[k].iDriver == i) { dev2screen[k++] = l; break; } } } } free(driverProbed); } if (nDevToConfig != xf86NumScreens) { ErrorF("Number of created screens does not match number of detected" " devices.\n Configuration failed.\n"); goto bail; } xf86PostProbe(); for (j = 0; j < xf86NumScreens; j++) { xf86Screens[j]->scrnIndex = j; } xf86freeMonitorList(xf86config->conf_monitor_lst); xf86config->conf_monitor_lst = NULL; xf86freeScreenList(xf86config->conf_screen_lst); xf86config->conf_screen_lst = NULL; for (j = 0; j < xf86NumScreens; j++) { XF86ConfMonitorPtr monitor_ptr; XF86ConfScreenPtr screen_ptr; ConfiguredMonitor = NULL; if ((*xf86Screens[dev2screen[j]]->PreInit) && (*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]], PROBE_DETECT) && ConfiguredMonitor) { monitor_ptr = configureDDCMonitorSection(j); } else { monitor_ptr = configureMonitorSection(j); } screen_ptr = configureScreenSection(j); xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr); xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) xf86config-> conf_screen_lst, (glp) screen_ptr); } if (xf86writeConfigFile(filename, xf86config) == 0) { xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", filename, strerror(errno)); goto bail; } ErrorF("\n"); if (!foundMouse) { ErrorF("\n" __XSERVERNAME__ " is not able to detect your mouse.\n" "Edit the file and correct the Device.\n"); } else { ErrorF("\n" __XSERVERNAME__ " detected your mouse at device %s.\n" "Please check your config if the mouse is still not\n" "operational, as by default " __XSERVERNAME__ " tries to autodetect\n" "the protocol.\n", DFLT_MOUSE_DEV); } if (xf86NumScreens > 1) { ErrorF("\n" __XSERVERNAME__ " has configured a multihead system, please check your config.\n"); } ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE, filename); ErrorF("To test the server, run 'X -config %s'\n\n", filename); bail: OsCleanup(TRUE); AbortDDX(EXIT_ERR_CONFIGURE); fflush(stderr); exit(0); } /* Xorg -showopts: * For each driver module installed, print out the list * of options and their argument types, then exit * * Author: Marcus Schaefer, ms@suse.de */ void DoShowOptions(void) { int i = 0; const char **vlist = NULL; char *pSymbol = 0; XF86ModuleData *initData = 0; if (!(vlist = GenerateDriverList())) { ErrorF("Missing output drivers\n"); goto bail; } xf86LoadModules(vlist, 0); free(vlist); for (i = 0; i < xf86NumDrivers; i++) { if (xf86DriverList[i]->AvailableOptions) { const OptionInfoRec *pOption = (*xf86DriverList[i]->AvailableOptions) (0, 0); if (!pOption) { ErrorF("(EE) Couldn't read option table for %s driver\n", xf86DriverList[i]->driverName); continue; } XNFasprintf(&pSymbol, "%sModuleData", xf86DriverList[i]->driverName); initData = LoaderSymbol(pSymbol); if (initData) { XF86ModuleVersionInfo *vers = initData->vers; const OptionInfoRec *p; ErrorF("Driver[%d]:%s[%s] {\n", i, xf86DriverList[i]->driverName, vers->vendor); for (p = pOption; p->name != NULL; p++) { ErrorF("\t%s:%s\n", p->name, optionTypeToString(p->type)); } ErrorF("}\n"); } } } bail: OsCleanup(TRUE); AbortDDX(EXIT_ERR_DRIVERS); fflush(stderr); exit(0); } xorg-server-1.20.8/hw/xfree86/common/xf86Cursor.c0000644000175000017500000006232313640201473016346 00000000000000/* * Copyright (c) 1994-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). */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "input.h" #include "cursor.h" #include "mipointer.h" #include "scrnintstr.h" #include "globals.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSproc.h" #include #include "xf86Xinput.h" #ifdef XFreeXDGA #include "dgaproc.h" #endif typedef struct _xf86EdgeRec { short screen; short start; short end; DDXPointRec offset; struct _xf86EdgeRec *next; } xf86EdgeRec, *xf86EdgePtr; typedef struct { xf86EdgePtr left, right, up, down; } xf86ScreenLayoutRec, *xf86ScreenLayoutPtr; static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static void xf86PointerMoved(ScrnInfoPtr pScrn, int x, int y); static miPointerScreenFuncRec xf86PointerScreenFuncs = { xf86CursorOffScreen, xf86CrossScreen, xf86WarpCursor, }; static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS]; /* * xf86InitViewport -- * Initialize paning & zooming parameters, so that a driver must only * check what resolutions are possible and whether the virtual area * is valid if specified. */ void xf86InitViewport(ScrnInfoPtr pScr) { pScr->PointerMoved = xf86PointerMoved; /* * Compute the initial Viewport if necessary */ if (pScr->display) { if (pScr->display->frameX0 < 0) { pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2; pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2; } else { pScr->frameX0 = pScr->display->frameX0; pScr->frameY0 = pScr->display->frameY0; } } pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; /* * Now adjust the initial Viewport, so it lies within the virtual area */ if (pScr->frameX1 >= pScr->virtualX) { pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay; pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; } if (pScr->frameY1 >= pScr->virtualY) { pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay; pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; } } /* * xf86SetViewport -- * Scroll the visual part of the screen so the pointer is visible. */ void xf86SetViewport(ScreenPtr pScreen, int x, int y) { ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); (*pScr->PointerMoved) (pScr, x, y); } static void xf86PointerMoved(ScrnInfoPtr pScr, int x, int y) { Bool frameChanged = FALSE; /* * check wether (x,y) belongs to the visual part of the screen * if not, change the base of the displayed frame accoring */ if (pScr->frameX0 > x) { pScr->frameX0 = x; pScr->frameX1 = x + pScr->currentMode->HDisplay - 1; frameChanged = TRUE; } if (pScr->frameX1 < x) { pScr->frameX1 = x + 1; pScr->frameX0 = x - pScr->currentMode->HDisplay + 1; frameChanged = TRUE; } if (pScr->frameY0 > y) { pScr->frameY0 = y; pScr->frameY1 = y + pScr->currentMode->VDisplay - 1; frameChanged = TRUE; } if (pScr->frameY1 < y) { pScr->frameY1 = y; pScr->frameY0 = y - pScr->currentMode->VDisplay + 1; frameChanged = TRUE; } if (frameChanged && pScr->AdjustFrame != NULL) pScr->AdjustFrame(pScr, pScr->frameX0, pScr->frameY0); } /* * xf86LockZoom -- * Enable/disable ZoomViewport */ void xf86LockZoom(ScreenPtr pScreen, Bool lock) { ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); pScr->zoomLocked = lock; } /* * xf86SwitchMode -- * This is called by both keyboard processing and the VidMode extension to * set a new mode. */ Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); ScreenPtr pCursorScreen; Bool Switched; int px, py; DeviceIntPtr dev, it; if (!pScr->vtSema || !mode || !pScr->SwitchMode) return FALSE; #ifdef XFreeXDGA if (DGAActive(pScr->scrnIndex)) return FALSE; #endif if (mode == pScr->currentMode) return TRUE; if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY) return FALSE; /* Let's take an educated guess for which pointer to take here. And about as educated as it gets is to take the first pointer we find. */ for (dev = inputInfo.devices; dev; dev = dev->next) { if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner) break; } pCursorScreen = miPointerGetScreen(dev); if (pScreen == pCursorScreen) miPointerGetPosition(dev, &px, &py); input_lock(); Switched = (*pScr->SwitchMode) (pScr, mode); if (Switched) { pScr->currentMode = mode; /* * Adjust frame for new display size. * Frame is centered around cursor position if cursor is on same screen. */ if (pScreen == pCursorScreen) pScr->frameX0 = px - (mode->HDisplay / 2) + 1; else pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2; if (pScr->frameX0 < 0) pScr->frameX0 = 0; pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1; if (pScr->frameX1 >= pScr->virtualX) { pScr->frameX0 = pScr->virtualX - mode->HDisplay; pScr->frameX1 = pScr->virtualX - 1; } if (pScreen == pCursorScreen) pScr->frameY0 = py - (mode->VDisplay / 2) + 1; else pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2; if (pScr->frameY0 < 0) pScr->frameY0 = 0; pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1; if (pScr->frameY1 >= pScr->virtualY) { pScr->frameY0 = pScr->virtualY - mode->VDisplay; pScr->frameY1 = pScr->virtualY - 1; } } input_unlock(); if (pScr->AdjustFrame) (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0); /* The original code centered the frame around the cursor if possible. * Since this is hard to achieve with multiple cursors, we do the following: * - center around the first pointer * - move all other pointers to the nearest edge on the screen (or leave * them unmodified if they are within the boundaries). */ if (pScreen == pCursorScreen) { xf86WarpCursor(dev, pScreen, px, py); } for (it = inputInfo.devices; it; it = it->next) { if (it == dev) continue; if (IsPointerDevice(it) && it->spriteInfo->spriteOwner) { pCursorScreen = miPointerGetScreen(it); if (pScreen == pCursorScreen) { miPointerGetPosition(it, &px, &py); if (px < pScr->frameX0) px = pScr->frameX0; else if (px > pScr->frameX1) px = pScr->frameX1; if (py < pScr->frameY0) py = pScr->frameY0; else if (py > pScr->frameY1) py = pScr->frameY1; xf86WarpCursor(it, pScreen, px, py); } } } return Switched; } /* * xf86ZoomViewport -- * Reinitialize the visual part of the screen for another mode. */ void xf86ZoomViewport(ScreenPtr pScreen, int zoom) { ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); DisplayModePtr mode; if (pScr->zoomLocked || !(mode = pScr->currentMode)) return; do { if (zoom > 0) mode = mode->next; else mode = mode->prev; } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF)); (void) xf86SwitchMode(pScreen, mode); } static xf86EdgePtr FindEdge(xf86EdgePtr edge, int val) { while (edge && (edge->end <= val)) edge = edge->next; if (edge && (edge->start <= val)) return edge; return NULL; } /* * xf86CursorOffScreen -- * Check whether it is necessary to switch to another screen */ static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y) { xf86EdgePtr edge; int tmp; if (screenInfo.numScreens == 1) return FALSE; if (*x < 0) { tmp = *y; if (tmp < 0) tmp = 0; if (tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1; if ((edge = xf86ScreenLayout[(*pScreen)->myNum].left)) edge = FindEdge(edge, tmp); if (!edge) *x = 0; else { *x += edge->offset.x; *y += edge->offset.y; *pScreen = xf86Screens[edge->screen]->pScreen; } } if (*x >= (*pScreen)->width) { tmp = *y; if (tmp < 0) tmp = 0; if (tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1; if ((edge = xf86ScreenLayout[(*pScreen)->myNum].right)) edge = FindEdge(edge, tmp); if (!edge) *x = (*pScreen)->width - 1; else { *x += edge->offset.x; *y += edge->offset.y; *pScreen = xf86Screens[edge->screen]->pScreen; } } if (*y < 0) { tmp = *x; if (tmp < 0) tmp = 0; if (tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1; if ((edge = xf86ScreenLayout[(*pScreen)->myNum].up)) edge = FindEdge(edge, tmp); if (!edge) *y = 0; else { *x += edge->offset.x; *y += edge->offset.y; *pScreen = xf86Screens[edge->screen]->pScreen; } } if (*y >= (*pScreen)->height) { tmp = *x; if (tmp < 0) tmp = 0; if (tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1; if ((edge = xf86ScreenLayout[(*pScreen)->myNum].down)) edge = FindEdge(edge, tmp); if (!edge) *y = (*pScreen)->height - 1; else { *x += edge->offset.x; *y += edge->offset.y; (*pScreen) = xf86Screens[edge->screen]->pScreen; } } return TRUE; } /* * xf86CrossScreen -- * Switch to another screen * * Currently nothing special happens, but mi assumes the CrossScreen * method exists. */ static void xf86CrossScreen(ScreenPtr pScreen, Bool entering) { } /* * xf86WarpCursor -- * Warp possible to another screen */ /* ARGSUSED */ static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { input_lock(); miPointerWarpCursor(pDev, pScreen, x, y); xf86Info.currentScreen = pScreen; input_unlock(); } void * xf86GetPointerScreenFuncs(void) { return (void *) &xf86PointerScreenFuncs; } static xf86EdgePtr AddEdge(xf86EdgePtr edge, short min, short max, short dx, short dy, short screen) { xf86EdgePtr pEdge = edge, pPrev = NULL, pNew; while (1) { while (pEdge && (min >= pEdge->end)) { pPrev = pEdge; pEdge = pEdge->next; } if (!pEdge) { if (!(pNew = malloc(sizeof(xf86EdgeRec)))) break; pNew->screen = screen; pNew->start = min; pNew->end = max; pNew->offset.x = dx; pNew->offset.y = dy; pNew->next = NULL; if (pPrev) pPrev->next = pNew; else edge = pNew; break; } else if (min < pEdge->start) { if (!(pNew = malloc(sizeof(xf86EdgeRec)))) break; pNew->screen = screen; pNew->start = min; pNew->offset.x = dx; pNew->offset.y = dy; pNew->next = pEdge; if (pPrev) pPrev->next = pNew; else edge = pNew; if (max <= pEdge->start) { pNew->end = max; break; } else { pNew->end = pEdge->start; min = pEdge->end; } } else min = pEdge->end; pPrev = pEdge; pEdge = pEdge->next; if (max <= min) break; } return edge; } static void FillOutEdge(xf86EdgePtr pEdge, int limit) { xf86EdgePtr pNext; int diff; if (pEdge->start > 0) pEdge->start = 0; while ((pNext = pEdge->next)) { diff = pNext->start - pEdge->end; if (diff > 0) { pEdge->end += diff >> 1; pNext->start -= diff - (diff >> 1); } pEdge = pNext; } if (pEdge->end < limit) pEdge->end = limit; } /* * xf86InitOrigins() can deal with a maximum of 32 screens * on 32 bit architectures, 64 on 64 bit architectures. */ void xf86InitOrigins(void) { unsigned long screensLeft, prevScreensLeft, mask; screenLayoutPtr screen; ScreenPtr pScreen, refScreen; int x1, x2, y1, y2, left, right, top, bottom; int i, j, ref, minX, minY, min, max; xf86ScreenLayoutPtr pLayout; Bool OldStyleConfig = FALSE; memset(xf86ScreenLayout, 0, MAXSCREENS * sizeof(xf86ScreenLayoutRec)); screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1; while (1) { for (mask = screensLeft, i = 0; mask; mask >>= 1, i++) { if (!(mask & 1L)) continue; screen = &xf86ConfigLayout.screens[i]; if (screen->refscreen != NULL && screen->refscreen->screennum >= xf86NumScreens) { screensLeft &= ~(1 << i); xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n", screen->screen->id); continue; } pScreen = xf86Screens[i]->pScreen; switch (screen->where) { case PosObsolete: OldStyleConfig = TRUE; pLayout = &xf86ScreenLayout[i]; /* force edge lists */ if (screen->left) { ref = screen->left->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } pLayout->left = AddEdge(pLayout->left, 0, pScreen->height, xf86Screens[ref]->pScreen->width, 0, ref); } if (screen->right) { ref = screen->right->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } pLayout->right = AddEdge(pLayout->right, 0, pScreen->height, -pScreen->width, 0, ref); } if (screen->top) { ref = screen->top->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } pLayout->up = AddEdge(pLayout->up, 0, pScreen->width, 0, xf86Screens[ref]->pScreen->height, ref); } if (screen->bottom) { ref = screen->bottom->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } pLayout->down = AddEdge(pLayout->down, 0, pScreen->width, 0, -pScreen->height, ref); } /* we could also try to place it based on those relative locations if we wanted to */ screen->x = screen->y = 0; /* FALLTHROUGH */ case PosAbsolute: pScreen->x = screen->x; pScreen->y = screen->y; screensLeft &= ~(1 << i); break; case PosRelative: ref = screen->refscreen->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } if (screensLeft & (1 << ref)) break; refScreen = xf86Screens[ref]->pScreen; pScreen->x = refScreen->x + screen->x; pScreen->y = refScreen->y + screen->y; screensLeft &= ~(1 << i); break; case PosRightOf: ref = screen->refscreen->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } if (screensLeft & (1 << ref)) break; refScreen = xf86Screens[ref]->pScreen; pScreen->x = refScreen->x + refScreen->width; pScreen->y = refScreen->y; screensLeft &= ~(1 << i); break; case PosLeftOf: ref = screen->refscreen->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } if (screensLeft & (1 << ref)) break; refScreen = xf86Screens[ref]->pScreen; pScreen->x = refScreen->x - pScreen->width; pScreen->y = refScreen->y; screensLeft &= ~(1 << i); break; case PosBelow: ref = screen->refscreen->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } if (screensLeft & (1 << ref)) break; refScreen = xf86Screens[ref]->pScreen; pScreen->x = refScreen->x; pScreen->y = refScreen->y + refScreen->height; screensLeft &= ~(1 << i); break; case PosAbove: ref = screen->refscreen->screennum; if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) { ErrorF("Referenced uninitialized screen in Layout!\n"); break; } if (screensLeft & (1 << ref)) break; refScreen = xf86Screens[ref]->pScreen; pScreen->x = refScreen->x; pScreen->y = refScreen->y - pScreen->height; screensLeft &= ~(1 << i); break; default: ErrorF("Illegal placement keyword in Layout!\n"); break; } } if (!screensLeft) break; if (screensLeft == prevScreensLeft) { /* All the remaining screens are referencing each other. Assign a value to one of them and go through again */ i = 0; while (!((1 << i) & screensLeft)) { i++; } ref = xf86ConfigLayout.screens[i].refscreen->screennum; xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0; screensLeft &= ~(1 << ref); } prevScreensLeft = screensLeft; } /* justify the topmost and leftmost to (0,0) */ minX = xf86Screens[0]->pScreen->x; minY = xf86Screens[0]->pScreen->y; for (i = 1; i < xf86NumScreens; i++) { if (xf86Screens[i]->pScreen->x < minX) minX = xf86Screens[i]->pScreen->x; if (xf86Screens[i]->pScreen->y < minY) minY = xf86Screens[i]->pScreen->y; } if (minX || minY) { for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->pScreen->x -= minX; xf86Screens[i]->pScreen->y -= minY; } } /* Create the edge lists */ if (!OldStyleConfig) { for (i = 0; i < xf86NumScreens; i++) { pLayout = &xf86ScreenLayout[i]; pScreen = xf86Screens[i]->pScreen; left = pScreen->x; right = left + pScreen->width; top = pScreen->y; bottom = top + pScreen->height; for (j = 0; j < xf86NumScreens; j++) { if (i == j) continue; refScreen = xf86Screens[j]->pScreen; x1 = refScreen->x; x2 = x1 + refScreen->width; y1 = refScreen->y; y2 = y1 + refScreen->height; if ((bottom > y1) && (top < y2)) { min = y1 - top; if (min < 0) min = 0; max = pScreen->height - (bottom - y2); if (max > pScreen->height) max = pScreen->height; if (((left - 1) >= x1) && ((left - 1) < x2)) pLayout->left = AddEdge(pLayout->left, min, max, pScreen->x - refScreen->x, pScreen->y - refScreen->y, j); if ((right >= x1) && (right < x2)) pLayout->right = AddEdge(pLayout->right, min, max, pScreen->x - refScreen->x, pScreen->y - refScreen->y, j); } if ((left < x2) && (right > x1)) { min = x1 - left; if (min < 0) min = 0; max = pScreen->width - (right - x2); if (max > pScreen->width) max = pScreen->width; if (((top - 1) >= y1) && ((top - 1) < y2)) pLayout->up = AddEdge(pLayout->up, min, max, pScreen->x - refScreen->x, pScreen->y - refScreen->y, j); if ((bottom >= y1) && (bottom < y2)) pLayout->down = AddEdge(pLayout->down, min, max, pScreen->x - refScreen->x, pScreen->y - refScreen->y, j); } } } } if (!OldStyleConfig) { for (i = 0; i < xf86NumScreens; i++) { pLayout = &xf86ScreenLayout[i]; pScreen = xf86Screens[i]->pScreen; if (pLayout->left) FillOutEdge(pLayout->left, pScreen->height); if (pLayout->right) FillOutEdge(pLayout->right, pScreen->height); if (pLayout->up) FillOutEdge(pLayout->up, pScreen->width); if (pLayout->down) FillOutEdge(pLayout->down, pScreen->width); } } update_desktop_dimensions(); } void xf86ReconfigureLayout(void) { int i; for (i = 0; i < MAXSCREENS; i++) { xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i]; /* we don't have to zero these, xf86InitOrigins() takes care of that */ free(sl->left); free(sl->right); free(sl->up); free(sl->down); } xf86InitOrigins(); } xorg-server-1.20.8/hw/xfree86/common/xf86sbusBus.c0000644000175000017500000005517213640201473016523 00000000000000/* * 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 #endif #include #include #include #include #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 = xnfreallocarray(xf86SbusInfo, ++xf86nSbusInfo + 1, sizeof(psdp)); 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++) { snprintf(fbDevName, sizeof(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 = xnfreallocarray(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 = xnfreallocarray(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 DevPrivateKeyRec sbusPaletteKeyRec; #define sbusPaletteKey (&sbusPaletteKeyRec) 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; cmap = SBUSCMAPPTR(pScrn->pScreen); if (!cmap) return; fbcmap.count = 0; fbcmap.index = indices[0]; fbcmap.red = data = xallocarray(numColors, 3); if (!data) return; 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(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) (pScreen); } Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp) { sbusCmapPtr cmap; struct fbcmap fbcmap; unsigned char data[2]; if (!dixRegisterPrivateKey(sbusPaletteKey, PRIVATE_SCREEN, 0)) FatalError("Cannot register sbus private key"); 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); } } xorg-server-1.20.8/hw/xfree86/fbdevhw/0000755000175000017500000000000013640201534014416 500000000000000xorg-server-1.20.8/hw/xfree86/fbdevhw/Makefile.am0000644000175000017500000000064713640201473016403 00000000000000SUBDIRS = man module_LTLIBRARIES = libfbdevhw.la libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) if FBDEVHW libfbdevhw_la_SOURCES = fbdevhw.c else libfbdevhw_la_SOURCES = fbdevhwstub.c endif AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c -I$(srcdir)/../modes -I$(srcdir)/../ddc -I$(srcdir)/../parser AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = fbdevhw.h EXTRA_DIST = fbpriv.h README xorg-server-1.20.8/hw/xfree86/fbdevhw/fbdevhwstub.c0000644000175000017500000000551613640201473017036 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86cmap.h" #include "fbdevhw.h" /* Stubs for the static server on platforms that don't support fbdev */ Bool fbdevHWGetRec(ScrnInfoPtr pScrn) { return FALSE; } void fbdevHWFreeRec(ScrnInfoPtr pScrn) { } Bool fbdevHWProbe(struct pci_device *pPci, char *device, char **namep) { return FALSE; } Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device) { xf86Msg(X_ERROR, "fbdevhw is not available on this platform\n"); return FALSE; } char * fbdevHWGetName(ScrnInfoPtr pScrn) { return NULL; } int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp) { return -1; } int fbdevHWGetLineLength(ScrnInfoPtr pScrn) { return -1; /* Should cause something spectacular... */ } int fbdevHWGetType(ScrnInfoPtr pScrn) { return -1; } int fbdevHWGetVidmem(ScrnInfoPtr pScrn) { return -1; } void fbdevHWSetVideoModes(ScrnInfoPtr pScrn) { } DisplayModePtr fbdevHWGetBuildinMode(ScrnInfoPtr pScrn) { return NULL; } void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn) { } void * fbdevHWMapVidmem(ScrnInfoPtr pScrn) { return NULL; } int fbdevHWLinearOffset(ScrnInfoPtr pScrn) { return 0; } Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn) { return FALSE; } void * fbdevHWMapMMIO(ScrnInfoPtr pScrn) { return NULL; } Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn) { return FALSE; } Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { return FALSE; } void fbdevHWSave(ScrnInfoPtr pScrn) { } void fbdevHWRestore(ScrnInfoPtr pScrn) { } void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual) { } ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) { return MODE_ERROR; } Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { return FALSE; } void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { } Bool fbdevHWEnterVT(ScrnInfoPtr pScrn) { return FALSE; } void fbdevHWLeaveVT(ScrnInfoPtr pScrn) { } void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) { } Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode) { return FALSE; } xf86SwitchModeProc * fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; } xf86AdjustFrameProc * fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; } xf86EnterVTProc * fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; } xf86LeaveVTProc * fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; } xf86ValidModeProc * fbdevHWValidModeWeak(void) { return fbdevHWValidMode; } xf86DPMSSetProc * fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; } xf86LoadPaletteProc * fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; } SaveScreenProcPtr fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; } xorg-server-1.20.8/hw/xfree86/fbdevhw/fbpriv.h0000644000175000017500000002610213640201473016002 00000000000000/* * copyed from from linux kernel 2.2.4 * removed internal stuff (#ifdef __KERNEL__) */ #ifdef HAVE_XORG_CONFIG_H #include #endif #ifndef _LINUX_FB_H #define _LINUX_FB_H #include /* Definitions of frame buffers */ #define FB_MAJOR 29 #define FB_MODES_SHIFT 5 /* 32 modes per framebuffer */ #define FB_NUM_MINORS 256 /* 256 Minors */ #define FB_MAX (FB_NUM_MINORS / (1 << FB_MODES_SHIFT)) #define GET_FB_IDX(node) (MINOR(node) >> FB_MODES_SHIFT) /* ioctls 0x46 is 'F' */ #define FBIOGET_VSCREENINFO 0x4600 #define FBIOPUT_VSCREENINFO 0x4601 #define FBIOGET_FSCREENINFO 0x4602 #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x4606 /* 0x4607-0x460B are defined below */ /* #define FBIOGET_MONITORSPEC 0x460C */ /* #define FBIOPUT_MONITORSPEC 0x460D */ /* #define FBIOSWITCH_MONIBIT 0x460E */ #define FBIOGET_CON2FBMAP 0x460F #define FBIOPUT_CON2FBMAP 0x4610 #define FBIOBLANK 0x4611 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ #define FB_TYPE_TEXT 3 /* Text/attributes */ #define FB_AUX_TEXT_MDA 0 /* Monochrome text */ #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ #define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ #define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ #define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ #define FB_VISUAL_TRUECOLOR 2 /* True color */ #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ #define FB_ACCEL_NONE 0 /* no hardware accelerator */ #define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ #define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */ #define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */ #define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */ #define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */ #define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */ #define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */ #define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */ #define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */ #define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */ #define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */ #define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */ #define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */ #define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */ #define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */ #define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */ #define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */ #define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */ #define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */ #define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */ #define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ #define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ #define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ #define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ #define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */ #define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */ #define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */ #define FB_ACCEL_CT_6555x 30 /* C&T 6555x */ #define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ #define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */ struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ char *smem_start; /* Start of frame buffer mem */ /* (physical address) */ __u32 smem_len; /* Length of frame buffer mem */ __u32 type; /* see FB_TYPE_* */ __u32 type_aux; /* Interleave for interleaved Planes */ __u32 visual; /* see FB_VISUAL_* */ __u16 xpanstep; /* zero if no hardware panning */ __u16 ypanstep; /* zero if no hardware panning */ __u16 ywrapstep; /* zero if no hardware ywrap */ __u32 line_length; /* length of a line in bytes */ char *mmio_start; /* Start of Memory Mapped I/O */ /* (physical address) */ __u32 mmio_len; /* Length of Memory Mapped I/O */ __u32 accel; /* Type of acceleration available */ __u16 reserved[3]; /* Reserved for future compatibility */ }; /* Interpretation of offset for color fields: All offsets are from the right, * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you * can use the offset as right argument to <<). A pixel afterwards is a bit * stream and is written to video memory as that unmodified. This implies * big-endian byte order if bits_per_pixel is greater than 8. */ struct fb_bitfield { __u32 offset; /* beginning of bitfield */ __u32 length; /* length of bitfield */ __u32 msb_right; /* != 0 : Most significant bit is */ /* right */ }; #define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ #define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl) */ #define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ #define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ #define FB_ACTIVATE_MASK 15 /* values */ #define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ #define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ #define FB_ACCELF_TEXT 1 /* text mode acceleration */ #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ #define FB_SYNC_EXT 4 /* external sync */ #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ #define FB_SYNC_BROADCAST 16 /* broadcast video timings */ /* vtotal = 144d/288n/576i => PAL */ /* vtotal = 121d/242n/484i => NTSC */ #define FB_SYNC_ON_GREEN 32 /* sync on green */ #define FB_VMODE_NONINTERLACED 0 /* non interlaced */ #define FB_VMODE_INTERLACED 1 /* interlaced */ #define FB_VMODE_DOUBLE 2 /* double scan */ #define FB_VMODE_MASK 255 #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ struct fb_var_screeninfo { __u32 xres; /* visible resolution */ __u32 yres; __u32 xres_virtual; /* virtual resolution */ __u32 yres_virtual; __u32 xoffset; /* offset from virtual to visible */ __u32 yoffset; /* resolution */ __u32 bits_per_pixel; /* guess what */ __u32 grayscale; /* != 0 Graylevels instead of colors */ struct fb_bitfield red; /* bitfield in fb mem if true color, */ struct fb_bitfield green; /* else only length is significant */ struct fb_bitfield blue; struct fb_bitfield transp; /* transparency */ __u32 nonstd; /* != 0 Non standard pixel format */ __u32 activate; /* see FB_ACTIVATE_* */ __u32 height; /* height of picture in mm */ __u32 width; /* width of picture in mm */ __u32 accel_flags; /* acceleration flags (hints) */ /* Timing: All values in pixclocks, except pixclock (of course) */ __u32 pixclock; /* pixel clock in ps (pico seconds) */ __u32 left_margin; /* time from sync to picture */ __u32 right_margin; /* time from picture to sync */ __u32 upper_margin; /* time from sync to picture */ __u32 lower_margin; __u32 hsync_len; /* length of horizontal sync */ __u32 vsync_len; /* length of vertical sync */ __u32 sync; /* see FB_SYNC_* */ __u32 vmode; /* see FB_VMODE_* */ __u32 reserved[6]; /* Reserved for future compatibility */ }; struct fb_cmap { __u32 start; /* First entry */ __u32 len; /* Number of entries */ __u16 *red; /* Red values */ __u16 *green; __u16 *blue; __u16 *transp; /* transparency, can be NULL */ }; struct fb_con2fbmap { __u32 console; __u32 framebuffer; }; struct fb_monspecs { __u32 hfmin; /* hfreq lower limit (Hz) */ __u32 hfmax; /* hfreq upper limit (Hz) */ __u16 vfmin; /* vfreq lower limit (Hz) */ __u16 vfmax; /* vfreq upper limit (Hz) */ unsigned dpms:1; /* supports DPMS */ }; #if 1 #define FBCMD_GET_CURRENTPAR 0xDEAD0005 #define FBCMD_SET_CURRENTPAR 0xDEAD8005 #endif #if 1 /* Preliminary */ /* * Hardware Cursor */ #define FBIOGET_FCURSORINFO 0x4607 #define FBIOGET_VCURSORINFO 0x4608 #define FBIOPUT_VCURSORINFO 0x4609 #define FBIOGET_CURSORSTATE 0x460A #define FBIOPUT_CURSORSTATE 0x460B struct fb_fix_cursorinfo { __u16 crsr_width; /* width and height of the cursor in */ __u16 crsr_height; /* pixels (zero if no cursor) */ __u16 crsr_xsize; /* cursor size in display pixels */ __u16 crsr_ysize; __u16 crsr_color1; /* colormap entry for cursor color1 */ __u16 crsr_color2; /* colormap entry for cursor color2 */ }; struct fb_var_cursorinfo { __u16 width; __u16 height; __u16 xspot; __u16 yspot; __u8 data[1]; /* field with [height][width] */ }; struct fb_cursorstate { __s16 xoffset; __s16 yoffset; __u16 mode; }; #define FB_CURSOR_OFF 0 #define FB_CURSOR_ON 1 #define FB_CURSOR_FLASH 2 #endif /* Preliminary */ #endif /* _LINUX_FB_H */ xorg-server-1.20.8/hw/xfree86/fbdevhw/Makefile.in0000644000175000017500000010427613640201512016411 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/fbdevhw ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) libfbdevhw_la_LIBADD = am__libfbdevhw_la_SOURCES_DIST = fbdevhwstub.c fbdevhw.c @FBDEVHW_FALSE@am_libfbdevhw_la_OBJECTS = fbdevhwstub.lo @FBDEVHW_TRUE@am_libfbdevhw_la_OBJECTS = fbdevhw.lo libfbdevhw_la_OBJECTS = $(am_libfbdevhw_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libfbdevhw_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libfbdevhw_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/fbdevhw.Plo \ ./$(DEPDIR)/fbdevhwstub.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libfbdevhw_la_SOURCES) DIST_SOURCES = $(am__libfbdevhw_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(sdk_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man module_LTLIBRARIES = libfbdevhw.la libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) @FBDEVHW_FALSE@libfbdevhw_la_SOURCES = fbdevhwstub.c @FBDEVHW_TRUE@libfbdevhw_la_SOURCES = fbdevhw.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c -I$(srcdir)/../modes -I$(srcdir)/../ddc -I$(srcdir)/../parser AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = fbdevhw.h EXTRA_DIST = fbpriv.h README all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/fbdevhw/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/fbdevhw/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libfbdevhw.la: $(libfbdevhw_la_OBJECTS) $(libfbdevhw_la_DEPENDENCIES) $(EXTRA_libfbdevhw_la_DEPENDENCIES) $(AM_V_CCLD)$(libfbdevhw_la_LINK) -rpath $(moduledir) $(libfbdevhw_la_OBJECTS) $(libfbdevhw_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdevhw.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdevhwstub.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/fbdevhw.Plo -rm -f ./$(DEPDIR)/fbdevhwstub.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/fbdevhw.Plo -rm -f ./$(DEPDIR)/fbdevhwstub.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic clean-libtool \ clean-moduleLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/fbdevhw/README0000644000175000017500000000100613640201473015215 00000000000000 This is a submodule to access linux framebuffer devices. It is supported to work as helper module (like vgahw) for the chipset drivers. There are functions for saving/restoring/setting video modes, set palette entries, and a few more helper functions. Some of them can be hooked directly into ScrnInfoRec. In ../drivers/fbdev is a "chipset" driver. It is a simple, non-accelerated and hardware-independent driver which works on top of this fbdevhw submodule. Gerd -- Gerd Knorr xorg-server-1.20.8/hw/xfree86/fbdevhw/fbdevhw.c0000644000175000017500000006476713640201473016155 00000000000000/* all driver need this */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Modes.h" #include "xf86_OSproc.h" /* pci stuff */ #include "xf86Pci.h" #include "xf86cmap.h" #include "fbdevhw.h" #include "fbpriv.h" #include "globals.h" #include #define PAGE_MASK (~(getpagesize() - 1)) static XF86ModuleVersionInfo fbdevHWVersRec = { "fbdevhw", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 0, 0, 2, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} }; _X_EXPORT XF86ModuleData fbdevhwModuleData = { &fbdevHWVersRec, NULL, NULL }; #include #include #include #include #include #include #include /* -------------------------------------------------------------------- */ /* our private data, and two functions to allocate/free this */ #define FBDEVHWPTRLVAL(p) (p)->privates[fbdevHWPrivateIndex].ptr #define FBDEVHWPTR(p) ((fbdevHWPtr)(FBDEVHWPTRLVAL(p))) static int fbdevHWPrivateIndex = -1; typedef struct { /* framebuffer device: filename (/dev/fb*), handle, more */ char *device; int fd; void *fbmem; unsigned int fbmem_len; unsigned int fboff; char *mmio; unsigned int mmio_len; /* current hardware state */ struct fb_fix_screeninfo fix; struct fb_var_screeninfo var; /* saved video mode */ struct fb_var_screeninfo saved_var; /* buildin video mode */ DisplayModeRec buildin; /* disable non-fatal unsupported ioctls */ CARD32 unsupported_ioctls; } fbdevHWRec, *fbdevHWPtr; enum { FBIOBLANK_UNSUPPORTED = 0, }; Bool fbdevHWGetRec(ScrnInfoPtr pScrn) { if (fbdevHWPrivateIndex < 0) fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); if (FBDEVHWPTR(pScrn) != NULL) return TRUE; FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1); return TRUE; } void fbdevHWFreeRec(ScrnInfoPtr pScrn) { if (fbdevHWPrivateIndex < 0) return; free(FBDEVHWPTR(pScrn)); FBDEVHWPTRLVAL(pScrn) = NULL; } int fbdevHWGetFD(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr; fbdevHWGetRec(pScrn); fPtr = FBDEVHWPTR(pScrn); return fPtr->fd; } /* -------------------------------------------------------------------- */ /* some helpers for printing debug informations */ #ifdef DEBUG static void print_fbdev_mode(const char *txt, struct fb_var_screeninfo *var) { ErrorF("fbdev %s mode:\t%d %d %d %d %d %d %d %d %d %d %d:%d:%d\n", txt, var->pixclock, var->xres, var->right_margin, var->hsync_len, var->left_margin, var->yres, var->lower_margin, var->vsync_len, var->upper_margin, var->bits_per_pixel, var->red.length, var->green.length, var->blue.length); } static void print_xfree_mode(const char *txt, DisplayModePtr mode) { ErrorF("xfree %s mode:\t%d %d %d %d %d %d %d %d %d\n", txt, mode->Clock, mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal, mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal); } #endif /* -------------------------------------------------------------------- */ /* Convert timings between the XFree and the Frame Buffer Device */ static void xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var) { var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth : pScrn->virtualX; var->yres_virtual = pScrn->virtualY; var->bits_per_pixel = pScrn->bitsPerPixel; if (pScrn->defaultVisual == TrueColor || pScrn->defaultVisual == DirectColor) { var->red.length = pScrn->weight.red; var->green.length = pScrn->weight.green; var->blue.length = pScrn->weight.blue; } else { var->red.length = 8; var->green.length = 8; var->blue.length = 8; } } static void xfree2fbdev_timing(DisplayModePtr mode, struct fb_var_screeninfo *var) { var->xres = mode->HDisplay; var->yres = mode->VDisplay; if (var->xres_virtual < var->xres) var->xres_virtual = var->xres; if (var->yres_virtual < var->yres) var->yres_virtual = var->yres; var->xoffset = var->yoffset = 0; var->pixclock = mode->Clock ? 1000000000 / mode->Clock : 0; var->right_margin = mode->HSyncStart - mode->HDisplay; var->hsync_len = mode->HSyncEnd - mode->HSyncStart; var->left_margin = mode->HTotal - mode->HSyncEnd; var->lower_margin = mode->VSyncStart - mode->VDisplay; var->vsync_len = mode->VSyncEnd - mode->VSyncStart; var->upper_margin = mode->VTotal - mode->VSyncEnd; var->sync = 0; if (mode->Flags & V_PHSYNC) var->sync |= FB_SYNC_HOR_HIGH_ACT; if (mode->Flags & V_PVSYNC) var->sync |= FB_SYNC_VERT_HIGH_ACT; if (mode->Flags & V_PCSYNC) var->sync |= FB_SYNC_COMP_HIGH_ACT; if (mode->Flags & V_BCAST) var->sync |= FB_SYNC_BROADCAST; if (mode->Flags & V_INTERLACE) var->vmode = FB_VMODE_INTERLACED; else if (mode->Flags & V_DBLSCAN) var->vmode = FB_VMODE_DOUBLE; else var->vmode = FB_VMODE_NONINTERLACED; } static Bool fbdev_modes_equal(struct fb_var_screeninfo *set, struct fb_var_screeninfo *req) { return (set->xres_virtual >= req->xres_virtual && set->yres_virtual >= req->yres_virtual && set->bits_per_pixel == req->bits_per_pixel && set->red.length == req->red.length && set->green.length == req->green.length && set->blue.length == req->blue.length && set->xres == req->xres && set->yres == req->yres && set->right_margin == req->right_margin && set->hsync_len == req->hsync_len && set->left_margin == req->left_margin && set->lower_margin == req->lower_margin && set->vsync_len == req->vsync_len && set->upper_margin == req->upper_margin && set->sync == req->sync && set->vmode == req->vmode); } static void fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode) { mode->Clock = var->pixclock ? 1000000000 / var->pixclock : 0; mode->HDisplay = var->xres; mode->HSyncStart = mode->HDisplay + var->right_margin; mode->HSyncEnd = mode->HSyncStart + var->hsync_len; mode->HTotal = mode->HSyncEnd + var->left_margin; mode->VDisplay = var->yres; mode->VSyncStart = mode->VDisplay + var->lower_margin; mode->VSyncEnd = mode->VSyncStart + var->vsync_len; mode->VTotal = mode->VSyncEnd + var->upper_margin; mode->Flags = 0; mode->Flags |= var->sync & FB_SYNC_HOR_HIGH_ACT ? V_PHSYNC : V_NHSYNC; mode->Flags |= var->sync & FB_SYNC_VERT_HIGH_ACT ? V_PVSYNC : V_NVSYNC; mode->Flags |= var->sync & FB_SYNC_COMP_HIGH_ACT ? V_PCSYNC : V_NCSYNC; if (var->sync & FB_SYNC_BROADCAST) mode->Flags |= V_BCAST; if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) mode->Flags |= V_INTERLACE; else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) mode->Flags |= V_DBLSCAN; 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; } /* -------------------------------------------------------------------- */ /* open correct framebuffer device */ /** * Try to find the framebuffer device for a given PCI device */ static int fbdev_open_pci(struct pci_device *pPci, char **namep) { struct fb_fix_screeninfo fix; char filename[256]; int fd, i; for (i = 0; i < 8; i++) { snprintf(filename, sizeof(filename), "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d", pPci->domain, pPci->bus, pPci->dev, pPci->func, i); fd = open(filename, O_RDONLY, 0); if (fd < 0) { snprintf(filename, sizeof(filename), "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d", pPci->domain, pPci->bus, pPci->dev, pPci->func, i); fd = open(filename, O_RDONLY, 0); } if (fd >= 0) { close(fd); snprintf(filename, sizeof(filename), "/dev/fb%d", i); fd = open(filename, O_RDWR, 0); if (fd != -1) { if (ioctl(fd, FBIOGET_FSCREENINFO, (void *) &fix) != -1) { if (namep) { *namep = xnfalloc(16); strncpy(*namep, fix.id, 16); } return fd; } close(fd); } } } if (namep) *namep = NULL; xf86DrvMsg(-1, X_ERROR, "Unable to find a valid framebuffer device\n"); return -1; } static int fbdev_open(int scrnIndex, const char *dev, char **namep) { struct fb_fix_screeninfo fix; int fd; /* try argument (from XF86Config) first */ if (dev) { fd = open(dev, O_RDWR, 0); } else { /* second: environment variable */ dev = getenv("FRAMEBUFFER"); if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) { /* last try: default device */ dev = "/dev/fb0"; fd = open(dev, O_RDWR, 0); } } if (fd == -1) { xf86DrvMsg(scrnIndex, X_ERROR, "open %s: %s\n", dev, strerror(errno)); return -1; } /* only touch non-PCI devices on this path */ { char buf[PATH_MAX]; char *sysfs_path = NULL; char *node = strrchr(dev, '/') + 1; if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 || readlink(sysfs_path, buf, sizeof(buf)) < 0 || strstr(buf, "devices/pci")) { free(sysfs_path); close(fd); return -1; } free(sysfs_path); } if (namep) { if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, (void *) (&fix))) { *namep = NULL; xf86DrvMsg(scrnIndex, X_ERROR, "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return -1; } else { *namep = xnfalloc(16); strncpy(*namep, fix.id, 16); } } return fd; } /* -------------------------------------------------------------------- */ Bool fbdevHWProbe(struct pci_device *pPci, char *device, char **namep) { int fd; if (pPci) fd = fbdev_open_pci(pPci, namep); else fd = fbdev_open(-1, device, namep); if (-1 == fd) return FALSE; close(fd); return TRUE; } Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device) { fbdevHWPtr fPtr; fbdevHWGetRec(pScrn); fPtr = FBDEVHWPTR(pScrn); /* open device */ if (pPci) fPtr->fd = fbdev_open_pci(pPci, NULL); else fPtr->fd = fbdev_open(pScrn->scrnIndex, device, NULL); if (-1 == fPtr->fd) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to open framebuffer device, consult warnings" " and/or errors above for possible reasons\n" "\t(you may have to look at the server log to see" " warnings)\n"); return FALSE; } /* get current fb device settings */ if (-1 == ioctl(fPtr->fd, FBIOGET_FSCREENINFO, (void *) (&fPtr->fix))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ioctl FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (-1 == ioctl(fPtr->fd, FBIOGET_VSCREENINFO, (void *) (&fPtr->var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } /* we can use the current settings as "buildin mode" */ fbdev2xfree_timing(&fPtr->var, &fPtr->buildin); fPtr->buildin.name = "current"; fPtr->buildin.next = &fPtr->buildin; fPtr->buildin.prev = &fPtr->buildin; fPtr->buildin.type |= M_T_BUILTIN; return TRUE; } char * fbdevHWGetName(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); return fPtr->fix.id; } int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (fbbpp) *fbbpp = fPtr->var.bits_per_pixel; if (fPtr->fix.visual == FB_VISUAL_TRUECOLOR || fPtr->fix.visual == FB_VISUAL_DIRECTCOLOR) return fPtr->var.red.length + fPtr->var.green.length + fPtr->var.blue.length; else return fPtr->var.bits_per_pixel; } int fbdevHWGetLineLength(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (fPtr->fix.line_length) return fPtr->fix.line_length; else return fPtr->var.xres_virtual * fPtr->var.bits_per_pixel / 8; } int fbdevHWGetType(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); return fPtr->fix.type; } int fbdevHWGetVidmem(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); return fPtr->fix.smem_len; } static Bool fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); struct fb_var_screeninfo req_var = fPtr->var, set_var; xfree2fbdev_fblayout(pScrn, &req_var); xfree2fbdev_timing(mode, &req_var); #ifdef DEBUG print_xfree_mode("init", mode); print_fbdev_mode("init", &req_var); #endif set_var = req_var; if (check) set_var.activate = FB_ACTIVATE_TEST; if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&set_var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (!fbdev_modes_equal(&set_var, &req_var)) { if (!check) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO succeeded but modified " "mode\n"); #ifdef DEBUG print_fbdev_mode("returned", &set_var); #endif return FALSE; } if (!check) fPtr->var = set_var; return TRUE; } void fbdevHWSetVideoModes(ScrnInfoPtr pScrn) { const char **modename; DisplayModePtr mode, this, last = pScrn->modes; if (NULL == pScrn->display->modes) return; pScrn->virtualX = pScrn->display->virtualX; pScrn->virtualY = pScrn->display->virtualY; for (modename = pScrn->display->modes; *modename != NULL; modename++) { for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) { if (0 == strcmp(mode->name, *modename)) { if (fbdevHWSetMode(pScrn, mode, TRUE)) break; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" test failed\n", *modename); } } if (NULL == mode) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" not found\n", *modename); continue; } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" ok\n", *modename); if (pScrn->virtualX < mode->HDisplay) pScrn->virtualX = mode->HDisplay; if (pScrn->virtualY < mode->VDisplay) pScrn->virtualY = mode->VDisplay; if (NULL == pScrn->modes) { this = pScrn->modes = xf86DuplicateMode(mode); this->next = this; this->prev = this; } else { this = xf86DuplicateMode(mode); this->next = pScrn->modes; this->prev = last; last->next = this; pScrn->modes->prev = this; } last = this; } } DisplayModePtr fbdevHWGetBuildinMode(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); return &fPtr->buildin; } void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); pScrn->modes = &fPtr->buildin; pScrn->virtualX = pScrn->display->virtualX; pScrn->virtualY = pScrn->display->virtualY; if (pScrn->virtualX < fPtr->buildin.HDisplay) pScrn->virtualX = fPtr->buildin.HDisplay; if (pScrn->virtualY < fPtr->buildin.VDisplay) pScrn->virtualY = fPtr->buildin.VDisplay; } /* -------------------------------------------------------------------- */ static void calculateFbmem_len(fbdevHWPtr fPtr) { fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK; fPtr->fbmem_len = (fPtr->fboff + fPtr->fix.smem_len + ~PAGE_MASK) & PAGE_MASK; } void * fbdevHWMapVidmem(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (NULL == fPtr->fbmem) { calculateFbmem_len(fPtr); fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fPtr->fd, 0); if (-1 == (long) fPtr->fbmem) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mmap fbmem: %s\n", strerror(errno)); fPtr->fbmem = NULL; } else { /* Perhaps we'd better add fboff to fbmem and return 0 in fbdevHWLinearOffset()? Of course we then need to mask fPtr->fbmem with PAGE_MASK in fbdevHWUnmapVidmem() as well. [geert] */ } } pScrn->memPhysBase = (unsigned long) fPtr->fix.smem_start & (unsigned long) (PAGE_MASK); pScrn->fbOffset = (unsigned long) fPtr->fix.smem_start & (unsigned long) (~PAGE_MASK); return fPtr->fbmem; } int fbdevHWLinearOffset(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); return fPtr->fboff; } Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (NULL != fPtr->fbmem) { if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "munmap fbmem: %s\n", strerror(errno)); fPtr->fbmem = NULL; } return TRUE; } void * fbdevHWMapMMIO(ScrnInfoPtr pScrn) { unsigned int mmio_off; fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (NULL == fPtr->mmio) { /* tell the kernel not to use accels to speed up console scrolling */ fPtr->var.accel_flags = 0; if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&fPtr->var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK; fPtr->mmio_len = (mmio_off + fPtr->fix.mmio_len + ~PAGE_MASK) & PAGE_MASK; if (NULL == fPtr->fbmem) calculateFbmem_len(fPtr); fPtr->mmio = mmap(NULL, fPtr->mmio_len, PROT_READ | PROT_WRITE, MAP_SHARED, fPtr->fd, fPtr->fbmem_len); if (-1 == (long) fPtr->mmio) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mmap mmio: %s\n", strerror(errno)); fPtr->mmio = NULL; } else fPtr->mmio += mmio_off; } return fPtr->mmio; } Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (NULL != fPtr->mmio) { if (-1 == munmap((void *) ((unsigned long) fPtr->mmio & PAGE_MASK), fPtr->mmio_len)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "munmap mmio: %s\n", strerror(errno)); fPtr->mmio = NULL; /* FIXME: restore var.accel_flags [geert] */ } return TRUE; } /* -------------------------------------------------------------------- */ Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); pScrn->vtSema = TRUE; /* set */ if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; /* read back */ if (0 != ioctl(fPtr->fd, FBIOGET_FSCREENINFO, (void *) (&fPtr->fix))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (0 != ioctl(fPtr->fd, FBIOGET_VSCREENINFO, (void *) (&fPtr->var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (pScrn->defaultVisual == TrueColor || pScrn->defaultVisual == DirectColor) { /* XXX: This is a hack, but it should be a NOP for all the setups that * worked before and actually seems to fix some others... */ pScrn->offset.red = fPtr->var.red.offset; pScrn->offset.green = fPtr->var.green.offset; pScrn->offset.blue = fPtr->var.blue.offset; pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset; pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset; pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset; } return TRUE; } /* -------------------------------------------------------------------- */ /* video mode save/restore */ void fbdevHWSave(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (0 != ioctl(fPtr->fd, FBIOGET_VSCREENINFO, (void *) (&fPtr->saved_var))) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); } void fbdevHWRestore(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&fPtr->saved_var))) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); } /* -------------------------------------------------------------------- */ /* callback for xf86HandleColormaps */ void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); struct fb_cmap cmap; unsigned short red, green, blue; int i; cmap.len = 1; cmap.red = &red; cmap.green = &green; cmap.blue = &blue; cmap.transp = NULL; for (i = 0; i < numColors; i++) { cmap.start = indices[i]; red = (colors[indices[i]].red << 8) | colors[indices[i]].red; green = (colors[indices[i]].green << 8) | colors[indices[i]].green; blue = (colors[indices[i]].blue << 8) | colors[indices[i]].blue; if (-1 == ioctl(fPtr->fd, FBIOPUTCMAP, (void *) &cmap)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUTCMAP: %s\n", strerror(errno)); } } /* -------------------------------------------------------------------- */ /* these can be hooked directly into ScrnInfoRec */ ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) { if (!fbdevHWSetMode(pScrn, mode, TRUE)) return MODE_BAD; return MODE_OK; } Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; return TRUE; } void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual || y < 0 || y + fPtr->var.yres > fPtr->var.yres_virtual) return; fPtr->var.xoffset = x; fPtr->var.yoffset = y; if (-1 == ioctl(fPtr->fd, FBIOPAN_DISPLAY, (void *) &fPtr->var)) xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 5, "FBIOPAN_DISPLAY: %s\n", strerror(errno)); } Bool fbdevHWEnterVT(ScrnInfoPtr pScrn) { if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; fbdevHWAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0); return TRUE; } void fbdevHWLeaveVT(ScrnInfoPtr pScrn) { fbdevHWRestore(pScrn); } void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long fbmode; if (!pScrn->vtSema) return; if (fPtr->unsupported_ioctls & (1 << FBIOBLANK_UNSUPPORTED)) return; switch (mode) { case DPMSModeOn: fbmode = 0; break; case DPMSModeStandby: fbmode = 2; break; case DPMSModeSuspend: fbmode = 3; break; case DPMSModeOff: fbmode = 4; break; default: return; } RETRY: if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) fbmode)) { switch (errno) { case EAGAIN: xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FBIOBLANK: %s\n", strerror(errno)); break; case EINTR: case ERESTART: goto RETRY; default: fPtr->unsupported_ioctls |= (1 << FBIOBLANK_UNSUPPORTED); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FBIOBLANK: %s (Screen blanking not supported " "by kernel - disabling)\n", strerror(errno)); } } } Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long unblank; if (!pScrn->vtSema) return TRUE; if (fPtr->unsupported_ioctls & (1 << FBIOBLANK_UNSUPPORTED)) return FALSE; unblank = xf86IsUnblank(mode); RETRY: if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) (1 - unblank))) { switch (errno) { case EAGAIN: xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FBIOBLANK: %s\n", strerror(errno)); break; case EINTR: case ERESTART: goto RETRY; default: fPtr->unsupported_ioctls |= (1 << FBIOBLANK_UNSUPPORTED); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FBIOBLANK: %s (Screen blanking not supported " "by kernel - disabling)\n", strerror(errno)); } return FALSE; } return TRUE; } xf86SwitchModeProc * fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; } xf86AdjustFrameProc * fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; } xf86EnterVTProc * fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; } xf86LeaveVTProc * fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; } xf86ValidModeProc * fbdevHWValidModeWeak(void) { return fbdevHWValidMode; } xf86DPMSSetProc * fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; } xf86LoadPaletteProc * fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; } SaveScreenProcPtr fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; } xorg-server-1.20.8/hw/xfree86/fbdevhw/man/0000755000175000017500000000000013640201534015171 500000000000000xorg-server-1.20.8/hw/xfree86/fbdevhw/man/Makefile.am0000644000175000017500000000007613640201473017152 00000000000000include $(top_srcdir)/manpages.am driverman_PRE = fbdevhw.man xorg-server-1.20.8/hw/xfree86/fbdevhw/man/Makefile.in0000644000175000017500000006563313640201512017167 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/fbdevhw/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man driverman_PRE = fbdevhw.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/fbdevhw/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/fbdevhw/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/fbdevhw/man/fbdevhw.man0000644000175000017500000000165413640201473017243 00000000000000.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.1 2001/01/24 00:06:34 dawes Exp $ .TH FBDEVHW @drivermansuffix@ @vendorversion@ .SH NAME fbdevhw \- os-specific submodule for framebuffer device access .SH DESCRIPTION .B fbdevhw provides functions for talking to a framebuffer device. It is os-specific. It is a submodule used by other video drivers. A .B fbdevhw module is currently available for linux framebuffer devices. .PP fbdev(@drivermansuffix@) is a non-accelerated driver which runs on top of the fbdevhw module. fbdevhw can be used by other drivers too, this is usually activated with `Option "UseFBDev"' in the device section. .SH "SEE ALSO" Xorg(@appmansuffix@), xorg.conf(@filemansuffix@), xorgconfig(@appmansuffix@), Xserver(@appmansuffix@), X(@miscmansuffix@), fbdev(@drivermansuffix@) .SH AUTHORS Authors include: Gerd Knorr, based on the XF68_FBDev Server code (Martin Schaller, Geert Uytterhoeven). xorg-server-1.20.8/hw/xfree86/fbdevhw/fbdevhw.h0000644000175000017500000000606613640201473016146 00000000000000 #ifndef _FBDEVHW_H_ #define _FBDEVHW_H_ #include "xf86str.h" #include "colormapst.h" #define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */ #define FBDEVHW_PLANES 1 /* Non interleaved planes */ #define FBDEVHW_INTERLEAVED_PLANES 2 /* Interleaved planes */ #define FBDEVHW_TEXT 3 /* Text/attributes */ #define FBDEVHW_VGA_PLANES 4 /* EGA/VGA planes */ extern _X_EXPORT Bool fbdevHWGetRec(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWFreeRec(ScrnInfoPtr pScrn); extern _X_EXPORT int fbdevHWGetFD(ScrnInfoPtr pScrn); extern _X_EXPORT Bool fbdevHWProbe(struct pci_device *pPci, char *device, char **namep); extern _X_EXPORT Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device); extern _X_EXPORT char *fbdevHWGetName(ScrnInfoPtr pScrn); extern _X_EXPORT int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp); extern _X_EXPORT int fbdevHWGetLineLength(ScrnInfoPtr pScrn); extern _X_EXPORT int fbdevHWGetType(ScrnInfoPtr pScrn); extern _X_EXPORT int fbdevHWGetVidmem(ScrnInfoPtr pScrn); extern _X_EXPORT void *fbdevHWMapVidmem(ScrnInfoPtr pScrn); extern _X_EXPORT int fbdevHWLinearOffset(ScrnInfoPtr pScrn); extern _X_EXPORT Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn); extern _X_EXPORT void *fbdevHWMapMMIO(ScrnInfoPtr pScrn); extern _X_EXPORT Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWSetVideoModes(ScrnInfoPtr pScrn); extern _X_EXPORT DisplayModePtr fbdevHWGetBuildinMode(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn); extern _X_EXPORT Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); extern _X_EXPORT void fbdevHWSave(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWRestore(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual); extern _X_EXPORT ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags); extern _X_EXPORT Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT Bool fbdevHWEnterVT(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode); extern _X_EXPORT xf86SwitchModeProc *fbdevHWSwitchModeWeak(void); extern _X_EXPORT xf86AdjustFrameProc *fbdevHWAdjustFrameWeak(void); extern _X_EXPORT xf86EnterVTProc *fbdevHWEnterVTWeak(void); extern _X_EXPORT xf86LeaveVTProc *fbdevHWLeaveVTWeak(void); extern _X_EXPORT xf86ValidModeProc *fbdevHWValidModeWeak(void); extern _X_EXPORT xf86DPMSSetProc *fbdevHWDPMSSetWeak(void); extern _X_EXPORT xf86LoadPaletteProc *fbdevHWLoadPaletteWeak(void); extern _X_EXPORT SaveScreenProcPtr fbdevHWSaveScreenWeak(void); #endif xorg-server-1.20.8/hw/xfree86/fbdevhw/meson.build0000644000175000017500000000076213640201473016507 00000000000000if host_machine.system() == 'linux' srcs_fbdevhw = 'fbdevhw.c' else srcs_fbdevhw = 'fbdevhwstub.c' endif shared_module('fbdevhw', srcs_fbdevhw, include_directories: [ inc, xorg_inc ], dependencies: common_dep, c_args: xorg_c_args, install: true, install_dir: module_dir, link_with: e, ) install_data('fbdevhw.h', install_dir: xorgsdkdir) install_man(configure_file( input: 'man/fbdevhw.man', output: 'fbdevhw.4', configuration: manpage_config, )) xorg-server-1.20.8/hw/xfree86/man/0000755000175000017500000000000013640201534013544 500000000000000xorg-server-1.20.8/hw/xfree86/man/Makefile.am0000644000175000017500000000035713640201473015527 00000000000000include $(top_srcdir)/manpages.am appman_PRE = Xorg.man fileman_PRE = xorg.conf.man xorg.conf.d.man if SUID_WRAPPER appman_PRE += Xorg.wrap.man fileman_PRE += Xwrapper.config.man else EXTRA_DIST += Xorg.wrap.man Xwrapper.config.man endif xorg-server-1.20.8/hw/xfree86/man/Xorg.man0000644000175000017500000004630513640201473015112 00000000000000.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH Xorg @appmansuffix@ @vendorversion@ .SH NAME Xorg - X11R7 X server .SH SYNOPSIS .B Xorg .RI [\fB:\fP display ] .RI [ option .IR ... ] .SH DESCRIPTION .B Xorg is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware. It now runs on a wider range of hardware and OS platforms. .PP This work was derived by the X.Org Foundation from the XFree86 Project's .I "XFree86\ 4.4rc2" release. The XFree86 release was originally derived from .I "X386\ 1.2" by Thomas Roell which was contributed to X11R5 by Snitily Graphics Consulting Service. .SH PLATFORMS .PP .B Xorg operates under a wide range of operating systems and hardware platforms. The Intel x86 (IA32) architecture is the most widely supported hardware platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64, SPARC and PowerPC. The most widely supported operating systems are the free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD, OpenBSD, and Solaris. Commercial UNIX operating systems such as UnixWare are also supported. Other supported operating systems include GNU Hurd. Mac OS X is supported with the Xquartz(@appmansuffix@) X server. Win32/Cygwin is supported with the XWin(@appmansuffix@) X server. .PP .SH "NETWORK CONNECTIONS" .B Xorg supports connections made using the following reliable byte-streams: .TP 4 .I "Local" On most platforms, the "Local" connection type is a UNIX-domain socket. On some System V platforms, the "local" connection types also include STREAMS pipes, named pipes, and some other mechanisms. See the "LOCAL CONNECTIONS" section of X(@miscmansuffix@) for details. .TP 4 .I TCP/IP .B Xorg listens on port .RI 6000+ n , where .I n is the display number. This connection type is usually disabled by default, but may be enabled with the .B \-listen option (see the Xserver(1) man page for details). .SH OPTIONS .B Xorg supports several mechanisms for supplying/obtaining configuration and run-time parameters: command line options, environment variables, the xorg.conf(@filemansuffix@) configuration files, auto-detection, and fallback defaults. When the same information is supplied in more than one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters can be supplied via all methods. The available command line options and environment variables (and some defaults) are described here and in the Xserver(@appmansuffix@) manual page. Most configuration file parameters, with their defaults, are described in the xorg.conf(@filemansuffix@) manual page. Driver and module specific configuration parameters are described in the relevant driver or module manual page. .PP In addition to the normal server options described in the Xserver(@appmansuffix@) manual page, .B Xorg accepts the following command line switches: .TP 8 .BI vt XX .I XX specifies the Virtual Terminal device number which .B Xorg will use. Without this option, .B Xorg will pick the first available Virtual Terminal that it can locate. This option applies only to platforms that have virtual terminal support, such as Linux, BSD, OpenSolaris, SVR3, and SVR4. .TP .B \-allowMouseOpenFail Allow the server to start up even if the mouse device can't be opened or initialised. This is equivalent to the .B AllowMouseOpenFail xorg.conf(@filemansuffix@) file option. .TP 8 .B \-allowNonLocalXvidtune Make the VidMode extension available to remote clients. This allows the xvidtune client to connect from another host. This is equivalent to the .B AllowNonLocalXvidtune xorg.conf(@filemansuffix@) file option. By default non-local connections are not allowed. .TP 8 .BI \-bgamma " value" Set the blue gamma correction. .I value must be between 0.1 and 10. The default is 1.0. Not all drivers support this. See also the .BR \-gamma , .BR \-rgamma , and .B \-ggamma options. .TP 8 .BI \-bpp " n" No longer supported. Use .B \-depth to set the color depth, and use .B \-fbbpp if you really need to force a non-default framebuffer (hardware) pixel format. .TP 8 .BI \-config " file" Read the server configuration from .IR file . This option will work for any file when the server is run as root (i.e, with real-uid 0), or for files relative to a directory in the config search path for all other users. .TP 8 .BI \-configdir " directory" Read the server configuration files from .IR directory . This option will work for any directory when the server is run as root (i.e, with real-uid 0), or for directories relative to a directory in the config directory search path for all other users. .TP 8 .B \-configure When this option is specified, the .B Xorg server loads all video driver modules, probes for available hardware, and writes out an initial xorg.conf(@filemansuffix@) file based on what was detected. This option currently has some problems on some platforms, but in most cases it is a good way to bootstrap the configuration process. This option is only available when the server is run as root (i.e, with real-uid 0). .TP 8 .BI "\-crt /dev/tty" XX SCO only. This is the same as the .B vt option, and is provided for compatibility with the native SCO X server. .TP 8 .BI \-depth " n" Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and 24. Not all drivers support all values. .TP 8 .B \-disableVidMode Disable the parts of the VidMode extension (used by the xvidtune client) that can be used to change the video modes. This is equivalent to the .B DisableVidModeExtension xorg.conf(@filemansuffix@) file option. .TP 8 .B \-fbbpp \fIn\fP Sets the number of framebuffer bits per pixel. You should only set this if you're sure it's necessary; normally the server can deduce the correct value from .B \-depth above. Useful if you want to run a depth 24 configuration with a 24 bpp framebuffer rather than the (possibly default) 32 bpp framebuffer (or vice versa). Legal values are 1, 8, 16, 24, 32. Not all drivers support all values. .TP 8 .B \-flipPixels Swap the default values for the black and white pixels. .TP 8 .BI \-gamma " value" Set the gamma correction. .I value must be between 0.1 and 10. The default is 1.0. This value is applied equally to the R, G and B values. Those values can be set independently with the .BR \-rgamma , .BR \-bgamma , and .B \-ggamma options. Not all drivers support this. .TP 8 .BI \-ggamma " value" Set the green gamma correction. .I value must be between 0.1 and 10. The default is 1.0. Not all drivers support this. See also the .BR \-gamma , .BR \-rgamma , and .B \-bgamma options. .TP 8 .B \-ignoreABI The .B Xorg server checks the ABI revision levels of each module that it loads. It will normally refuse to load modules with ABI revisions that are newer than the server's. This is because such modules might use interfaces that the server does not have. When this option is specified, mismatches like this are downgraded from fatal errors to warnings. This option should be used with care. .TP 8 .B \-isolateDevice \fIbus\-id\fP Restrict device resets to the device at .IR bus\-id . The .I bus\-id string has the form .IB bustype : bus : device : function (e.g., \(oqPCI:1:0:0\(cq). At present, only isolation of PCI devices is supported; i.e., this option is ignored if .I bustype is anything other than \(oqPCI\(cq. .TP 8 .B \-keeptty Prevent the server from detaching its initial controlling terminal. If you want to use systemd-logind integration you must specify this option. Not all platforms support (or can use) this option. .TP 8 .BI \-keyboard " keyboard-name" Use the xorg.conf(@filemansuffix@) file .B InputDevice section called .I keyboard-name as the core keyboard. This option is ignored when the .B Layout section specifies a core keyboard. In the absence of both a Layout section and this option, the first relevant .B InputDevice section is used for the core keyboard. .TP 8 .BI \-layout " layout-name" Use the xorg.conf(@filemansuffix@) file .B Layout section called .IR layout-name . By default the first .B Layout section is used. .TP 8 .BI \-logfile " filename" Use the file called .I filename as the .B Xorg server log file. The default log file when running as root is .BI @logdir@/Xorg. n .log and for non root it is .BI $XDG_DATA_HOME/xorg/Xorg. n .log where .I n is the display number of the .B Xorg server. The default may be in a different directory on some platforms. This option is only available when the server is run as root (i.e, with real-uid 0). .TP 8 .BR \-logverbose " [\fIn\fP]" Sets the verbosity level for information printed to the .B Xorg server log file. If the .I n value isn't supplied, each occurrence of this option increments the log file verbosity level. When the .I n value is supplied, the log file verbosity level is set to that value. The default log file verbosity level is 3. .TP 8 .BI \-modulepath " searchpath" Set the module search path to .IR searchpath . .I searchpath is a comma separated list of directories to search for .B Xorg server modules. This option is only available when the server is run as root (i.e, with real-uid 0). .TP 8 .B \-nosilk Disable Silken Mouse support. .TP 8 .B \-novtswitch Disable the automatic switching on X server reset and shutdown to the VT that was active when the server started, if supported by the OS. .TP 8 .BI \-pointer " pointer-name" Use the xorg.conf(@filemansuffix@) file .B InputDevice section called .I pointer-name as the core pointer. This option is ignored when the .B Layout section specifies a core pointer. In the absence of both a Layout section and this option, the first relevant .B InputDevice section is used for the core pointer. .TP 8 .B \-quiet Suppress most informational messages at startup. The verbosity level is set to zero. .TP 8 .BI \-rgamma " value" Set the red gamma correction. .I value must be between 0.1 and 10. The default is 1.0. Not all drivers support this. See also the .BR \-gamma , .BR \-bgamma , and .B \-ggamma options. .TP 8 .B \-sharevts Share virtual terminals with another X server, if supported by the OS. .TP 8 .BI \-screen " screen-name" Use the xorg.conf(@filemansuffix@) file .B Screen section called .IR screen-name . By default the screens referenced by the default .B Layout section are used, or the first .B Screen section when there are no .B Layout sections. .TP 8 .B \-showconfig This is the same as the .B \-version option, and is included for compatibility reasons. It may be removed in a future release, so the .B \-version option should be used instead. .TP 8 .B \-showDefaultModulePath Print out the default module path the server was compiled with. .TP 8 .B \-showDefaultLibPath Print out the path libraries should be installed to. .TP 8 .B \-showopts For each driver module installed, print out the list of options and their argument types. .TP 8 .BI \-weight " nnn" Set RGB weighting at 16 bpp. The default is 565. This applies only to those drivers which support 16 bpp. .TP 8 .BR \-verbose " [\fIn\fP]" Sets the verbosity level for information printed on stderr. If the .I n value isn't supplied, each occurrence of this option increments the verbosity level. When the .I n value is supplied, the verbosity level is set to that value. The default verbosity level is 0. .TP 8 .B \-version Print out the server version, patchlevel, release date, the operating system/platform it was built on, and whether it includes module loader support. .SH "KEYBOARD" .PP The .B Xorg server is normally configured to recognize various special combinations of key presses that instruct the server to perform some action, rather than just sending the key press event to a client application. These actions depend on the XKB keymap loaded by a particular keyboard device and may or may not be available on a given configuration. .PP The following key combinations are commonly part of the default XKEYBOARD keymap. .TP 8 .B Ctrl+Alt+Backspace Immediately kills the server -- no questions asked. It can be disabled by setting the .B DontZap xorg.conf(@filemansuffix@) file option to a TRUE value. .PP .RS 8 It should be noted that zapping is triggered by the .B Terminate_Server action in the keyboard map. This action is not part of the default keymaps but can be enabled with the XKB option .B \*qterminate:ctrl_alt_bksp\*q. .RE .TP 8 .B Ctrl+Alt+Keypad-Plus Change video mode to next one specified in the configuration file. This can be disabled with the .B DontZoom xorg.conf(@filemansuffix@) file option. .TP 8 .B Ctrl+Alt+Keypad-Minus Change video mode to previous one specified in the configuration file. This can be disabled with the .B DontZoom xorg.conf(@filemansuffix@) file option. .TP 8 .B Ctrl+Alt+F1...F12 For systems with virtual terminal support, these keystroke combinations are used to switch to virtual terminals 1 through 12, respectively. This can be disabled with the .B DontVTSwitch xorg.conf(@filemansuffix@) file option. .SH CONFIGURATION .B Xorg typically uses a configuration file called .B xorg.conf and configuration files with the suffix .I .conf in a directory called .B @xconfigdir@ for its initial setup. Refer to the xorg.conf(@filemansuffix@) manual page for information about the format of this file. .PP .B Xorg has a mechanism for automatically generating a built-in configuration at run-time when no .B xorg.conf file or .B @xconfigdir@ files are present. The current version of this automatic configuration mechanism works in two ways. .PP The first is via enhancements that have made many components of the .B xorg.conf file optional. This means that information that can be probed or reasonably deduced doesn't need to be specified explicitly, greatly reducing the amount of built-in configuration information that needs to be generated at run-time. .PP The second is to have "safe" fallbacks for most configuration information. This maximises the likelihood that the .B Xorg server will start up in some usable configuration even when information about the specific hardware is not available. .PP The automatic configuration support for Xorg is work in progress. It is currently aimed at the most popular hardware and software platforms supported by Xorg. Enhancements are planned for future releases. .SH FILES The .B Xorg server config files can be found in a range of locations. These are documented fully in the xorg.conf(@filemansuffix@) manual page. The most commonly used locations are shown here. .TP 30 .B /etc/X11/xorg.conf Server configuration file. .TP 30 .B /etc/X11/xorg.conf-4 Server configuration file. .TP 30 .B /etc/xorg.conf Server configuration file. .TP 30 .B @projectroot@/etc/xorg.conf Server configuration file. .TP 30 .B @projectroot@/lib/X11/xorg.conf Server configuration file. .TP 30 .B /etc/X11/@xconfigdir@ Server configuration directory. .TP 30 .B /etc/X11/@xconfigdir@-4 Server configuration directory. .TP 30 .B /etc/@xconfigdir@ Server configuration directory. .TP 30 .B @projectroot@/etc/@xconfigdir@ Server configuration directory. .TP 30 .B @projectroot@/lib/X11/@xconfigdir@ Server configuration directory. .TP 30 .BI @logdir@/Xorg. n .log Server log file for display .IR n . .TP 30 .B @projectroot@/bin/\(** Client binaries. .TP 30 .B @projectroot@/include/\(** Header files. .TP 30 .B @projectroot@/lib/\(** Libraries. .TP 30 .B @datadir@/fonts/X11/\(** Fonts. .TP 30 .B @projectroot@/share/X11/XErrorDB Client error message database. .TP 30 .B @projectroot@/lib/X11/app-defaults/\(** Client resource specifications. .TP 30 .B @mandir@/man?/\(** Manual pages. .TP 30 .BI /etc/X n .hosts Initial access control list for display .IR n . .SH "SEE ALSO" X(@miscmansuffix@), Xserver(@appmansuffix@), xdm(@appmansuffix@), xinit(@appmansuffix@), xorg.conf(@filemansuffix@), xvidtune(@appmansuffix@), xkeyboard-config (@miscmansuffix@), apm(@drivermansuffix@), ati(@drivermansuffix@), chips(@drivermansuffix@), cirrus(@drivermansuffix@), cyrix(@drivermansuffix@), fbdev(@drivermansuffix@), glide(@drivermansuffix@), glint(@drivermansuffix@), i128(@drivermansuffix@), i740(@drivermansuffix@), imstt(@drivermansuffix@), intel(@drivermansuffix@), mga(@drivermansuffix@), neomagic(@drivermansuffix@), nsc(@drivermansuffix@), nv(@drivermansuffix@), openchrome (@drivermansuffix@), r128(@drivermansuffix@), rendition(@drivermansuffix@), s3virge(@drivermansuffix@), siliconmotion(@drivermansuffix@), sis(@drivermansuffix@), sunbw2(@drivermansuffix@), suncg14(@drivermansuffix@), suncg3(@drivermansuffix@), suncg6(@drivermansuffix@), sunffb(@drivermansuffix@), sunleo(@drivermansuffix@), suntcx(@drivermansuffix@), tdfx(@drivermansuffix@), tga(@drivermansuffix@), trident(@drivermansuffix@), tseng(@drivermansuffix@), v4l(@drivermansuffix@), vesa(@drivermansuffix@), vmware(@drivermansuffix@), .br Web site .IR . .SH AUTHORS Xorg has many contributors world wide. The names of most of them can be found in the documentation, ChangeLog files in the source tree, and in the actual source code. .PP Xorg was originally based on XFree86 4.4rc2. That was originally based on \fIX386 1.2\fP by Thomas Roell, which was contributed to the then X Consortium's X11R5 distribution by SGCS. .PP Xorg is released by the X.Org Foundation. .PP The project that became XFree86 was originally founded in 1992 by David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. .PP XFree86 was later integrated in the then X Consortium's X11R6 release by a group of dedicated XFree86 developers, including the following: .PP .RS 4 .nf Stuart Anderson \fIanderson@metrolink.com\fP Doug Anson \fIdanson@lgc.com\fP Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP Mike Bernson \fImike@mbsun.mlb.org\fP Robin Cutshaw \fIrobin@XFree86.org\fP David Dawes \fIdawes@XFree86.org\fP Marc Evans \fImarc@XFree86.org\fP Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP Dirk Hohndel \fIhohndel@XFree86.org\fP David Holland \fIdavidh@use.com\fP Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP Glenn Lai \fIglenn@cs.utexas.edu\fP Ted Lemon \fImellon@ncd.com\fP Rich Murphey \fIrich@XFree86.org\fP Hans Nasten \fInasten@everyware.se\fP Mark Snitily \fImark@sgcs.com\fP Randy Terbush \fIrandyt@cse.unl.edu\fP Jon Tombs \fItombs@XFree86.org\fP Kees Verstoep \fIversto@cs.vu.nl\fP Paul Vixie \fIpaul@vix.com\fP Mark Weaver \fIMark_Weaver@brown.edu\fP David Wexelblat \fIdwex@XFree86.org\fP Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP Orest Zborowski \fIorestz@eskimo.com\fP .fi .RE .PP Xorg source is available from the FTP server \fI\fP, and from the X.Org server \fI\fP. Documentation and other information can be found from the X.Org web site \fI\fP. .SH LEGAL .PP .B Xorg is copyright software, provided under licenses that permit modification and redistribution in source and binary form without fee. .B Xorg is copyright by numerous authors and contributors from around the world. Licensing information can be found at .IR . Refer to the source code for specific copyright notices. .PP .B XFree86(TM) is a trademark of The XFree86 Project, Inc. .PP .B X11(TM) and .B X Window System(TM) are trademarks of The Open Group. xorg-server-1.20.8/hw/xfree86/man/xorg.conf.d.man0000644000175000017500000000006113640201473016305 00000000000000.so man@filemansuffix@/xorg.conf.@filemansuffix@ xorg-server-1.20.8/hw/xfree86/man/Xorg.wrap.man0000644000175000017500000000624313640201473016057 00000000000000.\" Xwrapper.wrap.@appmansuffix@ .\" .\" Copyright 2014 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. .\" .\" 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. .\" .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH Xorg.wrap @appmansuffix@ @xorgversion@ .SH NAME Xorg.wrap \- Xorg X server binary wrapper .SH DESCRIPTION The Xorg X server may need root rights to function properly. To start the Xorg X server with these rights your system is using a suid root wrapper installed as @suid_wrapper_dir@/Xorg.wrap which will execute the real X server which is installed as @suid_wrapper_dir@/Xorg. .PP By default Xorg.wrap will autodetect if root rights are necessary, and if not it will drop its elevated rights before starting the real X server. By default Xorg.wrap will only allow executing the real X server from login sessions on a physical console. .SH CONFIG FILE Xorg.wrap's default behavior can be overridden from the \fI@sysconfdir@/X11/Xwrapper.config\fP config file. Lines starting with a \fB#\fP in Xwrapper.config are considered comments and will be ignored. Any other non empty lines must take the form of \fBkey\fP = \fIvalue\fP. .TP 8 \fBallowed_users\fP = \fIrootonly\fP|\fIconsole\fP|\fIanybody\fP Specify which users may start the X server through the wrapper. Use \fIrootonly\fP to only allow root, use \fIconsole\fP to only allow users logged into a physical console, and use \fIanybody\fP to allow anybody. The default is \fIconsole\fP. .TP 8 \fBneeds_root_rights\fP = \fIyes\fP|\fIno\fP|\fIauto\fP Configure if the wrapper should drop its elevated (root) rights before starting the X server. Use \fIyes\fP to force execution as root, \fIno\fP to force execution with all suid rights dropped, and \fIauto\fP to let the wrapper auto-detect. The default is \fIauto\fP. .PP When auto-detecting the wrapper will drop rights if kms graphics are available and not drop them if no kms graphics are detected. If a system has multiple graphics cards and some are not kms capable auto-detection may fail, in this case manual configuration should be used. .SH "SEE ALSO" Xorg X server information: \fIXorg\fP(1) xorg-server-1.20.8/hw/xfree86/man/Makefile.in0000644000175000017500000006620713640201513015541 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @SUID_WRAPPER_TRUE@am__append_1 = Xorg.wrap.man @SUID_WRAPPER_TRUE@am__append_2 = Xwrapper.config.man @SUID_WRAPPER_FALSE@am__append_3 = Xorg.wrap.man Xwrapper.config.man subdir = hw/xfree86/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) \ $(am__append_3) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man appman_PRE = Xorg.man $(am__append_1) fileman_PRE = xorg.conf.man xorg.conf.d.man $(am__append_2) all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/man/Xwrapper.config.man0000644000175000017500000000005713640201473017241 00000000000000.so man@appmansuffix@/Xorg.wrap.@appmansuffix@ xorg-server-1.20.8/hw/xfree86/man/xorg.conf.man0000644000175000017500000022643213640201473016077 00000000000000.\" shorthand for double quote that works everywhere. .ds q \N'34' .TH xorg.conf @filemansuffix@ @vendorversion@ .SH NAME xorg.conf, @xconfigdir@ \- configuration files for Xorg X server .SH INTRODUCTION .B Xorg supports several mechanisms for supplying/obtaining configuration and run-time parameters: command line options, environment variables, the xorg.conf and @xconfigdir@ configuration files, auto-detection, and fallback defaults. When the same information is supplied in more than one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters can be supplied via all methods. The available command line options and environment variables (and some defaults) are described in the Xserver(@appmansuffix@) and Xorg(@appmansuffix@) manual pages. Most configuration file parameters, with their defaults, are described below. Driver and module specific configuration parameters are described in the relevant driver or module manual page. .SH DESCRIPTION .B Xorg uses a configuration file called .I xorg.conf and files ending in the suffix .I .conf from the directory .I @xconfigdir@ for its initial setup. The .I xorg.conf configuration file is searched for in the following places when the server is started as a normal user: .PP .RS 4 .nf .IR /etc/X11/ .IR @projectroot@/etc/X11/ .IB /etc/X11/ $XORGCONFIG .IB @projectroot@/etc/X11/ $XORGCONFIG .I /etc/X11/xorg.conf .I /etc/xorg.conf .IR @projectroot@/etc/X11/xorg.conf. .I @projectroot@/etc/X11/xorg.conf .IR @projectroot@/lib/X11/xorg.conf. .I @projectroot@/lib/X11/xorg.conf .fi .RE .PP where .I is a relative path (with no \(lq..\(rq components) specified with the .B \-config command line option, .B $XORGCONFIG is the relative path (with no \(lq..\(rq components) specified by that environment variable, and .I is the machine's hostname as reported by .BR gethostname (@libmansuffix@). .PP When the Xorg server is started by the \(lqroot\(rq user, the config file search locations are as follows: .PP .RS 4 .nf .IR /etc/X11/ .IR @projectroot@/etc/X11/ .B $XORGCONFIG .IB /etc/X11/ $XORGCONFIG .IB @projectroot@/etc/X11/ $XORGCONFIG .I /etc/X11/xorg.conf .I /etc/xorg.conf .IR @projectroot@/etc/X11/xorg.conf. .I @projectroot@/etc/X11/xorg.conf .IR @projectroot@/lib/X11/xorg.conf. .I @projectroot@/lib/X11/xorg.conf .fi .RE .PP where .I is the path specified with the .B \-config command line option (which may be absolute or relative), .B $XORGCONFIG is the path specified by that environment variable (absolute or relative), .B $HOME is the path specified by that environment variable (usually the home directory), and .I is the machine's hostname as reported by .BR gethostname (@libmansuffix@). .PP Additional configuration files are searched for in the following directories when the server is started as a normal user: .PP .RS 4 .nf .IR /etc/X11/ .IR @sysconfdir@/X11/ .I /etc/X11/@xconfigdir@ .I @sysconfdir@/X11/@xconfigdir@ .fi .RE .PP where .I is a relative path (with no \(lq..\(rq components) specified with the .B \-configdir command line option. .PP When the Xorg server is started by the \(lqroot\(rq user, the config directory search locations are as follows: .PP .RS 4 .nf .IR /etc/X11/ .IR @sysconfdir@/X11/ .I /etc/X11/@xconfigdir@ .I @sysconfdir@/X11/@xconfigdir@ .fi .RE .PP where .I is the path specified with the .B \-configdir command line option (which may be absolute or relative). .PP Finally, configuration files will also be searched for in a directory reserved for system use. This is to separate configuration files from the vendor or 3rd party packages from those of local administration. These files are found in the following directory: .PP .RS 4 .nf .I @datadir@/X11/@xconfigdir@ .fi .RE .PP The .I xorg.conf and .I @xconfigdir@ files are composed of a number of sections which may be present in any order, or omitted to use default configuration values. Each section has the form: .PP .RS 4 .nf .BI "Section \*q" SectionName \*q .RI " " SectionEntry ... .B EndSection .fi .RE .PP The section names are: .PP .RS 4 .nf .BR "Files " "File pathnames" .BR "ServerFlags " "Server flags" .BR "Module " "Dynamic module loading" .BR "Extensions " "Extension enabling" .BR "InputDevice " "Input device description" .BR "InputClass " "Input class description" .BR "OutputClass " "Output class description" .BR "Device " "Graphics device description" .BR "VideoAdaptor " "Xv video adaptor description" .BR "Monitor " "Monitor description" .BR "Modes " "Video modes descriptions" .BR "Screen " "Screen configuration" .BR "ServerLayout " "Overall layout" .BR "DRI " "DRI\-specific configuration" .BR "Vendor " "Vendor\-specific configuration" .fi .RE .PP The following obsolete section names are still recognised for compatibility purposes. In new config files, the .B InputDevice section should be used instead. .PP .RS 4 .nf .BR "Keyboard " "Keyboard configuration" .BR "Pointer " "Pointer/mouse configuration" .fi .RE .PP The old .B XInput section is no longer recognised. .PP The .B ServerLayout sections are at the highest level. They bind together the input and output devices that will be used in a session. The input devices are described in the .B InputDevice sections. Output devices usually consist of multiple independent components (e.g., a graphics board and a monitor). These multiple components are bound together in the .B Screen sections, and it is these that are referenced by the .B ServerLayout section. Each .B Screen section binds together a graphics board and a monitor. The graphics boards are described in the .B Device sections, and the monitors are described in the .B Monitor sections. .PP Config file keywords are case\-insensitive, and \(lq_\(rq characters are ignored. Most strings (including .B Option names) are also case-insensitive, and insensitive to white space and \(lq_\(rq characters. .PP Each config file entry usually takes up a single line in the file. They consist of a keyword, which is possibly followed by one or more arguments, with the number and types of the arguments depending on the keyword. The argument types are: .PP .RS 4 .nf .BR "Integer " "an integer number in decimal, hex or octal" .BR "Real " "a floating point number" .BR "String " "a string enclosed in double quote marks (\*q)" .fi .RE .PP Note: hex integer values must be prefixed with \(lq0x\(rq, and octal values with \(lq0\(rq. .PP A special keyword called .B Option may be used to provide free\-form data to various components of the server. The .B Option keyword takes either one or two string arguments. The first is the option name, and the optional second argument is the option value. Some commonly used option value types include: .PP .RS 4 .nf .BR "Integer " "an integer number in decimal, hex or octal" .BR "Real " "a floating point number" .BR "String " "a sequence of characters" .BR "Boolean " "a boolean value (see below)" .BR "Frequency " "a frequency value (see below)" .fi .RE .PP Note that .I all .B Option values, not just strings, must be enclosed in quotes. .PP Boolean options may optionally have a value specified. When no value is specified, the option's value is .BR TRUE . The following boolean option values are recognised as .BR TRUE : .PP .RS 4 .BR 1 , .BR on , .BR true , .B yes .RE .PP and the following boolean option values are recognised as .BR FALSE : .PP .RS 4 .BR 0 , .BR off , .BR false , .B no .RE .PP If an option name is prefixed with .RB \*q No \*q, then the option value is negated. .PP Example: the following option entries are equivalent: .PP .RS 4 .nf .B "Option \*qAccel\*q \*qOff\*q" .B "Option \*qNoAccel\*q" .B "Option \*qNoAccel\*q \*qOn\*q" .B "Option \*qAccel\*q \*qfalse\*q" .B "Option \*qAccel\*q \*qno\*q" .fi .RE .PP Frequency option values consist of a real number that is optionally followed by one of the following frequency units: .PP .RS 4 .BR Hz , .BR k , .BR kHz , .BR M , .B MHz .RE .PP When the unit name is omitted, the correct units will be determined from the value and the expectations of the appropriate range of the value. It is recommended that the units always be specified when using frequency option values to avoid any errors in determining the value. .SH "FILES SECTION" The .B Files section is used to specify some path names required by the server. Some of these paths can also be set from the command line (see .BR Xserver (@appmansuffix@) and .BR Xorg (@appmansuffix@)). The command line settings override the values specified in the config file. The .B Files section is optional, as are all of the entries that may appear in it. .PP The entries that can appear in this section are: .TP 7 .BI "FontPath \*q" path \*q sets the search path for fonts. This path is a comma separated list of font path elements which the Xorg server searches for font databases. Multiple .B FontPath entries may be specified, and they will be concatenated to build up the fontpath used by the server. Font path elements can be absolute directory paths, catalogue directories or a font server identifier. The formats of the later two are explained below: .PP .RS 7 Catalogue directories: .PP .RS 4 Catalogue directories can be specified using the prefix \fBcatalogue:\fR before the directory name. The directory can then be populated with symlinks pointing to the real font directories, using the following syntax in the symlink name: .PP .RS 4 .IR : [attribute]: pri= .RE .PP where .I is an alphanumeric identifier, .I [attribute] is an attribute which will be passed to the underlying FPE and .I is a number used to order the fontfile FPEs. Examples: .PP .RS 4 .nf .I 75dpi:unscaled:pri=20 -> /usr/share/X11/fonts/75dpi .I gscript:pri=60 -> /usr/share/fonts/default/ghostscript .I misc:unscaled:pri=10 \-> /usr/share/X11/fonts/misc .fi .PP .RE .RE .RE .PP .RS 7 Font server identifiers: .PP .RS 4 Font server identifiers have the form: .RS 4 .PP .IR / : .RE .PP where .I is the transport type to use to connect to the font server (e.g., .B unix for UNIX\-domain sockets or .B tcp for a TCP/IP connection), .I is the hostname of the machine running the font server, and .I is the port number that the font server is listening on (usually 7100). .RE .PP When this entry is not specified in the config file, the server falls back to the compiled\-in default font path, which contains the following font path elements (which can be set inside a catalogue directory): .PP .RS 4 .nf .I @datadir@/fonts/X11/misc/ .I @datadir@/fonts/X11/TTF/ .I @datadir@/fonts/X11/OTF/ .I @datadir@/fonts/X11/Type1/ .I @datadir@/fonts/X11/100dpi/ .I @datadir@/fonts/X11/75dpi/ .fi .RE .PP Font path elements that are found to be invalid are removed from the font path when the server starts up. .RE .TP 7 .BI "ModulePath \*q" path \*q sets the search path for loadable Xorg server modules. This path is a comma separated list of directories which the Xorg server searches for loadable modules loading in the order specified. Multiple .B ModulePath entries may be specified, and they will be concatenated to build the module search path used by the server. The default module path is .PP .RS 11 @modulepath@ .RE .\" The LogFile keyword is not currently implemented .ig .TP 7 .BI "LogFile \*q" path \*q sets the name of the Xorg server log file. The default log file name when running as root is .PP .RS 11 .RI @logdir@/Xorg. .log .RE and for non root it is .RS 11 .RI $XDG_DATA_HOME/xorg/Xorg. .log .RE .PP .RS 7 where .I is the display number for the Xorg server. .. .TP 7 .BI "XkbDir \*q" path \*q sets the base directory for keyboard layout files. The .B \-xkbdir command line option can be used to override this. The default directory is .PP .RS 11 @xkbdir@ .RE .SH "SERVERFLAGS SECTION" In addition to options specific to this section (described below), the .B ServerFlags section is used to specify some global Xorg server options. All of the entries in this section are .BR Options , although for compatibility purposes some of the old style entries are still recognised. Those old style entries are not documented here, and using them is discouraged. The .B ServerFlags section is optional, as are the entries that may be specified in it. .PP .B Options specified in this section (with the exception of the .B \*qDefaultServerLayout\*q .BR Option ) may be overridden by .B Options specified in the active .B ServerLayout section. Options with command line equivalents are overridden when their command line equivalent is used. The options recognised by this section are: .TP 7 .BI "Option \*qDebug\*q \*q" string \*q This comma-separated list provides a way to control various debugging switches from the config file. At the moment the only defined value is .B dmabuf_capable which instructs glamor to enable some unstable buffer management code. .TP 7 .BI "Option \*qDefaultServerLayout\*q \*q" layout\-id \*q This specifies the default .B ServerLayout section to use in the absence of the .B \-layout command line option. .TP 7 .BI "Option \*qNoTrapSignals\*q \*q" boolean \*q This prevents the Xorg server from trapping a range of unexpected fatal signals and exiting cleanly. Instead, the Xorg server will die and drop core where the fault occurred. The default behaviour is for the Xorg server to exit cleanly, but still drop a core file. In general you never want to use this option unless you are debugging an Xorg server problem and know how to deal with the consequences. .TP 7 .BI "Option \*qDontVTSwitch\*q \*q" boolean \*q This disallows the use of the .BI Ctrl+Alt+F n sequence (where .RI F n refers to one of the numbered function keys). That sequence is normally used to switch to another \*qvirtual terminal\*q on operating systems that have this feature. When this option is enabled, that key sequence has no special meaning and is passed to clients. Default: off. .TP 7 .BI "Option \*qDontZap\*q \*q" boolean \*q This disallows the use of the .B Terminate_Server XKB action (usually on Ctrl+Alt+Backspace, depending on XKB options). This action is normally used to terminate the Xorg server. When this option is enabled, the action has no effect. Default: off. .TP 7 .BI "Option \*qDontZoom\*q \*q" boolean \*q This disallows the use of the .B Ctrl+Alt+Keypad\-Plus and .B Ctrl+Alt+Keypad\-Minus sequences. These sequences allows you to switch between video modes. When this option is enabled, those key sequences have no special meaning and are passed to clients. Default: off. .TP 7 .BI "Option \*qDisableVidModeExtension\*q \*q" boolean \*q This disables the parts of the VidMode extension used by the xvidtune client that can be used to change the video modes. Default: the VidMode extension is enabled. .TP 7 .BI "Option \*qAllowNonLocalXvidtune\*q \*q" boolean \*q This allows the xvidtune client (and other clients that use the VidMode extension) to connect from another host. Default: off. .TP 7 .BI "Option \*qAllowMouseOpenFail\*q \*q" boolean \*q This tells the mousedrv(@drivermansuffix@) and vmmouse(@drivermansuffix@) drivers to not report failure if the mouse device can't be opened/initialised. It has no effect on the evdev(@drivermansuffix@) or other drivers. Default: false. .TP 7 .BI "Option \*qBlankTime\*q \*q" time \*q sets the inactivity timeout for the .B blank phase of the screensaver. .I time is in minutes. This is equivalent to the Xorg server's .B \-s flag, and the value can be changed at run\-time with .BR xset(@appmansuffix@). Default: 10 minutes. .TP 7 .BI "Option \*qStandbyTime\*q \*q" time \*q sets the inactivity timeout for the .B standby phase of DPMS mode. .I time is in minutes, and the value can be changed at run\-time with .BR xset(@appmansuffix@). Default: 10 minutes. This is only suitable for VESA DPMS compatible monitors, and may not be supported by all video drivers. It is only enabled for screens that have the .B \*qDPMS\*q option set (see the MONITOR section below). .TP 7 .BI "Option \*qSuspendTime\*q \*q" time \*q sets the inactivity timeout for the .B suspend phase of DPMS mode. .I time is in minutes, and the value can be changed at run\-time with .BR xset(@appmansuffix@). Default: 10 minutes. This is only suitable for VESA DPMS compatible monitors, and may not be supported by all video drivers. It is only enabled for screens that have the .B \*qDPMS\*q option set (see the MONITOR section below). .TP 7 .BI "Option \*qOffTime\*q \*q" time \*q sets the inactivity timeout for the .B off phase of DPMS mode. .I time is in minutes, and the value can be changed at run\-time with .BR xset(@appmansuffix@). Default: 10 minutes. This is only suitable for VESA DPMS compatible monitors, and may not be supported by all video drivers. It is only enabled for screens that have the .B \*qDPMS\*q option set (see the MONITOR section below). .TP 7 .BI "Option \*qMaxClients\*q \*q" integer \*q Set the maximum number of clients allowed to connect to the X server. Acceptable values are 64, 128, 256 or 512. .TP 7 .BI "Option \*qNoPM\*q \*q" boolean \*q Disables something to do with power management events. Default: PM enabled on platforms that support it. .TP 7 .BI "Option \*qXinerama\*q \*q" boolean \*q enable or disable XINERAMA extension. Default is disabled. .TP 7 .BI "Option \*qIndirectGLX\*q \*q" boolean \*q enable or disable indirect GLX contexts. Indirect GLX contexts are disabled by default. .TP 7 .BI "Option \*qDRI2\*q \*q" boolean \*q enable or disable DRI2. DRI2 is disabled by default. .TP 7 .BI "Option \*qGlxVisuals\*q \*q" string \*q This option controls how many GLX visuals the GLX modules sets up. The default value is .BR "typical" , which will setup up a typical subset of the GLXFBConfigs provided by the driver as GLX visuals. Other options are .BR "minimal" , which will set up the minimal set allowed by the GLX specification and .BR "all" which will setup GLX visuals for all GLXFBConfigs. .TP 7 .BI "Option \*qUseDefaultFontPath\*q \*q" boolean \*q Include the default font path even if other paths are specified in xorg.conf. If enabled, other font paths are included as well. Enabled by default. .TP 7 .BI "Option \*qIgnoreABI\*q \*q" boolean \*q Allow modules built for a different, potentially incompatible version of the X server to load. Disabled by default. .TP 7 .BI "Option \*qAutoAddDevices\*q \*q" boolean \*q If this option is disabled, then no devices will be added from the HAL or udev backends. Enabled by default. .TP 7 .BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q If this option is disabled, then the devices will be added (and the DevicePresenceNotify event sent), but not enabled, thus leaving policy up to the client. Enabled by default. .TP 7 .BI "Option \*qAutoAddGPU\*q \*q" boolean \*q If this option is disabled, then no GPU devices will be added from the udev backend. Enabled by default. (May need to be disabled to setup Xinerama). .TP 7 .BI "Option \*qLog\*q \*q" string \*q This option controls whether the log is flushed and/or synced to disk after each message. Possible values are .B flush or .BR sync . Unset by default. .SH "MODULE SECTION" The .B Module section is used to specify which Xorg server modules should be loaded. This section is ignored when the Xorg server is built in static form. The type of modules normally loaded in this section are Xorg server extension modules. Most other module types are loaded automatically when they are needed via other mechanisms. The .B Module section is optional, as are all of the entries that may be specified in it. .PP Entries in this section may be in two forms. The first and most commonly used form is an entry that uses the .B Load keyword, as described here: .TP 7 .BI "Load \*q" modulename \*q This instructs the server to load the module called .IR modulename . The module name given should be the module's standard name, not the module file name. The standard name is case\-sensitive, and does not include the \(lqlib\(rq or \(lqcyg\(rq prefixes, or the \(lq.so\(rq or \(lq.dll\(rq suffixes. .PP .RS 7 Example: the DRI extension module can be loaded with the following entry: .PP .RS 4 .B "Load \*qdri\*q" .RE .RE .TP 7 .BI "Disable \*q" modulename \*q This instructs the server to not load the module called .IR modulename . Some modules are loaded by default in the server, and this overrides that default. If a .B Load instruction is given for the same module, it overrides the .B Disable instruction and the module is loaded. The module name given should be the module's standard name, not the module file name. As with the .B Load instruction, the standard name is case-sensitive, and does not include the "lib" prefix, or the ".a", ".o", or ".so" suffixes. .PP The second form of entry is a .BR SubSection, with the subsection name being the module name, and the contents of the .B SubSection being .B Options that are passed to the module when it is loaded. .PP Example: the extmod module (which contains a miscellaneous group of server extensions) can be loaded, with the XFree86\-DGA extension disabled by using the following entry: .PP .RS 4 .nf .B "SubSection \*qextmod\*q" .B " Option \*qomit XFree86\-DGA\*q" .B EndSubSection .fi .RE .PP Modules are searched for in each directory specified in the .B ModulePath search path, and in the drivers, extensions, input, internal, and multimedia subdirectories of each of those directories. In addition to this, operating system specific subdirectories of all the above are searched first if they exist. .PP To see what extension modules are available, check the extensions subdirectory under: .PP .RS 4 .nf @modulepath@ .fi .RE .PP The \(lqextmod\(rq, \(lqdbe\(rq, \(lqdri\(rq, \(lqdri2\(rq, \(lqglx\(rq, and \(lqrecord\(rq extension modules are loaded automatically, if they are present, unless disabled with \*qDisable\*q entries. It is recommended that at very least the \(lqextmod\(rq extension module be loaded. If it isn't, some commonly used server extensions (like the SHAPE extension) will not be available. .SH "EXTENSIONS SECTION" The .B Extensions section is used to specify which X11 protocol extensions should be enabled or disabled. The .B Extensions section is optional, as are all of the entries that may be specified in it. .PP Entries in this section are listed as Option statements with the name of the extension as the first argument, and a boolean value as the second. The extension name is case\-sensitive, and matches the form shown in the output of \*qXorg -extension ?\*q. .PP .RS 7 Example: the MIT-SHM extension can be disabled with the following entry: .PP .RS 4 .nf .B "Section \*qExtensions\*q" .B " Option \*qMIT-SHM\*q \*qDisable\*q" .B "EndSection" .fi .RE .RE .SH "INPUTDEVICE SECTION" The config file may have multiple .B InputDevice sections. Recent X servers employ HAL or udev backends for input device enumeration and input hotplugging. It is usually not necessary to provide .B InputDevice sections in the xorg.conf if hotplugging is in use (i.e. AutoAddDevices is enabled). If hotplugging is enabled, .B InputDevice sections using the .B mouse, kbd and .B vmmouse driver will be ignored. .PP If hotplugging is disabled, there will normally be at least two: one for the core (primary) keyboard and one for the core pointer. If either of these two is missing, a default configuration for the missing ones will be used. In the absence of an explicitly specified core input device, the first .B InputDevice marked as .B CorePointer (or .BR CoreKeyboard ) is used. If there is no match there, the first .B InputDevice that uses the \(lqmouse\(rq (or \(lqkbd\(rq) driver is used. The final fallback is to use built\-in default configurations. Currently the default configuration may not work as expected on all platforms. .PP .B InputDevice sections have the following format: .PP .RS 4 .nf .B "Section \*qInputDevice\*q" .BI " Identifier \*q" name \*q .BI " Driver \*q" inputdriver \*q .I " options" .I " ..." .B "EndSection" .fi .RE .PP The .B Identifier and .B Driver entries are required in all .B InputDevice sections. All other entries are optional. .PP The .B Identifier entry specifies the unique name for this input device. The .B Driver entry specifies the name of the driver to use for this input device. When using the loadable server, the input driver module .RI \*q inputdriver \*q will be loaded for each active .B InputDevice section. An .B InputDevice section is considered active if it is referenced by an active .B ServerLayout section, if it is referenced by the .B \-keyboard or .B \-pointer command line options, or if it is selected implicitly as the core pointer or keyboard device in the absence of such explicit references. The most commonly used input drivers are .BR evdev (@drivermansuffix@) on Linux systems, and .BR kbd (@drivermansuffix@) and .BR mousedrv (@drivermansuffix@) on other platforms. .PP .PP .B InputDevice sections recognise some driver\-independent .BR Options , which are described here. See the individual input driver manual pages for a description of the device\-specific options. .TP 7 .BI "Option \*qAutoServerLayout\*q \*q" boolean \*q Always add the device to the ServerLayout section used by this instance of the server. This affects implied layouts as well as explicit layouts specified in the configuration and/or on the command line. .TP 7 .BI "Option \*qCorePointer\*q" Deprecated, see .B Floating .TP 7 .BI "Option \*qCoreKeyboard\*q" Deprecated, see .B Floating .TP 7 .BI "Option \*qAlwaysCore\*q \*q" boolean \*q Deprecated, see .B Floating .TP 7 .BI "Option \*qSendCoreEvents\*q \*q" boolean \*q Deprecated, see .B Floating .TP 7 .BI "Option \*qFloating\*q \*q" boolean \*q When enabled, the input device is set up floating and does not report events through any master device or control a cursor. The device is only available to clients using the X Input Extension API. This option is disabled by default. The options .B CorePointer, .B CoreKeyboard, .B AlwaysCore, and .B SendCoreEvents, are the inverse of option .B Floating (i.e. .B SendCoreEvents \*qon\*q is equivalent to .B Floating \*qoff\*q ). This option controls the startup behavior only, a device may be reattached or set floating at runtime. .TP 7 .BI "Option \*qTransformationMatrix\*q \*q" a " " b " " c " " d " " e " " f " " g " " h " " i \*q Specifies the 3x3 transformation matrix for absolute input devices. The input device will be bound to the area given in the matrix. In most configurations, "a" and "e" specify the width and height of the area the device is bound to, and "c" and "f" specify the x and y offset of the area. The value range is 0 to 1, where 1 represents the width or height of all root windows together, 0.5 represents half the area, etc. The values represent a 3x3 matrix, with the first, second and third group of three values representing the first, second and third row of the matrix, respectively. The identity matrix is "1 0 0 0 1 0 0 0 1". .SS POINTER ACCELERATION For pointing devices, the following options control how the pointer is accelerated or decelerated with respect to physical device motion. Most of these can be adjusted at runtime, see the xinput(1) man page for details. Only the most important acceleration options are discussed here. .TP 7 .BI "Option \*qAccelerationProfile\*q \*q" integer \*q Select the profile. In layman's terms, the profile constitutes the "feeling" of the acceleration. More formally, it defines how the transfer function (actual acceleration as a function of current device velocity and acceleration controls) is constructed. This is mainly a matter of personal preference. .PP .RS 6 .nf .B " 0 classic (mostly compatible)" .B "-1 none (only constant deceleration is applied)" .B " 1 device-dependent" .B " 2 polynomial (polynomial function)" .B " 3 smooth linear (soft knee, then linear)" .B " 4 simple (normal when slow, otherwise accelerated)" .B " 5 power (power function)" .B " 6 linear (more speed, more acceleration)" .B " 7 limited (like linear, but maxes out at threshold)" .fi .RE .TP 7 .BI "Option \*qConstantDeceleration\*q \*q" real \*q Makes the pointer go .B deceleration times slower than normal. Most useful for high-resolution devices. A value between 0 and 1 will speed up the pointer. .TP 7 .BI "Option \*qAdaptiveDeceleration\*q \*q" real \*q Allows to actually decelerate the pointer when going slow. At most, it will be .B adaptive deceleration times slower. Enables precise pointer placement without sacrificing speed. .TP 7 .BI "Option \*qAccelerationScheme\*q \*q" string \*q Selects the scheme, which is the underlying algorithm. .PP .RS 7 .nf .B "predictable default algorithm (behaving more predictable)" .B "lightweight old acceleration code (as specified in the X protocol spec)" .B "none no acceleration or deceleration" .fi .RE .TP 7 .BI "Option \*qAccelerationNumerator\*q \*q" integer \*q .TP 7 .BI "Option \*qAccelerationDenominator\*q \*q" integer \*q Set numerator and denominator of the acceleration factor. The acceleration factor is a rational which, together with threshold, can be used to tweak profiles to suit the users needs. The .B simple and .B limited profiles use it directly (i.e. they accelerate by the factor), for other profiles it should hold that a higher acceleration factor leads to a faster pointer. Typically, 1 is unaccelerated and values up to 5 are sensible. .TP 7 .BI "Option \*qAccelerationThreshold\*q \*q" integer \*q Set the threshold, which is roughly the velocity (usually device units per 10 ms) required for acceleration to become effective. The precise effect varies with the profile however. .SH "INPUTCLASS SECTION" The config file may have multiple .B InputClass sections. These sections are optional and are used to provide configuration for a class of input devices as they are automatically added. An input device can match more than one .B InputClass section. Each class can override settings from a previous class, so it is best to arrange the sections with the most generic matches first. .PP .B InputClass sections have the following format: .PP .RS 4 .nf .B "Section \*qInputClass\*q" .BI " Identifier \*q" name \*q .I " entries" .I " ..." .I " options" .I " ..." .B "EndSection" .fi .RE .PP The .B Identifier entry is required in all .B InputClass sections. All other entries are optional. .PP The .B Identifier entry specifies the unique name for this input class. The .B Driver entry specifies the name of the driver to use for this input device. After all classes have been examined, the .RI \*q inputdriver \*q module from the first .B Driver entry will be enabled when using the loadable server. .PP When an input device is automatically added, its characteristics are checked against all .B InputClass sections. Each section can contain optional entries to narrow the match of the class. If none of the optional entries appear, the .B InputClass section is generic and will match any input device. If more than one of these entries appear, they all must match for the configuration to apply. .PP There are two types of match entries used in .B InputClass sections. The first allows various tokens to be matched against attributes of the device. An entry can be constructed to match attributes from different devices by separating arguments with a '|' character. Multiple entries of the same type may be supplied to add multiple matching conditions on the same attribute. For example: .PP .RS 4 .nf .B "Section \*qInputClass\*q" .B " Identifier \*qMy Class\*q" .B " # product string must contain example and .B " # either gizmo or gadget .B " MatchProduct \*qexample\*q .B " MatchProduct \*qgizmo|gadget\*q .B " NoMatchDriver \*qdrivername\*q .I " ..." .B "EndSection" .fi .RE .TP 7 .BI "MatchProduct \*q" matchproduct \*q This entry can be used to check if the substring .RI \*q matchproduct \*q occurs in the device's product name. .TP 7 .BI "MatchVendor \*q" matchvendor \*q This entry can be used to check if the substring .RI \*q matchvendor \*q occurs in the device's vendor name. .TP 7 .BI "MatchDevicePath \*q" matchdevice \*q This entry can be used to check if the device file matches the .RI \*q matchdevice \*q pathname pattern. .TP 7 .BI "MatchOS \*q" matchos \*q This entry can be used to check if the operating system matches the case-insensitive .RI \*q matchos \*q string. This entry is only supported on platforms providing the .BR uname (2) system call. .TP 7 .BI "MatchPnPID \*q" matchpnp \*q The device's Plug and Play (PnP) ID can be checked against the .RI \*q matchpnp \*q shell wildcard pattern. .TP 7 .BI "MatchUSBID \*q" matchusb \*q The device's USB ID can be checked against the .RI \*q matchusb \*q shell wildcard pattern. The ID is constructed as lowercase hexadecimal numbers separated by a ':'. This is the same format as the .BR lsusb (8) program. .TP 7 .BI "MatchDriver \*q" matchdriver \*q Check the case-sensitive string .RI \*q matchdriver \*q against the currently configured driver of the device. Ordering of sections using this entry is important since it will not match unless the driver has been set by the config backend or a previous .B InputClass section. .TP 7 .BI "MatchTag \*q" matchtag \*q This entry can be used to check if tags assigned by the config backend matches the .RI \*q matchtag \*q pattern. A match is found if at least one of the tags given in .RI \*q matchtag \*q matches at least one of the tags assigned by the backend. .TP 7 .BI "MatchLayout \*q" matchlayout \*q Check the case-sensitive string .RI \*q matchlayout \*q against the currently active .B ServerLayout section. The empty string "" matches an implicit layout which appears if no named .B ServerLayout sections have been found. .PP The above directives have equivalents for negative matching with the .B NoMatchProduct, .B NoMatchVendor, .B NoMatchDevicePath, .B NoMatchOS, .B NoMatchPnPID, .B NoMatchUSBID, .B NoMatchDriver, .B NoMatchTag, and .B NoMatchLayout directives. These NoMatch directives match if the subsequent match is not met by the device. .PP The second type of entry is used to match device types. These entries take a boolean argument similar to .B Option entries. .TP 7 .BI "MatchIsKeyboard \*q" bool \*q .TP 7 .BI "MatchIsPointer \*q" bool \*q .TP 7 .BI "MatchIsJoystick \*q" bool \*q .TP 7 .BI "MatchIsTablet \*q" bool \*q .TP 7 .BI "MatchIsTabletPad \*q" bool \*q .TP 7 .BI "MatchIsTouchpad \*q" bool \*q .TP 7 .BI "MatchIsTouchscreen \*q" bool \*q .PP When an input device has been matched to the .B InputClass section, any .B Option entries are applied to the device. One .B InputClass specific .B Option is recognized. See the .B InputDevice section above for a description of the remaining .B Option entries. .TP 7 .BI "Option \*qIgnore\*q \*q" boolean \*q This optional entry specifies that the device should be ignored entirely, and not added to the server. This can be useful when the device is handled by another program and no X events should be generated. .SH "OUTPUTCLASS SECTION" The config file may have multiple .B OutputClass sections. These sections are optional and are used to provide configuration for a class of output devices as they are automatically added. An output device can match more than one .B OutputClass section. Each class can override settings from a previous class, so it is best to arrange the sections with the most generic matches first. .PP .B OutputClass sections have the following format: .PP .RS 4 .nf .B "Section \*qOutputClass\*q" .BI " Identifier \*q" name \*q .I " entries" .I " ..." .B "EndSection" .fi .RE .PP The .B Identifier entry is required in all .B OutputClass sections. All other entries are optional. .PP The .B Identifier entry specifies the unique name for this output class. The .B Driver entry specifies the name of the driver to use for this output device. After all classes have been examined, the .RI \*q outputdriver \*q module from the first .B Driver entry will be enabled when using the loadable server. .PP When an output device is automatically added, its characteristics are checked against all .B OutputClass sections. Each section can contain optional entries to narrow the match of the class. If none of the optional entries appear, the .B OutputClass section is generic and will match any output device. If more than one of these entries appear, they all must match for the configuration to apply. .PP The following list of tokens can be matched against attributes of the device. An entry can be constructed to match attributes from different devices by separating arguments with a '|' character. .PP For example: .PP .RS 4 .nf .B "Section \*qOutputClass\*q" .B " Identifier \*qMy Class\*q" .B " # kernel driver must be either foo or bar .B " MatchDriver \*qfoo|bar\*q .I " ..." .B "EndSection" .fi .RE .TP 7 .BI "MatchDriver \*q" matchdriver \*q Check the case-sensitive string .RI \*q matchdriver \*q against the kernel driver of the device. .PP When an output device has been matched to the .B OutputClass section, any .B Option entries are applied to the device. One .B OutputClass specific .B Option is recognized. See the .B Device section below for a description of the remaining .B Option entries. .TP 7 .BI "Option \*qPrimaryGPU\*q \*q" boolean \*q This option specifies that the matched device should be treated as the primary GPU, replacing the selection of the GPU used as output by the firmware. If multiple output devices match an OutputClass section with the PrimaryGPU option set, the first one enumerated becomes the primary GPU. .PP A .B OutputClass Section may contain .B ModulePath entries. When an output device matches an .B OutputClass section, any .B ModulePath entries in that .B OutputClass are pre-pended to the search path for loadable Xorg server modules. See .B ModulePath in the .B Files section for more info. .SH "DEVICE SECTION" The config file may have multiple .B Device sections. There must be at least one, for the video card being used. .PP .B Device sections have the following format: .PP .RS 4 .nf .B "Section \*qDevice\*q" .BI " Identifier \*q" name \*q .BI " Driver \*q" driver \*q .I " entries" .I " ..." .B "EndSection" .fi .RE .PP The .B Identifier and .B Driver entries are required in all .B Device sections. All other entries are optional. .PP The .B Identifier entry specifies the unique name for this graphics device. The .B Driver entry specifies the name of the driver to use for this graphics device. When using the loadable server, the driver module .RI \*q driver \*q will be loaded for each active .B Device section. A .B Device section is considered active if it is referenced by an active .B Screen section. .PP .B Device sections recognise some driver\-independent entries and .BR Options , which are described here. Not all drivers make use of these driver\-independent entries, and many of those that do don't require them to be specified because the information is auto\-detected. See the individual graphics driver manual pages for further information about this, and for a description of the device\-specific options. Note that most of the .B Options listed here (but not the other entries) may be specified in the .B Screen section instead of here in the .B Device section. .TP 7 .BI "BusID \*q" bus\-id \*q This specifies the bus location of the graphics card. For PCI/AGP cards, the .I bus\-id string has the form .BI PCI: bus @ domain : device : function (e.g., \(lqPCI:1@0:0:0\(rq might be appropriate for an AGP card). The "@domain" part can be left out for PCI domain 0. This field is usually optional in single-head configurations when using the primary graphics card. In multi-head configurations, or when using a secondary graphics card in a single-head configuration, this entry is mandatory. Its main purpose is to make an unambiguous connection between the device section and the hardware it is representing. This information can usually be found by running the pciaccess tool scanpci. .TP 7 .BI "Screen " number This option is mandatory for cards where a single PCI entity can drive more than one display (i.e., multiple CRTCs sharing a single graphics accelerator and video memory). One .B Device section is required for each head, and this parameter determines which head each of the .B Device sections applies to. The legal values of .I number range from 0 to one less than the total number of heads per entity. Most drivers require that the primary screen (0) be present. .TP 7 .BI "Chipset \*q" chipset \*q This usually optional entry specifies the chipset used on the graphics board. In most cases this entry is not required because the drivers will probe the hardware to determine the chipset type. Don't specify it unless the driver-specific documentation recommends that you do. .TP 7 .BI "Ramdac \*q" ramdac\-type \*q This optional entry specifies the type of RAMDAC used on the graphics board. This is only used by a few of the drivers, and in most cases it is not required because the drivers will probe the hardware to determine the RAMDAC type where possible. Don't specify it unless the driver-specific documentation recommends that you do. .TP 7 .BI "DacSpeed " speed .TP 7 .BI "DacSpeed " "speed\-8 speed\-16 speed\-24 speed\-32" This optional entry specifies the RAMDAC speed rating (which is usually printed on the RAMDAC chip). The speed is in MHz. When one value is given, it applies to all framebuffer pixel sizes. When multiple values are given, they apply to the framebuffer pixel sizes 8, 16, 24 and 32 respectively. This is not used by many drivers, and only needs to be specified when the speed rating of the RAMDAC is different from the defaults built in to driver, or when the driver can't auto-detect the correct defaults. Don't specify it unless the driver-specific documentation recommends that you do. .TP 7 .BI "Clocks " "clock ..." specifies the pixel that are on your graphics board. The clocks are in MHz, and may be specified as a floating point number. The value is stored internally to the nearest kHz. The ordering of the clocks is important. It must match the order in which they are selected on the graphics board. Multiple .B Clocks lines may be specified, and each is concatenated to form the list. Most drivers do not use this entry, and it is only required for some older boards with non-programmable clocks. Don't specify this entry unless the driver-specific documentation explicitly recommends that you do. .TP .BI "ClockChip \*q" clockchip\-type \*q This optional entry is used to specify the clock chip type on graphics boards which have a programmable clock generator. Only a few Xorg drivers support programmable clock chips. For details, see the appropriate driver manual page. .TP 7 .BI "VideoRam " "mem" This optional entry specifies the amount of video ram that is installed on the graphics board. This is measured in kBytes. In most cases this is not required because the Xorg server probes the graphics board to determine this quantity. The driver-specific documentation should indicate when it might be needed. .TP 7 .BI "MemBase " "baseaddress" This optional entry specifies the memory base address of a graphics board's linear frame buffer. This entry is not used by many drivers, and it should only be specified if the driver-specific documentation recommends it. .TP 7 .BI "IOBase " "baseaddress" This optional entry specifies the IO base address. This entry is not used by many drivers, and it should only be specified if the driver-specific documentation recommends it. .TP 7 .BI "ChipID " "id" This optional entry specifies a numerical ID representing the chip type. For PCI cards, it is usually the device ID. This can be used to override the auto-detection, but that should only be done when the driver-specific documentation recommends it. .TP 7 .BI "ChipRev " "rev" This optional entry specifies the chip revision number. This can be used to override the auto-detection, but that should only be done when the driver-specific documentation recommends it. .TP 7 .BI "MatchSeat " "seat\-id" Only apply this .B Device section if X server was started with .B -seat .I seat\-id option. .TP 7 .BI "Option \*qModeDebug\*q \*q" boolean \*q Enable printing of additional debugging information about modesetting to the server log. .TP 7 .BI "Option \*qPreferCloneMode\*q \*q" boolean \*q If enabled, bring up monitors of a screen in clone mode instead of horizontal extended layout by default. (Defaults to off; the video driver can change the default value, but this option can always override it) .ig .TP 7 This optional entry allows an IRQ number to be specified. .. .TP 7 .B Options Option flags may be specified in the .B Device sections. These include driver\-specific options and driver\-independent options. The former are described in the driver\-specific documentation. Some of the latter are described below in the section about the .B Screen section, and they may also be included here. .SH "VIDEOADAPTOR SECTION" Nobody wants to say how this works. Maybe nobody knows ... .SH "MONITOR SECTION" The config file may have multiple .B Monitor sections. There should normally be at least one, for the monitor being used, but a default configuration will be created when one isn't specified. .PP .B Monitor sections have the following format: .PP .RS 4 .nf .B "Section \*qMonitor\*q" .BI " Identifier \*q" name \*q .I " entries" .I " ..." .B "EndSection" .fi .RE .PP The only mandatory entry in a .B Monitor section is the .B Identifier entry. .PP The .B Identifier entry specifies the unique name for this monitor. The .B Monitor section may be used to provide information about the specifications of the monitor, monitor-specific .BR Options , and information about the video modes to use with the monitor. .PP With RandR 1.2-enabled drivers, monitor sections may be tied to specific outputs of the video card. Using the name of the output defined by the video driver plus the identifier of a monitor section, one associates a monitor section with an output by adding an option to the Device section in the following format: .BI "Option \*qMonitor-" outputname "\*q \*q" monitorsection \*q (for example, .B Option \*qMonitor-VGA\*q \*qVGA monitor\*q for a VGA output) .PP In the absence of specific association of monitor sections to outputs, if a monitor section is present the server will associate it with an output to preserve compatibility for previous single-head configurations. .PP Specifying video modes is optional because the server will use the DDC or other information provided by the monitor to automatically configure the list of modes available. When modes are specified explicitly in the .B Monitor section (with the .BR Mode , .BR ModeLine , or .B UseModes keywords), built-in modes with the same names are not included. Built-in modes with different names are, however, still implicitly included, when they meet the requirements of the monitor. .PP The entries that may be used in .B Monitor sections are described below. .TP 7 .BI "VendorName \*q" vendor \*q This optional entry specifies the monitor's manufacturer. .TP 7 .BI "ModelName \*q" model \*q This optional entry specifies the monitor's model. .TP 7 .BI "HorizSync " "horizsync\-range" gives the range(s) of horizontal sync frequencies supported by the monitor. .I horizsync\-range may be a comma separated list of either discrete values or ranges of values. A range of values is two values separated by a dash. By default the values are in units of kHz. They may be specified in MHz or Hz if .B MHz or .B Hz is added to the end of the line. The data given here is used by the Xorg server to determine if video modes are within the specifications of the monitor. This information should be available in the monitor's handbook. If this entry is omitted, a default range of 28\-33kHz is used. .TP 7 .BI "VertRefresh " "vertrefresh\-range" gives the range(s) of vertical refresh frequencies supported by the monitor. .I vertrefresh\-range may be a comma separated list of either discrete values or ranges of values. A range of values is two values separated by a dash. By default the values are in units of Hz. They may be specified in MHz or kHz if .B MHz or .B kHz is added to the end of the line. The data given here is used by the Xorg server to determine if video modes are within the specifications of the monitor. This information should be available in the monitor's handbook. If this entry is omitted, a default range of 43\-72Hz is used. .TP 7 .BI "DisplaySize " "width height" This optional entry gives the width and height, in millimetres, of the picture area of the monitor. If given this is used to calculate the horizontal and vertical pitch (DPI) of the screen. .TP 7 .BI "Gamma " "gamma\-value" .TP 7 .BI "Gamma " "red\-gamma green\-gamma blue\-gamma" This is an optional entry that can be used to specify the gamma correction for the monitor. It may be specified as either a single value or as three separate RGB values. The values should be in the range 0.1 to 10.0, and the default is 1.0. Not all drivers are capable of using this information. .TP 7 .BI "UseModes \*q" modesection\-id \*q Include the set of modes listed in the .B Modes section called .IR modesection\-id. This makes all of the modes defined in that section available for use by this monitor. .TP 7 .BI "Mode \*q" name \*q This is an optional multi-line entry that can be used to provide definitions for video modes for the monitor. In most cases this isn't necessary because the built-in set of VESA standard modes will be sufficient. The .B Mode keyword indicates the start of a multi-line video mode description. The mode description is terminated with the .B EndMode keyword. The mode description consists of the following entries: .RS 7 .TP 4 .BI "DotClock " clock is the dot (pixel) clock rate to be used for the mode. .TP 4 .BI "HTimings " "hdisp hsyncstart hsyncend htotal" specifies the horizontal timings for the mode. .TP 4 .BI "VTimings " "vdisp vsyncstart vsyncend vtotal" specifies the vertical timings for the mode. .TP 4 .BI "Flags \*q" flag \*q " ..." specifies an optional set of mode flags, each of which is a separate string in double quotes. .B \*qInterlace\*q indicates that the mode is interlaced. .B \*qDoubleScan\*q indicates a mode where each scanline is doubled. .B \*q+HSync\*q and .B \*q\-HSync\*q can be used to select the polarity of the HSync signal. .B \*q+VSync\*q and .B \*q\-VSync\*q can be used to select the polarity of the VSync signal. .B \*qComposite\*q can be used to specify composite sync on hardware where this is supported. Additionally, on some hardware, .B \*q+CSync\*q and .B \*q\-CSync\*q may be used to select the composite sync polarity. .TP 4 .BI "HSkew " hskew specifies the number of pixels (towards the right edge of the screen) by which the display enable signal is to be skewed. Not all drivers use this information. This option might become necessary to override the default value supplied by the server (if any). \(lqRoving\(rq horizontal lines indicate this value needs to be increased. If the last few pixels on a scan line appear on the left of the screen, this value should be decreased. .TP 4 .BI "VScan " vscan specifies the number of times each scanline is painted on the screen. Not all drivers use this information. Values less than 1 are treated as 1, which is the default. Generally, the .B \*qDoubleScan\*q .B Flag mentioned above doubles this value. .RE .TP 7 .BI "ModeLine \*q" name \*q " mode\-description" This entry is a more compact version of the .B Mode entry, and it also can be used to specify video modes for the monitor. This is a single line format for specifying video modes. In most cases this isn't necessary because the built\-in set of VESA standard modes will be sufficient. .PP .RS 7 The .I mode\-description is in four sections, the first three of which are mandatory. The first is the dot (pixel) clock. This is a single number specifying the pixel clock rate for the mode in MHz. The second section is a list of four numbers specifying the horizontal timings. These numbers are the .IR hdisp , .IR hsyncstart , .IR hsyncend , and .I htotal values. The third section is a list of four numbers specifying the vertical timings. These numbers are the .IR vdisp , .IR vsyncstart , .IR vsyncend , and .I vtotal values. The final section is a list of flags specifying other characteristics of the mode. .B Interlace indicates that the mode is interlaced. .B DoubleScan indicates a mode where each scanline is doubled. .B +HSync and .B \-HSync can be used to select the polarity of the HSync signal. .B +VSync and .B \-VSync can be used to select the polarity of the VSync signal. .B Composite can be used to specify composite sync on hardware where this is supported. Additionally, on some hardware, .B +CSync and .B \-CSync may be used to select the composite sync polarity. The .B HSkew and .B VScan options mentioned above in the .B Mode entry description can also be used here. .RE .TP 7 .BI "Option \*qDPMS\*q \*q" bool \*q This option controls whether the server should enable the DPMS extension for power management for this screen. The default is to enable the extension. .TP 7 .BI "Option \*qSyncOnGreen\*q \*q" bool \*q This option controls whether the video card should drive the sync signal on the green color pin. Not all cards support this option, and most monitors do not require it. The default is off. .TP 7 .BI "Option \*qPrimary\*q \*q" bool \*q This optional entry specifies that the monitor should be treated as the primary monitor. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qPreferredMode\*q \*q" name \*q This optional entry specifies a mode to be marked as the preferred initial mode of the monitor. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qZoomModes\*q \*q" name " " name " " ... \*q This optional entry specifies modes to be marked as zoom modes. It is possible to switch to the next and previous mode via .BR Ctrl+Alt+Keypad\-Plus " and " Ctrl+Alt+Keypad\-Minus . All these keypad available modes are selected from the screen mode list. This list is a copy of the compatibility output monitor mode list. Since this output is the output connected to the lowest dot-area monitor, as determined from its largest size mode, that monitor defines the available zoom modes. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qPosition\*q \*q" x " " y \*q This optional entry specifies the position of the monitor within the X screen. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qLeftOf\*q \*q" output \*q This optional entry specifies that the monitor should be positioned to the left of the output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qRightOf\*q \*q" output \*q This optional entry specifies that the monitor should be positioned to the right of the output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qAbove\*q \*q" output \*q This optional entry specifies that the monitor should be positioned above the output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qBelow\*q \*q" output \*q This optional entry specifies that the monitor should be positioned below the output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qEnable\*q \*q" bool \*q This optional entry specifies whether the monitor should be turned on at startup. By default, the server will attempt to enable all connected monitors. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qDefaultModes\*q \*q" bool \*q This optional entry specifies whether the server should add supported default modes to the list of modes offered on this monitor. By default, the server will add default modes; you should only disable this if you can guarantee that EDID will be available at all times, or if you have added custom modelines which the server can use. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qMinClock\*q \*q" frequency \*q This optional entry specifies the minimum dot clock, in kHz, that is supported by the monitor. .TP 7 .BI "Option \*qMaxClock\*q \*q" frequency \*q This optional entry specifies the maximum dot clock, in kHz, that is supported by the monitor. .TP 7 .BI "Option \*qIgnore\*q \*q" bool \*q This optional entry specifies that the monitor should be ignored entirely, and not reported through RandR. This is useful if the hardware reports the presence of outputs that don't exist. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option \*qRotate\*q \*q" rotation \*q This optional entry specifies the initial rotation of the given monitor. Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and \*qinverted\*q. (RandR 1.2-supporting drivers only) .SH "MODES SECTION" The config file may have multiple .B Modes sections, or none. These sections provide a way of defining sets of video modes independently of the .B Monitor sections. .B Monitor sections may include the definitions provided in these sections by using the .B UseModes keyword. In most cases the .B Modes sections are not necessary because the built\-in set of VESA standard modes will be sufficient. .PP .B Modes sections have the following format: .PP .RS 4 .nf .B "Section \*qModes\*q" .BI " Identifier \*q" name \*q .I " entries" .I " ..." .B "EndSection" .fi .RE .PP The .B Identifier entry specifies the unique name for this set of mode descriptions. The other entries permitted in .B Modes sections are the .B Mode and .B ModeLine entries that are described above in the .B Monitor section. .SH "SCREEN SECTION" The config file may have multiple .B Screen sections. There must be at least one, for the \(lqscreen\(rq being used. A \(lqscreen\(rq represents the binding of a graphics device .RB ( Device section) and a monitor .RB ( Monitor section). A .B Screen section is considered \(lqactive\(rq if it is referenced by an active .B ServerLayout section or by the .B \-screen command line option. If neither of those is present, the first .B Screen section found in the config file is considered the active one. .PP .B Screen sections have the following format: .PP .RS 4 .nf .B "Section \*qScreen\*q" .BI " Identifier \*q" name \*q .BI " Device \*q" devid \*q .BI " GPUDevice \*q" devid \*q .BI " Monitor \*q" monid \*q .I " entries" .I " ..." .BI " SubSection \*qDisplay\*q" .I " entries" .I " ... .B " EndSubSection" .I " ..." .B "EndSection" .fi .RE .PP The .B Identifier entry is mandatory. All others are optional. .PP The .B Identifier entry specifies the unique name for this screen. The .B Screen section provides information specific to the whole screen, including screen\-specific .BR Options . In multi\-head configurations, there will be multiple active .B Screen sections, one for each head. The entries available for this section are: .TP 7 .BI "Device \*q" device\-id \*q This entry specifies the .B Device section to be used for this screen. When multiple graphics cards are present, this is what ties a specific card to a screen. The .I device\-id must match the .B Identifier of a .B Device section in the config file. .TP 7 .BI "GPUDevice \*q" device\-id \*q This entry specifies the .B Device section to be used as a secondary GPU device for this screen. When multiple graphics cards are present, this is what ties a specific secondary card to a screen. The .I device\-id must match the .B Identifier of a .B Device section in the config file. This can be specified up to 4 times for a single screen. .TP 7 .BI "Monitor \*q" monitor\-id \*q specifies which monitor description is to be used for this screen. If a .B Monitor name is not specified, a default configuration is used. Currently the default configuration may not function as expected on all platforms. .TP 7 .BI "VideoAdaptor \*q" xv\-id \*q specifies an optional Xv video adaptor description to be used with this screen. .TP 7 .BI "DefaultDepth " depth specifies which color depth the server should use by default. The .B \-depth command line option can be used to override this. If neither is specified, the default depth is driver\-specific, but in most cases is 8. .TP 7 .BI "DefaultFbBpp " bpp specifies which framebuffer layout to use by default. The .B \-fbbpp command line option can be used to override this. In most cases the driver will chose the best default value for this. The only case where there is even a choice in this value is for depth 24, where some hardware supports both a packed 24 bit framebuffer layout and a sparse 32 bit framebuffer layout. .TP 7 .BI "MatchSeat " "seat\-id" Only apply this .B Screen section if X server was started with .B -seat .I seat\-id option. .TP 7 .B Options Various .B Option flags may be specified in the .B Screen section. Some are driver\-specific and are described in the driver documentation. Others are driver\-independent, and will eventually be described here. .\" XXX These should really be in an xaa man page. .TP 7 .BI "Option \*qAccel\*q" Enables 2D hardware acceleration. This option is on by default, but it may be necessary to turn it off if there are bugs in the driver. There are many options to disable specific accelerated operations, listed below. Note that disabling an operation will have no effect if the operation is not accelerated (whether due to lack of support in the hardware or in the driver). .TP 7 .BI "Option \*qGlxVendorLibrary\*q \*q" string \*q This option specifies a space-separated list of OpenGL vendor libraries to use for the screen. This may be used to select an alternate implementation for development, debugging, or alternate feature sets. Default: mesa. .TP 7 .BI "Option \*qInitPrimary\*q \*q" boolean \*q Use the Int10 module to initialize the primary graphics card. Normally, only secondary cards are soft-booted using the Int10 module, as the primary card has already been initialized by the BIOS at boot time. Default: false. .TP 7 .BI "Option \*qNoInt10\*q \*q" boolean \*q Disables the Int10 module, a module that uses the int10 call to the BIOS of the graphics card to initialize it. Default: false. .PP Each .B Screen section may optionally contain one or more .B Display subsections. Those subsections provide depth/fbbpp specific configuration information, and the one chosen depends on the depth and/or fbbpp that is being used for the screen. The .B Display subsection format is described in the section below. .SH "DISPLAY SUBSECTION" Each .B Screen section may have multiple .B Display subsections. The \(lqactive\(rq .B Display subsection is the first that matches the depth and/or fbbpp values being used, or failing that, the first that has neither a depth or fbbpp value specified. The .B Display subsections are optional. When there isn't one that matches the depth and/or fbbpp values being used, all the parameters that can be specified here fall back to their defaults. .PP .B Display subsections have the following format: .PP .RS 4 .nf .B " SubSection \*qDisplay\*q" .BI " Depth " depth .I " entries" .I " ..." .B " EndSubSection" .fi .RE .TP 7 .BI "Depth " depth This entry specifies what colour depth the .B Display subsection is to be used for. This entry is usually specified, but it may be omitted to create a match\-all .B Display subsection or when wishing to match only against the .B FbBpp parameter. The range of .I depth values that are allowed depends on the driver. Most drivers support 8, 15, 16 and 24. Some also support 1 and/or 4, and some may support other values (like 30). Note: .I depth means the number of bits in a pixel that are actually used to determine the pixel colour. 32 is not a valid .I depth value. Most hardware that uses 32 bits per pixel only uses 24 of them to hold the colour information, which means that the colour depth is 24, not 32. .TP 7 .BI "FbBpp " bpp This entry specifies the framebuffer format this .B Display subsection is to be used for. This entry is only needed when providing depth 24 configurations that allow a choice between a 24 bpp packed framebuffer format and a 32bpp sparse framebuffer format. In most cases this entry should not be used. .TP 7 .BI "Weight " "red\-weight green\-weight blue\-weight" This optional entry specifies the relative RGB weighting to be used for a screen is being used at depth 16 for drivers that allow multiple formats. This may also be specified from the command line with the .B \-weight option (see .BR Xorg(@appmansuffix@)). .TP 7 .BI "Virtual " "xdim ydim" This optional entry specifies the virtual screen resolution to be used. .I xdim must be a multiple of either 8 or 16 for most drivers, and a multiple of 32 when running in monochrome mode. The given value will be rounded down if this is not the case. Video modes which are too large for the specified virtual size will be rejected. If this entry is not present, the virtual screen resolution will be set to accommodate all the valid video modes given in the .B Modes entry. Some drivers/hardware combinations do not support virtual screens. Refer to the appropriate driver\-specific documentation for details. .TP 7 .BI "ViewPort " "x0 y0" This optional entry sets the upper left corner of the initial display. This is only relevant when the virtual screen resolution is different from the resolution of the initial video mode. If this entry is not given, then the initial display will be centered in the virtual display area. .TP 7 .BI "Modes \*q" mode\-name \*q " ..." This optional entry specifies the list of video modes to use. Each .I mode\-name specified must be in double quotes. They must correspond to those specified or referenced in the appropriate .B Monitor section (including implicitly referenced built\-in VESA standard modes). The server will delete modes from this list which don't satisfy various requirements. The first valid mode in this list will be the default display mode for startup. The list of valid modes is converted internally into a circular list. It is possible to switch to the next mode with .B Ctrl+Alt+Keypad\-Plus and to the previous mode with .BR Ctrl+Alt+Keypad\-Minus . When this entry is omitted, the valid modes referenced by the appropriate .B Monitor section will be used. If the .B Monitor section contains no modes, then the selection will be taken from the built-in VESA standard modes. .TP 7 .BI "Visual \*q" visual\-name \*q This optional entry sets the default root visual type. This may also be specified from the command line (see the .BR Xserver(@appmansuffix@) man page). The visual types available for depth 8 are (default is .BR PseudoColor ): .PP .RS 11 .nf .B StaticGray .B GrayScale .B StaticColor .B PseudoColor .B TrueColor .B DirectColor .fi .RE .PP .RS 7 The visual type available for the depths 15, 16 and 24 are (default is .BR TrueColor ): .PP .RS 4 .nf .B TrueColor .B DirectColor .fi .RE .PP Not all drivers support .B DirectColor at these depths. .PP The visual types available for the depth 4 are (default is .BR StaticColor ): .PP .RS 4 .nf .B StaticGray .B GrayScale .B StaticColor .B PseudoColor .fi .RE .PP The visual type available for the depth 1 (monochrome) is .BR StaticGray . .RE .TP 7 .BI "Black " "red green blue" This optional entry allows the \(lqblack\(rq colour to be specified. This is only supported at depth 1. The default is black. .TP 7 .BI "White " "red green blue" This optional entry allows the \(lqwhite\(rq colour to be specified. This is only supported at depth 1. The default is white. .TP 7 .B Options Option flags may be specified in the .B Display subsections. These may include driver\-specific options and driver\-independent options. The former are described in the driver\-specific documentation. Some of the latter are described above in the section about the .B Screen section, and they may also be included here. .SH "SERVERLAYOUT SECTION" The config file may have multiple .B ServerLayout sections. A \(lqserver layout\(rq represents the binding of one or more screens .RB ( Screen sections) and one or more input devices .RB ( InputDevice sections) to form a complete configuration. In multi\-head configurations, it also specifies the relative layout of the heads. A .B ServerLayout section is considered \(lqactive\(rq if it is referenced by the .B \-layout command line option or by an .B "Option \*qDefaultServerLayout\*q" entry in the .B ServerFlags section (the former takes precedence over the latter). If those options are not used, the first .B ServerLayout section found in the config file is considered the active one. If no .B ServerLayout sections are present, the single active screen and two active (core) input devices are selected as described in the relevant sections above. .PP .B ServerLayout sections have the following format: .PP .RS 4 .nf .B "Section \*qServerLayout\*q" .BI " Identifier \*q" name \*q .BI " Screen \*q" screen\-id \*q .I " ..." .BI " InputDevice \*q" idev\-id \*q .I " ..." .I " options" .I " ..." .B "EndSection" .fi .RE .PP Each .B ServerLayout section must have an .B Identifier entry and at least one .B Screen entry. .PP The .B Identifier entry specifies the unique name for this server layout. The .B ServerLayout section provides information specific to the whole session, including session\-specific .BR Options . The .B ServerFlags options (described above) may be specified here, and ones given here override those given in the .B ServerFlags section. .PP The entries that may be used in this section are described here. .TP 7 .BI "Screen " "screen\-num" " \*qscreen\-id\*q " "position\-information" One of these entries must be given for each screen being used in a session. The .I screen\-id field is mandatory, and specifies the .B Screen section being referenced. The .I screen\-num field is optional, and may be used to specify the screen number in multi\-head configurations. When this field is omitted, the screens will be numbered in the order that they are listed in. The numbering starts from 0, and must be consecutive. The .I position\-information field describes the way multiple screens are positioned. There are a number of different ways that this information can be provided: .RS 7 .TP 4 .I "x y" .TP 4 .BI "Absolute " "x y" These both specify that the upper left corner's coordinates are .RI ( x , y ). The .B Absolute keyword is optional. Some older versions of XFree86 (4.2 and earlier) don't recognise the .B Absolute keyword, so it's safest to just specify the coordinates without it. .TP 4 .BI "RightOf \*q" screen\-id \*q .TP 4 .BI "LeftOf \*q" screen\-id \*q .TP 4 .BI "Above \*q" screen\-id \*q .TP 4 .BI "Below \*q" screen\-id \*q .TP 4 .BI "Relative \*q" screen\-id \*q " x y" These give the screen's location relative to another screen. The first four position the screen immediately to the right, left, above or below the other screen. When positioning to the right or left, the top edges are aligned. When positioning above or below, the left edges are aligned. The .B Relative form specifies the offset of the screen's origin (upper left corner) relative to the origin of another screen. .RE .TP 7 .BI "InputDevice \*q" idev\-id "\*q \*q" option \*q " ..." One of these entries should be given for each input device being used in a session. Normally at least two are required, one each for the core pointer and keyboard devices. If either of those is missing, suitable .B InputDevice entries are searched for using the method described above in the .B INPUTDEVICE section. The .I idev\-id field is mandatory, and specifies the name of the .B InputDevice section being referenced. Multiple .I option fields may be specified, each in double quotes. The options permitted here are any that may also be given in the .B InputDevice sections. Normally only session\-specific input device options would be used here. The most commonly used options are: .PP .RS 11 .nf .B \*qCorePointer\*q .B \*qCoreKeyboard\*q .B \*qSendCoreEvents\*q .fi .RE .PP .RS 7 and the first two should normally be used to indicate the core pointer and core keyboard devices respectively. .RE .TP 7 .BI "MatchSeat " "seat\-id" Only apply this .B ServerLayout section if X server was started with .B -seat .I seat\-id option. .TP 7 .B Options In addition to the following, any option permitted in the .B ServerFlags section may also be specified here. When the same option appears in both places, the value given here overrides the one given in the .B ServerFlags section. .TP 7 .BI "Option \*qIsolateDevice\*q \*q" bus\-id \*q Restrict device resets to the specified .IR bus\-id . See the .B BusID option (described in .BR "DEVICE SECTION" , above) for the format of the .I bus\-id parameter. This option overrides .BR SingleCard , if specified. At present, only PCI devices can be isolated in this manner. .TP 7 .BI "Option \*qSingleCard\*q \*q" boolean \*q As .BR IsolateDevice , except that the bus ID of the first device in the layout is used. .PP Here is an example of a .B ServerLayout section for a dual headed configuration with two mice: .PP .RS 4 .nf .B "Section \*qServerLayout\*q" .B " Identifier \*qLayout 1\*q" .B " Screen \*qMGA 1\*q" .B " Screen \*qMGA 2\*q RightOf \*qMGA 1\*q" .B " InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q" .B " InputDevice \*qMouse 1\*q \*qCorePointer\*q" .B " InputDevice \*qMouse 2\*q \*qSendCoreEvents\*q" .B " Option \*qBlankTime\*q \*q5\*q" .B "EndSection" .fi .RE .SH "DRI SECTION" This optional section is used to provide some information for the Direct Rendering Infrastructure. Details about the format of this section can be found on-line at .IR . .SH "VENDOR SECTION" The optional .B Vendor section may be used to provide vendor\-specific configuration information. Multiple .B Vendor sections may be present, and they may contain an .B Identifier entry and multiple .B Option flags. The data therein is not used in this release. .PP .SH "SEE ALSO" General: .BR X (@miscmansuffix@), .BR Xserver (@appmansuffix@), .BR Xorg (@appmansuffix@), .BR cvt (@appmansuffix@), .BR gtf (@appmansuffix@). .PP .B "Not all modules or interfaces are available on all platforms." .PP Display drivers: .BR apm (@drivermansuffix@), .BR ati (@drivermansuffix@), .BR chips (@drivermansuffix@), .BR cirrus (@drivermansuffix@), .BR cyrix (@drivermansuffix@), .BR fbdev (@drivermansuffix@), .BR glide (@drivermansuffix@), .BR glint (@drivermansuffix@), .BR i128 (@drivermansuffix@), .BR i740 (@drivermansuffix@), .BR imstt (@drivermansuffix@), .BR intel (@drivermansuffix@), .BR mga (@drivermansuffix@), .BR neomagic (@drivermansuffix@), .BR nv (@drivermansuffix@), .BR openchrome (@drivermansuffix@), .BR r128 (@drivermansuffix@), .BR radeon (@drivermansuffix@), .BR rendition (@drivermansuffix@), .BR savage (@drivermansuffix@), .BR s3virge (@drivermansuffix@), .BR siliconmotion (@drivermansuffix@), .BR sis (@drivermansuffix@), .BR sisusb (@drivermansuffix@), .BR sunbw2 (@drivermansuffix@), .BR suncg14 (@drivermansuffix@), .BR suncg3 (@drivermansuffix@), .BR suncg6 (@drivermansuffix@), .BR sunffb (@drivermansuffix@), .BR sunleo (@drivermansuffix@), .BR suntcx (@drivermansuffix@), .BR tdfx (@drivermansuffix@), .\" .BR tga (@drivermansuffix@), .BR trident (@drivermansuffix@), .BR tseng (@drivermansuffix@), .BR vesa (@drivermansuffix@), .BR vmware (@drivermansuffix@), .BR voodoo (@drivermansuffix@), .BR wsfb (@drivermansuffix@), .BR xgi (@drivermansuffix@), .BR xgixp (@drivermansuffix@). .PP Input drivers: .BR acecad (@drivermansuffix@), .BR citron (@drivermansuffix@), .BR elographics (@drivermansuffix@), .BR evdev (@drivermansuffix@), .BR fpit (@drivermansuffix@), .BR joystick (@drivermansuffix@), .BR kbd (@drivermansuffix@), .BR libinput (@drivermansuffix@), .BR mousedrv (@drivermansuffix@), .BR mutouch (@drivermansuffix@), .BR penmount (@drivermansuffix@), .BR synaptics (@drivermansuffix@), .BR vmmouse (@drivermansuffix@), .BR void (@drivermansuffix@), .BR wacom (@drivermansuffix@). .PP Other modules and interfaces: .BR exa (@drivermansuffix@), .BR fbdevhw (@drivermansuffix@), .\" .BR shadowfb (@drivermansuffix@), .BR v4l (@drivermansuffix@). .br .SH AUTHORS This manual page was largely rewritten by David Dawes .IR . xorg-server-1.20.8/hw/xfree86/Xorg.sh.in0000644000175000017500000000042713640201473014576 00000000000000#!/bin/sh # # Execute Xorg.wrap if it exists otherwise execute Xorg directly. # This allows distros to put the suid wrapper in a separate package. basedir=@SUID_WRAPPER_DIR@ if [ -x "$basedir"/Xorg.wrap ]; then exec "$basedir"/Xorg.wrap "$@" else exec "$basedir"/Xorg "$@" fi xorg-server-1.20.8/hw/xfree86/dixmods/0000755000175000017500000000000013640201534014440 500000000000000xorg-server-1.20.8/hw/xfree86/dixmods/shmodule.c0000644000175000017500000000364313640201473016354 00000000000000/* * Copyright © 2000 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 Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD 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 #endif #include "xf86Module.h" #include #include "scrnintstr.h" #include "windowstr.h" #include #include "dixfontstr.h" #include #include "mi.h" #include "regionstr.h" #include "globals.h" #include "gcstruct.h" #include "shadow.h" static XF86ModuleVersionInfo VersRec = { "shadow", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 1, 0, ABI_CLASS_ANSIC, /* Only need the ansic layer */ ABI_ANSIC_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ }; _X_EXPORT XF86ModuleData shadowModuleData = { &VersRec, NULL, NULL }; xorg-server-1.20.8/hw/xfree86/dixmods/Makefile.am0000644000175000017500000000262013640201473016416 00000000000000noinst_LTLIBRARIES = libdixmods.la if GLX GLXMODS = libglx.la endif module_LTLIBRARIES = libfb.la \ libwfb.la \ libshadow.la extsmoduledir = $(moduledir)/extensions extsmodule_LTLIBRARIES = $(GLXMODS) AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ AM_CPPFLAGS = @XORG_INCS@ \ -I$(top_srcdir)/hw/xfree86/loader \ -I$(top_srcdir)/miext/shadow \ -I$(top_srcdir)/glx libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libfb_la_LIBADD = $(top_builddir)/fb/libfb.la libfb_la_SOURCES = fbmodule.c libfb_la_CFLAGS = $(AM_CFLAGS) libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la libwfb_la_SOURCES = fbmodule.c libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS) if DRI2 libglx_la_LIBADD += $(top_builddir)/glx/libglxdri.la if NO_UNDEFINED libglx_la_LIBADD += $(LIBDRM_LIBS) $(PIXMAN_LIBS) endif endif libglx_la_SOURCES = glxmodule.c libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la if NO_UNDEFINED libshadow_la_LIBADD += libfb.la endif libshadow_la_SOURCES = shmodule.c libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c libdixmods_la_CFLAGS = $(AM_CFLAGS) xorg-server-1.20.8/hw/xfree86/dixmods/glxmodule.c0000644000175000017500000000455213640201473016534 00000000000000/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Module.h" #include "xf86Priv.h" #include "xf86.h" #include "colormap.h" #include "micmap.h" #include "globals.h" #include "glxserver.h" #include "extinit.h" #include "glx_extinit.h" static MODULESETUPPROTO(glxSetup); static XF86ModuleVersionInfo VersRec = { "glx", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_EXTENSION, ABI_EXTENSION_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} }; _X_EXPORT XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL }; static void * glxSetup(void *module, void *opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; __GLXprovider *provider; if (setupDone) { if (errmaj) *errmaj = LDR_ONCEONLY; return NULL; } setupDone = TRUE; provider = LoaderSymbol("__glXDRI2Provider"); if (provider) GlxPushProvider(provider); xorgGlxCreateVendor(); return module; } xorg-server-1.20.8/hw/xfree86/dixmods/fbmodule.c0000644000175000017500000000365313640201473016332 00000000000000/* * Copyright (C) 1998 The XFree86 Project, 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 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 * XFREE86 PROJECT 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 XFree86 Project 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 * XFree86 Project. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86Module.h" #include "fb.h" static XF86ModuleVersionInfo VersRec = { #ifdef FB_ACCESS_WRAPPER "wfb", #else "fb", #endif MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_ANSIC, /* Only need the ansic layer */ ABI_ANSIC_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ }; _X_EXPORT XF86ModuleData FBPREFIX(ModuleData) = { &VersRec, NULL, NULL}; xorg-server-1.20.8/hw/xfree86/dixmods/Makefile.in0000644000175000017500000011450113640201512016423 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @DRI2_TRUE@am__append_1 = $(top_builddir)/glx/libglxdri.la @DRI2_TRUE@@NO_UNDEFINED_TRUE@am__append_2 = $(LIBDRM_LIBS) $(PIXMAN_LIBS) @NO_UNDEFINED_TRUE@am__append_3 = libfb.la subdir = hw/xfree86/dixmods ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(extsmoduledir)" \ "$(DESTDIR)$(moduledir)" LTLIBRARIES = $(extsmodule_LTLIBRARIES) $(module_LTLIBRARIES) \ $(noinst_LTLIBRARIES) libdixmods_la_LIBADD = am_libdixmods_la_OBJECTS = libdixmods_la-miinitext.lo libdixmods_la_OBJECTS = $(am_libdixmods_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libdixmods_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdixmods_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libfb_la_DEPENDENCIES = $(top_builddir)/fb/libfb.la am_libfb_la_OBJECTS = libfb_la-fbmodule.lo libfb_la_OBJECTS = $(am_libfb_la_OBJECTS) libfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libfb_la_CFLAGS) \ $(CFLAGS) $(libfb_la_LDFLAGS) $(LDFLAGS) -o $@ am__DEPENDENCIES_1 = @DRI2_TRUE@@NO_UNDEFINED_TRUE@am__DEPENDENCIES_2 = \ @DRI2_TRUE@@NO_UNDEFINED_TRUE@ $(am__DEPENDENCIES_1) \ @DRI2_TRUE@@NO_UNDEFINED_TRUE@ $(am__DEPENDENCIES_1) libglx_la_DEPENDENCIES = $(top_builddir)/glx/libglx.la \ $(am__DEPENDENCIES_1) $(am__append_1) $(am__DEPENDENCIES_2) am_libglx_la_OBJECTS = glxmodule.lo libglx_la_OBJECTS = $(am_libglx_la_OBJECTS) libglx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libglx_la_LDFLAGS) $(LDFLAGS) -o $@ @GLX_TRUE@am_libglx_la_rpath = -rpath $(extsmoduledir) libshadow_la_DEPENDENCIES = $(top_builddir)/miext/shadow/libshadow.la \ $(am__append_3) am_libshadow_la_OBJECTS = shmodule.lo libshadow_la_OBJECTS = $(am_libshadow_la_OBJECTS) libshadow_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libshadow_la_LDFLAGS) $(LDFLAGS) -o $@ libwfb_la_DEPENDENCIES = $(top_builddir)/fb/libwfb.la am_libwfb_la_OBJECTS = libwfb_la-fbmodule.lo libwfb_la_OBJECTS = $(am_libwfb_la_OBJECTS) libwfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwfb_la_CFLAGS) \ $(CFLAGS) $(libwfb_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/glxmodule.Plo \ ./$(DEPDIR)/libdixmods_la-miinitext.Plo \ ./$(DEPDIR)/libfb_la-fbmodule.Plo \ ./$(DEPDIR)/libwfb_la-fbmodule.Plo ./$(DEPDIR)/shmodule.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdixmods_la_SOURCES) $(libfb_la_SOURCES) \ $(libglx_la_SOURCES) $(libshadow_la_SOURCES) \ $(libwfb_la_SOURCES) DIST_SOURCES = $(libdixmods_la_SOURCES) $(libfb_la_SOURCES) \ $(libglx_la_SOURCES) $(libshadow_la_SOURCES) \ $(libwfb_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdixmods.la @GLX_TRUE@GLXMODS = libglx.la module_LTLIBRARIES = libfb.la \ libwfb.la \ libshadow.la extsmoduledir = $(moduledir)/extensions extsmodule_LTLIBRARIES = $(GLXMODS) AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ AM_CPPFLAGS = @XORG_INCS@ \ -I$(top_srcdir)/hw/xfree86/loader \ -I$(top_srcdir)/miext/shadow \ -I$(top_srcdir)/glx libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libfb_la_LIBADD = $(top_builddir)/fb/libfb.la libfb_la_SOURCES = fbmodule.c libfb_la_CFLAGS = $(AM_CFLAGS) libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la libwfb_la_SOURCES = fbmodule.c libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS) \ $(am__append_1) $(am__append_2) libglx_la_SOURCES = glxmodule.c libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la \ $(am__append_3) libshadow_la_SOURCES = shmodule.c libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c libdixmods_la_CFLAGS = $(AM_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dixmods/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/dixmods/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-extsmoduleLTLIBRARIES: $(extsmodule_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(extsmodule_LTLIBRARIES)'; test -n "$(extsmoduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(extsmoduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(extsmoduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(extsmoduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(extsmoduledir)"; \ } uninstall-extsmoduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(extsmodule_LTLIBRARIES)'; test -n "$(extsmoduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(extsmoduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(extsmoduledir)/$$f"; \ done clean-extsmoduleLTLIBRARIES: -test -z "$(extsmodule_LTLIBRARIES)" || rm -f $(extsmodule_LTLIBRARIES) @list='$(extsmodule_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdixmods.la: $(libdixmods_la_OBJECTS) $(libdixmods_la_DEPENDENCIES) $(EXTRA_libdixmods_la_DEPENDENCIES) $(AM_V_CCLD)$(libdixmods_la_LINK) $(libdixmods_la_OBJECTS) $(libdixmods_la_LIBADD) $(LIBS) libfb.la: $(libfb_la_OBJECTS) $(libfb_la_DEPENDENCIES) $(EXTRA_libfb_la_DEPENDENCIES) $(AM_V_CCLD)$(libfb_la_LINK) -rpath $(moduledir) $(libfb_la_OBJECTS) $(libfb_la_LIBADD) $(LIBS) libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES) $(EXTRA_libglx_la_DEPENDENCIES) $(AM_V_CCLD)$(libglx_la_LINK) $(am_libglx_la_rpath) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS) libshadow.la: $(libshadow_la_OBJECTS) $(libshadow_la_DEPENDENCIES) $(EXTRA_libshadow_la_DEPENDENCIES) $(AM_V_CCLD)$(libshadow_la_LINK) -rpath $(moduledir) $(libshadow_la_OBJECTS) $(libshadow_la_LIBADD) $(LIBS) libwfb.la: $(libwfb_la_OBJECTS) $(libwfb_la_DEPENDENCIES) $(EXTRA_libwfb_la_DEPENDENCIES) $(AM_V_CCLD)$(libwfb_la_LINK) -rpath $(moduledir) $(libwfb_la_OBJECTS) $(libwfb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdixmods_la-miinitext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbmodule.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbmodule.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmodule.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libdixmods_la-miinitext.lo: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdixmods_la_CFLAGS) $(CFLAGS) -MT libdixmods_la-miinitext.lo -MD -MP -MF $(DEPDIR)/libdixmods_la-miinitext.Tpo -c -o libdixmods_la-miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdixmods_la-miinitext.Tpo $(DEPDIR)/libdixmods_la-miinitext.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='libdixmods_la-miinitext.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdixmods_la_CFLAGS) $(CFLAGS) -c -o libdixmods_la-miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c libfb_la-fbmodule.lo: fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbmodule.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbmodule.Tpo -c -o libfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbmodule.Tpo $(DEPDIR)/libfb_la-fbmodule.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbmodule.c' object='libfb_la-fbmodule.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c libwfb_la-fbmodule.lo: fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbmodule.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbmodule.Tpo -c -o libwfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbmodule.Tpo $(DEPDIR)/libwfb_la-fbmodule.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbmodule.c' object='libwfb_la-fbmodule.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(extsmoduledir)" "$(DESTDIR)$(moduledir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-extsmoduleLTLIBRARIES clean-generic clean-libtool \ clean-moduleLTLIBRARIES clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/glxmodule.Plo -rm -f ./$(DEPDIR)/libdixmods_la-miinitext.Plo -rm -f ./$(DEPDIR)/libfb_la-fbmodule.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbmodule.Plo -rm -f ./$(DEPDIR)/shmodule.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-extsmoduleLTLIBRARIES \ install-moduleLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/glxmodule.Plo -rm -f ./$(DEPDIR)/libdixmods_la-miinitext.Plo -rm -f ./$(DEPDIR)/libfb_la-fbmodule.Plo -rm -f ./$(DEPDIR)/libwfb_la-fbmodule.Plo -rm -f ./$(DEPDIR)/shmodule.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-extsmoduleLTLIBRARIES \ uninstall-moduleLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-extsmoduleLTLIBRARIES clean-generic clean-libtool \ clean-moduleLTLIBRARIES clean-noinstLTLIBRARIES cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-extsmoduleLTLIBRARIES install-html \ install-html-am install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-extsmoduleLTLIBRARIES uninstall-moduleLTLIBRARIES .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/dixmods/meson.build0000644000175000017500000000220513640201473016523 00000000000000fb = shared_module( 'fb', 'fbmodule.c', include_directories: [inc, xorg_inc], c_args: xorg_c_args, dependencies: common_dep, link_whole: libxserver_fb, link_with: e, install: true, install_dir: module_dir, ) shared_module( 'wfb', 'fbmodule.c', include_directories: [inc, xorg_inc], c_args: [ xorg_c_args, wfb_args ], dependencies: common_dep, link_whole: libxserver_wfb, link_with: e, install: true, install_dir: module_dir, ) shared_module( 'shadow', 'shmodule.c', include_directories: [inc, xorg_inc], c_args: xorg_c_args, dependencies: common_dep, link_whole: libxserver_miext_shadow, link_with: [fb, e], install: true, install_dir: module_dir, ) if build_glx shared_module( 'glx', [ 'glxmodule.c', srcs_glxdri2 ], include_directories: [ inc, xorg_inc, glx_inc ], c_args: [ xorg_c_args, glx_align64 ], dependencies: [ common_dep, dl_dep ], link_whole: libxserver_glx, link_with: e, install: true, install_dir: join_paths(module_dir, 'extensions') ) endif xorg-server-1.20.8/hw/xfree86/vbe/0000755000175000017500000000000013640201534013545 500000000000000xorg-server-1.20.8/hw/xfree86/vbe/vbe.c0000644000175000017500000007402513640201473014417 00000000000000 /* * XFree86 vbe module * Copyright 2000 Egbert Eich * * The mode query/save/set/restore functions from the vesa driver * have been moved here. * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) * Authors: Paulo César Pereira de Andrade */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include "xf86.h" #include "xf86Modes.h" #include "vbe.h" #include #define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x) #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define B_O16(x) (x) #define B_O32(x) (x) #else #define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) #define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) #endif #define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) #define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) #define R16(v) ((v) & 0xffff) static unsigned char *vbeReadEDID(vbeInfoPtr pVbe); static Bool vbeProbeDDC(vbeInfoPtr pVbe); static const char vbeVersionString[] = "VBE2"; vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex) { return VBEExtendedInit(pInt, entityIndex, 0); } vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags) { int RealOff; void *page = NULL; ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex); vbeControllerInfoPtr vbe = NULL; Bool init_int10 = FALSE; vbeInfoPtr vip = NULL; int screen; if (!pScrn) return NULL; screen = pScrn->scrnIndex; if (!pInt) { if (!xf86LoadSubModule(pScrn, "int10")) goto error; xf86DrvMsg(screen, X_INFO, "initializing int10\n"); pInt = xf86ExtendedInitInt10(entityIndex, Flags); if (!pInt) goto error; init_int10 = TRUE; } page = xf86Int10AllocPages(pInt, 1, &RealOff); if (!page) goto error; vbe = (vbeControllerInfoPtr) page; memcpy(vbe->VbeSignature, vbeVersionString, 4); pInt->ax = 0x4F00; pInt->es = SEG_ADDR(RealOff); pInt->di = SEG_OFF(RealOff); pInt->num = 0x10; xf86ExecX86int10(pInt); if ((pInt->ax & 0xff) != 0x4f) { xf86DrvMsgVerb(screen, X_INFO, 3, "VESA BIOS not detected\n"); goto error; } switch (pInt->ax & 0xff00) { case 0: xf86DrvMsg(screen, X_INFO, "VESA BIOS detected\n"); break; case 0x100: xf86DrvMsg(screen, X_INFO, "VESA BIOS function failed\n"); goto error; case 0x200: xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported\n"); goto error; case 0x300: xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported in current mode\n"); goto error; default: xf86DrvMsg(screen, X_INFO, "Invalid\n"); goto error; } xf86DrvMsgVerb(screen, X_INFO, 4, "VbeVersion is %d, OemStringPtr is 0x%08lx,\n" "\tOemVendorNamePtr is 0x%08lx, OemProductNamePtr is 0x%08lx,\n" "\tOemProductRevPtr is 0x%08lx\n", vbe->VbeVersion, (unsigned long) vbe->OemStringPtr, (unsigned long) vbe->OemVendorNamePtr, (unsigned long) vbe->OemProductNamePtr, (unsigned long) vbe->OemProductRevPtr); xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Version %i.%i\n", VERSION(vbe->VbeVersion)); xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Total Mem: %i kB\n", vbe->TotalMem * 64); xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM: %s\n", (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe->OemStringPtr))); if (B_O16(vbe->VbeVersion) >= 0x200) { xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Software Rev: %i.%i\n", VERSION(vbe->OemSoftwareRev)); if (vbe->OemVendorNamePtr) xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Vendor: %s\n", (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe-> OemVendorNamePtr))); if (vbe->OemProductNamePtr) xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product: %s\n", (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe-> OemProductNamePtr))); if (vbe->OemProductRevPtr) xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product Rev: %s\n", (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe-> OemProductRevPtr))); } vip = (vbeInfoPtr) xnfalloc(sizeof(vbeInfoRec)); vip->version = B_O16(vbe->VbeVersion); vip->pInt10 = pInt; vip->ddc = DDC_UNCHECKED; vip->memory = page; vip->real_mode_base = RealOff; vip->num_pages = 1; vip->init_int10 = init_int10; return vip; error: if (page) xf86Int10FreePages(pInt, page, 1); if (init_int10) xf86FreeInt10(pInt); return NULL; } void vbeFree(vbeInfoPtr pVbe) { if (!pVbe) return; xf86Int10FreePages(pVbe->pInt10, pVbe->memory, pVbe->num_pages); /* If we have initalized int10 we ought to free it, too */ if (pVbe->init_int10) xf86FreeInt10(pVbe->pInt10); free(pVbe); return; } static Bool vbeProbeDDC(vbeInfoPtr pVbe) { const char *ddc_level; int screen = pVbe->pInt10->pScrn->scrnIndex; if (pVbe->ddc == DDC_NONE) return FALSE; if (pVbe->ddc != DDC_UNCHECKED) return TRUE; pVbe->pInt10->ax = 0x4F15; pVbe->pInt10->bx = 0; pVbe->pInt10->cx = 0; pVbe->pInt10->es = 0; pVbe->pInt10->di = 0; pVbe->pInt10->num = 0x10; xf86ExecX86int10(pVbe->pInt10); if ((pVbe->pInt10->ax & 0xff) != 0x4f) { xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC not supported\n"); pVbe->ddc = DDC_NONE; return FALSE; } switch ((pVbe->pInt10->ax >> 8) & 0xff) { case 0: xf86DrvMsg(screen, X_INFO, "VESA VBE DDC supported\n"); switch (pVbe->pInt10->bx & 0x3) { case 0: ddc_level = " none"; pVbe->ddc = DDC_NONE; break; case 1: ddc_level = " 1"; pVbe->ddc = DDC_1; break; case 2: ddc_level = " 2"; pVbe->ddc = DDC_2; break; case 3: ddc_level = " 1 + 2"; pVbe->ddc = DDC_1_2; break; default: ddc_level = ""; pVbe->ddc = DDC_NONE; break; } xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Level%s\n", ddc_level); if (pVbe->pInt10->bx & 0x4) { xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Screen blanked" "for data transfer\n"); pVbe->ddc_blank = TRUE; } else pVbe->ddc_blank = FALSE; xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC transfer in appr. %x sec.\n", (pVbe->pInt10->bx >> 8) & 0xff); } return TRUE; } typedef enum { VBEOPT_NOVBE, VBEOPT_NODDC } VBEOpts; static const OptionInfoRec VBEOptions[] = { {VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE}, {VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; static unsigned char * vbeReadEDID(vbeInfoPtr pVbe) { int RealOff = pVbe->real_mode_base; void *page = pVbe->memory; unsigned char *tmp = NULL; Bool novbe = FALSE; Bool noddc = FALSE; ScrnInfoPtr pScrn = pVbe->pInt10->pScrn; int screen = pScrn->scrnIndex; OptionInfoPtr options; if (!page) return NULL; options = xnfalloc(sizeof(VBEOptions)); (void) memcpy(options, VBEOptions, sizeof(VBEOptions)); xf86ProcessOptions(screen, pScrn->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); free(options); if (novbe || noddc) return NULL; if (!vbeProbeDDC(pVbe)) goto error; memset(page, 0, sizeof(vbeInfoPtr)); strcpy(page, vbeVersionString); pVbe->pInt10->ax = 0x4F15; pVbe->pInt10->bx = 0x01; pVbe->pInt10->cx = 0; pVbe->pInt10->dx = 0; pVbe->pInt10->es = SEG_ADDR(RealOff); pVbe->pInt10->di = SEG_OFF(RealOff); pVbe->pInt10->num = 0x10; xf86ExecX86int10(pVbe->pInt10); if ((pVbe->pInt10->ax & 0xff) != 0x4f) { xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC invalid\n"); goto error; } switch (pVbe->pInt10->ax & 0xff00) { case 0x0: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read successfully\n"); tmp = (unsigned char *) xnfalloc(128); memcpy(tmp, page, 128); break; case 0x100: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read failed\n"); break; default: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC unkown failure %i\n", pVbe->pInt10->ax & 0xff00); break; } error: return tmp; } xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, void *unused) { unsigned char *DDC_data = NULL; if (!pVbe) return NULL; if (pVbe->version < 0x102) return NULL; DDC_data = vbeReadEDID(pVbe); if (!DDC_data) return NULL; return xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); } #define GET_UNALIGNED2(x) \ ((*(CARD16*)(x)) | (*(((CARD16*)(x) + 1))) << 16) VbeInfoBlock * VBEGetVBEInfo(vbeInfoPtr pVbe) { VbeInfoBlock *block = NULL; int i, pStr, pModes; char *str; CARD16 major, *modes; memset(pVbe->memory, 0, sizeof(VbeInfoBlock)); /* Input: AH := 4Fh Super VGA support AL := 00h Return Super VGA information ES:DI := Pointer to buffer Output: AX := status (All other registers are preserved) */ ((char *) pVbe->memory)[0] = 'V'; ((char *) pVbe->memory)[1] = 'B'; ((char *) pVbe->memory)[2] = 'E'; ((char *) pVbe->memory)[3] = '2'; pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f00; pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return NULL; block = calloc(sizeof(VbeInfoBlock), 1); block->VESASignature[0] = ((char *) pVbe->memory)[0]; block->VESASignature[1] = ((char *) pVbe->memory)[1]; block->VESASignature[2] = ((char *) pVbe->memory)[2]; block->VESASignature[3] = ((char *) pVbe->memory)[3]; block->VESAVersion = *(CARD16 *) (((char *) pVbe->memory) + 4); major = (unsigned) block->VESAVersion >> 8; pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 6)); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OEMStringPtr = strdup(str); block->Capabilities[0] = ((char *) pVbe->memory)[10]; block->Capabilities[1] = ((char *) pVbe->memory)[11]; block->Capabilities[2] = ((char *) pVbe->memory)[12]; block->Capabilities[3] = ((char *) pVbe->memory)[13]; pModes = GET_UNALIGNED2((((char *) pVbe->memory) + 14)); modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); i = 0; while (modes[i] != 0xffff) i++; block->VideoModePtr = xallocarray(i + 1, sizeof(CARD16)); memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); block->VideoModePtr[i] = 0xffff; block->TotalMemory = *(CARD16 *) (((char *) pVbe->memory) + 18); if (major < 2) memcpy(&block->OemSoftwareRev, ((char *) pVbe->memory) + 20, 236); else { block->OemSoftwareRev = *(CARD16 *) (((char *) pVbe->memory) + 20); pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 22)); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OemVendorNamePtr = strdup(str); pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 26)); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OemProductNamePtr = strdup(str); pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 30)); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OemProductRevPtr = strdup(str); memcpy(&block->Reserved, ((char *) pVbe->memory) + 34, 222); memcpy(&block->OemData, ((char *) pVbe->memory) + 256, 256); } return block; } void VBEFreeVBEInfo(VbeInfoBlock * block) { free(block->OEMStringPtr); free(block->VideoModePtr); if (((unsigned) block->VESAVersion >> 8) >= 2) { free(block->OemVendorNamePtr); free(block->OemProductNamePtr); free(block->OemProductRevPtr); } free(block); } Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock * block) { /* Input: AH := 4Fh Super VGA support AL := 02h Set Super VGA video mode BX := Video mode D0-D8 := Mode number D9-D10 := Reserved (must be 0) D11 := 0 Use current default refresh rate := 1 Use user specified CRTC values for refresh rate D12-13 Reserved for VBE/AF (must be 0) D14 := 0 Use windowed frame buffer model := 1 Use linear/flat frame buffer model D15 := 0 Clear video memory := 1 Don't clear video memory ES:DI := Pointer to VbeCRTCInfoBlock structure Output: AX = Status (All other registers are preserved) */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f02; pVbe->pInt10->bx = mode; if (block) { pVbe->pInt10->bx |= 1 << 11; memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock)); pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); } else pVbe->pInt10->bx &= ~(1 << 11); xf86ExecX86int10(pVbe->pInt10); return (R16(pVbe->pInt10->ax) == 0x4f); } Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) { /* Input: AH := 4Fh Super VGA support AL := 03h Return current video mode Output: AX := Status BX := Current video mode (All other registers are preserved) */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f03; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) == 0x4f) { *mode = R16(pVbe->pInt10->bx); return TRUE; } return FALSE; } VbeModeInfoBlock * VBEGetModeInfo(vbeInfoPtr pVbe, int mode) { VbeModeInfoBlock *block = NULL; memset(pVbe->memory, 0, sizeof(VbeModeInfoBlock)); /* Input: AH := 4Fh Super VGA support AL := 01h Return Super VGA mode information CX := Super VGA video mode (mode number must be one of those returned by Function 0) ES:DI := Pointer to buffer Output: AX := status (All other registers are preserved) */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f01; pVbe->pInt10->cx = mode; pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return NULL; block = malloc(sizeof(VbeModeInfoBlock)); if (block) memcpy(block, pVbe->memory, sizeof(*block)); return block; } void VBEFreeModeInfo(VbeModeInfoBlock * block) { free(block); } Bool VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, void **memory, int *size, int *real_mode_pages) { /* Input: AH := 4Fh Super VGA support AL := 04h Save/restore Super VGA video state DL := 00h Return save/restore state buffer size CX := Requested states D0 = Save/restore video hardware state D1 = Save/restore video BIOS data state D2 = Save/restore video DAC state D3 = Save/restore Super VGA state Output: AX = Status BX = Number of 64-byte blocks to hold the state buffer (All other registers are preserved) Input: AH := 4Fh Super VGA support AL := 04h Save/restore Super VGA video state DL := 01h Save Super VGA video state CX := Requested states (see above) ES:BX := Pointer to buffer Output: AX := Status (All other registers are preserved) Input: AH := 4Fh Super VGA support AL := 04h Save/restore Super VGA video state DL := 02h Restore Super VGA video state CX := Requested states (see above) ES:BX := Pointer to buffer Output: AX := Status (All other registers are preserved) */ if ((pVbe->version & 0xff00) > 0x100) { int screen = pVbe->pInt10->pScrn->scrnIndex; if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) { /* Query amount of memory to save state */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f04; pVbe->pInt10->dx = 0; pVbe->pInt10->cx = 0x000f; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return FALSE; if (function == MODE_SAVE) { int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1; if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, real_mode_pages)) == NULL) { xf86DrvMsg(screen, X_ERROR, "Cannot allocate memory to save SVGA state.\n"); return FALSE; } } *size = pVbe->pInt10->bx * 64; } /* Save/Restore Super VGA state */ if (function != MODE_QUERY) { if (!*memory) return FALSE; pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f04; switch (function) { case MODE_SAVE: pVbe->pInt10->dx = 1; break; case MODE_RESTORE: pVbe->pInt10->dx = 2; break; case MODE_QUERY: return FALSE; } pVbe->pInt10->cx = 0x000f; pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); xf86ExecX86int10(pVbe->pInt10); return (R16(pVbe->pInt10->ax) == 0x4f); } } return TRUE; } Bool VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) { /* Input: AH := 4Fh Super VGA support AL := 05h Output: */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f05; pVbe->pInt10->bx = window; pVbe->pInt10->dx = iBank; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return FALSE; return TRUE; } Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, int width, int *pixels, int *bytes, int *max) { if (command < SCANWID_SET || command > SCANWID_GET_MAX) return FALSE; /* Input: AX := 4F06h VBE Set/Get Logical Scan Line Length BL := 00h Set Scan Line Length in Pixels := 01h Get Scan Line Length := 02h Set Scan Line Length in Bytes := 03h Get Maximum Scan Line Length CX := If BL=00h Desired Width in Pixels If BL=02h Desired Width in Bytes (Ignored for Get Functions) Output: AX := VBE Return Status BX := Bytes Per Scan Line CX := Actual Pixels Per Scan Line (truncated to nearest complete pixel) DX := Maximum Number of Scan Lines */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f06; pVbe->pInt10->bx = command; if (command == SCANWID_SET || command == SCANWID_SET_BYTES) pVbe->pInt10->cx = width; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return FALSE; if (command == SCANWID_GET || command == SCANWID_GET_MAX) { if (pixels) *pixels = R16(pVbe->pInt10->cx); if (bytes) *bytes = R16(pVbe->pInt10->bx); if (max) *max = R16(pVbe->pInt10->dx); } return TRUE; } Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) { pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f07; pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00; pVbe->pInt10->cx = x; pVbe->pInt10->dx = y; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return FALSE; return TRUE; } Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) { pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f07; pVbe->pInt10->bx = 0x01; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return FALSE; *x = pVbe->pInt10->cx; *y = pVbe->pInt10->dx; return TRUE; } int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) { /* Input: AX := 4F08h VBE Set/Get Palette Format BL := 00h Set DAC Palette Format := 01h Get DAC Palette Format BH := Desired bits of color per primary (Set DAC Palette Format only) Output: AX := VBE Return Status BH := Current number of bits of color per primary */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f08; if (!bits) pVbe->pInt10->bx = 0x01; else pVbe->pInt10->bx = (bits & 0x00ff) << 8; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return 0; return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); } CARD32 * VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, CARD32 *data, Bool secondary, Bool wait_retrace) { /* Input: (16-bit) AX := 4F09h VBE Load/Unload Palette Data BL := 00h Set Palette Data := 01h Get Palette Data := 02h Set Secondary Palette Data := 03h Get Secondary Palette Data := 80h Set Palette Data during Vertical Retrace CX := Number of palette registers to update (to a maximum of 256) DX := First of the palette registers to update (start) ES:DI := Table of palette values (see below for format) Output: AX := VBE Return Status Input: (32-bit) BL := 00h Set Palette Data := 80h Set Palette Data during Vertical Retrace CX := Number of palette registers to update (to a maximum of 256) DX := First of the palette registers to update (start) ES:EDI := Table of palette values (see below for format) DS := Selector for memory mapped registers */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f09; if (!secondary) pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; else pVbe->pInt10->bx = set ? 2 : 3; pVbe->pInt10->cx = num; pVbe->pInt10->dx = first; pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); if (set) memcpy(pVbe->memory, data, num * sizeof(CARD32)); xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return NULL; if (set) return data; data = xallocarray(num, sizeof(CARD32)); memcpy(data, pVbe->memory, num * sizeof(CARD32)); return data; } VBEpmi * VBEGetVBEpmi(vbeInfoPtr pVbe) { VBEpmi *pmi; /* Input: AH := 4Fh Super VGA support AL := 0Ah Protected Mode Interface BL := 00h Return Protected Mode Table Output: AX := Status ES := Real Mode Segment of Table DI := Offset of Table CX := Lenght of Table including protected mode code in bytes (for copying purposes) (All other registers are preserved) */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f0a; pVbe->pInt10->bx = 0; pVbe->pInt10->di = 0; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return NULL; pmi = malloc(sizeof(VBEpmi)); pmi->seg_tbl = R16(pVbe->pInt10->es); pmi->tbl_off = R16(pVbe->pInt10->di); pmi->tbl_len = R16(pVbe->pInt10->cx); return pmi; } #if 0 vbeModeInfoPtr VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) { vbeModeInfoPtr ModeList = NULL; int i = 0; while (vbe->VideoModePtr[i] != 0xffff) { vbeModeInfoPtr m; VbeModeInfoBlock *mode; int id = vbe->VideoModePtr[i++]; int bpp; if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) continue; bpp = mode->BitsPerPixel; m = xnfcalloc(sizeof(vbeModeInfoRec), 1); m->width = mode->XResolution; m->height = mode->YResolution; m->bpp = bpp; m->n = id; m->next = ModeList; xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3, "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", m->n, m->width, m->height, m->bpp); ModeList = m; VBEFreeModeInfo(mode); } return ModeList; } unsigned short VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp) { while (m) { if (bpp == m->bpp && mode->HDisplay == m->width && mode->VDisplay == m->height) return m->n; m = m->next; } return 0; } #endif void VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, vbeSaveRestoreFunction function) { Bool SaveSucc = FALSE; if (VBE_VERSION_MAJOR(pVbe->version) > 1 && (function == MODE_SAVE || vbe_sr->pstate)) { if (function == MODE_RESTORE) memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize); ErrorF("VBESaveRestore\n"); if ((VBESaveRestore(pVbe, function, (void *) &vbe_sr->state, &vbe_sr->stateSize, &vbe_sr->statePage))) { if (function == MODE_SAVE) { SaveSucc = TRUE; vbe_sr->stateMode = -1; /* invalidate */ /* don't rely on the memory not being touched */ if (vbe_sr->pstate == NULL) vbe_sr->pstate = malloc(vbe_sr->stateSize); memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize); } ErrorF("VBESaveRestore done with success\n"); return; } ErrorF("VBESaveRestore done\n"); } if (function == MODE_SAVE && !SaveSucc) (void) VBEGetVBEMode(pVbe, &vbe_sr->stateMode); if (function == MODE_RESTORE && vbe_sr->stateMode != -1) VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL); } int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) { /* Input: AX := 4F0Bh VBE Get Pixel Clock BL := 00h Get Pixel Clock ECX := pixel clock in units of Hz DX := mode number Output: AX := VBE Return Status ECX := Closest pixel clock */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f0b; pVbe->pInt10->bx = 0x00; pVbe->pInt10->cx = clock; pVbe->pInt10->dx = mode; xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) return 0; return pVbe->pInt10->cx; } Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode) { /* Input: AX := 4F10h DPMS BL := 01h Set Display Power State BH := requested power state Output: AX := VBE Return Status */ pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f10; pVbe->pInt10->bx = 0x01; switch (mode) { case DPMSModeOn: break; case DPMSModeStandby: pVbe->pInt10->bx |= 0x100; break; case DPMSModeSuspend: pVbe->pInt10->bx |= 0x200; break; case DPMSModeOff: pVbe->pInt10->bx |= 0x400; break; } xf86ExecX86int10(pVbe->pInt10); return (R16(pVbe->pInt10->ax) == 0x4f); } void VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data) { DisplayModePtr mode; const float PANEL_HZ = 60.0; if (!data) return; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", data->hsize, data->vsize); if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh) return; if (data->hsize < 320 || data->vsize < 240) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "...which I refuse to believe\n"); return; } mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0); pScrn->monitor->nHsync = 1; pScrn->monitor->hsync[0].lo = 29.37; pScrn->monitor->hsync[0].hi = (float) mode->Clock / (float) mode->HTotal; pScrn->monitor->nVrefresh = 1; pScrn->monitor->vrefresh[0].lo = 56.0; pScrn->monitor->vrefresh[0].hi = (float) mode->Clock * 1000.0 / (float) mode->HTotal / (float) mode->VTotal; if (pScrn->monitor->vrefresh[0].hi < 59.47) pScrn->monitor->vrefresh[0].hi = 59.47; free(mode); } struct vbePanelID * VBEReadPanelID(vbeInfoPtr pVbe) { int RealOff = pVbe->real_mode_base; void *page = pVbe->memory; void *tmp = NULL; int screen = pVbe->pInt10->pScrn->scrnIndex; pVbe->pInt10->ax = 0x4F11; pVbe->pInt10->bx = 0x01; pVbe->pInt10->cx = 0; pVbe->pInt10->dx = 0; pVbe->pInt10->es = SEG_ADDR(RealOff); pVbe->pInt10->di = SEG_OFF(RealOff); pVbe->pInt10->num = 0x10; xf86ExecX86int10(pVbe->pInt10); if ((pVbe->pInt10->ax & 0xff) != 0x4f) { xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID invalid\n"); goto error; } switch (pVbe->pInt10->ax & 0xff00) { case 0x0: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID read successfully\n"); tmp = xnfalloc(32); memcpy(tmp, page, 32); break; case 0x100: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID read failed\n"); break; default: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID unknown failure %i\n", pVbe->pInt10->ax & 0xff00); break; } error: return tmp; } xorg-server-1.20.8/hw/xfree86/vbe/Makefile.am0000644000175000017500000000067013640201473015526 00000000000000module_LTLIBRARIES = libvbe.la libvbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c if NO_UNDEFINED libvbe_la_LIBADD = ../int10/libint10.la endif sdk_HEADERS = vbe.h vbeModes.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../modes -I$(srcdir)/../parser \ -I$(srcdir)/../int10 xorg-server-1.20.8/hw/xfree86/vbe/vbe.h0000644000175000017500000003001613640201473014414 00000000000000 /* * XFree86 vbe module * Copyright 2000 Egbert Eich * * The mode query/save/set/restore functions from the vesa driver * have been moved here. * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) * Authors: Paulo César Pereira de Andrade */ #ifndef _VBE_H #define _VBE_H #include "xf86int10.h" #include "xf86DDC.h" typedef enum { DDC_UNCHECKED, DDC_NONE, DDC_1, DDC_2, DDC_1_2 } ddc_lvl; typedef struct { xf86Int10InfoPtr pInt10; int version; void *memory; int real_mode_base; int num_pages; Bool init_int10; ddc_lvl ddc; Bool ddc_blank; } vbeInfoRec, *vbeInfoPtr; #define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1) #define VBE_VERSION_MINOR(x) (CARD8)(x) extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex); extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags); extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe); extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, void *pDDCModule); #pragma pack(1) typedef struct vbeControllerInfoBlock { CARD8 VbeSignature[4]; CARD16 VbeVersion; CARD32 OemStringPtr; CARD8 Capabilities[4]; CARD32 VideoModePtr; CARD16 TotalMem; CARD16 OemSoftwareRev; CARD32 OemVendorNamePtr; CARD32 OemProductNamePtr; CARD32 OemProductRevPtr; CARD8 Scratch[222]; CARD8 OemData[256]; } vbeControllerInfoRec, *vbeControllerInfoPtr; #if defined(__GNUC__) || defined(__USLC__) || defined(__SUNPRO_C) #pragma pack() /* All GCC versions recognise this syntax */ #else #pragma pack(0) #endif #if !( defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) ) #define __attribute__(a) #endif typedef struct _VbeInfoBlock VbeInfoBlock; typedef struct _VbeModeInfoBlock VbeModeInfoBlock; typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; /* * INT 0 */ struct _VbeInfoBlock { /* VESA 1.2 fields */ CARD8 VESASignature[4]; /* VESA */ CARD16 VESAVersion; /* Higher byte major, lower byte minor */ /*CARD32 */ char *OEMStringPtr; /* Pointer to OEM string */ CARD8 Capabilities[4]; /* Capabilities of the video environment */ /*CARD32 */ CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ /* VESA 2 fields */ CARD16 OemSoftwareRev; /* VBE implementation Software revision */ /*CARD32 */ char *OemVendorNamePtr; /* Pointer to Vendor Name String */ /*CARD32 */ char *OemProductNamePtr; /* Pointer to Product Name String */ /*CARD32 */ char *OemProductRevPtr; /* Pointer to Product Revision String */ CARD8 Reserved[222]; /* Reserved for VBE implementation */ CARD8 OemData[256]; /* Data Area for OEM Strings */ } __attribute__ ((packed)); /* Return Super VGA Information */ extern _X_EXPORT VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe); extern _X_EXPORT void VBEFreeVBEInfo(VbeInfoBlock * block); /* * INT 1 */ struct _VbeModeInfoBlock { CARD16 ModeAttributes; /* mode attributes */ CARD8 WinAAttributes; /* window A attributes */ CARD8 WinBAttributes; /* window B attributes */ CARD16 WinGranularity; /* window granularity */ CARD16 WinSize; /* window size */ CARD16 WinASegment; /* window A start segment */ CARD16 WinBSegment; /* window B start segment */ CARD32 WinFuncPtr; /* real mode pointer to window function */ CARD16 BytesPerScanline; /* bytes per scanline */ /* Mandatory information for VBE 1.2 and above */ CARD16 XResolution; /* horizontal resolution in pixels or characters */ CARD16 YResolution; /* vertical resolution in pixels or characters */ CARD8 XCharSize; /* character cell width in pixels */ CARD8 YCharSize; /* character cell height in pixels */ CARD8 NumberOfPlanes; /* number of memory planes */ CARD8 BitsPerPixel; /* bits per pixel */ CARD8 NumberOfBanks; /* number of banks */ CARD8 MemoryModel; /* memory model type */ CARD8 BankSize; /* bank size in KB */ CARD8 NumberOfImages; /* number of images */ CARD8 Reserved; /* 1 *//* reserved for page function */ /* Direct color fields (required for direct/6 and YUV/7 memory models) */ CARD8 RedMaskSize; /* size of direct color red mask in bits */ CARD8 RedFieldPosition; /* bit position of lsb of red mask */ CARD8 GreenMaskSize; /* size of direct color green mask in bits */ CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ CARD8 DirectColorModeInfo; /* direct color mode attributes */ /* Mandatory information for VBE 2.0 and above */ CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ CARD32 Reserved32; /* 0 *//* Reserved - always set to 0 */ CARD16 Reserved16; /* 0 *//* Reserved - always set to 0 */ /* Mandatory information for VBE 3.0 and above */ CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ CARD8 LinNumberOfImagePages; /* number of images for linear modes */ CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ } __attribute__ ((packed)); /* Return VBE Mode Information */ extern _X_EXPORT VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode); extern _X_EXPORT void VBEFreeModeInfo(VbeModeInfoBlock * block); /* * INT2 */ #define CRTC_DBLSCAN (1<<0) #define CRTC_INTERLACE (1<<1) #define CRTC_NHSYNC (1<<2) #define CRTC_NVSYNC (1<<3) struct _VbeCRTCInfoBlock { CARD16 HorizontalTotal; /* Horizontal total in pixels */ CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ CARD16 VerticalTotal; /* Vertical total in lines */ CARD16 VerticalSyncStart; /* Vertical sync start in lines */ CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ CARD32 PixelClock; /* Pixel clock in units of Hz */ CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ } __attribute__ ((packed)); /* VbeCRTCInfoBlock is in the VESA 3.0 specs */ extern _X_EXPORT Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock * crtc); /* * INT 3 */ extern _X_EXPORT Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode); /* * INT 4 */ /* Save/Restore Super VGA video state */ /* function values are (values stored in VESAPtr): * 0 := query & allocate amount of memory to save state * 1 := save state * 2 := restore state * * function 0 called automatically if function 1 called without * a previous call to function 0. */ typedef enum { MODE_QUERY, MODE_SAVE, MODE_RESTORE } vbeSaveRestoreFunction; extern _X_EXPORT Bool VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, void **memory, int *size, int *real_mode_pages); /* * INT 5 */ extern _X_EXPORT Bool VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window); /* * INT 6 */ typedef enum { SCANWID_SET, SCANWID_GET, SCANWID_SET_BYTES, SCANWID_GET_MAX } vbeScanwidthCommand; #define VBESetLogicalScanline(pVbe, width) \ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, width, \ NULL, NULL, NULL) #define VBESetLogicalScanlineBytes(pVbe, width) \ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \ NULL, NULL, NULL) #define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \ pixels, bytes, max) #define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, 0, \ pixels, bytes, max) extern _X_EXPORT Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, int width, int *pixels, int *bytes, int *max); /* * INT 7 */ /* 16 bit code */ extern _X_EXPORT Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace); extern _X_EXPORT Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y); /* * INT 8 */ /* if bits is 0, then it is a GET */ extern _X_EXPORT int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits); /* * INT 9 */ /* * If getting a palette, the data argument is not used. It will return * the data. * If setting a palette, it will return the pointer received on success, * NULL on failure. */ extern _X_EXPORT CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, CARD32 *data, Bool secondary, Bool wait_retrace); #define VBEFreePaletteData(data) free(data) /* * INT A */ typedef struct _VBEpmi { int seg_tbl; int tbl_off; int tbl_len; } VBEpmi; extern _X_EXPORT VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe); #define VESAFreeVBEpmi(pmi) free(pmi) /* high level helper functions */ typedef struct _vbeModeInfoRec { int width; int height; int bpp; int n; struct _vbeModeInfoRec *next; } vbeModeInfoRec, *vbeModeInfoPtr; typedef struct { CARD8 *state; CARD8 *pstate; int statePage; int stateSize; int stateMode; } vbeSaveRestoreRec, *vbeSaveRestorePtr; extern _X_EXPORT void VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, vbeSaveRestoreFunction function); extern _X_EXPORT int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock); extern _X_EXPORT Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode); struct vbePanelID { short hsize; short vsize; short fptype; char redbpp; char greenbpp; char bluebpp; char reservedbpp; int reserved_offscreen_mem_size; int reserved_offscreen_mem_pointer; char reserved[14]; }; extern _X_EXPORT void VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data); extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe); #endif xorg-server-1.20.8/hw/xfree86/vbe/Makefile.in0000644000175000017500000007375013640201514015544 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/xfree86/vbe ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(sdk_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) @NO_UNDEFINED_TRUE@libvbe_la_DEPENDENCIES = ../int10/libint10.la am_libvbe_la_OBJECTS = vbe.lo vbeModes.lo vbe_module.lo libvbe_la_OBJECTS = $(am_libvbe_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libvbe_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libvbe_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/vbe.Plo ./$(DEPDIR)/vbeModes.Plo \ ./$(DEPDIR)/vbe_module.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libvbe_la_SOURCES) DIST_SOURCES = $(libvbe_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(sdk_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libvbe.la libvbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c @NO_UNDEFINED_TRUE@libvbe_la_LIBADD = ../int10/libint10.la sdk_HEADERS = vbe.h vbeModes.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../modes -I$(srcdir)/../parser \ -I$(srcdir)/../int10 all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/vbe/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/xfree86/vbe/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-moduleLTLIBRARIES: $(module_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ } uninstall-moduleLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ done clean-moduleLTLIBRARIES: -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) @list='$(module_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libvbe.la: $(libvbe_la_OBJECTS) $(libvbe_la_DEPENDENCIES) $(EXTRA_libvbe_la_DEPENDENCIES) $(AM_V_CCLD)$(libvbe_la_LINK) -rpath $(moduledir) $(libvbe_la_OBJECTS) $(libvbe_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbe.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbeModes.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbe_module.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-sdkHEADERS: $(sdk_HEADERS) @$(NORMAL_INSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ done uninstall-sdkHEADERS: @$(NORMAL_UNINSTALL) @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/vbe.Plo -rm -f ./$(DEPDIR)/vbeModes.Plo -rm -f ./$(DEPDIR)/vbe_module.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/vbe.Plo -rm -f ./$(DEPDIR)/vbeModes.Plo -rm -f ./$(DEPDIR)/vbe_module.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-moduleLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-sdkHEADERS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/xfree86/vbe/vbeModes.h0000644000175000017500000000755213640201473015415 00000000000000/* * Copyright © 2002 David Dawes * * 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 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 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 author(s). * * Authors: David Dawes * */ #ifndef _VBE_MODES_H /* * This is intended to be stored in the DisplayModeRec's private area. * It includes all the information necessary to VBE information. */ typedef struct _VbeModeInfoData { int mode; VbeModeInfoBlock *data; VbeCRTCInfoBlock *block; } VbeModeInfoData; #define V_DEPTH_1 0x001 #define V_DEPTH_4 0x002 #define V_DEPTH_8 0x004 #define V_DEPTH_15 0x008 #define V_DEPTH_16 0x010 #define V_DEPTH_24_24 0x020 #define V_DEPTH_24_32 0x040 #define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32) #define V_DEPTH_30 0x080 #define V_DEPTH_32 0x100 #define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0) #define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0) #define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0) #define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0) #define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \ ((m)->PhysBasePtr != 0)) #define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \ (f & V_MODETYPE_BAD)) && \ VBE_MODE_GRAPHICS(m) && \ (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m)) #define V_MODETYPE_VBE 0x01 #define V_MODETYPE_VGA 0x02 #define V_MODETYPE_BAD 0x04 extern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, int *flags24, int modeTypes); extern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int modeTypes); extern _X_EXPORT void VBESetModeNames(DisplayModePtr pMode); extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe); /* * Note: These are alternatives to the standard helpers. They should * usually just wrap the standard helpers. */ extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, int maxHeight, int virtualX, int virtualY, int apertureSize, LookupModeFlags strategy); extern _X_EXPORT void VBEPrintModes(ScrnInfoPtr scrp); #endif /* VBE_MODES_H */ xorg-server-1.20.8/hw/xfree86/vbe/vbe_module.c0000644000175000017500000000073413640201473015760 00000000000000#ifdef HAVE_XORG_CONFIG_H #include #endif #include "xf86.h" #include "xf86str.h" #include "vbe.h" static XF86ModuleVersionInfo vbeVersRec = { "vbe", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 1, 0, ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, {0, 0, 0, 0} }; _X_EXPORT XF86ModuleData vbeModuleData = { &vbeVersRec, NULL, NULL }; xorg-server-1.20.8/hw/xfree86/vbe/vbeModes.c0000644000175000017500000003771613640201473015415 00000000000000#define DEBUG_VERB 2 /* * Copyright © 2002 David Dawes * * 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 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 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 author(s). * * Authors: David Dawes * */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "xf86.h" #include "vbe.h" #include "vbeModes.h" static int GetDepthFlag(vbeInfoPtr pVbe, int id) { VbeModeInfoBlock *mode; int bpp; if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) return 0; if (VBE_MODE_USABLE(mode, 0)) { int depth; if (VBE_MODE_COLOR(mode)) { depth = mode->RedMaskSize + mode->GreenMaskSize + mode->BlueMaskSize; } else { depth = 1; } bpp = mode->BitsPerPixel; VBEFreeModeInfo(mode); mode = NULL; switch (depth) { case 1: return V_DEPTH_1; case 4: return V_DEPTH_4; case 8: return V_DEPTH_8; case 15: return V_DEPTH_15; case 16: return V_DEPTH_16; case 24: switch (bpp) { case 24: return V_DEPTH_24_24; case 32: return V_DEPTH_24_32; } } } if (mode) VBEFreeModeInfo(mode); return 0; } /* * Find supported mode depths. */ int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, int *flags24, int modeTypes) { int i = 0; int depths = 0; if (modeTypes & V_MODETYPE_VBE) { while (vbe->VideoModePtr[i] != 0xffff) { depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]); } } /* * XXX This possibly only works with VBE 3.0 and later. */ if (modeTypes & V_MODETYPE_VGA) { for (i = 0; i < 0x7F; i++) { depths |= GetDepthFlag(pVbe, i); } } if (flags24) { if (depths & V_DEPTH_24_24) *flags24 |= Support24bppFb; if (depths & V_DEPTH_24_32) *flags24 |= Support32bppFb; } return depths; } static DisplayModePtr CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int id, int flags) { CARD16 major; VbeModeInfoBlock *mode; DisplayModePtr pMode; VbeModeInfoData *data; Bool modeOK = FALSE; major = (unsigned) (vbe->VESAVersion >> 8); if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) return NULL; /* Does the mode match the depth/bpp? */ /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */ if (VBE_MODE_USABLE(mode, flags) && ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) || (mode->BitsPerPixel > 8 && (mode->RedMaskSize + mode->GreenMaskSize + mode->BlueMaskSize) == pScrn->depth && mode->BitsPerPixel == pScrn->bitsPerPixel) || (mode->BitsPerPixel == 15 && pScrn->depth == 15) || (mode->BitsPerPixel <= 8 && mode->BitsPerPixel == pScrn->bitsPerPixel))) { modeOK = TRUE; xf86ErrorFVerb(DEBUG_VERB, "*"); } xf86ErrorFVerb(DEBUG_VERB, "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); xf86ErrorFVerb(DEBUG_VERB, " ModeAttributes: 0x%x\n", mode->ModeAttributes); xf86ErrorFVerb(DEBUG_VERB, " WinAAttributes: 0x%x\n", mode->WinAAttributes); xf86ErrorFVerb(DEBUG_VERB, " WinBAttributes: 0x%x\n", mode->WinBAttributes); xf86ErrorFVerb(DEBUG_VERB, " WinGranularity: %d\n", mode->WinGranularity); xf86ErrorFVerb(DEBUG_VERB, " WinSize: %d\n", mode->WinSize); xf86ErrorFVerb(DEBUG_VERB, " WinASegment: 0x%x\n", mode->WinASegment); xf86ErrorFVerb(DEBUG_VERB, " WinBSegment: 0x%x\n", mode->WinBSegment); xf86ErrorFVerb(DEBUG_VERB, " WinFuncPtr: 0x%lx\n", (unsigned long) mode->WinFuncPtr); xf86ErrorFVerb(DEBUG_VERB, " BytesPerScanline: %d\n", mode->BytesPerScanline); xf86ErrorFVerb(DEBUG_VERB, " XResolution: %d\n", mode->XResolution); xf86ErrorFVerb(DEBUG_VERB, " YResolution: %d\n", mode->YResolution); xf86ErrorFVerb(DEBUG_VERB, " XCharSize: %d\n", mode->XCharSize); xf86ErrorFVerb(DEBUG_VERB, " YCharSize: %d\n", mode->YCharSize); xf86ErrorFVerb(DEBUG_VERB, " NumberOfPlanes: %d\n", mode->NumberOfPlanes); xf86ErrorFVerb(DEBUG_VERB, " BitsPerPixel: %d\n", mode->BitsPerPixel); xf86ErrorFVerb(DEBUG_VERB, " NumberOfBanks: %d\n", mode->NumberOfBanks); xf86ErrorFVerb(DEBUG_VERB, " MemoryModel: %d\n", mode->MemoryModel); xf86ErrorFVerb(DEBUG_VERB, " BankSize: %d\n", mode->BankSize); xf86ErrorFVerb(DEBUG_VERB, " NumberOfImages: %d\n", mode->NumberOfImages); xf86ErrorFVerb(DEBUG_VERB, " RedMaskSize: %d\n", mode->RedMaskSize); xf86ErrorFVerb(DEBUG_VERB, " RedFieldPosition: %d\n", mode->RedFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " GreenMaskSize: %d\n", mode->GreenMaskSize); xf86ErrorFVerb(DEBUG_VERB, " GreenFieldPosition: %d\n", mode->GreenFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " BlueMaskSize: %d\n", mode->BlueMaskSize); xf86ErrorFVerb(DEBUG_VERB, " BlueFieldPosition: %d\n", mode->BlueFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " RsvdMaskSize: %d\n", mode->RsvdMaskSize); xf86ErrorFVerb(DEBUG_VERB, " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); if (major >= 2) { xf86ErrorFVerb(DEBUG_VERB, " PhysBasePtr: 0x%lx\n", (unsigned long) mode->PhysBasePtr); if (major >= 3) { xf86ErrorFVerb(DEBUG_VERB, " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); xf86ErrorFVerb(DEBUG_VERB, " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); xf86ErrorFVerb(DEBUG_VERB, " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); xf86ErrorFVerb(DEBUG_VERB, " LinRedMaskSize: %d\n", mode->LinRedMaskSize); xf86ErrorFVerb(DEBUG_VERB, " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); xf86ErrorFVerb(DEBUG_VERB, " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); xf86ErrorFVerb(DEBUG_VERB, " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); xf86ErrorFVerb(DEBUG_VERB, " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); xf86ErrorFVerb(DEBUG_VERB, " MaxPixelClock: %ld\n", (unsigned long) mode->MaxPixelClock); } } if (!modeOK) { VBEFreeModeInfo(mode); return NULL; } pMode = xnfcalloc(sizeof(DisplayModeRec), 1); pMode->status = MODE_OK; pMode->type = M_T_BUILTIN; /* for adjust frame */ pMode->HDisplay = mode->XResolution; pMode->VDisplay = mode->YResolution; data = xnfcalloc(sizeof(VbeModeInfoData), 1); data->mode = id; data->data = mode; pMode->PrivSize = sizeof(VbeModeInfoData); pMode->Private = (INT32 *) data; pMode->next = NULL; return pMode; } /* * Check the available BIOS modes, and extract those that match the * requirements into the modePool. Note: modePool is a NULL-terminated * list. */ DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int modeTypes) { DisplayModePtr pMode, p = NULL, modePool = NULL; int i = 0; if (modeTypes & V_MODETYPE_VBE) { while (vbe->VideoModePtr[i] != 0xffff) { int id = vbe->VideoModePtr[i++]; if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) { ModeStatus status = MODE_OK; /* Check the mode against a specified virtual size (if any) */ if (pScrn->display->virtualX > 0 && pMode->HDisplay > pScrn->display->virtualX) { status = MODE_VIRTUAL_X; } if (pScrn->display->virtualY > 0 && pMode->VDisplay > pScrn->display->virtualY) { status = MODE_VIRTUAL_Y; } if (status != MODE_OK) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not using mode \"%dx%d\" (%s)\n", pMode->HDisplay, pMode->VDisplay, xf86ModeStatusToString(status)); } else { if (p == NULL) { modePool = pMode; } else { p->next = pMode; } pMode->prev = NULL; p = pMode; } } } } if (modeTypes & V_MODETYPE_VGA) { for (i = 0; i < 0x7F; i++) { if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) { ModeStatus status = MODE_OK; /* Check the mode against a specified virtual size (if any) */ if (pScrn->display->virtualX > 0 && pMode->HDisplay > pScrn->display->virtualX) { status = MODE_VIRTUAL_X; } if (pScrn->display->virtualY > 0 && pMode->VDisplay > pScrn->display->virtualY) { status = MODE_VIRTUAL_Y; } if (status != MODE_OK) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not using mode \"%dx%d\" (%s)\n", pMode->HDisplay, pMode->VDisplay, xf86ModeStatusToString(status)); } else { if (p == NULL) { modePool = pMode; } else { p->next = pMode; } pMode->prev = NULL; p = pMode; } } } } return modePool; } void VBESetModeNames(DisplayModePtr pMode) { if (!pMode) return; do { if (!pMode->name) { /* Catch "bad" modes. */ if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 || pMode->VDisplay > 10000 || pMode->VDisplay < 0) { pMode->name = strdup("BADMODE"); } else { char *tmp; XNFasprintf(&tmp, "%dx%d", pMode->HDisplay, pMode->VDisplay); pMode->name = tmp; } } pMode = pMode->next; } while (pMode); } /* * Go through the monitor modes and selecting the best set of * parameters for each BIOS mode. Note: This is only supported in * VBE version 3.0 or later. */ void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe) { DisplayModePtr pMode; VbeModeInfoData *data; pMode = pScrn->modes; do { DisplayModePtr p, best = NULL; ModeStatus status; for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { if ((p->HDisplay != pMode->HDisplay) || (p->VDisplay != pMode->VDisplay) || (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) continue; /* XXX could support the various V_ flags */ status = xf86CheckModeForMonitor(p, pScrn->monitor); if (status != MODE_OK) continue; if (!best || (p->Clock > best->Clock)) best = p; } if (best) { int clock; data = (VbeModeInfoData *) pMode->Private; pMode->HSync = (float) best->Clock * 1000.0 / best->HTotal + 0.5; pMode->VRefresh = pMode->HSync / best->VTotal + 0.5; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Attempting to use %dHz refresh for mode \"%s\" (%x)\n", (int) pMode->VRefresh, pMode->name, data->mode); data->block = calloc(sizeof(VbeCRTCInfoBlock), 1); data->block->HorizontalTotal = best->HTotal; data->block->HorizontalSyncStart = best->HSyncStart; data->block->HorizontalSyncEnd = best->HSyncEnd; data->block->VerticalTotal = best->VTotal; data->block->VerticalSyncStart = best->VSyncStart; data->block->VerticalSyncEnd = best->VSyncEnd; data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) | ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0); data->block->PixelClock = best->Clock * 1000; /* XXX May not have this. */ clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock); DebugF("Setting clock %.2fMHz, closest is %.2fMHz\n", (double) data->block->PixelClock / 1000000.0, (double) clock / 1000000.0); if (clock) data->block->PixelClock = clock; data->mode |= (1 << 11); data->block->RefreshRate = ((double) (data->block->PixelClock) / (double) (best->HTotal * best->VTotal)) * 100; } pMode = pMode->next; } while (pMode != pScrn->modes); } /* * These wrappers are to allow (temporary) funtionality divergences. */ int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, int maxHeight, int virtualX, int virtualY, int apertureSize, LookupModeFlags strategy) { return xf86ValidateModes(scrp, availModes, modeNames, clockRanges, linePitches, minPitch, maxPitch, pitchInc, minHeight, maxHeight, virtualX, virtualY, apertureSize, strategy); } void VBEPrintModes(ScrnInfoPtr scrp) { xf86PrintModes(scrp); } xorg-server-1.20.8/hw/xfree86/vbe/meson.build0000644000175000017500000000043113640201473015627 00000000000000shared_module('vbe', [ 'vbe.c', 'vbeModes.c', 'vbe_module.c' ], include_directories: [ inc, xorg_inc ], dependencies: common_dep, c_args: xorg_c_args, install: true, install_dir: module_dir, ) install_data(['vbe.h', 'vbeModes.h'], install_dir: xorgsdkdir) xorg-server-1.20.8/hw/xfree86/meson.build0000644000175000017500000001117713640201473015064 00000000000000xorg_inc = include_directories( 'common', 'ddc', 'dri2', 'i2c', 'int10', 'loader', 'modes', 'os-support', 'os-support/bus', 'parser', 'ramdac', 'vbe', 'vgahw', ) xorg_c_args = [] xorg_c_args += '-DHAVE_XORG_CONFIG_H' xorg_c_args += '-DXORG_NO_SDKSYMS' pciaccess_dep = [] if get_option('pciaccess') pciaccess_dep = dependency('pciaccess', version: '>= 0.12.901') endif # subdirs for convenience libraries statically linked into Xorg subdir('common') subdir('ddc') if build_dri1 subdir('dri') endif if build_dri2 subdir('dri2') endif subdir('i2c') subdir('loader') subdir('modes') subdir('os-support') subdir('parser') subdir('ramdac') subdir('xkb') srcs_xorg = [ '../../mi/miinitext.c' ] # Extract all the objects so that all symbols get brought into the # server. This prevents us from needing a global table of all symbols # that should be exported to Xorg modules, at the expense of all # symbols being included and public xorg_link = [ libxserver, libglxvnd, xorg_common, xorg_loader, xorg_ddc, xorg_xkb, xorg_i2c, xorg_modes, xorg_os_support, xorg_parser, xorg_ramdac, libxserver_xext_vidmode, libxserver_main, libxserver_config, ] if build_dri1 xorg_link += xorg_dri endif if build_dri2 xorg_link += xorg_dri2 endif if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' linker_export_flags = '-Wl,--export-all-symbols' else linker_export_flags = '-Wl,--export-dynamic' endif xorg_deps = [ pixman_dep, m_dep, dl_dep, pciaccess_dep, sha1_dep, dependency('xau'), xdmcp_dep, xfont2_dep, xshmfence_dep, config_dep, libdrm_dep, ] if get_option('suid_wrapper') xorg_install_dir = get_option('libexecdir') else xorg_install_dir = get_option('bindir') endif e = executable( 'Xorg', srcs_xorg, include_directories: [inc, xorg_inc], link_whole: xorg_link, dependencies: xorg_deps, link_args: linker_export_flags, c_args: xorg_c_args, install: true, install_dir: xorg_install_dir, implib: true, ) # subdirs for modules loadable by Xorg subdir('dixmods') subdir('exa') subdir('fbdevhw') if gbm_dep.found() subdir('glamor_egl') endif if int10 != 'false' if int10 == 'x86emu' subdir('x86emu') endif subdir('int10') endif subdir('shadowfb') if build_vbe subdir('vbe') endif if build_vgahw subdir('vgahw') endif if build_modesetting subdir('drivers/modesetting') endif if get_option('suid_wrapper') executable('Xorg.wrap', 'xorg-wrapper.c', include_directories: [inc, xorg_inc], dependencies: xorg_deps, c_args: xorg_c_args, install: true, install_dir: get_option('libexecdir'), # install_mode: ['r-sr-xr-x', 0, 0], ) configure_file( input: 'Xorg.sh.in', output: 'Xorg', configuration: conf_data, install_dir: join_paths(get_option('prefix'), get_option('bindir')), ) endif executable('cvt', ['utils/cvt/cvt.c', 'modes/xf86cvt.c'], include_directories: [inc, xorg_inc], dependencies: xorg_deps, link_with: libxserver_os, c_args: xorg_c_args, install: true, ) executable('gtf', 'utils/gtf/gtf.c', include_directories: [inc, xorg_inc], dependencies: xorg_deps, c_args: xorg_c_args, install: true, ) # For symbol presence testing only xorgserver_lib = shared_library( 'xorgserver', srcs_xorg, include_directories: [inc, xorg_inc], link_whole: xorg_link, dependencies: xorg_deps, link_args: linker_export_flags, c_args: xorg_c_args, install: false, ) xorgserver_dep = declare_dependency(link_with: xorgserver_lib) install_man(configure_file( input: 'man/Xorg.man', output: 'Xorg.1', configuration: manpage_config, )) if get_option('suid_wrapper') install_man(configure_file( input: 'man/Xorg.wrap.man', output: 'Xorg.wrap.1', configuration: manpage_config, )) install_man(configure_file( input: 'man/Xwrapper.config.man', output: 'Xwrapper.config.5', configuration: manpage_config, )) endif install_man(configure_file( input: 'man/xorg.conf.man', output: 'xorg.conf.5', configuration: manpage_config, )) install_man(configure_file( input: 'man/xorg.conf.d.man', output: 'xorg.conf.d.5', configuration: manpage_config, )) install_man(configure_file( input: 'utils/man/cvt.man', output: 'cvt.1', configuration: manpage_config, )) install_man(configure_file( input: 'utils/man/gtf.man', output: 'gtf.1', configuration: manpage_config, )) xorg-server-1.20.8/hw/Makefile.in0000644000175000017500000006555513640201511013502 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @DMX_TRUE@DMX_SUBDIRS = dmx @XORG_TRUE@XORG_SUBDIRS = xfree86 @XVFB_TRUE@XVFB_SUBDIRS = vfb @XNEST_TRUE@XNEST_SUBDIRS = xnest @XWIN_TRUE@XWIN_SUBDIRS = xwin @KDRIVE_TRUE@KDRIVE_SUBDIRS = kdrive @XQUARTZ_TRUE@XQUARTZ_SUBDIRS = xquartz @XWAYLAND_TRUE@XWAYLAND_SUBDIRS = xwayland SUBDIRS = \ $(XORG_SUBDIRS) \ $(XWIN_SUBDIRS) \ $(XVFB_SUBDIRS) \ $(XNEST_SUBDIRS) \ $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ $(XQUARTZ_SUBDIRS) \ $(XWAYLAND_SUBDIRS) DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile relink: $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/dmx/0000755000175000017500000000000013640201533012271 500000000000000xorg-server-1.20.8/hw/dmx/input/0000755000175000017500000000000013640201533013430 500000000000000xorg-server-1.20.8/hw/dmx/input/dmxbackend.c0000644000175000017500000005177313640201473015634 00000000000000/* * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * David H. Dawes * Kevin E. Martin * Rickard E. (Rik) Faith */ /** \file * These routines support taking input from devices on the backend * (output) displays. \see dmxcommon.c. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #define DMX_BACKEND_DEBUG 0 #include "dmxinputinit.h" #include "dmxbackend.h" #include "dmxcommon.h" #include "dmxconsole.h" #include "dmxcursor.h" #include "dmxprop.h" #include "dmxsync.h" #include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */ #include "dmxevents.h" /* For dmxGetGlobalPosition */ #include "ChkNotMaskEv.h" #include "inputstr.h" #include "input.h" #include #include "mipointer.h" #include "scrnintstr.h" #include "windowstr.h" /* Private area for backend devices. */ typedef struct _myPrivate { DMX_COMMON_PRIVATE; int myScreen; DMXScreenInfo *grabbedScreen; int lastX, lastY; int centerX, centerY; int relative; int newscreen; int initialized; DevicePtr mou, kbd; int entered; int offX, offY; } myPrivate; #if DMX_BACKEND_DEBUG #define DMXDBG0(f) dmxLog(dmxDebug,f) #define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) #define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) #define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) #define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) #define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) #define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i) #define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j) #else #define DMXDBG0(f) #define DMXDBG1(f,a) #define DMXDBG2(f,a,b) #define DMXDBG3(f,a,b,c) #define DMXDBG4(f,a,b,c,d) #define DMXDBG5(f,a,b,c,d,e) #define DMXDBG6(f,a,b,c,d,e,g) #define DMXDBG7(f,a,b,c,d,e,g,h) #define DMXDBG8(f,a,b,c,d,e,g,h,i) #define DMXDBG9(f,a,b,c,d,e,g,h,i,j) #endif /** Create and return a private data structure. */ void * dmxBackendCreatePrivate(DeviceIntPtr pDevice) { GETDMXLOCALFROMPDEVICE; myPrivate *priv = calloc(1, sizeof(*priv)); priv->dmxLocal = dmxLocal; return priv; } /** Destroy the private data structure. No checking is performed to * verify that the structure was actually created by * #dmxBackendCreatePrivate. */ void dmxBackendDestroyPrivate(void *private) { free(private); } static void * dmxBackendTestScreen(DMXScreenInfo * dmxScreen, void *closure) { long target = (long) closure; if (dmxScreen->index == target) return dmxScreen; return NULL; } /* Return non-zero if screen and priv->myScreen are on the same physical * backend display (1 if they are the same screen, 2 if they are * different screens). Since this is a common operation, the results * are cached. The cache is invalidated if \a priv is NULL (this should * be done with each server generation and reconfiguration). */ static int dmxBackendSameDisplay(myPrivate * priv, long screen) { static myPrivate *oldpriv = NULL; static int oldscreen = -1; static int retcode = 0; if (priv == oldpriv && screen == oldscreen) return retcode; if (!priv) { /* Invalidate cache */ oldpriv = NULL; oldscreen = -1; retcode = 0; return 0; } if (screen == priv->myScreen) retcode = 1; else if (screen < 0 || screen >= dmxNumScreens) retcode = 0; else if (dmxPropertyIterate(priv->be, dmxBackendTestScreen, (void *) screen)) retcode = 2; else retcode = 0; oldpriv = priv; oldscreen = screen; return retcode; } static void * dmxBackendTestEvents(DMXScreenInfo * dmxScreen, void *closure) { XEvent *X = (XEvent *) closure; if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X)) return dmxScreen; return NULL; } static void * dmxBackendTestMotionEvent(DMXScreenInfo * dmxScreen, void *closure) { XEvent *X = (XEvent *) closure; if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X)) return dmxScreen; return NULL; } static DMXScreenInfo * dmxBackendGetEvent(myPrivate * priv, XEvent * X) { DMXScreenInfo *dmxScreen; if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X))) return dmxScreen; return NULL; } static DMXScreenInfo * dmxBackendPendingMotionEvent(myPrivate * priv, int save) { DMXScreenInfo *dmxScreen; XEvent N; if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestMotionEvent, &N))) { if (save) XPutBackEvent(dmxScreen->beDisplay, &N); return dmxScreen; } return NULL; } static void * dmxBackendTestWindow(DMXScreenInfo * dmxScreen, void *closure) { Window win = (Window) (long) closure; if (dmxScreen->scrnWin == win) return dmxScreen; return NULL; } static DMXScreenInfo * dmxBackendFindWindow(myPrivate * priv, Window win) { return dmxPropertyIterate(priv->be, dmxBackendTestWindow, (void *) (long) win); } /* If the cursor is over a set of overlapping screens and one of those * screens takes backend input, then we want that particular screen to * be current, not one of the other ones. */ static int dmxBackendFindOverlapping(myPrivate * priv, int screen, int x, int y) { DMXScreenInfo *start = &dmxScreens[screen]; DMXScreenInfo *pt; if (!start->over) return screen; for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { if (pt->index == priv->myScreen && dmxOnScreen(x, y, &dmxScreens[pt->index])) return pt->index; if (pt == start) break; } return screen; } /* Return non-zero if \a x and \a y are off \a screen. */ static int dmxBackendOffscreen(int screen, int x, int y) { DMXScreenInfo *dmxScreen = &dmxScreens[screen]; return (!dmxOnScreen(x, y, dmxScreen)); } /** This routine is called from #dmxCoreMotion for each motion * event. \a x and \a y are global coordinants. */ void dmxBackendUpdatePosition(void *private, int x, int y) { GETPRIVFROMPRIVATE; int screen = miPointerGetScreen(inputInfo.pointer)->myNum; DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; int oldRelative = priv->relative; int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); int same = dmxBackendSameDisplay(priv, topscreen); int offscreen = dmxBackendOffscreen(priv->myScreen, x, y); int offthis = dmxBackendOffscreen(screen, x, y); DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d" " topscreen=%d same=%d offscreen=%d offthis=%d\n", x, y, priv->myScreen, screen, priv->relative, topscreen, same, offscreen, offthis); if (offscreen) { /* If the cursor is off the input screen, it should be moving * relative unless it is visible on a screen of the same display * (i.e., one that shares the mouse). */ if (same == 2 && !offthis) { if (priv->relative) { DMXDBG0(" Off screen, but not absolute\n"); priv->relative = 0; } } else { if (!priv->relative) { DMXDBG0(" Off screen, but not relative\n"); priv->relative = 1; } } } else { if (topscreen != screen) { DMXDBG2(" Using screen %d instead of %d (from mi)\n", topscreen, screen); } if (same) { if (priv->relative) { DMXDBG0(" On screen, but not absolute\n"); priv->relative = 0; } } else { if (!priv->relative) { DMXDBG0(" Not on screen, but not relative\n"); priv->relative = 1; } } } if (oldRelative != priv->relative) { DMXDBG2(" Do switch, relative=%d same=%d\n", priv->relative, same); /* Discard all pre-switch events */ dmxSync(dmxScreen, TRUE); while (dmxBackendPendingMotionEvent(priv, FALSE)); if (dmxInput->console && offscreen) { /* Our special case is a console window and a backend window * share a display. In this case, the cursor is either on * the backend window (taking absolute input), or not (in * which case the cursor needs to be in the console * window). */ if (priv->grabbedScreen) { DMXDBG2(" *** force ungrab on %s, display=%p\n", priv->grabbedScreen->name, priv->grabbedScreen->beDisplay); XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); dmxSync(priv->grabbedScreen, TRUE); priv->grabbedScreen = NULL; } DMXDBG0(" Capturing console\n"); dmxConsoleCapture(dmxInput); } else { priv->newscreen = 1; if (priv->relative && !dmxInput->console) { DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n", priv->lastX, priv->lastY, priv->centerX, priv->centerY, priv->myScreen); dmxConsoleUncapture(dmxInput); dmxHideCursor(dmxScreen); priv->lastX = priv->centerX; priv->lastY = priv->centerY; XWarpPointer(priv->display, None, priv->window, 0, 0, 0, 0, priv->lastX, priv->lastY); dmxSync(dmxScreen, TRUE); } else { DMXDBG0(" Check cursor\n"); dmxCheckCursor(); } } } } /** Get events from the X queue on the backend servers and put the * events into the DMX event queue. */ void dmxBackendCollectEvents(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; XEvent X; DMXScreenInfo *dmxScreen; int left = 0; int entered = priv->entered; int ignoreLeave = 0; int v[2]; int retcode; while ((dmxScreen = dmxBackendGetEvent(priv, &X))) { switch (X.type) { case EnterNotify: dmxCommonSaveState(priv); if (entered++) continue; priv->entered = 1; ignoreLeave = 1; DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n", X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, dmxScreen->name, dmxScreen->beDisplay); XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); priv->grabbedScreen = dmxScreen; if ((retcode = XGrabPointer(dmxScreen->beDisplay, dmxScreen->scrnWin, True, 0, GrabModeAsync, GrabModeAsync, None, None, CurrentTime))) { dmxLog(dmxError, "XGrabPointer failed during backend enter (%d)\n", retcode); } break; case LeaveNotify: if (ignoreLeave) { ignoreLeave = 0; continue; } dmxCommonRestoreState(priv); if (left++) continue; DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n", X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, X.xcrossing.detail, X.xcrossing.focus, priv->grabbedScreen ? "UNGRAB" : "", dmxScreen->name); if (priv->grabbedScreen) { XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); dmxSync(priv->grabbedScreen, TRUE); priv->grabbedScreen = NULL; } break; case MotionNotify: DMXDBG8("dmxBackendCollectEvents: MotionNotify %d/%d" " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", dmxScreen->index, priv->myScreen, priv->newscreen, X.xmotion.x, X.xmotion.y, entered, priv->lastX, priv->lastY); if (dmxBackendPendingMotionEvent(priv, TRUE)) continue; if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window))) dmxLog(dmxFatal, " Event on non-existant window %lu\n", X.xmotion.window); if (!priv->relative || dmxInput->console) { int newX = X.xmotion.x - dmxScreen->rootX; int newY = X.xmotion.y - dmxScreen->rootY; if (!priv->newscreen) { int width = dmxScreen->rootWidth; int height = dmxScreen->rootHeight; if (!newX) newX = -1; if (newX == width - 1) newX = width; if (!newY) newY = -1; if (newY == height - 1) newY = height; } priv->newscreen = 0; v[0] = dmxScreen->rootXOrigin + newX; v[1] = dmxScreen->rootYOrigin + newY; DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n", v[0], v[1], priv->be->rootWidth, priv->be->rootHeight, priv->be->rootX, priv->be->rootY, priv->be->scrnWidth, priv->be->scrnHeight); motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block); priv->entered = 0; } else { int newX = priv->lastX - X.xmotion.x; int newY = priv->lastY - X.xmotion.y; priv->lastX = X.xmotion.x; priv->lastY = X.xmotion.y; v[0] = newX; v[1] = newY; DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]); motion(priv->mou, v, 0, 2, DMX_RELATIVE, block); } if (entered && priv->relative) { DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n", v[0], v[1], (dmxScreen->rootXOrigin + X.xmotion.x - dmxScreen->rootX), (dmxScreen->rootYOrigin + X.xmotion.y - dmxScreen->rootY)); } break; case KeyPress: case KeyRelease: enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); break; case ButtonPress: case ButtonRelease: /* fall-through */ default: /* Pass the whole event here, because * this may be an extension event. */ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); break; } } } /** Called after input events are processed from the DMX queue. No * event processing actually takes place here, but this is a convenient * place to update the pointer. */ void dmxBackendProcessInput(void *private) { GETPRIVFROMPRIVATE; DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d" " last=%d,%d center=%d,%d\n", priv->myScreen, priv->relative, priv->lastX, priv->lastY, priv->centerX, priv->centerY); if (priv->relative && !dmxInput->console && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) { DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n", priv->lastX, priv->lastY, priv->centerX, priv->centerY); priv->lastX = priv->centerX; priv->lastY = priv->centerY; XWarpPointer(priv->display, None, priv->window, 0, 0, 0, 0, priv->lastX, priv->lastY); dmxSync(&dmxScreens[priv->myScreen], TRUE); } } static void dmxBackendComputeCenter(myPrivate * priv) { int centerX; int centerY; centerX = priv->be->rootWidth / 2 + priv->be->rootX; centerY = priv->be->rootHeight / 2 + priv->be->rootY; if (centerX > priv->be->rootWidth) centerX = priv->be->rootWidth - 1; if (centerY > priv->be->rootHeight) centerY = priv->be->rootHeight - 1; if (centerX < 1) centerX = 1; if (centerY < 1) centerY = 1; priv->centerX = centerX; priv->centerY = centerY; } static DMXScreenInfo * dmxBackendInitPrivate(DevicePtr pDev) { GETPRIVFROMPDEV; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; DMXScreenInfo *dmxScreen; int i; /* Fill in myPrivate */ for (i = 0, dmxScreen = &dmxScreens[0]; i < dmxNumScreens; i++, dmxScreen++) { if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) { priv->display = dmxScreen->beDisplay; priv->window = dmxScreen->scrnWin; priv->be = dmxScreen; break; } } if (i >= dmxNumScreens) dmxLog(dmxFatal, "%s is not an existing backend display - cannot initialize\n", dmxInput->name); return dmxScreen; } /** Re-initialized the backend device described by \a pDev (after a * reconfig). */ void dmxBackendLateReInit(DevicePtr pDev) { GETPRIVFROMPDEV; int x, y; dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ dmxBackendInitPrivate(pDev); dmxBackendComputeCenter(priv); dmxGetGlobalPosition(&x, &y); dmxInvalidateGlobalPosition(); /* To force event processing */ dmxBackendUpdatePosition(priv, x, y); } /** Initialized the backend device described by \a pDev. */ void dmxBackendInit(DevicePtr pDev) { GETPRIVFROMPDEV; DMXScreenInfo *dmxScreen; dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev; if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev; if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */ dmxScreen = dmxBackendInitPrivate(pDev); /* Finish initialization using computed values or constants. */ dmxBackendComputeCenter(priv); priv->eventMask = (EnterWindowMask | LeaveWindowMask); priv->myScreen = dmxScreen->index; priv->lastX = priv->centerX; priv->lastY = priv->centerY; priv->relative = 0; priv->newscreen = 0; } /** Get information about the backend pointer (for initialization). */ void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev); info->buttonClass = 1; dmxCommonMouGetMap(pDev, info->map, &info->numButtons); info->valuatorClass = 1; info->numRelAxes = 2; info->minval[0] = 0; info->minval[1] = 0; info->maxval[0] = dmxScreen->beWidth; info->maxval[1] = dmxScreen->beHeight; info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; info->ptrFeedbackClass = 1; } /** Get information about the backend keyboard (for initialization). */ void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { dmxCommonKbdGetInfo(pDev, info); info->keyboard = 1; info->keyClass = 1; dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); info->freemap = 1; info->focusClass = 1; info->kbdFeedbackClass = 1; } /** Process #DMXFunctionType functions. The only function handled here * is to acknowledge a pending server shutdown. */ int dmxBackendFunctions(void *private, DMXFunctionType function) { switch (function) { case DMX_FUNCTION_TERMINATE: return 1; default: return 0; } } xorg-server-1.20.8/hw/dmx/input/dmxdummy.c0000644000175000017500000000535013640201473015366 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Provide mouse and keyboard that are sufficient for starting the X * server, but that don't actually provide any events. This is useful * for testing. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmx.h" #include "dmxinputinit.h" #include "dmxdummy.h" /** Return information about the dummy keyboard device specified in \a pDev * into the structure pointed to by \a info. The keyboard is set up to * have 1 valid key code that is \a NoSymbol */ void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { static KeySym keyboard_mapping = NoSymbol; info->keyboard = 1; info->keyClass = 1; info->keySyms.minKeyCode = 8; info->keySyms.maxKeyCode = 8; info->keySyms.mapWidth = 1; info->keySyms.map = &keyboard_mapping; info->freemap = 0; info->focusClass = 1; info->kbdFeedbackClass = 1; info->force = 1; } /** Return information about the dummy mouse device specified in \a pDev * into the structure pointed to by \a info. They mouse has 3 buttons * and two axes. */ void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { info->buttonClass = 1; info->numButtons = 3; info->map[0] = 1; info->map[1] = 2; info->map[2] = 3; info->valuatorClass = 1; info->numRelAxes = 2; info->minval[0] = 0; info->minval[1] = 0; info->maxval[0] = 0; info->maxval[1] = 0; info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; info->ptrFeedbackClass = 1; } xorg-server-1.20.8/hw/dmx/input/dmxmotion.h0000644000175000017500000000356313640201473015551 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to functions supporting motion events. \see dmxmotion.c */ #ifndef _DMXMOTION_H_ #define _DMXMOTION_H_ extern int dmxPointerGetMotionBufferSize(void); extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice, xTimecoord * coords, unsigned long start, unsigned long stop, ScreenPtr pScreen); extern void dmxPointerPutMotionEvent(DeviceIntPtr pDevice, int firstAxis, int axesCount, int *v, unsigned long time); #endif xorg-server-1.20.8/hw/dmx/input/dmxxinput.c0000644000175000017500000000422613640201473015563 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * * This file implements support required by the XINPUT extension. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include #include #include "inputstr.h" #include #include #include "XIstubs.h" #include "mipointer.h" #include "dmxinputinit.h" #include "exevents.h" /** Set device mode to \a mode. This is not implemented. */ int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) { return BadMatch; } /** Set device valuators. This is not implemented. */ int SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { return BadMatch; } /** Change device control. This is not implemented. */ int ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { return BadMatch; } xorg-server-1.20.8/hw/dmx/input/Makefile.am0000644000175000017500000000235013640201473015407 00000000000000noinst_LIBRARIES = libdmxinput.a if DMX_BUILD_USB USBSRCS = usb-keyboard.c \ usb-keyboard.h \ usb-mouse.c \ usb-mouse.h \ usb-other.c \ usb-other.h \ usb-common.c \ usb-common.h \ usb-private.h endif DRVSRCS = dmxdummy.c \ dmxdummy.h \ dmxbackend.c \ dmxbackend.h \ dmxconsole.c \ dmxconsole.h \ dmxcommon.c \ dmxcommon.h DMXSRCS = dmxinputinit.c \ dmxinputinit.h \ dmxarg.c \ dmxarg.h \ dmxevents.c \ dmxevents.h \ dmxxinput.c \ dmxmotion.c \ dmxmotion.h \ dmxmap.c \ dmxmap.h libdmxinput_a_SOURCES = ChkNotMaskEv.c \ ChkNotMaskEv.h \ atKeynames.h \ $(RAWSRCS) \ $(USBSRCS) \ $(DRVSRCS) \ $(DMXSRCS) \ $(LIBSRCS) if GLX GLX_DEFS = @GL_CFLAGS@ endif AM_CFLAGS = $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -DHAVE_DMX_CONFIG_H \ $(GLX_DEFS) \ @DMXMODULES_CFLAGS@ EXTRA_DIST = dmxdetach.c xorg-server-1.20.8/hw/dmx/input/dmxevents.h0000644000175000017500000000337413640201473015550 00000000000000/* * Copyright 2001 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to event processing functions. \see dmxevents.h */ #ifndef _DMXEVENTS_H_ #define _DMXEVENTS_H_ extern void dmxMotion(DevicePtr pDev, int *v, int firstAxis, int axesCount, DMXMotionType type, DMXBlockType block); extern void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, XEvent * e, DMXBlockType block); extern int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym); extern void dmxInvalidateGlobalPosition(void); #endif xorg-server-1.20.8/hw/dmx/input/usb-other.c0000644000175000017500000001275313640201473015437 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * * This code implements a low-level device driver for a non-keyboard, * non-mouse USB device (e.g., a joystick or gamepad). */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "usb-private.h" /*****************************************************************************/ /* Define some macros to make it easier to move this file to another * part of the Xserver tree. All calls to the dmx* layer are #defined * here for the .c file. The .h file will also have to be edited. */ #include "dmxinputinit.h" #include "usb-other.h" #define GETPRIV myPrivate *priv \ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private #define LOG0(f) dmxLog(dmxDebug,f) #define LOG1(f,a) dmxLog(dmxDebug,f,a) #define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define FATAL0(f) dmxLog(dmxFatal,f) #define FATAL1(f,a) dmxLog(dmxFatal,f,a) #define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) #define MOTIONPROC dmxMotionProcPtr #define ENQUEUEPROC dmxEnqueueProcPtr #define CHECKPROC dmxCheckSpecialProcPtr #define BLOCK DMXBlockType /* End of interface definitions. */ /*****************************************************************************/ /** Read the USB device using #usbRead. */ void othUSBRead(DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) { usbRead(pDev, motion, enqueue, 0xffff, block); } /** Initialize \a pDev using #usbInit. */ void othUSBInit(DevicePtr pDev) { usbInit(pDev, usbOther); } /** Turn \a pDev on (i.e., take input from \a pDev). */ int othUSBOn(DevicePtr pDev) { GETPRIV; if (priv->fd < 0) othUSBInit(pDev); return priv->fd; } /** Fill the \a info structure with information needed to initialize \a * pDev. */ void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { GETPRIV; int i, j; static KeySym keyboard_mapping = NoSymbol; int absolute[5]; #define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8))) /* Some USB mice devices return key * events from their pair'd * keyboard... */ info->keyClass = 1; info->keySyms.minKeyCode = 8; info->keySyms.maxKeyCode = 8; info->keySyms.mapWidth = 1; info->keySyms.map = &keyboard_mapping; for (i = 0; i < EV_MAX; i++) { if (test_bit(i)) { switch (i) { case EV_KEY: /* See above */ break; case EV_REL: info->valuatorClass = 1; if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) { info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1; dmxLog(dmxWarning, "Can only use %d relative axes\n", info->numRelAxes); } else info->numRelAxes = priv->numRel; info->minval[0] = 0; info->maxval[0] = 0; info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; break; case EV_ABS: info->valuatorClass = 1; if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) { info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1; dmxLog(dmxWarning, "Can only use %d absolute axes\n", info->numAbsAxes); } else info->numAbsAxes = priv->numAbs; for (j = 0; j < info->numAbsAxes; j++) { ioctl(priv->fd, EVIOCGABS(j), absolute); info->minval[1 + j] = absolute[1]; info->maxval[1 + j] = absolute[2]; info->res[1 + j] = absolute[3]; info->minres[1 + j] = absolute[3]; info->maxres[1 + j] = absolute[3]; } break; case EV_LED: info->ledFeedbackClass = 0; /* Not supported at this time */ break; case EV_SND: info->belFeedbackClass = 0; /* Not supported at this time */ break; } } } } xorg-server-1.20.8/hw/dmx/input/dmxmap.h0000644000175000017500000000315113640201473015012 00000000000000/* * Copyright 2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith */ /** \file * Interface to XInput event mapping support. \see dmxmap.c */ #ifndef _DMXMAP_H_ #define _DMXMAP_H_ extern void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, int remoteEvent, int serverEvent); extern void dmxMapClear(DMXLocalInputInfoPtr dmxLocal); extern int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent); #endif xorg-server-1.20.8/hw/dmx/input/dmxdummy.h0000644000175000017500000000302113640201473015364 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to dummy input device support. \see dmxdummy.c */ #ifndef _DMXDUMMY_H_ #define _DMXDUMMY_H_ extern void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); #endif xorg-server-1.20.8/hw/dmx/input/dmxmotion.c0000644000175000017500000001243213640201473015537 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * This file provides functions similar to miPointerGetMotionEvents and * miPointerPutMotionEvents, with the exception that devices with more * than two axes are fully supported. These routines may be used only * for motion buffers for extension devices, and are \a not compatible * replacements for the mi routines. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "inputstr.h" #include "dmxinputinit.h" #include "dmxcommon.h" #include "dmxmotion.h" #define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element)) /** Return size of motion buffer. \see DMX_MOTION_SIZE */ int dmxPointerGetMotionBufferSize(void) { return DMX_MOTION_SIZE; } /** This routine performs the same function as \a miPointerGetMotionEvents: * the events in the motion history that are between the start and stop * times (in mS) are placed in the coords vector, and the count of the * number of items so placed is returned. This routine is called from * dix/devices.c so that coords can hold valuator->numMotionEvents * events. This routine is called from \a Xi/gtmotion.c with coords large * enough to hold the same number of events in a variable-length * extended \a xTimecoord structure. This provides sufficient data for the * \a XGetDeviceMotionEvents library call, and would be identical to * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core * pointers) if \a xTimecoord used 32bit integers. * * Because DMX uses the mi* routines for all core devices, this routine * only has to support extension devices using the polymorphic coords. * Because compatibility with miPointerGetMotionEvents is not possible, * it is not provided. */ int dmxPointerGetMotionEvents(DeviceIntPtr pDevice, xTimecoord * coords, unsigned long start, unsigned long stop, ScreenPtr pScreen) { GETDMXLOCALFROMPDEVICE; int numAxes = pDevice->valuator->numAxes; unsigned long *c = (unsigned long *) coords; int count = 0; int i, j; if (!dmxLocal->history) return 0; for (i = dmxLocal->head; i != dmxLocal->tail;) { if (dmxLocal->history[OFFSET(i, 0)] >= stop) break; if (dmxLocal->history[OFFSET(i, 0)] >= start) { for (j = 0; j < numAxes + 1; j++) c[OFFSET(count, j)] = dmxLocal->history[OFFSET(i, j)]; ++count; } if (++i >= DMX_MOTION_SIZE) i = 0; } return count; } /** This routine adds an event to the motion history. A similar * function is performed by miPointerMove for the mi versions of these * routines. */ void dmxPointerPutMotionEvent(DeviceIntPtr pDevice, int firstAxis, int axesCount, int *v, unsigned long time) { GETDMXLOCALFROMPDEVICE; int numAxes = pDevice->valuator->numAxes; int i; if (!dmxLocal->history) { dmxLocal->history = xallocarray(numAxes + 1, sizeof(*dmxLocal->history) * DMX_MOTION_SIZE); dmxLocal->head = 0; dmxLocal->tail = 0; dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes); } else { if (++dmxLocal->tail >= DMX_MOTION_SIZE) dmxLocal->tail = 0; if (dmxLocal->head == dmxLocal->tail) if (++dmxLocal->head >= DMX_MOTION_SIZE) dmxLocal->head = 0; } dmxLocal->history[OFFSET(dmxLocal->tail, 0)] = time; /* Initialize the data from the known * values (if Absolute) or to zero (if * Relative) */ for (i = 0; i < numAxes; i++) { if (pDevice->valuator->axes[i].mode == Absolute) dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] = dmxLocal->valuators[i]; else dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] = 0; } for (i = firstAxis; i < axesCount; i++) { dmxLocal->history[OFFSET(dmxLocal->tail, i + i)] = (unsigned long) v[i - firstAxis]; dmxLocal->valuators[i] = v[i - firstAxis]; } } xorg-server-1.20.8/hw/dmx/input/usb-common.c0000644000175000017500000004357113640201473015610 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * * Routines that are common between \a usb-keyboard.c, \a usb-mouse.c, and * \a usb-other.c */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "usb-private.h" #define USB_COMMON_DEBUG 1 /*****************************************************************************/ /* Define some macros to make it easier to move this file to another * part of the Xserver tree. All calls to the dmx* layer are #defined * here for the .c file. The .h file will also have to be edited. */ #include "usb-mouse.h" #define GETPRIV myPrivate *priv \ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private #define GETNAME ((DMXLocalInputInfoPtr)(pDevice->public.devicePrivate)) \ ->name #define LOG0(f) dmxLog(dmxDebug,f) #define LOG1(f,a) dmxLog(dmxDebug,f,a) #define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define LOG1INPUT(p,f,a) dmxLogInput(p->dmxInput,f,a) #define LOG3INPUT(p,f,a,b,c) dmxLogInput(p->dmxInput,f,a,b,c) #define LOG5INPUT(p,f,a,b,c,d,e) dmxLogInput(p->dmxInput,f,a,b,c,d,e) #define FATAL0(f) dmxLog(dmxFatal,f) #define FATAL1(f,a) dmxLog(dmxFatal,f,a) #define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) #define MOTIONPROC dmxMotionProcPtr #define ENQUEUEPROC dmxEnqueueProcPtr #define CHECKPROC dmxCheckSpecialProcPtr #define BLOCK DMXBlockType /* End of interface definitions. */ /*****************************************************************************/ /** Read an event from the \a pDev device. If the event is a motion * event, enqueue it with the \a motion function. Otherwise, enqueue * the event with the \a enqueue function. The \a block type is passed * to the functions so that they may block the input thread as appropriate * to the caller of this function. * * Since USB devices return EV_KEY events for buttons and keys, \a * minButton is used to decide if a Button or Key event should be * queued.*/ void usbRead(DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, int minButton, BLOCK block) { GETPRIV; struct input_event raw; int v[DMX_MAX_AXES]; int axis; #define PRESS(b) \ do { \ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \ } while (0) #define RELEASE(b) \ do { \ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \ } while (0) while (read(priv->fd, &raw, sizeof(raw)) > 0) { #if USB_COMMON_DEBUG > 1 LOG3("USB: type = %d, code = 0x%02x, value = %d\n", raw.type, raw.code, raw.value); #endif switch (raw.type) { case EV_KEY: /* raw.value = 1 for first, 2 for repeat */ if (raw.code > minButton) { if (raw.value) PRESS((raw.code & 0x0f) + 1); else RELEASE((raw.code & 0x0f) + 1); } else { enqueue(pDev, raw.value ? KeyPress : KeyRelease, 0, 0, NULL, block); } break; case EV_REL: switch (raw.code) { case REL_X: v[0] = -raw.value; v[1] = 0; motion(pDev, v, 0, 2, DMX_RELATIVE, block); break; case REL_Y: v[0] = 0; v[1] = -raw.value; motion(pDev, v, 0, 2, DMX_RELATIVE, block); break; case REL_WHEEL: if ((int) raw.value > 0) { PRESS(4); RELEASE(4); } else if ((int) raw.value < 0) { PRESS(5); RELEASE(5); } break; default: memset(v, 0, sizeof(v)); axis = priv->relmap[raw.code]; v[axis] = raw.value; motion(pDev, v, axis, 1, DMX_RELATIVE, block); } break; case EV_ABS: memset(v, 0, sizeof(v)); axis = priv->absmap[raw.code]; v[axis] = raw.value; motion(pDev, v, axis, 1, DMX_ABSOLUTE, block); break; } } } #define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8))) #define test_bits(bit) (bits[(bit)/8] & (1 << ((bit)%8))) static void usbPrint(myPrivate * priv, const char *filename, const char *devname, int fd) { int j, k; DeviceIntPtr pDevice = priv->pDevice; unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that * KEY_MAX is greater than * REL_MAX, ABS_MAX, SND_MAX, and * LED_MAX. */ LOG3INPUT(priv, "%s (%s) using %s\n", pDevice->name, GETNAME, filename); LOG1INPUT(priv, " %s\n", devname); for (j = 0; j < EV_MAX; j++) { if (test_bit(j)) { const char *type = "unknown"; char extra[256]; /* FIXME: may cause buffer overflow */ extra[0] = '\0'; switch (j) { case EV_KEY: type = "keys/buttons"; break; case EV_REL: type = "relative"; memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits); for (k = 0; k < REL_MAX; k++) { if (test_bits(k)) switch (k) { case REL_X: strcat(extra, " X"); break; case REL_Y: strcat(extra, " Y"); break; case REL_Z: strcat(extra, " Z"); break; case REL_HWHEEL: strcat(extra, " HWheel"); break; case REL_DIAL: strcat(extra, " Dial"); break; case REL_WHEEL: strcat(extra, " Wheel"); break; case REL_MISC: strcat(extra, " Misc"); break; } } break; case EV_ABS: type = "absolute"; memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); for (k = 0; k < ABS_MAX; k++) { if (test_bits(k)) switch (k) { case ABS_X: strcat(extra, " X"); break; case ABS_Y: strcat(extra, " Y"); break; case ABS_Z: strcat(extra, " Z"); break; case ABS_RX: strcat(extra, " RX"); break; case ABS_RY: strcat(extra, " RY"); break; case ABS_RZ: strcat(extra, " RZ"); break; case ABS_THROTTLE: strcat(extra, " Throttle"); break; case ABS_RUDDER: strcat(extra, " Rudder"); break; case ABS_WHEEL: strcat(extra, " Wheel"); break; case ABS_GAS: strcat(extra, " Gas"); break; case ABS_BRAKE: strcat(extra, " Break"); break; case ABS_HAT0X: strcat(extra, " Hat0X"); break; case ABS_HAT0Y: strcat(extra, " Hat0Y"); break; case ABS_HAT1X: strcat(extra, " Hat1X"); break; case ABS_HAT1Y: strcat(extra, " Hat1Y"); break; case ABS_HAT2X: strcat(extra, " Hat2X"); break; case ABS_HAT2Y: strcat(extra, " Hat2Y"); break; case ABS_HAT3X: strcat(extra, " Hat3X"); break; case ABS_HAT3Y: strcat(extra, " Hat3Y"); break; case ABS_PRESSURE: strcat(extra, " Pressure"); break; case ABS_DISTANCE: strcat(extra, " Distance"); break; case ABS_TILT_X: strcat(extra, " TiltX"); break; case ABS_TILT_Y: strcat(extra, " TiltY"); break; case ABS_MISC: strcat(extra, " Misc"); break; } } break; case EV_MSC: type = "reserved"; break; case EV_LED: type = "leds"; memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits); for (k = 0; k < LED_MAX; k++) { if (test_bits(k)) switch (k) { case LED_NUML: strcat(extra, " NumLock"); break; case LED_CAPSL: strcat(extra, " CapsLock"); break; case LED_SCROLLL: strcat(extra, " ScrlLock"); break; case LED_COMPOSE: strcat(extra, " Compose"); break; case LED_KANA: strcat(extra, " Kana"); break; case LED_SLEEP: strcat(extra, " Sleep"); break; case LED_SUSPEND: strcat(extra, " Suspend"); break; case LED_MUTE: strcat(extra, " Mute"); break; case LED_MISC: strcat(extra, " Misc"); break; } } break; case EV_SND: type = "sound"; memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_SND, sizeof(bits)), bits); for (k = 0; k < SND_MAX; k++) { if (test_bits(k)) switch (k) { case SND_CLICK: strcat(extra, " Click"); break; case SND_BELL: strcat(extra, " Bell"); break; } } break; case EV_REP: type = "repeat"; break; case EV_FF: type = "feedback"; break; } LOG5INPUT(priv, " Feature 0x%02x = %s%s%s%s\n", j, type, extra[0] ? " [" : "", extra[0] ? extra + 1 : "", extra[0] ? "]" : ""); } } } /** Initialized \a pDev as a \a usbMouse, \a usbKeyboard, or \a usbOther device. */ void usbInit(DevicePtr pDev, usbType type) { GETPRIV; char name[64]; /* RATS: Only used in snprintf */ int i, j, k; char buf[256] = { 0, }; /* RATS: Use ok */ int version; unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that * KEY_MAX is greater than * REL_MAX, ABS_MAX, SND_MAX, and * LED_MAX. */ if (priv->fd >= 0) return; for (i = 0; i < 32; i++) { snprintf(name, sizeof(name), "/dev/input/event%d", i); if ((priv->fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) { ioctl(priv->fd, EVIOCGVERSION, &version); ioctl(priv->fd, EVIOCGNAME(sizeof(buf)), buf); memset(priv->mask, 0, sizeof(priv->mask)); ioctl(priv->fd, EVIOCGBIT(0, sizeof(priv->mask)), priv->mask); for (j = 0; j < EV_MAX; j++) { if (test_bit(j)) { switch (j) { case EV_REL: memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits); for (k = 0; k < REL_MAX; k++) { if (test_bits(k)) { if (k == REL_X) priv->relmap[k] = 0; else if (k == REL_Y) priv->relmap[k] = 1; else priv->relmap[k] = 2 + priv->numAbs; ++priv->numRel; } } break; case EV_ABS: memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); for (k = 0; k < ABS_MAX; k++) { if (test_bits(k)) { priv->absmap[k] = priv->numAbs; ++priv->numAbs; } } break; case EV_LED: memset(bits, 0, sizeof(bits)); ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits); for (k = 0; k < LED_MAX; k++) { if (test_bits(k)) ++priv->numLeds; } break; } } } switch (type) { case usbMouse: if (test_bit(EV_REL) && test_bit(EV_KEY)) goto found; break; case usbKeyboard: if (test_bit(EV_KEY) && test_bit(EV_LED) && !test_bit(EV_ABS)) goto found; break; case usbOther: if (!(test_bit(EV_REL) && test_bit(EV_KEY)) && !(test_bit(EV_KEY) && test_bit(EV_LED) && !test_bit(EV_ABS))) goto found; break; } close(priv->fd); priv->fd = -1; } } if (priv->fd < 0) FATAL1("usbInit: Cannot open /dev/input/event* port (%s)\n" " If you have not done so, you may need to:\n" " rmmod mousedev; rmmod keybdev\n" " modprobe evdev\n", strerror(errno)); found: usbPrint(priv, name, buf, priv->fd); } /** Turn \a pDev off (i.e., stop taking input from \a pDev). */ void usbOff(DevicePtr pDev) { GETPRIV; if (priv->fd >= 0) close(priv->fd); priv->fd = -1; } /** Create a private structure for use within this file. */ void * usbCreatePrivate(DeviceIntPtr pDevice) { myPrivate *priv = calloc(1, sizeof(*priv)); priv->fd = -1; priv->pDevice = pDevice; return priv; } /** Destroy a private structure. */ void usbDestroyPrivate(void *priv) { free(priv); } xorg-server-1.20.8/hw/dmx/input/usb-mouse.h0000644000175000017500000000344613640201473015452 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to USB mouse driver. \see usb-mouse.c \see usb-common.c */ #ifndef _USB_MOU_H_ #define _USB_MOU_H_ extern void mouUSBRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); extern void mouUSBInit(DevicePtr pDev); extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern int mouUSBOn(DevicePtr pDev); extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl); #endif xorg-server-1.20.8/hw/dmx/input/dmxconsole.c0000644000175000017500000011153413640201473015677 00000000000000/* * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * David H. Dawes * Kevin E. Martin * Rickard E. (Rik) Faith * */ /** \file * * This file implements the console input devices. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #define DMX_CONSOLE_DEBUG 0 #define DMX_WINDOW_DEBUG 0 #include "dmxinputinit.h" #include "dmxevents.h" #include "dmxconsole.h" #include "dmxcommon.h" #include "dmxscrinit.h" #include "dmxcb.h" #include "dmxsync.h" #include "inputstr.h" #include "input.h" #include "mipointer.h" #include "windowstr.h" #define CONSOLE_NUM 3 #define CONSOLE_DEN 4 #define DMX_CONSOLE_NAME "DMX Console" #define DMX_RES_NAME "Xdmx" #define DMX_RES_CLASS "XDmx" #define CONSOLE_BG_COLOR "gray75" #define CONSOLE_FG_COLOR "black" #define CONSOLE_SCREEN_BG_COLOR "white" #define CONSOLE_SCREEN_FG_COLOR "black" #define CONSOLE_SCREEN_DET_COLOR "gray75" #define CONSOLE_SCREEN_CUR_COLOR "red" #if DMX_CONSOLE_DEBUG #define DMXDBG0(f) dmxLog(dmxDebug,f) #define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) #define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) #define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) #define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) #define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) #else #define DMXDBG0(f) #define DMXDBG1(f,a) #define DMXDBG2(f,a,b) #define DMXDBG3(f,a,b,c) #define DMXDBG4(f,a,b,c,d) #define DMXDBG5(f,a,b,c,d,e) #define DMXDBG6(f,a,b,c,d,e,g) #define DMXDBG7(f,a,b,c,d,e,g,h) #endif /* Private area for consoles. */ typedef struct _myPrivate { DMX_COMMON_PRIVATE; int lastX; int lastY; int globalX; int globalY; int curX; int curY; int width; int height; int consWidth; int consHeight; double xScale; double yScale; XlibGC gc, gcDet, gcRev, gcCur; int grabbed, fine, captured; Cursor cursorNormal, cursorGrabbed, cursorEmpty; Pixmap pixmap; CloseScreenProcPtr CloseScreen; struct _myPrivate *next; /* for closing multiple consoles */ int initialized; DevicePtr mou, kbd; } myPrivate; static int scalex(myPrivate * priv, int x) { return (int) ((x * priv->xScale) + .5); } static int scaley(myPrivate * priv, int y) { return (int) ((y * priv->yScale) + .5); } static int unscalex(myPrivate * priv, int x) { return (int) ((x / priv->xScale) + .5); } static int unscaley(myPrivate * priv, int y) { return (int) ((y / priv->yScale) + .5); } /** Create the private area for \a pDevice. */ void * dmxConsoleCreatePrivate(DeviceIntPtr pDevice) { GETDMXLOCALFROMPDEVICE; myPrivate *priv = calloc(1, sizeof(*priv)); priv->dmxLocal = dmxLocal; return priv; } /** If \a private is non-NULL, free its associated memory. */ void dmxConsoleDestroyPrivate(void *private) { free(private); } static void dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect) { int size = 6; int x, y; XDrawLine(priv->display, priv->pixmap, priv->gcCur, x = scalex(priv, priv->globalX) - size, scaley(priv, priv->globalY), scalex(priv, priv->globalX) + size, scaley(priv, priv->globalY)); XDrawLine(priv->display, priv->pixmap, priv->gcCur, scalex(priv, priv->globalX), y = scaley(priv, priv->globalY) - size, scalex(priv, priv->globalX), scaley(priv, priv->globalY) + size); if (priv->grabbed) { XDrawLine(priv->display, priv->pixmap, priv->gcCur, scalex(priv, priv->globalX) - (int) (size / 1.4), scaley(priv, priv->globalY) - (int) (size / 1.4), scalex(priv, priv->globalX) + (int) (size / 1.4), scaley(priv, priv->globalY) + (int) (size / 1.4)); XDrawLine(priv->display, priv->pixmap, priv->gcCur, scalex(priv, priv->globalX) - (int) (size / 1.4), scaley(priv, priv->globalY) + (int) (size / 1.4), scalex(priv, priv->globalX) + (int) (size / 1.4), scaley(priv, priv->globalY) - (int) (size / 1.4)); } if (rect) { rect->x = x; rect->y = y; rect->width = 2 * size; rect->height = 2 * size; } } static void dmxConsoleDrawWindows(void *private) { GETONLYPRIVFROMPRIVATE; Display *dpy = priv->display; int i; Region whole, used, avail; XRectangle rect; whole = XCreateRegion(); used = XCreateRegion(); avail = XCreateRegion(); rect.x = 0; rect.y = 0; rect.width = priv->consWidth; rect.height = priv->consHeight; XUnionRectWithRegion(&rect, whole, whole); for (i = 0; i < dmxNumScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; WindowPtr pRoot = pScreen->root; WindowPtr pChild; #if DMX_WINDOW_DEBUG dmxLog(dmxDebug, "%lu %p %p %p 2\n", pRoot->drawable.id, pRoot->parent, pRoot->firstChild, pRoot->lastChild); #endif for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->mapped && pChild->realized) { #if DMX_WINDOW_DEBUG dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n", pChild, pChild->drawable.x, pChild->drawable.y, pChild->drawable.width, pChild->drawable.height, pChild->visibility, pChild->overrideRedirect, RegionNumRects(&pChild->clipList)); #endif rect.x = scalex(priv, pChild->drawable.x + pScreen->x); rect.y = scaley(priv, pChild->drawable.y + pScreen->y); rect.width = scalex(priv, pChild->drawable.width); rect.height = scaley(priv, pChild->drawable.height); XDrawRectangle(dpy, priv->pixmap, priv->gc, rect.x, rect.y, rect.width, rect.height); XUnionRectWithRegion(&rect, used, used); XSubtractRegion(whole, used, avail); XSetRegion(dpy, priv->gc, avail); } } #ifdef PANORAMIX if (!noPanoramiXExtension) break; /* Screen 0 valid with Xinerama */ #endif } XDestroyRegion(avail); XDestroyRegion(used); XDestroyRegion(whole); XSetClipMask(dpy, priv->gc, None); } static void dmxConsoleDraw(myPrivate * priv, int updateCursor, int update) { GETDMXINPUTFROMPRIV; Display *dpy = priv->display; int i; XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0, priv->consWidth, priv->consHeight); for (i = 0; i < dmxNumScreens; i++) { DMXScreenInfo *dmxScreen = &dmxScreens[i]; XFillRectangle(dpy, priv->pixmap, dmxScreen->beDisplay ? priv->gcRev : priv->gcDet, scalex(priv, screenInfo.screens[i]->x), scaley(priv, screenInfo.screens[i]->y), scalex(priv, screenInfo.screens[i]->width), scaley(priv, screenInfo.screens[i]->height)); } for (i = 0; i < dmxNumScreens; i++) { XDrawRectangle(dpy, priv->pixmap, priv->gc, scalex(priv, screenInfo.screens[i]->x), scaley(priv, screenInfo.screens[i]->y), scalex(priv, screenInfo.screens[i]->width), scaley(priv, screenInfo.screens[i]->height)); } if (dmxInput->windows) dmxConsoleDrawWindows(priv); if (priv->fine && updateCursor) dmxConsoleDrawFineCursor(priv, 0); if (update) { XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc, 0, 0, priv->consWidth, priv->consHeight, 0, 0); XSync(priv->display, False); /* Not a backend display */ } } static void dmxConsoleClearCursor(myPrivate * priv, int x, int y, XRectangle * rect) { int cw = 14, ch = 14; /* Clear width and height */ rect->x = scalex(priv, x) - cw / 2; rect->y = scaley(priv, y) - ch / 2; rect->width = cw; rect->height = ch; XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted); XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted); XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted); dmxConsoleDraw(priv, 0, 0); XSetClipMask(priv->display, priv->gc, None); XSetClipMask(priv->display, priv->gcDet, None); XSetClipMask(priv->display, priv->gcRev, None); } static void dmxConsoleUpdateFineCursor(myPrivate * priv) { int leave = 0; XRectangle rects[2]; dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]); if (priv->dmxLocal->sendsCore) { dmxGetGlobalPosition(&priv->globalX, &priv->globalY); } else { priv->globalX = priv->dmxLocal->lastX; priv->globalY = priv->dmxLocal->lastY; } priv->lastX = scalex(priv, priv->width / 2); priv->lastY = scaley(priv, priv->height / 2); /* Compute new warp position, which may be outside the window */ if (priv->globalX < 1 || priv->globalX >= priv->width) { if (priv->globalX < 1) priv->lastX = 0; else priv->lastX = scalex(priv, priv->width); priv->lastY = scaley(priv, priv->globalY); ++leave; } if (priv->globalY < 1 || priv->globalY >= priv->height) { if (priv->globalY < 1) priv->lastY = 0; else priv->lastY = scaley(priv, priv->height); priv->lastX = scalex(priv, priv->globalX); ++leave; } /* Draw pseudo cursor in window */ dmxConsoleDrawFineCursor(priv, &rects[1]); XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted); XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc, 0, 0, priv->consWidth, priv->consHeight, 0, 0); XSetClipMask(priv->display, priv->gc, None); DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n", priv->lastX, priv->lastY); XWarpPointer(priv->display, priv->window, priv->window, 0, 0, 0, 0, priv->lastX, priv->lastY); XSync(priv->display, False); /* Not a backend display */ if (leave) { XEvent X; while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) { if (X.type == MotionNotify) { if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) { DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n", X.xmotion.x, X.xmotion.y, priv->lastX, priv->lastY); } } else { dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n", X.type, dmxEventName(X.type)); } } } DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n", priv->lastX, priv->lastY, scalex(priv, priv->width), scaley(priv, priv->height), priv->globalX, priv->globalY); } /** Whenever the window layout (size, position, stacking order) might be * changed, this routine is called with the \a pWindow that changed and * the \a type of change. This routine is called in a conservative * fashion: the actual layout of the windows of the screen might not * have had any human-visible changes. */ void dmxConsoleUpdateInfo(void *private, DMXUpdateType type, WindowPtr pWindow) { GETONLYPRIVFROMPRIVATE; dmxConsoleDraw(priv, 1, 1); } static void dmxConsoleMoveAbsolute(myPrivate * priv, int x, int y, DevicePtr pDev, dmxMotionProcPtr motion, DMXBlockType block) { int tmpX, tmpY, v[2]; tmpX = unscalex(priv, x); tmpY = unscalex(priv, y); DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n", x, y, tmpX, tmpY, priv->curX, priv->curY); if (tmpX == priv->curX && tmpY == priv->curY) return; v[0] = unscalex(priv, x); v[1] = unscaley(priv, y); motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block); /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */ } static void dmxConsoleMoveRelative(myPrivate * priv, int x, int y, DevicePtr pDev, dmxMotionProcPtr motion, DMXBlockType block) { int v[2]; /* Ignore the event generated from * warping back to middle */ if (x == priv->lastX && y == priv->lastY) return; v[0] = priv->lastX - x; v[1] = priv->lastY - y; motion(pDev, v, 0, 2, DMX_RELATIVE, block); /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */ } /** This routine gets called from #dmxCoreMotion for each motion. This * allows the console's notion of the cursor postion to change when * another input device actually caused the change. */ void dmxConsoleUpdatePosition(void *private, int x, int y) { GETONLYPRIVFROMPRIVATE; int tmpX, tmpY; Display *dpy = priv->display; static unsigned long dmxGeneration = 0; tmpX = scalex(priv, x); tmpY = scaley(priv, y); DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n", x, y, tmpX, tmpY, priv->consWidth, priv->consHeight); if (priv->fine) dmxConsoleUpdateFineCursor(priv); if (tmpX != priv->curX || tmpY != priv->curY) { if (tmpX < 0) tmpX = 0; if (tmpY < 0) tmpY = 0; if (tmpX >= priv->consWidth) tmpX = priv->consWidth - 1; if (tmpY >= priv->consHeight) tmpY = priv->consHeight - 1; priv->curX = tmpX; priv->curY = tmpY; if (!priv->fine) { DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY); XWarpPointer(dpy, priv->window, priv->window, 0, 0, 0, 0, tmpX, tmpY); XSync(dpy, False); /* Not a backend display */ } } if (dmxGeneration != serverGeneration) { dmxGeneration = serverGeneration; dmxConsoleDraw(priv, 1, 1); } } /** Collect all pending events from the console's display. Plase these * events on the server event queue using the \a motion and \a enqueue * routines. The \a checkspecial routine is used to check for special * keys that need handling. \a block tells if signals should be blocked * when updating the event queue. */ void dmxConsoleCollectEvents(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; Display *dpy = priv->display; Window win = priv->window; int width = priv->width; int height = priv->height; XEvent X, N; XSetWindowAttributes attribs; static int rInitialized = 0; static Region r; XRectangle rect; static int raising = 0, raiseX, raiseY; /* FIXME */ while (XPending(dpy)) { XNextEvent(dpy, &X); switch (X.type) { case VisibilityNotify: break; case Expose: DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n", X.xexpose.count, X.xexpose.x, X.xexpose.y, X.xexpose.width, X.xexpose.height); if (!rInitialized++) r = XCreateRegion(); rect.x = X.xexpose.x; rect.y = X.xexpose.y; rect.width = X.xexpose.width; rect.height = X.xexpose.height; XUnionRectWithRegion(&rect, r, r); if (X.xexpose.count == 0) { XSetRegion(dpy, priv->gc, r); XSetRegion(dpy, priv->gcDet, r); XSetRegion(dpy, priv->gcRev, r); dmxConsoleDraw(priv, 1, 1); XSetClipMask(dpy, priv->gc, None); XSetClipMask(dpy, priv->gcDet, None); XSetClipMask(dpy, priv->gcRev, None); XDestroyRegion(r); rInitialized = 0; } break; case ResizeRequest: DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n", X.xresizerequest.width, X.xresizerequest.height); priv->consWidth = X.xresizerequest.width; priv->consHeight = X.xresizerequest.height; priv->xScale = (double) priv->consWidth / width; priv->yScale = (double) priv->consHeight / height; attribs.override_redirect = True; XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs); XResizeWindow(dpy, win, priv->consWidth, priv->consHeight); XFreePixmap(dpy, priv->pixmap); priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)), priv->consWidth, priv->consHeight, DefaultDepth(dpy, DefaultScreen(dpy))); dmxConsoleDraw(priv, 1, 1); attribs.override_redirect = False; XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs); break; case LeaveNotify: DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n", X.xcrossing.x, X.xcrossing.y, raising, priv->fine); if (!priv->captured) dmxCommonRestoreState(priv); else { dmxConsoleUncapture(dmxInput); dmxCommonRestoreState(priv); } break; case EnterNotify: DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n", X.xcrossing.x, X.xcrossing.y, raising, priv->fine, priv->curX, priv->curY); dmxCommonSaveState(priv); if (raising) { raising = 0; dmxConsoleMoveAbsolute(priv, raiseX, raiseY, priv->mou, motion, block); } else { if (priv->fine) { /* The raise will generate an event near the center, * which is not where the cursor should be. So we * save the real position, do the raise, and move * the cursor here again after the raise generates * the event. */ raising = 1; raiseX = X.xcrossing.x; raiseY = X.xcrossing.y; XRaiseWindow(dpy, priv->window); } XSync(dpy, False); /* Not a backend display */ if (!X.xcrossing.x && !X.xcrossing.y) dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY, priv->mou, motion, block); } break; case MotionNotify: if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y) continue; if (XPending(dpy)) { /* do motion compression */ XPeekEvent(dpy, &N); if (N.type == MotionNotify) continue; } DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n", X.xmotion.x, X.xmotion.y); if (raising) { raising = 0; dmxConsoleMoveAbsolute(priv, raiseX, raiseY, priv->mou, motion, block); } else { if (priv->fine) dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y, priv->mou, motion, block); else dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y, priv->mou, motion, block); } break; case KeyPress: case KeyRelease: enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); break; default: /* Pass the whole event here, because * this may be an extension event. */ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); break; } } } static void dmxCloseConsole(myPrivate * priv) { GETDMXINPUTFROMPRIV; dmxCommonRestoreState(priv); if (priv->display) { XFreeGC(priv->display, priv->gc); XFreeGC(priv->display, priv->gcDet); XFreeGC(priv->display, priv->gcRev); XFreeGC(priv->display, priv->gcCur); if (!dmxInput->console) XCloseDisplay(priv->display); } priv->display = NULL; } static Bool dmxCloseConsoleScreen(ScreenPtr pScreen) { myPrivate *priv, *last; for (last = priv = (myPrivate *) dixLookupPrivate(&pScreen->devPrivates, dmxScreenPrivateKey); priv; priv = priv->next) dmxCloseConsole(last = priv); DMX_UNWRAP(CloseScreen, last, pScreen); return pScreen->CloseScreen(pScreen); } static Cursor dmxConsoleCreateEmptyCursor(myPrivate * priv) { char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; Pixmap pixmap; Cursor cursor; XColor color, tmpColor; Display *dpy = priv->display; /* Create empty cursor for window */ pixmap = XCreateBitmapFromData(priv->display, priv->window, noCursorData, 8, 8); if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), "black", &color, &tmpColor)) dmxLog(dmxFatal, "Cannot allocate color for cursor\n"); cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0); XFreePixmap(dpy, pixmap); return cursor; } static void dmxConsoleComputeWidthHeight(myPrivate * priv, int *width, int *height, double *xScale, double *yScale, int *consWidth, int *consHeight) { int screen; Display *dpy = priv->display; *width = 0; *height = 0; *xScale = 1.0; *yScale = 1.0; screen = DefaultScreen(dpy); *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN; *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN; if (*consWidth < 1) *consWidth = 1; if (*consHeight < 1) *consHeight = 1; #if 1 /* Always keep the console size similar * to the global bounding box. */ *width = dmxGlobalWidth; *height = dmxGlobalHeight; #else /* Make the console window as big as * possible by computing the visible * bounding box. */ for (i = 0; i < dmxNumScreens; i++) { if (screenInfo.screens[i]->x + screenInfo.screens[i]->width > *width) *width = screenInfo.screens[i]->x + screenInfo.screens[i]->width; if (screenInfo.screens[i]->y + screenInfo.screens[i]->height > *height) *height = screenInfo.screens[i]->y + screenInfo.screens[i]->height; } #endif if ((double) *consWidth / *width < (double) *consHeight / *height) *xScale = *yScale = (double) *consWidth / *width; else *xScale = *yScale = (double) *consHeight / *height; *consWidth = scalex(priv, *width); *consHeight = scaley(priv, *height); if (*consWidth < 1) *consWidth = 1; if (*consHeight < 1) *consHeight = 1; } /** Re-initialized the console device described by \a pDev (after a * reconfig). */ void dmxConsoleReInit(DevicePtr pDev) { GETPRIVFROMPDEV; Display *dpy; if (!priv || !priv->initialized) return; dpy = priv->display; dmxConsoleComputeWidthHeight(priv, &priv->width, &priv->height, &priv->xScale, &priv->yScale, &priv->consWidth, &priv->consHeight); XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight); XFreePixmap(dpy, priv->pixmap); priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)), priv->consWidth, priv->consHeight, DefaultDepth(dpy, DefaultScreen(dpy))); dmxConsoleDraw(priv, 1, 1); } /** Initialized the console device described by \a pDev. */ void dmxConsoleInit(DevicePtr pDev) { GETPRIVFROMPDEV; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; int screen; unsigned long mask; XSetWindowAttributes attribs; Display *dpy; Window win; XGCValues gcvals; XColor color; XClassHint class_hints; unsigned long tmp; if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev; if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev; if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */ if (!(dpy = priv->display = XOpenDisplay(dmxInput->name))) dmxLog(dmxFatal, "dmxOpenConsole: cannot open console display %s\n", dmxInput->name); /* Set up defaults */ dmxConsoleComputeWidthHeight(priv, &priv->width, &priv->height, &priv->xScale, &priv->yScale, &priv->consWidth, &priv->consHeight); /* Private initialization using computed values or constants. */ screen = DefaultScreen(dpy); priv->initPointerX = scalex(priv, priv->width / 2); priv->initPointerY = scaley(priv, priv->height / 2); priv->eventMask = (ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask | ExposureMask | ResizeRedirectMask); mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect; attribs.colormap = DefaultColormap(dpy, screen); if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color) && XAllocColor(dpy, attribs.colormap, &color)) { attribs.background_pixel = color.pixel; } else attribs.background_pixel = WhitePixel(dpy, screen); attribs.event_mask = priv->eventMask; attribs.override_redirect = False; win = priv->window = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, priv->consWidth, priv->consHeight, 0, DefaultDepth(dpy, screen), InputOutput, DefaultVisual(dpy, screen), mask, &attribs); priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen), priv->consWidth, priv->consHeight, DefaultDepth(dpy, screen)); /* Set up properties */ XStoreName(dpy, win, DMX_CONSOLE_NAME); class_hints.res_name = (char *) DMX_RES_NAME; class_hints.res_class = (char *) DMX_RES_CLASS; XSetClassHint(dpy, win, &class_hints); /* Map the window */ XMapWindow(dpy, win); /* Create cursors */ priv->cursorNormal = XCreateFontCursor(dpy, XC_circle); priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider); priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv); XDefineCursor(dpy, priv->window, priv->cursorNormal); /* Create GC */ mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground | GCBackground | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle | GCGraphicsExposures); gcvals.function = GXcopy; gcvals.plane_mask = AllPlanes; gcvals.clip_mask = None; if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color) && XAllocColor(dpy, attribs.colormap, &color)) { gcvals.foreground = color.pixel; } else gcvals.foreground = BlackPixel(dpy, screen); if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color) && XAllocColor(dpy, attribs.colormap, &color)) { gcvals.background = color.pixel; } else gcvals.background = WhitePixel(dpy, screen); gcvals.line_width = 0; gcvals.line_style = LineSolid; gcvals.cap_style = CapNotLast; gcvals.fill_style = FillSolid; gcvals.graphics_exposures = False; priv->gc = XCreateGC(dpy, win, mask, &gcvals); tmp = gcvals.foreground; if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color) && XAllocColor(dpy, attribs.colormap, &color)) { gcvals.foreground = color.pixel; } else gcvals.foreground = BlackPixel(dpy, screen); priv->gcDet = XCreateGC(dpy, win, mask, &gcvals); gcvals.foreground = tmp; tmp = gcvals.background; gcvals.background = gcvals.foreground; gcvals.foreground = tmp; priv->gcRev = XCreateGC(dpy, win, mask, &gcvals); gcvals.background = gcvals.foreground; if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color) && XAllocColor(dpy, attribs.colormap, &color)) { gcvals.foreground = color.pixel; } else gcvals.foreground = BlackPixel(dpy, screen); priv->gcCur = XCreateGC(dpy, win, mask, &gcvals); dmxConsoleDraw(priv, 1, 1); if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey)) priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey); else DMX_WRAP(CloseScreen, dmxCloseConsoleScreen, priv, screenInfo.screens[0]); dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey, priv); } /** Fill in the \a info structure for the specified \a pDev. Only used * for pointers. */ void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { GETPRIVFROMPDEV; info->buttonClass = 1; dmxCommonMouGetMap(pDev, info->map, &info->numButtons); info->valuatorClass = 1; info->numRelAxes = 2; info->minval[0] = 0; info->minval[1] = 0; /* max possible console window size: */ info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display)); info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display)); info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; info->ptrFeedbackClass = 1; } /** Fill in the \a info structure for the specified \a pDev. Only used * for keyboard. */ void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { dmxCommonKbdGetInfo(pDev, info); info->keyboard = 1; info->keyClass = 1; dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); info->freemap = 1; info->focusClass = 1; info->kbdFeedbackClass = 1; } /** Handle special console-only keys. */ int dmxConsoleFunctions(void *private, DMXFunctionType function) { GETONLYPRIVFROMPRIVATE; XRectangle rect; Display *dpy = priv->display; switch (function) { case DMX_FUNCTION_FINE: if (priv->fine) { priv->fine = 0; dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect); XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted); XCopyArea(dpy, priv->pixmap, priv->window, priv->gc, 0, 0, priv->consWidth, priv->consHeight, 0, 0); XSetClipMask(dpy, priv->gc, None); XDefineCursor(dpy, priv->window, priv->grabbed ? priv->cursorGrabbed : priv->cursorNormal); XWarpPointer(dpy, priv->window, priv->window, 0, 0, 0, 0, scalex(priv, priv->globalX), scaley(priv, priv->globalY)); XSync(dpy, False); /* Not a backend display */ } else { priv->fine = 1; XRaiseWindow(dpy, priv->window); XDefineCursor(dpy, priv->window, priv->cursorEmpty); dmxConsoleUpdateFineCursor(priv); } return 1; case DMX_FUNCTION_GRAB: if (priv->grabbed) { XUngrabKeyboard(dpy, CurrentTime); XUngrabPointer(dpy, CurrentTime); XDefineCursor(dpy, priv->window, priv->fine ? priv->cursorEmpty : priv->cursorNormal); } else { if (XGrabPointer(dpy, priv->window, True, 0, GrabModeAsync, GrabModeAsync, priv->window, None, CurrentTime)) { dmxLog(dmxError, "XGrabPointer failed\n"); return 0; } if (XGrabKeyboard(dpy, priv->window, True, GrabModeAsync, GrabModeAsync, CurrentTime)) { dmxLog(dmxError, "XGrabKeyboard failed\n"); XUngrabPointer(dpy, CurrentTime); return 0; } XDefineCursor(dpy, priv->window, priv->fine ? priv->cursorEmpty : priv->cursorGrabbed); } priv->grabbed = !priv->grabbed; if (priv->fine) dmxConsoleUpdateFineCursor(priv); return 1; case DMX_FUNCTION_TERMINATE: return 1; default: return 0; } } static void dmxDump(void) { int i, j; DMXInputInfo *dmxInput; XEvent X; for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { for (j = 0; j < dmxInput->numDevs; j++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; myPrivate *priv = dmxLocal->private; while (priv && priv->display && XCheckTypedEvent(priv->display, MotionNotify, &X)) { DMXDBG4("dmxDump: %s/%d threw event away %d %s\n", dmxInput->name, j, X.type, dmxEventName(X.type)); } } } } /** This routine is used to warp the pointer into the console window * from anywhere on the screen. It is used when backend and console * input are both being taken from the same X display. */ void dmxConsoleCapture(DMXInputInfo * dmxInput) { int i; XEvent X; DMXDBG0("dmxConsoleCapture\n"); dmxSync(NULL, TRUE); for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; myPrivate *priv = dmxLocal->private; if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue; if (dmxLocal->type != DMX_LOCAL_MOUSE) continue; if (priv->captured) continue; priv->captured = 2; /* Ungrab only after proximal events. */ XRaiseWindow(priv->display, priv->window); XSync(priv->display, False); /* Not a backend display */ while (XCheckTypedEvent(priv->display, MotionNotify, &X)) { DMXDBG3(" Ignoring motion to %d %d after capture on %s\n", X.xmotion.x, X.xmotion.y, dmxInput->name); } XWarpPointer(priv->display, None, priv->window, 0, 0, 0, 0, priv->curX, priv->curY); XSync(priv->display, False); /* Not a backend display */ dmxDump(); if (priv->fine) dmxConsoleUpdateFineCursor(priv); } } /** Undo the capture that was done by #dmxConsoleCapture. */ void dmxConsoleUncapture(DMXInputInfo * dmxInput) { int i; DMXDBG0("dmxConsoleUncapture\n"); dmxSync(NULL, TRUE); for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; myPrivate *priv = dmxLocal->private; if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue; if (dmxLocal->type != DMX_LOCAL_MOUSE) continue; if (!priv->captured) continue; priv->captured = 0; XSync(priv->display, False); /* Not a backend display */ } } xorg-server-1.20.8/hw/dmx/input/ChkNotMaskEv.c0000644000175000017500000000764313640201473016026 00000000000000/* * Copyright 1985, 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. */ /* $XFree86 */ /* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** \file * This file provides a #XCheckNotMaskEvent function that is derived * from the standard Xlib XCheckMaskEvent function. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmx.h" #include "ChkNotMaskEv.h" extern long const _Xevent_to_mask[]; /** Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ Bool XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event) { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if (qelt->event.type >= LASTEvent || !(_Xevent_to_mask[qelt->event.type] & mask)) { *event = qelt->event; _XDeq(dpy, prev, qelt); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 2: _XEventsQueued(dpy, QueuedAfterReading); break; case 1: _XFlush(dpy); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } xorg-server-1.20.8/hw/dmx/input/dmxevents.c0000644000175000017500000006117313640201473015544 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Provide support and helper functions for enqueing events received by * the low-level input drivers. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #define DMX_EVENTS_DEBUG 0 #include "dmxinputinit.h" #include "dmxevents.h" #include "dmxcb.h" #include "dmxcommon.h" #include "dmxcursor.h" #include "dmxmotion.h" #include "dmxmap.h" #include #include "opaque.h" #include "inputstr.h" #include "inpututils.h" #include "mipointer.h" #include "mi.h" #include "exglobals.h" #include "xkbsrv.h" #include "XIstubs.h" static int dmxGlobalX, dmxGlobalY; /* Global cursor position */ static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion * should move the mouse anyway. */ #if DMX_EVENTS_DEBUG #define DMXDBG0(f) dmxLog(dmxDebug,f) #define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) #define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) #define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) #define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) #define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) #else #define DMXDBG0(f) #define DMXDBG1(f,a) #define DMXDBG2(f,a,b) #define DMXDBG3(f,a,b,c) #define DMXDBG4(f,a,b,c,d) #define DMXDBG5(f,a,b,c,d,e) #define DMXDBG6(f,a,b,c,d,e,g) #define DMXDBG7(f,a,b,c,d,e,g,h) #endif static int dmxApplyFunctions(DMXInputInfo * dmxInput, DMXFunctionType f) { int i; int rc = 0; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->functions) rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f); return rc; } static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym) { DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; #if 1 /* hack to detect ctrl-alt-q, etc */ static int ctrl = 0, alt = 0; /* keep track of ctrl/alt key status */ if (type == KeyPress && keySym == 0xffe3) { ctrl = 1; } else if (type == KeyRelease && keySym == 0xffe3) { ctrl = 0; } else if (type == KeyPress && keySym == 0xffe9) { alt = 1; } else if (type == KeyRelease && keySym == 0xffe9) { alt = 0; } if (!ctrl || !alt) return 0; #else unsigned short state = 0; if (dmxLocal->sendsCore) state = dmxLocalCoreKeyboard->pDevice->key->state; else if (dmxLocal->pDevice->key) state = dmxLocal->pDevice->key->state; DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", keySym, type == KeyPress ? "press" : "release", state); if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask)) return 0; #endif switch (keySym) { case XK_g: if (type == KeyPress) dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB); return 1; case XK_f: if (type == KeyPress) dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE); return 1; case XK_q: if (type == KeyPress && dmxLocal->sendsCore) if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) { dmxLog(dmxInfo, "User request for termination\n"); dispatchException |= DE_TERMINATE; } return 1; } return 0; } DMXScreenInfo * dmxFindFirstScreen(int x, int y) { int i; for (i = 0; i < dmxNumScreens; i++) { DMXScreenInfo *dmxScreen = &dmxScreens[i]; if (dmxOnScreen(x, y, dmxScreen)) return dmxScreen; } return NULL; } /** * Enqueue a motion event. */ static void enqueueMotion(DevicePtr pDev, int x, int y) { GETDMXLOCALFROMPDEV; DeviceIntPtr p = dmxLocal->pDevice; int valuators[3]; int detail = 0; /* XXX should this be mask of pressed buttons? */ ValuatorMask mask; valuators[0] = x; valuators[1] = y; valuator_mask_set_range(&mask, 0, 2, valuators); QueuePointerEvents(p, MotionNotify, detail, POINTER_ABSOLUTE | POINTER_SCREEN, &mask); return; } void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) { DMXScreenInfo *dmxScreen; DMXInputInfo *dmxInput; ScreenPtr pScreen; int localX; int localY; int i; if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", x, y, delta, dmxGlobalX, dmxGlobalY); dmxGlobalInvalid = 0; dmxGlobalX = x; dmxGlobalY = y; if (dmxGlobalX < 0) dmxGlobalX = 0; if (dmxGlobalY < 0) dmxGlobalY = 0; if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta - 1; if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta - 1; if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin; if ((pScreen = miPointerGetScreen(inputInfo.pointer)) && pScreen->myNum == dmxScreen->index) { /* Screen is old screen */ if (block) input_lock(); if (pDev) enqueueMotion(pDev, localX, localY); if (block) input_unlock(); } else { /* Screen is new */ DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", pScreen->myNum, dmxScreen->index, localX, localY); if (block) input_lock(); mieqProcessInputEvents(); miPointerSetScreen(inputInfo.pointer, dmxScreen->index, localX, localY); if (pDev) enqueueMotion(pDev, localX, localY); if (block) input_unlock(); } #if 00 miPointerGetPosition(inputInfo.pointer, &localX, &localY); if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY, localX, localY); DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" " on screen index=%d/%d localX=%d localY=%d\n", dmxGlobalX, dmxGlobalY, dmxScreen ? dmxScreen->index : -1, pScreen->myNum, localX, localY); } #endif } /* Send updates down to all core input * drivers */ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { int j; for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) if (!dmxInput->detached && dmxInput->devs[j]->sendsCore && dmxInput->devs[j]->update_position) dmxInput->devs[j]->update_position(dmxInput->devs[j]->private, dmxGlobalX, dmxGlobalY); } if (!dmxScreen) ProcessInputEvents(); } #define DMX_MAX_AXES 32 /* Max axes reported by this routine */ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, int *v, int firstAxis, int axesCount, DMXMotionType type, DMXBlockType block) { DeviceIntPtr pDevice = dmxLocal->pDevice; xEvent xE[2 * DMX_MAX_AXES / 6]; deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE; deviceValuator *xv = (deviceValuator *) xev + 1; int thisX = 0; int thisY = 0; int count; ValuatorMask mask; memset(xE, 0, sizeof(xE)); if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES; if ((valuator_get_mode(pDevice, 0) == Relative) && axesCount == 2) { /* The dmx console is a relative mode * device that sometimes reports * absolute motion. It only has two * axes. */ if (type == DMX_RELATIVE) { thisX = -v[0]; thisY = -v[1]; dmxLocal->lastX += thisX; dmxLocal->lastY += thisY; if (dmxLocal->update_position) dmxLocal->update_position(dmxLocal->private, dmxLocal->lastX, dmxLocal->lastY); } else { /* Convert to relative */ if (dmxLocal->lastX || dmxLocal->lastY) { thisX = v[0] - dmxLocal->lastX; thisY = v[1] - dmxLocal->lastY; } dmxLocal->lastX = v[0]; dmxLocal->lastY = v[1]; } v[0] = thisX; v[1] = thisY; } if (axesCount <= 6) { /* Optimize for the common case when * only 1 or 2 axes change. */ xev->time = GetTimeInMillis(); xev->type = DeviceMotionNotify; xev->detail = 0; xev->deviceid = pDevice->id | MORE_EVENTS; xv->type = DeviceValuator; xv->deviceid = pDevice->id; xv->num_valuators = axesCount; xv->first_valuator = firstAxis; switch (xv->num_valuators) { case 6: xv->valuator5 = v[5]; case 5: xv->valuator4 = v[4]; case 4: xv->valuator3 = v[3]; case 3: xv->valuator2 = v[2]; case 2: xv->valuator1 = v[1]; case 1: xv->valuator0 = v[0]; } count = 2; } else { int i; for (i = 0, count = 0; i < axesCount; i += 6) { xev->time = GetTimeInMillis(); xev->type = DeviceMotionNotify; xev->detail = 0; xev->deviceid = pDevice->id | MORE_EVENTS; xev += 2; xv->type = DeviceValuator; xv->deviceid = pDevice->id; xv->num_valuators = (i + 6 >= axesCount ? axesCount - i : 6); xv->first_valuator = firstAxis + i; switch (xv->num_valuators) { case 6: xv->valuator5 = v[i + 5]; case 5: xv->valuator4 = v[i + 4]; case 4: xv->valuator3 = v[i + 3]; case 3: xv->valuator2 = v[i + 2]; case 2: xv->valuator1 = v[i + 1]; case 1: xv->valuator0 = v[i + 0]; } xv += 2; count += 2; } } if (block) input_lock(); valuator_mask_set_range(&mask, firstAxis, axesCount, v); QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask); if (block) input_unlock(); } static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, XEvent * e, DMXBlockType block) { int type; int event = -1; XDeviceKeyEvent *ke = (XDeviceKeyEvent *) e; XDeviceMotionEvent *me = (XDeviceMotionEvent *) e; DeviceIntPtr pDevice = dmxLocal->pDevice; int valuators[MAX_VALUATORS]; ValuatorMask mask; if (!e) return -1; /* No extended event passed, cannot handle */ if ((XID) dmxLocal->deviceId != ke->deviceid) { /* Search for the correct dmxLocal, * since backend and console events are * picked up for the first device on * that X server. */ int i; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; for (i = 0; i < dmxInput->numDevs; i++) { dmxLocal = dmxInput->devs[i]; if ((XID) dmxLocal->deviceId == ke->deviceid) break; } } if ((XID) dmxLocal->deviceId != ke->deviceid || (type = dmxMapLookup(dmxLocal, e->type)) < 0) return -1; /* No mapping, so this event is unhandled */ switch (type) { case XI_DeviceValuator: event = DeviceValuator; break; case XI_DeviceKeyPress: event = KeyPress; break; case XI_DeviceKeyRelease: event = KeyRelease; break; case XI_DeviceButtonPress: event = ButtonPress; break; case XI_DeviceButtonRelease: event = ButtonRelease; break; case XI_DeviceMotionNotify: event = MotionNotify; break; case XI_DeviceFocusIn: event = DeviceFocusIn; break; case XI_DeviceFocusOut: event = DeviceFocusOut; break; case XI_ProximityIn: event = ProximityIn; break; case XI_ProximityOut: event = ProximityOut; break; case XI_DeviceStateNotify: event = DeviceStateNotify; break; case XI_DeviceMappingNotify: event = DeviceMappingNotify; break; case XI_ChangeDeviceNotify: event = ChangeDeviceNotify; break; case XI_DeviceKeystateNotify: event = DeviceStateNotify; break; case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break; } #define EXTRACT_VALUATORS(ke, valuators) \ valuators[0] = ke->axis_data[0]; \ valuators[1] = ke->axis_data[1]; \ valuators[2] = ke->axis_data[2]; \ valuators[3] = ke->axis_data[3]; \ valuators[4] = ke->axis_data[4]; \ valuators[5] = ke->axis_data[5]; \ switch (type) { case XI_DeviceKeyPress: case XI_DeviceKeyRelease: if (block) input_lock(); QueueKeyboardEvents(pDevice, event, ke->keycode); if (block) input_unlock(); break; case XI_DeviceButtonPress: case XI_DeviceButtonRelease: EXTRACT_VALUATORS(ke, valuators); valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) input_lock(); QueuePointerEvents(pDevice, event, ke->keycode, POINTER_ABSOLUTE, &mask); if (block) input_unlock(); break; case XI_ProximityIn: case XI_ProximityOut: EXTRACT_VALUATORS(ke, valuators); valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) input_lock(); QueueProximityEvents(pDevice, event, &mask); if (block) input_unlock(); break; break; case XI_DeviceMotionNotify: dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count, DMX_ABSOLUTE, block); break; case XI_DeviceFocusIn: case XI_DeviceFocusOut: case XI_DeviceStateNotify: case XI_DeviceMappingNotify: case XI_ChangeDeviceNotify: case XI_DeviceKeystateNotify: case XI_DeviceButtonstateNotify: /* These are ignored, since DMX will * generate its own events of these * types, as necessary. * Perhaps ChangeDeviceNotify should * generate an error, because it is * unexpected? */ break; case XI_DeviceValuator: default: dmxLog(dmxWarning, "XInput extension event (remote=%d -> zero-based=%d)" " not supported yet\n", e->type, type); return -1; } return 0; } static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button) { ButtonClassPtr b = dmxLocal->pDevice->button; if (button > b->numButtons) { /* This shouldn't happen. */ dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n", button, b->numButtons); return button; } return b->map[button]; } /** Return DMX's notion of the pointer position in the global coordinate * space. */ void dmxGetGlobalPosition(int *x, int *y) { *x = dmxGlobalX; *y = dmxGlobalY; } /** Invalidate the global position for #dmxCoreMotion. */ void dmxInvalidateGlobalPosition(void) { dmxGlobalInvalid = 1; } /** Enqueue a motion event for \a pDev. The \a v vector has length \a * axesCount, and contains values for each of the axes, starting at \a * firstAxes. * * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be * allowed to move outside the global boundaires). * * If \a block is set to \a DMX_BLOCK, then the input thread will be * blocked around calls to \a enqueueMotion(). */ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount, DMXMotionType type, DMXBlockType block) { GETDMXLOCALFROMPDEV; if (!dmxLocal->sendsCore) { dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block); return; } if (axesCount == 2) { switch (type) { case DMX_RELATIVE: dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block); break; case DMX_ABSOLUTE: dmxCoreMotion(pDev, v[0], v[1], 0, block); break; case DMX_ABSOLUTE_CONFINED: dmxCoreMotion(pDev, v[0], v[1], -1, block); break; } } } static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode) { KeySym keysym = NoSymbol; int effectiveGroup; XkbSrvInfoPtr xkbi; if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) goto out; xkbi = dmxLocal->pDevice->key->xkbInfo; effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode); if (effectiveGroup == -1) goto out; keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup); DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", keyCode, keysym); out: return keysym; } static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst) { /* FIXME: this is quite ineffective, converting to a core map first and * then extracting the info from there. It'd be better to run the actual * xkb map */ XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo; KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice); int i; /* Optimize for similar maps */ if (XkbKeycodeInRange(xkbi->desc, tryFirst) && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code) * pKeySyms->mapWidth] == keySym) return tryFirst; for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) { if (pKeySyms->map[(i - pKeySyms->minKeyCode) * pKeySyms->mapWidth] == keySym) { DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to" " keyCode=%d (reverses to core keySym=0x%04x)\n", keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard, i)); return i; } } return 0; } static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym) { GETDMXLOCALFROMPDEV; int keyCode; if (!dmxLocal->pDevice->key) { dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n", dmxLocal->pDevice->name); return NoSymbol; } if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (keySym == NoSymbol) return detail; keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail); return keyCode ? keyCode : detail; } /** Enqueue an event from the \a pDev device with the * specified \a type and \a detail. If the event is a KeyPress or * KeyRelease event, then the \a keySym is also specified. * * FIXME: make the code do what the comment says, or remove this comment. * If \a block is set to \a DMX_BLOCK, then the input thread will be * blocked around calls to dmxeqEnqueue(). */ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, XEvent * e, DMXBlockType block) { GETDMXINPUTFROMPDEV; DeviceIntPtr p = dmxLocal->pDevice; int valuators[3]; ValuatorMask mask; DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); switch (type) { case KeyPress: case KeyRelease: if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) return; if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) detail = dmxFixup(pDev, detail, keySym); /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */ QueueKeyboardEvents(p, type, detail); return; case ButtonPress: case ButtonRelease: detail = dmxGetButtonMapping(dmxLocal, detail); valuator_mask_zero(&mask); QueuePointerEvents(p, type, detail, 0, &mask); return; case MotionNotify: valuators[0] = e->xmotion.x; valuators[1] = e->xmotion.y; valuators[2] = e->xmotion.state; /* FIXME: WTF?? */ valuator_mask_set_range(&mask, 0, 3, valuators); QueuePointerEvents(p, type, detail, POINTER_ABSOLUTE | POINTER_SCREEN, &mask); return; case EnterNotify: case LeaveNotify: case KeymapNotify: case MappingNotify: /* This is sent because we change the * modifier map on the backend/console * input device so that we have complete * control of the input device LEDs. */ return; default: if (type == ProximityIn || type == ProximityOut) { if (dmxLocal->sendsCore) return; /* Not a core event */ break; } if (type >= LASTEvent) { if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block)) dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type); } else { dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n", type, dmxEventName(type)); } return; } } /** A pointer to this routine is passed to low-level input drivers so * that all special keychecking is unified to this file. This function * returns 0 if no special keys have been pressed. If the user has * requested termination of the DMX server, -1 is returned. If the user * has requested a switch to a VT, then the (1-based) number of that VT * is returned. */ int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym) { GETDMXINPUTFROMPDEV; int vt = 0; unsigned short state = 0; if (dmxLocal->sendsCore) state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo-> state); else if (dmxLocal->pDevice->key) state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state); if (!dmxLocal->sendsCore) return 0; /* Only for core devices */ DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym, state); if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask)) return 0; switch (keySym) { case XK_F1: case XK_F2: case XK_F3: case XK_F4: case XK_F5: case XK_F6: case XK_F7: case XK_F8: case XK_F9: case XK_F10: vt = keySym - XK_F1 + 1; break; case XK_F11: case XK_F12: vt = keySym - XK_F11 + 11; break; case XK_q: /* To avoid confusion */ case XK_BackSpace: case XK_Delete: case XK_KP_Delete: dmxLog(dmxInfo, "User request for termination\n"); dispatchException |= DE_TERMINATE; return -1; /* Terminate */ } if (vt) { dmxLog(dmxInfo, "Request to switch to VT %d\n", vt); dmxInput->vt_switch_pending = vt; return vt; } return 0; /* Do nothing */ } xorg-server-1.20.8/hw/dmx/input/dmxbackend.h0000644000175000017500000000436013640201473015627 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to backend input device support. \see dmxbackend.c \see * dmxcommon.c */ #ifndef _DMXBACKEND_H_ #define _DMXBACKEND_H_ extern void *dmxBackendCreatePrivate(DeviceIntPtr pDevice); extern void dmxBackendDestroyPrivate(void *private); extern void dmxBackendInit(DevicePtr pDev); extern void dmxBackendLateReInit(DevicePtr pDev); extern void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern void dmxBackendCollectEvents(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); extern void dmxBackendProcessInput(void *private); extern int dmxBackendFunctions(void *private, DMXFunctionType function); extern void dmxBackendUpdatePosition(void *private, int x, int y); #endif xorg-server-1.20.8/hw/dmx/input/dmxdetach.c0000644000175000017500000000367213640201473015470 00000000000000/* * Copyright 2004 Red Hat Inc., Raleigh, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Provide support and helper functions for input detach and attach. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmxinputinit.h" #include "dmxextension.h" /* For dmxInputCount */ /** Search for input associated with \a dmxScreen, and detach. */ void dmxInputDetach(DMXScreenInfo * dmxScreen, Bool reserveId) { int i; for (i = 0; i < dmxNumInputs; i++) { DMXInputInfo *dmxInput = &dmxInputs[i]; if (dmxInput->scrnIdx == dmxScreen->index) { dmxLogInput(dmxInput, "Detaching (%sreserved)\n", reserveId ? "" : "not "); dmxInput->detached = True; return; } } } xorg-server-1.20.8/hw/dmx/input/usb-other.h0000644000175000017500000000345413640201473015442 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to USB generic driver. \see usb-other.c \see usb-common.c */ #ifndef _USB_OTHER_H_ #define _USB_OTHER_H_ extern void othUSBRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); extern void othUSBInit(DevicePtr pDev); extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern int othUSBOn(DevicePtr pDev); extern void othUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl); #endif xorg-server-1.20.8/hw/dmx/input/Makefile.in0000644000175000017500000007474013640201512015426 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/dmx/input ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libdmxinput_a_AR = $(AR) $(ARFLAGS) libdmxinput_a_LIBADD = am__libdmxinput_a_SOURCES_DIST = ChkNotMaskEv.c ChkNotMaskEv.h \ atKeynames.h usb-keyboard.c usb-keyboard.h usb-mouse.c \ usb-mouse.h usb-other.c usb-other.h usb-common.c usb-common.h \ usb-private.h dmxdummy.c dmxdummy.h dmxbackend.c dmxbackend.h \ dmxconsole.c dmxconsole.h dmxcommon.c dmxcommon.h \ dmxinputinit.c dmxinputinit.h dmxarg.c dmxarg.h dmxevents.c \ dmxevents.h dmxxinput.c dmxmotion.c dmxmotion.h dmxmap.c \ dmxmap.h @DMX_BUILD_USB_TRUE@am__objects_1 = usb-keyboard.$(OBJEXT) \ @DMX_BUILD_USB_TRUE@ usb-mouse.$(OBJEXT) usb-other.$(OBJEXT) \ @DMX_BUILD_USB_TRUE@ usb-common.$(OBJEXT) am__objects_2 = dmxdummy.$(OBJEXT) dmxbackend.$(OBJEXT) \ dmxconsole.$(OBJEXT) dmxcommon.$(OBJEXT) am__objects_3 = dmxinputinit.$(OBJEXT) dmxarg.$(OBJEXT) \ dmxevents.$(OBJEXT) dmxxinput.$(OBJEXT) dmxmotion.$(OBJEXT) \ dmxmap.$(OBJEXT) am_libdmxinput_a_OBJECTS = ChkNotMaskEv.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) libdmxinput_a_OBJECTS = $(am_libdmxinput_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/ChkNotMaskEv.Po \ ./$(DEPDIR)/dmxarg.Po ./$(DEPDIR)/dmxbackend.Po \ ./$(DEPDIR)/dmxcommon.Po ./$(DEPDIR)/dmxconsole.Po \ ./$(DEPDIR)/dmxdummy.Po ./$(DEPDIR)/dmxevents.Po \ ./$(DEPDIR)/dmxinputinit.Po ./$(DEPDIR)/dmxmap.Po \ ./$(DEPDIR)/dmxmotion.Po ./$(DEPDIR)/dmxxinput.Po \ ./$(DEPDIR)/usb-common.Po ./$(DEPDIR)/usb-keyboard.Po \ ./$(DEPDIR)/usb-mouse.Po ./$(DEPDIR)/usb-other.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdmxinput_a_SOURCES) DIST_SOURCES = $(am__libdmxinput_a_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libdmxinput.a @DMX_BUILD_USB_TRUE@USBSRCS = usb-keyboard.c \ @DMX_BUILD_USB_TRUE@ usb-keyboard.h \ @DMX_BUILD_USB_TRUE@ usb-mouse.c \ @DMX_BUILD_USB_TRUE@ usb-mouse.h \ @DMX_BUILD_USB_TRUE@ usb-other.c \ @DMX_BUILD_USB_TRUE@ usb-other.h \ @DMX_BUILD_USB_TRUE@ usb-common.c \ @DMX_BUILD_USB_TRUE@ usb-common.h \ @DMX_BUILD_USB_TRUE@ usb-private.h DRVSRCS = dmxdummy.c \ dmxdummy.h \ dmxbackend.c \ dmxbackend.h \ dmxconsole.c \ dmxconsole.h \ dmxcommon.c \ dmxcommon.h DMXSRCS = dmxinputinit.c \ dmxinputinit.h \ dmxarg.c \ dmxarg.h \ dmxevents.c \ dmxevents.h \ dmxxinput.c \ dmxmotion.c \ dmxmotion.h \ dmxmap.c \ dmxmap.h libdmxinput_a_SOURCES = ChkNotMaskEv.c \ ChkNotMaskEv.h \ atKeynames.h \ $(RAWSRCS) \ $(USBSRCS) \ $(DRVSRCS) \ $(DMXSRCS) \ $(LIBSRCS) @GLX_TRUE@GLX_DEFS = @GL_CFLAGS@ AM_CFLAGS = $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -DHAVE_DMX_CONFIG_H \ $(GLX_DEFS) \ @DMXMODULES_CFLAGS@ EXTRA_DIST = dmxdetach.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/input/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/dmx/input/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libdmxinput.a: $(libdmxinput_a_OBJECTS) $(libdmxinput_a_DEPENDENCIES) $(EXTRA_libdmxinput_a_DEPENDENCIES) $(AM_V_at)-rm -f libdmxinput.a $(AM_V_AR)$(libdmxinput_a_AR) libdmxinput.a $(libdmxinput_a_OBJECTS) $(libdmxinput_a_LIBADD) $(AM_V_at)$(RANLIB) libdmxinput.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ChkNotMaskEv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxarg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxbackend.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcommon.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconsole.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxdummy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxevents.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxinputinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmotion.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxxinput.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-keyboard.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-mouse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-other.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/ChkNotMaskEv.Po -rm -f ./$(DEPDIR)/dmxarg.Po -rm -f ./$(DEPDIR)/dmxbackend.Po -rm -f ./$(DEPDIR)/dmxcommon.Po -rm -f ./$(DEPDIR)/dmxconsole.Po -rm -f ./$(DEPDIR)/dmxdummy.Po -rm -f ./$(DEPDIR)/dmxevents.Po -rm -f ./$(DEPDIR)/dmxinputinit.Po -rm -f ./$(DEPDIR)/dmxmap.Po -rm -f ./$(DEPDIR)/dmxmotion.Po -rm -f ./$(DEPDIR)/dmxxinput.Po -rm -f ./$(DEPDIR)/usb-common.Po -rm -f ./$(DEPDIR)/usb-keyboard.Po -rm -f ./$(DEPDIR)/usb-mouse.Po -rm -f ./$(DEPDIR)/usb-other.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/ChkNotMaskEv.Po -rm -f ./$(DEPDIR)/dmxarg.Po -rm -f ./$(DEPDIR)/dmxbackend.Po -rm -f ./$(DEPDIR)/dmxcommon.Po -rm -f ./$(DEPDIR)/dmxconsole.Po -rm -f ./$(DEPDIR)/dmxdummy.Po -rm -f ./$(DEPDIR)/dmxevents.Po -rm -f ./$(DEPDIR)/dmxinputinit.Po -rm -f ./$(DEPDIR)/dmxmap.Po -rm -f ./$(DEPDIR)/dmxmotion.Po -rm -f ./$(DEPDIR)/dmxxinput.Po -rm -f ./$(DEPDIR)/usb-common.Po -rm -f ./$(DEPDIR)/usb-keyboard.Po -rm -f ./$(DEPDIR)/usb-mouse.Po -rm -f ./$(DEPDIR)/usb-other.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/dmx/input/dmxconsole.h0000644000175000017500000000473313640201473015706 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface for console device support. \see dmxconsole.c \see dmxcommon.c */ #ifndef _DMXCONSOLE_H_ #define _DMXCONSOLE_H_ extern void *dmxConsoleCreatePrivate(DeviceIntPtr pDevice); extern void dmxConsoleDestroyPrivate(void *private); extern void dmxConsoleInit(DevicePtr pDev); extern void dmxConsoleReInit(DevicePtr pDev); extern void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern void dmxConsoleCollectEvents(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); extern int dmxConsoleFunctions(void *private, DMXFunctionType function); extern void dmxConsoleUpdatePosition(void *private, int x, int y); extern void dmxConsoleKbdSetCtrl(void *private, KeybdCtrl * ctrl); extern void dmxConsoleCapture(DMXInputInfo * dmxInput); extern void dmxConsoleUncapture(DMXInputInfo * dmxInput); extern void dmxConsoleUpdateInfo(void *private, DMXUpdateType, WindowPtr pWindow); #endif xorg-server-1.20.8/hw/dmx/input/dmxcommon.h0000644000175000017500000001235213640201473015530 00000000000000/* * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to functions used by backend and console input devices. * \see dmxcommon.c \see dmxbackend.c \see dmxconsole.c */ #ifndef _DMXCOMMON_H_ #define _DMXCOMMON_H_ #define DMX_COMMON_OTHER \ Display *display; \ Window window; \ DMXScreenInfo *be; \ DMXLocalInputInfoPtr dmxLocal; \ int initPointerX; \ int initPointerY; \ long eventMask; \ KeybdCtrl kctrl; \ PtrCtrl mctrl; \ int kctrlset; \ int mctrlset; \ KeybdCtrl savedKctrl; \ XModifierKeymap *savedModMap; \ int stateSaved #define DMX_COMMON_XKB \ DMX_COMMON_OTHER; \ XkbDescPtr xkb; \ XkbIndicatorRec savedIndicators #define DMX_COMMON_PRIVATE \ DMX_COMMON_XKB; \ XDevice *xi #define GETONLYPRIVFROMPRIVATE \ myPrivate *priv = private #define GETPRIVFROMPRIVATE \ GETONLYPRIVFROMPRIVATE; \ DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx] #define GETDMXLOCALFROMPDEVICE \ DevicePtr pDev = &pDevice->public; \ DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate #define GETDMXINPUTFROMPRIV \ DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx] #define GETDMXINPUTFROMPDEVICE \ GETDMXLOCALFROMPDEVICE; \ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx] #define GETDMXLOCALFROMPDEV \ DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate #define GETDMXINPUTFROMPDEV \ GETDMXLOCALFROMPDEV; \ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx] #define GETPRIVFROMPDEV \ GETDMXLOCALFROMPDEV; \ myPrivate *priv = dmxLocal->private #define DMX_KEYBOARD_EVENT_MASK \ (KeyPressMask | KeyReleaseMask | KeymapStateMask) #define DMX_POINTER_EVENT_MASK \ (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) extern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap); extern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl); extern void dmxCommonKbdBell(DevicePtr pDev, int percent, int volume, int pitch, int duration); extern int dmxCommonKbdOn(DevicePtr pDev); extern void dmxCommonKbdOff(DevicePtr pDev); extern void dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons); extern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl); extern int dmxCommonMouOn(DevicePtr pDev); extern void dmxCommonMouOff(DevicePtr pDev); extern int dmxFindPointerScreen(int x, int y); extern int dmxCommonOthOn(DevicePtr pDev); extern void dmxCommonOthOff(DevicePtr pDev); extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); /* helper functions */ extern void *dmxCommonCopyPrivate(DeviceIntPtr pDevice); extern void dmxCommonSaveState(void *private); extern void dmxCommonRestoreState(void *private); #endif xorg-server-1.20.8/hw/dmx/input/usb-keyboard.h0000644000175000017500000000346713640201473016125 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to USB keyboard driver. \see usb-keyboard.c \see usb-common.c */ #ifndef _USB_KEYBOARD_H_ #define _USB_KEYBOARD_H_ extern void kbdUSBInit(DevicePtr pDev); extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern int kbdUSBOn(DevicePtr pDev); extern void kbdUSBRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl); #endif xorg-server-1.20.8/hw/dmx/input/dmxinputinit.h0000644000175000017500000003246513640201473016272 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface for low-level input support. \see dmxinputinit.c */ #ifndef _DMXINPUTINIT_H_ #define _DMXINPUTINIT_H_ #include "dmx.h" #include "dmxinput.h" #include "dmxlog.h" #define DMX_LOCAL_DEFAULT_KEYBOARD "kbd" #define DMX_LOCAL_DEFAULT_POINTER "ps2" #define DMX_MAX_BUTTONS 256 #define DMX_MOTION_SIZE 256 #define DMX_MAX_VALUATORS 32 #define DMX_MAX_AXES 32 #define DMX_MAX_XINPUT_EVENT_TYPES 100 #define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */ #define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1) typedef enum { DMX_FUNCTION_GRAB, DMX_FUNCTION_TERMINATE, DMX_FUNCTION_FINE } DMXFunctionType; typedef enum { DMX_LOCAL_HIGHLEVEL, DMX_LOCAL_KEYBOARD, DMX_LOCAL_MOUSE, DMX_LOCAL_OTHER } DMXLocalInputType; typedef enum { DMX_LOCAL_TYPE_LOCAL, DMX_LOCAL_TYPE_CONSOLE, DMX_LOCAL_TYPE_BACKEND, DMX_LOCAL_TYPE_COMMON } DMXLocalInputExtType; typedef enum { DMX_RELATIVE, DMX_ABSOLUTE, DMX_ABSOLUTE_CONFINED } DMXMotionType; /** Stores information from low-level device that is used to initialize * the device at the dix level. */ typedef struct _DMXLocalInitInfo { int keyboard; /**< Non-zero if the device is a keyboard */ int keyClass; /**< Non-zero if keys are present */ KeySymsRec keySyms; /**< Key symbols */ int freemap; /**< If non-zero, free keySyms.map */ CARD8 modMap[MAP_LENGTH]; /**< Modifier map */ XkbDescPtr xkb; /**< XKB description */ XkbComponentNamesRec names; /**< XKB component names */ int freenames; /**< Non-zero if names should be free'd */ int force; /**< Do not allow command line override */ int buttonClass; /**< Non-zero if buttons are present */ int numButtons; /**< Number of buttons */ unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */ int valuatorClass; /**< Non-zero if valuators are * present */ int numRelAxes; /**< Number of relative axes */ int numAbsAxes; /**< Number of absolute axes */ int minval[DMX_MAX_AXES]; /**< Minimum values */ int maxval[DMX_MAX_AXES]; /**< Maximum values */ int res[DMX_MAX_AXES]; /**< Resolution */ int minres[DMX_MAX_AXES]; /**< Minimum resolutions */ int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */ int focusClass; /**< Non-zero if device can * cause focus */ int proximityClass; /**< Non-zero if device * causes proximity events */ int kbdFeedbackClass; /**< Non-zero if device has * keyboard feedback */ int ptrFeedbackClass; /**< Non-zero if device has * pointer feedback */ int ledFeedbackClass; /**< Non-zero if device has * LED indicators */ int belFeedbackClass; /**< Non-zero if device has a * bell */ int intFeedbackClass; /**< Non-zero if device has * integer feedback */ int strFeedbackClass; /**< Non-zero if device has * string feedback */ int maxSymbols; /**< Maximum symbols */ int maxSymbolsSupported; /**< Maximum symbols supported */ KeySym *symbols; /**< Key symbols */ } DMXLocalInitInfo, *DMXLocalInitInfoPtr; typedef void *(*dmxCreatePrivateProcPtr) (DeviceIntPtr); typedef void (*dmxDestroyPrivateProcPtr) (void *); typedef void (*dmxInitProcPtr) (DevicePtr); typedef void (*dmxReInitProcPtr) (DevicePtr); typedef void (*dmxLateReInitProcPtr) (DevicePtr); typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr); typedef int (*dmxOnProcPtr) (DevicePtr); typedef void (*dmxOffProcPtr) (DevicePtr); typedef void (*dmxUpdatePositionProcPtr) (void *, int x, int y); typedef void (*dmxVTPreSwitchProcPtr) (void *); /* Turn I/O Off */ typedef void (*dmxVTPostSwitchProcPtr) (void *); /* Turn I/O On */ typedef void (*dmxVTSwitchReturnProcPtr) (void *); typedef int (*dmxVTSwitchProcPtr) (void *, int vt, dmxVTSwitchReturnProcPtr, void *); typedef void (*dmxMotionProcPtr) (DevicePtr, int *valuators, int firstAxis, int axesCount, DMXMotionType type, DMXBlockType block); typedef void (*dmxEnqueueProcPtr) (DevicePtr, int type, int detail, KeySym keySym, XEvent * e, DMXBlockType block); typedef int (*dmxCheckSpecialProcPtr) (DevicePtr, KeySym keySym); typedef void (*dmxCollectEventsProcPtr) (DevicePtr, dmxMotionProcPtr, dmxEnqueueProcPtr, dmxCheckSpecialProcPtr, DMXBlockType); typedef void (*dmxProcessInputProcPtr) (void *); typedef void (*dmxUpdateInfoProcPtr) (void *, DMXUpdateType, WindowPtr); typedef int (*dmxFunctionsProcPtr) (void *, DMXFunctionType); typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl); typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl); typedef void (*dmxKBBellProcPtr) (DevicePtr, int percent, int volume, int pitch, int duration); /** Stores a mapping between the device id on the remote X server and * the id on the DMX server */ typedef struct _DMXEventMap { int remote; /**< Event number on remote X server */ int server; /**< Event number (unbiased) on DMX server */ } DMXEventMap; /** This is the device-independent structure used by the low-level input * routines. The contents are not exposed to top-level .c files (except * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */ typedef struct _DMXLocalInputInfo { const char *name; /**< Device name */ DMXLocalInputType type; /**< Device type */ DMXLocalInputExtType extType; /**< Extended device type */ int binding; /**< Count of how many consecutive * structs are bound to the same * device */ /* Low-level (e.g., keyboard/mouse drivers) */ dmxCreatePrivateProcPtr create_private; /**< Create * device-dependent * private */ dmxDestroyPrivateProcPtr destroy_private; /**< Destroy * device-dependent * private */ dmxInitProcPtr init; /**< Initialize device */ dmxReInitProcPtr reinit; /**< Reinitialize device * (during a * reconfiguration) */ dmxLateReInitProcPtr latereinit; /**< Reinitialize a device * (called very late * during a * reconfiguration) */ dmxGetInfoProcPtr get_info; /**< Get device information */ dmxOnProcPtr on; /**< Turn device on */ dmxOffProcPtr off; /**< Turn device off */ dmxUpdatePositionProcPtr update_position; /**< Called when another * device updates the * cursor position */ dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */ dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */ dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */ dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue * events from the * device*/ dmxProcessInputProcPtr process_input; /**< Process event (from * queue) */ dmxFunctionsProcPtr functions; dmxUpdateInfoProcPtr update_info; /**< Update window layout * information */ dmxMCtrlProcPtr mCtrl; /**< Pointer control */ dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */ dmxKBBellProcPtr kBell; /**< Bell control */ void *private; /**< Device-dependent private */ int isCore; /**< Is a DMX core device */ int sendsCore; /**< Sends DMX core events */ KeybdCtrl kctrl; /**< Keyboard control */ PtrCtrl mctrl; /**< Pointer control */ DeviceIntPtr pDevice; /**< X-level device */ int inputIdx; /**< High-level index */ int lastX, lastY; /**< Last known position; * for XInput in * dmxevents.c */ int head; /**< XInput motion history * head */ int tail; /**< XInput motion history * tail */ unsigned long *history; /**< XInput motion history */ int *valuators; /**< Cache of previous values */ /* for XInput ChangePointerDevice */ int (*savedMotionProc) (DeviceIntPtr, xTimecoord *, unsigned long, unsigned long, ScreenPtr); int savedMotionEvents; /**< Saved motion events */ int savedSendsCore; /**< Saved sends-core flag */ DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */ int mapOptimize; /**< XInput device id * map * optimization */ long deviceId; /**< device id on remote side, * if any */ const char *deviceName; /**< devive name on remote * side, if any */ } DMXLocalInputInfoRec; extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; extern void dmxLocalInitInput(DMXInputInfo * dmxInput); extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s); extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl); extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl); extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, void *ctrl, int unknown); extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, _Xconst char *reason); extern int dmxInputDetach(DMXInputInfo * dmxInput); extern void dmxInputDetachAll(DMXScreenInfo * dmxScreen); extern int dmxInputDetachId(int id); extern DMXInputInfo *dmxInputLocateId(int id); extern int dmxInputAttachConsole(const char *name, int isCore, int *id); extern int dmxInputAttachBackend(int physicalScreen, int isCore, int *id); #endif xorg-server-1.20.8/hw/dmx/input/dmxarg.c0000644000175000017500000001005513640201473015002 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Generic comma-delimited argument processing. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #define DMX_ARG_TEST 0 #include "dmx.h" #include "dmxarg.h" #include #include #if DMX_ARG_TEST #include #endif /** Stores the parsed argument list. */ struct _dmxArg { int argc; /**< Number of arguments in argv */ int argm; /**< Maximum number of arguments store-able in argv */ const char **argv; /**< Arguments */ }; /** Create an (externally opaque) \a dmxArg object. */ dmxArg dmxArgCreate(void) { dmxArg a = malloc(sizeof(*a)); a->argc = 0; a->argm = 2; a->argv = malloc(a->argm * sizeof(*a->argv)); a->argv[0] = NULL; return a; } /** Free the specified \a dmxArg object. */ void dmxArgFree(dmxArg a) { int i; for (i = 0; i < a->argc; i++) free((char *) a->argv[i]); free(a->argv); free(a); } /** Add the \a string as the next argument in the \a dmxArg object. */ void dmxArgAdd(dmxArg a, const char *string) { if (a->argm <= a->argc + 2) a->argv = reallocarray(a->argv, (a->argm *= 2), sizeof(*a->argv)); a->argv[a->argc++] = strdup(string); a->argv[a->argc] = NULL; } /** Return the argument number \a item in the \a dmxArg object. * Arguments are 0 based. NULL will be returned for values less than 0 * or equal to or greater than the number of arguments in the object. */ const char * dmxArgV(dmxArg a, int item) { if (item < 0 || item >= a->argc) return NULL; return a->argv[item]; } /** Return the number of arguments in the \a dmxArg object. */ int dmxArgC(dmxArg a) { return a->argc; } /** Parse a string into arguments delimited by commas. Return a new \a * dmxArg object containing the arguments. */ dmxArg dmxArgParse(const char *string) { int i = 0; dmxArg a = dmxArgCreate(); if (!string) return a; a->argv = (const char **)xstrtokenize(string, ","); if (a->argv) for (i = 0; a->argv[i] != NULL; i++); a->argc = i; return a; } #if DMX_ARG_TEST static void dmxArgPrint(dmxArg a) { int i; printf(" argc = %d\n", dmxArgC(a)); for (i = 0; i < dmxArgC(a); i++) printf(" argv[%d] = \"%s\"\n", i, dmxArgV(a, i)); } static void dmxArgTest(const char *string) { dmxArg a; if (!string) printf("Testing NULL\n"); else if (!strlen(string)) printf("Testing (empty)\n"); else printf("Testing \"%s\"\n", string); a = dmxArgParse(string); dmxArgPrint(a); dmxArgFree(a); } int main(void) { dmxArgTest(NULL); dmxArgTest(""); dmxArgTest(","); dmxArgTest("a"); dmxArgTest("a,"); dmxArgTest(",a"); dmxArgTest("a,b"); dmxArgTest("a,b,"); dmxArgTest("a,b,,"); dmxArgTest("a,b,,c"); return 0; } #endif xorg-server-1.20.8/hw/dmx/input/usb-private.h0000644000175000017500000000661413640201473015774 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Private header file for USB support. This file provides * Linux-specific include files and the definition of the private * structure. \see usb-common.c \see usb-keyboard.c \see usb-mouse.c * \see usb-other.c */ #ifndef _USB_PRIVATE_H_ #define _USB_PRIVATE_H_ #include "dmxinputinit.h" #include "inputstr.h" #include #include #include #include "usb-common.h" /* Support for force feedback was * introduced in Linxu 2.4.10 */ #ifndef EV_MSC #define EV_MSC 0x04 #endif #ifndef EV_FF #define EV_FF 0x15 #endif #ifndef LED_SLEEP #define LED_SLEEP 0x05 #endif #ifndef LED_SUSPEND #define LED_SUSPEND 0x06 #endif #ifndef LED_MUTE #define LED_MUTE 0x07 #endif #ifndef LED_MISC #define LED_MISC 0x08 #endif #ifndef BTN_DEAD #define BTN_DEAD 0x12f #endif #ifndef BTN_THUMBL #define BTN_THUMBL 0x13d #endif #ifndef BTN_THUMBR #define BTN_THUMBR 0x13e #endif #ifndef MSC_SERIAL #define MSC_SERIAL 0x00 #endif #ifndef MSC_MAX #define MSC_MAX 0x07 #endif /* Support for older kernels. */ #ifndef ABS_WHEEL #define ABS_WHEEL 0x08 #endif #ifndef ABS_GAS #define ABS_GAS 0x09 #endif #ifndef ABS_BRAKE #define ABS_BRAKE 0x0a #endif #define NUM_STATE_ENTRIES (256/32) /* Private area for USB devices. */ typedef struct _myPrivate { DeviceIntPtr pDevice; /**< Device (mouse or other) */ int fd; /**< File descriptor */ unsigned char mask[EV_MAX / 8 + 1]; /**< Mask */ int numRel, numAbs, numLeds; /**< Counts */ int relmap[REL_CNT]; /**< Relative axis map */ int absmap[ABS_CNT]; /**< Absolute axis map */ CARD32 kbdState[NUM_STATE_ENTRIES]; /**< Keyboard state */ DeviceIntPtr pKeyboard; /** Keyboard device */ int pitch; /**< Bell pitch */ unsigned long duration; /**< Bell duration */ /* FIXME: dmxInput is never initialized */ DMXInputInfo *dmxInput; /**< For pretty-printing */ } myPrivate; #endif xorg-server-1.20.8/hw/dmx/input/usb-keyboard.c0000644000175000017500000004336113640201473016115 00000000000000/* Portions of this file were derived from the following files: * ********************************************************************** * * xfree86/common/xf86KbdLnx.c * * Linux version of keymapping setup. The kernel (since 0.99.14) has support * for fully remapping the keyboard, but there are some differences between * the Linux map and the SVR4 map (esp. in the extended keycodes). We also * remove the restriction on what keycodes can be remapped. * Orest Zborowski. * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * 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 Thomas Roell not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Thomas Roell makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THOMAS ROELL 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. * */ /* * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * * This code implements a low-level device driver for a USB keyboard * under Linux. The keymap description is derived from code by Thomas * Roell, Orest Zborowski. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "atKeynames.h" #include "usb-private.h" #define USB_KEYBOARD_DEBUG 0 /*****************************************************************************/ /* Define some macros to make it easier to move this file to another * part of the Xserver tree. All calls to the dmx* layer are #defined * here for the .c file. The .h file will also have to be edited. */ #include "usb-keyboard.h" #include #define GETPRIV myPrivate *priv \ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private #define LOG0(f) dmxLog(dmxDebug,f) #define LOG1(f,a) dmxLog(dmxDebug,f,a) #define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define FATAL0(f) dmxLog(dmxFatal,f) #define FATAL1(f,a) dmxLog(dmxFatal,f,a) #define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) #define MOTIONPROC dmxMotionProcPtr #define ENQUEUEPROC dmxEnqueueProcPtr #define CHECKPROC dmxCheckSpecialProcPtr #define BLOCK DMXBlockType /* End of interface definitions. */ /*****************************************************************************/ #define GLYPHS_PER_KEY 4 #define NUM_KEYCODES 248 #define MIN_KEYCODE 8 #define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { /* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 0x0f */ XK_Tab, XK_ISO_Left_Tab, NoSymbol, NoSymbol, /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 0x1b */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol, /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol, /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol, /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol, /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol, /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol, /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, }; static int kbdUSBKeyDown(myPrivate * priv, int keyCode) { CARD8 byte = keyCode >> 5; CARD32 bit = 1 << (keyCode & 0x1f); if (byte > NUM_STATE_ENTRIES) return 0; return priv->kbdState[byte] & bit; } static void kbdUSBKeyState(myPrivate * priv, int type, int keyCode) { CARD8 byte = keyCode >> 5; CARD32 bit = 1 << (keyCode & 0x1f); if (byte > NUM_STATE_ENTRIES) return; if (type == KeyPress) priv->kbdState[byte] |= bit; else priv->kbdState[byte] &= ~bit; } /** Set the LEDs. */ void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl) { GETPRIV; struct timeval tv; struct input_event event; int i, led; gettimeofday(&tv, NULL); for (i = 0; i < 5; i++) { event.time.tv_sec = tv.tv_sec; event.time.tv_usec = tv.tv_usec; event.type = EV_LED; if (i == 0) led = 1; /* LED_CAPSL == 0x01 */ else if (i == 1) led = 0; /* LED_NUML == 0x00 */ else led = i; event.code = led; event.value = ! !(ctrl->leds & (1 << led)); if (write(priv->fd, &event, sizeof(event)) != sizeof(event)) DebugF("Failed to set LEDs!\n"); } } /** Initialize \a pDev using #usbInit. */ void kbdUSBInit(DevicePtr pDev) { usbInit(pDev, usbKeyboard); } static void kbdUSBConvert(DevicePtr pDev, unsigned int scanCode, int value, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) { GETPRIV; XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; int type; int keyCode; KeySym keySym = NoSymbol; int switching; /* Set up xEvent information */ type = value ? KeyPress : KeyRelease; keyCode = (scanCode & 0xff) + MIN_KEYCODE; /* Handle repeats */ if (keyCode >= xkbi->desc->min_key_code && keyCode <= xkbi->desc->max_key_code) { int effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, scanCode); keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); #if 0 switch (keySym) { case XK_Num_Lock: case XK_Scroll_Lock: case XK_Shift_Lock: case XK_Caps_Lock: /* Ignore releases and all but first press */ if (kbdLinuxModIgnore(priv, &xE, keySym)) return; if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease; else xE.u.u.type = KeyPress; break; } #endif /* If key is already down, ignore or autorepeat */ if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) { KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed; /* No auto-repeat? */ if ((feed && !feed->ctrl.autoRepeat) || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode] || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3] & (1 << (keyCode & 7))))) return; /* Ignore */ /* Do auto-repeat */ enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block); type = KeyPress; } /* If key is already up, ignore */ if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) return; } switching = 0; if (checkspecial && type == KeyPress) switching = checkspecial(pDev, keySym); if (!switching) { if (enqueue) enqueue(pDev, type, keyCode, keySym, NULL, block); kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */ } } /** Read an event from the \a pDev device. If the event is a motion * event, enqueue it with the \a motion function. Otherwise, check for * special keys with the \a checkspecial function and enqueue the event * with the \a enqueue function. The \a block type is passed to the * functions so that they may block the input thread as appropriate to the * caller of this function. */ void kbdUSBRead(DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) { GETPRIV; struct input_event raw; while (read(priv->fd, &raw, sizeof(raw)) > 0) { #if USB_KEYBOARD_DEBUG LOG3("KBD: type = %d, code = 0x%02x, value = %d\n", raw.type, raw.code, raw.value); #endif kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block); } } /** Turn \a pDev on (i.e., take input from \a pDev). */ int kbdUSBOn(DevicePtr pDev) { GETPRIV; if (priv->fd < 0) kbdUSBInit(pDev); return priv->fd; } static void kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) { KeySym *k, *mapCopy; int i; mapCopy = malloc(sizeof(map)); memcpy(mapCopy, map, sizeof(map)); /* compute the modifier map */ for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = NoSymbol; /* make sure it is restored */ for (k = mapCopy, i = MIN_KEYCODE; i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) { switch (*k) { case XK_Shift_L: case XK_Shift_R: pModMap[i] = ShiftMask; break; case XK_Control_L: case XK_Control_R: pModMap[i] = ControlMask; break; case XK_Caps_Lock: pModMap[i] = LockMask; break; case XK_Alt_L: case XK_Alt_R: pModMap[i] = AltMask; break; case XK_Num_Lock: pModMap[i] = NumLockMask; break; case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break; case XK_Kana_Lock: case XK_Kana_Shift: pModMap[i] = KanaMask; break; case XK_Mode_switch: pModMap[i] = AltLangMask; break; } } pKeySyms->map = mapCopy; /* Must be XFree'able */ pKeySyms->mapWidth = GLYPHS_PER_KEY; pKeySyms->minKeyCode = MIN_KEYCODE; pKeySyms->maxKeyCode = MAX_KEYCODE; } /** Fill the \a info structure with information needed to initialize \a * pDev. */ void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { info->keyboard = 1; info->keyClass = 1; kbdUSBGetMap(pDev, &info->keySyms, info->modMap); info->focusClass = 1; info->kbdFeedbackClass = 1; info->names.keycodes = strdup("powerpcps2"); info->force = 1; } xorg-server-1.20.8/hw/dmx/input/usb-common.h0000644000175000017500000000355013640201473015606 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to common USB support. \see usb-common.c \see usb-mouse.c * \see usb-keyboard.c \see usb-other.c */ #ifndef _USB_COMMON_H_ #define _USB_COMMON_H_ typedef enum { usbMouse, usbKeyboard, usbOther } usbType; extern void *usbCreatePrivate(DeviceIntPtr pDevice); extern void usbDestroyPrivate(void *priv); extern void usbRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, int minButton, DMXBlockType block); extern void usbInit(DevicePtr pDev, usbType type); extern void usbOff(DevicePtr pDev); #endif xorg-server-1.20.8/hw/dmx/input/atKeynames.h0000644000175000017500000003420713640201473015633 00000000000000/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * 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 Thomas Roell not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Thomas Roell makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THOMAS ROELL 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. * */ /* * Copyright (c) 1994-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). */ #ifndef _ATKEYNAMES_H #define _ATKEYNAMES_H #define XK_TECHNICAL #define XK_KATAKANA #include #include #define GLYPHS_PER_KEY 4 #define NUM_KEYCODES 248 #define MIN_KEYCODE 8 #define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) #define AltMask Mod1Mask #define NumLockMask Mod2Mask #define AltLangMask Mod3Mask #define KanaMask Mod4Mask #define ScrollLockMask Mod5Mask /* * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) * sets of scancodes. Set3 can only be generated by a MF keyboard. * Set2 sends a makecode for keypress, and the same code prefixed by a * F0 for keyrelease. This is a little bit ugly to handle. Thus we use * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. * Bit 7 ist set if the key is released. The code E0 switches to a * different meaning to add the new MF cursorkeys, while not breaking old * applications. E1 is another special prefix. Since I assume that there * will be further versions of PC/XT scancode compatible keyboards, we * may be in trouble one day. * * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. * 2) Use the keyboards native set and translate it to common keysyms. */ /* * definition of the AT84/MF101/MF102 Keyboard: * ============================================================ * Defined Key Cap Glyphs Pressed value * Key Name Main Also (hex) (dec) * ---------------- ---------- ------- ------ ------ */ #define KEY_Escape /* Escape 0x01 */ 1 #define KEY_1 /* 1 ! 0x02 */ 2 #define KEY_2 /* 2 @ 0x03 */ 3 #define KEY_3 /* 3 # 0x04 */ 4 #define KEY_4 /* 4 $ 0x05 */ 5 #define KEY_5 /* 5 % 0x06 */ 6 #define KEY_6 /* 6 ^ 0x07 */ 7 #define KEY_7 /* 7 & 0x08 */ 8 #define KEY_8 /* 8 * 0x09 */ 9 #define KEY_9 /* 9 ( 0x0a */ 10 #define KEY_0 /* 0 ) 0x0b */ 11 #define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 #define KEY_Equal /* = (Equal) + 0x0d */ 13 #define KEY_BackSpace /* Back Space 0x0e */ 14 #define KEY_Tab /* Tab 0x0f */ 15 #define KEY_Q /* Q 0x10 */ 16 #define KEY_W /* W 0x11 */ 17 #define KEY_E /* E 0x12 */ 18 #define KEY_R /* R 0x13 */ 19 #define KEY_T /* T 0x14 */ 20 #define KEY_Y /* Y 0x15 */ 21 #define KEY_U /* U 0x16 */ 22 #define KEY_I /* I 0x17 */ 23 #define KEY_O /* O 0x18 */ 24 #define KEY_P /* P 0x19 */ 25 #define KEY_LBrace /* [ { 0x1a */ 26 #define KEY_RBrace /* ] } 0x1b */ 27 #define KEY_Enter /* Enter 0x1c */ 28 #define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 #define KEY_A /* A 0x1e */ 30 #define KEY_S /* S 0x1f */ 31 #define KEY_D /* D 0x20 */ 32 #define KEY_F /* F 0x21 */ 33 #define KEY_G /* G 0x22 */ 34 #define KEY_H /* H 0x23 */ 35 #define KEY_J /* J 0x24 */ 36 #define KEY_K /* K 0x25 */ 37 #define KEY_L /* L 0x26 */ 38 #define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 #define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 #define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 #define KEY_ShiftL /* Shift(left) 0x2a */ 42 #define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 #define KEY_Z /* Z 0x2c */ 44 #define KEY_X /* X 0x2d */ 45 #define KEY_C /* C 0x2e */ 46 #define KEY_V /* V 0x2f */ 47 #define KEY_B /* B 0x30 */ 48 #define KEY_N /* N 0x31 */ 49 #define KEY_M /* M 0x32 */ 50 #define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 #define KEY_Period /* . (Period) >(Greater)0x34 */ 52 #define KEY_Slash /* / (Slash) ? 0x35 */ 53 #define KEY_ShiftR /* Shift(right) 0x36 */ 54 #define KEY_KP_Multiply /* * 0x37 */ 55 #define KEY_Alt /* Alt(left) 0x38 */ 56 #define KEY_Space /* (SpaceBar) 0x39 */ 57 #define KEY_CapsLock /* CapsLock 0x3a */ 58 #define KEY_F1 /* F1 0x3b */ 59 #define KEY_F2 /* F2 0x3c */ 60 #define KEY_F3 /* F3 0x3d */ 61 #define KEY_F4 /* F4 0x3e */ 62 #define KEY_F5 /* F5 0x3f */ 63 #define KEY_F6 /* F6 0x40 */ 64 #define KEY_F7 /* F7 0x41 */ 65 #define KEY_F8 /* F8 0x42 */ 66 #define KEY_F9 /* F9 0x43 */ 67 #define KEY_F10 /* F10 0x44 */ 68 #define KEY_NumLock /* NumLock 0x45 */ 69 #define KEY_ScrollLock /* ScrollLock 0x46 */ 70 #define KEY_KP_7 /* 7 Home 0x47 */ 71 #define KEY_KP_8 /* 8 Up 0x48 */ 72 #define KEY_KP_9 /* 9 PgUp 0x49 */ 73 #define KEY_KP_Minus /* - (Minus) 0x4a */ 74 #define KEY_KP_4 /* 4 Left 0x4b */ 75 #define KEY_KP_5 /* 5 0x4c */ 76 #define KEY_KP_6 /* 6 Right 0x4d */ 77 #define KEY_KP_Plus /* + (Plus) 0x4e */ 78 #define KEY_KP_1 /* 1 End 0x4f */ 79 #define KEY_KP_2 /* 2 Down 0x50 */ 80 #define KEY_KP_3 /* 3 PgDown 0x51 */ 81 #define KEY_KP_0 /* 0 Insert 0x52 */ 82 #define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 #define KEY_SysReqest /* SysReqest 0x54 */ 84 /* NOTUSED 0x55 */ #define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 #define KEY_F11 /* F11 0x57 */ 87 #define KEY_F12 /* F12 0x58 */ 88 #define KEY_Prefix0 /* special 0x60 */ 96 #define KEY_Prefix1 /* specail 0x61 */ 97 /* * The 'scancodes' below are generated by the server, because the MF101/102 * keyboard sends them as sequence of other scancodes */ #define KEY_Home /* Home 0x59 */ 89 #define KEY_Up /* Up 0x5a */ 90 #define KEY_PgUp /* PgUp 0x5b */ 91 #define KEY_Left /* Left 0x5c */ 92 #define KEY_Begin /* Begin 0x5d */ 93 #define KEY_Right /* Right 0x5e */ 94 #define KEY_End /* End 0x5f */ 95 #define KEY_Down /* Down 0x60 */ 96 #define KEY_PgDown /* PgDown 0x61 */ 97 #define KEY_Insert /* Insert 0x62 */ 98 #define KEY_Delete /* Delete 0x63 */ 99 #define KEY_KP_Enter /* Enter 0x64 */ 100 #define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 #define KEY_Pause /* Pause 0x66 */ 102 #define KEY_Print /* Print 0x67 */ 103 #define KEY_KP_Divide /* Divide 0x68 */ 104 #define KEY_AltLang /* AtlLang(right) 0x69 */ 105 #define KEY_Break /* Break 0x6a */ 106 #define KEY_LMeta /* Left Meta 0x6b */ 107 #define KEY_RMeta /* Right Meta 0x6c */ 108 #define KEY_Menu /* Menu 0x6d */ 109 #define KEY_F13 /* F13 0x6e */ 110 #define KEY_F14 /* F14 0x6f */ 111 #define KEY_F15 /* F15 0x70 */ 112 #define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112 #define KEY_F16 /* F16 0x71 */ 113 #define KEY_F17 /* F17 0x72 */ 114 #define KEY_KP_DEC /* KP_DEC 0x73 */ 115 #define KEY_BSlash2 /* \ _ 0x73 */ 115 #define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 #define KEY_XFER /* Kanji Transfer 0x79 */ 121 #define KEY_NFER /* No Kanji Transfer 0x7b */ 123 #define KEY_Yen /* Yen 0x7d */ 125 #define KEY_Power /* Power Key 0x84 */ 132 #define KEY_Mute /* Audio Mute 0x85 */ 133 #define KEY_AudioLower /* Audio Lower 0x86 */ 134 #define KEY_AudioRaise /* Audio Raise 0x87 */ 135 #define KEY_Help /* Help 0x88 */ 136 #define KEY_L1 /* Stop 0x89 */ 137 #define KEY_L2 /* Again 0x8a */ 138 #define KEY_L3 /* Props 0x8b */ 139 #define KEY_L4 /* Undo 0x8c */ 140 #define KEY_L5 /* Front 0x8d */ 141 #define KEY_L6 /* Copy 0x8e */ 142 #define KEY_L7 /* Open 0x8f */ 143 #define KEY_L8 /* Paste 0x90 */ 144 #define KEY_L9 /* Find 0x91 */ 145 #define KEY_L10 /* Cut 0x92 */ 146 /* * Fake 'scancodes' in the following ranges are generated for 2-byte * codes not handled elsewhere. These correspond to most extended keys * on so-called "Internet" keyboards: * * 0x79-0x93 * 0x96-0xa1 * 0xa3-0xac * 0xb1-0xb4 * 0xba-0xbd * 0xc2 * 0xcc-0xd2 * 0xd6-0xf7 */ /* * Remapped 'scancodes' are generated for single-byte codes in the range * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards. */ #define KEY_0x59 0x95 #define KEY_0x5A 0xA2 #define KEY_0x5B 0xAD #define KEY_0x5C KEY_KP_EQUAL #define KEY_0x5D 0xAE #define KEY_0x5E 0xAF #define KEY_0x5F 0xB0 #define KEY_0x62 0xB5 #define KEY_0x63 0xB6 #define KEY_0x64 0xB7 #define KEY_0x65 0xB8 #define KEY_0x66 0xB9 #define KEY_0x67 0xBE #define KEY_0x68 0xBF #define KEY_0x69 0xC0 #define KEY_0x6A 0xC1 #define KEY_0x6B 0xC3 #define KEY_0x6C 0xC4 #define KEY_0x6D 0xC5 #define KEY_0x6E 0xC6 #define KEY_0x6F 0xC7 #define KEY_0x70 0xC8 #define KEY_0x71 0xC9 #define KEY_0x72 0xCA #define KEY_0x73 0xCB #define KEY_0x74 0xD3 #define KEY_0x75 0xD4 #define KEY_0x76 0xD5 /* These are for "notused" and "unknown" entries in translation maps. */ #define KEY_NOTUSED 0 #define KEY_UNKNOWN 255 #endif /* _ATKEYNAMES_H */ xorg-server-1.20.8/hw/dmx/input/usb-mouse.c0000644000175000017500000000757413640201473015453 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * * This code implements a low-level device driver for a USB mouse. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "usb-private.h" /*****************************************************************************/ /* Define some macros to make it easier to move this file to another * part of the Xserver tree. All calls to the dmx* layer are #defined * here for the .c file. The .h file will also have to be edited. */ #include "usb-mouse.h" #define GETPRIV myPrivate *priv \ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private #define LOG0(f) dmxLog(dmxDebug,f) #define LOG1(f,a) dmxLog(dmxDebug,f,a) #define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) #define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) #define FATAL0(f) dmxLog(dmxFatal,f) #define FATAL1(f,a) dmxLog(dmxFatal,f,a) #define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) #define MOTIONPROC dmxMotionProcPtr #define ENQUEUEPROC dmxEnqueueProcPtr #define CHECKPROC dmxCheckSpecialProcPtr #define BLOCK DMXBlockType /* End of interface definitions. */ /*****************************************************************************/ /** Read the USB device using #usbRead. */ void mouUSBRead(DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) { usbRead(pDev, motion, enqueue, BTN_MISC, block); } /** Initialize \a pDev using #usbInit. */ void mouUSBInit(DevicePtr pDev) { usbInit(pDev, usbMouse); } /** Turn \a pDev on (i.e., take input from \a pDev). */ int mouUSBOn(DevicePtr pDev) { GETPRIV; if (priv->fd < 0) mouUSBInit(pDev); return priv->fd; } static void mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) { int i; if (nButtons) *nButtons = 5; if (map) for (i = 0; i <= *nButtons; i++) map[i] = i; } /** Fill the \a info structure with information needed to initialize \a * pDev. */ void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { static KeySym keyboard_mapping = NoSymbol; info->buttonClass = 1; mouUSBGetMap(pDev, info->map, &info->numButtons); info->valuatorClass = 1; info->numRelAxes = 2; info->minval[0] = 0; info->maxval[0] = 0; info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; info->ptrFeedbackClass = 1; /* Some USB mice devices return key * events from their pair'd * keyboard... */ info->keyClass = 1; info->keySyms.minKeyCode = 8; info->keySyms.maxKeyCode = 8; info->keySyms.mapWidth = 1; info->keySyms.map = &keyboard_mapping; } xorg-server-1.20.8/hw/dmx/input/dmxinputinit.c0000644000175000017500000012320313640201473016254 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * This file provides generic input support. Functions here set up * input and lead to the calling of low-level device drivers for * input. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #define DMX_WINDOW_DEBUG 0 #include "dmxinputinit.h" #include "dmxextension.h" /* For dmxInputCount */ #include "dmxdummy.h" #include "dmxbackend.h" #include "dmxconsole.h" #include "dmxcommon.h" #include "dmxevents.h" #include "dmxmotion.h" #include "dmxprop.h" #include "config/dmxconfig.h" #include "dmxcursor.h" #include "usb-keyboard.h" #include "usb-mouse.h" #include "usb-other.h" #include "usb-common.h" #include "dmxarg.h" #include "inputstr.h" #include "input.h" #include "mipointer.h" #include "windowstr.h" #include "mi.h" #include "xkbsrv.h" #include #include #include "exevents.h" #include "extinit.h" DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; static DMXLocalInputInfoRec DMXDummyMou = { "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo }; static DMXLocalInputInfoRec DMXDummyKbd = { "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo }; static DMXLocalInputInfoRec DMXBackendMou = { "backend-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_BACKEND, 2, dmxBackendCreatePrivate, dmxBackendDestroyPrivate, dmxBackendInit, NULL, dmxBackendLateReInit, dmxBackendMouGetInfo, dmxCommonMouOn, dmxCommonMouOff, dmxBackendUpdatePosition, NULL, NULL, NULL, dmxBackendCollectEvents, dmxBackendProcessInput, dmxBackendFunctions, NULL, dmxCommonMouCtrl }; static DMXLocalInputInfoRec DMXBackendKbd = { "backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND, 1, /* With backend-mou or console-mou */ dmxCommonCopyPrivate, NULL, dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo, dmxCommonKbdOn, dmxCommonKbdOff, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, dmxCommonKbdCtrl, dmxCommonKbdBell }; static DMXLocalInputInfoRec DMXConsoleMou = { "console-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, 2, dmxConsoleCreatePrivate, dmxConsoleDestroyPrivate, dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleMouGetInfo, dmxCommonMouOn, dmxCommonMouOff, dmxConsoleUpdatePosition, NULL, NULL, NULL, dmxConsoleCollectEvents, NULL, dmxConsoleFunctions, dmxConsoleUpdateInfo, dmxCommonMouCtrl }; static DMXLocalInputInfoRec DMXConsoleKbd = { "console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE, 1, /* With backend-mou or console-mou */ dmxCommonCopyPrivate, NULL, dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo, dmxCommonKbdOn, dmxCommonKbdOff, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, dmxCommonKbdCtrl, dmxCommonKbdBell }; static DMXLocalInputInfoRec DMXLocalDevices[] = { /* Dummy drivers that can compile on any OS */ #ifdef __linux__ /* USB drivers, currently only for Linux, but relatively easy to port to other OSs */ { "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, usbCreatePrivate, usbDestroyPrivate, kbdUSBInit, NULL, NULL, kbdUSBGetInfo, kbdUSBOn, usbOff, NULL, NULL, NULL, NULL, kbdUSBRead, NULL, NULL, NULL, NULL, kbdUSBCtrl}, { "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, usbCreatePrivate, usbDestroyPrivate, mouUSBInit, NULL, NULL, mouUSBGetInfo, mouUSBOn, usbOff, NULL, NULL, NULL, NULL, mouUSBRead}, { "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1, usbCreatePrivate, usbDestroyPrivate, othUSBInit, NULL, NULL, othUSBGetInfo, othUSBOn, usbOff, NULL, NULL, NULL, NULL, othUSBRead}, #endif { "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo}, { "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo}, {NULL} /* Must be last */ }; #if 11 /*BP*/ void DDXRingBell(int volume, int pitch, int duration) { /* NO-OP */ } /* taken from kdrive/src/kinput.c: */ static void dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl) { #if 0 KdKeyboardInfo *ki; for (ki = kdKeyboards; ki; ki = ki->next) { if (ki->dixdev && ki->dixdev->id == pDevice->id) break; } if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) return; KdSetLeds(ki, ctrl->leds); ki->bellPitch = ctrl->bell_pitch; ki->bellDuration = ctrl->bell_duration; #endif } /* taken from kdrive/src/kinput.c: */ static void dmxBell(int volume, DeviceIntPtr pDev, void *arg, int something) { #if 0 KeybdCtrl *ctrl = arg; KdKeyboardInfo *ki = NULL; for (ki = kdKeyboards; ki; ki = ki->next) { if (ki->dixdev && ki->dixdev->id == pDev->id) break; } if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) return; KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); #endif } #endif /*BP*/ static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl * ctrl) { if (!dmxLocal) return; dmxLocal->mctrl = *ctrl; if (dmxLocal->mCtrl) dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl); } /** Change the pointer control information for the \a pDevice. If the * device sends core events, then also change the control information * for all of the pointer devices that send core events. */ void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl) { GETDMXLOCALFROMPDEVICE; int i, j; if (dmxLocal->sendsCore) { /* Do for all core devices */ for (i = 0; i < dmxNumInputs; i++) { DMXInputInfo *dmxInput = &dmxInputs[i]; if (dmxInput->detached) continue; for (j = 0; j < dmxInput->numDevs; j++) if (dmxInput->devs[j]->sendsCore) _dmxChangePointerControl(dmxInput->devs[j], ctrl); } } else { /* Do for this device only */ _dmxChangePointerControl(dmxLocal, ctrl); } } static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, KeybdCtrl * ctrl) { dmxLocal->kctrl = *ctrl; if (dmxLocal->kCtrl) { dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl); if (dmxLocal->pDevice->kbdfeed) { XkbEventCauseRec cause; XkbSetCauseUnknown(&cause); /* Generate XKB events, as necessary */ XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False, NULL, &cause); } } } /** Change the keyboard control information for the \a pDevice. If the * device sends core events, then also change the control information * for all of the keyboard devices that send core events. */ void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl) { GETDMXLOCALFROMPDEVICE; int i, j; if (dmxLocal->sendsCore) { /* Do for all core devices */ for (i = 0; i < dmxNumInputs; i++) { DMXInputInfo *dmxInput = &dmxInputs[i]; if (dmxInput->detached) continue; for (j = 0; j < dmxInput->numDevs; j++) if (dmxInput->devs[j]->sendsCore) _dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl); } } else { /* Do for this device only */ _dmxKeyboardKbdCtrlProc(dmxLocal, ctrl); } } static void _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent) { if (dmxLocal->kBell) dmxLocal->kBell(&dmxLocal->pDevice->public, percent, dmxLocal->kctrl.bell, dmxLocal->kctrl.bell_pitch, dmxLocal->kctrl.bell_duration); } /** Sound the bell on the device. If the device send core events, then * sound the bell on all of the devices that send core events. */ void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, void *ctrl, int unknown) { GETDMXLOCALFROMPDEVICE; int i, j; if (dmxLocal->sendsCore) { /* Do for all core devices */ for (i = 0; i < dmxNumInputs; i++) { DMXInputInfo *dmxInput = &dmxInputs[i]; if (dmxInput->detached) continue; for (j = 0; j < dmxInput->numDevs; j++) if (dmxInput->devs[j]->sendsCore) _dmxKeyboardBellProc(dmxInput->devs[j], percent); } } else { /* Do for this device only */ _dmxKeyboardBellProc(dmxLocal, percent); } } static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) { if (names->keycodes) XFree(names->keycodes); if (names->types) XFree(names->types); if (names->compat) XFree(names->compat); if (names->symbols) XFree(names->symbols); if (names->geometry) XFree(names->geometry); } static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo * info) { GETDMXINPUTFROMPDEVICE; XkbRMLVOSet rmlvo; rmlvo.rules = dmxConfigGetXkbRules(); rmlvo.model = dmxConfigGetXkbModel(); rmlvo.layout = dmxConfigGetXkbLayout(); rmlvo.variant = dmxConfigGetXkbVariant(); rmlvo.options = dmxConfigGetXkbOptions(); XkbSetRulesDflts(&rmlvo); if (!info->force && (dmxInput->keycodes || dmxInput->symbols || dmxInput->geometry)) { if (info->freenames) dmxKeyboardFreeNames(&info->names); info->freenames = 0; info->names.keycodes = dmxInput->keycodes; info->names.types = NULL; info->names.compat = NULL; info->names.symbols = dmxInput->symbols; info->names.geometry = dmxInput->geometry; dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", info->names.keycodes); if (info->names.symbols && *info->names.symbols) dmxLogInputCont(dmxInput, " %s", info->names.symbols); if (info->names.geometry && *info->names.geometry) dmxLogInputCont(dmxInput, " %s", info->names.geometry); dmxLogInputCont(dmxInput, "\n"); } else if (info->names.keycodes) { dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", info->names.keycodes); if (info->names.symbols && *info->names.symbols) dmxLogInputCont(dmxInput, " %s", info->names.symbols); if (info->names.geometry && *info->names.geometry) dmxLogInputCont(dmxInput, " %s", info->names.geometry); dmxLogInputCont(dmxInput, "\n"); } else { dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", dmxConfigGetXkbRules(), dmxConfigGetXkbLayout(), dmxConfigGetXkbModel(), dmxConfigGetXkbVariant() ? dmxConfigGetXkbVariant() : "", dmxConfigGetXkbOptions() ? dmxConfigGetXkbOptions() : ""); } InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxKeyboardBellProc, dmxKeyboardKbdCtrlProc); if (info->freenames) dmxKeyboardFreeNames(&info->names); return Success; } static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) { GETDMXINPUTFROMPDEVICE; DMXLocalInitInfo info; int i; Atom btn_labels[MAX_BUTTONS] = { 0 }; /* FIXME */ Atom axis_labels[MAX_VALUATORS] = { 0 }; /* FIXME */ if (dmxInput->detached) return Success; memset(&info, 0, sizeof(info)); switch (what) { case DEVICE_INIT: if (dmxLocal->init) dmxLocal->init(pDev); if (dmxLocal->get_info) dmxLocal->get_info(pDev, &info); if (info.keyboard) { /* XKEYBOARD makes this a special case */ dmxKeyboardOn(pDevice, &info); break; } if (info.keyClass) { XkbRMLVOSet rmlvo; rmlvo.rules = dmxConfigGetXkbRules(); rmlvo.model = dmxConfigGetXkbModel(); rmlvo.layout = dmxConfigGetXkbLayout(); rmlvo.variant = dmxConfigGetXkbVariant(); rmlvo.options = dmxConfigGetXkbOptions(); InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxBell, dmxKbdCtrl); } if (info.buttonClass) { InitButtonClassDeviceStruct(pDevice, info.numButtons, btn_labels, info.map); } if (info.valuatorClass) { if (info.numRelAxes && dmxLocal->sendsCore) { InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, axis_labels, GetMaximumEventsNum(), Relative); for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, axis_labels[i], info.minval[i], info.maxval[i], info.res[i], info.minres[i], info.maxres[i], Relative); } else if (info.numRelAxes) { InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, axis_labels, dmxPointerGetMotionBufferSize(), Relative); for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, axis_labels[i], info.minval[i], info.maxval[i], info.res[i], info.minres[i], info.maxres[i], Relative); } else if (info.numAbsAxes) { InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes, axis_labels, dmxPointerGetMotionBufferSize(), Absolute); for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i, axis_labels[i], info.minval[i], info.maxval[i], info.res[i], info.minres[i], info.maxres[i], Absolute); } } if (info.focusClass) InitFocusClassDeviceStruct(pDevice); if (info.proximityClass) InitProximityClassDeviceStruct(pDevice); if (info.ptrFeedbackClass) InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl); if (info.intFeedbackClass || info.strFeedbackClass) dmxLog(dmxWarning, "Integer and string feedback not supported for %s\n", pDevice->name); if (!info.keyboard && (info.ledFeedbackClass || info.belFeedbackClass)) dmxLog(dmxWarning, "Led and bel feedback not supported for non-keyboard %s\n", pDevice->name); break; case DEVICE_ON: if (!pDev->on) { if (dmxLocal->on) dmxLocal->on(pDev); pDev->on = TRUE; } break; case DEVICE_OFF: case DEVICE_CLOSE: /* This can get called twice consecutively: once for a * detached screen (DEVICE_OFF), and then again at server * generation time (DEVICE_CLOSE). */ if (pDev->on) { if (dmxLocal->off) dmxLocal->off(pDev); pDev->on = FALSE; } break; } if (info.keySyms.map && info.freemap) { XFree(info.keySyms.map); info.keySyms.map = NULL; } if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True); return Success; } static void dmxProcessInputEvents(DMXInputInfo * dmxInput) { int i; mieqProcessInputEvents(); #if 00 /*BP*/ miPointerUpdate(); #endif if (dmxInput->detached) return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->process_input) { dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); } #if 11 /*BP*/ mieqProcessInputEvents(); #endif } static void dmxUpdateWindowInformation(DMXInputInfo * dmxInput, DMXUpdateType type, WindowPtr pWindow) { int i; #ifdef PANORAMIX if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root) return; #endif #if DMX_WINDOW_DEBUG { const char *name = "Unknown"; switch (type) { case DMX_UPDATE_REALIZE: name = "Realize"; break; case DMX_UPDATE_UNREALIZE: name = "Unrealize"; break; case DMX_UPDATE_RESTACK: name = "Restack"; break; case DMX_UPDATE_COPY: name = "Copy"; break; case DMX_UPDATE_RESIZE: name = "Resize"; break; case DMX_UPDATE_REPARENT: name = "Repaint"; break; } dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name); } #endif if (dmxInput->detached) return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->update_info) dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, type, pWindow); } static void dmxCollectAll(DMXInputInfo * dmxInput) { int i; if (dmxInput->detached) return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->collect_events) dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice-> public, dmxMotion, dmxEnqueue, dmxCheckSpecialKeys, DMX_BLOCK); } static void dmxBlockHandler(void *blockData, void *timeout) { DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; static unsigned long generation = 0; if (generation != serverGeneration) { generation = serverGeneration; dmxCollectAll(dmxInput); } } static void dmxSwitchReturn(void *p) { DMXInputInfo *dmxInput = p; int i; dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched); if (!dmxInput->vt_switched) dmxLog(dmxFatal, "dmxSwitchReturn called, but not switched\n"); for (i = 0; i < dmxInput->numDevs; i++) if (dmxInput->devs[i]->vt_post_switch) dmxInput->devs[i]->vt_post_switch(dmxInput->devs[i]->private); dmxInput->vt_switched = 0; } static void dmxWakeupHandler(void *blockData, int result) { DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; int i; if (dmxInput->vt_switch_pending) { dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending); for (i = 0; i < dmxInput->numDevs; i++) if (dmxInput->devs[i]->vt_pre_switch) dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private); dmxInput->vt_switched = dmxInput->vt_switch_pending; dmxInput->vt_switch_pending = 0; for (i = 0; i < dmxInput->numDevs; i++) { if (dmxInput->devs[i]->vt_switch) { if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private, dmxInput->vt_switched, dmxSwitchReturn, dmxInput)) dmxSwitchReturn(dmxInput); break; /* Only call one vt_switch routine */ } } } dmxCollectAll(dmxInput); } static char * dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal) { static int k = 0; static int m = 0; static int o = 0; static unsigned long dmxGeneration = 0; #define LEN 32 char *buf = malloc(LEN); if (dmxGeneration != serverGeneration) { k = m = o = 0; dmxGeneration = serverGeneration; } switch (dmxLocal->type) { case DMX_LOCAL_KEYBOARD: snprintf(buf, LEN, "Keyboard%d", k++); break; case DMX_LOCAL_MOUSE: snprintf(buf, LEN, "Mouse%d", m++); break; default: snprintf(buf, LEN, "Other%d", o++); break; } return buf; } static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) { DeviceIntPtr pDevice; Atom atom; const char *name = NULL; char *devname; DMXInputInfo *dmxInput; if (!dmxLocal) return NULL; dmxInput = &dmxInputs[dmxLocal->inputIdx]; if (dmxLocal->sendsCore) { if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) { dmxLocal->isCore = 1; dmxLocalCoreKeyboard = dmxLocal; name = "keyboard"; } if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) { dmxLocal->isCore = 1; dmxLocalCorePointer = dmxLocal; name = "pointer"; } } if (!name) { name = "extension"; } if (!name) dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name); pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE); if (!pDevice) { dmxLog(dmxError, "Too many devices -- cannot add device %s\n", dmxLocal->name); return NULL; } pDevice->public.devicePrivate = dmxLocal; dmxLocal->pDevice = pDevice; devname = dmxMakeUniqueDeviceName(dmxLocal); atom = MakeAtom((char *) devname, strlen(devname), TRUE); pDevice->type = atom; pDevice->name = devname; if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { #if 00 /*BP*/ miRegisterPointerDevice(screenInfo.screens[0], pDevice); #else /* Nothing? dmxDeviceOnOff() should get called to init, right? */ #endif } if (dmxLocal->create_private) dmxLocal->private = dmxLocal->create_private(pDevice); dmxLogInput(dmxInput, "Added %s as %s device called %s%s\n", dmxLocal->name, name, devname, dmxLocal->isCore ? " [core]" : (dmxLocal->sendsCore ? " [sends core events]" : "")); return pDevice; } static DMXLocalInputInfoPtr dmxLookupLocal(const char *name) { DMXLocalInputInfoPtr pt; for (pt = &DMXLocalDevices[0]; pt->name; ++pt) if (!strcmp(pt->name, name)) return pt; /* search for device name */ return NULL; } /** Copy the local input information from \a s into a new \a devs slot * in \a dmxInput. */ DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s) { DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal)); if (!dmxLocal) dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n"); memcpy(dmxLocal, s, sizeof(*dmxLocal)); dmxLocal->inputIdx = dmxInput->inputIdx; dmxLocal->sendsCore = dmxInput->core; dmxLocal->savedSendsCore = dmxInput->core; dmxLocal->deviceId = -1; ++dmxInput->numDevs; dmxInput->devs = reallocarray(dmxInput->devs, dmxInput->numDevs, sizeof(*dmxInput->devs)); dmxInput->devs[dmxInput->numDevs - 1] = dmxLocal; return dmxLocal; } static void dmxPopulateLocal(DMXInputInfo * dmxInput, dmxArg a) { int i; int help = 0; DMXLocalInputInfoRec *pt; for (i = 1; i < dmxArgC(a); i++) { const char *name = dmxArgV(a, i); if ((pt = dmxLookupLocal(name))) { dmxInputCopyLocal(dmxInput, pt); } else { if (strlen(name)) dmxLog(dmxWarning, "Could not find a driver called %s\n", name); ++help; } } if (help) { dmxLog(dmxInfo, "Available local device drivers:\n"); for (pt = &DMXLocalDevices[0]; pt->name; ++pt) { const char *type; switch (pt->type) { case DMX_LOCAL_KEYBOARD: type = "keyboard"; break; case DMX_LOCAL_MOUSE: type = "pointer"; break; default: type = "unknown"; break; } dmxLog(dmxInfo, " %s (%s)\n", pt->name, type); } dmxLog(dmxFatal, "Must have valid local device driver\n"); } } int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, _Xconst char *reason) { return 0; } static void dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI) { XExtensionVersion *ext; XDeviceInfo *devices; Display *dsp; int num; int i, j; XextErrorHandler handler; if (!(dsp = XOpenDisplay(dmxInput->name))) return; /* Print out information about the XInput Extension. */ handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); ext = XGetExtensionVersion(dsp, INAME); XSetExtensionErrorHandler(handler); if (!ext || ext == (XExtensionVersion *) NoSuchExtension) { dmxLogInput(dmxInput, "%s is not available\n", INAME); } else { dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n", dmxInput->name, INAME, ext->major_version, ext->minor_version); devices = XListInputDevices(dsp, &num); XFree(ext); ext = NULL; /* Print a list of all devices */ for (i = 0; i < num; i++) { const char *use = "Unknown"; switch (devices[i].use) { case IsXPointer: use = "XPointer"; break; case IsXKeyboard: use = "XKeyboard"; break; case IsXExtensionDevice: use = "XExtensionDevice"; break; case IsXExtensionPointer: use = "XExtensionPointer"; break; case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break; } dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n", (int) devices[i].id, devices[i].name ? devices[i].name : "", use); } /* Search for extensions */ for (i = 0; i < num; i++) { switch (devices[i].use) { case IsXKeyboard: for (j = 0; j < dmxInput->numDevs; j++) { DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; if (dmxL->type == DMX_LOCAL_KEYBOARD && dmxL->deviceId < 0) { dmxL->deviceId = devices[i].id; dmxL->deviceName = (devices[i].name ? strdup(devices[i].name) : NULL); } } break; case IsXPointer: for (j = 0; j < dmxInput->numDevs; j++) { DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) { dmxL->deviceId = devices[i].id; dmxL->deviceName = (devices[i].name ? xstrdup(devices[i].name) : NULL); } } break; } } XFreeDeviceList(devices); } XCloseDisplay(dsp); } /** Re-initialize all the devices described in \a dmxInput. Called from #dmxAdjustCursorBoundaries before the cursor is redisplayed. */ void dmxInputReInit(DMXInputInfo * dmxInput) { int i; for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; if (dmxLocal->reinit) dmxLocal->reinit(&dmxLocal->pDevice->public); } } /** Re-initialize all the devices described in \a dmxInput. Called from #dmxAdjustCursorBoundaries after the cursor is redisplayed. */ void dmxInputLateReInit(DMXInputInfo * dmxInput) { int i; for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; if (dmxLocal->latereinit) dmxLocal->latereinit(&dmxLocal->pDevice->public); } } /** Initialize all of the devices described in \a dmxInput. */ void dmxInputInit(DMXInputInfo * dmxInput) { dmxArg a; const char *name; int i; int doXI = 1; /* Include by default */ int forceConsole = 0; int doWindows = 1; /* On by default */ int hasXkb = 0; a = dmxArgParse(dmxInput->name); name = dmxArgV(a, 0); if (!strcmp(name, "local")) { dmxPopulateLocal(dmxInput, a); } else if (!strcmp(name, "dummy")) { dmxInputCopyLocal(dmxInput, &DMXDummyMou); dmxInputCopyLocal(dmxInput, &DMXDummyKbd); dmxLogInput(dmxInput, "Using dummy input\n"); } else { int found; for (i = 1; i < dmxArgC(a); i++) { switch (hasXkb) { case 1: dmxInput->keycodes = xstrdup(dmxArgV(a, i)); ++hasXkb; break; case 2: dmxInput->symbols = xstrdup(dmxArgV(a, i)); ++hasXkb; break; case 3: dmxInput->geometry = xstrdup(dmxArgV(a, i)); hasXkb = 0; break; case 0: if (!strcmp(dmxArgV(a, i), "noxi")) doXI = 0; else if (!strcmp(dmxArgV(a, i), "xi")) doXI = 1; else if (!strcmp(dmxArgV(a, i), "console")) forceConsole = 1; else if (!strcmp(dmxArgV(a, i), "noconsole")) forceConsole = 0; else if (!strcmp(dmxArgV(a, i), "windows")) doWindows = 1; else if (!strcmp(dmxArgV(a, i), "nowindows")) doWindows = 0; else if (!strcmp(dmxArgV(a, i), "xkb")) hasXkb = 1; else { dmxLog(dmxFatal, "Unknown input argument: %s\n", dmxArgV(a, i)); } } } for (found = 0, i = 0; i < dmxNumScreens; i++) { if (dmxPropertySameDisplay(&dmxScreens[i], name)) { if (dmxScreens[i].shared) dmxLog(dmxFatal, "Cannot take input from shared backend (%s)\n", name); if (!dmxInput->core) { dmxLog(dmxWarning, "Cannot use core devices on a backend (%s)" " as XInput devices\n", name); } else { char *pt; for (pt = (char *) dmxInput->name; pt && *pt; pt++) if (*pt == ',') *pt = '\0'; dmxInputCopyLocal(dmxInput, &DMXBackendMou); dmxInputCopyLocal(dmxInput, &DMXBackendKbd); dmxInput->scrnIdx = i; dmxLogInput(dmxInput, "Using backend input from %s\n", name); } ++found; break; } } if (!found || forceConsole) { char *pt; if (found) dmxInput->console = TRUE; for (pt = (char *) dmxInput->name; pt && *pt; pt++) if (*pt == ',') *pt = '\0'; dmxInputCopyLocal(dmxInput, &DMXConsoleMou); dmxInputCopyLocal(dmxInput, &DMXConsoleKbd); if (doWindows) { dmxInput->windows = TRUE; dmxInput->updateWindowInfo = dmxUpdateWindowInformation; } dmxLogInput(dmxInput, "Using console input from %s (%s windows)\n", name, doWindows ? "with" : "without"); } } dmxArgFree(a); /* Locate extensions we may be interested in */ dmxInputScanForExtensions(dmxInput, doXI); for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; dmxLocal->pDevice = dmxAddDevice(dmxLocal); } dmxInput->processInputEvents = dmxProcessInputEvents; dmxInput->detached = False; RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler, (void *) (uintptr_t) dmxInput->inputIdx); } static void dmxInputFreeLocal(DMXLocalInputInfoRec * local) { if (!local) return; if (local->isCore && local->type == DMX_LOCAL_MOUSE) dmxLocalCorePointer = NULL; if (local->isCore && local->type == DMX_LOCAL_KEYBOARD) dmxLocalCoreKeyboard = NULL; if (local->destroy_private) local->destroy_private(local->private); free(local->history); free(local->valuators); free((void *) local->deviceName); local->private = NULL; local->history = NULL; local->deviceName = NULL; free(local); } /** Free all of the memory associated with \a dmxInput */ void dmxInputFree(DMXInputInfo * dmxInput) { int i; if (!dmxInput) return; free(dmxInput->keycodes); free(dmxInput->symbols); free(dmxInput->geometry); for (i = 0; i < dmxInput->numDevs; i++) { dmxInputFreeLocal(dmxInput->devs[i]); dmxInput->devs[i] = NULL; } free(dmxInput->devs); dmxInput->devs = NULL; dmxInput->numDevs = 0; if (dmxInput->freename) free((void *) dmxInput->name); dmxInput->name = NULL; } /** Log information about all of the known devices using #dmxLog(). */ void dmxInputLogDevices(void) { int i, j; dmxLog(dmxInfo, "%d devices:\n", dmxGetInputCount()); dmxLog(dmxInfo, " Id Name Classes\n"); for (j = 0; j < dmxNumInputs; j++) { DMXInputInfo *dmxInput = &dmxInputs[j]; const char *pt = strchr(dmxInput->name, ','); int len = (pt ? (size_t) (pt - dmxInput->name) : strlen(dmxInput->name)); for (i = 0; i < dmxInput->numDevs; i++) { DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice; if (pDevice) { dmxLog(dmxInfo, " %2d%c %-20.20s", pDevice->id, dmxInput->detached ? 'D' : ' ', pDevice->name); if (pDevice->key) dmxLogCont(dmxInfo, " key"); if (pDevice->valuator) dmxLogCont(dmxInfo, " val"); if (pDevice->button) dmxLogCont(dmxInfo, " btn"); if (pDevice->focus) dmxLogCont(dmxInfo, " foc"); if (pDevice->kbdfeed) dmxLogCont(dmxInfo, " fb/kbd"); if (pDevice->ptrfeed) dmxLogCont(dmxInfo, " fb/ptr"); if (pDevice->intfeed) dmxLogCont(dmxInfo, " fb/int"); if (pDevice->stringfeed) dmxLogCont(dmxInfo, " fb/str"); if (pDevice->bell) dmxLogCont(dmxInfo, " fb/bel"); if (pDevice->leds) dmxLogCont(dmxInfo, " fb/led"); if (!pDevice->key && !pDevice->valuator && !pDevice->button && !pDevice->focus && !pDevice->kbdfeed && !pDevice->ptrfeed && !pDevice->intfeed && !pDevice->stringfeed && !pDevice->bell && !pDevice->leds) dmxLogCont(dmxInfo, " (none)"); dmxLogCont(dmxInfo, "\t[i%d/%*.*s", dmxInput->inputIdx, len, len, dmxInput->name); if (dmxInput->devs[i]->deviceId >= 0) dmxLogCont(dmxInfo, "/id%d", (int) dmxInput->devs[i]->deviceId); if (dmxInput->devs[i]->deviceName) dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName); dmxLogCont(dmxInfo, "] %s\n", dmxInput->devs[i]->isCore ? "core" : (dmxInput->devs[i]->sendsCore ? "extension (sends core events)" : "extension")); } } } } /** Detach an input */ int dmxInputDetach(DMXInputInfo * dmxInput) { int i; if (dmxInput->detached) return BadAccess; for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n", dmxLocal->pDevice->id, dmxLocal->pDevice->name, dmxLocal->isCore ? " [core]" : (dmxLocal->sendsCore ? " [sends core events]" : "")); DisableDevice(dmxLocal->pDevice, TRUE); } dmxInput->detached = True; dmxInputLogDevices(); return 0; } /** Search for input associated with \a dmxScreen, and detach. */ void dmxInputDetachAll(DMXScreenInfo * dmxScreen) { int i; for (i = 0; i < dmxNumInputs; i++) { DMXInputInfo *dmxInput = &dmxInputs[i]; if (dmxInput->scrnIdx == dmxScreen->index) dmxInputDetach(dmxInput); } } /** Search for input associated with \a deviceId, and detach. */ int dmxInputDetachId(int id) { DMXInputInfo *dmxInput = dmxInputLocateId(id); if (!dmxInput) return BadValue; return dmxInputDetach(dmxInput); } DMXInputInfo * dmxInputLocateId(int id) { int i, j; for (i = 0; i < dmxNumInputs; i++) { DMXInputInfo *dmxInput = &dmxInputs[i]; for (j = 0; j < dmxInput->numDevs; j++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; if (dmxLocal->pDevice->id == id) return dmxInput; } } return NULL; } static int dmxInputAttachNew(DMXInputInfo * dmxInput, int *id) { dmxInputInit(dmxInput); InitAndStartDevices(); if (id && dmxInput->devs) *id = dmxInput->devs[0]->pDevice->id; dmxInputLogDevices(); return 0; } static int dmxInputAttachOld(DMXInputInfo * dmxInput, int *id) { int i; dmxInput->detached = False; for (i = 0; i < dmxInput->numDevs; i++) { DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; if (id) *id = dmxLocal->pDevice->id; dmxLogInput(dmxInput, "Attaching device id %d: %s%s\n", dmxLocal->pDevice->id, dmxLocal->pDevice->name, dmxLocal->isCore ? " [core]" : (dmxLocal->sendsCore ? " [sends core events]" : "")); EnableDevice(dmxLocal->pDevice, TRUE); } dmxInputLogDevices(); return 0; } int dmxInputAttachConsole(const char *name, int isCore, int *id) { DMXInputInfo *dmxInput; int i; for (i = 0; i < dmxNumInputs; i++) { dmxInput = &dmxInputs[i]; if (dmxInput->scrnIdx == -1 && dmxInput->detached && !strcmp(dmxInput->name, name)) { /* Found match */ dmxLogInput(dmxInput, "Reattaching detached console input\n"); return dmxInputAttachOld(dmxInput, id); } } /* No match found */ dmxInput = dmxConfigAddInput(xstrdup(name), isCore); dmxInput->freename = TRUE; dmxLogInput(dmxInput, "Attaching new console input\n"); return dmxInputAttachNew(dmxInput, id); } int dmxInputAttachBackend(int physicalScreen, int isCore, int *id) { DMXInputInfo *dmxInput; DMXScreenInfo *dmxScreen; int i; if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) return BadValue; for (i = 0; i < dmxNumInputs; i++) { dmxInput = &dmxInputs[i]; if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) { /* Found match */ if (!dmxInput->detached) return BadAccess; /* Already attached */ dmxScreen = &dmxScreens[physicalScreen]; if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */ dmxLogInput(dmxInput, "Reattaching detached backend input\n"); return dmxInputAttachOld(dmxInput, id); } } /* No match found */ dmxScreen = &dmxScreens[physicalScreen]; if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */ dmxInput = dmxConfigAddInput(dmxScreen->name, isCore); dmxLogInput(dmxInput, "Attaching new backend input\n"); return dmxInputAttachNew(dmxInput, id); } xorg-server-1.20.8/hw/dmx/input/dmxmap.c0000644000175000017500000001015613640201473015010 00000000000000/* * Copyright 2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith */ /** \file * * This file implements a mapping from remote XInput event types to Xdmx * XInput event types. * * The exglobals.h file defines global server-side variables with names * Device* to be integers that hold the value of the type of the * server-side XInput extension event. * * The client-side X11/extensions/XInput.h file defines macros with THE * EXACT SAME Device* names! * * Using those macros to extract remote server event type values from * the (opaque) XDevice structure is appropriate, but makes a direct * mapping to the Device* integers impossible. So we use the normalized * XI_Device* names for these routines. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmxinputinit.h" #include "dmxmap.h" /** Create a mapping from \a remoteEvent to \a serverEvent. The \a * remoteEvent is the type returned from the remote server. The \a * serverEvent is from the XI_* list of events in * include/extensions/XIproto.h. */ void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, int remoteEvent, int serverEvent) { int hash = remoteEvent & DMX_MAP_MASK; int i; /* Return if this has already been mapped */ if (dmxLocal->map[hash].remote == remoteEvent && dmxLocal->map[hash].server == serverEvent) return; if (dmxLocal->map[hash].remote) { dmxLocal->mapOptimize = 0; for (i = 0; i < DMX_MAP_ENTRIES; i++) { if (!dmxLocal->map[i].remote) { dmxLocal->map[i].remote = remoteEvent; dmxLocal->map[i].server = serverEvent; return; } } dmxLog(dmxWarning, "Out of map entries, cannot map remove event type %d\n", remoteEvent); } else { dmxLocal->map[hash].remote = remoteEvent; dmxLocal->map[hash].server = serverEvent; } } /** Remove all mappings there were inserted with #dmxMapInsert. */ void dmxMapClear(DMXLocalInputInfoPtr dmxLocal) { int i; for (i = 0; i < DMX_MAP_ENTRIES; i++) dmxLocal->map[i].remote = 0; dmxLocal->mapOptimize = 1; } /** Lookup a mapping for \a remoteEvent. The \a remoteEvent is the type * returned from the remote server. The return value is that which was * passed into #dmxMapInsert (i.e., a value from the XI_* list in * include/extensions/XIproto.h). If a mapping is not available, -1 is * returned. */ int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent) { int hash = remoteEvent & DMX_MAP_MASK; int serverEvent = -1; int i; if (dmxLocal->mapOptimize && dmxLocal->map[hash].remote == remoteEvent) { serverEvent = dmxLocal->map[hash].server; } else { for (i = 0; i < DMX_MAP_ENTRIES; i++) if (dmxLocal->map[i].remote == remoteEvent) { serverEvent = dmxLocal->map[hash].server; break; } } return serverEvent; } xorg-server-1.20.8/hw/dmx/input/dmxarg.h0000644000175000017500000000321713640201473015011 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to argument handling functions. \see dmxarg.c */ #ifndef _DMXARG_H_ #define _DMXARG_H_ typedef struct _dmxArg *dmxArg; extern dmxArg dmxArgCreate(void); extern void dmxArgFree(dmxArg a); extern void dmxArgAdd(dmxArg a, const char *string); extern const char *dmxArgV(dmxArg a, int item); extern int dmxArgC(dmxArg a); extern dmxArg dmxArgParse(const char *string); #endif xorg-server-1.20.8/hw/dmx/input/meson.build0000644000175000017500000000114713640201473015520 00000000000000srcs_dmx_input = [ 'dmxdummy.c', 'dmxbackend.c', 'dmxconsole.c', 'dmxcommon.c', 'dmxinputinit.c', 'dmxarg.c', 'dmxevents.c', 'dmxxinput.c', 'dmxmotion.c', 'dmxmap.c', 'ChkNotMaskEv.c', ] if cc.has_header('linux/input.h') srcs_dmx_input += [ 'usb-keyboard.c', 'usb-mouse.c', 'usb-other.c', 'usb-common.c', ] endif dmx_input = static_library('dmx_input', srcs_dmx_input, include_directories: [ inc, include_directories('../') ], dependencies: common_dep, c_args: '-DHAVE_DMX_CONFIG_H', ) xorg-server-1.20.8/hw/dmx/input/ChkNotMaskEv.h0000644000175000017500000000272413640201473016026 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface for #XCheckNotMaskEvent function. \see ChkNotMaskEv.c */ #ifndef _CHKNOTMASKEV_H_ #define _CHKNOTMASKEV_H_ extern Bool XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event); #endif xorg-server-1.20.8/hw/dmx/input/dmxcommon.c0000644000175000017500000005416713640201473015535 00000000000000/* * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * David H. Dawes * Kevin E. Martin * Rickard E. (Rik) Faith */ /** \file * * This file implements common routines used by the backend and console * input devices. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #define DMX_STATE_DEBUG 0 #include "dmxinputinit.h" #include "dmxcommon.h" #include "dmxconsole.h" #include "dmxprop.h" #include "dmxsync.h" #include "dmxmap.h" #include "inputstr.h" #include "input.h" #include #include "mipointer.h" #include "scrnintstr.h" #include /* For usleep() */ #if DMX_STATE_DEBUG #define DMXDBG0(f) dmxLog(dmxDebug,f) #else #define DMXDBG0(f) #endif /** Each device has a private area that is visible only from inside the * driver code. */ typedef struct _myPrivate { DMX_COMMON_PRIVATE; } myPrivate; static void dmxCommonKbdSetAR(Display * display, unsigned char *old, unsigned char *new) { XKeyboardControl kc; XKeyboardState ks; unsigned long mask = KBKey | KBAutoRepeatMode; int i, j; int minKeycode, maxKeycode; if (!old) { XGetKeyboardControl(display, &ks); old = (unsigned char *) ks.auto_repeats; } XDisplayKeycodes(display, &minKeycode, &maxKeycode); for (i = 1; i < 32; i++) { if (!old || old[i] != new[i]) { for (j = 0; j < 8; j++) { if ((new[i] & (1 << j)) != (old[i] & (1 << j))) { kc.key = i * 8 + j; kc.auto_repeat_mode = ((new[i] & (1 << j)) ? AutoRepeatModeOn : AutoRepeatModeOff); if (kc.key >= minKeycode && kc.key <= maxKeycode) XChangeKeyboardControl(display, mask, &kc); } } } } } static void dmxCommonKbdSetLeds(Display * display, unsigned long new) { int i; XKeyboardControl kc; for (i = 0; i < 32; i++) { kc.led = i + 1; kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff; XChangeKeyboardControl(display, KBLed | KBLedMode, &kc); } } static void dmxCommonKbdSetCtrl(Display * display, KeybdCtrl * old, KeybdCtrl * new) { XKeyboardControl kc; unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode; if (!old || old->click != new->click || old->autoRepeat != new->autoRepeat) { kc.key_click_percent = new->click; kc.auto_repeat_mode = new->autoRepeat; XChangeKeyboardControl(display, mask, &kc); } dmxCommonKbdSetLeds(display, new->leds); dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL, new->autoRepeats); } static void dmxCommonMouSetCtrl(Display * display, PtrCtrl * old, PtrCtrl * new) { Bool do_accel, do_threshold; if (!old || old->num != new->num || old->den != new->den || old->threshold != new->threshold) { do_accel = (new->num > 0 && new->den > 0); do_threshold = (new->threshold > 0); if (do_accel || do_threshold) { XChangePointerControl(display, do_accel, do_threshold, new->num, new->den, new->threshold); } } } /** Update the keyboard control. */ void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl) { GETPRIVFROMPDEV; if (!priv->stateSaved && priv->be) dmxCommonSaveState(priv); if (!priv->display || !priv->stateSaved) return; dmxCommonKbdSetCtrl(priv->display, priv->kctrlset ? &priv->kctrl : NULL, ctrl); priv->kctrl = *ctrl; priv->kctrlset = 1; } /** Update the mouse control. */ void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl) { GETPRIVFROMPDEV; /* Don't set the acceleration for the * console, because that should be * controlled by the X server that the * console is running on. Otherwise, * the acceleration for the console * window would be unexpected for the * scale of the window. */ if (priv->be) { dmxCommonMouSetCtrl(priv->display, priv->mctrlset ? &priv->mctrl : NULL, ctrl); priv->mctrl = *ctrl; priv->mctrlset = 1; } } /** Sound they keyboard bell. */ void dmxCommonKbdBell(DevicePtr pDev, int percent, int volume, int pitch, int duration) { GETPRIVFROMPDEV; XKeyboardControl kc; XKeyboardState ks; unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration; if (!priv->be) XGetKeyboardControl(priv->display, &ks); kc.bell_percent = volume; kc.bell_pitch = pitch; kc.bell_duration = duration; XChangeKeyboardControl(priv->display, mask, &kc); XBell(priv->display, percent); if (!priv->be) { kc.bell_percent = ks.bell_percent; kc.bell_pitch = ks.bell_pitch; kc.bell_duration = ks.bell_duration; XChangeKeyboardControl(priv->display, mask, &kc); } } /** Get the keyboard mapping. */ void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) { GETPRIVFROMPDEV; int min_keycode; int max_keycode; int map_width; KeySym *keyboard_mapping; XModifierKeymap *modifier_mapping; int i, j; /* Compute pKeySyms. Cast * XGetKeyboardMapping because of * compiler warning on 64-bit machines. * We assume pointers to 32-bit and * 64-bit ints are the same. */ XDisplayKeycodes(priv->display, &min_keycode, &max_keycode); keyboard_mapping = (KeySym *) XGetKeyboardMapping(priv->display, min_keycode, max_keycode - min_keycode + 1, &map_width); pKeySyms->minKeyCode = min_keycode; pKeySyms->maxKeyCode = max_keycode; pKeySyms->mapWidth = map_width; pKeySyms->map = keyboard_mapping; /* Compute pModMap */ modifier_mapping = XGetModifierMapping(priv->display); for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = 0; for (j = 0; j < 8; j++) { int max_keypermod = modifier_mapping->max_keypermod; for (i = 0; i < max_keypermod; i++) { CARD8 keycode = modifier_mapping->modifiermap[j * max_keypermod + i]; if (keycode) pModMap[keycode] |= 1 << j; } } XFreeModifiermap(modifier_mapping); } /** Fill in the XKEYBOARD parts of the \a info structure for the * specified \a pDev. */ void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; char *pt; dmxCommonSaveState(priv); if (priv->xkb) { #define NAME(x) \ priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL info->names.keycodes = NAME(keycodes); info->names.types = NAME(types); info->names.compat = NAME(compat); info->names.symbols = NAME(symbols); info->names.geometry = NAME(geometry); info->freenames = 1; #undef NAME dmxLogInput(dmxInput, "XKEYBOARD: keycodes = %s\n", info->names.keycodes); dmxLogInput(dmxInput, "XKEYBOARD: symbols = %s\n", info->names.symbols); dmxLogInput(dmxInput, "XKEYBOARD: geometry = %s\n", info->names.geometry); if ((pt = strchr(info->names.keycodes, '+'))) *pt = '\0'; } dmxCommonRestoreState(priv); } /** Turn \a pDev on (i.e., take input from \a pDev). */ int dmxCommonKbdOn(DevicePtr pDev) { GETPRIVFROMPDEV; if (priv->be) dmxCommonSaveState(priv); priv->eventMask |= DMX_KEYBOARD_EVENT_MASK; XSelectInput(priv->display, priv->window, priv->eventMask); if (priv->be) XSetInputFocus(priv->display, priv->window, RevertToPointerRoot, CurrentTime); return -1; } /** Turn \a pDev off. */ void dmxCommonKbdOff(DevicePtr pDev) { GETPRIVFROMPDEV; priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK; XSelectInput(priv->display, priv->window, priv->eventMask); dmxCommonRestoreState(priv); } /** Turn \a pDev on (i.e., take input from \a pDev). */ int dmxCommonOthOn(DevicePtr pDev) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES]; int event_type[DMX_MAX_XINPUT_EVENT_TYPES]; int count = 0; #define ADD(type) \ if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \ type(priv->xi, event_type[count], event_list[count]); \ if (event_type[count]) { \ dmxMapInsert(dmxLocal, event_type[count], XI_##type); \ ++count; \ } \ } else { \ dmxLog(dmxWarning, "More than %d event types for %s\n", \ DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \ } if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) { dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n", dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)", (int) dmxLocal->deviceId, dmxInput->name); return -1; } ADD(DeviceKeyPress); ADD(DeviceKeyRelease); ADD(DeviceButtonPress); ADD(DeviceButtonRelease); ADD(DeviceMotionNotify); ADD(DeviceFocusIn); ADD(DeviceFocusOut); ADD(ProximityIn); ADD(ProximityOut); ADD(DeviceStateNotify); ADD(DeviceMappingNotify); ADD(ChangeDeviceNotify); XSelectExtensionEvent(priv->display, priv->window, event_list, count); return -1; } /** Turn \a pDev off. */ void dmxCommonOthOff(DevicePtr pDev) { GETPRIVFROMPDEV; if (priv->xi) XCloseDevice(priv->display, priv->xi); priv->xi = NULL; } /** Fill the \a info structure with information needed to initialize \a * pDev. */ void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; XExtensionVersion *ext; XDeviceInfo *devices; Display *display = priv->display; int num; int i, j, k; XextErrorHandler handler; if (!display && !(display = XOpenDisplay(dmxInput->name))) return; /* Print out information about the XInput Extension. */ handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); ext = XGetExtensionVersion(display, INAME); XSetExtensionErrorHandler(handler); if (ext && ext != (XExtensionVersion *) NoSuchExtension) { XFree(ext); devices = XListInputDevices(display, &num); for (i = 0; i < num; i++) { if (devices[i].id == (XID) dmxLocal->deviceId) { XAnyClassPtr any; XKeyInfoPtr ki; XButtonInfoPtr bi; XValuatorInfoPtr vi; for (j = 0, any = devices[i].inputclassinfo; j < devices[i].num_classes; any = (XAnyClassPtr) ((char *) any + any->length), j++) { switch (any->class) { case KeyClass: ki = (XKeyInfoPtr) any; info->keyboard = 1; info->keyClass = 1; info->keySyms.minKeyCode = ki->min_keycode; info->keySyms.maxKeyCode = ki->max_keycode; info->kbdFeedbackClass = 1; break; case ButtonClass: bi = (XButtonInfoPtr) any; info->buttonClass = 1; info->numButtons = bi->num_buttons; info->ptrFeedbackClass = 1; break; case ValuatorClass: /* This assume all axes are either * Absolute or Relative. */ vi = (XValuatorInfoPtr) any; info->valuatorClass = 1; if (vi->mode == Absolute) info->numAbsAxes = vi->num_axes; else info->numRelAxes = vi->num_axes; for (k = 0; k < vi->num_axes; k++) { info->res[k] = vi->axes[k].resolution; info->minres[k] = vi->axes[k].resolution; info->maxres[k] = vi->axes[k].resolution; info->minval[k] = vi->axes[k].min_value; info->maxval[k] = vi->axes[k].max_value; } break; case FeedbackClass: /* Only keyboard and pointer feedback * are handled at this time. */ break; case ProximityClass: info->proximityClass = 1; break; case FocusClass: info->focusClass = 1; break; case OtherClass: break; } } } } XFreeDeviceList(devices); } if (display != priv->display) XCloseDisplay(display); } /** Obtain the mouse button mapping. */ void dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) { GETPRIVFROMPDEV; int i; *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS); for (i = 0; i <= *nButtons; i++) map[i] = i; } static void * dmxCommonXSelect(DMXScreenInfo * dmxScreen, void *closure) { myPrivate *priv = closure; XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask); return NULL; } static void dmxCommonFdNotify(int fd, int ready, void *data) { /* This should process input on this fd, but instead all * of that is delayed until the block and wakeup handlers are called */ ; } static void * dmxCommonAddEnabledDevice(DMXScreenInfo * dmxScreen, void *closure) { SetNotifyFd(XConnectionNumber(dmxScreen->beDisplay), dmxCommonFdNotify, X_NOTIFY_READ, closure); return NULL; } static void * dmxCommonRemoveEnabledDevice(DMXScreenInfo * dmxScreen, void *closure) { RemoveNotifyFd(XConnectionNumber(dmxScreen->beDisplay)); return NULL; } /** Turn \a pDev on (i.e., take input from \a pDev). */ int dmxCommonMouOn(DevicePtr pDev) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; priv->eventMask |= DMX_POINTER_EVENT_MASK; if (!priv->be) { XSelectInput(priv->display, priv->window, priv->eventMask); SetNotifyFd(XConnectionNumber(priv->display), dmxCommonFdNotify,X_NOTIFY_READ, pDev); } else { dmxPropertyIterate(priv->be, dmxCommonXSelect, priv); dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput); } return -1; } /** Turn \a pDev off. */ void dmxCommonMouOff(DevicePtr pDev) { GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; priv->eventMask &= ~DMX_POINTER_EVENT_MASK; if (!priv->be) { RemoveNotifyFd(XConnectionNumber(priv->display)); XSelectInput(priv->display, priv->window, priv->eventMask); } else { dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput); dmxPropertyIterate(priv->be, dmxCommonXSelect, priv); } } /** Given the global coordinates \a x and \a y, determine the screen * with the lowest number on which those coordinates lie. If they are * not on any screen, return -1. The number returned is an index into * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1, * inclusive. */ int dmxFindPointerScreen(int x, int y) { int i; for (i = 0; i < dmxNumScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; if (x >= pScreen->x && x < pScreen->x + pScreen->width && y >= pScreen->y && y < pScreen->y + pScreen->height) return i; } return -1; } /** Returns a pointer to the private area for the device that comes just * prior to \a pDevice in the current \a dmxInput device list. This is * used as the private area for the current device in some situations * (e.g., when a keyboard and mouse form a pair that should share the * same private area). If the requested private area cannot be located, * then NULL is returned. */ void * dmxCommonCopyPrivate(DeviceIntPtr pDevice) { GETDMXLOCALFROMPDEVICE; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; int i; for (i = 0; i < dmxInput->numDevs; i++) if (dmxInput->devs[i] == dmxLocal && i) return dmxInput->devs[i - 1]->private; return NULL; } /** This routine saves and resets some important state for the backend * and console device drivers: * - the modifier map is saved and set to 0 (so DMX controls the LEDs) * - the key click, bell, led, and repeat masks are saved and set to the * values that DMX claims to be using * * This routine and #dmxCommonRestoreState are used when the pointer * enters and leaves the console window, or when the backend window is * active or not active (for a full-screen window, this only happens at * server startup and server shutdown). */ void dmxCommonSaveState(void *private) { GETPRIVFROMPRIVATE; XKeyboardState ks; unsigned long i; XModifierKeymap *modmap; if (dmxInput->console) priv = dmxInput->devs[0]->private; if (!priv->display || priv->stateSaved) return; DMXDBG0("dmxCommonSaveState\n"); if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) { if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb) || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) { dmxLogInput(dmxInput, "Could not get XKB information\n"); XkbFreeKeyboard(priv->xkb, 0, True); priv->xkb = NULL; } else { if (priv->xkb->indicators) { priv->savedIndicators = *priv->xkb->indicators; for (i = 0; i < XkbNumIndicators; i++) if (priv->xkb->indicators->phys_indicators & (1 << i)) { priv->xkb->indicators->maps[i].flags = XkbIM_NoAutomatic; } XkbSetIndicatorMap(priv->display, ~0, priv->xkb); } } } XGetKeyboardControl(priv->display, &ks); priv->savedKctrl.click = ks.key_click_percent; priv->savedKctrl.bell = ks.bell_percent; priv->savedKctrl.bell_pitch = ks.bell_pitch; priv->savedKctrl.bell_duration = ks.bell_duration; priv->savedKctrl.leds = ks.led_mask; priv->savedKctrl.autoRepeat = ks.global_auto_repeat; for (i = 0; i < 32; i++) priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i]; dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl, &priv->dmxLocal->kctrl); priv->savedModMap = XGetModifierMapping(priv->display); modmap = XNewModifiermap(0); XSetModifierMapping(priv->display, modmap); if (dmxInput->scrnIdx != -1) dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE); XFreeModifiermap(modmap); priv->stateSaved = 1; } /** This routine restores all the information saved by #dmxCommonSaveState. */ void dmxCommonRestoreState(void *private) { GETPRIVFROMPRIVATE; int retcode = -1; CARD32 start; if (dmxInput->console) priv = dmxInput->devs[0]->private; if (!priv->stateSaved) return; priv->stateSaved = 0; DMXDBG0("dmxCommonRestoreState\n"); if (priv->xkb) { *priv->xkb->indicators = priv->savedIndicators; XkbSetIndicatorMap(priv->display, ~0, priv->xkb); XkbFreeKeyboard(priv->xkb, 0, True); priv->xkb = 0; } for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) { CARD32 tmp; retcode = XSetModifierMapping(priv->display, priv->savedModMap); if (retcode == MappingSuccess) break; if (retcode == MappingBusy) dmxLogInput(dmxInput, "Keyboard busy, waiting\n"); else dmxLogInput(dmxInput, "Keyboard error, waiting\n"); /* Don't generate X11 protocol for a bit */ for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) { usleep(250); /* This ends up sleeping only until * the next key press generates an * interruption. We make the delay * relatively short in case the user * pressed they keys quickly. */ } } if (retcode != MappingSuccess) dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n"); XFreeModifiermap(priv->savedModMap); priv->savedModMap = NULL; dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl); priv->kctrlset = 0; /* Invalidate copy */ } xorg-server-1.20.8/hw/dmx/Makefile.am0000644000175000017500000000404413640201473014252 00000000000000 SUBDIRS = input config examples doc doxygen man bin_PROGRAMS = Xdmx if XINERAMA PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c endif if GLX SUBDIRS += glxProxy GLX_LIBS = glxProxy/libglxproxy.a GLX_SRCS = $(PANORAMIX_SRCS) dmx_glxvisuals.c dmx_glxvisuals.h GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod GLX_DEFS = @GL_CFLAGS@ endif AM_CFLAGS = \ -DHAVE_DMX_CONFIG_H \ $(DIX_CFLAGS) \ $(GLX_INCS) \ $(GLX_DEFS) \ $(DMX_CFLAGS) \ @DMXMODULES_CFLAGS@ Xdmx_SOURCES = dmx.c \ dmxcb.c \ dmxcb.h \ dmxclient.h \ dmxcmap.c \ dmxcmap.h \ dmx-config.h \ dmxcursor.c \ dmxcursor.h \ dmxdpms.c \ dmxdpms.h \ dmxextension.c \ dmxextension.h \ dmxfont.c \ dmxfont.h \ dmxgc.c \ dmxgc.h \ dmxgcops.c \ dmxgcops.h \ dmx.h \ dmxinit.c \ dmxinit.h \ dmxinput.c \ dmxinput.h \ dmxlog.c \ dmxlog.h \ dmxpict.c \ dmxpict.h \ dmxpixmap.c \ dmxpixmap.h \ dmxprop.c \ dmxprop.h \ dmxscrinit.c \ dmxscrinit.h \ dmxstat.c \ dmxstat.h \ dmxsync.c \ dmxsync.h \ dmxvisual.c \ dmxvisual.h \ dmxwindow.c \ dmxwindow.h \ $(top_srcdir)/mi/miinitext.c \ $(GLX_SRCS) #if COMPOSITE #Xdmx_SOURCES += fakecw.c #endif XDMX_LIBS = \ $(GLX_LIBS) \ @XDMX_LIBS@ \ input/libdmxinput.a \ config/libdmxconfig.a Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) Xdmx_DEPENDENCIES= $(XDMX_LIBS) Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) relink: $(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT) xorg-server-1.20.8/hw/dmx/dmxgc.c0000644000175000017500000003166113640201473013471 00000000000000/* * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Kevin E. Martin * */ /** \file * This file provides support for GCs. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmx.h" #include "dmxsync.h" #include "dmxgc.h" #include "dmxgcops.h" #include "dmxpixmap.h" #include "dmxfont.h" #include "gcstruct.h" #include "pixmapstr.h" #include "migc.h" static const GCFuncs dmxGCFuncs = { dmxValidateGC, dmxChangeGC, dmxCopyGC, dmxDestroyGC, dmxChangeClip, dmxDestroyClip, dmxCopyClip, }; static const GCOps dmxGCOps = { dmxFillSpans, dmxSetSpans, dmxPutImage, dmxCopyArea, dmxCopyPlane, dmxPolyPoint, dmxPolylines, dmxPolySegment, dmxPolyRectangle, dmxPolyArc, dmxFillPolygon, dmxPolyFillRect, dmxPolyFillArc, dmxPolyText8, dmxPolyText16, dmxImageText8, dmxImageText16, dmxImageGlyphBlt, dmxPolyGlyphBlt, dmxPushPixels }; /** Initialize the GC on \a pScreen */ Bool dmxInitGC(ScreenPtr pScreen) { if (!dixRegisterPrivateKey (&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec))) return FALSE; return TRUE; } /** Create the GC on the back-end server. */ void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); int i; for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) { unsigned long mask; XGCValues gcvals; mask = GCGraphicsExposures; gcvals.graphics_exposures = FALSE; /* Create GC in the back-end servers */ pGCPriv->gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i], mask, &gcvals); break; } } } /** Create a graphics context on the back-end server associated /a pGC's * screen. */ Bool dmxCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); Bool ret; DMX_UNWRAP(CreateGC, dmxScreen, pScreen); if ((ret = pScreen->CreateGC(pGC))) { /* Save the old funcs */ pGCPriv->funcs = pGC->funcs; pGCPriv->ops = NULL; pGC->funcs = &dmxGCFuncs; if (dmxScreen->beDisplay) { dmxBECreateGC(pScreen, pGC); } else { pGCPriv->gc = NULL; } /* Check for "magic special case" * 1. see CreateGC in dix/gc.c for more info * 2. see dmxChangeGC for more info */ pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap); } DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); return ret; } /** Validate a graphics context, \a pGC, locally in the DMX server and * recompute the composite clip, if necessary. */ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); DMX_GC_FUNC_PROLOGUE(pGC); #if 0 pGC->funcs->ValidateGC(pGC, changes, pDrawable); #endif if (pDrawable->type == DRAWABLE_WINDOW || pDrawable->type == DRAWABLE_PIXMAP) { /* Save the old ops, since we're about to change the ops in the * epilogue. */ pGCPriv->ops = pGC->ops; } else { pGCPriv->ops = NULL; } /* If the client clip is different or moved OR the subwindowMode has * changed OR the window's clip has changed since the last * validation, then we need to recompute the composite clip. */ if ((changes & (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode)) || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { miComputeCompositeClip(pGC, pDrawable); } DMX_GC_FUNC_EPILOGUE(pGC); } /** Set the values in the graphics context on the back-end server * associated with \a pGC's screen. */ void dmxChangeGC(GCPtr pGC, unsigned long mask) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); XGCValues v; DMX_GC_FUNC_PROLOGUE(pGC); #if 0 pGC->funcs->ChangeGC(pGC, mask); #endif /* Handle "magic special case" from CreateGC */ if (pGCPriv->msc) { /* The "magic special case" is used to handle the case where a * foreground pixel is set when the GC is created so that a * "pseudo default-tile" can be created and used in case the * fillstyle was set to FillTiled. This specific case is tested * in xtest (XCreateGC test #3). What has happened in dix by * the time it reaches here is (1) the pGC->tile.pixel has been * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a * tile has also been set, then pGC->tileIsPixel is unset and * pGC->tile.pixmap is initialized; else, the default tile is * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is * initialized to the "pseudo default-tile". In either case, * pGC->tile.pixmap is set; however, in the "magic special case" * the mask is not updated to allow us to detect that we should * initialize the GCTile in the back-end server. Thus, we catch * this case in dmxCreateGC and add GCTile to the mask here. * Are there any cases that I've missed? */ /* Make sure that the tile.pixmap is set, just in case the user * set GCTile in the mask but forgot to set vals.pixmap */ if (pGC->tile.pixmap) mask |= GCTile; /* This only happens once when the GC is created */ pGCPriv->msc = FALSE; } /* Update back-end server's gc */ if (mask & GCFunction) v.function = pGC->alu; if (mask & GCPlaneMask) v.plane_mask = pGC->planemask; if (mask & GCForeground) v.foreground = pGC->fgPixel; if (mask & GCBackground) v.background = pGC->bgPixel; if (mask & GCLineWidth) v.line_width = pGC->lineWidth; if (mask & GCLineStyle) v.line_style = pGC->lineStyle; if (mask & GCCapStyle) v.cap_style = pGC->capStyle; if (mask & GCJoinStyle) v.join_style = pGC->joinStyle; if (mask & GCFillStyle) v.fill_style = pGC->fillStyle; if (mask & GCFillRule) v.fill_rule = pGC->fillRule; if (mask & GCTile) { if (pGC->tileIsPixel) { mask &= ~GCTile; } else { dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap); v.tile = (Drawable) pPixPriv->pixmap; } } if (mask & GCStipple) { dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple); v.stipple = (Drawable) pPixPriv->pixmap; } if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x; if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y; if (mask & GCFont) { if (dmxScreen->beDisplay) { dmxFontPrivPtr pFontPriv; pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex); v.font = pFontPriv->font[pScreen->myNum]->fid; } else { mask &= ~GCFont; } } if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode; /* Graphics exposures are not needed on the back-ends since they can be generated on the front-end thereby saving bandwidth. */ if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures; if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x; if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y; if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */ if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset; if (mask & GCDashList) { mask &= ~GCDashList; if (dmxScreen->beDisplay) XSetDashes(dmxScreen->beDisplay, pGCPriv->gc, pGC->dashOffset, (char *) pGC->dash, pGC->numInDashList); } if (mask & GCArcMode) v.arc_mode = pGC->arcMode; if (mask && dmxScreen->beDisplay) { XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v); dmxSync(dmxScreen, FALSE); } DMX_GC_FUNC_EPILOGUE(pGC); } /** Copy \a pGCSrc to \a pGCDst on the back-end server associated with * \a pGCSrc's screen. */ void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst) { ScreenPtr pScreen = pGCSrc->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc); dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst); DMX_GC_FUNC_PROLOGUE(pGCDst); pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst); /* Copy the GC on the back-end server */ if (dmxScreen->beDisplay) XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc); DMX_GC_FUNC_EPILOGUE(pGCDst); } /** Free the \a pGC on the back-end server. */ Bool dmxBEFreeGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); if (pGCPriv->gc) { XFreeGC(dmxScreen->beDisplay, pGCPriv->gc); pGCPriv->gc = NULL; return TRUE; } return FALSE; } /** Destroy the graphics context, \a pGC and free the corresponding GC * on the back-end server. */ void dmxDestroyGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; DMX_GC_FUNC_PROLOGUE(pGC); /* Free the GC on the back-end server */ if (dmxScreen->beDisplay) dmxBEFreeGC(pGC); pGC->funcs->DestroyGC(pGC); DMX_GC_FUNC_EPILOGUE(pGC); } /** Change the clip rects for a GC. */ void dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); XRectangle *pRects; BoxPtr pBox; int i, nRects; DMX_GC_FUNC_PROLOGUE(pGC); pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); /* Set the client clip on the back-end server */ if (!pGC->clientClip) { if (dmxScreen->beDisplay) XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); } else { if (dmxScreen->beDisplay) { nRects = RegionNumRects((RegionPtr) pGC->clientClip); pRects = xallocarray(nRects, sizeof(*pRects)); pBox = RegionRects((RegionPtr) pGC->clientClip); for (i = 0; i < nRects; i++) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; pRects[i].width = pBox[i].x2 - pBox[i].x1; pRects[i].height = pBox[i].y2 - pBox[i].y1; } XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc, pGC->clipOrg.x, pGC->clipOrg.y, pRects, nRects, Unsorted); free(pRects); } } DMX_GC_FUNC_EPILOGUE(pGC); } /** Destroy a GC's clip rects. */ void dmxDestroyClip(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); DMX_GC_FUNC_PROLOGUE(pGC); pGC->funcs->DestroyClip(pGC); /* Set the client clip on the back-end server to None */ if (dmxScreen->beDisplay) XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); DMX_GC_FUNC_EPILOGUE(pGC); } /** Copy a GC's clip rects. */ void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc) { DMX_GC_FUNC_PROLOGUE(pGCDst); pGCDst->funcs->CopyClip(pGCDst, pGCSrc); DMX_GC_FUNC_EPILOGUE(pGCDst); } xorg-server-1.20.8/hw/dmx/dmxvisual.c0000644000175000017500000001033713640201473014400 00000000000000/* * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Kevin E. Martin * */ /** \file * This file provides support for visuals. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmx.h" #include "dmxvisual.h" #include "scrnintstr.h" #ifdef GLXEXT #include extern VisualID glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig * configs, int nconfigs); static Visual * dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; int j; VisualID vid; vid = glxMatchVisualInConfigList(pScreen, pVisual, dmxScreen->glxVisuals, dmxScreen->numGlxVisuals); if (vid) { /* Find the X visual of the matching GLX visual */ for (j = 0; j < dmxScreen->beNumVisuals; j++) if (vid == dmxScreen->beVisuals[j].visualid) return dmxScreen->beVisuals[j].visual; } /* No matching visual found */ return NULL; } #endif /** Return the visual that matched \a pVisual. */ Visual * dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; int i; #ifdef GLXEXT Visual *retval; #endif if (!dmxScreen->beDisplay) return NULL; #ifdef GLXEXT if ((retval = dmxLookupGLXVisual(pScreen, pVisual))) return retval; #endif for (i = 0; i < dmxScreen->beNumVisuals; i++) { if (pVisual->class == dmxScreen->beVisuals[i].class && pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb && pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size && pVisual->nplanes == dmxScreen->beVisuals[i].depth && pVisual->redMask == dmxScreen->beVisuals[i].red_mask && pVisual->greenMask == dmxScreen->beVisuals[i].green_mask && pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) { return dmxScreen->beVisuals[i].visual; } } return NULL; } /** Return the visual that matched the \a vid. */ Visual * dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid) { Visual *visual; int i; if (!dmxScreens[pScreen->myNum].beDisplay) return NULL; for (i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].vid == vid) { visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]); if (visual) return visual; } } return NULL; } /** Return the colormap for the \a visual. */ Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual * visual) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; int i; if (dmxScreen->beDisplay) { for (i = 0; i < dmxScreen->beNumDefColormaps; i++) if (visual == dmxScreen->beVisuals[i].visual) return dmxScreen->beDefColormaps[i]; } return None; } xorg-server-1.20.8/hw/dmx/dmxwindow.h0000644000175000017500000001125013640201473014404 00000000000000/* * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Kevin E. Martin * */ /** \file * Interface for window support. \see dmxwindow.c */ #ifndef DMXWINDOW_H #define DMXWINDOW_H #include "windowstr.h" /** Window private area. */ typedef struct _dmxWinPriv { Window window; Bool offscreen; Bool mapped; Bool restacked; unsigned long attribMask; Colormap cmap; Visual *visual; Bool isShaped; Bool hasPict; #ifdef GLXEXT void *swapGroup; int barrier; void (*windowDestroyed) (WindowPtr); void (*windowUnmapped) (WindowPtr); #endif } dmxWinPrivRec, *dmxWinPrivPtr; extern Bool dmxInitWindow(ScreenPtr pScreen); extern Window dmxCreateRootWindow(WindowPtr pWindow); extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow, Colormap * cmap, Visual ** visual); extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync); extern Bool dmxCreateWindow(WindowPtr pWindow); extern Bool dmxDestroyWindow(WindowPtr pWindow); extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y); extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask); extern Bool dmxRealizeWindow(WindowPtr pWindow); extern Bool dmxUnrealizeWindow(WindowPtr pWindow); extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib); extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn); extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); extern void dmxResizeWindow(WindowPtr pWindow, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib); extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent); extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width); extern void dmxResizeScreenWindow(ScreenPtr pScreen, int x, int y, int w, int h); extern void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h); extern Bool dmxBEDestroyWindow(WindowPtr pWindow); /* Support for shape extension */ extern void dmxSetShape(WindowPtr pWindow, int kind); /** Get window private pointer. */ #define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \ dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey)) /* All of these macros are only used in dmxwindow.c */ #define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \ do { \ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \ DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \ if (pGCPriv->ops) \ DMX_UNWRAP(ops, pGCPriv, (_pGC)); \ } while (0) #define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \ do { \ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \ DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \ if (pGCPriv->ops) \ DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \ } while (0) #define DMX_WINDOW_X1(_pWin) \ ((_pWin)->drawable.x - wBorderWidth(_pWin)) #define DMX_WINDOW_Y1(_pWin) \ ((_pWin)->drawable.y - wBorderWidth(_pWin)) #define DMX_WINDOW_X2(_pWin) \ ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width) #define DMX_WINDOW_Y2(_pWin) \ ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height) #define DMX_WINDOW_OFFSCREEN(_pWin) \ (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \ DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \ DMX_WINDOW_X2(_pWin) <= 0 || \ DMX_WINDOW_Y2(_pWin) <= 0) #endif /* DMXWINDOW_H */ xorg-server-1.20.8/hw/dmx/dmxwindow.c0000644000175000017500000010345013640201473014403 00000000000000/* * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Kevin E. Martin * */ /** \file * This file provides support for window-related functions. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmx.h" #include "dmxsync.h" #include "dmxwindow.h" #include "dmxpixmap.h" #include "dmxcmap.h" #include "dmxvisual.h" #include "dmxinput.h" #include "dmxextension.h" #include "dmxpict.h" #include "windowstr.h" static void dmxDoRestackWindow(WindowPtr pWindow); static void dmxDoChangeWindowAttributes(WindowPtr pWindow, unsigned long *mask, XSetWindowAttributes * attribs); static void dmxDoSetShape(WindowPtr pWindow); /** Initialize the private area for the window functions. */ Bool dmxInitWindow(ScreenPtr pScreen) { if (!dixRegisterPrivateKey (&dmxWinPrivateKeyRec, PRIVATE_WINDOW, sizeof(dmxWinPrivRec))) return FALSE; return TRUE; } Window dmxCreateRootWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); Window parent; Visual *visual; unsigned long mask; XSetWindowAttributes attribs; ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; /* Create root window */ parent = dmxScreen->scrnWin; /* This is our "Screen" window */ visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual; dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), RT_COLORMAP, NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel; attribs.event_mask = ExposureMask; attribs.backing_store = NotUseful; attribs.colormap = pCmapPriv->cmap; attribs.border_pixel = 0; /* Incorporate new attributes, if needed */ if (pWinPriv->attribMask) { dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs); mask |= pWinPriv->attribMask; } return XCreateWindow(dmxScreen->beDisplay, parent, pWindow->origin.x - wBorderWidth(pWindow), pWindow->origin.y - wBorderWidth(pWindow), pWindow->drawable.width, pWindow->drawable.height, pWindow->borderWidth, pWindow->drawable.depth, pWindow->drawable.class, visual, mask, &attribs); } /** Change the location and size of the "screen" window. Called from * dmxextension.c dmxConfigureScreenWindow(). */ void dmxResizeScreenWindow(ScreenPtr pScreen, int x, int y, int w, int h) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; unsigned int m; XWindowChanges c; if (!dmxScreen->beDisplay) return; /* Handle resizing on back-end server */ m = CWX | CWY | CWWidth | CWHeight; c.x = x; c.y = y; c.width = w; c.height = h; XConfigureWindow(dmxScreen->beDisplay, dmxScreen->scrnWin, m, &c); dmxSync(dmxScreen, False); } /** Change the location and size of the "root" window. Called from * #dmxCreateWindow. */ void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h) { DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); unsigned int m; XWindowChanges c; /* Handle resizing on back-end server */ if (dmxScreen->beDisplay) { m = CWX | CWY | CWWidth | CWHeight; c.x = x; c.y = y; c.width = (w > 0) ? w : 1; c.height = (h > 0) ? h : 1; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); } if (w == 0 || h == 0) { if (pWinPriv->mapped) { if (dmxScreen->beDisplay) XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window); pWinPriv->mapped = FALSE; } } else if (!pWinPriv->mapped) { if (dmxScreen->beDisplay) XMapWindow(dmxScreen->beDisplay, pWinPriv->window); pWinPriv->mapped = TRUE; } if (dmxScreen->beDisplay) dmxSync(dmxScreen, False); } void dmxGetDefaultWindowAttributes(WindowPtr pWindow, Colormap * cmap, Visual ** visual) { ScreenPtr pScreen = pWindow->drawable.pScreen; if (pWindow->drawable.class != InputOnly && pWindow->optional && pWindow->optional->visual != wVisual(pWindow->parent)) { /* Find the matching visual */ *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow)); /* Handle optional colormaps */ if (pWindow->optional->colormap) { ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), RT_COLORMAP, NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); *cmap = pCmapPriv->cmap; } else { *cmap = dmxColormapFromDefaultVisual(pScreen, *visual); } } else { *visual = CopyFromParent; *cmap = (Colormap) 0; } } static Window dmxCreateNonRootWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); Window parent; unsigned long mask = 0L; XSetWindowAttributes attribs; dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent); /* Create window on back-end server */ parent = pParentPriv->window; /* The parent won't exist if this call to CreateNonRootWindow came from ReparentWindow and the grandparent window has not yet been created */ if (!parent) { dmxCreateAndRealizeWindow(pWindow->parent, FALSE); parent = pParentPriv->window; } /* Incorporate new attributes, if needed */ if (pWinPriv->attribMask) { dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs); mask |= pWinPriv->attribMask; } /* Add in default attributes */ if (pWindow->drawable.class != InputOnly) { mask |= CWBackingStore; attribs.backing_store = NotUseful; if (!(mask & CWColormap) && pWinPriv->cmap) { mask |= CWColormap; attribs.colormap = pWinPriv->cmap; if (!(mask & CWBorderPixel)) { mask |= CWBorderPixel; attribs.border_pixel = 0; } } } /* Handle case where subwindows are being mapped, but created out of order -- if current window has a previous sibling, then it cannot be created on top of the stack, so we must restack the windows */ pWinPriv->restacked = (pWindow->prevSib != NullWindow); return XCreateWindow(dmxScreen->beDisplay, parent, pWindow->origin.x - wBorderWidth(pWindow), pWindow->origin.y - wBorderWidth(pWindow), pWindow->drawable.width, pWindow->drawable.height, pWindow->borderWidth, pWindow->drawable.depth, pWindow->drawable.class, pWinPriv->visual, mask, &attribs); } /** This function handles lazy window creation and realization. Window * creation is handled by #dmxCreateNonRootWindow(). It also handles * any stacking changes that have occured since the window was * originally created by calling #dmxDoRestackWindow(). If the window * is shaped, the shape is set on the back-end server by calling * #dmxDoSetShape(), and if the window has pictures (from RENDER) * associated with it, those pictures are created on the back-end * server by calling #dmxCreatePictureList(). If \a doSync is TRUE, * then #dmxSync() is called. */ void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); if (!dmxScreen->beDisplay) return; pWinPriv->window = dmxCreateNonRootWindow(pWindow); if (pWinPriv->restacked) dmxDoRestackWindow(pWindow); if (pWinPriv->isShaped) dmxDoSetShape(pWindow); if (pWinPriv->hasPict) dmxCreatePictureList(pWindow); if (pWinPriv->mapped) XMapWindow(dmxScreen->beDisplay, pWinPriv->window); if (doSync) dmxSync(dmxScreen, False); } /** Create \a pWindow on the back-end server. If the lazy window * creation optimization is enabled, then the actual creation and * realization of the window is handled by * #dmxCreateAndRealizeWindow(). */ Bool dmxCreateWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); Bool ret = TRUE; DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); #if 0 if (pScreen->CreateWindow) ret = pScreen->CreateWindow(pWindow); #endif /* Set up the defaults */ pWinPriv->window = (Window) 0; pWinPriv->offscreen = TRUE; pWinPriv->mapped = FALSE; pWinPriv->restacked = FALSE; pWinPriv->attribMask = 0; pWinPriv->isShaped = FALSE; pWinPriv->hasPict = FALSE; #ifdef GLXEXT pWinPriv->swapGroup = NULL; pWinPriv->barrier = 0; #endif if (dmxScreen->beDisplay) { /* Only create the root window at this stage -- non-root windows are created when they are mapped and are on-screen */ if (!pWindow->parent) { dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pWindow); if (dmxScreen->scrnX != dmxScreen->rootX || dmxScreen->scrnY != dmxScreen->rootY || dmxScreen->scrnWidth != dmxScreen->rootWidth || dmxScreen->scrnHeight != dmxScreen->rootHeight) { dmxResizeRootWindow(pWindow, dmxScreen->rootX, dmxScreen->rootY, dmxScreen->rootWidth, dmxScreen->rootHeight); dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index], dmxScreen->rootX, dmxScreen->rootY, dmxScreen->rootWidth, dmxScreen->rootHeight); pWindow->origin.x = dmxScreen->rootX; pWindow->origin.y = dmxScreen->rootY; } } else { dmxGetDefaultWindowAttributes(pWindow, &pWinPriv->cmap, &pWinPriv->visual); if (dmxLazyWindowCreation) { /* Save parent's visual for use later */ if (pWinPriv->visual == CopyFromParent) pWinPriv->visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow->parent)); } else { pWinPriv->window = dmxCreateNonRootWindow(pWindow); } } dmxSync(dmxScreen, False); } DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); return ret; } /** Destroy \a pWindow on the back-end server. */ Bool dmxBEDestroyWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); if (pWinPriv->window) { XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window); pWinPriv->window = (Window) 0; return TRUE; } return FALSE; } /** Destroy \a pWindow on the back-end server. If any RENDER pictures were created, destroy them as well. */ Bool dmxDestroyWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; Bool ret = TRUE; Bool needSync = FALSE; #ifdef GLXEXT dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); #endif DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); /* Destroy any picture list associated with this window */ needSync |= dmxDestroyPictureList(pWindow); /* Destroy window on back-end server */ needSync |= dmxBEDestroyWindow(pWindow); if (needSync) dmxSync(dmxScreen, FALSE); #ifdef GLXEXT if (pWinPriv->swapGroup && pWinPriv->windowDestroyed) pWinPriv->windowDestroyed(pWindow); #endif if (pScreen->DestroyWindow) ret = pScreen->DestroyWindow(pWindow); DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); return ret; } /** Change the position of \a pWindow to be \a x, \a y. */ Bool dmxPositionWindow(WindowPtr pWindow, int x, int y) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; Bool ret = TRUE; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); unsigned int m; XWindowChanges c; DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); #if 0 if (pScreen->PositionWindow) ret = pScreen->PositionWindow(pWindow, x, y); #endif /* Determine if the window is completely off the visible portion of the screen */ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); /* If the window is now on-screen and it is mapped and it has not been created yet, create it and map it */ if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { dmxCreateAndRealizeWindow(pWindow, TRUE); } else if (pWinPriv->window) { /* Position window on back-end server */ m = CWX | CWY | CWWidth | CWHeight; c.x = pWindow->origin.x - wBorderWidth(pWindow); c.y = pWindow->origin.y - wBorderWidth(pWindow); c.width = pWindow->drawable.width; c.height = pWindow->drawable.height; if (pWindow->drawable.class != InputOnly) { m |= CWBorderWidth; c.border_width = pWindow->borderWidth; } XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); dmxSync(dmxScreen, False); } DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); return ret; } static void dmxDoChangeWindowAttributes(WindowPtr pWindow, unsigned long *mask, XSetWindowAttributes * attribs) { dmxPixPrivPtr pPixPriv; if (*mask & CWBackPixmap) { switch (pWindow->backgroundState) { case None: attribs->background_pixmap = None; break; case ParentRelative: attribs->background_pixmap = ParentRelative; break; case BackgroundPixmap: pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap); attribs->background_pixmap = pPixPriv->pixmap; break; case BackgroundPixel: *mask &= ~CWBackPixmap; break; } } if (*mask & CWBackPixel) { if (pWindow->backgroundState == BackgroundPixel) attribs->background_pixel = pWindow->background.pixel; else *mask &= ~CWBackPixel; } if (*mask & CWBorderPixmap) { if (pWindow->borderIsPixel) *mask &= ~CWBorderPixmap; else { pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap); attribs->border_pixmap = pPixPriv->pixmap; } } if (*mask & CWBorderPixel) { if (pWindow->borderIsPixel) attribs->border_pixel = pWindow->border.pixel; else *mask &= ~CWBorderPixel; } if (*mask & CWBitGravity) attribs->bit_gravity = pWindow->bitGravity; if (*mask & CWWinGravity) *mask &= ~CWWinGravity; /* Handled by dix */ if (*mask & CWBackingStore) *mask &= ~CWBackingStore; /* Backing store not supported */ if (*mask & CWBackingPlanes) *mask &= ~CWBackingPlanes; /* Backing store not supported */ if (*mask & CWBackingPixel) *mask &= ~CWBackingPixel; /* Backing store not supported */ if (*mask & CWOverrideRedirect) attribs->override_redirect = pWindow->overrideRedirect; if (*mask & CWSaveUnder) *mask &= ~CWSaveUnder; /* Save unders not supported */ if (*mask & CWEventMask) *mask &= ~CWEventMask; /* Events are handled by dix */ if (*mask & CWDontPropagate) *mask &= ~CWDontPropagate; /* Events are handled by dix */ if (*mask & CWColormap) { ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), RT_COLORMAP, NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); attribs->colormap = pCmapPriv->cmap; } if (*mask & CWCursor) *mask &= ~CWCursor; /* Handled by the cursor code */ } /** Change the window attributes of \a pWindow. */ Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; Bool ret = TRUE; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); XSetWindowAttributes attribs; DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); #if 0 if (pScreen->ChangeWindowAttributes) ret = pScreen->ChangeWindowAttributes(pWindow, mask); #endif /* Change window attribs on back-end server */ dmxDoChangeWindowAttributes(pWindow, &mask, &attribs); /* Save mask for lazy window creation optimization */ pWinPriv->attribMask |= mask; if (mask && pWinPriv->window) { XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window, mask, &attribs); dmxSync(dmxScreen, False); } DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, pScreen); return ret; } /** Realize \a pWindow on the back-end server. If the lazy window * creation optimization is enabled, the window is only realized when * it at least partially overlaps the screen. */ Bool dmxRealizeWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; Bool ret = TRUE; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); #if 0 if (pScreen->RealizeWindow) ret = pScreen->RealizeWindow(pWindow); #endif /* Determine if the window is completely off the visible portion of the screen */ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); /* If the window hasn't been created and it's not offscreen, then create it */ if (!pWinPriv->window && !pWinPriv->offscreen) { dmxCreateAndRealizeWindow(pWindow, FALSE); } if (pWinPriv->window) { /* Realize window on back-end server */ XMapWindow(dmxScreen->beDisplay, pWinPriv->window); dmxSync(dmxScreen, False); } /* Let the other functions know that the window is now mapped */ pWinPriv->mapped = TRUE; DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); dmxUpdateWindowInfo(DMX_UPDATE_REALIZE, pWindow); return ret; } /** Unrealize \a pWindow on the back-end server. */ Bool dmxUnrealizeWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; Bool ret = TRUE; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); #if 0 if (pScreen->UnrealizeWindow) ret = pScreen->UnrealizeWindow(pWindow); #endif if (pWinPriv->window) { /* Unrealize window on back-end server */ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window); dmxSync(dmxScreen, False); } /* When unrealized (i.e., unmapped), the window is always considered off of the visible portion of the screen */ pWinPriv->offscreen = TRUE; pWinPriv->mapped = FALSE; #ifdef GLXEXT if (pWinPriv->swapGroup && pWinPriv->windowUnmapped) pWinPriv->windowUnmapped(pWindow); #endif DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); dmxUpdateWindowInfo(DMX_UPDATE_UNREALIZE, pWindow); return ret; } static void dmxDoRestackWindow(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); WindowPtr pNextSib = pWindow->nextSib; unsigned int m; XWindowChanges c; if (pNextSib == NullWindow) { /* Window is at the bottom of the stack */ m = CWStackMode; c.sibling = (Window) 0; c.stack_mode = Below; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); } else { /* Window is not at the bottom of the stack */ dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib); /* Handle case where siblings have not yet been created due to lazy window creation optimization by first finding the next sibling in the sibling list that has been created (if any) and then putting the current window just above that sibling, and if no next siblings have been created yet, then put it at the bottom of the stack (since it might have a previous sibling that should be above it). */ while (!pNextSibPriv->window) { pNextSib = pNextSib->nextSib; if (pNextSib == NullWindow) { /* Window is at the bottom of the stack */ m = CWStackMode; c.sibling = (Window) 0; c.stack_mode = Below; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); return; } pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib); } m = CWStackMode | CWSibling; c.sibling = pNextSibPriv->window; c.stack_mode = Above; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); } } /** Handle window restacking. The actual restacking occurs in * #dmxDoRestackWindow(). */ void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); #if 0 if (pScreen->RestackWindow) pScreen->RestackWindow(pWindow, pOldNextSib); #endif if (pOldNextSib != pWindow->nextSib) { /* Track restacking for lazy window creation optimization */ pWinPriv->restacked = TRUE; /* Restack window on back-end server */ if (pWinPriv->window) { dmxDoRestackWindow(pWindow); dmxSync(dmxScreen, False); } } DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); dmxUpdateWindowInfo(DMX_UPDATE_RESTACK, pWindow); } static Bool dmxWindowExposurePredicate(Display * dpy, XEvent * ev, XPointer ptr) { return (ev->type == Expose && ev->xexpose.window == *(Window *) ptr); } /** Handle exposures on \a pWindow. Since window exposures are handled * in DMX, the events that are generated by the back-end server are * redundant, so we eat them here. */ void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); XEvent ev; DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); dmxSync(dmxScreen, False); if (pWinPriv->window) { while (XCheckIfEvent(dmxScreen->beDisplay, &ev, dmxWindowExposurePredicate, (XPointer) &pWinPriv->window)) { /* Handle expose events -- this should not be necessary since the base window in which the root window was created is guaranteed to be on top (override_redirect), so we should just swallow these events. If for some reason the window is not on top, then we'd need to collect these events and send them to the client later (e.g., during the block handler as Xnest does). */ } } #if 1 if (pScreen->WindowExposures) pScreen->WindowExposures(pWindow, prgn); #endif DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); } /** Move \a pWindow on the back-end server. Determine whether or not it * is on or offscreen, and realize it if it is newly on screen and the * lazy window creation optimization is enabled. */ void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); unsigned int m; XWindowChanges c; DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); #if 0 if (pScreen->CopyWindow) pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); #endif /* Determine if the window is completely off the visible portion of the screen */ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); /* If the window is now on-screen and it is mapped and it has not been created yet, create it and map it */ if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { dmxCreateAndRealizeWindow(pWindow, TRUE); } else if (pWinPriv->window) { /* Move window on back-end server */ m = CWX | CWY | CWWidth | CWHeight; c.x = pWindow->origin.x - wBorderWidth(pWindow); c.y = pWindow->origin.y - wBorderWidth(pWindow); c.width = pWindow->drawable.width; c.height = pWindow->drawable.height; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); dmxSync(dmxScreen, False); } DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); dmxUpdateWindowInfo(DMX_UPDATE_COPY, pWindow); } /** Resize \a pWindow on the back-end server. Determine whether or not * it is on or offscreen, and realize it if it is newly on screen and * the lazy window creation optimization is enabled. */ void dmxResizeWindow(WindowPtr pWindow, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); unsigned int m; XWindowChanges c; DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); #if 1 if (pScreen->ResizeWindow) pScreen->ResizeWindow(pWindow, x, y, w, h, pSib); #endif /* Determine if the window is completely off the visible portion of the screen */ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); /* If the window is now on-screen and it is mapped and it has not been created yet, create it and map it */ if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { dmxCreateAndRealizeWindow(pWindow, TRUE); } else if (pWinPriv->window) { /* Handle resizing on back-end server */ m = CWX | CWY | CWWidth | CWHeight; c.x = pWindow->origin.x - wBorderWidth(pWindow); c.y = pWindow->origin.y - wBorderWidth(pWindow); c.width = pWindow->drawable.width; c.height = pWindow->drawable.height; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); dmxSync(dmxScreen, False); } DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); dmxUpdateWindowInfo(DMX_UPDATE_RESIZE, pWindow); } /** Reparent \a pWindow on the back-end server. */ void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent); DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); #if 0 if (pScreen->ReparentWindow) pScreen->ReparentWindow(pWindow, pPriorParent); #endif if (pWinPriv->window) { if (!pParentPriv->window) { dmxCreateAndRealizeWindow(pWindow->parent, FALSE); } /* Handle reparenting on back-end server */ XReparentWindow(dmxScreen->beDisplay, pWinPriv->window, pParentPriv->window, pWindow->origin.x - wBorderWidth(pWindow), pWindow->origin.x - wBorderWidth(pWindow)); dmxSync(dmxScreen, False); } DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); dmxUpdateWindowInfo(DMX_UPDATE_REPARENT, pWindow); } /** Change border width for \a pWindow to \a width pixels. */ void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); unsigned int m; XWindowChanges c; DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); #if 1 if (pScreen->ChangeBorderWidth) pScreen->ChangeBorderWidth(pWindow, width); #endif /* NOTE: Do we need to check for on/off screen here? */ if (pWinPriv->window) { /* Handle border width change on back-end server */ m = CWBorderWidth; c.border_width = width; XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); dmxSync(dmxScreen, False); } DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); } static void dmxDoSetShape(WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); int nBox; BoxPtr pBox; int nRect; XRectangle *pRect; XRectangle *pRectFirst; /* First, set the bounding shape */ if (wBoundingShape(pWindow)) { pBox = RegionRects(wBoundingShape(pWindow)); nRect = nBox = RegionNumRects(wBoundingShape(pWindow)); pRectFirst = pRect = xallocarray(nRect, sizeof(*pRect)); while (nBox--) { pRect->x = pBox->x1; pRect->y = pBox->y1; pRect->width = pBox->x2 - pBox->x1; pRect->height = pBox->y2 - pBox->y1; pBox++; pRect++; } XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window, ShapeBounding, 0, 0, pRectFirst, nRect, ShapeSet, YXBanded); free(pRectFirst); } else { XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window, ShapeBounding, 0, 0, None, ShapeSet); } /* Next, set the clip shape */ if (wClipShape(pWindow)) { pBox = RegionRects(wClipShape(pWindow)); nRect = nBox = RegionNumRects(wClipShape(pWindow)); pRectFirst = pRect = xallocarray(nRect, sizeof(*pRect)); while (nBox--) { pRect->x = pBox->x1; pRect->y = pBox->y1; pRect->width = pBox->x2 - pBox->x1; pRect->height = pBox->y2 - pBox->y1; pBox++; pRect++; } XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window, ShapeClip, 0, 0, pRectFirst, nRect, ShapeSet, YXBanded); free(pRectFirst); } else { XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window, ShapeClip, 0, 0, None, ShapeSet); } if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) { ErrorF("Input selected for window %x on Screen %d\n", (unsigned int) pWinPriv->window, pScreen->myNum); } } /** Set shape of \a pWindow on the back-end server. */ void dmxSetShape(WindowPtr pWindow, int kind) { ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); DMX_UNWRAP(SetShape, dmxScreen, pScreen); #if 1 if (pScreen->SetShape) pScreen->SetShape(pWindow, kind); #endif if (pWinPriv->window) { /* Handle setting the current shape on the back-end server */ dmxDoSetShape(pWindow); dmxSync(dmxScreen, False); } else { pWinPriv->isShaped = TRUE; } DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); } xorg-server-1.20.8/hw/dmx/config/0000755000175000017500000000000013640201533013536 500000000000000xorg-server-1.20.8/hw/dmx/config/test-c.in0000644000175000017500000000001013640201473015177 00000000000000virtual xorg-server-1.20.8/hw/dmx/config/Makefile.am0000644000175000017500000000275713640201473015530 00000000000000SUBDIRS = man noinst_LIBRARIES = libdmxconfig.a LIBSRCS = parser.y \ scanner.l \ dmxparse.c \ dmxparse.h \ dmxprint.c \ dmxprint.h \ dmxcompat.c \ dmxcompat.h \ dmxconfig.c \ dmxconfig.h parser.h: parser.c scanner.c: scanner.l parser.h BUILT_SOURCES = parser.c parser.h scanner.c MAINTAINERCLEANFILES = $(BUILT_SOURCES) libdmxconfig_a_SOURCES = $(LIBSRCS) libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c if GLX GLX_DEFS = @GL_CFLAGS@ endif AM_YFLAGS = -d AM_CFLAGS = \ $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -DHAVE_DMX_CONFIG_H \ -DDMX_LOG_STANDALONE \ $(GLX_DEFS) \ @DMXMODULES_CFLAGS@ bin_PROGRAMS = xdmxconfig vdltodmx dmxtodmx xdmxconfig_DEPENDENCIES = libdmxconfig.a xdmxconfig_SOURCES = \ xdmxconfig.c \ $(top_srcdir)/hw/dmx/dmxlog.c \ Canvas.c \ Canvas.h \ CanvasP.h xdmxconfig_LDADD = -L. -ldmxconfig @XDMXCONFIG_DEP_LIBS@ xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@ vdltodmx_DEPENDENCIES = libdmxconfig.a vdltodmx_SOURCES = vdltodmx.c vdltodmx_LDADD = -L. -ldmxconfig dmxtodmx_DEPENDENCIES = libdmxconfig.a dmxtodmx_SOURCES = dmxtodmx.c dmxtodmx_LDADD = -L. -ldmxconfig EXTRA_DIST = \ test-a.in test-a.out \ test-b.in test-b.out \ test-c.in test-c.out \ test-d.in test-d.out \ test-e.in test-e.out \ test-f.in test-f.out \ test-g.in test-g.out \ test-h.in test-h.out \ test-i.in test-i.out \ test-j.in test-j.out \ test-k.in test-k.out \ test-l.in test-l.out xorg-server-1.20.8/hw/dmx/config/test-i.out0000644000175000017500000000004713640201473015420 00000000000000virtual a { param a b; # comment } xorg-server-1.20.8/hw/dmx/config/test-f.in0000644000175000017500000000001413640201473015206 00000000000000virtual { } xorg-server-1.20.8/hw/dmx/config/test-b.in0000644000175000017500000000001213640201473015200 00000000000000# comment xorg-server-1.20.8/hw/dmx/config/test-k.out0000644000175000017500000000006313640201473015420 00000000000000virtual a { option "+xinerama -syncbatch 0"; } xorg-server-1.20.8/hw/dmx/config/test-e.out0000644000175000017500000000017013640201473015411 00000000000000parse error on line 1 at token "display" syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...) xorg-server-1.20.8/hw/dmx/config/vdltodmx.c0000644000175000017500000000345113640201473015471 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ #include "dmxconfig.h" #include "dmxparse.h" #include "dmxprint.h" #include "dmxcompat.h" int main(int argc, char **argv) { DMXConfigEntryPtr entry; FILE *str; if (argc != 2 && argc != 3) { fprintf(stderr, "Usage: vdltodmx inFile [outFile]\n"); return 1; } if (argc == 2) { str = stdout; } else if (!(str = fopen(argv[2], "w"))) { fprintf(stderr, "Cannot open %s for write\n", argv[2]); return 2; } entry = dmxVDLRead(argv[1]); dmxConfigPrint(str, entry); return 0; } xorg-server-1.20.8/hw/dmx/config/test-a.in0000644000175000017500000000000613640201473015202 00000000000000error xorg-server-1.20.8/hw/dmx/config/test-d.in0000644000175000017500000000001013640201473015200 00000000000000display xorg-server-1.20.8/hw/dmx/config/Canvas.c0000644000175000017500000001347713640201473015054 00000000000000/* * 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 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * * This file was originally taken from xc/lib/Xaw/Template.c */ #include #include #include "CanvasP.h" static void CanvasInitialize(Widget request, Widget w, ArgList args, Cardinal * num_args) { } static void CanvasExpose(Widget w, XEvent * event, Region region) { CanvasExposeDataRec data; data.w = w; data.event = event; data.region = region; if (!XtIsRealized(w)) return; XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) &data); } static void CanvasResize(Widget w) { if (!XtIsRealized(w)) return; XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer) w); } static void CanvasAction(Widget w, XEvent * event, String * params, Cardinal * num_params) { XtCallCallbacks(w, XtNcallback, (XtPointer) event); } #define offset(field) XtOffsetOf(CanvasRec, canvas.field) static XtResource resources[] = { {XtNcallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL} , {(char *) XtNcanvasExposeCallback, (char *) XtCcanvasExposeCallback, XtRCallback, sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL} , {(char *) XtNcanvasResizeCallback, (char *) XtCcanvasResizeCallback, XtRCallback, sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL} , }; #undef offset static XtActionsRec actions[] = { {(char *) "canvas", CanvasAction}, }; static char translations[] = ": canvas()\n\ : canvas()\n\ : canvas()\n\ : canvas()\n\ "; #define Superclass (&widgetClassRec) CanvasClassRec canvasClassRec = { /* core */ { (WidgetClass) Superclass, /* superclass */ (char *) "Canvas", /* class_name */ sizeof(CanvasRec), /* widget_size */ NULL, /* class_initialize */ NULL, /* class_part_initialize */ False, /* class_inited */ CanvasInitialize, /* initialize */ NULL, /* initialize_hook */ XtInheritRealize, /* realize */ actions, /* actions */ XtNumber(actions), /* num_actions */ resources, /* resources */ XtNumber(resources), /* num_resources */ NULLQUARK, /* xrm_class */ True, /* compress_motion */ True, /* compress_exposure */ True, /* compress_enterleave */ False, /* visible_interest */ NULL, /* destroy */ CanvasResize, /* resize */ CanvasExpose, /* expose */ NULL, /* set_values */ NULL, /* set_values_hook */ XtInheritSetValuesAlmost, /* set_values_almost */ NULL, /* get_values_hook */ NULL, /* accept_focus */ XtVersion, /* version */ NULL, /* callback_private */ translations, /* tm_table */ XtInheritQueryGeometry, /* query_geometry */ XtInheritDisplayAccelerator, /* display_accelerator */ NULL, /* extension */ } , /* canvas */ { NULL, /* extension */ } }; WidgetClass canvasWidgetClass = (WidgetClass) &canvasClassRec; xorg-server-1.20.8/hw/dmx/config/scanner.l0000644000175000017500000001501713640201473015273 00000000000000/* $XFree86$ */ /* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ %{ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmxparse.h" #include "parser.h" #include "os.h" #include #include #include static int getdimension(int token, const char *text, int leng); static int getstring(int token, const char *text, int leng); static int gettoken(int token, const char *text, int leng); static int getcomment(int token, const char *text, int leng); static int lineno = 1; %} %s OTHER comment #.* word ([[:alpha:]_/:\-\+\.\*][[:alnum:]_/:\-\+\.\*]+) string \"(([^\"\n])|\"\")*\" badstring \"(([^\"\n])|\"\")* number [[:digit:]x]+ dimension [[:digit:]]+[[:blank:]]*x[[:blank:]]*[[:digit:]]+ offset [+-][[:digit:]]+[[:blank:]]*[+-][[:blank:]]*[[:digit:]]+ origin @[[:blank:]]*[[:digit:]]+[[:blank:]]*[[:blank:]]*x[[:digit:]]+ NL \n WS [[:blank:]]+ %% virtual return gettoken(T_VIRTUAL, yytext, yyleng); display return gettoken(T_DISPLAY, yytext, yyleng); wall return gettoken(T_WALL, yytext, yyleng); option return gettoken(T_OPTION, yytext, yyleng); param return gettoken(T_PARAM, yytext, yyleng); {dimension} return getdimension(T_DIMENSION, yytext, yyleng); {offset} return getdimension(T_OFFSET, yytext+1, yyleng-1); {origin} return getdimension(T_ORIGIN, yytext+1, yyleng-1); {word} return getstring(T_STRING, yytext, yyleng); {string} return getstring(T_STRING, yytext+1, yyleng-2); {NL} ++lineno; {WS} \{ return gettoken(yytext[0], yytext, yyleng); \} return gettoken(yytext[0], yytext, yyleng); \; return gettoken(yytext[0], yytext, yyleng); \/ return gettoken(yytext[0], yytext, yyleng); ^{comment} return getcomment(T_LINE_COMMENT, yytext, yyleng); {comment} return getcomment(T_COMMENT, yytext, yyleng); . return getstring(T_STRING, yytext, yyleng); <> return 0; %% int yywrap(void) { (void) &yyunput; (void) &input; return 1; } _X_NORETURN void yyerror(const char *message) { const char *pt, *end; struct _entry { const char *from; const char *to; } *entry, list[] = { { "T_VIRTUAL", "\"virtual\"" }, { "T_DISPLAY", "\"display\"" }, { "T_WALL", "\"wall\"" }, { "T_OPTION", "\"option\"" }, { "T_PARAM", "\"param\"" }, { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" }, { "T_OFFSET", "display offset (e.g., +10-10)" }, { "T_ORIGIN", "tile origin (e.g., @1280x1024)" }, { "T_STRING", "string" }, { "T_COMMENT", "comment (e.g., #...)" }, { "T_LINE_COMMENT", "comment (e.g., #...)" }, { NULL, NULL } }; fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n", lineno, (int)yyleng, (int)yyleng, yytext); end = message + strlen(message); for (pt = message; *pt; pt++) { if (pt[0] == 'T' && pt[1] == '_') { const char *next = strchr(pt, ' '); if (!next || !*next) next = strchr(pt, '\0'); if (!next) goto bail; --next; if (next-pt == 1 && next[1] && next[2] == '\'' && next[3] == '\'') { fprintf(stderr, "\"%c\"", next[1]); pt += 4; goto cnt; } for (entry = list; entry->from; ++entry) { if (!strncmp(entry->from, pt, strlen(entry->from))) { fprintf(stderr, "%s", entry->to); pt = next; goto cnt; } } } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3] && pt[4] == '\'' && pt[5] == '\'') { fprintf(stderr, "\"%c\"", pt[3]); pt += 5; } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') { fprintf(stderr, "\"%c\"", pt[1]); pt += 3; } bail: putc(*pt, stderr); cnt: ; } fprintf(stderr, "\n"); exit( 1 ); } static int getdimension(int token, const char *text, int leng) { char *endptr; char *tmp = dmxConfigAlloc(leng+1); int x, y; strlcpy(tmp, text, leng+1); x = strtol(tmp, &endptr, 10); while (*endptr && !isdigit(*endptr)) ++endptr; y = strtol(endptr, NULL, 10); dmxConfigFree(tmp); yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1); return token; } static int getstring(int token, const char *text, int leng) { yylval.string = dmxConfigCreateString(token, lineno, NULL, dmxConfigCopyString(leng ? text : "", leng)); return token; } static int gettoken(int token, const char *text, int leng) { yylval.token = dmxConfigCreateToken(token, lineno, NULL); return token; } static int getcomment(int token, const char *text, int leng) { yylval.comment = dmxConfigCreateComment(token, lineno, dmxConfigCopyString(text + 1, leng - 1)); return token; } xorg-server-1.20.8/hw/dmx/config/test-h.in0000644000175000017500000000012513640201473015213 00000000000000# comment a # comment b ## comment c # <-- tab # Next comment is empty # # Non empty xorg-server-1.20.8/hw/dmx/config/dmxconfig.h0000644000175000017500000000441613640201473015615 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface for DMX configuration file support. \see dmxconfig.c */ #ifndef _DMXCONFIG_H_ #define _DMXCONFIG_H_ #include extern void dmxConfigStoreDisplay(const char *display); extern void dmxConfigStoreInput(const char *input); /* Core devices */ extern void dmxConfigStoreXInput(const char *input); /* Non-core devices */ extern void dmxConfigStoreFile(const char *file); extern void dmxConfigStoreConfig(const char *config); extern void dmxConfigConfigure(void); extern void dmxConfigSetMaxScreens(void); extern void dmxConfigSetXkbRules(const char *rules); extern void dmxConfigSetXkbModel(const char *model); extern void dmxConfigSetXkbLayout(const char *layout); extern void dmxConfigSetXkbVariant(const char *variant); extern void dmxConfigSetXkbOptions(const char *options); extern char *dmxConfigGetXkbRules(void); extern char *dmxConfigGetXkbModel(void); extern char *dmxConfigGetXkbLayout(void); extern char *dmxConfigGetXkbVariant(void); extern char *dmxConfigGetXkbOptions(void); #endif xorg-server-1.20.8/hw/dmx/config/dmxcompat.c0000644000175000017500000001645613640201473015635 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith */ /** \file * This file provides some compatibility support for reading VDL files * that are used by xmovie * (http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml). * * This file is not used by the DMX server. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "os.h" #include "dmxconfig.h" #include "dmxparse.h" #include "dmxcompat.h" #include "parser.h" #include #include #include #include static int dmxVDLReadLine(FILE * str, char *buf, int len) { if (fgets(buf, len, str)) return strlen(buf); return 0; } static int dmxVDLCount(const char *buf) { return strtol(buf, NULL, 10); } static void dmxVDLVirtualEntry(const char *buf, char *name, int *len, int *x, int *y) { char *end; const char *s; char *d; int start; *x = strtol(buf, &end, 10); *y = strtol(end, &end, 10); for (s = end, d = name, start = 1; *s && *s != '['; ++s) { if (start && isspace(*s)) continue; *d++ = *s; start = 0; } *d = '\0'; while (d > name && isspace(d[-1])) *--d = '\0'; /* remove trailing space */ *len = strlen(name); } static void dmxVDLDisplayEntry(const char *buf, char *name, int *len, int *x, int *y, int *xoff, int *yoff, int *xorig, int *yorig) { const char *pt; char *end; pt = strchr(buf, ' '); strlcpy(name, buf, 1 + pt - buf); *len = strlen(name); *x = strtol(pt, &end, 10); *y = strtol(end, &end, 10); *xorig = strtol(end, &end, 10); *yorig = strtol(end, &end, 10); *xoff = strtol(end, &end, 10); *yoff = strtol(end, NULL, 10); } /** Read from the VDL format \a filename and return a newly allocated \a * DMXConfigEntryPtr */ DMXConfigEntryPtr dmxVDLRead(const char *filename) { FILE *str; char buf[2048]; /* RATS: Use ok */ char *pt; int lineno = 0; DMXConfigEntryPtr entry = NULL; DMXConfigVirtualPtr virtual = NULL; DMXConfigSubPtr sub = NULL; DMXConfigDisplayPtr display = NULL; DMXConfigFullDimPtr fdim = NULL; int dcount = 0; int icount = 0; int x, y, xoff, yoff, xorig, yorig; char name[2048]; /* RATS: Use ok */ const char *tmp; int len; enum { simulateFlag, virtualCount, virtualEntry, displayCount, displayEntry, ignoreCount, ignoreEntry } state = simulateFlag; if (!filename) str = stdin; else str = fopen(filename, "r"); if (!str) return NULL; while (dmxVDLReadLine(str, buf, sizeof(buf))) { DMXConfigCommentPtr comment = NULL; ++lineno; for (pt = buf; *pt; pt++) if (*pt == '\r' || *pt == '\n') { *pt = '\0'; break; } if (buf[0] == '#') { tmp = dmxConfigCopyString(buf + 1, strlen(buf + 1)); comment = dmxConfigCreateComment(T_COMMENT, lineno, tmp); entry = dmxConfigAddEntry(entry, dmxConfigComment, comment, NULL); continue; } switch (state) { case simulateFlag: state = virtualCount; break; case virtualCount: state = virtualEntry; break; case virtualEntry: len = sizeof(name); dmxVDLVirtualEntry(buf, name, &len, &x, &y); tmp = dmxConfigCopyString(name, len); virtual = dmxConfigCreateVirtual(NULL, dmxConfigCreateString(T_STRING, lineno, NULL, tmp), dmxConfigCreatePair(T_DIMENSION, lineno, NULL, x, y, 0, 0), NULL, NULL, NULL); state = displayCount; break; case displayCount: dcount = dmxVDLCount(buf); state = displayEntry; break; case displayEntry: dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff, &xorig, &yorig); tmp = dmxConfigCopyString(name, len); fdim = dmxConfigCreateFullDim(dmxConfigCreatePartDim (dmxConfigCreatePair (T_DIMENSION, lineno, NULL, x, y, 0, 0), dmxConfigCreatePair(T_OFFSET, lineno, NULL, xoff, yoff, xoff, yoff)), NULL); display = dmxConfigCreateDisplay(NULL, dmxConfigCreateString(T_STRING, lineno, NULL, tmp), fdim, dmxConfigCreatePair(T_ORIGIN, lineno, NULL, xorig, yorig, 0, 0), NULL); sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display)); if (!--dcount) { state = ignoreCount; virtual->subentry = sub; entry = dmxConfigAddEntry(entry, dmxConfigVirtual, NULL, virtual); virtual = NULL; sub = NULL; } break; case ignoreCount: icount = dmxVDLCount(buf); state = ignoreEntry; break; case ignoreEntry: if (!--icount) state = virtualEntry; break; } } if (str != stdin) fclose(str); return entry; } xorg-server-1.20.8/hw/dmx/config/test-g.out0000644000175000017500000000010613640201473015412 00000000000000virtual a { display d0:0 1280x1024; display d1:0 1280x1024; } xorg-server-1.20.8/hw/dmx/config/test-l.out0000644000175000017500000000050213640201473015417 00000000000000virtual a { display d0:0 1x2; display d1:0 +3+4; display d2:0 100x200 @1x1; display d3:0 +3+4 @2x2; display d4:0 100x200+3+4 @3x3; display d5:0 / 1x2+3+4; display d6:0 / 1x2; display d7:0 / +3+4; display d8:0 / 1x2+3+4 @4x4; display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100; } xorg-server-1.20.8/hw/dmx/config/test-f.out0000644000175000017500000000010513640201473015410 00000000000000parse error on line 2 at token "}" syntax error, unexpected "}"B} xorg-server-1.20.8/hw/dmx/config/test-i.in0000644000175000017500000000004713640201473015217 00000000000000virtual a { param a b; # comment } xorg-server-1.20.8/hw/dmx/config/dmxtodmx.c0000644000175000017500000000310213640201473015465 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * * This is a simple filter for testing. */ #include "dmxconfig.h" #include "dmxparse.h" #include "dmxprint.h" #include "dmxcompat.h" extern int yyparse(void); extern int yydebug; extern FILE *yyin; int main(int argc, char **argv) { yydebug = 0; yyparse(); dmxConfigPrint(stdout, dmxConfigEntry); return 0; } xorg-server-1.20.8/hw/dmx/config/parser.c0000644000175000017500000016273213640201533015131 00000000000000/* A Bison parser, made by GNU Bison 3.1. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Copy the first part of user declarations. */ #line 35 "parser.y" /* yacc.c:339 */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmxparse.h" #include #include #define YYDEBUG 1 #define YYERROR_VERBOSE #define YY_USE_PROTOS extern int yylex(void); DMXConfigEntryPtr dmxConfigEntry = NULL; #define APPEND(type, h, t) \ { \ type pt; \ for (pt = h; pt->next; pt = pt->next); \ pt->next = t; \ } #line 88 "parser.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "y.tab.h". */ #ifndef YY_YY_PARSER_H_INCLUDED # define YY_YY_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { T_VIRTUAL = 258, T_DISPLAY = 259, T_WALL = 260, T_OPTION = 261, T_PARAM = 262, T_STRING = 263, T_DIMENSION = 264, T_OFFSET = 265, T_ORIGIN = 266, T_COMMENT = 267, T_LINE_COMMENT = 268 }; #endif /* Tokens. */ #define T_VIRTUAL 258 #define T_DISPLAY 259 #define T_WALL 260 #define T_OPTION 261 #define T_PARAM 262 #define T_STRING 263 #define T_DIMENSION 264 #define T_OFFSET 265 #define T_ORIGIN 266 #define T_COMMENT 267 #define T_LINE_COMMENT 268 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 57 "parser.y" /* yacc.c:355 */ DMXConfigTokenPtr token; DMXConfigStringPtr string; DMXConfigNumberPtr number; DMXConfigPairPtr pair; DMXConfigFullDimPtr fdim; DMXConfigPartDimPtr pdim; DMXConfigDisplayPtr display; DMXConfigWallPtr wall; DMXConfigOptionPtr option; DMXConfigParamPtr param; DMXConfigCommentPtr comment; DMXConfigSubPtr subentry; DMXConfigVirtualPtr virtual; DMXConfigEntryPtr entry; #line 171 "parser.c" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_PARSER_H_INCLUDED */ /* Copy the second part of user declarations. */ #line 188 "parser.c" /* yacc.c:358 */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 13 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 106 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 18 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 25 /* YYNRULES -- Number of rules. */ #define YYNRULES 59 /* YYNSTATES -- Number of states. */ #define YYNSTATES 95 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 268 #define YYTRANSLATE(YYX) \ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 96, 96, 99, 100, 103, 104, 107, 109, 111, 113, 117, 118, 121, 122, 123, 124, 125, 128, 132, 134, 140, 141, 144, 148, 150, 152, 156, 158, 160, 164, 166, 168, 171, 173, 175, 177, 181, 183, 185, 189, 190, 193, 194, 197, 198, 201, 202, 205, 206, 209, 210, 213, 214, 217, 218, 221, 222, 225, 226 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "'{'", "'}'", "';'", "'/'", "T_VIRTUAL", "T_DISPLAY", "T_WALL", "T_OPTION", "T_PARAM", "T_STRING", "T_DIMENSION", "T_OFFSET", "T_ORIGIN", "T_COMMENT", "T_LINE_COMMENT", "$accept", "Program", "EntryList", "Entry", "Virtual", "SubList", "Sub", "OptionEntry", "ParamEntry", "ParamList", "Param", "PartialDim", "FullDim", "DisplayEntry", "WallEntry", "Display", "Name", "Dimension", "Offset", "Origin", "Terminal", "Open", "Close", "Wall", "NameList", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 123, 125, 59, 47, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268 }; # endif #define YYPACT_NINF -32 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-32))) #define YYTABLE_NINF -1 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int8 yypact[] = { -3, 41, -32, 22, -3, -32, -32, 12, 35, 46, 5, 62, 75, -32, -32, -32, -32, -32, 62, 75, 75, 51, 54, 59, 18, -32, 65, -32, -32, -32, -32, -32, 88, 37, 75, 65, 65, -32, -32, -32, 86, 59, 86, 61, -32, -32, 79, -4, 80, 28, 31, 74, 67, -32, -32, 37, 86, 65, -32, -32, -32, -32, 56, -32, 86, -32, -32, -32, -32, -32, -4, 81, 94, -32, 31, 94, -32, -32, 59, 86, -32, -32, -32, -32, -32, -32, -32, -32, 94, -32, -32, 86, -32, -32, -32 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 0, 6, 0, 2, 3, 5, 52, 42, 44, 0, 0, 0, 1, 4, 53, 43, 45, 0, 0, 0, 40, 56, 0, 0, 13, 0, 11, 16, 17, 14, 15, 0, 0, 0, 0, 0, 41, 57, 58, 0, 0, 0, 54, 12, 7, 50, 0, 46, 29, 0, 0, 25, 26, 36, 0, 0, 0, 9, 8, 59, 18, 0, 21, 0, 19, 55, 51, 28, 47, 0, 48, 0, 34, 0, 0, 35, 24, 0, 0, 39, 10, 22, 20, 23, 27, 49, 31, 0, 33, 32, 0, 38, 30, 37 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -32, -32, -32, 99, -32, 6, -19, -32, -32, -32, 42, -28, 55, -32, -32, -32, -1, 2, 53, -31, -27, 48, -30, -32, -22 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 3, 4, 5, 6, 26, 27, 28, 29, 62, 63, 49, 50, 30, 31, 32, 39, 52, 53, 72, 54, 12, 45, 33, 64 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 10, 40, 42, 11, 1, 58, 59, 44, 7, 9, 48, 56, 18, 61, 2, 65, 44, 44, 9, 68, 75, 7, 13, 73, 76, 35, 36, 81, 15, 80, 8, 51, 83, 79, 70, 55, 46, 84, 44, 60, 57, 60, 85, 88, 7, 87, 71, 89, 90, 8, 9, 16, 92, 8, 9, 60, 91, 78, 19, 20, 43, 93, 17, 60, 94, 7, 34, 37, 8, 43, 38, 8, 41, 21, 22, 23, 24, 66, 60, 46, 47, 48, 25, 21, 22, 23, 24, 9, 48, 71, 60, 46, 25, 46, 47, 67, 69, 86, 8, 46, 8, 9, 48, 14, 82, 77, 74 }; static const yytype_uint8 yycheck[] = { 1, 23, 24, 1, 7, 35, 36, 26, 3, 13, 14, 33, 10, 40, 17, 42, 35, 36, 13, 47, 51, 3, 0, 50, 51, 19, 20, 57, 16, 56, 12, 32, 62, 55, 6, 33, 5, 64, 57, 40, 34, 42, 70, 74, 3, 72, 15, 74, 75, 12, 13, 16, 79, 12, 13, 56, 78, 55, 10, 11, 4, 88, 16, 64, 91, 3, 18, 16, 12, 4, 16, 12, 24, 8, 9, 10, 11, 16, 79, 5, 6, 14, 17, 8, 9, 10, 11, 13, 14, 15, 91, 5, 17, 5, 6, 16, 16, 16, 12, 5, 12, 13, 14, 4, 62, 52, 51 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 7, 17, 19, 20, 21, 22, 3, 12, 13, 34, 35, 39, 0, 21, 16, 16, 16, 35, 39, 39, 8, 9, 10, 11, 17, 23, 24, 25, 26, 31, 32, 33, 41, 39, 23, 23, 16, 16, 34, 42, 39, 42, 4, 24, 40, 5, 6, 14, 29, 30, 34, 35, 36, 38, 35, 42, 23, 40, 40, 34, 38, 27, 28, 42, 38, 16, 16, 29, 16, 6, 15, 37, 38, 30, 37, 38, 36, 35, 42, 38, 40, 28, 40, 38, 29, 16, 38, 37, 38, 38, 42, 38, 38, 38 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 18, 19, 20, 20, 21, 21, 22, 22, 22, 22, 23, 23, 24, 24, 24, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 2, 1, 1, 4, 5, 5, 6, 1, 2, 1, 1, 1, 1, 1, 3, 3, 4, 1, 2, 2, 2, 1, 1, 3, 2, 1, 5, 4, 4, 4, 3, 3, 2, 5, 4, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { FILE *yyo = yyoutput; YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 96 "parser.y" /* yacc.c:1651 */ { dmxConfigEntry = (yyvsp[0].entry); } #line 1327 "parser.c" /* yacc.c:1651 */ break; case 4: #line 100 "parser.y" /* yacc.c:1651 */ { APPEND(DMXConfigEntryPtr,(yyvsp[-1].entry),(yyvsp[0].entry)); (yyval.entry) = (yyvsp[-1].entry); } #line 1333 "parser.c" /* yacc.c:1651 */ break; case 5: #line 103 "parser.y" /* yacc.c:1651 */ { (yyval.entry) = dmxConfigEntryVirtual((yyvsp[0].virtual)); } #line 1339 "parser.c" /* yacc.c:1651 */ break; case 6: #line 104 "parser.y" /* yacc.c:1651 */ { (yyval.entry) = dmxConfigEntryComment((yyvsp[0].comment)); } #line 1345 "parser.c" /* yacc.c:1651 */ break; case 7: #line 108 "parser.y" /* yacc.c:1651 */ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[-3].token), NULL, NULL, (yyvsp[-2].token), (yyvsp[-1].subentry), (yyvsp[0].token)); } #line 1351 "parser.c" /* yacc.c:1651 */ break; case 8: #line 110 "parser.y" /* yacc.c:1651 */ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[-4].token), NULL, (yyvsp[-3].pair), (yyvsp[-2].token), (yyvsp[-1].subentry), (yyvsp[0].token)); } #line 1357 "parser.c" /* yacc.c:1651 */ break; case 9: #line 112 "parser.y" /* yacc.c:1651 */ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[-4].token), (yyvsp[-3].string), NULL, (yyvsp[-2].token), (yyvsp[-1].subentry), (yyvsp[0].token)); } #line 1363 "parser.c" /* yacc.c:1651 */ break; case 10: #line 114 "parser.y" /* yacc.c:1651 */ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[-5].token), (yyvsp[-4].string), (yyvsp[-3].pair), (yyvsp[-2].token), (yyvsp[-1].subentry), (yyvsp[0].token) ); } #line 1369 "parser.c" /* yacc.c:1651 */ break; case 12: #line 118 "parser.y" /* yacc.c:1651 */ { APPEND(DMXConfigSubPtr,(yyvsp[-1].subentry),(yyvsp[0].subentry)); (yyval.subentry) = (yyvsp[-1].subentry); } #line 1375 "parser.c" /* yacc.c:1651 */ break; case 13: #line 121 "parser.y" /* yacc.c:1651 */ { (yyval.subentry) = dmxConfigSubComment((yyvsp[0].comment)); } #line 1381 "parser.c" /* yacc.c:1651 */ break; case 14: #line 122 "parser.y" /* yacc.c:1651 */ { (yyval.subentry) = dmxConfigSubDisplay((yyvsp[0].display)); } #line 1387 "parser.c" /* yacc.c:1651 */ break; case 15: #line 123 "parser.y" /* yacc.c:1651 */ { (yyval.subentry) = dmxConfigSubWall((yyvsp[0].wall)); } #line 1393 "parser.c" /* yacc.c:1651 */ break; case 16: #line 124 "parser.y" /* yacc.c:1651 */ { (yyval.subentry) = dmxConfigSubOption((yyvsp[0].option)); } #line 1399 "parser.c" /* yacc.c:1651 */ break; case 17: #line 125 "parser.y" /* yacc.c:1651 */ { (yyval.subentry) = dmxConfigSubParam((yyvsp[0].param)); } #line 1405 "parser.c" /* yacc.c:1651 */ break; case 18: #line 129 "parser.y" /* yacc.c:1651 */ { (yyval.option) = dmxConfigCreateOption((yyvsp[-2].token), (yyvsp[-1].string), (yyvsp[0].token)); } #line 1411 "parser.c" /* yacc.c:1651 */ break; case 19: #line 133 "parser.y" /* yacc.c:1651 */ { (yyval.param) = dmxConfigCreateParam((yyvsp[-2].token), NULL, (yyvsp[-1].string), NULL, (yyvsp[0].token)); } #line 1417 "parser.c" /* yacc.c:1651 */ break; case 20: #line 135 "parser.y" /* yacc.c:1651 */ { (yyval.param) = dmxConfigCreateParam((yyvsp[-3].token), (yyvsp[-2].token), NULL, (yyvsp[0].token), NULL); (yyval.param)->next = (yyvsp[-1].param); } #line 1425 "parser.c" /* yacc.c:1651 */ break; case 22: #line 141 "parser.y" /* yacc.c:1651 */ { APPEND(DMXConfigParamPtr,(yyvsp[-1].param),(yyvsp[0].param)); (yyval.param) = (yyvsp[-1].param); } #line 1431 "parser.c" /* yacc.c:1651 */ break; case 23: #line 145 "parser.y" /* yacc.c:1651 */ { (yyval.param) = dmxConfigCreateParam(NULL, NULL, (yyvsp[-1].string), NULL, (yyvsp[0].token)); } #line 1437 "parser.c" /* yacc.c:1651 */ break; case 24: #line 149 "parser.y" /* yacc.c:1651 */ { (yyval.pdim) = dmxConfigCreatePartDim((yyvsp[-1].pair), (yyvsp[0].pair)); } #line 1443 "parser.c" /* yacc.c:1651 */ break; case 25: #line 151 "parser.y" /* yacc.c:1651 */ { (yyval.pdim) = dmxConfigCreatePartDim((yyvsp[0].pair), NULL); } #line 1449 "parser.c" /* yacc.c:1651 */ break; case 26: #line 153 "parser.y" /* yacc.c:1651 */ { (yyval.pdim) = dmxConfigCreatePartDim(NULL, (yyvsp[0].pair)); } #line 1455 "parser.c" /* yacc.c:1651 */ break; case 27: #line 157 "parser.y" /* yacc.c:1651 */ { (yyval.fdim) = dmxConfigCreateFullDim((yyvsp[-2].pdim), (yyvsp[0].pdim)); } #line 1461 "parser.c" /* yacc.c:1651 */ break; case 28: #line 159 "parser.y" /* yacc.c:1651 */ { (yyval.fdim) = dmxConfigCreateFullDim(NULL, (yyvsp[0].pdim)); } #line 1467 "parser.c" /* yacc.c:1651 */ break; case 29: #line 161 "parser.y" /* yacc.c:1651 */ { (yyval.fdim) = dmxConfigCreateFullDim((yyvsp[0].pdim), NULL); } #line 1473 "parser.c" /* yacc.c:1651 */ break; case 30: #line 165 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-4].token), (yyvsp[-3].string), (yyvsp[-2].fdim), (yyvsp[-1].pair), (yyvsp[0].token)); } #line 1479 "parser.c" /* yacc.c:1651 */ break; case 31: #line 167 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-3].token), NULL, (yyvsp[-2].fdim), (yyvsp[-1].pair), (yyvsp[0].token)); } #line 1485 "parser.c" /* yacc.c:1651 */ break; case 32: #line 169 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-3].token), (yyvsp[-2].string), NULL, (yyvsp[-1].pair), (yyvsp[0].token)); } #line 1491 "parser.c" /* yacc.c:1651 */ break; case 33: #line 172 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-3].token), (yyvsp[-2].string), (yyvsp[-1].fdim), NULL, (yyvsp[0].token)); } #line 1497 "parser.c" /* yacc.c:1651 */ break; case 34: #line 174 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-2].token), NULL, (yyvsp[-1].fdim), NULL, (yyvsp[0].token)); } #line 1503 "parser.c" /* yacc.c:1651 */ break; case 35: #line 176 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-2].token), (yyvsp[-1].string), NULL, NULL, (yyvsp[0].token)); } #line 1509 "parser.c" /* yacc.c:1651 */ break; case 36: #line 178 "parser.y" /* yacc.c:1651 */ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[-1].token), NULL, NULL, NULL, (yyvsp[0].token)); } #line 1515 "parser.c" /* yacc.c:1651 */ break; case 37: #line 182 "parser.y" /* yacc.c:1651 */ { (yyval.wall) = dmxConfigCreateWall((yyvsp[-4].token), (yyvsp[-3].pair), (yyvsp[-2].pair), (yyvsp[-1].string), (yyvsp[0].token)); } #line 1521 "parser.c" /* yacc.c:1651 */ break; case 38: #line 184 "parser.y" /* yacc.c:1651 */ { (yyval.wall) = dmxConfigCreateWall((yyvsp[-3].token), (yyvsp[-2].pair), NULL, (yyvsp[-1].string), (yyvsp[0].token)); } #line 1527 "parser.c" /* yacc.c:1651 */ break; case 39: #line 186 "parser.y" /* yacc.c:1651 */ { (yyval.wall) = dmxConfigCreateWall((yyvsp[-2].token), NULL, NULL, (yyvsp[-1].string), (yyvsp[0].token)); } #line 1533 "parser.c" /* yacc.c:1651 */ break; case 41: #line 190 "parser.y" /* yacc.c:1651 */ { (yyval.token) = (yyvsp[-1].token); (yyval.token)->comment = (yyvsp[0].comment)->comment; } #line 1539 "parser.c" /* yacc.c:1651 */ break; case 43: #line 194 "parser.y" /* yacc.c:1651 */ { (yyval.string) = (yyvsp[-1].string); (yyval.string)->comment = (yyvsp[0].comment)->comment; } #line 1545 "parser.c" /* yacc.c:1651 */ break; case 45: #line 198 "parser.y" /* yacc.c:1651 */ { (yyval.pair) = (yyvsp[-1].pair); (yyval.pair)->comment = (yyvsp[0].comment)->comment; } #line 1551 "parser.c" /* yacc.c:1651 */ break; case 47: #line 202 "parser.y" /* yacc.c:1651 */ { (yyval.pair) = (yyvsp[-1].pair); (yyval.pair)->comment = (yyvsp[0].comment)->comment; } #line 1557 "parser.c" /* yacc.c:1651 */ break; case 49: #line 206 "parser.y" /* yacc.c:1651 */ { (yyval.pair) = (yyvsp[-1].pair); (yyval.pair)->comment = (yyvsp[0].comment)->comment; } #line 1563 "parser.c" /* yacc.c:1651 */ break; case 51: #line 210 "parser.y" /* yacc.c:1651 */ { (yyval.token) = (yyvsp[-1].token); (yyval.token)->comment = (yyvsp[0].comment)->comment; } #line 1569 "parser.c" /* yacc.c:1651 */ break; case 53: #line 214 "parser.y" /* yacc.c:1651 */ { (yyval.token) = (yyvsp[-1].token); (yyval.token)->comment = (yyvsp[0].comment)->comment; } #line 1575 "parser.c" /* yacc.c:1651 */ break; case 55: #line 218 "parser.y" /* yacc.c:1651 */ { (yyval.token) = (yyvsp[-1].token); (yyval.token)->comment = (yyvsp[0].comment)->comment; } #line 1581 "parser.c" /* yacc.c:1651 */ break; case 57: #line 222 "parser.y" /* yacc.c:1651 */ { (yyval.token) = (yyvsp[-1].token); (yyval.token)->comment = (yyvsp[0].comment)->comment; } #line 1587 "parser.c" /* yacc.c:1651 */ break; case 59: #line 226 "parser.y" /* yacc.c:1651 */ { APPEND(DMXConfigStringPtr, (yyvsp[-1].string), (yyvsp[0].string)); (yyval.string) = (yyvsp[-1].string); } #line 1593 "parser.c" /* yacc.c:1651 */ break; #line 1597 "parser.c" /* yacc.c:1651 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } xorg-server-1.20.8/hw/dmx/config/test-e.in0000644000175000017500000000001113640201473015202 00000000000000display; xorg-server-1.20.8/hw/dmx/config/Makefile.in0000644000175000017500000013344413640201511015530 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = xdmxconfig$(EXEEXT) vdltodmx$(EXEEXT) dmxtodmx$(EXEEXT) subdir = hw/dmx/config ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libdmxconfig_a_AR = $(AR) $(ARFLAGS) libdmxconfig_a_LIBADD = am__objects_1 = parser.$(OBJEXT) scanner.$(OBJEXT) dmxparse.$(OBJEXT) \ dmxprint.$(OBJEXT) dmxcompat.$(OBJEXT) dmxconfig.$(OBJEXT) am_libdmxconfig_a_OBJECTS = $(am__objects_1) strlcpy.$(OBJEXT) libdmxconfig_a_OBJECTS = $(am_libdmxconfig_a_OBJECTS) am_dmxtodmx_OBJECTS = dmxtodmx.$(OBJEXT) dmxtodmx_OBJECTS = $(am_dmxtodmx_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_vdltodmx_OBJECTS = vdltodmx.$(OBJEXT) vdltodmx_OBJECTS = $(am_vdltodmx_OBJECTS) am_xdmxconfig_OBJECTS = xdmxconfig-xdmxconfig.$(OBJEXT) \ xdmxconfig-dmxlog.$(OBJEXT) xdmxconfig-Canvas.$(OBJEXT) xdmxconfig_OBJECTS = $(am_xdmxconfig_OBJECTS) xdmxconfig_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(xdmxconfig_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/dmxcompat.Po \ ./$(DEPDIR)/dmxconfig.Po ./$(DEPDIR)/dmxparse.Po \ ./$(DEPDIR)/dmxprint.Po ./$(DEPDIR)/dmxtodmx.Po \ ./$(DEPDIR)/parser.Po ./$(DEPDIR)/scanner.Po \ ./$(DEPDIR)/strlcpy.Po ./$(DEPDIR)/vdltodmx.Po \ ./$(DEPDIR)/xdmxconfig-Canvas.Po \ ./$(DEPDIR)/xdmxconfig-dmxlog.Po \ ./$(DEPDIR)/xdmxconfig-xdmxconfig.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/ylwrap am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ -e s/c++$$/h++/ -e s/c$$/h/ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) AM_V_YACC = $(am__v_YACC_@AM_V@) am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) am__v_YACC_0 = @echo " YACC " $@; am__v_YACC_1 = SOURCES = $(libdmxconfig_a_SOURCES) $(dmxtodmx_SOURCES) \ $(vdltodmx_SOURCES) $(xdmxconfig_SOURCES) DIST_SOURCES = $(libdmxconfig_a_SOURCES) $(dmxtodmx_SOURCES) \ $(vdltodmx_SOURCES) $(xdmxconfig_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/ylwrap TODO parser.c parser.h scanner.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man noinst_LIBRARIES = libdmxconfig.a LIBSRCS = parser.y \ scanner.l \ dmxparse.c \ dmxparse.h \ dmxprint.c \ dmxprint.h \ dmxcompat.c \ dmxcompat.h \ dmxconfig.c \ dmxconfig.h BUILT_SOURCES = parser.c parser.h scanner.c MAINTAINERCLEANFILES = $(BUILT_SOURCES) libdmxconfig_a_SOURCES = $(LIBSRCS) $(top_srcdir)/os/strlcpy.c @GLX_TRUE@GLX_DEFS = @GL_CFLAGS@ AM_YFLAGS = -d AM_CFLAGS = \ $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -DHAVE_DMX_CONFIG_H \ -DDMX_LOG_STANDALONE \ $(GLX_DEFS) \ @DMXMODULES_CFLAGS@ xdmxconfig_DEPENDENCIES = libdmxconfig.a xdmxconfig_SOURCES = \ xdmxconfig.c \ $(top_srcdir)/hw/dmx/dmxlog.c \ Canvas.c \ Canvas.h \ CanvasP.h xdmxconfig_LDADD = -L. -ldmxconfig @XDMXCONFIG_DEP_LIBS@ xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@ vdltodmx_DEPENDENCIES = libdmxconfig.a vdltodmx_SOURCES = vdltodmx.c vdltodmx_LDADD = -L. -ldmxconfig dmxtodmx_DEPENDENCIES = libdmxconfig.a dmxtodmx_SOURCES = dmxtodmx.c dmxtodmx_LDADD = -L. -ldmxconfig EXTRA_DIST = \ test-a.in test-a.out \ test-b.in test-b.out \ test-c.in test-c.out \ test-d.in test-d.out \ test-e.in test-e.out \ test-f.in test-f.out \ test-g.in test-g.out \ test-h.in test-h.out \ test-i.in test-i.out \ test-j.in test-j.out \ test-k.in test-k.out \ test-l.in test-l.out all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .l .lo .o .obj .y $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/config/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/dmx/config/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libdmxconfig.a: $(libdmxconfig_a_OBJECTS) $(libdmxconfig_a_DEPENDENCIES) $(EXTRA_libdmxconfig_a_DEPENDENCIES) $(AM_V_at)-rm -f libdmxconfig.a $(AM_V_AR)$(libdmxconfig_a_AR) libdmxconfig.a $(libdmxconfig_a_OBJECTS) $(libdmxconfig_a_LIBADD) $(AM_V_at)$(RANLIB) libdmxconfig.a dmxtodmx$(EXEEXT): $(dmxtodmx_OBJECTS) $(dmxtodmx_DEPENDENCIES) $(EXTRA_dmxtodmx_DEPENDENCIES) @rm -f dmxtodmx$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dmxtodmx_OBJECTS) $(dmxtodmx_LDADD) $(LIBS) vdltodmx$(EXEEXT): $(vdltodmx_OBJECTS) $(vdltodmx_DEPENDENCIES) $(EXTRA_vdltodmx_DEPENDENCIES) @rm -f vdltodmx$(EXEEXT) $(AM_V_CCLD)$(LINK) $(vdltodmx_OBJECTS) $(vdltodmx_LDADD) $(LIBS) xdmxconfig$(EXEEXT): $(xdmxconfig_OBJECTS) $(xdmxconfig_DEPENDENCIES) $(EXTRA_xdmxconfig_DEPENDENCIES) @rm -f xdmxconfig$(EXEEXT) $(AM_V_CCLD)$(xdmxconfig_LINK) $(xdmxconfig_OBJECTS) $(xdmxconfig_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcompat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconfig.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxparse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxprint.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxtodmx.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vdltodmx.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-Canvas.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-dmxlog.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-xdmxconfig.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< strlcpy.o: $(top_srcdir)/os/strlcpy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strlcpy.o -MD -MP -MF $(DEPDIR)/strlcpy.Tpo -c -o strlcpy.o `test -f '$(top_srcdir)/os/strlcpy.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcpy.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strlcpy.Tpo $(DEPDIR)/strlcpy.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/os/strlcpy.c' object='strlcpy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strlcpy.o `test -f '$(top_srcdir)/os/strlcpy.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcpy.c strlcpy.obj: $(top_srcdir)/os/strlcpy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strlcpy.obj -MD -MP -MF $(DEPDIR)/strlcpy.Tpo -c -o strlcpy.obj `if test -f '$(top_srcdir)/os/strlcpy.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcpy.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcpy.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strlcpy.Tpo $(DEPDIR)/strlcpy.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/os/strlcpy.c' object='strlcpy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strlcpy.obj `if test -f '$(top_srcdir)/os/strlcpy.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcpy.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcpy.c'; fi` xdmxconfig-xdmxconfig.o: xdmxconfig.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-xdmxconfig.o -MD -MP -MF $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo -c -o xdmxconfig-xdmxconfig.o `test -f 'xdmxconfig.c' || echo '$(srcdir)/'`xdmxconfig.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo $(DEPDIR)/xdmxconfig-xdmxconfig.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xdmxconfig.c' object='xdmxconfig-xdmxconfig.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-xdmxconfig.o `test -f 'xdmxconfig.c' || echo '$(srcdir)/'`xdmxconfig.c xdmxconfig-xdmxconfig.obj: xdmxconfig.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-xdmxconfig.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo -c -o xdmxconfig-xdmxconfig.obj `if test -f 'xdmxconfig.c'; then $(CYGPATH_W) 'xdmxconfig.c'; else $(CYGPATH_W) '$(srcdir)/xdmxconfig.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo $(DEPDIR)/xdmxconfig-xdmxconfig.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xdmxconfig.c' object='xdmxconfig-xdmxconfig.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-xdmxconfig.obj `if test -f 'xdmxconfig.c'; then $(CYGPATH_W) 'xdmxconfig.c'; else $(CYGPATH_W) '$(srcdir)/xdmxconfig.c'; fi` xdmxconfig-dmxlog.o: $(top_srcdir)/hw/dmx/dmxlog.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-dmxlog.o -MD -MP -MF $(DEPDIR)/xdmxconfig-dmxlog.Tpo -c -o xdmxconfig-dmxlog.o `test -f '$(top_srcdir)/hw/dmx/dmxlog.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/dmx/dmxlog.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdmxconfig-dmxlog.Tpo $(DEPDIR)/xdmxconfig-dmxlog.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/hw/dmx/dmxlog.c' object='xdmxconfig-dmxlog.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-dmxlog.o `test -f '$(top_srcdir)/hw/dmx/dmxlog.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/dmx/dmxlog.c xdmxconfig-dmxlog.obj: $(top_srcdir)/hw/dmx/dmxlog.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-dmxlog.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-dmxlog.Tpo -c -o xdmxconfig-dmxlog.obj `if test -f '$(top_srcdir)/hw/dmx/dmxlog.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/dmx/dmxlog.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/dmx/dmxlog.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdmxconfig-dmxlog.Tpo $(DEPDIR)/xdmxconfig-dmxlog.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/hw/dmx/dmxlog.c' object='xdmxconfig-dmxlog.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-dmxlog.obj `if test -f '$(top_srcdir)/hw/dmx/dmxlog.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/dmx/dmxlog.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/dmx/dmxlog.c'; fi` xdmxconfig-Canvas.o: Canvas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-Canvas.o -MD -MP -MF $(DEPDIR)/xdmxconfig-Canvas.Tpo -c -o xdmxconfig-Canvas.o `test -f 'Canvas.c' || echo '$(srcdir)/'`Canvas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdmxconfig-Canvas.Tpo $(DEPDIR)/xdmxconfig-Canvas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='Canvas.c' object='xdmxconfig-Canvas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-Canvas.o `test -f 'Canvas.c' || echo '$(srcdir)/'`Canvas.c xdmxconfig-Canvas.obj: Canvas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-Canvas.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-Canvas.Tpo -c -o xdmxconfig-Canvas.obj `if test -f 'Canvas.c'; then $(CYGPATH_W) 'Canvas.c'; else $(CYGPATH_W) '$(srcdir)/Canvas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdmxconfig-Canvas.Tpo $(DEPDIR)/xdmxconfig-Canvas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='Canvas.c' object='xdmxconfig-Canvas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-Canvas.obj `if test -f 'Canvas.c'; then $(CYGPATH_W) 'Canvas.c'; else $(CYGPATH_W) '$(srcdir)/Canvas.c'; fi` .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(LIBRARIES) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f parser.c -rm -f parser.h -rm -f scanner.c -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/dmxcompat.Po -rm -f ./$(DEPDIR)/dmxconfig.Po -rm -f ./$(DEPDIR)/dmxparse.Po -rm -f ./$(DEPDIR)/dmxprint.Po -rm -f ./$(DEPDIR)/dmxtodmx.Po -rm -f ./$(DEPDIR)/parser.Po -rm -f ./$(DEPDIR)/scanner.Po -rm -f ./$(DEPDIR)/strlcpy.Po -rm -f ./$(DEPDIR)/vdltodmx.Po -rm -f ./$(DEPDIR)/xdmxconfig-Canvas.Po -rm -f ./$(DEPDIR)/xdmxconfig-dmxlog.Po -rm -f ./$(DEPDIR)/xdmxconfig-xdmxconfig.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/dmxcompat.Po -rm -f ./$(DEPDIR)/dmxconfig.Po -rm -f ./$(DEPDIR)/dmxparse.Po -rm -f ./$(DEPDIR)/dmxprint.Po -rm -f ./$(DEPDIR)/dmxtodmx.Po -rm -f ./$(DEPDIR)/parser.Po -rm -f ./$(DEPDIR)/scanner.Po -rm -f ./$(DEPDIR)/strlcpy.Po -rm -f ./$(DEPDIR)/vdltodmx.Po -rm -f ./$(DEPDIR)/xdmxconfig-Canvas.Po -rm -f ./$(DEPDIR)/xdmxconfig-dmxlog.Po -rm -f ./$(DEPDIR)/xdmxconfig-xdmxconfig.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: $(am__recursive_targets) all check install install-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile parser.h: parser.c scanner.c: scanner.l parser.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/dmx/config/dmxprint.h0000644000175000017500000000300113640201473015471 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to DMX configuration file pretty-printer. \see dmxprint.c */ #ifndef _DMXPRINT_H_ #define _DMXPRINT_H_ void dmxConfigPrint(FILE * str, DMXConfigEntryPtr entry); void dmxConfigVirtualPrint(FILE * str, DMXConfigVirtualPtr p); #endif xorg-server-1.20.8/hw/dmx/config/test-g.in0000644000175000017500000000010613640201473015211 00000000000000virtual a { display d0:0 1280x1024; display d1:0 1280x1024; } xorg-server-1.20.8/hw/dmx/config/test-l.in0000644000175000017500000000050213640201473015216 00000000000000virtual a { display d0:0 1x2; display d1:0 +3+4; display d2:0 100x200 @1x1; display d3:0 +3+4 @2x2; display d4:0 100x200+3+4 @3x3; display d5:0 / 1x2+3+4; display d6:0 / 1x2; display d7:0 / +3+4; display d8:0 / 1x2+3+4 @4x4; display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100; } xorg-server-1.20.8/hw/dmx/config/TODO0000644000175000017500000000027413640201473014154 00000000000000Fri May 31 13:20:17 2002 1) Sanitize values from input boxes. 2) Add canvas colors to cavas widget resources or to command-line options. 3) Add ability to edit option line(s) and wall. xorg-server-1.20.8/hw/dmx/config/dmxconfig.c0000644000175000017500000004147713640201473015620 00000000000000/* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Provides interface for reading DMX configuration files and for * combining that information with command-line configuration parameters. */ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmx.h" #include "dmxinput.h" #include "dmxconfig.h" #include "dmxparse.h" #include "dmxlog.h" #include "dmxcb.h" #include "dmxstat.h" #include "parser.h" extern int yydebug; extern FILE *yyin; static char *dmxXkbRules; static char *dmxXkbModel; static char *dmxXkbLayout; static char *dmxXkbVariant; static char *dmxXkbOptions; /** Stores lists of configuration information. */ typedef struct DMXConfigListStruct { const char *name; struct DMXConfigListStruct *next; } DMXConfigList, *DMXConfigListPtr; /** This stucture stores the parsed configuration information. */ typedef struct DMXConfigCmdStruct { const char *filename; const char *config; DMXConfigList *displays; DMXConfigList *inputs; DMXConfigList *xinputs; } DMXConfigCmd, *DMXConfigCmdPtr; extern DMXConfigEntryPtr dmxConfigEntry; static DMXConfigCmd dmxConfigCmd; static int dmxDisplaysFromCommandLine; /** Make a note that \a display is the name of an X11 display that * should be initialized as a backend (output) display. Called from * #ddxProcessArgument. */ void dmxConfigStoreDisplay(const char *display) { DMXConfigListPtr entry = malloc(sizeof(*entry)); entry->name = strdup(display); entry->next = NULL; if (!dmxConfigCmd.displays) dmxConfigCmd.displays = entry; else { DMXConfigList *pt; for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next); if (!pt) dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n"); pt->next = entry; } ++dmxDisplaysFromCommandLine; } /** Make a note that \a input is the name of an X11 display that should * be used for input (either a backend or a console input device). */ void dmxConfigStoreInput(const char *input) { DMXConfigListPtr entry = malloc(sizeof(*entry)); entry->name = strdup(input); entry->next = NULL; if (!dmxConfigCmd.inputs) dmxConfigCmd.inputs = entry; else { DMXConfigList *pt; for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next); if (!pt) dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n"); pt->next = entry; } } /** Make a note that \a input is the name of an X11 display that should * be used for input from XInput extension devices. */ void dmxConfigStoreXInput(const char *input) { DMXConfigListPtr entry = malloc(sizeof(*entry)); entry->name = strdup(input); entry->next = NULL; if (!dmxConfigCmd.xinputs) dmxConfigCmd.xinputs = entry; else { DMXConfigList *pt; for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next); if (!pt) dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n"); pt->next = entry; } } /** Make a note that \a file is the configuration file. */ void dmxConfigStoreFile(const char *file) { if (dmxConfigCmd.filename) dmxLog(dmxFatal, "Only one -configfile allowed\n"); dmxConfigCmd.filename = strdup(file); } /** Make a note that \a config should be used as the configuration for * current instantiation of the DMX server. */ void dmxConfigStoreConfig(const char *config) { if (dmxConfigCmd.config) dmxLog(dmxFatal, "Only one -config allowed\n"); dmxConfigCmd.config = strdup(config); } static int dmxConfigReadFile(const char *filename, int debug) { FILE *str; if (!(str = fopen(filename, "r"))) return -1; dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename); yyin = str; yydebug = debug; yyparse(); fclose(str); return 0; } static const char * dmxConfigMatch(const char *target, DMXConfigEntryPtr entry) { DMXConfigVirtualPtr v = entry->virtual; const char *name = NULL; if (v && v->name) name = v->name; if (v && !dmxConfigCmd.config) return v->name ? v->name : ""; if (!name) return NULL; if (!strcmp(name, target)) return name; return NULL; } static DMXScreenInfo * dmxConfigAddDisplay(const char *name, int scrnWidth, int scrnHeight, int scrnX, int scrnY, int scrnXSign, int scrnYSign, int rootWidth, int rootHeight, int rootX, int rootY, int rootXSign, int rootYSign) { DMXScreenInfo *dmxScreen; if (!(dmxScreens = reallocarray(dmxScreens, dmxNumScreens + 1, sizeof(*dmxScreens)))) dmxLog(dmxFatal, "dmxConfigAddDisplay: realloc failed for screen %d (%s)\n", dmxNumScreens, name); dmxScreen = &dmxScreens[dmxNumScreens]; memset(dmxScreen, 0, sizeof(*dmxScreen)); dmxScreen->name = name; dmxScreen->index = dmxNumScreens; dmxScreen->scrnWidth = scrnWidth; dmxScreen->scrnHeight = scrnHeight; dmxScreen->scrnX = scrnX; dmxScreen->scrnY = scrnY; dmxScreen->scrnXSign = scrnXSign; dmxScreen->scrnYSign = scrnYSign; dmxScreen->rootWidth = rootWidth; dmxScreen->rootHeight = rootHeight; dmxScreen->rootX = rootX; dmxScreen->rootY = rootY; dmxScreen->stat = dmxStatAlloc(); ++dmxNumScreens; return dmxScreen; } DMXInputInfo * dmxConfigAddInput(const char *name, int core) { DMXInputInfo *dmxInput; if (!(dmxInputs = reallocarray(dmxInputs, dmxNumInputs + 1, sizeof(*dmxInputs)))) dmxLog(dmxFatal, "dmxConfigAddInput: realloc failed for input %d (%s)\n", dmxNumInputs, name); dmxInput = &dmxInputs[dmxNumInputs]; memset(dmxInput, 0, sizeof(*dmxInput)); dmxInput->name = name; dmxInput->inputIdx = dmxNumInputs; dmxInput->scrnIdx = -1; dmxInput->core = core; ++dmxNumInputs; return dmxInput; } static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d) { DMXScreenInfo *dmxScreen; dmxScreen = dmxConfigAddDisplay(d->name, d->scrnWidth, d->scrnHeight, d->scrnX, d->scrnY, d->scrnXSign, d->scrnYSign, d->rootWidth, d->rootHeight, d->rootX, d->rootY, d->rootXSign, d->rootXSign); dmxScreen->where = PosAbsolute; dmxScreen->whereX = d->rootXOrigin; dmxScreen->whereY = d->rootYOrigin; } static void dmxConfigCopyFromWall(DMXConfigWallPtr w) { DMXConfigStringPtr pt; DMXScreenInfo *dmxScreen; int edge = dmxNumScreens; int last = dmxNumScreens; if (!w->xwall && !w->ywall) { /* Try to make it square */ int count; for (pt = w->nameList, count = 0; pt; pt = pt->next) ++count; w->xwall = sqrt(count) + .5; } for (pt = w->nameList; pt; pt = pt->next) { dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (pt == w->nameList) { /* Upper left */ dmxScreen->where = PosAbsolute; dmxScreen->whereX = 0; dmxScreen->whereY = 0; } else if (w->xwall) { /* Tile left to right, then top to bottom */ if (!((dmxNumScreens - 1) % w->xwall)) { dmxScreen->where = PosBelow; dmxScreen->whereRefScreen = edge; edge = dmxNumScreens - 1; } else { dmxScreen->where = PosRightOf; dmxScreen->whereRefScreen = last; } } else { /* Tile top to bottom, then left to right */ if (!((dmxNumScreens - 1) % w->ywall)) { dmxScreen->where = PosRightOf; dmxScreen->whereRefScreen = edge; edge = dmxNumScreens - 1; } else { dmxScreen->where = PosBelow; dmxScreen->whereRefScreen = last; } } last = dmxNumScreens - 1; if (dmxScreen->where == PosAbsolute) dmxLog(dmxInfo, "Added %s at %d %d\n", pt->string, dmxScreen->whereX, dmxScreen->whereY); else dmxLog(dmxInfo, "Added %s %s %s\n", pt->string, dmxScreen->where == PosBelow ? "below" : "right of", dmxScreens[dmxScreen->whereRefScreen].name); } } static void dmxConfigCopyFromOption(DMXConfigOptionPtr o) { DMXConfigStringPtr pt; int argc = 0; char **argv = NULL; if (serverGeneration != 1) return; /* FIXME: only do once, for now */ if (!o || !o->string) return; for (pt = o->option; pt; pt = pt->next) { if (pt->string) { ++argc; argv = reallocarray(argv, argc + 1, sizeof(*argv)); argv[argc] = (char *) pt->string; } } argv[0] = NULL; ProcessCommandLine(argc + 1, argv); free(argv); } static void dmxConfigCopyFromParam(DMXConfigParamPtr p) { const char **argv; int argc; if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) { dmxConfigSetXkbRules(argv[1]); } else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc)) && argc == 2) { dmxConfigSetXkbModel(argv[1]); } else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc)) && argc == 2) { dmxConfigSetXkbLayout(argv[1]); } else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc)) && argc == 2) { dmxConfigSetXkbVariant(argv[1]); } else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc)) && argc == 2) { dmxConfigSetXkbOptions(argv[1]); } } static void dmxConfigCopyData(DMXConfigVirtualPtr v) { DMXConfigSubPtr sub; if (v->dim) dmxSetWidthHeight(v->dim->x, v->dim->y); else dmxSetWidthHeight(0, 0); for (sub = v->subentry; sub; sub = sub->next) { switch (sub->type) { case dmxConfigDisplay: dmxConfigCopyFromDisplay(sub->display); break; case dmxConfigWall: dmxConfigCopyFromWall(sub->wall); break; case dmxConfigOption: dmxConfigCopyFromOption(sub->option); break; case dmxConfigParam: dmxConfigCopyFromParam(sub->param); break; default: dmxLog(dmxFatal, "dmxConfigCopyData: not a display, wall, or value\n"); } } } static void dmxConfigFromCommandLine(void) { DMXConfigListPtr pt; dmxLog(dmxInfo, "Using configuration from command line\n"); for (pt = dmxConfigCmd.displays; pt; pt = pt->next) { DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (dmxNumScreens == 1) { dmxScreen->where = PosAbsolute; dmxScreen->whereX = 0; dmxScreen->whereY = 0; dmxLog(dmxInfo, "Added %s at %d %d\n", dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY); } else { dmxScreen->where = PosRightOf; dmxScreen->whereRefScreen = dmxNumScreens - 2; if (dmxScreen->whereRefScreen < 0) dmxScreen->whereRefScreen = 0; dmxLog(dmxInfo, "Added %s %s %s\n", dmxScreen->name, dmxScreen->where == PosBelow ? "below" : "right of", dmxScreens[dmxScreen->whereRefScreen].name); } } } static void dmxConfigFromConfigFile(void) { DMXConfigEntryPtr pt; const char *name; for (pt = dmxConfigEntry; pt; pt = pt->next) { /* FIXME -- if an input is specified, use it */ if (pt->type != dmxConfigVirtual) continue; if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) { dmxLog(dmxInfo, "Using configuration \"%s\"\n", name); dmxConfigCopyData(pt->virtual); return; } } dmxLog(dmxFatal, "Could not find configuration \"%s\" in \"%s\"\n", dmxConfigCmd.config, dmxConfigCmd.filename); } static void dmxConfigConfigInputs(void) { DMXConfigListPtr pt; if (dmxNumInputs) return; if (dmxConfigCmd.inputs) { /* Use command line */ for (pt = dmxConfigCmd.inputs; pt; pt = pt->next) dmxConfigAddInput(pt->name, TRUE); } else if (dmxNumScreens) { /* Use first display */ dmxConfigAddInput(dmxScreens[0].name, TRUE); } else { /* Use dummy */ dmxConfigAddInput("dummy", TRUE); } if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */ for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next) dmxConfigAddInput(pt->name, FALSE); } } /** Set up the appropriate global variables so that the DMX server will * be initialized using the configuration specified in the config file * and on the command line. */ void dmxConfigConfigure(void) { if (dmxConfigEntry) { dmxConfigFreeEntry(dmxConfigEntry); dmxConfigEntry = NULL; } if (dmxConfigCmd.filename) { if (dmxConfigCmd.displays) dmxLog(dmxWarning, "Using configuration file \"%s\" instead of command line\n", dmxConfigCmd.filename); dmxConfigReadFile(dmxConfigCmd.filename, 0); dmxConfigFromConfigFile(); } else { if (dmxConfigCmd.config) dmxLog(dmxWarning, "Configuration name (%s) without configuration file\n", dmxConfigCmd.config); dmxConfigFromCommandLine(); } dmxConfigConfigInputs(); } /** This function determines the number of displays we WILL have and * sets MAXSCREENS to that value. This is difficult since the number * depends on the command line (which is easy to count) or on the config * file, which has to be parsed. */ void dmxConfigSetMaxScreens(void) { static int processing = 0; if (processing) return; /* Prevent reentry via ProcessCommandLine */ processing = 1; if (dmxConfigCmd.filename) { if (!dmxNumScreens) dmxConfigConfigure(); #ifndef MAXSCREENS SetMaxScreens(dmxNumScreens); #endif } else #ifndef MAXSCREENS SetMaxScreens(dmxDisplaysFromCommandLine); #endif processing = 0; } /** This macro is used to generate the following access methods: * - dmxConfig{Set,Get}rules * - dmxConfig{Set,Get}model * - dmxConfig{Set,Get}layout * - dmxConfig{Set,Get}variant * - dmxConfig{Set,Get}options * These methods are used to read and write information about the keyboard. */ #define GEN(param,glob,def) \ void dmxConfigSet##glob(const char *param) { \ if (dmx##glob) free((void *)dmx##glob); \ dmx##glob = strdup(param); \ } \ char *dmxConfigGet##glob(void) { \ return (char *)(dmx##glob ? dmx##glob : def); \ } GEN(rules, XkbRules, XKB_DFLT_RULES) GEN(model, XkbModel, XKB_DFLT_MODEL) GEN(layout, XkbLayout, XKB_DFLT_LAYOUT) GEN(variant, XkbVariant, XKB_DFLT_VARIANT) GEN(options, XkbOptions, XKB_DFLT_OPTIONS) xorg-server-1.20.8/hw/dmx/config/dmxparse.h0000644000175000017500000002651313640201473015464 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to DMX configuration file parser. \see dmxparse.c */ #ifndef _DMXPARSE_H_ #define _DMXPARSE_H_ #include /* For FILE */ #include /* For _X_ATTRIBUTE_PRINTF */ /** Stores tokens not stored in other structures (e.g., keywords and ;) */ typedef struct _DMXConfigToken { int token; int line; const char *comment; } DMXConfigToken, *DMXConfigTokenPtr; /** Stores parsed strings. */ typedef struct _DMXConfigString { int token; int line; const char *comment; const char *string; struct _DMXConfigString *next; } DMXConfigString, *DMXConfigStringPtr; /** Stores parsed numbers. */ typedef struct _DMXConfigNumber { int token; int line; const char *comment; int number; } DMXConfigNumber, *DMXConfigNumberPtr; /** Stores parsed pairs (e.g., x y) */ typedef struct _DMXConfigPair { int token; int line; const char *comment; int x; int y; int xsign; int ysign; } DMXConfigPair, *DMXConfigPairPtr; /** Stores parsed comments not stored with a token. */ typedef struct _DMXConfigComment { int token; int line; const char *comment; } DMXConfigComment, *DMXConfigCommentPtr; typedef enum { dmxConfigComment, dmxConfigVirtual, dmxConfigDisplay, dmxConfigWall, dmxConfigOption, dmxConfigParam } DMXConfigType; /** Stores a geometry specification. */ typedef struct _DMXConfigPartDim { DMXConfigPairPtr dim; DMXConfigPairPtr offset; } DMXConfigPartDim, *DMXConfigPartDimPtr; /** Stores a pair of geometry specifications. */ typedef struct _DMXConfigFullDim { DMXConfigPartDimPtr scrn; DMXConfigPartDimPtr root; } DMXConfigFullDim, *DMXConfigFullDimPtr; /** Stores parsed display information. */ typedef struct _DMXConfigDisplay { /* Summary information */ const char *name; /* Screen Window Geometry */ int scrnWidth, scrnHeight; int scrnX, scrnY; int scrnXSign, scrnYSign; /* Root Window Geometry */ int rootWidth, rootHeight; int rootX, rootY; int rootXSign, rootYSign; /* Origin in global space */ int rootXOrigin, rootYOrigin; /* Raw configuration information */ DMXConfigTokenPtr start; DMXConfigStringPtr dname; DMXConfigFullDimPtr dim; DMXConfigPairPtr origin; DMXConfigTokenPtr end; } DMXConfigDisplay, *DMXConfigDisplayPtr; /** Stores parsed wall information. */ typedef struct _DMXConfigWall { /* Summary information */ int width, height; /* dimensions of displays */ int xwall, ywall; /* dimensions of wall, in tiles */ /* Raw configuration informaiton */ DMXConfigTokenPtr start; DMXConfigPairPtr wallDim; DMXConfigPairPtr displayDim; DMXConfigStringPtr nameList; DMXConfigTokenPtr end; } DMXConfigWall, *DMXConfigWallPtr; /** Stores parsed option information. */ typedef struct _DMXConfigOption { /* Summary information */ char *string; /* Raw configuration informaiton */ DMXConfigTokenPtr start; DMXConfigStringPtr option; DMXConfigTokenPtr end; } DMXConfigOption, *DMXConfigOptionPtr; /** Stores parsed param information. */ typedef struct _DMXConfigParam { int argc; const char **argv; DMXConfigTokenPtr start; DMXConfigTokenPtr open; DMXConfigStringPtr param; DMXConfigTokenPtr close; DMXConfigTokenPtr end; /* Either open/close OR end */ struct _DMXConfigParam *next; } DMXConfigParam, *DMXConfigParamPtr; /** Stores options under an entry (subentry). */ typedef struct _DMXConfigSub { DMXConfigType type; DMXConfigCommentPtr comment; DMXConfigDisplayPtr display; DMXConfigWallPtr wall; DMXConfigOptionPtr option; DMXConfigParamPtr param; struct _DMXConfigSub *next; } DMXConfigSub, *DMXConfigSubPtr; /** Stores parsed virtual information. */ typedef struct _DMXConfigVirtual { /* Summary information */ const char *name; int width, height; /* Raw configuration information */ DMXConfigTokenPtr start; DMXConfigStringPtr vname; DMXConfigPairPtr dim; DMXConfigTokenPtr open; DMXConfigSubPtr subentry; DMXConfigTokenPtr close; } DMXConfigVirtual, *DMXConfigVirtualPtr; /** Heads entry storage. */ typedef struct _DMXConfigEntry { DMXConfigType type; DMXConfigCommentPtr comment; DMXConfigVirtualPtr virtual; struct _DMXConfigEntry *next; } DMXConfigEntry, *DMXConfigEntryPtr; extern DMXConfigEntryPtr dmxConfigEntry; extern void yyerror(const char *message); extern void dmxConfigLog(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,0); extern void *dmxConfigAlloc(unsigned long bytes); extern void *dmxConfigRealloc(void *orig, unsigned long orig_bytes, unsigned long bytes); extern const char *dmxConfigCopyString(const char *string, int length); extern void dmxConfigFree(void *area); extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, const char *comment); extern void dmxConfigFreeToken(DMXConfigTokenPtr p); extern DMXConfigStringPtr dmxConfigCreateString(int token, int line, const char *comment, const char *string); extern void dmxConfigFreeString(DMXConfigStringPtr p); extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line, const char *comment, int number); extern void dmxConfigFreeNumber(DMXConfigNumberPtr p); extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line, const char *comment, int x, int y, int xsign, int ysign); extern void dmxConfigFreePair(DMXConfigPairPtr p); extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line, const char *comment); extern void dmxConfigFreeComment(DMXConfigCommentPtr p); extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim, DMXConfigPairPtr pOffset); extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p); extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, DMXConfigPartDimPtr pRoot); extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p); extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, DMXConfigStringPtr pName, DMXConfigFullDimPtr pDim, DMXConfigPairPtr pOrigin, DMXConfigTokenPtr pEnd); extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p); extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart, DMXConfigPairPtr pWallDim, DMXConfigPairPtr pDisplayDim, DMXConfigStringPtr pNameList, DMXConfigTokenPtr pEnd); extern void dmxConfigFreeWall(DMXConfigWallPtr p); extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart, DMXConfigStringPtr pOption, DMXConfigTokenPtr pEnd); extern void dmxConfigFreeOption(DMXConfigOptionPtr p); extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart, DMXConfigTokenPtr pOpen, DMXConfigStringPtr pParam, DMXConfigTokenPtr pClose, DMXConfigTokenPtr pEnd); extern void dmxConfigFreeParam(DMXConfigParamPtr p); extern const char **dmxConfigLookupParam(DMXConfigParamPtr p, const char *key, int *argc); extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type, DMXConfigCommentPtr comment, DMXConfigDisplayPtr display, DMXConfigWallPtr wall, DMXConfigOptionPtr option, DMXConfigParamPtr param); extern void dmxConfigFreeSub(DMXConfigSubPtr sub); extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment); extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display); extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall); extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option); extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param); extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head, DMXConfigSubPtr sub); extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, DMXConfigStringPtr pName, DMXConfigPairPtr pDim, DMXConfigTokenPtr pOpen, DMXConfigSubPtr pSubentry, DMXConfigTokenPtr pClose); extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual); extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type, DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual); extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry); extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head, DMXConfigType type, DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual); extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment); extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual); #endif xorg-server-1.20.8/hw/dmx/config/dmxcompat.h0000644000175000017500000000275113640201473015633 00000000000000/* * Copyright 2002 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * Interface to VDL compatibility support. \see dmxcompat.c * * This file is not used by the DMX server. */ #ifndef _DMXCOMPAT_H_ #define _DMXCOMPAT_H_ extern DMXConfigEntryPtr dmxVDLRead(const char *filename); #endif xorg-server-1.20.8/hw/dmx/config/test-j.out0000644000175000017500000000044513640201473015423 00000000000000virtual a { option "aaa aa cc"; param { # comment 1 a b; c d; x y z; # comment 2 } param e f g h; # comment 3 param e f g hlskdjflskdfjsd #comment 4 flksdjf sldkfjsldkfjsdlf lsdkfjsldkfjlsdkjflskdjflsdkjfl lkjsdlfjsdlfkjsdlfj; } xorg-server-1.20.8/hw/dmx/config/CanvasP.h0000644000175000017500000000363413640201473015173 00000000000000/* Copyright 1987, 1998 The Open Group Copyright 2002 Red Hat Inc., Durham, North Carolina. 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. */ /* * Authors: * Rickard E. (Rik) Faith * * This file was originally taken from xc/lib/Xaw/TemplateP.h */ #ifndef _CanvasP_h #define _CanvasP_h #include "Canvas.h" /* include superclass private header file */ #include typedef struct { XtPointer extension; } CanvasClassPart; typedef struct _CanvasClassRec { CoreClassPart core_class; CanvasClassPart canvas_class; } CanvasClassRec; extern CanvasClassRec canvasClassRec; typedef struct { XtCallbackList input_callback; XtCallbackList expose_callback; XtCallbackList resize_callback; } CanvasPart; typedef struct _CanvasRec { CorePart core; CanvasPart canvas; } CanvasRec; #endif /* _CanvasP_h */ xorg-server-1.20.8/hw/dmx/config/man/0000755000175000017500000000000013640201533014311 500000000000000xorg-server-1.20.8/hw/dmx/config/man/Makefile.am0000644000175000017500000000013013640201473016262 00000000000000include $(top_srcdir)/manpages.am appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man xorg-server-1.20.8/hw/dmx/config/man/vdltodmx.man0000644000175000017500000000511013640201473016567 00000000000000.\" $XFree86$ .\" Copyright 2002 Red Hat Inc., Durham, North Carolina. .\" 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 on 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 .\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS .\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN .\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN .\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE .\" SOFTWARE. .\" .\" Authors: .\" Rickard E. (Rik) Faith .\" .TH vdltodmx 1 @vendorversion@ .SH NAME vdltodmx - dmx configuration file parser and printer .SH SYNOPSIS .B vdltodmx .I infile .I outfile .SH DESCRIPTION .I vdltodmx reads the input file, which should be in VDL configuration file format. After a successful parse, a file in Xdmx configuration file format is written to the output file. .P The VDL file format is used with .IR xmovie , which is available from http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html .SH EXAMPLE Given the following VDL-format file: .RS .nf 0 2 # # 2560 2048 Left two-thirds [restrict=*:2] 2 :2.1 1280 2048 0 0 0 0 :2.2 1280 2048 1280 0 0 0 4 1280 1024 0 0 1280 1024 0 1024 1280 1024 1280 0 1280 1024 1280 1024 # 2560 2048 Right two-thirds [restrict=*:2] 2 :2.2 1280 2048 0 0 0 0 :2.3 1280 2048 1280 0 0 0 4 1280 1024 1280 0 1280 1024 1280 1024 1280 1024 2560 0 1280 1024 2560 1024 .fi .RE the following DMX-format file will be produced: .RS .nf # # virtual "Left two-thirds" 2560x2048 { display :2.1 1280x2048; display :2.2 1280x2048 @1280x0; } # virtual "Right two-thirds" 2560x2048 { display :2.2 1280x2048; display :2.3 1280x2048 @1280x0; } .fi .RE .SH BUGS If the VDL file is not in the expected format, the program will probably dump core. .SH "SEE ALSO" Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1) xorg-server-1.20.8/hw/dmx/config/man/xdmxconfig.man0000644000175000017500000000524113640201473017101 00000000000000.\" $XFree86$ .\" Copyright 2002 Red Hat Inc., Durham, North Carolina. .\" 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 on 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 .\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS .\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN .\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN .\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE .\" SOFTWARE. .\" .\" Authors: .\" Rickard E. (Rik) Faith .\" .TH xdmxconfig 1 @vendorversion@ .SH NAME xdmxconfig - a graphical configuration tool for Xdmx configuration files .SH SYNOPSIS .B xdmxconfig [filename] .SH DESCRIPTION .I xdmxconfig reads, edits, and writes configuration files for the Xdmx server. The grammar for the configuration file is specified in the Xdmx(1) manual page. .PP To start from scratch, create a "New Global" and specify the name and overall dimensions for the configuration. Then use "New Display" to enter more displays. .PP If there is more than one configuration, the configuration name button will bring up a selection menu. .PP In the right-hand pannel, the left mouse button will move the highlighted display at "tool resolution"; the middle mouse button will move the highlighted display by a single pixel (at "wall resolution"); and the right mouse button will bring up a menu allowing the highlighted display to be edited or deleted. The arrow keys will also move the highlighted display by a single pixel. .SH BUGS Currently, entries with the .B wall keyword are not editable, but will be preserved in the new output file. The tool will quit when requested by the user, even if a configuration file has not been written out (i.e., without warning). The menu interaction should be improved (menu entries that don't currently work should be greyed-out, for example). The Help button does not work. .SH "SEE ALSO" Xdmx(1), vdltodmx(1) xorg-server-1.20.8/hw/dmx/config/man/dmxtodmx.man0000644000175000017500000000321713640201473016600 00000000000000.\" $XFree86$ .\" Copyright 2002 Red Hat Inc., Durham, North Carolina. .\" 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 on 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 .\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS .\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN .\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN .\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE .\" SOFTWARE. .\" .\" Authors: .\" Rickard E. (Rik) Faith .\" .TH dmxtodmx 1 @vendorversion@ .SH NAME dmxtodmx - dmx configuration file parser and printer .SH SYNOPSIS .B dmxtodmx .SH DESCRIPTION .I dmxtodmx reads the standard input, parsing a configuration file for the .I Xdmx distributed multi-head X server. After a successful parse, the file is pretty-printed to standard output. .SH "SEE ALSO" Xdmx(1), vdltodmx(1), xdmxconfig(1) xorg-server-1.20.8/hw/dmx/config/man/Makefile.in0000644000175000017500000006564613640201511016313 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = hw/dmx/config/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \ "$(DESTDIR)$(filemandir)" DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/manpages.am DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_CFLAGS = @BASE_CFLAGS@ BASE_FONT_PATH = @BASE_FONT_PATH@ BUILD_DATE = @BUILD_DATE@ BUILD_TIME = @BUILD_TIME@ BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ BUNDLE_VERSION = @BUNDLE_VERSION@ BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ DGA_LIBS = @DGA_LIBS@ DIX_CFLAGS = @DIX_CFLAGS@ DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ DMXMODULES_LIBS = @DMXMODULES_LIBS@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ FONT75DPIDIR = @FONT75DPIDIR@ FONTMISCDIR = @FONTMISCDIR@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GBM_CFLAGS = @GBM_CFLAGS@ GBM_LIBS = @GBM_LIBS@ GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ HAVE_DOT = @HAVE_DOT@ INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ KDRIVE_INCS = @KDRIVE_INCS@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ # xorg-macros.m4 has these bracketed by double underscores, but meson # wants ats. # Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS # 's|/,|/, |g' will add a space to help font path formatting MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \ -e 's|[@]mandir[@]|$(mandir)|g' -e \ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROJECTROOT = @PROJECTROOT@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XCONFIGDIR = @XCONFIGDIR@ XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ XKB_DFLT_RULES = @XKB_DFLT_RULES@ XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SGML_PATH = @XORG_SGML_PATH@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ XWAYLAND_LIBS = @XWAYLAND_LIBS@ XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ appmandir = $(APP_MAN_DIR) #appman_PRE = list of application man page files set by calling Makefile.am appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) drivermandir = $(DRIVER_MAN_DIR) #driverman_PRE = list of driver man page files set by calling Makefile.am driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) filemandir = $(FILE_MAN_DIR) #fileman_PRE = list of file man page files set by calling Makefile.am fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/config/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign hw/dmx/config/man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/manpages.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir) install-drivermanDATA: $(driverman_DATA) @$(NORMAL_INSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(drivermandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(drivermandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(drivermandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(drivermandir)" || exit $$?; \ done uninstall-drivermanDATA: @$(NORMAL_UNINSTALL) @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir) install-filemanDATA: $(fileman_DATA) @$(NORMAL_INSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \ done uninstall-filemanDATA: @$(NORMAL_UNINSTALL) @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-drivermanDATA \ install-filemanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-appmanDATA install-data \ install-data-am install-drivermanDATA install-dvi \ install-dvi-am install-exec install-exec-am \ install-filemanDATA install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-appmanDATA uninstall-drivermanDATA \ uninstall-filemanDATA .PRECIOUS: Makefile .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(DRIVER_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .man.$(FILE_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xorg-server-1.20.8/hw/dmx/config/test-a.out0000644000175000017500000000016313640201473015407 00000000000000parse error on line 1 at token "error" syntax error, unexpected string expecting "virtual" or comment (e.g., #...) xorg-server-1.20.8/hw/dmx/config/parser.y0000644000175000017500000001614713640201473015160 00000000000000/* $XFree86$ */ /* * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. * * 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 on 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 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ %{ #ifdef HAVE_DMX_CONFIG_H #include #endif #include "dmxparse.h" #include #include #define YYDEBUG 1 #define YYERROR_VERBOSE #define YY_USE_PROTOS extern int yylex(void); DMXConfigEntryPtr dmxConfigEntry = NULL; #define APPEND(type, h, t) \ { \ type pt; \ for (pt = h; pt->next; pt = pt->next); \ pt->next = t; \ } %} %union { DMXConfigTokenPtr token; DMXConfigStringPtr string; DMXConfigNumberPtr number; DMXConfigPairPtr pair; DMXConfigFullDimPtr fdim; DMXConfigPartDimPtr pdim; DMXConfigDisplayPtr display; DMXConfigWallPtr wall; DMXConfigOptionPtr option; DMXConfigParamPtr param; DMXConfigCommentPtr comment; DMXConfigSubPtr subentry; DMXConfigVirtualPtr virtual; DMXConfigEntryPtr entry; } /* Terminals */ %token '{' '}' ';' '/' T_VIRTUAL T_DISPLAY T_WALL T_OPTION T_PARAM %token T_STRING %token T_DIMENSION T_OFFSET T_ORIGIN %token T_COMMENT T_LINE_COMMENT /* Non-termials */ %type Display Wall Terminal Open Close %type NameList Name %type Dimension Offset Origin %type PartialDim %type FullDim %type DisplayEntry %type